Exemplo n.º 1
0
        public static void GetProgresByTag(string tag, out float contained, out float calculated, out float ready)
        {
            if (profile)
            {
                Profiler.BeginSample("Get Progress Tag");
            }

            DictTuple <string, bool, bool> dict = new DictTuple <string, bool, bool>();

            int queueCount = queue.Count;

            contained = 0; calculated = 0; ready = 0;

            for (int i = 0; i < queueCount; i++)
            {
                ThreadWorker worker = queue[i];
                if (worker.stage == Stage.stop || worker.stage == Stage.blank)
                {
                    continue;
                }
                if (!worker.tag.Contains(tag))
                {
                    continue;
                }

                //contains
                if (!dict.ContainsKey(worker.tag))
                {
                    dict.Add(worker.tag, true, true);
                }

                //calculated
                TupleSet <bool, bool> tuple = dict[worker.tag];
                if (worker.stage != Stage.applyEnqueued && worker.stage != Stage.coroutineEnqueued && worker.stage != Stage.coroutineRunning && worker.stage != Stage.ready)
                {
                    tuple.item1 = false; tuple.item2 = false; dict[worker.tag] = tuple;
                }

                //ready
                if (worker.stage != Stage.ready)
                {
                    tuple.item2 = false; dict[worker.tag] = tuple;
                }
            }

            //calculating total statistics
            contained = dict.Count;
            foreach (TupleSet <bool, bool> tuple in dict.Values())
            {
                if (tuple.item1)
                {
                    calculated++;
                }
                if (tuple.item2)
                {
                    ready++;
                }
            }

            if (profile)
            {
                Profiler.EndSample();
            }
        }