michaelrw

ingameMenu.ws (v4.0.2 update)

Mar 16th, 2023
1,098
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 94.92 KB | Gaming | 0 0
  1. /***********************************************************************/
  2. /**     © 2015 CD PROJEKT S.A. All rights reserved.
  3. /**     THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /**     The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. enum InGameMenuActionType
  11. {
  12.     IGMActionType_CommonMenu        = 0,
  13.     IGMActionType_Close             = 1,
  14.     IGMActionType_MenuHolder        = 2,
  15.     IGMActionType_MenuLastHolder    = 3,
  16.     IGMActionType_Load              = 4,
  17.     IGMActionType_Save              = 5,
  18.     IGMActionType_Quit              = 6,
  19.     IGMActionType_Preset            = 7,
  20.     IGMActionType_Toggle            = 8,
  21.     IGMActionType_List              = 9,
  22.     IGMActionType_Slider            = 10,
  23.     IGMActionType_LoadLastSave      = 11,
  24.     IGMActionType_Tutorials         = 12,
  25.     IGMActionType_Credits           = 13,
  26.     IGMActionType_Help              = 14,
  27.     IGMActionType_Controls          = 15,
  28.     IGMActionType_ControllerHelp    = 16,
  29.     IGMActionType_NewGame           = 17,
  30.     IGMActionType_CloseGame         = 18,
  31.     IGMActionType_UIRescale         = 19,
  32.     IGMActionType_Gamma             = 20,
  33.     IGMActionType_DebugStartQuest   = 21,
  34.     IGMActionType_Gwint             = 22,
  35.     IGMActionType_ImportSave        = 23,
  36.     IGMActionType_KeyBinds          = 24,
  37.     IGMActionType_Back              = 25,
  38.     IGMActionType_NewGamePlus       = 26,
  39.     IGMActionType_InstalledDLC      = 27,
  40.     IGMActionType_Button            = 28,
  41.     IGMActionType_ToggleRender      = 29,
  42.     IGMActionType_Gog               = 30,
  43.     IGMActionType_TelemetryConsent  = 31,
  44.     IGMActionType_ListWithCondition = 32,
  45.     IGMActionType_Stepper           = 33,
  46.     IGMActionType_ToggleStepper     = 34,
  47.     IGMActionType_Separator         = 35,
  48.     IGMActionType_SubtleSeparator   = 36,
  49.    
  50.     IGMActionType_PurchaseEP1       = 37,
  51.     IGMActionType_PurchaseEP2       = 38,
  52.  
  53.     IGMActionType_Options           = 100
  54. };
  55.  
  56. enum GERR
  57. {
  58.         GOGNoInternetConnection = 0,
  59.         RewardsTemporaryFail = 1,
  60.         RewardsRequestFailed = 2,
  61.         QRCodeTemporaryFail=  3,
  62.         QRCodeRequestFailed = 4
  63. };
  64.            
  65.  
  66. enum EIngameMenuConstants
  67. {
  68.     IGMC_Difficulty_mask    =   7,  
  69.     IGMC_Tutorials_On       =   1024,
  70.     IGMC_Simulate_Import    =   2048,
  71.     IGMC_Import_Save        =   4096,
  72.     IGMC_EP1_Save           =   8192,
  73.     IGMC_New_game_plus      =   16384,
  74.     IGMC_EP2_Save           =   32768,
  75. }
  76.  
  77. struct newGameConfig
  78. {
  79.     var tutorialsOn : bool;
  80.     var difficulty : int;
  81.     var simulate_import : bool;
  82.     var import_save_index : int;
  83. }
  84.  
  85.  
  86. function UpdateAO2CorrespondRT(RTEnabled: bool, justValidate: bool)
  87. {
  88.     var inGameConfigWrapper : CInGameConfigWrapper;
  89.     inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  90.        
  91.     if( RTEnabled )
  92.     {
  93.         if ((justValidate && StringToInt(inGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) == IGMOPT_AO_SSAO)
  94.          ||(!justValidate && StringToInt(inGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) != IGMOPT_AO_NRDRTAO))
  95.         {
  96.             inGameConfigWrapper.SetVarValue('PostProcess', 'Virtual_SSAOSolution', IntToString(IGMOPT_AO_NRDRTAO));
  97.         }
  98.     } else {
  99.         if(StringToInt(inGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) >= IGMOPT_AO_RTAO)
  100.         {
  101.             inGameConfigWrapper.SetVarValue('PostProcess', 'Virtual_SSAOSolution', IntToString(IGMOPT_AO_SSAO));
  102.         }
  103.     }
  104. }
  105.    
  106. class CR4IngameMenu extends CR4MenuBase
  107. {
  108.     protected var mInGameConfigWrapper  : CInGameConfigWrapper;
  109.     protected var inGameConfigBufferedWrapper : CInGameConfigBufferedWrapper;
  110.    
  111.     protected var currentNewGameConfig  : newGameConfig;
  112.    
  113.     private var m_fxNavigateBack        : CScriptedFlashFunction;
  114.     private var m_fxSetIsMainMenu       : CScriptedFlashFunction;
  115.     private var m_fxSetCurrentUsername  : CScriptedFlashFunction;
  116.     private var m_fxSetVersion          : CScriptedFlashFunction;
  117.     private var m_fxShowHelp            : CScriptedFlashFunction;
  118.     private var m_fxSetVisible          : CScriptedFlashFunction;
  119.     private var m_fxSetPanelMode        : CScriptedFlashFunction;
  120.     private var m_fxRemoveOption        : CScriptedFlashFunction;
  121.     private var m_fxSetGameLogoLanguage : CScriptedFlashFunction;
  122.     private var m_fxUpdateOptionValue   : CScriptedFlashFunction;
  123.     private var m_fxUpdateOptionLabel   : CScriptedFlashFunction;
  124.     private var m_fxUpdateInputFeedback : CScriptedFlashFunction;
  125.     private var m_fxOnSaveScreenshotRdy : CScriptedFlashFunction;
  126.     private var m_fxSetIgnoreInput      : CScriptedFlashFunction;
  127.     private var m_fxUpdateSaveSlot      : CScriptedFlashFunction;
  128.     private var m_fxForceEnterCurEntry  : CScriptedFlashFunction;
  129.     private var m_fxForceBackgroundVis  : CScriptedFlashFunction;
  130.     private var m_fxSetHardwareCursorOn : CScriptedFlashFunction;
  131.     private var m_fxSetExpansionText    : CScriptedFlashFunction;
  132.     private var m_fxUpdateAnchorsAspectRatio : CScriptedFlashFunction;
  133.     private var m_fxQRCodeReadyToLoad   : CScriptedFlashFunction;
  134.     private var m_fxShowCloudModal      : CScriptedFlashFunction;
  135.     private var m_fxCloseGalaxySignInModalWindow: CScriptedFlashFunction;
  136.     private var m_fxSetDLSSIsSupported  : CScriptedFlashFunction;
  137.     private var m_fxSetRTEnabled        : CScriptedFlashFunction;
  138.     private var m_fxHideErrorWindow     : CScriptedFlashFunction;
  139.    
  140.     protected var loadConfPopup         : W3ApplyLoadConfirmation;
  141.     protected var saveConfPopup         : W3SaveGameConfirmation;
  142.     protected var newGameConfPopup      : W3NewGameConfirmation;
  143.     protected var actionConfPopup       : W3ActionConfirmation;
  144.     protected var deleteConfPopup       : W3DeleteSaveConf;
  145.     protected var diffChangeConfPopup   : W3DifficultyChangeConfirmation;
  146.     protected var isShowingSaveList     : bool; default isShowingSaveList = false;
  147.     protected var isShowingLoadList     : bool; default isShowingLoadList = false;
  148.    
  149.     protected var smartKeybindingEnabled : bool; default smartKeybindingEnabled = true;
  150.    
  151.     public var m_structureCreator       : IngameMenuStructureCreator;
  152.    
  153.     protected var isInLoadselector      : bool; default isInLoadselector = false;
  154.     protected var swapAcceptCancelChanged : bool; default swapAcceptCancelChanged = false;
  155.     protected var alternativeRadialInputChanged : bool; default alternativeRadialInputChanged = false;
  156.     protected var EnableUberMovement : bool; default EnableUberMovement = false;
  157.    
  158.     protected var shouldRefreshKinect   : bool; default shouldRefreshKinect = false;
  159.     public var isMainMenu               : bool;
  160.    
  161.     protected var managingPause     : bool; default managingPause = false;
  162.    
  163.     protected var updateInputDeviceRequired : bool; default updateInputDeviceRequired = false;
  164.    
  165.     protected var hasChangedOption      : bool;
  166.     default hasChangedOption = false;
  167.    
  168.    
  169.     protected var curMenuDepth      : int;
  170.     default curMenuDepth = 0;
  171.     protected var depthOptions      : int;
  172.     default depthOptions = 10;
  173.    
  174.     private var ignoreInput             : bool;
  175.     default ignoreInput = false;
  176.    
  177.     public var disableAccountPicker : bool;
  178.     default disableAccountPicker = false;
  179.    
  180.     protected var lastSetTag : int;
  181.    
  182.     protected var currentLangValue      : string;
  183.     protected var lastUsedLangValue     : string;
  184.     protected var currentSpeechLang     : string;
  185.     protected var lastUsedSpeechLang    : string;
  186.     private var languageName            : string;
  187.    
  188.     private var panelMode               : bool; default panelMode = false;
  189.     private var postprocessRtGreyed     : bool; default postprocessRtGreyed = false;
  190.     private var postprocessEntered      : bool; default postprocessEntered = false;
  191.    
  192.     public var lastSetDifficulty        : int;
  193.    
  194.     private var lastTimeGetOption       : int;  default lastTimeGetOption = 0;
  195.    
  196.     event  OnConfigUI()
  197.     {
  198.         var initDataObject      : W3MenuInitData;
  199.         var commonIngameMenu    : CR4CommonIngameMenu;
  200.         var commonMainMenuBase  : CR4CommonMainMenuBase;
  201.         var deathScreenMenu     : CR4DeathScreenMenu;
  202.         var audioLanguageName   : string;
  203.         var tempLanguageName    : string;
  204.         var username            : string;
  205.         var lootPopup           : CR4LootPopup;
  206.         var ep1StatusText       : string;
  207.         var ep2StatusText       : string;
  208.         var width               : int;
  209.         var height              : int;
  210.        
  211.         super.OnConfigUI();
  212.        
  213.         m_fxNavigateBack = m_flashModule.GetMemberFlashFunction("handleNavigateBack");
  214.         m_fxSetIsMainMenu = m_flashModule.GetMemberFlashFunction("setIsMainMenu");
  215.         m_fxSetCurrentUsername = m_flashModule.GetMemberFlashFunction("setCurrentUsername");
  216.         m_fxSetVersion = m_flashModule.GetMemberFlashFunction("setVersion");
  217.         m_fxShowHelp = m_flashModule.GetMemberFlashFunction("showHelpPanel");      
  218.         m_fxSetVisible = m_flashModule.GetMemberFlashFunction("setVisible");
  219.         m_fxSetPanelMode = m_flashModule.GetMemberFlashFunction("setPanelMode");
  220.         m_fxRemoveOption = m_flashModule.GetMemberFlashFunction("removeOption");
  221.         m_fxSetGameLogoLanguage = m_flashModule.GetMemberFlashFunction( "setGameLogoLanguage" );
  222.         m_fxUpdateOptionValue = m_flashModule.GetMemberFlashFunction( "updateOptionValue" );
  223.         m_fxUpdateOptionLabel = m_flashModule.GetMemberFlashFunction( "updateOptionLabel" );
  224.         m_fxUpdateInputFeedback = m_flashModule.GetMemberFlashFunction( "updateInputFeedback" );
  225.         m_fxOnSaveScreenshotRdy = m_flashModule.GetMemberFlashFunction( "onSaveScreenshotLoaded" );
  226.         m_fxSetIgnoreInput = m_flashModule.GetMemberFlashFunction( "setIgnoreInput" );
  227.         m_fxUpdateSaveSlot = m_flashModule.GetMemberFlashFunction( "updateSaveSlot" );
  228.         m_fxForceEnterCurEntry = m_flashModule.GetMemberFlashFunction( "forceEnterCurrentEntry" );
  229.         m_fxForceBackgroundVis = m_flashModule.GetMemberFlashFunction( "setForceBackgroundVisible" );
  230.         m_fxSetHardwareCursorOn = m_flashModule.GetMemberFlashFunction( "setHardwareCursorOn" );
  231.         m_fxSetExpansionText = m_flashModule.GetMemberFlashFunction( "setExpansionText" );
  232.         m_fxUpdateAnchorsAspectRatio = m_flashModule.GetMemberFlashFunction( "UpdateAnchorsAspectRatio" );
  233.         m_fxQRCodeReadyToLoad = m_flashModule.GetMemberFlashFunction("QRCodeReadyToLoad");
  234.         m_fxShowCloudModal = m_flashModule.GetMemberFlashFunction("ShowCloudModal");
  235.         m_fxCloseGalaxySignInModalWindow = m_flashModule.GetMemberFlashFunction("closeGalaxySignInDialog");
  236.         m_fxSetDLSSIsSupported = m_flashModule.GetMemberFlashFunction("DLSSIsSupported");
  237.         m_fxSetRTEnabled = m_flashModule.GetMemberFlashFunction("RTEnabled");
  238.         m_fxHideErrorWindow = m_flashModule.GetMemberFlashFunction("hideErrorHandlingWindow");
  239.  
  240.         m_structureCreator = new IngameMenuStructureCreator in this;
  241.         m_structureCreator.parentMenu = this;
  242.         m_structureCreator.m_flashValueStorage = m_flashValueStorage;
  243.         m_structureCreator.m_flashConstructor = m_flashValueStorage.CreateTempFlashObject();
  244.        
  245.         m_hideTutorial = false;
  246.         m_forceHideTutorial = false;
  247.         disableAccountPicker = false;
  248.        
  249.         theGame.LoadHudSettings();
  250.        
  251.         mInGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  252.         inGameConfigBufferedWrapper = theGame.GetGuiManager().GetInGameConfigBufferedWrapper();
  253.        
  254.         lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('LootPopup');
  255.            
  256.         if (lootPopup)
  257.         {
  258.             lootPopup.ClosePopup();
  259.         }
  260.        
  261.         commonIngameMenu = (CR4CommonIngameMenu)(GetParent());
  262.         commonMainMenuBase = (CR4CommonMainMenuBase)(GetParent());
  263.         deathScreenMenu = (CR4DeathScreenMenu)(GetParent());
  264.        
  265.         if (commonIngameMenu)
  266.         {
  267.             isMainMenu = false;
  268.             panelMode = false;
  269.             mInGameConfigWrapper.ActivateScriptTag('inGame');
  270.             mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  271.             if ((!thePlayer.IsAlive() && !thePlayer.OnCheckUnconscious()) || theGame.HasBlackscreenRequested() || FactsQuerySum("nge_pause_menu_disabled") > 0  )
  272.             {
  273.                 CloseMenu();
  274.                 return true;
  275.             }
  276.            
  277.            
  278.             if(theGame.IsDialogOrCutscenePlaying())
  279.                 theSound.SoundEvent("music_pause");
  280.            
  281.         }
  282.         else if (commonMainMenuBase)
  283.         {
  284.             isMainMenu = true;
  285.             panelMode = false;
  286.             mInGameConfigWrapper.ActivateScriptTag('mainMenu');
  287.             mInGameConfigWrapper.DeactivateScriptTag('inGame');
  288.            
  289.             StartShowingCustomDialogs();
  290.            
  291.             //---=== modFriendlyHUD ===---
  292.             if(!ShouldHideDLCIcons())
  293.             //---=== modFriendlyHUD ===---
  294.             {
  295.             if (theGame.GetDLCManager().IsEP1Available())
  296.             {
  297.                 ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  298.             }
  299.             else
  300.             {
  301.                 ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  302.             }
  303.            
  304.             if (theGame.GetDLCManager().IsEP2Available())
  305.             {
  306.                 ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  307.             }
  308.             else
  309.             {
  310.                
  311.                 ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  312.             }          
  313.            
  314.             m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  315.             }
  316.            
  317.             if (theGame.AreConfigResetInThisSession() && !theGame.HasShownConfigChangedMessage())
  318.             {
  319.                 showNotification(GetLocStringByKeyExt("update_warning_message"));
  320.                 OnPlaySoundEvent("gui_global_denied");
  321.                 theGame.SetHasShownConfigChangedMessage(true);
  322.             }
  323.         }
  324.         else if (deathScreenMenu)
  325.         {
  326.             isMainMenu = false;
  327.             panelMode = true;
  328.             mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  329.             mInGameConfigWrapper.DeactivateScriptTag('inGame');
  330.            
  331.             deathScreenMenu.HideInputFeedback();
  332.            
  333.             if (hasSaveDataToLoad())
  334.             {
  335.                 isInLoadselector = true;
  336.                 SendLoadData();
  337.                 m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  338.             }
  339.             else
  340.             {
  341.                 CloseMenu();
  342.             }
  343.         }
  344.         else
  345.         {
  346.             initDataObject = (W3MenuInitData)GetMenuInitData();
  347.            
  348.             if (initDataObject && initDataObject.getDefaultState() == 'SaveGame')
  349.             {
  350.                 isMainMenu = false;
  351.                 panelMode = true;
  352.                
  353.                 managingPause = true;
  354.                 theInput.StoreContext( 'EMPTY_CONTEXT' );
  355.                 theGame.Pause('IngameMenu');
  356.                
  357.                 mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  358.                 mInGameConfigWrapper.DeactivateScriptTag('inGame');
  359.                
  360.                 SendSaveData();
  361.                 m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  362.             }
  363.         }
  364.        
  365.         IngameMenu_UpdateDLCScriptTags();
  366.        
  367.         if (!panelMode)
  368.         {
  369.             m_fxSetIsMainMenu.InvokeSelfOneArg(FlashArgBool(isMainMenu));
  370.            
  371.             if (isMainMenu)
  372.             {
  373.                 username = FixStringForFont(theGame.GetActiveUserDisplayName());
  374.                 m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  375.                
  376.                 m_fxSetVersion.InvokeSelfOneArg(FlashArgString(theGame.GetApplicationVersion()));
  377.                
  378.                 if( !theGame.IsContentAvailable( 'content12' ) )
  379.                 {
  380.                     theGame.GetGuiManager().RefreshMainMenuAfterContentLoaded();
  381.                 }
  382.             }
  383.            
  384.             theGame.GetSecondScreenManager().SendGameMenuOpen();
  385.            
  386.             lastSetDifficulty = theGame.GetDifficultyLevel();
  387.            
  388.             currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  389.             lastUsedLangValue = currentLangValue;
  390.            
  391.             currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  392.             lastUsedSpeechLang = currentSpeechLang;
  393.            
  394.             theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  395.             if( tempLanguageName != languageName )
  396.             {
  397.                 languageName = tempLanguageName;
  398.                 m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  399.             }
  400.            
  401.             PopulateMenuData();
  402.             if(!theTelemetry.WasConsentWindowShown())
  403.             {
  404.                 ShowTelemetryWindow();
  405.             }
  406.         }
  407.        
  408.         theGame.GetCurrentViewportResolution( width, height );
  409.         m_fxUpdateAnchorsAspectRatio.InvokeSelfTwoArgs( FlashArgInt( width ), FlashArgInt( height ) );
  410.        
  411.         theInput.RegisterListener( this, 'OnShowDeveloperMode', 'ShowDeveloperMode' );
  412.     }
  413.    
  414.     event OnRefreshActiveUserDisplayName()
  415.     {
  416.         var username            : string;
  417.  
  418.         if (isMainMenu)
  419.         {
  420.             username = FixStringForFont(theGame.GetActiveUserDisplayName());
  421.             m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  422.         }
  423.     }
  424.  
  425.     event OnRefresh()
  426.     {
  427.         var audioLanguageName   : string;
  428.         var tempLanguageName    : string;
  429.         var overlayPopupRef     : CR4OverlayPopup;
  430.         var username            : string;
  431.         var hud                 : CR4ScriptedHud;
  432.         var ep1StatusText       : string;
  433.         var ep2StatusText       : string;
  434.        
  435.        
  436.         currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  437.         lastUsedLangValue = currentLangValue;
  438.            
  439.         currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  440.         lastUsedSpeechLang = currentSpeechLang;
  441.        
  442.         if (isMainMenu)
  443.         {
  444.             username = FixStringForFont(theGame.GetActiveUserDisplayName());
  445.             m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  446.            
  447.             PopulateMenuData();
  448.            
  449.            
  450.            
  451.            
  452.            
  453.            
  454.            
  455.         }
  456.        
  457.         UpdateAcceptCancelSwaping();
  458.         SetPlatformType(theGame.GetPlatform());
  459.         hud = (CR4ScriptedHud)(theGame.GetHud());
  460.         if (hud)
  461.         {
  462.             hud.UpdateAcceptCancelSwaping();
  463.         }
  464.        
  465.         overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  466.         if (overlayPopupRef)
  467.         {
  468.             overlayPopupRef.UpdateAcceptCancelSwaping();
  469.         }
  470.        
  471.         theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  472.         if( tempLanguageName != languageName )
  473.         {
  474.             languageName = tempLanguageName;
  475.             m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  476.             m_fxUpdateInputFeedback.InvokeSelf();
  477.             if (overlayPopupRef)
  478.             {
  479.                 overlayPopupRef.UpdateButtons();
  480.             }
  481.         }
  482.        
  483.        
  484.         //---=== modFriendlyHUD ===---
  485.         if(!ShouldHideDLCIcons())
  486.         //---=== modFriendlyHUD ===---
  487.         {
  488.            
  489.            
  490.             if (theGame.GetDLCManager().IsEP1Available())
  491.             {
  492.                 ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  493.             }
  494.             else
  495.             {
  496.                 ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  497.             }
  498.            
  499.             if (theGame.GetDLCManager().IsEP2Available())
  500.             {
  501.                 ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  502.             }
  503.             else
  504.             {
  505.                
  506.                 ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  507.             }
  508.            
  509.             m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  510.         }
  511.         setArabicAligmentMode();
  512.     }
  513.  
  514.     event OnVisitWeibo()
  515.     {
  516.         theGame.VisitWeibo();
  517.     }
  518.    
  519.     function OnRequestSubMenu( menuName: name, optional initData : IScriptable )
  520.     {
  521.         RequestSubMenu(menuName, initData);
  522.         m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(false));
  523.     }
  524.    
  525.     function ChildRequestCloseMenu()
  526.     {
  527.         m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(true));
  528.     }
  529.    
  530.     event OnCloseMenu()
  531.     {
  532.        
  533.         if(theGame.IsDialogOrCutscenePlaying())
  534.             theSound.SoundEvent("music_resume");
  535.        
  536.         CloseMenu();
  537.     }
  538.    
  539.     public function ReopenMenu()
  540.     {
  541.         var commonInGameMenu : CR4CommonIngameMenu;
  542.         var commonMainMenuBase : CR4CommonMainMenuBase;
  543.        
  544.         commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  545.         if(commonInGameMenu)
  546.         {
  547.             commonInGameMenu.reopenRequested = true;
  548.         }
  549.        
  550.         commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  551.         if ( commonMainMenuBase )
  552.         {
  553.             commonMainMenuBase.reopenRequested = true;
  554.         }
  555.        
  556.         CloseMenu();
  557.     }
  558.        
  559.     event  OnClosingMenu()
  560.     {
  561.         var commonInGameMenu : CR4CommonIngameMenu;
  562.         var commonMainMenuBase : CR4CommonMainMenuBase;
  563.         var deathScreenMenu : CR4DeathScreenMenu;
  564.         var controlsFeedbackModule : CR4HudModuleControlsFeedback;
  565.         var interactionModule : CR4HudModuleInteractions;
  566.         var hud : CR4ScriptedHud;
  567.        
  568.         SaveChangedSettings();
  569.        
  570.         theGame.GetSecondScreenManager().SendGameMenuClose();
  571.         super.OnClosingMenu();
  572.        
  573.        
  574.         hud = (CR4ScriptedHud)(theGame.GetHud());
  575.         if (hud)
  576.         {
  577.             controlsFeedbackModule = (CR4HudModuleControlsFeedback)(hud.GetHudModule(NameToString('ControlsFeedbackModule')));
  578.             if (controlsFeedbackModule)
  579.             {
  580.                 controlsFeedbackModule.ForceModuleUpdate();
  581.             }
  582.            
  583.             interactionModule = (CR4HudModuleInteractions)(hud.GetHudModule(NameToString('InteractionsModule')));
  584.             if (interactionModule)
  585.             {
  586.                 interactionModule.ForceUpdateModule();
  587.             }
  588.         }
  589.        
  590.         if (managingPause)
  591.         {
  592.             managingPause = false;
  593.             theInput.RestoreContext( 'EMPTY_CONTEXT', true );
  594.             theGame.Unpause('IngameMenu');
  595.         }
  596.        
  597.         if (theGame.GetGuiManager().potalConfirmationPending)
  598.         {
  599.             theGame.GetGuiManager().ResumePortalConfirmationPendingMessage();
  600.         }
  601.        
  602.         if (m_structureCreator)
  603.         {
  604.             delete m_structureCreator;
  605.         }
  606.        
  607.         if (loadConfPopup)
  608.         {
  609.             delete loadConfPopup;
  610.         }
  611.        
  612.         if (saveConfPopup)
  613.         {
  614.             delete saveConfPopup;
  615.         }
  616.        
  617.         if (actionConfPopup)
  618.         {
  619.             delete actionConfPopup;
  620.         }
  621.        
  622.         if (newGameConfPopup)
  623.         {
  624.             delete newGameConfPopup;
  625.         }
  626.        
  627.         if (deleteConfPopup)
  628.         {
  629.             delete deleteConfPopup;
  630.         }
  631.        
  632.         if (diffChangeConfPopup)
  633.         {
  634.             delete diffChangeConfPopup;
  635.         }
  636.        
  637.         commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  638.         if(commonInGameMenu)
  639.         {
  640.             commonInGameMenu.ChildRequestCloseMenu();
  641.             return true;
  642.         }
  643.        
  644.         commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  645.         if ( commonMainMenuBase )
  646.         {
  647.             commonMainMenuBase.ChildRequestCloseMenu();
  648.             return true;
  649.         }
  650.        
  651.         deathScreenMenu = (CR4DeathScreenMenu)m_parentMenu;
  652.         if (deathScreenMenu)
  653.         {
  654.             deathScreenMenu.ChildRequestCloseMenu();
  655.             return true;
  656.         }
  657.     }
  658.    
  659.    
  660.     protected function CloseCurrentPopup():void
  661.     {
  662.         if (loadConfPopup)
  663.         {
  664.             loadConfPopup.ClosePopupOverlay();
  665.         }
  666.         else if (saveConfPopup)
  667.         {
  668.             saveConfPopup.ClosePopupOverlay();
  669.         }      
  670.         else if (actionConfPopup)
  671.         {
  672.             actionConfPopup.ClosePopupOverlay();
  673.         }      
  674.         else if (newGameConfPopup)
  675.         {
  676.             newGameConfPopup.ClosePopupOverlay();
  677.         }      
  678.         else if (deleteConfPopup)
  679.         {
  680.             deleteConfPopup.ClosePopupOverlay();
  681.         }      
  682.         else if (diffChangeConfPopup)
  683.         {
  684.             diffChangeConfPopup.ClosePopupOverlay();
  685.         }
  686.     }
  687.    
  688.     public function SetIgnoreInput(value : bool) : void
  689.     {
  690.         if (value != ignoreInput)
  691.         {
  692.             ignoreInput = value;
  693.             m_fxSetIgnoreInput.InvokeSelfOneArg( FlashArgBool(value) );
  694.         }
  695.     }
  696.    
  697.     public function UpdateSaveSlot() : void
  698.     {
  699.         m_fxUpdateSaveSlot.InvokeSelf();
  700.     }
  701.    
  702.     public function OnUserSignIn() : void
  703.     {
  704.         SetIgnoreInput(false);
  705.         CloseCurrentPopup();
  706.     }
  707.    
  708.     public function OnUserSignInCancelled() : void
  709.     {
  710.         SetIgnoreInput(false);
  711.         CloseCurrentPopup();
  712.     }
  713.    
  714.     public function OnSaveLoadingFailed() : void
  715.     {
  716.         SetIgnoreInput(false);
  717.         CloseCurrentPopup();
  718.     }
  719.    
  720.     event  OnItemActivated( actionType:int, menuTag:int ) : void
  721.     {
  722.         var l_DataFlashArray : CScriptedFlashArray;
  723.         var manager : CR4GuiManager;
  724.        
  725.         if (ignoreInput)
  726.         {
  727.             m_fxNavigateBack.InvokeSelf();
  728.         }
  729.         else
  730.         {
  731.             postprocessEntered = false;
  732.            
  733.             switch (actionType)
  734.             {
  735.             case IGMActionType_CommonMenu:
  736.                 theGame.RequestMenu( 'CommonMenu' );
  737.                 break;
  738.             case IGMActionType_MenuHolder:
  739.                
  740.                
  741.                 m_initialSelectionsToIgnore = 1;
  742.                 OnPlaySoundEvent( "gui_global_panel_open" );
  743.                 curMenuDepth += 1;
  744.                 break;
  745.             case IGMActionType_MenuLastHolder:
  746.                 m_initialSelectionsToIgnore = 1;
  747.                 OnPlaySoundEvent( "gui_global_panel_open" );
  748.                 curMenuDepth += 1;
  749.                 break;
  750.             case IGMActionType_Load:
  751.                 if (hasSaveDataToLoad())
  752.                 {
  753.                     SendLoadData();
  754.                 }
  755.                 else
  756.                 {
  757.                    
  758.                     m_fxNavigateBack.InvokeSelf();
  759.                 }
  760.                 isInLoadselector = true;
  761.                 break;
  762.             case IGMActionType_Save:
  763.                 if ( !theGame.AreSavesLocked() )
  764.                 {
  765.                     SendSaveData();
  766.                 }
  767.                 else
  768.                 {
  769.                     m_fxNavigateBack.InvokeSelf();
  770.                     theGame.GetGuiManager().DisplayLockedSavePopup();
  771.                 }
  772.                 isInLoadselector = false;
  773.                 break;
  774.             case IGMActionType_Quit:
  775.                 ShowActionConfPopup( IGMActionType_Quit, "", GetPlatformLocString( "error_message_exit_game" ) );
  776.                 break;
  777.             case IGMActionType_Toggle:
  778.                 break;
  779.             case IGMActionType_ListWithCondition:
  780.                 break;
  781.             case IGMActionType_List:
  782.                 break;
  783.             case IGMActionType_Slider:
  784.                 break;
  785.             case IGMActionType_LoadLastSave:
  786.                 LoadLastSave();
  787.                 break;
  788.             case IGMActionType_Close:
  789.                
  790.                 break;
  791.             case IGMActionType_Tutorials:
  792.                 theGame.RequestMenuWithBackground( 'GlossaryTutorialsMenu', 'CommonMenu' );
  793.                 break;
  794.             case IGMActionType_Credits:
  795.                 theGame.GetGuiManager().RequestCreditsMenu(menuTag);
  796.                 break;
  797.             case IGMActionType_Help:
  798.                 showHelpPanel();
  799.                 break;
  800.             case IGMActionType_Options:
  801.                 DLSSSupported();
  802.                 RTEnabled();
  803.                
  804.                 developerOptions = m_flashValueStorage.CreateTempFlashArray();
  805.                
  806.                 showOptionsPanel();
  807.                
  808.                 isDeveloperModeEnabled = false;
  809.                 ShowDeveloperMode( isDeveloperModeEnabled );
  810.                 break;
  811.             case IGMActionType_ControllerHelp:
  812.                 curMenuDepth += 1;
  813.                 SendControllerData();
  814.                 break;
  815.             case IGMActionType_NewGame:
  816.                 TryStartNewGame(menuTag);
  817.                 break;
  818.             case IGMActionType_NewGamePlus:
  819.                 fetchNewGameConfigFromTag(menuTag);
  820.                 SendNewGamePlusSaves();
  821.                 break;
  822.             case IGMActionType_InstalledDLC:
  823.                 SendInstalledDLCList();
  824.                 break;
  825.             case IGMActionType_UIRescale:
  826.                 curMenuDepth += 1;
  827.                 SendRescaleData();
  828.                 break;
  829.             case IGMActionType_DebugStartQuest:
  830.                 RequestSubMenu( 'MainDbgStartQuestMenu', GetMenuInitData() );
  831.                 break;
  832.             case IGMActionType_Gwint:
  833.                 GetRootMenu().CloseMenu();
  834.                 theGame.RequestMenu( 'DeckBuilder' );
  835.                 break;
  836.             case IGMActionType_ImportSave:
  837.                 lastSetTag = menuTag;
  838.                 fetchNewGameConfigFromTag( menuTag );
  839.                 SendImportSaveData( );
  840.                 break;
  841.             case IGMActionType_CloseGame:
  842.                 if (!isMainMenu)
  843.                 {
  844.                     ShowActionConfPopup(IGMActionType_CloseGame, "", GetLocStringByKeyExt("error_message_exit_game"));
  845.                 }
  846.                 else
  847.                 {
  848.                     theGame.RequestExit();
  849.                 }
  850.                 break;
  851.             case IGMActionType_KeyBinds:
  852.                 curMenuDepth += 1;
  853.                 SendKeybindData();
  854.                 break;
  855.                
  856.             case IGMActionType_ToggleRender:
  857.                 ToggleRTEnabled();
  858.                 break;
  859.             case IGMActionType_Gog:
  860.                 m_initialSelectionsToIgnore = 1;
  861.                 manager = (CR4GuiManager)theGame.GetGuiManager();
  862.                 if (manager) {
  863.                     manager.GalaxyQRSignInInitiate();
  864.                 }
  865.                 break;
  866.             case IGMActionType_TelemetryConsent:   
  867.                 ShowTelemetryWindow();
  868.                 break;
  869.             case IGMActionType_PurchaseEP1:
  870.                 theGame.DisplayStoreExpansionPack('ep1');
  871.                 break;
  872.             case IGMActionType_PurchaseEP2:
  873.                 theGame.DisplayStoreExpansionPack('bob_000_000');
  874.                 break;
  875.             }
  876.         }
  877.     }
  878.  
  879.     event  OnShowOptionSubmenu( actionType:int, menuTag:int ) : void
  880.     {
  881.         updateDLSSGOptionChanged();
  882.     }
  883.    
  884.     public function HandleLoadGameFailed():void
  885.     {
  886.         disableAccountPicker = false;
  887.         SetIgnoreInput(false);
  888.     }
  889.    
  890.     private function StartShowingCustomDialogs()
  891.     {
  892.        
  893.        
  894.        
  895.         if (theGame.GetInGameConfigWrapper().GetVarValue('Hidden', 'HasSeenGotyWelcomeMessage') == "false")
  896.         {
  897.             theGame.GetInGameConfigWrapper().SetVarValue('Hidden', 'HasSeenGotyWelcomeMessage', "true");
  898.             theGame.SaveUserSettings();
  899.  
  900.             prepareBigMessageGOTY( "menu_goty_starting_message_alt" );
  901.         }
  902.     }
  903.    
  904.     protected function prepareBigMessage( epIndex : int ):void
  905.     {
  906.         var l_DataFlashObject       : CScriptedFlashObject;
  907.        
  908.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  909.  
  910.         l_DataFlashObject.SetMemberFlashInt( "index", epIndex );
  911.         l_DataFlashObject.SetMemberFlashString( "tfTitle1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_1") );
  912.         l_DataFlashObject.SetMemberFlashString( "tfTitle2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_2") );
  913.        
  914.         l_DataFlashObject.SetMemberFlashString( "tfTitlePath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1") );
  915.         l_DataFlashObject.SetMemberFlashString( "tfTitlePath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2") );
  916.         l_DataFlashObject.SetMemberFlashString( "tfTitlePath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3") );
  917.        
  918.         l_DataFlashObject.SetMemberFlashString( "tfDescPath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1_description") );
  919.         l_DataFlashObject.SetMemberFlashString( "tfDescPath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2_description") );
  920.         l_DataFlashObject.SetMemberFlashString( "tfDescPath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3_description") );
  921.        
  922.         l_DataFlashObject.SetMemberFlashString( "tfWarning", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_warning_level") );
  923.         l_DataFlashObject.SetMemberFlashString( "tfGoodLuck", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_good_luck") );
  924.        
  925.         m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage" + epIndex, l_DataFlashObject );
  926.     }
  927.    
  928.     private function prepareBigMessageGOTY( text : string )
  929.     {
  930.         var l_DataFlashObject       : CScriptedFlashObject;
  931.         var title1 : string;
  932.         var content : string;
  933.         var titleEnd : string;
  934.  
  935.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  936.  
  937.         title1   = GetLocStringByKey( text );
  938.         content  = GetLocStringByKey( "menu_goty_starting_message_content" );
  939.         titleEnd = GetLocStringByKey( "ep1_installed_information_good_luck" );
  940.  
  941.         l_DataFlashObject.SetMemberFlashInt( "index", 3 );
  942.         l_DataFlashObject.SetMemberFlashString( "tfTitle1",   title1 );
  943.         l_DataFlashObject.SetMemberFlashString( "tfContent",  content );
  944.         l_DataFlashObject.SetMemberFlashString( "tfTitleEnd", titleEnd );
  945.        
  946.         m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage3", l_DataFlashObject );
  947.  
  948.     }
  949.    
  950.     public function StartShowCustomDialogGalaxySignIn()
  951.     {
  952.         var l_DataFlashObject       : CScriptedFlashObject;
  953.         var isPlatformPC        : bool;
  954.        
  955.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  956.         isPlatformPC = (theGame.GetGalaxyPf() == Platform_PC);
  957.        
  958.         l_DataFlashObject.SetMemberFlashInt( "index", 4 );
  959.         l_DataFlashObject.SetMemberFlashBool("isPlatformPC", isPlatformPC);
  960.         l_DataFlashObject.SetMemberFlashString( "tfTitleSignIn", "[[ui_gog_qr_title]]" );
  961.         l_DataFlashObject.SetMemberFlashString( "tfContentSignInTopA", "[[ui_gog_qr_explain_1]]" );
  962.         l_DataFlashObject.SetMemberFlashString( "tfContentSignInTopB", "[[ui_gog_qr_explain_2]]" );
  963.         if (isPlatformPC) {
  964.             if (theGame.UsesRedLauncher())
  965.                 l_DataFlashObject.SetMemberFlashString( "tfContentSignIn2", "[[ui_gog_red_launcher_signin_instructions]]");
  966.             else
  967.                 l_DataFlashObject.SetMemberFlashString( "tfContentSignIn2", "[[ui_gog_pc_signin_instructions]]");
  968.         }
  969.         else
  970.         {
  971.             l_DataFlashObject.SetMemberFlashString( "tfLink1" , "[[ui_gog_qr_pls_wait]]");
  972.             l_DataFlashObject.SetMemberFlashString( "tfContentSignIn2", "[[ui_gog_qr_use_url]]");
  973.             l_DataFlashObject.SetMemberFlashString( "tfContentSignIn3", "[[ui_gog_qr_scan_hint]]" );
  974.         }
  975.        
  976.         m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage4", l_DataFlashObject );
  977.     }
  978.  
  979.     public function HideErrorWindow()
  980.     {
  981.         m_fxHideErrorWindow.InvokeSelf();
  982.     }
  983.  
  984.     public function ShowErrorWindow(error : int)
  985.     {
  986.         var l_DataFlashObject : CScriptedFlashObject;
  987.         var tfDescription : string ;
  988.        
  989.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  990.         switch(error)
  991.         {
  992.             case RewardsRequestFailed:
  993.             case QRCodeRequestFailed:
  994.             case GOGNoInternetConnection:
  995.                 tfDescription = "[[ui_gog_error_no_connection]]";
  996.                 break;
  997.             case RewardsTemporaryFail:
  998.                 tfDescription = "[[ui_gog_error_fault_retry]]";
  999.                 break;
  1000.             default:
  1001.                 tfDescription = "[[ui_gog_error_smt_wrong]]";
  1002.                 break;
  1003.         }      
  1004.         l_DataFlashObject.SetMemberFlashString("tfTitleError","[[ui_gog_error_popup_title]]");
  1005.         l_DataFlashObject.SetMemberFlashString("tfDescription",tfDescription);
  1006.        
  1007.         m_flashValueStorage.SetFlashObject("ingamemenu.ErrorHandleWindow", l_DataFlashObject);
  1008.     }
  1009.  
  1010.     private function SetRewardsCellParams( out dataFObj : CScriptedFlashObject, out rewarr : array< int >, cellName: string, rewID : int )
  1011.     {
  1012.         var rewTitle : string ;
  1013.         var rewDesc : string ;
  1014.         var isPresent : bool ;
  1015.        
  1016.        
  1017.         isPresent = rewarr.Contains(rewID);
  1018.         dataFObj.SetMemberFlashBool("b"+cellName+"on", isPresent);
  1019.         if ( !isPresent ) {
  1020.             return;
  1021.         }  
  1022.        
  1023.        
  1024.         theGame.GetGuiManager().GetGalaxyRewardDesc( rewID, rewTitle, rewDesc );
  1025.         dataFObj.SetMemberFlashString("tf"+cellName+"title", rewTitle);
  1026.         dataFObj.SetMemberFlashString("tf"+cellName+"desc", rewDesc);
  1027.     }
  1028.  
  1029.     public function ShowRewardsWindow( out rewarr : array< int > )
  1030.     {      
  1031.         var dataFObj : CScriptedFlashObject;
  1032.         var tfTableTitle : string ;
  1033.         var tfTableDescription : string ;
  1034.         var tfRoachDescription : string ;
  1035.         var isRoachPresent : bool ;
  1036.  
  1037.        
  1038.         dataFObj = m_flashValueStorage.CreateTempFlashObject();
  1039.         tfTableTitle = GetLocStringByKeyExt("ui_gog_rewards_table_title");
  1040.         dataFObj.SetMemberFlashString("tfTitleRewards",tfTableTitle);
  1041.         if(theGame.GetPlatform() == Platform_PC)
  1042.             dataFObj.SetMemberFlashString("tfTitleLink","[[ui_gog_link_rewards]]");
  1043.         else
  1044.             dataFObj.SetMemberFlashString("tfTitleLink","");
  1045.         tfTableDescription = GetLocStringByKeyExt("ui_gog_rewards_table_description");
  1046.         dataFObj.SetMemberFlashString("tfTopDescription",tfTableDescription);
  1047.        
  1048.        
  1049.        
  1050.        
  1051.        
  1052.        
  1053.        
  1054.        
  1055.         SetRewardsCellParams( dataFObj, rewarr, "Cell_1_1", 6);  
  1056.         SetRewardsCellParams( dataFObj, rewarr, "Cell_1_2", 7);  
  1057.         SetRewardsCellParams( dataFObj, rewarr, "Cell_2_1", 8);  
  1058.         SetRewardsCellParams( dataFObj, rewarr, "Cell_2_2", 9);  
  1059.         SetRewardsCellParams( dataFObj, rewarr, "Cell_3_1", 10);
  1060.         SetRewardsCellParams( dataFObj, rewarr, "Cell_3_2", 11);
  1061.         SetRewardsCellParams( dataFObj, rewarr, "Cell_4_1", 12);
  1062.         SetRewardsCellParams( dataFObj, rewarr, "Cell_4_2", 13);
  1063.         SetRewardsCellParams( dataFObj, rewarr, "Cell_5_1", 14);
  1064.         SetRewardsCellParams( dataFObj, rewarr, "Cell_5_2", 15);
  1065.        
  1066.        
  1067.         isRoachPresent = rewarr.Contains(12);
  1068.         if  (isRoachPresent) {
  1069.             tfRoachDescription = GetLocStringByKeyExt("ui_gog_reward_roach_table_desc");
  1070.         } else {
  1071.             tfRoachDescription = "";
  1072.         }
  1073.         dataFObj.SetMemberFlashString("tfRoachDescription",tfRoachDescription);
  1074.  
  1075.        
  1076.         m_flashValueStorage.SetFlashObject("ingamemenu.RewardsTableWindow", dataFObj);
  1077.     }
  1078.    
  1079.     private function ShowTelemetryWindow()
  1080.     {
  1081.         var l_DataFlashObject   : CScriptedFlashObject;
  1082.         var isPlatformPC        : bool = (theGame.GetGalaxyPf() == Platform_PC);
  1083.        
  1084.         if( theGame.isUserSignedIn() )
  1085.         {
  1086.             l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  1087.  
  1088.             l_DataFlashObject.SetMemberFlashBool("isPlatformPC", isPlatformPC);
  1089.             l_DataFlashObject.SetMemberFlashString("tfTelemetryTitle","[[ui_gog_tel_consent_title]]");
  1090.             l_DataFlashObject.SetMemberFlashString("tfTelemetryContent","[[ui_gog_tel_consent_big_text]]");
  1091.             l_DataFlashObject.SetMemberFlashString("tfTelemetryContent2","[[ui_gog_tel_consent_question]]");
  1092.             l_DataFlashObject.SetMemberFlashString("tfTelemetryFooter","[[ui_gog_tel_consent_thanks]]");
  1093.             l_DataFlashObject.SetMemberFlashString("tfTelemetryFooter2","CD PROJEKT RED");
  1094.            
  1095.             m_flashValueStorage.SetFlashObject("ingamemenu.TelemetryModalWindow",l_DataFlashObject);
  1096.            
  1097.             theTelemetry.MarkShownConsentWindow();
  1098.         }
  1099.     }
  1100.        
  1101.     protected function LoadLastSave():void
  1102.     {
  1103.         if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1104.         {
  1105.             return;
  1106.         }
  1107.        
  1108.         SetIgnoreInput(true);
  1109.        
  1110.         if (isMainMenu)
  1111.         {
  1112.             disableAccountPicker = true;
  1113.         }
  1114.        
  1115.         theGame.LoadLastGameInit();
  1116.     }
  1117.    
  1118.     protected function ShowActionConfPopup(action : int, title : string, description : string) : void
  1119.     {
  1120.         if (actionConfPopup)
  1121.         {
  1122.             delete actionConfPopup;
  1123.         }
  1124.        
  1125.         actionConfPopup = new W3ActionConfirmation in this;
  1126.         actionConfPopup.SetMessageTitle(title);
  1127.         actionConfPopup.SetMessageText(description);
  1128.         actionConfPopup.actionID = action;
  1129.         actionConfPopup.menuRef = this;
  1130.         actionConfPopup.BlurBackground = true;
  1131.            
  1132.         RequestSubMenu('PopupMenu', actionConfPopup);
  1133.     }
  1134.    
  1135.     public function OnActionConfirmed(action:int) : void
  1136.     {
  1137.         var parentMenu : CR4MenuBase;
  1138.        
  1139.         parentMenu = (CR4MenuBase)GetParent();
  1140.        
  1141.         switch (action)
  1142.         {
  1143.         case IGMActionType_Quit:
  1144.             {
  1145.                 parentMenu.OnCloseMenu();
  1146.                 theGame.RequestEndGame();
  1147.                 break;
  1148.             }
  1149.         case IGMActionType_CloseGame:
  1150.             {
  1151.                 theGame.RequestExit();
  1152.                 break;
  1153.             }
  1154.         }
  1155.     }
  1156.    
  1157.     event  OnPresetApplied(groupId:name, targetPresetIndex:int)
  1158.     {
  1159.         hasChangedOption = true;
  1160.         IngameMenu_ChangePresetValue(groupId, targetPresetIndex, this);
  1161.        
  1162.         if (groupId == 'Rendering' && !isMainMenu)
  1163.         {
  1164.             m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  1165.         }
  1166.        
  1167.        
  1168.         if(groupId == 'PostProcess')
  1169.         {
  1170.             UpdateAO2CorrespondRT(theGame.GetRTEnabled(), true);
  1171.             UpdateOptions('PostProcess', false);
  1172.         }
  1173.  
  1174.         updateOptionsDisableState();
  1175.     }
  1176.    
  1177.     event  OnTelemetryConsentChanged(telemetryConsent:bool)
  1178.     {
  1179.         theTelemetry.TelemetryConsentChanged( telemetryConsent );
  1180.        
  1181.     }
  1182.    
  1183.     event  OnConsentPopupWasShown(consentPopupWasShown: bool)
  1184.     {
  1185.         theTelemetry.MarkShownConsentWindow();
  1186.     }
  1187.    
  1188.     public function UpdateOptions(groupId:name, applyLocks:bool)
  1189.     {
  1190.         var optionChangeContainer : CScriptedFlashObject;
  1191.        
  1192.         optionChangeContainer = m_flashValueStorage.CreateTempFlashObject();
  1193.         IngameMenu_GatherOptionUpdatedValues(groupId, optionChangeContainer, m_flashValueStorage, applyLocks);
  1194.        
  1195.         m_flashValueStorage.SetFlashObject( "ingamemenu.optionValueChanges", optionChangeContainer );
  1196.         IngameMenu_GatherOptionUpdatedValueList(groupId, m_flashValueStorage);
  1197.     }
  1198.    
  1199.     public function DLSSSupported()
  1200.     {
  1201.         var DLSSIsSupported : bool;
  1202.         DLSSIsSupported = theGame.GetIsDLSSSupported();
  1203.         m_fxSetDLSSIsSupported.InvokeSelfTwoArgs( FlashArgBool(DLSSIsSupported), FlashArgUInt(NameToFlashUInt('AAMode') ));            
  1204.     }
  1205.    
  1206.     public function RTEnabled()
  1207.     {
  1208.         var RTEnabled : bool;
  1209.         RTEnabled = theGame.GetRTEnabled();
  1210.         m_fxSetRTEnabled.InvokeSelfTwoArgs( FlashArgBool(RTEnabled), FlashArgUInt(NameToFlashUInt('Virtual_SSAOSolution') ));
  1211.         if(RTEnabled == false)
  1212.         {
  1213.             if( StringToInt(mInGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) >= 2 )
  1214.             {
  1215.                 mInGameConfigWrapper.SetVarValue( 'PostProcess', 'Virtual_SSAOSolution','1' );
  1216.                 m_fxUpdateOptionValue.InvokeSelfTwoArgs( FlashArgUInt(NameToFlashUInt('Virtual_SSAOSolution')), FlashArgString('1') );
  1217.             }
  1218.         }
  1219.     }
  1220.    
  1221.     event  OnCancelOptionValueChange(groupId:int, optionName:name)
  1222.     {
  1223.         var groupName:name;
  1224.         var curTimeGetOption:int;
  1225.                
  1226.         groupName = mInGameConfigWrapper.GetGroupName(groupId);
  1227.  
  1228.         if (groupName == 'Graphics' && optionName == 'AAMode' && theGame.GetIsDLSSSupported() == false)
  1229.         {
  1230.             showNotification(GetPlatformLocString("option_warning_dlss_support"));
  1231.         }
  1232.        
  1233.        
  1234.        
  1235.        
  1236.        
  1237.        
  1238.        
  1239.        
  1240.        
  1241.         curTimeGetOption = theGame.GetLocalTimeAsMilliseconds();
  1242.         if(((curTimeGetOption - lastTimeGetOption) > 300))
  1243.         {
  1244.             lastTimeGetOption = curTimeGetOption;
  1245.             theSound.SoundEvent("gui_global_denied");
  1246.         }
  1247.     }
  1248.    
  1249.     event  OnOptionValueChanged(groupId:int, optionName:name, optionValue:string)
  1250.     {
  1251.         var groupName           : name;
  1252.         var hud                 : CR4ScriptedHud;
  1253.         var isValid             : bool;
  1254.         var isBuffered          : bool;
  1255.                
  1256.        
  1257.         var dialogModule : CR4HudModuleDialog;
  1258.         var subtitleModule : CR4HudModuleSubtitles;
  1259.         var onelinerModule : CR4HudModuleOneliners;
  1260.        
  1261.        
  1262.        
  1263.         var minimapModule : CR4HudModuleMinimap2;
  1264.        
  1265.        
  1266.        
  1267.         var objectiveModule : CR4HudModuleQuests;
  1268.        
  1269.  
  1270.         hasChangedOption = true;
  1271.        
  1272.         OnPlaySoundEvent( "gui_global_switch" );
  1273.        
  1274.        
  1275.         if (groupId == NameToFlashUInt('SpecialSettingsGroupId'))
  1276.         {
  1277.             HandleSpecialValueChanged(optionName, optionValue);
  1278.             return true;
  1279.         }      
  1280.        
  1281.        
  1282.         if (optionName == 'InvertLockOption')
  1283.         {
  1284.             if ( optionValue == "true" )
  1285.                 thePlayer.SetInvertedLockOption(true);
  1286.             else
  1287.                 thePlayer.SetInvertedLockOption(false);
  1288.         }
  1289.        
  1290.         if (optionName == 'InvertCameraX')
  1291.         {
  1292.             if ( optionValue == "true" )
  1293.                 thePlayer.SetInvertedCameraX(true);
  1294.             else
  1295.                 thePlayer.SetInvertedCameraX(false);
  1296.         }
  1297.        
  1298.         if (optionName == 'InvertCameraY')
  1299.         {
  1300.             if ( optionValue == "true" )
  1301.                 thePlayer.SetInvertedCameraY(true);
  1302.             else
  1303.                 thePlayer.SetInvertedCameraY(false);
  1304.         }
  1305.        
  1306.         if (optionName == 'InvertCameraXOnMouse')
  1307.         {
  1308.             if ( optionValue == "true" )
  1309.                 thePlayer.SetInvertedMouseCameraX(true);
  1310.             else
  1311.                 thePlayer.SetInvertedMouseCameraX(false);
  1312.         }
  1313.        
  1314.         if (optionName == 'InvertCameraYOnMouse')
  1315.         {
  1316.             if ( optionValue == "true" )
  1317.                 thePlayer.SetInvertedMouseCameraY(true);
  1318.             else
  1319.                 thePlayer.SetInvertedMouseCameraY(false);
  1320.         }
  1321.        
  1322.        
  1323.        
  1324.         if (optionName == 'EnableAlternateSignCasting')
  1325.         {
  1326.             if ( optionValue == "1" )
  1327.             {
  1328.                 thePlayer.GetInputHandler().SetIsAltSignCasting(true);
  1329.                 FactsSet( "nge_alt_sign_casting_chosen", 1 );
  1330.             }
  1331.             else
  1332.             {
  1333.                 thePlayer.GetInputHandler().SetIsAltSignCasting(false);
  1334.                 FactsSet( "nge_alt_sign_casting_chosen", 0 );
  1335.             }
  1336.             thePlayer.ApplyCastSettings();
  1337.         }
  1338.        
  1339.        
  1340.        
  1341.         if (optionName == 'EnableAlternateExplorationCamera')
  1342.         {
  1343.             if ( optionValue == "1" )
  1344.                 thePlayer.SetExplCamera(true);
  1345.             else
  1346.                 thePlayer.SetExplCamera(false);
  1347.         }
  1348.        
  1349.         if (optionName == 'EnableAlternateCombatCamera')
  1350.         {
  1351.             if ( optionValue == "1" )
  1352.                 thePlayer.SetCmbtCamera(true);
  1353.             else
  1354.                 thePlayer.SetCmbtCamera(false);
  1355.         }
  1356.        
  1357.         if (optionName == 'EnableAlternateHorseCamera')
  1358.         {
  1359.             if ( optionValue == "1" )
  1360.                 thePlayer.SetHorseCamera(true);
  1361.             else
  1362.                 thePlayer.SetHorseCamera(false);
  1363.         }
  1364.        
  1365.         if (optionName == 'SoftLockCameraAssist')
  1366.         {
  1367.             if ( optionValue == "true" )
  1368.                 thePlayer.SetSoftLockCameraAssist(true);
  1369.             else
  1370.                 thePlayer.SetSoftLockCameraAssist(false);
  1371.         }
  1372.        
  1373.        
  1374.        
  1375.         if (optionName == 'SubtitleScale')
  1376.         {
  1377.             hud = (CR4ScriptedHud)theGame.GetHud();
  1378.            
  1379.             if(hud)
  1380.             {
  1381.                 dialogModule = (CR4HudModuleDialog)hud.GetHudModule("DialogModule");
  1382.                 if(dialogModule)
  1383.                     dialogModule.SetSubtitleScale( StringToInt(optionValue) );
  1384.                
  1385.                 subtitleModule = (CR4HudModuleSubtitles)hud.GetHudModule("SubtitlesModule");
  1386.                 if(subtitleModule)
  1387.                     subtitleModule.SetSubtitleScale( StringToInt(optionValue) );
  1388.             }
  1389.         }
  1390.        
  1391.         if (optionName == 'DialogChoiceScale')
  1392.         {
  1393.             hud = (CR4ScriptedHud)theGame.GetHud();
  1394.            
  1395.             if(hud)
  1396.             {
  1397.                 dialogModule = (CR4HudModuleDialog)hud.GetHudModule("DialogModule");
  1398.                 if(dialogModule)
  1399.                     dialogModule.SetDialogChoiceScale( StringToInt(optionValue) );
  1400.             }
  1401.         }
  1402.        
  1403.         if (optionName == 'OnelinerScale')
  1404.         {
  1405.             hud = (CR4ScriptedHud)theGame.GetHud();
  1406.            
  1407.             if(hud)
  1408.             {
  1409.                 onelinerModule = (CR4HudModuleOneliners)hud.GetHudModule("OnelinersModule");
  1410.                 if(onelinerModule)
  1411.                     onelinerModule.SetOnelinerScale( StringToInt(optionValue) );
  1412.             }
  1413.         }
  1414.        
  1415.        
  1416.        
  1417.         if (optionName == 'MinimapDuringFocusCombat')
  1418.         {
  1419.             hud = (CR4ScriptedHud)theGame.GetHud();
  1420.            
  1421.             if(hud)
  1422.             {
  1423.                 minimapModule = (CR4HudModuleMinimap2)hud.GetHudModule("Minimap2Module");
  1424.                 if(minimapModule)
  1425.                 {
  1426.                     if ( optionValue == "true" )
  1427.                     {
  1428.                         minimapModule.SetMinimapDuringFocusCombat( true );
  1429.                     }
  1430.                     else
  1431.                     {
  1432.                         minimapModule.SetMinimapDuringFocusCombat( false );
  1433.                     }
  1434.                 }                  
  1435.             }
  1436.         }
  1437.        
  1438.        
  1439.        
  1440.         if (optionName == 'ObjectiveDuringFocusCombat')
  1441.         {
  1442.             hud = (CR4ScriptedHud)theGame.GetHud();
  1443.            
  1444.             if(hud)
  1445.             {
  1446.                 objectiveModule = (CR4HudModuleQuests)hud.GetHudModule("QuestsModule");
  1447.                 if(objectiveModule)
  1448.                 {
  1449.                     if ( optionValue == "true" )
  1450.                     {
  1451.                         objectiveModule.SetObjectiveDuringFocusCombat( true );
  1452.                     }
  1453.                     else
  1454.                     {
  1455.                         objectiveModule.SetObjectiveDuringFocusCombat( false );
  1456.                     }
  1457.                 }                  
  1458.             }
  1459.         }
  1460.        
  1461.        
  1462.        
  1463.         if (optionName == 'LeftStickSprint')
  1464.         {
  1465.             if ( optionValue == "true" )
  1466.                 thePlayer.SetLeftStickSprint(true);
  1467.             else
  1468.                 thePlayer.SetLeftStickSprint(false);
  1469.         }
  1470.        
  1471.        
  1472.         if (optionName == 'HardwareCursor')
  1473.         {
  1474.             isValid = optionValue;
  1475.             m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(isValid));
  1476.         }
  1477.        
  1478.         if( optionName == 'ConsentTelemetry' )
  1479.         {
  1480.             if ( optionValue =="true" )
  1481.             {
  1482.                 OnTelemetryConsentChanged(true);
  1483.             }
  1484.             else
  1485.             {
  1486.                 OnTelemetryConsentChanged(false);
  1487.             }
  1488.         }
  1489.        
  1490.         if (optionName == 'SwapAcceptCancel')
  1491.         {
  1492.             swapAcceptCancelChanged = true;
  1493.         }
  1494.        
  1495.         if (optionName == 'AlternativeRadialMenuInputMode')
  1496.         {
  1497.             alternativeRadialInputChanged = true;
  1498.         }
  1499.        
  1500.         if (optionName == 'EnableUberMovement')
  1501.         {
  1502.             if ( optionValue == "1" )
  1503.                 theGame.EnableUberMovement( true );
  1504.             else
  1505.                 theGame.EnableUberMovement( false );
  1506.         }
  1507.        
  1508.         if (optionName == 'GwentDifficulty')
  1509.         {
  1510.             if ( optionValue == "0" )
  1511.                 FactsSet( 'gwent_difficulty' , 1 );
  1512.             else if ( optionValue == "1" )
  1513.                 FactsSet( 'gwent_difficulty' , 2 );
  1514.             else if ( optionValue == "2" )
  1515.                 FactsSet( 'gwent_difficulty' , 3 );
  1516.            
  1517.             return true;
  1518.         }
  1519.        
  1520.         if (optionName == 'HardwareCursor')
  1521.         {
  1522.             updateInputDeviceRequired = true;
  1523.         }
  1524.        
  1525.         groupName = mInGameConfigWrapper.GetGroupName( groupId );
  1526.        
  1527.        
  1528.         isBuffered =
  1529.             ( mInGameConfigWrapper.DoGroupHasTag( groupName, 'buffered' ) || mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'buffered' ) )
  1530.             && !mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'dropDown' )
  1531.             && !mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'nonbuffered' );
  1532.        
  1533.         if ( groupName == 'Localization' &&
  1534.              optionName == 'Virtual_Localization_speech' &&
  1535.              theGame.GetVoiceLangDownloadStatus( mInGameConfigWrapper.GetVarOption( groupName, optionName, StringToInt( optionValue ) ) ) != STREAMABLE_LOADED
  1536.             )
  1537.         {
  1538.             return true;
  1539.         }
  1540.        
  1541.         if( isBuffered == true )
  1542.         {
  1543.             inGameConfigBufferedWrapper.SetVarValue(groupName, optionName, optionValue);
  1544.         }
  1545.         else
  1546.         {
  1547.             mInGameConfigWrapper.SetVarValue(groupName, optionName, optionValue);
  1548.         }
  1549.            
  1550.         theGame.OnConfigValueChanged(optionName, optionValue);
  1551.        
  1552.         if (groupName == 'Hud' || optionName == 'Subtitles')
  1553.         {
  1554.             hud = (CR4ScriptedHud)theGame.GetHud();
  1555.            
  1556.             if (hud)
  1557.             {
  1558.                 hud.UpdateHudConfig(optionName, true);
  1559.             }
  1560.         }
  1561.        
  1562.         if (groupName == 'Localization')
  1563.         {
  1564.             if (optionName == 'Virtual_Localization_text')
  1565.             {
  1566.                 currentLangValue = optionValue;
  1567.             }
  1568.             else if (optionName == 'Virtual_Localization_speech')
  1569.             {
  1570.                 currentSpeechLang = optionValue;
  1571.             }
  1572.         }
  1573.        
  1574.         if (groupName == 'Rendering' && !isMainMenu)
  1575.         {
  1576.             m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  1577.         }
  1578.        
  1579.         if (groupName == 'Rendering' && optionName == 'PreserveSystemGamma')
  1580.         {
  1581.             theGame.GetGuiManager().DisplayRestartGameToApplyAllChanges();
  1582.         }
  1583.        
  1584.         if(optionName == 'EnableRT')
  1585.         {
  1586.            
  1587.             if( optionValue == "true" )
  1588.             {
  1589.                 if(StringToInt(mInGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) != IGMOPT_AO_NRDRTAO)
  1590.                 {
  1591.                     mInGameConfigWrapper.SetVarValue('PostProcess', 'Virtual_SSAOSolution', IntToString(IGMOPT_AO_NRDRTAO));
  1592.                 }
  1593.             }
  1594.             if( optionValue == "false" )
  1595.             {
  1596.                 if(StringToInt(mInGameConfigWrapper.GetVarValue('PostProcess', 'Virtual_SSAOSolution')) >= IGMOPT_AO_RTAO)
  1597.                 {
  1598.                     mInGameConfigWrapper.SetVarValue('PostProcess', 'Virtual_SSAOSolution', IntToString(IGMOPT_AO_SSAO));
  1599.                 }
  1600.             }
  1601.             UpdateAO2CorrespondRT(optionValue == "true", false);
  1602.             UpdateOptions('PostProcess', false);
  1603.  
  1604.            
  1605.             updateRTOptionEnabled(optionValue == "true");
  1606.             updateRTAOOptionChanged();
  1607.             updateRTROptionChanged();
  1608.         }
  1609.        
  1610.         if (optionName == 'AllowMotionBlur')
  1611.         {
  1612.             updateMotionBlurOptionChanged(optionValue == "true");
  1613.         }
  1614.  
  1615.        
  1616.        
  1617.        
  1618.        
  1619.        
  1620.        
  1621.  
  1622.        
  1623.        
  1624.        
  1625.        
  1626.        
  1627.        
  1628.  
  1629.         if ( optionName == 'Virtual_HairWorksLevel' )
  1630.         {
  1631.             updateHairWorksOptionChanged();
  1632.         }
  1633.        
  1634.         if( optionName == 'AAMode' )
  1635.         {
  1636.             UpdateOptions('PostProcess', true);
  1637.             updateAAOptionChanged();
  1638.         }
  1639.  
  1640.         if (optionName == 'RTAOEnabled')
  1641.         {
  1642.             updateRTAOOptionChanged();
  1643.         }
  1644.  
  1645.         if (optionName == 'EnableRtRadiance')
  1646.         {
  1647.             updateRTROptionChanged();
  1648.         }
  1649.        
  1650.         if( optionName == 'DeveloperMode' )
  1651.         {
  1652.             ShowDeveloperOptions( optionValue == "true" );
  1653.         }
  1654.  
  1655.         if (optionName == 'GraphicsPreset')
  1656.         {
  1657.             setLocksOnPresetChanged();
  1658.         }
  1659.  
  1660.         if (optionName == 'Virtual_DLSSG')
  1661.         {
  1662.             updateDLSSGOptionChanged();
  1663.         }
  1664.  
  1665.         if (optionName == 'Virtual_Reflex')
  1666.         {
  1667.             updateReflexOptionChanged();
  1668.         }
  1669.  
  1670.         IngameMenu_AdditionalOptionValueChangeHandling( groupName, optionName, optionValue, m_flashValueStorage );
  1671.  
  1672.        
  1673.        
  1674.        
  1675.        
  1676.        
  1677.        
  1678.         if ( optionName == 'CrossProgression' )
  1679.         {
  1680.             theGame.UpdateCrossProgressionValue( optionValue );
  1681.         }
  1682.     }
  1683.    
  1684.     private function updateMotionBlurOptionChanged(enabled:bool):void
  1685.     {
  1686.         var dataObject : CScriptedFlashObject;
  1687.         var dataArray : CScriptedFlashArray;
  1688.  
  1689.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1690.  
  1691.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1692.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('MotionBlurIntensity') );
  1693.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1694.         dataArray.PushBackFlashObject(dataObject);
  1695.        
  1696.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1697.        
  1698.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1699.     }
  1700.  
  1701.     private function setLocksOnPresetChanged():void
  1702.     {
  1703.         setLocksOnRTChange(theGame.GetRTEnabled());
  1704.         updateHairWorksOptionChanged();
  1705.         updateAAOptionChanged();
  1706.     }
  1707.  
  1708.     private function setLocksOnRTChange(enabled:bool):void
  1709.     {
  1710.         UpdateAO2CorrespondRT(enabled, false);
  1711.         UpdateOptions('PostProcess', true);
  1712.         updateRTOptionEnabled(enabled);
  1713.         updateRTAOOptionChanged();
  1714.         updateRTROptionChanged();
  1715.     }
  1716.  
  1717.     private function updateOptionsDisableState():void
  1718.     {
  1719.         updateRTOptionEnabled(theGame.GetRTEnabled());
  1720.         updateAAOptionChanged();
  1721.         updateHairWorksOptionChanged();
  1722.         updateRTAOOptionChanged();
  1723.         updateRTROptionChanged();
  1724.     }
  1725.  
  1726.     protected function updateRTOptionEnabled(enabled:bool):void
  1727.     {
  1728.         var dataObject : CScriptedFlashObject;
  1729.         var dataArray : CScriptedFlashArray;
  1730.  
  1731.         if ( !theGame.GetRTSupported() ) return;
  1732.  
  1733.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1734.  
  1735.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1736.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('RTGIPreset') );
  1737.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1738.         dataArray.PushBackFlashObject(dataObject);
  1739.  
  1740.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1741.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('EnableRtRadiance') );
  1742.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1743.         dataArray.PushBackFlashObject(dataObject);
  1744.  
  1745.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1746.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Shadows') );
  1747.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1748.         dataArray.PushBackFlashObject(dataObject);
  1749.  
  1750.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1751.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('RTAOEnabled') );
  1752.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1753.         dataArray.PushBackFlashObject(dataObject);
  1754.  
  1755.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1756.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_GlobalIllumination') );
  1757.         dataObject.SetMemberFlashBool( "disabled", !enabled);
  1758.         dataArray.PushBackFlashObject(dataObject);
  1759.  
  1760.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1761.        
  1762.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1763.     }
  1764.  
  1765.     protected function updateAAOptionChanged():void
  1766.     {
  1767.         var dataObject : CScriptedFlashObject;
  1768.         var dataArray : CScriptedFlashArray;
  1769.  
  1770.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1771.  
  1772.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1773.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('FSRQuality') );
  1774.         dataObject.SetMemberFlashBool( "disabled", !theGame.GetFSREnabled());
  1775.         dataArray.PushBackFlashObject(dataObject);
  1776.  
  1777.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1778.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('DLSSQuality') );
  1779.         dataObject.SetMemberFlashBool( "disabled", !theGame.GetDLSSEnabled());
  1780.         dataArray.PushBackFlashObject(dataObject);
  1781.  
  1782.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1783.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('DynamicResolutionScaling') );
  1784.         dataObject.SetMemberFlashBool( "disabled", theGame.GetDLSSEnabled() || theGame.GetDLSSGEnabled());
  1785.         dataArray.PushBackFlashObject(dataObject);
  1786.  
  1787.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1788.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_SharpenAmount') );
  1789.         dataObject.SetMemberFlashBool( "disabled", false );
  1790.         dataArray.PushBackFlashObject(dataObject);
  1791.  
  1792.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1793.        
  1794.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1795.     }
  1796.  
  1797.     protected function updateHairWorksOptionChanged():void
  1798.     {
  1799.         var dataObject : CScriptedFlashObject;
  1800.         var dataArray : CScriptedFlashArray;
  1801.  
  1802.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1803.  
  1804.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1805.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_HairWorksAALevel') );
  1806.         dataObject.SetMemberFlashBool( "disabled", !theGame.GetHairWorksEnabled());
  1807.         dataArray.PushBackFlashObject(dataObject);
  1808.  
  1809.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1810.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_HairWorksQualityPreset') );
  1811.         dataObject.SetMemberFlashBool( "disabled", !theGame.GetHairWorksEnabled());
  1812.         dataArray.PushBackFlashObject(dataObject);
  1813.  
  1814.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1815.        
  1816.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1817.     }
  1818.  
  1819.     protected function updateRTAOOptionChanged():void
  1820.     {
  1821.         var dataObject : CScriptedFlashObject;
  1822.         var dataArray : CScriptedFlashArray;
  1823.  
  1824.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1825.  
  1826.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1827.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('SSAOEnabled') );
  1828.         dataObject.SetMemberFlashBool( "disabled", theGame.GetRTAOEnabled());
  1829.         dataArray.PushBackFlashObject(dataObject);
  1830.  
  1831.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1832.        
  1833.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1834.     }
  1835.  
  1836.     protected function updateDLSSGOptionChanged():void
  1837.     {
  1838.         var dataObject : CScriptedFlashObject;
  1839.         var dataArray : CScriptedFlashArray;
  1840.         var dlssEnabled : bool;
  1841.         var dlssgEnabled : bool;
  1842.  
  1843.         dlssEnabled = theGame.GetDLSSEnabled();
  1844.         dlssgEnabled = theGame.GetDLSSGEnabled();
  1845.  
  1846.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1847.  
  1848.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1849.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_Reflex') );
  1850.         dataObject.SetMemberFlashBool( "disabled", dlssgEnabled || !theGame.GetReflexSupported());
  1851.         if (dlssgEnabled)
  1852.         {
  1853.             dataObject.SetMemberFlashString( "current", "1");
  1854.         }
  1855.         else
  1856.         {
  1857.             dataObject.SetMemberFlashBool( "resetToStartingValue", true);
  1858.         }
  1859.         dataArray.PushBackFlashObject(dataObject);
  1860.  
  1861.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1862.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('VSync') );
  1863.         dataObject.SetMemberFlashBool( "disabled", dlssgEnabled);
  1864.         dataArray.PushBackFlashObject(dataObject);
  1865.  
  1866.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1867.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('FPSLimit') );
  1868.         dataObject.SetMemberFlashBool( "disabled", dlssgEnabled);
  1869.         dataArray.PushBackFlashObject(dataObject);
  1870.  
  1871.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1872.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('DynamicResolutionScaling') );
  1873.         dataObject.SetMemberFlashBool( "disabled", dlssEnabled || dlssgEnabled);
  1874.         dataArray.PushBackFlashObject(dataObject);
  1875.  
  1876.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1877.        
  1878.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1879.     }
  1880.  
  1881.     protected function updateReflexOptionChanged():void
  1882.     {
  1883.         var dataObject : CScriptedFlashObject;
  1884.         var dataArray : CScriptedFlashArray;
  1885.  
  1886.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1887.  
  1888.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1889.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_Reflex') );
  1890.         dataObject.SetMemberFlashBool( "disabled", theGame.GetDLSSGEnabled() || !theGame.GetReflexSupported());
  1891.         if (!theGame.GetDLSSGEnabled())
  1892.         {
  1893.             dataObject.SetMemberFlashBool( "resetStartingValue", true);
  1894.         }
  1895.         dataArray.PushBackFlashObject(dataObject);
  1896.  
  1897.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1898.        
  1899.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1900.     }
  1901.  
  1902.     protected function updateRTROptionChanged():void
  1903.     {
  1904.         var dataObject : CScriptedFlashObject;
  1905.         var dataArray : CScriptedFlashArray;
  1906.  
  1907.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  1908.  
  1909.         dataObject = m_flashValueStorage.CreateTempFlashObject();
  1910.         dataObject.SetMemberFlashUInt( "tag", NameToFlashUInt('Virtual_SSREnabled') );
  1911.         dataObject.SetMemberFlashBool( "disabled", theGame.GetRTREnabled());
  1912.         dataArray.PushBackFlashObject(dataObject);
  1913.  
  1914.         m_flashValueStorage.SetFlashArray( "options.update_disabled", dataArray );
  1915.        
  1916.         theGame.GetGuiManager().ForceProcessFlashStorage();
  1917.     }
  1918.    
  1919.     event  OnButtonClicked( optionName : name )
  1920.     {
  1921.         if ( optionName == 'MoreSpeechLanguages' )
  1922.         {
  1923.             theGame.DisplayStore();
  1924.         }
  1925.     }
  1926.    
  1927.     event  OnOptionSelectionChanged( optionName : name, value : bool)
  1928.     {
  1929.         if (!postprocessEntered && optionName == 'AAMode')
  1930.         {
  1931.             UpdateOptions('PostProcess', true);
  1932.             postprocessEntered = true;
  1933.             updateAAOptionChanged();
  1934.         }
  1935.        
  1936.         if ( optionName == 'EnableRT')
  1937.         {
  1938.            
  1939.             if (value && postprocessRtGreyed == true)
  1940.             {
  1941.                 postprocessRtGreyed = false;
  1942.                 UpdateOptions('PostProcess', false);
  1943.             }
  1944.         }
  1945.         else if (value)
  1946.         {
  1947.             if (postprocessRtGreyed == false)
  1948.             {
  1949.                 postprocessRtGreyed = true;
  1950.                 UpdateOptions('PostProcess', true);
  1951.             }
  1952.         }
  1953.     }
  1954.    
  1955.     protected function HandleSpecialValueChanged(optionName:name, optionValue:string):void
  1956.     {
  1957.         var intValue : int;
  1958.        
  1959.         if (optionName == 'GameDifficulty')
  1960.         {
  1961.             intValue = StringToInt(optionValue, 1);
  1962.            
  1963.             lastSetDifficulty = intValue + 1;
  1964.         }
  1965.     }
  1966.    
  1967.     public function OnGraphicsUpdated(keepChanges:bool):void
  1968.     {
  1969.        
  1970.        
  1971.        
  1972.        
  1973.        
  1974.     }
  1975.    
  1976.     event  OnOptionPanelNavigateBack()
  1977.     {
  1978.         var graphicChangesPending:bool;
  1979.         var hud : CR4ScriptedHud;
  1980.        
  1981.         if (inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1982.         {
  1983.             inGameConfigBufferedWrapper.ApplyNewValues();
  1984.             theGame.GetGuiManager().ShowProgressDialog(UMID_GraphicsRefreshing, "", "message_text_confirm_option_changes", true, UDB_OkCancel, 100, UMPT_GraphicsRefresh, '');
  1985.             ReopenMenu();
  1986.             return true;
  1987.         }
  1988.        
  1989.         hud = (CR4ScriptedHud)theGame.GetHud();
  1990.         if (hud)
  1991.         {
  1992.             hud.RefreshHudConfiguration();
  1993.         }
  1994.        
  1995.         thePlayer.SetAutoCameraCenter( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'AutoCameraCenter' ) );
  1996.         thePlayer.SetEnemyUpscaling( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'EnemyUpscaling' ) );
  1997.     }
  1998.    
  1999.     event  OnNavigatedBack()
  2000.     {
  2001.         var lowestDifficultyUsed : EDifficultyMode;
  2002.         var hud : CR4ScriptedHud;
  2003.         var overlayPopupRef : CR4OverlayPopup;
  2004.         var radialMenuModule : CR4HudModuleRadialMenu;
  2005.         var confirmResult : int;
  2006.         var flashObject : CScriptedFlashObject;
  2007.        
  2008.         hud = (CR4ScriptedHud)(theGame.GetHud());
  2009.         overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  2010.        
  2011.         if( inGameConfigBufferedWrapper.IsEmpty() == false )
  2012.         {
  2013.             if (!inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  2014.             {
  2015.                 inGameConfigBufferedWrapper.FlushBuffer();
  2016.             }
  2017.            
  2018.             hasChangedOption = true;
  2019.         }
  2020.        
  2021.         if ( theGame.GetVoiceLangDownloadStatus( mInGameConfigWrapper.GetVarOption( 'Localization', 'Virtual_Localization_speech', StringToInt( currentSpeechLang ) ) ) != STREAMABLE_LOADED )
  2022.         {
  2023.            
  2024.             currentSpeechLang = lastUsedSpeechLang;
  2025.             mInGameConfigWrapper.SetVarValue( 'Localization', 'Virtual_Localization_speech', currentSpeechLang );
  2026.            
  2027.             theGame.UpdateSpeechLanguageSlider( currentSpeechLang );
  2028.         }
  2029.        
  2030.         if (currentLangValue != lastUsedLangValue || lastUsedSpeechLang != currentSpeechLang)
  2031.         {
  2032.             lastUsedLangValue = currentLangValue;
  2033.             lastUsedSpeechLang = currentSpeechLang;
  2034.             theGame.ReloadLanguage();
  2035.            
  2036.             flashObject = m_flashValueStorage.CreateTempFlashObject();
  2037.             flashObject.SetMemberFlashUInt( "optionTag", NameToFlashUInt( 'Virtual_Localization_speech' ) );
  2038.             flashObject.SetMemberFlashString( "optionSelectedId", currentSpeechLang ); 
  2039.             m_flashValueStorage.SetFlashObject( "option.changedId", flashObject );
  2040.         }
  2041.        
  2042.         if (swapAcceptCancelChanged)
  2043.         {
  2044.             swapAcceptCancelChanged = false;
  2045.             UpdateAcceptCancelSwaping();
  2046.            
  2047.             if (hud)
  2048.             {
  2049.                 hud.UpdateAcceptCancelSwaping();
  2050.             }
  2051.            
  2052.             if (overlayPopupRef)
  2053.             {
  2054.                 overlayPopupRef.UpdateAcceptCancelSwaping();
  2055.             }
  2056.         }
  2057.        
  2058.         if (alternativeRadialInputChanged)
  2059.         {
  2060.             alternativeRadialInputChanged = false;
  2061.            
  2062.             if (hud)
  2063.             {
  2064.                 radialMenuModule =  (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  2065.                 if (radialMenuModule)
  2066.                 {
  2067.                     radialMenuModule.UpdateInputMode();
  2068.                 }
  2069.             }
  2070.         }
  2071.        
  2072.         isShowingSaveList = false;
  2073.         isShowingLoadList = false;
  2074.        
  2075.         OnPlaySoundEvent( "gui_global_panel_close" );
  2076.        
  2077.         lowestDifficultyUsed = theGame.GetLowestDifficultyUsed();
  2078.        
  2079.        
  2080.        
  2081.         if (!isMainMenu && theGame.GetDifficultyLevel() != lastSetDifficulty && lowestDifficultyUsed > lastSetDifficulty && lowestDifficultyUsed > EDM_Medium)
  2082.         {
  2083.             diffChangeConfPopup = new W3DifficultyChangeConfirmation in this;
  2084.            
  2085.             diffChangeConfPopup.SetMessageTitle("");
  2086.             diffChangeConfPopup.SetMessageText( GetPlatformLocString( "difficulty_change_warning_message", "difficulty_change_warning_message_X1" ) );
  2087.             diffChangeConfPopup.menuRef = this;
  2088.             diffChangeConfPopup.targetDifficulty = lastSetDifficulty;
  2089.             diffChangeConfPopup.BlurBackground = true;
  2090.            
  2091.             RequestSubMenu('PopupMenu', diffChangeConfPopup);
  2092.         }
  2093.         else if (lastSetDifficulty != theGame.GetDifficultyLevel())
  2094.         {
  2095.             theGame.SetDifficultyLevel(lastSetDifficulty);
  2096.             theGame.OnDifficultyChanged(lastSetDifficulty);
  2097.         }
  2098.        
  2099.         SaveChangedSettings();
  2100.  
  2101.         if (overlayPopupRef && updateInputDeviceRequired)
  2102.         {
  2103.             updateInputDeviceRequired = false;
  2104.             overlayPopupRef.UpdateInputDevice();
  2105.         }
  2106.  
  2107.        
  2108.         curMenuDepth -= 1;
  2109.         if (curMenuDepth < depthOptions) {
  2110.             curMenuDepth = 1;
  2111.         }
  2112.         theTelemetry.NoticeMenuDepth(curMenuDepth);
  2113.     }
  2114.    
  2115.     public function CancelDifficultyChange() : void
  2116.     {
  2117.         var difficultyIndex:int;
  2118.         var difficultyIndexAsString:string;
  2119.        
  2120.         lastSetDifficulty = theGame.GetDifficultyLevel();
  2121.        
  2122.         difficultyIndex = lastSetDifficulty - 1;
  2123.         difficultyIndexAsString = "" + difficultyIndex;
  2124.         m_fxUpdateOptionValue.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt('GameDifficulty')), FlashArgString(difficultyIndexAsString));
  2125.     }
  2126.    
  2127.     protected function SaveChangedSettings()
  2128.     {
  2129.         if (hasChangedOption)
  2130.         {
  2131.             hasChangedOption = false;
  2132.             theGame.SaveUserSettings();
  2133.             //---=== modFriendlyHUD ===---
  2134.             GetFHUDConfig().UpdateUserSettings();
  2135.             //---=== modFriendlyHUD ===---
  2136.         }
  2137.     }
  2138.    
  2139.     event  OnProfileChange()
  2140.     {
  2141.         if( !disableAccountPicker )
  2142.         {
  2143.             SetIgnoreInput(true);
  2144.             theGame.ChangeActiveUser();
  2145.         }
  2146.     }
  2147.    
  2148.     event  OnSaveGameCalled(type : ESaveGameType, saveArrayIndex : int)
  2149.     {
  2150.         var saves : array< SSavegameInfo >;
  2151.         var currentSave : SSavegameInfo;
  2152.        
  2153.         ignoreInput = true;
  2154.        
  2155.         if ( theGame.AreSavesLocked() )
  2156.         {
  2157.             theGame.GetGuiManager().DisplayLockedSavePopup();
  2158.             SetIgnoreInput(false);
  2159.             return false;
  2160.         }
  2161.    
  2162.         if (saveArrayIndex >= 0)
  2163.         {
  2164.             if (saveConfPopup)
  2165.             {
  2166.                 delete saveConfPopup;
  2167.             }
  2168.            
  2169.             theGame.GetRecentListSG( saves );
  2170.             currentSave = saves[ saveArrayIndex ];
  2171.            
  2172.             saveConfPopup = new W3SaveGameConfirmation in this;
  2173.             saveConfPopup.SetMessageTitle("");
  2174.             saveConfPopup.SetMessageText( GetPlatformLocString( "error_message_overwrite_save" ) );
  2175.             saveConfPopup.menuRef = this;
  2176.             saveConfPopup.type = currentSave.slotType;
  2177.             saveConfPopup.slot = currentSave.slotIndex;
  2178.             saveConfPopup.BlurBackground = true;
  2179.                
  2180.             RequestSubMenu('PopupMenu', saveConfPopup);
  2181.         }
  2182.         else
  2183.         {
  2184.             executeSave(type, -1);
  2185.             SetIgnoreInput(false);
  2186.         }
  2187.     }
  2188.    
  2189.     public function executeSave(type : ESaveGameType, slot : int)
  2190.     {
  2191.         theGame.SaveGame(type, slot);
  2192.         m_fxNavigateBack.InvokeSelf();
  2193.     }
  2194.    
  2195.     event  OnLoadGameCalled(type : ESaveGameType, saveListIndex : int)
  2196.     {
  2197.         var saveGameRef : SSavegameInfo;
  2198.         var saveGames   : array< SSavegameInfo >;
  2199.        
  2200.         if (ignoreInput)
  2201.         {
  2202.             return false;
  2203.         }
  2204.        
  2205.         disableAccountPicker = true;
  2206.        
  2207.         if (loadConfPopup)
  2208.         {
  2209.             delete loadConfPopup;
  2210.         }
  2211.        
  2212.         theGame.ListSavedGames( saveGames );
  2213.         saveGameRef = saveGames[saveListIndex];
  2214.        
  2215.         if (panelMode || (isMainMenu && !hasValidAutosaveData()))
  2216.         {
  2217.             LoadSaveRequested(saveGameRef);
  2218.         }
  2219.         else
  2220.         {
  2221.             loadConfPopup = new W3ApplyLoadConfirmation in this;
  2222.             loadConfPopup.SetMessageTitle( GetPlatformLocString( "panel_mainmenu_popup_load_title" ) );
  2223.            
  2224.             if (isMainMenu)
  2225.             {
  2226.                 loadConfPopup.SetMessageText( GetPlatformLocString("error_message_load_game_main_menu") );
  2227.             }
  2228.             else
  2229.             {
  2230.                 loadConfPopup.SetMessageText( GetPlatformLocString( "error_message_load_game" ) );
  2231.             }
  2232.            
  2233.             loadConfPopup.menuRef = this;
  2234.             loadConfPopup.saveSlotRef = saveGameRef;
  2235.             loadConfPopup.BlurBackground = true;
  2236.            
  2237.             SetIgnoreInput(true);
  2238.                    
  2239.             RequestSubMenu('PopupMenu', loadConfPopup);
  2240.         }
  2241.     }
  2242.    
  2243.     public function LoadSaveRequested(saveSlotRef : SSavegameInfo) : void
  2244.     {  
  2245.         var fromDeathScreen : bool;
  2246.        
  2247.         if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  2248.         {
  2249.             SetIgnoreInput(false);
  2250.             disableAccountPicker = false;
  2251.             return;
  2252.         }
  2253.        
  2254.         SetIgnoreInput(true);
  2255.        
  2256.         if (isMainMenu)
  2257.         {
  2258.             disableAccountPicker = true;
  2259.         }
  2260.  
  2261.        
  2262.         fromDeathScreen = (CR4DeathScreenMenu)m_parentMenu;
  2263.         theGame.LoadGameInit( saveSlotRef , fromDeathScreen );
  2264.     }
  2265.    
  2266.     event  OnImportGameCalled(menuTag:int):void
  2267.     {
  2268.         var savesToImport : array< SSavegameInfo >;
  2269.         var difficulty:int;
  2270.         var tutorialsEnabled:bool;
  2271.         var simulateImport:bool;
  2272.         var maskResult:int;
  2273.         var progress : float;
  2274.        
  2275.         if (!theGame.IsContentAvailable('launch0'))
  2276.         {
  2277.             progress = theGame.ProgressToContentAvailable('launch0');
  2278.             theSound.SoundEvent("gui_global_denied");
  2279.             theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  2280.            
  2281.         }
  2282.         else
  2283.         {
  2284.             theGame.ListW2SavedGames( savesToImport );
  2285.            
  2286.             if ( menuTag < savesToImport.Size() )
  2287.             {
  2288.                 disableAccountPicker = true;
  2289.                
  2290.                 theGame.ClearInitialFacts();
  2291.                
  2292.                 if (theGame.ImportSave( savesToImport[ menuTag ] ))
  2293.                 {
  2294.                     currentNewGameConfig.import_save_index = menuTag;
  2295.                    
  2296.                     if ((lastSetTag & IGMC_New_game_plus) == IGMC_New_game_plus)
  2297.                     {
  2298.                         m_fxForceEnterCurEntry.InvokeSelf();
  2299.                     }
  2300.                     else
  2301.                     {
  2302.                        
  2303.                         theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  2304.                         TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  2305.                        
  2306.                         if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  2307.                         {
  2308.                             OnPlaySoundEvent("gui_global_game_start");
  2309.                             OnPlaySoundEvent("mus_intro_usm");
  2310.                             GetRootMenu().CloseMenu();
  2311.                         }
  2312.                     }
  2313.                 }
  2314.                 else
  2315.                 {
  2316.                     showNotification(GetLocStringByKeyExt("import_witcher_two_failed"));
  2317.                     OnPlaySoundEvent("gui_global_denied");
  2318.                 }
  2319.             }
  2320.         }
  2321.     }
  2322.    
  2323.     event  OnNewGamePlusCalled(saveListIndex:int):void
  2324.     {
  2325.         var startGameStatus : ENewGamePlusStatus;
  2326.         var saveGameRef     : SSavegameInfo;
  2327.         var saveGames       : array< SSavegameInfo >;
  2328.         var errorMessage    : string;
  2329.         var progress : float;
  2330.        
  2331.         var requiredContent : name = 'content12';
  2332.        
  2333.         ignoreInput = true;
  2334.        
  2335.         if (!theGame.IsContentAvailable(requiredContent))
  2336.         {
  2337.             progress = theGame.ProgressToContentAvailable(requiredContent);
  2338.             theSound.SoundEvent("gui_global_denied");
  2339.             SetIgnoreInput(false);
  2340.             theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, requiredContent);
  2341.         }
  2342.         else
  2343.         {
  2344.             disableAccountPicker = true;
  2345.            
  2346.             theGame.ListSavedGames( saveGames );
  2347.             saveGameRef = saveGames[saveListIndex];
  2348.            
  2349.             if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  2350.             {
  2351.                 theGame.AddInitialFact("simulate_import_ingame");
  2352.             }
  2353.            
  2354.             theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  2355.            
  2356.             TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  2357.            
  2358.             startGameStatus = theGame.StartNewGamePlus(saveGameRef);
  2359.            
  2360.             if (startGameStatus == NGP_Success)
  2361.             {
  2362.                 theGame.GetGuiManager().RequestMouseCursor(false);
  2363.                 OnPlaySoundEvent("gui_global_game_start");
  2364.                 OnPlaySoundEvent("mus_intro_usm");
  2365.                 GetRootMenu().CloseMenu();
  2366.             }
  2367.             else
  2368.             {
  2369.                 errorMessage = "";
  2370.                 SetIgnoreInput(false);
  2371.                 disableAccountPicker = false;
  2372.                
  2373.                 switch (startGameStatus)
  2374.                 {
  2375.                 case NGP_Invalid:
  2376.                     errorMessage = GetPlatformLocString("newgame_plus_error_invalid");
  2377.                     break;
  2378.                 case NGP_CantLoad:
  2379.                     errorMessage = GetLocStringByKeyExt("newgame_plus_error_cantload");
  2380.                     break;
  2381.                 case NGP_TooOld:
  2382.                     errorMessage = GetLocStringByKeyExt("newgame_plus_error_too_old");
  2383.                     break;
  2384.                 case NGP_RequirementsNotMet:
  2385.                     errorMessage = GetLocStringByKeyExt("newgame_plus_error_requirementnotmet");
  2386.                     break;
  2387.                 case NGP_InternalError:
  2388.                     errorMessage = GetPlatformLocString("newgame_plus_error_internalerror");
  2389.                     break;
  2390.                 case NGP_ContentRequired:
  2391.                     errorMessage = GetLocStringByKeyExt("newgame_plus_error_contentrequired");
  2392.                     break;
  2393.                 }
  2394.                
  2395.                 showNotification(errorMessage);
  2396.                 OnPlaySoundEvent("gui_global_denied");
  2397.             }
  2398.         }
  2399.     }
  2400.    
  2401.     event  OnDeleteSaveCalled(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  2402.     {
  2403.         if (ignoreInput)
  2404.         {
  2405.             return false;
  2406.         }
  2407.        
  2408.         SetIgnoreInput(true);
  2409.        
  2410.         disableAccountPicker = true;
  2411.        
  2412.         if (deleteConfPopup)
  2413.         {
  2414.             delete deleteConfPopup;
  2415.         }
  2416.        
  2417.         deleteConfPopup = new W3DeleteSaveConf in this;
  2418.         deleteConfPopup.SetMessageTitle("");
  2419.        
  2420.         if (theGame.GetPlatform() == Platform_PS5)
  2421.         {
  2422.             deleteConfPopup.SetMessageText( GetPlatformLocString( "error_message_delete_save_ps5" ) );
  2423.         }
  2424.         else
  2425.         {
  2426.             deleteConfPopup.SetMessageText( GetPlatformLocString( "panel_mainmenu_confirm_delete_text" ) );
  2427.         }
  2428.         deleteConfPopup.menuRef = this;
  2429.         deleteConfPopup.type = type;
  2430.         deleteConfPopup.slot = saveListIndex;
  2431.         deleteConfPopup.saveMode = isSaveMode;
  2432.         deleteConfPopup.BlurBackground = true;
  2433.            
  2434.         RequestSubMenu('PopupMenu', deleteConfPopup);
  2435.     }
  2436.    
  2437.     event  OnSyncSaveCalled(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  2438.     {
  2439.        
  2440.         var manager : CR4GuiManager;
  2441.         manager = (CR4GuiManager)theGame.GetGuiManager();
  2442.         if (manager) {
  2443.             manager.SyncGalaxySlot(saveListIndex);
  2444.         }
  2445.     }
  2446.    
  2447.     event  OnLoginCloudCalled()
  2448.     {
  2449.         var manager : CR4GuiManager;
  2450.        
  2451.        
  2452.         if (!theGame.IsGalaxyUserSignedIn()) {
  2453.             manager = (CR4GuiManager)theGame.GetGuiManager();
  2454.             if (manager) {
  2455.                 manager.GalaxyQRSignInInitiate();
  2456.             }
  2457.         }
  2458.     }
  2459.    
  2460.     event  OnShowCloudModalCalled()
  2461.     {
  2462.         var manager : CR4GuiManager;
  2463.  
  2464.         if (!theGame.HasInternetConnection()) {
  2465.             ShowErrorWindow( GOGNoInternetConnection );
  2466.         } else if (theGame.IsGalaxyUserSignedIn()) {
  2467.            
  2468.             manager = (CR4GuiManager)theGame.GetGuiManager();
  2469.             if (manager) {
  2470.                 manager.ShowCloudModal();
  2471.                
  2472.             }
  2473.         }
  2474.     }
  2475.    
  2476.     public function DeleteSave(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  2477.     {
  2478.         var saves : array< SSavegameInfo >;
  2479.         var currentSave : SSavegameInfo;
  2480.         var numSavesBeforeDelete : int;
  2481.        
  2482.         theGame.GetRecentListSG( saves );
  2483.        
  2484.         numSavesBeforeDelete = saves.Size();
  2485.        
  2486.         if (saveListIndex < saves.Size())
  2487.         {
  2488.             currentSave = saves[ saveListIndex ];
  2489.             theGame.DeleteSavedGame(currentSave);
  2490.         }
  2491.        
  2492.         if (numSavesBeforeDelete <= 1)
  2493.         {
  2494.             m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('Continue')));
  2495.             m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('LoadGame')));
  2496.            
  2497.             if (isInLoadselector)
  2498.             {
  2499.                 m_fxNavigateBack.InvokeSelf();
  2500.             }
  2501.             else
  2502.             {
  2503.                 SendSaveData();
  2504.             }
  2505.         }
  2506.         else
  2507.         {
  2508.             if (isSaveMode)
  2509.             {
  2510.                 SendSaveData();
  2511.             }
  2512.             else if (hasSaveDataToLoad())
  2513.             {
  2514.                 SendLoadData();
  2515.             }
  2516.         }
  2517.     }
  2518.    
  2519.     protected function showOptionsPanel() : void
  2520.     {
  2521.         var l_DataFlashArray : CScriptedFlashArray;
  2522.    
  2523.         if (theGame.GetPlatform() == Platform_PC)
  2524.         {
  2525.             m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(mInGameConfigWrapper.GetVarValue('Rendering', 'HardwareCursor')));
  2526.         }
  2527.        
  2528.         l_DataFlashArray = IngameMenu_FillOptionsSubMenuData(m_flashValueStorage, isMainMenu);
  2529.        
  2530.         m_initialSelectionsToIgnore = 1;
  2531.         OnPlaySoundEvent( "gui_global_panel_open" );
  2532.        
  2533.         m_flashValueStorage.SetFlashArray( "ingamemenu.options.entries", l_DataFlashArray );
  2534.        
  2535.        
  2536.         curMenuDepth = depthOptions;
  2537.         theTelemetry.NoticeMenuDepth(curMenuDepth);
  2538.     }
  2539.    
  2540.     public function ToggleRTEnabled() : void
  2541.     {
  2542.         theGame.ToggleRTEnabled();
  2543.         RTEnabled();
  2544.         m_fxUpdateOptionLabel.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt('toggle_render')), FlashArgString(theGame.GetToggleButtonCaption()));
  2545.         theGame.SaveUserSettings();
  2546.     }
  2547.    
  2548.     protected function showHelpPanel() : void
  2549.     {
  2550.         m_fxNavigateBack.InvokeSelf();
  2551.        
  2552.         theGame.DisplaySystemHelp();
  2553.     }
  2554.    
  2555.     public function TryStartNewGame(optionsArray : int):void
  2556.     {
  2557.         var progress : float;
  2558.        
  2559.         if (!theGame.IsContentAvailable('launch0'))
  2560.         {
  2561.             progress = theGame.ProgressToContentAvailable('launch0');
  2562.             theSound.SoundEvent("gui_global_denied");
  2563.             theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  2564.         }
  2565.         else
  2566.         {
  2567.             fetchNewGameConfigFromTag(optionsArray);
  2568.            
  2569.             if ((optionsArray & IGMC_EP2_Save) == IGMC_EP2_Save)
  2570.             {
  2571.                
  2572.                 theGame.InitStandaloneDLCLoading('bob_000_000', currentNewGameConfig.difficulty);
  2573.                 theGame.EnableUberMovement( true );
  2574.                 ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  2575.             }
  2576.             else if ((optionsArray & IGMC_EP1_Save) == IGMC_EP1_Save)
  2577.             {
  2578.                
  2579.                 theGame.InitStandaloneDLCLoading('ep1', currentNewGameConfig.difficulty);
  2580.                 theGame.EnableUberMovement( true );
  2581.                 ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  2582.             }
  2583.             else
  2584.             {
  2585.                 if (hasValidAutosaveData())
  2586.                 {
  2587.                     if (newGameConfPopup)
  2588.                     {
  2589.                         delete newGameConfPopup;
  2590.                     }
  2591.                    
  2592.                     newGameConfPopup = new W3NewGameConfirmation in this;
  2593.                     newGameConfPopup.SetMessageTitle("");
  2594.                     newGameConfPopup.SetMessageText( GetPlatformLocString( "error_message_start_game" ) );
  2595.                     newGameConfPopup.menuRef = this;
  2596.                     newGameConfPopup.BlurBackground = true;
  2597.                        
  2598.                     RequestSubMenu('PopupMenu', newGameConfPopup);
  2599.                 }
  2600.                 else
  2601.                 {
  2602.                     NewGameRequested();
  2603.                 }
  2604.             }
  2605.         }
  2606.     }
  2607.    
  2608.     protected function fetchNewGameConfigFromTag(optionsTag : int):void
  2609.     {
  2610.         var maskResult:int;
  2611.        
  2612.         currentNewGameConfig.difficulty = optionsTag & IGMC_Difficulty_mask;
  2613.        
  2614.         maskResult = optionsTag & IGMC_Tutorials_On;
  2615.         currentNewGameConfig.tutorialsOn = (maskResult == IGMC_Tutorials_On);
  2616.        
  2617.         maskResult = optionsTag & IGMC_Import_Save;
  2618.         if (maskResult != IGMC_Import_Save)
  2619.         {
  2620.             currentNewGameConfig.import_save_index = -1;
  2621.         }
  2622.        
  2623.         maskResult = optionsTag & IGMC_Simulate_Import;
  2624.         currentNewGameConfig.simulate_import = (maskResult == IGMC_Simulate_Import);
  2625.     }
  2626.    
  2627.     public function NewGameRequested():void
  2628.     {
  2629.         disableAccountPicker = true;
  2630.        
  2631.         if (currentNewGameConfig.import_save_index == -1)
  2632.         {
  2633.             theGame.ClearInitialFacts();
  2634.         }
  2635.        
  2636.         if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  2637.         {
  2638.             theGame.AddInitialFact("simulate_import_ingame");
  2639.         }
  2640.        
  2641.         theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  2642.        
  2643.         TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  2644.        
  2645.         StartNewGame();
  2646.     }
  2647.    
  2648.     event  OnUpdateRescale(hScale : float, vScale : float)
  2649.     {
  2650.         var hud : CR4ScriptedHud;
  2651.         var needRescale : bool;
  2652.        
  2653.         hud = (CR4ScriptedHud)theGame.GetHud();
  2654.         needRescale = false;
  2655.        
  2656.         if( theGame.GetUIHorizontalFrameScale() != hScale )
  2657.         {
  2658.             theGame.SetUIHorizontalFrameScale(hScale);
  2659.             mInGameConfigWrapper.SetVarValue('Hidden', 'uiHorizontalFrameScale', FloatToString(hScale));
  2660.             needRescale = true;
  2661.             hasChangedOption = true;
  2662.         }  
  2663.         if( theGame.GetUIVerticalFrameScale() != vScale )
  2664.         {
  2665.             theGame.SetUIVerticalFrameScale(vScale);
  2666.             mInGameConfigWrapper.SetVarValue('Hidden', 'uiVerticalFrameScale', FloatToString(vScale));
  2667.             needRescale = true;
  2668.             hasChangedOption = true;
  2669.         }  
  2670.        
  2671.         if( needRescale && hud )
  2672.         {
  2673.             hud.RescaleModules();
  2674.         }
  2675.     }
  2676.    
  2677.     public function ShowTutorialChosen(enabled:bool):void
  2678.     {
  2679.         TutorialMessagesEnable(enabled);
  2680.        
  2681.         StartNewGame();
  2682.     }
  2683.    
  2684.     public function StartNewGame():void
  2685.     {
  2686.         if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  2687.         {
  2688.             return;
  2689.         }
  2690.        
  2691.         if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  2692.         {
  2693.             theGame.GetGuiManager().RequestMouseCursor(false);
  2694.             OnPlaySoundEvent("gui_global_game_start");
  2695.             OnPlaySoundEvent("mus_intro_usm");
  2696.             GetRootMenu().CloseMenu();
  2697.         }
  2698.     }
  2699.    
  2700.     function PopulateMenuData()
  2701.     {
  2702.         var l_DataFlashArray        : CScriptedFlashArray;
  2703.         var l_ChildMenuFlashArray   : CScriptedFlashArray;
  2704.         var l_DataFlashObject       : CScriptedFlashObject;
  2705.         var l_subDataFlashObject    : CScriptedFlashObject;
  2706.        
  2707.         l_DataFlashArray = m_structureCreator.PopulateMenuData();
  2708.        
  2709.         m_flashValueStorage.SetFlashArray( "ingamemenu.entries", l_DataFlashArray );
  2710.     }
  2711.    
  2712.     protected function addInLoadOption():void
  2713.     {
  2714.         var l_DataFlashObject       : CScriptedFlashObject;
  2715.         var l_ChildMenuFlashArray   : CScriptedFlashArray;
  2716.        
  2717.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  2718.         l_DataFlashObject.SetMemberFlashString( "id", "mainmenu_loadgame");
  2719.         l_DataFlashObject.SetMemberFlashUInt(  "tag", NameToFlashUInt('LoadGame') );
  2720.         l_DataFlashObject.SetMemberFlashString(  "label", GetLocStringByKeyExt("panel_mainmenu_loadgame") );   
  2721.        
  2722.         l_DataFlashObject.SetMemberFlashUInt( "type", IGMActionType_Load );
  2723.        
  2724.         l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2725.         l_DataFlashObject.SetMemberFlashArray( "subElements", l_ChildMenuFlashArray );
  2726.        
  2727.         m_flashValueStorage.SetFlashObject( "ingamemenu.addloading", l_DataFlashObject );
  2728.     }
  2729.    
  2730.     event  OnBack()
  2731.     {
  2732.         CloseMenu();
  2733.     }
  2734.    
  2735.     public function HasSavesToImport() : bool
  2736.     {
  2737.         var savesToImport : array< SSavegameInfo >;
  2738.        
  2739.         theGame.ListW2SavedGames( savesToImport );
  2740.         return savesToImport.Size() != 0;
  2741.     }
  2742.  
  2743.     protected function SendImportSaveData()
  2744.     {
  2745.         var dataFlashArray  : CScriptedFlashArray;
  2746.        
  2747.         dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2748.        
  2749.         IngameMenu_PopulateImportSaveData(m_flashValueStorage, dataFlashArray);
  2750.        
  2751.         m_initialSelectionsToIgnore = 1;
  2752.         OnPlaySoundEvent( "gui_global_panel_open" );
  2753.        
  2754.         isShowingSaveList = true;
  2755.         m_flashValueStorage.SetFlashArray( "ingamemenu.importSlots", dataFlashArray );
  2756.     }
  2757.    
  2758.     protected function hasValidAutosaveData() : bool
  2759.     {
  2760.         var currentSave : SSavegameInfo;
  2761.         var num : int;
  2762.         var i : int;
  2763.        
  2764.         num = theGame.GetNumSaveSlots( SGT_AutoSave );
  2765.         for ( i = 0; i < num; i = i + 1 )
  2766.         {
  2767.             if ( theGame.GetSaveInSlot( SGT_AutoSave, i, currentSave ) )
  2768.             {
  2769.                 return true;
  2770.             }
  2771.         }
  2772.        
  2773.         num = theGame.GetNumSaveSlots( SGT_CheckPoint );
  2774.         for ( i = 0; i < num; i = i + 1 )
  2775.         {
  2776.             if ( theGame.GetSaveInSlot( SGT_CheckPoint, i, currentSave ) )
  2777.             {
  2778.                 return true;
  2779.             }
  2780.         }
  2781.        
  2782.         return false;
  2783.     }
  2784.    
  2785.     public function HandleSaveListUpdate():void
  2786.     {
  2787.         if (isShowingSaveList)
  2788.         {
  2789.             SendSaveData();
  2790.         }
  2791.         else if (isShowingLoadList)
  2792.         {
  2793.             SendLoadData();
  2794.         }
  2795.        
  2796.         if (hasSaveDataToLoad())
  2797.         {
  2798.             addInLoadOption();
  2799.         }
  2800.     }
  2801.    
  2802.     public function QRCodeReady(UrlAdres : String):void
  2803.     {
  2804.         m_fxQRCodeReadyToLoad.InvokeSelfOneArg(FlashArgString(UrlAdres));  
  2805.     }
  2806.  
  2807.     public function CloudPersonaReady(namePersona : String):void
  2808.     {
  2809.         m_fxShowCloudModal.InvokeSelfOneArg(FlashArgString(namePersona));  
  2810.     }
  2811.    
  2812.     public function CloseGalaxySignInModalWindow():void
  2813.     {
  2814.         m_fxCloseGalaxySignInModalWindow.InvokeSelf();
  2815.        
  2816.         showNotification( GetLocStringByKeyExt("ui_cloud_gog_sign_in_success"),, true );
  2817.     }
  2818.    
  2819.     event OnVisitSignInPage()
  2820.     {
  2821.         var manager : CR4GuiManager;
  2822.         manager = (CR4GuiManager)theGame.GetGuiManager();
  2823.         if ( manager )
  2824.         {
  2825.             manager.VisitSignInPage();
  2826.         }
  2827.  
  2828.     }
  2829.    
  2830.     event OnGalaxyQRSignInCancel()
  2831.     {
  2832.         var manager : CR4GuiManager;
  2833.         manager = (CR4GuiManager)theGame.GetGuiManager();
  2834.         if ( manager )
  2835.         {
  2836.             manager.GalaxyQRSignInCancel();
  2837.         }
  2838.     }
  2839.    
  2840.     event OnGalaxyUnlinkAccounts()
  2841.     {
  2842.         var manager : CR4GuiManager;
  2843.         manager = (CR4GuiManager)theGame.GetGuiManager();
  2844.         if ( manager )
  2845.         {
  2846.             manager.GalaxyUnlinkAccounts();
  2847.         }
  2848.     }
  2849.  
  2850.     public function CheckSaveAvailability(): void
  2851.     {
  2852.         if(!hasSaveDataToLoad())
  2853.         {
  2854.             m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('LoadGame')));
  2855.             m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('Continue')));
  2856.         }
  2857.         else
  2858.         {
  2859.             PopulateMenuData();
  2860.         }
  2861.     }
  2862.    
  2863.     protected function SendLoadData():void
  2864.     {
  2865.         var l_DataFlashObject : CScriptedFlashObject;
  2866.         var dataFlashArray  : CScriptedFlashArray;
  2867.        
  2868.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  2869.         l_DataFlashObject.SetMemberFlashBool( "isUserSignedIn", theGame.IsGalaxyUserSignedIn() && theGame.GetInGameConfigWrapper().GetVarValue( 'Gameplay', 'CrossProgression' ) == "true" );
  2870.         m_flashValueStorage.SetFlashObject( "ingamemenu.gogCloudState", l_DataFlashObject );
  2871.        
  2872.         dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2873.        
  2874.         PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  2875.        
  2876.         m_initialSelectionsToIgnore = 1;
  2877.         OnPlaySoundEvent( "gui_global_panel_open" );
  2878.        
  2879.         if (dataFlashArray.GetLength() == 0)
  2880.         {
  2881.             m_fxNavigateBack.InvokeSelf();
  2882.         }
  2883.         else
  2884.         {
  2885.             isShowingLoadList = true;
  2886.             m_flashValueStorage.SetFlashArray( "ingamemenu.loadSlots", dataFlashArray );
  2887.         }
  2888.     }
  2889.    
  2890.    
  2891.     protected function SendSaveData():void
  2892.     {
  2893.         var l_DataFlashObject : CScriptedFlashObject;
  2894.         var dataFlashArray  : CScriptedFlashArray;
  2895.        
  2896.         l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  2897.         l_DataFlashObject.SetMemberFlashBool( "isUserSignedIn", theGame.IsGalaxyUserSignedIn() && theGame.GetInGameConfigWrapper().GetVarValue( 'Gameplay', 'CrossProgression' ) == "true" );
  2898.         m_flashValueStorage.SetFlashObject( "ingamemenu.gogCloudState", l_DataFlashObject );
  2899.        
  2900.         dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2901.        
  2902.        
  2903.        
  2904.         PopulateSaveDataForSlotType(SGT_Manual, dataFlashArray, true);
  2905.        
  2906.         m_initialSelectionsToIgnore = 1;
  2907.         OnPlaySoundEvent( "gui_global_panel_open" );
  2908.        
  2909.         isShowingSaveList = true;
  2910.         m_flashValueStorage.SetFlashArray( "ingamemenu.saveSlots", dataFlashArray );
  2911.        
  2912.         if ( theGame.ShouldShowSaveCompatibilityWarning() )
  2913.         {
  2914.             theGame.GetGuiManager().ShowUserDialog( UMID_SaveCompatWarning, "", "error_save_not_compatible", UDB_Ok );
  2915.         }
  2916.     }
  2917.    
  2918.     protected function SendNewGamePlusSaves():void
  2919.     {
  2920.         var dataFlashArray  : CScriptedFlashArray;
  2921.        
  2922.         dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2923.        
  2924.         PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  2925.        
  2926.         theGame.GetGuiManager().ShowUserDialog(0, "", "message_new_game_plus_reminder", UDB_Ok);
  2927.        
  2928.         if (dataFlashArray.GetLength() == 0)
  2929.         {
  2930.             OnPlaySoundEvent("gui_global_denied");
  2931.             showNotification(GetLocStringByKeyExt("mainmenu_newgame_plus_no_saves"));
  2932.             m_fxNavigateBack.InvokeSelf();
  2933.         }
  2934.         else
  2935.         {
  2936.             m_initialSelectionsToIgnore = 1;
  2937.             OnPlaySoundEvent( "gui_global_panel_open" );
  2938.             m_flashValueStorage.SetFlashArray( "ingamemenu.newGamePlusSlots", dataFlashArray );
  2939.         }
  2940.     }
  2941.    
  2942.     protected function PopulateSaveDataForSlotType(saveType:int, parentObject:CScriptedFlashArray, allowEmptySlot:bool):void
  2943.     {
  2944.         IngameMenu_PopulateSaveDataForSlotType(m_flashValueStorage, saveType, parentObject, allowEmptySlot);
  2945.     }
  2946.    
  2947.     event  OnLoadSaveImageCancelled():void
  2948.     {
  2949.         theGame.FreeScreenshotData();
  2950.     }
  2951.    
  2952.     event  OnScreenshotDataRequested(saveIndex:int):void
  2953.     {
  2954.         var targetSaveInfo  : SSavegameInfo;
  2955.         var saveGames       : array< SSavegameInfo >;
  2956.        
  2957.         theGame.GetRecentListSG( saveGames );
  2958.         UpdateSaveSlot();
  2959.        
  2960.         if (saveIndex >= 0 && saveIndex < saveGames.Size())
  2961.         {
  2962.             targetSaveInfo = saveGames[saveIndex];
  2963.            
  2964.             theGame.RequestScreenshotData(targetSaveInfo);
  2965.         }
  2966.     }
  2967.    
  2968.     event  OnCheckScreenshotDataReady():void
  2969.     {
  2970.         if (theGame.IsScreenshotDataReady())
  2971.         {
  2972.             m_fxOnSaveScreenshotRdy.InvokeSelf();
  2973.         }
  2974.     }
  2975.    
  2976.     protected function SendInstalledDLCList():void
  2977.     {
  2978.         var currentData : CScriptedFlashObject;
  2979.         var dataArray : CScriptedFlashArray;
  2980.         var dlcManager : CDLCManager;
  2981.         var i : int;
  2982.         var dlcList : array<name>;
  2983.        
  2984.         var currentName : string;
  2985.         var currentDesc : string;
  2986.        
  2987.        
  2988.        
  2989.         dataArray = m_flashValueStorage.CreateTempFlashArray();
  2990.        
  2991.         dlcManager = theGame.GetDLCManager();
  2992.         dlcManager.GetDLCs(dlcList);
  2993.        
  2994.         for (i = 0; i < dlcList.Size(); i += 1)
  2995.         {
  2996.            
  2997.            
  2998.                 currentData = m_flashValueStorage.CreateTempFlashObject();
  2999.                
  3000.                 currentName = GetLocStringByKeyExt( "content_name_" + NameToString(dlcList[i]) );
  3001.                 currentDesc = "";
  3002.                
  3003.                 if (currentName != "")
  3004.                 {
  3005.                     currentData.SetMemberFlashString("label", currentName);
  3006.                     currentData.SetMemberFlashString("desc", currentDesc);
  3007.                    
  3008.                     dataArray.PushBackFlashObject(currentData);
  3009.                 }
  3010.            
  3011.         }
  3012.        
  3013.        
  3014.        
  3015.         m_flashValueStorage.SetFlashArray("ingamemenu.installedDLCs", dataArray);
  3016.     }
  3017.    
  3018.     protected function SendRescaleData():void
  3019.     {
  3020.         var currentData : CScriptedFlashObject;
  3021.        
  3022.         currentData = m_flashValueStorage.CreateTempFlashObject();
  3023.        
  3024.         currentData.SetMemberFlashNumber("initialHScale", theGame.GetUIHorizontalFrameScale() );
  3025.         currentData.SetMemberFlashNumber("initialVScale", theGame.GetUIVerticalFrameScale() );
  3026.        
  3027.         m_flashValueStorage.SetFlashObject("ingamemenu.uirescale", currentData);
  3028.     }
  3029.    
  3030.     protected function SendControllerData():void
  3031.     {
  3032.         var dataFlashArray : CScriptedFlashArray;
  3033.        
  3034.         if ( (W3ReplacerCiri)thePlayer )
  3035.         {
  3036.             dataFlashArray = InGameMenu_CreateControllerDataCiri(m_flashValueStorage);
  3037.         }
  3038.         else
  3039.         {
  3040.             dataFlashArray = InGameMenu_CreateControllerData(m_flashValueStorage);
  3041.         }
  3042.        
  3043.         m_flashValueStorage.SetFlashArray( "ingamemenu.gamepad.mappings", dataFlashArray );
  3044.     }
  3045.    
  3046.     protected function SendKeybindData():void
  3047.     {
  3048.         var dataFlashArray : CScriptedFlashArray;
  3049.        
  3050.         dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  3051.        
  3052.         IngameMenu_GatherKeybindData(dataFlashArray, m_flashValueStorage);
  3053.        
  3054.         m_flashValueStorage.SetFlashArray( "ingamemenu.keybindValues", dataFlashArray );
  3055.     }
  3056.    
  3057.     event  OnClearKeybind(keybindTag:name):void
  3058.     {
  3059.         hasChangedOption = true;
  3060.         mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, "IK_None;IK_None");
  3061.         SendKeybindData();
  3062.     }
  3063.    
  3064.    
  3065.    
  3066.     protected function GetKeybindGroupTag(keybindName : name) : name
  3067.     {
  3068.         if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap1'))
  3069.         {
  3070.             return 'input_overlap1';
  3071.         }
  3072.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap2'))
  3073.         {
  3074.             return 'input_overlap2';
  3075.         }
  3076.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap3'))
  3077.         {
  3078.             return 'input_overlap3';
  3079.         }
  3080.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap4'))
  3081.         {
  3082.             return 'input_overlap4';
  3083.         }
  3084.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap5'))
  3085.         {
  3086.             return 'input_overlap5';
  3087.         }
  3088.         //---=== modFriendlyHUD ===---
  3089.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud1')
  3090.                     || keybindName == 'HoldToSeeEssentials' || keybindName == 'HubMenu')
  3091.         {
  3092.             return 'input_overlap_fhud1';
  3093.         }
  3094.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud2')
  3095.                     || keybindName == 'HoldToSeeCharStats' || keybindName == 'PanelChar')
  3096.         {
  3097.             return 'input_overlap_fhud2';
  3098.         }
  3099.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud3')
  3100.                     || keybindName == 'HoldToSeeMap' || keybindName == 'PanelMap')
  3101.         {
  3102.             return 'input_overlap_fhud3';
  3103.         }
  3104.         else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud4')
  3105.                     || keybindName == 'HoldToSeeQuests' || keybindName == 'PanelJour')
  3106.         {
  3107.             return 'input_overlap_fhud4';
  3108.         }
  3109.         //---=== modFriendlyHUD ===---
  3110.        
  3111.         return '';
  3112.     }
  3113.    
  3114.     event  OnChangeKeybind(keybindTag:name, newKeybindValue:EInputKey):void
  3115.     {
  3116.         var newSettingString : string;
  3117.         var exisitingKeybind : name;
  3118.         var groupIndex : int;
  3119.         var keybindChangedMessage : string;
  3120.         var numKeybinds : int;
  3121.         var i : int;
  3122.         var currentBindingTag : name;
  3123.        
  3124.         var iterator_KeybindName : name;
  3125.         var iterator_KeybindKey : string;
  3126.        
  3127.         hasChangedOption = true;
  3128.        
  3129.         newSettingString = newKeybindValue;
  3130.        
  3131.        
  3132.        
  3133.         {
  3134.             groupIndex = IngameMenu_GetPCInputGroupIndex();
  3135.        
  3136.             if (groupIndex != -1)
  3137.             {
  3138.                 numKeybinds = mInGameConfigWrapper.GetVarsNumByGroupName('PCInput');
  3139.                 currentBindingTag = GetKeybindGroupTag(keybindTag);
  3140.                
  3141.                 for (i = 0; i < numKeybinds; i += 1)
  3142.                 {
  3143.                     iterator_KeybindName = mInGameConfigWrapper.GetVarName(groupIndex, i);
  3144.                     iterator_KeybindKey = mInGameConfigWrapper.GetVarValue('PCInput', iterator_KeybindName);
  3145.                    
  3146.                     iterator_KeybindKey = StrReplace(iterator_KeybindKey, ";IK_None", "");
  3147.                     iterator_KeybindKey = StrReplace(iterator_KeybindKey, "IK_None;", "");
  3148.                    
  3149.                     if (iterator_KeybindKey == newSettingString && iterator_KeybindName != keybindTag &&
  3150.                         (currentBindingTag == '' || currentBindingTag != GetKeybindGroupTag(iterator_KeybindName)))
  3151.                     {
  3152.                         if (keybindChangedMessage != "")
  3153.                         {
  3154.                             keybindChangedMessage += ", ";
  3155.                         }
  3156.                         keybindChangedMessage += IngameMenu_GetLocalizedKeybindName(iterator_KeybindName);
  3157.                         OnClearKeybind(iterator_KeybindName);
  3158.                     }
  3159.                 }
  3160.             }
  3161.            
  3162.             if (keybindChangedMessage != "")
  3163.             {
  3164.                 keybindChangedMessage += " </br>" + GetLocStringByKeyExt("key_unbound_message");
  3165.                 showNotification(keybindChangedMessage);
  3166.             }
  3167.         }
  3168.        
  3169.         newSettingString = newKeybindValue + ";IK_None";
  3170.         mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, newSettingString);
  3171.         SendKeybindData();
  3172.     }
  3173.    
  3174.     event  OnSmartKeybindEnabledChanged(value:bool):void
  3175.     {
  3176.         smartKeybindingEnabled = value;
  3177.     }
  3178.    
  3179.     event  OnInvalidKeybindTried(keyCode:EInputKey):void
  3180.     {
  3181.         showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  3182.         OnPlaySoundEvent("gui_global_denied");
  3183.     }
  3184.    
  3185.     event  OnLockedKeybindTried():void
  3186.     {
  3187.         showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  3188.         OnPlaySoundEvent("gui_global_denied");
  3189.     }
  3190.    
  3191.     //---=== modFriendlyHUD ===---
  3192.     function ShouldHideDLCIcons() : bool
  3193.     {
  3194.         return theGame.GetInGameConfigWrapper().GetVarValue('fhudMainMenu', 'fhudHideDLC');
  3195.     }
  3196.     //---=== modFriendlyHUD ===---
  3197.  
  3198.     event  OnResetKeybinds():void
  3199.     {
  3200.         mInGameConfigWrapper.ResetGroupToDefaults('PCInput');
  3201.         SendKeybindData();
  3202.         showNotification(inGameMenu_TryLocalize("menu_option_reset_successful"));
  3203.        
  3204.         hasChangedOption = true;
  3205.     }
  3206.    
  3207.     event OnDownloadContentRequested( groupId:int, optionName:name, optionValue:string )
  3208.     {
  3209.         var groupName : name;
  3210.         var locale : string;
  3211.    
  3212.         groupName = mInGameConfigWrapper.GetGroupName(groupId);
  3213.    
  3214.         if (groupName == 'Localization' && optionName == 'Virtual_Localization_speech')
  3215.         {
  3216.             locale = mInGameConfigWrapper.GetVarOption( groupName, optionName, StringToInt( optionValue ) );
  3217.             theGame.RequestVoiceLangDownload( locale );
  3218.         }
  3219.     }
  3220.    
  3221.     function PlayOpenSoundEvent()
  3222.     {
  3223.     }
  3224.    
  3225.     private var isDeveloperModeEnabled : bool; default isDeveloperModeEnabled = false;
  3226.     private var developerOptions : CScriptedFlashArray;
  3227.    
  3228.     public function GetDeveloperOptionsContainer() : CScriptedFlashArray
  3229.     {
  3230.         return developerOptions;
  3231.     }
  3232.    
  3233.     private function ShowDeveloperMode( show : bool )
  3234.     {
  3235.         var optionObject        : CScriptedFlashObject;
  3236.         var optionFlashArray    : CScriptedFlashArray;
  3237.         var entriesArray        : CScriptedFlashArray;
  3238.         var entriesObject       : CScriptedFlashObject;
  3239.         var i                   : int;
  3240.        
  3241.         if( show )
  3242.         {
  3243.             optionObject = m_flashValueStorage.CreateTempFlashObject();
  3244.             optionObject.SetMemberFlashUInt( "tag", NameToFlashUInt( 'DeveloperMode' ) );
  3245.             optionObject.SetMemberFlashInt( "groupID", theGame.GetInGameConfigWrapper().GetGroupIdx( 'Rendering' ) );
  3246.             optionObject.SetMemberFlashUInt( "type", IGMActionType_ToggleStepper );
  3247.             optionObject.SetMemberFlashString( "label", inGameMenu_TryLocalize( "DeveloperMode" ) );
  3248.             optionObject.SetMemberFlashString( "current", theGame.GetInGameConfigWrapper().GetVarValue( 'Rendering', 'DeveloperMode' ) );
  3249.             optionObject.SetMemberFlashString( "startingValue", "false" );
  3250.             optionObject.SetMemberFlashBool( "checkHardwareCursor", false );
  3251.             optionObject.SetMemberFlashBool( "streamable", false );
  3252.             optionObject.SetMemberFlashBool( "isDropdownContent", false );
  3253.             optionObject.SetMemberFlashBool( "isDeveloper", true );
  3254.        
  3255.             entriesArray = m_flashValueStorage.CreateTempFlashArray();
  3256.             entriesArray.PushBackFlashObject( optionObject );
  3257.        
  3258.             entriesObject = m_flashValueStorage.CreateTempFlashObject();
  3259.             entriesObject.SetMemberFlashArray( "list", entriesArray );
  3260.             entriesObject.SetMemberFlashUInt( "masterTag", 0 );
  3261.             m_flashValueStorage.SetFlashObject( "options.insert_entry", entriesObject );
  3262.         }
  3263.         else
  3264.         {
  3265.             optionObject = m_flashValueStorage.CreateTempFlashObject();
  3266.             optionObject.SetMemberFlashUInt( "tag", NameToFlashUInt( 'DeveloperMode' ) );
  3267.        
  3268.             entriesArray = m_flashValueStorage.CreateTempFlashArray();
  3269.             entriesArray.PushBackFlashObject( optionObject );
  3270.        
  3271.             entriesObject = m_flashValueStorage.CreateTempFlashObject();
  3272.             entriesObject.SetMemberFlashArray( "list", entriesArray );
  3273.             m_flashValueStorage.SetFlashObject( "options.remove_entry", entriesObject );
  3274.         }
  3275.        
  3276.         theGame.GetGuiManager().ForceProcessFlashStorage();
  3277.         ShowDeveloperOptions( theGame.GetInGameConfigWrapper().GetVarValue( 'Rendering', 'DeveloperMode' ) == "true" );
  3278.     }
  3279.    
  3280.     public function ShowDeveloperOptions( show : bool )
  3281.     {
  3282.         var optionObject        : CScriptedFlashObject;
  3283.         var optionFlashArray    : CScriptedFlashArray;
  3284.         var entriesArray        : CScriptedFlashArray;
  3285.         var entriesObject       : CScriptedFlashObject;
  3286.         var i                   : int;
  3287.         var masterTag           : int;
  3288.    
  3289.         if( show && isDeveloperModeEnabled )
  3290.         {
  3291.             for( i = 0; i < developerOptions.GetLength(); i = i + 1 )
  3292.             {
  3293.                 entriesArray = m_flashValueStorage.CreateTempFlashArray();
  3294.                 entriesArray.PushBackFlashObject( developerOptions.GetElementFlashObject( i ) );
  3295.                
  3296.                 entriesObject = m_flashValueStorage.CreateTempFlashObject();
  3297.                 entriesObject.SetMemberFlashArray( "list", entriesArray );
  3298.                 masterTag = developerOptions.GetElementFlashObject( i ).GetMemberFlashUInt( "masterTag");
  3299.                 entriesObject.SetMemberFlashUInt( "masterTag", masterTag );
  3300.                
  3301.                 m_flashValueStorage.SetFlashObject( "options.insert_entry", entriesObject );
  3302.                 theGame.GetGuiManager().ForceProcessFlashStorage();
  3303.             }
  3304.         }
  3305.         else
  3306.         {
  3307.             for( i = 0; i < developerOptions.GetLength(); i = i + 1 )
  3308.             {
  3309.                 entriesArray = m_flashValueStorage.CreateTempFlashArray();
  3310.                 entriesArray.PushBackFlashObject( developerOptions.GetElementFlashObject( i ) );
  3311.                
  3312.                 entriesObject = m_flashValueStorage.CreateTempFlashObject();
  3313.                 entriesObject.SetMemberFlashArray( "list", entriesArray );
  3314.                
  3315.                 m_flashValueStorage.SetFlashObject( "options.remove_entry", entriesObject );
  3316.                 theGame.GetGuiManager().ForceProcessFlashStorage();
  3317.             }
  3318.         }
  3319.     }
  3320.    
  3321.     event OnShowDeveloperMode( action : SInputAction )
  3322.     {
  3323.         if( !IsPressed(action) || !theInput.IsActionPressed( 'ShowDeveloperModeAlt' ) )
  3324.             return false;
  3325.            
  3326.         isDeveloperModeEnabled = !isDeveloperModeEnabled;
  3327.         ShowDeveloperMode( isDeveloperModeEnabled );
  3328.     }
  3329. }
  3330.  
  3331. exec function ddd()
  3332. {
  3333.     LogChannel('asd', "[" + GetLocStringByKey( "menu_goty_starting_message_content" ) + "]" );
  3334.     LogChannel('asd', "[" + GetLocStringById( 1217650 ) + "]" );
  3335. }
Advertisement
Comments
  • brianshaw50
    3 years
    # Bash 0.90 KB | 0 0
    1. I have been using the Crypto for 2-3 years. And I noticed that it is the most trustworthy Crypto platform to use for trade and investment purposes. This platform is available for experts and beginners. It offers more than 130 assets to buy, sell, and transfer. It also has a good position regarding security and compliance compared to other Crypto exchanges.
    2. visit here:-
    3. https://sites.google.com/365cryptocurrencies.com/spotwalletextension/
    4. https://sites.google.com/365cryptocurrencies.com/bitkeepwallet/
    5. https://sites.google.com/365cryptocurrencies.com/blockwalletextension/
    6. https://sites.google.com/365cryptocurrencies.com/plasmawalletextension/
    7. https://sites.google.com/365cryptocurrencies.com/leapcosmoswallet/
    8. https://sites.google.com/365cryptocurrencies.com/pontemaptoswallet/
    9. https://sites.google.com/365cryptocurrencies.com/lilicowallet/
    10. https://sites.google.com/365cryptocurrencies.com/keplrwallet/
Add Comment
Please, Sign In to add comment