コード例 #1
0
 /// <summary>
 /// Вызывается, когда игрок умер или покинул матч или был исключен из матча.
 /// </summary>
 /// <param name="playerDeathData"></param>
 public void MarkPlayerAsExcluded(PlayerDeathData playerDeathData)
 {
     if (!killedPlayerCollection.TryAdd(playerDeathData, null))
     {
         log.Error($"Попытка повторно добавить игрока с {nameof(playerDeathData.PlayerAccountId)} " +
                   $"{playerDeathData.PlayerAccountId} в коллекцию игроков которые были исключены из матча.");
     }
 }
        public async Task <bool> TryNotify(PlayerDeathData playerDeathData)
        {
            string pathname = "/GameServer/PlayerDeath";
            string query    = $"?accountId={playerDeathData.PlayerAccountId}" +
                              $"&placeInBattle={playerDeathData.PlaceInBattle}" +
                              $"&MatchId={playerDeathData.MatchId}" +
                              $"&secret={Globals.GameServerSecret}";

            return(await httpWrapper.HttpDelete(pathname, query));
        }
コード例 #3
0
        public void Validate(PlayerDeathData playerDeathData)
        {
            if (playerDeathData.MatchId == default)
            {
                throw new Exception(nameof(playerDeathData.MatchId));
            }

            if (playerDeathData.PlayerAccountId == default)
            {
                throw new Exception(nameof(playerDeathData.PlayerAccountId));
            }

            if (playerDeathData.PlaceInBattle == default)
            {
                throw new Exception(nameof(playerDeathData.PlaceInBattle));
            }
        }