Merge branch 'sjm/250402' into sjm/250403
This commit is contained in:
@@ -369,6 +369,50 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157621255}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &183140327
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 183140328}
|
||||
- component: {fileID: 183140329}
|
||||
m_Layer: 0
|
||||
m_Name: InterferedObjectManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &183140328
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 183140327}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1093055756}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &183140329
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 183140327}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0c728344b2bbf5746b1a41daa8ff51b0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &205918190
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4121,6 +4165,26 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4062748835041242030, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4062748835041242030, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4062748835041242030, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5808496954263173159, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5808496954263173159, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7484356029459005624, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Panel_AssetLibrary
|
||||
@@ -4258,6 +4322,7 @@ Transform:
|
||||
- {fileID: 538683123}
|
||||
- {fileID: 617235297}
|
||||
- {fileID: 1801579273}
|
||||
- {fileID: 183140328}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1096619401
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using XED.Asset;
|
||||
using XED.Command;
|
||||
|
||||
namespace XED.Command
|
||||
{
|
||||
public class CreateInterferedObjectButtonCommand : IReversibleCommand
|
||||
{
|
||||
public CreateInterferedObjectButtonCommand()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
|
||||
|
||||
public bool CanExecute()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57aaa2e5b1c74a74b955b7cdc045e483
|
||||
@@ -38,6 +38,8 @@ namespace XED.Asset
|
||||
public CustomAssetDataHandler assetDataHandler;
|
||||
public CustomAssetEventHandler assetEventHandler;
|
||||
|
||||
InterferedObjectManager interferedObjectManager;
|
||||
|
||||
ProjectManager projectManager;
|
||||
void Awake()
|
||||
{
|
||||
@@ -45,8 +47,8 @@ namespace XED.Asset
|
||||
renderObjectHandler = FindFirstObjectByType<RenderObjectHandler>();
|
||||
assetDataHandler = new CustomAssetDataHandler(this);
|
||||
assetEventHandler = new CustomAssetEventHandler(this);
|
||||
projectManager = FindSingle<ProjectManager>();
|
||||
|
||||
projectManager = FindSingle<ProjectManager>();
|
||||
interferedObjectManager = FindSingle<InterferedObjectManager>();
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
@@ -141,6 +143,8 @@ namespace XED.Asset
|
||||
}
|
||||
selectedItem = Instantiate(renderObjectPrefab);
|
||||
selectRenderObject = selectedItem.GetComponent<CustomAssetRenderObject>();
|
||||
selectRenderObject.OnOverlabBegin += interferedObjectManager.AddInterferedPair;
|
||||
selectRenderObject.OnOverlabEnd += interferedObjectManager.RemoveInterferedPair;
|
||||
selectRenderObject.instantiateObject = selectedAssetData.InstantiateLoadedObject;
|
||||
selectRenderObject.getBounds = selectedAssetData.GetCombinedBoundary;
|
||||
selectRenderObject.CreateRenderObject();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -28,6 +29,9 @@ namespace XED.Util
|
||||
|
||||
LayerMask twinObjectMask;
|
||||
|
||||
public event Action<TwinObject, TwinObject> OnOverlabBegin;
|
||||
public event Action<TwinObject, TwinObject> OnOverlabEnd;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
objectRenderer = GetComponentInChildren<MeshRenderer>();
|
||||
@@ -67,6 +71,8 @@ namespace XED.Util
|
||||
}
|
||||
Show();
|
||||
}
|
||||
|
||||
OnOverlabBegin?.Invoke(GetComponent<TwinObject>(), other.GetComponent<TwinObject>());
|
||||
}
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
@@ -83,6 +89,8 @@ namespace XED.Util
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
OnOverlabEnd?.Invoke(GetComponent<TwinObject>(), other.GetComponent<TwinObject>());
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace XED.Manage
|
||||
FBXFileManager fbxFileManager = customAssetConnector.saveLoadFBXData;
|
||||
GameObject componentWindow = canvas_Popup.panel_hierarchy.gameObject;
|
||||
GameObject interferedobjectlistWindow = canvas_Popup.panel_interferedobjectlist.gameObject;
|
||||
|
||||
InterferedObjectManager interferedObjectManager = FindSingle<InterferedObjectManager>();
|
||||
|
||||
|
||||
UIConnection();
|
||||
StatusConnection();
|
||||
ManagerConnection();
|
||||
@@ -61,6 +63,8 @@ namespace XED.Manage
|
||||
|
||||
fbxFileManager.onBeginLoadAsset += (() => assetWindow.SetActive(true));
|
||||
canvas_Popup.panel_objectinfo.onTransformChanged += renderObjectHandler.OnTransformChanged;
|
||||
interferedObjectManager.OnAddInterferedPair += canvas_Popup.panel_interferedobjectlist.CreateContentButton;
|
||||
interferedObjectManager.OnRemoveInterferedPair += canvas_Popup.panel_interferedobjectlist.RemoveContentButton;
|
||||
|
||||
|
||||
projectManager.onLoadAsset += customAssetConnector.OnLoadAsset;
|
||||
|
||||
39
Assets/Scripts/Studio/Managers/InterferedObjectManager.cs
Normal file
39
Assets/Scripts/Studio/Managers/InterferedObjectManager.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TriLibCore.Interfaces;
|
||||
using UnityEngine;
|
||||
using XED.Util;
|
||||
using XRLib;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class InterferedObjectManager : MonoBehaviour, ISingle
|
||||
{
|
||||
HashSet<(TwinObject, TwinObject)> interferedPairs = new();
|
||||
|
||||
public event Action<(TwinObject, TwinObject)> OnAddInterferedPair;
|
||||
public event Action<(TwinObject, TwinObject)> OnRemoveInterferedPair;
|
||||
|
||||
public void AddInterferedPair(TwinObject obj1, TwinObject obj2)
|
||||
{
|
||||
var pair = obj1.GetInstanceID() < obj2.GetInstanceID() ? (obj1, obj2) : (obj2, obj1);
|
||||
|
||||
if (interferedPairs.Contains(pair))
|
||||
return;
|
||||
|
||||
interferedPairs.Add(pair);
|
||||
OnAddInterferedPair?.Invoke(pair);
|
||||
}
|
||||
|
||||
public void RemoveInterferedPair(TwinObject obj1, TwinObject obj2)
|
||||
{
|
||||
var pair = obj1.GetInstanceID() < obj2.GetInstanceID() ? (obj1, obj2) : (obj2, obj1);
|
||||
|
||||
if (!interferedPairs.Contains(pair))
|
||||
return;
|
||||
|
||||
interferedPairs.Remove(pair);
|
||||
OnRemoveInterferedPair?.Invoke(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c728344b2bbf5746b1a41daa8ff51b0
|
||||
@@ -20,16 +20,12 @@ namespace XED
|
||||
[PropertyVisible, Tooltip("µÎ ¹øÂ° info")]
|
||||
public bool IsInteractible;
|
||||
|
||||
Panel_InterferedObjectList panel_InterferedObjectList;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
IsDisplayable = true;
|
||||
IsInteractible = true;
|
||||
physics.Init(this);
|
||||
metaData.Init(this);
|
||||
|
||||
panel_InterferedObjectList = FindSingle<Panel_InterferedObjectList>();
|
||||
}
|
||||
|
||||
public void Binding(IEntity entity)
|
||||
@@ -64,21 +60,5 @@ namespace XED
|
||||
{
|
||||
return JsonConvert.SerializeObject(entity);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!other.TryGetComponent<TwinObject>(out TwinObject contracter))
|
||||
return;
|
||||
|
||||
panel_InterferedObjectList.CreateContentButton(this, contracter);
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!other.TryGetComponent<TwinObject>(out TwinObject contracter))
|
||||
return;
|
||||
|
||||
panel_InterferedObjectList.RemoveContentButton(this, contracter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XED.Util;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XED.Util;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class Panel_InterferedObjectList : PanelBase, ISingle
|
||||
public class Panel_InterferedObjectList : PanelBase
|
||||
{
|
||||
Button Button_Close;
|
||||
RectTransform content;
|
||||
GameObject buttonPrefab;
|
||||
|
||||
HashSet<(TwinObject, TwinObject)> createdPairs = new();
|
||||
Dictionary<(TwinObject, TwinObject), UI_InterferedObjectButton> createdButtons = new();
|
||||
|
||||
public override void AfterAwake()
|
||||
@@ -20,31 +20,18 @@ namespace XED.UI
|
||||
Button_Close.onClick.AddListener(OnClickClose);
|
||||
content = GetComponentInChildren<ScrollRect>().content;
|
||||
buttonPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_InterferedObjectButton");
|
||||
|
||||
}
|
||||
|
||||
public void CreateContentButton(TwinObject obj1, TwinObject obj2)
|
||||
public void CreateContentButton((TwinObject, TwinObject) pair)
|
||||
{
|
||||
var pair = obj1.GetInstanceID() < obj2.GetInstanceID() ? (obj1, obj2) : (obj2, obj1);
|
||||
|
||||
if (createdPairs.Contains(pair))
|
||||
return;
|
||||
|
||||
var newButton = Instantiate(buttonPrefab, content).GetComponent<UI_InterferedObjectButton>();
|
||||
createdPairs.Add(pair);
|
||||
createdButtons.Add(pair, newButton);
|
||||
newButton.Initialize(obj1, obj2);
|
||||
newButton.Initialize(pair.Item1, pair.Item2);
|
||||
}
|
||||
|
||||
public void RemoveContentButton(TwinObject obj1, TwinObject obj2)
|
||||
public void RemoveContentButton((TwinObject, TwinObject) pair)
|
||||
{
|
||||
var pair = obj1.GetInstanceID() < obj2.GetInstanceID() ? (obj1, obj2) : (obj2, obj1);
|
||||
|
||||
if (!createdPairs.Contains(pair))
|
||||
return;
|
||||
|
||||
Destroy(createdButtons[pair].gameObject);
|
||||
createdPairs.Remove(pair);
|
||||
createdButtons.Remove(pair);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user