diff --git a/data/ui/xbox/endGameWindow.png b/data/ui/xbox/endGameWindow.png new file mode 100644 index 00000000..b424d574 Binary files /dev/null and b/data/ui/xbox/endGameWindow.png differ diff --git a/src/gui/EndGameGui.hx b/src/gui/EndGameGui.hx index a97da4ff..60ce1862 100644 --- a/src/gui/EndGameGui.hx +++ b/src/gui/EndGameGui.hx @@ -33,319 +33,381 @@ class EndGameGui extends GuiControl { return [normal, hover, pressed]; } - var pg = new GuiImage(ResourceLoader.getResource("data/ui/endgame/base.png", ResourceLoader.getImage, this.imageResources).toTile()); - pg.horizSizing = Center; - pg.vertSizing = Center; - pg.position = new Vector(28, 20); - pg.extent = new Vector(584, 440); + var scene2d = MarbleGame.canvas.scene2d; - var continueButton = new GuiButton(loadButtonImages("data/ui/endgame/continue")); - continueButton.horizSizing = Right; - continueButton.vertSizing = Bottom; - continueButton.position = new Vector(460, 307); - continueButton.extent = new Vector(104, 54); - continueButton.accelerator = hxd.Key.ENTER; - continueButton.gamepadAccelerator = ["A"]; - continueButton.pressedAction = (e) -> continueFunc(continueButton); + var offsetX = (scene2d.width - 1280) / 2; + var offsetY = (scene2d.height - 720) / 2; - var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay")); - restartButton.horizSizing = Right; - restartButton.vertSizing = Bottom; - restartButton.position = new Vector(460, 363); - restartButton.extent = new Vector(104, 54); - restartButton.gamepadAccelerator = ["B"]; - restartButton.pressedAction = (e) -> restartFunc(restartButton); + var subX = 640 - (scene2d.width - offsetX * 2) * 640 / scene2d.width; + var subY = 480 - (scene2d.height - offsetY * 2) * 480 / scene2d.height; - var nextLevel = new GuiControl(); - nextLevel.position = new Vector(326, 307); - nextLevel.extent = new Vector(130, 110); + var innerCtrl = new GuiControl(); + innerCtrl.position = new Vector(offsetX, offsetY); + innerCtrl.extent = new Vector(640 - subX, 480 - subY); + innerCtrl.horizSizing = Width; + innerCtrl.vertSizing = Height; + this.addChild(innerCtrl); - var temprev = new BitmapData(1, 1); - temprev.setPixel(0, 0, 0); - var tmpprevtile = Tile.fromBitmap(temprev); + var endGameWnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/endGameWindow.png", ResourceLoader.getImage, this.imageResources).toTile()); + endGameWnd.horizSizing = Left; + endGameWnd.vertSizing = Top; + endGameWnd.position = new Vector(80 - offsetX / 2, 170); + endGameWnd.extent = new Vector(336, 150); + innerCtrl.addChild(endGameWnd); - var nextLevelPreview = new GuiImage(tmpprevtile); - nextLevelPreview.position = new Vector(-15, 0); - nextLevelPreview.extent = new Vector(160, 110); - nextLevel.addChild(nextLevelPreview); + var subX = 640 - (scene2d.width - offsetX * 2) * 640 / scene2d.width; + var subY = 480 - (scene2d.height - offsetY * 2) * 480 / scene2d.height; - mission.getNextMission().getPreviewImage(t -> { - nextLevelPreview.bmp.tile = t; - }); - - var nextLevelBtn = new GuiButton(loadButtonImages('data/ui/endgame/level_window')); - nextLevelBtn.horizSizing = Width; - nextLevelBtn.vertSizing = Height; - nextLevelBtn.position = new Vector(0, 0); - nextLevelBtn.extent = new Vector(130, 110); - nextLevelBtn.gamepadAccelerator = ["X"]; - nextLevelBtn.pressedAction = (e) -> nextLevelFunc(nextLevelBtn); - 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 arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt"); var arial14b = new BitmapFont(arial14fontdata.entry); @:privateAccess arial14b.loader = ResourceLoader.loader; - var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel); + var arial14 = arial14b.toSdfFont(cast 22 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel); - var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt"); - var domcasual32b = new BitmapFont(domcasual32fontdata.entry); - @:privateAccess domcasual32b.loader = ResourceLoader.loader; - var domcasual32 = domcasual32b.toSdfFont(cast 28 * Settings.uiScale, MultiChannel); - var domcasual64 = domcasual32b.toSdfFont(cast 58 * Settings.uiScale, MultiChannel); - var domcasual24 = domcasual32b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel); - - var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt"); - var expo50b = new BitmapFont(expo50fontdata.entry); - @:privateAccess expo50b.loader = ResourceLoader.loader; - var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel); - var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel); + var statIcon = new GuiImage(ResourceLoader.getResource("data/ui/xbox/statIcon.png", ResourceLoader.getImage, this.imageResources).toTile()); + statIcon.position = new Vector(38, 27); + statIcon.extent = new Vector(20, 20); + endGameWnd.addChild(statIcon); function mlFontLoader(text:String) { - switch (text) { - case "DomCasual24": - return domcasual24; - case "DomCasual32": - return domcasual32; - case "DomCasual64": - return domcasual64; - case "Arial14": - return arial14; - case "Expo32": - return expo32; - default: - return null; - } + return arial14; } - var egResult = new GuiMLText(domcasual32, mlFontLoader); - egResult.position = new Vector(313, 54); - egResult.extent = new Vector(244, 69); - egResult.text.text = '

${Util.formatTime(timeState.gameplayClock)}

'; - egResult.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); - pg.addChild(egResult); - - var egFirstLine = new GuiMLText(domcasual24, mlFontLoader); - egFirstLine.position = new Vector(340, 150); - egFirstLine.extent = new Vector(210, 25); - egFirstLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFirstLine); - - var egSecondLine = new GuiMLText(domcasual24, mlFontLoader); - egSecondLine.position = new Vector(341, 178); - egSecondLine.extent = new Vector(209, 25); - egSecondLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egSecondLine); - - var egThirdLine = new GuiMLText(domcasual24, mlFontLoader); - egThirdLine.position = new Vector(341, 206); - egThirdLine.extent = new Vector(209, 25); - egThirdLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egThirdLine); - - var egFourthLine = new GuiMLText(domcasual24, mlFontLoader); - egFourthLine.position = new Vector(341, 234); - egFourthLine.extent = new Vector(209, 25); - egFourthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFourthLine); - - var egFifthLine = new GuiMLText(domcasual24, mlFontLoader); - egFifthLine.position = new Vector(341, 262); - egFifthLine.extent = new Vector(209, 25); - egFifthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFifthLine); - - var egFirstLineScore = new GuiMLText(domcasual24, mlFontLoader); - egFirstLineScore.position = new Vector(475, 150); - egFirstLineScore.extent = new Vector(210, 25); - egFirstLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFirstLineScore); - - var egSecondLineScore = new GuiMLText(domcasual24, mlFontLoader); - egSecondLineScore.position = new Vector(476, 178); - egSecondLineScore.extent = new Vector(209, 25); - egSecondLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egSecondLineScore); - - var egThirdLineScore = new GuiMLText(domcasual24, mlFontLoader); - egThirdLineScore.position = new Vector(476, 206); - egThirdLineScore.extent = new Vector(209, 25); - egThirdLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egThirdLineScore); - - var egFourthLineScore = new GuiMLText(domcasual24, mlFontLoader); - egFourthLineScore.position = new Vector(476, 234); - egFourthLineScore.extent = new Vector(209, 25); - egFourthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFourthLineScore); - - var egFifthLineScore = new GuiMLText(domcasual24, mlFontLoader); - egFifthLineScore.position = new Vector(476, 262); - egFifthLineScore.extent = new Vector(209, 25); - egFifthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - pg.addChild(egFifthLineScore); - - var egTitleText = new GuiMLText(expo50, mlFontLoader); - egTitleText.text.textColor = 0xffff00; - egTitleText.text.text = 'Your Time:'; - egTitleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); - egTitleText.position = new Vector(34, 54); - egTitleText.extent = new Vector(247, 69); - pg.addChild(egTitleText); - - var egTopThreeText = new GuiMLText(domcasual32, mlFontLoader); - egTopThreeText.position = new Vector(341, 114); - egTopThreeText.extent = new Vector(209, 34); - egTopThreeText.text.text = 'Top 5 Times:'; // Make toggleable 3-5 - egTopThreeText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); - pg.addChild(egTopThreeText); - - var text = '

'; - // Check for ultimate time TODO - if (mission.ultimateTime > 0 && timeState.gameplayClock < mission.ultimateTime) { - text += 'You beat the Ultimate Time!'; - } else { - if (mission.goldTime > 0 && timeState.gameplayClock < mission.goldTime) { - if (mission.game == "gold" || mission.game.toLowerCase() == "ultra") - text += 'You beat the Gold Time!'; - else - text += 'You beat the Platinum Time!'; - } else { - if (mission.qualifyTime > timeState.gameplayClock) { - text += "You beat the Par Time!"; - } else { - text += 'You didn\'t pass the Par Time!'; - } - } - } - text += '

'; - - var finishMessage = new GuiMLText(expo32, mlFontLoader); - finishMessage.text.textColor = 0x00ff00; - finishMessage.text.text = text; - finishMessage.text.filter = new DropShadow(1, 0.785, 0, 1, 0, 0.4, 1, true); - // finishMessage.justify = Center; - finishMessage.position = new Vector(25, 120); - finishMessage.extent = new Vector(293, 211); - pg.addChild(finishMessage); - - var qualified = mission.qualifyTime > timeState.gameplayClock; + var egResultLeft = new GuiMLText(arial14, mlFontLoader); + egResultLeft.position = new Vector(28, 26); + egResultLeft.extent = new Vector(180, 100); + egResultLeft.text.text = '

Time:
Par Time:
Rating:
My Best Time:

'; + endGameWnd.addChild(egResultLeft); + var c0 = 0xEBEBEB; + var c1 = 0x8DFF8D; + var c2 = 0x88BCEE; + var c3 = 0xFF7575; var scoreData:Array = Settings.getScores(mission.path); - while (scoreData.length < 5) { - scoreData.push({name: "Matan W.", time: 5999.999}); + while (scoreData.length < 1) { + scoreData.push({name: "Nardo Polo", time: 5999.999}); } - egFirstLine.text.text = '

1. ${scoreData[0].name}

'; - egSecondLine.text.text = '

2. ${scoreData[1].name}

'; - egThirdLine.text.text = '

3. ${scoreData[2].name}

'; - egFourthLine.text.text = '

4. ${scoreData[3].name}

'; - egFifthLine.text.text = '

5. ${scoreData[4].name}

'; + var bestScore = scoreData[0]; - var lineelems = [ - egFirstLineScore, - egSecondLineScore, - egThirdLineScore, - egFourthLineScore, - egFifthLineScore - ]; + var egResultRight = new GuiMLText(arial14, mlFontLoader); + egResultRight.position = new Vector(214, 26); + egResultRight.extent = new Vector(180, 100); + egResultRight.text.text = '${Util.formatTime(timeState.gameplayClock)}
${Util.formatTime(mission.qualifyTime)}
0
${Util.formatTime(bestScore.time)}'; + endGameWnd.addChild(egResultRight); - for (i in 0...5) { - if (scoreData[i].time < mission.ultimateTime) { - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } else { - if (scoreData[i].time < mission.goldTime) { - if (mission.game == "gold" || mission.game.toLowerCase() == "ultra") - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - else - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } else { - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } - } - } + // var pg = new GuiImage(ResourceLoader.getResource("data/ui/endgame/base.png", ResourceLoader.getImage, this.imageResources).toTile()); + // pg.horizSizing = Center; + // pg.vertSizing = Center; + // pg.position = new Vector(28, 20); + // pg.extent = new Vector(584, 440); - var leftColumn = new GuiMLText(domcasual24, mlFontLoader); - leftColumn.text.lineSpacing = 5; - leftColumn.text.textColor = 0xFFFFFF; - leftColumn.text.text = 'Par Time:
${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? 'Gold Time:' : 'Platinum Time:'}
${mission.ultimateTime != 0 ? 'Ultimate Time:
' : ''}
Time Passed:
Clock Bonuses:
'; - leftColumn.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); - leftColumn.position = new Vector(25, 165); - leftColumn.extent = new Vector(293, 211); - pg.addChild(leftColumn); + // var continueButton = new GuiButton(loadButtonImages("data/ui/endgame/continue")); + // continueButton.horizSizing = Right; + // continueButton.vertSizing = Bottom; + // continueButton.position = new Vector(460, 307); + // continueButton.extent = new Vector(104, 54); + // continueButton.accelerator = hxd.Key.ENTER; + // continueButton.gamepadAccelerator = ["A"]; + // continueButton.pressedAction = (e) -> continueFunc(continueButton); - var elapsedTime = Math.max(timeState.currentAttemptTime - 3.5, 0); - var bonusTime = Math.max(0, Std.int((elapsedTime - timeState.gameplayClock) * 1000) / 1000); + // var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay")); + // restartButton.horizSizing = Right; + // restartButton.vertSizing = Bottom; + // restartButton.position = new Vector(460, 363); + // restartButton.extent = new Vector(104, 54); + // restartButton.gamepadAccelerator = ["B"]; + // restartButton.pressedAction = (e) -> restartFunc(restartButton); - var rightColumn = new GuiMLText(domcasual24, mlFontLoader); - rightColumn.text.lineSpacing = 5; - rightColumn.text.textColor = 0xFFFFFF; - rightColumn.text.text = '${Util.formatTime(mission.qualifyTime == Math.POSITIVE_INFINITY ? 5999.999 : mission.qualifyTime)}
${Util.formatTime(mission.goldTime)}
${mission.ultimateTime != 0 ? '${Util.formatTime(mission.ultimateTime)}
' : ''}
${Util.formatTime(elapsedTime)}
${Util.formatTime(bonusTime)}
'; - rightColumn.text.filter = new DropShadow(1.414, 0.785, 0xffffff, 1, 0, 0.4, 1, true); - rightColumn.position = new Vector(235, 165); - rightColumn.extent = new Vector(293, 211); - pg.addChild(rightColumn); + // var nextLevel = new GuiControl(); + // nextLevel.position = new Vector(326, 307); + // nextLevel.extent = new Vector(130, 110); - pg.addChild(continueButton); - pg.addChild(restartButton); - pg.addChild(nextLevel); - pg.addChild(egFirstLine); - pg.addChild(egSecondLine); - pg.addChild(egThirdLine); - pg.addChild(egFourthLine); - pg.addChild(egFifthLine); + // var temprev = new BitmapData(1, 1); + // temprev.setPixel(0, 0, 0); + // var tmpprevtile = Tile.fromBitmap(temprev); - this.addChild(pg); + // var nextLevelPreview = new GuiImage(tmpprevtile); + // nextLevelPreview.position = new Vector(-15, 0); + // nextLevelPreview.extent = new Vector(160, 110); + // nextLevel.addChild(nextLevelPreview); - var scoreTimes = scoreData.map(x -> x.time).concat([timeState.gameplayClock]); - scoreTimes.sort((a, b) -> a == b ? 0 : (a > b ? 1 : -1)); + // mission.getNextMission().getPreviewImage(t -> { + // nextLevelPreview.bmp.tile = t; + // }); - var idx = scoreTimes.indexOf(timeState.gameplayClock); + // var nextLevelBtn = new GuiButton(loadButtonImages('data/ui/endgame/level_window')); + // nextLevelBtn.horizSizing = Width; + // nextLevelBtn.vertSizing = Height; + // nextLevelBtn.position = new Vector(0, 0); + // nextLevelBtn.extent = new Vector(130, 110); + // nextLevelBtn.gamepadAccelerator = ["X"]; + // nextLevelBtn.pressedAction = (e) -> nextLevelFunc(nextLevelBtn); + // nextLevel.addChild(nextLevelBtn); - // if (Settings.progression[mission.difficultyIndex] == mission.index && qualified) { - // Settings.progression[mission.difficultyIndex]++; + // function setButtonStates(enabled:Bool) { + // nextLevelBtn.disabled = !enabled; + // continueButton.disabled = !enabled; + // restartButton.disabled = !enabled; // } - Settings.save(); - if (idx <= 4) { - setButtonStates(false); - var end = new EnterNameDlg(idx, (name) -> { - setButtonStates(true); - if (scoreSubmitted) - return; + // var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt"); + // var arial14b = new BitmapFont(arial14fontdata.entry); + // @:privateAccess arial14b.loader = ResourceLoader.loader; + // var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel); - var myScore = {name: name, time: timeState.gameplayClock}; - scoreData.push(myScore); - scoreData.sort((a, b) -> a.time == b.time ? 0 : (a.time > b.time ? 1 : -1)); + // var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt"); + // var domcasual32b = new BitmapFont(domcasual32fontdata.entry); + // @:privateAccess domcasual32b.loader = ResourceLoader.loader; + // var domcasual32 = domcasual32b.toSdfFont(cast 28 * Settings.uiScale, MultiChannel); + // var domcasual64 = domcasual32b.toSdfFont(cast 58 * Settings.uiScale, MultiChannel); + // var domcasual24 = domcasual32b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel); - egFirstLine.text.text = '

1. ${scoreData[0].name}

'; - egSecondLine.text.text = '

2. ${scoreData[1].name}

'; - egThirdLine.text.text = '

3. ${scoreData[2].name}

'; - egFourthLine.text.text = '

4. ${scoreData[3].name}

'; - egFifthLine.text.text = '

5. ${scoreData[4].name}

'; + // var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt"); + // var expo50b = new BitmapFont(expo50fontdata.entry); + // @:privateAccess expo50b.loader = ResourceLoader.loader; + // var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel); + // var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel); - for (i in 0...5) { - if (scoreData[i].time < mission.ultimateTime) { - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } else { - if (scoreData[i].time < mission.goldTime) { - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } else { - lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; - } - } - } + // function mlFontLoader(text:String) { + // switch (text) { + // case "DomCasual24": + // return domcasual24; + // case "DomCasual32": + // return domcasual32; + // case "DomCasual64": + // return domcasual64; + // case "Arial14": + // return arial14; + // case "Expo32": + // return expo32; + // default: + // return null; + // } + // } - Settings.saveScore(mission.path, myScore); + // var egResult = new GuiMLText(domcasual32, mlFontLoader); + // egResult.position = new Vector(313, 54); + // egResult.extent = new Vector(244, 69); + // egResult.text.text = '

${Util.formatTime(timeState.gameplayClock)}

'; + // egResult.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); + // pg.addChild(egResult); - scoreSubmitted = true; - }); - this.addChild(end); - } + // var egFirstLine = new GuiMLText(domcasual24, mlFontLoader); + // egFirstLine.position = new Vector(340, 150); + // egFirstLine.extent = new Vector(210, 25); + // egFirstLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFirstLine); + + // var egSecondLine = new GuiMLText(domcasual24, mlFontLoader); + // egSecondLine.position = new Vector(341, 178); + // egSecondLine.extent = new Vector(209, 25); + // egSecondLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egSecondLine); + + // var egThirdLine = new GuiMLText(domcasual24, mlFontLoader); + // egThirdLine.position = new Vector(341, 206); + // egThirdLine.extent = new Vector(209, 25); + // egThirdLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egThirdLine); + + // var egFourthLine = new GuiMLText(domcasual24, mlFontLoader); + // egFourthLine.position = new Vector(341, 234); + // egFourthLine.extent = new Vector(209, 25); + // egFourthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFourthLine); + + // var egFifthLine = new GuiMLText(domcasual24, mlFontLoader); + // egFifthLine.position = new Vector(341, 262); + // egFifthLine.extent = new Vector(209, 25); + // egFifthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFifthLine); + + // var egFirstLineScore = new GuiMLText(domcasual24, mlFontLoader); + // egFirstLineScore.position = new Vector(475, 150); + // egFirstLineScore.extent = new Vector(210, 25); + // egFirstLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFirstLineScore); + + // var egSecondLineScore = new GuiMLText(domcasual24, mlFontLoader); + // egSecondLineScore.position = new Vector(476, 178); + // egSecondLineScore.extent = new Vector(209, 25); + // egSecondLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egSecondLineScore); + + // var egThirdLineScore = new GuiMLText(domcasual24, mlFontLoader); + // egThirdLineScore.position = new Vector(476, 206); + // egThirdLineScore.extent = new Vector(209, 25); + // egThirdLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egThirdLineScore); + + // var egFourthLineScore = new GuiMLText(domcasual24, mlFontLoader); + // egFourthLineScore.position = new Vector(476, 234); + // egFourthLineScore.extent = new Vector(209, 25); + // egFourthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFourthLineScore); + + // var egFifthLineScore = new GuiMLText(domcasual24, mlFontLoader); + // egFifthLineScore.position = new Vector(476, 262); + // egFifthLineScore.extent = new Vector(209, 25); + // egFifthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // pg.addChild(egFifthLineScore); + + // var egTitleText = new GuiMLText(expo50, mlFontLoader); + // egTitleText.text.textColor = 0xffff00; + // egTitleText.text.text = 'Your Time:'; + // egTitleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); + // egTitleText.position = new Vector(34, 54); + // egTitleText.extent = new Vector(247, 69); + // pg.addChild(egTitleText); + + // var egTopThreeText = new GuiMLText(domcasual32, mlFontLoader); + // egTopThreeText.position = new Vector(341, 114); + // egTopThreeText.extent = new Vector(209, 34); + // egTopThreeText.text.text = 'Top 5 Times:'; // Make toggleable 3-5 + // egTopThreeText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); + // pg.addChild(egTopThreeText); + + // var text = '

'; + // // Check for ultimate time TODO + // if (mission.ultimateTime > 0 && timeState.gameplayClock < mission.ultimateTime) { + // text += 'You beat the Ultimate Time!'; + // } else { + // if (mission.goldTime > 0 && timeState.gameplayClock < mission.goldTime) { + // if (mission.game == "gold" || mission.game.toLowerCase() == "ultra") + // text += 'You beat the Gold Time!'; + // else + // text += 'You beat the Platinum Time!'; + // } else { + // if (mission.qualifyTime > timeState.gameplayClock) { + // text += "You beat the Par Time!"; + // } else { + // text += 'You didn\'t pass the Par Time!'; + // } + // } + // } + // text += '

'; + + // var finishMessage = new GuiMLText(expo32, mlFontLoader); + // finishMessage.text.textColor = 0x00ff00; + // finishMessage.text.text = text; + // finishMessage.text.filter = new DropShadow(1, 0.785, 0, 1, 0, 0.4, 1, true); + // // finishMessage.justify = Center; + // finishMessage.position = new Vector(25, 120); + // finishMessage.extent = new Vector(293, 211); + // pg.addChild(finishMessage); + + // var qualified = mission.qualifyTime > timeState.gameplayClock; + + // var scoreData:Array = Settings.getScores(mission.path); + // while (scoreData.length < 5) { + // scoreData.push({name: "Matan W.", time: 5999.999}); + // } + + // egFirstLine.text.text = '

1. ${scoreData[0].name}

'; + // egSecondLine.text.text = '

2. ${scoreData[1].name}

'; + // egThirdLine.text.text = '

3. ${scoreData[2].name}

'; + // egFourthLine.text.text = '

4. ${scoreData[3].name}

'; + // egFifthLine.text.text = '

5. ${scoreData[4].name}

'; + + // var lineelems = [ + // egFirstLineScore, + // egSecondLineScore, + // egThirdLineScore, + // egFourthLineScore, + // egFifthLineScore + // ]; + + // for (i in 0...5) { + // if (scoreData[i].time < mission.ultimateTime) { + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } else { + // if (scoreData[i].time < mission.goldTime) { + // if (mission.game == "gold" || mission.game.toLowerCase() == "ultra") + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // else + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } else { + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } + // } + // } + + // var leftColumn = new GuiMLText(domcasual24, mlFontLoader); + // leftColumn.text.lineSpacing = 5; + // leftColumn.text.textColor = 0xFFFFFF; + // leftColumn.text.text = 'Par Time:
${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? 'Gold Time:' : 'Platinum Time:'}
${mission.ultimateTime != 0 ? 'Ultimate Time:
' : ''}
Time Passed:
Clock Bonuses:
'; + // leftColumn.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); + // leftColumn.position = new Vector(25, 165); + // leftColumn.extent = new Vector(293, 211); + // pg.addChild(leftColumn); + + // var elapsedTime = Math.max(timeState.currentAttemptTime - 3.5, 0); + // var bonusTime = Math.max(0, Std.int((elapsedTime - timeState.gameplayClock) * 1000) / 1000); + + // var rightColumn = new GuiMLText(domcasual24, mlFontLoader); + // rightColumn.text.lineSpacing = 5; + // rightColumn.text.textColor = 0xFFFFFF; + // rightColumn.text.text = '${Util.formatTime(mission.qualifyTime == Math.POSITIVE_INFINITY ? 5999.999 : mission.qualifyTime)}
${Util.formatTime(mission.goldTime)}
${mission.ultimateTime != 0 ? '${Util.formatTime(mission.ultimateTime)}
' : ''}
${Util.formatTime(elapsedTime)}
${Util.formatTime(bonusTime)}
'; + // rightColumn.text.filter = new DropShadow(1.414, 0.785, 0xffffff, 1, 0, 0.4, 1, true); + // rightColumn.position = new Vector(235, 165); + // rightColumn.extent = new Vector(293, 211); + // pg.addChild(rightColumn); + + // pg.addChild(continueButton); + // pg.addChild(restartButton); + // pg.addChild(nextLevel); + // pg.addChild(egFirstLine); + // pg.addChild(egSecondLine); + // pg.addChild(egThirdLine); + // pg.addChild(egFourthLine); + // pg.addChild(egFifthLine); + + // this.addChild(pg); + + // var scoreTimes = scoreData.map(x -> x.time).concat([timeState.gameplayClock]); + // scoreTimes.sort((a, b) -> a == b ? 0 : (a > b ? 1 : -1)); + + // var idx = scoreTimes.indexOf(timeState.gameplayClock); + + // // if (Settings.progression[mission.difficultyIndex] == mission.index && qualified) { + // // Settings.progression[mission.difficultyIndex]++; + // // } + // Settings.save(); + + // if (idx <= 4) { + // setButtonStates(false); + // var end = new EnterNameDlg(idx, (name) -> { + // setButtonStates(true); + // if (scoreSubmitted) + // return; + + // var myScore = {name: name, time: timeState.gameplayClock}; + // scoreData.push(myScore); + // scoreData.sort((a, b) -> a.time == b.time ? 0 : (a.time > b.time ? 1 : -1)); + + // egFirstLine.text.text = '

1. ${scoreData[0].name}

'; + // egSecondLine.text.text = '

2. ${scoreData[1].name}

'; + // egThirdLine.text.text = '

3. ${scoreData[2].name}

'; + // egFourthLine.text.text = '

4. ${scoreData[3].name}

'; + // egFifthLine.text.text = '

5. ${scoreData[4].name}

'; + + // for (i in 0...5) { + // if (scoreData[i].time < mission.ultimateTime) { + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } else { + // if (scoreData[i].time < mission.goldTime) { + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } else { + // lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; + // } + // } + // } + + // Settings.saveScore(mission.path, myScore); + + // scoreSubmitted = true; + // }); + // this.addChild(end); + // } } } diff --git a/src/gui/ExitGameDlg.hx b/src/gui/ExitGameDlg.hx index 6adb94f1..0e703071 100644 --- a/src/gui/ExitGameDlg.hx +++ b/src/gui/ExitGameDlg.hx @@ -65,7 +65,7 @@ class ExitGameDlg extends GuiImage { innerCtrl.addChild(levelTitle); var btnList = new GuiXboxList(); - btnList.position = new Vector(70, 95); + btnList.position = new Vector(70 - offsetX / 2, 95); btnList.horizSizing = Left; btnList.extent = new Vector(502, 500); innerCtrl.addChild(btnList); diff --git a/src/gui/GuiXboxListButton.hx b/src/gui/GuiXboxListButton.hx index 56d260e5..cc0db78a 100644 --- a/src/gui/GuiXboxListButton.hx +++ b/src/gui/GuiXboxListButton.hx @@ -114,6 +114,8 @@ class GuiXboxListButton extends GuiControl { } public override function onMouseRelease(mouseState:MouseState) { + if (mouseState.handled) + return; mouseState.handled = true; super.onMouseRelease(mouseState); if (this.pressedAction != null && !disabled) { @@ -122,6 +124,8 @@ class GuiXboxListButton extends GuiControl { } public override function onMouseEnter(mouseState:MouseState) { + if (mouseState.handled) + return; mouseState.handled = true; super.onMouseEnter(mouseState);