重构inspector!
This commit is contained in:
30
Assets/Scripts/DynamicUI/DynamicUISubcontainer.cs
Normal file
30
Assets/Scripts/DynamicUI/DynamicUISubcontainer.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUISubcontainer : MonoBehaviour
|
||||
{
|
||||
Inspector Inspector => EditorManager.instance.uiManager.inspector;
|
||||
public DynamicUIContainer parentContainer;
|
||||
public GridLayoutGroup gridLayoutGroup;
|
||||
public RectTransform rect;
|
||||
public List<DynamicUIElement> dynamicUIElements;
|
||||
|
||||
public void Initialize(DynamicUIContainer parentContainer, int elementCountPerRow, float height = 100)
|
||||
{
|
||||
this.parentContainer = parentContainer;
|
||||
this.gridLayoutGroup.cellSize = new Vector2(600f / elementCountPerRow, height);
|
||||
this.dynamicUIElements = new List<DynamicUIElement>();
|
||||
}
|
||||
|
||||
public DynamicUISubcontainer Mark(string mark, IHaveInspection inspection = null)
|
||||
{
|
||||
inspection ??= Inspector;
|
||||
inspection.MarkedSubcontainers.TryAdd(mark, this);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user