diff --git a/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs b/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs index 799da301..60c76a91 100644 --- a/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs +++ b/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs @@ -36,16 +36,13 @@ namespace XED.Asset public CustomAssetEventHandler assetEventHandler; public CustomAssetCommandHandler assetCommandHandler; - Panel_InterferedObjectList panel_InterferedObjectList; - void Awake() { saveLoadFBXData = FindFirstObjectByType(); renderObjectHandler = FindFirstObjectByType(); assetDataHandler = new CustomAssetDataHandler(this); assetEventHandler = new CustomAssetEventHandler(this); - assetCommandHandler = new CustomAssetCommandHandler(this); - panel_InterferedObjectList = FindAnyObjectByType(); + assetCommandHandler = new CustomAssetCommandHandler(this); } void Start() { @@ -112,12 +109,6 @@ namespace XED.Asset selectRenderObject.CreateRenderObject(); selectRenderObject.Select(); selectedAssetData.AddTransformToRender(selectedItem.transform); - TwinObject selectedTwinObject = selectedItem.GetComponent(); - if (selectedTwinObject != null) - { - selectedTwinObject.OnTwinConflictEvent += panel_InterferedObjectList.CreateContentButton; - selectedTwinObject.OnTwinDeconflictEvent += panel_InterferedObjectList.RemoveContentButton; - } } public void OnAssetDropped(HierarchyItem item) { diff --git a/Assets/Scripts/Studio/TwinObject/TwinObject.cs b/Assets/Scripts/Studio/TwinObject/TwinObject.cs index 05318ec3..8183be30 100644 --- a/Assets/Scripts/Studio/TwinObject/TwinObject.cs +++ b/Assets/Scripts/Studio/TwinObject/TwinObject.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using System; using UnityEngine; using XED.Attributes; +using XED.UI; using XED.VirtualFactory; namespace XED @@ -20,8 +21,7 @@ namespace XED [PropertyVisible, Tooltip("µÎ ¹øÂ° info")] public bool IsInteractible; - public Action OnTwinConflictEvent; - public Action OnTwinDeconflictEvent; + Panel_InterferedObjectList panel_InterferedObjectList; public override void AfterAwake() { @@ -29,6 +29,8 @@ namespace XED IsInteractible = true; physics.Init(this); metaData.Init(this); + + panel_InterferedObjectList = FindSingle(); } public void Binding(IEntity entity) { @@ -68,7 +70,7 @@ namespace XED if (!other.TryGetComponent(out TwinObject contracter)) return; - Conflict(contracter); + panel_InterferedObjectList.CreateContentButton(this, contracter); } private void OnTriggerExit(Collider other) @@ -76,23 +78,8 @@ namespace XED if (!other.TryGetComponent(out TwinObject contracter)) return; - Deconflict(contracter); + panel_InterferedObjectList.RemoveContentButton(this, contracter); } - void Conflict(TwinObject contract) - { - OnTwinConflictEvent?.Invoke(this, contract); - } - - void Deconflict(TwinObject contract) - { - OnTwinDeconflictEvent?.Invoke(this, contract); - } - - private void OnDestroy() - { - OnTwinConflictEvent = null; - OnTwinDeconflictEvent = null; - } } } \ No newline at end of file diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_InterferedObjectList.cs b/Assets/Scripts/Studio/UI/Panel/Panel_InterferedObjectList.cs index c6697eac..22ae7f90 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_InterferedObjectList.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_InterferedObjectList.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; +using XRLib; using XRLib.UI; namespace XED.UI { - public class Panel_InterferedObjectList : PanelBase + public class Panel_InterferedObjectList : PanelBase, ISingle { Button Button_Close; RectTransform content;