1
This commit is contained in:
parent
dae1f4bbaf
commit
118d4a6c14
@ -14,6 +14,10 @@ class CustomMember
|
||||
bool IsView();
|
||||
const std::string& GetAccountId() { return account_id_; }
|
||||
const std::string& GetSessionId() { return session_id_; }
|
||||
const std::string& GetName() { return name_; }
|
||||
const std::string& GetAvatarUrl() { return avatar_url_; }
|
||||
int GetHeadFrame() { return head_frame_; }
|
||||
int GetSex() { return sex_; }
|
||||
std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
|
||||
|
||||
private:
|
||||
@ -22,6 +26,10 @@ class CustomMember
|
||||
int join_time_ = 0;
|
||||
std::string account_id_;
|
||||
std::string session_id_;
|
||||
std::string name_;
|
||||
std::string avatar_url_;
|
||||
int head_frame_ = 0;
|
||||
int sex_ = 0;
|
||||
std::shared_ptr<BattleDataContext> battle_context_;
|
||||
friend class CustomBattle;
|
||||
};
|
||||
|
@ -2726,6 +2726,62 @@ int Room::InitWithCustomBattle(long ip_saddr, int socket_handle, std::shared_ptr
|
||||
(
|
||||
[join_msg, p, net_team] (std::shared_ptr<CustomMember> m) mutable -> bool
|
||||
{
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
//hum->ip_saddr = ip_saddr;
|
||||
//hum->socket_handle = socket_handle;
|
||||
hum->name = m->GetName();
|
||||
hum->room = p->GetRoom();
|
||||
hum->proto_version = join_msg.proto_version();
|
||||
#if 0
|
||||
hum->hero_uniid = a8::XValue(join_msg->hero_uniid());
|
||||
#endif
|
||||
hum->battle_uuid = m->GetNetData()->battle_uuid;
|
||||
hum->is_valid_battle = m->GetNetData()->is_valid_battle;
|
||||
hum->payload = m->GetNetData()->payload;
|
||||
#if 1
|
||||
join_msg.set_account_id(m->GetAccountId());
|
||||
join_msg.set_session_id(m->GetSessionId());
|
||||
join_msg.set_team_uuid(m->GetTeam()->GetTeamUuid());
|
||||
join_msg.set_name(m->GetName());
|
||||
join_msg.set_avatar_url(m->GetAvatarUrl());
|
||||
join_msg.set_head_frame(m->GetHeadFrame());
|
||||
join_msg.set_sex(m->GetSex());
|
||||
join_msg.set_hero_id(m->GetNetData()->GetHeroId());
|
||||
#endif
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
0,
|
||||
0,
|
||||
join_msg
|
||||
);
|
||||
hum->meta = mt::Hero::GetById(join_msg.hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = mt::Param::s().human_meta;
|
||||
}
|
||||
hum->SetNetData(m->GetNetData());
|
||||
hum->GetNetData()->Init(hum);
|
||||
{
|
||||
long long hero_uniid = 0;
|
||||
int hero_lv = 1;
|
||||
int quality = 1;
|
||||
hum->GetNetData()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||
hum->hero_uniid = hero_uniid;
|
||||
}
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetNetData()->GetMaxHP());
|
||||
hum->SetMaxHP(hum->GetHP());
|
||||
PlayerMgr::Instance()->IncAccountNum(join_msg.account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(join_msg, hum);
|
||||
//_team->AddMember(hum);
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("moba init1 uniid:%d team_id:%d side:%d\n",
|
||||
{
|
||||
hum->GetUniId(),
|
||||
hum->GetTeam()->GetTeamId(),
|
||||
hum->side
|
||||
});
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user