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
                };
            }
        }
Esempio n. 2
0
        public static void Awake(this ServerFrameComponent self)
        {
            self.Frame        = 0;
            self.FrameMessage = new FrameMessage()
            {
                Frame = self.Frame
            };

            self.UpdateFrameAsync();
        }
Esempio n. 3
0
        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
                };
            }
        }
Esempio n. 4
0
        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
                };
            }
        }
Esempio n. 5
0
 public static void Add(this ServerFrameComponent self, IFrameMessage message)
 {
     self.FrameMessage.Messages.Add((MessageObject)message);
 }
Esempio n. 6
0
 public static void Add(this ServerFrameComponent self, AFrameMessage message)
 {
     self.FrameMessage.Messages.Add(message);
 }
Esempio n. 7
0
 public static void Add(this ServerFrameComponent self, OneFrameMessage oneFrameMessage)
 {
     self.FrameMessage.Message.Add(oneFrameMessage);
 }
Esempio n. 8
0
 public static void Add(this ServerFrameComponent self, OneFrameMessage oneFrameMessage)
 {
     //Log.Info(oneFrameMessage.ToString());
     self.FrameMessage.Message.Add(oneFrameMessage);
 }