尝试优化Inspector的排版
在输数字的地方输入框的输入限制可以改成十进制数,这样就不会因为输了字母然后报错了
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@@ -9,9 +10,23 @@ 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(CanCompress)gridLayoutGroup.cellSize=new Vector2(gridLayoutGroup.cellSize.x,gridLayoutGroup.cellSize.y/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user