UIGuildMember - jimdroberts/FishMMO GitHub Wiki
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.
-
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.
-
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.
- Add
UIGuildMember
to a guild member row prefab and exposeName
,Rank
, andLocation
text fields in the inspector. - Use a parent
UIGuild
controller to instantiate and manageUIGuildMember
entries (the controller resolves names and drives updates). - Ensure
UIDropdown
,UIChat
, and theClientNamingSystem
are available at runtime for dropdown actions and name resolution.
// 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.
- 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.