Advertisement
Guest User

Uhhh

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