Advertisement
Guest User

Untitled

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