mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
Rewriting everything from scratch, developed generic ObjectPool system
This commit is contained in:
46
src/UI/Inspectors/InspectorTab.cs
Normal file
46
src/UI/Inspectors/InspectorTab.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.UI.ObjectPool;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
|
||||
namespace UnityExplorer.UI.Inspectors
|
||||
{
|
||||
public class InspectorTab : IPooledObject
|
||||
{
|
||||
public GameObject UIRoot => uiRoot;
|
||||
private GameObject uiRoot;
|
||||
|
||||
public float DefaultHeight => 25f;
|
||||
|
||||
public ButtonRef TabButton;
|
||||
public Text TabText;
|
||||
|
||||
public ButtonRef CloseButton;
|
||||
|
||||
public GameObject CreateContent(GameObject parent)
|
||||
{
|
||||
uiRoot = UIFactory.CreateHorizontalGroup(parent, "TabObject", true, true, true, true, 0, new Vector4(0, 0, 3, 0));
|
||||
UIFactory.SetLayoutElement(uiRoot, minWidth: 185, flexibleWidth: 0);
|
||||
uiRoot.AddComponent<Mask>();
|
||||
|
||||
TabButton = UIFactory.CreateButton(uiRoot, "TabButton", "");
|
||||
|
||||
UIFactory.SetLayoutElement(TabButton.Button.gameObject, minWidth: 165, flexibleWidth: 0);
|
||||
|
||||
TabText = TabButton.Button.GetComponentInChildren<Text>();
|
||||
TabText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
TabText.alignment = TextAnchor.MiddleLeft;
|
||||
|
||||
CloseButton = UIFactory.CreateButton(uiRoot, "CloseButton", "X", new Color(0.2f, 0.2f, 0.2f, 1));
|
||||
UIFactory.SetLayoutElement(CloseButton.Button.gameObject, minWidth: 20, flexibleWidth: 0);
|
||||
var closeBtnText = CloseButton.Button.GetComponentInChildren<Text>();
|
||||
closeBtnText.color = Color.red;
|
||||
|
||||
return uiRoot;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user