Guest User

Zappy's ingameMenu.ws

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