This commit is contained in:
aozhiwei 2024-03-25 20:45:49 +08:00
parent e8f4e92eac
commit 2dd720af02
4 changed files with 12 additions and 1 deletions

View File

@ -67,6 +67,7 @@ void CustomBattle::ParseResult(a8::XObject& obj)
auto team = GetTeamByTeamUuid(team_uuid);
if (!team) {
team = std::make_shared<CustomTeam>();
team->custom_battle_ = this;
team->team_uuid_ = team_uuid;
team->is_view_ = false;
uuid_hash_[team->team_uuid_] = team;

View File

@ -22,5 +22,10 @@ bool CustomMember::IsView()
void CustomMember::_CMBattlePreSetReady(f8::MsgHdr* hdr, const cs::CMBattlePreSetReady& msg)
{
is_ready_ = true;
}
bool CustomMember::IsAndroid()
{
return false;
}

View File

@ -31,6 +31,7 @@ class CustomMember
int GetSex() { return sex_; }
std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
void _CMBattlePreSetReady(f8::MsgHdr* hdr, const cs::CMBattlePreSetReady& msg);
bool IsAndroid();
private:
std::shared_ptr<cs::CMJoin> join_msg_;
@ -45,6 +46,7 @@ private:
std::string avatar_url_;
int head_frame_ = 0;
int sex_ = 0;
int is_ready_ = 0;
std::shared_ptr<BattleDataContext> battle_context_;
friend class CustomBattle;
};

View File

@ -1,6 +1,7 @@
#pragma once
class CustomMember;
class CustomBattle;
class CustomTeam
{
public:
@ -11,8 +12,10 @@ class CustomTeam
void TraverseMember(std::function<bool (std::shared_ptr<CustomMember>)> cb);
int GetMemberNum();
int GetAverageHeroLv();
CustomBattle* GetCustomBattle() { return custom_battle_; }
private:
CustomBattle* custom_battle_ = nullptr;
std::string team_uuid_;
bool is_view_ = false;
std::map<std::string, std::shared_ptr<CustomMember>> member_hash_;