示例#1
0
        private void pic_MouseMove(object sender, MouseEventArgs e)
        {
            if (At.HasValue == false || CanJump)
            {
                return;
            }
            if (Math.Abs(e.X - At.Value.X) > 5)
            {
                var x = e.X > At.Value.X ? 1 : -1;
                JumpOver = Move(X + x, Y);
                JumpTo   = Move(X + x + x, Y);
            }
            else if (Math.Abs(e.Y - At.Value.Y) > 5)
            {
                var y = e.Y > At.Value.Y ? 1 : -1;
                JumpOver = Move(X, Y + y);
                JumpTo   = Move(X, Y + y + y);
            }
            else
            {
                return;
            }

            CanJump = JumpTo != null && JumpOver.State == 1 && JumpTo.State == 0;
            if (CanJump)
            {
                JumpOver.SetState(0);
                JumpTo.SetState(2);
            }
        }
示例#2
0
 private void pic_MouseUp(object sender, MouseEventArgs e)
 {
     if (!CanJump)
     {
         return;
     }
     SetState(0);
     JumpTo.SetState(1);
     JumpOver.SetState(0);
     At      = null;
     JumpTo  = JumpOver = null;
     CanJump = false;
 }
示例#3
0
        public Main()
        {
            InitializeComponent();

            Marble.SetMarbles(this);
        }
示例#4
0
 private void btnReset_Click(object sender, System.EventArgs e)
 {
     Marble.Reset();
 }