Add Music fluctuations project and Chinese plan docs

This commit is contained in:
2026-03-21 15:55:54 +08:00
parent 629455df07
commit a172d75e36
462 changed files with 382904 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#pragma once
#include <functional>
using ListenerID = uint64_t;
template<class... ArgTypes>
class Event
{
public:
void a(){}
using Callback = std::function<void(ArgTypes...)>;
ListenerID AddListener(Callback p_callback);
ListenerID operator+=(Callback p_callback);
bool RemoveListener(ListenerID p_listenerID);
bool operator-=(ListenerID p_listenerID);
void RemoveAllListeners();
uint64_t GetListenerCount();
void Invoke(ArgTypes... p_args);
private:
std::unordered_map<ListenerID, Callback> m_callbacks; //存储该事件的所有监听者
ListenerID m_availableListenerID = 0; //一个监听者ID的自增统计量
};
#include"Event.inl"