//游戏消息 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 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; }