本文整理汇总了C#中SteamBot.Bot.HandleInput方法的典型用法代码示例。如果您正苦于以下问题:C# Bot.HandleInput方法的具体用法?C# Bot.HandleInput怎么用?C# Bot.HandleInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SteamBot.Bot
的用法示例。
在下文中一共展示了Bot.HandleInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BotMode
// This mode is to run a single Bot until it's terminated.
private static void BotMode(int botIndex)
{
if (!File.Exists("settings.json"))
{
Console.WriteLine("No settings.json file found.");
return;
}
Configuration configObject;
try
{
configObject = Configuration.LoadConfiguration("settings.json");
}
catch (Newtonsoft.Json.JsonReaderException)
{
// handle basic json formatting screwups
Console.WriteLine("settings.json file is corrupt or improperly formatted.");
return;
}
if (botIndex >= configObject.Bots.Length)
{
Console.WriteLine("Invalid bot index.");
return;
}
Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
Console.Title = "Bot Manager";
b.StartBot();
string AuthSet = "auth";
string ExecCommand = "exec";
string InputCommand = "input";
// this loop is needed to keep the botmode console alive.
// instead of just sleeping, this loop will handle console input
while (true)
{
string inputText = Console.ReadLine();
if (String.IsNullOrEmpty(inputText))
continue;
// Small parse for console input
var c = inputText.Trim();
var cs = c.Split(' ');
if (cs.Length > 1)
{
if (cs[0].Equals(AuthSet, StringComparison.CurrentCultureIgnoreCase))
{
b.AuthCode = cs[1].Trim();
}
else if (cs[0].Equals(ExecCommand, StringComparison.CurrentCultureIgnoreCase))
{
b.HandleBotCommand(c.Remove(0, cs[0].Length + 1));
}
else if (cs[0].Equals(InputCommand, StringComparison.CurrentCultureIgnoreCase))
{
b.HandleInput(c.Remove(0, cs[0].Length + 1));
}
}
}
}