Added options and credits tabs for the in-game UI menu. Credits tab is blank for now. Disabled smooth locomotion to address the player controller confusion issues (see my thesis). Smooth locomotion can be reactivated via the options menu.
This commit is contained in:
@@ -24,6 +24,24 @@ public class Menu : MonoBehaviour
|
||||
public InputActionReference openMenuAction;
|
||||
private Canvas canvas;
|
||||
|
||||
public enum MenuTab
|
||||
{
|
||||
Map,
|
||||
Options,
|
||||
Credits
|
||||
}
|
||||
|
||||
public GameObject MapTab;
|
||||
public GameObject OptionsTab;
|
||||
public GameObject CreditsTab;
|
||||
|
||||
private MenuTab currentTab;
|
||||
|
||||
|
||||
public Button mapBookmark;
|
||||
public Button optionsBookmark;
|
||||
public Button creditsBookmark;
|
||||
|
||||
// Values for setting the position of the player marker. Do not touch them without great cause.
|
||||
private Vector2 rotatedPlayerPos = new Vector2();
|
||||
private float worldToMapAngle = 130.0f;
|
||||
@@ -38,6 +56,8 @@ public class Menu : MonoBehaviour
|
||||
private float floor1LowerLimit = -5;
|
||||
private bool activated = true;
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
openMenuAction.action.Enable();
|
||||
@@ -45,6 +65,11 @@ public class Menu : MonoBehaviour
|
||||
InputSystem.onDeviceChange += OnDeviceChange;
|
||||
canvas = GetComponent<Canvas>();
|
||||
setCanvasVisibility(false);
|
||||
|
||||
mapBookmark.onClick.AddListener(activateMapPanel);
|
||||
optionsBookmark.onClick.AddListener(activateOptionsPanel);
|
||||
creditsBookmark.onClick.AddListener(activateCreditsPanel);
|
||||
activateMapPanel();
|
||||
|
||||
}
|
||||
public void DeactivateMenu() // Makes the ToggleMenu inable to toggle.
|
||||
@@ -57,6 +82,36 @@ public class Menu : MonoBehaviour
|
||||
activated = true;
|
||||
}
|
||||
|
||||
private void activateMapPanel()
|
||||
{
|
||||
SetActiveTab(MenuTab.Map);
|
||||
}
|
||||
|
||||
private void activateOptionsPanel()
|
||||
{
|
||||
SetActiveTab(MenuTab.Options);
|
||||
}
|
||||
|
||||
private void activateCreditsPanel()
|
||||
{
|
||||
SetActiveTab(MenuTab.Credits);
|
||||
}
|
||||
|
||||
private void SetActiveTab(MenuTab tab)
|
||||
{
|
||||
currentTab = tab;
|
||||
|
||||
MapTab.SetActive(tab == MenuTab.Map);
|
||||
OptionsTab.SetActive(tab == MenuTab.Options);
|
||||
CreditsTab.SetActive(tab == MenuTab.Credits);
|
||||
|
||||
mapBookmark.GetComponent<HoverSlideButton>().SetOnState(tab == MenuTab.Map);
|
||||
optionsBookmark.GetComponent<HoverSlideButton>().SetOnState(tab == MenuTab.Options);
|
||||
creditsBookmark.GetComponent<HoverSlideButton>().SetOnState(tab == MenuTab.Credits);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setCanvasVisibility(bool enabled)
|
||||
{
|
||||
canvas.enabled = enabled;
|
||||
@@ -160,10 +215,12 @@ public class Menu : MonoBehaviour
|
||||
ToggleMenu(new InputAction.CallbackContext()); // Activate menu.
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePlayerIconPosition();
|
||||
UpdatePlayerIconRotation();
|
||||
UpdateActveFloor();
|
||||
if (MapTab.activeSelf)
|
||||
{
|
||||
UpdatePlayerIconPosition();
|
||||
UpdatePlayerIconRotation();
|
||||
UpdateActveFloor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -266,10 +323,12 @@ public class Menu : MonoBehaviour
|
||||
if (PlayericonFloor1Parent.activeSelf)
|
||||
{
|
||||
PlayericonFloor1.GetComponent<RectTransform>().anchoredPosition = IMG_Player;
|
||||
Debug.Log(IMG_Player);
|
||||
}
|
||||
if (PlayericonFloor2Parent.activeSelf)
|
||||
{
|
||||
PlayericonFloor2.GetComponent<RectTransform>().anchoredPosition = IMG_Player;
|
||||
Debug.Log(IMG_Player);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user