空袭ok
This commit is contained in:
parent
311a184e98
commit
93edcf786d
@ -18,6 +18,14 @@ void FrameEvent::AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos)
|
||||
TypeConvert::ToPb(box_pos, airdrop->mutable_pos());
|
||||
}
|
||||
|
||||
void FrameEvent::AddAirRaid(int appear_time, const a8::Vec2& raid_pos, float raid_rad)
|
||||
{
|
||||
cs::MFAirRaid* airraid = airraids_.Add();
|
||||
airraid->set_appear_time(appear_time);
|
||||
airraid->set_rad(raid_rad);
|
||||
TypeConvert::ToPb(raid_pos, airraid->mutable_pos());
|
||||
}
|
||||
|
||||
void FrameEvent::AddEmote(CreatureWeakPtr& sender, int emote_id)
|
||||
{
|
||||
{
|
||||
@ -381,6 +389,9 @@ void FrameEvent::Clear()
|
||||
if (airdrops_.size() > 0) {
|
||||
airdrops_.Clear();
|
||||
}
|
||||
if (airraids_.size() > 0) {
|
||||
airraids_.Clear();
|
||||
}
|
||||
if (!chged_bullet_nums_.empty()) {
|
||||
chged_bullet_nums_.clear();
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ struct FrameEvent
|
||||
{
|
||||
public:
|
||||
void AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos);
|
||||
void AddAirRaid(int appear_time, const a8::Vec2& raid_pos, float raid_rad);
|
||||
void AddEmote(CreatureWeakPtr& sender, int emote_id);
|
||||
void AddShot(CreatureWeakPtr& sender);
|
||||
void AddBullet(CreatureWeakPtr& sender,
|
||||
@ -40,6 +41,7 @@ public:
|
||||
void Clear();
|
||||
private:
|
||||
::google::protobuf::RepeatedPtrField<::cs::MFAirDrop> airdrops_;
|
||||
::google::protobuf::RepeatedPtrField<::cs::MFAirRaid> airraids_;
|
||||
std::vector<std::tuple<CreatureWeakPtr, ::cs::MFShot>> shots_;
|
||||
std::vector<std::tuple<CreatureWeakPtr, ::cs::MFBullet>> bullets_;
|
||||
std::vector<std::tuple<CreatureWeakPtr, ::cs::MFExplosion>> explosions_;
|
||||
|
@ -38,6 +38,13 @@ namespace MetaData
|
||||
airdrops.push_back(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->airraids(), strings, '|');
|
||||
for (auto& str : strings) {
|
||||
airraids.push_back(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->game_start_buff_list(), strings, ':');
|
||||
@ -609,6 +616,11 @@ namespace MetaData
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AirRaid::Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AirLine::Init()
|
||||
{
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ namespace MetaData
|
||||
std::vector<std::tuple<std::string, int>> template_list;
|
||||
int rand_space = 0;
|
||||
std::vector<int> airdrops;
|
||||
std::vector<int> airraids;
|
||||
int refresh_robot_min_num = 0;
|
||||
int refresh_robot_max_num = 0;
|
||||
int refresh_robot_min_time = 0;
|
||||
@ -161,6 +162,13 @@ namespace MetaData
|
||||
const metatable::AirDrop* i = nullptr;
|
||||
};
|
||||
|
||||
struct AirRaid
|
||||
{
|
||||
const metatable::AirRaid* i = nullptr;
|
||||
|
||||
void Init();
|
||||
};
|
||||
|
||||
struct AirLine
|
||||
{
|
||||
const metatable::AirLine* i = nullptr;
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
std::list<MetaData::Drop> drop_list;
|
||||
std::list<metatable::AirDrop> airdrop_meta_list;
|
||||
std::list<MetaData::AirDrop> airdrop_list;
|
||||
std::list<metatable::AirRaid> airraid_meta_list;
|
||||
std::list<MetaData::AirRaid> airraid_list;
|
||||
std::list<metatable::AirLine> airline_meta_list;
|
||||
std::list<MetaData::AirLine> airline_list;
|
||||
std::list<metatable::Dress> dress_meta_list;
|
||||
@ -71,6 +73,7 @@ public:
|
||||
std::map<std::string, MetaData::Parameter*> parameter_hash;
|
||||
std::map<int, MetaData::Map*> gamemap_hash;
|
||||
std::map<int, MetaData::AirDrop*> airdrop_hash;
|
||||
std::map<int, MetaData::AirRaid*> airraid_hash;
|
||||
std::map<int, MetaData::SafeArea*> safearea_hash;
|
||||
std::map<int, MetaData::Item*> item_hash;
|
||||
std::map<int, MetaData::Equip*> equip_hash;
|
||||
@ -129,6 +132,7 @@ public:
|
||||
f8::ReadCsvMetaFile(res_path + "mapThing@mapThing.csv", mapthing_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "drop@drop.csv", drop_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "airdrop@airdrop.csv", airdrop_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "airraid@airraid.csv", airraid_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "airline@airline.csv", airline_meta_list);
|
||||
f8::ReadJsonMetaFile(res_path + "maps.json", building_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "dress@dress.csv", dress_meta_list);
|
||||
@ -570,6 +574,13 @@ private:
|
||||
airdrop_hash[meta.id()] = &item;
|
||||
}
|
||||
|
||||
for (auto& meta : airraid_meta_list) {
|
||||
MetaData::AirRaid& item = a8::FastAppend(airraid_list);
|
||||
item.i = &meta;
|
||||
item.Init();
|
||||
airraid_hash[meta.id()] = &item;
|
||||
}
|
||||
|
||||
for (auto& meta : airline_meta_list) {
|
||||
MetaData::AirLine& item = a8::FastAppend(airline_list);
|
||||
item.i = &meta;
|
||||
@ -801,6 +812,17 @@ MetaData::AirDrop* MetaMgr::GetAirDrop(int airdrop_id)
|
||||
return itr != loader_->airdrop_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
std::list<MetaData::AirRaid>& MetaMgr::GetAirRaids()
|
||||
{
|
||||
return loader_->airraid_list;
|
||||
}
|
||||
|
||||
MetaData::AirRaid* MetaMgr::GetAirRaid(int airraid_id)
|
||||
{
|
||||
auto itr = loader_->airraid_hash.find(airraid_id);
|
||||
return itr != loader_->airraid_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
MetaData::AirLine* MetaMgr::RandAirLine(int map_id)
|
||||
{
|
||||
auto itr = loader_->airline_hash.find(map_id);
|
||||
|
@ -36,6 +36,8 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
std::list<metatable::MapLayerJson>* GetMapLayer(const std::string& map_name);
|
||||
std::list<MetaData::AirDrop>& GetAirDrops();
|
||||
MetaData::AirDrop* GetAirDrop(int airdrop_id);
|
||||
std::list<MetaData::AirRaid>& GetAirRaids();
|
||||
MetaData::AirRaid* GetAirRaid(int airraid_id);
|
||||
MetaData::AirLine* RandAirLine(int map_id);
|
||||
MetaData::Skill* GetSkill(int skill_id);
|
||||
MetaData::Buff* GetBuff(int buff_id);
|
||||
|
@ -1275,7 +1275,6 @@ void Room::UpdateGasInactive()
|
||||
CombineTeam();
|
||||
ShuaPlane();
|
||||
NotifyWxVoip();
|
||||
InitAirDrop();
|
||||
InitAndroidAI();
|
||||
RoomMgr::Instance()->ActiveRoom(GetRoomUuid());
|
||||
int auto_jump_interval = MetaMgr::Instance()->GetSysParamAsInt("auto_jump_interval");
|
||||
@ -1418,6 +1417,7 @@ void Room::UpdateGasJump()
|
||||
NotifyWxVoip();
|
||||
if (room_type_ != RT_NewBrid) {
|
||||
InitAirDrop();
|
||||
InitAirRaid();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3880,3 +3880,75 @@ void Room::SetInfiniteBulletMode()
|
||||
pair.second->SetInfiniteBulletMode();
|
||||
}
|
||||
}
|
||||
|
||||
void Room::InitAirRaid()
|
||||
{
|
||||
std::list<MetaData::AirRaid>& air_raids = MetaMgr::Instance()->GetAirRaids();
|
||||
for (auto& air_raid : air_raids) {
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE * air_raid.i->time(),
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(air_raid.i->id()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
room->AirRaid(param.param1);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
}
|
||||
|
||||
void Room::AirRaid(int airraid_id)
|
||||
{
|
||||
MetaData::AirRaid* raid_meta = MetaMgr::Instance()->GetAirRaid(airraid_id);
|
||||
if (!raid_meta) {
|
||||
return;
|
||||
}
|
||||
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(raid_meta->i->bomb_id());
|
||||
if (!thing_meta) {
|
||||
return;
|
||||
}
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
a8::Vec2 center = gas_data_.pos_new + dir * (500 + rand() % 300);
|
||||
frame_event.AddAirRaid(raid_meta->i->appear_time(), center, raid_meta->i->rad());
|
||||
|
||||
auto raid_cb =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (room->IsGameOver()) {
|
||||
return;
|
||||
}
|
||||
MetaData::AirRaid* raid_meta = (MetaData::AirRaid*)param.param1.GetUserData();
|
||||
a8::Vec2 center = a8::Vec2
|
||||
(
|
||||
param.param2.GetDouble(),
|
||||
param.param3.GetDouble()
|
||||
);
|
||||
for (int i = 0; i < raid_meta->i->bomb_num(); ++i) {
|
||||
a8::Vec2 pos = center;
|
||||
RoomObstacle* obstacle = room->CreateObstacle
|
||||
(
|
||||
raid_meta->i->bomb_id(),
|
||||
pos.x,
|
||||
pos.y
|
||||
);
|
||||
if (obstacle) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE * raid_meta->i->appear_time() / 1000.f,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam2(raid_meta)
|
||||
.SetParam2(center.x)
|
||||
.SetParam3(center.y),
|
||||
raid_cb,
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ public:
|
||||
long long GetGasInactiveTime();
|
||||
void ShuaGuideAndroid(Human* target);
|
||||
void InitAirDrop();
|
||||
void InitAirRaid();
|
||||
void CheckPartObjects(Human* testa = nullptr, Human* testb = nullptr);
|
||||
bool RuningInTimer();
|
||||
Human* GetOneCanEnableAndroid();
|
||||
@ -200,6 +201,7 @@ private:
|
||||
void CombineTeam();
|
||||
void AirDrop(int appear_time, int box_id, int airdrop_id);
|
||||
void AdjustAirDropPos(MetaData::MapThing* thing_meta, a8::Vec2& box_pos);
|
||||
void AirRaid(int airraid_id);
|
||||
void ShuaPlane();
|
||||
Team* NewTeam();
|
||||
RoomObstacle* InternalCreateObstacle(int id, float x, float y,
|
||||
@ -303,6 +305,7 @@ private:
|
||||
MetaData::AirLine* airline_ = nullptr;
|
||||
a8::XTimerAttacher xtimer_attacher_;
|
||||
size_t airdrop_times_ = 0;
|
||||
size_t airraid_times_ = 0;
|
||||
int level0room_born_point_uniid_ = 0;
|
||||
int level1room_born_point_uniid_ = 0;
|
||||
bool show_handed_ = false;
|
||||
|
@ -706,6 +706,14 @@ message MFAirDrop
|
||||
optional MFVec2 pos = 3; //位置
|
||||
}
|
||||
|
||||
//空袭
|
||||
message MFAirRaid
|
||||
{
|
||||
optional int32 appear_time = 1; //空袭出现时间(毫秒)
|
||||
optional MFVec2 pos = 3; //空袭位置
|
||||
optional float rad = 4; //空袭半径
|
||||
}
|
||||
|
||||
//buff
|
||||
message MFBuff
|
||||
{
|
||||
@ -1074,6 +1082,7 @@ message SMUpdate
|
||||
repeated MFBuffChg chged_buff_list = 28; //buff变更列表
|
||||
repeated MFPropertyChg chged_property_list = 31; //property变更列表
|
||||
repeated MFPlaySkill play_skill_list = 32; //播放技能
|
||||
optional MFAirRaid airraid = 33; //空袭
|
||||
|
||||
repeated MFTuple dead_alive_objs = 42; //玩家values[0]:objid values[1]:多少毫秒后复活 values[2]: 0:死亡 1:复活
|
||||
//一下字段只有僵尸模式才有效
|
||||
|
@ -36,6 +36,7 @@ message Map
|
||||
optional string map_pic = 13;
|
||||
optional string first_safearea_center = 14;
|
||||
optional int32 init_gas_ring = 15;
|
||||
optional string airraids = 16;
|
||||
}
|
||||
|
||||
message MapThing
|
||||
@ -254,6 +255,16 @@ message AirDrop
|
||||
optional int32 drop_id = 4;
|
||||
}
|
||||
|
||||
message AirRaid
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 time = 2;
|
||||
optional int32 appear_time = 3;
|
||||
optional int32 bomb_id = 4;
|
||||
optional int32 bomb_num = 5;
|
||||
optional float rad = 6;
|
||||
}
|
||||
|
||||
message AirLine
|
||||
{
|
||||
optional int32 id = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user