This commit is contained in:
aozhiwei 2019-04-08 14:35:55 +08:00
parent f86291f4bc
commit 35fd26271d
2 changed files with 14 additions and 0 deletions

View File

@ -72,6 +72,9 @@ void Player::Update(int delta_time)
if (action_type != AT_None) { if (action_type != AT_None) {
UpdateAction(); UpdateAction();
} }
if (spectate) {
UpdateSpectate();
}
MakeUpdateMsg(); MakeUpdateMsg();
SendNotifyMsg(*update_msg); SendNotifyMsg(*update_msg);
{ {
@ -249,6 +252,11 @@ void Player::UpdateUseItemIdx()
use_item = false; use_item = false;
} }
void Player::UpdateSpectate()
{
spectate = false;
}
void Player::Shot() void Player::Shot()
{ {
if (!curr_weapon->meta) { if (!curr_weapon->meta) {
@ -590,6 +598,9 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
use_item = true; use_item = true;
use_item_idx = msg.use_item_idx(); use_item_idx = msg.use_item_idx();
} }
if (msg.has_spectate()) {
spectate = true;
}
} }
void Player::UpdateDropWeapon() void Player::UpdateDropWeapon()

View File

@ -55,6 +55,8 @@ class Player : public Human
bool reload = false; bool reload = false;
bool spectate = false;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
template <typename T> template <typename T>
@ -76,6 +78,7 @@ class Player : public Human
void UpdateReload(); void UpdateReload();
void UpdateCancelAction(); void UpdateCancelAction();
void UpdateUseItemIdx(); void UpdateUseItemIdx();
void UpdateSpectate();
void Shot(); void Shot();
void ProcInteraction(); void ProcInteraction();
void ObstacleInteraction(Obstacle* entity); void ObstacleInteraction(Obstacle* entity);