move duplicates of GetSpawnColors to LobbyInfo
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user