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


C# CommandParser.AddCommand方法代码示例

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


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

示例1: Create

        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("version", "Build: RMUD Hadad <s0>");
            Core.StandardMessage("commit", "Commit: <s0>");
            Core.StandardMessage("no commit", "Commit version not found.");

            Parser.AddCommand(
                Or(
                    KeyWord("VERSION"),
                    KeyWord("VER")))
                .Manual("Displays the server version currently running.")
                .ProceduralRule((match, actor) =>
                {
                    var buildVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                    MudObject.SendMessage(actor, "@version", buildVersion);

                    if (System.IO.File.Exists("version.txt"))
                        MudObject.SendMessage(actor, "@commit", System.IO.File.ReadAllText("version.txt"));
                    else
                        MudObject.SendMessage(actor, "@no commit");

                    foreach (var module in Core.IntegratedModules)
                        MudObject.SendMessage(actor, module.Info.Description);

                    return PerformResult.Continue;
                });
        }
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:28,代码来源:Version.cs

示例2: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new KeyWord("LOOK", false),
				new LookProcessor(),
				"Look around at your suroundings.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:7,代码来源:Look.cs

示例3: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new KeyWord("DROP", false),
					new ObjectMatcher("TARGET", new InScopeObjectSource())),
				new DropProcessor(),
				"Drop something");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:9,代码来源:Drop.cs

示例4: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new KeyWord("GO", true),
					new Cardinal("DIRECTION")),
				new GoProcessor(),
				"Move between rooms.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:9,代码来源:Go.cs

示例5: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Or(
					new KeyWord("HELP", false),
					new KeyWord("?", false)),
				new HelpProcessor(),
				"Display a list of all defined commands.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:9,代码来源:Help.cs

示例6: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Or(
					new KeyWord("i", false),
					new KeyWord("inv", false),
					new KeyWord("inventory", false)),
				new InventoryProcessor(),
				"See what you are carrying.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:10,代码来源:Inventory.cs

示例7: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("SAY", false),
						new KeyWord("'", false)),
					new Rest("SPEECH")),
				new SayProcessor(SayProcessor.EmoteTypes.Speech),
				"Say something.");

			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("EMOTE", false),
						new KeyWord("\"", false)),
					new Rest("SPEECH")),
				new SayProcessor(SayProcessor.EmoteTypes.Emote),
				"Emote something.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:20,代码来源:Say.cs

示例8: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new RankGate(500),
					new KeyWord("MOVE", false),
					new ObjectMatcher("TARGET", new InScopeObjectSource()),
					new KeyWord("TO", true),
					new Path("DESTINATION"))
				, new MoveProcessor(),
				"Teleport an object to a new location. Bypasses take rules.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:12,代码来源:Move.cs

示例9: Create

 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         KeyWord("!DUMPMESSAGES"))
         .Manual("Dump defined messages to messages.txt")
         .ProceduralRule((match, actor) =>
         {
             var builder = new StringBuilder();
             Core.DumpMessagesForCustomization(builder);
             System.IO.File.WriteAllText("messages.txt", builder.ToString());
             MudObject.SendMessage(actor, "Messages dumped to messages.txt.");
             return PerformResult.Continue;
         });
 }
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:14,代码来源:DumpMessages.cs

示例10: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("LOOK", false),
						new KeyWord("EXAMINE", false),
						new KeyWord("X", false)),
					new KeyWord("AT", true),
					new ObjectMatcher("TARGET", new InScopeObjectSource())),
				new ExamineProcessor(),
				"Look closely at an object.");

			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("LOOK", false),
						new KeyWord("EXAMINE", false),
						new KeyWord("X", false)),
					new KeyWord("AT", true),
					new Rest("ERROR"))
				, new ReportError("I don't see that here.\r\n"),
				"Error reporting command");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:24,代码来源:Examine.cs

示例11: Create

		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new RankGate(500),
					new Or(
						new KeyWord("INSPECT", false),
						new KeyWord("INS", false),
						new KeyWord("P", false)),
					new Or(
						new ObjectMatcher("TARGET", new InScopeObjectSource()),
						new KeyWord("HERE", false)))
				, new InspectProcessor(),
				"Inspect internal properties of an object.");
		}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:15,代码来源:Inspect.cs

示例12: Create

        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("help topics", "Available help topics");
            Core.StandardMessage("no help topic", "There is no help available for that topic.");

            Parser.AddCommand(
                Sequence(
                    Or(
                        KeyWord("HELP"),
                        KeyWord("MAN"),
                        KeyWord("?")),
                    Optional(Rest("TOPIC"))))
                .Manual("This is the command you typed to get this message.")
                .ProceduralRule((match, actor) =>
                {
                    if (!match.ContainsKey("TOPIC"))
                    {
                        MudObject.SendMessage(actor, "@help topics");
                        var line = "";
                        foreach (var manPage in ManPages.Pages.Select(p => p.Name).Distinct().OrderBy(s => s))
                        {
                            line += manPage;
                            if (line.Length < 20) line += new String(' ', 20 - line.Length);
                            else if (line.Length < 40) line += new String(' ', 40 - line.Length);
                            else
                            {
                                MudObject.SendMessage(actor, line);
                                line = "";
                            }
                        }
                    }
                    else
                    {
                        var manPageName = match["TOPIC"].ToString().ToUpper();
                        var pages = new List<ManPage>(ManPages.Pages.Where(p => p.Name == manPageName));
                        if (pages.Count > 0)
                            foreach (var manPage in pages)
                                manPage.SendManPage(actor);
                        else
                            MudObject.SendMessage(actor, "@no help topic");

                    }
                    return PerformResult.Continue;
                });
        }
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:45,代码来源:Man.cs

示例13: AddUpcomingIMCommands

 private void AddUpcomingIMCommands(CommandParser showUpcomingParser)
 {
     showUpcomingParser.AddCommand("recordings", "r", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Recording); });
     showUpcomingParser.AddCommand("alerts", "a", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Alert); });
     showUpcomingParser.AddCommand("suggestions", "s", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Suggestion); });
 }
开发者ID:ElRakiti,项目名称:ARGUS-TV,代码行数:6,代码来源:IMCommands.cs


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