tiled_cmd.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #!/usr/local/bin/python2
  2. import sys
  3. import subprocess
  4. from conv_lvs import conver_json_to_proto
  5. cfg_x = {
  6. "app_path":"/Users/xulianxin/Library/Developer/Xcode/DerivedData/TileManor-cyfxmuqeginijzdrqtqyskjujkxr/Build/Products/Debug/TileManor-desktop.app/",
  7. "res_path":"/Users/xulianxin/Documents/develop/game/TileMatch/TileManor/Resources/res_TileMatch/level/",
  8. "app_name":"TileManor-Desktop"
  9. }
  10. cfg = cfg_x
  11. if __name__ == '__main__':
  12. print('tiled_cmd handle commands')
  13. if len(sys.argv) > 1:
  14. if sys.argv[1] == 'testlv':
  15. # 从 sys.argv[2] 中提取关卡文件名和路径名
  16. fn = sys.argv[2].split("/")[-1].split(".")[0]
  17. tDir = "/".join(sys.argv[2].split("/")[:-1])
  18. tDirDst = tDir+"/../loadable"
  19. conver_json_to_proto(tDir, fn, tDirDst)
  20. subprocess.call(["cp", tDirDst + "/" + fn + ".bin", cfg["res_path"] + fn + ".bin"])
  21. subprocess.call(["cp", tDirDst + "/" + fn + ".bin", cfg["app_path"] + "Contents/Resources/" + fn + ".bin"])
  22. app = cfg["app_path"] + "Contents/MacOS/" + cfg["app_name"]
  23. subprocess.call([app, "testlv", fn])
  24. else:
  25. print('tiled_cmd')