Skip to content

Commit

Permalink
refactor: use RegisterHUDPanelForGamemode in defrag powerup panel
Browse files Browse the repository at this point in the history
  • Loading branch information
tsa96 authored and PeenScreeker committed Apr 17, 2024
1 parent b710678 commit b59d86c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layout/hud/powerup-timer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</styles>
<scripts>
<include src="file://{scripts}/common/gamemodes.js" />
<include src="file://{scripts}/util/register-event-for-gamemodes.js" />
<include src="file://{scripts}/util/register-for-gamemodes.js" />
<include src="file://{scripts}/hud/powerup-timer.js" />
</scripts>

Expand Down
7 changes: 6 additions & 1 deletion scripts/hud/powerup-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class PowerupTimer {
}

static {
RegisterEventForGamemodes([GameMode.DEFRAG], 'HudProcessInput', $.GetContextPanel(), this.onUpdate.bind(this));
RegisterHUDPanelForGamemode({
gamemodes: [GameMode.DEFRAG],
context: this,
contextPanel: $.GetContextPanel(),
handledEvents: [{ event: 'HudProcessInput', contextPanel: $.GetContextPanel(), callback: this.onUpdate }]
});
}
}

0 comments on commit b59d86c

Please sign in to comment.