// // RWStruct.hpp // redwise_sdk // // Created by 余纪柱 on 2023/9/6. // #ifndef RWStruct_hpp #define RWStruct_hpp // wwise native include #include #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 ownerEvents; }; struct RWStateDescription { uint32_t stateID; string stateName; string ownerStateGroup; }; struct RWStateGroupDescription { uint32_t groupID; string groupName; vector ownerEvents; }; struct RWParamDescription { uint32_t paramID; string paramName; vector ownerEvents; }; #pragma mark 声明结构体_描述各属性 “基础信息+关联关系” 的详细信息(Event、Switch、State、StateGroup、SwitchGroup、Parameter) struct RWSwitchInfo { RWSwitchDescription switchDescription; }; struct RWStateInfo { RWStateDescription stateDescription; }; struct RWSwitchGroupInfo { string switchsFormat; set switchs; RWSwitchGroupDescription switchGroupDescription; }; struct RWStateGroupInfo { string statesFormat; set states; RWStateGroupDescription stateGroupDescription; }; struct RWEventInfo { set switchGroupNames; set stateGroupNames; set paramNames; RWEventDescription eventDescription; }; struct RWParamInfo { RWParamDescription paramDescription; }; struct RWBankInfo { RWBankDescription bnkDescription; unordered_map EventPool; unordered_map StateGroupPool; unordered_map SwitchGroupPool; unordered_map switchPool; unordered_map statePool; unordered_map ParameterPool; }; #pragma mark 声明结构体_描述播放详情 struct RWPlayInfo { function onEventEnd; RWPlayInfo(function p_eventEndCallback) : onEventEnd(p_eventEndCallback){}; }; struct RWEmitterInfo { cocos2d::Node* emitter; function onEventEnd; RWEmitterInfo(function p_eventEndCallback, cocos2d::Node* p_emitter) : onEventEnd(p_eventEndCallback), emitter(p_emitter){}; }; struct RWEventCacheItem { unordered_map 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 asyncLoadCallback; function asyncUnloadCallback; RWBankCacheItem(int in_referenceCount, AkUInt32 in_bankID, function in_asyncLoadCallback = NULL, function 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 params; }; struct RWRedreamInfo { vector events; RWReturn log; }; #endif /* RWStruct_hpp */