Esempio n. 1
0
    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;
    }
Esempio n. 3
0
 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;
    }