Esempio n. 1
0
        public override void SenceDidLoad()
        {
            base.SenceDidLoad();
            if (this.gameType == GameType.FiveXFive)
            {
                row    = 5;
                column = 5;
            }
            else if (this.gameType == GameType.SixXSix)
            {
                row    = 6;
                column = 6;
            }
            this.numbers     = new int[column, row];
            this.squareCells = new SquareCell[column, row];

            //ESC
            ConsoleSpirit backSpirit = new ConsoleSpirit(1, 1, ConsoleApplication.appWidth - 1 - 1, 1, ConsoleColor.Gray);

            backSpirit.Text = new string[] { " << ESC键返回菜单  P键重新开始" };
            this.Spirits.Add(backSpirit);

            //计分板
            this.scoreSp      = new ConsoleSpirit(33, 1, ConsoleApplication.appWidth - 1 - 33, 1, ConsoleColor.Gray, ConsoleColor.Black);
            this.scoreSp.Text = new string[] { "当前分数 : 0" };
            this.addSpirit(scoreSp);

            //方格
            for (int y = 0; y < row; y++)
            {
                for (int x = 0; x < column; x++)
                {
                    SquareCell cell = new SquareCell((ConsoleApplication.appWidth - 2 * (column - 1) - 6 * column) / 2 + x * 8, 3 + y * 4, 6, 3, ConsoleColor.Cyan);
                    cell.Score    = this.numbers[x, y];
                    cell.gameType = this.gameType;
                    this.addSpirit(cell);
                    this.squareCells[x, y] = cell;
                }
            }

            AddNumber(numbers, 0, 2);
            AddNumber(numbers, 0, 2);
        }
Esempio n. 2
0
        public override void SenceDidLoad()
        {
            //游戏规则视图
            ConsoleSpirit ruleSp = new ConsoleSpirit((ConsoleApplication.appWidth - 36) / 2, 1, 36, 25, ConsoleColor.Gray, ConsoleColor.Black);

            ruleSp.FileName = "gameRule.txt";
            this.addSpirit(ruleSp);

            button1      = new ConsoleSpirit(13, 19, 9, 1, ConsoleColor.Gray);
            button1.Text = new string[] { "4 X 4 模式" };
            ruleSp.AddSubSpirit(button1);

            button2      = new ConsoleSpirit(13, 21, 9, 1, ConsoleColor.Gray);
            button2.Text = new string[] { "5 X 5 模式" };
            ruleSp.AddSubSpirit(button2);

            button3      = new ConsoleSpirit(13, 23, 9, 1, ConsoleColor.Gray);
            button3.Text = new string[] { "6 X 6 模式" };
            ruleSp.AddSubSpirit(button3);
            SetBackgroundColor();
        }