public void OnRecievedFramePacket(NetMessage.SCFrame frame) { List <Packet> list = new List <Packet>(); for (int i = 0; i < frame.users.Count; i++) { int uid = frame.users[i]; NetMessage.PbFrames pbs = frame.frames[i]; if (pbs == null || pbs.frames.Count == 0) { continue; } for (int k = 0; k < pbs.frames.Count; k++) { NetMessage.PbFrame pb = pbs.frames[k]; if (pb == null) { continue; } Packet move = new Packet(); move.team = (TEAM)(uid + 1); move.packet = Json.DeCode <FramePacket>(pb.content); list.Add(move); } } battleSystem.lockStep.AddFrame(frame.frameNum, list.ToArray()); }
public void OnRecievedScriptFrame(NetMessage.PbSCFrames frames) { for (int i = 0; i < frames.frames.Count;) { List <Packet> list = new List <Packet>(); int FrameNum = frames.frames[i].frameNum; for (int j = i; j < frames.frames.Count; ++j) { NetMessage.SCFrame frame = frames.frames[j]; if (frame.frameNum == FrameNum) { i++; NetMessage.PbFrames pbs = frame.frames[0]; if (pbs == null || pbs.frames.Count == 0) { continue; } for (int k = 0; k < pbs.frames.Count; k++) { NetMessage.PbFrame pb = pbs.frames[k]; if (pb == null) { continue; } Packet move = new Packet(); move.team = TEAM.Neutral; move.packet = Json.DeCode <FramePacket>(pb.content); list.Add(move); } } else { break; } } battleSystem.lockStep.AddFrame(FrameNum, list.ToArray()); list.Clear(); list = null; } }