IAPCtlShopUI.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // IAPCtlShopUI.hpp
  3. // TileManor
  4. //
  5. // Created by 徐炼新 on 2024/1/16.
  6. //
  7. #ifndef IAPCtlShopUI_hpp
  8. #define IAPCtlShopUI_hpp
  9. #include <stdio.h>
  10. #include "cocos2d.h"
  11. #include "RUReboltLayer.h"
  12. #include "RUTableView.h"
  13. #include "IAPConf.hpp"
  14. class IAPCtlShopItem;
  15. class MapIGCoin;
  16. class IAPCtlShopUI : public cocos2d::Ref
  17. {
  18. public:
  19. static IAPCtlShopUI* getInstance();
  20. // 在指定节点内创建
  21. bool create(cocos2d::Node* pParent, IAPConf* cfg, int placementId = 1);
  22. // 设置退出时的回调
  23. void setCBWhileQuit(std::function<void()> cb) { _cb = cb; }
  24. // 当前是否正在显示
  25. bool isShowing();
  26. // 退出当前界面
  27. void quit();
  28. private:
  29. IAPCtlShopUI();
  30. ~IAPCtlShopUI();
  31. void clear();
  32. void _onNotifyDevelopment(const redutils::ReboltNotifyData& data);
  33. void constructShopItem(bool bShowAll = false);
  34. private:
  35. static IAPCtlShopUI* _instance;
  36. IAPConf* _cfg = nullptr;
  37. redutils::RUReboltLayer* _layer = nullptr;
  38. cocos2d::Node* _ndScrollArea = nullptr;
  39. redutils::RUTableView* _tableView = nullptr;
  40. redutils::RUTableDataModel _tableData;
  41. std::vector<GoodsInfo> _goodsInfo;
  42. std::vector<IAPCtlShopItem*> _goodsItems;
  43. redutils::RUReboltLayer* _btnShowAll = nullptr;
  44. std::vector<cocos2d::Size> _allSizes;
  45. MapIGCoin* _igCoin = nullptr;
  46. bool _bUIShowing = false;
  47. std::function<void()> _cb = nullptr;
  48. int _placementId = 0;
  49. };
  50. #endif /* IAPCtlShopUI_hpp */