pgd/20250624 Task #177

Merged
Ghost merged 4 commits from pgd/20250624_1 into main 2025-06-24 11:59:31 +09:00
8 changed files with 42 additions and 13 deletions

View File

@@ -14,8 +14,10 @@ namespace Studio.Manage
viewAngle = new Vector3(45, 145, 0); viewAngle = new Vector3(45, 145, 0);
} }
public void MoveToTwinObjectPos(TwinObject target) public void MoveToTwinObjectPos(GameObject target)
{ {
if (target == null)
return;
var command = new MoveToTargetCommand(target.transform, viewAngle, cameraDistance); var command = new MoveToTargetCommand(target.transform, viewAngle, cameraDistance);
CommandInvoker.instance.Invoke(command); CommandInvoker.instance.Invoke(command);
} }

View File

@@ -1,7 +1,9 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems;
using XRLib; using XRLib;
namespace Studio.Manage namespace Studio.Manage
@@ -106,6 +108,9 @@ namespace Studio.Manage
} }
void Update() void Update()
{ {
if (IsEditInputField())
return;
foreach (var key in downKeyActionTable.Keys) foreach (var key in downKeyActionTable.Keys)
{ {
if (Input.GetKeyDown(key)) if (Input.GetKeyDown(key))
@@ -149,5 +154,15 @@ namespace Studio.Manage
updateLoop?.Invoke(); updateLoop?.Invoke();
} }
bool IsEditInputField()
{
GameObject selectedObj = EventSystem.current.currentSelectedGameObject;
if (selectedObj == null)
return false;
return selectedObj.GetComponent<TMP_InputField>() != null;
}
} }
} }

View File

@@ -30,7 +30,7 @@ namespace Studio.UI
public void CreateContentButton((TwinObject, TwinObject) pair) public void CreateContentButton((TwinObject, TwinObject) pair)
{ {
var newButton = Object.Instantiate(buttonPrefab, content).GetComponent<UI_InterferedObjectButton>(); var newButton = Object.Instantiate(buttonPrefab, content).GetComponent<UI_InterferedObjectButton>();
newButton.OnClickButton += cameraManager.MoveToTwinObjectPos; //newButton.OnClickButton += cameraManager.MoveToTwinObjectPos;
newButton.Initialize(pair.Item1, pair.Item2); newButton.Initialize(pair.Item1, pair.Item2);
createdButtons.Add(pair, newButton); createdButtons.Add(pair, newButton);
} }

View File

@@ -258,15 +258,15 @@ namespace Studio.HierarchyTree
} }
public void OnSelectSingle(HierarchyItem item) public void OnSelectSingle(HierarchyItem item)
{ {
if (selectedItems.Count == 1 && selectedItems[0] == item) //if (selectedItems.Count == 1 && selectedItems[0] == item)
{ //{
selectedItems.Clear(); // selectedItems.Clear();
} //}
else //else
{ //{
selectedItems.Clear(); selectedItems.Clear();
selectedItems.Add(item); selectedItems.Add(item);
} //}
foreach (var itemUI in activeItems) foreach (var itemUI in activeItems)
{ {
itemUI.SetSelected(selectedItems); itemUI.SetSelected(selectedItems);

View File

@@ -6,6 +6,7 @@ using UnityEngine.Events;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.UI; using UnityEngine.UI;
using Studio.UI; using Studio.UI;
using Studio.Manage;
namespace Studio.HierarchyTree namespace Studio.HierarchyTree
{ {
@@ -24,6 +25,9 @@ namespace Studio.HierarchyTree
private HierarchyScrollItemUI hoverItemUI; private HierarchyScrollItemUI hoverItemUI;
private Coroutine coroutinePendPopup; private Coroutine coroutinePendPopup;
public UnityEvent<HierarchyItem> onExit; public UnityEvent<HierarchyItem> onExit;
private float lastClickTime = 0f;
private const float doubleClickInterval = 0.3f;
public override void OnBeginDrag(PointerEventData eventData) public override void OnBeginDrag(PointerEventData eventData)
{ {
if (eventData.button != PointerEventData.InputButton.Left) if (eventData.button != PointerEventData.InputButton.Left)
@@ -83,8 +87,6 @@ namespace Studio.HierarchyTree
} }
} }
public override void OnEndDrag(PointerEventData eventData) public override void OnEndDrag(PointerEventData eventData)
{ {
if (eventData.button == PointerEventData.InputButton.Left) if (eventData.button == PointerEventData.InputButton.Left)
@@ -142,19 +144,29 @@ namespace Studio.HierarchyTree
base.OnEndDrag(eventData); base.OnEndDrag(eventData);
} }
} }
public void OnPointerDown(PointerEventData eventData) public void OnPointerDown(PointerEventData eventData)
{ {
if (eventData.button == PointerEventData.InputButton.Left) if (eventData.button == PointerEventData.InputButton.Left)
{ {
HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData); HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData);
if (itemUI != null) if (itemUI != null)
{ {
sourceItem = itemUI.currentItem; sourceItem = itemUI.currentItem;
float timeSinceLastClick = Time.time - lastClickTime;
if (timeSinceLastClick <= doubleClickInterval)
{
ManagerHub.instance.Get<CameraManager>().MoveToTwinObjectPos(sourceItem.linkedObject);
}
} }
if (sourceItem != null) if (sourceItem != null)
{ {
coroutinePendPopup = StartCoroutine(CoroutinePendPopup()); coroutinePendPopup = StartCoroutine(CoroutinePendPopup());
} }
lastClickTime = Time.time;
} }
} }
public void OnPointerUp(PointerEventData eventData) public void OnPointerUp(PointerEventData eventData)

View File

@@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_StringTable: m_StringTable:
m_TableReference: m_TableReference:
m_TableCollectionName: m_TableCollectionName: GUID:ab1e4fa9b84503341a204ed3ec095aa8
m_AssetTable: m_AssetTable:
m_TableReference: m_TableReference:
m_TableCollectionName: m_TableCollectionName:

View File

@@ -1 +1 @@
000e1e56b63491cd2948148ccce2b84c 77439a0de80e9b4861c25c52b97dc770