void OnNet_ReqMissFrame(Player player, BaseFormater data) { var reqMsg = data as Msg_ReqMissFrame; var nextCheckTick = reqMsg.StartTick; Debug.Log($"OnNet_ReqMissFrame nextCheckTick id:{player.localId}:{nextCheckTick}"); var msg = new Msg_RepMissFrame(); int count = Math.Min(Math.Min((Tick - 1), allHistoryFrames.Count) - nextCheckTick, MaxRepMissFrameCountPerPack); if (count <= 0) { return; } var frames = new ServerFrame[count]; for (int i = 0; i < count; i++) { frames[i] = allHistoryFrames[nextCheckTick + i]; Debug.Assert(frames[i] != null); } msg.StartTick = frames[0].Tick; msg.Frames = frames; SendTo(player, EMsgSC.G2C_RepMissFrame, msg, true); }
public void PushLocalFrame(ServerFrame frame) { var sIdx = frame.tick % _bufferSize; Debug.Assert(_clientBuffer[sIdx] == null || _clientBuffer[sIdx].tick <= frame.tick, "Push local frame error!"); _clientBuffer[sIdx] = frame; }
void CheckValid() { for (int i = 0; i < 3; i++) { if (borders[i].dir == LVector2.zero) { Debug.Assert(false); } } }
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); }
protected virtual void Awake() { _referenceHolder = GetComponent <IReferenceHolder>(); Debug.Assert(_referenceHolder != null, GetType() + " miss IReferenceHolder "); }