Files
ichni_Creator_Studio/Assets/Scripts/DynamicUI/DynamicUIContainer.cs
TRAfoer 4d9694db60 细化一些UI
我觉得TimelineCanvas可以利用一下
比如把note放在上面?
2025-02-20 15:25:42 +08:00

37 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace Ichni.Editor
{
public class DynamicUIContainer : MonoBehaviour
{
Inspector Inspector => EditorManager.instance.uiManager.inspector;
public TMP_Text title;
public GridLayoutGroup gridLayoutGroup;
public List<DynamicUIElement> dynamicUIElements = new List<DynamicUIElement>();
[FormerlySerializedAs("container")] public RectTransform rect;
public void SetDeviver(int num){//rect 500
gridLayoutGroup.cellSize=new Vector2(Inspector.inspectorRect.rect.width/num,gridLayoutGroup.cellSize.y);
bool CanCompress=true;//这是是想着如果没有按钮以外的东西就把y值调小一点的
foreach(var i in GetComponentsInChildren<DynamicUIElement>()){
i.DeviverSet(num);
if(i.GetType()!=typeof(DynamicUIButton))CanCompress=false;
if(i.GetType()==typeof(DynamicUIBaseColorPicker)||
i.GetType()==typeof(DynamicUIEmissionColorPicker)){//一个container可能不会有除了color以外的的东西吧
gridLayoutGroup.cellSize=new Vector2(gridLayoutGroup.cellSize.x,gridLayoutGroup.cellSize.y*2.5f);
}
}
if(CanCompress)gridLayoutGroup.cellSize=new Vector2(gridLayoutGroup.cellSize.x,gridLayoutGroup.cellSize.y/2);
//Danger写了好多特判
}
}
}