Advertisement
MMPCheater

Untitled

Nov 18th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.12 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. enum InGameMenuActionType
  11. {
  12. IGMActionType_CommonMenu = 0,
  13. IGMActionType_Close = 1,
  14. IGMActionType_MenuHolder = 2,
  15. IGMActionType_MenuLastHolder = 3,
  16. IGMActionType_Load = 4,
  17. IGMActionType_Save = 5,
  18. IGMActionType_Quit = 6,
  19. IGMActionType_Preset = 7,
  20. IGMActionType_Toggle = 8,
  21. IGMActionType_List = 9,
  22. IGMActionType_Slider = 10,
  23. IGMActionType_LoadLastSave = 11,
  24. IGMActionType_Tutorials = 12,
  25. IGMActionType_Credits = 13,
  26. IGMActionType_Help = 14,
  27. IGMActionType_Controls = 15,
  28. IGMActionType_ControllerHelp = 16,
  29. IGMActionType_NewGame = 17,
  30. IGMActionType_CloseGame = 18,
  31. IGMActionType_UIRescale = 19,
  32. IGMActionType_Gamma = 20,
  33. IGMActionType_DebugStartQuest = 21,
  34. IGMActionType_Gwint = 22,
  35. IGMActionType_ImportSave = 23,
  36. IGMActionType_KeyBinds = 24,
  37. IGMActionType_Back = 25,
  38. IGMActionType_NewGamePlus = 26,
  39. IGMActionType_InstalledDLC = 27,
  40.  
  41. IGMActionType_Options = 100
  42. };
  43.  
  44. enum EIngameMenuConstants
  45. {
  46. IGMC_Difficulty_mask = 7,
  47. IGMC_Tutorials_On = 1024,
  48. IGMC_Simulate_Import = 2048,
  49. IGMC_Import_Save = 4096,
  50. IGMC_EP1_Save = 8192,
  51. IGMC_New_game_plus = 16384,
  52. IGMC_EP2_Save = 32768,
  53. }
  54.  
  55. struct newGameConfig
  56. {
  57. var tutorialsOn : bool;
  58. var difficulty : int;
  59. var simulate_import : bool;
  60. var import_save_index : int;
  61. }
  62.  
  63. class CR4IngameMenu extends CR4MenuBase
  64. {
  65. protected var mInGameConfigWrapper : CInGameConfigWrapper;
  66. protected var inGameConfigBufferedWrapper : CInGameConfigBufferedWrapper;
  67.  
  68. protected var currentNewGameConfig : newGameConfig;
  69.  
  70. private var m_fxNavigateBack : CScriptedFlashFunction;
  71. private var m_fxSetIsMainMenu : CScriptedFlashFunction;
  72. private var m_fxSetCurrentUsername : CScriptedFlashFunction;
  73. private var m_fxSetVersion : CScriptedFlashFunction;
  74. private var m_fxShowHelp : CScriptedFlashFunction;
  75. private var m_fxSetVisible : CScriptedFlashFunction;
  76. private var m_fxSetPanelMode : CScriptedFlashFunction;
  77. private var m_fxRemoveOption : CScriptedFlashFunction;
  78. private var m_fxSetGameLogoLanguage : CScriptedFlashFunction;
  79. private var m_fxUpdateOptionValue : CScriptedFlashFunction;
  80. private var m_fxUpdateInputFeedback : CScriptedFlashFunction;
  81. private var m_fxOnSaveScreenshotRdy : CScriptedFlashFunction;
  82. private var m_fxSetIgnoreInput : CScriptedFlashFunction;
  83. private var m_fxForceEnterCurEntry : CScriptedFlashFunction;
  84. private var m_fxForceBackgroundVis : CScriptedFlashFunction;
  85. private var m_fxSetHardwareCursorOn : CScriptedFlashFunction;
  86. private var m_fxSetExpansionText : CScriptedFlashFunction;
  87.  
  88. protected var loadConfPopup : W3ApplyLoadConfirmation;
  89. protected var saveConfPopup : W3SaveGameConfirmation;
  90. protected var newGameConfPopup : W3NewGameConfirmation;
  91. protected var actionConfPopup : W3ActionConfirmation;
  92. protected var deleteConfPopup : W3DeleteSaveConf;
  93. protected var diffChangeConfPopup : W3DifficultyChangeConfirmation;
  94. protected var isShowingSaveList : bool; default isShowingSaveList = false;
  95. protected var isShowingLoadList : bool; default isShowingLoadList = false;
  96.  
  97. protected var smartKeybindingEnabled : bool; default smartKeybindingEnabled = true;
  98.  
  99. public var m_structureCreator : IngameMenuStructureCreator;
  100.  
  101. protected var isInLoadselector : bool; default isInLoadselector = false;
  102. protected var swapAcceptCancelChanged : bool; default swapAcceptCancelChanged = false;
  103. protected var alternativeRadialInputChanged : bool; default alternativeRadialInputChanged = false;
  104. protected var EnableUberMovement : bool; default EnableUberMovement = false;
  105.  
  106. protected var shouldRefreshKinect : bool; default shouldRefreshKinect = false;
  107. public var isMainMenu : bool;
  108.  
  109. protected var managingPause : bool; default managingPause = false;
  110.  
  111. protected var updateInputDeviceRequired : bool; default updateInputDeviceRequired = false;
  112.  
  113. protected var hasChangedOption : bool;
  114. default hasChangedOption = false;
  115.  
  116. private var ignoreInput : bool;
  117. default ignoreInput = false;
  118.  
  119. public var disableAccountPicker : bool;
  120. default disableAccountPicker = false;
  121.  
  122. protected var lastSetTag : int;
  123.  
  124. protected var currentLangValue : string;
  125. protected var lastUsedLangValue : string;
  126. protected var currentSpeechLang : string;
  127. protected var lastUsedSpeechLang : string;
  128. private var languageName : string;
  129.  
  130. private var panelMode : bool; default panelMode = false;
  131.  
  132. public var lastSetDifficulty : int;
  133.  
  134. event OnConfigUI()
  135. {
  136. var initDataObject : W3MenuInitData;
  137. var commonIngameMenu : CR4CommonIngameMenu;
  138. var commonMainMenuBase : CR4CommonMainMenuBase;
  139. var deathScreenMenu : CR4DeathScreenMenu;
  140. var audioLanguageName : string;
  141. var tempLanguageName : string;
  142. var username : string;
  143. var lootPopup : CR4LootPopup;
  144. var ep1StatusText : string;
  145. var ep2StatusText : string;
  146.  
  147. //New Game Plus Plus begin
  148. var newGamePlusPlusLevel: int;
  149. //New Game Plus Plus end
  150.  
  151. super.OnConfigUI();
  152.  
  153. m_fxNavigateBack = m_flashModule.GetMemberFlashFunction("handleNavigateBack");
  154. m_fxSetIsMainMenu = m_flashModule.GetMemberFlashFunction("setIsMainMenu");
  155. m_fxSetCurrentUsername = m_flashModule.GetMemberFlashFunction("setCurrentUsername");
  156. m_fxSetVersion = m_flashModule.GetMemberFlashFunction("setVersion");
  157. m_fxShowHelp = m_flashModule.GetMemberFlashFunction("showHelpPanel");
  158. m_fxSetVisible = m_flashModule.GetMemberFlashFunction("setVisible");
  159. m_fxSetPanelMode = m_flashModule.GetMemberFlashFunction("setPanelMode");
  160. m_fxRemoveOption = m_flashModule.GetMemberFlashFunction("removeOption");
  161. m_fxSetGameLogoLanguage = m_flashModule.GetMemberFlashFunction( "setGameLogoLanguage" );
  162. m_fxUpdateOptionValue = m_flashModule.GetMemberFlashFunction( "updateOptionValue" );
  163. m_fxUpdateInputFeedback = m_flashModule.GetMemberFlashFunction( "updateInputFeedback" );
  164. m_fxOnSaveScreenshotRdy = m_flashModule.GetMemberFlashFunction( "onSaveScreenshotLoaded" );
  165. m_fxSetIgnoreInput = m_flashModule.GetMemberFlashFunction( "setIgnoreInput" );
  166. m_fxForceEnterCurEntry = m_flashModule.GetMemberFlashFunction( "forceEnterCurrentEntry" );
  167. m_fxForceBackgroundVis = m_flashModule.GetMemberFlashFunction( "setForceBackgroundVisible" );
  168. m_fxSetHardwareCursorOn = m_flashModule.GetMemberFlashFunction( "setHardwareCursorOn" );
  169. m_fxSetExpansionText = m_flashModule.GetMemberFlashFunction( "setExpansionText" );
  170.  
  171. m_structureCreator = new IngameMenuStructureCreator in this;
  172. m_structureCreator.parentMenu = this;
  173. m_structureCreator.m_flashValueStorage = m_flashValueStorage;
  174. m_structureCreator.m_flashConstructor = m_flashValueStorage.CreateTempFlashObject();
  175.  
  176. m_hideTutorial = false;
  177. m_forceHideTutorial = false;
  178. disableAccountPicker = false;
  179.  
  180. theGame.LoadHudSettings();
  181.  
  182. mInGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  183. inGameConfigBufferedWrapper = theGame.GetGuiManager().GetInGameConfigBufferedWrapper();
  184.  
  185. lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('LootPopup');
  186.  
  187. if (lootPopup)
  188. {
  189. lootPopup.ClosePopup();
  190. }
  191.  
  192. commonIngameMenu = (CR4CommonIngameMenu)(GetParent());
  193. commonMainMenuBase = (CR4CommonMainMenuBase)(GetParent());
  194. deathScreenMenu = (CR4DeathScreenMenu)(GetParent());
  195.  
  196. if (commonIngameMenu)
  197. {
  198. //New Game Plus Plus begin
  199. if (FactsQuerySum("NewGamePlus") > 0)
  200. {
  201. newGamePlusPlusLevel = theGame.params.GetNewGamePlusLevel();
  202. mInGameConfigWrapper.SetVarValue('NewGamePlusPlus', 'NewGamePlusPlusLevel', newGamePlusPlusLevel);
  203. }
  204. //New Game Plus Plus end
  205.  
  206. isMainMenu = false;
  207. panelMode = false;
  208. mInGameConfigWrapper.ActivateScriptTag('inGame');
  209. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  210. if ((!thePlayer.IsAlive() && !thePlayer.OnCheckUnconscious()) || theGame.HasBlackscreenRequested() || theGame.IsDialogOrCutscenePlaying())
  211. {
  212. CloseMenu();
  213. return true;
  214. }
  215. WmkGetQuickSlotsInstance().OnIngameMenuOpen(this); // -= WMK:modQuickSlots =-
  216. }
  217. else if (commonMainMenuBase)
  218. {
  219. isMainMenu = true;
  220. panelMode = false;
  221. mInGameConfigWrapper.ActivateScriptTag('mainMenu');
  222. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  223.  
  224. StartShowingCustomDialogs();
  225.  
  226. if (theGame.GetDLCManager().IsEP1Available())
  227. {
  228. ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  229. }
  230. else
  231. {
  232. ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  233. }
  234.  
  235. if (theGame.GetDLCManager().IsEP2Available())
  236. {
  237. ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  238. }
  239. else
  240. {
  241.  
  242. ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  243. }
  244.  
  245. m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  246.  
  247. if (theGame.AreConfigResetInThisSession() && !theGame.HasShownConfigChangedMessage())
  248. {
  249. showNotification(GetLocStringByKeyExt("update_warning_message"));
  250. OnPlaySoundEvent("gui_global_denied");
  251. theGame.SetHasShownConfigChangedMessage(true);
  252. }
  253. }
  254. else if (deathScreenMenu)
  255. {
  256. isMainMenu = false;
  257. panelMode = true;
  258. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  259. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  260.  
  261. deathScreenMenu.HideInputFeedback();
  262.  
  263. if (hasSaveDataToLoad())
  264. {
  265. isInLoadselector = true;
  266. SendLoadData();
  267. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  268. }
  269. else
  270. {
  271. CloseMenu();
  272. }
  273. }
  274. else
  275. {
  276. initDataObject = (W3MenuInitData)GetMenuInitData();
  277.  
  278. if (initDataObject && initDataObject.getDefaultState() == 'SaveGame')
  279. {
  280. isMainMenu = false;
  281. panelMode = true;
  282.  
  283. managingPause = true;
  284. theInput.StoreContext( 'EMPTY_CONTEXT' );
  285. theGame.Pause('IngameMenu');
  286.  
  287. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  288. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  289.  
  290. SendSaveData();
  291. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  292. }
  293. }
  294.  
  295. IngameMenu_UpdateDLCScriptTags();
  296.  
  297. if (!panelMode)
  298. {
  299. m_fxSetIsMainMenu.InvokeSelfOneArg(FlashArgBool(isMainMenu));
  300. if (isMainMenu)
  301. {
  302. username = FixStringForFont(theGame.GetActiveUserDisplayName());
  303. m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  304.  
  305. m_fxSetVersion.InvokeSelfOneArg(FlashArgString(theGame.GetApplicationVersion()));
  306. }
  307. theGame.GetSecondScreenManager().SendGameMenuOpen();
  308.  
  309. lastSetDifficulty = theGame.GetDifficultyLevel();
  310.  
  311. currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  312. lastUsedLangValue = currentLangValue;
  313.  
  314. currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  315. lastUsedSpeechLang = currentSpeechLang;
  316.  
  317. theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  318. if( tempLanguageName != languageName )
  319. {
  320. languageName = tempLanguageName;
  321. m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  322. }
  323.  
  324. PopulateMenuData();
  325. }
  326. }
  327.  
  328. event OnRefresh()
  329. {
  330. var audioLanguageName : string;
  331. var tempLanguageName : string;
  332. var overlayPopupRef : CR4OverlayPopup;
  333. var username : string;
  334. var hud : CR4ScriptedHud;
  335. var ep1StatusText : string;
  336. var ep2StatusText : string;
  337.  
  338.  
  339. currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  340. lastUsedLangValue = currentLangValue;
  341.  
  342. currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  343. lastUsedSpeechLang = currentSpeechLang;
  344.  
  345. if (isMainMenu)
  346. {
  347. username = FixStringForFont(theGame.GetActiveUserDisplayName());
  348. m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  349.  
  350. PopulateMenuData();
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358. }
  359.  
  360. UpdateAcceptCancelSwaping();
  361. SetPlatformType(theGame.GetPlatform());
  362. hud = (CR4ScriptedHud)(theGame.GetHud());
  363. if (hud)
  364. {
  365. hud.UpdateAcceptCancelSwaping();
  366. }
  367.  
  368. overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  369. if (overlayPopupRef)
  370. {
  371. overlayPopupRef.UpdateAcceptCancelSwaping();
  372. }
  373.  
  374. theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  375. if( tempLanguageName != languageName )
  376. {
  377. languageName = tempLanguageName;
  378. m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  379. m_fxUpdateInputFeedback.InvokeSelf();
  380. if (overlayPopupRef)
  381. {
  382. overlayPopupRef.UpdateButtons();
  383. }
  384. }
  385.  
  386. if (!theGame.IsContentAvailable('content12'))
  387.  
  388. {
  389.  
  390.  
  391.  
  392. m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  393. }
  394. setArabicAligmentMode();
  395. }
  396.  
  397. function OnRequestSubMenu( menuName: name, optional initData : IScriptable )
  398. {
  399. RequestSubMenu(menuName, initData);
  400. m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(false));
  401. }
  402.  
  403. function ChildRequestCloseMenu()
  404. {
  405. m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(true));
  406. }
  407.  
  408. event OnCloseMenu()
  409. {
  410. CloseMenu();
  411. }
  412.  
  413. public function ReopenMenu()
  414. {
  415. var commonInGameMenu : CR4CommonIngameMenu;
  416. var commonMainMenuBase : CR4CommonMainMenuBase;
  417.  
  418. commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  419. if(commonInGameMenu)
  420. {
  421. commonInGameMenu.reopenRequested = true;
  422. }
  423.  
  424. commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  425. if ( commonMainMenuBase )
  426. {
  427. commonMainMenuBase.reopenRequested = true;
  428. }
  429.  
  430. CloseMenu();
  431. }
  432.  
  433. event OnClosingMenu()
  434. {
  435. var commonInGameMenu : CR4CommonIngameMenu;
  436. var commonMainMenuBase : CR4CommonMainMenuBase;
  437. var deathScreenMenu : CR4DeathScreenMenu;
  438. var controlsFeedbackModule : CR4HudModuleControlsFeedback;
  439. var interactionModule : CR4HudModuleInteractions;
  440. var hud : CR4ScriptedHud;
  441.  
  442. //New Game Plus Plus begin
  443. var newGamePlusPlusLevel: int;
  444. var equipmentLeveling: string;
  445. //New Game Plus Plus end
  446.  
  447. SaveChangedSettings();
  448.  
  449. theGame.GetSecondScreenManager().SendGameMenuClose();
  450. super.OnClosingMenu();
  451.  
  452.  
  453. hud = (CR4ScriptedHud)(theGame.GetHud());
  454. if (hud)
  455. {
  456. controlsFeedbackModule = (CR4HudModuleControlsFeedback)(hud.GetHudModule(NameToString('ControlsFeedbackModule')));
  457. if (controlsFeedbackModule)
  458. {
  459. controlsFeedbackModule.ForceModuleUpdate();
  460. }
  461.  
  462. interactionModule = (CR4HudModuleInteractions)(hud.GetHudModule(NameToString('InteractionsModule')));
  463. if (interactionModule)
  464. {
  465. interactionModule.ForceUpdateModule();
  466. }
  467. }
  468.  
  469. if (managingPause)
  470. {
  471. managingPause = false;
  472. theInput.RestoreContext( 'EMPTY_CONTEXT', true );
  473. theGame.Unpause('IngameMenu');
  474. }
  475.  
  476. // -= WMK:modQuickSlots =-
  477. if (WmkGetQuickSlotsInstance() && (CR4CommonIngameMenu)(GetParent())) {
  478. WmkGetQuickSlotsInstance().OnClosingIngameMenu(this);
  479. }
  480. // -= WMK:modQuickSlots =-
  481.  
  482. if (theGame.GetGuiManager().potalConfirmationPending)
  483. {
  484. theGame.GetGuiManager().ResumePortalConfirmationPendingMessage();
  485. }
  486.  
  487. if (m_structureCreator)
  488. {
  489. delete m_structureCreator;
  490. }
  491.  
  492. if (loadConfPopup)
  493. {
  494. delete loadConfPopup;
  495. }
  496.  
  497. if (saveConfPopup)
  498. {
  499. delete saveConfPopup;
  500. }
  501.  
  502. if (actionConfPopup)
  503. {
  504. delete actionConfPopup;
  505. }
  506.  
  507. if (newGameConfPopup)
  508. {
  509. delete newGameConfPopup;
  510. }
  511.  
  512. if (deleteConfPopup)
  513. {
  514. delete deleteConfPopup;
  515. }
  516.  
  517. if (diffChangeConfPopup)
  518. {
  519. delete diffChangeConfPopup;
  520. }
  521.  
  522. commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  523. if(commonInGameMenu)
  524. {
  525. //New Game Plus Plus begin
  526. if (FactsQuerySum("NewGamePlus") > 0)
  527. {
  528. newGamePlusPlusLevel = StringToInt(mInGameConfigWrapper.GetVarValue('NewGamePlusPlus', 'NewGamePlusPlusLevel'), 0);
  529. theGame.params.SetNewGamePlusLevel(newGamePlusPlusLevel);
  530. FactsSet("FinalNewGamePlusLevel", theGame.params.GetNewGamePlusLevel());
  531. }
  532.  
  533. equipmentLeveling = mInGameConfigWrapper.GetVarValue('NewGamePlusPlus', 'EquipmentLeveling');
  534.  
  535. if (equipmentLeveling == "2")
  536. thePlayer.GetInventory().LevelEquipment();
  537. else if (equipmentLeveling == "1")
  538. thePlayer.GetInventory().RestoreEquipment();
  539. //New Game Plus Plus end
  540.  
  541. commonInGameMenu.ChildRequestCloseMenu();
  542. return true;
  543. }
  544.  
  545. commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  546. if ( commonMainMenuBase )
  547. {
  548. commonMainMenuBase.ChildRequestCloseMenu();
  549. return true;
  550. }
  551.  
  552. deathScreenMenu = (CR4DeathScreenMenu)m_parentMenu;
  553. if (deathScreenMenu)
  554. {
  555. deathScreenMenu.ChildRequestCloseMenu();
  556. return true;
  557. }
  558. }
  559.  
  560.  
  561. protected function CloseCurrentPopup():void
  562. {
  563. if (loadConfPopup)
  564. {
  565. loadConfPopup.ClosePopupOverlay();
  566. }
  567. else if (saveConfPopup)
  568. {
  569. saveConfPopup.ClosePopupOverlay();
  570. }
  571. else if (actionConfPopup)
  572. {
  573. actionConfPopup.ClosePopupOverlay();
  574. }
  575. else if (newGameConfPopup)
  576. {
  577. newGameConfPopup.ClosePopupOverlay();
  578. }
  579. else if (deleteConfPopup)
  580. {
  581. deleteConfPopup.ClosePopupOverlay();
  582. }
  583. else if (diffChangeConfPopup)
  584. {
  585. diffChangeConfPopup.ClosePopupOverlay();
  586. }
  587. }
  588.  
  589. public function SetIgnoreInput(value : bool) : void
  590. {
  591. if (value != ignoreInput)
  592. {
  593. ignoreInput = value;
  594. m_fxSetIgnoreInput.InvokeSelfOneArg( FlashArgBool(value) );
  595. }
  596. }
  597.  
  598. public function OnUserSignIn() : void
  599. {
  600. SetIgnoreInput(false);
  601. CloseCurrentPopup();
  602. }
  603.  
  604. public function OnUserSignInCancelled() : void
  605. {
  606. SetIgnoreInput(false);
  607. CloseCurrentPopup();
  608. }
  609.  
  610. public function OnSaveLoadingFailed() : void
  611. {
  612. SetIgnoreInput(false);
  613. CloseCurrentPopup();
  614. }
  615.  
  616. event OnItemActivated( actionType:int, menuTag:int ) : void
  617. {
  618. var l_DataFlashArray : CScriptedFlashArray;
  619.  
  620. if (ignoreInput)
  621. {
  622. m_fxNavigateBack.InvokeSelf();
  623. }
  624. else
  625. {
  626. switch (actionType)
  627. {
  628. case IGMActionType_CommonMenu:
  629. theGame.RequestMenu( 'CommonMenu' );
  630. break;
  631. case IGMActionType_MenuHolder:
  632.  
  633.  
  634. m_initialSelectionsToIgnore = 1;
  635. OnPlaySoundEvent( "gui_global_panel_open" );
  636. break;
  637. case IGMActionType_MenuLastHolder:
  638. m_initialSelectionsToIgnore = 1;
  639. OnPlaySoundEvent( "gui_global_panel_open" );
  640. break;
  641. case IGMActionType_Load:
  642. if (hasSaveDataToLoad())
  643. {
  644. SendLoadData();
  645. }
  646. else
  647. {
  648.  
  649. m_fxNavigateBack.InvokeSelf();
  650. }
  651. isInLoadselector = true;
  652. break;
  653. case IGMActionType_Save:
  654. if ( !theGame.AreSavesLocked() )
  655. {
  656. SendSaveData();
  657. }
  658. else
  659. {
  660. m_fxNavigateBack.InvokeSelf();
  661. theGame.GetGuiManager().DisplayLockedSavePopup();
  662. }
  663. isInLoadselector = false;
  664. break;
  665. case IGMActionType_Quit:
  666. if (theGame.GetPlatform() == Platform_Xbox1)
  667. {
  668. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game_x1"));
  669. }
  670. else if (theGame.GetPlatform() == Platform_PS4)
  671. {
  672. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game_ps4"));
  673. }
  674. else
  675. {
  676. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game"));
  677. }
  678. break;
  679. case IGMActionType_Toggle:
  680. break;
  681. case IGMActionType_List:
  682. break;
  683. case IGMActionType_Slider:
  684. break;
  685. case IGMActionType_LoadLastSave:
  686. LoadLastSave();
  687. break;
  688. case IGMActionType_Close:
  689.  
  690. break;
  691. case IGMActionType_Tutorials:
  692. theGame.RequestMenuWithBackground( 'GlossaryTutorialsMenu', 'CommonMenu' );
  693. break;
  694. case IGMActionType_Credits:
  695. theGame.GetGuiManager().RequestCreditsMenu(menuTag);
  696. break;
  697. case IGMActionType_Help:
  698. showHelpPanel();
  699. break;
  700. case IGMActionType_Options:
  701. if (theGame.GetPlatform() == Platform_PC)
  702. {
  703. m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(mInGameConfigWrapper.GetVarValue('Rendering', 'HardwareCursor')));
  704. }
  705. l_DataFlashArray = IngameMenu_FillOptionsSubMenuData(m_flashValueStorage, isMainMenu);
  706.  
  707. m_initialSelectionsToIgnore = 1;
  708. OnPlaySoundEvent( "gui_global_panel_open" );
  709.  
  710. m_flashValueStorage.SetFlashArray( "ingamemenu.options.entries", l_DataFlashArray );
  711. break;
  712. case IGMActionType_ControllerHelp:
  713. SendControllerData();
  714. break;
  715. case IGMActionType_NewGame:
  716. TryStartNewGame(menuTag);
  717. break;
  718. case IGMActionType_NewGamePlus:
  719. fetchNewGameConfigFromTag(menuTag);
  720. SendNewGamePlusSaves();
  721. break;
  722. case IGMActionType_InstalledDLC:
  723. SendInstalledDLCList();
  724. break;
  725. case IGMActionType_UIRescale:
  726. SendRescaleData();
  727. break;
  728. case IGMActionType_DebugStartQuest:
  729. RequestSubMenu( 'MainDbgStartQuestMenu', GetMenuInitData() );
  730. break;
  731. case IGMActionType_Gwint:
  732. GetRootMenu().CloseMenu();
  733. theGame.RequestMenu( 'DeckBuilder' );
  734. break;
  735. case IGMActionType_ImportSave:
  736. lastSetTag = menuTag;
  737. fetchNewGameConfigFromTag( menuTag );
  738. SendImportSaveData( );
  739. break;
  740. case IGMActionType_CloseGame:
  741. if (!isMainMenu)
  742. {
  743. ShowActionConfPopup(IGMActionType_CloseGame, "", GetLocStringByKeyExt("error_message_exit_game"));
  744. }
  745. else
  746. {
  747. theGame.RequestExit();
  748. }
  749. break;
  750. case IGMActionType_KeyBinds:
  751. SendKeybindData();
  752. break;
  753. }
  754. }
  755. }
  756.  
  757. public function HandleLoadGameFailed():void
  758. {
  759. disableAccountPicker = false;
  760. SetIgnoreInput(false);
  761. }
  762.  
  763. private function StartShowingCustomDialogs()
  764. {
  765.  
  766.  
  767.  
  768. if (theGame.GetInGameConfigWrapper().GetVarValue('Hidden', 'HasSeenGotyWelcomeMessage') == "false")
  769. {
  770. theGame.GetInGameConfigWrapper().SetVarValue('Hidden', 'HasSeenGotyWelcomeMessage', "true");
  771. theGame.SaveUserSettings();
  772.  
  773. if ( theGame.GetInGameConfigWrapper().GetVarValue('Hidden', 'NorthAmericanVersion') == "true" )
  774. {
  775. prepareBigMessageGOTY( "menu_goty_starting_message_alt" );
  776. }
  777. else
  778. {
  779. prepareBigMessageGOTY( "menu_goty_starting_message" );
  780. }
  781. }
  782. theGame.SaveUserSettings();
  783. prepareBigMessage( 2 );
  784. }
  785.  
  786. }
  787.  
  788. protected function prepareBigMessage( epIndex : int ):void
  789. {
  790. var l_DataFlashObject : CScriptedFlashObject;
  791.  
  792. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  793.  
  794. l_DataFlashObject.SetMemberFlashInt( "index", epIndex );
  795. l_DataFlashObject.SetMemberFlashString( "tfTitle1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_1") );
  796. l_DataFlashObject.SetMemberFlashString( "tfTitle2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_2") );
  797.  
  798. l_DataFlashObject.SetMemberFlashString( "tfTitlePath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1") );
  799. l_DataFlashObject.SetMemberFlashString( "tfTitlePath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2") );
  800. l_DataFlashObject.SetMemberFlashString( "tfTitlePath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3") );
  801.  
  802. l_DataFlashObject.SetMemberFlashString( "tfDescPath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1_description") );
  803. l_DataFlashObject.SetMemberFlashString( "tfDescPath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2_description") );
  804. l_DataFlashObject.SetMemberFlashString( "tfDescPath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3_description") );
  805.  
  806. l_DataFlashObject.SetMemberFlashString( "tfWarning", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_warning_level") );
  807. l_DataFlashObject.SetMemberFlashString( "tfGoodLuck", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_good_luck") );
  808.  
  809. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage" + epIndex, l_DataFlashObject );
  810. }
  811.  
  812. private function prepareBigMessageGOTY( text : string )
  813. {
  814. var l_DataFlashObject : CScriptedFlashObject;
  815. var title1 : string;
  816. var content : string;
  817. var titleEnd : string;
  818.  
  819. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  820.  
  821. title1 = GetLocStringByKey( text );
  822. content = GetLocStringByKey( "menu_goty_starting_message_content" );
  823. titleEnd = GetLocStringByKey( "ep1_installed_information_good_luck" );
  824.  
  825. l_DataFlashObject.SetMemberFlashInt( "index", 3 );
  826. l_DataFlashObject.SetMemberFlashString( "tfTitle1", title1 );
  827. l_DataFlashObject.SetMemberFlashString( "tfContent", content );
  828. l_DataFlashObject.SetMemberFlashString( "tfTitleEnd", titleEnd );
  829.  
  830. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage3", l_DataFlashObject );
  831.  
  832. }
  833.  
  834.  
  835. protected function LoadLastSave():void
  836. {
  837. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  838. {
  839. return;
  840. }
  841.  
  842. SetIgnoreInput(true);
  843.  
  844. if (isMainMenu)
  845. {
  846. disableAccountPicker = true;
  847. }
  848.  
  849. theGame.LoadLastGameInit();
  850. }
  851.  
  852. protected function ShowActionConfPopup(action : int, title : string, description : string) : void
  853. {
  854. if (actionConfPopup)
  855. {
  856. delete actionConfPopup;
  857. }
  858.  
  859. actionConfPopup = new W3ActionConfirmation in this;
  860. actionConfPopup.SetMessageTitle(title);
  861. actionConfPopup.SetMessageText(description);
  862. actionConfPopup.actionID = action;
  863. actionConfPopup.menuRef = this;
  864. actionConfPopup.BlurBackground = true;
  865.  
  866. RequestSubMenu('PopupMenu', actionConfPopup);
  867. }
  868.  
  869. public function OnActionConfirmed(action:int) : void
  870. {
  871. var parentMenu : CR4MenuBase;
  872.  
  873. parentMenu = (CR4MenuBase)GetParent();
  874.  
  875. switch (action)
  876. {
  877. case IGMActionType_Quit:
  878. {
  879. parentMenu.OnCloseMenu();
  880. theGame.RequestEndGame();
  881. break;
  882. }
  883. case IGMActionType_CloseGame:
  884. {
  885. theGame.RequestExit();
  886. break;
  887. }
  888. }
  889. }
  890.  
  891. event OnPresetApplied(groupId:name, targetPresetIndex:int)
  892. {
  893. hasChangedOption = true;
  894. IngameMenu_ChangePresetValue(groupId, targetPresetIndex, this);
  895.  
  896. if (groupId == 'Rendering' && !isMainMenu)
  897. {
  898. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  899. }
  900. }
  901.  
  902. public function UpdateOptions(groupId:name)
  903. {
  904. var optionChangeContainer : CScriptedFlashObject;
  905.  
  906. optionChangeContainer = m_flashValueStorage.CreateTempFlashObject();
  907. IngameMenu_GatherOptionUpdatedValues(groupId, optionChangeContainer, m_flashValueStorage);
  908.  
  909. m_flashValueStorage.SetFlashObject( "ingamemenu.optionValueChanges", optionChangeContainer );
  910. }
  911.  
  912. event OnOptionValueChanged(groupId:int, optionName:name, optionValue:string)
  913. {
  914. var groupName:name;
  915. var hud : CR4ScriptedHud;
  916. var isValid : bool;
  917. var isBuffered : bool;
  918.  
  919. hasChangedOption = true;
  920.  
  921. OnPlaySoundEvent( "gui_global_switch" );
  922.  
  923. if (groupId == NameToFlashUInt('SpecialSettingsGroupId'))
  924. {
  925. HandleSpecialValueChanged(optionName, optionValue);
  926. return true;
  927. }
  928.  
  929. if (optionName == 'HardwareCursor')
  930. {
  931. isValid = optionValue;
  932. m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(isValid));
  933. }
  934.  
  935. if (optionName == 'SwapAcceptCancel')
  936. {
  937. swapAcceptCancelChanged = true;
  938. }
  939.  
  940. if (optionName == 'AlternativeRadialMenuInputMode')
  941. {
  942. alternativeRadialInputChanged = true;
  943. }
  944.  
  945. if (optionName == 'EnableUberMovement')
  946. {
  947. if ( optionValue == "1" )
  948. theGame.EnableUberMovement( true );
  949. else
  950. theGame.EnableUberMovement( false );
  951. }
  952.  
  953. if (optionName == 'GwentDifficulty')
  954. {
  955. if ( optionValue == "0" )
  956. FactsSet( 'gwent_difficulty' , 1 );
  957. else if ( optionValue == "1" )
  958. FactsSet( 'gwent_difficulty' , 2 );
  959. else if ( optionValue == "2" )
  960. FactsSet( 'gwent_difficulty' , 3 );
  961.  
  962. return true;
  963. }
  964.  
  965. if (optionName == 'HardwareCursor')
  966. {
  967. updateInputDeviceRequired = true;
  968. }
  969.  
  970. groupName = mInGameConfigWrapper.GetGroupName(groupId);
  971.  
  972.  
  973. isBuffered = mInGameConfigWrapper.DoGroupHasTag( groupName, 'buffered' );
  974. if( isBuffered == false )
  975. {
  976. isBuffered = mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'buffered' );
  977. }
  978.  
  979. if( isBuffered == true )
  980. {
  981. inGameConfigBufferedWrapper.SetVarValue(groupName, optionName, optionValue);
  982. }
  983. else
  984. {
  985. mInGameConfigWrapper.SetVarValue(groupName, optionName, optionValue);
  986. }
  987.  
  988. theGame.OnConfigValueChanged(optionName, optionValue);
  989.  
  990. if (groupName == 'Hud' || optionName == 'Subtitles')
  991. {
  992. hud = (CR4ScriptedHud)theGame.GetHud();
  993.  
  994. if (hud)
  995. {
  996. hud.UpdateHudConfig(optionName, true);
  997. }
  998. }
  999.  
  1000. if (groupName == 'Localization')
  1001. {
  1002. if (optionName == 'Virtual_Localization_text')
  1003. {
  1004. currentLangValue = optionValue;
  1005. }
  1006. else if (optionName == 'Virtual_Localization_speech')
  1007. {
  1008. currentSpeechLang = optionValue;
  1009. }
  1010. }
  1011.  
  1012. if (groupName == 'Rendering' && !isMainMenu)
  1013. {
  1014. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  1015. }
  1016.  
  1017. if (groupName == 'Rendering' && optionName == 'PreserveSystemGamma')
  1018. {
  1019. theGame.GetGuiManager().DisplayRestartGameToApplyAllChanges();
  1020. }
  1021.  
  1022. // -= WMK:modQuickSlots =-
  1023. if (WmkGetQuickSlotsInstance()) {
  1024. WmkGetQuickSlotsInstance().OnOptionValueChanged(groupName, optionName, optionValue);
  1025. }
  1026. // -= WMK:modQuickSlots =-
  1027. }
  1028.  
  1029. protected function HandleSpecialValueChanged(optionName:name, optionValue:string):void
  1030. {
  1031. var intValue : int;
  1032.  
  1033. if (optionName == 'GameDifficulty')
  1034. {
  1035. intValue = StringToInt(optionValue, 1);
  1036.  
  1037. lastSetDifficulty = intValue + 1;
  1038. }
  1039. }
  1040.  
  1041. public function OnGraphicsUpdated(keepChanges:bool):void
  1042. {
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048. }
  1049.  
  1050. event OnOptionPanelNavigateBack()
  1051. {
  1052. var graphicChangesPending:bool;
  1053. var hud : CR4ScriptedHud;
  1054.  
  1055. if (inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1056. {
  1057. inGameConfigBufferedWrapper.ApplyNewValues();
  1058. theGame.GetGuiManager().ShowProgressDialog(UMID_GraphicsRefreshing, "", "message_text_confirm_option_changes", true, UDB_OkCancel, 100, UMPT_GraphicsRefresh, '');
  1059. ReopenMenu();
  1060. return true;
  1061. }
  1062.  
  1063. hud = (CR4ScriptedHud)theGame.GetHud();
  1064. if (hud)
  1065. {
  1066. hud.RefreshHudConfiguration();
  1067. }
  1068.  
  1069. thePlayer.SetAutoCameraCenter( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'AutoCameraCenter' ) );
  1070. thePlayer.SetEnemyUpscaling( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'EnemyUpscaling' ) );
  1071. }
  1072.  
  1073. event OnNavigatedBack()
  1074. {
  1075. var lowestDifficultyUsed : EDifficultyMode;
  1076. var hud : CR4ScriptedHud;
  1077. var overlayPopupRef : CR4OverlayPopup;
  1078. var radialMenuModule : CR4HudModuleRadialMenu;
  1079. var confirmResult : int;
  1080.  
  1081. hud = (CR4ScriptedHud)(theGame.GetHud());
  1082. overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  1083.  
  1084. if( inGameConfigBufferedWrapper.IsEmpty() == false )
  1085. {
  1086. if (!inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1087. {
  1088. inGameConfigBufferedWrapper.FlushBuffer();
  1089. }
  1090.  
  1091. hasChangedOption = true;
  1092. }
  1093.  
  1094. if (currentLangValue != lastUsedLangValue || lastUsedSpeechLang != currentSpeechLang)
  1095. {
  1096. lastUsedLangValue = currentLangValue;
  1097. lastUsedSpeechLang = currentSpeechLang;
  1098. theGame.ReloadLanguage();
  1099.  
  1100. }
  1101.  
  1102. if (swapAcceptCancelChanged)
  1103. {
  1104. swapAcceptCancelChanged = false;
  1105. UpdateAcceptCancelSwaping();
  1106.  
  1107. if (hud)
  1108. {
  1109. hud.UpdateAcceptCancelSwaping();
  1110. }
  1111.  
  1112. if (overlayPopupRef)
  1113. {
  1114. overlayPopupRef.UpdateAcceptCancelSwaping();
  1115. }
  1116. }
  1117.  
  1118. if (alternativeRadialInputChanged)
  1119. {
  1120. alternativeRadialInputChanged = false;
  1121.  
  1122. if (hud)
  1123. {
  1124. radialMenuModule = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  1125. if (radialMenuModule)
  1126. {
  1127. radialMenuModule.UpdateInputMode();
  1128. }
  1129. }
  1130. }
  1131.  
  1132. isShowingSaveList = false;
  1133. isShowingLoadList = false;
  1134.  
  1135. OnPlaySoundEvent( "gui_global_panel_close" );
  1136.  
  1137. lowestDifficultyUsed = theGame.GetLowestDifficultyUsed();
  1138.  
  1139.  
  1140.  
  1141. if (!isMainMenu && theGame.GetDifficultyLevel() != lastSetDifficulty && lowestDifficultyUsed > lastSetDifficulty && lowestDifficultyUsed > EDM_Medium)
  1142. {
  1143. diffChangeConfPopup = new W3DifficultyChangeConfirmation in this;
  1144.  
  1145. diffChangeConfPopup.SetMessageTitle("");
  1146.  
  1147. if (theGame.GetPlatform() == Platform_PS4)
  1148. {
  1149. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_PS4"));
  1150. }
  1151. else
  1152. {
  1153. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_X1"));
  1154. }
  1155.  
  1156. diffChangeConfPopup.menuRef = this;
  1157. diffChangeConfPopup.targetDifficulty = lastSetDifficulty;
  1158. diffChangeConfPopup.BlurBackground = true;
  1159.  
  1160. RequestSubMenu('PopupMenu', diffChangeConfPopup);
  1161. }
  1162. else if (lastSetDifficulty != theGame.GetDifficultyLevel())
  1163. {
  1164. theGame.SetDifficultyLevel(lastSetDifficulty);
  1165. theGame.OnDifficultyChanged(lastSetDifficulty);
  1166. }
  1167.  
  1168. SaveChangedSettings();
  1169.  
  1170. if (overlayPopupRef && updateInputDeviceRequired)
  1171. {
  1172. updateInputDeviceRequired = false;
  1173. overlayPopupRef.UpdateInputDevice();
  1174. }
  1175. }
  1176.  
  1177. public function CancelDifficultyChange() : void
  1178. {
  1179. var difficultyIndex:int;
  1180. var difficultyIndexAsString:string;
  1181.  
  1182. lastSetDifficulty = theGame.GetDifficultyLevel();
  1183.  
  1184. difficultyIndex = lastSetDifficulty - 1;
  1185. difficultyIndexAsString = "" + difficultyIndex;
  1186. m_fxUpdateOptionValue.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt('GameDifficulty')), FlashArgString(difficultyIndexAsString));
  1187. }
  1188.  
  1189. protected function SaveChangedSettings()
  1190. {
  1191. if (hasChangedOption)
  1192. {
  1193. hasChangedOption = false;
  1194. theGame.SaveUserSettings();
  1195. }
  1196. }
  1197.  
  1198. event OnProfileChange()
  1199. {
  1200. if( !disableAccountPicker )
  1201. {
  1202. SetIgnoreInput(true);
  1203. theGame.ChangeActiveUser();
  1204. }
  1205. }
  1206.  
  1207. event OnSaveGameCalled(type : ESaveGameType, saveArrayIndex : int)
  1208. {
  1209. var saves : array< SSavegameInfo >;
  1210. var currentSave : SSavegameInfo;
  1211.  
  1212. ignoreInput = true;
  1213.  
  1214. if ( theGame.AreSavesLocked() )
  1215. {
  1216. theGame.GetGuiManager().DisplayLockedSavePopup();
  1217. SetIgnoreInput(false);
  1218. return false;
  1219. }
  1220.  
  1221. if (saveArrayIndex >= 0)
  1222. {
  1223. if (saveConfPopup)
  1224. {
  1225. delete saveConfPopup;
  1226. }
  1227.  
  1228. theGame.ListSavedGames( saves );
  1229. currentSave = saves[ saveArrayIndex ];
  1230.  
  1231. saveConfPopup = new W3SaveGameConfirmation in this;
  1232. saveConfPopup.SetMessageTitle("");
  1233. if (theGame.GetPlatform() == Platform_Xbox1)
  1234. {
  1235. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_x1"));
  1236. }
  1237. else if (theGame.GetPlatform() == Platform_PS4)
  1238. {
  1239. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_ps4"));
  1240. }
  1241. else
  1242. {
  1243. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save"));
  1244. }
  1245. saveConfPopup.menuRef = this;
  1246. saveConfPopup.type = currentSave.slotType;
  1247. saveConfPopup.slot = currentSave.slotIndex;
  1248. saveConfPopup.BlurBackground = true;
  1249.  
  1250. RequestSubMenu('PopupMenu', saveConfPopup);
  1251. }
  1252. else
  1253. {
  1254. executeSave(type, -1);
  1255. SetIgnoreInput(false);
  1256. }
  1257. }
  1258.  
  1259. public function executeSave(type : ESaveGameType, slot : int)
  1260. {
  1261. var hadLoadable:bool;
  1262.  
  1263. hadLoadable = hasSaveDataToLoad();
  1264.  
  1265. theGame.SaveGame(type, slot);
  1266. m_fxNavigateBack.InvokeSelf();
  1267. }
  1268.  
  1269. event OnLoadGameCalled(type : ESaveGameType, saveListIndex : int)
  1270. {
  1271. var saveGameRef : SSavegameInfo;
  1272. var saveGames : array< SSavegameInfo >;
  1273.  
  1274. if (ignoreInput)
  1275. {
  1276. return false;
  1277. }
  1278.  
  1279. disableAccountPicker = true;
  1280.  
  1281. if (loadConfPopup)
  1282. {
  1283. delete loadConfPopup;
  1284. }
  1285.  
  1286. theGame.ListSavedGames( saveGames );
  1287. saveGameRef = saveGames[saveListIndex];
  1288.  
  1289. if (panelMode || (isMainMenu && !hasValidAutosaveData()))
  1290. {
  1291. LoadSaveRequested(saveGameRef);
  1292. }
  1293. else
  1294. {
  1295. loadConfPopup = new W3ApplyLoadConfirmation in this;
  1296.  
  1297. if (theGame.GetPlatform() == Platform_Xbox1)
  1298. {
  1299. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_x1"));
  1300. }
  1301. else if (theGame.GetPlatform() == Platform_PS4)
  1302. {
  1303. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_ps4"));
  1304. }
  1305. else
  1306. {
  1307. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title"));
  1308. }
  1309.  
  1310. if (isMainMenu)
  1311. {
  1312. if (theGame.GetPlatform() == Platform_Xbox1)
  1313. {
  1314. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_x1"));
  1315. }
  1316. else if (theGame.GetPlatform() == Platform_PS4)
  1317. {
  1318. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_ps4"));
  1319. }
  1320. else
  1321. {
  1322. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu"));
  1323. }
  1324. }
  1325. else
  1326. {
  1327. if (theGame.GetPlatform() == Platform_Xbox1)
  1328. {
  1329. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_x1"));
  1330. }
  1331. else if (theGame.GetPlatform() == Platform_PS4)
  1332. {
  1333. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_ps4"));
  1334. }
  1335. else
  1336. {
  1337. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game"));
  1338. }
  1339. }
  1340. loadConfPopup.menuRef = this;
  1341. loadConfPopup.saveSlotRef = saveGameRef;
  1342. loadConfPopup.BlurBackground = true;
  1343.  
  1344. SetIgnoreInput(true);
  1345.  
  1346. RequestSubMenu('PopupMenu', loadConfPopup);
  1347. }
  1348. }
  1349.  
  1350. public function LoadSaveRequested(saveSlotRef : SSavegameInfo) : void
  1351. {
  1352. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1353. {
  1354. SetIgnoreInput(false);
  1355. disableAccountPicker = false;
  1356. return;
  1357. }
  1358.  
  1359. SetIgnoreInput(true);
  1360.  
  1361. if (isMainMenu)
  1362. {
  1363. disableAccountPicker = true;
  1364. }
  1365.  
  1366. theGame.LoadGameInit( saveSlotRef );
  1367. }
  1368.  
  1369. event OnImportGameCalled(menuTag:int):void
  1370. {
  1371. var savesToImport : array< SSavegameInfo >;
  1372. var difficulty:int;
  1373. var tutorialsEnabled:bool;
  1374. var simulateImport:bool;
  1375. var maskResult:int;
  1376. var progress : float;
  1377.  
  1378. if (!theGame.IsContentAvailable('launch0'))
  1379. {
  1380. progress = theGame.ProgressToContentAvailable('launch0');
  1381. theSound.SoundEvent("gui_global_denied");
  1382. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1383.  
  1384. }
  1385. else
  1386. {
  1387. theGame.ListW2SavedGames( savesToImport );
  1388.  
  1389. if ( menuTag < savesToImport.Size() )
  1390. {
  1391. disableAccountPicker = true;
  1392.  
  1393. theGame.ClearInitialFacts();
  1394.  
  1395. if (theGame.ImportSave( savesToImport[ menuTag ] ))
  1396. {
  1397. currentNewGameConfig.import_save_index = menuTag;
  1398.  
  1399. if ((lastSetTag & IGMC_New_game_plus) == IGMC_New_game_plus)
  1400. {
  1401. m_fxForceEnterCurEntry.InvokeSelf();
  1402. }
  1403. else
  1404. {
  1405.  
  1406. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1407. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1408.  
  1409. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1410. {
  1411. OnPlaySoundEvent("gui_global_game_start");
  1412. OnPlaySoundEvent("mus_intro_usm");
  1413. GetRootMenu().CloseMenu();
  1414. }
  1415. }
  1416. }
  1417. else
  1418. {
  1419. showNotification(GetLocStringByKeyExt("import_witcher_two_failed"));
  1420. OnPlaySoundEvent("gui_global_denied");
  1421. }
  1422. }
  1423. }
  1424. }
  1425.  
  1426. event OnNewGamePlusCalled(saveListIndex:int):void
  1427. {
  1428. var startGameStatus : ENewGamePlusStatus;
  1429. var saveGameRef : SSavegameInfo;
  1430. var saveGames : array< SSavegameInfo >;
  1431. var errorMessage : string;
  1432. var progress : float;
  1433.  
  1434. var requiredContent : name = 'content12';
  1435.  
  1436. ignoreInput = true;
  1437.  
  1438. if (!theGame.IsContentAvailable(requiredContent))
  1439. {
  1440. progress = theGame.ProgressToContentAvailable(requiredContent);
  1441. theSound.SoundEvent("gui_global_denied");
  1442. SetIgnoreInput(false);
  1443. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, requiredContent);
  1444. }
  1445. else
  1446. {
  1447. disableAccountPicker = true;
  1448.  
  1449. theGame.ListSavedGames( saveGames );
  1450. saveGameRef = saveGames[saveListIndex];
  1451.  
  1452. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1453. {
  1454. theGame.AddInitialFact("simulate_import_ingame");
  1455. }
  1456.  
  1457. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1458.  
  1459. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1460.  
  1461. startGameStatus = theGame.StartNewGamePlus(saveGameRef);
  1462.  
  1463. if (startGameStatus == NGP_Success)
  1464. {
  1465. theGame.GetGuiManager().RequestMouseCursor(false);
  1466. OnPlaySoundEvent("gui_global_game_start");
  1467. OnPlaySoundEvent("mus_intro_usm");
  1468. GetRootMenu().CloseMenu();
  1469. }
  1470. else
  1471. {
  1472. errorMessage = "";
  1473. SetIgnoreInput(false);
  1474. disableAccountPicker = false;
  1475.  
  1476. switch (startGameStatus)
  1477. {
  1478. case NGP_Invalid:
  1479. errorMessage = GetLocStringByKeyExt("newgame_plus_error_invalid");
  1480. break;
  1481. case NGP_CantLoad:
  1482. errorMessage = GetLocStringByKeyExt("newgame_plus_error_cantload");
  1483. break;
  1484. case NGP_TooOld:
  1485. errorMessage = GetLocStringByKeyExt("newgame_plus_error_too_old");
  1486. break;
  1487. case NGP_RequirementsNotMet:
  1488. errorMessage = GetLocStringByKeyExt("newgame_plus_error_requirementnotmet");
  1489. break;
  1490. case NGP_InternalError:
  1491. errorMessage = GetLocStringByKeyExt("newgame_plus_error_internalerror");
  1492. break;
  1493. case NGP_ContentRequired:
  1494. errorMessage = GetLocStringByKeyExt("newgame_plus_error_contentrequired");
  1495. break;
  1496. }
  1497.  
  1498. showNotification(errorMessage);
  1499. OnPlaySoundEvent("gui_global_denied");
  1500. }
  1501. }
  1502. }
  1503.  
  1504. event OnDeleteSaveCalled(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1505. {
  1506. if (ignoreInput)
  1507. {
  1508. return false;
  1509. }
  1510.  
  1511. SetIgnoreInput(true);
  1512.  
  1513. disableAccountPicker = true;
  1514.  
  1515. if (deleteConfPopup)
  1516. {
  1517. delete deleteConfPopup;
  1518. }
  1519.  
  1520. deleteConfPopup = new W3DeleteSaveConf in this;
  1521. deleteConfPopup.SetMessageTitle("");
  1522. if (theGame.GetPlatform() == Platform_Xbox1)
  1523. {
  1524. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_x1"));
  1525. }
  1526. else if (theGame.GetPlatform() == Platform_PS4)
  1527. {
  1528. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_ps4"));
  1529. }
  1530. else
  1531. {
  1532. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text"));
  1533. }
  1534. deleteConfPopup.menuRef = this;
  1535. deleteConfPopup.type = type;
  1536. deleteConfPopup.slot = saveListIndex;
  1537. deleteConfPopup.saveMode = isSaveMode;
  1538. deleteConfPopup.BlurBackground = true;
  1539.  
  1540. RequestSubMenu('PopupMenu', deleteConfPopup);
  1541. }
  1542.  
  1543. public function DeleteSave(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1544. {
  1545. var saves : array< SSavegameInfo >;
  1546. var currentSave : SSavegameInfo;
  1547. var numSavesBeforeDelete : int;
  1548.  
  1549. theGame.ListSavedGames( saves );
  1550.  
  1551. numSavesBeforeDelete = saves.Size();
  1552.  
  1553. if (saveListIndex < saves.Size())
  1554. {
  1555. currentSave = saves[ saveListIndex ];
  1556. theGame.DeleteSavedGame(currentSave);
  1557. }
  1558.  
  1559. if (numSavesBeforeDelete <= 1)
  1560. {
  1561. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('Continue')));
  1562. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('LoadGame')));
  1563.  
  1564. if (isInLoadselector)
  1565. {
  1566. m_fxNavigateBack.InvokeSelf();
  1567. }
  1568. else
  1569. {
  1570. SendSaveData();
  1571. }
  1572. }
  1573. else
  1574. {
  1575. if (isSaveMode)
  1576. {
  1577. SendSaveData();
  1578. }
  1579. else if (hasSaveDataToLoad())
  1580. {
  1581. SendLoadData();
  1582. }
  1583. }
  1584. }
  1585.  
  1586. protected function showHelpPanel() : void
  1587. {
  1588. m_fxNavigateBack.InvokeSelf();
  1589.  
  1590. theGame.DisplaySystemHelp();
  1591. }
  1592.  
  1593. public function TryStartNewGame(optionsArray : int):void
  1594. {
  1595. var progress : float;
  1596.  
  1597. if (!theGame.IsContentAvailable('launch0'))
  1598. {
  1599. progress = theGame.ProgressToContentAvailable('launch0');
  1600. theSound.SoundEvent("gui_global_denied");
  1601. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1602. }
  1603. else
  1604. {
  1605. fetchNewGameConfigFromTag(optionsArray);
  1606.  
  1607. if ((optionsArray & IGMC_EP2_Save) == IGMC_EP2_Save)
  1608. {
  1609.  
  1610. theGame.InitStandaloneDLCLoading('bob_000_000', currentNewGameConfig.difficulty);
  1611. theGame.EnableUberMovement( true );
  1612. ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  1613. }
  1614. else if ((optionsArray & IGMC_EP1_Save) == IGMC_EP1_Save)
  1615. {
  1616.  
  1617. theGame.InitStandaloneDLCLoading('ep1', currentNewGameConfig.difficulty);
  1618. theGame.EnableUberMovement( true );
  1619. ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  1620. }
  1621. else
  1622. {
  1623. if (hasValidAutosaveData())
  1624. {
  1625. if (newGameConfPopup)
  1626. {
  1627. delete newGameConfPopup;
  1628. }
  1629.  
  1630. newGameConfPopup = new W3NewGameConfirmation in this;
  1631. newGameConfPopup.SetMessageTitle("");
  1632. if (theGame.GetPlatform() == Platform_Xbox1)
  1633. {
  1634. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_x1"));
  1635. }
  1636. else if (theGame.GetPlatform() == Platform_PS4)
  1637. {
  1638. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_ps4"));
  1639. }
  1640. else
  1641. {
  1642. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game"));
  1643. }
  1644. newGameConfPopup.menuRef = this;
  1645. newGameConfPopup.BlurBackground = true;
  1646.  
  1647. RequestSubMenu('PopupMenu', newGameConfPopup);
  1648. }
  1649. else
  1650. {
  1651. NewGameRequested();
  1652. }
  1653. }
  1654. }
  1655. }
  1656.  
  1657. protected function fetchNewGameConfigFromTag(optionsTag : int):void
  1658. {
  1659. var maskResult:int;
  1660.  
  1661. currentNewGameConfig.difficulty = optionsTag & IGMC_Difficulty_mask;
  1662.  
  1663. maskResult = optionsTag & IGMC_Tutorials_On;
  1664. currentNewGameConfig.tutorialsOn = (maskResult == IGMC_Tutorials_On);
  1665.  
  1666. maskResult = optionsTag & IGMC_Import_Save;
  1667. if (maskResult != IGMC_Import_Save)
  1668. {
  1669. currentNewGameConfig.import_save_index = -1;
  1670. }
  1671.  
  1672. maskResult = optionsTag & IGMC_Simulate_Import;
  1673. currentNewGameConfig.simulate_import = (maskResult == IGMC_Simulate_Import);
  1674. }
  1675.  
  1676. public function NewGameRequested():void
  1677. {
  1678. disableAccountPicker = true;
  1679.  
  1680. if (currentNewGameConfig.import_save_index == -1)
  1681. {
  1682. theGame.ClearInitialFacts();
  1683. }
  1684.  
  1685. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1686. {
  1687. theGame.AddInitialFact("simulate_import_ingame");
  1688. }
  1689.  
  1690. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1691.  
  1692. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1693.  
  1694. StartNewGame();
  1695. }
  1696.  
  1697. event OnUpdateRescale(hScale : float, vScale : float)
  1698. {
  1699. var hud : CR4ScriptedHud;
  1700. var needRescale : bool;
  1701.  
  1702. hud = (CR4ScriptedHud)theGame.GetHud();
  1703. needRescale = false;
  1704.  
  1705. if( theGame.GetUIHorizontalFrameScale() != hScale )
  1706. {
  1707. theGame.SetUIHorizontalFrameScale(hScale);
  1708. mInGameConfigWrapper.SetVarValue('Hidden', 'uiHorizontalFrameScale', FloatToString(hScale));
  1709. needRescale = true;
  1710. hasChangedOption = true;
  1711. }
  1712. if( theGame.GetUIVerticalFrameScale() != vScale )
  1713. {
  1714. theGame.SetUIVerticalFrameScale(vScale);
  1715. mInGameConfigWrapper.SetVarValue('Hidden', 'uiVerticalFrameScale', FloatToString(vScale));
  1716. needRescale = true;
  1717. hasChangedOption = true;
  1718. }
  1719.  
  1720. if( needRescale && hud )
  1721. {
  1722. hud.RescaleModules();
  1723. }
  1724. }
  1725.  
  1726. public function ShowTutorialChosen(enabled:bool):void
  1727. {
  1728. TutorialMessagesEnable(enabled);
  1729.  
  1730. StartNewGame();
  1731. }
  1732.  
  1733. public function StartNewGame():void
  1734. {
  1735. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1736. {
  1737. return;
  1738. }
  1739.  
  1740. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1741. {
  1742. theGame.GetGuiManager().RequestMouseCursor(false);
  1743. OnPlaySoundEvent("gui_global_game_start");
  1744. OnPlaySoundEvent("mus_intro_usm");
  1745. GetRootMenu().CloseMenu();
  1746. }
  1747. }
  1748.  
  1749. function PopulateMenuData()
  1750. {
  1751. var l_DataFlashArray : CScriptedFlashArray;
  1752. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1753. var l_DataFlashObject : CScriptedFlashObject;
  1754. var l_subDataFlashObject : CScriptedFlashObject;
  1755.  
  1756. l_DataFlashArray = m_structureCreator.PopulateMenuData();
  1757.  
  1758. m_flashValueStorage.SetFlashArray( "ingamemenu.entries", l_DataFlashArray );
  1759. }
  1760.  
  1761. protected function addInLoadOption():void
  1762. {
  1763. var l_DataFlashObject : CScriptedFlashObject;
  1764. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1765.  
  1766. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  1767. l_DataFlashObject.SetMemberFlashString( "id", "mainmenu_loadgame");
  1768. l_DataFlashObject.SetMemberFlashUInt( "tag", NameToFlashUInt('LoadGame') );
  1769. l_DataFlashObject.SetMemberFlashString( "label", GetLocStringByKeyExt("panel_mainmenu_loadgame") );
  1770.  
  1771. l_DataFlashObject.SetMemberFlashUInt( "type", IGMActionType_Load );
  1772.  
  1773. l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1774. l_DataFlashObject.SetMemberFlashArray( "subElements", l_ChildMenuFlashArray );
  1775.  
  1776. m_flashValueStorage.SetFlashObject( "ingamemenu.addloading", l_DataFlashObject );
  1777. }
  1778.  
  1779. event OnBack()
  1780. {
  1781. CloseMenu();
  1782. }
  1783.  
  1784. public function HasSavesToImport() : bool
  1785. {
  1786. var savesToImport : array< SSavegameInfo >;
  1787.  
  1788. theGame.ListW2SavedGames( savesToImport );
  1789. return savesToImport.Size() != 0;
  1790. }
  1791.  
  1792. protected function SendImportSaveData()
  1793. {
  1794. var dataFlashArray : CScriptedFlashArray;
  1795.  
  1796. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1797.  
  1798. IngameMenu_PopulateImportSaveData(m_flashValueStorage, dataFlashArray);
  1799.  
  1800. m_initialSelectionsToIgnore = 1;
  1801. OnPlaySoundEvent( "gui_global_panel_open" );
  1802.  
  1803. isShowingSaveList = true;
  1804. m_flashValueStorage.SetFlashArray( "ingamemenu.importSlots", dataFlashArray );
  1805. }
  1806.  
  1807. protected function hasValidAutosaveData() : bool
  1808. {
  1809. var currentSave : SSavegameInfo;
  1810. var num : int;
  1811. var i : int;
  1812.  
  1813. num = theGame.GetNumSaveSlots( SGT_AutoSave );
  1814. for ( i = 0; i < num; i = i + 1 )
  1815. {
  1816. if ( theGame.GetSaveInSlot( SGT_AutoSave, i, currentSave ) )
  1817. {
  1818. return true;
  1819. }
  1820. }
  1821.  
  1822. num = theGame.GetNumSaveSlots( SGT_CheckPoint );
  1823. for ( i = 0; i < num; i = i + 1 )
  1824. {
  1825. if ( theGame.GetSaveInSlot( SGT_CheckPoint, i, currentSave ) )
  1826. {
  1827. return true;
  1828. }
  1829. }
  1830.  
  1831. return false;
  1832. }
  1833.  
  1834. public function HandleSaveListUpdate():void
  1835. {
  1836. if (isShowingSaveList)
  1837. {
  1838. SendSaveData();
  1839. }
  1840. else if (isShowingLoadList)
  1841. {
  1842. SendLoadData();
  1843. }
  1844.  
  1845. if (hasSaveDataToLoad())
  1846. {
  1847. addInLoadOption();
  1848. }
  1849. }
  1850.  
  1851. protected function SendLoadData():void
  1852. {
  1853. var dataFlashArray : CScriptedFlashArray;
  1854.  
  1855. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1856.  
  1857. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1858.  
  1859. m_initialSelectionsToIgnore = 1;
  1860. OnPlaySoundEvent( "gui_global_panel_open" );
  1861.  
  1862. if (dataFlashArray.GetLength() == 0)
  1863. {
  1864. m_fxNavigateBack.InvokeSelf();
  1865. }
  1866. else
  1867. {
  1868. isShowingLoadList = true;
  1869. m_flashValueStorage.SetFlashArray( "ingamemenu.loadSlots", dataFlashArray );
  1870. }
  1871. }
  1872.  
  1873.  
  1874. protected function SendSaveData():void
  1875. {
  1876. var dataFlashArray : CScriptedFlashArray;
  1877.  
  1878. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1879.  
  1880.  
  1881.  
  1882. PopulateSaveDataForSlotType(SGT_Manual, dataFlashArray, true);
  1883.  
  1884. m_initialSelectionsToIgnore = 1;
  1885. OnPlaySoundEvent( "gui_global_panel_open" );
  1886.  
  1887. isShowingSaveList = true;
  1888. m_flashValueStorage.SetFlashArray( "ingamemenu.saveSlots", dataFlashArray );
  1889.  
  1890. if ( theGame.ShouldShowSaveCompatibilityWarning() )
  1891. {
  1892. theGame.GetGuiManager().ShowUserDialog( UMID_SaveCompatWarning, "", "error_save_not_compatible", UDB_Ok );
  1893. }
  1894. }
  1895.  
  1896. protected function SendNewGamePlusSaves():void
  1897. {
  1898. var dataFlashArray : CScriptedFlashArray;
  1899.  
  1900. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1901.  
  1902. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1903.  
  1904. theGame.GetGuiManager().ShowUserDialog(0, "", "message_new_game_plus_reminder", UDB_Ok);
  1905.  
  1906. if (dataFlashArray.GetLength() == 0)
  1907. {
  1908. OnPlaySoundEvent("gui_global_denied");
  1909. showNotification(GetLocStringByKeyExt("mainmenu_newgame_plus_no_saves"));
  1910. m_fxNavigateBack.InvokeSelf();
  1911. }
  1912. else
  1913. {
  1914. m_initialSelectionsToIgnore = 1;
  1915. OnPlaySoundEvent( "gui_global_panel_open" );
  1916. m_flashValueStorage.SetFlashArray( "ingamemenu.newGamePlusSlots", dataFlashArray );
  1917. }
  1918. }
  1919.  
  1920. protected function PopulateSaveDataForSlotType(saveType:int, parentObject:CScriptedFlashArray, allowEmptySlot:bool):void
  1921. {
  1922. IngameMenu_PopulateSaveDataForSlotType(m_flashValueStorage, saveType, parentObject, allowEmptySlot);
  1923. }
  1924.  
  1925. event OnLoadSaveImageCancelled():void
  1926. {
  1927. theGame.FreeScreenshotData();
  1928. }
  1929.  
  1930. event OnScreenshotDataRequested(saveIndex:int):void
  1931. {
  1932. var targetSaveInfo : SSavegameInfo;
  1933. var saveGames : array< SSavegameInfo >;
  1934.  
  1935. theGame.ListSavedGames( saveGames );
  1936.  
  1937. if (saveIndex >= 0 && saveIndex < saveGames.Size())
  1938. {
  1939. targetSaveInfo = saveGames[saveIndex];
  1940.  
  1941. theGame.RequestScreenshotData(targetSaveInfo);
  1942. }
  1943. }
  1944.  
  1945. event OnCheckScreenshotDataReady():void
  1946. {
  1947. if (theGame.IsScreenshotDataReady())
  1948. {
  1949. m_fxOnSaveScreenshotRdy.InvokeSelf();
  1950. }
  1951. }
  1952.  
  1953. protected function SendInstalledDLCList():void
  1954. {
  1955. var currentData : CScriptedFlashObject;
  1956. var dataArray : CScriptedFlashArray;
  1957. var dlcManager : CDLCManager;
  1958. var i : int;
  1959. var dlcList : array<name>;
  1960.  
  1961. var currentName : string;
  1962. var currentDesc : string;
  1963.  
  1964.  
  1965.  
  1966. dataArray = m_flashValueStorage.CreateTempFlashArray();
  1967.  
  1968. dlcManager = theGame.GetDLCManager();
  1969. dlcManager.GetDLCs(dlcList);
  1970.  
  1971. for (i = 0; i < dlcList.Size(); i += 1)
  1972. {
  1973.  
  1974.  
  1975. currentData = m_flashValueStorage.CreateTempFlashObject();
  1976.  
  1977. currentName = GetLocStringByKeyExt( "content_name_" + NameToString(dlcList[i]) );
  1978. currentDesc = "";
  1979.  
  1980. if (currentName != "")
  1981. {
  1982. currentData.SetMemberFlashString("label", currentName);
  1983. currentData.SetMemberFlashString("desc", currentDesc);
  1984.  
  1985. dataArray.PushBackFlashObject(currentData);
  1986. }
  1987.  
  1988. }
  1989.  
  1990.  
  1991.  
  1992. m_flashValueStorage.SetFlashArray("ingamemenu.installedDLCs", dataArray);
  1993. }
  1994.  
  1995. protected function SendRescaleData():void
  1996. {
  1997. var currentData : CScriptedFlashObject;
  1998.  
  1999. currentData = m_flashValueStorage.CreateTempFlashObject();
  2000.  
  2001. currentData.SetMemberFlashNumber("initialHScale", theGame.GetUIHorizontalFrameScale() );
  2002. currentData.SetMemberFlashNumber("initialVScale", theGame.GetUIVerticalFrameScale() );
  2003.  
  2004. m_flashValueStorage.SetFlashObject("ingamemenu.uirescale", currentData);
  2005. }
  2006.  
  2007. protected function SendControllerData():void
  2008. {
  2009. var dataFlashArray : CScriptedFlashArray;
  2010.  
  2011. if ( (W3ReplacerCiri)thePlayer )
  2012. {
  2013. dataFlashArray = InGameMenu_CreateControllerDataCiri(m_flashValueStorage);
  2014. }
  2015. else
  2016. {
  2017. dataFlashArray = InGameMenu_CreateControllerData(m_flashValueStorage);
  2018. }
  2019.  
  2020. m_flashValueStorage.SetFlashArray( "ingamemenu.gamepad.mappings", dataFlashArray );
  2021. }
  2022.  
  2023. protected function SendKeybindData():void
  2024. {
  2025. var dataFlashArray : CScriptedFlashArray;
  2026.  
  2027. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2028.  
  2029. IngameMenu_GatherKeybindData(dataFlashArray, m_flashValueStorage);
  2030.  
  2031. m_flashValueStorage.SetFlashArray( "ingamemenu.keybindValues", dataFlashArray );
  2032. }
  2033.  
  2034. event OnClearKeybind(keybindTag:name):void
  2035. {
  2036. hasChangedOption = true;
  2037. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, "IK_None;IK_None");
  2038. SendKeybindData();
  2039. }
  2040.  
  2041.  
  2042.  
  2043. protected function GetKeybindGroupTag(keybindName : name) : name
  2044. {
  2045. if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap1'))
  2046. {
  2047. return 'input_overlap1';
  2048. }
  2049. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap2'))
  2050. {
  2051. return 'input_overlap2';
  2052. }
  2053. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap3'))
  2054. {
  2055. return 'input_overlap3';
  2056. }
  2057. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap4'))
  2058. {
  2059. return 'input_overlap4';
  2060. }
  2061. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap5'))
  2062. {
  2063. return 'input_overlap5';
  2064. }
  2065.  
  2066. return '';
  2067. }
  2068. event OnChangeKeybind(keybindTag:name, newKeybindValue:EInputKey):void
  2069. {
  2070. var newSettingString : string;
  2071. var exisitingKeybind : name;
  2072. var groupIndex : int;
  2073. var keybindChangedMessage : string;
  2074. var numKeybinds : int;
  2075. var i : int;
  2076. var currentBindingTag : name;
  2077.  
  2078. var iterator_KeybindName : name;
  2079. var iterator_KeybindKey : string;
  2080.  
  2081. hasChangedOption = true;
  2082.  
  2083. newSettingString = newKeybindValue;
  2084.  
  2085.  
  2086.  
  2087. {
  2088. groupIndex = IngameMenu_GetPCInputGroupIndex();
  2089.  
  2090. if (groupIndex != -1)
  2091. {
  2092. numKeybinds = mInGameConfigWrapper.GetVarsNumByGroupName('PCInput');
  2093. currentBindingTag = GetKeybindGroupTag(keybindTag);
  2094.  
  2095. for (i = 0; i < numKeybinds; i += 1)
  2096. {
  2097. iterator_KeybindName = mInGameConfigWrapper.GetVarName(groupIndex, i);
  2098. iterator_KeybindKey = mInGameConfigWrapper.GetVarValue('PCInput', iterator_KeybindName);
  2099.  
  2100. iterator_KeybindKey = StrReplace(iterator_KeybindKey, ";IK_None", "");
  2101. iterator_KeybindKey = StrReplace(iterator_KeybindKey, "IK_None;", "");
  2102.  
  2103. if (iterator_KeybindKey == newSettingString && iterator_KeybindName != keybindTag &&
  2104. (currentBindingTag == '' || currentBindingTag != GetKeybindGroupTag(iterator_KeybindName)))
  2105. {
  2106. if (keybindChangedMessage != "")
  2107. {
  2108. keybindChangedMessage += ", ";
  2109. }
  2110. keybindChangedMessage += IngameMenu_GetLocalizedKeybindName(iterator_KeybindName);
  2111. OnClearKeybind(iterator_KeybindName);
  2112. }
  2113. }
  2114. }
  2115.  
  2116. if (keybindChangedMessage != "")
  2117. {
  2118. keybindChangedMessage += " </br>" + GetLocStringByKeyExt("key_unbound_message");
  2119. showNotification(keybindChangedMessage);
  2120. }
  2121. }
  2122.  
  2123. newSettingString = newKeybindValue + ";IK_None";
  2124. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, newSettingString);
  2125. SendKeybindData();
  2126. }
  2127.  
  2128. event OnSmartKeybindEnabledChanged(value:bool):void
  2129. {
  2130. smartKeybindingEnabled = value;
  2131. }
  2132.  
  2133. event OnInvalidKeybindTried(keyCode:EInputKey):void
  2134. {
  2135. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2136. OnPlaySoundEvent("gui_global_denied");
  2137. }
  2138.  
  2139. event OnLockedKeybindTried():void
  2140. {
  2141. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2142. OnPlaySoundEvent("gui_global_denied");
  2143. }
  2144.  
  2145. event OnResetKeybinds():void
  2146. {
  2147. mInGameConfigWrapper.ResetGroupToDefaults('PCInput');
  2148. SendKeybindData();
  2149. showNotification(inGameMenu_TryLocalize("menu_option_reset_successful"));
  2150.  
  2151. hasChangedOption = true;
  2152. }
  2153.  
  2154. function PlayOpenSoundEvent()
  2155. {
  2156. }
  2157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement