diff --git a/Assets/Scripts/UVC/Data/DataObject.cs b/Assets/Scripts/UVC/Data/DataObject.cs index d59f1650..61b895b8 100644 --- a/Assets/Scripts/UVC/Data/DataObject.cs +++ b/Assets/Scripts/UVC/Data/DataObject.cs @@ -4,7 +4,9 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Collections.Specialized; using System.Linq; +using UVC.Extention; using UVC.Log; namespace UVC.Data @@ -47,7 +49,7 @@ namespace UVC.Data /// // - password는 제외됨 /// /// - public class DataObject : SortedDictionary, IDataObject + public class DataObject : OrderedDictionary, IDataObject { /// @@ -103,11 +105,12 @@ namespace UVC.Data /// Dictionary로 데이터 객체를 초기화합니다. /// /// 초기화에 사용할 Dictionary 객체 - public DataObject(Dictionary dictionary) : base(dictionary) + public DataObject(Dictionary dictionary) : base() { // 생성자에서 초기 속성들을 기존 속성으로 등록 foreach (var key in dictionary.Keys) { + Add(key, dictionary[key]); existingProperties.Add(key); } } diff --git a/Assets/Scripts/UVC/EditableObject.cs b/Assets/Scripts/UVC/EditableObject.cs deleted file mode 100644 index a7dddc32..00000000 --- a/Assets/Scripts/UVC/EditableObject.cs +++ /dev/null @@ -1,19 +0,0 @@ -using UnityEngine; - -namespace UVC.Editor -{ - public abstract class EditableObject : MonoBehaviour, ISelectable - { - [field: SerializeField] - public string ItemId { get; private set; } - - public abstract void OnSelect(); - public abstract void OnDeselect(); - - public virtual void Initialize(string id) - { - this.ItemId = id; - this.name = $"{GetType().Name}_{id}"; - } - } -} diff --git a/Assets/Scripts/UVC/EditableObject.cs.meta b/Assets/Scripts/UVC/EditableObject.cs.meta deleted file mode 100644 index 299a606a..00000000 --- a/Assets/Scripts/UVC/EditableObject.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: c0224adc9ffbf484eadece57e5583624 \ No newline at end of file diff --git a/Assets/Scripts/UVC/EditableObject3D.cs b/Assets/Scripts/UVC/EditableObject3D.cs deleted file mode 100644 index da0e2cb4..00000000 --- a/Assets/Scripts/UVC/EditableObject3D.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UnityEngine; - -namespace UVC.Editor -{ - public class EditableObject3D : EditableObject - { - // 3D 객체 고유의 속성 및 로직 - // 예: Material, Mesh 등 - - public override void OnSelect() - { - // 외곽선 표시 로직 호출 - Debug.Log($"{name} selected."); - } - - public override void OnDeselect() - { - // 외곽선 숨김 로직 호출 - Debug.Log($"{name} deselected."); - } - } -} diff --git a/Assets/Scripts/UVC/EditableObject3D.cs.meta b/Assets/Scripts/UVC/EditableObject3D.cs.meta deleted file mode 100644 index 885e7b4d..00000000 --- a/Assets/Scripts/UVC/EditableObject3D.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 4f0f7e0e4ee826a409789e44ac3584fb \ No newline at end of file diff --git a/Assets/Scripts/UVC/Extention/OrderedDictionary.cs b/Assets/Scripts/UVC/Extention/OrderedDictionary.cs new file mode 100644 index 00000000..e64c6205 --- /dev/null +++ b/Assets/Scripts/UVC/Extention/OrderedDictionary.cs @@ -0,0 +1,413 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace UVC.Extention +{ + /// + /// 키의 순서가 보장되는 스레드 안전한 제네릭 컬렉션을 나타냅니다. + /// 항목이 추가된 순서대로 유지되며, 인덱스를 통해 접근할 수 있습니다. + /// + /// 사전의 키 형식입니다. + /// 사전의 값 형식입니다. + /// + /// 다음은 OrderedDictionary의 사용 예제입니다. + /// + /// // OrderedDictionary 인스턴스 생성 + /// var cityPopulation = new OrderedDictionary(); + /// + /// // 데이터 추가 (순서대로 추가됨) + /// cityPopulation.Add("서울", 9700000); + /// cityPopulation.Add("부산", 3400000); + /// cityPopulation.Add("인천", 3000000); + /// + /// // 키를 이용한 값 접근 + /// Console.WriteLine($"서울 인구: {cityPopulation["서울"]}"); // 출력: 서울 인구: 9700000 + /// + /// // 인덱스를 이용한 값 접근 (순서 보장) + /// Console.WriteLine($"첫 번째 추가된 도시의 인구: {cityPopulation.GetValueAt(0)}"); // 출력: 첫 번째 추가된 도시의 인구: 9700000 + /// + /// // 특정 위치에 데이터 삽입 + /// cityPopulation.Insert(1, "대구", 2400000); // "부산" 앞에 "대구" 삽입 + /// + /// // 추가된 순서대로 반복 + /// Console.WriteLine("\n현재 도시 목록 (순서 보장):"); + /// foreach(var city in cityPopulation) + /// { + /// Console.WriteLine($"- {city.Key}: {city.Value}"); + /// } + /// // 출력: + /// // - 서울: 9700000 + /// // - 대구: 2400000 + /// // - 부산: 3400000 + /// // - 인천: 3000000 + /// + /// // 항목 삭제 + /// cityPopulation.Remove("부산"); + /// + /// Console.WriteLine("\n'부산' 삭제 후 도시 목록:"); + /// foreach(var city in cityPopulation) + /// { + /// Console.WriteLine($"- {city.Key}: {city.Value}"); + /// } + /// + /// + public partial class OrderedDictionary : IDictionary + { + private readonly object _lock = new object(); + private readonly Dictionary _dict; + private readonly List _keys; + + #region Constructors + + /// + /// 비어 있고 기본 초기 용량을 가지며 키 형식에 대한 기본 같음 비교자를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + public OrderedDictionary() + { + _dict = new Dictionary(); + _keys = new List(); + } + + /// + /// 비어 있고 기본 초기 용량을 가지며 지정된 를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + /// 키를 비교할 때 사용할 구현 또는 키 형식에 대한 기본 를 사용하려면 null입니다. + public OrderedDictionary(IEqualityComparer comparer) + { + _dict = new Dictionary(comparer); + _keys = new List(); + } + + /// + /// 비어 있고 지정된 초기 용량을 가지며 키 형식에 대한 기본 같음 비교자를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + /// 가 초기에 포함할 수 있는 요소의 수입니다. + public OrderedDictionary(int capacity) + { + _dict = new Dictionary(capacity); + _keys = new List(capacity); + } + + /// + /// 비어 있고 지정된 초기 용량을 가지며 지정된 를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + /// 가 초기에 포함할 수 있는 요소의 수입니다. + /// 키를 비교할 때 사용할 구현 또는 키 형식에 대한 기본 를 사용하려면 null입니다. + public OrderedDictionary(int capacity, IEqualityComparer comparer) + { + _dict = new Dictionary(capacity, comparer); + _keys = new List(capacity); + } + + /// + /// 지정된 에서 복사한 요소를 포함하고 키 형식에 대한 기본 같음 비교자를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + /// 요소가 새 에 복사되는 입니다. + public OrderedDictionary(IDictionary dictionary) + { + _dict = new Dictionary(dictionary); + _keys = new List(dictionary.Keys); + } + + /// + /// 지정된 에서 복사한 요소를 포함하고 지정된 를 사용하는 클래스의 새 인스턴스를 초기화합니다. + /// + /// 요소가 새 에 복사되는 입니다. + /// 키를 비교할 때 사용할 구현 또는 키 형식에 대한 기본 를 사용하려면 null입니다. + public OrderedDictionary(IDictionary dictionary, IEqualityComparer comparer) + { + _dict = new Dictionary(dictionary, comparer); + _keys = new List(dictionary.Keys); + } + + #endregion + + #region IDictionary Members + + /// + /// 사전에 지정된 키와 값을 추가합니다. + /// + /// 추가할 요소의 키입니다. + /// 추가할 요소의 값입니다. + public void Add(TKey key, TValue value) + { + lock (_lock) + { + if (_dict.ContainsKey(key)) + throw new ArgumentException("이미 존재하는 키입니다."); + _keys.Add(key); + _dict.Add(key, value); + } + } + + /// + /// 사전에 지정된 키가 포함되어 있는지 확인합니다. + /// + /// 찾을 키입니다. + /// 사전에 지정된 키를 가진 요소가 있으면 true이고, 그렇지 않으면 false입니다. + public bool ContainsKey(TKey key) + { + lock (_lock) + { + return _dict.ContainsKey(key); + } + } + + /// + /// 사전의 키를 순서대로 포함하는 컬렉션을 가져옵니다. + /// + public ICollection Keys + { + get + { + lock (_lock) + { + return _keys.AsReadOnly(); + } + } + } + + /// + /// 사전에서 지정된 키를 가진 요소를 제거합니다. + /// 참고: 이 작업은 내부 리스트에서 키를 찾아 제거하므로 O(n)의 시간 복잡도를 가질 수 있습니다. + /// + /// 제거할 요소의 키입니다. + /// 요소를 성공적으로 찾아 제거했으면 true이고, 그렇지 않으면 false입니다. + public bool Remove(TKey key) + { + lock (_lock) + { + if (_dict.Remove(key)) + { + _keys.Remove(key); + return true; + } + return false; + } + } + + /// + /// 지정된 키와 연결된 값을 가져옵니다. + /// + /// 가져올 값의 키입니다. + /// 이 메서드가 반환될 때, 키가 있으면 해당 키와 연결된 값을 포함하고, 그렇지 않으면 value 매개 변수의 형식에 대한 기본값을 포함합니다. + /// 사전에 지정된 키를 가진 요소가 있으면 true이고, 그렇지 않으면 false입니다. + public bool TryGetValue(TKey key, out TValue value) + { + lock (_lock) + { + return _dict.TryGetValue(key, out value); + } + } + + /// + /// 사전의 값을 순서대로 포함하는 컬렉션을 가져옵니다. + /// + public ICollection Values + { + get + { + lock (_lock) + { + // ToList()를 호출하여 즉시 평가된 읽기 전용 컬렉션을 반환합니다. + // 이는 스레드 안정성을 위해 중요합니다. + return _keys.Select(key => _dict[key]).ToList().AsReadOnly(); + } + } + } + + + /// + /// 지정된 키와 연결된 값을 가져오거나 설정합니다. + /// + /// 가져오거나 설정할 요소의 키입니다. + /// 지정된 키와 연결된 값입니다. + public TValue this[TKey key] + { + get + { + lock (_lock) + { + return _dict[key]; + } + } + set + { + lock (_lock) + { + if (!_dict.ContainsKey(key)) + { + _keys.Add(key); + } + _dict[key] = value; + } + } + } + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + /// + /// 사전에서 모든 키와 값을 제거합니다. + /// + public void Clear() + { + lock (_lock) + { + _dict.Clear(); + _keys.Clear(); + } + } + + bool ICollection>.Contains(KeyValuePair item) + { + lock (_lock) + { + return ((ICollection>)_dict).Contains(item); + } + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + lock (_lock) + { + if (array == null) throw new ArgumentNullException(nameof(array)); + if (arrayIndex < 0) throw new ArgumentOutOfRangeException(nameof(arrayIndex)); + if (array.Length - arrayIndex < Count) throw new ArgumentException("대상 배열이 충분히 크지 않습니다."); + + foreach (var key in _keys) + { + array[arrayIndex++] = new KeyValuePair(key, _dict[key]); + } + } + } + + /// + /// 사전에 포함된 키/값 쌍의 수를 가져옵니다. + /// + public int Count + { + get + { + lock (_lock) + { + return _dict.Count; + } + } + } + + + /// + /// 사전이 읽기 전용인지 여부를 나타내는 값을 가져옵니다. + /// + public bool IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) + { + lock (_lock) + { + if (((ICollection>)_dict).Contains(item)) + { + return Remove(item.Key); + } + return false; + } + } + + #endregion + + #region IEnumerable> Members + + /// + /// 사전을 반복하는 열거자를 반환합니다. + /// 주의: 열거가 진행되는 동안 컬렉션이 다른 스레드에서 수정되면 예외가 발생할 수 있습니다. 스레드 안전한 열거를 위해서는 컬렉션을 복사하거나 lock을 사용해야 합니다. + /// + /// 사전을 반복하는 데 사용할 수 있는 입니다. + public IEnumerator> GetEnumerator() + { + // GetEnumerator는 스레드 안정성을 위해 컬렉션의 복사본을 만들어 순회하는 것이 일반적입니다. + List> listCopy; + lock (_lock) + { + listCopy = new List>(Count); + foreach (var key in _keys) + { + listCopy.Add(new KeyValuePair(key, _dict[key])); + } + } + return listCopy.GetEnumerator(); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + #endregion + + #region OrderedDictionary Specific Members + + /// + /// 사전의 지정된 인덱스에 키/값 쌍을 삽입합니다. + /// 참고: 이 작업은 내부 리스트에 요소를 삽입하므로 O(n)의 시간 복잡도를 가질 수 있습니다. + /// + /// 키/값 쌍을 삽입할 인덱스(0부터 시작)입니다. + /// 삽입할 요소의 키입니다. + /// 삽입할 요소의 값입니다. + public void Insert(int index, TKey key, TValue value) + { + lock (_lock) + { + if (_dict.ContainsKey(key)) + throw new ArgumentException("이미 존재하는 키입니다."); + _keys.Insert(index, key); + _dict.Add(key, value); + } + } + + /// + /// 사전의 지정된 인덱스에 있는 요소를 제거합니다. + /// 참고: 이 작업은 내부 리스트에서 요소를 제거하므로 O(n)의 시간 복잡도를 가질 수 있습니다. + /// + /// 제거할 요소의 인덱스(0부터 시작)입니다. + public void RemoveAt(int index) + { + lock (_lock) + { + if (index < 0 || index >= _keys.Count) + throw new ArgumentOutOfRangeException(nameof(index)); + + TKey key = _keys[index]; + _keys.RemoveAt(index); + _dict.Remove(key); + } + } + + /// + /// 지정된 인덱스의 값을 가져옵니다. + /// + /// 가져올 값의 인덱스 + /// 지정된 인덱스에 있는 항목의 값 + public TValue GetValueAt(int index) + { + lock (_lock) + { + return _dict[_keys[index]]; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/UVC/Extention/OrderedDictionary.cs.meta b/Assets/Scripts/UVC/Extention/OrderedDictionary.cs.meta new file mode 100644 index 00000000..e6be1d23 --- /dev/null +++ b/Assets/Scripts/UVC/Extention/OrderedDictionary.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fe6fb83b61db8124a88f9d74891f26e9 \ No newline at end of file diff --git a/Assets/Scripts/UVC/ISelectable.cs b/Assets/Scripts/UVC/ISelectable.cs deleted file mode 100644 index bc05f47e..00000000 --- a/Assets/Scripts/UVC/ISelectable.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace UVC.Editor -{ - public interface ISelectable - { - void OnSelect(); - void OnDeselect(); - } -} diff --git a/Assets/Scripts/UVC/ISelectable.cs.meta b/Assets/Scripts/UVC/ISelectable.cs.meta deleted file mode 100644 index dbee8f5d..00000000 --- a/Assets/Scripts/UVC/ISelectable.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: f9156b89e72147142831eb6d58934e49 \ No newline at end of file diff --git a/Assets/Scripts/UVC/InteractionController.cs b/Assets/Scripts/UVC/InteractionController.cs deleted file mode 100644 index 10479e55..00000000 --- a/Assets/Scripts/UVC/InteractionController.cs +++ /dev/null @@ -1,77 +0,0 @@ -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UVC.Editor -{ - public class InteractionController : MonoBehaviour - { - public static event System.Action OnObjectSelected; - public static event System.Action OnBackgroundClicked; - - private Camera _mainCamera; - private EditableObject _selectedObject; - - void Awake() - { - _mainCamera = Camera.main; - } - - void Update() - { - if (Input.GetMouseButtonDown(0)) - { - // UI 위에서 클릭했는지 먼저 확인 - if (EventSystem.current.IsPointerOverGameObject()) - { - return; // UI 클릭 시 월드 객체 선택 방지 - } - - HandleSelection(); - } - } - - private void HandleSelection() - { - Ray ray = _mainCamera.ScreenPointToRay(Input.mousePosition); - // 3D 객체 선택 (Physics Raycast) - if (Physics.Raycast(ray, out RaycastHit hit)) - { - // EditableObject 컴포넌트를 가진 객체인지 확인 - if (hit.collider.TryGetComponent(out var target)) - { - SetSelectedObject(target); - return; - } - } - - // 2D 객체 선택 (Physics2D Raycast) - 필요 시 카메라 설정에 따라 추가 - // RaycastHit2D hit2D = Physics2D.GetRayIntersection(ray); - // if (hit2D.collider != null && hit2D.collider.TryGetComponent(out var target2D)) - // { - // SetSelectedObject(target2D); - // return; - // } - - // 아무것도 선택되지 않았을 경우 - SetSelectedObject(null); - } - - private void SetSelectedObject(EditableObject target) - { - if (_selectedObject == target) return; - - _selectedObject?.OnDeselect(); - _selectedObject = target; - _selectedObject?.OnSelect(); - - if (_selectedObject != null) - { - OnObjectSelected?.Invoke(_selectedObject); - } - else - { - OnBackgroundClicked?.Invoke(); - } - } - } -} diff --git a/Assets/Scripts/UVC/InteractionController.cs.meta b/Assets/Scripts/UVC/InteractionController.cs.meta deleted file mode 100644 index 87fbfab9..00000000 --- a/Assets/Scripts/UVC/InteractionController.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 2f8a7b0a02822c942a8c2846d5a2432a \ No newline at end of file diff --git a/Assets/Scripts/UVC/Object3d/FactoryObject.cs b/Assets/Scripts/UVC/Object3d/FactoryObject.cs new file mode 100644 index 00000000..b3ddca33 --- /dev/null +++ b/Assets/Scripts/UVC/Object3d/FactoryObject.cs @@ -0,0 +1,119 @@ +#nullable enable +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; +using UVC.Extention; +using UVC.UI.Info; + +namespace UVC.Object3d +{ + /// + /// + /// + public class FactoryObject : InteractiveObject + { + // InfoWindow 인스턴스에 대한 참조 + protected InfoWindow infoWindow; + + protected Camera mainCamera; + + protected FactoryObjectInfo? factoryObjectInfo; + public FactoryObjectInfo? FactoryObjectInfo + { + get => factoryObjectInfo; + set + { + factoryObjectInfo = value; + if (value != null) + { + // 객체의 이름을 GameObject의 이름으로 설정합니다. + gameObject.name = value.Name; + } + } + } + + protected Dictionary data = new Dictionary(); + + protected List? dataOrderedMask; + /// + /// InfoWindow에 표시할 데이터의 순서와 항목을 지정하는 마스크입니다. + /// + public List? DataOrderedMask + { + get => dataOrderedMask; + set + { + dataOrderedMask = value; + } + } + + private void Awake() + { + mainCamera = Camera.main; + + // 씬에 있는 InfoWindow 인스턴스를 동적으로 찾습니다. + // FindObjectOfType은 씬에서 해당 타입의 활성화된 첫 번째 객체를 반환합니다. + infoWindow = InfoWindow.Create(); + + if (infoWindow == null) + { + Debug.LogError("씬에서 InfoWindow 컴포넌트를 찾을 수 없습니다. InfoWindow가 씬에 존재하고 활성화되어 있는지 확인해주세요."); + enabled = false; // infoWindow가 없으면 이 스크립트를 비활성화합니다. + } + } + + + /// + /// 포인터 클릭 이벤트를 처리하고 관련 데이터가 포함된 정보 창을 표시합니다. + /// + /// 이 메서드는 정보 창이 현재 표시되어 있는지, 그리고 + /// 유효한 데이터가 있는지 확인합니다. 데이터가 마스크를 사용하여 정렬된 경우 마스크된 데이터만 표시되고, 그렇지 않은 경우 + /// 사용 가능한 모든 데이터가 표시됩니다. 정보 창은 현재 + /// 변환을 기준으로 배치됩니다. + /// 포인터 클릭과 관련된 이벤트 데이터입니다. + public override void OnPointerClick(PointerEventData eventData) + { + if(!infoWindow.IsVisible && data != null && data.Count > 0) + { + Dictionary info = new Dictionary(); + // dataOrderedMask가 설정되어 있으면 해당 순서대로 정보를 가져옵니다. + if (dataOrderedMask != null && dataOrderedMask.Count > 0) + { + foreach (var key in dataOrderedMask) + { + if (data.ContainsKey(key)) + { + info[key] = data[key]; + } + } + } + else + { + // dataOrderedMask가 설정되어 있지 않으면 모든 데이터를 사용합니다. + info = new Dictionary(data); + } + infoWindow.Show(transform, info); + } + } + + /// + /// 변경된 데이터만 업데이트합니다. + /// + /// + public void UpdateData(IDictionary data) + { + foreach (var kvp in data) + { + if (this.data.ContainsKey(kvp.Key)) + { + this.data[kvp.Key] = kvp.Value; + } + else + { + this.data.Add(kvp.Key, kvp.Value); + } + } + } + + } +} diff --git a/Assets/Scripts/UVC/Object3d/InteractionController.cs.meta b/Assets/Scripts/UVC/Object3d/FactoryObject.cs.meta similarity index 100% rename from Assets/Scripts/UVC/Object3d/InteractionController.cs.meta rename to Assets/Scripts/UVC/Object3d/FactoryObject.cs.meta diff --git a/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs b/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs new file mode 100644 index 00000000..e55b5787 --- /dev/null +++ b/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs @@ -0,0 +1,51 @@ +namespace UVC.Object3d +{ + public class FactoryObjectInfo + { + /// + /// 이름 + /// + public string Name { get; set; } + + /// + /// 아이디 + /// + public string Id { get; set; } + + /// + /// 위치 + /// + public string Position { get; set; } + + /// + /// 구역 + /// + public string Area { get; set; } + + /// + /// 층 + /// + public string Floor { get; set; } + + public FactoryObjectInfo(string name, string id, string position, string area, string floor) + { + Name = name; + Id = id; + Position = position; + Area = area; + Floor = floor; + } + + public bool Equals(FactoryObjectInfo other) + { + if (other == null) return false; + return Name == other.Name && Id == other.Id && Position == other.Position && Area == other.Area && Floor == other.Floor; + } + + public override string ToString() + { + return $"Name:{Name},Id:{Id},Position:{Position},Area:{Area},Floor:{Floor}"; + } + + } +} diff --git a/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs.meta b/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs.meta new file mode 100644 index 00000000..bc0428b3 --- /dev/null +++ b/Assets/Scripts/UVC/Object3d/FactoryObjectInfo.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 88a40c66f1e6dad4daa5a1339bd1a0bb \ No newline at end of file diff --git a/Assets/Scripts/UVC/Object3d/InteractionController.cs b/Assets/Scripts/UVC/Object3d/InteractionController.cs deleted file mode 100644 index ec498685..00000000 --- a/Assets/Scripts/UVC/Object3d/InteractionController.cs +++ /dev/null @@ -1,55 +0,0 @@ -#nullable enable -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.EventSystems; -using UVC.Extention; -using UVC.UI.Info; - -namespace UVC.Object3d -{ - /// - /// 사용자의 마우스 클릭 입력을 감지하고 3D 객체와 상호작용합니다. - /// - public class InteractionController : InteractiveObject - { - // InfoWindow 인스턴스에 대한 참조 - private InfoWindow infoWindow; - - private Camera mainCamera; - - private Dictionary? infoData; - - private void Awake() - { - mainCamera = Camera.main; - - // 씬에 있는 InfoWindow 인스턴스를 동적으로 찾습니다. - // FindObjectOfType은 씬에서 해당 타입의 활성화된 첫 번째 객체를 반환합니다. - infoWindow = InfoWindow.Create(); - - if (infoWindow == null) - { - Debug.LogError("씬에서 InfoWindow 컴포넌트를 찾을 수 없습니다. InfoWindow가 씬에 존재하고 활성화되어 있는지 확인해주세요."); - enabled = false; // infoWindow가 없으면 이 스크립트를 비활성화합니다. - } - } - - public override void OnPointerClick(PointerEventData eventData) - { - Dictionary info = new Dictionary - { - { "objectName", gameObject.name }, - { "objectPosition", transform.position }, - { "objectRotation", transform.rotation }, - { "objectScale", transform.localScale } - }; - // 변경 된 정보가 있을 때 클릭된 객체의 정보를 InfoWindow에 전달합니다. - if (!infoWindow.IsVisible && (infoData != null && !infoData.IsSame(info))) - { - infoWindow.Show(transform, info); - infoData = info; - } - } - - } -} diff --git a/Assets/Scripts/UVC/OutlineEffect.cs b/Assets/Scripts/UVC/OutlineEffect.cs deleted file mode 100644 index b79fbdac..00000000 --- a/Assets/Scripts/UVC/OutlineEffect.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Linq; -using UnityEngine; - -namespace UVC.Editor -{ - [RequireComponent(typeof(Renderer))] - public class OutlineEffect : MonoBehaviour - { - [SerializeField] private Material _outlineMaterial; - private Renderer _renderer; - private bool _isOutlined = false; - - void Awake() - { - _renderer = GetComponent(); - } - - public void SetOutline(bool visible) - { - if (_isOutlined == visible) return; - - _isOutlined = visible; - var materials = _renderer.sharedMaterials.ToList(); - if (_isOutlined) - { - materials.Add(_outlineMaterial); - } - else - { - materials.Remove(_outlineMaterial); - } - _renderer.materials = materials.ToArray(); - } - } -} diff --git a/Assets/Scripts/UVC/OutlineEffect.cs.meta b/Assets/Scripts/UVC/OutlineEffect.cs.meta deleted file mode 100644 index 893845fa..00000000 --- a/Assets/Scripts/UVC/OutlineEffect.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 575f56d1e1229a543a23502e94149f71 \ No newline at end of file