Advertisement
Guest User

Untitled

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