示例#1
0
        //初始化
        internal void init()
        {
            //每次初始化都重绘背景
            Graphics g = Graphics.FromImage(bmp);

            drawingFormHelper.DrawBackground(g);


            //发一次牌
            dpoker    = new DistributePokerHelper();
            pokerList = dpoker.Distribute();

            //每个人手中的牌清空,准备摸牌
            currentPokers[0].Clear();
            currentPokers[1].Clear();
            currentPokers[2].Clear();
            currentPokers[3].Clear();

            //清空已发送的牌
            currentAllSendPokers[0].Clear();
            currentAllSendPokers[1].Clear();
            currentAllSendPokers[2].Clear();
            currentAllSendPokers[3].Clear();


            //为每个人的currentPokers设置Rank
            currentPokers[0].Rank = currentRank;
            currentPokers[1].Rank = currentRank;
            currentPokers[2].Rank = currentRank;
            currentPokers[3].Rank = currentRank;
            currentPokers[0].Suit = 0;
            currentPokers[1].Suit = 0;
            currentPokers[2].Suit = 0;
            currentPokers[3].Suit = 0;


            currentSendCards[0] = new ArrayList();
            currentSendCards[1] = new ArrayList();
            currentSendCards[2] = new ArrayList();
            currentSendCards[3] = new ArrayList();

            //
            myCardsLocation = new ArrayList();
            myCardsNumber   = new ArrayList();
            myCardIsReady   = new ArrayList();
            send8Cards      = new ArrayList();


            //设置命令
            currentState.CurrentCardCommands = CardCommands.ReadyCards;
            currentState.Suit = 0;


            //设置还未发牌,循环25次将牌发完
            currentCount = 0;

            //目前不可以反牌
            showSuits   = 0;
            whoShowRank = 0;

            //得分清零
            Scores = 0;


            //绘制Sidebar
            drawingFormHelper.DrawSidebar(g);
            //绘制东南西北
            drawingFormHelper.DrawOtherMaster(g, 0, 0);

            if (currentState.Master != 0)
            {
                drawingFormHelper.DrawMaster(g, currentState.Master, 1);
                drawingFormHelper.DrawOtherMaster(g, currentState.Master, 1);
            }

            //绘制Rank
            drawingFormHelper.DrawRank(g, currentState.OurCurrentRank, true, false);
            drawingFormHelper.DrawRank(g, currentState.OpposedCurrentRank, false, false);

            //绘制花色
            drawingFormHelper.DrawSuit(g, 0, true, false);
            drawingFormHelper.DrawSuit(g, 0, false, false);

            send8Cards = new ArrayList();
            //调整花色
            if (currentRank == 53)
            {
                currentState.Suit = 5;
            }

            whoIsBigger = 0;

            //如果设置了游戏截止,则停止游戏
            if (gameConfig.WhenFinished > 0)
            {
                bool b = false;

                if ((currentState.OurTotalRound + 1) > gameConfig.WhenFinished)
                {
                    b = true;
                }
                if ((currentState.OpposedTotalRound + 1) > gameConfig.WhenFinished)
                {
                    b = true;
                }
                if (b)
                {
                    timer.Stop();
                    PauseGametoolStripMenuItem.Text  = "继续游戏";
                    PauseGametoolStripMenuItem.Image = Properties.Resources.MenuResume;
                }
            }
        }