Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust ui text and add back buttons #143

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions Assets/scripts/ui/GameMenuHandlerUGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class GameMenuHandlerUGUI : MonoBehaviour {
/// <summary>
Expand All @@ -14,32 +15,50 @@ public class GameMenuHandlerUGUI : MonoBehaviour {
public GameObject instructionPanel;
public GameObject clientWaitPanel;
public GameObject backgroundPanel;
private List<GameObject> panelStack;

[SerializeField]
private Text instruction;

private bool offlineSelected;
private bool singlePlayerSelected;


// Use this for initialization
void Start () {
offlineSelected = false;
singlePlayerSelected = false;

panelStack = new List<GameObject>();
panelStack.Add(localOrOnlinePanel);
}

//merp was going to do something better, like this, but decided the other way was quicker to program, atm. - sjm
void Function(string menu)
{
}

public void PreviousPanel()
{
if (panelStack.Count > 1 && panelStack[panelStack.Count - 1].activeSelf == true)
{
panelStack[panelStack.Count - 1].SetActive(false);
panelStack[panelStack.Count - 2].SetActive(true);
panelStack.RemoveAt(panelStack.Count - 1);
}
else if (panelStack.Count == 1)
{
SceneManager.LoadScene("MainMenu");
}
}

public void OnlineOrLocalPanel()
{

{
if (localOrOnlinePanel.activeSelf == false)
{
CloseAllPanels();
localOrOnlinePanel.SetActive(true);
localOrOnlinePanel.SetActive(true);
panelStack.Add(localOrOnlinePanel);

}
else if (localOrOnlinePanel.activeSelf == true)
Expand All @@ -49,13 +68,14 @@ public void OnlineOrLocalPanel()
}

public void LocalPanel()
{
{
offlineSelected = true;

if (singleOrMultiPanel.activeSelf == false)
{
CloseAllPanels();
singleOrMultiPanel.SetActive(true);
singleOrMultiPanel.SetActive(true);
panelStack.Add(singleOrMultiPanel);
}
else if (singleOrMultiPanel.activeSelf == true)
{
Expand All @@ -65,11 +85,12 @@ public void LocalPanel()


public void OnlinePanel()
{
{
if (onlinePanel.activeSelf == false)
{
CloseAllPanels();
onlinePanel.SetActive(true);
onlinePanel.SetActive(true);
panelStack.Add(onlinePanel);
}
else if (onlinePanel.activeSelf == true)
{
Expand All @@ -78,14 +99,15 @@ public void OnlinePanel()
}

public void LevelSelectionPanel(bool singlePlayer)
{
{
// Store whether single player was selected as reference for InstructionPanel().
singlePlayerSelected = singlePlayer;

if (levelSelectionPanel.activeSelf == false)
{
CloseAllPanels();
levelSelectionPanel.SetActive(true);
levelSelectionPanel.SetActive(true);
panelStack.Add(levelSelectionPanel);
}
else if (levelSelectionPanel.activeSelf == true)
{
Expand All @@ -94,11 +116,12 @@ public void LevelSelectionPanel(bool singlePlayer)
}

public void InstructionPanel()
{
{
if (instructionPanel.activeSelf == false)
{
CloseAllPanels();
instructionPanel.SetActive(true);
instructionPanel.SetActive(true);
panelStack.Add(instructionPanel);
}
else if (instructionPanel.activeSelf == true)
{
Expand Down Expand Up @@ -138,6 +161,7 @@ public void ClientWaitPanel()
{
CloseAllPanels();
clientWaitPanel.SetActive(true);
panelStack.Add(clientWaitPanel);
}
else if (clientWaitPanel.activeSelf == true)
{
Expand Down
Loading