加加加加
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -14,7 +15,7 @@ namespace Ichni.Editor
|
||||
public RectTransform tabContainer;
|
||||
public Button addFolderButton;
|
||||
public List<HierarchyTab> tabList;
|
||||
|
||||
public Button expandButtom;
|
||||
private void Awake()
|
||||
{
|
||||
tabList = new List<HierarchyTab>();
|
||||
@@ -22,6 +23,8 @@ namespace Ichni.Editor
|
||||
{
|
||||
ElementFolder.GenerateElement("New Folder", Guid.NewGuid(), new List<string>(), true, null);
|
||||
});
|
||||
expandButtom.onClick.AddListener(Expand);
|
||||
rectTransform = this.GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public HierarchyTab GenerateTab(GameElement targetElement, GameElement parentElement)
|
||||
@@ -31,6 +34,48 @@ namespace Ichni.Editor
|
||||
tabList.Add(tab);
|
||||
return tab;
|
||||
}
|
||||
public bool isExpand = false;
|
||||
private RectTransform rectTransform;
|
||||
public void Expand()
|
||||
{
|
||||
float originX = 225f;
|
||||
isExpand = !isExpand;
|
||||
// 用DOTween动画赋值
|
||||
if (isExpand)
|
||||
{
|
||||
rectTransform.DOSizeDelta(
|
||||
new Vector2(rectTransform.sizeDelta.x * 2, rectTransform.sizeDelta.y), 0.5f);
|
||||
rectTransform.DOAnchorPos(
|
||||
new Vector2(originX * 2, rectTransform.anchoredPosition.y), 0.5f);
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.x * 3,
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
expandButtom.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.x * 2,
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.DOSizeDelta(
|
||||
new Vector2(rectTransform.sizeDelta.x / 2, rectTransform.sizeDelta.y), 0.5f);
|
||||
rectTransform.DOAnchorPos(
|
||||
new Vector2(originX, rectTransform.anchoredPosition.y), 0.5f);
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.x / 3,
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
expandButtom.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.x / 2,
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public ScrollRect scrollRect;
|
||||
public Vector2 vector2;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Ichni.Editor
|
||||
}
|
||||
public void SetStatus()
|
||||
{
|
||||
//expandButton.interactable = !connectedGameElement.childElementList.IsNullOrEmpty();
|
||||
expandButton.gameObject.SetActive(!connectedGameElement.childElementList.IsNullOrEmpty());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user