public void UpdateNotify() { if (notifyList.Count > 0) { for (int i = 0, max = notifyList.Count; i < max; i++) { NotifyObject <T> obj = notifyList[i]; if (obj.target == null) { ExcuteAction((int)obj.notify, obj.param); } else { ExcuteAction((int)obj.notify, obj.target, obj.param); } } notifyList.Clear(); } if (cacheNotifys.Count > 0) { for (int i = 0; i < cacheNotifys.Count; i++) { notifyList.Add(cacheNotifys[i]); } cacheNotifys.Clear(); } }
public void PushNotify(int notify, GameObject target, T data) { NotifyObject <T> obj = new NotifyObject <T> { notify = notify, target = target, param = data }; cacheNotifys.Add(obj); }