RUQCoreBtn.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // Redream的QCoreBtn加载类
  3. //
  4. #ifndef RUQCoreBtn_h
  5. #define RUQCoreBtn_h
  6. #include "RUQCoreLayer.h"
  7. #include "RUDefine.h"
  8. NS_RU_BEGIN
  9. class QCoreBtn:public QCoreLayer
  10. {
  11. public:
  12. static QCoreBtn * Layer(string file);
  13. RED_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(QCoreBtn, create);
  14. QCoreBtn();
  15. ~QCoreBtn();
  16. virtual cocos2d::extension::Control::Handler onResolveREDCCControlSelector(cocos2d::Ref * pTarget, const char * pSelectorName) override;
  17. virtual void onNodeLoaded(cocos2d::Node * node, redream::NodeLoader * nodeLoader) override;
  18. virtual void resetParticle(std::string name);
  19. virtual void ResetButton();
  20. virtual void setTouchEnable(bool enable);
  21. std::function<void(QCoreBtn*,int)> coreClickButton = nullptr;
  22. virtual void ingroPlayEffect();
  23. void setTimelines(const char* tl4Tap, const char* tl4Release);
  24. protected:
  25. virtual void clScheduOnce(float dt);
  26. //----------ccb中所有的按钮都用一个函数 onBtnMenu 然后用tag 来区分是那个按钮
  27. virtual void OnClickCCBButton(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
  28. virtual void clickBtnSechel(float t); //------延时调用的函数
  29. protected:
  30. int _mClickButtonTag; //------需要把点击按钮的tag保存在这个变量里面
  31. bool _bCanClickButton; //------用来保证状态的变量
  32. //------------
  33. bool _playEffect;
  34. Vec2 _lastWorldPos;
  35. bool _isPlayRelease;
  36. std::string _tapTL;
  37. std::string _releaseTL;
  38. };
  39. class QCoreBtnLoader : public redream::LayerLoader {
  40. public:
  41. RED_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(QCoreBtnLoader, loader);
  42. protected:
  43. RED_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(QCoreBtn);
  44. };
  45. NS_RU_END
  46. #endif /* defined(RUQCoreBtn_h) */