This commit is contained in:
aozhiwei 2024-03-29 16:41:37 +08:00
parent 555d58716b
commit e30f9e2274
5 changed files with 27 additions and 11 deletions

View File

@ -5,9 +5,9 @@
#include "mt/InGameVoice.h" #include "mt/InGameVoice.h"
IMPL_TABLE(mt::InGameVoice) IMPL_TABLE(mt::InGameVoice)
int mt::InGameVoice::play_interval = 0; int mt::InGameVoice::s_play_interval = 0;
int mt::InGameVoice::series_kill_interval = 0; int mt::InGameVoice::s_series_kill_interval = 0;
std::map<int, std::vector<const mt::InGameVoice*>> mt::InGameVoice::type_hash_; std::map<int, std::vector<const mt::InGameVoice*>> mt::InGameVoice::s_type_hash_;
namespace mt namespace mt
{ {
@ -46,13 +46,19 @@ namespace mt
} }
_notify_object = ParseNotifyObject(notify_object()); _notify_object = ParseNotifyObject(notify_object());
{ {
auto itr = type_hash_.find(event_type()); auto itr = s_type_hash_.find(event_type());
if (itr != type_hash_.end()) { if (itr != s_type_hash_.end()) {
itr->second.push_back(this); itr->second.push_back(this);
} else { } else {
type_hash_[event_type()] = std::vector<const mt::InGameVoice*>({this}); s_type_hash_[event_type()] = std::vector<const mt::InGameVoice*>({this});
} }
} }
if (play_interval() > 0) {
s_play_interval = play_interval();
}
if (series_kill_interval() > 0) {
s_series_kill_interval = series_kill_interval();
}
} }
void InGameVoice::Init2() void InGameVoice::Init2()

View File

@ -37,8 +37,8 @@ namespace mt
"ingameVoice@ingameVoice.json", "ingameVoice@ingameVoice.json",
"id") "id")
public: public:
static int play_interval; static int s_play_interval;
static int series_kill_interval; static int s_series_kill_interval;
void Init1(); void Init1();
void Init2(); void Init2();
@ -48,7 +48,7 @@ namespace mt
private: private:
InGameVoiceNotifyObject_e _notify_object; InGameVoiceNotifyObject_e _notify_object;
static std::map<int, std::vector<const InGameVoice*>> type_hash_; static std::map<int, std::vector<const InGameVoice*>> s_type_hash_;
}; };

View File

@ -16,6 +16,8 @@ namespace mtb
int cond() const { return cond_; }; int cond() const { return cond_; };
const std::string notify_object() const { return notify_object_; }; const std::string notify_object() const { return notify_object_; };
int notify_fields() const { return notify_fields_; }; int notify_fields() const { return notify_fields_; };
int play_interval() const { return play_interval_; };
int series_kill_interval() const { return series_kill_interval_; };
bool has_event_type() const { return __flags__.test(0);}; bool has_event_type() const { return __flags__.test(0);};
bool has_moba_is_play() const { return __flags__.test(1);}; bool has_moba_is_play() const { return __flags__.test(1);};
@ -23,6 +25,8 @@ namespace mtb
bool has_cond() const { return __flags__.test(3);}; bool has_cond() const { return __flags__.test(3);};
bool has_notify_object() const { return __flags__.test(4);}; bool has_notify_object() const { return __flags__.test(4);};
bool has_notify_fields() const { return __flags__.test(5);}; bool has_notify_fields() const { return __flags__.test(5);};
bool has_play_interval() const { return __flags__.test(6);};
bool has_series_kill_interval() const { return __flags__.test(7);};
protected: protected:
@ -32,9 +36,11 @@ namespace mtb
int cond_ = 0; int cond_ = 0;
std::string notify_object_; std::string notify_object_;
int notify_fields_ = 0; int notify_fields_ = 0;
int play_interval_ = 0;
int series_kill_interval_ = 0;
public: public:
std::bitset<6> __flags__; std::bitset<8> __flags__;
}; };
}; };

View File

@ -133,13 +133,15 @@ namespace mtb
{ {
std::shared_ptr<a8::reflect::Class> meta_class = nullptr; std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
if (!meta_class) { if (!meta_class) {
meta_class = std::make_shared<a8::reflect::Class>("InGameVoice", 6, 0); meta_class = std::make_shared<a8::reflect::Class>("InGameVoice", 8, 0);
meta_class->SetSimpleField(0, "event_type", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, event_type_)); meta_class->SetSimpleField(0, "event_type", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, event_type_));
meta_class->SetSimpleField(1, "moba_is_play", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, moba_is_play_)); meta_class->SetSimpleField(1, "moba_is_play", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, moba_is_play_));
meta_class->SetSimpleField(2, "sound_id", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, sound_id_)); meta_class->SetSimpleField(2, "sound_id", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, sound_id_));
meta_class->SetSimpleField(3, "cond", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, cond_)); meta_class->SetSimpleField(3, "cond", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, cond_));
meta_class->SetSimpleField(4, "notify_object", a8::reflect::ET_STRING, my_offsetof2(InGameVoice, notify_object_)); meta_class->SetSimpleField(4, "notify_object", a8::reflect::ET_STRING, my_offsetof2(InGameVoice, notify_object_));
meta_class->SetSimpleField(5, "notify_fields", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, notify_fields_)); meta_class->SetSimpleField(5, "notify_fields", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, notify_fields_));
meta_class->SetSimpleField(6, "play_interval", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, play_interval_));
meta_class->SetSimpleField(7, "series_kill_interval", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, series_kill_interval_));
} }
return meta_class; return meta_class;
} }

View File

@ -66,6 +66,8 @@ message InGameVoice
optional int32 cond = 4; optional int32 cond = 4;
optional string notify_object = 5; optional string notify_object = 5;
optional int32 notify_fields = 6; optional int32 notify_fields = 6;
optional int32 play_interval = 7;
optional int32 series_kill_interval = 8;
} }
message MapArea message MapArea