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


C# DropDownButtonWidget.AttachPanel方法代码示例

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


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

示例1: ShowColorDropDown

		public static void ShowColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world)
		{
			Action onExit = () =>
			{
				Game.Settings.Player.Color = preview.Color;
				Game.Settings.Save();
			};

			color.RemovePanel();

			Action<HSLColor> onChange = c => preview.Color = c;

			var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
			{
				{ "onChange", onChange },
				{ "initialColor", Game.Settings.Player.Color }
			});

			color.AttachPanel(colorChooser, onExit);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:20,代码来源:ColorPickerLogic.cs

示例2: ShowColorDropDown

        void ShowColorDropDown(DropDownButtonWidget color, Session.Client client)
        {
            var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" );
            var hueSlider = colorChooser.GetWidget<SliderWidget>("HUE_SLIDER");
            hueSlider.Value = orderManager.LocalClient.ColorRamp.H / 255f;

            var satSlider = colorChooser.GetWidget<SliderWidget>("SAT_SLIDER");
            satSlider.Value = orderManager.LocalClient.ColorRamp.S / 255f;

            var lumSlider = colorChooser.GetWidget<SliderWidget>("LUM_SLIDER");
            lumSlider.Value = orderManager.LocalClient.ColorRamp.L / 255f;

            var rangeSlider = colorChooser.GetWidget<SliderWidget>("RANGE_SLIDER");
            rangeSlider.Value = orderManager.LocalClient.ColorRamp.R / 255f;

            Action updateColorPreview = () => UpdateColorPreview(hueSlider.Value, satSlider.Value, lumSlider.Value, rangeSlider.Value);

            hueSlider.OnChange += _ => updateColorPreview();
            satSlider.OnChange += _ => updateColorPreview();
            lumSlider.OnChange += _ => updateColorPreview();
            rangeSlider.OnChange += _ => updateColorPreview();
            updateColorPreview();

            colorChooser.GetWidget<ButtonWidget>("BUTTON_OK").OnClick = () =>
            {
                updateColorPreview();
                UpdatePlayerColor(hueSlider.Value, satSlider.Value, lumSlider.Value, rangeSlider.Value);
                color.RemovePanel();
            };

            color.AttachPanel(colorChooser);
        }
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:32,代码来源:LobbyLogic.cs

示例3: ShowColorDropDown

        public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client,
			OrderManager orderManager, World world, ColorPreviewManagerWidget preview)
        {
            Action onExit = () =>
            {
                if (client.Bot == null)
                {
                    Game.Settings.Player.Color = preview.Color;
                    Game.Settings.Save();
                }

                color.RemovePanel();
                orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, preview.Color)));
            };

            Action<HSLColor> onChange = c => preview.Color = c;

            var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
            {
                { "onChange", onChange },
                { "initialColor", client.Color }
            });

            color.AttachPanel(colorChooser, onExit);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:25,代码来源:LobbyUtils.cs

示例4: ShowColorDropDown

        public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client,
			OrderManager orderManager, ColorPickerPaletteModifier preview)
        {
            Action<ColorRamp> onSelect = c =>
            {
                if (client.Bot == null)
                {
                    Game.Settings.Player.ColorRamp = c;
                    Game.Settings.Save();
                }

                color.RemovePanel();
                orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, c)));
            };

            Action<ColorRamp> onChange = c => preview.Ramp = c;

            var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs()
            {
                { "onSelect", onSelect },
                { "onChange", onChange },
                { "initialRamp", client.ColorRamp }
            });

            color.AttachPanel(colorChooser);
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:26,代码来源:LobbyUtils.cs

示例5: ShowColorPicker

        bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s)
        {
            Action<HSLColor> onChange = c => colorPreview.Color = c;
            Action onExit = () =>
            {
                s.Color = colorPreview.Color;
                color.RemovePanel();
            };

            var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
            {
                { "onExit", onExit },
                { "onChange", onChange },
                { "initialColor", s.Color }
            });

            color.AttachPanel(colorChooser, onExit);
            return true;
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:19,代码来源:CncSettingsLogic.cs

示例6: ShowColorPicker

        bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s)
        {
            Action<ColorRamp> onSelect = c => { s.ColorRamp = c; color.RemovePanel(); };
            Action<ColorRamp> onChange = c => {	playerPalettePreview.Ramp = c; };

            var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
            {
                { "onSelect", onSelect },
                { "onChange", onChange },
                { "initialRamp", s.ColorRamp }
            });

            color.AttachPanel(colorChooser);
            return true;
        }
开发者ID:JamesDunne,项目名称:OpenRA,代码行数:15,代码来源:CncSettingsLogic.cs


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