Esempio n. 1
0
        public static void Notify(this CoroutineLockComponent self, CoroutineLockType coroutineLockType, long key, int count)
        {
            CoroutineLockQueueType coroutineLockQueueType = self.list[(int)coroutineLockType];

            if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
            {
                return;
            }

            if (queue.Count == 0)
            {
                coroutineLockQueueType.Remove(key);
                return;
            }

#if NOT_UNITY
            const int frameCoroutineCount = 5;
#else
            const int frameCoroutineCount = 10;
#endif

            if (count > frameCoroutineCount)
            {
                self.NextFrameRun(coroutineLockType, key);
                return;
            }

            CoroutineLockInfo coroutineLockInfo = queue.Dequeue();
            coroutineLockInfo.Tcs.SetResult(self.CreateCoroutineLock(coroutineLockType, key, coroutineLockInfo.Time, count));
        }
Esempio n. 2
0
        public static void Notify(this CoroutineLockComponent self, int coroutineLockType, long key, int level)
        {
            CoroutineLockQueueType coroutineLockQueueType = self.list[coroutineLockType];

            if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
            {
                return;
            }

            if (queue.Count == 0)
            {
                coroutineLockQueueType.Remove(key);
                return;
            }

            CoroutineLockInfo coroutineLockInfo = queue.Dequeue();

            coroutineLockInfo.Tcs.SetResult(self.CreateCoroutineLock(coroutineLockType, key, coroutineLockInfo.Time, level));
        }
Esempio n. 3
0
        private static void Notify(this CoroutineLockComponent self, int coroutineLockType, long key, int level)
        {
            CoroutineLockQueueType coroutineLockQueueType = self.list[coroutineLockType];

            CoroutineLockQueue queue = coroutineLockQueueType.GetChild <CoroutineLockQueue>(key);

            if (queue == null)
            {
                return;
            }

            if (queue.Count == 0)
            {
                coroutineLockQueueType.RemoveChild(key);
                return;
            }

            CoroutineLockInfo coroutineLockInfo = queue.Dequeue();

            coroutineLockInfo.Tcs.SetResult(self.CreateCoroutineLock(queue, coroutineLockType, key, coroutineLockInfo.Time, level));
        }