This commit is contained in:
aozhiwei 2020-06-18 18:34:19 +08:00
parent abf27b8923
commit 1f4ff08d57
2 changed files with 18 additions and 0 deletions

View File

@ -691,6 +691,7 @@ void Player::OnDataVersion1Change()
{
Player* hum = (Player*)param.sender.GetUserData();
hum->InternalUpdateUserInfo();
hum->SyncOtherFriend();
},
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
@ -714,6 +715,7 @@ void Player::OnTempCustomDataChange()
{
Player* hum = (Player*)param.sender.GetUserData();
hum->InternalUpdateUserInfo();
hum->SyncOtherFriend();
},
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
@ -846,3 +848,18 @@ void Player::PushFriendList()
FillFriendList(respmsg.mutable_friend_list());
SendMsg(respmsg);
}
void Player::SyncOtherFriend()
{
cs::SMUserInfoUpdate msg;
auto p = msg.add_user_infos();
TypeConvert::Convert(myself.base_data, *p->mutable_base_data());
TypeConvert::Convert(myself.temp_custom_data, *p->mutable_temp_custom_data());
for (auto& pair : friend_hash_) {
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(pair.second->base_data.account_id);
if (hum) {
hum->SendMsg(msg);
}
}
}

View File

@ -115,6 +115,7 @@ private:
int msgid,
::google::protobuf::Message& msg);
void InternalUpdateUserInfo();
void SyncOtherFriend();
private:
bool dirty_ = false;