예제 #1
0
        private void forceTime(float now)
        {
            List <IAutoReleaseRef> clearList = new List <IAutoReleaseRef>();

            foreach (IAutoReleaseRef res in pool.Keys)
            {
                if (now - pool[res] > TIMEOUT)
                {
                    clearList.Add(res);
                }
            }

            int len = clearList.Count;

            if (len > 0)
            {
                foreach (IAutoReleaseRef res in clearList)
                {
                    res.__dispose();
                    pool.Remove(res);
                }
            }

            if (pool.Count == 0)
            {
                TickManager.Remove(tick);
            }
        }
예제 #2
0
        private void render(float deltaTime)
        {
            if (len > 0)
            {
                dispatching = true;
                SignalNode <float> t = firstNode;

                List <SignalNode <float> > temp = getSignalNodeList();
                float now = Time.time;
                while (t != null)
                {
                    if (t.active == NodeActiveState.Runing)
                    {
                        if (now > t.data)
                        {
                            Remove(t.action);
                            t.action(t.data);
                        }
                    }
                    temp.Add(t);
                    t = t.next;
                }
                dispatching = false;
                int l = temp.Count;
                for (int i = 0; i < l; i++)
                {
                    SignalNode <float> item = temp[i];
                    if (item.active == NodeActiveState.TodoDelete)
                    {
                        _remove(item, item.action);
                    }
                    else if (item.active == NodeActiveState.TodoAdd)
                    {
                        item.active = NodeActiveState.Runing;
                    }
                }
                recycle(temp);
            }
            else
            {
                TickManager.Remove(render);
            }
        }