UIBuffGroup - jimdroberts/FishMMO GitHub Wiki

Description

A UI component representing a group for a buff or debuff in the FishMMO client. Displays the buff icon, tooltip, duration slider, and label. Intended to be used as part of the buff UI to show active buffs or debuffs on the player.


API Access

Fields

  • public Image Icon

    The icon representing the buff or debuff.

  • public UITooltipButton TooltipButton

    The tooltip button for displaying additional information about the buff or debuff.

  • public Slider DurationSlider

    The slider showing the remaining duration of the buff or debuff.

  • public TMP_Text ButtonText

    The text label for the buff or debuff button.


Basic Usage

Setup

  1. Attach UIBuffGroup to a buff group UI GameObject in the Unity Editor.
  2. Assign the Icon, TooltipButton, DurationSlider, and ButtonText fields in the Inspector.
  3. Integrate with the buff UI to update the group when a buff or debuff is added or updated.

Example

// Example usage in a MonoBehaviour
public UIBuffGroup buffGroup;

void ShowBuff(Buff buff) {
    buffGroup.Icon.sprite = buff.Template.Icon;
    buffGroup.ButtonText.text = buff.Template.Name;
    buffGroup.DurationSlider.value = buff.RemainingTime / buff.Template.Duration;
    // Set up tooltip as needed
}

Best Practices

  • Always assign all UI references in the Inspector to avoid null reference errors.
  • Update the UI fields whenever a new buff or debuff is added or updated.
  • Use the duration slider to give clear feedback on buff/debuff duration.
  • Integrate with the tooltip system for additional information display.
⚠️ **GitHub.com Fallback** ⚠️