Rust.Community icon indicating copy to clipboard operation
Rust.Community copied to clipboard

Countdown improvements

Open Kulltero opened this issue 2 years ago • 0 comments

Improving the Countdown Component

Changed the countdown component to be useful for any counting/timer operation by supporting float parameters fully ensuring backwards compatibility (as JSON auto converts ints to float) added optional interval component to seperately control update rate from step amount added optional destroyIfDone parameter (defaults to true to maintain old behaviour), allows keeping the timer text arround after its finished counting added timerFormat enum that formats the number into a variety of timer presets added numberFormat option to be passed into the ToString() function

https://github.com/Facepunch/Rust.Community/assets/33698270/f8bb378f-cfff-4865-971b-c92e0fa28691

public enum TimerFormat {
   None, // Default => applies numberFormat to the number directly
   SecondsHundreth, // 30.653 => "30.65"
   MinutesSeconds, // 97.324 => "01:37"
   MinutesSecondsHundreth, // 97.324 => "01:37.32"
   HoursMinutes, // 3845.45 => "01:04"
   HoursMinutesSeconds // 3845.45 => "01:04:05"
}

Kulltero avatar May 17 '23 02:05 Kulltero