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) 
Beispiel #2
0
    def GenerateProject(self, isHD, channel):
        name = self.GetProjectName(channel)
        # cloudres
        # output
        dir = mainResource.GetRootCocosBuildOutput() + "/" + name
        FileUtil.RemoveDir(dir)

        # 0f6 2f1
        UNITYPATH = ""
        if Platform.isWindowsSystem():
            # UNITYPATH="E:/Unity/"+Source.UNITY_VERSION_WIN+"/Editor/Unity.exe"
            UNITYPATH = "CocosCreator.exe"
        else:
            # UNITYPATH="/Applications/Unity/Hub/Editor/"+Source.UNITY_VERSION_MAC+"/Unity.app/Contents/MacOS/Unity"
            UNITYPATH = "/Applications/CocosCreator/Creator/" + Source.Cocos_Version + "/CocosCreator.app/Contents/MacOS/CocosCreator"
            #  --project projectPath--build "platform=web-desktop;debug=true"

        appid = mainAppInfo.GetAppId(isHD, channel)
        PROJECT_PATH = mainResource.GetRootProjectUnity()
        # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform=wechatgame;debug=false\""

        # package = "packages: { wechatgame: {appid: '*****',}}"
        package = "packages: { wechatgame: {appid: '" + appid + "',}}"
        # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform="+name+";debug=false;packages="+package+"\""
        cmd = UNITYPATH + " --project " + PROJECT_PATH + " --build " + "\"platform=" + name + ";debug=false" + "\""

        print("BuildWeixin  cmd=" + cmd)
        # ps = subprocess.Popen(cmd)
        # ps.wait()#让程序阻塞
        os.system(cmd)

        print("BuildWeixin  end")
    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)
    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)
Beispiel #5
0
 def DeleteCloudRes(self):
     dir = mainResource.GetRootUnityAssetsResource() + "/GameRes/CloudRes"
     FileUtil.RemoveDir(dir)
     file = mainResource.GetRootUnityAssetsResource(
     ) + "/GameRes/CloudRes.zip"
     FileUtil.RemoveFile(file)