• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WidgetArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WidgetArgs的典型用法代码示例。如果您正苦于以下问题:C# WidgetArgs类的具体用法?C# WidgetArgs怎么用?C# WidgetArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WidgetArgs类属于命名空间,在下文中一共展示了WidgetArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialize

		public override void Initialize(WidgetArgs args)
		{
			paletteOpenOrigin = new float2(Game.Renderer.Resolution.Width - Columns*IconWidth - 23, 280);
			paletteClosedOrigin = new float2(Game.Renderer.Resolution.Width - 16, 280);
			paletteOrigin = paletteClosedOrigin;
			base.Initialize(args);
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:7,代码来源:BuildPaletteWidget.cs


示例2: StartGame

        public void StartGame(Arguments args)
        {
            var widgetArgs = new WidgetArgs();

            Ui.LoadWidget("MODCHOOSER_BACKGROUND", Ui.Root, widgetArgs);
            Ui.OpenWindow("MODCHOOSER_DIALOG", widgetArgs);
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:7,代码来源:ModChooserLoadScreen.cs


示例3: LoadWidget

        public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
        {
            if (!args.ContainsKey("modData"))
                args = new WidgetArgs(args) { { "modData", modData } };

            var widget = NewWidget(node.Key, args);

            if (parent != null)
                parent.AddChild(widget);

            if (node.Key.Contains("@"))
                FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);

            foreach (var child in node.Value.Nodes)
                if (child.Key != "Children")
                    FieldLoader.LoadField(widget, child.Key, child.Value.Value);

            widget.Initialize(args);

            foreach (var child in node.Value.Nodes)
                if (child.Key == "Children")
                    foreach (var c in child.Value.Nodes)
                        LoadWidget(args, widget, c);

            var logicNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "Logic");
            var logic = logicNode == null ? null : logicNode.Value.ToDictionary();
            args.Add("logicArgs", logic);

            widget.PostInit(args);

            args.Remove("logicArgs");

            return widget;
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:34,代码来源:WidgetLoader.cs


示例4: RAInstallLogic

        public RAInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading)
        {
            var panel = widget.Get("INSTALL_PANEL");
            var args = new WidgetArgs()
            {
                { "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
                { "installData", installData },
                { "continueLoading", continueLoading }
            };

            panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);

            panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_FROMCD_PANEL", args);

            panel.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;

            panel.Get<ButtonWidget>("MODS_BUTTON").OnClick = () =>
            {
                Ui.OpenWindow("MODS_PANEL", new WidgetArgs()
                              {
                    { "onExit", () => {} },
                    // Close this panel
                    { "onSwitch", Ui.CloseWindow },
                });
            };
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:28,代码来源:RAInstallLogic.cs


示例5: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			icon = new Animation(world, "icon");
			clock = new Animation(world, "clock");
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:7,代码来源:SupportPowerBinWidget.cs


示例6: Initialize

        public override void Initialize(WidgetArgs args)
        {
            base.Initialize(args);

            // Start in the closed position
            offset = ClosedOffset;
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:7,代码来源:SlidingContainerWidget.cs


示例7: CncInstallLogic

        public CncInstallLogic(Widget widget, Dictionary<string, string> installData, Action continueLoading)
        {
            var panel = widget.Get("INSTALL_PANEL");
            var args = new WidgetArgs()
            {
                { "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
                { "installData", installData }
            };

            panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);

            panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_FROMCD_PANEL", new WidgetArgs(args)
                {
                    { "filesToCopy", new[] { "CONQUER.MIX", "DESERT.MIX", "SCORES.MIX",
                                             "SOUNDS.MIX", "TEMPERAT.MIX", "WINTER.MIX" } },
                    { "filesToExtract", new[] { "speech.mix", "tempicnh.mix", "transit.mix" } },
                });

            panel.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;

            panel.Get<ButtonWidget>("MODS_BUTTON").OnClick = () =>
            {
                Ui.OpenWindow("MODS_PANEL", new WidgetArgs()
                {
                    { "onExit", () => { } },
                    { "onSwitch", Ui.CloseWindow },
                });
            };
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:31,代码来源:CncInstallLogic.cs


示例8: LoadWidget

		public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
		{
			var widget = NewWidget(node.Key, args);

			if (parent != null)
				parent.AddChild( widget );

			if (node.Key.Contains("@"))
				FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);

			foreach (var child in node.Value.Nodes)
				if (child.Key != "Children")
					FieldLoader.LoadField(widget, child.Key, child.Value.Value);

			if (!args.ContainsKey("modRules"))
				args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
			widget.Initialize(args);

			foreach (var child in node.Value.Nodes)
				if (child.Key == "Children")
					foreach (var c in child.Value.Nodes)
						LoadWidget( args, widget, c);

			widget.PostInit(args);
			return widget;
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:26,代码来源:WidgetLoader.cs


示例9: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			var width = world.Map.Bounds.Width;
			var height = world.Map.Bounds.Height;
			var size = Math.Max(width, height);
			var rb = RenderBounds;

			previewScale = Math.Min(rb.Width * 1f / width, rb.Height * 1f / height);
			previewOrigin = new int2((int)(previewScale * (size - width) / 2), (int)(previewScale * (size - height) / 2));
			mapRect = new Rectangle(previewOrigin.X, previewOrigin.Y, (int)(previewScale * width), (int)(previewScale * height));

			// Only needs to be done once
			using (var terrainBitmap = Minimap.TerrainBitmap(world.Map.Rules.TileSets[world.Map.Tileset], world.Map))
			{
				var r = new Rectangle(0, 0, width, height);
				var s = new Size(terrainBitmap.Width, terrainBitmap.Height);
				var terrainSheet = new Sheet(s, false);
				terrainSheet.Texture.SetData(terrainBitmap);
				terrainSprite = new Sprite(terrainSheet, r, TextureChannel.Alpha);

				// Data is set in Tick()
				customTerrainSprite = new Sprite(new Sheet(s, false), r, TextureChannel.Alpha);
				actorSprite = new Sprite(new Sheet(s, false), r, TextureChannel.Alpha);
				shroudSprite = new Sprite(new Sheet(s, false), r, TextureChannel.Alpha);
			}
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:28,代码来源:RadarWidget.cs


示例10: CncInstallLogic

        public CncInstallLogic([ObjectCreator.Param] Widget widget,
		                       [ObjectCreator.Param] Dictionary<string,string> installData,
		                       [ObjectCreator.Param] Action continueLoading)
        {
            var panel = widget.GetWidget("INSTALL_PANEL");
            var args = new WidgetArgs()
            {
                { "continueLoading", () => { Widget.CloseWindow(); continueLoading(); } },
                { "installData", installData }
            };

            panel.GetWidget<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Widget.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);

            panel.GetWidget<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Widget.OpenWindow("INSTALL_FROMCD_PANEL", args);

            panel.GetWidget<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;

            panel.GetWidget<ButtonWidget>("MODS_BUTTON").OnClick = () =>
            {
                Widget.OpenWindow("MODS_PANEL", new WidgetArgs()
                {
                    { "onExit", () => {} },
                    // Close this panel
                    { "onSwitch", Widget.CloseWindow },
                });
            };
        }
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:29,代码来源:CncInstallLogic.cs


示例11: InstallLogic

        public InstallLogic(Widget widget, Dictionary<string, string> installData, Action continueLoading)
        {
            var panel = widget.Get("INSTALL_PANEL");
            var args = new WidgetArgs()
            {
                { "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
                { "installData", installData },
                { "continueLoading", continueLoading }
            };

            panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);

            if (installData.ContainsKey("FilesToCopy") && !string.IsNullOrEmpty(installData["FilesToCopy"]) &&
                installData.ContainsKey("FilesToExtract") && !string.IsNullOrEmpty(installData["FilesToExtract"]))
            {
                args = new WidgetArgs(args)
                {
                    { "filesToCopy", installData["FilesToCopy"].Split(',') },
                    { "filesToExtract", installData["FilesToExtract"].Split(',') },
                };
            }
            panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_FROMCD_PANEL", args);

            panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                Game.Settings.Game.PreviousMod = Game.modData.Manifest.Mod.Id;
                Game.InitializeWithMod("modchooser", null);
            };
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:31,代码来源:InstallLogic.cs


示例12: InstallLogic

        public InstallLogic(Widget widget, Action continueLoading)
        {
            var installData = Game.ModData.Manifest.Get<ContentInstaller>();
            var panel = widget.Get("INSTALL_PANEL");
            var widgetArgs = new WidgetArgs()
            {
                { "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
                { "continueLoading", continueLoading },
                { "mirrorListUrl", installData.PackageMirrorList },
            };

            panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", widgetArgs);

            panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Ui.OpenWindow("INSTALL_FROMCD_PANEL", widgetArgs);

            panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                Game.RunAfterTick(() =>
                {
                    Game.Settings.Game.PreviousMod = Game.ModData.Manifest.Mod.Id;
                    Game.InitializeMod("modchooser", null);
                });
            };
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:26,代码来源:InstallLogic.cs


示例13: LoadWidget

        public Widget LoadWidget( WidgetArgs args, Widget parent, string w )
        {
            MiniYamlNode ret;
            if (!widgets.TryGetValue(w, out ret))
                throw new InvalidDataException("Cannot find widget with Id `{0}`".F(w));

            return LoadWidget( args, parent, ret );
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:8,代码来源:WidgetLoader.cs


示例14: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			// Bitmap data is generated in a background thread and then flipped
			front = new byte[4*256*256];
			back = new byte[4*256*256];

			var rect = new Rectangle((int)(255*SRange[0]), (int)(255*(1 - VRange[1])), (int)(255*(SRange[1] - SRange[0]))+1, (int)(255*(VRange[1] - VRange[0])) + 1);
			mixerSprite = new Sprite(new Sheet(new Size(256, 256)), rect, TextureChannel.Alpha);
			mixerSprite.sheet.Texture.SetData(front, 256, 256);
		}
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:12,代码来源:ColorMixerWidget.cs


示例15: StartGame

		public void StartGame(Arguments args)
		{
			var widgetArgs = new WidgetArgs();

			Ui.LoadWidget("MODCHOOSER_BACKGROUND", Ui.Root, widgetArgs);

			if (args != null && args.Contains("installMusic"))
			{
				widgetArgs.Add("modId", args.GetValue("installMusic", ""));
				Ui.OpenWindow("INSTALL_MUSIC_PANEL", widgetArgs);
			}
			else
				Ui.OpenWindow("MODCHOOSER_DIALOG", widgetArgs);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:14,代码来源:ModChooserLoadScreen.cs


示例16: RAInstallLogic

        public RAInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading)
        {
            var panel = widget.GetWidget("INSTALL_PANEL");
            var args = new WidgetArgs()
            {
                { "afterInstall", () => { Widget.CloseWindow(); continueLoading(); } },
                { "installData", installData }
            };

            panel.GetWidget<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
                Widget.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);

            panel.GetWidget<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
                Widget.OpenWindow("INSTALL_FROMCD_PANEL", args);

            panel.GetWidget<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;
        }
开发者ID:alzeih,项目名称:OpenRA,代码行数:17,代码来源:RAInstallLogic.cs


示例17: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			if (Unit != null && Sequence != null)
			{
				var anim = new Animation(worldRenderer.world, Unit, () => Facing);
				anim.PlayFetchIndex(Sequence, () => Frame);
				GetAnimation = () => anim;
			}

			GetSprite = () =>
			{
				var anim = GetAnimation();
				return anim != null ? anim.Image : null;
			};
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:17,代码来源:SpriteSequenceWidget.cs


示例18: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			// The four layers are stored in a 2x2 grid within a single texture
			radarSheet = new Sheet(SheetType.BGRA, new Size(2 * previewWidth, 2 * previewHeight).NextPowerOf2());
			radarSheet.CreateBuffer();
			radarData = radarSheet.GetData();

			MapBoundsChanged();

			// Set initial terrain data
			foreach (var cell in world.Map.AllCells)
				UpdateTerrainCell(cell);

			world.Map.MapTiles.Value.CellEntryChanged += UpdateTerrainCell;
			world.Map.CustomTerrain.CellEntryChanged += UpdateTerrainCell;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:18,代码来源:RadarWidget.cs


示例19: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			sRange[0] += STrim;
			sRange[1] -= STrim;
			vRange[0] += VTrim;
			vRange[1] -= VTrim;

			// Bitmap data is generated in a background thread and then flipped
			front = new byte[4 * 256 * 256];
			back = new byte[4 * 256 * 256];

			var rect = new Rectangle((int)(255 * sRange[0]), (int)(255 * (1 - vRange[1])), (int)(255 * (sRange[1] - sRange[0])) + 1, (int)(255 * (vRange[1] - vRange[0])) + 1);
			var mixerSheet = new Sheet(SheetType.BGRA, new Size(256, 256));
			mixerSheet.GetTexture().SetData(front, 256, 256);
			mixerSprite = new Sprite(mixerSheet, rect, TextureChannel.Alpha);
			GenerateBitmap();
		}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:19,代码来源:ColorMixerWidget.cs


示例20: Initialize

        public override void Initialize(WidgetArgs args)
        {
            base.Initialize(args);

            hueBitmap = new Bitmap(256, 256);
            hueSprite = new Sprite(new Sheet(new Size(256, 256)), new Rectangle(0, 0, 256, 1), TextureChannel.Alpha);

            var bitmapData = hueBitmap.LockBits(hueBitmap.Bounds(),
                ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
            unsafe
            {
                int* c = (int*)bitmapData.Scan0;
                for (var h = 0; h < 256; h++)
                    *(c + h) = HSLColor.FromHSV(h/255f, 1, 1).RGB.ToArgb();
            }
            hueBitmap.UnlockBits(bitmapData);

            hueSprite.sheet.Texture.SetData(hueBitmap);
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:19,代码来源:HueSliderWidget.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WidgetStyle类代码示例发布时间:2022-05-24
下一篇:
C# Widget类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap