This commit is contained in:
aozhiwei 2023-12-28 16:03:23 +08:00
parent 26e94374a3
commit 3e7b9608f0
6 changed files with 53 additions and 50 deletions

View File

@ -270,6 +270,7 @@ class Human : public Creature
void LootInteraction(Loot* entity);
void ObstacleInteraction(Obstacle* entity);
void SendMobaTeamNotify();
void PushJoinRoomMsg();
void ReJoin(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
std::shared_ptr<MobaBattle> p);

View File

@ -1997,11 +1997,61 @@ void Human::SendMobaTeamNotify()
SendNotifyMsg(notify_msg);
}
void Human::PushJoinRoomMsg()
{
if (!a8::HasBitFlag(status, CS_ForceTeam)) {
cs::SMJoinedNotify notifymsg;
notifymsg.set_error_code(0);
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
room->FillSMJoinedNotify(this, notifymsg);
#ifdef MYDEBUG
//notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#else
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#endif
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
}
{
cs::SMMapInfo notifymsg;
notifymsg.set_map_id(room->GetMapMeta()->map_id());
#ifdef MYDEBUG
#else
if (proto_version < cs::ProtoVersion) {
#if 0
notifymsg.set_map_id(1001);
#endif
}
#endif
notifymsg.set_map_width(room->GetMapMeta()->map_width());
notifymsg.set_map_height(room->GetMapMeta()->map_height());
notifymsg.set_room_mode((int)room->GetRoomMode());
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
notifymsg.set_player_id(GetUniId());
notifymsg.set_started(false);
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
notifymsg.set_match_mode(GetBattleContext()->GetMatchMode());
notifymsg.set_pve_instance_id(room->pve_instance ? room->pve_instance->gemini_id() : 0);
notifymsg.set_mapid(room->GetMapMeta()->map_id());
if (room->IsMobaModeRoom()){
notifymsg.set_side(side);
} else {
notifymsg.set_side(0);
}
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
#ifdef MYDEBUG
a8::XPrintf("PushJoinRooMmsg %d side:%d\n", {GetUniId(), side});
#endif
}
}
void Human::ReJoin(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
std::shared_ptr<MobaBattle> p)
{
this->ip_saddr = ip_saddr;
this->socket_handle = socket_handle;
PushJoinRoomMsg();
RefreshView();
room->NotifyUiUpdate();
}
void GGListener::SendError(int sockhandle, unsigned int seqid,

View File

@ -1449,53 +1449,6 @@ void Player::_CMTeamMarkTargetPos(f8::MsgHdr* hdr, const cs::CMTeamMarkTargetPos
NotifyTeamMarkTargetPos();
}
void Player::PushJoinRoomMsg()
{
if (!a8::HasBitFlag(status, CS_ForceTeam)) {
cs::SMJoinedNotify notifymsg;
notifymsg.set_error_code(0);
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
room->FillSMJoinedNotify(this, notifymsg);
#ifdef MYDEBUG
//notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#else
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#endif
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
}
{
cs::SMMapInfo notifymsg;
notifymsg.set_map_id(room->GetMapMeta()->map_id());
#ifdef MYDEBUG
#else
if (proto_version < cs::ProtoVersion) {
#if 0
notifymsg.set_map_id(1001);
#endif
}
#endif
notifymsg.set_map_width(room->GetMapMeta()->map_width());
notifymsg.set_map_height(room->GetMapMeta()->map_height());
notifymsg.set_room_mode((int)room->GetRoomMode());
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
notifymsg.set_player_id(GetUniId());
notifymsg.set_started(false);
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
notifymsg.set_match_mode(GetBattleContext()->GetMatchMode());
notifymsg.set_pve_instance_id(room->pve_instance ? room->pve_instance->gemini_id() : 0);
notifymsg.set_mapid(room->GetMapMeta()->map_id());
if (room->IsMobaModeRoom()){
notifymsg.set_side(side);
} else {
notifymsg.set_side(0);
}
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
#ifdef MYDEBUG
a8::XPrintf("PushJoinRooMmsg %d side:%d\n", {GetUniId(), side});
#endif
}
}
void Player::ProcPreSettlementInfo(const std::string& pre_settlement_info)
{
std::vector<std::string> tmp_strings;

View File

@ -123,7 +123,6 @@ class Player : public Human
void HumanInteraction(Human* hum);
void ProcPreSettlementInfo(const std::string& pre_settlement_info);
void ProcSkillList();
void PushJoinRoomMsg();
void _CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg);
void _CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg);

View File

@ -523,7 +523,7 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr<Team> team)
NotifyUiUpdate();
}
void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
void Room::FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg)
{
msg.set_team_mode(msg.team_mode());
msg.set_adjust_bullet(1);

View File

@ -149,7 +149,7 @@ public:
void RemoveObjectLater(RoomEntity* entity);
void RemoveObjectLater(RoomObstacle* entity);
void FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg);
void FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg);
void TraversePlayerList(std::function<void (Player*)> func);
void TraverseHumanList(std::function<bool (Human*)> func);