2019-03-28 16:43:17 +08:00

70 lines
1.6 KiB
C++

#pragma once
#include "human.h"
#include "GGListener.h"
namespace cs
{
class CMMove;
class CMDropItem;
class CMEmote;
class CMSpectate;
class CMVoice;
class MFActivePlayerData;
}
class Room;
class Obstacle;
class Player : public Human
{
public:
enum { HID = HID_Player };
public:
int socket_handle = 0;
std::string account_id;
int team_mode = 0;
int player_count = 0;
bool auto_fill = false;
bool use_touch = false;
std::string avatar_url;
int last_seq_id = 0;
bool moving = false;
int moved_frames = 0;
bool shot_start = false;
bool shot_hold = false;
int series_shot_frames = 0;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
template <typename T>
void SendNotifyMsg(T& msg)
{
GGListener::Instance()->SendToClient(socket_handle, 0, msg);
}
Player();
virtual ~Player() override;
virtual void Initialize() override;
virtual void Update(int delta_time) override;
void UpdateMove();
void UpdateShot();
void Shot();
void ProcInteraction();
void ObstacleInteraction(Obstacle* entity);
void _CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg);
void _CMDropItem(f8::MsgHdr& hdr, const cs::CMDropItem& msg);
void _CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg);
void _CMSpectate(f8::MsgHdr& hdr, const cs::CMSpectate& msg);
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
void FillMFPlayerData(cs::MFActivePlayerData* player_data);
private:
cs::SMUpdate* update_msg = nullptr;
void MakeUpdateMsg();
};