当前位置: 首页>>代码示例>>C#>>正文


C# Map.GetSpawnPoints方法代码示例

本文整理汇总了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));
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:9,代码来源:LobbyUtils.cs

示例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);
 }
开发者ID:Tsher,项目名称:OpenRA,代码行数:9,代码来源:LobbyUtils.cs

示例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)));
            }
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:20,代码来源:LobbyUtils.cs

示例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);
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:15,代码来源:LobbyUtils.cs


注:本文中的OpenRA.FileFormats.Map.GetSpawnPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。