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

C# Ruleset类代码示例

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

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



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

示例1: CheckUpgradesValidity

        static void CheckUpgradesValidity(Action<string> emitError, Ruleset rules)
        {
            var upgradesGranted = GetAllGrantedUpgrades(emitError, rules).ToHashSet();

            foreach (var actorInfo in rules.Actors)
            {
                if (actorInfo.Key.StartsWith("^"))
                    continue;

                foreach (var trait in actorInfo.Value.TraitInfos<ITraitInfo>())
                {
                    var fields = trait.GetType().GetFields();
                    foreach (var field in fields.Where(x => x.HasAttribute<UpgradeUsedReferenceAttribute>()))
                    {
                        var values = LintExts.GetFieldValues(trait, field, emitError);
                        foreach (var value in values)
                        {
                            if (!upgradesGranted.Contains(value))
                                emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value));

                            if (actorInfo.Value.TraitInfoOrDefault<UpgradeManagerInfo>() == null)
                                emitError("Actor type `{0}` uses upgrade `{1}`, but doesn't have the UpgradeManager trait.".F(actorInfo.Key, value));
                        }
                    }
                }
            }
        }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:27,代码来源:CheckUpgrades.cs


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


示例3: CncInstallMusicLogic

        public CncInstallMusicLogic(Widget widget, Ruleset modRules, Action onExit)
        {
            var installButton = widget.GetOrNull<ButtonWidget>("INSTALL_BUTTON");
            if (installButton != null)
            {
                Action afterInstall = () =>
                {
                    try
                    {
                        var path = new string[] { Platform.SupportDir, "Content", Game.modData.Manifest.Mod.Id }.Aggregate(Path.Combine);
                        GlobalFileSystem.Mount(Path.Combine(path, "scores.mix"));
                        GlobalFileSystem.Mount(Path.Combine(path, "transit.mix"));

                        modRules.Music.Do(m => m.Value.Reload());

                        var musicPlayerLogic = (MusicPlayerLogic)installButton.Parent.LogicObject;
                        musicPlayerLogic.BuildMusicTable();
                    }
                    catch (Exception e)
                    {
                        Log.Write("debug", "Mounting the new mixfile and rebuild of scores list failed:\n{0}", e);
                    }
                };

                installButton.OnClick = () =>
                    Ui.OpenWindow("INSTALL_MUSIC_PANEL", new WidgetArgs() {
                        { "afterInstall", afterInstall },
                        { "filesToCopy", new[] { "SCORES.MIX" } },
                        { "filesToExtract", new[] { "transit.mix" } },
                    });
                installButton.IsVisible = () => modRules.InstalledMusic.ToArray().Length < 3; // HACK around music being split between transit.mix and scores.mix
            }
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:33,代码来源:CncInstallMusicLogic.cs


示例4: TileSelectorLogic

		public TileSelectorLogic(Widget widget, WorldRenderer worldRenderer, Ruleset modRules)
		{
			var tileset = modRules.TileSets[worldRenderer.World.Map.Tileset];

			editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
			panel = widget.Get<ScrollPanelWidget>("TILETEMPLATE_LIST");
			itemTemplate = panel.Get<ScrollItemWidget>("TILEPREVIEW_TEMPLATE");
			panel.Layout = new GridLayout(panel);

			var tileCategorySelector = widget.Get<DropDownButtonWidget>("TILE_CATEGORY");
			var categories = tileset.EditorTemplateOrder;
			Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
			{
				var item = ScrollItemWidget.Setup(template,
					() => tileCategorySelector.Text == option,
					() => { tileCategorySelector.Text = option; IntializeTilePreview(widget, worldRenderer, tileset, option); });

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

			tileCategorySelector.OnClick = () =>
				tileCategorySelector.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, categories, setupItem);

			tileCategorySelector.Text = categories.First();
			IntializeTilePreview(widget, worldRenderer, tileset, categories.First());
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:27,代码来源:TileSelectorLogic.cs


示例5: Run

		public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
		{
			foreach (var actorInfo in rules.Actors)
			{
				var healthTraits = actorInfo.Value.TraitInfos<HealthInfo>().ToList();
				if (!healthTraits.Any())
					continue;

				var targetable = actorInfo.Value.TraitInfos<ITargetableInfo>().SelectMany(x => x.GetTargetTypes()).ToList();
				if (!targetable.Any())
					continue;

				foreach (var weaponInfo in rules.Weapons)
				{
					var warheads = weaponInfo.Value.Warheads.OfType<SpreadDamageWarhead>().Where(dw => dw.Damage > 0);

					foreach (var warhead in warheads)
					{
						// This is a special warhead, like the one on `weathering` in D2k.
						if (!warhead.DamageTypes.Any())
							continue;

						// This warhead cannot affect this actor.
						if (!warhead.ValidTargets.Overlaps(targetable))
							continue;

						if (healthTraits.Where(x => x.Radius.Length > warhead.TargetExtraSearchRadius.Length).Any())
							emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of a warhead on `{1}`!"
								.F(actorInfo.Key, weaponInfo.Key));
					}
				}
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:33,代码来源:CheckTargetHealthRadius.cs


示例6: Run

		public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
		{
			foreach (var actorInfo in rules.Actors)
			{
				if (actorInfo.Key.StartsWith("^"))
					continue;

				var count = actorInfo.Value.TraitInfos<IDefaultVisibilityInfo>().Count();

				if (count == 0)
					emitError("Actor type `{0}` does not define a default visibility type!".F(actorInfo.Key));
				else if (count > 1)
					emitError("Actor type `{0}` defines multiple default visibility types!".F(actorInfo.Key));
				else
				{
					var vis = actorInfo.Value.TraitInfoOrDefault<HiddenUnderShroudInfo>();
					if (vis != null && vis.Type == VisibilityType.Footprint)
					{
						var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
						if (ios == null)
							emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but has no IOccupySpace traits!".F(actorInfo.Key, vis.GetType()));
						else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
							emitError("Actor type `{0}` defines VisibilityType.Footprint in `{1}` but does not have any footprint cells!".F(actorInfo.Key, vis.GetType()));
					}
				}
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:27,代码来源:CheckDefaultVisibility.cs


示例7: LoadMapSettings

        public static void LoadMapSettings(Session.Global gs, Ruleset rules)
        {
            var devMode = rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
            gs.AllowCheats = devMode.Enabled;

            var crateSpawner = rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
            gs.Crates = crateSpawner != null && crateSpawner.Enabled;

            var shroud = rules.Actors["player"].TraitInfo<ShroudInfo>();
            gs.Fog = shroud.FogEnabled;
            gs.Shroud = !shroud.ExploredMapEnabled;

            var resources = rules.Actors["player"].TraitInfo<PlayerResourcesInfo>();
            gs.StartingCash = resources.DefaultCash;

            var startingUnits = rules.Actors["world"].TraitInfoOrDefault<SpawnMPUnitsInfo>();
            gs.StartingUnitsClass = startingUnits == null ? "none" : startingUnits.StartingUnitsClass;

            var mapBuildRadius = rules.Actors["world"].TraitInfoOrDefault<MapBuildRadiusInfo>();
            gs.AllyBuildRadius = mapBuildRadius != null && mapBuildRadius.AllyBuildRadiusEnabled;

            var mapCreeps = rules.Actors["world"].TraitInfoOrDefault<MapCreepsInfo>();
            gs.Creeps = mapCreeps != null && mapCreeps.Enabled;

            var mapOptions = rules.Actors["world"].TraitInfo<MapOptionsInfo>();
            gs.ShortGame = mapOptions.ShortGameEnabled;
            gs.TechLevel = mapOptions.TechLevel;
            gs.Difficulty = mapOptions.Difficulty ?? mapOptions.Difficulties.FirstOrDefault();
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:29,代码来源:LobbyCommands.cs


示例8: CheckUpgradesUsage

        static void CheckUpgradesUsage(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
        {
            var upgradesUsed = GetAllUsedUpgrades(emitError, rules).ToHashSet();

            // Check all upgrades granted by traits.
            foreach (var actorInfo in rules.Actors)
            {
                foreach (var trait in actorInfo.Value.TraitInfos<ITraitInfo>())
                {
                    var fields = trait.GetType().GetFields();
                    foreach (var field in fields.Where(x => x.HasAttribute<UpgradeGrantedReferenceAttribute>()))
                    {
                        var values = LintExts.GetFieldValues(trait, field, emitError);
                        foreach (var value in values.Where(x => !upgradesUsed.Contains(x)))
                            emitWarning("Actor type `{0}` grants upgrade `{1}` that is not used by anything!".F(actorInfo.Key, value));
                    }
                }
            }

            // Check all upgrades granted by warheads.
            foreach (var weapon in rules.Weapons)
            {
                foreach (var warhead in weapon.Value.Warheads)
                {
                    var fields = warhead.GetType().GetFields();
                    foreach (var field in fields.Where(x => x.HasAttribute<UpgradeGrantedReferenceAttribute>()))
                    {
                        var values = LintExts.GetFieldValues(warhead, field, emitError);
                        foreach (var value in values.Where(x => !upgradesUsed.Contains(x)))
                            emitWarning("Weapon type `{0}` grants upgrade `{1}` that is not used by anything!".F(weapon.Key, value));
                    }
                }
            }
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:34,代码来源:CheckUpgrades.cs


示例9: Run

        public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
        {
            foreach (var weaponInfo in rules.Weapons)
            {
                var missile = weaponInfo.Value.Projectile as MissileInfo;
                if (missile != null)
                {
                    var minAngle = missile.MinimumLaunchAngle.Angle;
                    var maxAngle = missile.MaximumLaunchAngle.Angle;

                    // If both angles are identical, we only need to test one of them
                    var testMaxAngle = minAngle != maxAngle;
                    CheckLaunchAngles(weaponInfo.Key, minAngle, testMaxAngle, maxAngle, emitError);
                }

                var bullet = weaponInfo.Value.Projectile as BulletInfo;
                if (bullet != null)
                {
                    var minAngle = bullet.LaunchAngle[0].Angle;
                    var maxAngle = bullet.LaunchAngle.Length > 1 ? bullet.LaunchAngle[1].Angle : minAngle;

                    // If both angles are identical, we only need to test one of them
                    var testMaxAngle = minAngle != maxAngle;
                    CheckLaunchAngles(weaponInfo.Key, minAngle, testMaxAngle, maxAngle, emitError);
                }
            }
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:27,代码来源:CheckAngle.cs


示例10: story_data_is_observed_during_invocation

        public void story_data_is_observed_during_invocation()
        {
            var data = new List<KeyValuePair<string, object>>()
            {
                new KeyValuePair<string, object>("bool_value", true),
                new KeyValuePair<string, object>("int_value", 123),
                new KeyValuePair<string, object>("string_value", "test!"),
            };

            var handlerRules = new Ruleset<IStory, IStoryHandler>()
            {
                Rules = {
                    new PredicateRule(
                        _ => true,                                                              // always run for story
                        _ => new ActionHandler(
                            (story) => Assert.AreEqual(0, story.Data.Count()),                  // make sure OnStart() is invoked with zero data items.
                            (story, task) => Assert.IsTrue(data.SequenceEqual(story.Data)))     // make sure OnStop() is invoked with 3 data items.
                    ),
                },
            };

            new Story("testStory", handlerRules).Run(story =>
            {
                foreach (var kvp in data)
                {
                    story.Data[kvp.Key] = kvp.Value;
                }
            });
        }
开发者ID:amitapl,项目名称:logmetry,代码行数:29,代码来源:CoreTests.cs


示例11: Run

		public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
		{
			foreach (var weaponInfo in rules.Weapons)
			{
				var warheads = weaponInfo.Value.Warheads.OfType<SpawnActorWarhead>().ToList();

				foreach (var warhead in warheads)
				{
					foreach (var a in warhead.Actors)
					{
						if (!rules.Actors.ContainsKey(a.ToLowerInvariant()))
						{
							emitError("Warhead type {0} tries to spawn invalid actor {1}!"
							.F(weaponInfo.Key, a));
							break;
						}

						if (!rules.Actors[a.ToLowerInvariant()].HasTraitInfo<IPositionableInfo>())
							emitError("Warhead type {0} tries to spawn unpositionable actor {1}!"
							.F(weaponInfo.Key, a));

						if (!rules.Actors[a.ToLowerInvariant()].HasTraitInfo<ParachutableInfo>() && warhead.Paradrop == true)
							emitError("Warhead type {0} tries to paradrop actor {1} which doesn't have the Parachutable trait!"
							.F(weaponInfo.Key, a));
					}
				}
			}
		}
开发者ID:GraionDilach,项目名称:OpenRA.Mods.AS,代码行数:28,代码来源:CheckSpawnActorWarheads.cs


示例12: ScrollItemWidget

 public ScrollItemWidget(Ruleset modRules)
     : base(modRules)
 {
     IsVisible = () => false;
     VisualHeight = 0;
     IgnoreChildMouseOver = true;
 }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:7,代码来源:ScrollItemWidget.cs


示例13: Run

		public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
		{
			foreach (var actorInfo in rules.Actors)
			{
				var healthTraits = actorInfo.Value.TraitInfos<HealthInfo>().ToList();
				if (!healthTraits.Any())
					continue;

				var targetable = actorInfo.Value.TraitInfos<ITargetableInfo>().SelectMany(x => x.GetTargetTypes()).ToList();
				if (!targetable.Any())
					continue;

				foreach (var weaponInfo in rules.Weapons)
				{
					var warheadAS = weaponInfo.Value.Warheads.OfType<WarheadAS>();

					foreach (var wh in warheadAS)
					{
						// This warhead cannot affect this actor.
						if (!wh.ValidTargets.Overlaps(targetable))
							continue;

						if (healthTraits.Any(x => x.Shape.OuterRadius.Length > wh.TargetSearchRadius.Length))
							emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of an AS warhead on `{1}`!"
								.F(actorInfo.Key, weaponInfo.Key));
					}
				}
			}
		}
开发者ID:GraionDilach,项目名称:OpenRA.Mods.AS,代码行数:29,代码来源:CheckTargetHealthRadiusAS.cs


示例14: Run

 public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
 {
     foreach (var actorData in D2kMapImporter.ActorDataByActorCode.Values)
     {
         if (!rules.Actors.ContainsKey(actorData.First))
             emitError("Undefined actor {0} in map import code.".F(actorData.First));
     }
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:8,代码来源:CheckImportActors.cs


示例15: story_exception_thrown_is_propagated

        public void story_exception_thrown_is_propagated()
        {
            var handlerRules = new Ruleset<IStory, IStoryHandler>();

            new Story("testStory", handlerRules).Run(story =>
            {
                throw new InvalidOperationException("oh oh");
            });
        }
开发者ID:amitapl,项目名称:logmetry,代码行数:9,代码来源:CoreTests.cs


示例16: story_exception_thrown_is_propagated

        public void story_exception_thrown_is_propagated()
        {
            var handlerRules = new Ruleset<IStory, IStoryHandler>();

            Storytelling.StartNew("testStory", () =>
            {
                throw new InvalidOperationException("oh oh");
            });
        }
开发者ID:narratr,项目名称:story,代码行数:9,代码来源:CoreTests.cs


示例17: AddStaticResources

		// Add the static resources defined in the map; if the map lives
		// in a world use AddCustomTerrain instead
		static Bitmap AddStaticResources(TileSet tileset, Map map, Ruleset resourceRules, Bitmap terrainBitmap)
		{
			var terrain = new Bitmap(terrainBitmap);
			var isRectangularIsometric = map.Grid.Type == MapGridType.RectangularIsometric;
			var b = map.Bounds;

			// Fudge the heightmap offset by adding as much extra as we need / can
			// This tries to correct for our incorrect assumption that MPos == PPos
			var heightOffset = Math.Min(map.Grid.MaximumTerrainHeight, map.MapSize.Y - b.Bottom);
			var width = b.Width;
			var height = b.Height + heightOffset;

			var resources = resourceRules.Actors["world"].TraitInfos<ResourceTypeInfo>()
				.ToDictionary(r => r.ResourceType, r => r.TerrainType);

			var bitmapData = terrain.LockBits(terrain.Bounds(),
				ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);

			unsafe
			{
				var colors = (int*)bitmapData.Scan0;
				var stride = bitmapData.Stride / 4;
				for (var y = 0; y < height; y++)
				{
					for (var x = 0; x < width; x++)
					{
						var uv = new MPos(x + b.Left, y + b.Top);
						if (map.MapResources.Value[uv].Type == 0)
							continue;

						string res;
						if (!resources.TryGetValue(map.MapResources.Value[uv].Type, out res))
							continue;

						var color = tileset[tileset.GetTerrainIndex(res)].Color.ToArgb();
						if (isRectangularIsometric)
						{
							// Odd rows are shifted right by 1px
							var dx = uv.V & 1;
							if (x + dx > 0)
								colors[y * stride + 2 * x + dx - 1] = color;

							if (2 * x + dx < stride)
								colors[y * stride + 2 * x + dx] = color;
						}
						else
							colors[y * stride + x] = color;
					}
				}
			}

			terrain.UnlockBits(bitmapData);

			return terrain;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:57,代码来源:Minimap.cs


示例18: MusicPlayerLogic

        public MusicPlayerLogic(Widget widget, Ruleset modRules, Action onExit)
        {
            this.modRules = modRules;

            var panel = widget.Get("MUSIC_PANEL");

            musicList = panel.Get<ScrollPanelWidget>("MUSIC_LIST");
            itemTemplate = musicList.Get<ScrollItemWidget>("MUSIC_TEMPLATE");

            BuildMusicTable();

            Func<bool> noMusic = () => !installed;
            panel.Get("NO_MUSIC_LABEL").IsVisible = noMusic;

            var playButton = panel.Get<ButtonWidget>("BUTTON_PLAY");
            playButton.OnClick = Play;
            playButton.IsDisabled = noMusic;
            playButton.IsVisible = () => !Sound.MusicPlaying;

            var pauseButton = panel.Get<ButtonWidget>("BUTTON_PAUSE");
            pauseButton.OnClick = Sound.PauseMusic;
            pauseButton.IsDisabled = noMusic;
            pauseButton.IsVisible = () => Sound.MusicPlaying;

            var stopButton = panel.Get<ButtonWidget>("BUTTON_STOP");
            stopButton.OnClick = Sound.StopMusic;
            stopButton.IsDisabled = noMusic;

            var nextButton = panel.Get<ButtonWidget>("BUTTON_NEXT");
            nextButton.OnClick = () => { currentSong = GetNextSong(); Play(); };
            nextButton.IsDisabled = noMusic;

            var prevButton = panel.Get<ButtonWidget>("BUTTON_PREV");
            prevButton.OnClick = () => { currentSong = GetPrevSong(); Play(); };
            prevButton.IsDisabled = noMusic;

            var shuffleCheckbox = panel.Get<CheckboxWidget>("SHUFFLE");
            shuffleCheckbox.IsChecked = () => Game.Settings.Sound.Shuffle;
            shuffleCheckbox.OnClick = () => Game.Settings.Sound.Shuffle ^= true;

            var repeatCheckbox = panel.Get<CheckboxWidget>("REPEAT");
            repeatCheckbox.IsChecked = () => Game.Settings.Sound.Repeat;
            repeatCheckbox.OnClick = () => Game.Settings.Sound.Repeat ^= true;

            panel.Get<LabelWidget>("TIME_LABEL").GetText = () => (currentSong == null) ? "" :
                "{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60,
                    currentSong.Length / 60, currentSong.Length % 60);

            var musicSlider = panel.Get<SliderWidget>("MUSIC_SLIDER");
            musicSlider.OnChange += x => Sound.MusicVolume = x;
            musicSlider.Value = Sound.MusicVolume;

            panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => { Game.Settings.Save(); Ui.CloseWindow(); onExit(); };
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:54,代码来源:MusicPlayerLogic.cs


示例19: story_detaches_correctly

        public void story_detaches_correctly()
        {
            var handlerRules = new Ruleset<IStory, IStoryHandler>();

            var story1 = new Story("story1", handlerRules);
            Assert.AreEqual("story1", story1.Name);
            story1.Detach();

            var story2 = new Story("story2", handlerRules);
            Assert.AreEqual("story2", story2.Name);
            story2.Detach();
        }
开发者ID:amitapl,项目名称:logmetry,代码行数:12,代码来源:CoreTests.cs


示例20: Run

        public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
        {
            foreach (var weaponInfo in rules.Weapons)
            {
                var range = weaponInfo.Value.Range;
                var missile = weaponInfo.Value.Projectile as MissileInfo;

                if (missile != null && missile.RangeLimit > WDist.Zero && missile.RangeLimit < range)
                    emitError("Weapon `{0}`: projectile RangeLimit lower than weapon range!"
                        .F(weaponInfo.Key));
            }
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:12,代码来源:CheckRangeLimit.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Run类代码示例发布时间:2022-05-24
下一篇:
C# Rule_Context类代码示例发布时间: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