Пример #1
0
        void difficultyButton_Click(object sender, EventArgs e)
        {
            XnaButton button = (XnaButton)sender;
            TwisterDifficulty diff = (TwisterDifficulty)button.Tag;
            _needsConfigure = false;

            if (FingerGames.IsTrial && (diff == TwisterDifficulty.Beginner || diff == TwisterDifficulty.Master))
            {
                FingerGames.Instance.SetStage(Stage.Trial);
            }
            else
            {
                int colCount = 5;
                int rowCount = 3;
                int yOffset = 24;
                int width, height;

                switch (diff)
                {
                    case TwisterDifficulty.Beginner:
                        {
                            colCount = 3;
                            rowCount = 2;
                        }
                        break;
                    case TwisterDifficulty.Intermediate:
                        {
                            colCount = 5;
                            rowCount = 3;
                        }
                        break;
                    case TwisterDifficulty.Master:
                        {
                            colCount = 6;
                            rowCount = 4;
                        }
                        break;
                }

                GameManager.GameVariation = diff.ToString();

                width = (800 - 80) / colCount;
                height = width;
                yOffset = (480 - width * rowCount) / 2;

                double halfCol = (colCount - 1) / 2;
                double widthOffset = (width / 10);

                _circles = new TwisterCircle[colCount * rowCount];
                int index = 0;
                for (int x = 0; x < colCount; ++x)
                {
                    for (int y = 0; y < rowCount; ++y)
                    {
                        Rectangle bounds = new Rectangle((int)(80 + x * width + (y-halfCol) * widthOffset), yOffset + y * height, width, height);
                        _circles[index] = new TwisterCircle(this.GameManager.Game, bounds, _colors[index % _colors.Length]);

                        index++;
                    }
                }
                foreach (TwisterCircle circle in _circles)
                {
                    circle.Digit = null;
                    circle.SetIntroAnim(TimeSpan.FromMilliseconds(FingerGames.Randomizer.Next(0, 2000)), FingerGames.Randomizer.Next(100, 1600));
                }
            }
        }
Пример #2
0
        void difficultyButton_Click(object sender, EventArgs e)
        {
            XnaButton         button = (XnaButton)sender;
            TwisterDifficulty diff   = (TwisterDifficulty)button.Tag;

            _needsConfigure = false;

            if (FingerGames.IsTrial && (diff == TwisterDifficulty.Beginner || diff == TwisterDifficulty.Master))
            {
                FingerGames.Instance.SetStage(Stage.Trial);
            }
            else
            {
                int colCount = 5;
                int rowCount = 3;
                int yOffset = 24;
                int width, height;

                switch (diff)
                {
                case TwisterDifficulty.Beginner:
                {
                    colCount = 3;
                    rowCount = 2;
                }
                break;

                case TwisterDifficulty.Intermediate:
                {
                    colCount = 5;
                    rowCount = 3;
                }
                break;

                case TwisterDifficulty.Master:
                {
                    colCount = 6;
                    rowCount = 4;
                }
                break;
                }

                GameManager.GameVariation = diff.ToString();

                width   = (800 - 80) / colCount;
                height  = width;
                yOffset = (480 - width * rowCount) / 2;

                double halfCol     = (colCount - 1) / 2;
                double widthOffset = (width / 10);

                _circles = new TwisterCircle[colCount * rowCount];
                int index = 0;
                for (int x = 0; x < colCount; ++x)
                {
                    for (int y = 0; y < rowCount; ++y)
                    {
                        Rectangle bounds = new Rectangle((int)(80 + x * width + (y - halfCol) * widthOffset), yOffset + y * height, width, height);
                        _circles[index] = new TwisterCircle(this.GameManager.Game, bounds, _colors[index % _colors.Length]);

                        index++;
                    }
                }
                foreach (TwisterCircle circle in _circles)
                {
                    circle.Digit = null;
                    circle.SetIntroAnim(TimeSpan.FromMilliseconds(FingerGames.Randomizer.Next(0, 2000)), FingerGames.Randomizer.Next(100, 1600));
                }
            }
        }