mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-13 22:33:43 +00:00
UI ups
This commit is contained in:
parent
8df84480d3
commit
ff6b95b251
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,10 @@ public class Scoreboard: MonoBehaviour
|
|||||||
public static Scoreboard Instance;
|
public static Scoreboard Instance;
|
||||||
public LevelObjective CurrentObjective;
|
public LevelObjective CurrentObjective;
|
||||||
|
|
||||||
|
public LevelObjective Stage1Objective;
|
||||||
|
public LevelObjective Stage2Objective;
|
||||||
|
public LevelObjective Stage3Objective;
|
||||||
|
|
||||||
public Dictionary<ProductType, Vector2Int> ProductCounts = new ();
|
public Dictionary<ProductType, Vector2Int> ProductCounts = new ();
|
||||||
|
|
||||||
public float _timeLeft;
|
public float _timeLeft;
|
||||||
@ -25,9 +29,21 @@ public class Scoreboard: MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public void StartStage(StagingManager.StageEnum stage)
|
||||||
{
|
{
|
||||||
SetObjective(CurrentObjective);
|
switch (stage)
|
||||||
|
{
|
||||||
|
case StagingManager.StageEnum.Level1:
|
||||||
|
SetObjective(Stage1Objective);
|
||||||
|
break;
|
||||||
|
case StagingManager.StageEnum.Level2:
|
||||||
|
SetObjective(Stage2Objective);
|
||||||
|
break;
|
||||||
|
case StagingManager.StageEnum.Level3:
|
||||||
|
SetObjective(Stage3Objective);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
Assets/Scripts/UI.meta
Normal file
3
Assets/Scripts/UI.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8929854d39c43b68703c565297a73f1
|
||||||
|
timeCreated: 1724110207
|
91
Assets/Scripts/UI/UIManager.cs
Normal file
91
Assets/Scripts/UI/UIManager.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class UIManager: MonoBehaviour
|
||||||
|
{
|
||||||
|
public enum UIState
|
||||||
|
{
|
||||||
|
MainMenu = 0,
|
||||||
|
Game = 1,
|
||||||
|
Pause = 2,
|
||||||
|
HowToPlay = 3,
|
||||||
|
StageSelect = 4,
|
||||||
|
ConfirmQuit = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UIState> StateStack = new List<UIState>() {UIState.MainMenu};
|
||||||
|
|
||||||
|
public GameObject MainMenu;
|
||||||
|
public GameObject Reticle;
|
||||||
|
public GameObject HowToPlay;
|
||||||
|
public GameObject StageSelect;
|
||||||
|
public GameObject ConfirmQuit;
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
MainMenu.SetActive(false);
|
||||||
|
Reticle.SetActive(false);
|
||||||
|
HowToPlay.SetActive(false);
|
||||||
|
StageSelect.SetActive(false);
|
||||||
|
ConfirmQuit.SetActive(false);
|
||||||
|
|
||||||
|
PushState(UIState.MainMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PushState(UIState state)
|
||||||
|
{
|
||||||
|
if (StateStack.Count > 0)
|
||||||
|
{
|
||||||
|
OnExitState(StateStack[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
StateStack.Add(state);
|
||||||
|
OnEnterState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PopState()
|
||||||
|
{
|
||||||
|
if (StateStack.Count > 0)
|
||||||
|
{
|
||||||
|
OnExitState(StateStack[0]);
|
||||||
|
StateStack.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnterState(UIState state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case UIState.MainMenu:
|
||||||
|
MainMenu.SetActive(true);
|
||||||
|
break;
|
||||||
|
case UIState.Game:
|
||||||
|
Reticle.SetActive(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnExitState(UIState state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case UIState.MainMenu:
|
||||||
|
MainMenu.SetActive(false);
|
||||||
|
break;
|
||||||
|
case UIState.Game:
|
||||||
|
Reticle.SetActive(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartStage(int stage)
|
||||||
|
{
|
||||||
|
Scoreboard.Instance.StartStage((StagingManager.StageEnum)stage);
|
||||||
|
PushState(UIState.Game);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Quit()
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/UI/UIManager.cs.meta
Normal file
3
Assets/Scripts/UI/UIManager.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1d007036093842af8034f1c5e5c1e7e8
|
||||||
|
timeCreated: 1724110214
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user