本文整理汇总了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;
});
}
示例2: Create
public override void Create(CommandParser Parser)
{
Parser.AddCommand(
new KeyWord("LOOK", false),
new LookProcessor(),
"Look around at your suroundings.");
}
示例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");
}
示例4: Create
public override void Create(CommandParser Parser)
{
Parser.AddCommand(
new Sequence(
new KeyWord("GO", true),
new Cardinal("DIRECTION")),
new GoProcessor(),
"Move between rooms.");
}
示例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.");
}
示例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.");
}
示例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.");
}
示例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.");
}
示例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;
});
}
示例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");
}
示例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.");
}
示例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;
});
}
示例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); });
}