From 1059c468eb2eaf46af57ef3d2a5f87db9453fa36 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 20 May 2019 20:21:45 +0800 Subject: [PATCH] add SMUiUpdate --- server/gameserver/human.cc | 18 +++++++++++++++++- server/gameserver/human.h | 1 + server/gameserver/room.cc | 13 +++++++++++++ server/tools/protobuild/cs_msgid.proto | 2 ++ server/tools/protobuild/cs_proto.proto | 16 ++++++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 9de4948..b209271 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -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()) { diff --git a/server/gameserver/human.h b/server/gameserver/human.h index f76bb8b..79dfc7a 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -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(); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index b0f4ee0..5cf43f7 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -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) diff --git a/server/tools/protobuild/cs_msgid.proto b/server/tools/protobuild/cs_msgid.proto index 0f45886..44367f4 100644 --- a/server/tools/protobuild/cs_msgid.proto +++ b/server/tools/protobuild/cs_msgid.proto @@ -32,4 +32,6 @@ enum SMMessageId_e _SMDisconnectNotify = 1008; _SMGameOver = 1009; _SMDebugMsg = 1010; + _SMWxVoip = 1011; + _SMUiUpdate = 1012; } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index b3d9702..8e35362 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -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; //击杀数 +}