本文整理汇总了C#中OpenRA.FileFormats.Map.GetSpawnPoints方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetSpawnPoints方法的具体用法?C# Map.GetSpawnPoints怎么用?C# Map.GetSpawnPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.FileFormats.Map
的用法示例。
在下文中一共展示了Map.GetSpawnPoints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSpawnColors
public static Dictionary<int2, Color> GetSpawnColors(OrderManager orderManager, Map map)
{
var spawns = map.GetSpawnPoints();
return orderManager.LobbyInfo.Clients
.Where( c => c.SpawnPoint != 0 )
.ToDictionary(
c => spawns[c.SpawnPoint - 1],
c => c.ColorRamp.GetColor(0));
}
示例2: GetSpawnClients
public static Dictionary<int2, Session.Client> GetSpawnClients(OrderManager orderManager, Map map)
{
var spawns = map.GetSpawnPoints();
return orderManager.LobbyInfo.Clients
.Where(c => c.SpawnPoint != 0)
.ToDictionary(
c => spawns[c.SpawnPoint - 1],
c => c);
}
示例3: SelectSpawnPoint
public static void SelectSpawnPoint(OrderManager orderManager, MapPreviewWidget mapPreview, Map map, MouseInput mi)
{
if (map == null || mi.Button != MouseButton.Left
|| orderManager.LocalClient.State == Session.ClientState.Ready)
return;
var selectedSpawn = map.GetSpawnPoints()
.Select((sp, i) => Pair.New(mapPreview.ConvertToPreview(sp), i))
.Where(a => (a.First - mi.Location).LengthSquared < 64)
.Select(a => a.Second + 1)
.FirstOrDefault();
var owned = orderManager.LobbyInfo.Clients.Any(c => c.SpawnPoint == selectedSpawn);
if (selectedSpawn == 0 || !owned)
{
var locals = orderManager.LobbyInfo.Clients.Where(c => c.Index == orderManager.LocalClient.Index || (Game.IsHost && c.Bot != null));
var playerToMove = locals.Where(c => (selectedSpawn == 0) ^ (c.SpawnPoint == 0)).FirstOrDefault();
orderManager.IssueOrder(Order.Command("spawn {0} {1}".F((playerToMove ?? orderManager.LocalClient).Index, selectedSpawn)));
}
}
示例4: ShowTeamDropDown
public static void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client,
OrderManager orderManager, Map map)
{
Func<int, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => client.Team == ii,
() => orderManager.IssueOrder(Order.Command("team {0} {1}".F(client.Index, ii))));
item.Get<LabelWidget>("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString();
return item;
};
var options = Exts.MakeArray(map.GetSpawnPoints().Length + 1, i => i).ToList();
dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem);
}