Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Timer System WIP #1045

Open
wants to merge 46 commits into
base: develop
Choose a base branch
from
Open

Conversation

CG-Tespy
Copy link
Collaborator

Description

This adds an easy-to-use Timer system to Fungus

Why would Fungus need this?

It's pretty common to set time limits in games or check how long things took. It's even more common to track the player's playtime, yet as all official releases of Fungus (at the time of this writing) lack that, that forces devs to look to other things to implement those features.

With this, we save devs the trouble. Plus, the new save system really needs this one; it has to be able to show playtime in the UI, after all. Heck, that's the reason I even went through all this effort xD

Important Notes

Other information

While I think the system is production-ready as-is, I would very much like to get feedback on it before it gets approved for an official release.

Updating develop branch on my end
…it in nested namespace

It's a whole system, so I figured it'd be good to put it in a namespace specifically for said system
Since they'll all need to fetch the tracker and have the same button color, I felt it best to create a superclass that handles all that for each Playtime Command that we expect users to mess with.
It's pretty much a POCO version of the old PlaytimeTracker but repurposed to be more... well, general-purpose.
…ists function public

Also had the fungus manager make sure there is a TimerManager with it at all times
Also added missing Continue calls to the non-abstract Timer Commands
So that the user can show them in the UI and such
When their time recorded gets into the negatives
This way, Start can also resume timers
…ahead

Also did a small update to the CountupTimers scene so that seeing milliseconds pass doesn't cause any text-shaking
StartDate isn't needed to keep either timer type ticking, and given how the tick process works, there's no need to have the dates stay intact after deserialization
…t tests

A few bugfixes to other glitches made these tests fail despite the FungusExample scenes showing things working just fine.

Turns out I just had to correct a rounding error and make sure the timer doesn't get restarted at the wrong time
No longer need to use it as reference for the Timer System
- New Commands
  - ForceTimerCountdownEnd
  - TimerStatToString
- New EventHandlers
  - TimerCountdownEnd
- Enum values being capitalized
- All inputs for timer IDs requiring IntegerVariables
- TimerStopped event not executing when a countdown timer stops itself anymore
- Renamed TimerState enum to TimeMeasurement to avoid confusion with TimerStat
- For better encapsulation, TimerManager's public Timers property returns a copy of the timers it keeps track of
  - Had to refactor several unit tests that assumed that everything in said Timers property DIDN'T return copies
- Changes to demo scenes to show off new features
@CG-Tespy
Copy link
Collaborator Author

I think things are looking pretty good now ^^ Thoughts, @chrisgregan and @stevehalliwell ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant