コード例 #1
0
        public void SavePlayer(PlayerStoreData playerStoreData)
        {
            var storedPlayer = GetPlayerOrNull(playerStoreData.PlayerId, playerStoreData.PlayerType);

            players.Remove(storedPlayer);

            players.Add(playerStoreData);
        }
コード例 #2
0
        public void LoadPlayer(Guid playerId, PlayerType playerType, Action <PlayerStoreData> callback)
        {
            PlayerStoreData storedPlayer = GetPlayerOrNull(playerId, playerType);

            if (storedPlayer == null)
            {
                throw new Exception("Игрок не найден");
            }

            ExecuteWithDelay(() => callback(storedPlayer));
        }
コード例 #3
0
 public void SavePlayer(PlayerStoreData playerStoreData)
 {
     Task.Run(() =>
     {
         using (IDbConnection con = new Npgsql.NpgsqlConnection(connectionString))
         {
             con.ExecuteScalar <PlayerStoreData>(
                 @"UPDATE users SET name=@Name, is_activated = @isActivated, rating=@rating
                     WHERE player_id=@playerId AND player_type=@playerTypeString", playerStoreData);
         }
     });
 }