This commit is contained in:
aozhiwei 2024-03-29 17:00:38 +08:00
parent 07d3d11127
commit 8b122340f9
5 changed files with 36 additions and 5 deletions

View File

@ -71,11 +71,37 @@ namespace mt
return _notify_object;
}
void InGameVoice::Traverse(int event_type, std::function<bool (const InGameVoice*)> cb)
void InGameVoice::Traverse(bool is_moba_room, int event_type, std::function<bool (const InGameVoice*)> cb)
{
auto itr = s_type_hash_.find(event_type);
if (itr != s_type_hash_.end()) {
for (auto& ele : itr->second) {
bool ok = false;
switch (ele->play_scene()) {
case 3:
{
ok = true;
}
break;
case 2:
{
ok = !is_moba_room;
}
break;
case 1:
{
ok = is_moba_room;
}
break;
default:
{
}
break;
}
if (ok && !cb(ele)) {
return;
}
}
}
}

View File

@ -44,7 +44,7 @@ namespace mt
void Init2();
InGameVoiceNotifyObject_e GetNotifyObject() const;
static void Traverse(int event_type, std::function<bool (const InGameVoice*)> cb);
static void Traverse(bool is_moba_room, int event_type, std::function<bool (const InGameVoice*)> cb);
private:
InGameVoiceNotifyObject_e _notify_object;

View File

@ -18,6 +18,7 @@ namespace mtb
int notify_fields() const { return notify_fields_; };
int play_interval() const { return play_interval_; };
int series_kill_interval() const { return series_kill_interval_; };
int play_scene() const { return play_scene_; };
bool has_event_type() const { return __flags__.test(0);};
bool has_moba_is_play() const { return __flags__.test(1);};
@ -27,6 +28,7 @@ namespace mtb
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);};
bool has_play_scene() const { return __flags__.test(8);};
protected:
@ -38,9 +40,10 @@ namespace mtb
int notify_fields_ = 0;
int play_interval_ = 0;
int series_kill_interval_ = 0;
int play_scene_ = 0;
public:
std::bitset<8> __flags__;
std::bitset<9> __flags__;
};
};

View File

@ -133,7 +133,7 @@ namespace mtb
{
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
if (!meta_class) {
meta_class = std::make_shared<a8::reflect::Class>("InGameVoice", 8, 0);
meta_class = std::make_shared<a8::reflect::Class>("InGameVoice", 9, 0);
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(2, "sound_id", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, sound_id_));
@ -142,6 +142,7 @@ namespace mtb
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_));
meta_class->SetSimpleField(8, "play_scene", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, play_scene_));
}
return meta_class;
}

View File

@ -68,6 +68,7 @@ message InGameVoice
optional int32 notify_fields = 6;
optional int32 play_interval = 7;
optional int32 series_kill_interval = 8;
optional int32 play_scene = 9;
}
message MapArea