本文整理汇总了C#中InputHelper.IsMaxNegativeReached方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.IsMaxNegativeReached方法的具体用法?C# InputHelper.IsMaxNegativeReached怎么用?C# InputHelper.IsMaxNegativeReached使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputHelper
的用法示例。
在下文中一共展示了InputHelper.IsMaxNegativeReached方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Matches
public bool Matches(InputHelper.CommandMove command)
{
InputHelper.KeyState previousKeyState = command.GetPreviousMove();
InputHelper.KeyState currentKeyState = command.GetCurrentMove();
InputBuffer currentBuffer = GetNextBuffer(currentKeyState);
if (currentKeyState.GetState() != InputHelper.ButtonState.Held)
{
if (command.IsMaxNegativeReached() == true)
{
command.Reset();
return false;
}
if (currentBuffer.GetCurrentInputState() == currentKeyState.GetKey())
{
command.Next();
if (command.GetCurrentMoveStep() >= command.GetMoves().Count - 1)
{
currentKeyState = command.GetMoves()[command.GetMoves().Count - 1];
}
else
{
currentKeyState = command.GetCurrentMove();
}
currentBuffer = GetNextBuffer(currentKeyState);
Debug.WriteLine("NEXT BUFFER: " + currentKeyState.GetState());
}
else
{
command.IncrementNegativeCount();
}
}
else
{
Debug.WriteLine("IN HELD");
checkHeld(command, currentKeyState);
}
if (command.IsComplete())
{
Debug.WriteLine("IS COMPLETE");
command.Reset();
ResetBuffers();
return true;
}
return false;
}
示例2: checkHeld
private void checkHeld(InputHelper.CommandMove command, InputHelper.KeyState currentKeyState)
{
int held = 0;
Debug.WriteLine("HELD KEY: " + currentKeyState.GetState());
currentKeyState = command.GetCurrentMove();
if (command.IsMaxNegativeReached() == true)
{
command.Reset();
held = 0;
}
if (releasedState.GetCurrentInputState() != InputHelper.KeyPress.NONE)
{
if (releasedState.GetCurrentInputState() == currentKeyState.GetKey()
|| (releasedState.GetCurrentInputState(releasedState.GetCurrentStateStep()-2) == currentKeyState.GetKey()
&& releasedState.GetCurrentInputState() != currentKeyState.GetKey()))
{
command.Reset();
}
}
for (int i = 0; i < heldState.GetBuffer().Count - 1; i++)
{
bool reset = (releasedState.GetBuffer().Count >= i + 2
&& releasedState.GetBuffer()[i + 1] == currentKeyState.GetKey());
if (reset)
{
held = 0;
command.IncrementNegativeCount();
break;
}
if (heldState.GetBuffer()[i + 1] == currentKeyState.GetKey())
{
held++;
command.ResetNegativeEdge();
}
else
{
held = 0;
command.Reset();
break;
}
}
Debug.WriteLine("HELD COUNT: " + held);
Debug.WriteLine("HELD TIME: " + currentKeyState.GetKeyHeldTime());
if (held >= currentKeyState.GetKeyHeldTime())
{
command.Next();
}
else
{
command.IncrementNegativeCount();
}
}