Example #1
0
        public async Task <List <PlayerLocationDto> > GetLocations()
        {
            var query = new TableQuery <PlayerLocationEntity>().AsTableQuery();

            var results = new List <PlayerLocationDto>();

            TableContinuationToken continuationToken = null;

            do
            {
                var queryResult = await _locationsTable.ExecuteQuerySegmentedAsync(query, continuationToken);

                foreach (var entity in queryResult)
                {
                    var playerLocationDto = new PlayerLocationDto
                    {
                        GameType    = entity.GameType,
                        ServerId    = entity.ServerId,
                        ServerName  = entity.ServerName,
                        Guid        = entity.Guid,
                        PlayerName  = entity.PlayerName,
                        GeoLocation = entity.GeoLocation
                    };

                    results.Add(playerLocationDto);
                }

                continuationToken = queryResult.ContinuationToken;
            } while (continuationToken != null);

            return(results);
        }
Example #2
0
        public async Task UpdateEntry(PlayerLocationDto model)
        {
            var playerLocationEntity = new PlayerLocationEntity
            {
                PartitionKey = model.ServerId.ToString(),
                GameType     = model.GameType,
                ServerId     = model.ServerId,
                ServerName   = model.ServerName,
                Guid         = model.Guid,
                PlayerName   = model.PlayerName,
                GeoLocation  = model.GeoLocation
            };

            if (string.IsNullOrWhiteSpace(playerLocationEntity.RowKey))
            {
                playerLocationEntity.RowKey = GenerateRowKeyForPlayerLocation(model);
            }

            var operation = TableOperation.InsertOrMerge(playerLocationEntity);
            await _locationsTable.ExecuteAsync(operation);
        }
Example #3
0
 public RoomInvitationPlayerAckMessage(ulong unk1, string unk2, PlayerLocationDto location)
 {
     Unk1     = unk1;
     Unk2     = unk2;
     Location = location;
 }
Example #4
0
 public RoomInvitationPlayerAckMessage()
 {
     Unk2     = "";
     Location = new PlayerLocationDto();
 }
Example #5
0
 private static string GenerateRowKeyForPlayerLocation(PlayerLocationDto playerLocationDto)
 {
     return($"{playerLocationDto.GameType}-{playerLocationDto.ServerId}-{playerLocationDto.Guid}");
 }
Example #6
0
 public RoomInvitationPlayerAckMessage(ulong senderid, string sendernickname, PlayerLocationDto location)
 {
     SenderId       = senderid;
     SenderNickname = sendernickname;
     Location       = location;
 }