RedWise.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // RedWise.hpp
  3. // MyGameCpp
  4. //
  5. // Created by 余纪柱 on 2020/12/22.
  6. //
  7. #ifndef RedWise_hpp
  8. #define RedWise_hpp
  9. // cpp include
  10. #include <math/Vec3.h>
  11. #include <set>
  12. #include <string>
  13. #include <unordered_map>
  14. #include <unordered_set>
  15. #include <vector>
  16. class RedWise;
  17. using namespace std;
  18. RedWise* _redwise();
  19. #pragma mark 声明枚举_RedWise API 返回类型
  20. enum class RWResultType
  21. {
  22. None,
  23. EventForcePost, // 强制使事件活动
  24. EventRuning, // 事件活动中
  25. EventRest, // 事件空闲中
  26. EventNotFind, // 事件不存在
  27. EventFind, // 找到事件
  28. ResetSuccess, // 重置成功
  29. ResetFail, // 重置失败
  30. SetAppNameSucess, // 设置成功
  31. SetAppNameFail, // 设置失败
  32. SetAppNameFailWhenRelease, // 正式版App拒绝设置AppName,因其使用场景为debug
  33. RetainBankSuccess,
  34. RetainBankFail,
  35. NameStringEmpty // 检测到作为名字使用的串为空
  36. };
  37. struct RWReturn
  38. {
  39. bool findEvent = false;
  40. RWResultType type = RWResultType::None;
  41. std::uint32_t eventID = 0;
  42. std::string error;
  43. std::string warn;
  44. };
  45. struct RWRedreamParam
  46. {
  47. string name;
  48. float value = 0;
  49. float min = 0.f;
  50. float max = 100.f;
  51. RWRedreamParam() {};
  52. RWRedreamParam(const string& name, float value, float min, float max)
  53. : name(name), value(value), min(min), max(max) {}
  54. };
  55. using namespace std;
  56. class RedWise
  57. {
  58. public:
  59. public:
  60. static RedWise* RW;
  61. static RedWise* getInstance(); ///单例
  62. bool _init();
  63. RWReturn postEvent(string eventName, bool forcePostEvent = true, function<void(void)> onEventEnd = NULL){
  64. RWReturn rer;
  65. return rer;
  66. }; /// 常用
  67. RWReturn postEventByBnk(string bnkPath,string eventName,vector<RWRedreamParam> params, bool forcePostEvent){
  68. RWReturn result;
  69. return result;
  70. };
  71. RWReturn postEventByBnk(string bnkPath,string eventName,function<void(void)> onEventEnd = NULL){
  72. RWReturn result;
  73. return result;
  74. };
  75. };
  76. #endif /* RedWise_hpp */