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 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)
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()
def UpLoadSignAndroid(self): webcmd = WebDriverCmd(self.driver) # E:\Users\moon\Downloads if Platform.isWindowsSystem(): downloadDir = "C:\\Users\\moon\\Downloads" if Platform.isMacSystem(): downloadDir = "/Users/moon/Downloads" self.DeleteAllDownloadFile(downloadDir, ".apk") # 下载空包 E:\Users\moon\Downloads\mssp-verify-b8920a35.apk key = "//button[@class='veui-button bottom20']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(3) apk_unsign = self.GetDownloadFile(downloadDir, ".apk") apk_sign = mainResource.GetProjectOutPut() + "/mssp_baidu/signed.apk" FileUtil.CreateDir(FileUtil.GetLastDirofDir(apk_sign)) jks = mainResource.GetDirProductCommon() + "/Ad/moonma.jks" if Platform.isWindowsSystem(): # sign apk: # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai" if Platform.isMacSystem(): # sign apk: # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai" print(cmd) os.system(cmd) time.sleep(1) # sign end # 滚动到浏览器顶部 js_top = "var q=document.documentElement.scrollTop=0" # 滚动到浏览器底部 js_bottom = "var q=document.documentElement.scrollTop=document.documentElement.scrollHeight" self.driver.execute_script(js_bottom) time.sleep(2) # 上传签名包 # key = "//input[@accept='.apk' and @name='file']" key = "//label[@class='veui-button veui-uploader-input-label']" item = webcmd.AddCmd(CmdType.CLICK_Action, key) # webcmd.SetItemVisible(item) webcmd.Run(True) self.OpenFileBrowser(apk_sign)
def CopyInAppPurchasesScreenshot(self, isHd): # src =mainResource.GetProjectConfig() + "/default/appstore/in_app_purchases_screenshot.png" src = mainResource.GetDirProductCommon( ) + "/in_app_purchases_screenshot.png" rootConfig = mainResource.GetProjectConfigApp() dst = rootConfig + "/appstore/ios/app.itmsp" if isHd: dst = rootConfig + "/appstore/ios/app_pad.itmsp" dst = dst + "/in_app_purchases_screenshot.png" if not os.path.isfile(dst): shutil.copyfile(src, dst)
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 CopyExportOptionsPlist(self): src =mainResource.GetDirProductCommon() + "/ExportOptions.plist" dst =mainResource.GetRootProjectIos() + "/ExportOptions.plist" if not os.path.isfile(dst): shutil.copyfile(src,dst)
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()