1
This commit is contained in:
parent
9419e2728a
commit
cc0bf35f27
@ -40,6 +40,7 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
||||
return;
|
||||
}
|
||||
std::string team_uuid = team_obj->Get("team_uuid").GetString();
|
||||
int is_view = team_obj->Get("is_view").GetInt();
|
||||
auto member_list = team_obj->At("members");
|
||||
if (!member_list ||
|
||||
!member_list->IsArray()) {
|
||||
@ -50,6 +51,7 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
||||
if (!team) {
|
||||
team = std::make_shared<CustomTeam>();
|
||||
team->team_uuid_ = team_uuid;
|
||||
team->is_view_ = is_view ? true : false;
|
||||
uuid_hash_[team->team_uuid_] = team;
|
||||
}
|
||||
for (int ii = 0; ii < member_list->Size(); ++ii) {
|
||||
|
@ -12,3 +12,8 @@ void CustomMember::Join(Player* hum)
|
||||
joined_ = true;
|
||||
join_time_ = Global::g_nowtime;
|
||||
}
|
||||
|
||||
bool CustomMember::IsView()
|
||||
{
|
||||
return team_->IsView();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class CustomMember
|
||||
CustomTeam* GetTeam() { return team_; }
|
||||
bool IsJoined() { return joined_; }
|
||||
int GetJoinTime() { return join_time_; }
|
||||
bool IsViewer() { return is_viewer_; }
|
||||
bool IsView();
|
||||
const std::string& GetAccountId() { return account_id_; }
|
||||
const std::string& GetSessionId() { return session_id_; }
|
||||
std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
|
||||
@ -20,7 +20,6 @@ class CustomMember
|
||||
CustomTeam *team_ = nullptr;
|
||||
bool joined_ = false;
|
||||
int join_time_ = 0;
|
||||
bool is_viewer_ = false;
|
||||
std::string account_id_;
|
||||
std::string session_id_;
|
||||
std::shared_ptr<BattleDataContext> battle_context_;
|
||||
|
@ -7,9 +7,11 @@ class CustomTeam
|
||||
|
||||
const std::string& GetTeamUuid() { return team_uuid_; }
|
||||
std::shared_ptr<CustomMember> GetMember(const std::string& account_id);
|
||||
bool IsView() { return is_view_; }
|
||||
|
||||
private:
|
||||
std::string team_uuid_;
|
||||
bool is_view_ = false;
|
||||
std::map<std::string, std::shared_ptr<CustomMember>> member_hash_;
|
||||
friend class CustomBattle;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user