BOOL SFRoomLoading::OnLoadingComplete( SFPlayer* pPlayer, BasePacket* pPacket) { SFRoom* pRoom = GetOwner(); pRoom->GetP2PSys()->AddPeer(pPlayer->GetSerial(), pPlayer->GetIPInfo()); if(TRUE != pRoom->CheckLoadingComplete()) return FALSE; pRoom->ChangeState(ROOM_STATE_PLAYREADY); pRoom->ChangeState(ROOM_STATE_PLAY); return TRUE; }
BOOL SFRoomManager::OnCreateRoom( SFPlayerLobby* pLobbyState, int GameMode ) { SFRoom* pRoom = GetEmptyRoom(); SFPlayer* pPlayer = pLobbyState->GetOwner(); if(NULL == pRoom) return FALSE; SFASSERT(pRoom->GetRoomState() == ROOM_STATE_NONE); pRoom->Open(pPlayer); pRoom->ChangeState(ROOM_STATE_WAIT); pPlayer->SetRoomIndex(pRoom->GetRoomIndex()); _GameModeInfo* pInfo = pRoom->GetGameModeInfo(); pInfo->SetGameMode(GameMode); m_ActiveRoomMap.insert(std::make_pair(pRoom->GetRoomIndex(), pRoom)); return TRUE; }