add SMUiUpdate
This commit is contained in:
parent
cd8191e2b1
commit
1059c468eb
@ -1146,7 +1146,15 @@ void Human::FillMFGasData(cs::MFGasData* gas_data)
|
||||
gas_data->set_duration(std::max(duration * 50, (long long)1000) / 1000);
|
||||
} else if (room->gas_data.gas_mode == GasJump) {
|
||||
gas_data->set_duration(0);
|
||||
} else {
|
||||
} else if (room->gas_data.gas_mode == GasMoving) {
|
||||
if (room->gas_data.new_area_meta->i->shrink_speed() > 0.01f) {
|
||||
long long duration = (room->gas_data.old_area_meta->i->rad() - room->gas_data.new_area_meta->i->rad()) /
|
||||
room->gas_data.new_area_meta->i->shrink_speed();
|
||||
gas_data->set_duration(++duration);
|
||||
} else {
|
||||
gas_data->set_duration(0);
|
||||
}
|
||||
} else {
|
||||
if (room->gas_data.old_area_meta->i->wait_time() <= 0) {
|
||||
gas_data->set_duration(0);
|
||||
} else {
|
||||
@ -1624,6 +1632,14 @@ void Human::UpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
void Human::SendUIUpdate()
|
||||
{
|
||||
cs::SMUiUpdate notifymsg;
|
||||
notifymsg.set_alive_count(room->AliveCount());
|
||||
notifymsg.set_kill_count(stats.kills);
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
void Human::ClearFrameData()
|
||||
{
|
||||
if (!new_objects.empty()) {
|
||||
|
@ -172,6 +172,7 @@ class Human : public Entity
|
||||
void SendDebugMsg(const std::string& debug_msg);
|
||||
void SendRollMsg(const std::string& roll_msg);
|
||||
void UpdateAction();
|
||||
void SendUIUpdate();
|
||||
|
||||
private:
|
||||
void ClearFrameData();
|
||||
|
@ -588,6 +588,19 @@ void Room::OnHumanDie(Human* hum)
|
||||
frame_event.AddExplosionEx(hum, 0, hum->pos, 1);
|
||||
}
|
||||
--alive_count_;
|
||||
xtimer.AddDeadLineTimerAndAttach(0,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
room->TouchPlayerList(a8::XParams(),
|
||||
[] (Player * hum, a8::XParams & param)
|
||||
{
|
||||
hum->SendUIUpdate();
|
||||
});
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
|
||||
bool Room::OverBorder(const Vector2D pos, float radius)
|
||||
|
@ -32,4 +32,6 @@ enum SMMessageId_e
|
||||
_SMDisconnectNotify = 1008;
|
||||
_SMGameOver = 1009;
|
||||
_SMDebugMsg = 1010;
|
||||
_SMWxVoip = 1011;
|
||||
_SMUiUpdate = 1012;
|
||||
}
|
||||
|
@ -770,3 +770,19 @@ message SMDebugMsg
|
||||
{
|
||||
optional string debug_msg = 3; //调试信息
|
||||
}
|
||||
|
||||
/*
|
||||
微信实时语音房间
|
||||
客户端需要调用loginserver签名后再加入微信实时语音房间
|
||||
*/
|
||||
message SMWxVoip
|
||||
{
|
||||
optional string group_id = 1; //微信语聊房间id
|
||||
}
|
||||
|
||||
//ui界面更新,一些不需要实时更新的数据
|
||||
message SMUiUpdate
|
||||
{
|
||||
optional int32 alive_count = 1; //存活数量
|
||||
optional int32 kill_count = 2; //击杀数
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user