Ejemplo n.º 1
0
 public SyncLastestManager(IGameContexts gameContexts, ISnapshotSelector snapshotSelector)
 {
     this.gameContexts     = gameContexts;
     this.snapshotSelector = snapshotSelector;
     diffHandler           = new SyncLatestMapDiffHandler(this);
     latestCompareAgent    = new GameEntitySelfLatestCompareAgent();
 }
 public AbstractPredictionInfoProvider(
     ISnapshotSelectorContainer snapshotSelector,
     IGameContexts gameContexts)
 {
     _snapshotSelector = snapshotSelector;
     _gameContexts     = gameContexts;
 }
Ejemplo n.º 3
0
 public VehiclePredictionProvider(ISnapshotSelector snapshotSelector, IGameContexts gameContexts,
                                  VehicleContext vehicleContext, bool serverAuthorative) : base(snapshotSelector,
                                                                                                gameContexts)
 {
     _vehicleContext    = vehicleContext;
     _serverAuthorative = serverAuthorative;
 }
 public UserPredictionInfoProvider(
     ISnapshotSelectorContainer snapshotSelector,
     PlayerContext playerContext,
     IGameContexts gameContexts)
     : base(snapshotSelector, gameContexts)
 {
     _playerContext = playerContext;
 }
Ejemplo n.º 5
0
        public void Update(List <IGameEntity> preEntitys, IContexts _newContexts)
        {
            try
            {
                _contexts = _newContexts;

                _removeList.Clear();

                // _preEntitys_HashSet 进行填充,用于在 Add 函数中判断 是否加入的entity是 上次残留的对象
                _preEntitys_HashSet.Clear();
                foreach (var entity in preEntitys)
                {
                    _preEntitys_HashSet.Add(entity.EntityKey);
                }

                // 获取 _gameContexts
                if (_gameContexts == null)
                {
                    _gameContexts = (_newContexts as Contexts).session.commonSession.GameContexts;
                }

                // 遍历残留字典
                foreach (var keyValue in _dict)
                {
                    var entityKey = keyValue.Key;

                    IGameEntity entity = null;
                    //---------------------------------------------------
                    // 找不到entityKey对应的entity,就标记去除
                    if (!_gameContexts.TryGetGameEntity(entityKey, out entity))
                    {
                        _removeList.Add(entityKey);
                        continue;
                    }

                    //---------------------------------------------------
                    // 不符合条件的就标记去除
                    if (!keyValue.Value.CanStay(_contexts))
                    {
                        _removeList.Add(entityKey);
                        continue;
                    }
                    //---------------------------------------------------

                    preEntitys.Add(entity);
                }

                // -----清除被标记的key-------------------------------
                foreach (var entityKey in _removeList)
                {
                    _dict.Remove(entityKey);
                }
            }
            catch (Exception e)
            {
                _logger.ErrorFormat("当前线程为 {0},异常为:{1}", System.Threading.Thread.CurrentThread.Name, e.Message + "\n" + e.StackTrace);
            }
        }
Ejemplo n.º 6
0
 public SyncLatestHandler(
     ISnapshotSelectorContainer snapshotPool,
     IGameContexts gameContexts,
     ISnapshotEntityMapFilter snapshotEntityMapFilter)
 {
     _snapshotPool            = snapshotPool;
     _gameContexts            = gameContexts;
     _snapshotEntityMapFilter = snapshotEntityMapFilter;
 }
 public CommoTickImmutabblitySystem(
     IGameContexts gameContexts)
 {
     foreach (var info in gameContexts.AllContexts)
     {
         if (info.CanContainComponent <FlagImmutabilityComponent>())
         {
             _groups.Add(info.CreateGameGroup <FlagImmutabilityComponent>());
         }
     }
 }
Ejemplo n.º 8
0
 public CommonLifeTimeSystem(
     IGameContexts gameContexts)
 {
     foreach (var info in gameContexts.AllContexts)
     {
         if (info.CanContainComponent <LifeTimeComponent>())
         {
             _groups.Add(info.CreateGameGroup <LifeTimeComponent>());
         }
     }
 }
Ejemplo n.º 9
0
 public UserPredictionProvider(ISnapshotSelector snapshotSelector, PlayerContext playerContext,
                               IGameContexts gameContexts) : base(snapshotSelector, gameContexts)
 {
     this.playerContext = playerContext;
 }
Ejemplo n.º 10
0
 public ClientCompensationWorldFactory(IGameContexts gameContexts, IHitBoxEntityManager hitboxHandler)
     : base(hitboxHandler)
 {
     _gameContexts = gameContexts;
 }
Ejemplo n.º 11
0
 public ClientUpdateLatestManager(IGameContexts gameContexts)
 {
     this.gameContexts = gameContexts;
 }
Ejemplo n.º 12
0
 public UpdateLatestHandler(IGameContexts gameContexts)
 {
     _gameContexts = gameContexts;
 }
Ejemplo n.º 13
0
 public PlaybackInfoProvider(IGameContexts gameContexts)
 {
     this.gameContexts = gameContexts;
 }
Ejemplo n.º 14
0
 public SnapshotFactory(IGameContexts gameContexts)
 {
     _gameContexts = gameContexts;
 }
Ejemplo n.º 15
0
 public OfflineSnapshotSelector(EntityKey self, IGameContexts gameContexts)
 {
     _self        = self;
     _snapshotFac = new SnapshotFactory(gameContexts);
 }
 public AbstractPredictionProvider(ISnapshotSelector snapshotSelector, IGameContexts gameContexts)
 {
     this.snapshotSelector = snapshotSelector;
     this.gameContexts     = gameContexts;
 }