def skipInterstitial(self, isReport=False): ''' 跳过插屏广告 若无插屏广告返回False 若有插屏广告, 关闭插屏广告并放回True ''' sleep(4) checkpoint_list = [ [ self.getPoco(self.eCheckPoint["OrdinaryInterstitial_Exist"]), self.getPoco(self.eCheckPoint["OrdinaryInterstitial_Close"]), "检测到普通插屏(Poco)" ], [ self.getPoco(self.eCheckPoint["NativeInterstitial_Exist"]), self.getPoco(self.eCheckPoint["NativeInterstitial_Close"]), "检测到原生插屏(Poco)" ], [ self.getPoco_default( self.eCheckPoint["OrdinaryInterstitial_Exist"]), self.getPoco_default( self.eCheckPoint["OrdinaryInterstitial_Close"]), "检测到普通插屏(Default_Poco)" ], [ self.getImage(self.eCheckPoint["OrdinaryInterstitial_Exist"]), self.getImage(self.eCheckPoint["OrdinaryInterstitial_Close"]), "检测到普通插屏(图像)" ], [ self.Game.nativeInterstitial, self.Game.nativeInterstitialClose, "检测到原生插屏(图像)" ], [ self.getImage_default( self.eCheckPoint["OrdinaryInterstitial_Exist"]), self.getImage_default( self.eCheckPoint["OrdinaryInterstitial_Close"]), "检测到普通插屏(Default_图像)" ] ] for exist, close, msg in checkpoint_list: pos = exists_any(exist) if (pos != False): self.Reporter.report(msg, isReport_caller=isReport) pos = exists_any(close) if (pos != False): touch(pos) else: keyevent("BACK") return True # 无插屏 if (isReport): self.Reporter.report("未显示插屏广告") return False
def skipVideo(self, isReport=False): ''' 跳过视频 若无视频播放, 返回False 若有视频播放, 等待视频结束并返回True ''' sleep(40) checkpoint_list = [ [self.getPoco(self.eCheckPoint["Video_Close"]), "检测到视频(Poco)"], [ self.getPoco_default(self.eCheckPoint["Video_Close"]), "检测到视频(Default_Poco)" ], [self.getImage(self.eCheckPoint["Video_Close"]), "检测到视频(图片)"], [ self.getImage_default(self.eCheckPoint["Video_Close"]), "检测到视频(Default_图片)" ] ] for close, msg in checkpoint_list: pos = exists_any(close) if (pos != False): self.Reporter.report(msg, isReport_caller=isReport) touch(pos) return True # No video exists if isReport: self.Reporter.report("未检测到视频") return False
def login(self): sleep(20) for i in range(1, 10): pos = exists_any([Template(r"tpl1568883448109.png", record_pos=(0.381, 0.02), resolution=(1080, 1920)), Template(r"tpl1568883477317.png", record_pos=(-0.397, 0.765), resolution=(1080, 1920))]) if (pos != False): break else: keyevent("BACK") sleep(2)
def isSplashExists(self, isReport=False): ''' 开屏是否存在 ''' # 普通开屏(Poco) pos = exists_any(self.getPoco( self.eCheckPoint["OrdinarySplash_Exist"])) if (pos != False): self.Reporter.report("检测到普通开屏(Poco)", isReport_caller=isReport) sleep(10) return True # 原生开屏(Poco) pos = exists_any(self.getPoco(self.eCheckPoint["NativeSplash_Exist"])) if (pos != False): self.Reporter.report("检测到原生开屏(Poco)", isReport_caller=isReport) sleep(10) return True # 普通开屏(Default_Poco) pos = exists_any( self.getPoco_default(self.eCheckPoint["OrdinarySplash_Exist"])) if (pos != False): self.Reporter.report("检测到普通开屏(Default_Poco)", isReport_caller=isReport) sleep(10) return True # 普通开屏(图片) pos = exists_any( self.getImage(self.eCheckPoint["OrdinarySplash_Exist"])) if (pos != False): self.Reporter.report("检测到普通开屏(图片)", isReport_caller=isReport) sleep(10) return True # 原生开屏(图片) pos = exists_any(self.Game.nativeSplash) if (pos != False): self.Reporter.report("检测到原生开屏(图片)", isReport_caller=isReport) sleep(10) return True # 普通开屏(Default_图片) pos = exists_any( self.getImage_default(self.eCheckPoint["OrdinarySplash_Exist"])) if (pos != False): self.Reporter.report("检测到普通开屏(Default_图片)", isReport_caller=isReport) sleep(10) return True # 无开屏 self.Reporter.report("未检测到开屏", isReport_caller=isReport) return False
def isBannerExists(self, isReport=False): ''' Banner 是否存在 若存在, 则输出存在并返回True 若不存在则返回False ''' checkpoint_list = [ [self.Game.nativeBanner, "检测到原生Banner(图片)"], [ self.getPoco(self.eCheckPoint["OrdinaryBanner_Exist"]), "检测到普通Banner(Poco)" ], [ self.getPoco(self.eCheckPoint["NativeBanner_Exist"]), "检测到原生Banner(Poco)" ], [ self.getPoco_default(self.eCheckPoint["OrdinaryBanner_Exist"]), "检测到普通Banner(Default_Poco)" ], [ self.getImage(self.eCheckPoint["OrdinaryBanner_Exist"]), "检测到普通Banner(图片)" ], [ self.getImage_default( self.eCheckPoint["OrdinaryBanner_Exist"]), "检测到普通Banner(Default_图片)" ] ] for c, msg in checkpoint_list: pos = exists_any(c) if (pos != False): self.Reporter.report(msg, isReport_caller=isReport) return # 无Banner self.Reporter.report("未显示Banner", isReport_caller=isReport) return False
def login(self): sleep(20) for i in range(0, 10): sleep(5) pos = exists( Template(r"tpl1568625811370.png", record_pos=(0.0, -0.002), resolution=(1080, 1920))) if (pos != False): touch( Template(r"tpl1568625827803.png", record_pos=(-0.215, 0.144), resolution=(1080, 1920))) sleep(1) continue pos = exists( Template(r"tpl1568275354110.png", record_pos=(0.001, 0.033), resolution=(1080, 1920))) if (pos != False): touch( Template(r"tpl1568275375109.png", record_pos=(0.219, 0.219), resolution=(1080, 1920))) sleep(0.5) keyevent("BACK") sleep(0.5) continue pos = exists_any([ Template(r"tpl1568883448109.png", record_pos=(0.381, 0.02), resolution=(1080, 1920)), Template(r"tpl1568883477317.png", record_pos=(-0.397, 0.765), resolution=(1080, 1920)) ]) if (pos != False): break keyevent("BACK") self.Game.skip_beginner_gift()