UI Manager
Subscribed Events
EventType.MENU_SWITCHED, <Canvas> EventType.OVERLAY_SWITCHED, <Canvas> EventType.DISPLAY_INFO_POPUP, <string, float>
Description
UI Manager that allows for easy switching of canvases with the use of an Event Bus.
using UnityEngine;
public class ScoreController: MonoBehaviour
{
private int playerScore = 0;
private int opponentScore = 0;
private int scoreLimit = 11;
//Displays the Win/Lose screen based on outcome of the game and turns off all other main canvases.
private void CheckWinLose()
{
if(playerScore >= scoreLimit)
Eventbus.Publish(MENU_SWITCHED, UIManager.Instance.WinScreen);
else if(opponentScore>= scoreLimit)
Eventbus.Publish(MENU_SWITCHED, UIManager.Instance.LoseScreen);
}
//Increases the players score and displays an info popup saying "Player Scored" that is visible for 2 seconds.
private void PlayerScored()
{
playerScore++;
Eventbus.Publish(EventType.DISPLAY_INFO_POPUP, "Player Scored", 2f);
}
//Increases the opponents score and displays an info popup saying "Opponent Scored" that is visible for 2 seconds.
private void Opponent Scored()
{
opponentScore++;
Eventbus.Publish(EventType.DISPLAY_INFO_POPUP, "Opponent Scored", 2f);
}
}Properites
btnColor | Color variable for an active button that has not been selected yet. |
menuList | List of Canvas objects for use with EventType.MENU_SWITCHED. |
overlayList | List of overlay Canvas objects for use with EventType.OVERLAY_SWITCHED. |
titleScreen | private Canvas variable for titleScreen canvas. |
gameModeScreen | private Canvas variable for gameModeScreen canvas. |
exhibitionStartScreen | private Canvas variable for exhibitionStartScreen canvas. |
tournamentStartScreen | private Canvas variable for tournamentStartScreen canvas. |
gameScreen | private Canvas variable for gameScreen canvas. |
scoreText | Text variable for gameScreen to display the score. |
winLoseScreen | private Canvas variable for winLoseScreen canvas. |
outcomeText | Text variable for winLoseScreen to display the outcome of the game. (Win/Lose). |
finalScoreText | Text variable for winLoseScreen to display the final score. |
customizationPaddleScreen | private Canvas variable for customizationPaddleScreen canvas. |
paddleDescriptionText | Text variable for customizationPaddleScreen to display the discription of the paddle. |
customizationBallScreen | private Canvas variable for customizationBallScreen canvas. |
ballDescriptionText | Text variable for customizationBallScreen to display the discription of the ball. |
customizationBallTrailScreen | private Canvas variable for customizationBallTrailScreen canvas. |
ballTrailDescriptionText | Text variable for customizationBallTrailScreen to display the discription of the ball trail. |
TitleScreen | public Canvas property for titleScreen canvas. |
GameModeScreen | public Canvas property for gameModeScreen canvas. |
ExhibitionStartScreen | public Canvas property for exhibitionStartScreen canvas. |
TournamentStartScreen | public Canvas property for tournamentStartScreen canvas. |
GameScreen | public Canvas property for gameScreen canvas. |
WinLoseScreen | public Canvas property for winLoseScreen canvas. |
CustomizationPaddleScreen | public Canvas property for customizationPaddleScreen canvas. |
CustomizationBallScreen | public Canvas property for customizationBallScreen canvas. |
CustomizationBallTrailScreen | public Canvas property for customizationBallTrailScreen canvas. |
exhibitionsStartController | Reference to the ExhibitionStartController for initializing the exhibition game mode with buttons. |
infoScreen | private Canvas variable for infoScreen overlay canvas. |
infoText | Text variable for infoScreen to display the info provided. |
InfoScreen | public Canvas variable for infoScreen overlay canvas. |



