@@ -39,8 +39,14 @@ var array<MCM_SettingsPanel> SettingsPanels;
3939var array <MCM_SettingsPanel > ShowQueue ;
4040var UIButton SaveAndExitButton ;
4141var UIButton CancelButton ;
42+ var UITextTooltip ActiveTooltip ;
43+ var float SBOffset , ScrollHeight ;
4244
4345var int CurrentGameMode ;
46+ var UINavigationHelp NavHelp ;
47+ var ConsoleOptionAttentionType AttentionType ;
48+ var UIMechaListItem MechaListItem ;
49+ var int MechaListItemType ; //enum EUILineItemType found in UIMechaListItem;
4450
4551// Pawn hiding code thanks to Patrick-Seymour
4652var bool SoldierVisible ;
@@ -101,6 +107,9 @@ simulated function OnInit()
101107 `log ("MCM Core: hiding soldier guy on main menu for visibility." );
102108 HideSoldierIfMainMenu ();
103109 }
110+
111+ NavHelp = Spawn (class 'UINavigationHelp' ,self ).InitNavHelp ();
112+ UpdateNavHelp ();
104113}
105114
106115simulated function OnRemoved ()
@@ -141,7 +150,7 @@ simulated function CreateSkeleton()
141150 // Save and exit button
142151 SaveAndExitButton = Spawn (class 'UIButton' , Container );
143152 SaveAndExitButton .bAnimateOnInit = false ;
144- SaveAndExitButton .InitButton (, m_strSaveAndExit , OnSaveAndExit , eUIButtonStyle_HOTLINK_BUTTON );
153+ SaveAndExitButton .InitButton ( , class 'UIOptionsPCScreen' . default . m_strSaveAndExit , OnSaveAndExit , eUIButtonStyle_HOTLINK_BUTTON );
145154 SaveAndExitButton .SetGamepadIcon (class 'UIUtilities_Input' .const .ICON_X_SQUARE );
146155 SaveAndExitButton .SetPosition (Container .width - 190 , Container .height - 40 ); //Relative to this screen panel
147156 SaveAndExitButton .DisableNavigation ();
@@ -150,7 +159,7 @@ simulated function CreateSkeleton()
150159 {
151160 CancelButton = Spawn (class 'UIButton' , Container );
152161 SaveAndExitButton .bAnimateOnInit = false ;
153- CancelButton .InitButton (, m_strCancel , OnCancel );
162+ CancelButton .InitButton ( , class 'UIUtilities_Text' . default . m_strGenericCancel , OnCancel );
154163 CancelButton .SetPosition (Container .width - 190 - 170 , Container .height - 40 ); //Relative to this screen panel
155164 CancelButton .DisableNavigation ();
156165 }
@@ -191,6 +200,105 @@ event Tick(float DeltaTime)
191200 Super .Tick (DeltaTime );
192201}
193202
203+ simulated function UpdateNavHelp ( bool bWipeButtons = false )
204+ {
205+ NavHelp .ClearButtonHelp ();
206+ NavHelp .bIsVerticalHelp = true ; //bsg-hlee (05.05.17): Stacking the B button at the bottom left nav help to match the rest of the main menu screens.
207+ NavHelp .AddBackButton (GoBack );
208+
209+ if (`ISCONTROLLERACTIVE )
210+ {
211+ //determines if focus is on the RIGHT column
212+ if (AttentionType == COAT_DETAILS )
213+ {
214+ switch (MechaListItemType )
215+ {
216+ case EUILineItemType_Slider :
217+ NavHelp .AddLeftHelp (class 'UIUtilities_Text' .default .m_strGenericAdjust , class 'UIUtilities_Input' .const .ICON_DPAD_HORIZONTAL );
218+ break ;
219+ case EUILineItemType_Checkbox :
220+ NavHelp .AddLeftHelp (class 'UIUtilities_Text' .default .m_strGenericToggle , class 'UIUtilities_Input' .static .GetAdvanceButtonIcon ());
221+ break ;
222+ case EUILineItemType_Spinner :
223+ NavHelp .AddLeftHelp (class 'UIUtilities_Text' .default .m_strGenericSelect , class 'UIUtilities_Input' .const .ICON_DPAD_HORIZONTAL );
224+ break ;
225+ case EUILineItemType_Dropdown :
226+ case EUILineItemType_Button :
227+ NavHelp .AddSelectNavHelp ();
228+ break ;
229+ }
230+ // </workshop>
231+ }
232+ else //COAT_CATEGORIES
233+ NavHelp .AddSelectNavHelp ();
234+ }
235+
236+ }
237+
238+ simulated function OnSelectionChanged (UIList ContainerList , int ItemIndex )
239+ {
240+ UpdateMechItemNavHelp (ContainerList , ItemIndex ); //INS: - JTA 2016/3/18
241+
242+ if (`ISCONTROLLERACTIVE )
243+ {
244+ if (ActiveTooltip != none )
245+ {
246+ if (`PRES .m_eUIMode != eUIMode_Shell )
247+ {
248+ ActiveTooltip .HideTooltip ();
249+ }
250+
251+ XComPresentationLayerBase (Owner ).m_kTooltipMgr .DeactivateTooltip (ActiveTooltip , true );
252+ ActiveTooltip = none ;
253+ }
254+
255+ if (MechaListItem != none )
256+ {
257+ if (MechaListItem .BG .bHasTooltip )
258+ {
259+ ActiveTooltip = UITextTooltip (Movie .Pres .m_kTooltipMgr .GetTooltipByID (MechaListItem .BG .CachedTooltipId ));
260+ if (ActiveTooltip != none )
261+ {
262+ ActiveTooltip .SetFollowMouse (false );
263+ ActiveTooltip .SetTooltipPosition (950.0 , MechaListItem .Y - SBOffset + 180 );
264+ ActiveTooltip .SetDelay (0 );
265+ ActiveTooltip .ShowTooltip ();
266+ XComPresentationLayerBase (Owner ).m_kTooltipMgr .ActivateTooltip (ActiveTooltip );
267+ }
268+ }
269+ }
270+ }
271+ }
272+
273+ function OnScrollPercentChanged ( float newPercent )
274+ {
275+ SBOffset = newPercent * ScrollHeight ;
276+ if (ActiveTooltip != none )
277+ {
278+ ActiveTooltip .SetTooltipPosition (950.0 , MechaListItem .Y - SBOffset + 180 );
279+ }
280+ }
281+
282+ //Determines if a change is necessary in the Navhelp
283+ //Mr. Nice: Also stash MechaListItem in properties, useful elsewhere!
284+ simulated function UpdateMechItemNavHelp (UIList ContainerList , int Index )
285+ {
286+ local int NewMechaListItemType ; //enum EUILineItemType found in UIMechaListItem;
287+
288+ if (AttentionType == COAT_CATEGORIES ) return ; // Mr. Nice: Will get "spurious" Update when backing out
289+ //Checks to see if the selected list item is the same as the previously selected list item (to determine if we need to refresh the navhelp)
290+ MechaListItem = UIMechaListItem (ContainerList .GetSelectedItem ());
291+ if (MechaListItem != None )
292+ {
293+ NewMechaListItemType = int (MechaListItem .Type );
294+ if (NewMechaListItemType != MechaListItemType )
295+ {
296+ MechaListItemType = NewMechaListItemType ;
297+ UpdateNavHelp ();
298+ }
299+ }
300+ }
301+
194302// Special button handlers ========================================================================
195303
196304simulated function OnSaveAndExit (UIButton kButton )
@@ -217,6 +325,44 @@ simulated function OnCancel(UIButton kButton)
217325 CloseScreen ();
218326}
219327
328+ function GoBack ()
329+ {
330+ local UIList List ;
331+
332+ switch (AttentionType )
333+ {
334+ case COAT_CATEGORIES :
335+ OnCancel (none );
336+ break ;
337+
338+ case COAT_DETAILS :
339+ if (MechaListItemType == EUILineItemType_Dropdown && MechaListItem .Dropdown .isOpen )
340+ {
341+ MechaListItem .Dropdown .BackOut ();
342+ }
343+ else
344+ {
345+ AttentionType = COAT_CATEGORIES ;
346+ TabsList .SetSelectedNavigation ();
347+ MechaListItem .OnLoseFocus ();
348+ List = UIList (MechaListItem .GetParent (class 'UIList' ));
349+ List .SetSelectedIndex (0 );
350+ if (List .Scrollbar !=none )
351+ {
352+ List .Scrollbar .SetThumbAtPercent (0 );
353+ }
354+ if (ActiveTooltip != none )
355+ {
356+ Movie .Pres .m_kTooltipMgr .DeactivateTooltip (ActiveTooltip , true );
357+ ActiveTooltip = none ;
358+ }
359+ UpdateNavHelp ();
360+ }
361+ Movie .Pres .PlayUISound (eSUISound_MenuClose ); //bsg-crobinson (5.9.17): Add close menu sound on back
362+ break ;
363+ }
364+ }
365+
220366simulated function CloseScreen ()
221367{
222368 Super .CloseScreen ();
@@ -233,19 +379,28 @@ simulated function bool OnUnrealCommand(int cmd, int arg)
233379
234380 switch ( cmd )
235381 {
382+ case class 'UIUtilities_Input' .const .FXS_R_MOUSE_DOWN :
383+ OnCancel (none );
384+ return true ;
385+
236386 case class 'UIUtilities_Input' .const .FXS_BUTTON_B :
237387 case class 'UIUtilities_Input' .const .FXS_KEY_ESCAPE :
238- case class 'UIUtilities_Input' .const .FXS_R_MOUSE_DOWN :
239- if (TabsList .bIsFocused )
240- {
241- OnCancel (none );
242- }
243- else
388+ GoBack ();
389+ return true ;
390+
391+ case class 'UIUtilities_Input' .const .FXS_ARROW_DOWN :
392+ case class 'UIUtilities_Input' .const .FXS_DPAD_DOWN :
393+ case class 'UIUtilities_Input' .const .FXS_VIRTUAL_LSTICK_DOWN :
394+ case class 'UIUtilities_Input' .const .FXS_ARROW_UP :
395+ case class 'UIUtilities_Input' .const .FXS_DPAD_UP :
396+ case class 'UIUtilities_Input' .const .FXS_VIRTUAL_LSTICK_UP :
397+ if (MechaListItemType == EUILineItemType_Dropdown && MechaListItem .Dropdown .isOpen )
244398 {
245- Movie . Pres . PlayUISound ( eSUISound_MenuClose );
246- TabsList . SetSelectedNavigation ( );
399+ // Mr. Nice: Let the dropdown handle it, will get consumed by the UIList otherwise
400+ return MechaListItem . OnUnrealCommand ( cmd , arg );
247401 }
248- return true ;
402+ break ;
403+
249404 case class 'UIUtilities_Input' .const .FXS_BUTTON_X :
250405 OnSaveAndExit (none );
251406 return true ;
@@ -364,10 +519,8 @@ simulated function ChoosePanelByPageID(int PageID)
364519 else
365520 {
366521 `log ("MCM: Found correct panel, showing." );
367- Movie .Pres .PlayUISound (eSUISound_MenuSelect );
368- TmpPage .SetSelectedNavigation ();
369522 TmpPage .Show ();
370- TabsList . OnLoseFocus ( );
523+ SelectSettingsPanel ( TmpPage );
371524 }
372525 }
373526
@@ -392,14 +545,21 @@ simulated function ChoosePanelByPageID(int PageID)
392545 if (TmpPage .GetPageID () == SelectedPageID )
393546 {
394547 `log ("MCM: Found correct panel, navigating." );
395- Movie .Pres .PlayUISound (eSUISound_MenuSelect );
396- TmpPage .SetSelectedNavigation ();
397- TabsList .OnLoseFocus ();
548+ SelectSettingsPanel (TmpPage );
398549 }
399550 }
400551 }
401552}
402553
554+ simulated function SelectSettingsPanel (MCM_SettingsPanel Tab )
555+ {
556+ Movie .Pres .PlayUISound (eSUISound_MenuSelect );
557+ AttentionType = COAT_DETAILS ;
558+ Tab .SetSelectedNavigation ();
559+ UpdateMechItemNavHelp (Tab .SettingsList , 0 );
560+ ScrollHeight = Tab .SettingsList .TotalItemSize - Tab .SettingsList .Height - 55 ;
561+ }
562+
403563simulated function TabClickedHandler (MCM_SettingsTab Caller , int PageID )
404564{
405565 `log ("MCM Tab clicked: " $ string (PageID ));
@@ -424,10 +584,11 @@ function MCM_API_SettingsPage MakeSettingsPage(string TabLabel, int PageID)
424584{
425585 local MCM_SettingsPanel SP ;
426586 SP = Spawn (class 'MCM_SettingsPanel' , Container );
587+ SP .OptionsScreen = self ;
427588 SP .InitPanel ();
428589 SP .SettingsPageID = PageID ;
429590 SP .SetPosition (TABLIST_WIDTH + OPTIONS_MARGIN , HEADER_HEIGHT );
430-
591+
431592 SP .SetPageTitle (TabLabel );
432593
433594 // By default do not show the panel.
0 commit comments