Advertisement
fandadar

Untitled

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