M_CommodityCFG.h 811 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <boost/unordered_map.hpp>
  3. #include <vector>
  4. struct M_CommodityCFGData
  5. {
  6. //商品ID
  7. int mCommodityId;
  8. //商品名称
  9. std::string mName;
  10. //商品类型(3.礼物5.相框)
  11. int mCommodityType;
  12. //价格类型(1金币 2礼券)
  13. int mPriceType;
  14. //实际价格
  15. int mPrice;
  16. //所含道具,对应ItemCFG.xls表
  17. std::vector<int> mItem;
  18. //是否能购买(是否显示)
  19. bool mIsCanBuy;
  20. //数量
  21. std::vector<int> mCount;
  22. };
  23. class M_CommodityCFG
  24. {
  25. public:
  26. private:
  27. static std::auto_ptr<M_CommodityCFG> msSingleton;
  28. public:
  29. int GetCount();
  30. const M_CommodityCFGData* GetData(int CommodityId);
  31. boost::unordered_map<int, M_CommodityCFGData>& GetMapData();
  32. void Reload();
  33. void Load(const std::string& path);
  34. void Load();
  35. static M_CommodityCFG* GetSingleton();
  36. private:
  37. boost::unordered_map<int, M_CommodityCFGData> mMapData;
  38. };