Advertisement
FatherZionist

Untitled

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