Пример #1
0
    def ScanPrefabFile(self, dir, filejson):
        if not os.path.exists(dir):
            return
        listFile = []

        dirsave = FileUtil.GetLastDirofDir(filejson)
        FileUtil.CreateDir((dirsave))

        FileUtil.GetFileList(dir, "prefab", listFile)

        dataRoot = json.loads("{}")
        #        "BtnIconPlay" : {
        #     "path" : "App/UI/Common/Button/BtnIconPlay.png"
        # },
        for fileimage in listFile:
            # item= json.loads("{}")
            filepath = fileimage.replace(
                mainResource.GetRootUnityAssets() + "/", "")
            # item["path"]=filepath
            name = FileUtil.GetPathNameWithoutExt(fileimage)
            dataRoot[name] = filepath

        json_str = json.dumps(dataRoot,
                              ensure_ascii=False,
                              indent=4,
                              sort_keys=True)
        FileUtil.SaveString2File(json_str, filejson)
Пример #2
0
    def ConfigiOSAdkitCode(self,source_ad):
        dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS"
        dirCodeAdkitPlatform = dirRoot+"/Common/AdKit/Platform"

        FileUtil.RemoveDir(dirCodeAdkitPlatform+"/"+source_ad)
        if not self.IsNoIDFASDK():
            zipfile = dirCodeAdkitPlatform+"/"+source_ad+".zip"
            ZipUtil.un_zip(zipfile,dirCodeAdkitPlatform)
Пример #3
0
 def SaveCommonScript(self):
     listname = {"AppBase", "Common"}
     for name in listname:
         src = mainResource.GetRootUnityAssets()+"/Script/"+name
         dst = mainResource.GetDirProductCommon()+"/ProjectUnity/Assets/Script/"+name
         print(src)
         print(dst)
         FileUtil.CopyDir(src, dst)
Пример #4
0
    def ScanImageFile(self, dir, filejson):
        # if not os.path.exists(dir):
        #     return

        listFile = []
        if os.path.exists(dir):
            FileUtil.GetFileList(dir, "png", listFile)
            FileUtil.GetFileList(dir, "jpg", listFile)
            print("listFile len=" + str(len(listFile)))
        dataRootOld = None
        if os.path.exists(filejson) == True:
            print("filejson = " + filejson)
            strfile = FileUtil.GetFileString(filejson)
            # print("strfile = "+strfile)
            dataRootOld = json.loads(strfile)
            if dataRootOld is None:
                print("dataRootOld is  none")
                print("strfile = " + strfile)
            # remove
            os.remove(filejson)

        dataRoot = json.loads("{}")
        #        "BtnIconPlay" : {
        #     "path" : "App/UI/Common/Button/BtnIconPlay.png"
        # },
        for fileimage in listFile:

            item = json.loads("{}")
            filepath = fileimage.replace(
                mainResource.GetRootUnityAssets() + "/", "")
            filepath = filepath.replace(self.dirCloudResHead, "")

            item["path"] = filepath
            name = FileUtil.GetPathNameWithoutExt(fileimage)

            # 从原来的json中恢复board
            if dataRootOld is not None:
                # print("dataRootOld is not none")
                if name in dataRootOld:
                    # print("dataRootOld  name="+name)
                    dataitem = dataRootOld[name]
                    key = "board"
                    # key = "path"
                    # if name =="BtnCommon":
                    #     # key = "board"
                    #     print("dataitem[key] = "+dataitem[key]+" name="+name)

                    if key in dataitem:
                        print("key = " + key + " name=" + name)
                        item[key] = dataitem[key]

            dataRoot[name] = item

        json_str = json.dumps(dataRoot,
                              ensure_ascii=False,
                              indent=4,
                              sort_keys=True)
        FileUtil.SaveString2File(json_str, filejson)
Пример #5
0
    def ConfigiOSLib(self,source_lib):
        dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS"
        dirLib = dirRoot+"/ThirdParty"

        FileUtil.RemoveDir(dirLib+"/"+source_lib)
        if not self.IsNoIDFASDK():
            zipfile = dirLib+"/"+source_lib+".zip"
            ZipUtil.un_zip(zipfile,dirLib)

        self.DeleteMACOSX(dirLib)
Пример #6
0
    def CopyPlugins(self):
        dirname = "Plugins"
        dir1 = mainResource.GetDirProductCommon()+"/"+dirname
        dir2 = mainResource.GetRootUnityAssets()+"/"+dirname
        flag = os.path.exists(dir2)
        if not flag:
            # shutil.rmtree(dir2)
            shutil.copytree(dir1,dir2)

        self.ConfigiOSPluginsCode()
Пример #7
0
    def ConfigiOSPluginsCode(self):
        dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS"
        dirCodeCommon = dirRoot+"/Common"
 
        dirCodeAdkit = dirRoot+"/Common/AdKit"

        # tongji
        FileUtil.RemoveDir(dirCodeCommon+"/Tongji")
        zipfile = dirCodeCommon+"/Tongji.zip" 
        if self.IsNoIDFASDK(): 
            zipfile = dirCodeCommon+"/Tongji_NoSDK.zip" 
        flag = os.path.exists(zipfile)
        if flag:
            ZipUtil.un_zip(zipfile,dirCodeCommon)

        # share
        FileUtil.RemoveDir(dirCodeCommon+"/Share")
        zipfile = dirCodeCommon+"/Share.zip" 
        if self.IsNoIDFASDK(): 
            zipfile = dirCodeCommon+"/Share_NoSDK.zip" 
        flag = os.path.exists(zipfile)
        if flag:
            ZipUtil.un_zip(zipfile,dirCodeCommon)


        # adconfig
        FileUtil.RemoveDir(dirCodeAdkit+"/AdConfig")
        zipfile = dirCodeAdkit+"/AdConfig.zip" 
        if self.IsNoIDFASDK(): 
            zipfile = dirCodeAdkit+"/AdConfig_NoSDK.zip" 
        flag = os.path.exists(zipfile)
        if flag:
            ZipUtil.un_zip(zipfile,dirCodeAdkit)



        # adkit
        self.ConfigiOSLib(Source.GDT)
        self.ConfigiOSLib(Source.BAIDU)
        self.ConfigiOSLib(Source.ADMOB)
        self.ConfigiOSLib(Source.CHSJ)
        self.ConfigiOSLib(Source.UNITY)
        self.ConfigiOSLib(Source.UMENG)

        self.ConfigiOSAdkitCode(Source.GDT)
        self.ConfigiOSAdkitCode(Source.BAIDU)
        self.ConfigiOSAdkitCode(Source.ADMOB)
        self.ConfigiOSAdkitCode(Source.CHSJ)
        self.ConfigiOSAdkitCode(Source.UNITY) 
Пример #8
0
    def MakeCodeDoc(self, isHd):
        title = mainAppInfo.GetAppName(Source.ANDROID, isHd,
                                       Source.LANGUAGE_CN) + "V1.0.0"
        codedir = "/Users/moon/sourcecode/LearnWord"
        codedir = mainResource.GetRootUnityAssets(
        ) + "/Script/Apps/" + mainResource.getGameType()
        # codedir = mainResource.GetRootUnityAssets()+"/Script/Apps/"+mainResource.getGameType()+"/Base"
        outputdir = mainResource.GetProjectOutPutApp()
        FileUtil.CreateDir(outputdir)

        docoutput = outputdir + "/" + mainResource.getGameType() + ".docx"
        if isHd:
            docoutput = outputdir + "/" + mainResource.getGameType(
            ) + "_HD.docx"

        os.system("pyerz -e cs -i " + codedir + " -o " + docoutput + " -t " +
                  title)

        self.WordToPdf(docoutput)