コード例 #1
0
def copyApk(channel):
    gameName = common.getGameName()
    gameType = common.getGameType()
    # copy2 同时复制文件权限
    dirapk = common.GetProjectOutPutApp() + "/apk"

    if common.AppForPad(False):
        dirapk += "/heng"
        gameName += "_hd"
    else:
        dirapk += "/shu"

    if not os.path.exists(dirapk):
        os.makedirs(dirapk)

    shutil.copy2(
        common.getAndroidProjectApk(),
        dirapk + "/" + gameType + "_" + gameName + "_" + channel + ".apk")
コード例 #2
0
    # sys.setdefaultencoding("utf-8")

    print("脚本名:", sys.argv[0])
    cmdPath = common.cur_file_dir()
    count = len(sys.argv)
    isHD = False

    for i in range(1, count):
        print("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

        if i == 2:
            if sys.argv[i] == "hd":
                isHD = True

    print("cmdPath=" + cmdPath)
    common.SetCmdPath(cmdPath)
    gameName = common.getGameName()
    gameType = common.getGameType()
    print("gameName=" + gameName)
    print("gameType=" + gameType)
    android_studio_dir = common.GetRootDirAndroidStudio()
    print("android_studio_dir=" + android_studio_dir)
    # python 里无法直接执行cd目录,想要用chdir改变当前的工作目录
    os.chdir(android_studio_dir)
    buildApk()
    copyApk("")

    print("apk_build sucess")
コード例 #3
0
def DoCopy():
    gameName = common.getGameName()
    gameType = common.getGameType()
    print(gameName)
    print(gameType)

    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

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

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

    # copy GameRes 游戏图片等资源
    dirname = "GameRes"

    # unity editor 
    dir1 = gameResRoot
    dir2 = streamingAssetsUnity+"/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)

    # ios
    # dir2 = rootiOSXcode+"/Data/Raw/"+dirname
    # flag = os.path.exists(dir2)
    # if flag:
    #     shutil.rmtree(dir2)
    # shutil.copytree(dir1,dir2)

   # android asset
    dir2 = rootAndroidStudio+"/src/main/assets/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)


 # copy GameData 游戏配置等数据 
    dirname = "GameData"

    # unity editor 
    dir1 = gameDataRoot
    dir2 = streamingAssetsUnity+"/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)

    # ios
    # dir2 = rootiOSXcode+"/Data/Raw/"+dirname
    # flag = os.path.exists(dir2)
    # if flag:
    #     shutil.rmtree(dir2)
    # shutil.copytree(dir1,dir2)

   # android asset
    dir2 = rootAndroidStudio+"/src/main/assets/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)


    dirname = "GameData/common"

    # unity editor 
    dir1 = gameDataCommonRoot
    dir2 = streamingAssetsUnity+"/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)

    # ios
    # dir2 = rootiOSXcode+"/Data/Raw/"+dirname
    # flag = os.path.exists(dir2)
    # if flag:
    #     shutil.rmtree(dir2)
    # shutil.copytree(dir1,dir2)

   # android asset
    dir2 = rootAndroidStudio+"/src/main/assets/"+dirname
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    shutil.copytree(dir1,dir2)

    CopyConfigDataToAndroid()