Advertisement
Guest User

Untitled

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