1
This commit is contained in:
parent
84e22471d2
commit
a2de56c187
@ -2213,73 +2213,8 @@ void Room::OnGameOver()
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
Player* player = nullptr;
|
||||
TraversePlayerList
|
||||
(
|
||||
[&player] (Player* hum) -> bool
|
||||
{
|
||||
player = hum;
|
||||
return true;
|
||||
});
|
||||
if (!player) {
|
||||
return;
|
||||
}
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
if (url.find('?') != std::string::npos) {
|
||||
url += "c=Battle&a=roomReport";
|
||||
} else {
|
||||
url += "?c=Battle&a=roomReport";
|
||||
}
|
||||
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
|
||||
std::shared_ptr<a8::MutableXObject> post_data = a8::MutableXObject::CreateObject();
|
||||
params->SetVal("account_id", player->account_id);
|
||||
params->SetVal("session_id", player->session_id);
|
||||
params->SetVal("__POST", post_data->ToJsonStr());
|
||||
GenBattleRoomReportData(post_data.get());
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[room_uuid = GetRoomUuid()]
|
||||
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||
{
|
||||
auto room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
|
||||
if (room) {
|
||||
}
|
||||
},
|
||||
url.c_str(),
|
||||
*params.get()
|
||||
);
|
||||
TryRoomReport(0);
|
||||
}
|
||||
int param1 = 1;
|
||||
xtimer.SetIntervalEx
|
||||
(
|
||||
SERVER_FRAME_RATE * 6,
|
||||
[this, param1] (int event, const a8::Args* args) mutable
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (GetOnlinePlayerNum() <= 0 && !added_to_over_room) {
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid_);
|
||||
xtimer.DeleteCurrentTimer();
|
||||
return;
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
if (param1 > 10) {
|
||||
#else
|
||||
if (param1 > 5) {
|
||||
#endif
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid_);
|
||||
}
|
||||
TraverseHumanList
|
||||
(
|
||||
[] (Human* ele_hum) -> bool
|
||||
{
|
||||
ele_hum->SendGameOver();
|
||||
return true;
|
||||
});
|
||||
++param1;
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_);
|
||||
}
|
||||
|
||||
void Room::RandRemoveAndroid()
|
||||
@ -3943,3 +3878,86 @@ void Room::GenBattleRoomReportData(a8::MutableXObject* params)
|
||||
);
|
||||
params->SetVal("team_list", *teams_pb);
|
||||
}
|
||||
|
||||
void Room::StartOverTimer()
|
||||
{
|
||||
int param1 = 1;
|
||||
xtimer.SetIntervalEx
|
||||
(
|
||||
SERVER_FRAME_RATE * 6,
|
||||
[this, param1] (int event, const a8::Args* args) mutable
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (GetOnlinePlayerNum() <= 0 && !added_to_over_room) {
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid_);
|
||||
xtimer.DeleteCurrentTimer();
|
||||
return;
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
if (param1 > 10) {
|
||||
#else
|
||||
if (param1 > 5) {
|
||||
#endif
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid_);
|
||||
}
|
||||
TraverseHumanList
|
||||
(
|
||||
[] (Human* ele_hum) -> bool
|
||||
{
|
||||
ele_hum->SendGameOver();
|
||||
return true;
|
||||
});
|
||||
++param1;
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_);
|
||||
}
|
||||
|
||||
void Room::TryRoomReport(int try_count)
|
||||
{
|
||||
if (sending_room_report_battle_) {
|
||||
return;
|
||||
}
|
||||
if (already_room_report_battle_) {
|
||||
return;;
|
||||
}
|
||||
sending_room_report_battle_ = true;
|
||||
Player* player = nullptr;
|
||||
TraversePlayerList
|
||||
(
|
||||
[&player] (Player* hum) -> bool
|
||||
{
|
||||
player = hum;
|
||||
return true;
|
||||
});
|
||||
if (!player) {
|
||||
return;
|
||||
}
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
if (url.find('?') != std::string::npos) {
|
||||
url += "c=Battle&a=roomReport";
|
||||
} else {
|
||||
url += "?c=Battle&a=roomReport";
|
||||
}
|
||||
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
|
||||
std::shared_ptr<a8::MutableXObject> post_data = a8::MutableXObject::CreateObject();
|
||||
params->SetVal("account_id", player->account_id);
|
||||
params->SetVal("session_id", player->session_id);
|
||||
params->SetVal("__POST", post_data->ToJsonStr());
|
||||
GenBattleRoomReportData(post_data.get());
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[room_uuid = GetRoomUuid()]
|
||||
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||
{
|
||||
auto room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
|
||||
if (room) {
|
||||
room->already_room_report_battle_ = true;
|
||||
room->sending_room_report_battle_ = false;
|
||||
}
|
||||
},
|
||||
url.c_str(),
|
||||
*params.get()
|
||||
);
|
||||
}
|
||||
|
@ -305,6 +305,7 @@ public:
|
||||
void OnTeamPartChg(Human* hum);
|
||||
bool IsAlreadyRoomReportBattle() { return already_room_report_battle_; }
|
||||
int GetReportMapMode();
|
||||
void StartOverTimer();
|
||||
|
||||
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
|
||||
|
||||
@ -375,6 +376,7 @@ private:
|
||||
void IncAliveCount();
|
||||
void DecAliveCount();
|
||||
void GenBattleRoomReportData(a8::MutableXObject* params);
|
||||
void TryRoomReport(int try_count);
|
||||
|
||||
private:
|
||||
bool destorying_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user