1
This commit is contained in:
parent
8b477e257d
commit
b260277248
@ -2,6 +2,11 @@
|
||||
|
||||
#include "mobabattle.h"
|
||||
|
||||
void MobaTeam::TraverseMember(std::function<bool (std::shared_ptr<MobaMember>)> cb)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MobaBattle::CanAdd(const std::string& account_id, const std::string& session_id)
|
||||
{
|
||||
return true;
|
||||
|
@ -3,6 +3,15 @@
|
||||
class Room;
|
||||
class MobaTeam;
|
||||
class MobaMember;
|
||||
|
||||
class MobaTeam
|
||||
{
|
||||
public:
|
||||
|
||||
void TraverseMember(std::function<bool (std::shared_ptr<MobaMember>)> cb);
|
||||
|
||||
};
|
||||
|
||||
class MobaBattle
|
||||
{
|
||||
public:
|
||||
|
@ -2256,49 +2256,52 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
|
||||
moba_teams.size() > 2) {
|
||||
abort();
|
||||
}
|
||||
p->TraverseMemberList
|
||||
(
|
||||
[p, msg, ip_saddr, socket_handle] (MobaMember* m) -> bool
|
||||
{
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
hum->room = p->GetRoom();
|
||||
hum->proto_version = msg->proto_version();
|
||||
#if 0
|
||||
hum->hero_uniid = a8::XValue(msg.hero_uniid());
|
||||
#endif
|
||||
//hum->battle_uuid = member->GetNetData()->battle_uuid;
|
||||
//hum->is_valid_battle = member->GetNetData()->is_valid_battle;
|
||||
//hum->payload = member->GetNetData()->payload;
|
||||
//msg.set_session_id(member->GetSessionId());
|
||||
//msg.set_team_uuid(team->GetTeamUuid());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
ip_saddr,
|
||||
socket_handle,
|
||||
*msg
|
||||
);
|
||||
hum->meta = mt::Hero::GetById(msg->hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = mt::Param::s().human_meta;
|
||||
}
|
||||
//hum->SetBattleContext(member->GetNetData());
|
||||
hum->GetBattleContext()->Init(hum);
|
||||
for (size_t i = 0; i < moba_teams.size(); ++i) {
|
||||
auto team = moba_teams.at(i);
|
||||
team->TraverseMember
|
||||
(
|
||||
[ip_saddr, socket_handle, msg, p] (std::shared_ptr<MobaMember> m) -> bool
|
||||
{
|
||||
long long hero_uniid = 0;
|
||||
int hero_lv = 1;
|
||||
int quality = 1;
|
||||
hum->GetBattleContext()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||
hum->hero_uniid = hero_uniid;
|
||||
}
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
|
||||
hum->SetMaxHP(hum->GetHP());
|
||||
//member->Join(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg->account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(*msg, hum);
|
||||
return true;
|
||||
});
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
hum->room = p->GetRoom();
|
||||
hum->proto_version = msg->proto_version();
|
||||
#if 0
|
||||
hum->hero_uniid = a8::XValue(msg.hero_uniid());
|
||||
#endif
|
||||
//hum->battle_uuid = member->GetNetData()->battle_uuid;
|
||||
//hum->is_valid_battle = member->GetNetData()->is_valid_battle;
|
||||
//hum->payload = member->GetNetData()->payload;
|
||||
//msg.set_session_id(member->GetSessionId());
|
||||
//msg.set_team_uuid(team->GetTeamUuid());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
ip_saddr,
|
||||
socket_handle,
|
||||
*msg
|
||||
);
|
||||
hum->meta = mt::Hero::GetById(msg->hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = mt::Param::s().human_meta;
|
||||
}
|
||||
//hum->SetBattleContext(member->GetNetData());
|
||||
hum->GetBattleContext()->Init(hum);
|
||||
{
|
||||
long long hero_uniid = 0;
|
||||
int hero_lv = 1;
|
||||
int quality = 1;
|
||||
hum->GetBattleContext()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||
hum->hero_uniid = hero_uniid;
|
||||
}
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
|
||||
hum->SetMaxHP(hum->GetHP());
|
||||
//member->Join(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg->account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(*msg, hum);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user