Advertisement
Guest User

Untitled

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