Advertisement
Hird194

Found unexpected '}'

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