235 lines
5.1 KiB
C++
235 lines
5.1 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "AfxTempl.h"
|
|||
|
|
#include "PrivateGame.h"
|
|||
|
|
#include "PrivateServiceManager.h"
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>캯<EFBFBD><ECBAAF>
|
|||
|
|
CPrivateServiceManager::CPrivateServiceManager(void)
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
|
m_bIsService=false;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
m_pIGamePrivatetem=NULL;
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CPrivateServiceManager::~CPrivateServiceManager(void)
|
|||
|
|
{
|
|||
|
|
//<2F>ͷ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
|
if(m_pIGamePrivatetem!=NULL) SafeDelete(m_pIGamePrivatetem);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::StopService()
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>
|
|||
|
|
ASSERT(m_bIsService==true);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
m_bIsService=false;
|
|||
|
|
|
|||
|
|
//<2F>ͷ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
|
if(m_pIGamePrivatetem!=NULL) SafeRelease(m_pIGamePrivatetem);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::StartService()
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>
|
|||
|
|
ASSERT(m_bIsService==false);
|
|||
|
|
if(m_bIsService==true) return false;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
m_bIsService=true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>֪ͨ
|
|||
|
|
if(m_pIGamePrivatetem!=NULL) m_pIGamePrivatetem->OnStartService();
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
//<2F>ӿڲ<D3BF>ѯ
|
|||
|
|
void * CPrivateServiceManager::QueryInterface(const IID & Guid, DWORD dwQueryVer)
|
|||
|
|
{
|
|||
|
|
QUERYINTERFACE(IPrivateServiceManager,Guid,dwQueryVer);
|
|||
|
|
QUERYINTERFACE_IUNKNOWNEX(IPrivateServiceManager,Guid,dwQueryVer);
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::CreatePrivateMatch()
|
|||
|
|
{
|
|||
|
|
//<2F>ӿ<EFBFBD><D3BF>ж<EFBFBD>
|
|||
|
|
ASSERT(m_pIGamePrivatetem==NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL) return false;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
m_pIGamePrivatetem = new PriaveteGame();
|
|||
|
|
if(m_pIGamePrivatetem==NULL) throw TEXT("˽<EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
|||
|
|
}
|
|||
|
|
catch(...)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return m_pIGamePrivatetem!=NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::BindTableFrame(ITableFrame * pTableFrame,WORD wTableID)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->BindTableFrame(pTableFrame,wTableID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>ӿ<EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::InitPrivateInterface(tagPrivateManagerParameter & MatchManagerParameter)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->InitPrivateInterface(MatchManagerParameter);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ʱ<><CAB1><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventTimer(DWORD dwTimerID, WPARAM dwBindParameter)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventTimer(dwTimerID,dwBindParameter);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF>¼<EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventDataBase(WORD wRequestID, IServerUserItem * pIServerUserItem, VOID * pData, WORD wDataSize)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventDataBase(wRequestID,pIServerUserItem,pData,wDataSize);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
bool CPrivateServiceManager::OnEventSocketPrivate(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem, DWORD dwSocketID)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventSocketPrivate(wSubCmdID,pData,wDataSize,pIServerUserItem,dwSocketID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD>¼
|
|||
|
|
bool CPrivateServiceManager::OnEventUserLogon(IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventUserLogon(pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>dz<EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventUserLogout(IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventUserLogout(pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventEnterPrivate(DWORD dwSocketID,VOID* pData,DWORD dwUserIP, bool bIsMobile)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventEnterPrivate(dwSocketID, pData, dwUserIP, bIsMobile);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventUserJoinPrivate(IServerUserItem * pIServerUserItem, BYTE cbReason,DWORD dwSocketID)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventUserJoinPrivate(pIServerUserItem,cbReason,dwSocketID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CPrivateServiceManager::OnEventUserQuitPrivate(IServerUserItem * pIServerUserItem, BYTE cbReason,WORD *pBestRank, DWORD dwContextID)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventUserQuitPrivate(pIServerUserItem,cbReason,pBestRank,dwContextID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
bool CPrivateServiceManager::OnEventReqStandUP(IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return m_pIGamePrivatetem->OnEventReqStandUP(pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>ӿ<EFBFBD>
|
|||
|
|
IUnknownEx * CPrivateServiceManager::GetServerUserItemSink()
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pIGamePrivatetem!=NULL);
|
|||
|
|
if(m_pIGamePrivatetem!=NULL)
|
|||
|
|
{
|
|||
|
|
return QUERY_OBJECT_PTR_INTERFACE(m_pIGamePrivatetem,IServerUserItemSink);
|
|||
|
|
}
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
DECLARE_CREATE_MODULE(PrivateServiceManager);
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|