bellusfennec-CooldownUI icon

CooldownUI

A universal UI library for displaying cooldowns, timers, and status indicators above players. Easy to integrate into your ROUNDS mods.

Last updated 2 weeks ago
Total downloads 38638
Total rating 1 
Categories Gameplay Visual Effects Utilities
Dependency string bellusfennec-CooldownUI-1.0.1
Dependants 2 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack_ROUNDS-5.4.1901 icon
BepInEx-BepInExPack_ROUNDS

BepInEx pack for ROUNDS. Preconfigured and ready to use.

Preferred version: 5.4.1901
willis81808-UnboundLib-3.2.14 icon
willis81808-UnboundLib

This is a helpful utility for ROUNDS modders aimed at simplifying common tasks.

Preferred version: 3.2.14

README

CooldownUI

A universal UI library for ROUNDS that provides easy-to-use cooldown timers, status indicators, and text displays above players.

Features

  • Cooldown Timers - Display countdown with color transition (red → green)
  • Active Duration - Show remaining active time (cyan color)
  • Custom Text - Display any text with custom colors
  • Icons - Text icons (symbols) and sprite icons next to timers
  • Auto-Stacking - Multiple timers automatically stack vertically
  • Dynamic Scale Compensation - UI maintains constant size even when player scales up/down
  • Standardized Size - Consistent text size across all mods using this library
  • Performance - Efficient TextMeshPro rendering with built-in outline

Usage

Add as Dependency

In your mod's manifest.json:

{
    "dependencies": [
        "BellusFennec-CooldownUI-1.0.1"
    ]
}

In your plugin class:

[BepInDependency("com.rounds.cooldownui", BepInDependency.DependencyFlags.HardDependency)]

Basic Examples

Creating a Cooldown Timer

using CooldownUILib;

public class MyCardMono : MonoBehaviour
{
    private CooldownUI cooldownUI;
    private Player player;
    private float cooldown = 5f;
    private float cooldownTimer = 0f;

    void Start()
    {
        player = GetComponent<Player>();
        
        // Create UI attached to player
        cooldownUI = CooldownUI.Create(player.transform);
        
        // Optional: Set an icon
        cooldownUI.SetIcon("⚡", Color.yellow);
    }

    void Update()
    {
        if (cooldownTimer > 0f)
        {
            cooldownTimer -= Time.deltaTime;
            cooldownUI.ShowCooldown(cooldownTimer, cooldown);
        }
        else
        {
            cooldownUI.Hide();
        }
    }

    void OnDestroy()
    {
        if (cooldownUI != null)
        {
            Destroy(cooldownUI.gameObject);
        }
    }
}

Showing Active Duration

// Show remaining active time (cyan color)
cooldownUI.ShowActive(remainingTime);

Custom Text Display

// Show custom text
cooldownUI.ShowText("READY", Color.green);
cooldownUI.ShowText("x3", Color.white);  // Stack count
cooldownUI.ShowText("BLOCKED", Color.red);

// Convenience methods
cooldownUI.ShowReady();           // Shows "READY" in green
cooldownUI.ShowStacks(3);         // Shows "x3"
cooldownUI.ShowStacks(5, Color.yellow);

Icon Support

CooldownUI supports from Noto Sans Symbols font family.

Icon that are displayed correctly:

{ "Arrows", new[] { "←", "↑", "→", "↓", "↔", "↕", "➤" } },
{ "NumberForms", new[] { "Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ" } },
{ "Combat", new[] { "⚔", "⚒", "⚓", "☠", "⚙", "⚗", "⚖", "⛏", "⛓", "⛊", "⚰", "⛨" } },
{ "Magic", new[] { "⚡", "❄", "☀", "☁", "☂", "☃", "✴", "❋", "☼" } },
{ "Hearts", new[] { "❤", "♥", "♡", "❥" } },
{ "Status", new[] { "✓", "✔", "✗", "✘", "⚠" } },
{ "Stars", new[] { "★", "☆", "✦", "✧", "✪", "✫", "✬", "✭", "✮", "✯" } },
{ "Shapes", new[] { "●", "○", "■", "▲", "△", "▼", "▽", "◆", "◇" } },
{ "Numbers", new[] { "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩" } },
{ "Cards", new[] { "♠", "♡", "♢", "♣", "♤", "♥", "♦", "♧" } },
{ "Music", new[] { "♩", "♪", "♫", "♬" } },
{ "Math", new[] { "+", "±", "×", "÷", "=", "-" } },
{ "Progress", new[] { "⏱", "⌛" } },
{ "Misc", new[] { "☯", "☮", "⚛", "☢", "☣", "⚕", "⚜" } }

check, there may be more of them.

Text Icons (Symbols)

cooldownUI.SetIcon("⬆", Color.green);   // Arrow up
cooldownUI.SetIcon("⬇", Color.red);
cooldownUI.SetIcon("①", Color.white);   // Circled 1
cooldownUI.SetIcon("☯", Color.white);   // Yin yang

Sprite Icons

// Use custom sprite as icon
cooldownUI.SetIconSprite(mySprite, Color.white);

// Clear sprite icon
cooldownUI.ClearIconSprite();

Icon Configuration

// Position icon on left or right of timer
cooldownUI.SetIconPosition(IconPosition.Left);   // Default
cooldownUI.SetIconPosition(IconPosition.Right);

// Sync icon color with timer (red→green during cooldown)
cooldownUI.SetIconColorSync(true);

// Hide icon when showing "READY"
cooldownUI.SetHideIconOnReady(true);

// Scale icon (0.1 to 3.0)
cooldownUI.SetIconScale(1.5f);

// Clear any icon
cooldownUI.ClearIcon();

Advanced Usage

Custom Colors

// Set custom state colors
cooldownUI.SetColors(
    ready: Color.cyan,      // When cooldown complete
    cooldown: Color.magenta, // During cooldown
    active: Color.yellow    // During active effect
);

// Set outline color
cooldownUI.SetOutlineColor(new Color(0.2f, 0f, 0f, 0.9f));

// Set outline width (0 to 1)
cooldownUI.SetOutlineWidth(0.2f);

Custom Scale

// Create with custom scale (1.5x larger)
var ui = CooldownUI.Create(player.transform, 1.5f);

// Smaller UI
var smallUI = CooldownUI.Create(player.transform, 0.7f);

Full Card Example

using BepInEx;
using UnboundLib.Cards;
using UnityEngine;
using CooldownUILib;

public class MyAbilityCard : CustomCard
{
    public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
    {
        // Card setup
    }

    public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
    {
        var mono = player.gameObject.GetOrAddComponent<MyAbilityMono>();
        mono.Initialize(player);
    }

    // ... other required overrides
}

public class MyAbilityMono : MonoBehaviour
{
    private Player player;
    private CooldownUI cooldownUI;
    
    private float abilityCooldown = 10f;
    private float abilityDuration = 3f;
    private float cooldownTimer = 0f;
    private float activeTimer = 0f;
    private bool isActive = false;

    public void Initialize(Player player)
    {
        this.player = player;
        
        // Create cooldown UI
        cooldownUI = CooldownUI.Create(player.transform);
        cooldownUI.SetIcon("⚡", Color.cyan);
        cooldownUI.SetIconColorSync(true);  // Icon changes color with timer
    }

    void Update()
    {
        if (player == null) return;

        // Active state
        if (isActive)
        {
            activeTimer -= Time.deltaTime;
            cooldownUI.ShowActive(activeTimer);
            
            if (activeTimer <= 0f)
            {
                DeactivateAbility();
            }
            return;
        }

        // Cooldown state
        if (cooldownTimer > 0f)
        {
            cooldownTimer -= Time.deltaTime;
            cooldownUI.ShowCooldown(cooldownTimer, abilityCooldown);
        }
        else
        {
            cooldownUI.ShowReady();
            
            // Check for activation (example: block key)
            if (player.data.block.IsBlocking())
            {
                ActivateAbility();
            }
        }
    }

    void ActivateAbility()
    {
        isActive = true;
        activeTimer = abilityDuration;
        // Apply ability effects...
    }

    void DeactivateAbility()
    {
        isActive = false;
        cooldownTimer = abilityCooldown;
        // Remove ability effects...
    }

    void OnDestroy()
    {
        if (cooldownUI != null)
        {
            Destroy(cooldownUI.gameObject);
        }
    }
}

API Reference

Factory Methods

Method Description
CooldownUI.Create(Transform parent, float scale = 1f) Creates UI attached to target

Display Methods

Method Description
ShowCooldown(float remaining, float total) Shows cooldown (red→green)
ShowActive(float remaining) Shows active time (cyan)
ShowText(string text, Color color) Shows custom text
ShowReady() Shows "READY" in green
ShowStacks(int count, Color? color) Shows stack count (e.g., "x3")
Hide() Hides the UI

Icon Methods (Text)

Method Description
SetIcon(string icon, Color? color) Sets text icon (symbol)
ClearIcon() Removes any icon

Icon Methods (Sprite)

Method Description
SetIconSprite(Sprite sprite, Color? color) Sets sprite icon
ClearIconSprite() Removes sprite icon

Icon Configuration

Method Description
SetIconPosition(IconPosition pos) Left or Right of timer
SetIconColorSync(bool sync) Sync icon color with timer
SetHideIconOnReady(bool hide) Hide icon on READY state
SetIconScale(float scale) Scale icon (0.1 - 3.0)
GetIconType() Returns None, Text, or Sprite
HasIcon() Returns true if icon is set

Customization Methods

Method Description
SetColors(Color ready, Color cooldown, Color active) Sets state colors
SetOutlineColor(Color color) Sets text outline color
SetOutlineWidth(float width) Sets outline width (0-1)
SetShadowColor(Color color) Alias for SetOutlineColor

Static Methods

Method Description
CooldownUI.ClearAllRegistrations() Clears all tracking data
CooldownUI.GetActiveUICount(Transform target) Gets UI count for target

Tips

  1. Always destroy UI in OnDestroy - Prevents memory leaks
  2. Use ClearAllRegistrations on round end - Already handled by the plugin
  3. Multiple UIs auto-stack - No manual positioning needed

Feedback

If you have any feedback, please reach out to me on Telegram.