public override void execute() { GameScene gameScene = mGameSceneManager.getCurScene(); if (gameScene.getType() != GAME_SCENE_TYPE.GST_MAHJONG) { return; } CommandMahjongSceneNotifyStartDone cmd = mCommandSystem.newCmd <CommandMahjongSceneNotifyStartDone>(); mCommandSystem.pushCommand(cmd, gameScene); }
public void update(float elapsedTime) { // 开始拿牌时,需要由麻将系统给玩家分发牌 if (mPlayState == MAHJONG_PLAY_STATE.MPS_GET_START) { mCurInterval -= elapsedTime; // 从庄家开始发牌 if (mCurInterval <= 0.0f) { mCurInterval = GameDefine.ASSIGN_MAHJONG_INTERVAL; Character curPlayer = mPlayerPositionList[mCurAssignPos]; // 给玩家发牌 CommandCharacterGetStart cmd = mCommandSystem.newCmd <CommandCharacterGetStart>(); cmd.mMahjong = requestGet(); mCommandSystem.pushCommand(cmd, curPlayer); bool isDone = false; int palyerHandInCount = curPlayer.getCharacterData().mHandIn.Count; // 如果是庄家,需要拿够14张牌 if (mCurAssignPos == mBankerPos) { isDone = (palyerHandInCount == GameDefine.MAX_HAND_IN_COUNT); } // 不是庄家则拿13张牌 else { isDone = (palyerHandInCount == GameDefine.MAX_HAND_IN_COUNT - 1); } // 牌拿完时需要重新排列 if (isDone) { CommandCharacterReorderMahjong cmdReorder = mCommandSystem.newCmd <CommandCharacterReorderMahjong>(); mCommandSystem.pushCommand(cmdReorder, curPlayer); // 如果是庄家拿完了牌,则进入正常游戏流程 if (mCurAssignPos == mBankerPos) { CommandMahjongSceneNotifyStartDone cmdStartDone = mCommandSystem.newCmd <CommandMahjongSceneNotifyStartDone>(); mCommandSystem.pushCommand(cmdStartDone, mGameSceneManager.getCurScene()); // 通知玩家打出一张牌 CommandCharacterAskDrop cmdAskDrop = mCommandSystem.newCmd <CommandCharacterAskDrop>(); mCommandSystem.pushCommand(cmdAskDrop, curPlayer); return; } } mCurAssignPos = (PLAYER_POSITION)(((int)mCurAssignPos + 1) % (int)PLAYER_POSITION.PP_MAX); } } }