public void AddBattle(Battle battle) { BattleList.RemoveAll(bt => bt.Id == battle.Id); if (BattleList.Count != 0) { battle.Id = BattleList.Where(bt => bt.Id > 0).OrderByDescending(bt => bt.Id).First().Id + 1; } else { battle.Id = 1; } BattleList.Add(battle); }
public void Update() { // Очистка завершённых игар BattleList.RemoveAll(battle => battle.Status == BattleStatus.BATTLE_STATUS_DONE); }