示例#1
0
// use room type and role id to get role room potiner.
LWRoomBase* GroupRoomProcessor::GetRoleRoom(ERoomType eRT, unsigned int nRoleID)
{
    CGroupRoleEntity *pEnt = CGroupPlayerManager::Instance().SearchRoleByID(nRoleID);
    ENSURE_WITH_LOG_CMD(NULL != pEnt, return NULL, "miss group on line role[%u] entity.", nRoleID);

    ENSURE_WITH_LOG_CMD(pEnt->GetGroupRoomType() == eRT, return NULL, "error role[%u] room type[%d,%d] on GetRoleRoom", nRoleID, (int)pEnt->GetGroupRoomType(), (int)eRT);

    LWRoomManagerPtr roomPtr = GetRoomManager(eRT);
    ENSURE_WITH_LOG_CMD(NULL != roomPtr, return NULL, "miss room manage type[%d] ", (int)eRT);

    return roomPtr->GetRoom(pEnt->GetGroupRoomID()); // 取得这个房间
}
示例#2
0
void GroupRoomProcessor::OnRoleLogOut(CGroupRoleEntity *pGroupRole)
{
    if (NULL != pGroupRole && pGroupRole->GetGroupRoomType() != eRoomType_None)
    {
        LWRoomManager *pManager = GetRoomManager(pGroupRole->GetGroupRoomType());
        ENSURE_WITH_LOG_CMD(NULL != pManager, return, "error to get room manager[%d]", (int)pGroupRole->GetGroupRoomType());

        LWRoomBase *pRoom = pManager->GetRoom(pGroupRole->GetGroupRoomID());
        if (NULL != pRoom)
            pManager->OnRoleLogout(pRoom, pGroupRole->GetRoleID());

        pGroupRole->ClearGroupRoom(); // 清理这个人的房间
    }
示例#3
0
LWRoomBase* GroupRoomProcessor::GetRoleRoom(CGroupRoleEntity *pRoleEntity)
{
    if (NULL == pRoleEntity)
        return NULL;

    if (pRoleEntity->GetGroupRoomType() == eRoomType_None)
        return NULL;

    LWRoomManager *pRoomMgr = GetRoomManager(pRoleEntity->GetGroupRoomType());
    if (NULL == pRoomMgr)
        return NULL;
    
    return pRoomMgr->GetRoom(pRoleEntity->GetGroupRoomID());
}
示例#4
0
BOOL SFLogicEntry::OnDisconnectPlayer(int serial)
{
	PlayerMap::iterator iter = m_PlayerMap.find(serial);
	
	if(iter == m_PlayerMap.end())
	{
		SFASSERT(0);
		return FALSE;
	}

	SFPlayer* pPlayer = iter->second;

	m_pPlayerManager->DelPlayer(pPlayer);

///////////////////////////////////////////////////////////
//20120619 이런식으로 짜면 실수할 여지가 크다.... 나중에 수정할 수 있도록 한다.
///////////////////////////////////////////////////////////
	if (pPlayer->GetPlayerState() == PLAYER_STATE_LOADING ||
		pPlayer->GetPlayerState() == PLAYER_STATE_ROOM ||
		pPlayer->GetPlayerState() == PLAYER_STATE_PLAY ||
		pPlayer->GetPlayerState() == PLAYER_STATE_PLAYEND ||
		pPlayer->GetPlayerState() == PLAYER_STATE_PLAYREADY)
	{
		SFRoomManager* pManager = GetRoomManager();
		SFRoom* pRoom = pManager->GetRoom(pPlayer->GetRoomIndex());
		pRoom->GetRoomFSM()->OnLeaveRoom(pPlayer);
	}

	pPlayer->ChangeState(PLAYER_STATE_NONE);

	m_pPlayerPool->Release(pPlayer);

	m_PlayerMap.erase(iter);

	return TRUE;
}
示例#5
0
BOOL SFLogicEntry::OnTimer(BasePacket* pPacket)
{
	SFRoomManager* pManager = GetRoomManager();
	return pManager->Update();
}