#!/usr/local/bin/python2 import sys import subprocess from conv_lvs import conver_json_to_proto cfg_x = { "app_path":"/Users/xulianxin/Library/Developer/Xcode/DerivedData/TileManor-cyfxmuqeginijzdrqtqyskjujkxr/Build/Products/Debug/TileManor-desktop.app/", "res_path":"/Users/xulianxin/Documents/develop/game/TileMatch/TileManor/Resources/res_TileMatch/level/", "app_name":"TileManor-Desktop" } cfg = cfg_x if __name__ == '__main__': print('tiled_cmd handle commands') if len(sys.argv) > 1: if sys.argv[1] == 'testlv': # 从 sys.argv[2] 中提取关卡文件名和路径名 fn = sys.argv[2].split("/")[-1].split(".")[0] tDir = "/".join(sys.argv[2].split("/")[:-1]) tDirDst = tDir+"/../loadable" conver_json_to_proto(tDir, fn, tDirDst) subprocess.call(["cp", tDirDst + "/" + fn + ".bin", cfg["res_path"] + fn + ".bin"]) subprocess.call(["cp", tDirDst + "/" + fn + ".bin", cfg["app_path"] + "Contents/Resources/" + fn + ".bin"]) app = cfg["app_path"] + "Contents/MacOS/" + cfg["app_name"] subprocess.call([app, "testlv", fn]) else: print('tiled_cmd')