def Run(self, isHd): print("UpdateAppstore Run") gameName = mainResource.getGameName() gameType = mainResource.getGameType() print(gameName) print(gameType) if len(sys.argv) > 2: if sys.argv[2] == "delete_screenshot": # delete_screenshots() sys.exit(0) #先从default 拷贝 文件模版 dir_default = mainResource.GetProjectConfigDefault() dir_to = mainResource.GetProjectConfigApp() dir1 = dir_default + "/appstore" dir2 = dir_to + "/appstore" flag = os.path.exists(dir2) print("UpdateAppstore dir1=" + dir1 + "dir2=" + dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) # self.copy_screenshots() self.updateAppstore(isHd) # self.updateAppstore(True) print("UpdateAppstore sucess")
def Run(self, platform, channel, isHD): print("Build Run platform=" + platform + " channel=" + channel + " isHD=" + str(isHD)) self.Init(channel) gameName = mainResource.getGameName() gameType = mainResource.getGameType() print("gameName=" + gameName) print("gameType=" + gameType) if platform == Source.ANDROID: # python 里无法直接执行cd目录,想要用chdir改变当前的工作目录 android_studio_dir = mainResource.GetRootDirAndroidStudio() # python 里无法直接执行cd目录,要用chdir改变当前的工作目录 os.chdir(android_studio_dir) for channel in self.listChannel: print("apk_build:" + channel) self.BuildClean() mainAppChannel.UpdateChannel(channel, isHD) self.BuildApk() self.CopyApk(channel) if platform == Source.MinProgram: self.DeleteCloudRes() if channel == Source.WEIXIN2: self.BuildProject(isHD, Source.WEIXIN) else: self.GenerateProject(isHD, channel) self.BuildProject(isHD, channel) print("Build sucess channel=" + channel)
def CreateApp(self, isHD): # ad.GoHome(isHD) time.sleep(1) print(" gp CreateApp") package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) name = mainAppInfo.GetAppName(Source.IOS, isHD, Source.LANGUAGE_EN) gameName = mainResource.getGameName() gameType = mainResource.getGameType() #self.driver.get(self.HTTP_HEAD+"GooglePlayDeveloperAPI/CreateApp?package="+package+"&name="+name+"&apptype="+gameType+"&appkey="+gameName+"&path="+mainResource.cmdPath) mainAppStoreGoogleInternal.Run("createapp", isHD)
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)
def Run(self, type): gameName = mainResource.getGameName() gameType = mainResource.getGameType() if type == "save": self.SaveCode() self.SaveCodeMain() if type == "copy": self.CopyCode() self.CopyCodeMain()
def MakeGuideDoc(self, isHd): title = mainAppInfo.GetAppName(Source.ANDROID, isHd, Source.LANGUAGE_CN) + "V1.0.0" detail = mainAppInfo.GetAppDetail(isHd, Source.LANGUAGE_CN) # detail +="/n" detail += mainAppInfo.GetAppDetail(isHd, Source.LANGUAGE_EN) outputdir = mainResource.GetProjectOutPutApp() FileUtil.CreateDir(outputdir) docoutput = outputdir + "/" + mainResource.getGameType( ) + "_guide.docx" dirscreenshot = mainResource.GetProjectOutPutApp( ) + "/screenshot/shu/cn/1080p" filedetail = mainResource.GetProjectConfigApp( ) + "/appinfo/app_description.xml" if isHd: dirscreenshot = mainResource.GetProjectOutPutApp( ) + "/screenshot/heng/cn/1080p" filedetail = mainResource.GetProjectConfigApp( ) + "/appinfo/app_description_hd.xml" docoutput = outputdir + "/" + mainResource.getGameType( ) + "_guide_hd.docx" filedst = dirscreenshot + "/detail.xml" FileUtil.SaveString2File(detail, filedst) # FileUtil.CopyFile(filedetail,filedst) cmd = "pyerz -e xml -i " + dirscreenshot + " -o " + docoutput + " -t " + title + " --font-size 16 --space-before 2 --space-after 10 --line-spacing 16 " # print("cmd=",cmd) for i in range(5): pic = dirscreenshot + "/" + str(i + 1) + ".jpg" if os.path.exists(pic): cmd += " -pic " + pic os.system(cmd) os.remove(filedst) self.WordToPdf(docoutput)
def DoCopyGameData(self): gameName = mainResource.getGameName() gameType = mainResource.getGameType() print(gameName) print(gameType) resDataName = mainResource.getGameName()#sys.argv[1] gameResName = self.getGameResName() gameResCommonRoot = mainResource.GetDirProductCommon()+"/GameResCommon"+"/"+gameResName gameResRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameRes" flag = os.path.exists(gameResRoot) if not flag: #目录不存在的话到gamerescommon里copy gameResRoot = gameResCommonRoot gameDataCommonRoot = mainResource.GetDirProductCommon()+"/GameDataCommon" gameDataRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameData" # streamingAssetsUnity = mainResource.GetRootProjectUnity()+"/Assets/StreamingAssets" rootAndroidStudio =mainResource.GetRootDirAndroidStudio() rootiOSXcode =mainResource.GetRootDirXcode() # 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"
def Run(self): gameType = mainResource.getGameType() gameName = mainResource.getGameName() rootAndroidStudio = mainResource.GetRootDirAndroidStudio() # android asset dir_asset = "/src/main/assets/bin" dir1 = mainResource.GetRootDirAndroidOutput() + dir_asset dir2 = rootAndroidStudio + dir_asset flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) dir_asset = "/src/main/assets/baidu_tts_data" dir1 = mainResource.GetRootDirAndroidOutput() + dir_asset dir2 = rootAndroidStudio + dir_asset flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) # android jniLibs dir_asset = "/src/main/jniLibs" dir1 = mainResource.GetRootDirAndroidOutput() + dir_asset dir2 = rootAndroidStudio + dir_asset flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) filename = "/libs/unity-classes.jar" shutil.copy2(mainResource.GetRootDirAndroidOutput() + filename, rootAndroidStudio + filename) dataJson = self.LoadJsonAndroidAssetConfigCommon() appNameAndroidAsset = dataJson["APP_NAME_KEYWORD"] appTypeAndroidAsset = dataJson["APP_TYPE"] print(appTypeAndroidAsset) print(appNameAndroidAsset) if appTypeAndroidAsset != gameType or appNameAndroidAsset != gameName: print("mainCopyGamedata DoCopyAll") mainCopyGamedata.DoCopyAll() self.CopyConfigDataToAndroid() print("copy_android_output_asset sucess")
def CopyApk(self,channel): gameName = mainResource.getGameName() gameType = mainResource.getGameType() # copy2 同时复制文件权限 dirapk = mainResource.GetProjectOutPutApp() + "/apk" if mainResource.AppForPad(False): dirapk+="/heng" gameName += "_hd" else: dirapk+="/shu" if not os.path.exists(dirapk): os.makedirs(dirapk) shutil.copy2(mainResource.getAndroidProjectApk(), dirapk + "/" + gameType + "_" + gameName + "_" + channel + ".apk")
def Run(self,channel,isHD): self.Init(channel) gameName = mainResource.getGameName() gameType = mainResource.getGameType() print("ApkBuild isHD="+str(isHD)) print("gameName="+gameName) print ("gameType="+gameType) print(mainResource.getAndroidProjectApk()) # python 里无法直接执行cd目录,想要用chdir改变当前的工作目录 android_studio_dir = mainResource.GetRootDirAndroidStudio() # python 里无法直接执行cd目录,要用chdir改变当前的工作目录 os.chdir(android_studio_dir) for channel in self.listChannel: print("apk_build:" + channel) self.BuildClean() mainAppChannel.UpdateChannel(channel,isHD) self.BuildApk() self.CopyApk(channel) print("apk_build sucess channel="+channel)
def Run(self): gameName = mainResource.getGameName() gameType = mainResource.getGameType() print(gameName) print(gameType) resDataName = mainResource.getGameName()#sys.argv[1] gameResName = self.getGameResName() gameResCommonRoot = mainResource.GetDirProductCommon()+"/GameResCommon"+"/"+gameResName gameResRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameRes" flag = os.path.exists(gameResRoot) if not flag: #目录不存在的话到gamerescommon里copy gameResRoot = gameResCommonRoot; gameDataRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameData" streamingAssetsUnity = mainResource.GetRootProjectUnity()+"/Assets/StreamingAssets" rootAndroidStudio = mainResource.GetRootDirAndroidStudio() rootiOSXcode =mainResource.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) if flag: shutil.rmtree(dir2) print("clean_screenshot sucess")
def Run(self): # resoucedata gameType = mainResource.getGameType() gameName = mainResource.getGameName() dir1 = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/"+Source.Dir_Name_Resources+"/App" dir2 = mainResource.GetRootUnityAssetsResource()+"/App" flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) print("copytree dir2 =",dir2) shutil.copytree(dir1,dir2) # AppCommon dir1 = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+"AppCommon/"+Source.Dir_Name_Resources dir2 = mainResource.GetRootUnityAssetsResource()+"/AppCommon" FileUtil.CopyDir(dir1,dir2) self.CopyResConfigData() # self.CopyPlugins() print ("copy_resource sucess")
def Run(self): gameType = mainResource.getGameType() gameName = mainResource.getGameName() configDirUnity = mainResource.GetRootUnityAssetsResource( ) + "/ConfigData/config" configAppType = mainConfig.GetConfigAppType(configDirUnity) configAppName = mainConfig.GetConfigAppName(configDirUnity) print("unity:" + configAppType + " " + configAppName) if gameType != configAppType or gameName != configAppName: print("check app type and name fail") sys.exit(0) dir1 = mainResource.GetRootUnityAssetsResource() + "/App" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + gameName + "/" + Source.Dir_Name_Resources + "/App" flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) # AppCommon dir1 = mainResource.GetRootUnityAssetsResource() + "/AppCommon" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + "AppCommon/" + Source.Dir_Name_Resources flag = os.path.exists(dir2) FileUtil.CopyDir(dir1, dir2) # ConfigData dir1 = mainResource.GetRootUnityAssetsResource() + "/ConfigData" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + gameName + "/ConfigData" flag = os.path.exists(dir2) FileUtil.CopyDir(dir1, dir2) print("save_resource sucess")
def UpdateApk(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) gameName = mainResource.getGameName() gameType = mainResource.getGameType() mainAppStoreGoogleInternal.Run("UpdateApk", isHD)
def GetFileSourceCodeZipMain(self): return self.GetDirScriptApps( ) + "/CodeZip/" + mainResource.getGameType() + "_Main.zip"
def GetDirSourceCode(self): return self.GetDirScriptApps() + "/" + mainResource.getGameType()
def DoCopyAll(self): gameName = mainResource.getGameName() gameType = mainResource.getGameType() print(gameName) print(gameType) resDataName = mainResource.getGameName()#sys.argv[1] gameResName = self.getGameResName() gameResCommonRoot = mainResource.GetDirProductCommon()+"/GameResCommon"+"/"+gameResName gameResRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameRes" flag = os.path.exists(gameResRoot) if not flag: #目录不存在的话到gamerescommon里copy gameResRoot = gameResCommonRoot gameDataCommonRoot = mainResource.GetDirProductCommon()+"/GameDataCommon" gameDataRoot = mainResource.GetResourceDataRoot()+"/"+gameType+"/"+gameName+"/GameData" rootAndroidStudio =mainResource.GetRootDirAndroidStudio() rootiOSXcode =mainResource.GetRootDirXcode() # copy GameRes 游戏图片等资源 dirname = "GameRes" # unity editor dir1 = gameResRoot dir2 = mainResource.GetRootUnityAssetsResource()+"/"+dirname flag = os.path.exists(dir2) print("GameRes dir1="+dir1+" dir2="+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) print("gamedata dir2=",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) self.CopyConfigDataToAndroid()