This commit is contained in:
aozhiwei 2023-12-29 18:00:53 +08:00
parent b2b248b4df
commit 6c0a8624c2
4 changed files with 33 additions and 6 deletions

View File

@ -19,6 +19,15 @@ Position BornPoint::RandPoint(Room* room) const
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, glm::radians((float)(rand() % 360)));
pos.AddGlmVec3(dir * (float)a8::RandEx(10, 100));
#ifdef MYDEBUG
a8::XPrintf("RandPoint wo_meta:%d pos:%d %d %d\n",
{
(long long)((char*)wo_meta.get()),
pos.GetX(),
pos.GetY(),
pos.GetZ()
});
#endif
}
} else {
pos.SetX(5120.000000000000);

View File

@ -2080,6 +2080,9 @@ void Human::PushJoinRoomMsg()
void Human::ReJoin(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
std::shared_ptr<MobaBattle> p)
{
if (!IsPlayer()) {
abort();
}
this->ip_saddr = ip_saddr;
this->socket_handle = socket_handle;
room->frame_event.AddEnterGame(GetWeakPtrRef());
@ -2090,8 +2093,21 @@ void Human::ReJoin(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin>
PushJoinRoomMsg();
RefreshView();
room->NotifyUiUpdate();
PlayerMgr::Instance()->ReBindSocket(AsPlayer());
if (room->IsMobaModeRoom()) {
SendMobaTeamNotify();
room->xtimer.SetIntervalEx
(SERVER_FRAME_RATE,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!room->IsGameOver() && room->GetGasData().GetGasMode() == GasInactive) {
SendMobaTeamNotify();
} else {
room->xtimer.DeleteCurrentTimer();
}
}
},
&xtimer_attacher);
}
}
@ -2436,7 +2452,8 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
return true;
});
};
int side = a8::RandEx(1, 2);
//int side = a8::RandEx(1, 2);
int side = 1;
for (size_t i = 0; i < 2; ++i) {
auto team = room_teams.at(i);
if (team->GetMemberNum() < MAX_TEAM_NUM) {
@ -2450,11 +2467,12 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
hum->born_point->wo_meta = std::get<0>(GetMapMeta()->moba_born_points.at(side - 1));
hum->InitMobaRoad();
#ifdef MYDEBUG
a8::XPrintf("moba init uniid:%d team_id:%d side:%d\n",
a8::XPrintf("moba init uniid:%d team_id:%d side:%d wo_meta:%d\n",
{
hum->GetUniId(),
hum->GetTeam()->GetTeamId(),
hum->side
hum->side,
hum->born_point->wo_meta.get()
});
#endif
return true;

View File

@ -349,7 +349,7 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
acc_inactive_time_ += GetGasInactiveReaminTime() - 2;
}
}
#if 1
#if 0
if (IsMobaModeRoom()) {
//hum->side = a8::RandEx(1, 2);
hum->side = 1;

View File

@ -838,7 +838,7 @@ void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
const mt::Map* map_meta = mt::Map::GetById(msg->mapid());
if (map_meta && map_meta->is_moba()) {
msg->set_room_mode(kMobaMode);
#if 0
#if 1
{
auto data = a8::MutableXObject::CreateObject();
data->SetVal("zone_id", 1);