Advertisement
lufusol

ingameMenu.ws for Friendly Meditation for Witcher 3 4.01

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