1.修改GameManager类中的GameManager::m_serverIP = "192.168.1.225";
2.SceneMain类中在点击房间类型时,发送自己游戏的类型ID,如我的游戏是3101,所以这里改成31,而不用正常情况下的GameTypeIndex_CD
m_sceneData.m_GameIndex = 31;//GameTypeIndex_CD;
m_sceneData.m_GameGrade =0;
m_SceneRoom->onRun(true);
break;
3.修改SceneRoom类中的(加上了case 31 匹配你想进入的场景)
void SceneRoom::onRunLogonFinish(bool login) { GameDataRef* view=NULL; switch (m_sceneData.m_GameIndex) { case 31: case GameTypeIndex_CD: view=(GameDataRef*)(ScnenControlPHZ::getInstance()->setCurrentScene(Scene_game_cd)); break; case GameTypeIndex_WW: view=(GameDataRef*)(ScnenControlPHZ::getInstance()->setCurrentScene(Scene_game_ww)); break; case GameTypeIndex_LHQ: view=(GameDataRef*)(ScnenControlPHZ::getInstance()->setCurrentScene(Scene_game_lhq)); break; case GameTypeIndex_ZP: view=(GameDataRef*)(ScnenControlPHZ::getInstance()->setCurrentScene(Scene_game_zp)); break; case GameTypeIndex_WHZ: view=(GameDataRef*)(ScnenControlPHZ::getInstance()->setCurrentScene(Scene_game_whz)); break; default: break; } //好友房间不需要登陆 if(login) { view->runAction(CCSequence::create(CCDelayTime::create(1.0f),CallFunc::create(CC_CALLBACK_0(GameDataRef::onLogin,view)),nullptr)); } }
4.通过查看上面代码中的setCurrentScene(Scene_game_cd),我们可以知道他跳转到了CDSceneView牌桌界面(CD表示常德),然后通过OnGameMessageRun来处理游戏的逻辑消息
5.接下来我们处理自己的图片和逻辑数据的对应关系,它在GameResBase中。
6.回过头来查看游戏开始消息后的处理逻辑(OnSubGameStart函数)
时间: 2024-09-29 09:30:37