This commit is contained in:
aozhiwei 2021-09-28 22:49:37 +08:00
parent acd2f08cb0
commit 3f9720f080
4 changed files with 27 additions and 3 deletions

View File

@ -63,11 +63,19 @@ void RawTeamMember::InitRobot()
}
}
MatchTeam::~MatchTeam()
{
timer_attacher.ClearTimerList();
#ifdef DEBUG
a8::XPrintf("~MatchTeam %s\n", {GetTeamUUid()});
#endif
}
void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
{
master_team_ = this;
create_tick_ = a8::XGetTickCount();
a8::Timer::Instance()->AddRepeatTimerAndAttach
timer_ = a8::Timer::Instance()->AddRepeatTimerAndAttach
(1000,
a8::XParams()
.SetSender(this),
@ -76,7 +84,14 @@ void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
MatchTeam* team = (MatchTeam*)param.sender.GetUserData();
team->Update();
},
&timer_attacher.timer_list_);
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
{
#ifdef DEBUG
a8::XPrintf("~MatchTeam.timer\n", {});
#endif
}
);
phase_= kMatchCombining;
phase_start_tick_ = a8::XGetTickCount();
countdown_ = MetaMgr::Instance()->match_team_time;
@ -174,8 +189,10 @@ void MatchTeam::Update()
UpdateSlave();
}
master_team_->SyncMatchInfo();
if (phase_ == kMatchStartGame) {
if (phase_ == kMatchStartGame && IsMasterTeam()) {
StartGame();
a8::Timer::Instance()->DeleteTimer(timer_);
timer_ = nullptr;
}
}

View File

@ -47,6 +47,7 @@ class MatchTeam
{
public:
a8::TimerAttacher timer_attacher;
~MatchTeam();
void Init(f8::MsgHdr& hdr, const cs::CMJoin& msg);
@ -93,6 +94,7 @@ class MatchTeam
std::map<std::string, std::shared_ptr<RawTeamMember>> raw_member_hash_;
std::shared_ptr<RawTeamMember> first_member_;
long long last_auto_choose_tick_ = 0;
timer_list* timer_ = nullptr;
std::map<std::string, MatchTeam*> combined_team_hash_;
MatchTeam* master_team_ = nullptr;

View File

@ -1198,6 +1198,9 @@ void Player::PushJoinRoomMsg()
notifymsg.set_started(false);
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
#ifdef DEBUG
a8::XPrintf("PushJoinRooMmsg %d\n", {GetUniId()});
#endif
}
}

View File

@ -3959,9 +3959,11 @@ void Room::AddTeam(class MatchTeam* team)
Player* hum = NewPlayer();
#if 1
a8::SetBitFlag(hum->status, CS_ForceTeam);
#if 0
member->msg.mutable_baseskin()->Clear();
member->msg.add_baseskin(1);
#endif
#endif
hum->ProcPreSettlementInfo(member->msg.pre_settlement_info());
PlayerMgr::Instance()->
CreatePlayerByCMJoin(hum,