38 lines
844 B
C++
38 lines
844 B
C++
#pragma once
|
|
|
|
class Room;
|
|
class Hero;
|
|
class Obstacle;
|
|
|
|
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
|
{
|
|
public:
|
|
|
|
BoxDrop(Room* room);
|
|
void Init();
|
|
void UnInit();
|
|
void OnBattleStart();
|
|
void OnHeroDeadDrop(Hero* hero);
|
|
void OnObstacleDeadDrop(Obstacle* ob);
|
|
void RequestReturnBoxNum();
|
|
|
|
private:
|
|
|
|
void Drop(int num, const glm::vec3& center);
|
|
void RequestAllocBoxNum();
|
|
bool FillAccountIdSessionId(std::string account_id, std::string session_id);
|
|
void OnAllocOk(int box_num);
|
|
void OnAllocFail();
|
|
void AllocBoxToRoom();
|
|
int GetAndDecObjBoxNum(int uniid);
|
|
int GetUsedBoxNum();
|
|
|
|
private:
|
|
Room* room_ = nullptr;
|
|
a8::XTimerWp get_box_num_timer_;
|
|
int alloc_box_num_ = 0;
|
|
bool alloced_ = false;
|
|
bool returned_ = false;
|
|
std::map<int, int> drop_hash_;
|
|
};
|