예제 #1
0
        private void rightMove(Domino domino, PictureBox pbox)
        {
            ImageRotator rotator = new ImageRotator();

            pbox.Location = rightPoint;
            if (domino.First != domino.Second)
            {
                pbox.Image    = rotator.ClockWise(pbox.Image);
                pbox.Location = new Point(pbox.Location.X, vertRY);
                if (domino.First != Right)
                {
                    pbox.Image = rotator.HalfCircle(pbox.Image);
                }
            }
            else
            {
                pbox.Location = new Point(pbox.Location.X, vertRY - 11);
                rotator.ClockWise(pbox.Image);
            }
            Right = (byte)(domino.First + domino.Second - Right);
            if (rightPoint.X > 700 && (downCount > 1 || domino.First != domino.Second) && downCount <= 2)
            {
                if (domino.First == domino.Second)
                {
                    pbox.Image    = rotator.ClockWise(pbox.Image);
                    pbox.Location = new Point(pbox.Location.X - 11, pbox.Location.Y);
                    rotator.ClockWise(pbox.Image);
                }
                else
                {
                    pbox.Image = rotator.CounterClockWise(pbox.Image);
                }
                rightPoint    = new Point(domino.First == domino.Second ? rightPoint.X - 11 : rightPoint.X, vertRY);
                vertRY       += pbox.Size.Height + 3;
                pbox.Location = rightPoint;
                downCount++;
            }
            else if (downCount > 2)
            {
                rightPoint    = new Point(rightPoint.X - pbox.Image.Width - 3, vertRY - 11);
                pbox.Image    = rotator.HalfCircle(pbox.Image);
                pbox.Location = rightPoint;
                if (domino.First == domino.Second)
                {
                    pbox.Location = new Point(pbox.Location.X, pbox.Location.Y - 11);
                }
            }
            else
            {
                rightPoint = new Point(rightPoint.X + pbox.Image.Width + 3, vertRY);
            }
            // (this as Form).Text = downCount.ToString();
            pbox.Size    = pbox.Image.Size;
            label2.Text += '\n' + pbox.Location.ToString() + '-' + pbox.Size.ToString() + '-' + domino.ToString();
        }
예제 #2
0
        private void leftMove(Domino domino, PictureBox pbox)
        {
            ImageRotator rotator = new ImageRotator();

            if (domino.First != domino.Second)
            {
                pbox.Image = rotator.ClockWise(pbox.Image);
                leftPoint  = new Point(leftPoint.X, vertLY);
                if (domino.Second != Left)
                {
                    pbox.Image = rotator.HalfCircle(pbox.Image);
                }
            }
            else
            {
                leftPoint = new Point(leftPoint.X, vertLY - 11);
                //  rotator.ClockWise(pbox.Image);
            }
            if (leftPoint.X < 100 && (upCount > 0 || domino.First != domino.Second) && upCount <= 2)
            {
                pbox.Size  = pbox.Size.Reverse();
                pbox.Image = rotator.CounterClockWise(pbox.Image);
                vertLY    -= pbox.Size.Height + 3;
                leftPoint  = new Point(domino.First == domino.Second ? leftPoint.X - 11 : leftPoint.X, vertLY);
                if (upCount == 0)
                {
                    vertLY -= 32;
                }
                upCount++;
                pbox.Location = leftPoint;
                if (upCount == 3)
                {
                    leftPoint.X += 25;
                }
                if (domino.First == domino.Second)
                {
                    pbox.Image    = rotator.ClockWise(pbox.Image);
                    pbox.Location = new Point(pbox.Location.X - 11, pbox.Location.Y);
                }
                pbox.Size = pbox.Image.Size;
            }
            else if (leftPoint.X < 300 && upCount <= 2 && upCount > 0)
            {
                //vertLY -= 3;
                pbox.Location = new Point(domino.First == domino.Second ? leftPoint.X - 25 : leftPoint.X, vertLY);
                leftPoint     = new Point(leftPoint.X, leftPoint.Y - 3);
                if (domino.First == domino.Second)
                {
                    pbox.Location = new Point(pbox.Location.X, pbox.Location.Y - 11);
                }
            }
            else if (upCount > 2)
            {
                pbox.Image    = rotator.HalfCircle(pbox.Image);
                pbox.Location = leftPoint;
                leftPoint     = new Point(leftPoint.X + pbox.Width + 3, vertLY - 22);

                /*  if (domino.First == domino.Second)
                 *    pbox.Location = new Point(pbox.Location.X, pbox.Location.Y - 11);*/
            }
            else
            {
                leftPoint     = new Point(leftPoint.X - pbox.Image.Width - 3, leftPoint.Y);
                pbox.Location = leftPoint;
            }
            Left         = (byte)(domino.First + domino.Second - Left);
            pbox.Size    = pbox.Image.Size;
            label2.Text += '\n' + pbox.Location.ToString() + '-' + pbox.Size.ToString() + '-' + domino.ToString();
        }