Advertisement
Guest User

Untitled

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