This commit is contained in:
aozhiwei 2022-11-17 12:09:33 +08:00
parent 2e5c79e1e8
commit 9e82d0dbcd
7 changed files with 40 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "app.h"
#include "room.h"
#include "explosion.h"
#include "roommgr.h"
#include "attrhelper.h"
@ -329,6 +330,11 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
payload = obj.Get("payload").GetString();
errcode = obj.Get("errcode");
errmsg = obj.Get("errmsg").GetString();
if (errcode == 0) {
revive_coin_ = obj.Get("revive_coin");
int match_mode = obj.Get("match_mode");
RoomMgr::Instance()->SetMatchMode(match_mode ? 1 : 0);
}
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
hero_dto = obj.At("hero_dto");
hero_ability_->hero_uniid_ = hero_dto->Get("hero_uniid", "");
@ -755,3 +761,13 @@ float BattleDataContext::GetExtRecoverHp()
{
return 0;
}
void BattleDataContext::SetReviveCoin(int num)
{
revive_coin_ = num;
}
int BattleDataContext::GetReviveCoin()
{
return revive_coin_;
}

View File

@ -71,6 +71,9 @@ struct BattleDataContext
float GetHeroTotalAtk();
float GetExtRecoverHp();
void SetReviveCoin(int num);
int GetReviveCoin();
private:
void Clear();
float GetTotalAtk(IBullet* bullet);
@ -85,6 +88,7 @@ private:
private:
CreatureWeakPtr owner_;
int revive_coin_ = 0;
std::shared_ptr<HeroAbility> hero_ability_;
std::shared_ptr<WeaponAbility> weapon1_ability_;

View File

@ -300,6 +300,7 @@ enum PropertyType_e
kPropBeHook = 34,
kPropSkillMinor = 35,
kPropReviveCion = 36,
};
enum MapObjectType_e

View File

@ -96,6 +96,14 @@ void Player::Initialize()
#endif
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
}
{
room->frame_event.AddPropChg
(GetWeakPtrRef(),
kPropReviveCion,
0,
GetBattleContext()->GetReviveCoin(),
true);
}
}
void Player::Update(int delta_time)

View File

@ -849,3 +849,8 @@ void RoomMgr::SendGetBattleData(int mode,
);
}
}
void RoomMgr::SetMatchMode(int mode)
{
match_mode_ = mode;
}

View File

@ -80,6 +80,8 @@ class RoomMgr : public a8::Singleton<RoomMgr>
std::vector<std::shared_ptr<cs::CMJoin>>& join_msgs,
std::function<
void(std::vector<std::shared_ptr<BattleDataContext>>&)> cb);
int GetMatchMode() { return match_mode_; };
void SetMatchMode(int mode);
private:
void InstallReportStateTimer();
@ -110,6 +112,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
private:
int current_room_idx_ = 0;
int match_mode_ = 0;
std::map<long long, Room*> inactive_room_hash_;
std::map<long long, Room*> room_hash_;

View File

@ -166,6 +166,9 @@ message MFVec2
valule: cd时间()
value2: cd时间()
value3: id
property_type: 36
property_subtype:
valule:
*/
message MFPropertyChg
{