RUBaseConf.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // GameConf.hpp
  3. // CandyCookie
  4. //
  5. // Created by 徐炼新 on 2021/6/29.
  6. //
  7. #ifndef BaseConf_hpp
  8. #define BaseConf_hpp
  9. #include "cocos2d.h"
  10. #include "RUDefine.h"
  11. USING_NS_CC;
  12. NS_RU_BEGIN
  13. class BaseConf {
  14. public:
  15. BaseConf(const char*);
  16. /// 获取某项配置
  17. /// @param group 组名
  18. /// @param confKey 配置项名称,如果有多级则中间用 ":" 连起来
  19. const string& getConf(const string& group, const string& confKey);
  20. /// 获取某个分组的某项配置
  21. /// @param userGrp 用户分组
  22. /// @param optK 选项的key
  23. std::string getGrpOptions(int userGrp, const char* optK);
  24. /// 获取某项配置
  25. /// @param confKey 单个的配置项名称
  26. const string& getConf(const string& confKey);
  27. float getConfAsFloat(const string& confKey);
  28. float getConfAsFloat(const string& group, const string& confKey);
  29. std::list<float> getConfAsFloatList(const string& confKey);
  30. std::list<float> getConfAsFloatList(const string& group, const string& confKey);
  31. bool isValid();
  32. private:
  33. string _nullV;
  34. json11::Json _jConf;
  35. bool _valid = false;
  36. };
  37. NS_RU_END
  38. #endif /* GameConf_hpp */