添加聊天全局红点

This commit is contained in:
aozhiwei 2020-12-21 13:21:07 +08:00
parent f08ce2b8e2
commit 0ebc307758
5 changed files with 16 additions and 4 deletions

View File

@ -176,6 +176,10 @@ void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg)
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id);
if (hum) {
hum->SendMsg(notifymsg);
if (hum->chat_channel == kCCTeam) {
a8::SetBitFlag(hum->red_point_flags_, RPF_FriendApply);
hum->SyncRedPoint();
}
}
}
delete p;
@ -269,6 +273,8 @@ void ChatMgr::SyncPrivateChatMsg(Player* hum)
}
} else {
hum->MarkNewMsg();
a8::SetBitFlag(hum->red_point_flags_, RPF_FriendApply);
hum->SyncRedPoint();
}
}
@ -292,6 +298,8 @@ void ChatMgr::SyncGuildChatMsg(Player* hum)
}
} else {
hum->MarkNewMsg();
a8::SetBitFlag(hum->red_point_flags_, RPF_FriendApply);
hum->SyncRedPoint();
}
}
}

View File

@ -55,7 +55,8 @@ enum NetHandler_e
enum ReadPointFlag
{
RPF_FriendApply = 0,
RPF_GuildApply = 1
RPF_GuildApply = 1,
RPF_Chat = 1
};
enum GuildMemberQuitReason

View File

@ -632,6 +632,9 @@ void Player::_CMReadMsgAndOpenChatNotify(f8::MsgHdr& hdr, const cs::CMReadMsgAnd
}
}
}
a8::UnSetBitFlag(red_point_flags_, RPF_Chat);
SyncRedPoint();
}
}

View File

@ -23,6 +23,7 @@ class Player
int channel = 0;
long ip_saddr = 0;
int account_registertime = 0;
int red_point_flags_ = 0;
int chat_channel = -1;
std::string private_target;
@ -167,6 +168,7 @@ class Player
void SaveToDB(a8::XParams param, f8::AsyncDBOnOkFunc on_ok, f8::AsyncDBOnErrorFunc on_error);
void MarkNewMsg();
void SyncRedPoint();
private:
void FillFriendList(::google::protobuf::RepeatedPtrField< ::cs::MFUserInfo >* friend_list);
@ -195,7 +197,6 @@ private:
void OnFriendDeleteEvent(Event& event);
void OnGuildRefuseEvent(Event& event);
bool CanAddFriend(const std::string& account_id);
void SyncRedPoint();
void OnDailyReset();
void RecalcRedPoint();
void ClearApplyByIdx(long long idx);
@ -223,7 +224,6 @@ private:
bool event_fetching_ = false;
long long last_run_tick_ = 0;
std::map<long long, Event> event_hash_;
int red_point_flags_ = 0;
std::set<std::string> exclude_account_ids_;
std::string user_sign_;
int last_create_guild_time_ = 0;

View File

@ -814,7 +814,7 @@ message SMUpdateAccountInfo
//
message SMUpdateRedPointNotify
{
optional int32 red_point_flags = 1; // 1<<0: 1<<1:
optional int32 red_point_flags = 1; // 1<<0: 1<<1: 1<<2
}
//