#pragma once
#include "..//Game_Module//Unit_Factory.h"
#include "Game_API.h"
struct Game_Unit_Name{};
typedef Proxy_Factory< Game_Unit_Name, Unit_Factory< long >, Unit_Factory< long > > GAME_UNIT_FACTORY;
typedef Proxy_Factory< Game_Unit_Name, IEvt_Server<>, Evt_Server<> > GAME_EVT_SERVER;
struct Game_Unit
{
Game_Unit( long _uid ):UID(_uid){ GAME_UNIT_FACTORY::get_proxy()->push_single(UID, this); }
virtual ~Game_Unit(){ GAME_UNIT_FACTORY::get_proxy()->pop(UID); }
const long UID;
};
class Role_Unit: public Game_Unit
{
public:
Role_Unit( long _uid ):Game_Unit(_uid), p_SKL_Prepare(NULL){}
virtual ~Role_Unit()
{
DELETE_POINT(p_SKL_Prepare);
}
void create_skill_prepare_tgr( long _delay_time )
{
delete_skill_prepare_tgr();
p_SKL_Prepare = new SKL_Prepare_Timer( _delay_time );
}
void delete_skill_prepare_tgr()
{
DELETE_POINT(p_SKL_Prepare);
}
private:
ITimerSink* p_SKL_Prepare;
};
#pragma once
using namespace std;
struct SKILL_ID
{
enum SKILL
{
SKL_PLAN = 1, //施法前摇
SKL_BREAK = 2, //施法打断
LXTX = 3, //流星突现
MFX = 4, //魔法箭
};
};
//struct SKILL_SERVER_NAME{};
//
//typedef Proxy_Factory< SKILL_SERVER_NAME, Delete_Proxy, Delete_Proxy > SKILL_DELETE_SERVER;
#pragma once
#include "..//App_Module//App_Server.h"
#define CLIENT_OPERATE() App_Server::get_log_trace()->print( Module_Name::Game_App, _T("客户端操作 ") )
#define SERVER_OPERATE() App_Server::get_log_trace()->print( Module_Name::Game_App, _T("服务器操作 ") )
CString l2s(long _num);
CString d2s(double _num);
//执行基类
class SKL_Base_Act: public IAction_Event_Listener<>
{
public:
SKL_Base_Act(long _skill_evt);
virtual ~SKL_Base_Act();
private:
long m_skill_evt;
};
//前摇器
class SKL_Prepare_Timer: public ITimerSink
{
public:
SKL_Prepare_Timer(long _delay_time);
virtual ~SKL_Prepare_Timer();
virtual void on_time(long _user_sign);
};
#include "stdafx.h"
#include "Game_API.h"
#include "Game_Unit.h"
#include "Game_Skill_define.h"
CString l2s(long _num)
{
CString ret;
ret.Format(_T("%d"), _num);
return ret;
}
CString d2s(double _num)
{
CString ret;
ret.Format(_T("%0.9f"), _num);
return ret;
}
SKL_Base_Act::SKL_Base_Act(long _skill_evt):m_skill_evt(_skill_evt)
{
GAME_EVT_SERVER::get_proxy()->add_listener(m_skill_evt, this);
}
SKL_Base_Act::~SKL_Base_Act()
{
GAME_EVT_SERVER::get_proxy()->remove_listener(m_skill_evt, this);
}
//前摇器
SKL_Prepare_Timer::SKL_Prepare_Timer( long _delay_time )
{
App_Server::get_time_axis()->set_time_tgr( this, 1, _delay_time, 10000);
}
SKL_Prepare_Timer::~SKL_Prepare_Timer()
{
App_Server::get_time_axis()->kill_time_tgr(this, 1);
}
void SKL_Prepare_Timer::on_time(long _user_sign)
{
CString text;
text.Format( _T("施法 -- 流星突现") );
App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}
#pragma once
#include "..//..//Game_Module//Map_Par_Binder.h"
struct SKL_Prepare_Par
{
public:
// 投手, 前摇时间
SKL_Prepare_Par( long _caster_uid, long _delay_time ):date(_caster_uid, _delay_time){};
Bind_Par< TYPELIST_2(long, long) > date;
};
//施法准备
class PLAN_SKL;
class BREAK_SKL;
class SKL_Prepare
{
public:
SKL_Prepare();
virtual ~SKL_Prepare();
private:
PLAN_SKL* mp_plan_skl;
BREAK_SKL* mp_break_skl;
};
#include "stdafx.h"
#include "SKL_Prepare.h"
#include "..//Game_API.h"
#include "..//Game_Skill_define.h"
#include "..//Game_Unit.h"
//执行施法前摇
struct PLAN_SKL: public SKL_Base_Act
{
PLAN_SKL():SKL_Base_Act(SKILL_ID::SKL_PLAN){}
virtual void on_action(Msg *_p_msg)
{
//投手, 前摇时间, 技能(技能ID, 投手, 投递目标, 投递地点)
SKL_Prepare_Par* p_buf = NULL;
_p_msg->get_sub_buf(p_buf);
Role_Unit* p = (Role_Unit*)GAME_UNIT_FACTORY::get_proxy()->get_unit(p_buf->date.par1);
RETURN_IF_NULL( p );
p->create_skill_prepare_tgr( p_buf->date.par2 );
CString text;
text.Format( _T("进入施法前摇") );
App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}
};
//打断施法前摇
struct BREAK_SKL: public SKL_Base_Act
{
BREAK_SKL():SKL_Base_Act(SKILL_ID::SKL_BREAK){}
virtual void on_action(Msg *_p_msg)
{
Role_Unit* p = (Role_Unit*)GAME_UNIT_FACTORY::get_proxy()->get_unit(1);
RETURN_IF_NULL( p );
p->delete_skill_prepare_tgr();
CString text;
text.Format( _T("打断施法前摇") );
App_Server::get_log_trace()->print( Module_Name::Game_App, text.GetBuffer() );
}
};
SKL_Prepare::SKL_Prepare()
{
mp_plan_skl = new PLAN_SKL();
mp_break_skl = new BREAK_SKL();
}
SKL_Prepare::~SKL_Prepare()
{
DELETE_POINT( mp_plan_skl );
DELETE_POINT( mp_break_skl );
}