Exemplo n.º 1
0
        //private List<Action> tempHandle = new List<Action>();
        private void render(float deltaTime)
        {
            if (len > 0)
            {
                dispatching = true;
                ActionNode <float> t = firstNode;

                List <ActionNode <float> > temp = GetSignalNodeList();
                float now = Time.time;
                while (t != null)
                {
                    if (t.active == NodeActiveState.Runing)
                    {
                        if (now > t.data)
                        {
                            Remove(t.action);
                            t.action();
                            //DebugX.Log("callLater:" + now + ":" + t.data);
                        }
                    }
                    temp.Add(t);
                    t = t.next;
                }
                dispatching = false;

                int l = temp.Count;
                for (int i = 0; i < l; i++)
                {
                    ActionNode <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);
            }
        }
Exemplo n.º 2
0
        public void dispatch()
        {
            if (len > 0)
            {
                dispatching = true;
                ActionNode <T> t = firstNode;

                List <ActionNode <T> > temp = GetSignalNodeList();

                while (t != null)
                {
                    if (t.active == NodeActiveState.Runing)
                    {
                        t.action();
                    }
                    temp.Add(t);
                    t = t.next;
                }
                dispatching = false;

                int l = temp.Count;
                for (int i = 0; i < l; i++)
                {
                    ActionNode <T> item = temp[i];
                    if (item.active == NodeActiveState.ToDoDelete)
                    {
                        _remove(item, item.action);
                    }
                    else if (item.active == NodeActiveState.ToDoAdd)
                    {
                        item.active = NodeActiveState.Runing;
                    }
                }
                Recycle(temp);
            }
        }