| using System; |
| using System; |
| using System.Collections; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.ComponentModel; |
| using System.ComponentModel; |
| using System.Runtime.CompilerServices; |
| using System.Runtime.CompilerServices; |
| using GUIFramework; |
| using GUIFramework; |
| using PlatformTools.Core; |
| using PlatformTools.Core; |
| using SoftReferenceableAssets.SceneManagement; |
| using SoftReferenceableAssets.SceneManagement; |
| using Steamworks; |
| using Steamworks; |
| using TMPro; |
| using TMPro; |
| using UnityEngine; |
| using UnityEngine; |
| using UnityEngine.Events; |
| using UnityEngine.Events; |
| using UnityEngine.EventSystems; |
| using UnityEngine.EventSystems; |
| using UnityEngine.UI; |
| using UnityEngine.UI; |
| |
| |
| public class FejdStartup : MonoBehaviour |
| public class FejdStartup : MonoBehaviour |
| { |
| { |
| public static FejdStartup instance |
| public static FejdStartup instance |
| { |
| { |
| get |
| get |
| { |
| { |
| return FejdStartup.m_instance; |
| return FejdStartup.m_instance; |
| } |
| } |
| } |
| } |
| |
| |
| private void Awake() |
| private void Awake() |
| { |
| { |
| FejdStartup.m_instance = this; |
| FejdStartup.m_instance = this; |
| this.ParseArguments(); |
| this.ParseArguments(); |
| this.m_crossplayServerToggle.gameObject.SetActive(true); |
| this.m_crossplayServerToggle.gameObject.SetActive(true); |
| if (!FejdStartup.AwakePlatforms()) |
| if (!FejdStartup.AwakePlatforms()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| FileHelpers.UpdateCloudEnabledStatus(); |
| FileHelpers.UpdateCloudEnabledStatus(); |
| Settings.SetPlatformDefaultPrefs(); |
| Settings.SetPlatformDefaultPrefs(); |
| QualitySettings.maxQueuedFrames = 2; |
| QualitySettings.maxQueuedFrames = 2; |
| ZLog.Log(string.Concat(new string[] |
| ZLog.Log(string.Concat(new string[] |
| { |
| { |
| "Valheim version: ", |
| "Valheim version: ", |
| global::Version.GetVersionString(false), |
| global::Version.GetVersionString(false), |
| " (network version ", |
| " (network version ", |
| . | 23U.ToString(), |
| 27U.ToString(), |
| ")" |
| ")" |
| })); |
| })); |
| Settings.ApplyStartupSettings(); |
| Settings.ApplyStartupSettings(); |
| WorldGenerator.Initialize(World.GetMenuWorld()); |
| WorldGenerator.Initialize(World.GetMenuWorld()); |
| if (!global::Console.instance) |
| if (!global::Console.instance) |
| { |
| { |
| UnityEngine.Object.Instantiate<GameObject>(this.m_consolePrefab); |
| UnityEngine.Object.Instantiate<GameObject>(this.m_consolePrefab); |
| } |
| } |
| this.m_mainCamera.transform.position = this.m_cameraMarkerMain.transform.position; |
| this.m_mainCamera.transform.position = this.m_cameraMarkerMain.transform.position; |
| this.m_mainCamera.transform.rotation = this.m_cameraMarkerMain.transform.rotation; |
| this.m_mainCamera.transform.rotation = this.m_cameraMarkerMain.transform.rotation; |
| ZLog.Log("Render threading mode:" + SystemInfo.renderingThreadingMode.ToString()); |
| ZLog.Log("Render threading mode:" + SystemInfo.renderingThreadingMode.ToString()); |
| Gogan.StartSession(); |
| Gogan.StartSession(); |
| Gogan.LogEvent("Game", "Version", global::Version.GetVersionString(false), 0L); |
| Gogan.LogEvent("Game", "Version", global::Version.GetVersionString(false), 0L); |
| Gogan.LogEvent("Game", "SteamID", SteamManager.APP_ID.ToString(), 0L); |
| Gogan.LogEvent("Game", "SteamID", SteamManager.APP_ID.ToString(), 0L); |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| if (Settings.IsSteamRunningOnSteamDeck()) |
| if (Settings.IsSteamRunningOnSteamDeck()) |
| { |
| { |
| Transform transform = this.m_menuList.transform.Find("Menu"); |
| Transform transform = this.m_menuList.transform.Find("Menu"); |
| if (transform != null) |
| if (transform != null) |
| { |
| { |
| Transform transform2 = transform.Find("showlog"); |
| Transform transform2 = transform.Find("showlog"); |
| if (transform2 != null) |
| if (transform2 != null) |
| { |
| { |
| transform2.gameObject.SetActive(false); |
| transform2.gameObject.SetActive(false); |
| } |
| } |
| } |
| } |
| } |
| } |
| this.m_menuButtons = this.m_menuList.GetComponentsInChildren<Button>(); |
| this.m_menuButtons = this.m_menuList.GetComponentsInChildren<Button>(); |
| . | |
| TabHandler[] enabledComponentsInChildren = Utils.GetEnabledComponentsInChildren<TabHandler>(this.m_startGamePanel.gameObject); |
| |
| TabHandler[] array = enabledComponentsInChildren; |
| |
| for (int i = 0; i < array.Length; i++) |
| |
| { |
| |
| array[i].enabled = false; |
| |
| } |
| |
| this.m_startGamePanel.gameObject.SetActive(true); |
| this.m_serverOptions.gameObject.SetActive(true); |
| this.m_serverOptions.gameObject.SetActive(true); |
| this.m_serverOptions.gameObject.SetActive(false); |
| this.m_serverOptions.gameObject.SetActive(false); |
| . | |
| this.m_startGamePanel.gameObject.SetActive(false); |
| |
| array = enabledComponentsInChildren; |
| |
| for (int i = 0; i < array.Length; i++) |
| |
| { |
| |
| array[i].enabled = true; |
| |
| } |
| Game.Unpause(); |
| Game.Unpause(); |
| Time.timeScale = 1f; |
| Time.timeScale = 1f; |
| ZInput.Initialize(); |
| ZInput.Initialize(); |
| ZInput.OnInputLayoutChanged += this.UpdateCursor; |
| ZInput.OnInputLayoutChanged += this.UpdateCursor; |
| this.UpdateCursor(); |
| this.UpdateCursor(); |
| } |
| } |
| |
| |
| public static bool AwakePlatforms() |
| public static bool AwakePlatforms() |
| { |
| { |
| if (FejdStartup.s_monoUpdaters == null) |
| if (FejdStartup.s_monoUpdaters == null) |
| { |
| { |
| FejdStartup.s_monoUpdaters = new GameObject(); |
| FejdStartup.s_monoUpdaters = new GameObject(); |
| FejdStartup.s_monoUpdaters.AddComponent<MonoUpdaters>(); |
| FejdStartup.s_monoUpdaters.AddComponent<MonoUpdaters>(); |
| UnityEngine.Object.DontDestroyOnLoad(FejdStartup.s_monoUpdaters); |
| UnityEngine.Object.DontDestroyOnLoad(FejdStartup.s_monoUpdaters); |
| } |
| } |
| if (!FejdStartup.AwakeSteam() || !FejdStartup.AwakePlayFab() || !FejdStartup.AwakeCustom()) |
| if (!FejdStartup.AwakeSteam() || !FejdStartup.AwakePlayFab() || !FejdStartup.AwakeCustom()) |
| { |
| { |
| ZLog.LogError("Awake of network backend failed"); |
| ZLog.LogError("Awake of network backend failed"); |
| return false; |
| return false; |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private static bool AwakePlayFab() |
| private static bool AwakePlayFab() |
| { |
| { |
| PlayFabManager.Initialize(); |
| PlayFabManager.Initialize(); |
| PlayFabManager.SetCustomId(PrivilegeManager.Platform.Steam, SteamUser.GetSteamID().ToString()); |
| PlayFabManager.SetCustomId(PrivilegeManager.Platform.Steam, SteamUser.GetSteamID().ToString()); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private static bool AwakeSteam() |
| private static bool AwakeSteam() |
| { |
| { |
| return FejdStartup.InitializeSteam(); |
| return FejdStartup.InitializeSteam(); |
| } |
| } |
| |
| |
| private static bool AwakeCustom() |
| private static bool AwakeCustom() |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void OnDestroy() |
| private void OnDestroy() |
| { |
| { |
| SaveSystem.ClearWorldListCache(false); |
| SaveSystem.ClearWorldListCache(false); |
| FejdStartup.m_instance = null; |
| FejdStartup.m_instance = null; |
| ZInput.OnInputLayoutChanged -= this.UpdateCursor; |
| ZInput.OnInputLayoutChanged -= this.UpdateCursor; |
| Localization.OnLanguageChange = (Action)Delegate.Remove(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| Localization.OnLanguageChange = (Action)Delegate.Remove(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| } |
| } |
| |
| |
| private void OnApplicationQuit() |
| private void OnApplicationQuit() |
| { |
| { |
| HeightmapBuilder.instance.Dispose(); |
| HeightmapBuilder.instance.Dispose(); |
| } |
| } |
| |
| |
| private void OnEnable() |
| private void OnEnable() |
| { |
| { |
| FejdStartup.startGameEvent += this.AddToServerList; |
| FejdStartup.startGameEvent += this.AddToServerList; |
| } |
| } |
| |
| |
| private void OnDisable() |
| private void OnDisable() |
| { |
| { |
| FejdStartup.startGameEvent -= this.AddToServerList; |
| FejdStartup.startGameEvent -= this.AddToServerList; |
| } |
| } |
| |
| |
| private void AddToServerList(object sender, FejdStartup.StartGameEventArgs e) |
| private void AddToServerList(object sender, FejdStartup.StartGameEventArgs e) |
| { |
| { |
| if (!e.isHost) |
| if (!e.isHost) |
| { |
| { |
| ServerList.AddToRecentServersList(this.GetServerToJoin()); |
| ServerList.AddToRecentServersList(this.GetServerToJoin()); |
| } |
| } |
| } |
| } |
| |
| |
| private void Start() |
| private void Start() |
| { |
| { |
| this.SetupGui(); |
| this.SetupGui(); |
| this.SetupObjectDB(); |
| this.SetupObjectDB(); |
| this.m_openServerToggle.onValueChanged.AddListener(new UnityAction<bool>(this.OnOpenServerToggleClicked)); |
| this.m_openServerToggle.onValueChanged.AddListener(new UnityAction<bool>(this.OnOpenServerToggleClicked)); |
| MusicMan.instance.Reset(); |
| MusicMan.instance.Reset(); |
| MusicMan.instance.TriggerMusic("menu"); |
| MusicMan.instance.TriggerMusic("menu"); |
| this.ShowConnectError(ZNet.ConnectionStatus.None); |
| this.ShowConnectError(ZNet.ConnectionStatus.None); |
| ZSteamMatchmaking.Initialize(); |
| ZSteamMatchmaking.Initialize(); |
| if (FejdStartup.m_firstStartup) |
| if (FejdStartup.m_firstStartup) |
| { |
| { |
| this.HandleStartupJoin(); |
| this.HandleStartupJoin(); |
| } |
| } |
| this.m_menuAnimator.SetBool("FirstStartup", FejdStartup.m_firstStartup); |
| this.m_menuAnimator.SetBool("FirstStartup", FejdStartup.m_firstStartup); |
| FejdStartup.m_firstStartup = false; |
| FejdStartup.m_firstStartup = false; |
| string @string = PlayerPrefs.GetString("profile"); |
| string @string = PlayerPrefs.GetString("profile"); |
| if (@string.Length > 0) |
| if (@string.Length > 0) |
| { |
| { |
| this.SetSelectedProfile(@string); |
| this.SetSelectedProfile(@string); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| if (this.m_profiles.Count > 0) |
| if (this.m_profiles.Count > 0) |
| { |
| { |
| this.SetSelectedProfile(this.m_profiles[0].GetFilename()); |
| this.SetSelectedProfile(this.m_profiles[0].GetFilename()); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| } |
| } |
| Action handlePendingInvite = FejdStartup.HandlePendingInvite; |
| Action handlePendingInvite = FejdStartup.HandlePendingInvite; |
| if (handlePendingInvite != null) |
| if (handlePendingInvite != null) |
| { |
| { |
| handlePendingInvite(); |
| handlePendingInvite(); |
| } |
| } |
| CensorShittyWords.UGCPopupShown = (Action)Delegate.Remove(CensorShittyWords.UGCPopupShown, new Action(this.OnUGCPopupShown)); |
| CensorShittyWords.UGCPopupShown = (Action)Delegate.Remove(CensorShittyWords.UGCPopupShown, new Action(this.OnUGCPopupShown)); |
| CensorShittyWords.UGCPopupShown = (Action)Delegate.Combine(CensorShittyWords.UGCPopupShown, new Action(this.OnUGCPopupShown)); |
| CensorShittyWords.UGCPopupShown = (Action)Delegate.Combine(CensorShittyWords.UGCPopupShown, new Action(this.OnUGCPopupShown)); |
| SaveSystem.ClearWorldListCache(true); |
| SaveSystem.ClearWorldListCache(true); |
| Player.m_debugMode = false; |
| Player.m_debugMode = false; |
| } |
| } |
| |
| |
| private void SetupGui() |
| private void SetupGui() |
| { |
| { |
| this.HideAll(); |
| this.HideAll(); |
| this.m_mainMenu.SetActive(true); |
| this.m_mainMenu.SetActive(true); |
| if (SteamManager.APP_ID == 1223920U) |
| if (SteamManager.APP_ID == 1223920U) |
| { |
| { |
| this.m_betaText.SetActive(true); |
| this.m_betaText.SetActive(true); |
| if (!Debug.isDebugBuild && !this.AcceptedNDA()) |
| if (!Debug.isDebugBuild && !this.AcceptedNDA()) |
| { |
| { |
| this.m_ndaPanel.SetActive(true); |
| this.m_ndaPanel.SetActive(true); |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| } |
| } |
| } |
| } |
| this.m_moddedText.SetActive(Game.isModded); |
| this.m_moddedText.SetActive(Game.isModded); |
| this.m_worldListBaseSize = this.m_worldListRoot.rect.height; |
| this.m_worldListBaseSize = this.m_worldListRoot.rect.height; |
| . | this.m_versionLabel.text = string.Format("Version {0} (n-{1})", global::Version.GetVersionString(false), 23U); |
| this.m_versionLabel.text = string.Format("Version {0} (n-{1})", global::Version.GetVersionString(false), 27U); |
| Localization.instance.Localize(base.transform); |
| Localization.instance.Localize(base.transform); |
| Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, new Action(this.OnLanguageChange)); |
| } |
| } |
| |
| |
| private void HideAll() |
| private void HideAll() |
| { |
| { |
| this.m_worldVersionPanel.SetActive(false); |
| this.m_worldVersionPanel.SetActive(false); |
| this.m_playerVersionPanel.SetActive(false); |
| this.m_playerVersionPanel.SetActive(false); |
| this.m_newGameVersionPanel.SetActive(false); |
| this.m_newGameVersionPanel.SetActive(false); |
| this.m_loading.SetActive(false); |
| this.m_loading.SetActive(false); |
| this.m_pleaseWait.SetActive(false); |
| this.m_pleaseWait.SetActive(false); |
| this.m_characterSelectScreen.SetActive(false); |
| this.m_characterSelectScreen.SetActive(false); |
| this.m_creditsPanel.SetActive(false); |
| this.m_creditsPanel.SetActive(false); |
| this.m_startGamePanel.SetActive(false); |
| this.m_startGamePanel.SetActive(false); |
| this.m_createWorldPanel.SetActive(false); |
| this.m_createWorldPanel.SetActive(false); |
| this.m_serverOptions.gameObject.SetActive(false); |
| this.m_serverOptions.gameObject.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| this.m_ndaPanel.SetActive(false); |
| this.m_ndaPanel.SetActive(false); |
| this.m_betaText.SetActive(false); |
| this.m_betaText.SetActive(false); |
| } |
| } |
| |
| |
| public static bool InitializeSteam() |
| public static bool InitializeSteam() |
| { |
| { |
| if (SteamManager.Initialize()) |
| if (SteamManager.Initialize()) |
| { |
| { |
| string personaName = SteamFriends.GetPersonaName(); |
| string personaName = SteamFriends.GetPersonaName(); |
| ZLog.Log("Steam initialized, persona:" + personaName); |
| ZLog.Log("Steam initialized, persona:" + personaName); |
| PrivilegeManager.SetPrivilegeData(new PrivilegeData |
| PrivilegeManager.SetPrivilegeData(new PrivilegeData |
| { |
| { |
| platformUserId = (ulong)SteamUser.GetSteamID(), |
| platformUserId = (ulong)SteamUser.GetSteamID(), |
| platformCanAccess = new CanAccessCallback(FejdStartup.OnSteamCanAccess), |
| platformCanAccess = new CanAccessCallback(FejdStartup.OnSteamCanAccess), |
| canAccessOnlineMultiplayer = true, |
| canAccessOnlineMultiplayer = true, |
| canViewUserGeneratedContentAll = true, |
| canViewUserGeneratedContentAll = true, |
| canCrossplay = true |
| canCrossplay = true |
| }); |
| }); |
| return true; |
| return true; |
| } |
| } |
| ZLog.LogError("Steam is not initialized"); |
| ZLog.LogError("Steam is not initialized"); |
| Application.Quit(); |
| Application.Quit(); |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private void HandleStartupJoin() |
| private void HandleStartupJoin() |
| { |
| { |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| { |
| { |
| string text = commandLineArgs[i]; |
| string text = commandLineArgs[i]; |
| if (text == "+connect" && i < commandLineArgs.Length - 1) |
| if (text == "+connect" && i < commandLineArgs.Length - 1) |
| { |
| { |
| string text2 = commandLineArgs[i + 1]; |
| string text2 = commandLineArgs[i + 1]; |
| ZLog.Log("JOIN " + text2); |
| ZLog.Log("JOIN " + text2); |
| ZSteamMatchmaking.instance.QueueServerJoin(text2); |
| ZSteamMatchmaking.instance.QueueServerJoin(text2); |
| } |
| } |
| else if (text == "+connect_lobby" && i < commandLineArgs.Length - 1) |
| else if (text == "+connect_lobby" && i < commandLineArgs.Length - 1) |
| { |
| { |
| string text3 = commandLineArgs[i + 1]; |
| string text3 = commandLineArgs[i + 1]; |
| CSteamID csteamID = new CSteamID(ulong.Parse(text3)); |
| CSteamID csteamID = new CSteamID(ulong.Parse(text3)); |
| ZSteamMatchmaking.instance.QueueLobbyJoin(csteamID); |
| ZSteamMatchmaking.instance.QueueLobbyJoin(csteamID); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private static void OnSteamCanAccess(PrivilegeManager.Permission permission, PrivilegeManager.User user, CanAccessResult cb) |
| private static void OnSteamCanAccess(PrivilegeManager.Permission permission, PrivilegeManager.User user, CanAccessResult cb) |
| { |
| { |
| if (user.platform == PrivilegeManager.Platform.Steam) |
| if (user.platform == PrivilegeManager.Platform.Steam) |
| { |
| { |
| EFriendRelationship friendRelationship = SteamFriends.GetFriendRelationship((CSteamID)user.id); |
| EFriendRelationship friendRelationship = SteamFriends.GetFriendRelationship((CSteamID)user.id); |
| if (friendRelationship == EFriendRelationship.k_EFriendRelationshipIgnored || friendRelationship == EFriendRelationship.k_EFriendRelationshipIgnoredFriend) |
| if (friendRelationship == EFriendRelationship.k_EFriendRelationshipIgnored || friendRelationship == EFriendRelationship.k_EFriendRelationshipIgnoredFriend) |
| { |
| { |
| cb(PrivilegeManager.Result.NotAllowed); |
| cb(PrivilegeManager.Result.NotAllowed); |
| return; |
| return; |
| } |
| } |
| } |
| } |
| cb(PrivilegeManager.Result.Allowed); |
| cb(PrivilegeManager.Result.Allowed); |
| } |
| } |
| |
| |
| private void ParseArguments() |
| private void ParseArguments() |
| { |
| { |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| { |
| { |
| if (commandLineArgs[i] == "-console") |
| if (commandLineArgs[i] == "-console") |
| { |
| { |
| global::Console.SetConsoleEnabled(true); |
| global::Console.SetConsoleEnabled(true); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private bool ParseServerArguments() |
| private bool ParseServerArguments() |
| { |
| { |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| string[] commandLineArgs = Environment.GetCommandLineArgs(); |
| string text = "Dedicated"; |
| string text = "Dedicated"; |
| string text2 = ""; |
| string text2 = ""; |
| string text3 = ""; |
| string text3 = ""; |
| int num = 2456; |
| int num = 2456; |
| bool flag = true; |
| bool flag = true; |
| ZNet.m_backupCount = 4; |
| ZNet.m_backupCount = 4; |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| for (int i = 0; i < commandLineArgs.Length; i++) |
| { |
| { |
| string text4 = commandLineArgs[i].ToLower(); |
| string text4 = commandLineArgs[i].ToLower(); |
| int num2; |
| int num2; |
| int num3; |
| int num3; |
| int num4; |
| int num4; |
| int num5; |
| int num5; |
| if (text4 == "-world") |
| if (text4 == "-world") |
| { |
| { |
| string text5 = commandLineArgs[i + 1]; |
| string text5 = commandLineArgs[i + 1]; |
| if (text5 != "") |
| if (text5 != "") |
| { |
| { |
| text = text5; |
| text = text5; |
| } |
| } |
| i++; |
| i++; |
| } |
| } |
| else if (text4 == "-name") |
| else if (text4 == "-name") |
| { |
| { |
| string text6 = commandLineArgs[i + 1]; |
| string text6 = commandLineArgs[i + 1]; |
| if (text6 != "") |
| if (text6 != "") |
| { |
| { |
| text3 = text6; |
| text3 = text6; |
| } |
| } |
| i++; |
| i++; |
| } |
| } |
| else if (text4 == "-port") |
| else if (text4 == "-port") |
| { |
| { |
| string text7 = commandLineArgs[i + 1]; |
| string text7 = commandLineArgs[i + 1]; |
| if (text7 != "") |
| if (text7 != "") |
| { |
| { |
| num = int.Parse(text7); |
| num = int.Parse(text7); |
| } |
| } |
| i++; |
| i++; |
| } |
| } |
| else if (text4 == "-password") |
| else if (text4 == "-password") |
| { |
| { |
| text2 = commandLineArgs[i + 1]; |
| text2 = commandLineArgs[i + 1]; |
| i++; |
| i++; |
| } |
| } |
| else if (text4 == "-savedir") |
| else if (text4 == "-savedir") |
| { |
| { |
| string text8 = commandLineArgs[i + 1]; |
| string text8 = commandLineArgs[i + 1]; |
| Utils.SetSaveDataPath(text8); |
| Utils.SetSaveDataPath(text8); |
| ZLog.Log("Setting -savedir to: " + text8); |
| ZLog.Log("Setting -savedir to: " + text8); |
| i++; |
| i++; |
| } |
| } |
| else if (text4 == "-public") |
| else if (text4 == "-public") |
| { |
| { |
| string text9 = commandLineArgs[i + 1]; |
| string text9 = commandLineArgs[i + 1]; |
| if (text9 != "") |
| if (text9 != "") |
| { |
| { |
| flag = text9 == "1"; |
| flag = text9 == "1"; |
| } |
| } |
| i++; |
| i++; |
| } |
| } |
| else if (text4.ToLower() == "-logfile") |
| else if (text4.ToLower() == "-logfile") |
| { |
| { |
| ZLog.Log("Setting -logfile to: " + commandLineArgs[i + 1]); |
| ZLog.Log("Setting -logfile to: " + commandLineArgs[i + 1]); |
| } |
| } |
| else if (text4 == "-crossplay") |
| else if (text4 == "-crossplay") |
| { |
| { |
| ZNet.m_onlineBackend = OnlineBackendType.PlayFab; |
| ZNet.m_onlineBackend = OnlineBackendType.PlayFab; |
| } |
| } |
| else if (text4 == "-instanceid" && commandLineArgs.Length > i + 1) |
| else if (text4 == "-instanceid" && commandLineArgs.Length > i + 1) |
| { |
| { |
| FejdStartup.InstanceId = commandLineArgs[i + 1]; |
| FejdStartup.InstanceId = commandLineArgs[i + 1]; |
| i++; |
| i++; |
| } |
| } |
| else if (text4.ToLower() == "-backups" && int.TryParse(commandLineArgs[i + 1], out num2)) |
| else if (text4.ToLower() == "-backups" && int.TryParse(commandLineArgs[i + 1], out num2)) |
| { |
| { |
| ZNet.m_backupCount = num2; |
| ZNet.m_backupCount = num2; |
| } |
| } |
| else if (text4 == "-backupshort" && int.TryParse(commandLineArgs[i + 1], out num3)) |
| else if (text4 == "-backupshort" && int.TryParse(commandLineArgs[i + 1], out num3)) |
| { |
| { |
| ZNet.m_backupShort = Mathf.Max(5, num3); |
| ZNet.m_backupShort = Mathf.Max(5, num3); |
| } |
| } |
| else if (text4 == "-backuplong" && int.TryParse(commandLineArgs[i + 1], out num4)) |
| else if (text4 == "-backuplong" && int.TryParse(commandLineArgs[i + 1], out num4)) |
| { |
| { |
| ZNet.m_backupLong = Mathf.Max(5, num4); |
| ZNet.m_backupLong = Mathf.Max(5, num4); |
| } |
| } |
| else if (text4 == "-saveinterval" && int.TryParse(commandLineArgs[i + 1], out num5)) |
| else if (text4 == "-saveinterval" && int.TryParse(commandLineArgs[i + 1], out num5)) |
| { |
| { |
| Game.m_saveInterval = (float)Mathf.Max(5, num5); |
| Game.m_saveInterval = (float)Mathf.Max(5, num5); |
| } |
| } |
| } |
| } |
| if (text3 == "") |
| if (text3 == "") |
| { |
| { |
| text3 = text; |
| text3 = text; |
| } |
| } |
| World createWorld = World.GetCreateWorld(text, FileHelpers.FileSource.Local); |
| World createWorld = World.GetCreateWorld(text, FileHelpers.FileSource.Local); |
| if (!ServerOptionsGUI.m_instance) |
| if (!ServerOptionsGUI.m_instance) |
| { |
| { |
| UnityEngine.Object.Instantiate<ServerOptionsGUI>(this.m_serverOptions).gameObject.SetActive(true); |
| UnityEngine.Object.Instantiate<ServerOptionsGUI>(this.m_serverOptions).gameObject.SetActive(true); |
| } |
| } |
| for (int j = 0; j < commandLineArgs.Length; j++) |
| for (int j = 0; j < commandLineArgs.Length; j++) |
| { |
| { |
| string text10 = commandLineArgs[j].ToLower(); |
| string text10 = commandLineArgs[j].ToLower(); |
| if (text10 == "-resetmodifiers") |
| if (text10 == "-resetmodifiers") |
| { |
| { |
| createWorld.m_startingGlobalKeys.Clear(); |
| createWorld.m_startingGlobalKeys.Clear(); |
| createWorld.m_startingKeysChanged = true; |
| createWorld.m_startingKeysChanged = true; |
| ZLog.Log("Resetting world modifiers"); |
| ZLog.Log("Resetting world modifiers"); |
| } |
| } |
| else if (text10 == "-preset" && commandLineArgs.Length > j + 1) |
| else if (text10 == "-preset" && commandLineArgs.Length > j + 1) |
| { |
| { |
| string text11 = commandLineArgs[j + 1]; |
| string text11 = commandLineArgs[j + 1]; |
| WorldPresets worldPresets; |
| WorldPresets worldPresets; |
| if (Enum.TryParse<WorldPresets>(text11, true, out worldPresets)) |
| if (Enum.TryParse<WorldPresets>(text11, true, out worldPresets)) |
| { |
| { |
| createWorld.m_startingGlobalKeys.Clear(); |
| createWorld.m_startingGlobalKeys.Clear(); |
| createWorld.m_startingKeysChanged = true; |
| createWorld.m_startingKeysChanged = true; |
| ServerOptionsGUI.m_instance.ReadKeys(createWorld); |
| ServerOptionsGUI.m_instance.ReadKeys(createWorld); |
| ServerOptionsGUI.m_instance.SetPreset(createWorld, worldPresets); |
| ServerOptionsGUI.m_instance.SetPreset(createWorld, worldPresets); |
| ServerOptionsGUI.m_instance.SetKeys(createWorld); |
| ServerOptionsGUI.m_instance.SetKeys(createWorld); |
| ZLog.Log("Setting world modifier preset: " + text11); |
| ZLog.Log("Setting world modifier preset: " + text11); |
| } |
| } |
| else |
| else |
| { |
| { |
| ZLog.LogError("Could not parse '" + text11 + "' as a world modifier preset."); |
| ZLog.LogError("Could not parse '" + text11 + "' as a world modifier preset."); |
| } |
| } |
| } |
| } |
| else if (text10 == "-modifier" && commandLineArgs.Length > j + 2) |
| else if (text10 == "-modifier" && commandLineArgs.Length > j + 2) |
| { |
| { |
| string text12 = commandLineArgs[j + 1]; |
| string text12 = commandLineArgs[j + 1]; |
| string text13 = commandLineArgs[j + 2]; |
| string text13 = commandLineArgs[j + 2]; |
| WorldModifiers worldModifiers; |
| WorldModifiers worldModifiers; |
| WorldModifierOption worldModifierOption; |
| WorldModifierOption worldModifierOption; |
| if (Enum.TryParse<WorldModifiers>(text12, true, out worldModifiers) && Enum.TryParse<WorldModifierOption>(text13, true, out worldModifierOption)) |
| if (Enum.TryParse<WorldModifiers>(text12, true, out worldModifiers) && Enum.TryParse<WorldModifierOption>(text13, true, out worldModifierOption)) |
| { |
| { |
| ServerOptionsGUI.m_instance.ReadKeys(createWorld); |
| ServerOptionsGUI.m_instance.ReadKeys(createWorld); |
| ServerOptionsGUI.m_instance.SetPreset(createWorld, worldModifiers, worldModifierOption); |
| ServerOptionsGUI.m_instance.SetPreset(createWorld, worldModifiers, worldModifierOption); |
| ServerOptionsGUI.m_instance.SetKeys(createWorld); |
| ServerOptionsGUI.m_instance.SetKeys(createWorld); |
| ZLog.Log("Setting world modifier: " + text12 + "->" + text13); |
| ZLog.Log("Setting world modifier: " + text12 + "->" + text13); |
| } |
| } |
| else |
| else |
| { |
| { |
| ZLog.LogError(string.Concat(new string[] { "Could not parse '", text12, "' with a value of '", text13, "' as a world modifier." })); |
| ZLog.LogError(string.Concat(new string[] { "Could not parse '", text12, "' with a value of '", text13, "' as a world modifier." })); |
| } |
| } |
| } |
| } |
| else if (text10 == "-setkey" && commandLineArgs.Length > j + 1) |
| else if (text10 == "-setkey" && commandLineArgs.Length > j + 1) |
| { |
| { |
| string text14 = commandLineArgs[j + 1]; |
| string text14 = commandLineArgs[j + 1]; |
| if (!createWorld.m_startingGlobalKeys.Contains(text14)) |
| if (!createWorld.m_startingGlobalKeys.Contains(text14)) |
| { |
| { |
| createWorld.m_startingGlobalKeys.Add(text14.ToLower()); |
| createWorld.m_startingGlobalKeys.Add(text14.ToLower()); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (flag && !this.IsPublicPasswordValid(text2, createWorld)) |
| if (flag && !this.IsPublicPasswordValid(text2, createWorld)) |
| { |
| { |
| string publicPasswordError = this.GetPublicPasswordError(text2, createWorld); |
| string publicPasswordError = this.GetPublicPasswordError(text2, createWorld); |
| ZLog.LogError("Error bad password:" + publicPasswordError); |
| ZLog.LogError("Error bad password:" + publicPasswordError); |
| Application.Quit(); |
| Application.Quit(); |
| return false; |
| return false; |
| } |
| } |
| ZNet.SetServer(true, true, flag, text3, text2, createWorld); |
| ZNet.SetServer(true, true, flag, text3, text2, createWorld); |
| ZNet.ResetServerHost(); |
| ZNet.ResetServerHost(); |
| SteamManager.SetServerPort(num); |
| SteamManager.SetServerPort(num); |
| ZSteamSocket.SetDataPort(num); |
| ZSteamSocket.SetDataPort(num); |
| ZPlayFabMatchmaking.SetDataPort(num); |
| ZPlayFabMatchmaking.SetDataPort(num); |
| if (ZNet.m_onlineBackend == OnlineBackendType.PlayFab) |
| if (ZNet.m_onlineBackend == OnlineBackendType.PlayFab) |
| { |
| { |
| ZPlayFabMatchmaking.LookupPublicIP(); |
| ZPlayFabMatchmaking.LookupPublicIP(); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void SetupObjectDB() |
| private void SetupObjectDB() |
| { |
| { |
| ObjectDB objectDB = base.gameObject.AddComponent<ObjectDB>(); |
| ObjectDB objectDB = base.gameObject.AddComponent<ObjectDB>(); |
| ObjectDB component = this.m_objectDBPrefab.GetComponent<ObjectDB>(); |
| ObjectDB component = this.m_objectDBPrefab.GetComponent<ObjectDB>(); |
| objectDB.CopyOtherDB(component); |
| objectDB.CopyOtherDB(component); |
| } |
| } |
| |
| |
| private void ShowConnectError(ZNet.ConnectionStatus statusOverride = ZNet.ConnectionStatus.None) |
| private void ShowConnectError(ZNet.ConnectionStatus statusOverride = ZNet.ConnectionStatus.None) |
| { |
| { |
| ZNet.ConnectionStatus connectionStatus = ((statusOverride == ZNet.ConnectionStatus.None) ? ZNet.GetConnectionStatus() : statusOverride); |
| ZNet.ConnectionStatus connectionStatus = ((statusOverride == ZNet.ConnectionStatus.None) ? ZNet.GetConnectionStatus() : statusOverride); |
| if (ZNet.m_loadError) |
| if (ZNet.m_loadError) |
| { |
| { |
| this.m_connectionFailedPanel.SetActive(true); |
| this.m_connectionFailedPanel.SetActive(true); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_worldfileload"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_worldfileload"); |
| } |
| } |
| if (ZNet.m_loadError) |
| if (ZNet.m_loadError) |
| { |
| { |
| this.m_connectionFailedPanel.SetActive(true); |
| this.m_connectionFailedPanel.SetActive(true); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_worldfileload"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_worldfileload"); |
| } |
| } |
| if (connectionStatus != ZNet.ConnectionStatus.Connected && connectionStatus != ZNet.ConnectionStatus.Connecting && connectionStatus != ZNet.ConnectionStatus.None) |
| if (connectionStatus != ZNet.ConnectionStatus.Connected && connectionStatus != ZNet.ConnectionStatus.Connecting && connectionStatus != ZNet.ConnectionStatus.None) |
| { |
| { |
| this.m_connectionFailedPanel.SetActive(true); |
| this.m_connectionFailedPanel.SetActive(true); |
| switch (connectionStatus) |
| switch (connectionStatus) |
| { |
| { |
| case ZNet.ConnectionStatus.ErrorVersion: |
| case ZNet.ConnectionStatus.ErrorVersion: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_incompatibleversion"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_incompatibleversion"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorDisconnected: |
| case ZNet.ConnectionStatus.ErrorDisconnected: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_disconnected"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_disconnected"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorConnectFailed: |
| case ZNet.ConnectionStatus.ErrorConnectFailed: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_failedconnect"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_failedconnect"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorPassword: |
| case ZNet.ConnectionStatus.ErrorPassword: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_password"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_password"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorAlreadyConnected: |
| case ZNet.ConnectionStatus.ErrorAlreadyConnected: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_alreadyconnected"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_alreadyconnected"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorBanned: |
| case ZNet.ConnectionStatus.ErrorBanned: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_banned"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_banned"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorFull: |
| case ZNet.ConnectionStatus.ErrorFull: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_serverfull"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_serverfull"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorPlatformExcluded: |
| case ZNet.ConnectionStatus.ErrorPlatformExcluded: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_platformexcluded"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_platformexcluded"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorCrossplayPrivilege: |
| case ZNet.ConnectionStatus.ErrorCrossplayPrivilege: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$xbox_error_crossplayprivilege"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$xbox_error_crossplayprivilege"); |
| return; |
| return; |
| case ZNet.ConnectionStatus.ErrorKicked: |
| case ZNet.ConnectionStatus.ErrorKicked: |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_kicked"); |
| this.m_connectionFailedError.text = Localization.instance.Localize("$error_kicked"); |
| break; |
| break; |
| default: |
| default: |
| return; |
| return; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public void OnNewVersionButtonDownload() |
| public void OnNewVersionButtonDownload() |
| { |
| { |
| Application.OpenURL(this.m_downloadUrl); |
| Application.OpenURL(this.m_downloadUrl); |
| Application.Quit(); |
| Application.Quit(); |
| } |
| } |
| |
| |
| public void OnNewVersionButtonContinue() |
| public void OnNewVersionButtonContinue() |
| { |
| { |
| this.m_newGameVersionPanel.SetActive(false); |
| this.m_newGameVersionPanel.SetActive(false); |
| } |
| } |
| |
| |
| public void OnStartGame() |
| public void OnStartGame() |
| { |
| { |
| Gogan.LogEvent("Screen", "Enter", "StartGame", 0L); |
| Gogan.LogEvent("Screen", "Enter", "StartGame", 0L); |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| this.ShowCharacterSelection(); |
| this.ShowCharacterSelection(); |
| } |
| } |
| |
| |
| private void ShowStartGame() |
| private void ShowStartGame() |
| { |
| { |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| this.m_createWorldPanel.SetActive(false); |
| this.m_createWorldPanel.SetActive(false); |
| this.m_serverOptions.gameObject.SetActive(false); |
| this.m_serverOptions.gameObject.SetActive(false); |
| this.m_startGamePanel.SetActive(true); |
| this.m_startGamePanel.SetActive(true); |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| } |
| } |
| |
| |
| public void OnSelectWorldTab() |
| public void OnSelectWorldTab() |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| } |
| } |
| |
| |
| private void RefreshWorldSelection() |
| private void RefreshWorldSelection() |
| { |
| { |
| this.UpdateWorldList(true); |
| this.UpdateWorldList(true); |
| if (this.m_world != null) |
| if (this.m_world != null) |
| { |
| { |
| this.m_world = this.FindWorld(this.m_world.m_name); |
| this.m_world = this.FindWorld(this.m_world.m_name); |
| if (this.m_world != null) |
| if (this.m_world != null) |
| { |
| { |
| this.UpdateWorldList(true); |
| this.UpdateWorldList(true); |
| } |
| } |
| } |
| } |
| if (this.m_world == null) |
| if (this.m_world == null) |
| { |
| { |
| string @string = PlayerPrefs.GetString("world"); |
| string @string = PlayerPrefs.GetString("world"); |
| if (@string.Length > 0) |
| if (@string.Length > 0) |
| { |
| { |
| this.m_world = this.FindWorld(@string); |
| this.m_world = this.FindWorld(@string); |
| } |
| } |
| if (this.m_world == null) |
| if (this.m_world == null) |
| { |
| { |
| this.m_world = ((this.m_worlds.Count > 0) ? this.m_worlds[0] : null); |
| this.m_world = ((this.m_worlds.Count > 0) ? this.m_worlds[0] : null); |
| } |
| } |
| if (this.m_world != null) |
| if (this.m_world != null) |
| { |
| { |
| this.UpdateWorldList(true); |
| this.UpdateWorldList(true); |
| } |
| } |
| this.m_crossplayServerToggle.isOn = PlayerPrefs.GetInt("crossplay", 1) == 1; |
| this.m_crossplayServerToggle.isOn = PlayerPrefs.GetInt("crossplay", 1) == 1; |
| } |
| } |
| } |
| } |
| |
| |
| public void OnServerListTab() |
| public void OnServerListTab() |
| { |
| { |
| if (!PrivilegeManager.CanAccessOnlineMultiplayer) |
| if (!PrivilegeManager.CanAccessOnlineMultiplayer) |
| { |
| { |
| this.m_startGamePanel.transform.GetChild(0).GetComponent<TabHandler>().SetActiveTab(0, false, true); |
| this.m_startGamePanel.transform.GetChild(0).GetComponent<TabHandler>().SetActiveTab(0, false, true); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| } |
| } |
| } |
| } |
| |
| |
| private void OnOpenServerToggleClicked(bool value) |
| private void OnOpenServerToggleClicked(bool value) |
| { |
| { |
| if (value && !PrivilegeManager.CanAccessOnlineMultiplayer) |
| if (value && !PrivilegeManager.CanAccessOnlineMultiplayer) |
| { |
| { |
| this.m_openServerToggle.isOn = false; |
| this.m_openServerToggle.isOn = false; |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| } |
| } |
| } |
| } |
| |
| |
| private void ShowOnlineMultiplayerPrivilegeWarning() |
| private void ShowOnlineMultiplayerPrivilegeWarning() |
| { |
| { |
| if (!PrivilegeManager.HasPrivilegeData || PlayFabManager.CurrentLoginState != LoginState.LoggedIn) |
| if (!PrivilegeManager.HasPrivilegeData || PlayFabManager.CurrentLoginState != LoginState.LoggedIn) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$menu_logintext", "$menu_loginfailedtext", delegate |
| UnifiedPopup.Push(new WarningPopup("$menu_logintext", "$menu_loginfailedtext", delegate |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| return; |
| return; |
| } |
| } |
| UnifiedPopup.Push(new WarningPopup("$menu_privilegerequiredheader", "$menu_onlineprivilegetext", delegate |
| UnifiedPopup.Push(new WarningPopup("$menu_privilegerequiredheader", "$menu_onlineprivilegetext", delegate |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| } |
| } |
| |
| |
| private void OnUGCPopupShown() |
| private void OnUGCPopupShown() |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| } |
| } |
| |
| |
| private World FindWorld(string name) |
| private World FindWorld(string name) |
| { |
| { |
| foreach (World world in this.m_worlds) |
| foreach (World world in this.m_worlds) |
| { |
| { |
| if (world.m_name == name) |
| if (world.m_name == name) |
| { |
| { |
| return world; |
| return world; |
| } |
| } |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| private void UpdateWorldList(bool centerSelection) |
| private void UpdateWorldList(bool centerSelection) |
| { |
| { |
| this.m_worlds = SaveSystem.GetWorldList(); |
| this.m_worlds = SaveSystem.GetWorldList(); |
| float num = (float)this.m_worlds.Count * this.m_worldListElementStep; |
| float num = (float)this.m_worlds.Count * this.m_worldListElementStep; |
| num = Mathf.Max(this.m_worldListBaseSize, num); |
| num = Mathf.Max(this.m_worldListBaseSize, num); |
| this.m_worldListRoot.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num); |
| this.m_worldListRoot.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num); |
| for (int i = 0; i < this.m_worlds.Count; i++) |
| for (int i = 0; i < this.m_worlds.Count; i++) |
| { |
| { |
| World world = this.m_worlds[i]; |
| World world = this.m_worlds[i]; |
| GameObject gameObject; |
| GameObject gameObject; |
| if (i < this.m_worldListElements.Count) |
| if (i < this.m_worldListElements.Count) |
| { |
| { |
| gameObject = this.m_worldListElements[i]; |
| gameObject = this.m_worldListElements[i]; |
| } |
| } |
| else |
| else |
| { |
| { |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_worldListElement, this.m_worldListRoot); |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_worldListElement, this.m_worldListRoot); |
| this.m_worldListElements.Add(gameObject); |
| this.m_worldListElements.Add(gameObject); |
| gameObject.SetActive(true); |
| gameObject.SetActive(true); |
| } |
| } |
| (gameObject.transform as RectTransform).anchoredPosition = new Vector2(0f, (float)i * -this.m_worldListElementStep); |
| (gameObject.transform as RectTransform).anchoredPosition = new Vector2(0f, (float)i * -this.m_worldListElementStep); |
| Button component = gameObject.GetComponent<Button>(); |
| Button component = gameObject.GetComponent<Button>(); |
| component.onClick.RemoveAllListeners(); |
| component.onClick.RemoveAllListeners(); |
| int index = i; |
| int index = i; |
| component.onClick.AddListener(delegate |
| component.onClick.AddListener(delegate |
| { |
| { |
| this.OnSelectWorld(index); |
| this.OnSelectWorld(index); |
| }); |
| }); |
| TMP_Text component2 = gameObject.transform.Find("seed").GetComponent<TMP_Text>(); |
| TMP_Text component2 = gameObject.transform.Find("seed").GetComponent<TMP_Text>(); |
| component2.text = world.m_seedName; |
| component2.text = world.m_seedName; |
| gameObject.transform.Find("modifiers").GetComponent<TMP_Text>().text = Localization.instance.Localize(ServerOptionsGUI.GetWorldModifierSummary(world.m_startingGlobalKeys, true, ", ")); |
| gameObject.transform.Find("modifiers").GetComponent<TMP_Text>().text = Localization.instance.Localize(ServerOptionsGUI.GetWorldModifierSummary(world.m_startingGlobalKeys, true, ", ")); |
| TMP_Text component3 = gameObject.transform.Find("name").GetComponent<TMP_Text>(); |
| TMP_Text component3 = gameObject.transform.Find("name").GetComponent<TMP_Text>(); |
| if (world.m_name == world.m_fileName) |
| if (world.m_name == world.m_fileName) |
| { |
| { |
| component3.text = world.m_name; |
| component3.text = world.m_name; |
| } |
| } |
| else |
| else |
| { |
| { |
| component3.text = world.m_name + " (" + world.m_fileName + ")"; |
| component3.text = world.m_name + " (" + world.m_fileName + ")"; |
| } |
| } |
| Transform transform = gameObject.transform.Find("source_cloud"); |
| Transform transform = gameObject.transform.Find("source_cloud"); |
| if (transform != null) |
| if (transform != null) |
| { |
| { |
| transform.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Cloud); |
| transform.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Cloud); |
| } |
| } |
| Transform transform2 = gameObject.transform.Find("source_local"); |
| Transform transform2 = gameObject.transform.Find("source_local"); |
| if (transform2 != null) |
| if (transform2 != null) |
| { |
| { |
| transform2.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Local); |
| transform2.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Local); |
| } |
| } |
| Transform transform3 = gameObject.transform.Find("source_legacy"); |
| Transform transform3 = gameObject.transform.Find("source_legacy"); |
| if (transform3 != null) |
| if (transform3 != null) |
| { |
| { |
| transform3.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Legacy); |
| transform3.gameObject.SetActive(world.m_fileSource == FileHelpers.FileSource.Legacy); |
| } |
| } |
| switch (world.m_dataError) |
| switch (world.m_dataError) |
| { |
| { |
| case World.SaveDataError.None: |
| case World.SaveDataError.None: |
| break; |
| break; |
| case World.SaveDataError.BadVersion: |
| case World.SaveDataError.BadVersion: |
| component2.text = " [BAD VERSION]"; |
| component2.text = " [BAD VERSION]"; |
| break; |
| break; |
| case World.SaveDataError.LoadError: |
| case World.SaveDataError.LoadError: |
| component2.text = " [LOAD ERROR]"; |
| component2.text = " [LOAD ERROR]"; |
| break; |
| break; |
| case World.SaveDataError.Corrupt: |
| case World.SaveDataError.Corrupt: |
| component2.text = " [CORRUPT]"; |
| component2.text = " [CORRUPT]"; |
| break; |
| break; |
| case World.SaveDataError.MissingMeta: |
| case World.SaveDataError.MissingMeta: |
| component2.text = " [MISSING META]"; |
| component2.text = " [MISSING META]"; |
| break; |
| break; |
| case World.SaveDataError.MissingDB: |
| case World.SaveDataError.MissingDB: |
| component2.text = " [MISSING DB]"; |
| component2.text = " [MISSING DB]"; |
| break; |
| break; |
| default: |
| default: |
| component2.text = string.Format(" [{0}]", world.m_dataError); |
| component2.text = string.Format(" [{0}]", world.m_dataError); |
| break; |
| break; |
| } |
| } |
| RectTransform rectTransform = gameObject.transform.Find("selected") as RectTransform; |
| RectTransform rectTransform = gameObject.transform.Find("selected") as RectTransform; |
| bool flag = this.m_world != null && world.m_fileName == this.m_world.m_fileName; |
| bool flag = this.m_world != null && world.m_fileName == this.m_world.m_fileName; |
| if (flag && this.m_world != world) |
| if (flag && this.m_world != world) |
| { |
| { |
| this.m_world = world; |
| this.m_world = world; |
| } |
| } |
| rectTransform.gameObject.SetActive(flag); |
| rectTransform.gameObject.SetActive(flag); |
| if (flag) |
| if (flag) |
| { |
| { |
| component.Select(); |
| component.Select(); |
| } |
| } |
| if (flag && centerSelection) |
| if (flag && centerSelection) |
| { |
| { |
| this.m_worldListEnsureVisible.CenterOnItem(rectTransform); |
| this.m_worldListEnsureVisible.CenterOnItem(rectTransform); |
| } |
| } |
| } |
| } |
| for (int j = this.m_worldListElements.Count - 1; j >= this.m_worlds.Count; j--) |
| for (int j = this.m_worldListElements.Count - 1; j >= this.m_worlds.Count; j--) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_worldListElements[j]); |
| UnityEngine.Object.Destroy(this.m_worldListElements[j]); |
| this.m_worldListElements.RemoveAt(j); |
| this.m_worldListElements.RemoveAt(j); |
| } |
| } |
| this.m_worldSourceInfo.text = ""; |
| this.m_worldSourceInfo.text = ""; |
| this.m_worldSourceInfoPanel.SetActive(false); |
| this.m_worldSourceInfoPanel.SetActive(false); |
| if (this.m_world != null) |
| if (this.m_world != null) |
| { |
| { |
| this.m_worldSourceInfo.text = Localization.instance.Localize(((this.m_world.m_fileSource == FileHelpers.FileSource.Legacy) ? "$menu_legacynotice \n\n$menu_legacynotice_worlds \n\n" : "") + ((!FileHelpers.m_cloudEnabled) ? "$menu_cloudsavesdisabled" : "")); |
| this.m_worldSourceInfo.text = Localization.instance.Localize(((this.m_world.m_fileSource == FileHelpers.FileSource.Legacy) ? "$menu_legacynotice \n\n$menu_legacynotice_worlds \n\n" : "") + ((!FileHelpers.m_cloudEnabled) ? "$menu_cloudsavesdisabled" : "")); |
| this.m_worldSourceInfoPanel.SetActive(this.m_worldSourceInfo.text.Length > 0); |
| this.m_worldSourceInfoPanel.SetActive(this.m_worldSourceInfo.text.Length > 0); |
| } |
| } |
| for (int k = 0; k < this.m_worlds.Count; k++) |
| for (int k = 0; k < this.m_worlds.Count; k++) |
| { |
| { |
| World world2 = this.m_worlds[k]; |
| World world2 = this.m_worlds[k]; |
| UITooltip componentInChildren = this.m_worldListElements[k].GetComponentInChildren<UITooltip>(); |
| UITooltip componentInChildren = this.m_worldListElements[k].GetComponentInChildren<UITooltip>(); |
| if (componentInChildren != null) |
| if (componentInChildren != null) |
| { |
| { |
| string worldModifierSummary = ServerOptionsGUI.GetWorldModifierSummary(world2.m_startingGlobalKeys, false, "\n"); |
| string worldModifierSummary = ServerOptionsGUI.GetWorldModifierSummary(world2.m_startingGlobalKeys, false, "\n"); |
| componentInChildren.Set(string.IsNullOrEmpty(worldModifierSummary) ? "" : "$menu_serveroptions", worldModifierSummary, this.m_worldSourceInfoPanel.activeSelf ? this.m_tooltipSecondaryAnchor : this.m_tooltipAnchor, default(Vector2)); |
| componentInChildren.Set(string.IsNullOrEmpty(worldModifierSummary) ? "" : "$menu_serveroptions", worldModifierSummary, this.m_worldSourceInfoPanel.activeSelf ? this.m_tooltipSecondaryAnchor : this.m_tooltipAnchor, default(Vector2)); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public void OnWorldRemove() |
| public void OnWorldRemove() |
| { |
| { |
| if (this.m_world == null) |
| if (this.m_world == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_removeWorldName.text = this.m_world.m_fileName; |
| this.m_removeWorldName.text = this.m_world.m_fileName; |
| this.m_removeWorldDialog.SetActive(true); |
| this.m_removeWorldDialog.SetActive(true); |
| } |
| } |
| |
| |
| public void OnButtonRemoveWorldYes() |
| public void OnButtonRemoveWorldYes() |
| { |
| { |
| World.RemoveWorld(this.m_world.m_fileName, this.m_world.m_fileSource); |
| World.RemoveWorld(this.m_world.m_fileName, this.m_world.m_fileSource); |
| this.m_world = null; |
| this.m_world = null; |
| this.m_worlds = SaveSystem.GetWorldList(); |
| this.m_worlds = SaveSystem.GetWorldList(); |
| this.SetSelectedWorld(0, true); |
| this.SetSelectedWorld(0, true); |
| this.m_removeWorldDialog.SetActive(false); |
| this.m_removeWorldDialog.SetActive(false); |
| } |
| } |
| |
| |
| public void OnButtonRemoveWorldNo() |
| public void OnButtonRemoveWorldNo() |
| { |
| { |
| this.m_removeWorldDialog.SetActive(false); |
| this.m_removeWorldDialog.SetActive(false); |
| } |
| } |
| |
| |
| private void OnSelectWorld(int index) |
| private void OnSelectWorld(int index) |
| { |
| { |
| this.SetSelectedWorld(index, false); |
| this.SetSelectedWorld(index, false); |
| } |
| } |
| |
| |
| private void SetSelectedWorld(int index, bool centerSelection) |
| private void SetSelectedWorld(int index, bool centerSelection) |
| { |
| { |
| if (this.m_worlds.Count != 0) |
| if (this.m_worlds.Count != 0) |
| { |
| { |
| index = Mathf.Clamp(index, 0, this.m_worlds.Count - 1); |
| index = Mathf.Clamp(index, 0, this.m_worlds.Count - 1); |
| this.m_world = this.m_worlds[index]; |
| this.m_world = this.m_worlds[index]; |
| } |
| } |
| this.UpdateWorldList(centerSelection); |
| this.UpdateWorldList(centerSelection); |
| } |
| } |
| |
| |
| private int GetSelectedWorld() |
| private int GetSelectedWorld() |
| { |
| { |
| if (this.m_world == null) |
| if (this.m_world == null) |
| { |
| { |
| return -1; |
| return -1; |
| } |
| } |
| for (int i = 0; i < this.m_worlds.Count; i++) |
| for (int i = 0; i < this.m_worlds.Count; i++) |
| { |
| { |
| if (this.m_worlds[i].m_fileName == this.m_world.m_fileName) |
| if (this.m_worlds[i].m_fileName == this.m_world.m_fileName) |
| { |
| { |
| return i; |
| return i; |
| } |
| } |
| } |
| } |
| return -1; |
| return -1; |
| } |
| } |
| |
| |
| private int FindSelectedWorld(GameObject button) |
| private int FindSelectedWorld(GameObject button) |
| { |
| { |
| for (int i = 0; i < this.m_worldListElements.Count; i++) |
| for (int i = 0; i < this.m_worldListElements.Count; i++) |
| { |
| { |
| if (this.m_worldListElements[i] == button) |
| if (this.m_worldListElements[i] == button) |
| { |
| { |
| return i; |
| return i; |
| } |
| } |
| } |
| } |
| return -1; |
| return -1; |
| } |
| } |
| |
| |
| private FileHelpers.FileSource GetMoveTarget(FileHelpers.FileSource source) |
| private FileHelpers.FileSource GetMoveTarget(FileHelpers.FileSource source) |
| { |
| { |
| if (source == FileHelpers.FileSource.Cloud) |
| if (source == FileHelpers.FileSource.Cloud) |
| { |
| { |
| return FileHelpers.FileSource.Local; |
| return FileHelpers.FileSource.Local; |
| } |
| } |
| return FileHelpers.FileSource.Cloud; |
| return FileHelpers.FileSource.Cloud; |
| } |
| } |
| |
| |
| public void OnWorldNew() |
| public void OnWorldNew() |
| { |
| { |
| this.m_createWorldPanel.SetActive(true); |
| this.m_createWorldPanel.SetActive(true); |
| this.m_newWorldName.text = ""; |
| this.m_newWorldName.text = ""; |
| this.m_newWorldSeed.text = World.GenerateSeed(); |
| this.m_newWorldSeed.text = World.GenerateSeed(); |
| } |
| } |
| |
| |
| public void OnNewWorldDone(bool forceLocal) |
| public void OnNewWorldDone(bool forceLocal) |
| { |
| { |
| string text = this.m_newWorldName.text; |
| string text = this.m_newWorldName.text; |
| string text2 = this.m_newWorldSeed.text; |
| string text2 = this.m_newWorldSeed.text; |
| if (World.HaveWorld(text)) |
| if (World.HaveWorld(text)) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$menu_newworldalreadyexists"), Localization.instance.Localize("$menu_newworldalreadyexistsmessage", new string[] { text }), delegate |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$menu_newworldalreadyexists"), Localization.instance.Localize("$menu_newworldalreadyexistsmessage", new string[] { text }), delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, false)); |
| }, false)); |
| return; |
| return; |
| } |
| } |
| this.m_world = new World(text, text2); |
| this.m_world = new World(text, text2); |
| this.m_world.m_fileSource = ((FileHelpers.m_cloudEnabled && !forceLocal) ? FileHelpers.FileSource.Cloud : FileHelpers.FileSource.Local); |
| this.m_world.m_fileSource = ((FileHelpers.m_cloudEnabled && !forceLocal) ? FileHelpers.FileSource.Cloud : FileHelpers.FileSource.Local); |
| this.m_world.m_needsDB = false; |
| this.m_world.m_needsDB = false; |
| if (this.m_world.m_fileSource == FileHelpers.FileSource.Cloud && FileHelpers.OperationExceedsCloudCapacity(2097152UL)) |
| if (this.m_world.m_fileSource == FileHelpers.FileSource.Cloud && FileHelpers.OperationExceedsCloudCapacity(2097152UL)) |
| { |
| { |
| this.ShowCloudQuotaWorldDialog(); |
| this.ShowCloudQuotaWorldDialog(); |
| ZLog.LogWarning("This operation may exceed the cloud save quota and has therefore been aborted! Prompt shown to user."); |
| ZLog.LogWarning("This operation may exceed the cloud save quota and has therefore been aborted! Prompt shown to user."); |
| return; |
| return; |
| } |
| } |
| this.m_world.SaveWorldMetaData(DateTime.Now); |
| this.m_world.SaveWorldMetaData(DateTime.Now); |
| this.UpdateWorldList(true); |
| this.UpdateWorldList(true); |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| Gogan.LogEvent("Menu", "NewWorld", text, 0L); |
| Gogan.LogEvent("Menu", "NewWorld", text, 0L); |
| } |
| } |
| |
| |
| public void OnNewWorldBack() |
| public void OnNewWorldBack() |
| { |
| { |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| } |
| } |
| |
| |
| public void OnServerOptions() |
| public void OnServerOptions() |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| this.m_serverOptions.gameObject.SetActive(true); |
| this.m_serverOptions.gameObject.SetActive(true); |
| this.m_serverOptions.ReadKeys(this.m_world); |
| this.m_serverOptions.ReadKeys(this.m_world); |
| EventSystem.current.SetSelectedGameObject(this.m_serverOptions.m_doneButton); |
| EventSystem.current.SetSelectedGameObject(this.m_serverOptions.m_doneButton); |
| if (PlatformPrefs.GetInt("ServerOptionsDisclaimer", 0) == 0) |
| if (PlatformPrefs.GetInt("ServerOptionsDisclaimer", 0) == 0) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$menu_modifier_popup_title", "$menu_modifier_popup_text", delegate |
| UnifiedPopup.Push(new WarningPopup("$menu_modifier_popup_title", "$menu_modifier_popup_text", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| PlatformPrefs.SetInt("ServerOptionsDisclaimer", 1); |
| PlatformPrefs.SetInt("ServerOptionsDisclaimer", 1); |
| } |
| } |
| } |
| } |
| |
| |
| public void OnServerOptionsDone() |
| public void OnServerOptionsDone() |
| { |
| { |
| this.m_world.m_startingGlobalKeys.Clear(); |
| this.m_world.m_startingGlobalKeys.Clear(); |
| this.m_world.m_startingKeysChanged = true; |
| this.m_world.m_startingKeysChanged = true; |
| this.m_serverOptions.SetKeys(this.m_world); |
| this.m_serverOptions.SetKeys(this.m_world); |
| DateTime now = DateTime.Now; |
| DateTime now = DateTime.Now; |
| SaveWithBackups saveWithBackups; |
| SaveWithBackups saveWithBackups; |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_fileName, SaveDataType.World, out saveWithBackups) || saveWithBackups.IsDeleted) |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_fileName, SaveDataType.World, out saveWithBackups) || saveWithBackups.IsDeleted) |
| { |
| { |
| ZLog.LogError("Failed to retrieve world save " + this.m_world.m_fileName + " by name when modifying server options!"); |
| ZLog.LogError("Failed to retrieve world save " + this.m_world.m_fileName + " by name when modifying server options!"); |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| return; |
| return; |
| } |
| } |
| SaveSystem.CheckMove(this.m_world.m_fileName, SaveDataType.World, ref this.m_world.m_fileSource, now, saveWithBackups.PrimaryFile.Size, true); |
| SaveSystem.CheckMove(this.m_world.m_fileName, SaveDataType.World, ref this.m_world.m_fileSource, now, saveWithBackups.PrimaryFile.Size, true); |
| this.m_world.SaveWorldMetaData(now); |
| this.m_world.SaveWorldMetaData(now); |
| this.UpdateWorldList(true); |
| this.UpdateWorldList(true); |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| } |
| } |
| |
| |
| public void OnServerOptionsCancel() |
| public void OnServerOptionsCancel() |
| { |
| { |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| } |
| } |
| |
| |
| public void OnMerchStoreButton() |
| public void OnMerchStoreButton() |
| { |
| { |
| Application.OpenURL("http://valheim.shop/?game_" + global::Version.GetPlatformPrefix("win")); |
| Application.OpenURL("http://valheim.shop/?game_" + global::Version.GetPlatformPrefix("win")); |
| } |
| } |
| |
| |
| public void OnCloudStorageLowNextSaveWarningOk() |
| public void OnCloudStorageLowNextSaveWarningOk() |
| { |
| { |
| this.m_cloudStorageWarningNextSave.SetActive(false); |
| this.m_cloudStorageWarningNextSave.SetActive(false); |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| } |
| } |
| |
| |
| public void OnWorldStart() |
| public void OnWorldStart() |
| { |
| { |
| if (!SaveSystem.CanSaveToCloudStorage(this.m_world, this.m_profiles[this.m_profileIndex]) || Menu.ExceedCloudStorageTest) |
| if (!SaveSystem.CanSaveToCloudStorage(this.m_world, this.m_profiles[this.m_profileIndex]) || Menu.ExceedCloudStorageTest) |
| { |
| { |
| this.m_cloudStorageWarningNextSave.SetActive(true); |
| this.m_cloudStorageWarningNextSave.SetActive(true); |
| return; |
| return; |
| } |
| } |
| if (this.m_world == null || this.m_startingWorld) |
| if (this.m_world == null || this.m_startingWorld) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| Game.m_serverOptionsSummary = ""; |
| Game.m_serverOptionsSummary = ""; |
| switch (this.m_world.m_dataError) |
| switch (this.m_world.m_dataError) |
| { |
| { |
| case World.SaveDataError.None: |
| case World.SaveDataError.None: |
| { |
| { |
| PlayerPrefs.SetString("world", this.m_world.m_name); |
| PlayerPrefs.SetString("world", this.m_world.m_name); |
| if (this.m_crossplayServerToggle.IsInteractable()) |
| if (this.m_crossplayServerToggle.IsInteractable()) |
| { |
| { |
| PlayerPrefs.SetInt("crossplay", this.m_crossplayServerToggle.isOn ? 1 : 0); |
| PlayerPrefs.SetInt("crossplay", this.m_crossplayServerToggle.isOn ? 1 : 0); |
| } |
| } |
| bool isOn = this.m_publicServerToggle.isOn; |
| bool isOn = this.m_publicServerToggle.isOn; |
| bool isOn2 = this.m_openServerToggle.isOn; |
| bool isOn2 = this.m_openServerToggle.isOn; |
| bool isOn3 = this.m_crossplayServerToggle.isOn; |
| bool isOn3 = this.m_crossplayServerToggle.isOn; |
| string text = this.m_serverPassword.text; |
| string text = this.m_serverPassword.text; |
| OnlineBackendType onlineBackend = this.GetOnlineBackend(isOn3); |
| OnlineBackendType onlineBackend = this.GetOnlineBackend(isOn3); |
| if (isOn2 && onlineBackend == OnlineBackendType.PlayFab && !PlayFabManager.IsLoggedIn) |
| if (isOn2 && onlineBackend == OnlineBackendType.PlayFab && !PlayFabManager.IsLoggedIn) |
| { |
| { |
| this.ContinueWhenLoggedInPopup(new FejdStartup.ContinueAction(this.OnWorldStart)); |
| this.ContinueWhenLoggedInPopup(new FejdStartup.ContinueAction(this.OnWorldStart)); |
| return; |
| return; |
| } |
| } |
| ZNet.m_onlineBackend = onlineBackend; |
| ZNet.m_onlineBackend = onlineBackend; |
| ZSteamMatchmaking.instance.StopServerListing(); |
| ZSteamMatchmaking.instance.StopServerListing(); |
| this.m_startingWorld = true; |
| this.m_startingWorld = true; |
| ZNet.SetServer(true, isOn2, isOn, this.m_world.m_name, text, this.m_world); |
| ZNet.SetServer(true, isOn2, isOn, this.m_world.m_name, text, this.m_world); |
| ZNet.ResetServerHost(); |
| ZNet.ResetServerHost(); |
| string text2 = "open:" + isOn2.ToString() + ",public:" + isOn.ToString(); |
| string text2 = "open:" + isOn2.ToString() + ",public:" + isOn.ToString(); |
| Gogan.LogEvent("Menu", "WorldStart", text2, 0L); |
| Gogan.LogEvent("Menu", "WorldStart", text2, 0L); |
| FejdStartup.StartGameEventHandler startGameEventHandler = FejdStartup.startGameEvent; |
| FejdStartup.StartGameEventHandler startGameEventHandler = FejdStartup.startGameEvent; |
| if (startGameEventHandler != null) |
| if (startGameEventHandler != null) |
| { |
| { |
| startGameEventHandler(this, new FejdStartup.StartGameEventArgs(true)); |
| startGameEventHandler(this, new FejdStartup.StartGameEventArgs(true)); |
| } |
| } |
| this.TransitionToMainScene(); |
| this.TransitionToMainScene(); |
| return; |
| return; |
| } |
| } |
| case World.SaveDataError.BadVersion: |
| case World.SaveDataError.BadVersion: |
| return; |
| return; |
| case World.SaveDataError.LoadError: |
| case World.SaveDataError.LoadError: |
| case World.SaveDataError.Corrupt: |
| case World.SaveDataError.Corrupt: |
| { |
| { |
| SaveWithBackups saveWithBackups; |
| SaveWithBackups saveWithBackups; |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_name, SaveDataType.World, out saveWithBackups)) |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_name, SaveDataType.World, out saveWithBackups)) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError("Failed to restore backup! Couldn't get world " + this.m_world.m_name + " by name from save system."); |
| ZLog.LogError("Failed to restore backup! Couldn't get world " + this.m_world.m_name + " by name from save system."); |
| return; |
| return; |
| } |
| } |
| if (saveWithBackups.IsDeleted) |
| if (saveWithBackups.IsDeleted) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError("Failed to restore backup! World " + this.m_world.m_name + " retrieved from save system was deleted."); |
| ZLog.LogError("Failed to restore backup! World " + this.m_world.m_name + " retrieved from save system was deleted."); |
| return; |
| return; |
| } |
| } |
| if (SaveSystem.HasRestorableBackup(saveWithBackups)) |
| if (SaveSystem.HasRestorableBackup(saveWithBackups)) |
| { |
| { |
| this.<OnWorldStart>g__RestoreBackupPrompt|50_1(saveWithBackups); |
| this.<OnWorldStart>g__RestoreBackupPrompt|50_1(saveWithBackups); |
| return; |
| return; |
| } |
| } |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| return; |
| return; |
| } |
| } |
| case World.SaveDataError.MissingMeta: |
| case World.SaveDataError.MissingMeta: |
| { |
| { |
| SaveWithBackups saveWithBackups2; |
| SaveWithBackups saveWithBackups2; |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_name, SaveDataType.World, out saveWithBackups2)) |
| if (!SaveSystem.TryGetSaveByName(this.m_world.m_name, SaveDataType.World, out saveWithBackups2)) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError("Failed to restore meta file! Couldn't get world " + this.m_world.m_name + " by name from save system."); |
| ZLog.LogError("Failed to restore meta file! Couldn't get world " + this.m_world.m_name + " by name from save system."); |
| return; |
| return; |
| } |
| } |
| if (saveWithBackups2.IsDeleted) |
| if (saveWithBackups2.IsDeleted) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError("Failed to restore meta file! World " + this.m_world.m_name + " retrieved from save system was deleted."); |
| ZLog.LogError("Failed to restore meta file! World " + this.m_world.m_name + " retrieved from save system was deleted."); |
| return; |
| return; |
| } |
| } |
| if (SaveSystem.HasBackupWithMeta(saveWithBackups2)) |
| if (SaveSystem.HasBackupWithMeta(saveWithBackups2)) |
| { |
| { |
| this.<OnWorldStart>g__RestoreMetaFromBackupPrompt|50_0(saveWithBackups2); |
| this.<OnWorldStart>g__RestoreMetaFromBackupPrompt|50_0(saveWithBackups2); |
| return; |
| return; |
| } |
| } |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| return; |
| return; |
| } |
| } |
| default: |
| default: |
| return; |
| return; |
| } |
| } |
| } |
| } |
| |
| |
| private void ContinueWhenLoggedInPopup(FejdStartup.ContinueAction continueAction) |
| private void ContinueWhenLoggedInPopup(FejdStartup.ContinueAction continueAction) |
| { |
| { |
| string headerText = Localization.instance.Localize("$menu_loginheader"); |
| string headerText = Localization.instance.Localize("$menu_loginheader"); |
| string loggingInText = Localization.instance.Localize("$menu_logintext"); |
| string loggingInText = Localization.instance.Localize("$menu_logintext"); |
| string retryText = ""; |
| string retryText = ""; |
| int previousRetryCountdown = -1; |
| int previousRetryCountdown = -1; |
| UnifiedPopup.Push(new CancelableTaskPopup(() => headerText, delegate |
| UnifiedPopup.Push(new CancelableTaskPopup(() => headerText, delegate |
| { |
| { |
| if (PlayFabManager.CurrentLoginState == LoginState.WaitingForRetry) |
| if (PlayFabManager.CurrentLoginState == LoginState.WaitingForRetry) |
| { |
| { |
| int num = Mathf.CeilToInt((float)(PlayFabManager.NextRetryUtc - DateTime.UtcNow).TotalSeconds); |
| int num = Mathf.CeilToInt((float)(PlayFabManager.NextRetryUtc - DateTime.UtcNow).TotalSeconds); |
| if (previousRetryCountdown != num) |
| if (previousRetryCountdown != num) |
| { |
| { |
| previousRetryCountdown = num; |
| previousRetryCountdown = num; |
| retryText = Localization.instance.Localize("$menu_loginfailedtext") + "\n" + Localization.instance.Localize("$menu_loginretrycountdowntext", new string[] { num.ToString() }); |
| retryText = Localization.instance.Localize("$menu_loginfailedtext") + "\n" + Localization.instance.Localize("$menu_loginretrycountdowntext", new string[] { num.ToString() }); |
| } |
| } |
| return retryText; |
| return retryText; |
| } |
| } |
| return loggingInText; |
| return loggingInText; |
| }, delegate |
| }, delegate |
| { |
| { |
| if (PlayFabManager.IsLoggedIn) |
| if (PlayFabManager.IsLoggedIn) |
| { |
| { |
| FejdStartup.ContinueAction continueAction2 = continueAction; |
| FejdStartup.ContinueAction continueAction2 = continueAction; |
| if (continueAction2 != null) |
| if (continueAction2 != null) |
| { |
| { |
| continueAction2(); |
| continueAction2(); |
| } |
| } |
| } |
| } |
| return PlayFabManager.IsLoggedIn; |
| return PlayFabManager.IsLoggedIn; |
| }, delegate |
| }, delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| })); |
| })); |
| } |
| } |
| |
| |
| private OnlineBackendType GetOnlineBackend(bool crossplayServer) |
| private OnlineBackendType GetOnlineBackend(bool crossplayServer) |
| { |
| { |
| OnlineBackendType onlineBackendType = OnlineBackendType.Steamworks; |
| OnlineBackendType onlineBackendType = OnlineBackendType.Steamworks; |
| if (crossplayServer) |
| if (crossplayServer) |
| { |
| { |
| onlineBackendType = OnlineBackendType.PlayFab; |
| onlineBackendType = OnlineBackendType.PlayFab; |
| } |
| } |
| return onlineBackendType; |
| return onlineBackendType; |
| } |
| } |
| |
| |
| private void ShowCharacterSelection() |
| private void ShowCharacterSelection() |
| { |
| { |
| Gogan.LogEvent("Screen", "Enter", "CharacterSelection", 0L); |
| Gogan.LogEvent("Screen", "Enter", "CharacterSelection", 0L); |
| ZLog.Log("show character selection"); |
| ZLog.Log("show character selection"); |
| this.m_characterSelectScreen.SetActive(true); |
| this.m_characterSelectScreen.SetActive(true); |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_newCharacterPanel.SetActive(false); |
| this.m_newCharacterPanel.SetActive(false); |
| if (this.m_profiles == null) |
| if (this.m_profiles == null) |
| { |
| { |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| } |
| } |
| if (this.m_profileIndex >= this.m_profiles.Count) |
| if (this.m_profileIndex >= this.m_profiles.Count) |
| { |
| { |
| this.m_profileIndex = this.m_profiles.Count - 1; |
| this.m_profileIndex = this.m_profiles.Count - 1; |
| } |
| } |
| if (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count) |
| if (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count) |
| { |
| { |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| this.m_csFileSource.text = Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)); |
| this.m_csFileSource.text = Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)); |
| } |
| } |
| } |
| } |
| |
| |
| public void OnJoinStart() |
| public void OnJoinStart() |
| { |
| { |
| this.JoinServer(); |
| this.JoinServer(); |
| } |
| } |
| |
| |
| public void JoinServer() |
| public void JoinServer() |
| { |
| { |
| if (!PlayFabManager.IsLoggedIn && this.m_joinServer.m_joinData is ServerJoinDataPlayFabUser) |
| if (!PlayFabManager.IsLoggedIn && this.m_joinServer.m_joinData is ServerJoinDataPlayFabUser) |
| { |
| { |
| this.ContinueWhenLoggedInPopup(new FejdStartup.ContinueAction(this.JoinServer)); |
| this.ContinueWhenLoggedInPopup(new FejdStartup.ContinueAction(this.JoinServer)); |
| return; |
| return; |
| } |
| } |
| if (!PrivilegeManager.CanAccessOnlineMultiplayer) |
| if (!PrivilegeManager.CanAccessOnlineMultiplayer) |
| { |
| { |
| ZLog.LogWarning("You should always prevent JoinServer() from being called when user does not have online multiplayer privilege!"); |
| ZLog.LogWarning("You should always prevent JoinServer() from being called when user does not have online multiplayer privilege!"); |
| this.HideAll(); |
| this.HideAll(); |
| this.m_mainMenu.SetActive(true); |
| this.m_mainMenu.SetActive(true); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| return; |
| return; |
| } |
| } |
| . | if (this.m_joinServer.OnlineStatus == OnlineStatus.Online && this.m_joinServer.m_networkVersion != 23U) |
| if (this.m_joinServer.OnlineStatus == OnlineStatus.Online && this.m_joinServer.m_networkVersion != 27U) |
| { |
| { |
| . | UnifiedPopup.Push(new WarningPopup("$error_incompatibleversion", (23U < this.m_joinServer.m_networkVersion) ? "$error_needslocalupdatetojoin" : "$error_needsserverupdatetojoin", delegate |
| UnifiedPopup.Push(new WarningPopup("$error_incompatibleversion", (27U < this.m_joinServer.m_networkVersion) ? "$error_needslocalupdatetojoin" : "$error_needsserverupdatetojoin", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| return; |
| return; |
| } |
| } |
| if (this.m_joinServer.PlatformRestriction != PrivilegeManager.Platform.Unknown && !this.m_joinServer.IsJoinable) |
| if (this.m_joinServer.PlatformRestriction != PrivilegeManager.Platform.Unknown && !this.m_joinServer.IsJoinable) |
| { |
| { |
| if (this.m_joinServer.IsCrossplay) |
| if (this.m_joinServer.IsCrossplay) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$error_failedconnect"), Localization.instance.Localize("$xbox_error_crossplayprivilege"), delegate |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$error_failedconnect"), Localization.instance.Localize("$xbox_error_crossplayprivilege"), delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, false)); |
| }, false)); |
| return; |
| return; |
| } |
| } |
| if (!this.m_joinServer.IsRestrictedToOwnPlatform) |
| if (!this.m_joinServer.IsRestrictedToOwnPlatform) |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$error_failedconnect"), Localization.instance.Localize("$xbox_error_crossplayprivilege"), delegate |
| UnifiedPopup.Push(new WarningPopup(Localization.instance.Localize("$error_failedconnect"), Localization.instance.Localize("$xbox_error_crossplayprivilege"), delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, false)); |
| }, false)); |
| return; |
| return; |
| } |
| } |
| ZLog.LogWarning("This part of the code should be unreachable unless the way ServerStatus works has been changed. The connection should've been prevented but it will be tried anyway."); |
| ZLog.LogWarning("This part of the code should be unreachable unless the way ServerStatus works has been changed. The connection should've been prevented but it will be tried anyway."); |
| } |
| } |
| ZNet.SetServer(false, false, false, "", "", null); |
| ZNet.SetServer(false, false, false, "", "", null); |
| bool flag = false; |
| bool flag = false; |
| if (this.m_joinServer.m_joinData is ServerJoinDataSteamUser) |
| if (this.m_joinServer.m_joinData is ServerJoinDataSteamUser) |
| { |
| { |
| ZNet.SetServerHost((ulong)(this.m_joinServer.m_joinData as ServerJoinDataSteamUser).m_joinUserID); |
| ZNet.SetServerHost((ulong)(this.m_joinServer.m_joinData as ServerJoinDataSteamUser).m_joinUserID); |
| flag = true; |
| flag = true; |
| } |
| } |
| if (this.m_joinServer.m_joinData is ServerJoinDataPlayFabUser) |
| if (this.m_joinServer.m_joinData is ServerJoinDataPlayFabUser) |
| { |
| { |
| ZNet.SetServerHost((this.m_joinServer.m_joinData as ServerJoinDataPlayFabUser).m_remotePlayerId); |
| ZNet.SetServerHost((this.m_joinServer.m_joinData as ServerJoinDataPlayFabUser).m_remotePlayerId); |
| flag = true; |
| flag = true; |
| } |
| } |
| if (this.m_joinServer.m_joinData is ServerJoinDataDedicated) |
| if (this.m_joinServer.m_joinData is ServerJoinDataDedicated) |
| { |
| { |
| ServerJoinDataDedicated serverJoin = this.m_joinServer.m_joinData as ServerJoinDataDedicated; |
| ServerJoinDataDedicated serverJoin = this.m_joinServer.m_joinData as ServerJoinDataDedicated; |
| if (serverJoin.IsValid()) |
| if (serverJoin.IsValid()) |
| { |
| { |
| if (PlayFabManager.IsLoggedIn) |
| if (PlayFabManager.IsLoggedIn) |
| { |
| { |
| ZNet.ResetServerHost(); |
| ZNet.ResetServerHost(); |
| ZPlayFabMatchmaking.FindHostByIp(serverJoin.GetIPPortString(), delegate(PlayFabMatchmakingServerData result) |
| ZPlayFabMatchmaking.FindHostByIp(serverJoin.GetIPPortString(), delegate(PlayFabMatchmakingServerData result) |
| { |
| { |
| if (result != null) |
| if (result != null) |
| { |
| { |
| ZNet.SetServerHost(result.remotePlayerId); |
| ZNet.SetServerHost(result.remotePlayerId); |
| ZLog.Log("Determined backend of dedicated server to be PlayFab"); |
| ZLog.Log("Determined backend of dedicated server to be PlayFab"); |
| return; |
| return; |
| } |
| } |
| FejdStartup.retries = 50; |
| FejdStartup.retries = 50; |
| }, delegate(ZPLayFabMatchmakingFailReason failReason) |
| }, delegate(ZPLayFabMatchmakingFailReason failReason) |
| { |
| { |
| ZNet.SetServerHost(serverJoin.GetIPString(), (int)serverJoin.m_port, OnlineBackendType.Steamworks); |
| ZNet.SetServerHost(serverJoin.GetIPString(), (int)serverJoin.m_port, OnlineBackendType.Steamworks); |
| ZLog.Log("Determined backend of dedicated server to be Steamworks"); |
| ZLog.Log("Determined backend of dedicated server to be Steamworks"); |
| }, true); |
| }, true); |
| } |
| } |
| else |
| else |
| { |
| { |
| ZNet.SetServerHost(serverJoin.GetIPString(), (int)serverJoin.m_port, OnlineBackendType.Steamworks); |
| ZNet.SetServerHost(serverJoin.GetIPString(), (int)serverJoin.m_port, OnlineBackendType.Steamworks); |
| ZLog.Log("Determined backend of dedicated server to be Steamworks"); |
| ZLog.Log("Determined backend of dedicated server to be Steamworks"); |
| } |
| } |
| flag = true; |
| flag = true; |
| } |
| } |
| else |
| else |
| { |
| { |
| flag = false; |
| flag = false; |
| } |
| } |
| } |
| } |
| if (!flag) |
| if (!flag) |
| { |
| { |
| Debug.LogError("Couldn't set the server host!"); |
| Debug.LogError("Couldn't set the server host!"); |
| return; |
| return; |
| } |
| } |
| Gogan.LogEvent("Menu", "JoinServer", "", 0L); |
| Gogan.LogEvent("Menu", "JoinServer", "", 0L); |
| Action resetPendingInvite = FejdStartup.ResetPendingInvite; |
| Action resetPendingInvite = FejdStartup.ResetPendingInvite; |
| if (resetPendingInvite != null) |
| if (resetPendingInvite != null) |
| { |
| { |
| resetPendingInvite(); |
| resetPendingInvite(); |
| } |
| } |
| FejdStartup.StartGameEventHandler startGameEventHandler = FejdStartup.startGameEvent; |
| FejdStartup.StartGameEventHandler startGameEventHandler = FejdStartup.startGameEvent; |
| if (startGameEventHandler != null) |
| if (startGameEventHandler != null) |
| { |
| { |
| startGameEventHandler(this, new FejdStartup.StartGameEventArgs(false)); |
| startGameEventHandler(this, new FejdStartup.StartGameEventArgs(false)); |
| } |
| } |
| this.TransitionToMainScene(); |
| this.TransitionToMainScene(); |
| } |
| } |
| |
| |
| public void OnStartGameBack() |
| public void OnStartGameBack() |
| { |
| { |
| this.m_startGamePanel.SetActive(false); |
| this.m_startGamePanel.SetActive(false); |
| this.ShowCharacterSelection(); |
| this.ShowCharacterSelection(); |
| } |
| } |
| |
| |
| public void OnCredits() |
| public void OnCredits() |
| { |
| { |
| this.m_creditsPanel.SetActive(true); |
| this.m_creditsPanel.SetActive(true); |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| Gogan.LogEvent("Screen", "Enter", "Credits", 0L); |
| Gogan.LogEvent("Screen", "Enter", "Credits", 0L); |
| this.m_creditsList.anchoredPosition = new Vector2(0f, 0f); |
| this.m_creditsList.anchoredPosition = new Vector2(0f, 0f); |
| } |
| } |
| |
| |
| public void OnCreditsBack() |
| public void OnCreditsBack() |
| { |
| { |
| this.m_mainMenu.SetActive(true); |
| this.m_mainMenu.SetActive(true); |
| this.m_creditsPanel.SetActive(false); |
| this.m_creditsPanel.SetActive(false); |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| } |
| } |
| |
| |
| public void OnSelelectCharacterBack() |
| public void OnSelelectCharacterBack() |
| { |
| { |
| this.m_characterSelectScreen.SetActive(false); |
| this.m_characterSelectScreen.SetActive(false); |
| this.m_mainMenu.SetActive(true); |
| this.m_mainMenu.SetActive(true); |
| this.m_queuedJoinServer = null; |
| this.m_queuedJoinServer = null; |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| Gogan.LogEvent("Screen", "Enter", "StartMenu", 0L); |
| } |
| } |
| |
| |
| public void OnAbort() |
| public void OnAbort() |
| { |
| { |
| Application.Quit(); |
| Application.Quit(); |
| } |
| } |
| |
| |
| public void OnWorldVersionYes() |
| public void OnWorldVersionYes() |
| { |
| { |
| this.m_worldVersionPanel.SetActive(false); |
| this.m_worldVersionPanel.SetActive(false); |
| } |
| } |
| |
| |
| public void OnPlayerVersionOk() |
| public void OnPlayerVersionOk() |
| { |
| { |
| this.m_playerVersionPanel.SetActive(false); |
| this.m_playerVersionPanel.SetActive(false); |
| } |
| } |
| |
| |
| private void FixedUpdate() |
| private void FixedUpdate() |
| { |
| { |
| ZInput.FixedUpdate(Time.fixedDeltaTime); |
| ZInput.FixedUpdate(Time.fixedDeltaTime); |
| } |
| } |
| |
| |
| private void UpdateCursor() |
| private void UpdateCursor() |
| { |
| { |
| Cursor.lockState = (ZInput.IsMouseActive() ? CursorLockMode.None : CursorLockMode.Locked); |
| Cursor.lockState = (ZInput.IsMouseActive() ? CursorLockMode.None : CursorLockMode.Locked); |
| Cursor.visible = ZInput.IsMouseActive(); |
| Cursor.visible = ZInput.IsMouseActive(); |
| } |
| } |
| |
| |
| private void OnLanguageChange() |
| private void OnLanguageChange() |
| { |
| { |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| |
| |
| private void Update() |
| private void Update() |
| { |
| { |
| int num = ((Settings.FPSLimit != 29) ? Mathf.Min(Settings.FPSLimit, 60) : 60); |
| int num = ((Settings.FPSLimit != 29) ? Mathf.Min(Settings.FPSLimit, 60) : 60); |
| Application.targetFrameRate = ((Settings.ReduceBackgroundUsage && !Application.isFocused) ? Mathf.Min(30, num) : num); |
| Application.targetFrameRate = ((Settings.ReduceBackgroundUsage && !Application.isFocused) ? Mathf.Min(30, num) : num); |
| if (Terminal.m_showTests) |
| if (Terminal.m_showTests) |
| { |
| { |
| Terminal.m_testList["fps limit"] = Application.targetFrameRate.ToString(); |
| Terminal.m_testList["fps limit"] = Application.targetFrameRate.ToString(); |
| } |
| } |
| ZInput.Update(Time.deltaTime); |
| ZInput.Update(Time.deltaTime); |
| Localization.instance.ReLocalizeVisible(base.transform); |
| Localization.instance.ReLocalizeVisible(base.transform); |
| this.UpdateGamepad(); |
| this.UpdateGamepad(); |
| this.UpdateKeyboard(); |
| this.UpdateKeyboard(); |
| this.CheckPendingSteamJoinRequest(); |
| this.CheckPendingSteamJoinRequest(); |
| if (MasterClient.instance != null) |
| if (MasterClient.instance != null) |
| { |
| { |
| MasterClient.instance.Update(Time.deltaTime); |
| MasterClient.instance.Update(Time.deltaTime); |
| } |
| } |
| if (ZBroastcast.instance != null) |
| if (ZBroastcast.instance != null) |
| { |
| { |
| ZBroastcast.instance.Update(Time.deltaTime); |
| ZBroastcast.instance.Update(Time.deltaTime); |
| } |
| } |
| this.UpdateCharacterRotation(Time.deltaTime); |
| this.UpdateCharacterRotation(Time.deltaTime); |
| this.UpdateCamera(Time.deltaTime); |
| this.UpdateCamera(Time.deltaTime); |
| if (this.m_newCharacterPanel.activeInHierarchy) |
| if (this.m_newCharacterPanel.activeInHierarchy) |
| { |
| { |
| this.m_csNewCharacterDone.interactable = this.m_csNewCharacterName.text.Length >= 3; |
| this.m_csNewCharacterDone.interactable = this.m_csNewCharacterName.text.Length >= 3; |
| Navigation navigation = this.m_csNewCharacterName.navigation; |
| Navigation navigation = this.m_csNewCharacterName.navigation; |
| navigation.selectOnDown = (this.m_csNewCharacterDone.interactable ? this.m_csNewCharacterDone : this.m_csNewCharacterCancel); |
| navigation.selectOnDown = (this.m_csNewCharacterDone.interactable ? this.m_csNewCharacterDone : this.m_csNewCharacterCancel); |
| this.m_csNewCharacterName.navigation = navigation; |
| this.m_csNewCharacterName.navigation = navigation; |
| } |
| } |
| if (this.m_newCharacterPanel.activeInHierarchy) |
| if (this.m_newCharacterPanel.activeInHierarchy) |
| { |
| { |
| this.m_csNewCharacterDone.interactable = this.m_csNewCharacterName.text.Length >= 3; |
| this.m_csNewCharacterDone.interactable = this.m_csNewCharacterName.text.Length >= 3; |
| } |
| } |
| if (this.m_serverOptionsButton.gameObject.activeInHierarchy) |
| if (this.m_serverOptionsButton.gameObject.activeInHierarchy) |
| { |
| { |
| this.m_serverOptionsButton.interactable = this.m_world != null; |
| this.m_serverOptionsButton.interactable = this.m_world != null; |
| } |
| } |
| if (this.m_createWorldPanel.activeInHierarchy) |
| if (this.m_createWorldPanel.activeInHierarchy) |
| { |
| { |
| this.m_newWorldDone.interactable = this.m_newWorldName.text.Length >= 5; |
| this.m_newWorldDone.interactable = this.m_newWorldName.text.Length >= 5; |
| } |
| } |
| if (this.m_startGamePanel.activeInHierarchy) |
| if (this.m_startGamePanel.activeInHierarchy) |
| { |
| { |
| this.m_worldStart.interactable = this.CanStartServer(); |
| this.m_worldStart.interactable = this.CanStartServer(); |
| this.m_worldRemove.interactable = this.m_world != null; |
| this.m_worldRemove.interactable = this.m_world != null; |
| this.UpdatePasswordError(); |
| this.UpdatePasswordError(); |
| } |
| } |
| if (this.m_startGamePanel.activeInHierarchy) |
| if (this.m_startGamePanel.activeInHierarchy) |
| { |
| { |
| bool flag = this.m_openServerToggle.isOn && this.m_openServerToggle.interactable; |
| bool flag = this.m_openServerToggle.isOn && this.m_openServerToggle.interactable; |
| this.SetToggleState(this.m_publicServerToggle, flag); |
| this.SetToggleState(this.m_publicServerToggle, flag); |
| this.SetToggleState(this.m_crossplayServerToggle, flag); |
| this.SetToggleState(this.m_crossplayServerToggle, flag); |
| this.m_serverPassword.interactable = flag; |
| this.m_serverPassword.interactable = flag; |
| } |
| } |
| if (this.m_creditsPanel.activeInHierarchy) |
| if (this.m_creditsPanel.activeInHierarchy) |
| { |
| { |
| RectTransform rectTransform = this.m_creditsList.parent as RectTransform; |
| RectTransform rectTransform = this.m_creditsList.parent as RectTransform; |
| Vector3[] array = new Vector3[4]; |
| Vector3[] array = new Vector3[4]; |
| this.m_creditsList.GetWorldCorners(array); |
| this.m_creditsList.GetWorldCorners(array); |
| Vector3[] array2 = new Vector3[4]; |
| Vector3[] array2 = new Vector3[4]; |
| rectTransform.GetWorldCorners(array2); |
| rectTransform.GetWorldCorners(array2); |
| float num2 = array2[1].y - array2[0].y; |
| float num2 = array2[1].y - array2[0].y; |
| if ((double)array[3].y < (double)num2 * 0.5) |
| if ((double)array[3].y < (double)num2 * 0.5) |
| { |
| { |
| Vector3 position = this.m_creditsList.position; |
| Vector3 position = this.m_creditsList.position; |
| position.y += Time.deltaTime * this.m_creditsSpeed * num2; |
| position.y += Time.deltaTime * this.m_creditsSpeed * num2; |
| this.m_creditsList.position = position; |
| this.m_creditsList.position = position; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void OnGUI() |
| private void OnGUI() |
| { |
| { |
| ZInput.OnGUI(); |
| ZInput.OnGUI(); |
| } |
| } |
| |
| |
| private void SetToggleState(Toggle toggle, bool active) |
| private void SetToggleState(Toggle toggle, bool active) |
| { |
| { |
| toggle.interactable = active; |
| toggle.interactable = active; |
| Color toggleColor = this.m_toggleColor; |
| Color toggleColor = this.m_toggleColor; |
| Graphic componentInChildren = toggle.GetComponentInChildren<TMP_Text>(); |
| Graphic componentInChildren = toggle.GetComponentInChildren<TMP_Text>(); |
| if (!active) |
| if (!active) |
| { |
| { |
| float num = 0.5f; |
| float num = 0.5f; |
| float num2 = toggleColor.linear.r * 0.2126f + toggleColor.linear.g * 0.7152f + toggleColor.linear.b * 0.0722f; |
| float num2 = toggleColor.linear.r * 0.2126f + toggleColor.linear.g * 0.7152f + toggleColor.linear.b * 0.0722f; |
| num2 *= num; |
| num2 *= num; |
| toggleColor.r = (toggleColor.g = (toggleColor.b = Mathf.LinearToGammaSpace(num2))); |
| toggleColor.r = (toggleColor.g = (toggleColor.b = Mathf.LinearToGammaSpace(num2))); |
| } |
| } |
| componentInChildren.color = toggleColor; |
| componentInChildren.color = toggleColor; |
| } |
| } |
| |
| |
| private void LateUpdate() |
| private void LateUpdate() |
| { |
| { |
| if (ZInput.GetKeyDown(KeyCode.F11, true)) |
| if (ZInput.GetKeyDown(KeyCode.F11, true)) |
| { |
| { |
| GameCamera.ScreenShot(); |
| GameCamera.ScreenShot(); |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateKeyboard() |
| private void UpdateKeyboard() |
| { |
| { |
| if (ZInput.GetKeyDown(KeyCode.Return, true) && this.m_menuList.activeInHierarchy && !this.m_passwordError.gameObject.activeInHierarchy) |
| if (ZInput.GetKeyDown(KeyCode.Return, true) && this.m_menuList.activeInHierarchy && !this.m_passwordError.gameObject.activeInHierarchy) |
| { |
| { |
| if (this.m_menuSelectedButton != null) |
| if (this.m_menuSelectedButton != null) |
| { |
| { |
| this.m_menuSelectedButton.OnSubmit(null); |
| this.m_menuSelectedButton.OnSubmit(null); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.OnStartGame(); |
| this.OnStartGame(); |
| } |
| } |
| } |
| } |
| if (this.m_worldListPanel.GetComponent<UIGamePad>().IsBlocked()) |
| if (this.m_worldListPanel.GetComponent<UIGamePad>().IsBlocked()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (ZInput.GetKeyDown(KeyCode.UpArrow, true)) |
| if (ZInput.GetKeyDown(KeyCode.UpArrow, true)) |
| { |
| { |
| if (this.m_worldListPanel.activeInHierarchy) |
| if (this.m_worldListPanel.activeInHierarchy) |
| { |
| { |
| this.SetSelectedWorld(this.GetSelectedWorld() - 1, true); |
| this.SetSelectedWorld(this.GetSelectedWorld() - 1, true); |
| } |
| } |
| if (this.m_menuList.activeInHierarchy) |
| if (this.m_menuList.activeInHierarchy) |
| { |
| { |
| if (this.m_menuSelectedButton == null) |
| if (this.m_menuSelectedButton == null) |
| { |
| { |
| this.m_menuSelectedButton = this.m_menuButtons[0]; |
| this.m_menuSelectedButton = this.m_menuButtons[0]; |
| this.m_menuSelectedButton.Select(); |
| this.m_menuSelectedButton.Select(); |
| } |
| } |
| else |
| else |
| { |
| { |
| for (int i = 1; i < this.m_menuButtons.Length; i++) |
| for (int i = 1; i < this.m_menuButtons.Length; i++) |
| { |
| { |
| if (this.m_menuButtons[i] == this.m_menuSelectedButton) |
| if (this.m_menuButtons[i] == this.m_menuSelectedButton) |
| { |
| { |
| this.m_menuSelectedButton = this.m_menuButtons[i - 1]; |
| this.m_menuSelectedButton = this.m_menuButtons[i - 1]; |
| this.m_menuSelectedButton.Select(); |
| this.m_menuSelectedButton.Select(); |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| if (ZInput.GetKeyDown(KeyCode.DownArrow, true)) |
| if (ZInput.GetKeyDown(KeyCode.DownArrow, true)) |
| { |
| { |
| if (this.m_worldListPanel.activeInHierarchy) |
| if (this.m_worldListPanel.activeInHierarchy) |
| { |
| { |
| this.SetSelectedWorld(this.GetSelectedWorld() + 1, true); |
| this.SetSelectedWorld(this.GetSelectedWorld() + 1, true); |
| } |
| } |
| if (this.m_menuList.activeInHierarchy) |
| if (this.m_menuList.activeInHierarchy) |
| { |
| { |
| if (this.m_menuSelectedButton == null) |
| if (this.m_menuSelectedButton == null) |
| { |
| { |
| this.m_menuSelectedButton = this.m_menuButtons[0]; |
| this.m_menuSelectedButton = this.m_menuButtons[0]; |
| this.m_menuSelectedButton.Select(); |
| this.m_menuSelectedButton.Select(); |
| return; |
| return; |
| } |
| } |
| for (int j = 0; j < this.m_menuButtons.Length - 1; j++) |
| for (int j = 0; j < this.m_menuButtons.Length - 1; j++) |
| { |
| { |
| if (this.m_menuButtons[j] == this.m_menuSelectedButton) |
| if (this.m_menuButtons[j] == this.m_menuSelectedButton) |
| { |
| { |
| this.m_menuSelectedButton = this.m_menuButtons[j + 1]; |
| this.m_menuSelectedButton = this.m_menuButtons[j + 1]; |
| this.m_menuSelectedButton.Select(); |
| this.m_menuSelectedButton.Select(); |
| return; |
| return; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateGamepad() |
| private void UpdateGamepad() |
| { |
| { |
| if (ZInput.IsGamepadActive() && this.m_menuList.activeInHierarchy && EventSystem.current.currentSelectedGameObject == null && this.m_menuButtons != null && this.m_menuButtons.Length != 0) |
| if (ZInput.IsGamepadActive() && this.m_menuList.activeInHierarchy && EventSystem.current.currentSelectedGameObject == null && this.m_menuButtons != null && this.m_menuButtons.Length != 0) |
| { |
| { |
| base.StartCoroutine(this.SelectFirstMenuEntry(this.m_menuButtons[0])); |
| base.StartCoroutine(this.SelectFirstMenuEntry(this.m_menuButtons[0])); |
| } |
| } |
| if (!ZInput.IsGamepadActive() || this.m_worldListPanel.GetComponent<UIGamePad>().IsBlocked()) |
| if (!ZInput.IsGamepadActive() || this.m_worldListPanel.GetComponent<UIGamePad>().IsBlocked()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_worldListPanel.activeInHierarchy) |
| if (this.m_worldListPanel.activeInHierarchy) |
| { |
| { |
| if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown")) |
| if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown")) |
| { |
| { |
| this.SetSelectedWorld(this.GetSelectedWorld() + 1, true); |
| this.SetSelectedWorld(this.GetSelectedWorld() + 1, true); |
| } |
| } |
| if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp")) |
| if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp")) |
| { |
| { |
| this.SetSelectedWorld(this.GetSelectedWorld() - 1, true); |
| this.SetSelectedWorld(this.GetSelectedWorld() - 1, true); |
| } |
| } |
| if (EventSystem.current.currentSelectedGameObject == null) |
| if (EventSystem.current.currentSelectedGameObject == null) |
| { |
| { |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| } |
| } |
| } |
| } |
| if (this.m_characterSelectScreen.activeInHierarchy && !this.m_newCharacterPanel.activeInHierarchy && this.m_csLeftButton.interactable && ZInput.GetButtonDown("JoyDPadLeft")) |
| if (this.m_characterSelectScreen.activeInHierarchy && !this.m_newCharacterPanel.activeInHierarchy && this.m_csLeftButton.interactable && ZInput.GetButtonDown("JoyDPadLeft")) |
| { |
| { |
| this.OnCharacterLeft(); |
| this.OnCharacterLeft(); |
| } |
| } |
| if (this.m_characterSelectScreen.activeInHierarchy && !this.m_newCharacterPanel.activeInHierarchy && this.m_csRightButton.interactable && ZInput.GetButtonDown("JoyDPadRight")) |
| if (this.m_characterSelectScreen.activeInHierarchy && !this.m_newCharacterPanel.activeInHierarchy && this.m_csRightButton.interactable && ZInput.GetButtonDown("JoyDPadRight")) |
| { |
| { |
| this.OnCharacterRight(); |
| this.OnCharacterRight(); |
| } |
| } |
| if (this.m_patchLogScroll.gameObject.activeInHierarchy) |
| if (this.m_patchLogScroll.gameObject.activeInHierarchy) |
| { |
| { |
| this.m_patchLogScroll.value -= ZInput.GetJoyRightStickY() * 0.02f; |
| this.m_patchLogScroll.value -= ZInput.GetJoyRightStickY() * 0.02f; |
| } |
| } |
| } |
| } |
| |
| |
| private IEnumerator SelectFirstMenuEntry(Button button) |
| private IEnumerator SelectFirstMenuEntry(Button button) |
| { |
| { |
| if (!this.m_menuList.activeInHierarchy) |
| if (!this.m_menuList.activeInHierarchy) |
| { |
| { |
| yield break; |
| yield break; |
| } |
| } |
| if (Event.current != null) |
| if (Event.current != null) |
| { |
| { |
| Event.current.Use(); |
| Event.current.Use(); |
| } |
| } |
| yield return null; |
| yield return null; |
| yield return null; |
| yield return null; |
| if (UnifiedPopup.IsVisible()) |
| if (UnifiedPopup.IsVisible()) |
| { |
| { |
| UnifiedPopup.SetFocus(); |
| UnifiedPopup.SetFocus(); |
| yield break; |
| yield break; |
| } |
| } |
| this.m_menuSelectedButton = button; |
| this.m_menuSelectedButton = button; |
| this.m_menuSelectedButton.Select(); |
| this.m_menuSelectedButton.Select(); |
| yield break; |
| yield break; |
| } |
| } |
| |
| |
| private void CheckPendingSteamJoinRequest() |
| private void CheckPendingSteamJoinRequest() |
| { |
| { |
| ServerJoinData serverJoinData; |
| ServerJoinData serverJoinData; |
| if (ZSteamMatchmaking.instance != null && ZSteamMatchmaking.instance.GetJoinHost(out serverJoinData)) |
| if (ZSteamMatchmaking.instance != null && ZSteamMatchmaking.instance.GetJoinHost(out serverJoinData)) |
| { |
| { |
| if (PrivilegeManager.CanAccessOnlineMultiplayer) |
| if (PrivilegeManager.CanAccessOnlineMultiplayer) |
| { |
| { |
| this.m_queuedJoinServer = serverJoinData; |
| this.m_queuedJoinServer = serverJoinData; |
| if (this.m_serverListPanel.activeInHierarchy) |
| if (this.m_serverListPanel.activeInHierarchy) |
| { |
| { |
| this.m_joinServer = new ServerStatus(this.m_queuedJoinServer); |
| this.m_joinServer = new ServerStatus(this.m_queuedJoinServer); |
| this.m_queuedJoinServer = null; |
| this.m_queuedJoinServer = null; |
| this.JoinServer(); |
| this.JoinServer(); |
| return; |
| return; |
| } |
| } |
| this.HideAll(); |
| this.HideAll(); |
| this.ShowCharacterSelection(); |
| this.ShowCharacterSelection(); |
| return; |
| return; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| this.ShowOnlineMultiplayerPrivilegeWarning(); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateCharacterRotation(float dt) |
| private void UpdateCharacterRotation(float dt) |
| { |
| { |
| if (this.m_playerInstance == null) |
| if (this.m_playerInstance == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.m_characterSelectScreen.activeInHierarchy) |
| if (!this.m_characterSelectScreen.activeInHierarchy) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (ZInput.GetMouseButton(0) && !EventSystem.current.IsPointerOverGameObject()) |
| if (ZInput.GetMouseButton(0) && !EventSystem.current.IsPointerOverGameObject()) |
| { |
| { |
| float x = ZInput.GetMouseDelta().x; |
| float x = ZInput.GetMouseDelta().x; |
| this.m_playerInstance.transform.Rotate(0f, -x * this.m_characterRotateSpeed, 0f); |
| this.m_playerInstance.transform.Rotate(0f, -x * this.m_characterRotateSpeed, 0f); |
| } |
| } |
| float joyRightStickX = ZInput.GetJoyRightStickX(); |
| float joyRightStickX = ZInput.GetJoyRightStickX(); |
| if (joyRightStickX != 0f) |
| if (joyRightStickX != 0f) |
| { |
| { |
| this.m_playerInstance.transform.Rotate(0f, -joyRightStickX * this.m_characterRotateSpeedGamepad * dt, 0f); |
| this.m_playerInstance.transform.Rotate(0f, -joyRightStickX * this.m_characterRotateSpeedGamepad * dt, 0f); |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdatePasswordError() |
| private void UpdatePasswordError() |
| { |
| { |
| string text = ""; |
| string text = ""; |
| if (this.NeedPassword()) |
| if (this.NeedPassword()) |
| { |
| { |
| text = this.GetPublicPasswordError(this.m_serverPassword.text, this.m_world); |
| text = this.GetPublicPasswordError(this.m_serverPassword.text, this.m_world); |
| } |
| } |
| this.m_passwordError.text = text; |
| this.m_passwordError.text = text; |
| } |
| } |
| |
| |
| private bool NeedPassword() |
| private bool NeedPassword() |
| { |
| { |
| return (this.m_publicServerToggle.isOn | this.m_crossplayServerToggle.isOn) & this.m_openServerToggle.isOn; |
| return (this.m_publicServerToggle.isOn | this.m_crossplayServerToggle.isOn) & this.m_openServerToggle.isOn; |
| } |
| } |
| |
| |
| private string GetPublicPasswordError(string password, World world) |
| private string GetPublicPasswordError(string password, World world) |
| { |
| { |
| if (password.Length < this.m_minimumPasswordLength) |
| if (password.Length < this.m_minimumPasswordLength) |
| { |
| { |
| return Localization.instance.Localize("$menu_passwordshort"); |
| return Localization.instance.Localize("$menu_passwordshort"); |
| } |
| } |
| if (world != null && (world.m_name.Contains(password) || world.m_seedName.Contains(password))) |
| if (world != null && (world.m_name.Contains(password) || world.m_seedName.Contains(password))) |
| { |
| { |
| return Localization.instance.Localize("$menu_passwordinvalid"); |
| return Localization.instance.Localize("$menu_passwordinvalid"); |
| } |
| } |
| return ""; |
| return ""; |
| } |
| } |
| |
| |
| private bool IsPublicPasswordValid(string password, World world) |
| private bool IsPublicPasswordValid(string password, World world) |
| { |
| { |
| return password.Length >= this.m_minimumPasswordLength && !world.m_name.Contains(password) && !world.m_seedName.Contains(password); |
| return password.Length >= this.m_minimumPasswordLength && !world.m_name.Contains(password) && !world.m_seedName.Contains(password); |
| } |
| } |
| |
| |
| private bool CanStartServer() |
| private bool CanStartServer() |
| { |
| { |
| if (this.m_world == null) |
| if (this.m_world == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| switch (this.m_world.m_dataError) |
| switch (this.m_world.m_dataError) |
| { |
| { |
| case World.SaveDataError.None: |
| case World.SaveDataError.None: |
| case World.SaveDataError.LoadError: |
| case World.SaveDataError.LoadError: |
| case World.SaveDataError.Corrupt: |
| case World.SaveDataError.Corrupt: |
| case World.SaveDataError.MissingMeta: |
| case World.SaveDataError.MissingMeta: |
| return !this.NeedPassword() || this.IsPublicPasswordValid(this.m_serverPassword.text, this.m_world); |
| return !this.NeedPassword() || this.IsPublicPasswordValid(this.m_serverPassword.text, this.m_world); |
| default: |
| default: |
| return false; |
| return false; |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateCamera(float dt) |
| private void UpdateCamera(float dt) |
| { |
| { |
| Transform transform = this.m_cameraMarkerMain; |
| Transform transform = this.m_cameraMarkerMain; |
| if (this.m_characterSelectScreen.activeSelf) |
| if (this.m_characterSelectScreen.activeSelf) |
| { |
| { |
| transform = this.m_cameraMarkerCharacter; |
| transform = this.m_cameraMarkerCharacter; |
| } |
| } |
| else if (this.m_creditsPanel.activeSelf) |
| else if (this.m_creditsPanel.activeSelf) |
| { |
| { |
| transform = this.m_cameraMarkerCredits; |
| transform = this.m_cameraMarkerCredits; |
| } |
| } |
| else if (this.m_startGamePanel.activeSelf) |
| else if (this.m_startGamePanel.activeSelf) |
| { |
| { |
| transform = this.m_cameraMarkerGame; |
| transform = this.m_cameraMarkerGame; |
| } |
| } |
| else if (this.m_manageSavesMenu.IsVisible()) |
| else if (this.m_manageSavesMenu.IsVisible()) |
| { |
| { |
| transform = this.m_cameraMarkerSaves; |
| transform = this.m_cameraMarkerSaves; |
| } |
| } |
| this.m_mainCamera.transform.position = Vector3.SmoothDamp(this.m_mainCamera.transform.position, transform.position, ref this.camSpeed, 1.5f, 1000f, dt); |
| this.m_mainCamera.transform.position = Vector3.SmoothDamp(this.m_mainCamera.transform.position, transform.position, ref this.camSpeed, 1.5f, 1000f, dt); |
| Vector3 vector = Vector3.SmoothDamp(this.m_mainCamera.transform.forward, transform.forward, ref this.camRotSpeed, 1.5f, 1000f, dt); |
| Vector3 vector = Vector3.SmoothDamp(this.m_mainCamera.transform.forward, transform.forward, ref this.camRotSpeed, 1.5f, 1000f, dt); |
| vector.Normalize(); |
| vector.Normalize(); |
| this.m_mainCamera.transform.rotation = Quaternion.LookRotation(vector); |
| this.m_mainCamera.transform.rotation = Quaternion.LookRotation(vector); |
| } |
| } |
| |
| |
| public void ShowCloudQuotaWarning() |
| public void ShowCloudQuotaWarning() |
| { |
| { |
| UnifiedPopup.Push(new WarningPopup("$menu_cloudstoragefull", "$menu_cloudstoragefulloperationfailed", delegate |
| UnifiedPopup.Push(new WarningPopup("$menu_cloudstoragefull", "$menu_cloudstoragefulloperationfailed", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| } |
| } |
| |
| |
| public void ShowCloudQuotaWorldDialog() |
| public void ShowCloudQuotaWorldDialog() |
| { |
| { |
| UnifiedPopup.Push(new YesNoPopup("$menu_cloudstoragefull", "$menu_cloudstoragefullworldprompt", delegate |
| UnifiedPopup.Push(new YesNoPopup("$menu_cloudstoragefull", "$menu_cloudstoragefullworldprompt", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| this.OnNewWorldDone(true); |
| this.OnNewWorldDone(true); |
| }, delegate |
| }, delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| } |
| } |
| |
| |
| public void ShowCloudQuotaCharacterDialog() |
| public void ShowCloudQuotaCharacterDialog() |
| { |
| { |
| UnifiedPopup.Push(new YesNoPopup("$menu_cloudstoragefull", "$menu_cloudstoragefullcharacterprompt", delegate |
| UnifiedPopup.Push(new YesNoPopup("$menu_cloudstoragefull", "$menu_cloudstoragefullcharacterprompt", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| this.OnNewCharacterDone(true); |
| this.OnNewCharacterDone(true); |
| }, delegate |
| }, delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| }, true)); |
| }, true)); |
| } |
| } |
| |
| |
| public void OnManageSaves(int index) |
| public void OnManageSaves(int index) |
| { |
| { |
| this.HideAll(); |
| this.HideAll(); |
| if (index == 0) |
| if (index == 0) |
| { |
| { |
| this.m_manageSavesMenu.Open(SaveDataType.World, (this.m_world != null) ? this.m_world.m_fileName : null, new ManageSavesMenu.ClosedCallback(this.ShowStartGame), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| this.m_manageSavesMenu.Open(SaveDataType.World, (this.m_world != null) ? this.m_world.m_fileName : null, new ManageSavesMenu.ClosedCallback(this.ShowStartGame), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| return; |
| return; |
| } |
| } |
| if (index != 1) |
| if (index != 1) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_manageSavesMenu.Open(SaveDataType.Character, (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count && this.m_profiles[this.m_profileIndex] != null) ? this.m_profiles[this.m_profileIndex].m_filename : null, new ManageSavesMenu.ClosedCallback(this.ShowCharacterSelection), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| this.m_manageSavesMenu.Open(SaveDataType.Character, (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count && this.m_profiles[this.m_profileIndex] != null) ? this.m_profiles[this.m_profileIndex].m_filename : null, new ManageSavesMenu.ClosedCallback(this.ShowCharacterSelection), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| } |
| } |
| |
| |
| private void OnSavesModified(SaveDataType dataType) |
| private void OnSavesModified(SaveDataType dataType) |
| { |
| { |
| if (dataType == SaveDataType.World) |
| if (dataType == SaveDataType.World) |
| { |
| { |
| SaveSystem.ClearWorldListCache(true); |
| SaveSystem.ClearWorldListCache(true); |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| return; |
| return; |
| } |
| } |
| if (dataType != SaveDataType.Character) |
| if (dataType != SaveDataType.Character) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| string text = null; |
| string text = null; |
| if (this.m_profileIndex < this.m_profiles.Count && this.m_profileIndex >= 0) |
| if (this.m_profileIndex < this.m_profiles.Count && this.m_profileIndex >= 0) |
| { |
| { |
| text = this.m_profiles[this.m_profileIndex].GetFilename(); |
| text = this.m_profiles[this.m_profileIndex].GetFilename(); |
| } |
| } |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.SetSelectedProfile(text); |
| this.SetSelectedProfile(text); |
| this.m_manageSavesMenu.Open(dataType, new ManageSavesMenu.ClosedCallback(this.ShowCharacterSelection), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| this.m_manageSavesMenu.Open(dataType, new ManageSavesMenu.ClosedCallback(this.ShowCharacterSelection), new ManageSavesMenu.SavesModifiedCallback(this.OnSavesModified)); |
| } |
| } |
| |
| |
| private void UpdateCharacterList() |
| private void UpdateCharacterList() |
| { |
| { |
| if (this.m_profiles == null) |
| if (this.m_profiles == null) |
| { |
| { |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| } |
| } |
| if (this.m_profileIndex >= this.m_profiles.Count) |
| if (this.m_profileIndex >= this.m_profiles.Count) |
| { |
| { |
| this.m_profileIndex = this.m_profiles.Count - 1; |
| this.m_profileIndex = this.m_profiles.Count - 1; |
| } |
| } |
| this.m_csRemoveButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csRemoveButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csStartButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csStartButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csNewButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csNewButton.gameObject.SetActive(this.m_profiles.Count > 0); |
| this.m_csNewBigButton.gameObject.SetActive(this.m_profiles.Count == 0); |
| this.m_csNewBigButton.gameObject.SetActive(this.m_profiles.Count == 0); |
| this.m_csLeftButton.interactable = this.m_profileIndex > 0; |
| this.m_csLeftButton.interactable = this.m_profileIndex > 0; |
| this.m_csRightButton.interactable = this.m_profileIndex < this.m_profiles.Count - 1; |
| this.m_csRightButton.interactable = this.m_profileIndex < this.m_profiles.Count - 1; |
| if (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count) |
| if (this.m_profileIndex >= 0 && this.m_profileIndex < this.m_profiles.Count) |
| { |
| { |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| if (playerProfile.GetName().ToLower() == playerProfile.m_filename.ToLower()) |
| if (playerProfile.GetName().ToLower() == playerProfile.m_filename.ToLower()) |
| { |
| { |
| this.m_csName.text = playerProfile.GetName(); |
| this.m_csName.text = playerProfile.GetName(); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_csName.text = playerProfile.GetName() + " (" + playerProfile.m_filename + ")"; |
| this.m_csName.text = playerProfile.GetName() + " (" + playerProfile.m_filename + ")"; |
| } |
| } |
| this.m_csName.gameObject.SetActive(true); |
| this.m_csName.gameObject.SetActive(true); |
| this.m_csFileSource.gameObject.SetActive(true); |
| this.m_csFileSource.gameObject.SetActive(true); |
| this.m_csFileSource.text = Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)); |
| this.m_csFileSource.text = Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)); |
| this.m_csSourceInfo.text = Localization.instance.Localize(((playerProfile.m_fileSource == FileHelpers.FileSource.Legacy) ? "$menu_legacynotice \n\n" : "") + ((!FileHelpers.m_cloudEnabled) ? "$menu_cloudsavesdisabled" : "")); |
| this.m_csSourceInfo.text = Localization.instance.Localize(((playerProfile.m_fileSource == FileHelpers.FileSource.Legacy) ? "$menu_legacynotice \n\n" : "") + ((!FileHelpers.m_cloudEnabled) ? "$menu_cloudsavesdisabled" : "")); |
| Transform transform = this.m_csFileSource.transform.Find("source_cloud"); |
| Transform transform = this.m_csFileSource.transform.Find("source_cloud"); |
| if (transform != null) |
| if (transform != null) |
| { |
| { |
| transform.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Cloud); |
| transform.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Cloud); |
| } |
| } |
| Transform transform2 = this.m_csFileSource.transform.Find("source_local"); |
| Transform transform2 = this.m_csFileSource.transform.Find("source_local"); |
| if (transform2 != null) |
| if (transform2 != null) |
| { |
| { |
| transform2.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Local); |
| transform2.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Local); |
| } |
| } |
| Transform transform3 = this.m_csFileSource.transform.Find("source_legacy"); |
| Transform transform3 = this.m_csFileSource.transform.Find("source_legacy"); |
| if (transform3 != null) |
| if (transform3 != null) |
| { |
| { |
| transform3.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Legacy); |
| transform3.gameObject.SetActive(playerProfile.m_fileSource == FileHelpers.FileSource.Legacy); |
| } |
| } |
| this.SetupCharacterPreview(playerProfile); |
| this.SetupCharacterPreview(playerProfile); |
| return; |
| return; |
| } |
| } |
| this.m_csName.gameObject.SetActive(false); |
| this.m_csName.gameObject.SetActive(false); |
| this.m_csFileSource.gameObject.SetActive(false); |
| this.m_csFileSource.gameObject.SetActive(false); |
| this.ClearCharacterPreview(); |
| this.ClearCharacterPreview(); |
| } |
| } |
| |
| |
| private void SetSelectedProfile(string filename) |
| private void SetSelectedProfile(string filename) |
| { |
| { |
| if (this.m_profiles == null) |
| if (this.m_profiles == null) |
| { |
| { |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| this.m_profiles = SaveSystem.GetAllPlayerProfiles(); |
| } |
| } |
| this.m_profileIndex = 0; |
| this.m_profileIndex = 0; |
| if (filename != null) |
| if (filename != null) |
| { |
| { |
| for (int i = 0; i < this.m_profiles.Count; i++) |
| for (int i = 0; i < this.m_profiles.Count; i++) |
| { |
| { |
| if (this.m_profiles[i].GetFilename() == filename) |
| if (this.m_profiles[i].GetFilename() == filename) |
| { |
| { |
| this.m_profileIndex = i; |
| this.m_profileIndex = i; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| |
| |
| public void OnNewCharacterDone(bool forceLocal) |
| public void OnNewCharacterDone(bool forceLocal) |
| { |
| { |
| string text = this.m_csNewCharacterName.text; |
| string text = this.m_csNewCharacterName.text; |
| string text2 = text.ToLower(); |
| string text2 = text.ToLower(); |
| PlayerProfile playerProfile = new PlayerProfile(text2, FileHelpers.FileSource.Auto); |
| PlayerProfile playerProfile = new PlayerProfile(text2, FileHelpers.FileSource.Auto); |
| if (forceLocal) |
| if (forceLocal) |
| { |
| { |
| playerProfile.m_fileSource = FileHelpers.FileSource.Local; |
| playerProfile.m_fileSource = FileHelpers.FileSource.Local; |
| } |
| } |
| if (playerProfile.m_fileSource == FileHelpers.FileSource.Cloud && FileHelpers.OperationExceedsCloudCapacity(1048576UL * 3UL)) |
| if (playerProfile.m_fileSource == FileHelpers.FileSource.Cloud && FileHelpers.OperationExceedsCloudCapacity(1048576UL * 3UL)) |
| { |
| { |
| this.ShowCloudQuotaCharacterDialog(); |
| this.ShowCloudQuotaCharacterDialog(); |
| ZLog.LogWarning("The character save operation may exceed the cloud save quota and has therefore been aborted! Prompt shown to user."); |
| ZLog.LogWarning("The character save operation may exceed the cloud save quota and has therefore been aborted! Prompt shown to user."); |
| return; |
| return; |
| } |
| } |
| if (PlayerProfile.HaveProfile(text2)) |
| if (PlayerProfile.HaveProfile(text2)) |
| { |
| { |
| this.m_newCharacterError.SetActive(true); |
| this.m_newCharacterError.SetActive(true); |
| return; |
| return; |
| } |
| } |
| Player component = this.m_playerInstance.GetComponent<Player>(); |
| Player component = this.m_playerInstance.GetComponent<Player>(); |
| component.GiveDefaultItems(); |
| component.GiveDefaultItems(); |
| playerProfile.SetName(text); |
| playerProfile.SetName(text); |
| playerProfile.SavePlayerData(component); |
| playerProfile.SavePlayerData(component); |
| playerProfile.Save(); |
| playerProfile.Save(); |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_newCharacterPanel.SetActive(false); |
| this.m_newCharacterPanel.SetActive(false); |
| this.m_profiles = null; |
| this.m_profiles = null; |
| this.SetSelectedProfile(text2); |
| this.SetSelectedProfile(text2); |
| this.m_csNewCharacterName.text = ""; |
| this.m_csNewCharacterName.text = ""; |
| Gogan.LogEvent("Menu", "NewCharacter", text, 0L); |
| Gogan.LogEvent("Menu", "NewCharacter", text, 0L); |
| } |
| } |
| |
| |
| public void OnNewCharacterCancel() |
| public void OnNewCharacterCancel() |
| { |
| { |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_selectCharacterPanel.SetActive(true); |
| this.m_newCharacterPanel.SetActive(false); |
| this.m_newCharacterPanel.SetActive(false); |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| |
| |
| public void OnCharacterNew() |
| public void OnCharacterNew() |
| { |
| { |
| this.m_newCharacterPanel.SetActive(true); |
| this.m_newCharacterPanel.SetActive(true); |
| this.m_selectCharacterPanel.SetActive(false); |
| this.m_selectCharacterPanel.SetActive(false); |
| this.m_newCharacterError.SetActive(false); |
| this.m_newCharacterError.SetActive(false); |
| this.SetupCharacterPreview(null); |
| this.SetupCharacterPreview(null); |
| Gogan.LogEvent("Screen", "Enter", "CreateCharacter", 0L); |
| Gogan.LogEvent("Screen", "Enter", "CreateCharacter", 0L); |
| } |
| } |
| |
| |
| public void OnCharacterRemove() |
| public void OnCharacterRemove() |
| { |
| { |
| if (this.m_profileIndex < 0 || this.m_profileIndex >= this.m_profiles.Count) |
| if (this.m_profileIndex < 0 || this.m_profileIndex >= this.m_profiles.Count) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| this.m_removeCharacterName.text = playerProfile.GetName() + " (" + Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)) + ")"; |
| this.m_removeCharacterName.text = playerProfile.GetName() + " (" + Localization.instance.Localize(FileHelpers.GetSourceString(playerProfile.m_fileSource)) + ")"; |
| this.m_tempRemoveCharacterName = playerProfile.GetFilename(); |
| this.m_tempRemoveCharacterName = playerProfile.GetFilename(); |
| this.m_tempRemoveCharacterSource = playerProfile.m_fileSource; |
| this.m_tempRemoveCharacterSource = playerProfile.m_fileSource; |
| this.m_tempRemoveCharacterIndex = this.m_profileIndex; |
| this.m_tempRemoveCharacterIndex = this.m_profileIndex; |
| this.m_removeCharacterDialog.SetActive(true); |
| this.m_removeCharacterDialog.SetActive(true); |
| } |
| } |
| |
| |
| public void OnButtonRemoveCharacterYes() |
| public void OnButtonRemoveCharacterYes() |
| { |
| { |
| ZLog.Log("Remove character"); |
| ZLog.Log("Remove character"); |
| PlayerProfile.RemoveProfile(this.m_tempRemoveCharacterName, this.m_tempRemoveCharacterSource); |
| PlayerProfile.RemoveProfile(this.m_tempRemoveCharacterName, this.m_tempRemoveCharacterSource); |
| this.m_profiles.RemoveAt(this.m_tempRemoveCharacterIndex); |
| this.m_profiles.RemoveAt(this.m_tempRemoveCharacterIndex); |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| this.m_removeCharacterDialog.SetActive(false); |
| this.m_removeCharacterDialog.SetActive(false); |
| } |
| } |
| |
| |
| public void OnButtonRemoveCharacterNo() |
| public void OnButtonRemoveCharacterNo() |
| { |
| { |
| this.m_removeCharacterDialog.SetActive(false); |
| this.m_removeCharacterDialog.SetActive(false); |
| } |
| } |
| |
| |
| public void OnCharacterLeft() |
| public void OnCharacterLeft() |
| { |
| { |
| if (this.m_profileIndex > 0) |
| if (this.m_profileIndex > 0) |
| { |
| { |
| this.m_profileIndex--; |
| this.m_profileIndex--; |
| } |
| } |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| |
| |
| public void OnCharacterRight() |
| public void OnCharacterRight() |
| { |
| { |
| if (this.m_profileIndex < this.m_profiles.Count - 1) |
| if (this.m_profileIndex < this.m_profiles.Count - 1) |
| { |
| { |
| this.m_profileIndex++; |
| this.m_profileIndex++; |
| } |
| } |
| this.UpdateCharacterList(); |
| this.UpdateCharacterList(); |
| } |
| } |
| |
| |
| public void OnCharacterStart() |
| public void OnCharacterStart() |
| { |
| { |
| ZLog.Log("OnCharacterStart"); |
| ZLog.Log("OnCharacterStart"); |
| if (this.m_profileIndex < 0 || this.m_profileIndex >= this.m_profiles.Count) |
| if (this.m_profileIndex < 0 || this.m_profileIndex >= this.m_profiles.Count) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| PlayerProfile playerProfile = this.m_profiles[this.m_profileIndex]; |
| PlayerPrefs.SetString("profile", playerProfile.GetFilename()); |
| PlayerPrefs.SetString("profile", playerProfile.GetFilename()); |
| Game.SetProfile(playerProfile.GetFilename(), playerProfile.m_fileSource); |
| Game.SetProfile(playerProfile.GetFilename(), playerProfile.m_fileSource); |
| this.m_characterSelectScreen.SetActive(false); |
| this.m_characterSelectScreen.SetActive(false); |
| if (this.m_queuedJoinServer != null) |
| if (this.m_queuedJoinServer != null) |
| { |
| { |
| this.m_joinServer = new ServerStatus(this.m_queuedJoinServer); |
| this.m_joinServer = new ServerStatus(this.m_queuedJoinServer); |
| this.m_queuedJoinServer = null; |
| this.m_queuedJoinServer = null; |
| this.JoinServer(); |
| this.JoinServer(); |
| return; |
| return; |
| } |
| } |
| this.ShowStartGame(); |
| this.ShowStartGame(); |
| if (this.m_worlds.Count == 0) |
| if (this.m_worlds.Count == 0) |
| { |
| { |
| this.OnWorldNew(); |
| this.OnWorldNew(); |
| } |
| } |
| } |
| } |
| |
| |
| private void TransitionToMainScene() |
| private void TransitionToMainScene() |
| { |
| { |
| this.m_menuAnimator.SetTrigger("FadeOut"); |
| this.m_menuAnimator.SetTrigger("FadeOut"); |
| FejdStartup.retries = 0; |
| FejdStartup.retries = 0; |
| base.Invoke("LoadMainSceneIfBackendSelected", 1.5f); |
| base.Invoke("LoadMainSceneIfBackendSelected", 1.5f); |
| } |
| } |
| |
| |
| private void LoadMainSceneIfBackendSelected() |
| private void LoadMainSceneIfBackendSelected() |
| { |
| { |
| if (this.m_startingWorld || ZNet.HasServerHost()) |
| if (this.m_startingWorld || ZNet.HasServerHost()) |
| { |
| { |
| ZLog.Log("Loading main scene"); |
| ZLog.Log("Loading main scene"); |
| this.LoadMainScene(); |
| this.LoadMainScene(); |
| return; |
| return; |
| } |
| } |
| FejdStartup.retries++; |
| FejdStartup.retries++; |
| if (FejdStartup.retries > 50) |
| if (FejdStartup.retries > 50) |
| { |
| { |
| ZLog.Log("Max retries reached, reloading startup scene with connection error"); |
| ZLog.Log("Max retries reached, reloading startup scene with connection error"); |
| ZNet.SetExternalError(ZNet.ConnectionStatus.ErrorConnectFailed); |
| ZNet.SetExternalError(ZNet.ConnectionStatus.ErrorConnectFailed); |
| this.m_menuAnimator.SetTrigger("FadeIn"); |
| this.m_menuAnimator.SetTrigger("FadeIn"); |
| this.ShowConnectError(ZNet.ConnectionStatus.ErrorConnectFailed); |
| this.ShowConnectError(ZNet.ConnectionStatus.ErrorConnectFailed); |
| return; |
| return; |
| } |
| } |
| base.Invoke("LoadMainSceneIfBackendSelected", 0.25f); |
| base.Invoke("LoadMainSceneIfBackendSelected", 0.25f); |
| ZLog.Log("Backend not retreived yet, checking again in 0.25 seconds..."); |
| ZLog.Log("Backend not retreived yet, checking again in 0.25 seconds..."); |
| } |
| } |
| |
| |
| private void LoadMainScene() |
| private void LoadMainScene() |
| { |
| { |
| this.m_loading.SetActive(true); |
| this.m_loading.SetActive(true); |
| SceneManager.LoadScene(this.m_mainScene, LoadSceneMode.Single); |
| SceneManager.LoadScene(this.m_mainScene, LoadSceneMode.Single); |
| this.m_startingWorld = false; |
| this.m_startingWorld = false; |
| } |
| } |
| |
| |
| public void OnButtonSettings() |
| public void OnButtonSettings() |
| { |
| { |
| this.m_mainMenu.SetActive(false); |
| this.m_mainMenu.SetActive(false); |
| this.m_settingsPopup = UnityEngine.Object.Instantiate<GameObject>(this.m_settingsPrefab, base.transform); |
| this.m_settingsPopup = UnityEngine.Object.Instantiate<GameObject>(this.m_settingsPrefab, base.transform); |
| this.m_settingsPopup.GetComponent<Settings>().SettingsPopupDestroyed += delegate |
| this.m_settingsPopup.GetComponent<Settings>().SettingsPopupDestroyed += delegate |
| { |
| { |
| GameObject mainMenu = this.m_mainMenu; |
| GameObject mainMenu = this.m_mainMenu; |
| if (mainMenu == null) |
| if (mainMenu == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| mainMenu.SetActive(true); |
| mainMenu.SetActive(true); |
| }; |
| }; |
| } |
| } |
| |
| |
| public void OnButtonFeedback() |
| public void OnButtonFeedback() |
| { |
| { |
| UnityEngine.Object.Instantiate<GameObject>(this.m_feedbackPrefab, base.transform); |
| UnityEngine.Object.Instantiate<GameObject>(this.m_feedbackPrefab, base.transform); |
| } |
| } |
| |
| |
| public void OnButtonTwitter() |
| public void OnButtonTwitter() |
| { |
| { |
| Application.OpenURL("https://twitter.com/valheimgame"); |
| Application.OpenURL("https://twitter.com/valheimgame"); |
| } |
| } |
| |
| |
| public void OnButtonWebPage() |
| public void OnButtonWebPage() |
| { |
| { |
| Application.OpenURL("http://valheimgame.com/"); |
| Application.OpenURL("http://valheimgame.com/"); |
| } |
| } |
| |
| |
| public void OnButtonDiscord() |
| public void OnButtonDiscord() |
| { |
| { |
| Application.OpenURL("https://discord.gg/44qXMJH"); |
| Application.OpenURL("https://discord.gg/44qXMJH"); |
| } |
| } |
| |
| |
| public void OnButtonFacebook() |
| public void OnButtonFacebook() |
| { |
| { |
| Application.OpenURL("https://www.facebook.com/valheimgame/"); |
| Application.OpenURL("https://www.facebook.com/valheimgame/"); |
| } |
| } |
| |
| |
| public void OnButtonShowLog() |
| public void OnButtonShowLog() |
| { |
| { |
| Application.OpenURL(Application.persistentDataPath + "/"); |
| Application.OpenURL(Application.persistentDataPath + "/"); |
| } |
| } |
| |
| |
| private bool AcceptedNDA() |
| private bool AcceptedNDA() |
| { |
| { |
| return PlayerPrefs.GetInt("accepted_nda", 0) == 1; |
| return PlayerPrefs.GetInt("accepted_nda", 0) == 1; |
| } |
| } |
| |
| |
| public void OnButtonNDAAccept() |
| public void OnButtonNDAAccept() |
| { |
| { |
| PlayerPrefs.SetInt("accepted_nda", 1); |
| PlayerPrefs.SetInt("accepted_nda", 1); |
| this.m_ndaPanel.SetActive(false); |
| this.m_ndaPanel.SetActive(false); |
| this.m_mainMenu.SetActive(true); |
| this.m_mainMenu.SetActive(true); |
| } |
| } |
| |
| |
| public void OnButtonNDADecline() |
| public void OnButtonNDADecline() |
| { |
| { |
| Application.Quit(); |
| Application.Quit(); |
| } |
| } |
| |
| |
| public void OnConnectionFailedOk() |
| public void OnConnectionFailedOk() |
| { |
| { |
| this.m_connectionFailedPanel.SetActive(false); |
| this.m_connectionFailedPanel.SetActive(false); |
| } |
| } |
| |
| |
| public Player GetPreviewPlayer() |
| public Player GetPreviewPlayer() |
| { |
| { |
| if (this.m_playerInstance != null) |
| if (this.m_playerInstance != null) |
| { |
| { |
| return this.m_playerInstance.GetComponent<Player>(); |
| return this.m_playerInstance.GetComponent<Player>(); |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| private void ClearCharacterPreview() |
| private void ClearCharacterPreview() |
| { |
| { |
| if (this.m_playerInstance) |
| if (this.m_playerInstance) |
| { |
| { |
| UnityEngine.Object.Instantiate<GameObject>(this.m_changeEffectPrefab, this.m_characterPreviewPoint.position, this.m_characterPreviewPoint.rotation); |
| UnityEngine.Object.Instantiate<GameObject>(this.m_changeEffectPrefab, this.m_characterPreviewPoint.position, this.m_characterPreviewPoint.rotation); |
| UnityEngine.Object.Destroy(this.m_playerInstance); |
| UnityEngine.Object.Destroy(this.m_playerInstance); |
| this.m_playerInstance = null; |
| this.m_playerInstance = null; |
| } |
| } |
| } |
| } |
| |
| |
| private void SetupCharacterPreview(PlayerProfile profile) |
| private void SetupCharacterPreview(PlayerProfile profile) |
| { |
| { |
| this.ClearCharacterPreview(); |
| this.ClearCharacterPreview(); |
| ZNetView.m_forceDisableInit = true; |
| ZNetView.m_forceDisableInit = true; |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_playerPrefab, this.m_characterPreviewPoint.position, this.m_characterPreviewPoint.rotation); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_playerPrefab, this.m_characterPreviewPoint.position, this.m_characterPreviewPoint.rotation); |
| ZNetView.m_forceDisableInit = false; |
| ZNetView.m_forceDisableInit = false; |
| UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>()); |
| UnityEngine.Object.Destroy(gameObject.GetComponent<Rigidbody>()); |
| Animator[] componentsInChildren = gameObject.GetComponentsInChildren<Animator>(); |
| Animator[] componentsInChildren = gameObject.GetComponentsInChildren<Animator>(); |
| for (int i = 0; i < componentsInChildren.Length; i++) |
| for (int i = 0; i < componentsInChildren.Length; i++) |
| { |
| { |
| componentsInChildren[i].updateMode = AnimatorUpdateMode.Normal; |
| componentsInChildren[i].updateMode = AnimatorUpdateMode.Normal; |
| } |
| } |
| Player component = gameObject.GetComponent<Player>(); |
| Player component = gameObject.GetComponent<Player>(); |
| if (profile != null) |
| if (profile != null) |
| { |
| { |
| try |
| try |
| { |
| { |
| profile.LoadPlayerData(component); |
| profile.LoadPlayerData(component); |
| } |
| } |
| catch (Exception ex) |
| catch (Exception ex) |
| { |
| { |
| Debug.LogWarning("Error loading player data: " + profile.GetPath() + ", error: " + ex.Message); |
| Debug.LogWarning("Error loading player data: " + profile.GetPath() + ", error: " + ex.Message); |
| } |
| } |
| } |
| } |
| this.m_playerInstance = gameObject; |
| this.m_playerInstance = gameObject; |
| } |
| } |
| |
| |
| public void SetServerToJoin(ServerStatus serverData) |
| public void SetServerToJoin(ServerStatus serverData) |
| { |
| { |
| this.m_joinServer = serverData; |
| this.m_joinServer = serverData; |
| } |
| } |
| |
| |
| public bool HasServerToJoin() |
| public bool HasServerToJoin() |
| { |
| { |
| return this.m_joinServer != null; |
| return this.m_joinServer != null; |
| } |
| } |
| |
| |
| public ServerJoinData GetServerToJoin() |
| public ServerJoinData GetServerToJoin() |
| { |
| { |
| if (this.m_joinServer == null) |
| if (this.m_joinServer == null) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| return this.m_joinServer.m_joinData; |
| return this.m_joinServer.m_joinData; |
| } |
| } |
| |
| |
| public static event FejdStartup.StartGameEventHandler startGameEvent; |
| public static event FejdStartup.StartGameEventHandler startGameEvent; |
| |
| |
| public static string InstanceId { get; private set; } = null; |
| public static string InstanceId { get; private set; } = null; |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| private void <OnWorldStart>g__RestoreMetaFromBackupPrompt|50_0(SaveWithBackups saveToRestore) |
| private void <OnWorldStart>g__RestoreMetaFromBackupPrompt|50_0(SaveWithBackups saveToRestore) |
| { |
| { |
| UnifiedPopup.Push(new YesNoPopup("$menu_restorebackup", "$menu_missingmetarestore", delegate |
| UnifiedPopup.Push(new YesNoPopup("$menu_restorebackup", "$menu_missingmetarestore", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| SaveSystem.RestoreBackupResult restoreBackupResult = SaveSystem.RestoreMetaFromMostRecentBackup(saveToRestore.PrimaryFile); |
| SaveSystem.RestoreBackupResult restoreBackupResult = SaveSystem.RestoreMetaFromMostRecentBackup(saveToRestore.PrimaryFile); |
| switch (restoreBackupResult) |
| switch (restoreBackupResult) |
| { |
| { |
| case SaveSystem.RestoreBackupResult.Success: |
| case SaveSystem.RestoreBackupResult.Success: |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| return; |
| return; |
| case SaveSystem.RestoreBackupResult.NoBackup: |
| case SaveSystem.RestoreBackupResult.NoBackup: |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| return; |
| return; |
| } |
| } |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestoremeta", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError(string.Format("Failed to restore meta file! Result: {0}", restoreBackupResult)); |
| ZLog.LogError(string.Format("Failed to restore meta file! Result: {0}", restoreBackupResult)); |
| }, new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| }, new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| } |
| } |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| private void <OnWorldStart>g__RestoreBackupPrompt|50_1(SaveWithBackups saveToRestore) |
| private void <OnWorldStart>g__RestoreBackupPrompt|50_1(SaveWithBackups saveToRestore) |
| { |
| { |
| UnifiedPopup.Push(new YesNoPopup("$menu_restorebackup", "$menu_corruptsaverestore", delegate |
| UnifiedPopup.Push(new YesNoPopup("$menu_restorebackup", "$menu_corruptsaverestore", delegate |
| { |
| { |
| UnifiedPopup.Pop(); |
| UnifiedPopup.Pop(); |
| SaveSystem.RestoreBackupResult restoreBackupResult = SaveSystem.RestoreMostRecentBackup(saveToRestore); |
| SaveSystem.RestoreBackupResult restoreBackupResult = SaveSystem.RestoreMostRecentBackup(saveToRestore); |
| switch (restoreBackupResult) |
| switch (restoreBackupResult) |
| { |
| { |
| case SaveSystem.RestoreBackupResult.Success: |
| case SaveSystem.RestoreBackupResult.Success: |
| SaveSystem.ClearWorldListCache(true); |
| SaveSystem.ClearWorldListCache(true); |
| this.RefreshWorldSelection(); |
| this.RefreshWorldSelection(); |
| return; |
| return; |
| case SaveSystem.RestoreBackupResult.NoBackup: |
| case SaveSystem.RestoreBackupResult.NoBackup: |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$error_nosuitablebackupfound", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| return; |
| return; |
| } |
| } |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| UnifiedPopup.Push(new WarningPopup("$error_cantrestorebackup", "$menu_checklogfile", new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| ZLog.LogError(string.Format("Failed to restore backup! Result: {0}", restoreBackupResult)); |
| ZLog.LogError(string.Format("Failed to restore backup! Result: {0}", restoreBackupResult)); |
| }, new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| }, new PopupButtonCallback(UnifiedPopup.Pop), true)); |
| } |
| } |
| |
| |
| private Vector3 camSpeed = Vector3.zero; |
| private Vector3 camSpeed = Vector3.zero; |
| |
| |
| private Vector3 camRotSpeed = Vector3.zero; |
| private Vector3 camRotSpeed = Vector3.zero; |
| |
| |
| private const int maxRetries = 50; |
| private const int maxRetries = 50; |
| |
| |
| private static int retries = 0; |
| private static int retries = 0; |
| |
| |
| private static FejdStartup m_instance; |
| private static FejdStartup m_instance; |
| |
| |
| [Header("Start")] |
| [Header("Start")] |
| public Animator m_menuAnimator; |
| public Animator m_menuAnimator; |
| |
| |
| public GameObject m_worldVersionPanel; |
| public GameObject m_worldVersionPanel; |
| |
| |
| public GameObject m_playerVersionPanel; |
| public GameObject m_playerVersionPanel; |
| |
| |
| public GameObject m_newGameVersionPanel; |
| public GameObject m_newGameVersionPanel; |
| |
| |
| public GameObject m_connectionFailedPanel; |
| public GameObject m_connectionFailedPanel; |
| |
| |
| public TMP_Text m_connectionFailedError; |
| public TMP_Text m_connectionFailedError; |
| |
| |
| public TMP_Text m_newVersionName; |
| public TMP_Text m_newVersionName; |
| |
| |
| public GameObject m_loading; |
| public GameObject m_loading; |
| |
| |
| public GameObject m_pleaseWait; |
| public GameObject m_pleaseWait; |
| |
| |
| public TMP_Text m_versionLabel; |
| public TMP_Text m_versionLabel; |
| |
| |
| public GameObject m_mainMenu; |
| public GameObject m_mainMenu; |
| |
| |
| public GameObject m_ndaPanel; |
| public GameObject m_ndaPanel; |
| |
| |
| public GameObject m_betaText; |
| public GameObject m_betaText; |
| |
| |
| public GameObject m_moddedText; |
| public GameObject m_moddedText; |
| |
| |
| public Scrollbar m_patchLogScroll; |
| public Scrollbar m_patchLogScroll; |
| |
| |
| public GameObject m_characterSelectScreen; |
| public GameObject m_characterSelectScreen; |
| |
| |
| public GameObject m_selectCharacterPanel; |
| public GameObject m_selectCharacterPanel; |
| |
| |
| public GameObject m_newCharacterPanel; |
| public GameObject m_newCharacterPanel; |
| |
| |
| public GameObject m_creditsPanel; |
| public GameObject m_creditsPanel; |
| |
| |
| public GameObject m_startGamePanel; |
| public GameObject m_startGamePanel; |
| |
| |
| public GameObject m_createWorldPanel; |
| public GameObject m_createWorldPanel; |
| |
| |
| public ServerOptionsGUI m_serverOptions; |
| public ServerOptionsGUI m_serverOptions; |
| |
| |
| public Button m_serverOptionsButton; |
| public Button m_serverOptionsButton; |
| |
| |
| public GameObject m_menuList; |
| public GameObject m_menuList; |
| |
| |
| private Button[] m_menuButtons; |
| private Button[] m_menuButtons; |
| |
| |
| private Button m_menuSelectedButton; |
| private Button m_menuSelectedButton; |
| |
| |
| public RectTransform m_creditsList; |
| public RectTransform m_creditsList; |
| |
| |
| public float m_creditsSpeed = 100f; |
| public float m_creditsSpeed = 100f; |
| |
| |
| public SceneReference m_startScene; |
| public SceneReference m_startScene; |
| |
| |
| public SceneReference m_mainScene; |
| public SceneReference m_mainScene; |
| |
| |
| [Header("Camera")] |
| [Header("Camera")] |
| public GameObject m_mainCamera; |
| public GameObject m_mainCamera; |
| |
| |
| public Transform m_cameraMarkerStart; |
| public Transform m_cameraMarkerStart; |
| |
| |
| public Transform m_cameraMarkerMain; |
| public Transform m_cameraMarkerMain; |
| |
| |
| public Transform m_cameraMarkerCharacter; |
| public Transform m_cameraMarkerCharacter; |
| |
| |
| public Transform m_cameraMarkerCredits; |
| public Transform m_cameraMarkerCredits; |
| |
| |
| public Transform m_cameraMarkerGame; |
| public Transform m_cameraMarkerGame; |
| |
| |
| public Transform m_cameraMarkerSaves; |
| public Transform m_cameraMarkerSaves; |
| |
| |
| public float m_cameraMoveSpeed = 1.5f; |
| public float m_cameraMoveSpeed = 1.5f; |
| |
| |
| public float m_cameraMoveSpeedStart = 1.5f; |
| public float m_cameraMoveSpeedStart = 1.5f; |
| |
| |
| [Header("Join")] |
| [Header("Join")] |
| public GameObject m_serverListPanel; |
| public GameObject m_serverListPanel; |
| |
| |
| public Toggle m_publicServerToggle; |
| public Toggle m_publicServerToggle; |
| |
| |
| public Toggle m_openServerToggle; |
| public Toggle m_openServerToggle; |
| |
| |
| public Toggle m_crossplayServerToggle; |
| public Toggle m_crossplayServerToggle; |
| |
| |
| public Color m_toggleColor = new Color(1f, 0.6308316f, 0.2352941f); |
| public Color m_toggleColor = new Color(1f, 0.6308316f, 0.2352941f); |
| |
| |
| public GuiInputField m_serverPassword; |
| public GuiInputField m_serverPassword; |
| |
| |
| public TMP_Text m_passwordError; |
| public TMP_Text m_passwordError; |
| |
| |
| public int m_minimumPasswordLength = 5; |
| public int m_minimumPasswordLength = 5; |
| |
| |
| public float m_characterRotateSpeed = 4f; |
| public float m_characterRotateSpeed = 4f; |
| |
| |
| public float m_characterRotateSpeedGamepad = 200f; |
| public float m_characterRotateSpeedGamepad = 200f; |
| |
| |
| public int m_joinHostPort = 2456; |
| public int m_joinHostPort = 2456; |
| |
| |
| [Header("World")] |
| [Header("World")] |
| public GameObject m_worldListPanel; |
| public GameObject m_worldListPanel; |
| |
| |
| public RectTransform m_worldListRoot; |
| public RectTransform m_worldListRoot; |
| |
| |
| public GameObject m_worldListElement; |
| public GameObject m_worldListElement; |
| |
| |
| public ScrollRectEnsureVisible m_worldListEnsureVisible; |
| public ScrollRectEnsureVisible m_worldListEnsureVisible; |
| |
| |
| public float m_worldListElementStep = 28f; |
| public float m_worldListElementStep = 28f; |
| |
| |
| public TextMeshProUGUI m_worldSourceInfo; |
| public TextMeshProUGUI m_worldSourceInfo; |
| |
| |
| public GameObject m_worldSourceInfoPanel; |
| public GameObject m_worldSourceInfoPanel; |
| |
| |
| public GuiInputField m_newWorldName; |
| public GuiInputField m_newWorldName; |
| |
| |
| public GuiInputField m_newWorldSeed; |
| public GuiInputField m_newWorldSeed; |
| |
| |
| public Button m_newWorldDone; |
| public Button m_newWorldDone; |
| |
| |
| public Button m_worldStart; |
| public Button m_worldStart; |
| |
| |
| public Button m_worldRemove; |
| public Button m_worldRemove; |
| |
| |
| public GameObject m_removeWorldDialog; |
| public GameObject m_removeWorldDialog; |
| |
| |
| public TMP_Text m_removeWorldName; |
| public TMP_Text m_removeWorldName; |
| |
| |
| public GameObject m_removeCharacterDialog; |
| public GameObject m_removeCharacterDialog; |
| |
| |
| public TMP_Text m_removeCharacterName; |
| public TMP_Text m_removeCharacterName; |
| |
| |
| public RectTransform m_tooltipAnchor; |
| public RectTransform m_tooltipAnchor; |
| |
| |
| public RectTransform m_tooltipSecondaryAnchor; |
| public RectTransform m_tooltipSecondaryAnchor; |
| |
| |
| [Header("Character selection")] |
| [Header("Character selection")] |
| public Button m_csStartButton; |
| public Button m_csStartButton; |
| |
| |
| public Button m_csNewBigButton; |
| public Button m_csNewBigButton; |
| |
| |
| public Button m_csNewButton; |
| public Button m_csNewButton; |
| |
| |
| public Button m_csRemoveButton; |
| public Button m_csRemoveButton; |
| |
| |
| public Button m_csLeftButton; |
| public Button m_csLeftButton; |
| |
| |
| public Button m_csRightButton; |
| public Button m_csRightButton; |
| |
| |
| public Button m_csNewCharacterDone; |
| public Button m_csNewCharacterDone; |
| |
| |
| public Button m_csNewCharacterCancel; |
| public Button m_csNewCharacterCancel; |
| |
| |
| public GameObject m_newCharacterError; |
| public GameObject m_newCharacterError; |
| |
| |
| public TMP_Text m_csName; |
| public TMP_Text m_csName; |
| |
| |
| public TMP_Text m_csFileSource; |
| public TMP_Text m_csFileSource; |
| |
| |
| public TMP_Text m_csSourceInfo; |
| public TMP_Text m_csSourceInfo; |
| |
| |
| public GuiInputField m_csNewCharacterName; |
| public GuiInputField m_csNewCharacterName; |
| |
| |
| [Header("Misc")] |
| [Header("Misc")] |
| public Transform m_characterPreviewPoint; |
| public Transform m_characterPreviewPoint; |
| |
| |
| public GameObject m_playerPrefab; |
| public GameObject m_playerPrefab; |
| |
| |
| public GameObject m_objectDBPrefab; |
| public GameObject m_objectDBPrefab; |
| |
| |
| public GameObject m_settingsPrefab; |
| public GameObject m_settingsPrefab; |
| |
| |
| public GameObject m_consolePrefab; |
| public GameObject m_consolePrefab; |
| |
| |
| public GameObject m_feedbackPrefab; |
| public GameObject m_feedbackPrefab; |
| |
| |
| public GameObject m_changeEffectPrefab; |
| public GameObject m_changeEffectPrefab; |
| |
| |
| public ManageSavesMenu m_manageSavesMenu; |
| public ManageSavesMenu m_manageSavesMenu; |
| |
| |
| public GameObject m_cloudStorageWarningNextSave; |
| public GameObject m_cloudStorageWarningNextSave; |
| |
| |
| private GameObject m_settingsPopup; |
| private GameObject m_settingsPopup; |
| |
| |
| private string m_downloadUrl = ""; |
| private string m_downloadUrl = ""; |
| |
| |
| [TextArea] |
| [TextArea] |
| public string m_versionXmlUrl = "https://dl.dropboxusercontent.com/s/5ibm05oelbqt8zq/fejdversion.xml?dl=0"; |
| public string m_versionXmlUrl = "https://dl.dropboxusercontent.com/s/5ibm05oelbqt8zq/fejdversion.xml?dl=0"; |
| |
| |
| private World m_world; |
| private World m_world; |
| |
| |
| private bool m_startingWorld; |
| private bool m_startingWorld; |
| |
| |
| private ServerStatus m_joinServer; |
| private ServerStatus m_joinServer; |
| |
| |
| private ServerJoinData m_queuedJoinServer; |
| private ServerJoinData m_queuedJoinServer; |
| |
| |
| private float m_worldListBaseSize; |
| private float m_worldListBaseSize; |
| |
| |
| private List<PlayerProfile> m_profiles; |
| private List<PlayerProfile> m_profiles; |
| |
| |
| private int m_profileIndex; |
| private int m_profileIndex; |
| |
| |
| private string m_tempRemoveCharacterName = ""; |
| private string m_tempRemoveCharacterName = ""; |
| |
| |
| private FileHelpers.FileSource m_tempRemoveCharacterSource; |
| private FileHelpers.FileSource m_tempRemoveCharacterSource; |
| |
| |
| private int m_tempRemoveCharacterIndex = -1; |
| private int m_tempRemoveCharacterIndex = -1; |
| |
| |
| private BackgroundWorker m_moveFileWorker; |
| private BackgroundWorker m_moveFileWorker; |
| |
| |
| private List<GameObject> m_worldListElements = new List<GameObject>(); |
| private List<GameObject> m_worldListElements = new List<GameObject>(); |
| |
| |
| private List<World> m_worlds; |
| private List<World> m_worlds; |
| |
| |
| private GameObject m_playerInstance; |
| private GameObject m_playerInstance; |
| |
| |
| private static bool m_firstStartup = true; |
| private static bool m_firstStartup = true; |
| |
| |
| public static Action HandlePendingInvite; |
| public static Action HandlePendingInvite; |
| |
| |
| public static Action ResetPendingInvite; |
| public static Action ResetPendingInvite; |
| |
| |
| public static Action<Privilege> ResolvePrivilege; |
| public static Action<Privilege> ResolvePrivilege; |
| |
| |
| private static GameObject s_monoUpdaters = null; |
| private static GameObject s_monoUpdaters = null; |
| |
| |
| private delegate void ContinueAction(); |
| private delegate void ContinueAction(); |
| |
| |
| public struct StartGameEventArgs |
| public struct StartGameEventArgs |
| { |
| { |
| public StartGameEventArgs(bool isHost) |
| public StartGameEventArgs(bool isHost) |
| { |
| { |
| this.isHost = isHost; |
| this.isHost = isHost; |
| } |
| } |
| |
| |
| public bool isHost; |
| public bool isHost; |
| } |
| } |
| |
| |
| public delegate void StartGameEventHandler(object sender, FejdStartup.StartGameEventArgs e); |
| public delegate void StartGameEventHandler(object sender, FejdStartup.StartGameEventArgs e); |
| } |
| } |
| |
| |