コード例 #1
0
 public static Country GetConnectedFriendlyCountry(Game game, Player player, Country origin, MapTemplate mapTemplate)
 {
     return game.Teams.Where(x => x.Players.Contains(player))
             .SelectMany(t => t.Players)
             .SelectMany(p => p.Countries).First(c => mapTemplate.AreConnected(origin.CountryIdentifier, c.CountryIdentifier));
 }
コード例 #2
0
ファイル: Map.cs プロジェクト: cschleiden/imperaplus-backend
        internal void UpdateOwnership(Player oldPlayer, Player newPlayer, Country country)
        {
            if (oldPlayer != null)
            {
                if (this.PlayerToCountry.ContainsKey(oldPlayer.Id))
                {
                    this.PlayerToCountry[oldPlayer.Id].Remove(country);
                }
            }

            if (newPlayer != null)
            {
                if (this.PlayerToCountry.ContainsKey(newPlayer.Id))
                {
                    this.PlayerToCountry[newPlayer.Id].Add(country);
                }
                else
                {
                    this.PlayerToCountry.Add(newPlayer.Id, new List<Country> { country });
                }

                country.PlayerId = newPlayer.Id;
                country.TeamId = newPlayer.TeamId;
            }
            else
            {
                country.PlayerId = Guid.Empty;
                country.TeamId = Guid.Empty;
            }
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: cschleiden/imperaplus-backend
 internal void UpdateOwnership(Player player, Country country)
 {
     this.UpdateOwnership(null, player, country);
 }
コード例 #4
0
 public static Country GetConnectedEnemyCountry(Game game, Player player, Country origin, MapTemplate mapTemplate)
 {
     return GetEnemyTeams(game, player)
             .SelectMany(t => t.Players)
             .SelectMany(p => p.Countries).First(c => mapTemplate.AreConnected(origin.CountryIdentifier, c.CountryIdentifier));
 }