| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using ETModel;
- namespace ETHotfix
- {
- [ObjectSystem]
- public class ServerFrameComponentSystem : AwakeSystem<ServerFrameComponent>
- {
- public override void Awake(ServerFrameComponent self)
- {
- self.Awake();
- }
- }
-
- public static class ServerFrameComponentEx
- {
- 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 void Add(this ServerFrameComponent self, IFrameMessage message)
- {
- self.FrameMessage.Messages.Add((MessageObject)message);
- }
- }
- }
|