mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-30 04:57:10 +01:00
Merging
This commit is contained in:
55
Assets/Scripts/HomeMenu/MenuPanelSwitch.cs
Normal file
55
Assets/Scripts/HomeMenu/MenuPanelSwitch.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MenuPanelSwitch : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject MainPanel, JoinPanel, HostPanel, OptionsPanel;
|
||||
|
||||
[SerializeField] private Button JoinBtn, HostBtn, OptionsBtn;
|
||||
private Button BackBtn;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ResetToMain();
|
||||
JoinBtn.onClick.AddListener(SwitchJoinPanel);
|
||||
HostBtn.onClick.AddListener(SwitchHostPanel);
|
||||
OptionsBtn.onClick.AddListener(SwitchOptionsPanel);
|
||||
}
|
||||
public void ResetToMain()
|
||||
{
|
||||
JoinPanel.SetActive(false);
|
||||
HostPanel.SetActive(false);
|
||||
OptionsPanel.SetActive(false);
|
||||
|
||||
MainPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void TurnAllOff()
|
||||
{
|
||||
JoinPanel.SetActive(false);
|
||||
HostPanel.SetActive(false);
|
||||
OptionsPanel.SetActive(false);
|
||||
MainPanel.SetActive(false);
|
||||
}
|
||||
|
||||
public void SwitchJoinPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
JoinPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SwitchHostPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
HostPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SwitchOptionsPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
OptionsPanel.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user