This commit is contained in:
aozhiwei 2019-07-18 10:16:22 +08:00
parent b06e983ccd
commit afd4e8061a
4 changed files with 26 additions and 30 deletions

View File

@ -235,6 +235,7 @@ void Human::Shot()
void Human::DirectShot(MetaData::Equip* bullet_meta, int skill_id) void Human::DirectShot(MetaData::Equip* bullet_meta, int skill_id)
{ {
#if 0
for (auto& tuple : bullet_meta->bullet_born_offset) { for (auto& tuple : bullet_meta->bullet_born_offset) {
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple)); a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
bullet_born_offset.Rotate(attack_dir.CalcAngle(a8::Vec2::UP)); bullet_born_offset.Rotate(attack_dir.CalcAngle(a8::Vec2::UP));
@ -284,6 +285,7 @@ void Human::DirectShot(MetaData::Equip* bullet_meta, int skill_id)
} }
} }
OnAttack(); OnAttack();
#endif
} }
void Human::RecalcSelfCollider() void Human::RecalcSelfCollider()

View File

@ -48,38 +48,25 @@ namespace MetaData
void Equip::Init() void Equip::Init()
{ {
{ {
std::vector<std::string> strings; std::vector<std::string> strings0;
a8::Split(i->bullet_born_offset(), strings, '|'); a8::Split(i->bullet_born_offset(), strings0, '$');
for (auto& str : strings) { for (auto& str0 : strings0) {
std::vector<std::string> strings2; std::vector<std::string> strings;
a8::Split(str, strings2, ':'); a8::Split(str0, strings, '|');
assert(strings2.size() >= 2); auto& p = a8::FastAppend(bullet_born_offset);
bullet_born_offset.push_back(std::make_tuple( std::get<0>(p) = i->bullet_delay() * (bullet_born_offset.size() - 1);
a8::XValue(strings2[0]).GetDouble(), for (auto& str : strings) {
a8::XValue(strings2[1]).GetDouble(), std::vector<std::string> strings2;
strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0 a8::Split(str, strings2, ':');
) assert(strings2.size() >= 2);
); auto& born_point = a8::FastAppend(std::get<1>(p));
} born_point.born_offset = a8::Vec2(a8::XValue(strings2[0]).GetDouble(),
} a8::XValue(strings2[1]).GetDouble()
#if 0 );
{ born_point.angle = strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0;
std::vector<std::string> strings;
a8::Split(i->volume(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() == 2);
if (strings2.size() >= 2) {
int slot = a8::XValue(strings2[0]);
int num = a8::XValue(strings2[1]);
if (slot >= 0 && slot < volume.size()){
volume[slot] = num;
}
} }
} }
} }
#endif
} }
bool Equip::CanDrop() bool Equip::CanDrop()

View File

@ -47,11 +47,17 @@ namespace MetaData
const metatable::Item* i = nullptr; const metatable::Item* i = nullptr;
}; };
struct BulletBornPoint
{
a8::Vec2 born_offset;
float angle = 0.0f;
};
struct Equip struct Equip
{ {
const metatable::Equip* i = nullptr; const metatable::Equip* i = nullptr;
std::vector<std::tuple<float, float, float>> bullet_born_offset; std::vector<std::tuple<int, std::vector<BulletBornPoint>>> bullet_born_offset;
std::array<int, IS_END> volume = {}; std::array<int, IS_END> volume = {};
void Init(); void Init();

View File

@ -85,6 +85,7 @@ message Equip
//required string inventory_slot = 31; // //required string inventory_slot = 31; //
//required int32 _inventory_slot = 32; // //required int32 _inventory_slot = 32; //
required int32 bullet_delay = 33;
} }
message EquipUpgrade message EquipUpgrade