public static IEnumerator Run( float deltaTime, Action <string> statusFunction = null, string format = null) { if (Application.isLoadingPrefabs == null) { Application.isLoadingPrefabs = (__Null)1; string[] prewarmAssets = PrefabPoolWarmup.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(); } PrefabPoolWarmup.PrefabWarmup(prewarmAssets[i]); } Application.isLoadingPrefabs = (__Null)0; } }
public static IEnumerator Run(float deltaTime, Action <string> statusFunction = null, string format = null) { string str; if (Rust.Application.isLoadingPrefabs) { yield break; } Rust.Application.isLoadingPrefabs = true; string[] assetList = PrefabPoolWarmup.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(); } PrefabPoolWarmup.PrefabWarmup(assetList[i]); } Rust.Application.isLoadingPrefabs = false; }
public static void Run() { if (Application.isLoadingPrefabs != null) { return; } Application.isLoadingPrefabs = (__Null)1; foreach (string asset in PrefabPoolWarmup.GetAssetList()) { PrefabPoolWarmup.PrefabWarmup(asset); } Application.isLoadingPrefabs = (__Null)0; }
public static void Run() { if (Rust.Application.isLoadingPrefabs) { return; } Rust.Application.isLoadingPrefabs = true; string[] assetList = PrefabPoolWarmup.GetAssetList(); for (int i = 0; i < (int)assetList.Length; i++) { PrefabPoolWarmup.PrefabWarmup(assetList[i]); } Rust.Application.isLoadingPrefabs = false; }