修复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))
|
||||
{
|
||||
HotkeyRegistration hotkeyInfo;
|
||||
for (int i = registrations.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (registrations[i].button == button)
|
||||
{
|
||||
registrations.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
hotkeyInfo = registrations[i];
|
||||
if (_sharedHandlers.TryGetValue(actionId, out var handlerInfo))
|
||||
{
|
||||
actionRef.action.Disable();
|
||||
var (handler, pressType) = handlerInfo;
|
||||
var actionRef = hotkeyInfo.reference;
|
||||
|
||||
|
||||
switch (pressType)
|
||||
if (actionRef != null && actionRef.action != null)
|
||||
{
|
||||
case EHotkeyPressType.Started:
|
||||
actionRef.action.started -= handler;
|
||||
break;
|
||||
case EHotkeyPressType.Performed:
|
||||
actionRef.action.performed -= handler;
|
||||
break;
|
||||
if (registrations.Count == 0)
|
||||
{
|
||||
actionRef.action.Disable();
|
||||
}
|
||||
|
||||
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