UIMenu - jimdroberts/FishMMO GitHub Wiki
UIMenu
is a UI control in the FishMMO client that manages the main menu, including options, quitting to login, and quitting the game. It provides button handlers for these actions and interacts with other UI components and the client.
-
public void OnButtonOptions()
Called when the Options button is pressed. Shows the options UI if available.
-
public void OnButtonQuitToLogin()
Called when the Quit to Login button is pressed. Returns the player to the login screen.
-
public void OnButtonQuit()
Called when the Quit button is pressed. Exits the game client.
- Attach
UIMenu
to a UI GameObject in the Unity Editor. - Connect the menu buttons to the corresponding methods (
OnButtonOptions
,OnButtonQuitToLogin
,OnButtonQuit
). - Ensure
UIOptions
andClient
are properly configured in the project.
// Example: Using UIMenu button handlers
public void OnButtonOptions()
{
if (UIManager.TryGet("UIOptions", out UIOptions uiOptions))
{
uiOptions.Show();
}
}
public void OnButtonQuitToLogin()
{
Client.QuitToLogin();
}
public void OnButtonQuit()
{
Client.Quit();
}
- Ensure all menu buttons are properly wired to their handler methods.
- Use
UIManager.TryGet
to safely access other UI components. - Handle quitting and login transitions gracefully to avoid data loss.