1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 19:55:12 +00:00

fix(momotalk): correct sidebar switch

This commit is contained in:
YoursFunny 2023-12-23 17:03:15 +08:00
parent 8ccb3d3d22
commit 107392a900
Signed by: YoursFunny
GPG Key ID: 207EDC3CD5B40F9C
6 changed files with 60 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -69,28 +69,6 @@ MENU = ButtonWrapper(
button=(1156, 15, 1251, 63),
),
)
MESSAGE_OFF = ButtonWrapper(
name='MESSAGE_OFF',
jp=None,
en=Button(
file='./assets/en/momotalk/MESSAGE_OFF.png',
area=(143, 273, 203, 298),
search=(123, 253, 223, 318),
color=(93, 105, 122),
button=(143, 273, 203, 298),
),
)
MESSAGE_ON = ButtonWrapper(
name='MESSAGE_ON',
jp=None,
en=Button(
file='./assets/en/momotalk/MESSAGE_ON.png',
area=(143, 271, 203, 301),
search=(123, 251, 223, 321),
color=(160, 168, 182),
button=(143, 271, 203, 301),
),
)
NOTIFICATION_BADGE = ButtonWrapper(
name='NOTIFICATION_BADGE',
jp=None,
@ -168,6 +146,50 @@ STORY = ButtonWrapper(
button=(790, 529, 979, 557),
),
)
SWITCH_MESSAGE = ButtonWrapper(
name='SWITCH_MESSAGE',
jp=None,
en=Button(
file='./assets/en/momotalk/SWITCH_MESSAGE.png',
area=(147, 271, 194, 297),
search=(127, 251, 214, 317),
color=(187, 191, 201),
button=(147, 271, 194, 297),
),
)
SWITCH_MESSAGE_CHECK = ButtonWrapper(
name='SWITCH_MESSAGE_CHECK',
jp=None,
en=Button(
file='./assets/en/momotalk/SWITCH_MESSAGE_CHECK.png',
area=(228, 165, 391, 194),
search=(208, 145, 411, 214),
color=(211, 215, 217),
button=(228, 165, 391, 194),
),
)
SWITCH_STUDENT = ButtonWrapper(
name='SWITCH_STUDENT',
jp=None,
en=Button(
file='./assets/en/momotalk/SWITCH_STUDENT.png',
area=(148, 167, 194, 217),
search=(128, 147, 214, 237),
color=(157, 166, 179),
button=(148, 167, 194, 217),
),
)
SWITCH_STUDENT_CHECK = ButtonWrapper(
name='SWITCH_STUDENT_CHECK',
jp=None,
en=Button(
file='./assets/en/momotalk/SWITCH_STUDENT_CHECK.png',
area=(229, 166, 320, 192),
search=(209, 146, 340, 212),
color=(199, 203, 205),
button=(229, 166, 320, 192),
),
)
UNREAD = ButtonWrapper(
name='UNREAD',
jp=None,

View File

@ -1,18 +1,18 @@
from module.base.timer import Timer
from module.base.base import ModuleBase
from module.logger import logger
from module.ui.switch import Switch
from module.base.utils import point_in_area, area_size
from tasks.base.ui import UI
from tasks.base.page import page_main, page_momo_talk
from tasks.momotalk.assets.assets_momotalk import *
import cv2
import numpy as np
"""None of the switches works"""
SWITCH_MESSAGE = Switch("Message_switch")
SWITCH_MESSAGE.add_state("on", MESSAGE_ON)
SWITCH_MESSAGE.add_state("off", MESSAGE_OFF)
from module.base.base import ModuleBase
from module.base.timer import Timer
from module.base.utils import point_in_area, area_size
from module.logger import logger
from module.ui.switch import Switch
from tasks.base.page import page_main, page_momo_talk
from tasks.base.ui import UI
from tasks.momotalk.assets.assets_momotalk import *
SWITCH_SIDEBAR = Switch("Sidebar_switch", is_selector=True)
SWITCH_SIDEBAR.add_state("student", SWITCH_STUDENT_CHECK, SWITCH_STUDENT)
SWITCH_SIDEBAR.add_state("message", SWITCH_MESSAGE_CHECK, SWITCH_MESSAGE)
SWITCH_UNREAD = Switch("Unread_switch")
SWITCH_UNREAD.add_state("on", UNREAD_ON)
@ -27,6 +27,7 @@ button can be found in different locations"""
REPLY_TEMPLATE = REPLY.matched_button.image
STORY_TEMPLATE = STORY.matched_button.image
class MomoTalkUI(UI):
def __init__(self, config, device):
super().__init__(config, device)
@ -121,10 +122,10 @@ class MomoTalkUI(UI):
self.ui_ensure(page_main)
if self.match_color(NOTIFICATION_BADGE, threshold=80):
self.ui_ensure(page_momo_talk)
while not self.select_then_check(MESSAGE_OFF, MESSAGE_ON):
pass
while SWITCH_SIDEBAR.get(self) != "message":
SWITCH_SIDEBAR.set("message", self)
return True
logger.warn("No students available for interaction")
logger.warning("No students available for interaction")
return False
def sort_messages(self):