Ejemplo n.º 1
0
    def BuildProject(self, isHD, channel):
        name = self.GetProjectName(channel)
        dirproject = mainResource.GetRootCocosBuildOutput() + "/" + name
        appid = mainAppInfo.GetAppId(isHD, channel)
        if name == Source.ProjectNameMiniGameWeixin or name == Source.ProjectNameMiniGameByte:
            filepath = mainResource.GetProjectConfigDefault(
            ) + "/" + name + "/game.json"
            strfile = FileUtil.GetFileString(filepath)
            strfile = strfile.replace("_Orientation_", "portrait")
            filepath = dirproject + "/game.json"
            FileUtil.RemoveFile(filepath)
            FileUtil.SaveString2File(strfile, filepath)

            filepath = mainResource.GetProjectConfigDefault(
            ) + "/" + name + "/project.config.json"
            strfile = FileUtil.GetFileString(filepath)
            print("BuildWeixin  appid=" + appid)
            # wx3e44af039aee1b96
            strfile = strfile.replace("_APPID_", appid)
            # print("BuildWeixin  strfile="+strfile)
            filepath = dirproject + "/project.config.json"
            FileUtil.RemoveFile(filepath)
            FileUtil.SaveString2File(strfile, filepath)

        # python 里无法直接执行cd目录,要用chdir改变当前的工作目录
        if os.path.exists(dirproject):
            os.chdir(dirproject)
        print("dirproject:" + dirproject)
        if name == Source.ProjectNameMiniGameVivo:
            os.system("npm install")
            os.system("npm run build")
Ejemplo n.º 2
0
 def DeleteCloudRes(self):
     dir = mainResource.GetRootUnityAssetsResource() + "/GameRes/CloudRes"
     FileUtil.RemoveDir(dir)
     file = mainResource.GetRootUnityAssetsResource(
     ) + "/GameRes/CloudRes.zip"
     FileUtil.RemoveFile(file)