move duplicates of GetSpawnColors to LobbyInfo

This commit is contained in:
Chris Forbes
2011-10-18 20:15:31 +13:00
parent 89ea4d1e0a
commit 50010faf58
3 changed files with 17 additions and 28 deletions

View File

@@ -138,20 +138,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
mapTitle.IsVisible = () => Map != null;
mapTitle.GetText = () => Map.Title;
mapPreview.SpawnColors = () =>
{
var spawns = Map.SpawnPoints;
var sc = new Dictionary<int2, Color>();
for (int i = 1; i <= spawns.Count(); i++)
{
var client = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.SpawnPoint == i);
if (client == null)
continue;
sc.Add(spawns.ElementAt(i - 1), client.ColorRamp.GetColor(0));
}
return sc;
};
mapPreview.SpawnColors = () => LobbyUtils.GetSpawnColors( orderManager, Map );
CountryNames = Rules.Info["world"].Traits.WithInterface<CountryInfo>()
.Where(c => c.Selectable)

View File

@@ -91,20 +91,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
}
};
mapPreview.SpawnColors = () =>
{
var spawns = Map.SpawnPoints;
var sc = new Dictionary<int2, Color>();
for (int i = 1; i <= spawns.Count(); i++)
{
var client = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.SpawnPoint == i);
if (client == null)
continue;
sc.Add(spawns.ElementAt(i - 1), client.ColorRamp.GetColor(0));
}
return sc;
};
mapPreview.SpawnColors = () => LobbyUtils.GetSpawnColors( orderManager, Map );
CountryNames = Rules.Info["world"].Traits.WithInterface<CountryInfo>()
.Where(c => c.Selectable)

View File

@@ -118,5 +118,20 @@ namespace OpenRA.Mods.RA.Widgets.Logic
dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, countryNames.Keys.ToList(), setupItem);
}
public static Dictionary<int2, Color> GetSpawnColors(OrderManager orderManager, Map map)
{
var spawns = Map.SpawnPoints;
var sc = new Dictionary<int2, Color>();
for (int i = 1; i <= spawns.Count(); i++)
{
var client = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.SpawnPoint == i);
if (client == null)
continue;
sc.Add(spawns.ElementAt(i - 1), client.ColorRamp.GetColor(0));
}
return sc;
}
}
}