本文整理汇总了C#中Position.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Position.Get方法的具体用法?C# Position.Get怎么用?C# Position.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindIf
internal static Position FindIf(Position begin, Position end, IPredicate1 f)
{
while (begin != end && !f.Execute(begin.Get())) {
++begin;
}
return begin;
}
示例2: Find
internal static Position Find(Position begin, Position end, char value)
{
while (begin != end && begin.Get() != value) {
++begin;
}
return begin;
}
示例3: Equal
internal static bool Equal(Position begin, Position end, string s)
{
int i = 0;
while (begin != end && begin.Get() == s[i]) {
begin++;
i++;
}
return begin == end;
}
示例4: AdjacentFind
internal static Position AdjacentFind(Position begin, Position end, IPredicate2 f)
{
Position result = begin;
if (begin != end) {
while (++begin != end && !f.Execute(result.Get(), begin.Get())) {
result = begin;
}
}
return (begin == end) ? end : result;
}
示例5: BotManager
public void BotManager()
{
_surrender = Convert.ToBoolean( ConfigurationManager.AppSettings["enable_surrender"] );
if (_surrender)
Base.Write("Automatic Surrender: Enabled", ConsoleColor.White);
else
Base.Write("Automatic Surrender: Disabled", ConsoleColor.White);
try
{
positions = new Position();
Base.Write("Bot initialized with resolution " + positions.resolution, ConsoleColor.White);
}
catch (Exception e)
{
Base.Write(e);
System.Environment.Exit(1);
}
System.Threading.Timer afkTimer = null;
System.Threading.Timer surrenderTimer = null;
bool actionNeeded = false;
while (true)
{
Thread.Sleep(5000);
statusType oldStatus = status;
actionNeeded = GetStatus();
if ( !oldStatus.Equals(status) || actionNeeded)
{
actionNeeded = GetStatus(true);
//dispose of timers
if (afkTimer != null) afkTimer.Dispose();
if (surrenderTimer != null) surrenderTimer.Dispose();
if (status.WindowStatus == WindowStatusType.Game)
{
if (status.GameStatus == GameStatusType.InProgress)
{
if (_surrender)
{
Base.Write("Starting Anti-AFK and Auto-Surrender", ConsoleColor.White);
afkTimer = new System.Threading.Timer(AntiAfk, null, 15000, 10000);
surrenderTimer = new System.Threading.Timer(AttemptSurrender, null, 60000, 60000);
}
else
{
Base.Write("Starting Anti-AFK", ConsoleColor.White);
afkTimer = new System.Threading.Timer(AntiAfk, null, 15000, 10000);
}
}
else
{ //in victory or defeat game screens
Base.Write("Leaving game screen...");
Cursor.Position = RelativePoint(gameWindowDimensions, positions.Get("end_game_button"));
BringWindowToTop(Base.gameWindowName, false);
Thread.Sleep(1000);
new InputSimulator().Mouse.LeftButtonClick();
}
}
else
{
if (status.ClientStatus == ClientStatusType.LevelUp)
{
Base.Write("Clearing popup", ConsoleColor.White);
BringWindowToTop(Base.clientWindowName, true);
Cursor.Position = RelativePoint(clientWindowDimensions, positions.Get("level_up_button"));
Thread.Sleep(1000);
new InputSimulator().Mouse.LeftButtonClick();
}
if (status.ClientStatus == ClientStatusType.ScoreScreen)
{
if (Abort)
{
Console.Beep();
Base.Write("Game Over. Aborting...");
Base.Close();
}
Base.Write("Clicking \"Play Again\" in a moment");
BringWindowToTop(Base.clientWindowName, true);
Cursor.Position = RelativePoint(clientWindowDimensions, positions.Get("play_again_button"));
Thread.Sleep(1000);
new InputSimulator().Mouse.LeftButtonClick();
}
else if (status.ClientStatus == ClientStatusType.Unqueued)
{
if (Abort)
{
Console.Beep();
Base.Write("Game Over. Aborting...");
Base.Close();
}
Base.Write("Clicking \"Play Again\" in a moment");
BringWindowToTop(Base.clientWindowName, true);
//.........这里部分代码省略.........
示例6: Match
internal static bool Match(Position begin, Position end)
{
return begin != end && begin.Get() == '#';
}