protected void Start() { var reader = new NetworkReader(file.bytes); var msg = new Msg.Sync() { syncList = new List <List <Snapshot> >() }; msg.Deserialize(reader); }
private void Sync(byte msgId, NetworkReader reader, IPEndPoint ep) { if (ServerMgr.Active) { return; } var msg = new Msg.Sync() { syncList = this.syncList }; msg.Deserialize(reader, this.fd); var list = msg.selfList; var serverList = msg.serverList; int index = list.Count; for (int i = 0; i < list.Count; i++) { if (!list[i].Equals(this.checkList[i])) { index = i; print(i); break; } } if (index == list.Count) // Agreement { this.checkList.RemoveRange(0, list.Count); } else { var frame = list[list.Count - 1].frame; for (int i = this.checkList.Count - 1; i >= 0; i--) { if (this.checkList[i].frame <= frame) { this.checkList.RemoveAt(i); } } ClientMgr.Resolve(this.fd, list, index); ClientMgr.Resolve(this.fd, this.checkList, 0); } ClientMgr.Resolve(this.fd, serverList, 0); }