RUReboltCompt.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // RUReboltComp.hpp
  3. // red_utils
  4. //
  5. // Created by 徐炼新 on 2024/4/26.
  6. //
  7. #ifndef RUReboltCompt_hpp
  8. #define RUReboltCompt_hpp
  9. #include "Redream.h"
  10. #include "RUDefine.h"
  11. #include "RUReboltLayer.h"
  12. NS_RU_BEGIN
  13. ///延时调用,好处,没有key关键字,可以同时加多个.
  14. void RU_addCallBack(const std::function<void()>& callBack, float dt);
  15. class ReboltCompt: public cocos2d::Component, public redream::NotifyDevelopmentDelegate
  16. {
  17. public:
  18. virtual ~ReboltCompt();
  19. CREATE_FUNC(ReboltCompt);
  20. ///其他参数是空.
  21. static ReboltCompt* LoadReboltComptFile(const string& ccbName, redream::NotifyDevelopmentDelegate *ndDelegate = nullptr);
  22. ///加载Rebolt的redream,没有也能加载.
  23. ///loaderLib自定义加载ui的class
  24. ///ndDelegate: NotifyDevelopmentDelegate的实例,如果是空,则返回的 ReboltCompt为代理,此时可以用 ReboltCompt的onNotifyDev函数为回调入口
  25. ///owner : 通常为nil
  26. static ReboltCompt* LoadReboltComptFile(const string& ccbName,
  27. redream::NodeLoaderLibrary* loaderLib,
  28. redream::NotifyDevelopmentDelegate *ndDelegate,
  29. Ref* owner);
  30. std::string runBehaviacWhitFunName(std::string name, std::map<std::string, bool> boolMap = {}, std::map<std::string, std::string> stringMap = {});
  31. void setCoderDataVar(std::string key, std::string content);
  32. ///延时移除自己的 Node
  33. void DelayRemoveOwer(float dt=0.017f);
  34. redream::ReboltRedManager* getRRMgr() {return _rs;};
  35. virtual void registerOnNotify(const std::function<void(const ReboltNotifyData&)>& notifyCallback);
  36. protected:
  37. void onNotifyDevelopment(redream::ReboltRedManager* reboltRedManager,
  38. redream::NotifyDevelopmentWaiter* waiter,
  39. std::string notify,
  40. std::string param,
  41. bool reboltIsWait,
  42. Node* outNode) override ;
  43. private:
  44. redream::ReboltRedManager* _rs = nullptr;
  45. std::function<void(ReboltNotifyData)> _onNotifyDev = nullptr;
  46. };
  47. NS_RU_END
  48. #endif /* RUReboltCompt_hpp */