183 lines
5.4 KiB
C++
183 lines
5.4 KiB
C++
#include "StdAfx.h"
|
|
#include "Tableframesink.h"
|
|
#include "GameServerManager.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//全局变量
|
|
static CGameServiceManager g_GameServiceManager; //管理变量
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//构造函数
|
|
CGameServiceManager::CGameServiceManager(void)
|
|
{
|
|
// //设置属性
|
|
// m_GameServiceAttrib.wKindID=KIND_ID;
|
|
// m_GameServiceAttrib.wChairCount=GAME_PLAYER;
|
|
// m_GameServiceAttrib.cbJoinInGame=FALSE;
|
|
// lstrcpyn(m_GameServiceAttrib.szKindName,GAME_NAME,CountArray(m_GameServiceAttrib.szKindName));
|
|
// lstrcpyn(m_GameServiceAttrib.szDataBaseName,TEXT("QPShuangKouBBDB"),CountArray(m_GameServiceAttrib.szDataBaseName));
|
|
//
|
|
//#ifdef VIDEO_GAME
|
|
// lstrcpyn(m_GameServiceAttrib.szDescription,TEXT("双扣游戏服务组件"),CountArray(m_GameServiceAttrib.szDescription));
|
|
// lstrcpyn(m_GameServiceAttrib.szClientModuleName,TEXT("ShuangKouBBVD.EXE"),CountArray(m_GameServiceAttrib.szClientModuleName));
|
|
// lstrcpyn(m_GameServiceAttrib.szServerModuleName,TEXT("ShuangKouBBVDServer.DLL"),CountArray(m_GameServiceAttrib.szServerModuleName));
|
|
//#else
|
|
// lstrcpyn(m_GameServiceAttrib.szDescription,TEXT("双扣游戏服务组件"),CountArray(m_GameServiceAttrib.szDescription));
|
|
// lstrcpyn(m_GameServiceAttrib.szClientModuleName,TEXT("ShuangKouBB.EXE"),CountArray(m_GameServiceAttrib.szClientModuleName));
|
|
// lstrcpyn(m_GameServiceAttrib.szServerModuleName,TEXT("ShuangKouBBServer.DLL"),CountArray(m_GameServiceAttrib.szServerModuleName));
|
|
//#endif
|
|
|
|
//控件变量
|
|
m_hDllInstance = NULL;
|
|
|
|
//内核属性
|
|
m_GameServiceAttrib.wKindID = KIND_ID;
|
|
m_GameServiceAttrib.wChairCount = GAME_PLAYER;
|
|
m_GameServiceAttrib.wSupporType = (GAME_GENRE_GOLD | GAME_GENRE_SCORE | GAME_GENRE_MATCH | GAME_GENRE_EDUCATE | SCORE_GENRE_NORMAL);
|
|
|
|
//功能标志
|
|
m_GameServiceAttrib.cbDynamicJoin = FALSE;
|
|
m_GameServiceAttrib.cbAndroidUser = TRUE;
|
|
m_GameServiceAttrib.cbOffLineTrustee = TRUE;
|
|
|
|
//服务属性
|
|
m_GameServiceAttrib.dwServerVersion = VERSION_SERVER;
|
|
m_GameServiceAttrib.dwClientVersion = VERSION_CLIENT;
|
|
lstrcpyn(m_GameServiceAttrib.szGameName, GAME_NAME, CountArray(m_GameServiceAttrib.szGameName));
|
|
lstrcpyn(m_GameServiceAttrib.szDataBaseName, TEXT("QPSRDZDB"), CountArray(m_GameServiceAttrib.szDataBaseName));
|
|
lstrcpyn(m_GameServiceAttrib.szClientEXEName, TEXT("SRDZ.EXE"), CountArray(m_GameServiceAttrib.szClientEXEName));
|
|
lstrcpyn(m_GameServiceAttrib.szServerDLLName, TEXT("SRDZServer.DLL"), CountArray(m_GameServiceAttrib.szServerDLLName));
|
|
|
|
return;
|
|
}
|
|
|
|
//析构函数
|
|
CGameServiceManager::~CGameServiceManager(void)
|
|
{
|
|
}
|
|
|
|
//接口查询
|
|
VOID * CGameServiceManager::QueryInterface(REFGUID Guid, DWORD dwQueryVer)
|
|
{
|
|
QUERYINTERFACE(IGameServiceManager,Guid,dwQueryVer);
|
|
QUERYINTERFACE_IUNKNOWNEX(IGameServiceManager,Guid,dwQueryVer);
|
|
return NULL;
|
|
}
|
|
|
|
//创建游戏桌
|
|
VOID * CGameServiceManager::CreateTableFrameSink(REFGUID Guid, DWORD dwQueryVer)
|
|
{
|
|
//建立对象
|
|
CTableFrameSink * pTableFrameSink=NULL;
|
|
try
|
|
{
|
|
pTableFrameSink=new CTableFrameSink();
|
|
if (pTableFrameSink==NULL) throw TEXT("创建失败");
|
|
void * pObject=pTableFrameSink->QueryInterface(Guid,dwQueryVer);
|
|
if (pObject==NULL) throw TEXT("接口查询失败");
|
|
return pObject;
|
|
}
|
|
catch (...) {}
|
|
|
|
//清理对象
|
|
SafeDelete(pTableFrameSink);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
////获取属性
|
|
//void __cdecl CGameServiceManager::GetGameServiceAttrib(tagGameServiceAttrib & GameServiceAttrib)
|
|
//{
|
|
// GameServiceAttrib=m_GameServiceAttrib;
|
|
// return;
|
|
//}
|
|
//
|
|
////参数修改
|
|
//bool __cdecl CGameServiceManager::RectifyServiceOption(tagGameServiceOption * pGameServiceOption)
|
|
//{
|
|
// //效验参数
|
|
// ASSERT(pGameServiceOption!=NULL);
|
|
// if (pGameServiceOption==NULL) return false;
|
|
//
|
|
// //单元积分
|
|
// pGameServiceOption->lCellScore=__max(1L,pGameServiceOption->lCellScore);
|
|
//
|
|
// //积分下限
|
|
// if (pGameServiceOption->wServerType==GAME_GENRE_GOLD)
|
|
// {
|
|
// pGameServiceOption->lLessScore=__max(pGameServiceOption->lCellScore*6L,pGameServiceOption->lLessScore);
|
|
// }
|
|
///*
|
|
//
|
|
// //积分上限
|
|
// if (pGameServiceOption->lRestrictScore!=0L)
|
|
// {
|
|
// pGameServiceOption->lRestrictScore=__max(pGameServiceOption->lRestrictScore,pGameServiceOption->lLessScore);
|
|
// }
|
|
//*/
|
|
//
|
|
// return true;
|
|
//}
|
|
|
|
//创建机器
|
|
VOID * CGameServiceManager::CreateAndroidUserItemSink(REFGUID Guid, DWORD dwQueryVer)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
//创建数据
|
|
VOID * CGameServiceManager::CreateGameDataBaseEngineSink(REFGUID Guid, DWORD dwQueryVer)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
//组件属性
|
|
bool CGameServiceManager::GetServiceAttrib(tagGameServiceAttrib & GameServiceAttrib)
|
|
{
|
|
//设置变量
|
|
GameServiceAttrib = m_GameServiceAttrib;
|
|
|
|
return true;
|
|
}
|
|
|
|
//调整参数
|
|
bool CGameServiceManager::RectifyParameter(tagGameServiceOption & GameServiceOption)
|
|
{
|
|
//保存房间选项
|
|
m_GameServiceOption = GameServiceOption;
|
|
|
|
//单元积分
|
|
GameServiceOption.lCellScore = __max(1L, GameServiceOption.lCellScore);
|
|
|
|
return true;
|
|
}
|
|
|
|
//获取配置
|
|
bool CGameServiceManager::SaveCustomRule(LPBYTE pcbCustomRule, WORD wCustonSize)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//默认配置
|
|
bool CGameServiceManager::DefaultCustomRule(LPBYTE pcbCustomRule, WORD wCustonSize)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//创建窗口
|
|
HWND CGameServiceManager::CreateCustomRule(CWnd * pParentWnd, CRect rcCreate, LPBYTE pcbCustomRule, WORD wCustonSize)
|
|
{
|
|
return nullptr;
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//建立对象函数
|
|
extern "C" __declspec(dllexport) void * __cdecl CreateGameServiceManager(const GUID & Guid, DWORD dwInterfaceVer)
|
|
{
|
|
return g_GameServiceManager.QueryInterface(Guid,dwInterfaceVer);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|