Advertisement
Guest User

IngameMenu

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