1
This commit is contained in:
parent
2ae8fe18cc
commit
4484436629
@ -184,6 +184,18 @@ bool CustomBattle::AllIsJoined()
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CustomBattle::AllIsReady()
|
||||
{
|
||||
bool ok = true;
|
||||
for (auto& pair : member_id_hash_) {
|
||||
if (!pair.second->IsReady()) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
int CustomBattle::GetMemberNum()
|
||||
{
|
||||
return member_id_hash_.size();
|
||||
@ -304,5 +316,8 @@ void CustomBattle::OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr,
|
||||
|
||||
void CustomBattle::OnMemberReady(CustomMember* member)
|
||||
{
|
||||
if (state_ == 0 && AllIsReady()) {
|
||||
state_ = 1;
|
||||
}
|
||||
NotifyState();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class CustomBattle
|
||||
std::shared_ptr<CustomTeam> GetTeamByTeamUuid(const std::string& team_uuid);
|
||||
std::shared_ptr<CustomMember> GetObByAccountId(const std::string& account_id);
|
||||
bool AllIsJoined();
|
||||
bool AllIsReady();
|
||||
int GetMemberNum();
|
||||
int GetTeamNum();
|
||||
void TraverseMemberList(std::function<bool (CustomMember*)> func);
|
||||
|
@ -32,6 +32,7 @@ class CustomMember
|
||||
std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
|
||||
void _CMBattlePreSetReady(f8::MsgHdr* hdr, const cs::CMBattlePreSetReady& msg);
|
||||
bool IsAndroid();
|
||||
bool IsReady() { return is_ready_; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<cs::CMJoin> join_msg_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user