public static async ETVoid UpdateFrameAsync(this ServerFrameComponent self) { TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>(); long instanceId = self.InstanceId; while (true) { if (self.InstanceId != instanceId) { return; } await timerComponent.WaitAsync(100); // 不论 FrameMessage.Message 是否有消息内容,都会向客户端转发 MessageHelper.Broadcast(self.FrameMessage); // 转发完,reset FrameMassage ++self.Frame; self.FrameMessage = new FrameMessage() { Frame = self.Frame }; } }
public static void Awake(this ServerFrameComponent self) { self.Frame = 0; self.FrameMessage = new FrameMessage() { Frame = self.Frame }; self.UpdateFrameAsync(); }
public static async void UpdateFrameAsync(this ServerFrameComponent self) { TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>(); while (true) { if (self.IsDisposed) { return; } await timerComponent.WaitAsync(40); MessageHelper.Broadcast(self.FrameMessage); ++self.Frame; self.FrameMessage = new FrameMessage() { Frame = self.Frame }; } }
public static async void UpdateFrameAsync(this ServerFrameComponent self) { TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>(); long instanceId = self.InstanceId; while (true) { if (self.InstanceId != instanceId) { return; } await timerComponent.WaitAsync(100); //延时100毫秒 MessageHelper.Broadcast(self.FrameMessage); //广播一次帧消息 ++self.Frame; //帧+1 self.FrameMessage = new FrameMessage() { Frame = self.Frame }; } }
public static void Add(this ServerFrameComponent self, IFrameMessage message) { self.FrameMessage.Messages.Add((MessageObject)message); }
public static void Add(this ServerFrameComponent self, AFrameMessage message) { self.FrameMessage.Messages.Add(message); }
public static void Add(this ServerFrameComponent self, OneFrameMessage oneFrameMessage) { self.FrameMessage.Message.Add(oneFrameMessage); }
public static void Add(this ServerFrameComponent self, OneFrameMessage oneFrameMessage) { //Log.Info(oneFrameMessage.ToString()); self.FrameMessage.Message.Add(oneFrameMessage); }