施法前摇

#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 );
}


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值