More progress

This commit is contained in:
Sinai committed 2021-05-05 21:27:09 +10:00
1 parent 961ff80c6d
commit e4ff86259b
42 files changed
+1159 -730

No files matched your search

+15 -18
View File
@@ -6,11 +6,7 @@ using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Core.Config;
using UnityExplorer.Core.Runtime;
using UnityExplorer.UI.Inspectors;
using UnityExplorer.UI.Models;
using UnityExplorer.UI.Utility;
using UnityExplorer.UI.Widgets;
namespace UnityExplorer.UI.Panels
{
@@ -23,6 +19,8 @@ namespace UnityExplorer.UI.Panels
public override string Name => "Inspector";
public override UIManager.Panels PanelType => UIManager.Panels.Inspector;
public override bool ShouldSaveActiveState => false;
public override int MinWidth => 550;
public override int MinHeight => 350;
public GameObject NavbarHolder;
public GameObject ContentHolder;
@@ -40,41 +38,40 @@ namespace UnityExplorer.UI.Panels
{
base.OnFinishResize(panel);
InspectorManager.PanelWidth = this.mainPanelRect.rect.width;
InspectorManager.OnPanelResized(panel.rect.width);
}
public override void LoadSaveData()
{
ApplySaveData(ConfigManager.InspectorData.Value);
public override string GetSaveData() => ConfigManager.InspectorData.Value;
InspectorManager.PanelWidth = this.mainPanelRect.rect.width;
}
//public override void LoadSaveData()
//{
// ApplySaveData(ConfigManager.InspectorData.Value);
//
// InspectorManager.PanelWidth = this.mainPanelRect.rect.width;
//}
public override void DoSaveToConfigElement()
{
ConfigManager.InspectorData.Value = this.ToSaveData();
}
public override void SetDefaultPosAndAnchors()
protected internal override void DoSetDefaultPosAndAnchors()
{
mainPanelRect.localPosition = Vector2.zero;
mainPanelRect.pivot = new Vector2(0f, 1f);
mainPanelRect.anchorMin = new Vector2(0.1f, 0.15f);
mainPanelRect.anchorMax = new Vector2(0.1f, 0.95f);
mainPanelRect.offsetMin = new Vector2(mainPanelRect.offsetMin.x, 100); // bottom
mainPanelRect.offsetMax = new Vector2(mainPanelRect.offsetMax.x, -50); // top
mainPanelRect.sizeDelta = new Vector2(700f, mainPanelRect.sizeDelta.y);
mainPanelRect.anchoredPosition = new Vector2(-150, 0);
mainPanelRect.anchorMin = new Vector2(0.35f, 0.175f);
mainPanelRect.anchorMax = new Vector2(0.8f, 0.925f);
}
public override void ConstructPanelContent()
{
// this.UIRoot.GetComponent<Mask>().enabled = false;
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.content, forceHeight: true, spacing: 4, padLeft: 5, padRight: 5);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.content, true, true, true, true, 4, padLeft: 5, padRight: 5);
this.NavbarHolder = UIFactory.CreateGridGroup(this.content, "Navbar", new Vector2(200, 22), new Vector2(4, 4),
new Color(0.12f, 0.12f, 0.12f));
new Color(0.05f, 0.05f, 0.05f));
//UIFactory.SetLayoutElement(NavbarHolder, flexibleWidth: 9999, minHeight: 0, preferredHeight: 0, flexibleHeight: 9999);
NavbarHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;