Advertisement
Prizmoe

My script issue

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