Quantum 3 3.0.5

Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
Quantum.QuantumStartUI Class Reference

A simple menu to utilize the most common Photon connection and game start modes. More...

Inheritance diagram for Quantum.QuantumStartUI:
Quantum.QuantumMonoBehaviour

Classes

class  UIBindings
 Includes all ui element bindings for the menu. More...
 

Public Member Functions

void SetPanelVisibility (bool isShowing, float normalizedAnimationTime=0.0f)
 Set the visibility of the panel and play show and hide animations. More...
 
async System.Threading.Tasks.Task TryExecuteMppmCommand (QuantumMppmCommand command)
 Multiplayer Play Mode command execution. Allows to start Mppm instances of the menu simultaneously and connect to the same room. More...
 

Public Attributes

bool DisableAfterLoadingFromDifferentScene
 Disable the menu when this scene is loaded from a different scene (e.g. another online menu). More...
 
int PingDelta = 81
 The ping threshold between signal strength icons. More...
 
bool ReloadSceneAfterShutdown = true
 Reload this scene after shutting down the game. More...
 
bool ToggleUnityCursor
 Toggle UnityEngine.Cursor on and off when enabled and disabling the menu. More...
 

Protected Types

enum  State
 Simple menu state machine to prevent multiple start and shutdown calls. More...
 
enum  Tab
 Available tabs are hard-coded. More...
 

Protected Member Functions

virtual void Awake ()
 Unity Awake() method to register button listeners and get components. More...
 
virtual async void OnConnectionError (string errorMessage)
 A callback for the connection to report errors during runtime. More...
 
virtual void OnCopyRoomNamePressed ()
 Copy the room name button was pressed. QuantumCopyToClipboard has a different implementation in WebGL. More...
 
virtual async void OnDisconnectPressed ()
 The user pressed the disconnect button, shutdown the game and disconnect from the server. More...
 
virtual void OnEnable ()
 Unity OnEnable() method to initialize the menu UI elements and set the initial state. More...
 
virtual void OnMuteValueChanged (bool value)
 The sound mute button toggle was pressed. More...
 
virtual async void OnPlayPressed ()
 Start the game when the user pressed the play button. More...
 
virtual void OnPopupPressed ()
 The user pressed the popup button, complete the task so ShowPopupAsync(string) can complete. More...
 
virtual void OnQuitPressed ()
 Quit the application when the user pressed the quit button. More...
 
virtual void OnTogglePressed ()
 Toggle menu button pressed will show or hide the main menu panel. More...
 
virtual async System.Threading.Tasks.Task ShowPopupAsync (string message)
 Show the popup screen and wait for the user to close it. More...
 
virtual async System.Threading.Tasks.Task ShutdownGameAsync ()
 Shutdown the game and disconnect from the server. Will ignore subsequent calls until the shutdown is complete. More...
 
virtual async System.Threading.Tasks.Task StartGameAsync (bool isOnline, string playerName, string roomName, string region)
 Handling commencing the connection and game start. Mostly UI boilerplate, enabling and disabling UI elements, setting status text, etc. Calls QuantumStartUIConnectionBase.ConnectAsync(QuantumStartUIConnectionBase.StartParameter) to start the connection and game. More...
 
virtual void Update ()
 Unity Update() method updates a few things by polling. More...
 

Static Protected Member Functions

static void QuantumCopyToClipboard (string text)
 Copy the given text to the system clipboard. Has a different implementation in WebGL builds, where it uses a JavaScript function to copy to clipboard. More...
 

Protected Attributes

Animator Animator
 The animator controller component. The menu also works without an animator. More...
 
QuantumStartUIConnectionBase Connection
 The connection implementation that handles the connection to the Photon server and game start. Will be tried to retrieved during Awake. More...
 
State CurrentState
 Is set during the async shutdown process to prevent multiple shutdown calls. More...
 
Tab CurrentTab
 The currently selected tab. More...
 
List< UnityEngine.UI.Selectable > ToggleInputGroup
 A list of UI elements that are set non-interactable during starting process, populated internally. More...
 
UIBindings UI
 The UI bindings for the menu. More...
 

Static Protected Attributes

static readonly int AnimationHashHide = Animator.StringToHash("Hide")
 Cached Hide animation hash. More...
 
static readonly int AnimationHashShow = Animator.StringToHash("Show")
 Cached Show animation hash. More...
 

Properties

bool? IsMuted [get, set]
 Load and save the muted state in Player Prefs. More...
 
string PlayerName [get, set]
 Load and save the name player name in Payer Prefs. More...
 
string Region [get, set]
 Load and save the selected region in Player Prefs. More...
 

Detailed Description

A simple menu to utilize the most common Photon connection and game start modes.

Member Enumeration Documentation

◆ State

enum Quantum.QuantumStartUI.State
strongprotected

Simple menu state machine to prevent multiple start and shutdown calls.

Enumerator
Idle 

Default state, no connection or game started.

Starting 

Game is connecting and starting.

Running 

Game is running.

ShuttingDown 

Game is shutting down.

◆ Tab

enum Quantum.QuantumStartUI.Tab
strongprotected

Available tabs are hard-coded.

Enumerator
Online 

Play online tab

Local 

Play local tab

Member Function Documentation

◆ QuantumCopyToClipboard()

static void Quantum.QuantumStartUI.QuantumCopyToClipboard ( string  text)
staticprotected

Copy the given text to the system clipboard. Has a different implementation in WebGL builds, where it uses a JavaScript function to copy to clipboard.

Parameters
text

◆ TryExecuteMppmCommand()

async System.Threading.Tasks.Task Quantum.QuantumStartUI.TryExecuteMppmCommand ( QuantumMppmCommand  command)
inline

Multiplayer Play Mode command execution. Allows to start Mppm instances of the menu simultaneously and connect to the same room.

Parameters
commandMppm command

◆ SetPanelVisibility()

void Quantum.QuantumStartUI.SetPanelVisibility ( bool  isShowing,
float  normalizedAnimationTime = 0.0f 
)
inline

Set the visibility of the panel and play show and hide animations.

Parameters
isShowingMenu main panel visibility
normalizedAnimationTimeThe time offset between zero and one forwarded to the show animation.

◆ Awake()

virtual void Quantum.QuantumStartUI.Awake ( )
inlineprotectedvirtual

Unity Awake() method to register button listeners and get components.

◆ OnMuteValueChanged()

virtual void Quantum.QuantumStartUI.OnMuteValueChanged ( bool  value)
inlineprotectedvirtual

The sound mute button toggle was pressed.

Parameters
valueMuted state.

◆ OnCopyRoomNamePressed()

virtual void Quantum.QuantumStartUI.OnCopyRoomNamePressed ( )
inlineprotectedvirtual

Copy the room name button was pressed. QuantumCopyToClipboard has a different implementation in WebGL.

◆ OnEnable()

virtual void Quantum.QuantumStartUI.OnEnable ( )
inlineprotectedvirtual

Unity OnEnable() method to initialize the menu UI elements and set the initial state.

◆ Update()

virtual void Quantum.QuantumStartUI.Update ( )
inlineprotectedvirtual

Unity Update() method updates a few things by polling.

◆ OnTogglePressed()

virtual void Quantum.QuantumStartUI.OnTogglePressed ( )
inlineprotectedvirtual

Toggle menu button pressed will show or hide the main menu panel.

◆ OnPlayPressed()

virtual async void Quantum.QuantumStartUI.OnPlayPressed ( )
inlineprotectedvirtual

Start the game when the user pressed the play button.

◆ StartGameAsync()

virtual async System.Threading.Tasks.Task Quantum.QuantumStartUI.StartGameAsync ( bool  isOnline,
string  playerName,
string  roomName,
string  region 
)
inlineprotectedvirtual

Handling commencing the connection and game start. Mostly UI boilerplate, enabling and disabling UI elements, setting status text, etc. Calls QuantumStartUIConnectionBase.ConnectAsync(QuantumStartUIConnectionBase.StartParameter) to start the connection and game.

Parameters
isOnlineNon-online start does not require a connection.
playerNamePlayer name to use for the connection.
roomNameRoom name, can be null.
regionRegion to use.

◆ OnDisconnectPressed()

virtual async void Quantum.QuantumStartUI.OnDisconnectPressed ( )
inlineprotectedvirtual

The user pressed the disconnect button, shutdown the game and disconnect from the server.

◆ OnConnectionError()

virtual async void Quantum.QuantumStartUI.OnConnectionError ( string  errorMessage)
inlineprotectedvirtual

A callback for the connection to report errors during runtime.

Parameters
errorMessageThe error message to display to the user

◆ ShutdownGameAsync()

virtual async System.Threading.Tasks.Task Quantum.QuantumStartUI.ShutdownGameAsync ( )
inlineprotectedvirtual

Shutdown the game and disconnect from the server. Will ignore subsequent calls until the shutdown is complete.

◆ OnPopupPressed()

virtual void Quantum.QuantumStartUI.OnPopupPressed ( )
inlineprotectedvirtual

The user pressed the popup button, complete the task so ShowPopupAsync(string) can complete.

◆ OnQuitPressed()

virtual void Quantum.QuantumStartUI.OnQuitPressed ( )
inlineprotectedvirtual

Quit the application when the user pressed the quit button.

◆ ShowPopupAsync()

virtual async System.Threading.Tasks.Task Quantum.QuantumStartUI.ShowPopupAsync ( string  message)
inlineprotectedvirtual

Show the popup screen and wait for the user to close it.

Parameters
messageMessage to display in the popup

Member Data Documentation

◆ AnimationHashHide

readonly int Quantum.QuantumStartUI.AnimationHashHide = Animator.StringToHash("Hide")
staticprotected

Cached Hide animation hash.

◆ AnimationHashShow

readonly int Quantum.QuantumStartUI.AnimationHashShow = Animator.StringToHash("Show")
staticprotected

Cached Show animation hash.

◆ ToggleUnityCursor

bool Quantum.QuantumStartUI.ToggleUnityCursor

Toggle UnityEngine.Cursor on and off when enabled and disabling the menu.

◆ ReloadSceneAfterShutdown

bool Quantum.QuantumStartUI.ReloadSceneAfterShutdown = true

Reload this scene after shutting down the game.

◆ DisableAfterLoadingFromDifferentScene

bool Quantum.QuantumStartUI.DisableAfterLoadingFromDifferentScene

Disable the menu when this scene is loaded from a different scene (e.g. another online menu).

◆ PingDelta

int Quantum.QuantumStartUI.PingDelta = 81

The ping threshold between signal strength icons.

◆ UI

UIBindings Quantum.QuantumStartUI.UI
protected

The UI bindings for the menu.

◆ ToggleInputGroup

List<UnityEngine.UI.Selectable> Quantum.QuantumStartUI.ToggleInputGroup
protected

A list of UI elements that are set non-interactable during starting process, populated internally.

◆ Connection

QuantumStartUIConnectionBase Quantum.QuantumStartUI.Connection
protected

The connection implementation that handles the connection to the Photon server and game start. Will be tried to retrieved during Awake.

◆ Animator

Animator Quantum.QuantumStartUI.Animator
protected

The animator controller component. The menu also works without an animator.

◆ CurrentState

State Quantum.QuantumStartUI.CurrentState
protected

Is set during the async shutdown process to prevent multiple shutdown calls.

◆ CurrentTab

Tab Quantum.QuantumStartUI.CurrentTab
protected

The currently selected tab.

Property Documentation

◆ PlayerName

string Quantum.QuantumStartUI.PlayerName
getsetprotected

Load and save the name player name in Payer Prefs.

◆ Region

string Quantum.QuantumStartUI.Region
getsetprotected

Load and save the selected region in Player Prefs.

◆ IsMuted

bool? Quantum.QuantumStartUI.IsMuted
getsetprotected

Load and save the muted state in Player Prefs.