This commit is contained in:
aozhiwei 2024-07-29 17:10:51 +08:00
parent a24e7d1680
commit 534c22990d
4 changed files with 40 additions and 16 deletions

View File

@ -0,0 +1,18 @@
#include "precompile.h"
#include "boxdrop.h"
BoxDrop::BoxDrop(Room* room):room_(room)
{
}
void BoxDrop::Init()
{
}
void BoxDrop::UnInit()
{
}

View File

@ -0,0 +1,15 @@
#pragma once
class Room;
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
{
public:
BoxDrop(Room* room);
void Init();
void UnInit();
private:
Room* room_ = nullptr;
};

View File

@ -52,6 +52,7 @@
#include "httpproxy.h" #include "httpproxy.h"
#include "netdata.h" #include "netdata.h"
#include "stats.h" #include "stats.h"
#include "boxdrop.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Hero.h" #include "mt/Hero.h"
@ -133,6 +134,7 @@ void Room::Init()
incubator_->room = this; incubator_->room = this;
incubator_->Init(); incubator_->Init();
sand_table_ = std::make_shared<SandTable>(this); sand_table_ = std::make_shared<SandTable>(this);
box_drop_ = std::make_shared<BoxDrop>(this);
#ifdef MYDEBUG #ifdef MYDEBUG
InitDebugInfo(); InitDebugInfo();
#endif #endif
@ -226,6 +228,8 @@ void Room::UnInit()
#ifdef MYDEBUG #ifdef MYDEBUG
UnInitDebugInfo(); UnInitDebugInfo();
#endif #endif
box_drop_->UnInit();
box_drop_ = nullptr;
incubator_ = nullptr; incubator_ = nullptr;
timer_attacher.ClearTimerList(); timer_attacher.ClearTimerList();
xtimer_attacher_.ClearTimerList(); xtimer_attacher_.ClearTimerList();
@ -4270,15 +4274,3 @@ void Room::MobaOver()
OnGameOver(); OnGameOver();
} }
} }
int Room::GetMaxBoxNum()
{
return max_box_num_;
}
void Room::SetMaxBoxNum(int box_num)
{
if (box_num > 0) {
max_box_num_ = box_num;
}
}

View File

@ -51,6 +51,7 @@ class CustomMember;
class RoomAgent; class RoomAgent;
class RoomOb; class RoomOb;
class InGameVoice; class InGameVoice;
class BoxDrop;
struct Plane struct Plane
{ {
@ -305,8 +306,7 @@ public:
void CalcMvp(); void CalcMvp();
long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; } long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; }
void MobaOver(); void MobaOver();
int GetMaxBoxNum(); std::shared_ptr<BoxDrop> GetBoxDrop() { return box_drop_; }
void SetMaxBoxNum(int box_num);
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; } std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
@ -474,8 +474,7 @@ private:
RoomAgent* room_agent_; RoomAgent* room_agent_;
std::shared_ptr<InGameVoice> ingame_voice_; std::shared_ptr<InGameVoice> ingame_voice_;
std::shared_ptr<BoxDrop> box_drop_;
int max_box_num_ = 0;
friend class Incubator; friend class Incubator;
friend class Team; friend class Team;