CCEventAssetsManagerEx.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /****************************************************************************
  2. Copyright (c) 2014-2017 Chukong Technologies Inc.
  3. http://www.cocos2d-x.org
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. ****************************************************************************/
  20. #ifndef __cocos2d_libs__CCEventAssetsManagerEx__
  21. #define __cocos2d_libs__CCEventAssetsManagerEx__
  22. #include "base/CCEvent.h"
  23. #include "base/CCEventCustom.h"
  24. #include "extensions/ExtensionMacros.h"
  25. #include "extensions/ExtensionExport.h"
  26. NS_CC_EXT_BEGIN
  27. class AssetsManagerEx;
  28. class CC_EX_DLL EventAssetsManagerEx : public cocos2d::EventCustom
  29. {
  30. public:
  31. friend class AssetsManagerEx;
  32. //! Update events code
  33. enum class EventCode
  34. {
  35. ERROR_NO_LOCAL_MANIFEST,
  36. ERROR_DOWNLOAD_MANIFEST,
  37. ERROR_PARSE_MANIFEST,
  38. NEW_VERSION_FOUND,
  39. ALREADY_UP_TO_DATE,
  40. UPDATE_PROGRESSION,
  41. ASSET_UPDATED,
  42. ERROR_UPDATING,
  43. UPDATE_FINISHED,
  44. UPDATE_FAILED,
  45. ERROR_DECOMPRESS
  46. };
  47. EventCode getEventCode() const { return _code; }
  48. int getCURLECode() const { return _curle_code; }
  49. int getCURLMCode() const { return _curlm_code; }
  50. std::string getMessage() const { return _message; }
  51. std::string getAssetId() const { return _assetId; }
  52. cocos2d::extension::AssetsManagerEx *getAssetsManagerEx() const { return _manager; }
  53. float getPercent() const { return _percent; }
  54. float getPercentByFile() const { return _percentByFile; }
  55. CC_CONSTRUCTOR_ACCESS:
  56. /** Constructor */
  57. EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, float percent = 0, float percentByFile = 0, const std::string& assetId = "", const std::string& message = "", int curle_code = 0, int curlm_code = 0);
  58. private:
  59. EventCode _code;
  60. cocos2d::extension::AssetsManagerEx *_manager;
  61. std::string _message;
  62. std::string _assetId;
  63. int _curle_code;
  64. int _curlm_code;
  65. float _percent;
  66. float _percentByFile;
  67. };
  68. NS_CC_EXT_END
  69. #endif /* defined(__cocos2d_libs__CCEventAssetsManagerEx__) */