Hierarchy, AssetLibrary 스크립트 분리 #64
1175
Assets/Resources/Prefabs/UI/PRF_AssetLibraryItem.prefab
Normal file
1175
Assets/Resources/Prefabs/UI/PRF_AssetLibraryItem.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e62001ea460aa642abd1fbdaf7aeef4
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -187,7 +187,7 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 4015588128209844106}
|
||||
- m_Target: {fileID: 0}
|
||||
m_TargetAssemblyTypeName: ScrollItemUI, Assembly-CSharp
|
||||
m_MethodName: ToggleExpandCollapse
|
||||
m_Mode: 1
|
||||
@@ -575,7 +575,7 @@ GameObject:
|
||||
- component: {fileID: 9006872392457284266}
|
||||
- component: {fileID: 8477375491772574401}
|
||||
- component: {fileID: 3780121772043696551}
|
||||
- component: {fileID: 4015588128209844106}
|
||||
- component: {fileID: -5127072004719193365}
|
||||
m_Layer: 5
|
||||
m_Name: PRF_HierarchyItem
|
||||
m_TagString: Untagged
|
||||
@@ -671,7 +671,7 @@ MonoBehaviour:
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &4015588128209844106
|
||||
--- !u!114 &-5127072004719193365
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -680,7 +680,7 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 3462696633915938941}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3966a0ccff02f5b44b226385d4acbce6, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: f0bda0c2ecf40cb46b79090671565e7a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
nameText: {fileID: 197987882297848403}
|
||||
@@ -715,20 +715,20 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
selectedColor: {r: 1, g: 0, b: 0, a: 0.47058824}
|
||||
hoverColor: {r: 0.8396226, g: 0.16237983, b: 0.16237983, a: 0.47058824}
|
||||
hoverColor: {r: 0.8392157, g: 0.16078432, b: 0.16078432, a: 0.47058824}
|
||||
upperLine: {fileID: 2946232207523233411}
|
||||
lowerLine: {fileID: 4764771198905317747}
|
||||
lineColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
lineColor: {r: 1, g: 0, b: 0, a: 0.47058824}
|
||||
highLight: {fileID: 4406185178758208484}
|
||||
itemSprites:
|
||||
- type: 1
|
||||
sprite: {fileID: 21300000, guid: 843b0cd3e5f6646f6b1992c54699fa62, type: 3}
|
||||
sprite: {fileID: 21300000, guid: aeb5d9c57606d4dfe8a6b9fbf2f02724, type: 3}
|
||||
- type: 2
|
||||
sprite: {fileID: 21300000, guid: 13092802db0264b23b9440b2e0cdc512, type: 3}
|
||||
sprite: {fileID: 21300000, guid: 11d239518c86e4f1a96c2548526f2d01, type: 3}
|
||||
- type: 3
|
||||
sprite: {fileID: 21300000, guid: 89898a01151c19c4580b1470257609cd, type: 3}
|
||||
- type: 4
|
||||
sprite: {fileID: 21300000, guid: f2b5e142dbcc84d60a79a67f508407f4, type: 3}
|
||||
sprite: {fileID: 21300000, guid: 2a742499639b14fb6b84e6ee26c79416, type: 3}
|
||||
- type: 5
|
||||
sprite: {fileID: 21300000, guid: 7ba72824288e08d4cb3289c7b83c4fb5, type: 3}
|
||||
isSelected: 0
|
||||
|
||||
@@ -301,6 +301,23 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
prf_LinkDataUI: {fileID: 3588877776299194241, guid: 9f62a52c6a3d48947b57fdd4f941a260, type: 3}
|
||||
body: {fileID: 1617081465}
|
||||
--- !u!1 &151726775 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 1986159252352877611, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
m_PrefabInstance: {fileID: 297039007}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &151726777
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 151726775}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cc5c360456b9e024b9f8086a48c83331, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &157533902
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -725,6 +742,11 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 228222345}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!224 &245495201 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 7269315550475766926, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1071471324}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &247025118
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -993,11 +1015,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4926694108229151116, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4926694108229151116, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7037160010838976915, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
@@ -1013,9 +1035,21 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 7997719753715833387, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
- {fileID: 7384204056437819368, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
- {fileID: 2892856486240836700, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
- {fileID: 5837102469366969298, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 7433254547843893619, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 545396303}
|
||||
- targetCorrespondingSourceObject: {fileID: 7433254547843893619, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 545396302}
|
||||
- targetCorrespondingSourceObject: {fileID: 1986159252352877611, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 151726777}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
--- !u!224 &297039008 stripped
|
||||
RectTransform:
|
||||
@@ -1274,10 +1308,24 @@ PrefabInstance:
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedComponents:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 9212912866775810492, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
- {fileID: 7960851107803094795, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
- {fileID: 2895410154246721519, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 712989226239373666, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1712223852}
|
||||
- targetCorrespondingSourceObject: {fileID: 712989226239373666, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1712223851}
|
||||
- targetCorrespondingSourceObject: {fileID: 5679087631209130613, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1495096692}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
--- !u!1 &351287972
|
||||
GameObject:
|
||||
@@ -1311,6 +1359,17 @@ Transform:
|
||||
- {fileID: 741022416}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &378374035 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 5239349785135887062, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &391151067
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2444,6 +2503,85 @@ Transform:
|
||||
- {fileID: 759321983}
|
||||
m_Father: {fileID: 1093055756}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &545396296 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7433254547843893619, guid: 82511e73cbe6181438fd98254170e476, type: 3}
|
||||
m_PrefabInstance: {fileID: 297039007}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &545396302
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 545396296}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 448ec7391867608489f206f58b3630af, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
searchInput: {fileID: 0}
|
||||
onSelect:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onParentChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onHover:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
isSiblingEditable: 0
|
||||
--- !u!114 &545396303
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 545396296}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cab9a4db9e60ee84f94fb7ae134fbcc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 0}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
passDragToChildren: 1
|
||||
setToChildItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToPriorSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToNextSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragBegin:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragAndDrop:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
itemPopup: {fileID: 0}
|
||||
menuPopup: {fileID: 0}
|
||||
onExit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &545811780
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2920,6 +3058,17 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &713159441 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 2079917933779035735, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &741022415
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3026,6 +3175,11 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 729a2ee4bef76d34aa641f7254b67f3b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!224 &756595188 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5577640530772520038, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &759321982
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3072,6 +3226,17 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_isEnabled: 1
|
||||
_actionLimit: 50
|
||||
--- !u!114 &763331480 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 689613192064771489, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1071471324}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &798680914
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3438,6 +3603,85 @@ MonoBehaviour:
|
||||
_name: Orbit
|
||||
_staticData:
|
||||
CanHaveMouseButtons: 1
|
||||
--- !u!1 &845276415 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 3409657278186462712, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1071471324}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &845276417
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 845276415}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5b91609659b374d4d89246a2b7f4f990, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
searchInput: {fileID: 1406997741}
|
||||
onSelect:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onParentChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onHover:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
isSiblingEditable: 0
|
||||
--- !u!114 &845276418
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 845276415}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fc24e335961d7d8409f2bc9cc2d7ef00, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 245495201}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 10
|
||||
m_Viewport: {fileID: 1458018270}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 763331480}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
passDragToChildren: 1
|
||||
setToChildItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToPriorSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToNextSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragBegin:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragAndDrop:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
itemPopup: {fileID: 0}
|
||||
menuPopup: {fileID: 0}
|
||||
onExit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &880472957
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3615,6 +3859,11 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 1086541728698475203, guid: ab86017dea8f4f549b71b4a6fa12b3ec, type: 3}
|
||||
m_PrefabInstance: {fileID: 916751973}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &974887642 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5533745587376848395, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &982431036
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4185,16 +4434,28 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5808496954263173159, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7484356029459005624, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Panel_AssetLibrary
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
- target: {fileID: 7484356029459005624, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 342864130844440066, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
- {fileID: 892358076823065835, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 3409657278186462712, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 845276418}
|
||||
- targetCorrespondingSourceObject: {fileID: 3409657278186462712, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 845276417}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
--- !u!224 &1071471325 stripped
|
||||
RectTransform:
|
||||
@@ -8733,6 +8994,17 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1321269470}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &1406997741 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 6137145368396620085, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1071471324}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &1439596646
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -8955,6 +9227,11 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1441967167}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!224 &1458018270 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 4062748835041242030, guid: 3335bcff08be47a4baa17f7fde07b24e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1071471324}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1464917248
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -9075,6 +9352,23 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1464917248}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1495096690 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 5679087631209130613, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1495096692
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1495096690}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cc5c360456b9e024b9f8086a48c83331, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1541677883
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -9978,6 +10272,85 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 9204995643987852086, guid: b7fb9c984bb17994ca59c9312245bd9e, type: 3}
|
||||
m_PrefabInstance: {fileID: 1712022042}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1712223849 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 712989226239373666, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
m_PrefabInstance: {fileID: 307970698}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1712223851
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1712223849}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 448ec7391867608489f206f58b3630af, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
searchInput: {fileID: 713159441}
|
||||
onSelect:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onParentChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onHover:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
isSiblingEditable: 1
|
||||
--- !u!114 &1712223852
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1712223849}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cab9a4db9e60ee84f94fb7ae134fbcc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 756595188}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 10
|
||||
m_Viewport: {fileID: 974887642}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 378374035}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
passDragToChildren: 1
|
||||
setToChildItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToPriorSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
setToNextSiblingItem:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragBegin:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onDragAndDrop:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
itemPopup: {fileID: 0}
|
||||
menuPopup: {fileID: 0}
|
||||
onExit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!224 &1715748516 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5401784972116968138, guid: 6b6204170622c2248aa45b7084250442, type: 3}
|
||||
|
||||
@@ -11,15 +11,16 @@ using UnityEditor;
|
||||
using System;
|
||||
using XED.Core;
|
||||
using System.Collections;
|
||||
using XED.AssetLibraryTree;
|
||||
|
||||
namespace XED.Asset
|
||||
{
|
||||
public class CustomAssetConnector : Manager
|
||||
{
|
||||
public PooledScrollView assetScrollView;
|
||||
public CustomScrollRect assetScrollRect;
|
||||
public PooledScrollView componentScrollView;
|
||||
public PooledScrollView InterworkingDataScrollView;
|
||||
public AssetLibraryPooledScrollView assetScrollView;
|
||||
public AssetLibraryScrollRect assetScrollRect;
|
||||
public HierarchyPooledScrollView componentScrollView;
|
||||
public HierarchyPooledScrollView InterworkingDataScrollView;
|
||||
public Panel_ObjectDistance panel_ObjectDistance;
|
||||
public GameObject renderObjectPrefab;
|
||||
public float objectShowDistance = 1000.0f;
|
||||
@@ -98,7 +99,7 @@ namespace XED.Asset
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAssetSelected(HierarchyItem item)
|
||||
public void OnAssetSelected(AssetLibraryItem item)
|
||||
{
|
||||
if (item == null || item.linkedObject == null)
|
||||
{
|
||||
@@ -123,7 +124,7 @@ namespace XED.Asset
|
||||
selectedAssetData.AddTransformToRender(selectedItem.transform);
|
||||
CoroutineRunner.instance.StartCoroutine(ChangeSelectedAssetTransform());
|
||||
}
|
||||
public void OnAssetDropped(HierarchyItem item)
|
||||
public void OnAssetDropped(AssetLibraryItem item)
|
||||
{
|
||||
if (selectedAssetData == null)
|
||||
return;
|
||||
@@ -171,7 +172,7 @@ namespace XED.Asset
|
||||
}
|
||||
public void OnLoadAsset(AssetData asset)
|
||||
{
|
||||
HierarchyItem item = assetScrollView.FindItem(asset.name, HierarchyItemType.file);
|
||||
AssetLibraryItem item = assetScrollView.FindItem(asset.name, AssetLibraryItemType.file);
|
||||
OnAssetSelected(item);
|
||||
selectRenderObject.transform.position = new Vector3(asset.position.x, asset.position.y, asset.position.z);
|
||||
selectRenderObject.transform.eulerAngles = new Vector3(asset.rotation.x, asset.rotation.y, asset.rotation.z);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using XED.Asset;
|
||||
using XED.AssetLibraryTree;
|
||||
using XED.HierarchyTree;
|
||||
using XED.Manage;
|
||||
using XED.Util;
|
||||
@@ -10,8 +11,8 @@ namespace XED
|
||||
public void OnLoadFbxFile(string objectName, string folderName, CustomAssetData assetData)
|
||||
{
|
||||
var connector = ManagerHub.instance.Get<CustomAssetConnector>();
|
||||
HierarchyItem parent = connector.assetScrollView.FindItem(folderName, HierarchyItemType.folder) ?? connector.assetScrollView.AddItem(folderName, null, HierarchyItemType.folder);
|
||||
HierarchyItem item = connector.assetScrollView.AddItem(objectName, assetData.gameObject, HierarchyItemType.file, parent);
|
||||
AssetLibraryItem parent = connector.assetScrollView.FindItem(folderName, AssetLibraryItemType.folder) ?? connector.assetScrollView.AddItem(folderName, null, AssetLibraryItemType.folder);
|
||||
AssetLibraryItem item = connector.assetScrollView.AddItem(objectName, assetData.gameObject, AssetLibraryItemType.file, parent);
|
||||
assetData.onLoadProgress.RemoveAllListeners();
|
||||
assetData.onLoadProgress.AddListener((x) => item.onLoadProgress?.Invoke(x));
|
||||
}
|
||||
@@ -19,7 +20,7 @@ namespace XED
|
||||
public void OnRemoveFbxFile(string objectName)
|
||||
{
|
||||
var connector = ManagerHub.instance.Get<CustomAssetConnector>();
|
||||
connector.assetScrollView.RemoveItem(objectName, HierarchyItemType.file);
|
||||
connector.assetScrollView.RemoveItem(objectName, AssetLibraryItemType.file);
|
||||
}
|
||||
|
||||
public void SaveSelectedAssetDatasToLocal()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using XED.AssetLibraryTree;
|
||||
using XED.HierarchyTree;
|
||||
using XED.Manage;
|
||||
using XED.Util;
|
||||
@@ -36,7 +37,7 @@ namespace XED.Asset
|
||||
connector.OnSelectObjects(name, selectedObjects);
|
||||
}
|
||||
|
||||
public void OnSelectAssetFromHierarchy(List<HierarchyItem> selectedItems)
|
||||
public void OnSelectAssetFromHierarchy(List<AssetLibraryItem> selectedItems)
|
||||
{
|
||||
var connector = ManagerHub.instance.Get<CustomAssetConnector>();
|
||||
connector.selectedAssetDatas.Clear();
|
||||
@@ -46,7 +47,7 @@ namespace XED.Asset
|
||||
}
|
||||
for (int i = 0; i < selectedItems.Count; i++)
|
||||
{
|
||||
HierarchyItem assetItem = selectedItems[i];
|
||||
AssetLibraryItem assetItem = selectedItems[i];
|
||||
CustomAssetData assetData = null;
|
||||
if (assetItem.linkedObject)
|
||||
{
|
||||
|
||||
@@ -2,19 +2,20 @@ using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using XED.HierarchyTree;
|
||||
using UnityEngine.UI;
|
||||
using XED.AssetLibraryTree;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class Panel_AssetLibrary : PanelBase
|
||||
{
|
||||
public CustomScrollRect scrollRect;
|
||||
public PooledScrollView scrollView;
|
||||
public AssetLibraryScrollRect scrollRect;
|
||||
public AssetLibraryPooledScrollView scrollView;
|
||||
public Button Button_Close;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
scrollRect = GetComponentInChildren<CustomScrollRect>();
|
||||
scrollView = GetComponentInChildren<PooledScrollView>();
|
||||
scrollRect = GetComponentInChildren<AssetLibraryScrollRect>();
|
||||
scrollView = GetComponentInChildren<AssetLibraryPooledScrollView>();
|
||||
}
|
||||
|
||||
public override void AfterAwake()
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XED.AssetLibraryTree;
|
||||
using XED.HierarchyTree;
|
||||
using XED.Util;
|
||||
using XRLib.UI;
|
||||
@@ -46,7 +47,7 @@ namespace XED.UI
|
||||
onClickPreview?.Invoke(testArray);
|
||||
}
|
||||
|
||||
public void Open(List<HierarchyItem> selectedItems)
|
||||
public void Open(List<AssetLibraryItem> selectedItems)
|
||||
{
|
||||
Init();
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace XED.UI
|
||||
{
|
||||
public class Panel_Hierarchy : PanelBase//UnityEngine.MonoBehaviour
|
||||
{
|
||||
public CustomScrollRect scrollRect;
|
||||
public PooledScrollView scrollView;
|
||||
public HierarchyScrollRect scrollRect;
|
||||
public HierarchyPooledScrollView scrollView;
|
||||
public Button Button_Close;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
scrollRect = GetComponentInChildren<CustomScrollRect>();
|
||||
scrollView = GetComponentInChildren<PooledScrollView>();
|
||||
scrollRect = GetComponentInChildren<HierarchyScrollRect>();
|
||||
scrollView = GetComponentInChildren<HierarchyPooledScrollView>();
|
||||
}
|
||||
|
||||
public override void AfterAwake()
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace XED.UI
|
||||
{
|
||||
public class Panel_InterworkingDataList : PanelBase
|
||||
{
|
||||
public CustomScrollRect scrollRect;
|
||||
public PooledScrollView scrollView;
|
||||
public HierarchyScrollRect scrollRect;
|
||||
public HierarchyPooledScrollView scrollView;
|
||||
public Button Button_Close;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
scrollRect = GetComponentInChildren<CustomScrollRect>();
|
||||
scrollView = GetComponentInChildren<PooledScrollView>();
|
||||
scrollRect = GetComponentInChildren<HierarchyScrollRect>();
|
||||
scrollView = GetComponentInChildren<HierarchyPooledScrollView>();
|
||||
}
|
||||
|
||||
public override void AfterAwake()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Ookii.Dialogs;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using XED.HierarchyTree;
|
||||
using XED.AssetLibraryTree;
|
||||
using XED.Util;
|
||||
using XRLib.UI;
|
||||
|
||||
@@ -22,7 +20,7 @@ namespace XED.UI
|
||||
{
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
}
|
||||
public void HandleOpenClose(HierarchyItem selectedItem)
|
||||
public void HandleOpenClose(AssetLibraryItem selectedItem)
|
||||
{
|
||||
if (selectedItem == null)
|
||||
{
|
||||
|
||||
218
Assets/Scripts/Studio/UI/TreeView/AssetLibraryItem.cs
Normal file
218
Assets/Scripts/Studio/UI/TreeView/AssetLibraryItem.cs
Normal file
@@ -0,0 +1,218 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace XED.AssetLibraryTree
|
||||
{
|
||||
public enum AssetLibraryItemType
|
||||
{
|
||||
none, folder, file, obj, fbx, data
|
||||
}
|
||||
public class AssetLibraryItem
|
||||
{
|
||||
public string name;
|
||||
public int layerNum;
|
||||
public AssetLibraryItem parent;
|
||||
public GameObject linkedObject;
|
||||
public List<AssetLibraryItem> children;
|
||||
public bool isExpanded = true;
|
||||
public AssetLibraryItemType type;
|
||||
public UnityEvent<AssetLibraryItem, AssetLibraryItem> onParentChanged;
|
||||
public UnityEvent<float> onLoadProgress = new UnityEvent<float>();
|
||||
public AssetLibraryItem(string name)
|
||||
{
|
||||
this.name = name;
|
||||
children = new List<AssetLibraryItem>();
|
||||
}
|
||||
public AssetLibraryItem(string name, int layerNum)
|
||||
{
|
||||
this.name = name;
|
||||
this.layerNum = layerNum;
|
||||
children = new List<AssetLibraryItem>();
|
||||
}
|
||||
public AssetLibraryItem(AssetLibraryItem item)
|
||||
{
|
||||
this.name = item.name;
|
||||
this.layerNum = item.layerNum;
|
||||
this.parent = item.parent;
|
||||
this.isExpanded = false;
|
||||
this.type = item.type;
|
||||
this.onParentChanged = item.onParentChanged;
|
||||
children = new List<AssetLibraryItem>();
|
||||
for (int i = 0; i < item.children.Count; i++)
|
||||
{
|
||||
AssetLibraryItem copyChild = item.children[i].Copy();
|
||||
children.Add(copyChild);
|
||||
copyChild.parent = this;
|
||||
}
|
||||
ResetLayerNum();
|
||||
}
|
||||
public void AddChild(AssetLibraryItem item, int index = -1)
|
||||
{
|
||||
if (HasChildItem(item)) return;
|
||||
if (index < 0 || index >= children.Count) children.Add(item);
|
||||
else children.Insert(index, item);
|
||||
item.parent = this;
|
||||
item.ResetLayerNum();
|
||||
onParentChanged?.Invoke(this, item);
|
||||
}
|
||||
public void AddToPriorSibling(AssetLibraryItem item)
|
||||
{
|
||||
if (parent == null) return;
|
||||
int index = parent.children.FindIndex(x => x == this);
|
||||
parent.children.Insert(index, item);
|
||||
if (item.parent != parent)
|
||||
{
|
||||
onParentChanged?.Invoke(parent, item);
|
||||
item.parent = parent;
|
||||
}
|
||||
item.ResetLayerNum();
|
||||
}
|
||||
public void AddToNextSibling(AssetLibraryItem item)
|
||||
{
|
||||
if (parent == null) return;
|
||||
int index = parent.children.FindIndex(x => x == this);
|
||||
if (index >= 0 && index == parent.children.Count - 1)
|
||||
{
|
||||
parent.AddChild(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.children.Insert(index + 1, item);
|
||||
}
|
||||
if (item.parent != parent)
|
||||
{
|
||||
onParentChanged?.Invoke(parent, item);
|
||||
item.parent = parent;
|
||||
}
|
||||
item.ResetLayerNum();
|
||||
}
|
||||
public bool RemoveItem(AssetLibraryItem item)
|
||||
{
|
||||
if (item == null) return false;
|
||||
if (children.Contains(item))
|
||||
{
|
||||
children.Remove(item);
|
||||
return true;
|
||||
}
|
||||
foreach (AssetLibraryItem childItem in children)
|
||||
{
|
||||
if (childItem.RemoveItem(item))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void ResetLayerNum()
|
||||
{
|
||||
layerNum = parent.layerNum + 1;
|
||||
foreach (AssetLibraryItem childItem in children)
|
||||
{
|
||||
childItem.ResetLayerNum();
|
||||
}
|
||||
}
|
||||
public List<AssetLibraryItem> GetAll(bool includeCollapsed = false)
|
||||
{
|
||||
List<AssetLibraryItem> items = new List<AssetLibraryItem>();
|
||||
AssetLibraryItem node = GetNext(includeCollapsed);
|
||||
while (node != null && node.layerNum > layerNum)
|
||||
{
|
||||
items.Add(node);
|
||||
node = node.GetNext(includeCollapsed);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
public AssetLibraryItem Find(string name, AssetLibraryItemType type = AssetLibraryItemType.none)
|
||||
{
|
||||
AssetLibraryItem node = GetNext(true);
|
||||
while (node != null && node.layerNum != layerNum)
|
||||
{
|
||||
if (node.name.Equals(name) && (type == AssetLibraryItemType.none || type == node.type))
|
||||
{
|
||||
return node;
|
||||
}
|
||||
node = node.GetNext(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public List<AssetLibraryItem> FindAll(string name)
|
||||
{
|
||||
List<AssetLibraryItem> items = new List<AssetLibraryItem>();
|
||||
AssetLibraryItem node = GetNext(true);
|
||||
while (node != null && node.layerNum != layerNum)
|
||||
{
|
||||
if (node.name.Contains(name))
|
||||
items.Add(node);
|
||||
node = node.GetNext(true);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
public void ExpandInHierarchy()
|
||||
{
|
||||
AssetLibraryItem parentItem = parent;
|
||||
while (parentItem != null)
|
||||
{
|
||||
parentItem.isExpanded = true;
|
||||
parentItem = parentItem.parent;
|
||||
}
|
||||
}
|
||||
public AssetLibraryItem GetNext(bool includeCollapsed = false)
|
||||
{
|
||||
if (children.Count > 0 && (isExpanded || includeCollapsed)) return children[0];
|
||||
if (parent == null) return null;
|
||||
return parent.GetNext(this);
|
||||
}
|
||||
public AssetLibraryItem GetNext(AssetLibraryItem item)
|
||||
{
|
||||
int index = children.FindIndex(x => x == item);
|
||||
if (index == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (index >= 0 && index == children.Count - 1)
|
||||
{
|
||||
if (parent == null) return null;
|
||||
return parent.GetNext(this);
|
||||
}
|
||||
return children[index + 1];
|
||||
}
|
||||
public AssetLibraryItem GetNextSibling()
|
||||
{
|
||||
if (parent == null) return null;
|
||||
int index = GetSiblingIndex();
|
||||
if (index == parent.children.Count - 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return parent.children[index + 1];
|
||||
}
|
||||
public bool HasChildItem(AssetLibraryItem item)
|
||||
{
|
||||
return GetAll(true).Contains(item);
|
||||
}
|
||||
public int GetSiblingIndex()
|
||||
{
|
||||
return parent.children.FindIndex(x => x == this);
|
||||
}
|
||||
public int GetItemIndexInHierarchy(AssetLibraryItem item)
|
||||
{
|
||||
int index = 0;
|
||||
AssetLibraryItem node = GetNext(true);
|
||||
while (node != null && node.layerNum > layerNum)
|
||||
{
|
||||
if (node == item)
|
||||
{
|
||||
break;
|
||||
}
|
||||
node = node.GetNext(true);
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
public AssetLibraryItem Copy()
|
||||
{
|
||||
AssetLibraryItem copyItem = new AssetLibraryItem(this);
|
||||
return copyItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02c8aba09b6cf79448d6d0699308f932
|
||||
guid: cc3b811d06dede948a51fd4990d95cd8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,525 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
using UnityEngine.Events;
|
||||
using TMPro;
|
||||
using XED.Manage;
|
||||
using Unity.Hierarchy;
|
||||
using XED.Core;
|
||||
using XED.Command;
|
||||
|
||||
namespace XED.AssetLibraryTree
|
||||
{
|
||||
public class AssetLibraryPooledScrollView : MonoBehaviour
|
||||
{
|
||||
private RectTransform content; // Content RectTransform of the ScrollView.
|
||||
private AssetLibraryScrollRect scrollRect; // ScrollRect component.
|
||||
[SerializeField]
|
||||
private TMP_InputField searchInput;
|
||||
//private Button searchCancelButton;
|
||||
private GameObject itemPrefab; // Prefab for scroll items.
|
||||
private ObjectPool<AssetLibraryScrollItemUI> pool; // Pool for UI items.
|
||||
private List<AssetLibraryItem> data = new List<AssetLibraryItem>(); // The list of hierarchy items.
|
||||
private AssetLibraryItem root;
|
||||
|
||||
private List<AssetLibraryScrollItemUI> activeItems = new List<AssetLibraryScrollItemUI>();
|
||||
public List<AssetLibraryItem> selectedItems = new List<AssetLibraryItem>();
|
||||
private AssetLibraryItem lastSelectedItem = null;
|
||||
|
||||
private float itemHeight; // Height of a single item.
|
||||
private int visibleItemCount; // Number of visible items that fit in the viewport.
|
||||
private int currentIndex = -1; // The index of the first visible item.
|
||||
|
||||
public UnityEvent<List<AssetLibraryItem>> onSelect;
|
||||
public UnityEvent<AssetLibraryItem, AssetLibraryItem> onParentChanged;
|
||||
public UnityEvent<AssetLibraryItem> onHover;
|
||||
|
||||
public bool isSiblingEditable;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
content = Find<RectTransform>("Content");
|
||||
scrollRect = GetComponent<AssetLibraryScrollRect>();
|
||||
if (searchInput == null)
|
||||
{
|
||||
searchInput = GetComponentInChildren<TMP_InputField>();
|
||||
}
|
||||
//searchCancelButton = UtilityFunction.FindDeepChild(transform, "Button_SearchBar").GetComponent<Button>();
|
||||
itemPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_AssetLibraryItem");
|
||||
|
||||
//스크롤 뷰에 사용될 오브젝트 풀을 미리 20개 생성
|
||||
pool = new ObjectPool<AssetLibraryScrollItemUI>(
|
||||
createFunc: () => Instantiate(itemPrefab).GetComponent<AssetLibraryScrollItemUI>(),
|
||||
actionOnGet: (item) => item.gameObject.SetActive(true),
|
||||
actionOnRelease: (item) => item.gameObject.SetActive(false),
|
||||
actionOnDestroy: (item) => Destroy(item.gameObject),
|
||||
defaultCapacity: 20,
|
||||
maxSize: 40);
|
||||
|
||||
root = new AssetLibraryItem("Root", -1);
|
||||
root.onParentChanged = onParentChanged;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
//스크롤뷰의 값이 변할때마다 내용물 갱신해주는 함수 콜백 추가
|
||||
scrollRect.onValueChanged.AddListener(OnScrollValueChanged);
|
||||
scrollRect.setToChildItem.AddListener(SetToChildItem);
|
||||
scrollRect.setToPriorSiblingItem.AddListener(SetToPriorSiblingItem);
|
||||
scrollRect.setToNextSiblingItem.AddListener(SetToNextSiblingItem);
|
||||
//아이템 하나당 높이값 저장
|
||||
itemHeight = itemPrefab.GetComponent<RectTransform>().rect.height;
|
||||
//뷰포트에 몇개의 아이템이 보이는지 한개의 여유분을 두고 계산
|
||||
visibleItemCount = Mathf.CeilToInt(scrollRect.GetComponent<RectTransform>().sizeDelta.y / itemHeight) + 1;
|
||||
|
||||
searchInput.onValueChanged.AddListener(SearchData);
|
||||
//searchCancelButton.onClick.RemoveAllListeners();
|
||||
//searchCancelButton.onClick.AddListener(CancelSearch);
|
||||
|
||||
ResetData();
|
||||
}
|
||||
public AssetLibraryItem AddItem(string name, GameObject linkedObject, AssetLibraryItemType type, AssetLibraryItem parent = null)
|
||||
{
|
||||
AssetLibraryItem tempItem = new AssetLibraryItem(name);
|
||||
tempItem.linkedObject = linkedObject;
|
||||
tempItem.type = type;
|
||||
tempItem.onParentChanged = onParentChanged;
|
||||
if (parent == null)
|
||||
{
|
||||
root.AddChild(tempItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.AddChild(tempItem);
|
||||
}
|
||||
ResetData();
|
||||
return tempItem;
|
||||
}
|
||||
public void AddItem(AssetLibraryItem item)
|
||||
{
|
||||
root.AddChild(item);
|
||||
ResetData();
|
||||
}
|
||||
public AssetLibraryItem AddItem(string name, AssetLibraryItemType type)
|
||||
{
|
||||
AssetLibraryItem item = new AssetLibraryItem(name);
|
||||
item.type = type;
|
||||
root.AddChild(item);
|
||||
ResetData();
|
||||
return item;
|
||||
}
|
||||
public void AttachItem(AssetLibraryItem parent, AssetLibraryItem item, int index = -1)
|
||||
{
|
||||
if (parent.HasChildItem(item))
|
||||
return;
|
||||
parent.AddChild(item, index);
|
||||
ResetData();
|
||||
}
|
||||
public void RemoveItem(AssetLibraryItem removeItem)
|
||||
{
|
||||
root.RemoveItem(removeItem);
|
||||
ResetData();
|
||||
}
|
||||
public void RemoveItem(string name, AssetLibraryItemType type)
|
||||
{
|
||||
AssetLibraryItem removeItem = FindItem(name, type);
|
||||
root.RemoveItem(removeItem);
|
||||
ResetData();
|
||||
}
|
||||
public List<AssetLibraryItem> GetAllItems()
|
||||
{
|
||||
return root.GetAll(true);
|
||||
}
|
||||
public int GetItemIndex(AssetLibraryItem item)
|
||||
{
|
||||
return root.GetItemIndexInHierarchy(item);
|
||||
}
|
||||
public bool HasItem(AssetLibraryItem item)
|
||||
{
|
||||
return root.HasChildItem(item);
|
||||
}
|
||||
public AssetLibraryItem FindItem(string name, AssetLibraryItemType type)
|
||||
{
|
||||
return root.Find(name, type);
|
||||
}
|
||||
public void SetData()
|
||||
{
|
||||
data.Clear();
|
||||
data = root.GetAll();
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
public void ResetData()
|
||||
{
|
||||
data.Clear();
|
||||
data = root.GetAll();
|
||||
currentIndex = -1;
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
public void SetData(List<AssetLibraryItem> hierarchyData)
|
||||
{
|
||||
data = hierarchyData;
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
|
||||
private void OnScrollValueChanged(Vector2 scrollPos)
|
||||
{
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
|
||||
private void RebuildVisibleItems()
|
||||
{
|
||||
float scrollY = content.anchoredPosition.y;
|
||||
int newIndex = Mathf.FloorToInt(scrollY / itemHeight);
|
||||
if (newIndex < 0)
|
||||
{
|
||||
scrollY = 0;
|
||||
newIndex = 0;
|
||||
}
|
||||
|
||||
// If the visible index hasn't changed, do nothing.
|
||||
if (newIndex == currentIndex) return;
|
||||
|
||||
currentIndex = newIndex;
|
||||
|
||||
// Clear and recycle active items.
|
||||
foreach (var item in activeItems)
|
||||
{
|
||||
pool.Release(item);
|
||||
}
|
||||
activeItems.Clear();
|
||||
if (data.Count == 0)
|
||||
return;
|
||||
|
||||
int startIndex = Mathf.Clamp(currentIndex, 0, data.Count - 1);
|
||||
int endIndex = Mathf.Clamp(currentIndex + visibleItemCount, 0, data.Count);
|
||||
SetScrollItemUI(startIndex, endIndex);
|
||||
}
|
||||
private void RebuildVisibleItems(AssetLibraryItem focusItem)
|
||||
{
|
||||
int newIndex = data.FindIndex((x) => x == focusItem);
|
||||
currentIndex = newIndex;
|
||||
content.anchoredPosition = new Vector2(content.anchoredPosition.x, currentIndex * itemHeight);
|
||||
|
||||
// Clear and recycle active items.
|
||||
foreach (var item in activeItems)
|
||||
{
|
||||
pool.Release(item);
|
||||
}
|
||||
activeItems.Clear();
|
||||
if (data.Count == 0)
|
||||
return;
|
||||
|
||||
int startIndex = Mathf.Clamp(currentIndex, 0, data.Count - 1);
|
||||
int endIndex = Mathf.Clamp(currentIndex + visibleItemCount, 0, data.Count);
|
||||
SetScrollItemUI(startIndex, endIndex);
|
||||
}
|
||||
private void SetScrollItemUI(int startIndex, int endIndex)
|
||||
{
|
||||
int maxWidth = Mathf.RoundToInt(scrollRect.GetComponent<RectTransform>().sizeDelta.x);
|
||||
for (int i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
AssetLibraryItem item = data[i];
|
||||
AssetLibraryScrollItemUI itemUI = GetItemUI();
|
||||
int w = itemUI.SetItemData(item);
|
||||
itemUI.SetSelected(selectedItems);
|
||||
if (w > maxWidth) maxWidth = w;
|
||||
itemUI.transform.SetParent(content, false);
|
||||
|
||||
float yPos = -((float)i + 0.5f) * itemHeight;
|
||||
itemUI.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, yPos);
|
||||
|
||||
activeItems.Add(itemUI);
|
||||
}
|
||||
|
||||
content.sizeDelta = new Vector2(maxWidth, data.Count * itemHeight); // Set content height.
|
||||
}
|
||||
private AssetLibraryScrollItemUI GetItemUI()
|
||||
{
|
||||
AssetLibraryScrollItemUI itemUI = pool.Get();
|
||||
itemUI.onClickSingle.RemoveAllListeners();
|
||||
itemUI.onClickSingle.AddListener(OnSelectSingle);
|
||||
itemUI.onClickAddSingle.RemoveAllListeners();
|
||||
itemUI.onClickAddSingle.AddListener(OnSelectAnother);
|
||||
itemUI.onClickMultiple.RemoveAllListeners();
|
||||
itemUI.onClickMultiple.AddListener(OnSelectMultiple);
|
||||
itemUI.onToggleExpand.RemoveAllListeners();
|
||||
itemUI.onToggleExpand.AddListener(OnToggleExpand);
|
||||
itemUI.onHover.AddListener(OnHover);
|
||||
return itemUI;
|
||||
}
|
||||
public void OnSelect(List<AssetLibraryItem> items)
|
||||
{
|
||||
selectedItems = items;
|
||||
foreach (var itemUI in activeItems)
|
||||
{
|
||||
itemUI.SetSelected(items);
|
||||
}
|
||||
}
|
||||
public void OnSelectSingle(AssetLibraryItem item)
|
||||
{
|
||||
if (selectedItems.Count == 1 && selectedItems[0] == item)
|
||||
{
|
||||
selectedItems.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedItems.Clear();
|
||||
selectedItems.Add(item);
|
||||
}
|
||||
foreach (var itemUI in activeItems)
|
||||
{
|
||||
itemUI.SetSelected(selectedItems);
|
||||
}
|
||||
lastSelectedItem = item;
|
||||
onSelect?.Invoke(selectedItems);
|
||||
}
|
||||
public void OnHover(AssetLibraryItem item)
|
||||
{
|
||||
onHover?.Invoke(item);
|
||||
}
|
||||
public void OnSelectAnother(AssetLibraryItem item)
|
||||
{
|
||||
if (selectedItems.Count == 1 && selectedItems[0] == item)
|
||||
{
|
||||
selectedItems.Clear();
|
||||
}
|
||||
else if (selectedItems.Count > 1 && selectedItems.Contains(item))
|
||||
{
|
||||
selectedItems.Remove(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedItems.Add(item);
|
||||
}
|
||||
foreach (var itemUI in activeItems)
|
||||
{
|
||||
itemUI.SetSelected(selectedItems);
|
||||
}
|
||||
lastSelectedItem = item;
|
||||
onSelect?.Invoke(selectedItems);
|
||||
}
|
||||
public void OnSelectMultiple(AssetLibraryItem item)
|
||||
{
|
||||
int lastSelectedIndex = 0;
|
||||
if (lastSelectedItem != null)
|
||||
{
|
||||
lastSelectedIndex = data.FindIndex(x => x == lastSelectedItem);
|
||||
}
|
||||
//int lowestIndex = data
|
||||
// .Select((data, index) => new { data, index })
|
||||
// .Where(pair => selectedItems.Contains(pair.data))
|
||||
// .Min(pair => pair.index);
|
||||
int currentIndex = data.FindIndex(x => x == item);
|
||||
int startIndex = currentIndex > lastSelectedIndex ? lastSelectedIndex : currentIndex;
|
||||
int endIndex = currentIndex > lastSelectedIndex ? currentIndex : lastSelectedIndex;
|
||||
selectedItems.Clear();
|
||||
for (int i = startIndex; i <= endIndex; i++)
|
||||
{
|
||||
AssetLibraryItem tempItem = data[i];
|
||||
selectedItems.Add(tempItem);
|
||||
}
|
||||
foreach (var itemUI in activeItems)
|
||||
{
|
||||
itemUI.SetSelected(selectedItems);
|
||||
}
|
||||
onSelect?.Invoke(selectedItems);
|
||||
}
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (var itemUI in activeItems)
|
||||
{
|
||||
itemUI.SetSelected(false);
|
||||
}
|
||||
selectedItems.Clear();
|
||||
onSelect?.Invoke(selectedItems);
|
||||
lastSelectedItem = null;
|
||||
}
|
||||
public void OnToggleExpand()
|
||||
{
|
||||
currentIndex = -1;
|
||||
SetData();
|
||||
}
|
||||
public void SetToChildItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
return;
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
for (int i = 0; i < selectedItems.Count; i++)
|
||||
{
|
||||
AssetLibraryItem selectedItem = selectedItems[i];
|
||||
if (selectedItem == destItem || selectedItem.HasChildItem(destItem))
|
||||
continue;
|
||||
|
||||
AssetLibraryItem oldParent = selectedItem.parent;
|
||||
int oldIndex = selectedItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
destItem.AddChild(selectedItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
oldParent.AddChild(selectedItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcItem == destItem || srcItem.HasChildItem(destItem))
|
||||
return;
|
||||
|
||||
AssetLibraryItem oldParent = srcItem.parent;
|
||||
int oldIndex = srcItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
destItem.AddChild(srcItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
oldParent.AddChild(srcItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
public void SetToNextSiblingItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
return;
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
for (int i = 0; i < selectedItems.Count; i++)
|
||||
{
|
||||
AssetLibraryItem selectedItem = selectedItems[i];
|
||||
if (selectedItem == destItem || selectedItem.HasChildItem(destItem))
|
||||
continue;
|
||||
|
||||
AssetLibraryItem oldParent = selectedItem.parent;
|
||||
int oldIndex = selectedItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
destItem.AddToNextSibling(selectedItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
oldParent.AddChild(selectedItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcItem == destItem || srcItem.HasChildItem(destItem))
|
||||
return;
|
||||
|
||||
AssetLibraryItem oldParent = srcItem.parent;
|
||||
int oldIndex = srcItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
destItem.AddToNextSibling(srcItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
oldParent.AddChild(srcItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
public void SetToPriorSiblingItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
return;
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
for (int i = 0; i < selectedItems.Count; i++)
|
||||
{
|
||||
AssetLibraryItem selectedItem = selectedItems[i];
|
||||
if (selectedItem == destItem || selectedItem.HasChildItem(destItem))
|
||||
continue;
|
||||
|
||||
AssetLibraryItem oldParent = selectedItem.parent;
|
||||
int oldIndex = selectedItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
destItem.AddToPriorSibling(selectedItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(selectedItem);
|
||||
oldParent.AddChild(selectedItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcItem == destItem || srcItem.HasChildItem(destItem))
|
||||
return;
|
||||
|
||||
AssetLibraryItem oldParent = srcItem.parent;
|
||||
int oldIndex = srcItem.GetSiblingIndex();
|
||||
var command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
destItem.AddToPriorSibling(srcItem);
|
||||
ResetData();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
root.RemoveItem(srcItem);
|
||||
oldParent.AddChild(srcItem, oldIndex);
|
||||
ResetData();
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
}
|
||||
public void SearchData(string name)
|
||||
{
|
||||
data.Clear();
|
||||
data = root.FindAll(name);
|
||||
currentIndex = -1;
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
public void CancelSearch()
|
||||
{
|
||||
searchInput.text = "";
|
||||
data.Clear();
|
||||
currentIndex = -1;
|
||||
if (selectedItems.Count == 1)
|
||||
{
|
||||
selectedItems[0].ExpandInHierarchy();
|
||||
data = root.GetAll();
|
||||
RebuildVisibleItems(selectedItems[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = root.GetAll();
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 834bc067b08ed824b8b859748bb27a8c
|
||||
guid: 5b91609659b374d4d89246a2b7f4f990
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace XED.AssetLibraryTree
|
||||
{
|
||||
public class AssetLibraryPopupScrollViewItem : UnityEngine.MonoBehaviour
|
||||
{
|
||||
private AssetLibraryScrollRect scrollRect;
|
||||
private TMP_Text text;
|
||||
private Canvas canvas;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
text = GetComponentInChildren<TMP_Text>();
|
||||
scrollRect = GetComponentInParent<AssetLibraryScrollRect>();
|
||||
scrollRect.itemPopup = gameObject;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (scrollRect.sourceItem != null)
|
||||
{
|
||||
text.text = scrollRect.sourceItem.name;
|
||||
}
|
||||
// Position popup at the mouse position (convert screen point to UI point)
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
canvas.transform as RectTransform,
|
||||
Input.mousePosition,
|
||||
canvas.worldCamera,
|
||||
out Vector2 pos
|
||||
);
|
||||
transform.position = canvas.transform.TransformPoint(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
215
Assets/Scripts/Studio/UI/TreeView/AssetLibraryScrollItemUI.cs
Normal file
215
Assets/Scripts/Studio/UI/TreeView/AssetLibraryScrollItemUI.cs
Normal file
@@ -0,0 +1,215 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using System;
|
||||
using XRLib;
|
||||
|
||||
namespace XED.AssetLibraryTree
|
||||
{
|
||||
public class AssetLibraryScrollItemUI : UnityEngine.MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler//, IBeginDragHandler, IEndDragHandler,
|
||||
{
|
||||
public TMP_Text nameText;
|
||||
public Image iconImage;
|
||||
public Image loadProgress;
|
||||
public Button expandButton;
|
||||
public RectTransform paddingRT;
|
||||
public Sprite spriteExpanded;
|
||||
public Sprite spriteCollapsed;
|
||||
public UnityEvent<AssetLibraryItem> onClickSingle;
|
||||
public UnityEvent<AssetLibraryItem> onClickAddSingle;
|
||||
public UnityEvent<AssetLibraryItem> onClickMultiple;
|
||||
public UnityEvent<AssetLibraryItem> onHover;
|
||||
public UnityEvent onToggleExpand;
|
||||
public UnityEvent<AssetLibraryItem> onDragStart;
|
||||
public UnityEvent<AssetLibraryItem> onDragEnd;
|
||||
public UnityEvent<PointerEventData> onScroll;
|
||||
public Color selectedColor;
|
||||
public Color hoverColor;
|
||||
public AssetLibraryItem currentItem;
|
||||
public Image upperLine;
|
||||
public Image lowerLine;
|
||||
public Color lineColor;
|
||||
public GameObject highLight;
|
||||
public List<HierarchyItemSprite> itemSprites;
|
||||
private Image backgroundImage;
|
||||
public bool isSelected;
|
||||
private void Awake()
|
||||
{
|
||||
backgroundImage = GetComponent<Image>();
|
||||
}
|
||||
public int SetItemData(AssetLibraryItem item)
|
||||
{
|
||||
currentItem = item;
|
||||
nameText.text = item.name;
|
||||
currentItem.isExpanded = item.isExpanded;
|
||||
item.onLoadProgress.RemoveAllListeners();
|
||||
item.onLoadProgress.AddListener(OnLoadProgress);
|
||||
loadProgress.gameObject.SetActive(false);
|
||||
HierarchyItemSprite itemSprite = itemSprites.Find((x) => x.type == item.type);
|
||||
if (itemSprite != null) iconImage.sprite = itemSprite.sprite;
|
||||
expandButton.image.sprite = currentItem.isExpanded == true ? spriteExpanded : spriteCollapsed;
|
||||
|
||||
float width = nameText.GetComponent<RectTransform>().sizeDelta.x + iconImage.GetComponent<RectTransform>().sizeDelta.x;
|
||||
float paddingSize = item.layerNum * expandButton.GetComponent<RectTransform>().sizeDelta.x;
|
||||
if (item.children.Count > 0)
|
||||
{
|
||||
expandButton.gameObject.SetActive(true);
|
||||
width += expandButton.GetComponent<RectTransform>().sizeDelta.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
expandButton.gameObject.SetActive(false);
|
||||
paddingSize += expandButton.GetComponent<RectTransform>().sizeDelta.x;
|
||||
}
|
||||
width += paddingSize;
|
||||
paddingRT.sizeDelta = new Vector2(paddingSize, paddingRT.sizeDelta.y);
|
||||
upperLine.GetComponent<RectTransform>().offsetMin = new Vector2(paddingSize, 0);
|
||||
lowerLine.GetComponent<RectTransform>().offsetMin = new Vector2(paddingSize, 0);
|
||||
return Mathf.RoundToInt(width);
|
||||
}
|
||||
public void SetSelected(bool selected)
|
||||
{
|
||||
isSelected = selected;
|
||||
if (isSelected)
|
||||
{
|
||||
backgroundImage.color = selectedColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundImage.color = Color.clear;
|
||||
}
|
||||
}
|
||||
public void SetSelected(List<AssetLibraryItem> selectedItems)
|
||||
{
|
||||
isSelected = selectedItems.Contains(currentItem);
|
||||
if (isSelected)
|
||||
{
|
||||
backgroundImage.color = selectedColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundImage.color = Color.clear;
|
||||
}
|
||||
}
|
||||
public void ToggleExpandCollapse()
|
||||
{
|
||||
currentItem.isExpanded = !currentItem.isExpanded;
|
||||
expandButton.image.sprite = currentItem.isExpanded == true ? spriteExpanded : spriteCollapsed;
|
||||
onToggleExpand?.Invoke();
|
||||
}
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftControl))
|
||||
{
|
||||
onClickAddSingle?.Invoke(currentItem);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
onClickMultiple?.Invoke(currentItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
onClickSingle?.Invoke(currentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
backgroundImage.color = isSelected? selectedColor : hoverColor;
|
||||
onHover?.Invoke(currentItem);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
backgroundImage.color = isSelected? selectedColor : Color.clear;
|
||||
}
|
||||
|
||||
public void OnBeginDrag(BaseEventData data)
|
||||
{
|
||||
Debug.Log("DragStart " + currentItem.name);
|
||||
onDragStart?.Invoke(currentItem);
|
||||
}
|
||||
|
||||
public void OnEndDrag()
|
||||
{
|
||||
Debug.Log("DragEnd " + currentItem.name);
|
||||
onDragEnd?.Invoke(currentItem);
|
||||
}
|
||||
public void OnEndDrag(BaseEventData data)
|
||||
{
|
||||
AssetLibraryScrollItemUI itemUI = GetDropTarget(data);
|
||||
if (itemUI != null)
|
||||
itemUI.OnEndDrag();
|
||||
}
|
||||
private AssetLibraryScrollItemUI GetDropTarget(BaseEventData data)
|
||||
{
|
||||
PointerEventData eventData = (PointerEventData)data;
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
position = eventData.position
|
||||
};
|
||||
|
||||
var results = new System.Collections.Generic.List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(pointerData, results);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
AssetLibraryScrollItemUI itemUI = result.gameObject.GetComponent<AssetLibraryScrollItemUI>();
|
||||
if (itemUI != null)
|
||||
{
|
||||
return itemUI;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public void OnScroll(BaseEventData data)
|
||||
{
|
||||
PointerEventData eventData = (PointerEventData)data;
|
||||
onScroll?.Invoke(eventData);
|
||||
}
|
||||
public void ActivateUpperHighlight()
|
||||
{
|
||||
upperLine.color = lineColor;
|
||||
}
|
||||
public void ActivateLowerHighlight()
|
||||
{
|
||||
lowerLine.color = lineColor;
|
||||
}
|
||||
public void ActivateMidHighlight()
|
||||
{
|
||||
highLight.SetActive(true);
|
||||
}
|
||||
public void DeactivateAllHighlights()
|
||||
{
|
||||
upperLine.color = Color.clear;
|
||||
lowerLine.color = Color.clear;
|
||||
highLight.SetActive(false);
|
||||
}
|
||||
public void OnLoadProgress(float ratio)
|
||||
{
|
||||
if (ratio == 1.0f)
|
||||
{
|
||||
loadProgress.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
if (loadProgress.gameObject.activeSelf == false)
|
||||
{
|
||||
loadProgress.gameObject.SetActive(true);
|
||||
}
|
||||
loadProgress.fillAmount = ratio;
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
public class HierarchyItemSprite
|
||||
{
|
||||
public AssetLibraryItemType type;
|
||||
public Sprite sprite;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6317ef72ffa482d4288657d201a3c6aa
|
||||
guid: 06f21187ec447f64f9a7384b458e54c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
220
Assets/Scripts/Studio/UI/TreeView/AssetLibraryScrollRect.cs
Normal file
220
Assets/Scripts/Studio/UI/TreeView/AssetLibraryScrollRect.cs
Normal file
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XED.UI;
|
||||
|
||||
namespace XED.AssetLibraryTree
|
||||
{
|
||||
public class AssetLibraryScrollRect : ScrollRect, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
|
||||
{
|
||||
public bool passDragToChildren = true;
|
||||
public UnityEvent<AssetLibraryItem, AssetLibraryItem> setToChildItem;
|
||||
public UnityEvent<AssetLibraryItem, AssetLibraryItem> setToPriorSiblingItem;
|
||||
public UnityEvent<AssetLibraryItem, AssetLibraryItem> setToNextSiblingItem;
|
||||
//public UnityEvent onSelect;
|
||||
public UnityEvent<AssetLibraryItem> onDragBegin;
|
||||
public UnityEvent<AssetLibraryItem> onDragAndDrop;
|
||||
public GameObject itemPopup;
|
||||
public GameObject menuPopup;
|
||||
public AssetLibraryItem sourceItem;
|
||||
private AssetLibraryScrollItemUI hoverItemUI;
|
||||
private Coroutine coroutinePendPopup;
|
||||
public UnityEvent<AssetLibraryItem> onExit;
|
||||
public override void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
return;
|
||||
|
||||
AssetLibraryScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null && !itemUI.isSelected)
|
||||
{
|
||||
itemUI.OnPointerClick(eventData);
|
||||
}
|
||||
onDragBegin?.Invoke(sourceItem);
|
||||
if (!passDragToChildren)
|
||||
{
|
||||
base.OnBeginDrag(eventData); // Allow default scrolling if needed
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
if (hoverItemUI != null) hoverItemUI.DeactivateAllHighlights();
|
||||
AssetLibraryScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null)
|
||||
{
|
||||
RectTransform itemRect = itemUI.GetComponent<RectTransform>();
|
||||
Vector2 localPoint;
|
||||
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
itemRect,
|
||||
eventData.position,
|
||||
eventData.pressEventCamera,
|
||||
out localPoint
|
||||
);
|
||||
|
||||
float rectHeight = itemRect.rect.height;
|
||||
float normalizedY = (localPoint.y + rectHeight / 2) / rectHeight;
|
||||
|
||||
if (normalizedY >= 0.8f) // Upper 20%
|
||||
{
|
||||
itemUI.ActivateUpperHighlight();
|
||||
}
|
||||
else if (normalizedY <= 0.2f) // Lower 20%
|
||||
{
|
||||
itemUI.ActivateLowerHighlight();
|
||||
}
|
||||
else // Middle 60%
|
||||
{
|
||||
itemUI.ActivateMidHighlight();
|
||||
}
|
||||
hoverItemUI = itemUI;
|
||||
}
|
||||
}
|
||||
if (!passDragToChildren)
|
||||
{
|
||||
base.OnDrag(eventData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
if (hoverItemUI != null) hoverItemUI.DeactivateAllHighlights();
|
||||
if (coroutinePendPopup != null)
|
||||
{
|
||||
StopCoroutine(coroutinePendPopup);
|
||||
coroutinePendPopup = null;
|
||||
}
|
||||
itemPopup.SetActive(false);
|
||||
//Add to Other Item Hierarchy
|
||||
AssetLibraryScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null && sourceItem != null)
|
||||
{
|
||||
RectTransform itemRect = itemUI.GetComponent<RectTransform>(); // Get RectTransform of the item
|
||||
Vector2 localPoint;
|
||||
|
||||
// Convert screen position to local position within the item
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
itemRect,
|
||||
eventData.position,
|
||||
eventData.pressEventCamera,
|
||||
out localPoint
|
||||
);
|
||||
|
||||
float rectHeight = itemRect.rect.height; // Height of the item's RectTransform
|
||||
float normalizedY = (localPoint.y + rectHeight / 2) / rectHeight; // Normalize to 0 (bottom) to 1 (top)
|
||||
|
||||
hoverItemUI = itemUI;
|
||||
AssetLibraryItem destItem = itemUI.currentItem;
|
||||
|
||||
if (destItem == null)
|
||||
return;
|
||||
|
||||
if (normalizedY >= 0.8f)
|
||||
{
|
||||
setToPriorSiblingItem?.Invoke(sourceItem, destItem);
|
||||
}
|
||||
else if (normalizedY <= 0.2f)
|
||||
{
|
||||
setToNextSiblingItem?.Invoke(sourceItem, destItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
setToChildItem?.Invoke(sourceItem, destItem);
|
||||
}
|
||||
sourceItem = null;
|
||||
}
|
||||
onDragAndDrop?.Invoke(sourceItem);
|
||||
sourceItem = null;
|
||||
}
|
||||
if (!passDragToChildren)
|
||||
{
|
||||
base.OnEndDrag(eventData);
|
||||
}
|
||||
}
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
AssetLibraryScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null)
|
||||
{
|
||||
sourceItem = itemUI.currentItem;
|
||||
}
|
||||
if (sourceItem != null)
|
||||
{
|
||||
coroutinePendPopup = StartCoroutine(CoroutinePendPopup());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
if (coroutinePendPopup != null)
|
||||
{
|
||||
StopCoroutine(coroutinePendPopup);
|
||||
coroutinePendPopup = null;
|
||||
}
|
||||
itemPopup.SetActive(false);
|
||||
}
|
||||
else if (eventData.button == PointerEventData.InputButton.Right)
|
||||
{
|
||||
if (menuPopup != null)
|
||||
{
|
||||
menuPopup.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
private AssetLibraryScrollItemUI GetTargetItemUI(PointerEventData eventData)
|
||||
{
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
position = eventData.position // Get mouse position at drag end
|
||||
};
|
||||
|
||||
var results = new List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(pointerData, results); // Raycast against UI elements
|
||||
|
||||
AssetLibraryScrollItemUI itemUI = null;
|
||||
foreach (var result in results)
|
||||
{
|
||||
itemUI = result.gameObject.GetComponent<AssetLibraryScrollItemUI>();
|
||||
if (itemUI != null) // Exclude the dragged item itself
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemUI != null && itemUI.GetComponentInParent<AssetLibraryScrollRect>() == this)
|
||||
return itemUI;
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool IsPointerOverScrollRect()
|
||||
{
|
||||
return RectTransformUtility.RectangleContainsScreenPoint(
|
||||
GetComponent<RectTransform>(), Input.mousePosition);
|
||||
}
|
||||
IEnumerator CoroutinePendPopup()
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
itemPopup.SetActive(true);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
onExit?.Invoke(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3966a0ccff02f5b44b226385d4acbce6
|
||||
guid: fc24e335961d7d8409f2bc9cc2d7ef00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
2
Assets/Scripts/Studio/UI/TreeView/HierarchyItem.cs.meta
Normal file
2
Assets/Scripts/Studio/UI/TreeView/HierarchyItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5949f80e59af3e74b8189763889c3709
|
||||
@@ -10,19 +10,19 @@ using XED.Command;
|
||||
|
||||
namespace XED.HierarchyTree
|
||||
{
|
||||
public class PooledScrollView : MonoBehaviour
|
||||
public class HierarchyPooledScrollView : MonoBehaviour
|
||||
{
|
||||
private RectTransform content; // Content RectTransform of the ScrollView.
|
||||
private CustomScrollRect scrollRect; // ScrollRect component.
|
||||
private HierarchyScrollRect scrollRect; // ScrollRect component.
|
||||
[SerializeField]
|
||||
private TMP_InputField searchInput;
|
||||
//private Button searchCancelButton;
|
||||
private GameObject itemPrefab; // Prefab for scroll items.
|
||||
private ObjectPool<ScrollItemUI> pool; // Pool for UI items.
|
||||
private ObjectPool<HierarchyScrollItemUI> pool; // Pool for UI items.
|
||||
private List<HierarchyItem> data = new List<HierarchyItem>(); // The list of hierarchy items.
|
||||
private HierarchyItem root;
|
||||
|
||||
private List<ScrollItemUI> activeItems = new List<ScrollItemUI>();
|
||||
private List<HierarchyScrollItemUI> activeItems = new List<HierarchyScrollItemUI>();
|
||||
public List<HierarchyItem> selectedItems = new List<HierarchyItem>();
|
||||
private HierarchyItem lastSelectedItem = null;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace XED.HierarchyTree
|
||||
private void Awake()
|
||||
{
|
||||
content = Find<RectTransform>("Content");
|
||||
scrollRect = GetComponent<CustomScrollRect>();
|
||||
scrollRect = GetComponent<HierarchyScrollRect>();
|
||||
if (searchInput == null)
|
||||
{
|
||||
searchInput = GetComponentInChildren<TMP_InputField>();
|
||||
@@ -48,8 +48,8 @@ namespace XED.HierarchyTree
|
||||
itemPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_HierarchyItem");
|
||||
|
||||
//스크롤 뷰에 사용될 오브젝트 풀을 미리 20개 생성
|
||||
pool = new ObjectPool<ScrollItemUI>(
|
||||
createFunc: () => Instantiate(itemPrefab).GetComponent<ScrollItemUI>(),
|
||||
pool = new ObjectPool<HierarchyScrollItemUI>(
|
||||
createFunc: () => Instantiate(itemPrefab).GetComponent<HierarchyScrollItemUI>(),
|
||||
actionOnGet: (item) => item.gameObject.SetActive(true),
|
||||
actionOnRelease: (item) => item.gameObject.SetActive(false),
|
||||
actionOnDestroy: (item) => Destroy(item.gameObject),
|
||||
@@ -85,7 +85,7 @@ namespace XED.HierarchyTree
|
||||
tempItem.onParentChanged = onParentChanged;
|
||||
if (parent == null)
|
||||
{
|
||||
root.AddChild(tempItem);
|
||||
root.AddChild(tempItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,7 +218,7 @@ namespace XED.HierarchyTree
|
||||
for (int i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
HierarchyItem item = data[i];
|
||||
ScrollItemUI itemUI = GetItemUI();
|
||||
HierarchyScrollItemUI itemUI = GetItemUI();
|
||||
int w = itemUI.SetItemData(item);
|
||||
itemUI.SetSelected(selectedItems);
|
||||
if (w > maxWidth) maxWidth = w;
|
||||
@@ -232,9 +232,9 @@ namespace XED.HierarchyTree
|
||||
|
||||
content.sizeDelta = new Vector2(maxWidth, data.Count * itemHeight); // Set content height.
|
||||
}
|
||||
private ScrollItemUI GetItemUI()
|
||||
private HierarchyScrollItemUI GetItemUI()
|
||||
{
|
||||
ScrollItemUI itemUI = pool.Get();
|
||||
HierarchyScrollItemUI itemUI = pool.Get();
|
||||
itemUI.onClickSingle.RemoveAllListeners();
|
||||
itemUI.onClickSingle.AddListener(OnSelectSingle);
|
||||
itemUI.onClickAddSingle.RemoveAllListeners();
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 448ec7391867608489f206f58b3630af
|
||||
@@ -7,9 +7,9 @@ using TMPro;
|
||||
|
||||
namespace XED.HierarchyTree
|
||||
{
|
||||
public class PopupScrollViewItem : UnityEngine.MonoBehaviour
|
||||
public class HierarchyPopupScrollViewItem : UnityEngine.MonoBehaviour
|
||||
{
|
||||
private CustomScrollRect scrollRect;
|
||||
private HierarchyScrollRect scrollRect;
|
||||
private TMP_Text text;
|
||||
private Canvas canvas;
|
||||
// Start is called before the first frame update
|
||||
@@ -17,7 +17,7 @@ namespace XED.HierarchyTree
|
||||
{
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
text = GetComponentInChildren<TMP_Text>();
|
||||
scrollRect = GetComponentInParent<CustomScrollRect>();
|
||||
scrollRect = GetComponentInParent<HierarchyScrollRect>();
|
||||
scrollRect.itemPopup = gameObject;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc5c360456b9e024b9f8086a48c83331
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -10,7 +10,7 @@ using XRLib;
|
||||
|
||||
namespace XED.HierarchyTree
|
||||
{
|
||||
public class ScrollItemUI : UnityEngine.MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler//, IBeginDragHandler, IEndDragHandler,
|
||||
public class HierarchyScrollItemUI : UnityEngine.MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler//, IBeginDragHandler, IEndDragHandler,
|
||||
{
|
||||
public TMP_Text nameText;
|
||||
public Image iconImage;
|
||||
@@ -143,11 +143,11 @@ namespace XED.HierarchyTree
|
||||
}
|
||||
public void OnEndDrag(BaseEventData data)
|
||||
{
|
||||
ScrollItemUI itemUI = GetDropTarget(data);
|
||||
HierarchyScrollItemUI itemUI = GetDropTarget(data);
|
||||
if (itemUI != null)
|
||||
itemUI.OnEndDrag();
|
||||
}
|
||||
private ScrollItemUI GetDropTarget(BaseEventData data)
|
||||
private HierarchyScrollItemUI GetDropTarget(BaseEventData data)
|
||||
{
|
||||
PointerEventData eventData = (PointerEventData)data;
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current)
|
||||
@@ -160,7 +160,7 @@ namespace XED.HierarchyTree
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
ScrollItemUI itemUI = result.gameObject.GetComponent<ScrollItemUI>();
|
||||
HierarchyScrollItemUI itemUI = result.gameObject.GetComponent<HierarchyScrollItemUI>();
|
||||
if (itemUI != null)
|
||||
{
|
||||
return itemUI;
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0bda0c2ecf40cb46b79090671565e7a
|
||||
@@ -9,7 +9,7 @@ using XED.UI;
|
||||
|
||||
namespace XED.HierarchyTree
|
||||
{
|
||||
public class CustomScrollRect : ScrollRect, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
|
||||
public class HierarchyScrollRect : ScrollRect, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
|
||||
{
|
||||
public bool passDragToChildren = true;
|
||||
public UnityEvent<HierarchyItem, HierarchyItem> setToChildItem;
|
||||
@@ -21,7 +21,7 @@ namespace XED.HierarchyTree
|
||||
public GameObject itemPopup;
|
||||
public GameObject menuPopup;
|
||||
public HierarchyItem sourceItem;
|
||||
private ScrollItemUI hoverItemUI;
|
||||
private HierarchyScrollItemUI hoverItemUI;
|
||||
private Coroutine coroutinePendPopup;
|
||||
public UnityEvent<HierarchyItem> onExit;
|
||||
public override void OnBeginDrag(PointerEventData eventData)
|
||||
@@ -29,7 +29,7 @@ namespace XED.HierarchyTree
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
return;
|
||||
|
||||
ScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null && !itemUI.isSelected)
|
||||
{
|
||||
itemUI.OnPointerClick(eventData);
|
||||
@@ -46,7 +46,7 @@ namespace XED.HierarchyTree
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
if (hoverItemUI != null) hoverItemUI.DeactivateAllHighlights();
|
||||
ScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null)
|
||||
{
|
||||
RectTransform itemRect = itemUI.GetComponent<RectTransform>();
|
||||
@@ -97,7 +97,7 @@ namespace XED.HierarchyTree
|
||||
}
|
||||
itemPopup.SetActive(false);
|
||||
//Add to Other Item Hierarchy
|
||||
ScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null && sourceItem != null)
|
||||
{
|
||||
RectTransform itemRect = itemUI.GetComponent<RectTransform>(); // Get RectTransform of the item
|
||||
@@ -146,7 +146,7 @@ namespace XED.HierarchyTree
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
ScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
HierarchyScrollItemUI itemUI = GetTargetItemUI(eventData);
|
||||
if (itemUI != null)
|
||||
{
|
||||
sourceItem = itemUI.currentItem;
|
||||
@@ -176,7 +176,7 @@ namespace XED.HierarchyTree
|
||||
}
|
||||
}
|
||||
}
|
||||
private ScrollItemUI GetTargetItemUI(PointerEventData eventData)
|
||||
private HierarchyScrollItemUI GetTargetItemUI(PointerEventData eventData)
|
||||
{
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
@@ -186,16 +186,16 @@ namespace XED.HierarchyTree
|
||||
var results = new List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(pointerData, results); // Raycast against UI elements
|
||||
|
||||
ScrollItemUI itemUI = null;
|
||||
HierarchyScrollItemUI itemUI = null;
|
||||
foreach (var result in results)
|
||||
{
|
||||
itemUI = result.gameObject.GetComponent<ScrollItemUI>();
|
||||
itemUI = result.gameObject.GetComponent<HierarchyScrollItemUI>();
|
||||
if (itemUI != null) // Exclude the dragged item itself
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemUI != null && itemUI.GetComponentInParent<CustomScrollRect>() == this)
|
||||
if (itemUI != null && itemUI.GetComponentInParent<HierarchyScrollRect>() == this)
|
||||
return itemUI;
|
||||
|
||||
return null;
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cab9a4db9e60ee84f94fb7ae134fbcc5
|
||||
@@ -6,13 +6,13 @@ namespace XED.UI
|
||||
{
|
||||
public class PopupScrollViewMenu : MonoBehaviour
|
||||
{
|
||||
private CustomScrollRect scrollRect;
|
||||
private HierarchyScrollRect scrollRect;
|
||||
private Canvas canvas;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
scrollRect = GetComponentInParent<CustomScrollRect>();
|
||||
scrollRect = GetComponentInParent<HierarchyScrollRect>();
|
||||
scrollRect.menuPopup = gameObject;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace XED.UI
|
||||
public class ScrollViewMenu_ImportExport : PanelBase, IDeselectHandler
|
||||
{
|
||||
private Canvas canvas;
|
||||
private XED.HierarchyTree.CustomScrollRect scrollRect;
|
||||
private XED.AssetLibraryTree.AssetLibraryScrollRect scrollRect;
|
||||
private Button btnExport;
|
||||
private Button btnImport;
|
||||
private Selectable selectable;
|
||||
|
||||
Reference in New Issue
Block a user