Fix: Add setting In-game Text Language

This commit is contained in:
LmeSzinc 2023-09-13 04:25:02 +08:00
parent 76127b90e7
commit 2854a9eea8
9 changed files with 48 additions and 7 deletions

View File

@ -3,6 +3,7 @@
"Emulator": { "Emulator": {
"Serial": "auto", "Serial": "auto",
"PackageName": "auto", "PackageName": "auto",
"GameLanguage": "auto",
"ScreenshotMethod": "scrcpy", "ScreenshotMethod": "scrcpy",
"ControlMethod": "MaaTouch", "ControlMethod": "MaaTouch",
"AdbRestart": false "AdbRestart": false

View File

@ -16,6 +16,15 @@
"com.miHoYo.hkrpg.bilibili" "com.miHoYo.hkrpg.bilibili"
] ]
}, },
"GameLanguage": {
"type": "select",
"value": "auto",
"option": [
"auto",
"cn",
"en"
]
},
"ScreenshotMethod": { "ScreenshotMethod": {
"type": "select", "type": "select",
"value": "scrcpy", "value": "scrcpy",

View File

@ -21,6 +21,9 @@ Emulator:
PackageName: PackageName:
value: auto value: auto
option: [ auto, ] option: [ auto, ]
GameLanguage:
value: auto
option: [ auto, cn, en ]
ScreenshotMethod: ScreenshotMethod:
value: auto value: auto
option: [ auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy ] option: [ auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy ]

View File

@ -18,6 +18,7 @@ class GeneratedConfig:
# Group `Emulator` # Group `Emulator`
Emulator_Serial = 'auto' Emulator_Serial = 'auto'
Emulator_PackageName = 'auto' # auto, com.miHoYo.hkrpg, com.HoYoverse.hkrpgoversea, com.miHoYo.hkrpg.bilibili Emulator_PackageName = 'auto' # auto, com.miHoYo.hkrpg, com.HoYoverse.hkrpgoversea, com.miHoYo.hkrpg.bilibili
Emulator_GameLanguage = 'auto' # auto, cn, en
Emulator_ScreenshotMethod = 'auto' # auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy Emulator_ScreenshotMethod = 'auto' # auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy
Emulator_ControlMethod = 'MaaTouch' # minitouch, MaaTouch Emulator_ControlMethod = 'MaaTouch' # minitouch, MaaTouch
Emulator_AdbRestart = False Emulator_AdbRestart = False

View File

@ -84,6 +84,13 @@
"com.HoYoverse.hkrpgoversea": "OVERSEA", "com.HoYoverse.hkrpgoversea": "OVERSEA",
"com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili" "com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili"
}, },
"GameLanguage": {
"name": "In-game Text Language",
"help": "",
"auto": "Auto-detect",
"cn": "简体中文",
"en": "English"
},
"ScreenshotMethod": { "ScreenshotMethod": {
"name": "Screenshot Method", "name": "Screenshot Method",
"help": "When using auto-select, a benchmark will be performed and automatically changed to the fastest screenshot method.\nGeneral speed: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB.\nRun Tools - Performance Test to find the fastest method.", "help": "When using auto-select, a benchmark will be performed and automatically changed to the fastest screenshot method.\nGeneral speed: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB.\nRun Tools - Performance Test to find the fastest method.",

View File

@ -84,6 +84,13 @@
"com.HoYoverse.hkrpgoversea": "OVERSEA", "com.HoYoverse.hkrpgoversea": "OVERSEA",
"com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili" "com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili"
}, },
"GameLanguage": {
"name": "Emulator.GameLanguage.name",
"help": "Emulator.GameLanguage.help",
"auto": "auto",
"cn": "cn",
"en": "en"
},
"ScreenshotMethod": { "ScreenshotMethod": {
"name": "Emulator.ScreenshotMethod.name", "name": "Emulator.ScreenshotMethod.name",
"help": "Emulator.ScreenshotMethod.help", "help": "Emulator.ScreenshotMethod.help",

View File

@ -84,6 +84,13 @@
"com.HoYoverse.hkrpgoversea": "OVERSEA", "com.HoYoverse.hkrpgoversea": "OVERSEA",
"com.miHoYo.hkrpg.bilibili": "CN Bilibili渠道服 com.miHoYo.hkrpg.bilibili" "com.miHoYo.hkrpg.bilibili": "CN Bilibili渠道服 com.miHoYo.hkrpg.bilibili"
}, },
"GameLanguage": {
"name": "游戏内文本语言",
"help": "",
"auto": "自动检测",
"cn": "简体中文",
"en": "English"
},
"ScreenshotMethod": { "ScreenshotMethod": {
"name": "模拟器截图方案", "name": "模拟器截图方案",
"help": "使用自动选择时,将执行一次性能测试并自动更改为最快的截图方案\n一般情况下的速度: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB\n运行 工具 - 性能测试 以寻找最快的方案", "help": "使用自动选择时,将执行一次性能测试并自动更改为最快的截图方案\n一般情况下的速度: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB\n运行 工具 - 性能测试 以寻找最快的方案",

View File

@ -84,6 +84,13 @@
"com.HoYoverse.hkrpgoversea": "OVERSEA", "com.HoYoverse.hkrpgoversea": "OVERSEA",
"com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili" "com.miHoYo.hkrpg.bilibili": "CN com.miHoYo.hkrpg.bilibili"
}, },
"GameLanguage": {
"name": "遊戲內文本語言",
"help": "",
"auto": "自動檢測",
"cn": "简体中文",
"en": "English"
},
"ScreenshotMethod": { "ScreenshotMethod": {
"name": "模擬器截圖方案", "name": "模擬器截圖方案",
"help": "使用自動選擇時,將執行一次性能測試並自動更改為最快的截圖方案\n一般情況下的速度: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB\n運行 工具 - 性能測試 以尋找最快的方案", "help": "使用自動選擇時,將執行一次性能測試並自動更改為最快的截圖方案\n一般情況下的速度: DroidCast_raw >> aScreenCap_nc > ADB_nc >>> aScreenCap > uiautomator2 ~= ADB\n運行 工具 - 性能測試 以尋找最快的方案",

View File

@ -11,17 +11,15 @@ import uiautomator2 as u2
from adbutils import AdbClient, AdbDevice, AdbTimeout, ForwardItem, ReverseItem from adbutils import AdbClient, AdbDevice, AdbTimeout, ForwardItem, ReverseItem
from adbutils.errors import AdbError from adbutils.errors import AdbError
import module.config.server as server_
from module.base.decorator import Config, cached_property, del_cached_property from module.base.decorator import Config, cached_property, del_cached_property
from module.base.utils import ensure_time from module.base.utils import SelectedGrids, ensure_time
from module.device.connection_attr import ConnectionAttr from module.device.connection_attr import ConnectionAttr
from module.device.method.utils import ( from module.device.method.utils import (
RETRY_TRIES, remove_shell_warning, retry_sleep, PackageNotInstalled, RETRY_TRIES, get_serial_pair, handle_adb_error,
handle_adb_error, PackageNotInstalled, possible_reasons, random_port, recv_all, remove_shell_warning, retry_sleep)
recv_all, possible_reasons, from module.exception import EmulatorNotRunningError, RequestHumanTakeover
random_port, get_serial_pair)
from module.exception import RequestHumanTakeover, EmulatorNotRunningError
from module.logger import logger from module.logger import logger
from module.base.utils import SelectedGrids
def retry(func): def retry(func):
@ -109,6 +107,7 @@ class Connection(ConnectionAttr):
# else: # else:
# set_server(self.package) # set_server(self.package)
logger.attr('PackageName', self.package) logger.attr('PackageName', self.package)
server_.lang = self.config.Emulator_GameLanguage
logger.attr('Lang', self.config.LANG) logger.attr('Lang', self.config.LANG)
self.check_mumu_app_keep_alive() self.check_mumu_app_keep_alive()