當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。