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


C# DropDownButtonWidget.ShowDropDown方法代码示例

本文整理汇总了C#中DropDownButtonWidget.ShowDropDown方法的典型用法代码示例。如果您正苦于以下问题:C# DropDownButtonWidget.ShowDropDown方法的具体用法?C# DropDownButtonWidget.ShowDropDown怎么用?C# DropDownButtonWidget.ShowDropDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DropDownButtonWidget的用法示例。


在下文中一共展示了DropDownButtonWidget.ShowDropDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowSlotDropDown

		public static void ShowSlotDropDown(Ruleset rules, DropDownButtonWidget dropdown, Session.Slot slot,
			Session.Client client, OrderManager orderManager)
		{
			var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>() {{"Slot", new List<SlotDropDownOption>()
			{
				new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)),
				new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed)
			}}};

			var bots = new List<SlotDropDownOption>();
			if (slot.AllowBots)
			{
				foreach (var b in rules.Actors["player"].Traits.WithInterface<IBotInfo>().Select(t => t.Name))
				{
					var bot = b;
					var botController = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.IsAdmin);
					bots.Add(new SlotDropDownOption(bot,
						"slot_bot {0} {1} {2}".F(slot.PlayerReference, botController.Index, bot),
						() => client != null && client.Bot == bot));
				}
			}
			options.Add(bots.Any() ? "Bots" : "Bots Disabled", bots);

			Func<SlotDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
			{
				var item = ScrollItemWidget.Setup(itemTemplate,
					o.Selected,
					() => orderManager.IssueOrder(Order.Command(o.Order)));
				item.Get<LabelWidget>("LABEL").GetText = () => o.Title;
				return item;
			};

			dropdown.ShowDropDown<SlotDropDownOption>("LABEL_DROPDOWN_TEMPLATE", 167, options, setupItem);
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:34,代码来源:LobbyUtils.cs

示例2: ShowDropDown

		void ShowDropDown(Player p, DropDownButtonWidget dropdown)
		{
			var stances = Enum<Stance>.GetValues();
			Func<Stance, ScrollItemWidget, ScrollItemWidget> setupItem = (s, template) =>
			{
				var item = ScrollItemWidget.Setup(template,
					() => s == world.LocalPlayer.Stances[ p ],
					() => SetStance(dropdown, p, s));

				item.Get<LabelWidget>("LABEL").GetText = () => s.ToString();
				return item;
			};

			dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, stances, setupItem);
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:15,代码来源:DiplomacyLogic.cs

示例3: ShowRaceDropDown

        public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client,
			OrderManager orderManager, Dictionary<string, string> countryNames)
        {
            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (race, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => client.Country == race,
                    () => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
                item.GetWidget<LabelWidget>("LABEL").GetText = () => countryNames[race];
                var flag = item.GetWidget<ImageWidget>("FLAG");
                flag.GetImageCollection = () => "flags";
                flag.GetImageName = () => race;
                return item;
            };

            dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, countryNames.Keys.ToList(), setupItem);
        }
开发者ID:hoxworth,项目名称:OpenRA,代码行数:17,代码来源:LobbyUtils.cs

示例4: ActorSelectorLogic

		public ActorSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer, Ruleset modRules)
		{
			this.modRules = modRules;
			this.world = world;
			this.worldRenderer = worldRenderer;

			editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
			ownersDropDown = widget.Get<DropDownButtonWidget>("OWNERS_DROPDOWN");

			panel = widget.Get<ScrollPanelWidget>("ACTORTEMPLATE_LIST");
			itemTemplate = panel.Get<ScrollItemWidget>("ACTORPREVIEW_TEMPLATE");
			panel.Layout = new GridLayout(panel);

			var editorLayer = world.WorldActor.Trait<EditorActorLayer>();

			selectedOwner = editorLayer.Players.Players.Values.First();
			Func<PlayerReference, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
			{
				var item = ScrollItemWidget.Setup(template, () => selectedOwner == option, () =>
				{
					selectedOwner = option;

					ownersDropDown.Text = selectedOwner.Name;
					ownersDropDown.TextColor = selectedOwner.Color.RGB;

					IntializeActorPreviews();
				});

				item.Get<LabelWidget>("LABEL").GetText = () => option.Name;
				item.GetColor = () => option.Color.RGB;

				return item;
			};

			ownersDropDown.OnClick = () =>
			{
				var owners = editorLayer.Players.Players.Values.OrderBy(p => p.Name);
				ownersDropDown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, owners, setupItem);
			};

			ownersDropDown.Text = selectedOwner.Name;
			ownersDropDown.TextColor = selectedOwner.Color.RGB;

			IntializeActorPreviews();
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:45,代码来源:ActorSelectorLogic.cs

示例5: ObserverStatsLogic

		public ObserverStatsLogic(World world, WorldRenderer worldRenderer, Widget widget, Action onExit)
		{
			this.world = world;
			this.worldRenderer = worldRenderer;
			players = world.Players.Where(p => !p.NonCombatant);

			basicStatsHeaders = widget.Get<ContainerWidget>("BASIC_STATS_HEADERS");
			economyStatsHeaders = widget.Get<ContainerWidget>("ECONOMY_STATS_HEADERS");
			productionStatsHeaders = widget.Get<ContainerWidget>("PRODUCTION_STATS_HEADERS");
			combatStatsHeaders = widget.Get<ContainerWidget>("COMBAT_STATS_HEADERS");
			earnedThisMinuteGraphHeaders = widget.Get<ContainerWidget>("EARNED_THIS_MIN_GRAPH_HEADERS");

			playerStatsPanel = widget.Get<ScrollPanelWidget>("PLAYER_STATS_PANEL");
			playerStatsPanel.Layout = new GridLayout(playerStatsPanel);

			basicPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("BASIC_PLAYER_TEMPLATE");
			economyPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("ECONOMY_PLAYER_TEMPLATE");
			productionPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("PRODUCTION_PLAYER_TEMPLATE");
			combatPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("COMBAT_PLAYER_TEMPLATE");
			earnedThisMinuteGraphTemplate = playerStatsPanel.Get<ContainerWidget>("EARNED_THIS_MIN_GRAPH_TEMPLATE");

			teamTemplate = playerStatsPanel.Get<ScrollItemWidget>("TEAM_TEMPLATE");

			statsDropDown = widget.Get<DropDownButtonWidget>("STATS_DROPDOWN");
			statsDropDown.GetText = () => "Basic";
			statsDropDown.OnMouseDown = _ =>
			{
				var options = new List<StatsDropDownOption>
				{
					new StatsDropDownOption
					{
						Title = "Basic",
						IsSelected = () => basicStatsHeaders.Visible,
						OnClick = () =>
						{
							ClearStats();
							statsDropDown.GetText = () => "Basic";
							DisplayStats(BasicStats);
						}
					},
					new StatsDropDownOption
					{
						Title = "Economy",
						IsSelected = () => economyStatsHeaders.Visible,
						OnClick = () =>
						{
							ClearStats();
							statsDropDown.GetText = () => "Economy";
							DisplayStats(EconomyStats);
						}
					},
					new StatsDropDownOption
					{
						Title = "Production",
						IsSelected = () => productionStatsHeaders.Visible,
						OnClick = () =>
						{
							ClearStats();
							statsDropDown.GetText = () => "Production";
							DisplayStats(ProductionStats);
						}
					},
					new StatsDropDownOption
					{
						Title = "Combat",
						IsSelected = () => combatStatsHeaders.Visible,
						OnClick = () =>
						{
							ClearStats();
							statsDropDown.GetText = () => "Combat";
							DisplayStats(CombatStats);
						}
					},
					new StatsDropDownOption
					{
						Title = "Earnings (graph)",
						IsSelected = () => earnedThisMinuteGraphHeaders.Visible,
						OnClick = () =>
						{
							ClearStats();
							statsDropDown.GetText = () => "Earnings (graph)";
							EarnedThisMinuteGraph();
						}
					}
				};
				Func<StatsDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
				{
					var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick);
					item.Get<LabelWidget>("LABEL").GetText = () => option.Title;
					return item;
				};
				statsDropDown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem);
			};

			ClearStats();
			DisplayStats(BasicStats);

			var close = widget.GetOrNull<ButtonWidget>("CLOSE");
			if (close != null)
				close.OnClick = () =>
//.........这里部分代码省略.........
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:101,代码来源:ObserverStatsLogic.cs

示例6: 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

示例7: ShowAudioDeviceDropdown

        bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundSettings s, SoundDevice[] devices)
        {
            var i = 0;
            var options = devices.ToDictionary(d => (i++).ToString(), d => d);

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => soundDevice == options[o],
                    () => soundDevice = options[o]);

                item.Get<LabelWidget>("LABEL").GetText = () => options[o].Label;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:18,代码来源:SettingsMenuLogic.cs

示例8: ShowSpawnDropDown

        public static void ShowSpawnDropDown(DropDownButtonWidget dropdown, Session.Client client,
			OrderManager orderManager, IEnumerable<int> spawnPoints)
        {
            Func<int, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, itemTemplate) =>
            {
                var spawnPoint = spawnPoints.ToList()[ii];
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => client.SpawnPoint == spawnPoint,
                    () => SetSpawnPoint(orderManager, client, spawnPoint));
                item.Get<LabelWidget>("LABEL").GetText = () => spawnPoint == 0 ? "-" : Convert.ToChar('A' - 1 + spawnPoint).ToString();
                return item;
            };

            var options = Exts.MakeArray(spawnPoints.Count(), i => i).ToList();
            dropdown.ShowDropDown("SPAWN_DROPDOWN_TEMPLATE", 150, options, setupItem);
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:16,代码来源:LobbyUtils.cs

示例9: ShowSpawnDropDown

        void ShowSpawnDropDown(DropDownButtonWidget dropdown, Session.Client client)
        {
            Func<int, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                                                  () => client.SpawnPoint == ii,
                                                  () => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii))));
                item.GetWidget<LabelWidget>("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString();
                return item;
            };

            var taken = orderManager.LobbyInfo.Clients
                .Where(c => c.SpawnPoint != 0 && c.SpawnPoint != client.SpawnPoint && c.Slot != null)
                .Select(c => c.SpawnPoint).ToList();

            var options = Graphics.Util.MakeArray(Map.SpawnPoints.Count() + 1, i => i).Except(taken).ToList();
            dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem);
        }
开发者ID:hoxworth,项目名称:OpenRA,代码行数:18,代码来源:CncLobbyLogic.cs

示例10: ShowRendererDropdown

        public static bool ShowRendererDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
        {
            var options = new Dictionary<string, string>()
            {
                { "OpenGL", "Gl" },
                { "Cg Toolkit", "Cg" },
            };

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => s.Renderer == options[o],
                    () => s.Renderer = options[o]);
                item.Get<LabelWidget>("LABEL").GetText = () => o;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:20,代码来源:SettingsMenuLogic.cs

示例11: ShowSoundTickDropdown

        public static bool ShowSoundTickDropdown(DropDownButtonWidget dropdown, SoundSettings audio)
        {
            var options = new Dictionary<string, SoundCashTicks>()
            {
                { "Extreme", SoundCashTicks.Extreme },
                { "Normal", SoundCashTicks.Normal },
                { "Disabled", SoundCashTicks.Disabled },
            };

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => audio.SoundCashTickType == options[o],
                    () => audio.SoundCashTickType = options[o]);
                item.Get<LabelWidget>("LABEL").GetText = () => o;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:21,代码来源:SettingsMenuLogic.cs

示例12: ShowTeamDropDown

        public static void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client,
			OrderManager orderManager, int teamCount)
        {
            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 = Enumerable.Range(0, teamCount + 1);
            dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:15,代码来源:LobbyUtils.cs

示例13: ShowSlotDropDown

        void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client)
        {
            var options = new List<SlotDropDownOption>()
            {
                new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)),
                new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed)
            };

            if (slot.AllowBots)
                foreach (var b in Rules.Info["player"].Traits.WithInterface<IBotInfo>().Select(t => t.Name))
                {
                    var bot = b;
                    options.Add(new SlotDropDownOption("Bot: {0}".F(bot),
                        "slot_bot {0} {1}".F(slot.PlayerReference, bot),
                        () => client != null && client.Bot == bot));
                }

            Func<SlotDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    o.Selected,
                    () => orderManager.IssueOrder(Order.Command(o.Order)));
                item.GetWidget<LabelWidget>("LABEL").GetText = () => o.Title;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem);
        }
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:28,代码来源:LobbyLogic.cs

示例14: SetupGameModeDropdown

        void SetupGameModeDropdown(MapClassification tab, DropDownButtonWidget gameModeDropdown, ScrollItemWidget itemTemplate)
        {
            if (gameModeDropdown != null)
            {
                var gameModes = tabMaps[tab]
                    .GroupBy(m => m.Type)
                    .Select(g => Pair.New(g.Key, g.Count())).ToList();

                // 'all game types' extra item
                gameModes.Insert(0, Pair.New(null as string, tabMaps[tab].Count()));

                Func<Pair<string, int>, string> showItem = x => "{0} ({1})".F(x.First ?? "All Game Types", x.Second);

                Func<Pair<string, int>, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, template) =>
                {
                    var item = ScrollItemWidget.Setup(template,
                        () => gameMode == ii.First,
                        () => { gameMode = ii.First; EnumerateMaps(tab, itemTemplate); });
                    item.Get<LabelWidget>("LABEL").GetText = () => showItem(ii);
                    return item;
                };

                gameModeDropdown.OnClick = () =>
                    gameModeDropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 210, gameModes, setupItem);

                gameModeDropdown.GetText = () =>
                {
                    var item = gameModes.FirstOrDefault(m => m.First == gameMode);
                    if (item == default(Pair<string, int>))
                        item.First = "No matches";

                    return showItem(item);
                };
            }
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:35,代码来源:MapChooserLogic.cs

示例15: ShowFactionDropDown

        public static void ShowFactionDropDown(DropDownButtonWidget dropdown, Session.Client client,
			OrderManager orderManager, Dictionary<string, LobbyFaction> factions)
        {
            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (factionId, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => client.Faction == factionId,
                    () => orderManager.IssueOrder(Order.Command("faction {0} {1}".F(client.Index, factionId))));
                var faction = factions[factionId];
                item.Get<LabelWidget>("LABEL").GetText = () => faction.Name;
                var flag = item.Get<ImageWidget>("FLAG");
                flag.GetImageCollection = () => "flags";
                flag.GetImageName = () => factionId;
                item.GetTooltipText = () => faction.Description;
                return item;
            };

            var options = factions.Where(f => f.Value.Selectable).GroupBy(f => f.Value.Side)
                .ToDictionary(g => g.Key ?? "", g => g.Select(f => f.Key));

            dropdown.ShowDropDown("FACTION_DROPDOWN_TEMPLATE", 150, options, setupItem);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:22,代码来源:LobbyUtils.cs


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