예제 #1
0
    public override void execute()
    {
        CommandCharacterGetHua cmdShowHua = newCmd(out cmdShowHua);

        cmdShowHua.mMah = (MAHJONG)mMahjong.mValue;
        pushCommand(cmdShowHua, mCharacterManager.getCharacter(mOtherPlayerGUID.mValue));
    }
예제 #2
0
 public override void update(float elapsedTime)
 {
     // 开始拿牌时,需要由麻将系统给玩家分发牌
     if (mPlayState == MAHJONG_PLAY_STATE.MPS_GET_START)
     {
         mCurInterval -= elapsedTime;
         // 从庄家开始发牌
         if (mCurInterval <= 0.0f)
         {
             mCurInterval += GameDefine.ASSIGN_MAHJONG_INTERVAL;
             // 给玩家发牌
             CommandCharacterGetStart cmd = newCmd(out cmd);
             cmd.mMahjong = mHandInList[(int)mCurAssignPos][0];
             pushCommand(cmd, mPlayerPositionList[(int)mCurAssignPos]);
             mHandInList[(int)mCurAssignPos].RemoveAt(0);
             // 如果到房主的牌发完了,则退出发牌
             if (mCurAssignPos == mBankerPos && mHandInList[(int)mCurAssignPos].Count == 0)
             {
                 mPlayState = MAHJONG_PLAY_STATE.MPS_NORMAL_GAMING;
                 // 牌拿完时需要重新排列,发放花牌
                 int playerCount = mPlayerPositionList.Count;
                 for (int i = 0; i < playerCount; ++i)
                 {
                     int huaCount = mHuaList[i].Count;
                     for (int j = 0; j < huaCount; ++j)
                     {
                         CommandCharacterGetHua cmdHua = newCmd(out cmdHua);
                         cmdHua.mMah = mHuaList[i][j];
                         pushCommand(cmdHua, mPlayerPositionList[i]);
                     }
                 }
                 // 通知服务器开局麻将已经拿完了
                 mSocketManager.sendMessage <CSGetStartMahjongDone>();
                 return;
             }
             else
             {
                 mCurAssignPos = (PLAYER_POSITION)(((int)mCurAssignPos + 1) % (int)PLAYER_POSITION.PP_MAX);
             }
         }
     }
 }