public static IEnumerator Run( float deltaTime, Action <string> statusFunction = null, string format = null) { if (FileSystem_Warmup.run && !FileSystem_Warmup.running) { FileSystem_Warmup.running = true; string[] prewarmAssets = FileSystem_Warmup.GetAssetList(); Stopwatch sw = Stopwatch.StartNew(); for (int i = 0; i < prewarmAssets.Length; ++i) { if (sw.Elapsed.TotalSeconds > (double)deltaTime || i == 0 || i == prewarmAssets.Length - 1) { if (statusFunction != null) { statusFunction(string.Format(format != null ? format : "{0}/{1}", (object)(i + 1), (object)prewarmAssets.Length)); } yield return((object)CoroutineEx.waitForEndOfFrame); sw.Reset(); sw.Start(); } FileSystem_Warmup.PrefabWarmup(prewarmAssets[i]); } FileSystem_Warmup.running = FileSystem_Warmup.run = false; } }
public static IEnumerator Run(float deltaTime, Action <string> statusFunction = null, string format = null) { string str; if (!FileSystem_Warmup.run || FileSystem_Warmup.running) { yield break; } FileSystem_Warmup.running = true; string[] assetList = FileSystem_Warmup.GetAssetList(); Stopwatch stopwatch = Stopwatch.StartNew(); for (int i = 0; i < (int)assetList.Length; i++) { if (stopwatch.Elapsed.TotalSeconds > (double)deltaTime || i == 0 || i == (int)assetList.Length - 1) { if (statusFunction != null) { Action <string> action = statusFunction; str = (format != null ? format : "{0}/{1}"); action(string.Format(str, i + 1, (int)assetList.Length)); } yield return(CoroutineEx.waitForEndOfFrame); stopwatch.Reset(); stopwatch.Start(); } FileSystem_Warmup.PrefabWarmup(assetList[i]); } int num = 0; FileSystem_Warmup.run = (bool)num; FileSystem_Warmup.running = (bool)num; }
private static string[] GetAssetList() { return(( from x in (IEnumerable <GameManifest.PrefabProperties>)GameManifest.Current.prefabProperties select x.name into x where !FileSystem_Warmup.ShouldIgnore(x) select x).ToArray <string>()); }
public static void Run() { if (!FileSystem_Warmup.run || FileSystem_Warmup.running) { return; } FileSystem_Warmup.running = true; foreach (string asset in FileSystem_Warmup.GetAssetList()) { FileSystem_Warmup.PrefabWarmup(asset); } FileSystem_Warmup.running = FileSystem_Warmup.run = false; }
public static void Run() { if (!FileSystem_Warmup.run || FileSystem_Warmup.running) { return; } FileSystem_Warmup.running = true; string[] assetList = FileSystem_Warmup.GetAssetList(); for (int i = 0; i < (int)assetList.Length; i++) { FileSystem_Warmup.PrefabWarmup(assetList[i]); } int num = 0; FileSystem_Warmup.run = (bool)num; FileSystem_Warmup.running = (bool)num; }
private IEnumerator DedicatedServerStartup() { Bootstrap bootstrap = this; Application.isLoading = (__Null)1; Bootstrap.WriteToLog("Skinnable Warmup"); yield return((object)CoroutineEx.waitForEndOfFrame); yield return((object)CoroutineEx.waitForEndOfFrame); GameManifest.LoadAssets(); Bootstrap.WriteToLog("Loading Scene"); yield return((object)CoroutineEx.waitForEndOfFrame); yield return((object)CoroutineEx.waitForEndOfFrame); Physics.set_solverIterationCount(3); QualitySettings.SetQualityLevel(0); Object.DontDestroyOnLoad((Object)((Component)bootstrap).get_gameObject()); Object.DontDestroyOnLoad((Object)GameManager.server.CreatePrefab("assets/bundled/prefabs/system/server_console.prefab", true)); bootstrap.StartupShared(); World.InitSize(ConVar.Server.worldsize); World.InitSeed(ConVar.Server.seed); World.InitSalt(ConVar.Server.salt); World.Url = ConVar.Server.levelurl; LevelManager.LoadLevel(ConVar.Server.level, true); yield return((object)CoroutineEx.waitForEndOfFrame); yield return((object)CoroutineEx.waitForEndOfFrame); yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(FileSystem_Warmup.Run(0.2f, new Action <string>(Bootstrap.WriteToLog), "Asset Warmup ({0}/{1})"))); yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.StartServer(!CommandLine.HasSwitch("-skipload"), "", false))); if (!Object.op_Implicit((Object)Object.FindObjectOfType <Performance>())) { Object.DontDestroyOnLoad((Object)GameManager.server.CreatePrefab("assets/bundled/prefabs/system/performance.prefab", true)); } Pool.Clear(); Rust.GC.Collect(); Application.isLoading = (__Null)0; }
private IEnumerator DedicatedServerStartup() { Bootstrap bootstrap = null; Rust.Application.isLoading = true; Bootstrap.WriteToLog("Skinnable Warmup"); yield return(CoroutineEx.waitForEndOfFrame); yield return(CoroutineEx.waitForEndOfFrame); GameManifest.LoadAssets(); Bootstrap.WriteToLog("Loading Scene"); yield return(CoroutineEx.waitForEndOfFrame); yield return(CoroutineEx.waitForEndOfFrame); UnityEngine.Physics.solverIterationCount = 3; QualitySettings.SetQualityLevel(0); UnityEngine.Object.DontDestroyOnLoad(bootstrap.gameObject); UnityEngine.Object.DontDestroyOnLoad(GameManager.server.CreatePrefab("assets/bundled/prefabs/system/server_console.prefab", true)); bootstrap.StartupShared(); World.InitSize(ConVar.Server.worldsize); World.InitSeed(ConVar.Server.seed); World.InitSalt(ConVar.Server.salt); World.Url = ConVar.Server.levelurl; LevelManager.LoadLevel(ConVar.Server.level, true); yield return(CoroutineEx.waitForEndOfFrame); yield return(CoroutineEx.waitForEndOfFrame); yield return(bootstrap.StartCoroutine(FileSystem_Warmup.Run(0.2f, new Action <string>(Bootstrap.WriteToLog), "Asset Warmup ({0}/{1})"))); yield return(bootstrap.StartCoroutine(Bootstrap.StartServer(!Facepunch.CommandLine.HasSwitch("-skipload"), "", false))); if (!UnityEngine.Object.FindObjectOfType <Performance>()) { UnityEngine.Object.DontDestroyOnLoad(GameManager.server.CreatePrefab("assets/bundled/prefabs/system/performance.prefab", true)); } Facepunch.Pool.Clear(); Rust.GC.Collect(); Rust.Application.isLoading = false; }
private static string[] GetAssetList() { return(((IEnumerable <GameManifest.PrefabProperties>)GameManifest.Current.prefabProperties).Select <GameManifest.PrefabProperties, string>((Func <GameManifest.PrefabProperties, string>)(x => x.name)).Where <string>((Func <string, bool>)(x => !FileSystem_Warmup.ShouldIgnore(x))).ToArray <string>()); }