UIGuildMember - jimdroberts/FishMMO GitHub Wiki

Description

UI component that represents a guild member in the guild roster UI. Exposes name, rank, and location text fields and provides dropdown interactions for messaging, friend requests, rank changes, kicking members, and location actions.


API Access

Fields

  • public TMP_Text Name

    Text component that displays the guild member's character name.

  • public TMP_Text Rank

    Text component that displays the member's guild rank (e.g., Leader, Officer, Member).

  • public TMP_Text Location

    Text component that displays the member's current location string.

Methods

  • public void Button_OnClickName()

    Called when the member's name is clicked. Resolves the character ID from the name, prevents actions on self, and displays a dropdown with "Message" and "Add Friend" actions. "Message" pre-fills a /tell command in the chat input.

  • public void Button_OnClickRank()

    Called when the member's rank text is clicked. If the local player's guild rank authorizes changes, resolves the numeric GuildRank from the text and adds appropriate dropdown buttons: Promote, Demote, Kick. Each action resolves the character ID and broadcasts the corresponding guild change/ removal message to the server.

  • public void Button_OnClickLocation()

    Called when the location text is clicked. Currently a placeholder (logs the location). Can be extended to show map, teleport requests, or other location actions.


Basic Usage

Setup

  1. Add UIGuildMember to a guild member row prefab and expose Name, Rank, and Location text fields in the inspector.
  2. Use a parent UIGuild controller to instantiate and manage UIGuildMember entries (the controller resolves names and drives updates).
  3. Ensure UIDropdown, UIChat, and the ClientNamingSystem are available at runtime for dropdown actions and name resolution.

Example

// Typical usage: UIGuild creates entries and populates fields
var member = Instantiate(guildMemberPrefab, parent).GetComponent<UIGuildMember>();
member.Name.text = "PlayerOne";
member.Rank.text = GuildRank.Member.ToString();
member.Location.text = "Harbor Town";

// Clicking name or rank triggers dropdown-driven actions wired by the component.

Best Practices

  • Keep text fields simple and performant; avoid frequent string allocations in update loops.
  • Ensure ClientNamingSystem callbacks are lightweight and resilient to missing/slow responses.
  • Only allow rank/administrative actions when the local player's IGuildController.Rank permits them to avoid inconsistent UI states.
  • Localize button/label text if the game supports multiple languages.
  • Extend Button_OnClickLocation to provide useful guild-centric location actions (e.g., ping on map, request group) rather than leaving it as a no-op.
⚠️ **GitHub.com Fallback** ⚠️