Facepunch / Rust.Community

Community Entity to fill Server Side modder requests
MIT License
46 stars 21 forks source link

Countdown improvements #56

Closed Kulltero closed 4 months ago

Kulltero commented 1 year ago

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"
}
DezLife commented 4 months ago

@ElChupos