重构inspector!
This commit is contained in:
@@ -11,6 +11,8 @@ namespace Ichni.Editor
|
||||
{
|
||||
public abstract class DynamicUIElement : MonoBehaviour
|
||||
{
|
||||
Inspector Inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
public TMP_Text title;
|
||||
public CanvasGroup canvasGroup;
|
||||
public IBaseElement connectedBaseElement;
|
||||
@@ -34,28 +36,19 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public void Mark(IHaveInspection inspection, string mark)
|
||||
public DynamicUIElement Mark(string mark = "Default", IHaveInspection inspection = null)
|
||||
{
|
||||
inspection.MarkedElements.Add(mark, this);
|
||||
inspection ??= Inspector;
|
||||
if (mark == "Default")
|
||||
{
|
||||
mark = title.text;
|
||||
}
|
||||
|
||||
inspection.MarkedElements.TryAdd(mark, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract void AddListenerFunction(UnityAction action);
|
||||
|
||||
public virtual void DeviverSet(int DeviveNum){
|
||||
float o=2f/DeviveNum;//因为所有的单UI都是根据2栏来的
|
||||
Button[] childb=GetComponentsInChildren<Button>();
|
||||
TMP_Text[] childt=GetComponentsInChildren<TMP_Text>();
|
||||
foreach (var i in childb){
|
||||
RectTransform rectTransform = i.GetComponent<RectTransform>();
|
||||
rectTransform.sizeDelta=new Vector2(rectTransform.sizeDelta.x*o,rectTransform.sizeDelta.y);
|
||||
}
|
||||
foreach (var i in childt){
|
||||
RectTransform rectTransform = i.GetComponent<RectTransform>();
|
||||
rectTransform.sizeDelta=new Vector2(rectTransform.sizeDelta.x*o,rectTransform.sizeDelta.y);
|
||||
}
|
||||
}
|
||||
|
||||
//public abstract void ApplyParameters();
|
||||
public abstract DynamicUIElement AddListenerFunction(UnityAction action);
|
||||
}
|
||||
|
||||
public interface IHaveAutoUpdate
|
||||
|
||||
Reference in New Issue
Block a user