Menu Screen + UI Restyle
Created menu screen Created inventory tab with 2 cargo panes and properties panel Updated the style of every UI prefab Implemented Blurred UI material Implemented UI shaders for map layers Created Map tab (still needs input)
This commit is contained in:
parent
ac0361fd9b
commit
4f19189244
106 changed files with 11233 additions and 24584 deletions
54
Assets/MenuPanel.cs
Normal file
54
Assets/MenuPanel.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MenuPanel : MonoBehaviour
|
||||
{
|
||||
public RectTransform TabButtons;
|
||||
public Color ActiveTabColor;
|
||||
public Color InactiveTabColor;
|
||||
|
||||
public event Action<MenuTab> TabChanged;
|
||||
|
||||
private Dictionary<MenuTab, MenuTabButton> _tabs = new Dictionary<MenuTab, MenuTabButton>();
|
||||
private MenuTabButton _current;
|
||||
|
||||
public void ShowTab(MenuTab tab)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (_current == _tabs[tab]) return;
|
||||
|
||||
if(_current != null)
|
||||
{
|
||||
_current.TabContents.SetActive(false);
|
||||
_current.Text.color = InactiveTabColor;
|
||||
}
|
||||
|
||||
_current = _tabs[tab];
|
||||
|
||||
_current.TabContents.SetActive(true);
|
||||
_current.Text.color = ActiveTabColor;
|
||||
|
||||
TabChanged?.Invoke(tab);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
foreach (var tabButton in TabButtons.GetComponentsInChildren<MenuTabButton>())
|
||||
{
|
||||
tabButton.TabContents.SetActive(false);
|
||||
tabButton.Text.color = InactiveTabColor;
|
||||
_tabs.Add(tabButton.Tab, tabButton);
|
||||
tabButton.Button.onClick.AddListener(() => ShowTab(tabButton.Tab));
|
||||
}
|
||||
ShowTab(MenuTab.Inventory);
|
||||
}
|
||||
}
|
||||
|
||||
public enum MenuTab
|
||||
{
|
||||
Map,
|
||||
Inventory
|
||||
}
|
||||
Loading…
Reference in a new issue