五星宏辉【源码】

[复制链接]

该用户从未签到

2380

主题

2433

帖子

9139

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9139
QQ
跳转到指定楼层
楼主
发表于 2017-6-13 11:13:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

想要查看内容赶紧注册登陆吧!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
#include "StdAfx.h"
#include "Resource.h"
#include "Tableframesink.h"
#include "GameServerManager.h"

//////////////////////////////////////////////////////////////////////////

//全局变量
static CGameServiceManager            g_GameServiceManager;                //管理变量

//////////////////////////////////////////////////////////////////////////

//构造函数
CGameServiceManager::CGameServiceManager(void)
{
    ////设置属性
    //m_GameServiceAttrib.wKindID=KIND_ID;
    //m_GameServiceAttrib.wChairCount=GAME_PLAYER;
    //lstrcpyn(m_GameServiceAttrib.szKindName,GAME_NAME,CountArray(m_GameServiceAttrib.szKindName));
    //lstrcpyn(m_GameServiceAttrib.szDataBaseName,szTreasureDB,CountArray(m_GameServiceAttrib.szDataBaseName));
    //lstrcpyn(m_GameServiceAttrib.szDescription,TEXT("五星宏辉游戏服务组件"),CountArray(m_GameServiceAttrib.szDescription));
    //lstrcpyn(m_GameServiceAttrib.szClientModuleName,TEXT("FiveStar.exe"),CountArray(m_GameServiceAttrib.szClientModuleName));
    //lstrcpyn(m_GameServiceAttrib.szServerModuleN  bame,TEXT("FiveStarServer.dll"),CountArray(m_GameServiceAttrib.szServerModuleName));
    //m_GameServiceAttrib.cbJoinInGame = TRUE;


    //设置属性
    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);

    //功能标志
    m_GameServiceAttrib.cbDynamicJoin=TRUE;
    m_GameServiceAttrib.cbAndroidUser=TRUE;
    m_GameServiceAttrib.cbOffLineTrustee=FALSE;

    //服务属性
    m_GameServiceAttrib.dwServerVersion=VERSION_SERVER;
    m_GameServiceAttrib.dwClientVersion=VERSION_CLIENT;
    lstrcpyn(m_GameServiceAttrib.szGameName,GAME_NAME,CountArray(m_GameServiceAttrib.szGameName));
    lstrcpyn(m_GameServiceAttrib.szDataBaseName,szTreasureDB,CountArray(m_GameServiceAttrib.szDataBaseName));
    lstrcpyn(m_GameServiceAttrib.szClientEXEName,TEXT("FiveStar.EXE"),CountArray(m_GameServiceAttrib.szClientEXEName));
    lstrcpyn(m_GameServiceAttrib.szServerDLLName,TEXT("FiveStarServer.DLL"),CountArray(m_GameServiceAttrib.szServerDLLName));


    return;
}

//析构函数
CGameServiceManager::~CGameServiceManager(void)
{
}

//接口查询
VOID * CGameServiceManager:ueryInterface(const IID & Guid, DWORD dwQueryVer)
{
    QUERYINTERFACE(IGameServiceManager,Guid,dwQueryVer);
    QUERYINTERFACE_IUNKNOWNEX(IGameServiceManager,Guid,dwQueryVer);
    return NULL;
}

//创建游戏桌
void * CGameServiceManager::CreateTableFrameSink(const IID & 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;
}

//获取属性
bool CGameServiceManager::GetServiceAttrib(tagGameServiceAttrib & GameServiceAttrib)
{
    GameServiceAttrib=m_GameServiceAttrib;
    return true;
}

//参数修改
bool CGameServiceManager::RectifyParameter(tagGameServiceOption & GameServiceOption)
{
    //效验参数
    ASSERT(pGameServiceOption!=NULL);
    if (&GameServiceOption==NULL) return false;

    //单元积分
    GameServiceOption.lCellScore=__max(1L,GameServiceOption.lCellScore);

    //积分下限
    GameServiceOption.lMinTableScore=__max(0L,GameServiceOption.lMinTableScore);

    //积分上限
    if (GameServiceOption.lRestrictScore!=0L)
    {
        GameServiceOption.lRestrictScore=__max(GameServiceOption.lRestrictScore,GameServiceOption.lMinTableScore);
    }

    //读取配置
    memcpy(m_szGameRoomName, GameServiceOption.szServerName, sizeof(m_szGameRoomName));

    return true;
}

//创建机器
VOID * CGameServiceManager::CreateAndroidUserItemSink(REFGUID Guid, DWORD dwQueryVer)
{
    ////变量定义
    //CAndroidUserItemSink * pAndroidUserItemSink=NULL;

    //try
    //{
    //    //建立对象
    //    pAndroidUserItemSink=new CAndroidUserItemSink();
    //    if (pAndroidUserItemSink==NULL) throw TEXT("创建失败");

    //    //查询接口
    //    void * pObject=pAndroidUserItemSink->QueryInterface(Guid,dwQueryVer);
    //    if (pObject==NULL) throw TEXT("接口查询失败");

    //    return pObject;
    //}
    //catch (...) {}

    ////删除对象
    //SafeDelete(pAndroidUserItemSink);

    return NULL;
}
//创建数据
VOID * CGameServiceManager::CreateGameDataBaseEngineSink( REFGUID Guid, DWORD dwQueryVer )
{
    return NULL;
}


////获取配置
//bool CGameServiceManager::SaveCustomRule( LPBYTE pcbCustomRule, WORD wCustonSize )
//{
//    return /*m_DlgCustomRule.SaveCustomRule(pcbCustomRule,wCustonSize)*/;
//}

////创建窗口
//HWND CGameServiceManager::CreateCustomRule( CWnd * pParentWnd, CRect rcCreate, LPBYTE pcbCustomRule, WORD wCustonSize )
//{
//    //设置变量
//    m_DlgCustomRule.SetCustomRule(pcbCustomRule,wCustonSize);
//
//    //创建窗口
//    if (m_DlgCustomRule.m_hWnd == NULL)
//    {
//        //设置资源
//        AfxSetResourceHandle(GetModuleHandle(m_GameServiceAttrib.szServerDLLName));
//
//        //创建窗口
//        m_DlgCustomRule.Create(IDD_CUSTOM_RULE,pParentWnd);
//
//        //还原资源
//        AfxSetResourceHandle(GetModuleHandle(NULL));
//    }
//
//    //显示窗口
//    m_DlgCustomRule.SetWindowPos(NULL,rcCreate.left,rcCreate.top,rcCreate.Width(),rcCreate.Height(),SWP_NOZORDER|SWP_SHOWWINDOW);
//
//    return m_DlgCustomRule.GetSafeHwnd();
//}

////默认配置
//bool CGameServiceManager:efaultCustomRule( LPBYTE pcbCustomRule, WORD wCustonSize )
//{
//    return m_DlgCustomRule.DefaultCustomRule(pcbCustomRule,wCustonSize);
//}

//////////////////////////////////////////////////////////////////////////

//建立对象函数
extern "C" __declspec(dllexport) void * __cdecl CreateGameServiceManager(const GUID & Guid, DWORD dwInterfaceVer)
{
    return g_GameServiceManager.QueryInterface(Guid,dwInterfaceVer);
}

//////////////////////////////////////////////////////////////////////////

分享到:  QQ好友和群QQ好友和群
收藏收藏
回复

使用道具 举报

快速回复高级模式
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表