public void SyncLatest() { var lastestSnapshot = snapshotSelector.LatestSnapshot; if (null == lastestSnapshot) { return; } if (latestSnapshotSeq != lastestSnapshot.SnapshotSeq) { gameContexts.Self = lastestSnapshot.Self; latestSnapshotSeq = lastestSnapshot.SnapshotSeq; EntityMap remoteEntityMap = SyncLatestEntityMap.Allocate(false); EntityMap localEntityMap = SyncLatestEntityMap.Allocate(false); remoteEntityMap.AddAll(RemoteEntityMap); localEntityMap.AddAll(LocalEntityMap); latestCompareAgent.Init(diffHandler, lastestSnapshot.ServerTime); EntityMapCompareExecutor.Diff(localEntityMap, remoteEntityMap, diffHandler, "syncLatest", latestCompareAgent); RefCounterRecycler.Instance.ReleaseReference(remoteEntityMap); RefCounterRecycler.Instance.ReleaseReference(localEntityMap); } }
public void SyncLatest() { if (null == _handler.LatestSnapshot) { return; } if (_latestSnapshotSeq != _handler.LatestSnapshot.SnapshotSeq) { _handler.SetSelf(_handler.LatestSnapshot.Self); _latestSnapshotSeq = _handler.LatestSnapshot.SnapshotSeq; EntityMap remoteEntityMap = SyncLatestEntityMap.Allocate(false); EntityMap localEntityMap = SyncLatestEntityMap.Allocate(false); remoteEntityMap.AddAll(_handler.RemoteEntityMap); localEntityMap.AddAll(_handler.LocalEntityMap); SyncLatestRewindHandler rewindHandler = new SyncLatestRewindHandler(_handler); EntityMapComparator.Diff(localEntityMap, remoteEntityMap, rewindHandler, "syncLatest", _latestComparator.Init(rewindHandler, _handler.LatestSnapshot.ServerTime)); RefCounterRecycler.Instance.ReleaseReference(remoteEntityMap); RefCounterRecycler.Instance.ReleaseReference(localEntityMap); } }