You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3 KiB

  1. require("preload.Plugin")
  2. -- 安装包补丁工具
  3. -- android
  4. local PluginPatcher
  5. if cc.Application:getInstance():getTargetPlatform() == 3 then
  6. PluginPatcher = cc.PluginManager:getInstance():createPlugin("PluginPatcher" , "com/ddgame/plugin/PluginPatcher");
  7. elseif cc.Application:getInstance():getTargetPlatform() == 4 or cc.Application:getInstance():getTargetPlatform() == 5 then
  8. else
  9. end
  10. function getCurrentApkMd5()
  11. local result
  12. if PluginPatcher then
  13. result = PluginPatcher:callString("getApkMd5")
  14. end
  15. print("PluginPatcher::getCurrentApkMd5() result = ", tostring(result))
  16. return result
  17. end
  18. -- 是否支持补丁安装功能
  19. function isPatcherSupport()
  20. if cc.Application:getInstance():getTargetPlatform() == 3 then
  21. return true;
  22. else
  23. return false;
  24. end
  25. end
  26. -- 生成新的APK
  27. function patcherMakeApk(patchPath, patchMd5, newApkPath, newApkMd5)
  28. if PluginPatcher then
  29. local tt = {
  30. patchPath = patchPath,
  31. patchMd5 = patchMd5,
  32. newApkPath = newApkPath,
  33. newApkMd5 = newApkMd5,
  34. }
  35. local result = PluginPatcher:callString("makeNewApk", tt)
  36. print("PluginPatcher::patcherMakeApk() result = ", result)
  37. return result == "Successed";
  38. end
  39. return false;
  40. end
  41. -- 安装APK
  42. function patcherInstallApk(apk_file)
  43. if PluginPatcher then
  44. PluginPatcher:callVoid("installNewApk", apk_file);
  45. end
  46. end