zoukankan      html  css  js  c++  java
  • wz

    chcp 437
    monkeyrunner wz.py
    wz.bat
    #coding=utf-8
    from com.android.monkeyrunner import MonkeyDevice,MonkeyRunner
    import traceback
    
    class AutoPlayer:
        def __init__(self):
            self.count = 1
            self.driver = MonkeyRunner.waitForConnection()
            print type(self.driver)
            self.screen_width = self.driver.getProperty('display.width')
            self.screen_height = self.driver.getProperty('display.height')
            print '%s,height:%s'%(self.screen_width,self.screen_height)
            self.skip_point_x = int(self.screen_width)*1600/1920
            self.skip_point_y = int(self.screen_height)*960/1080
            self.start_point_x = int(self.screen_width)*1710/1920
            self.start_point_y = int(self.screen_height)*100/1080
            print 'skip_point_x:%d,skip_point_y:%d'%(self.skip_point_x,self.skip_point_y)
            print 'start_point_x:%d,start_point_y:%d'%(self.start_point_x,self.start_point_y)
            self.driver.startActivity(component = "com.tencent.tmgp.sgame/com.tencent.tmgp.sgame.SGameActivity")
        def auto_play(self):
            while True :
                try:
                    print 'touch count:%d ,touch postion x:%d ,y:%d'%(self.count,self.skip_point_x,self.skip_point_y )
                    #driver.wake()
                    self.driver.touch(self.skip_point_x,self.skip_point_y,MonkeyDevice.DOWN_AND_UP)
                    MonkeyRunner.sleep(1)
                    print 'touch count:%d ,touch postion x1:%d ,y1:%d'%(self.count,self.start_point_x,self.start_point_y)
                    self.driver.touch(self.start_point_x,self.start_point_y,MonkeyDevice.DOWN_AND_UP)
                    MonkeyRunner.sleep(3)
                    self.count = self.count+1
                except BaseException,e:
                    print traceback.print_exc()
    if __name__ == '__main__':
        auto_player_1 = ''
        while True:
            try:
                auto_player_1 = AutoPlayer()
                auto_player_1.auto_play()
            except BaseException,e:
                print traceback.print_exc()
                auto_player_1 = AutoPlayer()
                auto_player_1.auto_play()
            
    wz.py
  • 相关阅读:
    checkbox判断选中的三种方法
    bzoj 4031: [HEOI2015]小Z的房间
    bzoj 5056: OI游戏
    Hdoj 5181 numbers
    Loj #6164. 「美团 CodeM 初赛 Round A」数列互质
    Codeforces 869 C The Intriguing Obsession
    Loj #6142. 「2017 山东三轮集训 Day6」A
    bzoj 3714: [PA2014]Kuglarz
    Loj #6185. 烷基计数
    [HNOI2008]水平可见直线
  • 原文地址:https://www.cnblogs.com/xiaodebing/p/10036167.html
Copyright © 2011-2022 走看看