Advertisement
Guest User

StevoMS ingamemenu.ws

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