private void forceTime(float now) { int total = 0; List <IAutoReleaseRef> clearList = new List <IAutoReleaseRef>(); foreach (IAutoReleaseRef res in pool.Keys) { total++; 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); } }
public void render(float deltaTime) { if (len < 1) { TickManager.Remove(render); return; } float now = Time.realtimeSinceStartup; float dis = now - pre; if (dis < delayTime - 0.016f) { return; } pre = now; dispatching = true; SignalNode <float> t = firstNode; List <SignalNode <float> > temp = GetSignalNodeList(); while (t != null) { if (t.active == NodeActiveState.Runing) { float delta = delayTime; if (t.data != -1) { delta = t.data - pre; if (delta < 0) { ___removeHandle(t.action); } } t.action(delta); } 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); }
public override void OnPointerUp(PointerEventData eventData) { isDown = false; if (mouseEnterEnabled) { TickManager.Remove(tick); } this.simpleDispatch(MouseEventX.MOUSE_UP, eventData); base.OnPointerUp(eventData); }
//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); } }