修复hotkey
This commit is contained in:
parent
d8a4cc0993
commit
374ca27949
@ -109,41 +109,41 @@ internal static class UXHotkeyComponent
|
|||||||
{
|
{
|
||||||
if (_hotkeyRegistry.TryGetValue(actionId, out var registrations))
|
if (_hotkeyRegistry.TryGetValue(actionId, out var registrations))
|
||||||
{
|
{
|
||||||
|
HotkeyRegistration hotkeyInfo;
|
||||||
for (int i = registrations.Count - 1; i >= 0; i--)
|
for (int i = registrations.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (registrations[i].button == button)
|
if (registrations[i].button == button)
|
||||||
{
|
{
|
||||||
registrations.RemoveAt(i);
|
hotkeyInfo = registrations[i];
|
||||||
break;
|
if (_sharedHandlers.TryGetValue(actionId, out var handlerInfo))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (registrations.Count == 0)
|
|
||||||
{
|
|
||||||
_hotkeyRegistry.Remove(actionId);
|
|
||||||
|
|
||||||
if (_sharedHandlers.TryGetValue(actionId, out var handlerInfo))
|
|
||||||
{
|
|
||||||
var (handler, pressType) = handlerInfo;
|
|
||||||
var actionRef = registrations.Count > 0 ? registrations[0].reference : null;
|
|
||||||
|
|
||||||
if (actionRef != null && actionRef.action != null)
|
|
||||||
{
|
{
|
||||||
actionRef.action.Disable();
|
var (handler, pressType) = handlerInfo;
|
||||||
|
var actionRef = hotkeyInfo.reference;
|
||||||
|
|
||||||
|
if (actionRef != null && actionRef.action != null)
|
||||||
switch (pressType)
|
|
||||||
{
|
{
|
||||||
case EHotkeyPressType.Started:
|
if (registrations.Count == 0)
|
||||||
actionRef.action.started -= handler;
|
{
|
||||||
break;
|
actionRef.action.Disable();
|
||||||
case EHotkeyPressType.Performed:
|
}
|
||||||
actionRef.action.performed -= handler;
|
|
||||||
break;
|
switch (pressType)
|
||||||
|
{
|
||||||
|
case EHotkeyPressType.Started:
|
||||||
|
actionRef.action.started -= handler;
|
||||||
|
break;
|
||||||
|
case EHotkeyPressType.Performed:
|
||||||
|
actionRef.action.performed -= handler;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sharedHandlers.Remove(actionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_sharedHandlers.Remove(actionId);
|
registrations.RemoveAt(i);
|
||||||
|
_hotkeyRegistry.Remove(actionId);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user