This commit is contained in:
aozhiwei 2021-09-29 15:07:40 +08:00
parent 55704cc560
commit c07ee02788
2 changed files with 29 additions and 5 deletions

View File

@ -102,8 +102,23 @@ void MatchTeam::_CMMatchCancel(f8::MsgHdr& hdr, const cs::CMMatchCancel& msg)
void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
{
#ifdef DEBUG
a8::XPrintf("cmmatchchoose %s phase_:%d %s\n", {hdr.socket_handle, phase_, GetTeamUUid()});
{
for (auto& pair : raw_member_hash_) {
a8::XPrintf("cmmatchchoose member %d:%d:%s %s:%d\n",
{
hdr.socket_handle,
phase_,
GetTeamUUid(),
pair.second->msg.account_id(),
pair.second->socket_handle
});
}
}
#endif
auto member = GetMemberBySocket(hdr.socket_handle);
if (member && phase_ == kMatchChoose) {
if (member && master_team_->phase_ == kMatchChoose) {
member->msg.set_hero_id(msg.hero_id());
*member->msg.mutable_weapons() = msg.weapons();
*member->msg.mutable_skins() = msg.skins();
@ -111,25 +126,34 @@ void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
*member->msg.mutable_baseskin() = msg.baseskin();
member->msg.set_hero_skin(msg.hero_skin());
++member->choose_hero_times;
#ifdef DEBUG
a8::XPrintf("matchchoose %s\n", {member->msg.account_id()});
#endif
}
}
void MatchTeam::_CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg)
{
if (phase_ == kMatchChoose) {
if (master_team_->phase_ == kMatchChoose) {
auto member = GetMemberBySocket(hdr.socket_handle);
if (member) {
member->state = kMatchPrepare;
#ifdef DEBUG
a8::XPrintf("matchgamestart %s\n", {member->msg.account_id()});
#endif
}
}
}
void MatchTeam::_CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelStartGame& msg)
{
if (phase_ == kMatchChoose) {
if (master_team_->phase_ == kMatchChoose) {
auto member = GetMemberBySocket(hdr.socket_handle);
if (member) {
member->state = kMatchReadying;
#ifdef DEBUG
a8::XPrintf("matchcancelgamestart %s\n", {member->msg.account_id()});
#endif
}
}
}

View File

@ -348,10 +348,10 @@ public:
MetaMgr::Instance()->match_robot_time = MetaMgr::Instance()->GetSysParamAsInt("match_robot_time", 0);
MetaMgr::Instance()->match_choose_time = MetaMgr::Instance()->GetSysParamAsInt("match_choose_time", 0);
MetaMgr::Instance()->match_lock_time = MetaMgr::Instance()->GetSysParamAsInt("match_lock_time", 0);
#ifdef DEBUG
#ifdef DEBUG1
MetaMgr::Instance()->match_team_time = 10;
MetaMgr::Instance()->match_robot_time = 5;
MetaMgr::Instance()->match_choose_time = 15;
MetaMgr::Instance()->match_choose_time = 25;
MetaMgr::Instance()->match_lock_time = 10;
#endif
{