添加匹配时组队内成员消息
This commit is contained in:
parent
cacbbab1d0
commit
bba1e6ba8e
@ -95,6 +95,22 @@ void MatchMgr::_CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelS
|
||||
}
|
||||
}
|
||||
|
||||
void MatchMgr::_CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg)
|
||||
{
|
||||
auto match_info = GetMatchInfo(hdr.socket_handle);
|
||||
if (match_info) {
|
||||
std::get<1>(*match_info)->_CMMatchSendMsg(hdr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void MatchMgr::_CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg)
|
||||
{
|
||||
auto match_info = GetMatchInfo(hdr.socket_handle);
|
||||
if (match_info) {
|
||||
std::get<1>(*match_info)->_CMMatchBroadcastMsg(hdr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
bool MatchMgr::NeedMatch(const cs::CMJoin& msg)
|
||||
{
|
||||
bool need = !msg.team_uuid().empty() &&
|
||||
|
@ -8,6 +8,8 @@ namespace cs
|
||||
class CMMatchChoose;
|
||||
class CMMatchStartGame;
|
||||
class CMMatchCancelStartGame;
|
||||
class CMMatchSendMsg;
|
||||
class CMMatchBroadcastMsg;
|
||||
}
|
||||
|
||||
class MatchTeam;
|
||||
@ -31,6 +33,8 @@ public:
|
||||
void _CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg);
|
||||
void _CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg);
|
||||
void _CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelStartGame& msg);
|
||||
void _CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg);
|
||||
void _CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg);
|
||||
void TraverseTeam(std::function<void (MatchTeam*, bool&)> func);
|
||||
|
||||
bool NeedMatch(const cs::CMJoin& msg);
|
||||
|
@ -94,10 +94,6 @@ void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
|
||||
void MatchTeam::_CMMatchCancel(f8::MsgHdr& hdr, const cs::CMMatchCancel& msg)
|
||||
{
|
||||
auto member = GetMemberBySocket(hdr.socket_handle);
|
||||
if (member) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
|
||||
@ -158,6 +154,48 @@ void MatchTeam::_CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancel
|
||||
}
|
||||
}
|
||||
|
||||
void MatchTeam::_CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg)
|
||||
{
|
||||
auto sender = GetMemberBySocket(hdr.socket_handle);
|
||||
if (sender) {
|
||||
for (auto member : master_team_->curr_member_hash_) {
|
||||
if (member->socket_handle != 0) {
|
||||
bool found = false;
|
||||
for (auto& target : msg.target_list()) {
|
||||
if (target == member->msg.account_id()) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
cs::SMMatchMemberMsgNotify notifymsg;
|
||||
notifymsg.set_sender(sender->msg.account_id());
|
||||
notifymsg.set_content(msg.content());
|
||||
GGListener::Instance()->SendToClient(member->socket_handle, 0, notifymsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MatchTeam::_CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg)
|
||||
{
|
||||
auto sender = GetMemberBySocket(hdr.socket_handle);
|
||||
if (sender) {
|
||||
for (auto member : master_team_->curr_member_hash_) {
|
||||
if (member->socket_handle != 0) {
|
||||
if (!msg.exclude_self() ||
|
||||
(msg.exclude_self() && sender->msg.account_id() != member->msg.account_id())) {
|
||||
cs::SMMatchMemberMsgNotify notifymsg;
|
||||
notifymsg.set_sender(sender->msg.account_id());
|
||||
notifymsg.set_content(msg.content());
|
||||
GGListener::Instance()->SendToClient(member->socket_handle, 0, notifymsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MatchTeam::AddRawMember(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
{
|
||||
std::shared_ptr<RawTeamMember> member = std::make_shared<RawTeamMember>();
|
||||
|
@ -54,6 +54,8 @@ class MatchTeam
|
||||
void _CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg);
|
||||
void _CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg);
|
||||
void _CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelStartGame& msg);
|
||||
void _CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg);
|
||||
void _CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg);
|
||||
|
||||
void AddRawMember(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
||||
bool IsRawMember(const std::string& account_id);
|
||||
|
@ -25,6 +25,8 @@ enum CMMessageId_e
|
||||
_CMMatchChoose = 219;
|
||||
_CMMatchStartGame = 220;
|
||||
_CMMatchCancelStartGame = 221;
|
||||
_CMMatchSendMsg = 222;
|
||||
_CMMatchBroadcastMsg = 223;
|
||||
}
|
||||
|
||||
enum SMMessageId_e
|
||||
@ -56,4 +58,5 @@ enum SMMessageId_e
|
||||
_SMShowTeamUI = 1016;
|
||||
_SMUpdateMatchInfo = 1017;
|
||||
_SMGetItemNotify = 1018;
|
||||
_SMMatchMemberMsgNotify = 1019;
|
||||
}
|
||||
|
@ -1134,6 +1134,22 @@ message CMMatchCancelStartGame
|
||||
{
|
||||
}
|
||||
|
||||
//组队匹配-指定成员发送消息
|
||||
message CMMatchSendMsg
|
||||
{
|
||||
//成员将收到SMMatchMemberMsgNotify消息
|
||||
repeated string target_list = 1; //目标列表,目标收到SMMatchMemberMsgNotify消息
|
||||
optional string content = 2; //消息内容
|
||||
}
|
||||
|
||||
//组队匹配-队伍内广播消息
|
||||
message CMMatchBroadcastMsg
|
||||
{
|
||||
//成员将收到SMMatchMemberMsgNotify消息
|
||||
optional int32 exclude_self = 1; //include_self!=0时排除自己
|
||||
optional string content = 2; //消息内容
|
||||
}
|
||||
|
||||
//endcmmsg
|
||||
|
||||
//观战error_code == 0 时关闭结算界面,回到战斗界面
|
||||
@ -1337,6 +1353,13 @@ message SMUpdateMatchInfo
|
||||
optional MFMatchInfo info = 1; //匹配信息
|
||||
}
|
||||
|
||||
//匹配-队伍成员消息
|
||||
message SMMatchMemberMsgNotify
|
||||
{
|
||||
optional string sender = 1; //消息发送者
|
||||
optional string content = 2; //消息内容
|
||||
}
|
||||
|
||||
//获得物品
|
||||
message SMGetItemNotify
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user