Advertisement
Guest User

Untitled

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