This commit is contained in:
aozhiwei 2020-06-18 18:34:08 +08:00
commit e27cd603db
2 changed files with 18 additions and 0 deletions

View File

@ -593,6 +593,7 @@ void Player::OnDataVersion1Change()
{
Player* hum = (Player*)param.sender.GetUserData();
hum->InternalUpdateUserInfo();
hum->SyncOtherFriend();
},
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
@ -616,6 +617,7 @@ void Player::OnTempCustomDataChange()
{
Player* hum = (Player*)param.sender.GetUserData();
hum->InternalUpdateUserInfo();
hum->SyncOtherFriend();
},
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
@ -753,3 +755,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

@ -114,6 +114,7 @@ private:
int AddFriend(Friend* friendobj);
void RemoveFriend(const std::string& account_id);
void PushFriendList();
void SyncOtherFriend();
private:
bool dirty_ = false;