44 lines
No EOL
1.2 KiB
C#
44 lines
No EOL
1.2 KiB
C#
/*
|
|
* author: mark joshwel
|
|
* date: 30/5/2024
|
|
* description: credits menu script for handling credits menu button functions
|
|
*/
|
|
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
/// <summary>
|
|
/// class managing the credits menu and button function invocations
|
|
/// </summary>
|
|
public class CreditsMenu : CommonMenu
|
|
{
|
|
/// <summary>
|
|
/// button to return to main menu
|
|
/// </summary>
|
|
public Button ButtonReturn;
|
|
|
|
/// <summary>
|
|
/// function to associate a display state with the menu,
|
|
/// and subscribe button events to their respective functions
|
|
/// </summary>
|
|
public override void OnEnable()
|
|
{
|
|
associatedState = GameManager.DisplayState.ScreenCreditsMenu;
|
|
base.OnEnable();
|
|
|
|
// get the start button from the ui root and subscribe appropriate functions
|
|
ButtonReturn = UI.Q<Button>("ButtonReturn");
|
|
ButtonReturn.clicked += PlayClick;
|
|
ButtonReturn.clicked += OptionReturnToMainMenu;
|
|
}
|
|
|
|
/// <summary>
|
|
/// handles return to main menu button press,
|
|
/// signals the game manager appropriately
|
|
/// </summary>
|
|
private void OptionReturnToMainMenu()
|
|
{
|
|
// return to main menu
|
|
Game.SetDisplayState(GameManager.DisplayState.ScreenMainMenu);
|
|
}
|
|
} |