123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- //
- // RWStruct.hpp
- // redwise_sdk
- //
- // Created by 余纪柱 on 2023/9/6.
- //
- #ifndef RWStruct_hpp
- #define RWStruct_hpp
- // wwise native include
- #include <AK/SoundEngine/Common/AkTypes.h>
- #pragma mark 本地数据键值
- enum RWDataKeys
- {
- None,
- EffectStatus = 1,
- MusicStatus = 2,
- StashedEffectStatus = 3,
- StashedMusicStatus = 4
- };
- enum class RWItemIndexA
- {
- ID = 0,
- Name = 1,
- WwiseObjectPath = 2,
- Notes = 3
- };
- enum class RWItemIndexB
- {
- ID = 0,
- Name = 1,
- Notes = 2
- };
- #pragma mark 声明枚举_RedWise API 返回类型
- enum class RWResultType
- {
- None,
- EventForcePost, // 强制使事件活动
- EventRuning, // 事件活动中
- EventRest, // 事件空闲中
- EventNotFind, // 事件不存在
- EventFind, // 找到事件
- ResetSuccess, // 重置成功
- ResetFail, // 重置失败
- SetAppNameSucess, // 设置成功
- SetAppNameFail, // 设置失败
- SetAppNameFailWhenRelease, // 正式版App拒绝设置AppName,因其使用场景为debug
- RetainBankSuccess,
- RetainBankFail,
- NameStringEmpty // 检测到作为名字使用的串为空
- };
- #pragma mark 声明结构体_描述配置文件(XX.txt)中各属性基本信息
- struct RWBankDescription
- {
- string bankName;
- string bankFileName;
- };
- struct RWEventDescription
- {
- string eventName;
- uint32_t eventID;
- string ownerBankName;
- };
- struct RWSwitchDescription
- {
- uint32_t switchID;
- string switchName;
- string ownerSwitchGroup;
- };
- struct RWSwitchGroupDescription
- {
- uint32_t groupID;
- string groupName;
- vector<string> ownerEvents;
- };
- struct RWStateDescription
- {
- uint32_t stateID;
- string stateName;
- string ownerStateGroup;
- };
- struct RWStateGroupDescription
- {
- uint32_t groupID;
- string groupName;
- vector<string> ownerEvents;
- };
- struct RWParamDescription
- {
- uint32_t paramID;
- string paramName;
- vector<string> ownerEvents;
- };
- #pragma mark 声明结构体_描述各属性 “基础信息+关联关系” 的详细信息(Event、Switch、State、StateGroup、SwitchGroup、Parameter)
- struct RWSwitchInfo
- {
- RWSwitchDescription switchDescription;
- };
- struct RWStateInfo
- {
- RWStateDescription stateDescription;
- };
- struct RWSwitchGroupInfo
- {
- string switchsFormat;
- set<string> switchs;
- RWSwitchGroupDescription switchGroupDescription;
- };
- struct RWStateGroupInfo
- {
- string statesFormat;
- set<string> states;
- RWStateGroupDescription stateGroupDescription;
- };
- struct RWEventInfo
- {
- set<string> switchGroupNames;
- set<string> stateGroupNames;
- set<string> paramNames;
- RWEventDescription eventDescription;
- };
- struct RWParamInfo
- {
- RWParamDescription paramDescription;
- };
- struct RWBankInfo
- {
- RWBankDescription bnkDescription;
- unordered_map<string, RWEventInfo> EventPool;
- unordered_map<string, RWStateGroupInfo> StateGroupPool;
- unordered_map<string, RWSwitchGroupInfo> SwitchGroupPool;
- unordered_map<string, RWSwitchInfo> switchPool;
- unordered_map<string, RWStateInfo> statePool;
- unordered_map<string, RWParamInfo> ParameterPool;
- };
- #pragma mark 声明结构体_描述播放详情
- struct RWPlayInfo
- {
- function<void(void)> onEventEnd;
- RWPlayInfo(function<void(void)> p_eventEndCallback)
- : onEventEnd(p_eventEndCallback){};
- };
- struct RWEmitterInfo
- {
- cocos2d::Node* emitter;
- function<void(void)> onEventEnd;
- RWEmitterInfo(function<void(void)> p_eventEndCallback, cocos2d::Node* p_emitter)
- : onEventEnd(p_eventEndCallback), emitter(p_emitter){};
- };
- struct RWEventCacheItem
- {
- unordered_map<AkPlayingID, RWPlayInfo> m_playInfo;
- };
- struct RWReturn
- {
- bool findEvent = false;
- RWResultType type = RWResultType::None;
- uint32_t eventID = 0;
- AkPlayingID playID = 0;
-
- string error;
- string warn;
- };
- struct RWLog
- {
- string error;
- string warn;
-
- void addError(const string& str){error.append(str);error.append("\n");};
- void addWarn(const string& str){warn.append(str);warn.append("\n");}
- void popTo(RWReturn* rr = NULL)
- {
- if(rr)
- {
- rr->error = error;
- rr->warn = warn;
- }
- error = "";
- warn = "";
- }
- };
- class RedWise;
- struct RWSonStruct
- {
- RedWise* m_owner ;
- inline void setOwner(RedWise* owner)
- {m_owner = owner ;};
- };
- struct RWBankCacheItem
- {
- AkUInt32 bankID;
- int referenceCount;
- function<void(void)> asyncLoadCallback;
- function<void(void)> asyncUnloadCallback;
- RWBankCacheItem(int in_referenceCount, AkUInt32 in_bankID, function<void(void)> in_asyncLoadCallback = NULL, function<void(void)> in_asyncUnloadCallback = NULL)
- {
- referenceCount = in_referenceCount;
- bankID = in_bankID;
- asyncLoadCallback = in_asyncLoadCallback;
- asyncUnloadCallback = in_asyncUnloadCallback;
- };
- };
- struct RWRedreamParam
- {
- string name;
- float value = 0;
- float min = 0.f;
- float max = 100.f;
- RWRedreamParam() {};
- RWRedreamParam(const string& name, float value, float min, float max)
- : name(name), value(value), min(min), max(max) {}
- };
- struct RWRedreamEvent
- {
- string name;
- vector<RWRedreamParam> params;
- };
- struct RWRedreamInfo
- {
- vector<RWRedreamEvent> events;
- RWReturn log;
- };
- #endif /* RWStruct_hpp */
|