script.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # coding:utf8
  2. __author__ = 'dong'
  3. import os
  4. import logging
  5. import xml.dom.minidom
  6. import re
  7. import shutil
  8. import glob
  9. from xml.etree.ElementTree import ElementTree, Element
  10. import distutils.dir_util
  11. def script_pre(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  12. mipmap = os.path.join(decompileDir, "res/mipmap-anydpi-v26")
  13. values = os.path.join(decompileDir, "res/values-anydpi-v26")
  14. if os.path.exists(mipmap):
  15. distutils.dir_util.remove_tree(mipmap)
  16. if os.path.exists(values):
  17. distutils.dir_util.remove_tree(values)
  18. logging.info("-----debug-----")
  19. def script_after(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
  20. # ic_launcher_foreground.png
  21. list_ic_launcher_foreground = [
  22. "drawable",
  23. "drawable-hdpi-v4",
  24. "drawable-ldpi-v4",
  25. "drawable-mdpi-v4",
  26. "drawable-xhdpi-v4",
  27. "drawable-xxhdpi-v4",
  28. "drawable-xxxhdpi-v4",
  29. "mipmap",
  30. "mipmap-hdpi-v4",
  31. "mipmap-ldpi-v4",
  32. "mipmap-mdpi-v4",
  33. "mipmap-xhdpi-v4",
  34. "mipmap-xxhdpi-v4",
  35. "mipmap-xxxhdpi-v4",
  36. ]
  37. icon_src = os.path.join(extract_dir, "res", "drawable", "ic_launcher.png")
  38. for dpi in list_ic_launcher_foreground:
  39. icon = os.path.join(extract_dir, "res", dpi, "ic_launcher_foreground.png")
  40. if os.path.exists(icon):
  41. shutil.copyfile(icon_src, icon)
  42. if __name__ == '__main__':
  43. script_after("", "d:\\sanguo", "", "", "")