Skip to content

Commit

Permalink
fix endgame
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomityGuy committed Dec 17, 2022
1 parent ba1fd21 commit ec6e778
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/EndGameGui.hx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ class EndGameGui extends GuiControl {
};
nextLevel.addChild(nextLevelBtn);

function setButtonStates(enabled:Bool) {
nextLevelBtn.disabled = !enabled;
continueButton.disabled = !enabled;
restartButton.disabled = !enabled;
}

var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
var arial14b = new BitmapFont(arial14fontdata.entry);
@:privateAccess arial14b.loader = ResourceLoader.loader;
Expand Down Expand Up @@ -309,7 +315,9 @@ class EndGameGui extends GuiControl {
Settings.save();

if (idx <= 4) {
setButtonStates(false);
var end = new EnterNameDlg(idx, (name) -> {
setButtonStates(true);
if (scoreSubmitted)
return;

Expand Down
5 changes: 5 additions & 0 deletions src/gui/EnterNameDlg.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gui;

import h2d.Tile;
import hxd.BitmapData;
import h2d.filter.DropShadow;
import src.Settings;
import hxd.res.BitmapFont;
Expand Down Expand Up @@ -57,6 +59,9 @@ class EnterNameDlg extends GuiControl {
enterNameEdit.position = new Vector(28, 130);
enterNameEdit.extent = new Vector(363, 38);
enterNameEdit.text.text = Settings.highscoreName;
haxe.Timer.delay(() -> {
enterNameEdit.text.focus();
}, 5);

var okbutton = new GuiButton(loadButtonImages("data/ui/endgame/ok"));
okbutton.position = new Vector(151, 184);
Expand Down

0 comments on commit ec6e778

Please sign in to comment.