UIMenu - jimdroberts/FishMMO GitHub Wiki

Description

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.


API Access

Methods

  • 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.


Basic Usage

Setup

  1. Attach UIMenu to a UI GameObject in the Unity Editor.
  2. Connect the menu buttons to the corresponding methods (OnButtonOptions, OnButtonQuitToLogin, OnButtonQuit).
  3. Ensure UIOptions and Client are properly configured in the project.

Example

// 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();
}

Best Practices

  • 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.
⚠️ **GitHub.com Fallback** ⚠️