@@ -36,21 +36,6 @@ static ScreenMenu()
3636 /// </summary>
3737 public Color DisabledTextColor { get ; set ; } = Config . ScreenMenu . DisabledTextColor ;
3838
39- /// <summary>
40- /// Gets or sets a value indicating whether the menu has a background.
41- /// </summary>
42- public bool Background { get ; set ; } = Config . ScreenMenu . Background ;
43-
44- /// <summary>
45- /// Gets or sets the height of the background.
46- /// </summary>
47- public float BackgroundHeight { get ; set ; } = Config . ScreenMenu . BackgroundHeight ;
48-
49- /// <summary>
50- /// Gets or sets the width of the background.
51- /// </summary>
52- public float BackgroundWidth { get ; set ; } = Config . ScreenMenu . BackgroundWidth ;
53-
5439 /// <summary>
5540 /// Gets or sets the font used for the text.
5641 /// </summary>
@@ -101,10 +86,22 @@ static ScreenMenu()
10186 /// </summary>
10287 /// <param name="player">The player to whom the menu is displayed.</param>
10388 /// <param name="time">The duration for which the menu is displayed.</param>
104- public override void Display ( CCSPlayerController player , int time = 0 )
89+ public override void Display ( CCSPlayerController player , int time )
10590 {
10691 MenuTime = time ;
107- MenuManager . OpenMenu ( player , this , ( p , m ) => new ScreenMenuInstance ( p , m ) ) ;
92+ MenuManager . OpenMenu ( player , this , null , ( p , m ) => new ScreenMenuInstance ( p , m ) ) ;
93+ }
94+
95+ /// <summary>
96+ /// Displays the menu to the specified player for a specified duration, starting from the given item.
97+ /// </summary>
98+ /// <param name="player">The player to whom the menu is displayed.</param>
99+ /// <param name="firstItem">The index of the first item to display.</param>
100+ /// <param name="time">The duration for which the menu is displayed.</param>
101+ public override void DisplayAt ( CCSPlayerController player , int firstItem , int time )
102+ {
103+ MenuTime = time ;
104+ MenuManager . OpenMenu ( player , this , firstItem , ( p , m ) => new ScreenMenuInstance ( p , m ) ) ;
108105 }
109106}
110107
@@ -115,11 +112,6 @@ public class ScreenMenuInstance : BaseMenuInstance
115112{
116113 private readonly Dictionary < string , Action > Buttons = [ ] ;
117114
118- /// <summary>
119- /// Gets or sets the index of the currently selected option.
120- /// </summary>
121- public int CurrentChoiceIndex ;
122-
123115 /// <summary>
124116 /// Gets the number of items displayed per page.
125117 /// </summary>
@@ -172,6 +164,7 @@ public override void Display()
172164
173165 List < ( string Text , int GlobalIndex , bool disabled ) > visibleOptions = GetVisibleOptions ( ) ;
174166
167+ int maxLength = 0 ;
175168 for ( int i = 0 ; i < visibleOptions . Count ; i ++ )
176169 {
177170 ( string text , int _ , bool disabled ) = visibleOptions [ i ] ;
@@ -193,6 +186,9 @@ public override void Display()
193186 noneOptions . AppendLine ( displayLine ) ;
194187 disabledOptions . AppendLine ( ) ;
195188 }
189+
190+ if ( maxLength < displayLine . Length )
191+ maxLength = displayLine . Length ;
196192 }
197193
198194 noneOptions . AppendLine ( ) ;
@@ -206,15 +202,25 @@ public override void Display()
206202 disabledOptions . AppendLine ( Player . Localizer ( "SelectKey" , screenMenu . SelectKey ) ) ;
207203 }
208204
209- UpdateWorldText ( ref WorldText , noneOptions . ToString ( ) , screenMenu , screenMenu . TextColor ) ;
210- UpdateWorldText ( ref WorldTextDisabled , disabledOptions . ToString ( ) , screenMenu , screenMenu . DisabledTextColor ) ;
205+ for ( int i = 0 ; i < maxLength - 5 ; i ++ )
206+ disabledOptions . Append ( 'ᅠ' ) ;
207+
208+ UpdateWorldText ( ref WorldText , noneOptions . ToString ( ) , false , screenMenu , screenMenu . TextColor ) ;
209+ UpdateWorldText ( ref WorldTextDisabled , disabledOptions . ToString ( ) , true , screenMenu , screenMenu . DisabledTextColor ) ;
211210 }
212211
213- private static void UpdateWorldText ( ref CPointWorldText ? worldText , string message , ScreenMenu screenMenu , Color color )
212+ private static void UpdateWorldText ( ref CPointWorldText ? worldText , string message , bool background , ScreenMenu screenMenu , Color color )
214213 {
215214 if ( worldText == null || ! worldText . IsValid )
216215 {
217- worldText = CreateWorldText ( message , screenMenu . Size , color , screenMenu . Font , false , screenMenu . BackgroundHeight , screenMenu . BackgroundWidth ) ;
216+ worldText = CreateWorldText (
217+ message ,
218+ screenMenu . Size ,
219+ color ,
220+ screenMenu . Font ,
221+ background ,
222+ background ? - 0.001f : 0f
223+ ) ;
218224 }
219225 else
220226 {
@@ -403,6 +409,7 @@ private void HandleOption(int globalIndex)
403409 int end = Math . Min ( start + NumPerPage , totalItems ) ;
404410
405411 int displayNumber = 1 ;
412+ int maxLength = 0 ;
406413 for ( int i = start ; i < end ; i ++ )
407414 {
408415 ItemOption option = Menu . ItemOptions [ i ] ;
@@ -417,6 +424,9 @@ private void HandleOption(int globalIndex)
417424
418425 visible . Add ( ( text , i , option . DisableOption != DisableOption . None ) ) ;
419426 displayNumber ++ ;
427+
428+ if ( text . Length > maxLength )
429+ maxLength = text . Length ;
420430 }
421431
422432 if ( visible . Count > 0 )
0 commit comments