More progress, cleanups and fixes

This commit is contained in:
Sinai
2021-05-04 20:10:46 +10:00
parent 302ff29e36
commit a89d66cf81
30 changed files with 807 additions and 176 deletions

View File

@ -40,7 +40,7 @@ namespace UnityExplorer.UI.Panels
content.SetActive(true);
var button = tabButtons[tabIndex];
RuntimeProvider.Instance.SetColorBlock(button.Button, UIManager.navButtonEnabledColor, UIManager.navButtonEnabledColor * 1.2f);
RuntimeProvider.Instance.SetColorBlock(button.Button, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f);
SelectedTab = tabIndex;
SaveToConfigManager();
@ -49,7 +49,7 @@ namespace UnityExplorer.UI.Panels
private void DisableTab(int tabIndex)
{
tabPages[tabIndex].SetActive(false);
RuntimeProvider.Instance.SetColorBlock(tabButtons[tabIndex].Button, UIManager.navButtonDisabledColor, UIManager.navButtonDisabledColor * 1.2f);
RuntimeProvider.Instance.SetColorBlock(tabButtons[tabIndex].Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
}
public override void Update()
@ -97,10 +97,11 @@ namespace UnityExplorer.UI.Panels
public override void SetDefaultPosAndAnchors()
{
// todo proper default size
mainPanelRect.localPosition = Vector2.zero;
mainPanelRect.pivot = new Vector2(0f, 1f);
mainPanelRect.anchorMin = new Vector2(0.1f, 0.2f);
mainPanelRect.anchorMax = new Vector2(0.25f, 0.9f);
mainPanelRect.anchorMin = new Vector2(0.1f, 0.25f);
mainPanelRect.anchorMax = new Vector2(0.25f, 0.8f);
//mainPanelRect.anchorMin = Vector3.zero;

View File

@ -227,19 +227,6 @@ namespace UnityExplorer.UI.Panels
Vector3 pos = Panel.localPosition;
pos += (Vector3)diff;
Panel.localPosition = pos;
// TODO prevent dragging the navbar outside the window completely.
// this was not that, but should do that.
//var halfHeight = Panel.rect.height * 0.5f;
//var halfWidth = Panel.rect.width * 0.5f;
//if (Panel.MinY() - halfHeight + 25 < 0
// || Panel.MinX() - halfWidth + 25 < 0
// || Panel.MaxY() + halfWidth - 25 > Screen.height
// || Panel.MinX() + halfWidth - 25 > Screen.width)
//{
// Panel.localPosition -= (Vector3)diff;
//}
}
public void OnEndDrag()

View File

@ -114,9 +114,9 @@ namespace UnityExplorer.UI.Panels
if (NavButtonWanted)
{
if (active)
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.navButtonEnabledColor, UIManager.navButtonEnabledColor * 1.2f);
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f);
else
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.navButtonDisabledColor, UIManager.navButtonDisabledColor * 1.2f);
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
}
}
@ -136,7 +136,7 @@ namespace UnityExplorer.UI.Panels
NavButton = UIFactory.CreateButton(UIManager.NavbarButtonHolder, $"Button_{PanelType}", Name);
UIFactory.SetLayoutElement(NavButton.Button.gameObject, minWidth: 118, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.navButtonDisabledColor, UIManager.navButtonDisabledColor * 1.2f);
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
NavButton.OnClick += () =>
{
UIManager.TogglePanel(PanelType);