mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
switch
This commit is contained in:
parent
80e1899466
commit
9341aac0b6
@ -121,9 +121,16 @@ class ocrtext(basetext):
|
||||
triggered = True
|
||||
laststate = this
|
||||
if triggered and gobject.baseobject.hwnd:
|
||||
for _ in range(2):
|
||||
# 切换前台窗口
|
||||
p1 = windows.GetWindowThreadProcessId(gobject.baseobject.hwnd)
|
||||
p2 = windows.GetWindowThreadProcessId(windows.GetForegroundWindow())
|
||||
p2 = windows.GetWindowThreadProcessId(
|
||||
windows.GetForegroundWindow()
|
||||
)
|
||||
triggered = p1 == p2
|
||||
if triggered:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
if triggered:
|
||||
time.sleep(globalconfig["ocr_trigger_delay"])
|
||||
for _ in range(len(self.savelastimg)):
|
||||
|
@ -42,7 +42,7 @@ OCR的结果是不稳定的,经常对于图片的微小扰动会使文本发
|
||||
|
||||
### 鼠标键盘触发+等待稳定
|
||||
|
||||
以下鼠标键盘事件将触发该方法:按下鼠标左键、按下Enter、松开Ctrl、松开Shift、松开Alt
|
||||
以下鼠标键盘事件将触发该方法:按下鼠标左键、按下Enter、松开Ctrl、松开Shift、松开Alt。如果绑定了游戏窗口,则仅当游戏窗口为前台窗口时,才会触发方法。
|
||||
|
||||
触发该方法后,由于需要等待游戏渲染新的文本,或文本可能不是立即出现(文本速度不是最快),因此需要稍微等待一小段时间,直到显示的文本稳定。
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user