mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 09:01:45 +00:00
Add: Screen size check
This commit is contained in:
parent
c01a075554
commit
a8333f55d4
@ -18,6 +18,7 @@ class Connection:
|
|||||||
self.serial = str(self.config.SERIAL)
|
self.serial = str(self.config.SERIAL)
|
||||||
self.device = self.connect(self.serial)
|
self.device = self.connect(self.serial)
|
||||||
self.disable_uiautomator2_auto_quit()
|
self.disable_uiautomator2_auto_quit()
|
||||||
|
self.check_screen_size()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def adb_command(cmd, serial=None):
|
def adb_command(cmd, serial=None):
|
||||||
@ -61,3 +62,19 @@ class Connection:
|
|||||||
def disable_uiautomator2_auto_quit(self, port=7912, expire=300000):
|
def disable_uiautomator2_auto_quit(self, port=7912, expire=300000):
|
||||||
self.adb_command(['forward', 'tcp:%s' % port, 'tcp:%s' % port], serial=self.serial)
|
self.adb_command(['forward', 'tcp:%s' % port, 'tcp:%s' % port], serial=self.serial)
|
||||||
requests.post('http://127.0.0.1:%s/newCommandTimeout' % port, data=str(expire))
|
requests.post('http://127.0.0.1:%s/newCommandTimeout' % port, data=str(expire))
|
||||||
|
|
||||||
|
def check_screen_size(self):
|
||||||
|
info = self.device._request("get", '/info').json()
|
||||||
|
width, height = info['display']['width'], info['display']['height']
|
||||||
|
if height > width:
|
||||||
|
width, height = height, width
|
||||||
|
|
||||||
|
logger.attr('Screen_size', f'{width}x{height}')
|
||||||
|
|
||||||
|
if width == 1280 and height == 720:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logger.warning(f'Not supported screen size: {width}x{height}')
|
||||||
|
logger.warning('Alas requires 1280x720')
|
||||||
|
logger.hr('Script end')
|
||||||
|
exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user