Advertisement
Guest User

Untitled

a guest
May 16th, 2022
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.32 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. enum InGameMenuActionType
  11. {
  12. IGMActionType_CommonMenu = 0,
  13. IGMActionType_Close = 1,
  14. IGMActionType_MenuHolder = 2,
  15. IGMActionType_MenuLastHolder = 3,
  16. IGMActionType_Load = 4,
  17. IGMActionType_Save = 5,
  18. IGMActionType_Quit = 6,
  19. IGMActionType_Preset = 7,
  20. IGMActionType_Toggle = 8,
  21. IGMActionType_List = 9,
  22. IGMActionType_Slider = 10,
  23. IGMActionType_LoadLastSave = 11,
  24. IGMActionType_Tutorials = 12,
  25. IGMActionType_Credits = 13,
  26. IGMActionType_Help = 14,
  27. IGMActionType_Controls = 15,
  28. IGMActionType_ControllerHelp = 16,
  29. IGMActionType_NewGame = 17,
  30. IGMActionType_CloseGame = 18,
  31. IGMActionType_UIRescale = 19,
  32. IGMActionType_Gamma = 20,
  33. IGMActionType_DebugStartQuest = 21,
  34. IGMActionType_Gwint = 22,
  35. IGMActionType_ImportSave = 23,
  36. IGMActionType_KeyBinds = 24,
  37. IGMActionType_Back = 25,
  38. IGMActionType_NewGamePlus = 26,
  39. IGMActionType_InstalledDLC = 27,
  40. 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. if (!theGame.IsContentAvailable('content12'))
  223. {
  224. //---=== modFriendlyHUD ===---
  225. {
  226. if (theGame.GetDLCManager().IsEP1Available())
  227. {
  228. ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  229. }
  230. else
  231. {
  232. ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  233. }
  234.  
  235. if (theGame.GetDLCManager().IsEP2Available())
  236. {
  237. ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  238. }
  239. else
  240. {
  241.  
  242. ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  243. }
  244.  
  245. m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  246. }
  247.  
  248. if (theGame.AreConfigResetInThisSession() && !theGame.HasShownConfigChangedMessage())
  249. {
  250. showNotification(GetLocStringByKeyExt("update_warning_message"));
  251. OnPlaySoundEvent("gui_global_denied");
  252. theGame.SetHasShownConfigChangedMessage(true);
  253. }
  254. }
  255. else if (deathScreenMenu)
  256. {
  257. isMainMenu = false;
  258. panelMode = true;
  259. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  260. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  261.  
  262. deathScreenMenu.HideInputFeedback();
  263.  
  264. if (hasSaveDataToLoad())
  265. {
  266. isInLoadselector = true;
  267. SendLoadData();
  268. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  269. }
  270. else
  271. {
  272. CloseMenu();
  273. }
  274. }
  275. else
  276. {
  277. initDataObject = (W3MenuInitData)GetMenuInitData();
  278.  
  279. if (initDataObject && initDataObject.getDefaultState() == 'SaveGame')
  280. {
  281. isMainMenu = false;
  282. panelMode = true;
  283.  
  284. managingPause = true;
  285. theInput.StoreContext( 'EMPTY_CONTEXT' );
  286. theGame.Pause('IngameMenu');
  287.  
  288. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  289. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  290.  
  291. SendSaveData();
  292. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  293. }
  294. }
  295.  
  296. IngameMenu_UpdateDLCScriptTags();
  297.  
  298. if (!panelMode)
  299. {
  300. m_fxSetIsMainMenu.InvokeSelfOneArg(FlashArgBool(isMainMenu));
  301.  
  302. if (isMainMenu)
  303. {
  304. username = FixStringForFont(theGame.GetActiveUserDisplayName());
  305. m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  306.  
  307. m_fxSetVersion.InvokeSelfOneArg(FlashArgString(theGame.GetApplicationVersion()));
  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. if (!theGame.IsContentAvailable('content12'))
  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. //this function should be empty
  768. //if you have merging conflict here, choose lines from A
  769. //and make sure that this part of merged file
  770. //matches the code in A - i.e. has only these comments
  771. //between opening and closing bracket
  772. }
  773.  
  774. protected function prepareBigMessage( epIndex : int ):void
  775. {
  776. var l_DataFlashObject : CScriptedFlashObject;
  777.  
  778. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  779.  
  780. l_DataFlashObject.SetMemberFlashInt( "index", epIndex );
  781. l_DataFlashObject.SetMemberFlashString( "tfTitle1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_1") );
  782. l_DataFlashObject.SetMemberFlashString( "tfTitle2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_2") );
  783.  
  784. l_DataFlashObject.SetMemberFlashString( "tfTitlePath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1") );
  785. l_DataFlashObject.SetMemberFlashString( "tfTitlePath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2") );
  786. l_DataFlashObject.SetMemberFlashString( "tfTitlePath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3") );
  787.  
  788. l_DataFlashObject.SetMemberFlashString( "tfDescPath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1_description") );
  789. l_DataFlashObject.SetMemberFlashString( "tfDescPath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2_description") );
  790. l_DataFlashObject.SetMemberFlashString( "tfDescPath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3_description") );
  791.  
  792. l_DataFlashObject.SetMemberFlashString( "tfWarning", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_warning_level") );
  793. l_DataFlashObject.SetMemberFlashString( "tfGoodLuck", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_good_luck") );
  794.  
  795. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage" + epIndex, l_DataFlashObject );
  796. }
  797.  
  798. private function prepareBigMessageGOTY( text : string )
  799. {
  800. var l_DataFlashObject : CScriptedFlashObject;
  801. var title1 : string;
  802. var content : string;
  803. var titleEnd : string;
  804.  
  805. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  806.  
  807. title1 = GetLocStringByKey( text );
  808. content = GetLocStringByKey( "menu_goty_starting_message_content" );
  809. titleEnd = GetLocStringByKey( "ep1_installed_information_good_luck" );
  810.  
  811. l_DataFlashObject.SetMemberFlashInt( "index", 3 );
  812. l_DataFlashObject.SetMemberFlashString( "tfTitle1", title1 );
  813. l_DataFlashObject.SetMemberFlashString( "tfContent", content );
  814. l_DataFlashObject.SetMemberFlashString( "tfTitleEnd", titleEnd );
  815.  
  816. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage3", l_DataFlashObject );
  817.  
  818. }
  819.  
  820. protected function LoadLastSave():void
  821. {
  822. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  823. {
  824. return;
  825. }
  826.  
  827. SetIgnoreInput(true);
  828.  
  829. if (isMainMenu)
  830. {
  831. disableAccountPicker = true;
  832. }
  833.  
  834. theGame.LoadLastGameInit();
  835. }
  836.  
  837. protected function ShowActionConfPopup(action : int, title : string, description : string) : void
  838. {
  839. if (actionConfPopup)
  840. {
  841. delete actionConfPopup;
  842. }
  843.  
  844. actionConfPopup = new W3ActionConfirmation in this;
  845. actionConfPopup.SetMessageTitle(title);
  846. actionConfPopup.SetMessageText(description);
  847. actionConfPopup.actionID = action;
  848. actionConfPopup.menuRef = this;
  849. actionConfPopup.BlurBackground = true;
  850.  
  851. RequestSubMenu('PopupMenu', actionConfPopup);
  852. }
  853.  
  854. public function OnActionConfirmed(action:int) : void
  855. {
  856. var parentMenu : CR4MenuBase;
  857.  
  858. parentMenu = (CR4MenuBase)GetParent();
  859.  
  860. switch (action)
  861. {
  862. case IGMActionType_Quit:
  863. {
  864. parentMenu.OnCloseMenu();
  865. theGame.RequestEndGame();
  866. break;
  867. }
  868. case IGMActionType_CloseGame:
  869. {
  870. theGame.RequestExit();
  871. break;
  872. }
  873. }
  874. }
  875.  
  876. event OnPresetApplied(groupId:name, targetPresetIndex:int)
  877. {
  878. hasChangedOption = true;
  879. IngameMenu_ChangePresetValue(groupId, targetPresetIndex, this);
  880.  
  881. if (groupId == 'Rendering' && !isMainMenu)
  882. {
  883. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  884. }
  885. }
  886.  
  887. public function UpdateOptions(groupId:name)
  888. {
  889. var optionChangeContainer : CScriptedFlashObject;
  890.  
  891. optionChangeContainer = m_flashValueStorage.CreateTempFlashObject();
  892. IngameMenu_GatherOptionUpdatedValues(groupId, optionChangeContainer, m_flashValueStorage);
  893.  
  894. m_flashValueStorage.SetFlashObject( "ingamemenu.optionValueChanges", optionChangeContainer );
  895. }
  896.  
  897. event OnOptionValueChanged(groupId:int, optionName:name, optionValue:string)
  898. {
  899. var groupName:name;
  900. var hud : CR4ScriptedHud;
  901. var isValid : bool;
  902. var isBuffered : bool;
  903.  
  904. hasChangedOption = true;
  905.  
  906. OnPlaySoundEvent( "gui_global_switch" );
  907.  
  908. if (groupId == NameToFlashUInt('SpecialSettingsGroupId'))
  909. {
  910. HandleSpecialValueChanged(optionName, optionValue);
  911. return true;
  912. }
  913.  
  914. if (optionName == 'HardwareCursor')
  915. {
  916. isValid = optionValue;
  917. m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(isValid));
  918. }
  919.  
  920. if (optionName == 'SwapAcceptCancel')
  921. {
  922. swapAcceptCancelChanged = true;
  923. }
  924.  
  925. if (optionName == 'AlternativeRadialMenuInputMode')
  926. {
  927. alternativeRadialInputChanged = true;
  928. }
  929.  
  930. if (optionName == 'EnableUberMovement')
  931. {
  932. if ( optionValue == "1" )
  933. theGame.EnableUberMovement( true );
  934. else
  935. theGame.EnableUberMovement( false );
  936. }
  937.  
  938. if (optionName == 'GwentDifficulty')
  939. {
  940. if ( optionValue == "0" )
  941. FactsSet( 'gwent_difficulty' , 1 );
  942. else if ( optionValue == "1" )
  943. FactsSet( 'gwent_difficulty' , 2 );
  944. else if ( optionValue == "2" )
  945. FactsSet( 'gwent_difficulty' , 3 );
  946.  
  947. return true;
  948. }
  949.  
  950. if (optionName == 'HardwareCursor')
  951. {
  952. updateInputDeviceRequired = true;
  953. }
  954.  
  955. groupName = mInGameConfigWrapper.GetGroupName(groupId);
  956.  
  957.  
  958. isBuffered = mInGameConfigWrapper.DoGroupHasTag( groupName, 'buffered' );
  959. if( isBuffered == false )
  960. {
  961. isBuffered = mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'buffered' );
  962. }
  963.  
  964. if( isBuffered == true )
  965. {
  966. inGameConfigBufferedWrapper.SetVarValue(groupName, optionName, optionValue);
  967. }
  968. else
  969. {
  970. mInGameConfigWrapper.SetVarValue(groupName, optionName, optionValue);
  971. }
  972.  
  973. theGame.OnConfigValueChanged(optionName, optionValue);
  974.  
  975. if (groupName == 'Hud' || optionName == 'Subtitles')
  976. {
  977. hud = (CR4ScriptedHud)theGame.GetHud();
  978.  
  979. if (hud)
  980. {
  981. hud.UpdateHudConfig(optionName, true);
  982. }
  983. }
  984.  
  985. if (groupName == 'Localization')
  986. {
  987. if (optionName == 'Virtual_Localization_text')
  988. {
  989. currentLangValue = optionValue;
  990. }
  991. else if (optionName == 'Virtual_Localization_speech')
  992. {
  993. currentSpeechLang = optionValue;
  994. }
  995. }
  996.  
  997. if (groupName == 'Rendering' && !isMainMenu)
  998. {
  999. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  1000. }
  1001.  
  1002. if (groupName == 'Rendering' && optionName == 'PreserveSystemGamma')
  1003. {
  1004. theGame.GetGuiManager().DisplayRestartGameToApplyAllChanges();
  1005. }
  1006. }
  1007.  
  1008. event OnButtonClicked( optionName : name )
  1009. {
  1010. if ( optionName == 'MoreSpeechLanguages' )
  1011. {
  1012. theGame.DisplayStore();
  1013. }
  1014. }
  1015.  
  1016. protected function HandleSpecialValueChanged(optionName:name, optionValue:string):void
  1017. {
  1018. var intValue : int;
  1019.  
  1020. if (optionName == 'GameDifficulty')
  1021. {
  1022. intValue = StringToInt(optionValue, 1);
  1023.  
  1024. lastSetDifficulty = intValue + 1;
  1025. }
  1026. }
  1027.  
  1028. public function OnGraphicsUpdated(keepChanges:bool):void
  1029. {
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035. }
  1036.  
  1037. event OnOptionPanelNavigateBack()
  1038. {
  1039. var graphicChangesPending:bool;
  1040. var hud : CR4ScriptedHud;
  1041.  
  1042. if (inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1043. {
  1044. inGameConfigBufferedWrapper.ApplyNewValues();
  1045. theGame.GetGuiManager().ShowProgressDialog(UMID_GraphicsRefreshing, "", "message_text_confirm_option_changes", true, UDB_OkCancel, 100, UMPT_GraphicsRefresh, '');
  1046. ReopenMenu();
  1047. return true;
  1048. }
  1049.  
  1050. hud = (CR4ScriptedHud)theGame.GetHud();
  1051. if (hud)
  1052. {
  1053. hud.RefreshHudConfiguration();
  1054. }
  1055.  
  1056. thePlayer.SetAutoCameraCenter( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'AutoCameraCenter' ) );
  1057. thePlayer.SetEnemyUpscaling( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'EnemyUpscaling' ) );
  1058. }
  1059.  
  1060. event OnNavigatedBack()
  1061. {
  1062. var lowestDifficultyUsed : EDifficultyMode;
  1063. var hud : CR4ScriptedHud;
  1064. var overlayPopupRef : CR4OverlayPopup;
  1065. var radialMenuModule : CR4HudModuleRadialMenu;
  1066. var confirmResult : int;
  1067.  
  1068. hud = (CR4ScriptedHud)(theGame.GetHud());
  1069. overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  1070.  
  1071. if( inGameConfigBufferedWrapper.IsEmpty() == false )
  1072. {
  1073. if (!inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1074. {
  1075. inGameConfigBufferedWrapper.FlushBuffer();
  1076. }
  1077.  
  1078. hasChangedOption = true;
  1079. }
  1080.  
  1081. if (currentLangValue != lastUsedLangValue || lastUsedSpeechLang != currentSpeechLang)
  1082. {
  1083. lastUsedLangValue = currentLangValue;
  1084. lastUsedSpeechLang = currentSpeechLang;
  1085. theGame.ReloadLanguage();
  1086.  
  1087. }
  1088.  
  1089. if (swapAcceptCancelChanged)
  1090. {
  1091. swapAcceptCancelChanged = false;
  1092. UpdateAcceptCancelSwaping();
  1093.  
  1094. if (hud)
  1095. {
  1096. hud.UpdateAcceptCancelSwaping();
  1097. }
  1098.  
  1099. if (overlayPopupRef)
  1100. {
  1101. overlayPopupRef.UpdateAcceptCancelSwaping();
  1102. }
  1103. }
  1104.  
  1105. if (alternativeRadialInputChanged)
  1106. {
  1107. alternativeRadialInputChanged = false;
  1108.  
  1109. if (hud)
  1110. {
  1111. radialMenuModule = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  1112. if (radialMenuModule)
  1113. {
  1114. radialMenuModule.UpdateInputMode();
  1115. }
  1116. }
  1117. }
  1118.  
  1119. isShowingSaveList = false;
  1120. isShowingLoadList = false;
  1121.  
  1122. OnPlaySoundEvent( "gui_global_panel_close" );
  1123.  
  1124. lowestDifficultyUsed = theGame.GetLowestDifficultyUsed();
  1125.  
  1126.  
  1127.  
  1128. if (!isMainMenu && theGame.GetDifficultyLevel() != lastSetDifficulty && lowestDifficultyUsed > lastSetDifficulty && lowestDifficultyUsed > EDM_Medium)
  1129. {
  1130. diffChangeConfPopup = new W3DifficultyChangeConfirmation in this;
  1131.  
  1132. diffChangeConfPopup.SetMessageTitle("");
  1133.  
  1134. if (theGame.GetPlatform() == Platform_PS4)
  1135. {
  1136. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_PS4"));
  1137. }
  1138. else
  1139. {
  1140. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_X1"));
  1141. }
  1142.  
  1143. diffChangeConfPopup.menuRef = this;
  1144. diffChangeConfPopup.targetDifficulty = lastSetDifficulty;
  1145. diffChangeConfPopup.BlurBackground = true;
  1146.  
  1147. RequestSubMenu('PopupMenu', diffChangeConfPopup);
  1148. }
  1149. else if (lastSetDifficulty != theGame.GetDifficultyLevel())
  1150. {
  1151. theGame.SetDifficultyLevel(lastSetDifficulty);
  1152. theGame.OnDifficultyChanged(lastSetDifficulty);
  1153. }
  1154.  
  1155. SaveChangedSettings();
  1156.  
  1157. if (overlayPopupRef && updateInputDeviceRequired)
  1158. {
  1159. updateInputDeviceRequired = false;
  1160. overlayPopupRef.UpdateInputDevice();
  1161. }
  1162. }
  1163.  
  1164. public function CancelDifficultyChange() : void
  1165. {
  1166. var difficultyIndex:int;
  1167. var difficultyIndexAsString:string;
  1168.  
  1169. lastSetDifficulty = theGame.GetDifficultyLevel();
  1170.  
  1171. difficultyIndex = lastSetDifficulty - 1;
  1172. difficultyIndexAsString = "" + difficultyIndex;
  1173. m_fxUpdateOptionValue.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt('GameDifficulty')), FlashArgString(difficultyIndexAsString));
  1174. }
  1175.  
  1176. protected function SaveChangedSettings()
  1177. {
  1178. if (hasChangedOption)
  1179. {
  1180. hasChangedOption = false;
  1181. theGame.SaveUserSettings();
  1182. //---=== modFriendlyHUD ===---
  1183. GetFHUDConfig().UpdateUserSettings();
  1184. //---=== modFriendlyHUD ===---
  1185. }
  1186. }
  1187.  
  1188. event OnProfileChange()
  1189. {
  1190. if( !disableAccountPicker )
  1191. {
  1192. SetIgnoreInput(true);
  1193. theGame.ChangeActiveUser();
  1194. }
  1195. }
  1196.  
  1197. event OnSaveGameCalled(type : ESaveGameType, saveArrayIndex : int)
  1198. {
  1199. var saves : array< SSavegameInfo >;
  1200. var currentSave : SSavegameInfo;
  1201.  
  1202. ignoreInput = true;
  1203.  
  1204. if ( theGame.AreSavesLocked() )
  1205. {
  1206. theGame.GetGuiManager().DisplayLockedSavePopup();
  1207. SetIgnoreInput(false);
  1208. return false;
  1209. }
  1210.  
  1211. if (saveArrayIndex >= 0)
  1212. {
  1213. if (saveConfPopup)
  1214. {
  1215. delete saveConfPopup;
  1216. }
  1217.  
  1218. theGame.ListSavedGames( saves );
  1219. currentSave = saves[ saveArrayIndex ];
  1220.  
  1221. saveConfPopup = new W3SaveGameConfirmation in this;
  1222. saveConfPopup.SetMessageTitle("");
  1223. if (theGame.GetPlatform() == Platform_Xbox1)
  1224. {
  1225. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_x1"));
  1226. }
  1227. else if (theGame.GetPlatform() == Platform_PS4)
  1228. {
  1229. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_ps4"));
  1230. }
  1231. else
  1232. {
  1233. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save"));
  1234. }
  1235. saveConfPopup.menuRef = this;
  1236. saveConfPopup.type = currentSave.slotType;
  1237. saveConfPopup.slot = currentSave.slotIndex;
  1238. saveConfPopup.BlurBackground = true;
  1239.  
  1240. RequestSubMenu('PopupMenu', saveConfPopup);
  1241. }
  1242. else
  1243. {
  1244. executeSave(type, -1);
  1245. SetIgnoreInput(false);
  1246. }
  1247. }
  1248.  
  1249. public function executeSave(type : ESaveGameType, slot : int)
  1250. {
  1251. var hadLoadable:bool;
  1252.  
  1253. hadLoadable = hasSaveDataToLoad();
  1254.  
  1255. theGame.SaveGame(type, slot);
  1256. m_fxNavigateBack.InvokeSelf();
  1257. }
  1258.  
  1259. event OnLoadGameCalled(type : ESaveGameType, saveListIndex : int)
  1260. {
  1261. var saveGameRef : SSavegameInfo;
  1262. var saveGames : array< SSavegameInfo >;
  1263.  
  1264. if (ignoreInput)
  1265. {
  1266. return false;
  1267. }
  1268.  
  1269. disableAccountPicker = true;
  1270.  
  1271. if (loadConfPopup)
  1272. {
  1273. delete loadConfPopup;
  1274. }
  1275.  
  1276. theGame.ListSavedGames( saveGames );
  1277. saveGameRef = saveGames[saveListIndex];
  1278.  
  1279. if (panelMode || (isMainMenu && !hasValidAutosaveData()))
  1280. {
  1281. LoadSaveRequested(saveGameRef);
  1282. }
  1283. else
  1284. {
  1285. loadConfPopup = new W3ApplyLoadConfirmation in this;
  1286.  
  1287. if (theGame.GetPlatform() == Platform_Xbox1)
  1288. {
  1289. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_x1"));
  1290. }
  1291. else if (theGame.GetPlatform() == Platform_PS4)
  1292. {
  1293. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_ps4"));
  1294. }
  1295. else
  1296. {
  1297. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title"));
  1298. }
  1299.  
  1300. if (isMainMenu)
  1301. {
  1302. if (theGame.GetPlatform() == Platform_Xbox1)
  1303. {
  1304. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_x1"));
  1305. }
  1306. else if (theGame.GetPlatform() == Platform_PS4)
  1307. {
  1308. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_ps4"));
  1309. }
  1310. else
  1311. {
  1312. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu"));
  1313. }
  1314. }
  1315. else
  1316. {
  1317. if (theGame.GetPlatform() == Platform_Xbox1)
  1318. {
  1319. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_x1"));
  1320. }
  1321. else if (theGame.GetPlatform() == Platform_PS4)
  1322. {
  1323. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_ps4"));
  1324. }
  1325. else
  1326. {
  1327. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game"));
  1328. }
  1329. }
  1330. loadConfPopup.menuRef = this;
  1331. loadConfPopup.saveSlotRef = saveGameRef;
  1332. loadConfPopup.BlurBackground = true;
  1333.  
  1334. SetIgnoreInput(true);
  1335.  
  1336. RequestSubMenu('PopupMenu', loadConfPopup);
  1337. }
  1338. }
  1339.  
  1340. public function LoadSaveRequested(saveSlotRef : SSavegameInfo) : void
  1341. {
  1342. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1343. {
  1344. SetIgnoreInput(false);
  1345. disableAccountPicker = false;
  1346. return;
  1347. }
  1348.  
  1349. SetIgnoreInput(true);
  1350.  
  1351. if (isMainMenu)
  1352. {
  1353. disableAccountPicker = true;
  1354. }
  1355.  
  1356. theGame.LoadGameInit( saveSlotRef );
  1357. }
  1358.  
  1359. event OnImportGameCalled(menuTag:int):void
  1360. {
  1361. var savesToImport : array< SSavegameInfo >;
  1362. var difficulty:int;
  1363. var tutorialsEnabled:bool;
  1364. var simulateImport:bool;
  1365. var maskResult:int;
  1366. var progress : float;
  1367.  
  1368. if (!theGame.IsContentAvailable('launch0'))
  1369. {
  1370. progress = theGame.ProgressToContentAvailable('launch0');
  1371. theSound.SoundEvent("gui_global_denied");
  1372. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1373.  
  1374. }
  1375. else
  1376. {
  1377. theGame.ListW2SavedGames( savesToImport );
  1378.  
  1379. if ( menuTag < savesToImport.Size() )
  1380. {
  1381. disableAccountPicker = true;
  1382.  
  1383. theGame.ClearInitialFacts();
  1384.  
  1385. if (theGame.ImportSave( savesToImport[ menuTag ] ))
  1386. {
  1387. currentNewGameConfig.import_save_index = menuTag;
  1388.  
  1389. if ((lastSetTag & IGMC_New_game_plus) == IGMC_New_game_plus)
  1390. {
  1391. m_fxForceEnterCurEntry.InvokeSelf();
  1392. }
  1393. else
  1394. {
  1395.  
  1396. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1397. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1398.  
  1399. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1400. {
  1401. OnPlaySoundEvent("gui_global_game_start");
  1402. OnPlaySoundEvent("mus_intro_usm");
  1403. GetRootMenu().CloseMenu();
  1404. }
  1405. }
  1406. }
  1407. else
  1408. {
  1409. showNotification(GetLocStringByKeyExt("import_witcher_two_failed"));
  1410. OnPlaySoundEvent("gui_global_denied");
  1411. }
  1412. }
  1413. }
  1414. }
  1415.  
  1416. event OnNewGamePlusCalled(saveListIndex:int):void
  1417. {
  1418. var startGameStatus : ENewGamePlusStatus;
  1419. var saveGameRef : SSavegameInfo;
  1420. var saveGames : array< SSavegameInfo >;
  1421. var errorMessage : string;
  1422. var progress : float;
  1423.  
  1424. var requiredContent : name = 'content12';
  1425.  
  1426. ignoreInput = true;
  1427.  
  1428. if (!theGame.IsContentAvailable(requiredContent))
  1429. {
  1430. progress = theGame.ProgressToContentAvailable(requiredContent);
  1431. theSound.SoundEvent("gui_global_denied");
  1432. SetIgnoreInput(false);
  1433. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, requiredContent);
  1434. }
  1435. else
  1436. {
  1437. disableAccountPicker = true;
  1438.  
  1439. theGame.ListSavedGames( saveGames );
  1440. saveGameRef = saveGames[saveListIndex];
  1441.  
  1442. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1443. {
  1444. theGame.AddInitialFact("simulate_import_ingame");
  1445. }
  1446.  
  1447. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1448.  
  1449. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1450.  
  1451. startGameStatus = theGame.StartNewGamePlus(saveGameRef);
  1452.  
  1453. if (startGameStatus == NGP_Success)
  1454. {
  1455. theGame.GetGuiManager().RequestMouseCursor(false);
  1456. OnPlaySoundEvent("gui_global_game_start");
  1457. OnPlaySoundEvent("mus_intro_usm");
  1458. GetRootMenu().CloseMenu();
  1459. }
  1460. else
  1461. {
  1462. errorMessage = "";
  1463. SetIgnoreInput(false);
  1464. disableAccountPicker = false;
  1465.  
  1466. switch (startGameStatus)
  1467. {
  1468. case NGP_Invalid:
  1469. errorMessage = GetLocStringByKeyExt("newgame_plus_error_invalid");
  1470. break;
  1471. case NGP_CantLoad:
  1472. errorMessage = GetLocStringByKeyExt("newgame_plus_error_cantload");
  1473. break;
  1474. case NGP_TooOld:
  1475. errorMessage = GetLocStringByKeyExt("newgame_plus_error_too_old");
  1476. break;
  1477. case NGP_RequirementsNotMet:
  1478. errorMessage = GetLocStringByKeyExt("newgame_plus_error_requirementnotmet");
  1479. break;
  1480. case NGP_InternalError:
  1481. errorMessage = GetLocStringByKeyExt("newgame_plus_error_internalerror");
  1482. break;
  1483. case NGP_ContentRequired:
  1484. errorMessage = GetLocStringByKeyExt("newgame_plus_error_contentrequired");
  1485. break;
  1486. }
  1487.  
  1488. showNotification(errorMessage);
  1489. OnPlaySoundEvent("gui_global_denied");
  1490. }
  1491. }
  1492. }
  1493.  
  1494. event OnDeleteSaveCalled(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1495. {
  1496. if (ignoreInput)
  1497. {
  1498. return false;
  1499. }
  1500.  
  1501. SetIgnoreInput(true);
  1502.  
  1503. disableAccountPicker = true;
  1504.  
  1505. if (deleteConfPopup)
  1506. {
  1507. delete deleteConfPopup;
  1508. }
  1509.  
  1510. deleteConfPopup = new W3DeleteSaveConf in this;
  1511. deleteConfPopup.SetMessageTitle("");
  1512. if (theGame.GetPlatform() == Platform_Xbox1)
  1513. {
  1514. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_x1"));
  1515. }
  1516. else if (theGame.GetPlatform() == Platform_PS4)
  1517. {
  1518. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_ps4"));
  1519. }
  1520. else
  1521. {
  1522. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text"));
  1523. }
  1524. deleteConfPopup.menuRef = this;
  1525. deleteConfPopup.type = type;
  1526. deleteConfPopup.slot = saveListIndex;
  1527. deleteConfPopup.saveMode = isSaveMode;
  1528. deleteConfPopup.BlurBackground = true;
  1529.  
  1530. RequestSubMenu('PopupMenu', deleteConfPopup);
  1531. }
  1532.  
  1533. public function DeleteSave(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1534. {
  1535. var saves : array< SSavegameInfo >;
  1536. var currentSave : SSavegameInfo;
  1537. var numSavesBeforeDelete : int;
  1538.  
  1539. theGame.ListSavedGames( saves );
  1540.  
  1541. numSavesBeforeDelete = saves.Size();
  1542.  
  1543. if (saveListIndex < saves.Size())
  1544. {
  1545. currentSave = saves[ saveListIndex ];
  1546. theGame.DeleteSavedGame(currentSave);
  1547. }
  1548.  
  1549. if (numSavesBeforeDelete <= 1)
  1550. {
  1551. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('Continue')));
  1552. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('LoadGame')));
  1553.  
  1554. if (isInLoadselector)
  1555. {
  1556. m_fxNavigateBack.InvokeSelf();
  1557. }
  1558. else
  1559. {
  1560. SendSaveData();
  1561. }
  1562. }
  1563. else
  1564. {
  1565. if (isSaveMode)
  1566. {
  1567. SendSaveData();
  1568. }
  1569. else if (hasSaveDataToLoad())
  1570. {
  1571. SendLoadData();
  1572. }
  1573. }
  1574. }
  1575.  
  1576. protected function showHelpPanel() : void
  1577. {
  1578. m_fxNavigateBack.InvokeSelf();
  1579.  
  1580. theGame.DisplaySystemHelp();
  1581. }
  1582.  
  1583. public function TryStartNewGame(optionsArray : int):void
  1584. {
  1585. var progress : float;
  1586.  
  1587. if (!theGame.IsContentAvailable('launch0'))
  1588. {
  1589. progress = theGame.ProgressToContentAvailable('launch0');
  1590. theSound.SoundEvent("gui_global_denied");
  1591. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1592. }
  1593. else
  1594. {
  1595. fetchNewGameConfigFromTag(optionsArray);
  1596.  
  1597. if ((optionsArray & IGMC_EP2_Save) == IGMC_EP2_Save)
  1598. {
  1599.  
  1600. theGame.InitStandaloneDLCLoading('bob_000_000', currentNewGameConfig.difficulty);
  1601. theGame.EnableUberMovement( true );
  1602. ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  1603. }
  1604. else if ((optionsArray & IGMC_EP1_Save) == IGMC_EP1_Save)
  1605. {
  1606.  
  1607. theGame.InitStandaloneDLCLoading('ep1', currentNewGameConfig.difficulty);
  1608. theGame.EnableUberMovement( true );
  1609. ((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 );
  1610. }
  1611. else
  1612. {
  1613. if (hasValidAutosaveData())
  1614. {
  1615. if (newGameConfPopup)
  1616. {
  1617. delete newGameConfPopup;
  1618. }
  1619.  
  1620. newGameConfPopup = new W3NewGameConfirmation in this;
  1621. newGameConfPopup.SetMessageTitle("");
  1622. if (theGame.GetPlatform() == Platform_Xbox1)
  1623. {
  1624. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_x1"));
  1625. }
  1626. else if (theGame.GetPlatform() == Platform_PS4)
  1627. {
  1628. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_ps4"));
  1629. }
  1630. else
  1631. {
  1632. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game"));
  1633. }
  1634. newGameConfPopup.menuRef = this;
  1635. newGameConfPopup.BlurBackground = true;
  1636.  
  1637. RequestSubMenu('PopupMenu', newGameConfPopup);
  1638. }
  1639. else
  1640. {
  1641. NewGameRequested();
  1642. }
  1643. }
  1644. }
  1645. }
  1646.  
  1647. protected function fetchNewGameConfigFromTag(optionsTag : int):void
  1648. {
  1649. var maskResult:int;
  1650.  
  1651. currentNewGameConfig.difficulty = optionsTag & IGMC_Difficulty_mask;
  1652.  
  1653. maskResult = optionsTag & IGMC_Tutorials_On;
  1654. currentNewGameConfig.tutorialsOn = (maskResult == IGMC_Tutorials_On);
  1655.  
  1656. maskResult = optionsTag & IGMC_Import_Save;
  1657. if (maskResult != IGMC_Import_Save)
  1658. {
  1659. currentNewGameConfig.import_save_index = -1;
  1660. }
  1661.  
  1662. maskResult = optionsTag & IGMC_Simulate_Import;
  1663. currentNewGameConfig.simulate_import = (maskResult == IGMC_Simulate_Import);
  1664. }
  1665.  
  1666. public function NewGameRequested():void
  1667. {
  1668. disableAccountPicker = true;
  1669.  
  1670. if (currentNewGameConfig.import_save_index == -1)
  1671. {
  1672. theGame.ClearInitialFacts();
  1673. }
  1674.  
  1675. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1676. {
  1677. theGame.AddInitialFact("simulate_import_ingame");
  1678. }
  1679.  
  1680. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1681.  
  1682. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1683.  
  1684. StartNewGame();
  1685. }
  1686.  
  1687. event OnUpdateRescale(hScale : float, vScale : float)
  1688. {
  1689. var hud : CR4ScriptedHud;
  1690. var needRescale : bool;
  1691.  
  1692. hud = (CR4ScriptedHud)theGame.GetHud();
  1693. needRescale = false;
  1694.  
  1695. if( theGame.GetUIHorizontalFrameScale() != hScale )
  1696. {
  1697. theGame.SetUIHorizontalFrameScale(hScale);
  1698. mInGameConfigWrapper.SetVarValue('Hidden', 'uiHorizontalFrameScale', FloatToString(hScale));
  1699. needRescale = true;
  1700. hasChangedOption = true;
  1701. }
  1702. if( theGame.GetUIVerticalFrameScale() != vScale )
  1703. {
  1704. theGame.SetUIVerticalFrameScale(vScale);
  1705. mInGameConfigWrapper.SetVarValue('Hidden', 'uiVerticalFrameScale', FloatToString(vScale));
  1706. needRescale = true;
  1707. hasChangedOption = true;
  1708. }
  1709.  
  1710. if( needRescale && hud )
  1711. {
  1712. hud.RescaleModules();
  1713. }
  1714. }
  1715.  
  1716. public function ShowTutorialChosen(enabled:bool):void
  1717. {
  1718. TutorialMessagesEnable(enabled);
  1719.  
  1720. StartNewGame();
  1721. }
  1722.  
  1723. public function StartNewGame():void
  1724. {
  1725. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1726. {
  1727. return;
  1728. }
  1729.  
  1730. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1731. {
  1732. theGame.GetGuiManager().RequestMouseCursor(false);
  1733. OnPlaySoundEvent("gui_global_game_start");
  1734. OnPlaySoundEvent("mus_intro_usm");
  1735. GetRootMenu().CloseMenu();
  1736. }
  1737. }
  1738.  
  1739. function PopulateMenuData()
  1740. {
  1741. var l_DataFlashArray : CScriptedFlashArray;
  1742. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1743. var l_DataFlashObject : CScriptedFlashObject;
  1744. var l_subDataFlashObject : CScriptedFlashObject;
  1745.  
  1746. l_DataFlashArray = m_structureCreator.PopulateMenuData();
  1747.  
  1748. m_flashValueStorage.SetFlashArray( "ingamemenu.entries", l_DataFlashArray );
  1749. }
  1750.  
  1751. protected function addInLoadOption():void
  1752. {
  1753. var l_DataFlashObject : CScriptedFlashObject;
  1754. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1755.  
  1756. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  1757. l_DataFlashObject.SetMemberFlashString( "id", "mainmenu_loadgame");
  1758. l_DataFlashObject.SetMemberFlashUInt( "tag", NameToFlashUInt('LoadGame') );
  1759. l_DataFlashObject.SetMemberFlashString( "label", GetLocStringByKeyExt("panel_mainmenu_loadgame") );
  1760.  
  1761. l_DataFlashObject.SetMemberFlashUInt( "type", IGMActionType_Load );
  1762.  
  1763. l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1764. l_DataFlashObject.SetMemberFlashArray( "subElements", l_ChildMenuFlashArray );
  1765.  
  1766. m_flashValueStorage.SetFlashObject( "ingamemenu.addloading", l_DataFlashObject );
  1767. }
  1768.  
  1769. event OnBack()
  1770. {
  1771. CloseMenu();
  1772. }
  1773.  
  1774. public function HasSavesToImport() : bool
  1775. {
  1776. var savesToImport : array< SSavegameInfo >;
  1777.  
  1778. theGame.ListW2SavedGames( savesToImport );
  1779. return savesToImport.Size() != 0;
  1780. }
  1781.  
  1782. protected function SendImportSaveData()
  1783. {
  1784. var dataFlashArray : CScriptedFlashArray;
  1785.  
  1786. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1787.  
  1788. IngameMenu_PopulateImportSaveData(m_flashValueStorage, dataFlashArray);
  1789.  
  1790. m_initialSelectionsToIgnore = 1;
  1791. OnPlaySoundEvent( "gui_global_panel_open" );
  1792.  
  1793. isShowingSaveList = true;
  1794. m_flashValueStorage.SetFlashArray( "ingamemenu.importSlots", dataFlashArray );
  1795. }
  1796.  
  1797. protected function hasValidAutosaveData() : bool
  1798. {
  1799. var currentSave : SSavegameInfo;
  1800. var num : int;
  1801. var i : int;
  1802.  
  1803. num = theGame.GetNumSaveSlots( SGT_AutoSave );
  1804. for ( i = 0; i < num; i = i + 1 )
  1805. {
  1806. if ( theGame.GetSaveInSlot( SGT_AutoSave, i, currentSave ) )
  1807. {
  1808. return true;
  1809. }
  1810. }
  1811.  
  1812. num = theGame.GetNumSaveSlots( SGT_CheckPoint );
  1813. for ( i = 0; i < num; i = i + 1 )
  1814. {
  1815. if ( theGame.GetSaveInSlot( SGT_CheckPoint, i, currentSave ) )
  1816. {
  1817. return true;
  1818. }
  1819. }
  1820.  
  1821. return false;
  1822. }
  1823.  
  1824. public function HandleSaveListUpdate():void
  1825. {
  1826. if (isShowingSaveList)
  1827. {
  1828. SendSaveData();
  1829. }
  1830. else if (isShowingLoadList)
  1831. {
  1832. SendLoadData();
  1833. }
  1834.  
  1835. if (hasSaveDataToLoad())
  1836. {
  1837. addInLoadOption();
  1838. }
  1839. }
  1840.  
  1841. protected function SendLoadData():void
  1842. {
  1843. var dataFlashArray : CScriptedFlashArray;
  1844.  
  1845. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1846.  
  1847. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1848.  
  1849. m_initialSelectionsToIgnore = 1;
  1850. OnPlaySoundEvent( "gui_global_panel_open" );
  1851.  
  1852. if (dataFlashArray.GetLength() == 0)
  1853. {
  1854. m_fxNavigateBack.InvokeSelf();
  1855. }
  1856. else
  1857. {
  1858. isShowingLoadList = true;
  1859. m_flashValueStorage.SetFlashArray( "ingamemenu.loadSlots", dataFlashArray );
  1860. }
  1861. }
  1862.  
  1863.  
  1864. protected function SendSaveData():void
  1865. {
  1866. var dataFlashArray : CScriptedFlashArray;
  1867.  
  1868. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1869.  
  1870.  
  1871.  
  1872. PopulateSaveDataForSlotType(SGT_Manual, dataFlashArray, true);
  1873.  
  1874. m_initialSelectionsToIgnore = 1;
  1875. OnPlaySoundEvent( "gui_global_panel_open" );
  1876.  
  1877. isShowingSaveList = true;
  1878. m_flashValueStorage.SetFlashArray( "ingamemenu.saveSlots", dataFlashArray );
  1879.  
  1880. if ( theGame.ShouldShowSaveCompatibilityWarning() )
  1881. {
  1882. theGame.GetGuiManager().ShowUserDialog( UMID_SaveCompatWarning, "", "error_save_not_compatible", UDB_Ok );
  1883. }
  1884. }
  1885.  
  1886. protected function SendNewGamePlusSaves():void
  1887. {
  1888. var dataFlashArray : CScriptedFlashArray;
  1889.  
  1890. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1891.  
  1892. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1893.  
  1894. theGame.GetGuiManager().ShowUserDialog(0, "", "message_new_game_plus_reminder", UDB_Ok);
  1895.  
  1896. if (dataFlashArray.GetLength() == 0)
  1897. {
  1898. OnPlaySoundEvent("gui_global_denied");
  1899. showNotification(GetLocStringByKeyExt("mainmenu_newgame_plus_no_saves"));
  1900. m_fxNavigateBack.InvokeSelf();
  1901. }
  1902. else
  1903. {
  1904. m_initialSelectionsToIgnore = 1;
  1905. OnPlaySoundEvent( "gui_global_panel_open" );
  1906. m_flashValueStorage.SetFlashArray( "ingamemenu.newGamePlusSlots", dataFlashArray );
  1907. }
  1908. }
  1909.  
  1910. protected function PopulateSaveDataForSlotType(saveType:int, parentObject:CScriptedFlashArray, allowEmptySlot:bool):void
  1911. {
  1912. IngameMenu_PopulateSaveDataForSlotType(m_flashValueStorage, saveType, parentObject, allowEmptySlot);
  1913. }
  1914.  
  1915. event OnLoadSaveImageCancelled():void
  1916. {
  1917. theGame.FreeScreenshotData();
  1918. }
  1919.  
  1920. event OnScreenshotDataRequested(saveIndex:int):void
  1921. {
  1922. var targetSaveInfo : SSavegameInfo;
  1923. var saveGames : array< SSavegameInfo >;
  1924.  
  1925. theGame.ListSavedGames( saveGames );
  1926.  
  1927. if (saveIndex >= 0 && saveIndex < saveGames.Size())
  1928. {
  1929. targetSaveInfo = saveGames[saveIndex];
  1930.  
  1931. theGame.RequestScreenshotData(targetSaveInfo);
  1932. }
  1933. }
  1934.  
  1935. event OnCheckScreenshotDataReady():void
  1936. {
  1937. if (theGame.IsScreenshotDataReady())
  1938. {
  1939. m_fxOnSaveScreenshotRdy.InvokeSelf();
  1940. }
  1941. }
  1942.  
  1943. protected function SendInstalledDLCList():void
  1944. {
  1945. var currentData : CScriptedFlashObject;
  1946. var dataArray : CScriptedFlashArray;
  1947. var dlcManager : CDLCManager;
  1948. var i : int;
  1949. var dlcList : array<name>;
  1950.  
  1951. var currentName : string;
  1952. var currentDesc : string;
  1953.  
  1954.  
  1955.  
  1956. dataArray = m_flashValueStorage.CreateTempFlashArray();
  1957.  
  1958. dlcManager = theGame.GetDLCManager();
  1959. dlcManager.GetDLCs(dlcList);
  1960.  
  1961. for (i = 0; i < dlcList.Size(); i += 1)
  1962. {
  1963.  
  1964.  
  1965. currentData = m_flashValueStorage.CreateTempFlashObject();
  1966.  
  1967. currentName = GetLocStringByKeyExt( "content_name_" + NameToString(dlcList[i]) );
  1968. currentDesc = "";
  1969.  
  1970. if (currentName != "")
  1971. {
  1972. currentData.SetMemberFlashString("label", currentName);
  1973. currentData.SetMemberFlashString("desc", currentDesc);
  1974.  
  1975. dataArray.PushBackFlashObject(currentData);
  1976. }
  1977.  
  1978. }
  1979.  
  1980.  
  1981.  
  1982. m_flashValueStorage.SetFlashArray("ingamemenu.installedDLCs", dataArray);
  1983. }
  1984.  
  1985. protected function SendRescaleData():void
  1986. {
  1987. var currentData : CScriptedFlashObject;
  1988.  
  1989. currentData = m_flashValueStorage.CreateTempFlashObject();
  1990.  
  1991. currentData.SetMemberFlashNumber("initialHScale", theGame.GetUIHorizontalFrameScale() );
  1992. currentData.SetMemberFlashNumber("initialVScale", theGame.GetUIVerticalFrameScale() );
  1993.  
  1994. m_flashValueStorage.SetFlashObject("ingamemenu.uirescale", currentData);
  1995. }
  1996.  
  1997. protected function SendControllerData():void
  1998. {
  1999. var dataFlashArray : CScriptedFlashArray;
  2000.  
  2001. if ( (W3ReplacerCiri)thePlayer )
  2002. {
  2003. dataFlashArray = InGameMenu_CreateControllerDataCiri(m_flashValueStorage);
  2004. }
  2005. else
  2006. {
  2007. dataFlashArray = InGameMenu_CreateControllerData(m_flashValueStorage);
  2008. }
  2009.  
  2010. m_flashValueStorage.SetFlashArray( "ingamemenu.gamepad.mappings", dataFlashArray );
  2011. }
  2012.  
  2013. protected function SendKeybindData():void
  2014. {
  2015. var dataFlashArray : CScriptedFlashArray;
  2016.  
  2017. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2018.  
  2019. IngameMenu_GatherKeybindData(dataFlashArray, m_flashValueStorage);
  2020.  
  2021. m_flashValueStorage.SetFlashArray( "ingamemenu.keybindValues", dataFlashArray );
  2022. }
  2023.  
  2024. event OnClearKeybind(keybindTag:name):void
  2025. {
  2026. hasChangedOption = true;
  2027. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, "IK_None;IK_None");
  2028. SendKeybindData();
  2029. }
  2030.  
  2031.  
  2032.  
  2033. protected function GetKeybindGroupTag(keybindName : name) : name
  2034. {
  2035. if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap1'))
  2036. {
  2037. return 'input_overlap1';
  2038. }
  2039. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap2'))
  2040. {
  2041. return 'input_overlap2';
  2042. }
  2043. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap3'))
  2044. {
  2045. return 'input_overlap3';
  2046. }
  2047. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap4'))
  2048. {
  2049. return 'input_overlap4';
  2050. }
  2051. //---=== modFriendlyMeditation ===---
  2052. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fmed1')
  2053. || keybindName == 'HoldToMeditate' || keybindName == 'PanelMeditation')
  2054. {
  2055. return 'input_overlap_fmed1';
  2056. }
  2057. //---=== modFriendlyMeditation ===---
  2058. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap5'))
  2059. {
  2060. return 'input_overlap5';
  2061. }
  2062. //---=== modFriendlyHUD ===---
  2063. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud1')
  2064. || keybindName == 'HoldToSeeEssentials' || keybindName == 'HubMenu')
  2065. {
  2066. return 'input_overlap_fhud1';
  2067. }
  2068. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud2')
  2069. || keybindName == 'HoldToSeeCharStats' || keybindName == 'PanelChar')
  2070. {
  2071. return 'input_overlap_fhud2';
  2072. }
  2073. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud3')
  2074. || keybindName == 'HoldToSeeMap' || keybindName == 'PanelMap')
  2075. {
  2076. return 'input_overlap_fhud3';
  2077. }
  2078. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud4')
  2079. || keybindName == 'HoldToSeeQuests' || keybindName == 'PanelJour')
  2080. {
  2081. return 'input_overlap_fhud4';
  2082. }
  2083. //---=== modFriendlyHUD ===---
  2084.  
  2085. return '';
  2086. }
  2087.  
  2088. event OnChangeKeybind(keybindTag:name, newKeybindValue:EInputKey):void
  2089. {
  2090. var newSettingString : string;
  2091. var exisitingKeybind : name;
  2092. var groupIndex : int;
  2093. var keybindChangedMessage : string;
  2094. var numKeybinds : int;
  2095. var i : int;
  2096. var currentBindingTag : name;
  2097.  
  2098. var iterator_KeybindName : name;
  2099. var iterator_KeybindKey : string;
  2100.  
  2101. hasChangedOption = true;
  2102.  
  2103. newSettingString = newKeybindValue;
  2104.  
  2105.  
  2106.  
  2107. {
  2108. groupIndex = IngameMenu_GetPCInputGroupIndex();
  2109.  
  2110. if (groupIndex != -1)
  2111. {
  2112. numKeybinds = mInGameConfigWrapper.GetVarsNumByGroupName('PCInput');
  2113. currentBindingTag = GetKeybindGroupTag(keybindTag);
  2114.  
  2115. for (i = 0; i < numKeybinds; i += 1)
  2116. {
  2117. iterator_KeybindName = mInGameConfigWrapper.GetVarName(groupIndex, i);
  2118. iterator_KeybindKey = mInGameConfigWrapper.GetVarValue('PCInput', iterator_KeybindName);
  2119.  
  2120. iterator_KeybindKey = StrReplace(iterator_KeybindKey, ";IK_None", "");
  2121. iterator_KeybindKey = StrReplace(iterator_KeybindKey, "IK_None;", "");
  2122.  
  2123. if (iterator_KeybindKey == newSettingString && iterator_KeybindName != keybindTag &&
  2124. (currentBindingTag == '' || currentBindingTag != GetKeybindGroupTag(iterator_KeybindName)))
  2125. {
  2126. if (keybindChangedMessage != "")
  2127. {
  2128. keybindChangedMessage += ", ";
  2129. }
  2130. keybindChangedMessage += IngameMenu_GetLocalizedKeybindName(iterator_KeybindName);
  2131. OnClearKeybind(iterator_KeybindName);
  2132. }
  2133. }
  2134. }
  2135.  
  2136. if (keybindChangedMessage != "")
  2137. {
  2138. keybindChangedMessage += " </br>" + GetLocStringByKeyExt("key_unbound_message");
  2139. showNotification(keybindChangedMessage);
  2140. }
  2141. }
  2142.  
  2143. newSettingString = newKeybindValue + ";IK_None";
  2144. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, newSettingString);
  2145. SendKeybindData();
  2146. }
  2147.  
  2148. event OnSmartKeybindEnabledChanged(value:bool):void
  2149. {
  2150. smartKeybindingEnabled = value;
  2151. }
  2152.  
  2153. event OnInvalidKeybindTried(keyCode:EInputKey):void
  2154. {
  2155. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2156. OnPlaySoundEvent("gui_global_denied");
  2157. }
  2158.  
  2159. event OnLockedKeybindTried():void
  2160. {
  2161. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2162. OnPlaySoundEvent("gui_global_denied");
  2163. }
  2164.  
  2165. //---=== modFriendlyHUD ===---
  2166. function ShouldHideDLCIcons() : bool
  2167. {
  2168. return theGame.GetInGameConfigWrapper().GetVarValue('fhudMainMenu', 'fhudHideDLC');
  2169. }
  2170. //---=== modFriendlyHUD ===---
  2171.  
  2172. event OnResetKeybinds():void
  2173. {
  2174. mInGameConfigWrapper.ResetGroupToDefaults('PCInput');
  2175. SendKeybindData();
  2176. showNotification(inGameMenu_TryLocalize("menu_option_reset_successful"));
  2177.  
  2178. hasChangedOption = true;
  2179. }
  2180.  
  2181. function PlayOpenSoundEvent()
  2182. {
  2183. }
  2184. }
  2185.  
  2186. exec function ddd()
  2187. {
  2188. LogChannel('asd', "[" + GetLocStringByKey( "menu_goty_starting_message_content" ) + "]" );
  2189. LogChannel('asd', "[" + GetLocStringById( 1217650 ) + "]" );
  2190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement