Example #1
0
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;
}
Example #2
0
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;
}