示例#1
0
文件: Room.cs 项目: ProjectsPZ/PB0.1
 public bool RoundResetRoomF1(int round)
 {
     lock (this._lock)
     {
         if (this.LastRound != round)
         {
             if (Config.isTestMode)
             {
                 Logger.warning("Reseting room. [Last: " + (object)this.LastRound + "; New: " + (object)round + "]", false);
             }
             DateTime now = DateTime.Now;
             this.LastRound      = round;
             this._hasC4         = false;
             this.BombPosition   = new Half3();
             this._dropCounter   = 0;
             this._objsSyncRound = 0;
             this._sourceToMap   = this._mapId;
             if (!this._isBotMode)
             {
                 for (int index = 0; index < 16; ++index)
                 {
                     Player player = this._players[index];
                     player._life = player._maxLife;
                 }
                 this.LastPlayersSync = now;
                 this.Map             = MappingXML.getMapById(this._mapId);
                 List <ObjModel> objModelList = this.Map != null ? this.Map._objects : (List <ObjModel>)null;
                 if (objModelList != null)
                 {
                     for (int index = 0; index < objModelList.Count; ++index)
                     {
                         ObjModel   objModel   = objModelList[index];
                         ObjectInfo objectInfo = this._objects[objModel._id];
                         objectInfo._life = objModel._life;
                         if (!objModel._noInstaSync)
                         {
                             objModel.SetRandomAnimToObj(this, objectInfo);
                         }
                         else
                         {
                             objectInfo._anim = new AnimModel()
                             {
                                 _nextAnim = 1
                             };
                             objectInfo.lastInteractionTime = now;
                         }
                         objectInfo._model       = objModel;
                         objectInfo.DestroyState = 0;
                         MappingXML.SetObjectives(objModel, this);
                     }
                 }
                 this.LastObjsSync   = now;
                 this._objsSyncRound = round;
             }
             return(true);
         }
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// Reseta as informações da sala, caso a rodada seja válida.
 /// </summary>
 /// <param name="round">Rodada</param>
 /// <returns></returns>
 public bool RoundResetRoomF1(int round)
 {
     lock (_lock)
     {
         if (LastRound != round)
         {
             if (Config.isTestMode)
             {
                 Printf.warning("Reseting room. [Last: " + LastRound + "; New: " + round + "]");
             }
             DateTime now = DateTime.Now;
             LastRound      = round;
             _hasC4         = false;
             BombPosition   = new Half3();
             _dropCounter   = 0;
             _objsSyncRound = 0;
             _sourceToMap   = _mapId;
             if (!_isBotMode)
             {
                 for (int i = 0; i < 16; i++)
                 {
                     Player player = _players[i];
                     player._life = player._maxLife;
                 }
                 LastPlayersSync = now;
                 Map             = MappingXML.getMapById(_mapId);
                 List <ObjModel> objsm = Map != null ? Map._objects : null;
                 if (objsm != null)
                 {
                     for (int i = 0; i < objsm.Count; i++)
                     {
                         ObjModel   ob  = objsm[i];
                         ObjectInfo obj = _objects[ob._id];
                         obj._life = ob._life;
                         if (!ob._noInstaSync)
                         {
                             ob.GetARandomAnim(this, obj);
                         }
                         else
                         {
                             obj._anim = new AnimModel {
                                 _nextAnim = 1
                             };
                             obj._useDate = now;
                         }
                         obj._model       = ob;
                         obj.DestroyState = 0;
                         MappingXML.SetObjectives(ob, this);
                     }
                 }
                 LastObjsSync   = now;
                 _objsSyncRound = round;
             }
             return(true);
         }
     }
     return(false);
 }