⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serviceenginer.h

📁 游戏框架
💻 H
📖 第 1 页 / 共 2 页
字号:
// ***************************************************************
//  ServiceEnginer   version:  1.0
//  -------------------------------------------------------------
//	File Name:	ServiceEnginer.h
//	Created:	2007/07/18
//	Modified:	2007/07/18   16:43
//	Author:		William.Liang
//  Msn:		lwq49@msn.com
//  Email:		lwq49@21cn.com, lwq49@msn.com
//	Description:
//
//	Purpose:	
//  -------------------------------------------------------------
//  license:
//
//  The contents of this file are subject to the Mozilla Public
//  License Version 1.1 (the "License"); you may not use this file
//  except in compliance with the License. You may obtain a copy
//  of the License at http://www.mozilla.org/MPL/ Software dis-
//  tributed under the License is distributed on an "AS IS" 
//  basis, WITHOUT WARRANTY OF ANY KIND, either express or im-
//  plied. See the License for the specific language governing
//  rights and limitations under the License.
//
//  The Initial Developer of the Original Code is William.Liang .
//  Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#ifndef SERVICE_ENGINER_HEAD_FILE
#define SERVICE_ENGINER_HEAD_FILE

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

//平台头文件
#include "..\ObjectCom\ObjectCom.h"
#include "..\ComService\ComService.h"
//////////////////////////////////////////////////////////////////////////
//公共宏定义

//代理类型
#define PROXY_NONE					0									//没有代理
#define PROXY_SOCKS4				1									//SOCKS4 代理
#define PROXY_SOCKS5				2									//SOCKS5 代理
#define PROXY_HTTP					3									//HTTP 代理

//常量宏定义
#define EVENT_LEVEL_COUNT			4									//事件等级
#define MAX_QUEUE_PACKET			10240								//最大队列
#define INDEX_ALL_SOCKET			0xFFFF								//所有连接
#define TIMER_REPEAT_TIMER			DWORD(-1)							//重复次数

//导出定义
#ifndef SERVICE_ENGINER_CLASS
	#ifdef  SERVICE_ENGINER_DLL
		#define SERVICE_ENGINER_CLASS _declspec(dllexport)
	#else
		#define SERVICE_ENGINER_CLASS _declspec(dllimport)
	#endif
#endif

//模块定义
#ifdef _DEBUG
	#define SERVICE_ENGINER_DLL_NAME	TEXT("ServiceEnginerD.dll")			//组件 DLL 名字
#else
	#define SERVICE_ENGINER_DLL_NAME	TEXT("ServiceEnginer.dll")			//组件 DLL 名字
#endif

//////////////////////////////////////////////////////////////////////////
//
////网络数据定义
//#define SOCKET_VER						3									//数据包版本
//#define SOCKET_PACKAGE					4080								//最大网络包
//#define SOCKET_BUFFER					(sizeof(CMD_Head)+SOCKET_PACKAGE+2*sizeof(DWORD))

//事件标识
#define EVENT_CONTROL				0x0001								//控制消息
#define EVENT_TIMER					0x0002								//定时器引擎
#define EVENT_ACTION				0x0007								//动作引擎
#define EVENT_DATABASE				0x0003								//数据库请求
#define EVENT_SOCKET_ACCEPT			0x0004								//网络应答(服务端)
#define EVENT_SOCKET_READ			0x0005								//网络读取(服务端)
#define EVENT_SOCKET_CLOSE			0x0006								//网络关闭(服务端)
#define EVENT_CLIENT_SOCKET_CONNECT	0x0008								//网络应答(客户端)
#define EVENT_CLIENT_SOCKET_READ	0x0009								//网络读取(客户端)
#define EVENT_CLIENT_SOCKET_CLOSE	0x000A								//网络关闭(客户端)
//
////数据包结构信息
//struct CMD_Info
//{
//	WORD								wDataSize;							//数据大小
//	BYTE								cbCheckCode;						//效验字段
//	BYTE								cbMessageVer;						//版本标识
//};
//
////数据包命令信息
//struct CMD_Command
//{
//	WORD								wMainCmdID;							//主命令码
//	WORD								wSubCmdID;							//子命令码
//};
//
////数据包传递包头
//struct CMD_Head
//{
//	CMD_Info							CmdInfo;							//基础结构
//	CMD_Command							CommandInfo;						//命令信息
//};
//
////网络数据包缓冲
//struct CMD_Buffer
//{
//	CMD_Head							Head;								//数据包头
//	BYTE								cbBuffer[SOCKET_PACKAGE];			//数据缓冲
//};
//
////内核命令码
//#define MDM_KN_COMMAND					0									//内核命令
//#define SUB_KN_DETECT_SOCKET			1									//检测命令

//定时器事件
struct NTY_TimerEvent
{
	WORD							wTimerID;							//定时器 ID
	WPARAM							wBindParam;							//绑定参数
};

//动作事件
struct NTY_ActionEvent
{
	IGameObject*					pIGameObject;						//执行对象
	WORD							wActionID;							//定时器 ID
	DWORD							dwRepeatTimes;						//剩余执行次数
	WPARAM							wBindParam;							//绑定参数
};

//数据库请求事件
struct NTY_DataBaseEvent
{
	WORD							wIndex;								//对象索引
	WORD							wRoundID;							//对象标识
	WORD							wRequestID;							//请求标识
};

//网络应答事件
struct NTY_SocketAcceptEvent
{
	WORD							wIndex;								//连接索引
	WORD							wRoundID;							//连接标识
	DWORD							dwClientIP;							//连接地址
};

//网络读取事件
struct NTY_SocketReadEvent
{
	WORD							wIndex;								//连接索引
	WORD							wRoundID;							//连接标识
	WORD							wDataSize;							//数据大小
	CMD_Command						Command;							//命令信息
};

//网络关闭事件
struct NTY_SocketCloseEvent
{
	WORD							wIndex;								//连接索引
	WORD							wRoundID;							//连接标识
	DWORD							dwClientIP;							//连接地址
	DWORD							dwConnectSecond;					//连接时间
};


//网络应答事件
struct NTY_SocketConnectEvent
{
	int								iErrorCode;							//错误代码
	TCHAR							szErrorDesc[128];					//错误描述
};

//////////////////////////////////////////////////////////////////////////
//
////数据队列头
//struct tagDataHead
//{
//	WORD							wDataSize;							//数据大小
//	WORD							wIdentifier;						//类型标识
//	DWORD							dwInsertTime;						//插入时间
//};
//
////负荷信息
//struct tagBurthenInfo
//{
//	DWORD							dwDataSize;							//数据大小
//	DWORD							dwBufferSize;						//缓冲区长度
//	DWORD							dwDataPacketCount;					//数据包数目
//};

enum enuActionType{
	Action_Move,
	Action_MoveTrack,
	Action_Resize,
	Action_Angle,
	Action_Vibrating,
	Action_Alpha,
	Action_Z,
	Action_Rect,
};

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

#define VER_IQueueServiceSink INTERFACE_VERSION(1,1)
static const GUID IID_IQueueServiceSink={0x88b5bf59,0x3a98,0x43b1,0xac,0x85,0xf1,0x17,0x5b,0x29,0x69,0x40};

//数据队列类钩子接口
interface IQueueServiceSink : public IUnknownEx
{
	//通知回调函数
	virtual void __cdecl OnQueueServiceSink(WORD wIdentifier, void * pBuffer, WORD wDataSize, DWORD dwInsertTime)=NULL;
};

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

#define VER_IQueueService INTERFACE_VERSION(1,1)
static const GUID IID_IQueueService={0xcc5310b5,0x3709,0x40aa,0x85,0x24,0xd6,0xc5,0x87,0xb0,0x32,0x22};

//数据队列接口
interface IQueueService : public IUnknownEx
{
	//加入数据
	virtual bool __cdecl AddToQueue(WORD wIdentifier, void * const pBuffer, WORD wDataSize)=NULL;
};

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

#define VER_ITimerEngine INTERFACE_VERSION(1,1)
static const GUID IID_ITimerEngine={0x4a9b0421,0x1224,0x4e5e,0xa5,0x4f,0xb1,0x61,0x6e,0x62,0xdb,0x98};

//定时器引擎接口
interface ITimerEngine : public IUnknownEx
{
	//设置定时器
	virtual bool __cdecl SetTimer(WORD wTimerID, DWORD dwElapse, DWORD dwRepeat, WPARAM wParam, BOOL bCheckExist=true)=NULL; 
	//删除定时器
	virtual bool __cdecl KillTimer(WORD wTimerID)=NULL;
	//删除定时器
	virtual bool __cdecl KillAllTimer()=NULL;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -