Beispiel #1
0
        private bool RollbackTo(int tick, int maxContinueServerTick, bool isNeedClear = true)
        {
            _world.RollbackTo(tick, maxContinueServerTick, isNeedClear);
            var hash    = _commonStateService.Hash;
            var curHash = _hashHelper.CalcHash();

            if (hash != curHash)
            {
                Debug.LogError($"tick:{tick} Rollback error: Hash isDiff oldHash ={hash}  curHash{curHash}");
#if UNITY_EDITOR
                _dumpHelper.DumpToFile(true);
                return(false);
#endif
            }
            return(true);
        }
 private void DumpFrame(int hash)
 {
     if (_constStateService.IsClientMode)
     {
         if (_hashHelper.TryGetValue(_world.Tick, out var val))
         {
             _dumpHelper.DumpFrame(false);
             if (hash != val)
             {
                 Debug.LogError($"Tick : CurHash {hash} is different from oldHash {val}");
                 _dumpHelper.DumpToFile();
                 _commonStateService.IsPause = true;
             }
         }
         else
         {
             _dumpHelper.DumpFrame(true);
         }
     }
     else
     {
         _dumpHelper.DumpFrame(true);
     }
 }