Exemplo n.º 1
0
def CopyResConfigData():
    # ResConfigDataCommon
    reousceDataRoot = common.GetResourceDataRoot()
    dirname = "ConfigDataCommon"
    dirUnity = common.GetRootProjectUnity() + "/Assets/Resources"
    dir1 = reousceDataRoot + "/" + dirname
    dir2 = dirUnity + "/" + dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1, dir2)

    # ConfigData
    dir1 = common.GetConfigDataDir()
    dir2 = dirUnity + "/ConfigData"
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1, dir2)
Exemplo n.º 2
0
    for i in range(1, count):
        print("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

    common.SetCmdPath(cmdPath)
    gameName = common.getGameName()
    gameType = common.getGameType()

    print(gameName)
    print(gameType)

    # resoucedata
    dir1 = common.GetResourceDataRoot(
    ) + "/" + gameType + "/" + gameName + "/" + "Resources/App"
    dir2 = common.GetRootProjectUnity() + "/Assets/Resources/App"
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1, dir2)

    # AppCommon
    dir1 = common.GetResourceDataRoot(
    ) + "/" + gameType + "/" + "AppCommon/Resources"
    dir2 = common.GetRootProjectUnity() + "/Assets/Resources/AppCommon"
    common.CopyDir(dir1, dir2)

    CopyResConfigData()

    copy_plugins()
        if i == 2:
            stros = sys.argv[i]

    common.SetCmdPath(cmdPath)
    # 0f6 2f1
    UNITYPATH = ""
    if common.isWindowsSystem():
        UNITYPATH = "E:/Unity/" + source.UNITY_VERSION + "/Editor/Unity.exe"
        if not os.path.exists(UNITYPATH):
            # 阿里云添加环境变量 C:\Program Files\Unity\Hub\Editor\2019.3.2f1\Editor
            # UNITYPATH="C:/Program Files/Unity/Hub/Editor/"+source.UNITY_VERSION+"/Editor/Unity.exe"
            UNITYPATH = "Unity.exe"
    else:
        UNITYPATH = "/Applications/Unity/Hub/Editor/" + source.UNITY_VERSION + "/Unity.app/Contents/MacOS/Unity"

    PROJECT_PATH = common.GetRootProjectUnity()

    methond = ""
    if stros == source.ANDROID:
        methond = "BuildPlayer.PerformAndroidBuild"
    if stros == source.IOS:
        methond = "BuildPlayer.PerformiPhoneBuild"

    print("unity_build  start")
    cmd = UNITYPATH + " -quit " + " -batchmode " + " -projectPath " + PROJECT_PATH + " -executeMethod  " + methond
    # ps = subprocess.Popen(cmd)
    # ps.wait()#让程序阻塞
    os.system(cmd)
    print("unity_build  end")

# PROJECT_PATH="F:\sourcecode\unity\product\kidsgame\kidsgameUnity"
    resDataName = common.getGameName()  #sys.argv[1]
    gameResName = getGameResName()

    gameResCommonRoot = common.GetResourceDataRoot(
    ) + "/GameResCommon" + "/" + gameResName
    gameResRoot = common.GetResourceDataRoot(
    ) + "/" + gameType + "/" + gameName + "/GameRes"
    flag = os.path.exists(gameResRoot)
    if not flag:
        #目录不存在的话到gamerescommon里copy
        gameResRoot = gameResCommonRoot

    gameDataRoot = common.GetResourceDataRoot(
    ) + "/" + gameType + "/" + gameName + "/GameData"

    streamingAssetsUnity = common.GetRootProjectUnity(
    ) + "/Assets/StreamingAssets"
    rootAndroidStudio = common.GetRootDirAndroidStudio()
    rootiOSXcode = common.GetRootDirXcode()

    # copy GameData 游戏配置等数据
    dirname = "GameData/screenshot"
    # ios
    dir2 = rootiOSXcode + "/Data/Raw/" + dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)

    dirname = "GameData/screenshot"
    # android asset
    dir2 = rootAndroidStudio + "/src/main/assets/" + dirname
    flag = os.path.exists(dir2)
Exemplo n.º 5
0
    print("脚本名:", sys.argv[0])
    cmdPath = common.cur_file_dir()
    count = len(sys.argv)
    for i in range(1, count):
        print("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

    common.SetCmdPath(cmdPath)
    gameName = common.getGameName()
    gameType = common.getGameType()

    print(gameType)
    print(gameName)

    configDirUnity = common.GetRootProjectUnity(
    ) + "/Assets/Resources/ConfigData/config"

    configAppType = config.GetConfigAppType(configDirUnity)
    configAppName = config.GetConfigAppName(configDirUnity)
    print("unity:" + configAppType + " " + configAppName)

    if gameType != configAppType or gameName != configAppName:
        print("check app type and name fail")
        sys.exit(0)

    dir1 = common.GetRootProjectUnity() + "/Assets/Resources/App"
    dir2 = common.GetResourceDataRoot(
    ) + "/" + gameType + "/" + gameName + "/" + "Resources/App"
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)