コード例 #1
0
        /// <summary>
        /// 初始化.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormOnePlayer_Load(object sender, EventArgs e)
        {
            // 初始化游戏类.
            game = new BlackJackGame();

            // 初始化玩家.
            player = new Player()
            {
                Name = DEFAULT_PLAYER_NAME,
            };
            computerPlayer = new ComputerPlayer()
            {
                Name = DEFAULT_COMPUTER_PLAYER_NAME,
            };

            // 玩家加入游戏.
            game.AddNewPlayer(player);
            game.AddNewPlayer(computerPlayer);

            // 初始化游戏.
            //game.InitGames();


            // 事件绑定.
            // 当2张牌发完以后, 显示牌局.
            game.AfterTakeFirstTwoCard += new AfterTakeFirstTwoCardHandler(ShowAfterTakeFirstTwoCard);
        }