AssetLibraryPopupScrollViewItem 삭제
This commit is contained in:
@@ -1368,7 +1368,6 @@ RectTransform:
|
||||
- {fileID: 4062748835041242030}
|
||||
- {fileID: 7669971977167462851}
|
||||
- {fileID: 14884185527709109}
|
||||
- {fileID: 6055411565447103197}
|
||||
m_Father: {fileID: 1573249193208025711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
@@ -1563,55 +1562,6 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3905796311297402294
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6055411565447103197}
|
||||
- component: {fileID: 5228486192989051087}
|
||||
m_Layer: 5
|
||||
m_Name: PopupScrollViewItem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6055411565447103197
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3905796311297402294}
|
||||
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:
|
||||
- {fileID: 8396160395029261019}
|
||||
m_Father: {fileID: 3774859264702987967}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 327, y: -11.646606}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5228486192989051087
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3905796311297402294}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 35320badd37a474489e786554cde8813, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4244143198177438994
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1702,82 +1652,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!1 &4257137996181769062
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8396160395029261019}
|
||||
- component: {fileID: 7405042080931199372}
|
||||
- component: {fileID: 2403408689949033338}
|
||||
m_Layer: 5
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8396160395029261019
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4257137996181769062}
|
||||
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:
|
||||
- {fileID: 514978056142714461}
|
||||
m_Father: {fileID: 6055411565447103197}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 95, y: 0}
|
||||
m_SizeDelta: {x: 150, y: 24}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7405042080931199372
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4257137996181769062}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2403408689949033338
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4257137996181769062}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 0.9094448, b: 0, a: 0.19607843}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4319735508156098280
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1991,142 +1865,6 @@ MonoBehaviour:
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &5165986710654382505
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 514978056142714461}
|
||||
- component: {fileID: 743505372548182760}
|
||||
- component: {fileID: 6364859798121328650}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &514978056142714461
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5165986710654382505}
|
||||
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: 8396160395029261019}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: 24}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &743505372548182760
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5165986710654382505}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6364859798121328650
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5165986710654382505}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: New Text
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 2516582400
|
||||
m_fontColor: {r: 0, g: 0, b: 0, a: 0.5882353}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 15
|
||||
m_fontSizeBase: 15
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &5730464145202627090
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -3025,7 +3025,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1149817088}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 960, y: 503, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Studio.AssetTool
|
||||
public GameObject renderObjectPrefab;
|
||||
public float objectShowDistance = 1000.0f;
|
||||
|
||||
public InterferedObjectManager interferedObjectManager;
|
||||
//public InterferedObjectManager interferedObjectManager;
|
||||
public List<ConnectedAsset> connectedAssets = new List<ConnectedAsset>();
|
||||
public List<CustomAssetData> selectedAssetDatas = new List<CustomAssetData>();
|
||||
public CustomAssetData selectedAssetData;
|
||||
@@ -45,7 +45,7 @@ namespace Studio.AssetTool
|
||||
}
|
||||
public override void Init()
|
||||
{
|
||||
interferedObjectManager = ManagerHub.instance.Get<InterferedObjectManager>();
|
||||
//interferedObjectManager = ManagerHub.instance.Get<InterferedObjectManager>();
|
||||
assetScrollRect = EventConnector.instance.GetCanvas<Canvas_Popup>().panel_assetlibrary.scrollRect;
|
||||
assetScrollRect.onDragBegin.AddListener(OnAssetSelected);
|
||||
assetScrollRect.onDragAndDrop.AddListener(OnAssetDropped);
|
||||
@@ -65,25 +65,6 @@ namespace Studio.AssetTool
|
||||
renderObjectPrefab = Resources.Load<GameObject>("Prefabs/PRF_RenderObject");
|
||||
}
|
||||
|
||||
public void OnCopyObject(List<CustomAssetRenderObject> objects)
|
||||
{
|
||||
if (objects.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<ConnectedAsset> copySources = new List<ConnectedAsset>();
|
||||
List<ConnectedAsset> copyList = new List<ConnectedAsset>();
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
{
|
||||
ConnectedAsset searchAsset = connectedAssets.Find((x) => x.renderObject == objects[i]);
|
||||
copySources.Add(searchAsset);
|
||||
ConnectedAsset copyAsset = new ConnectedAsset();
|
||||
copyList.Add(copyAsset);
|
||||
connectedAssets.Add(copyAsset);
|
||||
}
|
||||
var command = new CopyObjectCommand();
|
||||
|
||||
}
|
||||
|
||||
IEnumerator ChangeSelectedAssetTransform()
|
||||
{
|
||||
@@ -140,6 +121,7 @@ namespace Studio.AssetTool
|
||||
}
|
||||
selectRenderObject.Deselect();
|
||||
selectedAssetData = null;
|
||||
Debug.Log($"On Asset Dropped {item.name}");
|
||||
onAssetDropped?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace XED
|
||||
private UI_InputTopicItem prf_InputTopicItem;
|
||||
private List<UI_InputTopicItem> inputTopicItems = new List<UI_InputTopicItem>();
|
||||
|
||||
public Action onTestAPI;
|
||||
public Action onMQTTTest;
|
||||
public Action<UI_MQTTConnection> onRemoveMQTTConnectionItem;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace XED
|
||||
prf_InputTopicItem = Resources.Load<UI_InputTopicItem>("Prefabs/UI/PRF_InputTopicItem");
|
||||
|
||||
Button_AddTopicItem.onClick.AddListener(OnClickAddURLItemButton);
|
||||
Button_TestMQTT.onClick.AddListener(OnClickTestMQTT);
|
||||
Button_TestMQTT.onClick.AddListener(OnClickMQTTTest);
|
||||
Button_Remove.onClick.AddListener(OnClickRemoveItemButton);
|
||||
|
||||
inputTopicItems.Clear();
|
||||
@@ -49,9 +49,10 @@ namespace XED
|
||||
AddURLItem(item);
|
||||
Button_AddTopicItem.transform.SetAsLastSibling();
|
||||
}
|
||||
private void OnClickTestMQTT()
|
||||
private void OnClickMQTTTest()
|
||||
{
|
||||
onTestAPI?.Invoke();
|
||||
Debug.Log("On Click MQTT Test");
|
||||
onMQTTTest?.Invoke();
|
||||
}
|
||||
private void OnClickRemoveItemButton()
|
||||
{
|
||||
@@ -83,7 +84,7 @@ namespace XED
|
||||
mqttConnection.port = InputField_Port.text;
|
||||
|
||||
foreach (var item in inputTopicItems)
|
||||
{
|
||||
{
|
||||
var topic = item.GetTopic();
|
||||
mqttConnection.topics.Add(topic);
|
||||
}
|
||||
|
||||
@@ -110,49 +110,14 @@ namespace Studio.AssetLibraryTree
|
||||
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);
|
||||
@@ -170,12 +135,6 @@ namespace Studio.AssetLibraryTree
|
||||
currentIndex = -1;
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
public void SetData(List<AssetLibraryItem> hierarchyData)
|
||||
{
|
||||
data = hierarchyData;
|
||||
RebuildVisibleItems();
|
||||
}
|
||||
|
||||
private void OnScrollValueChanged(Vector2 scrollPos)
|
||||
{
|
||||
RebuildVisibleItems();
|
||||
@@ -231,52 +190,6 @@ namespace Studio.AssetLibraryTree
|
||||
SetScrollItemUI(startIndex, endIndex);
|
||||
}
|
||||
|
||||
private void RebuildVisibleItems(AssetLibraryItem focusItem)
|
||||
{
|
||||
int itemIndex = data.FindIndex((x) => x == focusItem);
|
||||
currentIndex = itemIndex / 3;
|
||||
|
||||
float rowHeight = itemHeight + 10f;
|
||||
content.anchoredPosition = new Vector2(content.anchoredPosition.x, currentIndex * rowHeight);
|
||||
|
||||
foreach (var item in activeItems)
|
||||
itemsPool.Release(item);
|
||||
|
||||
foreach (var item in activeFolders)
|
||||
foldersPool.Release(item);
|
||||
|
||||
activeItems.Clear();
|
||||
activeFolders.Clear();
|
||||
displayData.Clear();
|
||||
|
||||
foreach (var item in data)
|
||||
{
|
||||
if (item.type == AssetLibraryItemType.folder)
|
||||
{
|
||||
int offset = displayData.Count % rowItemCount;
|
||||
|
||||
if (offset != 0)
|
||||
{
|
||||
int emptyCount = rowItemCount - offset;
|
||||
for (int i = 0; i < emptyCount; i++)
|
||||
displayData.Add(null);
|
||||
}
|
||||
|
||||
displayData.Add(item);
|
||||
displayData.Add(null);
|
||||
displayData.Add(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayData.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
int startIndex = Mathf.Clamp(currentIndex * rowItemCount, 0, displayData.Count);
|
||||
int endIndex = Mathf.Clamp((currentIndex + visibleItemCount) * rowItemCount, 0, displayData.Count);
|
||||
SetScrollItemUI(startIndex, endIndex);
|
||||
}
|
||||
|
||||
private void SetScrollItemUI(int startIndex, int endIndex)
|
||||
{
|
||||
float spacingX = 25f;
|
||||
@@ -331,24 +244,18 @@ namespace Studio.AssetLibraryTree
|
||||
{
|
||||
AssetLibraryScrollItemUI itemUI = itemsPool.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.onClickMultiple.RemoveAllListeners();
|
||||
itemUI.onClickAddSingle.RemoveAllListeners();
|
||||
|
||||
itemUI.onClickSingle.AddListener(OnSelectSingle);
|
||||
itemUI.onToggleExpand.AddListener(OnToggleExpand);
|
||||
itemUI.onClickAddSingle.AddListener(OnSelectAnother);
|
||||
itemUI.onClickMultiple.AddListener(OnSelectMultiple);
|
||||
//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)
|
||||
@@ -367,10 +274,6 @@ namespace Studio.AssetLibraryTree
|
||||
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)
|
||||
@@ -435,7 +338,10 @@ namespace Studio.AssetLibraryTree
|
||||
}
|
||||
public void SetToChildItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
if (!isSiblingEditable)
|
||||
return;
|
||||
|
||||
if (srcItem == null || destItem == null)
|
||||
return;
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
@@ -488,7 +394,10 @@ namespace Studio.AssetLibraryTree
|
||||
}
|
||||
public void SetToNextSiblingItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
if(!isSiblingEditable)
|
||||
return;
|
||||
|
||||
if (srcItem == null || destItem == null)
|
||||
return;
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
@@ -541,8 +450,12 @@ namespace Studio.AssetLibraryTree
|
||||
}
|
||||
public void SetToPriorSiblingItem(AssetLibraryItem srcItem, AssetLibraryItem destItem)
|
||||
{
|
||||
if (srcItem == null || destItem == null || !isSiblingEditable)
|
||||
if(!isSiblingEditable)
|
||||
return;
|
||||
|
||||
if (srcItem == null || destItem == null)
|
||||
return;
|
||||
|
||||
if (selectedItems.Contains(srcItem))
|
||||
{
|
||||
for (int i = 0; i < selectedItems.Count; i++)
|
||||
@@ -599,22 +512,5 @@ namespace Studio.AssetLibraryTree
|
||||
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,42 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Studio.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35320badd37a474489e786554cde8813
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -18,11 +18,9 @@ namespace Studio.AssetLibraryTree
|
||||
//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)
|
||||
{
|
||||
@@ -90,12 +88,7 @@ namespace Studio.AssetLibraryTree
|
||||
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)
|
||||
@@ -151,24 +144,12 @@ namespace Studio.AssetLibraryTree
|
||||
{
|
||||
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 (eventData.button == PointerEventData.InputButton.Right)
|
||||
{
|
||||
if (menuPopup != null)
|
||||
{
|
||||
@@ -205,12 +186,7 @@ namespace Studio.AssetLibraryTree
|
||||
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)
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user