private void OnEvent_OnServerMissFrame(object param)
        {
            Debug.Log("OnEvent_OnServerMissFrame", Array.Empty <object>());
            Msg_RepMissFrame msg = param as Msg_RepMissFrame;

            this.OnServerMissFrame(msg);
        }
Example #2
0
        void OnNet_ReqMissFrame(Player player, BaseMsg data)
        {
            var reqMsg        = data as Msg_ReqMissFrame;
            var nextCheckTick = reqMsg.StartTick;

            Log($"OnNet_ReqMissFrame nextCheckTick id:{player.LocalId}:{nextCheckTick}");
            int count = System.Math.Min(System.Math.Min((Tick - 1), allHistoryFrames.Count) - nextCheckTick,
                                        MaxRepMissFrameCountPerPack);

            if (count <= 0)
            {
                return;
            }
            var msg    = new Msg_RepMissFrame();
            var frames = new ServerFrame[count];

            for (int i = 0; i < count; i++)
            {
                frames[i] = allHistoryFrames[nextCheckTick + i];
                Logging.Debug.Assert(frames[i] != null);
            }

            msg.startTick = frames[0].tick;
            msg.frames    = frames;
            SendUdp(player, EMsgSC.G2C_RepMissFrame, msg, true);
        }
 public void OnMissFrames(Msg_RepMissFrame msg)
 {
     Log("OnMissFrames");
     if (msg != null)
     {
         EventHelper.Trigger(EEvent.OnServerMissFrame, msg);
     }
 }
Example #4
0
        public void OpenRecordFile(string path)
        {
            var bytes  = File.ReadAllBytes(path);
            var reader = new Deserializer(Compressor.Decompress(bytes));

            GameStartInfo = reader.Parse <Msg_G2C_GameStartInfo>();
            FramesInfo    = reader.Parse <Msg_RepMissFrame>();
            MaxRunTick    = FramesInfo.frames.Length + 1;
            IsVideoMode   = true;
        }
Example #5
0
        private void DumpGameFrames()
        {
            var msg   = new Msg_RepMissFrame();
            int count = Math.Min((Tick - 1), allHistoryFrames.Count);

            if (count <= 0)
            {
                return;
            }
            var frames = new ServerFrame[count];

            for (int i = 0; i < count; i++)
            {
                frames[i] = allHistoryFrames[i];
                Debug.Assert(frames[i] != null, "!!!!!!!!!!!!!!!!!");
            }

            msg.StartTick = frames[0].Tick;
            msg.Frames    = frames;
            var writer = new Serializer();

            writer.PutInt32(TypeId);
            writer.PutInt32(RoomId);
            writer.PutInt32(seed);
            writer.PutBytes_255(_playerId2LocalId.Values.ToArray());

            msg.Serialize(writer);
            var bytes = Compressor.Compress(writer);
            var path  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                     "../../Record/" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + TypeId + "_" + RoomId +
                                     ".record");
            var dir = Path.GetDirectoryName(path);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            Debug.Log("Create Record " + path);
            File.WriteAllBytes(path, bytes);
        }
Example #6
0
        public void OpenRecordFile(string path)
        {
            var bytes     = File.ReadAllBytes(path);
            var reader    = new Deserializer(Compressor.Decompress(bytes));
            var TypeId    = reader.GetInt();
            var RoomId    = reader.GetInt();
            var Seed      = reader.GetInt();
            var AllActors = reader.GetBytes_255();
            var msg       = new Msg_RepMissFrame();

            msg.startTick = 0;
            msg.Deserialize(reader);
            var msgStartGame = new Msg_StartGame();

            msgStartGame.RoomID          = RoomId;
            msgStartGame.Seed            = Seed;
            msgStartGame.AllActors       = AllActors;
            msgStartGame.SimulationSpeed = 60;
            MaxRunTick  = msg.frames.Length + 1;
            IsVideoMode = true;
            framesInfo  = msg;
            gameInfo    = msgStartGame;
        }
Example #7
0
        private void DumpGameFrames()
        {
            var msg   = new Msg_RepMissFrame();
            int count = System.Math.Min((Tick - 1), allHistoryFrames.Count);

            if (count <= 0)
            {
                return;
            }
            var writer = new Serializer();

            GameStartInfo.Serialize(writer);
            var frames = new ServerFrame[count];

            for (int i = 0; i < count; i++)
            {
                frames[i] = allHistoryFrames[i];
                Logging.Debug.Assert(frames[i] != null, "!!!!!!!!!!!!!!!!!");
            }

            msg.startTick = frames[0].tick;
            msg.frames    = frames;
            msg.Serialize(writer);
            var bytes = Compressor.Compress(writer);
            var path  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                     "../Record/" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + GameType + "_" + GameId +
                                     ".record");
            var dir = Path.GetDirectoryName(path);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            Log("Create Record " + path);
            File.WriteAllBytes(path, bytes);
        }
Example #8
0
 public virtual void OnMissFrames(Msg_RepMissFrame msg)
 {
 }
Example #9
0
 private void OnEvent_BorderVideoFrame(object param)
 {
     _videoFrames = param as Msg_RepMissFrame;
 }
 public override void OnMissFrames(Msg_RepMissFrame msg)
 {
 }
Example #11
0
        private void OnEvent_BorderVideoFrame(object param)
        {
            Msg_RepMissFrame msg = param as Msg_RepMissFrame;

            this.OnBorderVideoFrame(msg);
        }
Example #12
0
 public void OnServerMissFrame(Msg_RepMissFrame msg)
 {
     this._cmdBuffer.PushMissServerFrames(msg.frames, false);
 }
Example #13
0
 public void OnBorderVideoFrame(Msg_RepMissFrame msg)
 {
     this._videoFrames = msg;
 }
Example #14
0
        protected void G2C_RepMissFrame(object reader)
        {
            Msg_RepMissFrame msg = reader as Msg_RepMissFrame;

            _handler.OnMissFrames(msg);
        }