Add Game Manager (WIP), currently only force close and restart games are implemented.

This commit is contained in:
SaigyoujiYukon 2021-12-14 21:38:05 +08:00
parent 73b7748a07
commit ffd2ed1e25
12 changed files with 89 additions and 4 deletions

View File

@ -1424,5 +1424,10 @@
"AzurLaneUncensored": { "AzurLaneUncensored": {
"Repository": "https://gitee.com/LmeSzinc/AzurLaneUncensored" "Repository": "https://gitee.com/LmeSzinc/AzurLaneUncensored"
} }
},
"GameManager": {
"GameManager": {
"AutoRestart": true
}
} }
} }

4
gui.py
View File

@ -128,6 +128,10 @@ class AlasManager:
from module.daemon.benchmark import Benchmark from module.daemon.benchmark import Benchmark
Benchmark(config=config_name, task='Benchmark').run() Benchmark(config=config_name, task='Benchmark').run()
q.put("Scheduler stopped.\n") # Prevent status turns to warning q.put("Scheduler stopped.\n") # Prevent status turns to warning
elif func == 'GameManager':
from module.daemon.game_manager import GameManager
GameManager(config=config_name, task='GameManager').run()
q.put("Scheduler stopped.\n")
else: else:
logger.critical("No function matched") logger.critical("No function matched")

View File

@ -6397,5 +6397,13 @@
"value": "https://gitee.com/LmeSzinc/AzurLaneUncensored" "value": "https://gitee.com/LmeSzinc/AzurLaneUncensored"
} }
} }
},
"GameManager": {
"GameManager": {
"AutoRestart": {
"type": "checkbox",
"value": true
}
}
} }
} }

View File

@ -468,3 +468,5 @@ Benchmark:
TestClickMethod: true TestClickMethod: true
AzurLaneUncensored: AzurLaneUncensored:
Repository: https://gitee.com/LmeSzinc/AzurLaneUncensored Repository: https://gitee.com/LmeSzinc/AzurLaneUncensored
GameManager:
AutoRestart: true

View File

@ -58,7 +58,8 @@
"Daemon", "Daemon",
"OpsiDaemon", "OpsiDaemon",
"Benchmark", "Benchmark",
"AzurLaneUncensored" "AzurLaneUncensored",
"GameManager"
] ]
} }
} }

View File

@ -239,3 +239,5 @@ Benchmark:
- Benchmark - Benchmark
AzurLaneUncensored: AzurLaneUncensored:
- AzurLaneUncensored - AzurLaneUncensored
GameManager:
- GameManager

View File

@ -336,3 +336,6 @@ class GeneratedConfig:
# Group `AzurLaneUncensored` # Group `AzurLaneUncensored`
AzurLaneUncensored_Repository = 'https://gitee.com/LmeSzinc/AzurLaneUncensored' AzurLaneUncensored_Repository = 'https://gitee.com/LmeSzinc/AzurLaneUncensored'
# Group `GameManager`
GameManager_AutoRestart = True

View File

@ -217,6 +217,10 @@
"AzurLaneUncensored": { "AzurLaneUncensored": {
"name": "[CN] Uncensored Patch", "name": "[CN] Uncensored Patch",
"help": "" "help": ""
},
"GameManager": {
"name": "Game Manager(WIP)",
"help": ""
} }
}, },
"Scheduler": { "Scheduler": {
@ -1721,6 +1725,16 @@
"help": "Do not need to modify\nGithub: <https://github.com/LmeSzinc/AzurLaneUncensored>\nCN mirror: <https://gitee.com/LmeSzinc/AzurLaneUncensored>" "help": "Do not need to modify\nGithub: <https://github.com/LmeSzinc/AzurLaneUncensored>\nCN mirror: <https://gitee.com/LmeSzinc/AzurLaneUncensored>"
} }
}, },
"GameManager": {
"_info": {
"name": "Game Manager",
"help": "This is a semi-finished product, currently only implemented to force close the game and start it after closing."
},
"AutoRestart": {
"name": "Automatic Login",
"help": "Log back into the game when the game has been ended."
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "Install", "Install": "Install",

View File

@ -217,6 +217,10 @@
"AzurLaneUncensored": { "AzurLaneUncensored": {
"name": "Task.AzurLaneUncensored.name", "name": "Task.AzurLaneUncensored.name",
"help": "Task.AzurLaneUncensored.help" "help": "Task.AzurLaneUncensored.help"
},
"GameManager": {
"name": "Task.GameManager.name",
"help": "Task.GameManager.help"
} }
}, },
"Scheduler": { "Scheduler": {
@ -1721,6 +1725,16 @@
"help": "AzurLaneUncensored.Repository.help" "help": "AzurLaneUncensored.Repository.help"
} }
}, },
"GameManager": {
"_info": {
"name": "GameManager._info.name",
"help": "GameManager._info.help"
},
"AutoRestart": {
"name": "GameManager.AutoRestart.name",
"help": "GameManager.AutoRestart.help"
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "Gui.Aside.Install", "Install": "Gui.Aside.Install",

View File

@ -217,6 +217,10 @@
"AzurLaneUncensored": { "AzurLaneUncensored": {
"name": "反和谐", "name": "反和谐",
"help": "" "help": ""
},
"GameManager": {
"name": "游戏管理器(未完成)",
"help": ""
} }
}, },
"Scheduler": { "Scheduler": {
@ -1721,6 +1725,16 @@
"help": "一般不需要修改\n仓库 https://github.com/LmeSzinc/AzurLaneUncensored\n国内镜像默认 https://gitee.com/LmeSzinc/AzurLaneUncensored" "help": "一般不需要修改\n仓库 https://github.com/LmeSzinc/AzurLaneUncensored\n国内镜像默认 https://gitee.com/LmeSzinc/AzurLaneUncensored"
} }
}, },
"GameManager": {
"_info": {
"name": "游戏管理",
"help": "半成品,仅实现了强制关闭游戏,自动登录"
},
"AutoRestart": {
"name": "自动登录",
"help": "游戏被强制结束后自动登录游戏"
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "安装", "Install": "安装",

View File

@ -217,6 +217,10 @@
"AzurLaneUncensored": { "AzurLaneUncensored": {
"name": "反和諧", "name": "反和諧",
"help": "" "help": ""
},
"GameManager": {
"name": "遊戲管理器(未完成)",
"help": ""
} }
}, },
"Scheduler": { "Scheduler": {
@ -1721,6 +1725,16 @@
"help": "一般不需要修改\n倉庫 https://github.com/LmeSzinc/AzurLaneUncensored\n國內鏡像(預設) https://gitee.com/LmeSzinc/AzurLaneUncensored" "help": "一般不需要修改\n倉庫 https://github.com/LmeSzinc/AzurLaneUncensored\n國內鏡像(預設) https://gitee.com/LmeSzinc/AzurLaneUncensored"
} }
}, },
"GameManager": {
"_info": {
"name": "遊戲管理",
"help": "半成品,僅實現了強制關閉遊戲,自動登錄"
},
"AutoRestart": {
"name": "自動登錄",
"help": "遊戲被強制結束後自動登錄遊戲"
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "安裝", "Install": "安裝",

View File

@ -2,12 +2,16 @@ from module.handler.login import LoginHandler
from module.logger import logger from module.logger import logger
class ForceStop(LoginHandler): class GameManager(LoginHandler):
def force_stop(self): def run(self):
logger.hr('Force Stop AzurLane', level=1) logger.hr('Force Stop AzurLane', level=1)
self.device.app_stop() self.device.app_stop()
logger.info('Force Stop finished') logger.info('Force Stop finished')
if self.config.GameManager_AutoRestart:
self.device.app_start()
self.handle_app_login()
if __name__ == '__main__': if __name__ == '__main__':
ForceStop('alas', task='ForceStop').force_stop() GameManager('alas', task='GameManager').run()