1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2026-01-08 16:05:15 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
34c5323df3
fix(momotalk): correct sort switch 2023-12-23 17:23:40 +08:00
30d63fa193
fix(momotalk): correct sidebar switch 2023-12-23 17:03:15 +08:00
8 changed files with 77 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 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.9 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,
@ -135,26 +113,26 @@ SKIP = ButtonWrapper(
button=(1192, 103, 1229, 141),
),
)
SORT_OFF = ButtonWrapper(
name='SORT_OFF',
SORT_ASCENDING = ButtonWrapper(
name='SORT_ASCENDING',
jp=None,
en=Button(
file='./assets/en/momotalk/SORT_OFF.png',
area=(591, 158, 662, 199),
search=(571, 138, 682, 219),
color=(235, 237, 238),
button=(591, 158, 662, 199),
file='./assets/en/momotalk/SORT_ASCENDING.png',
area=(631, 166, 648, 188),
search=(611, 146, 668, 208),
color=(221, 228, 233),
button=(631, 166, 648, 188),
),
)
SORT_ON = ButtonWrapper(
name='SORT_ON',
SORT_DESCENDING = ButtonWrapper(
name='SORT_DESCENDING',
jp=None,
en=Button(
file='./assets/en/momotalk/SORT_ON.png',
area=(594, 159, 658, 196),
search=(574, 139, 678, 216),
color=(233, 235, 236),
button=(594, 159, 658, 196),
file='./assets/en/momotalk/SORT_DESCENDING.png',
area=(631, 166, 648, 189),
search=(611, 146, 668, 209),
color=(221, 228, 234),
button=(631, 166, 648, 189),
),
)
STORY = ButtonWrapper(
@ -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,32 +1,33 @@
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)
SWITCH_UNREAD.add_state("off", UNREAD_OFF)
SWITCH_SORT = Switch("Sort_switch")
SWITCH_SORT.add_state("on", SORT_ON)
SWITCH_SORT.add_state("off", SORT_OFF)
SWITCH_SORT.add_state("ascending", SORT_ASCENDING)
SWITCH_SORT.add_state("descending", SORT_DESCENDING)
"""Required for template matching as reply and story
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):
@ -144,7 +145,7 @@ class MomoTalkUI(UI):
"""
if self.match_color(FIRST_UNREAD, threshold=80) and self.select_then_disappear(FIRST_UNREAD, SELECT_STUDENT, force_select=True):
return True
logger.warn("No students available for interaction")
logger.warning("No students available for interaction")
return False
def chat(self):