Skip to content

Commit

Permalink
Good Dreams!
Browse files Browse the repository at this point in the history
  • Loading branch information
DartPower committed Jun 2, 2019
1 parent 3771b72 commit deedbe5
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 156 deletions.
84 changes: 42 additions & 42 deletions KonamiSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@

namespace SharpMCL
{
public class KonamiSequence
{
List<Keys> Keys = new List<Keys>{System.Windows.Forms.Keys.Up, System.Windows.Forms.Keys.Up,
System.Windows.Forms.Keys.Down, System.Windows.Forms.Keys.Down,
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right,
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right,
System.Windows.Forms.Keys.B, System.Windows.Forms.Keys.A};
private int mPosition = -1;
public class KonamiSequence
{
List<Keys> Keys = new List<Keys>{System.Windows.Forms.Keys.Up, System.Windows.Forms.Keys.Up,
System.Windows.Forms.Keys.Down, System.Windows.Forms.Keys.Down,
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right,
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right,
System.Windows.Forms.Keys.B, System.Windows.Forms.Keys.A};
private int mPosition = -1;

public int Position
{
get { return mPosition; }
private set { mPosition = value; }
}
public int Position
{
get { return mPosition; }
private set { mPosition = value; }
}

public bool IsCompletedBy(Keys key)
{
if (Keys[Position + 1] == key)
{
// move to next
Position++;
}
else if (Position == 1 && key == System.Windows.Forms.Keys.Up)
{
// stay where we are
}
else if (Keys[0] == key)
{
// restart at 1st
Position = 0;
}
else
{
// no match in sequence
Position = -1;
}
if (Position == Keys.Count - 1)
{
Position = -1;
return true;
}
return false;
}
}
public bool IsCompletedBy(Keys key)
{
if (Keys[Position + 1] == key)
{
// move to next
Position++;
}
else if (Position == 1 && key == System.Windows.Forms.Keys.Up)
{
// stay where we are
}
else if (Keys[0] == key)
{
// restart at 1st
Position = 0;
}
else
{
// no match in sequence
Position = -1;
}
if (Position == Keys.Count - 1)
{
Position = -1;
return true;
}
return false;
}
}
}
222 changes: 111 additions & 111 deletions LauncherForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LauncherForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SharpMCL
{
public partial class LauncherForm : Form
public partial class LauncherForm : Form
{
public LauncherForm()
{
Expand Down
4 changes: 2 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ static class Program
[STAThread]
static void Main(string[] args)
{
Marshal.PrelinkAll(typeof(Program));
Process currentProcess = Process.GetCurrentProcess();
Marshal.PrelinkAll(typeof(Program));
Process currentProcess = Process.GetCurrentProcess();
currentProcess.PriorityClass = ProcessPriorityClass.High;
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White;
Expand Down

0 comments on commit deedbe5

Please sign in to comment.