1
This commit is contained in:
parent
62d2b8246b
commit
7aedde8bde
@ -1495,58 +1495,6 @@ void Human::SendDebugMsg(const std::string& debug_msg)
|
||||
SendNotifyMsg(notify_msg);
|
||||
}
|
||||
|
||||
void Human::SendRollMsg(const std::string& msg, int killer_id, bool killer_team_id, int weapon_id)
|
||||
{
|
||||
KillInfo* info = new KillInfo;
|
||||
info->killer_id = killer_id;
|
||||
info->killer_team_id = killer_team_id;
|
||||
info->weapon_id = weapon_id;
|
||||
info->msg = msg;
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
0,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(info),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* target = (Human*)param.sender.GetUserData();
|
||||
KillInfo* info = (KillInfo*)param.param1.GetUserData();
|
||||
target->room->TraversePlayerList
|
||||
(a8::XParams(),
|
||||
[target, info] (Human* hum, a8::XParams& param) -> bool
|
||||
{
|
||||
cs::SMRollMsg msg;
|
||||
auto element = msg.add_elements();
|
||||
element->set_element_type(1);
|
||||
element->mutable_union_obj_1()->set_text(info->msg);
|
||||
if (info->killer_id == hum->GetUniId()){
|
||||
element->mutable_union_obj_1()->set_color(MetaMgr::Instance()->self_kill_color);
|
||||
} else if (info->killer_team_id == hum->team_id) {
|
||||
element->mutable_union_obj_1()->set_color(MetaMgr::Instance()->teammate_kill_color);
|
||||
} else if (target == hum) {
|
||||
element->mutable_union_obj_1()->set_color(MetaMgr::Instance()->self_bekill_color);
|
||||
} else if (target->team_id == hum->team_id) {
|
||||
element->mutable_union_obj_1()->set_color(MetaMgr::Instance()->teammate_bekill_color);
|
||||
}
|
||||
if (info->weapon_id != 0) {
|
||||
auto img_element = msg.add_elements();
|
||||
img_element->set_element_type(2);
|
||||
img_element->mutable_union_obj_2()->set_id(info->weapon_id);
|
||||
}
|
||||
hum->SendNotifyMsg(msg);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
KillInfo* info = (KillInfo*)param.param1.GetUserData();
|
||||
delete info;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Human::UpdateAction()
|
||||
{
|
||||
int passed_time = (room->GetFrameNo() - action_frameno) * FRAME_RATE_MS;
|
||||
|
@ -192,7 +192,6 @@ class Human : public Creature
|
||||
void SendGameOver();
|
||||
void FollowTarget(Human* target);
|
||||
virtual void SendDebugMsg(const std::string& debug_msg) override;
|
||||
void SendRollMsg(const std::string& msg, int killer_id, bool killer_team_id, int weapon_id = 0);
|
||||
void SendRollMsgEx(KillInfo& info,
|
||||
const char* fmt,
|
||||
std::initializer_list<a8::XValue> args
|
||||
|
Loading…
x
Reference in New Issue
Block a user