
CooldownUI
A universal UI library for displaying cooldowns, timers, and status indicators above players. Easy to integrate into your ROUNDS mods.Details
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 - Add icons/symbols 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 4-corner shadow rendering
Installation
- Install via Thunderstore Mod Manager (recommended)
- Or manually: Download and extract to
BepInEx/plugins/
Usage
Add as Dependency
In your mod's manifest.json:
{
"dependencies": [
"BellusFennec-CooldownUI-1.0.0"
]
}
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);
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 shadow color
cooldownUI.SetShadowColor(new Color(0.2f, 0f, 0f, 0.9f));
Icons
// Set icon with color
cooldownUI.SetIcon("🛡", Color.blue);
cooldownUI.SetIcon("★", new Color(1f, 0.8f, 0f));
// Clear icon
cooldownUI.ClearIcon();
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);
}
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 |
Customization Methods
| Method | Description |
|---|---|
SetIcon(string icon, Color? color) |
Sets icon character |
ClearIcon() |
Removes icon |
SetColors(Color ready, Color cooldown, Color active) |
Sets state colors |
SetShadowColor(Color color) |
Sets shadow color |
Static Methods
| Method | Description |
|---|---|
CooldownUI.ClearAllRegistrations() |
Clears all tracking data |
CooldownUI.GetActiveUICount(Transform target) |
Gets UI count for target |
Tips
- Always destroy UI in OnDestroy - Prevents memory leaks
- Use ClearAllRegistrations on round end - Already handled by the plugin
- Multiple UIs auto-stack - No manual positioning needed
- Icons support Unicode - Use emoji or special characters
Changelog
1.0.0
- Initial release
- Cooldown, active, and custom text display
- Icon support
- Auto-stacking for multiple timers
- Scale compensation
Credits
Created by BellusFennec for the ROUNDS modding community.
License
MIT License - Feel free to use in your mods!
Feedback
If you have any feedback, please reach out to me on Telegram.