This commit is contained in:
恍兮惚兮 2024-11-03 21:32:31 +08:00
parent 798b483f09
commit 4a24afe8d6
2 changed files with 21 additions and 5 deletions

View File

@ -857,11 +857,10 @@ class hookselect(closeashidewindow):
try:
hc, hn, tp = key
gobject.baseobject.textsource.usermanualaccepthooks.append(key)
if key in gobject.baseobject.textsource.selectedhook:
gobject.baseobject.textsource.selectedhook.remove(key)
gobject.baseobject.textsource.edit_selectedhook_remove(key)
if select:
gobject.baseobject.textsource.selectedhook.append(key)
gobject.baseobject.textsource.edit_selectedhook_insert(key)
if hn[:8] == "UserHook":
needinserthookcode = savehook_new_data[gobject.baseobject.gameuid][

View File

@ -168,6 +168,21 @@ class texthook(basetext):
self.delaycollectallselectedoutput()
self.autohookmonitorthread()
def edit_selectedhook_remove(self, key):
try:
self.selectedhook.remove(key)
except:
pass
_, _, tp = key
self.Luna_SyncThread(tp, False)
def edit_selectedhook_insert(self, key, idx=-1):
if idx == -1:
idx = len(self.selectedhook)
self.selectedhook.insert(idx, key)
_, _, tp = key
self.Luna_SyncThread(tp, True)
def initdll(self):
LunaHost = CDLL(
gobject.GetDllpath(
@ -538,7 +553,7 @@ class texthook(basetext):
insertindex = j
else:
insertindex = j + 1
self.selectedhook.insert(insertindex, key)
self.edit_selectedhook_insert(key, insertindex)
gobject.baseobject.hookselectdialog.addnewhooksignal.emit(
key, select, isembedable
)
@ -627,7 +642,9 @@ class texthook(basetext):
def delaycollectallselectedoutput(self):
while not self.ending:
time.sleep(0.01)
if time.time() < self.lastflushtime + self.config["textthreaddelay"] / 1000:
if time.time() < self.lastflushtime + min(
0.1, self.config["textthreaddelay"] / 1000
):
continue
if len(self.multiselectedcollector) == 0:
continue