mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2024-12-23 01:59:40 +08:00
Move MouseInspector dropdown to Inspector panel
This commit is contained in:
parent
aae248bf69
commit
c79223f537
@ -77,7 +77,7 @@ namespace UnityExplorer.Inspectors
|
||||
case 1: Instance.StartInspect(MouseInspectMode.World); break;
|
||||
case 2: Instance.StartInspect(MouseInspectMode.UI); break;
|
||||
}
|
||||
UIManager.MouseInspectDropdown.value = 0;
|
||||
InspectorPanel.Instance.MouseInspectDropdown.value = 0;
|
||||
}
|
||||
|
||||
public void StartInspect(MouseInspectMode mode)
|
||||
@ -111,7 +111,7 @@ namespace UnityExplorer.Inspectors
|
||||
UIManager.NavBarRect.gameObject.SetActive(true);
|
||||
UIManager.PanelHolder.SetActive(true);
|
||||
|
||||
var drop = UIManager.MouseInspectDropdown;
|
||||
var drop = InspectorPanel.Instance.MouseInspectDropdown;
|
||||
if (drop.transform.Find("Dropdown List") is Transform list)
|
||||
drop.DestroyDropdownList(list.gameObject);
|
||||
|
||||
|
@ -24,6 +24,7 @@ namespace UnityExplorer.UI.Panels
|
||||
public override int MinHeight => 350;
|
||||
|
||||
public GameObject NavbarHolder;
|
||||
public Dropdown MouseInspectDropdown;
|
||||
public GameObject ContentHolder;
|
||||
public RectTransform ContentRect;
|
||||
|
||||
@ -60,9 +61,21 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public override void ConstructPanelContent()
|
||||
{
|
||||
var closeHolder = this.titleBar.transform.Find("CloseHolder").gameObject;
|
||||
|
||||
// Inspect under mouse dropdown on title bar
|
||||
|
||||
var mouseDropdown = UIFactory.CreateDropdown(closeHolder, out MouseInspectDropdown, "Mouse Inspect", 14,
|
||||
InspectUnderMouse.OnDropdownSelect);
|
||||
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("World"));
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("UI"));
|
||||
mouseDropdown.transform.SetSiblingIndex(0);
|
||||
|
||||
// add close all button to titlebar
|
||||
|
||||
var closeAllBtn = UIFactory.CreateButton(this.titleBar.transform.Find("CloseHolder").gameObject, "CloseAllBtn", "Close All",
|
||||
var closeAllBtn = UIFactory.CreateButton(closeHolder.gameObject, "CloseAllBtn", "Close All",
|
||||
new Color(0.3f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(closeAllBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||
closeAllBtn.Component.transform.SetSiblingIndex(closeAllBtn.Component.transform.GetSiblingIndex() - 1);
|
||||
|
@ -55,7 +55,6 @@ namespace UnityExplorer.UI
|
||||
|
||||
public static RectTransform NavBarRect;
|
||||
public static GameObject NavbarTabButtonHolder;
|
||||
public static Dropdown MouseInspectDropdown;
|
||||
|
||||
private static ButtonRef closeBtn;
|
||||
private static ButtonRef pauseBtn;
|
||||
@ -84,9 +83,11 @@ namespace UnityExplorer.UI
|
||||
lastScreenWidth = Screen.width;
|
||||
lastScreenHeight = Screen.height;
|
||||
|
||||
// Create UI
|
||||
// Create UI.
|
||||
CreatePanelHolder();
|
||||
CreateTopNavBar();
|
||||
// This could be automated with Assembly.GetTypes(),
|
||||
// but the order is important and I'd have to write something to handle the order.
|
||||
UIPanels.Add(Panels.AutoCompleter, new AutoCompleteModal());
|
||||
UIPanels.Add(Panels.ObjectExplorer, new ObjectExplorerPanel());
|
||||
UIPanels.Add(Panels.Inspector, new InspectorPanel());
|
||||
@ -338,15 +339,6 @@ namespace UnityExplorer.UI
|
||||
UIFactory.SetLayoutElement(pauseBtn.Component.gameObject, minHeight: 25, minWidth: 25);
|
||||
pauseBtn.OnClick += OnPauseButtonClicked;
|
||||
|
||||
// Inspect under mouse dropdown
|
||||
|
||||
var mouseDropdown = UIFactory.CreateDropdown(navbarPanel, out MouseInspectDropdown, "Mouse Inspect", 14,
|
||||
InspectUnderMouse.OnDropdownSelect);
|
||||
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("World"));
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("UI"));
|
||||
|
||||
// Hide menu button
|
||||
|
||||
closeBtn = UIFactory.CreateButton(navbarPanel, "CloseButton", ConfigManager.Master_Toggle.Value.ToString());
|
||||
|
Loading…
Reference in New Issue
Block a user