Files
mir_server/server/LogicServer/entitysystem/EntityVarSubSystem.h
aixianling 5c9f1dae4a init
2025-01-09 17:45:40 +08:00

53 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/************************************************************************/
/*
/* 角色动态变量子系统
/*
/* 角色动态变量主要用于向脚本提供存放角色数据。这些数据也可以直接被C++读取和修改
/*
/*
/************************************************************************/
//*** 角色变量基础类 ***/
template<int SUBSYSTEMID,class SonClass, class EntityClass>
class CCustomEntityVarSubSystem :
public CEntitySubSystem<SUBSYSTEMID, SonClass, EntityClass>
{
public:
typedef CEntitySubSystem<SUBSYSTEMID, SonClass, EntityClass> Inherited;
public:
//获取变量对象
inline CCLVariant& GetVar() { return m_Var; }
public:
//初始化
inline bool Initialize(void *data,SIZE_T size)
{
if (!Inherited::Initialize(data, size))
return false;
m_Var.clear();
return true;
}
//析构
inline void Destroy() { m_Var.clear(); }
protected:
CCLVariant m_Var;//根变量
};
//*** 玩家变量类存DB ***/
class CActorVarSubSystem :
public CCustomEntityVarSubSystem<enActorVarSystemID, CActorVarSubSystem, CActor>
{
public:
typedef CCustomEntityVarSubSystem<enActorVarSystemID, CActorVarSubSystem, CActor> Inherited;
public:
//处理DB数据
void OnDbRetData(INT_PTR nCmd,INT_PTR nErrorCode,CDataPacketReader &reader);
//存盘
void Save(PACTORDBDATA pData);
};