public void Update() { if (this.TimeId.Count == 0) { return; } long timeNow = TimeHelper.Now(); if (timeNow < this.minTime) { return; } foreach (KeyValuePair <long, List <long> > kv in this.TimeId.GetDictionary()) { long k = kv.Key; if (k > timeNow) { minTime = k; break; } this.timeOutTime.Enqueue(k); } while (this.timeOutTime.Count > 0) { long time = this.timeOutTime.Dequeue(); foreach (long timerId in this.TimeId[time]) { this.timeOutTimerIds.Enqueue(timerId); } this.TimeId.Remove(time); } while (this.timeOutTimerIds.Count > 0) { long timerId = this.timeOutTimerIds.Dequeue(); ITimer timer; if (!this.timers.TryGetValue(timerId, out timer)) { continue; } timer.Run(true); } }
public void Awake(AChannel aChannel) { long timeNow = TimeHelper.Now(); this.LastRecvTime = timeNow; this.LastSendTime = timeNow; this.channel = aChannel; this.requestCallback.Clear(); long id = this.Id; channel.ErrorCallback += (c, e) => { this.Network.Remove(id); }; channel.ReadCallback += this.OnRead; }
public static void Check(this ActorLocationSenderComponent self, bool isTimeOut) { using (ListComponent <long> list = EntityFactory.Create <ListComponent <long> >(self.Domain)) { long timeNow = TimeHelper.Now(); foreach ((long key, Entity value) in self.Children) { ActorLocationSender actorLocationMessageSender = (ActorLocationSender)value; if (timeNow > actorLocationMessageSender.LastSendOrRecvTime + ActorLocationSenderComponent.TIMEOUT_TIME) { list.List.Add(key); } } foreach (long id in list.List) { self.Remove(id); } } }
public void Update() { if (this.moveTcs == null) { return; } Unit unit = this.GetParent <Unit>(); long timeNow = TimeHelper.Now(); if (timeNow - this.StartTime >= this.needTime) { unit.Position = this.Target; ETTaskCompletionSource tcs = this.moveTcs; this.moveTcs = null; tcs.SetResult(); return; } float amount = (timeNow - this.StartTime) * 1f / this.needTime; unit.Position = Vector3.Lerp(this.StartPos, this.Target, amount); }
public ActorMessageSender(Action <IActorResponse> callback) { this.CreateTime = TimeHelper.Now(); this.Callback = callback; }