Advertisement
Guest User

Untitled

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