waiting_scene增加有导航栏的未知场景、截图次数改为超时时长

This commit is contained in:
zhbaor 2024-08-21 22:04:21 +08:00
parent f20865b40d
commit 7f6d58e576
4 changed files with 25 additions and 21 deletions

View file

@ -87,12 +87,13 @@ class ExtraPart(ConfModel):
"托盘图标"
class WaitingSceneConf(ConfModel):
CONNECTING: tuple[int, int] = (1, 10)
UNKNOWN: tuple[int, int] = (1, 10)
LOADING: tuple[int, int] = (2, 30)
LOGIN_LOADING: tuple[int, int] = (3, 10)
LOGIN_MAIN_NOENTRY: tuple[int, int] = (3, 10)
OPERATOR_ONGOING: tuple[int, int] = (10, 30)
CONNECTING: tuple[int, int] = (1000, 15)
UNKNOWN: tuple[int, int] = (0, 10)
UNKNOWN_WITH_NAVBAR: tuple[int, int] = (0, 5)
LOADING: tuple[int, int] = (3000, 60)
LOGIN_LOADING: tuple[int, int] = (3000, 30)
LOGIN_MAIN_NOENTRY: tuple[int, int] = (3000, 30)
OPERATOR_ONGOING: tuple[int, int] = (10000, 300)
start_automatically: bool = False
"启动后自动开始任务"
@ -104,7 +105,7 @@ class ExtraPart(ConfModel):
"截图最短间隔(毫秒)"
screenshot: float = 24
"截图保留时长(小时)"
waiting_scene: WaitingSceneConf
waiting_scene_v2: WaitingSceneConf
"等待时间"

View file

@ -35,6 +35,7 @@ class BaseSolver:
waiting_scene = [
Scene.CONNECTING,
Scene.UNKNOWN,
Scene.UNKNOWN_WITH_NAVBAR,
Scene.LOADING,
Scene.LOGIN_LOADING,
Scene.LOGIN_MAIN_NOENTRY,
@ -490,11 +491,13 @@ class BaseSolver:
def waiting_solver(self):
"""需要等待的页面解决方法。触发超时重启会返回False"""
scene = self.scene()
sleep_time, wait_count = getattr(
config.conf.waiting_scene, scene_list[str(scene)]["label"]
start_time = datetime.now()
sleep_time, wait_time = getattr(
config.conf.waiting_scene_v2, scene_list[str(scene)]["label"]
)
for _ in range(wait_count):
self.sleep(sleep_time)
stop_time = start_time + timedelta(seconds=wait_time)
while datetime.now() < stop_time:
self.sleep(sleep_time / 1000)
if self.scene() != scene:
return True
logger.warning("相同场景等待超时")

View file

@ -40,7 +40,7 @@ const {
maa_adb_path,
maa_gap,
custom_screenshot,
waiting_scene
waiting_scene_v2
} = storeToRefs(config_store)
const { operators } = storeToRefs(plan_store)
@ -136,6 +136,7 @@ async function test_screenshot() {
const scene_name = {
CONNECTING: '正在提交反馈至神经',
UNKNOWN: '未知',
UNKNOWN_WITH_NAVBAR: '有导航栏的未知场景',
LOADING: '加载中',
LOGIN_LOADING: '场景跳转时的等待界面',
LOGIN_MAIN_NOENTRY: '登录页面(无按钮入口)',
@ -336,26 +337,25 @@ const scene_name = {
<tr>
<th>场景</th>
<th>截图间隔</th>
<th>等待次数</th>
<th>超时时长</th>
</tr>
</thead>
<tbody>
<tr v-for="(value, key) in waiting_scene">
<tr v-for="(value, key) in waiting_scene_v2">
<td>{{ scene_name[key] }}</td>
<td>
<n-input-number v-model:value="value[0]" :show-button="false" :precision="0">
<template #suffix></template>
<template #suffix></template>
</n-input-number>
</td>
<td>
<n-input-number v-model:value="value[1]" :show-button="false" :precision="0">
<template #suffix></template>
<template #suffix></template>
</n-input-number>
</td>
</tr>
</tbody>
</n-table>
<!-- {{ waiting_scene }} -->
</n-form-item>
<n-form-item label="界面缩放">
<n-slider

View file

@ -74,7 +74,7 @@ export const useConfigStore = defineStore('config', () => {
const credit_fight = ref({})
const custom_screenshot = ref({})
const notification_level = ref('INFO')
const waiting_scene = ref({})
const waiting_scene_v2 = ref({})
const exipring_medicine_on_weekend = ref(false)
async function load_shop() {
@ -165,7 +165,7 @@ export const useConfigStore = defineStore('config', () => {
credit_fight.value = response.data.credit_fight
custom_screenshot.value = response.data.custom_screenshot
notification_level.value = response.data.notification_level
waiting_scene.value = response.data.waiting_scene
waiting_scene_v2.value = response.data.waiting_scene_v2
exipring_medicine_on_weekend.value = response.data.exipring_medicine_on_weekend
}
@ -249,7 +249,7 @@ export const useConfigStore = defineStore('config', () => {
credit_fight: credit_fight.value,
custom_screenshot: custom_screenshot.value,
notification_level: notification_level.value,
waiting_scene: waiting_scene.value,
waiting_scene_v2: waiting_scene_v2.value,
exipring_medicine_on_weekend: exipring_medicine_on_weekend.value
}
}
@ -336,7 +336,7 @@ export const useConfigStore = defineStore('config', () => {
credit_fight,
custom_screenshot,
notification_level,
waiting_scene,
waiting_scene_v2,
exipring_medicine_on_weekend
}
})