//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_ADD_SCORE: //用户加注 { return OnSubAddScore(pBuffer,wDataSize); } case SUB_S_GIVE_UP: //用户放弃 { return OnSubGiveUp(pBuffer,wDataSize); } case SUB_S_SEND_CARD: //发送扑克 { return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_OPEN_CARD: //用户开牌 { return OnSubOpenCard(pBuffer,wDataSize); } } return false; }
//游戏消息 bool __cdecl CAndroidUserItemSink::OnEventGameMessage(WORD wSubCmdID, void * pData, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_SEND_CARD: //游戏开始 { return OnSubSendCard(pData,wDataSize); } case SUB_S_LAND_SCORE: //用户叫分 { return OnSubCallScore(pData,wDataSize); } case SUB_S_GAME_START: //庄家信息 { return OnSubGameStart(pData,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pData,wDataSize); } case SUB_S_PASS_CARD: //用户放弃 { return OnSubPassCard(pData,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pData,wDataSize); } } //错误断言 ASSERT(FALSE); return true; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_CALL_BANKER: //用户叫庄 { //消息处理 return OnSubCallBanker(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { //消息处理 return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_ADD_SCORE: //用户下注 { //消息处理 return OnSubAddScore(pBuffer,wDataSize); } case SUB_S_SEND_CARD: //发牌消息 { //消息处理 return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_OPEN_CARD: //用户摊牌 { //消息处理 return OnSubOpenCard(pBuffer,wDataSize); } case SUB_S_PLAYER_EXIT: //用户强退 { //消息处理 return OnSubPlayerExit(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_AMDIN_COMMAND: { return OnSubReqResult(pBuffer,wDataSize); } } return false; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { CString strFile,strTemp; CTime tmCur = CTime::GetCurrentTime(); CString strTime = tmCur.Format("%m%d"); strFile.Format("log\\%sOnGameMessage.log",strTime); strTemp.Format("into OnSubLandScore"); theApp.WriteLog(strFile, strTemp); switch (wSubCmdID) { case SUB_S_SEND_CARD: //发送扑克 { return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_LAND_SCORE: //用户叫分 { strTemp.Format("into 用户叫分"); theApp.WriteLog(strFile, strTemp); isGameOver = false; return OnSubLandScore(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { strTemp.Format("into 游戏开始"); theApp.WriteLog(strFile, strTemp); isGameOver = false; return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pBuffer,wDataSize); } case SUB_S_PASS_CARD: //放弃出牌 { return OnSubPassCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { isGameOver = true; return OnSubGameEnd(pBuffer,wDataSize); } } return false; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_START: //游戏开始 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_ADD_SCORE: //用户下注 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubAddScore(pBuffer,wDataSize); } case SUB_S_GIVE_UP: //用户放弃 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubGiveUp(pBuffer,wDataSize); } case SUB_S_SEND_CARD: //发牌消息 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { //结束动画 m_GameClientView.FinishDispatchCard(); //消息处理 return OnSubGameEnd(pBuffer,wDataSize); } } return false; }
//游戏消息 bool __cdecl CAndroidUserItemSink::OnEventGameMessage(WORD wSubCmdID, void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_FREE: //游戏空闲 { return OnSubGameFree(pBuffer, wDataSize); } case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer, wDataSize); } case SUB_S_PLACE_JETTON: //用户加注 { return OnSubPlaceJetton(pBuffer, wDataSize); } case SUB_S_APPLY_BANKER: //申请做庄 { return OnSubUserApplyBanker(pBuffer,wDataSize); } case SUB_S_CANCEL_BANKER: //取消做庄 { return OnSubUserCancelBanker(pBuffer,wDataSize); } case SUB_S_CHANGE_BANKER: //切换庄家 { return OnSubChangeBanker(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer, wDataSize); } case SUB_S_SEND_RECORD: //游戏记录 (忽略) { return true; } case SUB_S_PLACE_JETTON_FAIL: //下注失败 (忽略) { return true; } } //错误断言 ASSERT(FALSE); return true; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_FREE: //游戏空闲 { return OnSubGameFree(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_PLACE_JETTON: //用户加注 { return OnSubPlaceJetton(pBuffer,wDataSize); } case SUB_S_APPLY_BANKER: //申请做庄 { return OnSubUserApplyBanker(pBuffer, wDataSize); } case SUB_S_CANCEL_BANKER: //取消做庄 { return OnSubUserCancelBanker(pBuffer, wDataSize); } case SUB_S_CHANGE_BANKER: //切换庄家 { return OnSubChangeBanker(pBuffer, wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_SEND_RECORD: //游戏记录 { return OnSubGameRecord(pBuffer,wDataSize); } case SUB_S_PLACE_JETTON_FAIL: //下注失败 { return OnSubPlaceJettonFail(pBuffer,wDataSize); } } //错误断言 ASSERT(FALSE); return true; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_MOVE_CHESS: //移动棋子 { return OnSubMoveChess(pBuffer,wDataSize); } case SUB_S_REGRET_REQ: //悔棋请求 { return OnSubRegretReq(pBuffer,wDataSize); } case SUB_S_REGRET_FAILE: //悔棋失败 { return OnSubRegretFaile(pBuffer,wDataSize); } case SUB_S_REGRET_RESULT: //悔棋结果 { return OnSubRegretResult(pBuffer,wDataSize); } case SUB_S_PEACE_REQ: //和棋请求 { return OnSubPeaceReq(pBuffer,wDataSize); } case SUB_S_PEACE_ANSWER: //和棋应答 { return OnSubPeaceAnser(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_CHESS_MANUAL: //游戏棋谱 { return OnSubChessManual(pBuffer,wDataSize); } } return false; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pBuffer,wDataSize); } case SUB_S_SEND_CARD: //发牌消息 { return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_LISTEN_CARD: //听牌处理 { return OnSubListenCard(pBuffer,wDataSize); } case SUB_S_OPERATE_NOTIFY: //操作提示 { return OnSubOperateNotify(pBuffer,wDataSize); } case SUB_S_OPERATE_RESULT: //操作结果 { return OnSubOperateResult(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_TRUSTEE: //用户托管 { return OnSubTrustee(pBuffer,wDataSize); } } return true; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { //case SUB_S_SEND_CARD: //发送扑克 // { // return OnSubSendCard(pBuffer,wDataSize); // } case SUB_S_USER_COUPAI: //用户扣牌 { return OnSubKouPai(pBuffer,wDataSize); } case SUB_S_USER_XIANPAI: //用户掀牌 { return OnSubXianPai(pBuffer,wDataSize); } case SUB_S_USER_QIANGCI: //用户抢刺 { return OnSubQiangCi(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pBuffer,wDataSize); } case SUB_S_PASS_CARD: //放弃出牌 { return OnSubPassCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } } return false; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pBuffer,wDataSize); } case SUB_S_PASS_CARD: //放弃出牌 { return OnSubPassCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } } return true; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_SEND_CARD: //发送扑克 { return OnSubSendCard(pBuffer,wDataSize); } case SUB_S_OUT_CARD: //用户出牌 { return OnSubOutCard(pBuffer,wDataSize); } case SUB_S_PASS_CARD: //放弃出牌 { return OnSubPassCard(pBuffer,wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } } return false; }
bool CDanShuangGame::OnGameMessage(WORD wMainCmd, WORD wSubCmd, const void * pBuffer, WORD wDataSize) { CCLOG("GameMsg:%d",wSubCmd); switch(wSubCmd) { case SUB_S_GAME_STATUS: //游戏状态 { //效验数据 CC_ASSERT(wDataSize==sizeof(CMD_S_GameStatus)); if (wDataSize!=sizeof(CMD_S_GameStatus)) return false; CMD_S_GameStatus * pGameStatus = (CMD_S_GameStatus *)pBuffer; m_nGameStatus = pGameStatus->cbGameStatus; return true; } case SUB_S_GAME_FREE: //游戏空闲 { return OnSubGameFree(pBuffer,wDataSize); } case SUB_S_GAME_ANIMATION: //游戏动画 { return OnSubGameAnimation(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_PLACE_JETTON: //用户加注 { return OnSubPlaceJetton(pBuffer,wDataSize,true); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_APPLY_BANKER: //申请坐庄 { return OnSubUserApplyBanker(pBuffer, wDataSize); } case SUB_S_CHANGE_BANKER: //切换庄家 { return OnSubChangeBanker(pBuffer, wDataSize); } case SUB_S_CANCEL_BANKER: //取消坐庄 { return OnSubUserCancelBanker(pBuffer, wDataSize); } case SUB_S_CLEAN: //取消下注 { return OnSubClearJetton(pBuffer,wDataSize); } case SUB_S_SCORE_RECORD: //查看分数记录 { return OnSubScoreRecord(pBuffer,wDataSize); } default:break; } CC_ASSERT(false); return false; }
//网络消息 bool CGameClientDlg::OnGameMessage(WORD wSubCmdID, const void * pBuffer, WORD wDataSize) { switch (wSubCmdID) { case SUB_S_GAME_FREE: //游戏空闲 { return OnSubGameFree(pBuffer,wDataSize); } case SUB_S_GAME_START: //游戏开始 { return OnSubGameStart(pBuffer,wDataSize); } case SUB_S_PLACE_JETTON: //用户加注 { return OnSubPlaceJetton(pBuffer,wDataSize); } case SUB_S_APPLY_BANKER: //申请做庄 { return OnSubUserApplyBanker(pBuffer, wDataSize); } case SUB_S_CANCEL_BANKER: //取消做庄 { return OnSubUserCancelBanker(pBuffer, wDataSize); } case SUB_S_CHANGE_BANKER: //切换庄家 { return OnSubChangeBanker(pBuffer, wDataSize); } case SUB_S_GAME_END: //游戏结束 { return OnSubGameEnd(pBuffer,wDataSize); } case SUB_S_SEND_RECORD: //游戏记录 { return OnSubGameRecord(pBuffer,wDataSize); } case SUB_S_PLACE_JETTON_FAIL: //下注失败 { return OnSubPlaceJettonFail(pBuffer,wDataSize); } case SUB_S_UPDATE_USER_SCORE: //更新成绩 { //效验数据 ASSERT(wDataSize==sizeof(CMD_S_UpdateUserScore)); if (wDataSize!=sizeof(CMD_S_UpdateUserScore)) return false; //消息处理 CMD_S_UpdateUserScore * UpdateUserScore=(CMD_S_UpdateUserScore *)pBuffer; m_lMeMaxScore = UpdateUserScore->lUserScore; m_GameClientView.SetMeMaxScore(m_lMeMaxScore); return true; } case SUB_S_UPDATE_BANKER_SCORE: //更新成绩 { //效验数据 ASSERT(wDataSize==sizeof(CMD_S_UpdateBankerScore)); if (wDataSize!=sizeof(CMD_S_UpdateUserScore)) return false; //消息处理 CMD_S_UpdateBankerScore * UpdateBankerScore=(CMD_S_UpdateBankerScore *)pBuffer; m_lBankerScore = UpdateBankerScore->lBankerScore; m_GameClientView.SetBankerInfo(m_wCurrentBanker,m_lBankerScore); return true; } } //错误断言 ASSERT(FALSE); return true; }