Compare commits
2 Commits
pgd/202507
...
pgd/202507
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c111cc55b9 | ||
|
|
691f8725a2 |
@@ -106,7 +106,8 @@ namespace Studio.AssetTool
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
//ResizeBoundary();
|
||||
if (isSelected || isCollided)
|
||||
|
||||
if (isSelected || isCollided || eventData.pointerEnter != gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Studio.Command
|
||||
|
||||
var renderObjectHandler = ManagerHub.instance.Get<RenderObjectHandler>();
|
||||
renderObjectHandler.rtgController.SetGizmoTargetObjects(new List<GameObject>());
|
||||
|
||||
renderObjectHandler.DeselectAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,8 @@ namespace Studio.Command
|
||||
canvas.panel_dynamicobjectinfo.ResetObjectInfo();
|
||||
//connector.onRemoveObjects?.Invoke();
|
||||
connector.componentScrollView.DeselectAll();
|
||||
var renderObjectHandler = ManagerHub.instance.Get<RenderObjectHandler>();
|
||||
renderObjectHandler.DeselectAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using XRLib;
|
||||
@@ -13,10 +14,21 @@ namespace Studio.Manage
|
||||
Dictionary<KeyCode, Action> getKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||
Dictionary<KeyCode, Action> upKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||
Dictionary<KeyCode, Action> downKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||
Dictionary<KeyCode, Dictionary<KeyCode, Action>> shortCutActionTable = new ();
|
||||
Dictionary<KeyCode, Dictionary<KeyCode, Action>> shortCutActionTable = new();
|
||||
Dictionary<string, ShortcutState> shortcutStateTable = new Dictionary<string, ShortcutState>();
|
||||
|
||||
float shortCutInitialDelay = 0.5f;
|
||||
float shortCutRepeatDelay = 0.1f;
|
||||
|
||||
Stack<InputHandler> handlerStack = new();
|
||||
Action updateLoop;
|
||||
|
||||
private class ShortcutState
|
||||
{
|
||||
public float pressStartTime = -1f;
|
||||
public float lastActionTime = -1f;
|
||||
}
|
||||
|
||||
public void SetHandler(InputHandler handler)
|
||||
{
|
||||
SetKeyboardPreset(handler);
|
||||
@@ -34,11 +46,11 @@ namespace Studio.Manage
|
||||
RemoveKeyActionPreset(currentHandler);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tempStack.Push(currentHandler);
|
||||
}
|
||||
|
||||
while(tempStack.Count > 0)
|
||||
while (tempStack.Count > 0)
|
||||
{
|
||||
var tempHandler = tempStack.Pop();
|
||||
SetKeyboardPreset(tempHandler);
|
||||
@@ -47,24 +59,24 @@ namespace Studio.Manage
|
||||
|
||||
void RemoveKeyActionPreset(InputHandler handler)
|
||||
{
|
||||
foreach(var k in handler.getKeyActions)
|
||||
foreach (var k in handler.getKeyActions)
|
||||
{
|
||||
getKeyActionTable.Remove(k.Key);
|
||||
}
|
||||
|
||||
foreach(var k in handler.upKeyActions)
|
||||
foreach (var k in handler.upKeyActions)
|
||||
{
|
||||
upKeyActionTable.Remove(k.Key);
|
||||
}
|
||||
|
||||
foreach(var k in handler.downKeyActions)
|
||||
foreach (var k in handler.downKeyActions)
|
||||
{
|
||||
downKeyActionTable.Remove(k.Key);
|
||||
}
|
||||
|
||||
foreach(var k in handler.shortCutActions)
|
||||
foreach (var k in handler.shortCutActions)
|
||||
{
|
||||
foreach(var kk in k.Value)
|
||||
foreach (var kk in k.Value)
|
||||
{
|
||||
shortCutActionTable[k.Key].Remove(kk.Key);
|
||||
}
|
||||
@@ -79,14 +91,14 @@ namespace Studio.Manage
|
||||
getKeyActionTable[k.Key] = k.Value;
|
||||
}
|
||||
|
||||
foreach(var k in handler.upKeyActions)
|
||||
foreach (var k in handler.upKeyActions)
|
||||
{
|
||||
upKeyActionTable[k.Key]= k.Value;
|
||||
upKeyActionTable[k.Key] = k.Value;
|
||||
}
|
||||
|
||||
foreach(var k in handler.downKeyActions)
|
||||
foreach (var k in handler.downKeyActions)
|
||||
{
|
||||
downKeyActionTable[k.Key]= k.Value;
|
||||
downKeyActionTable[k.Key] = k.Value;
|
||||
}
|
||||
|
||||
foreach (var k in handler.shortCutActions)
|
||||
@@ -143,18 +155,53 @@ namespace Studio.Manage
|
||||
{
|
||||
foreach (var k in kk)
|
||||
{
|
||||
if (Input.GetKeyDown(k.Key))
|
||||
string inputKeystring = key + "+" + k.Key;
|
||||
bool bothKeyPressed = Input.GetKey(k.Key);
|
||||
|
||||
if (!shortcutStateTable.TryGetValue(inputKeystring, out var state))
|
||||
{
|
||||
k.Value?.Invoke();
|
||||
state = new ShortcutState();
|
||||
shortcutStateTable[inputKeystring] = state;
|
||||
}
|
||||
|
||||
if (bothKeyPressed)
|
||||
{
|
||||
float curTime = Time.time;
|
||||
|
||||
if (state.pressStartTime < 0f)
|
||||
{
|
||||
state.pressStartTime = curTime;
|
||||
state.lastActionTime = -1f;
|
||||
}
|
||||
|
||||
if (state.lastActionTime < 0f)
|
||||
{
|
||||
k.Value?.Invoke();
|
||||
state.lastActionTime = curTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
float holdTime = curTime - state.pressStartTime;
|
||||
float sinceLastAction = curTime - state.lastActionTime;
|
||||
|
||||
if (holdTime >= shortCutInitialDelay && sinceLastAction >= shortCutRepeatDelay)
|
||||
{
|
||||
k.Value?.Invoke();
|
||||
state.lastActionTime = curTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state.pressStartTime = -1f;
|
||||
state.lastActionTime = -1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateLoop?.Invoke();
|
||||
}
|
||||
|
||||
bool IsEditInputField()
|
||||
{
|
||||
GameObject selectedObj = EventSystem.current.currentSelectedGameObject;
|
||||
@@ -165,4 +212,5 @@ namespace Studio.Manage
|
||||
return selectedObj.GetComponent<TMP_InputField>() != null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user