start endgame

This commit is contained in:
RandomityGuy 2023-06-22 01:52:59 +05:30
parent cb16d629c0
commit bd940b0f8c
4 changed files with 347 additions and 281 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -33,319 +33,381 @@ class EndGameGui extends GuiControl {
return [normal, hover, pressed]; return [normal, hover, pressed];
} }
var pg = new GuiImage(ResourceLoader.getResource("data/ui/endgame/base.png", ResourceLoader.getImage, this.imageResources).toTile()); var scene2d = MarbleGame.canvas.scene2d;
pg.horizSizing = Center;
pg.vertSizing = Center;
pg.position = new Vector(28, 20);
pg.extent = new Vector(584, 440);
var continueButton = new GuiButton(loadButtonImages("data/ui/endgame/continue")); var offsetX = (scene2d.width - 1280) / 2;
continueButton.horizSizing = Right; var offsetY = (scene2d.height - 720) / 2;
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 restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay")); var subX = 640 - (scene2d.width - offsetX * 2) * 640 / scene2d.width;
restartButton.horizSizing = Right; var subY = 480 - (scene2d.height - offsetY * 2) * 480 / scene2d.height;
restartButton.vertSizing = Bottom;
restartButton.position = new Vector(460, 363);
restartButton.extent = new Vector(104, 54);
restartButton.gamepadAccelerator = ["B"];
restartButton.pressedAction = (e) -> restartFunc(restartButton);
var nextLevel = new GuiControl(); var innerCtrl = new GuiControl();
nextLevel.position = new Vector(326, 307); innerCtrl.position = new Vector(offsetX, offsetY);
nextLevel.extent = new Vector(130, 110); innerCtrl.extent = new Vector(640 - subX, 480 - subY);
innerCtrl.horizSizing = Width;
innerCtrl.vertSizing = Height;
this.addChild(innerCtrl);
var temprev = new BitmapData(1, 1); var endGameWnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/endGameWindow.png", ResourceLoader.getImage, this.imageResources).toTile());
temprev.setPixel(0, 0, 0); endGameWnd.horizSizing = Left;
var tmpprevtile = Tile.fromBitmap(temprev); 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); var subX = 640 - (scene2d.width - offsetX * 2) * 640 / scene2d.width;
nextLevelPreview.position = new Vector(-15, 0); var subY = 480 - (scene2d.height - offsetY * 2) * 480 / scene2d.height;
nextLevelPreview.extent = new Vector(160, 110);
nextLevel.addChild(nextLevelPreview);
mission.getNextMission().getPreviewImage(t -> { var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
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 arial14b = new BitmapFont(arial14fontdata.entry); var arial14b = new BitmapFont(arial14fontdata.entry);
@:privateAccess arial14b.loader = ResourceLoader.loader; @: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 statIcon = new GuiImage(ResourceLoader.getResource("data/ui/xbox/statIcon.png", ResourceLoader.getImage, this.imageResources).toTile());
var domcasual32b = new BitmapFont(domcasual32fontdata.entry); statIcon.position = new Vector(38, 27);
@:privateAccess domcasual32b.loader = ResourceLoader.loader; statIcon.extent = new Vector(20, 20);
var domcasual32 = domcasual32b.toSdfFont(cast 28 * Settings.uiScale, MultiChannel); endGameWnd.addChild(statIcon);
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);
function mlFontLoader(text:String) { function mlFontLoader(text:String) {
switch (text) { return arial14;
case "DomCasual24":
return domcasual24;
case "DomCasual32":
return domcasual32;
case "DomCasual64":
return domcasual64;
case "Arial14":
return arial14;
case "Expo32":
return expo32;
default:
return null;
}
} }
var egResult = new GuiMLText(domcasual32, mlFontLoader); var egResultLeft = new GuiMLText(arial14, mlFontLoader);
egResult.position = new Vector(313, 54); egResultLeft.position = new Vector(28, 26);
egResult.extent = new Vector(244, 69); egResultLeft.extent = new Vector(180, 100);
egResult.text.text = '<font face="DomCasual64" color="#FFFFFF"><p align="right">${Util.formatTime(timeState.gameplayClock)}</p></font>'; egResultLeft.text.text = '<p align="right"><font color="#8DFF8D">Time:</font><br/><font color="#88BCEE">Par Time:</font><br/><font color="#EBEBEB">Rating:</font><br/><font color="#EBEBEB">My Best Time:</font></p>';
egResult.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true); endGameWnd.addChild(egResultLeft);
pg.addChild(egResult); var c0 = 0xEBEBEB;
var c1 = 0x8DFF8D;
var egFirstLine = new GuiMLText(domcasual24, mlFontLoader); var c2 = 0x88BCEE;
egFirstLine.position = new Vector(340, 150); var c3 = 0xFF7575;
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 = '<font color="#FFFFFF" face="DomCasual64">Your Time:</font>';
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 = '<font face="DomCasual32" color="#FFFFFF">Top 5 Times:</font>'; // 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 = '<font color="#FFFFFF" face="DomCasual32"><p align="center">';
// Check for ultimate time TODO
if (mission.ultimateTime > 0 && timeState.gameplayClock < mission.ultimateTime) {
text += 'You beat the <font color="#FFDD22">Ultimate</font> Time!';
} else {
if (mission.goldTime > 0 && timeState.gameplayClock < mission.goldTime) {
if (mission.game == "gold" || mission.game.toLowerCase() == "ultra")
text += 'You beat the <font color="#FFCC00">Gold</font> Time!';
else
text += 'You beat the <font color="#CCCCCC">Platinum</font> Time!';
} else {
if (mission.qualifyTime > timeState.gameplayClock) {
text += "You beat the Par Time!";
} else {
text += '<font color="#F55555">You didn\'t pass the Par Time!</font>';
}
}
}
text += '</p></font>';
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<Score> = Settings.getScores(mission.path); var scoreData:Array<Score> = Settings.getScores(mission.path);
while (scoreData.length < 5) { while (scoreData.length < 1) {
scoreData.push({name: "Matan W.", time: 5999.999}); scoreData.push({name: "Nardo Polo", time: 5999.999});
} }
egFirstLine.text.text = '<p align="left"><font color="#EEC884">1. </font>${scoreData[0].name}</p>'; var bestScore = scoreData[0];
egSecondLine.text.text = '<p align="left"><font color="#CDCDCD">2. </font>${scoreData[1].name}</p>';
egThirdLine.text.text = '<p align="left"><font color="#C9AFA0">3. </font>${scoreData[2].name}</p>';
egFourthLine.text.text = '<p align="left"><font color="#A4A4A4">4. </font>${scoreData[3].name}</p>';
egFifthLine.text.text = '<p align="left"><font color="#949494">5. </font>${scoreData[4].name}</p>';
var lineelems = [ var egResultRight = new GuiMLText(arial14, mlFontLoader);
egFirstLineScore, egResultRight.position = new Vector(214, 26);
egSecondLineScore, egResultRight.extent = new Vector(180, 100);
egThirdLineScore, egResultRight.text.text = '<font color="#8DFF8D">${Util.formatTime(timeState.gameplayClock)}</font><br/><font color="#88BCEE">${Util.formatTime(mission.qualifyTime)}</font><br/><font color="#EBEBEB">0</font><br/><font color="#EBEBEB">${Util.formatTime(bestScore.time)}</font>';
egFourthLineScore, endGameWnd.addChild(egResultRight);
egFifthLineScore
];
for (i in 0...5) { // var pg = new GuiImage(ResourceLoader.getResource("data/ui/endgame/base.png", ResourceLoader.getImage, this.imageResources).toTile());
if (scoreData[i].time < mission.ultimateTime) { // pg.horizSizing = Center;
lineelems[i].text.text = '<font color="#FFDD22">${Util.formatTime(scoreData[i].time)}</font>'; // pg.vertSizing = Center;
} else { // pg.position = new Vector(28, 20);
if (scoreData[i].time < mission.goldTime) { // pg.extent = new Vector(584, 440);
if (mission.game == "gold" || mission.game.toLowerCase() == "ultra")
lineelems[i].text.text = '<font color="#FFCC00">${Util.formatTime(scoreData[i].time)}</font>';
else
lineelems[i].text.text = '<font color="#CCCCCC">${Util.formatTime(scoreData[i].time)}</font>';
} else {
lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}';
}
}
}
var leftColumn = new GuiMLText(domcasual24, mlFontLoader); // var continueButton = new GuiButton(loadButtonImages("data/ui/endgame/continue"));
leftColumn.text.lineSpacing = 5; // continueButton.horizSizing = Right;
leftColumn.text.textColor = 0xFFFFFF; // continueButton.vertSizing = Bottom;
leftColumn.text.text = 'Par Time:<br/>${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '<font color="#FFCC00">Gold Time:</font>' : '<font color="#CCCCCC">Platinum Time:</font>'}<br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">Ultimate Time:</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">Time Passed:<br/>Clock Bonuses:</font>'; // continueButton.position = new Vector(460, 307);
leftColumn.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true); // continueButton.extent = new Vector(104, 54);
leftColumn.position = new Vector(25, 165); // continueButton.accelerator = hxd.Key.ENTER;
leftColumn.extent = new Vector(293, 211); // continueButton.gamepadAccelerator = ["A"];
pg.addChild(leftColumn); // continueButton.pressedAction = (e) -> continueFunc(continueButton);
var elapsedTime = Math.max(timeState.currentAttemptTime - 3.5, 0); // var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay"));
var bonusTime = Math.max(0, Std.int((elapsedTime - timeState.gameplayClock) * 1000) / 1000); // 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); // var nextLevel = new GuiControl();
rightColumn.text.lineSpacing = 5; // nextLevel.position = new Vector(326, 307);
rightColumn.text.textColor = 0xFFFFFF; // nextLevel.extent = new Vector(130, 110);
rightColumn.text.text = '${Util.formatTime(mission.qualifyTime == Math.POSITIVE_INFINITY ? 5999.999 : mission.qualifyTime)}<br/><font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(mission.goldTime)}</font><br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">${Util.formatTime(mission.ultimateTime)}</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">${Util.formatTime(elapsedTime)}<br/>${Util.formatTime(bonusTime)}</font>';
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); // var temprev = new BitmapData(1, 1);
pg.addChild(restartButton); // temprev.setPixel(0, 0, 0);
pg.addChild(nextLevel); // var tmpprevtile = Tile.fromBitmap(temprev);
pg.addChild(egFirstLine);
pg.addChild(egSecondLine);
pg.addChild(egThirdLine);
pg.addChild(egFourthLine);
pg.addChild(egFifthLine);
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]); // mission.getNextMission().getPreviewImage(t -> {
scoreTimes.sort((a, b) -> a == b ? 0 : (a > b ? 1 : -1)); // 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) { // function setButtonStates(enabled:Bool) {
// Settings.progression[mission.difficultyIndex]++; // nextLevelBtn.disabled = !enabled;
// continueButton.disabled = !enabled;
// restartButton.disabled = !enabled;
// } // }
Settings.save();
if (idx <= 4) { // var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
setButtonStates(false); // var arial14b = new BitmapFont(arial14fontdata.entry);
var end = new EnterNameDlg(idx, (name) -> { // @:privateAccess arial14b.loader = ResourceLoader.loader;
setButtonStates(true); // var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
if (scoreSubmitted)
return;
var myScore = {name: name, time: timeState.gameplayClock}; // var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
scoreData.push(myScore); // var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
scoreData.sort((a, b) -> a.time == b.time ? 0 : (a.time > b.time ? 1 : -1)); // @: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 = '<p align="left"><font color="#EEC884">1. </font>${scoreData[0].name}</p>'; // var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt");
egSecondLine.text.text = '<p align="left"><font color="#CDCDCD">2. </font>${scoreData[1].name}</p>'; // var expo50b = new BitmapFont(expo50fontdata.entry);
egThirdLine.text.text = '<p align="left"><font color="#C9AFA0">3. </font>${scoreData[2].name}</p>'; // @:privateAccess expo50b.loader = ResourceLoader.loader;
egFourthLine.text.text = '<p align="left"><font color="#A4A4A4">4. </font>${scoreData[3].name}</p>'; // var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel);
egFifthLine.text.text = '<p align="left"><font color="#949494">5. </font>${scoreData[4].name}</p>'; // var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel);
for (i in 0...5) { // function mlFontLoader(text:String) {
if (scoreData[i].time < mission.ultimateTime) { // switch (text) {
lineelems[i].text.text = '<font color="#FFDD22">${Util.formatTime(scoreData[i].time)}</font>'; // case "DomCasual24":
} else { // return domcasual24;
if (scoreData[i].time < mission.goldTime) { // case "DomCasual32":
lineelems[i].text.text = '<font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(scoreData[i].time)}</font>'; // return domcasual32;
} else { // case "DomCasual64":
lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}'; // 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 = '<font face="DomCasual64" color="#FFFFFF"><p align="right">${Util.formatTime(timeState.gameplayClock)}</p></font>';
// egResult.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
// pg.addChild(egResult);
scoreSubmitted = true; // var egFirstLine = new GuiMLText(domcasual24, mlFontLoader);
}); // egFirstLine.position = new Vector(340, 150);
this.addChild(end); // 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 = '<font color="#FFFFFF" face="DomCasual64">Your Time:</font>';
// 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 = '<font face="DomCasual32" color="#FFFFFF">Top 5 Times:</font>'; // 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 = '<font color="#FFFFFF" face="DomCasual32"><p align="center">';
// // Check for ultimate time TODO
// if (mission.ultimateTime > 0 && timeState.gameplayClock < mission.ultimateTime) {
// text += 'You beat the <font color="#FFDD22">Ultimate</font> Time!';
// } else {
// if (mission.goldTime > 0 && timeState.gameplayClock < mission.goldTime) {
// if (mission.game == "gold" || mission.game.toLowerCase() == "ultra")
// text += 'You beat the <font color="#FFCC00">Gold</font> Time!';
// else
// text += 'You beat the <font color="#CCCCCC">Platinum</font> Time!';
// } else {
// if (mission.qualifyTime > timeState.gameplayClock) {
// text += "You beat the Par Time!";
// } else {
// text += '<font color="#F55555">You didn\'t pass the Par Time!</font>';
// }
// }
// }
// text += '</p></font>';
// 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<Score> = Settings.getScores(mission.path);
// while (scoreData.length < 5) {
// scoreData.push({name: "Matan W.", time: 5999.999});
// }
// egFirstLine.text.text = '<p align="left"><font color="#EEC884">1. </font>${scoreData[0].name}</p>';
// egSecondLine.text.text = '<p align="left"><font color="#CDCDCD">2. </font>${scoreData[1].name}</p>';
// egThirdLine.text.text = '<p align="left"><font color="#C9AFA0">3. </font>${scoreData[2].name}</p>';
// egFourthLine.text.text = '<p align="left"><font color="#A4A4A4">4. </font>${scoreData[3].name}</p>';
// egFifthLine.text.text = '<p align="left"><font color="#949494">5. </font>${scoreData[4].name}</p>';
// var lineelems = [
// egFirstLineScore,
// egSecondLineScore,
// egThirdLineScore,
// egFourthLineScore,
// egFifthLineScore
// ];
// for (i in 0...5) {
// if (scoreData[i].time < mission.ultimateTime) {
// lineelems[i].text.text = '<font color="#FFDD22">${Util.formatTime(scoreData[i].time)}</font>';
// } else {
// if (scoreData[i].time < mission.goldTime) {
// if (mission.game == "gold" || mission.game.toLowerCase() == "ultra")
// lineelems[i].text.text = '<font color="#FFCC00">${Util.formatTime(scoreData[i].time)}</font>';
// else
// lineelems[i].text.text = '<font color="#CCCCCC">${Util.formatTime(scoreData[i].time)}</font>';
// } 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:<br/>${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '<font color="#FFCC00">Gold Time:</font>' : '<font color="#CCCCCC">Platinum Time:</font>'}<br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">Ultimate Time:</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">Time Passed:<br/>Clock Bonuses:</font>';
// 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)}<br/><font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(mission.goldTime)}</font><br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">${Util.formatTime(mission.ultimateTime)}</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">${Util.formatTime(elapsedTime)}<br/>${Util.formatTime(bonusTime)}</font>';
// 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 = '<p align="left"><font color="#EEC884">1. </font>${scoreData[0].name}</p>';
// egSecondLine.text.text = '<p align="left"><font color="#CDCDCD">2. </font>${scoreData[1].name}</p>';
// egThirdLine.text.text = '<p align="left"><font color="#C9AFA0">3. </font>${scoreData[2].name}</p>';
// egFourthLine.text.text = '<p align="left"><font color="#A4A4A4">4. </font>${scoreData[3].name}</p>';
// egFifthLine.text.text = '<p align="left"><font color="#949494">5. </font>${scoreData[4].name}</p>';
// for (i in 0...5) {
// if (scoreData[i].time < mission.ultimateTime) {
// lineelems[i].text.text = '<font color="#FFDD22">${Util.formatTime(scoreData[i].time)}</font>';
// } else {
// if (scoreData[i].time < mission.goldTime) {
// lineelems[i].text.text = '<font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(scoreData[i].time)}</font>';
// } else {
// lineelems[i].text.text = '${Util.formatTime(scoreData[i].time)}';
// }
// }
// }
// Settings.saveScore(mission.path, myScore);
// scoreSubmitted = true;
// });
// this.addChild(end);
// }
} }
} }

View file

@ -65,7 +65,7 @@ class ExitGameDlg extends GuiImage {
innerCtrl.addChild(levelTitle); innerCtrl.addChild(levelTitle);
var btnList = new GuiXboxList(); var btnList = new GuiXboxList();
btnList.position = new Vector(70, 95); btnList.position = new Vector(70 - offsetX / 2, 95);
btnList.horizSizing = Left; btnList.horizSizing = Left;
btnList.extent = new Vector(502, 500); btnList.extent = new Vector(502, 500);
innerCtrl.addChild(btnList); innerCtrl.addChild(btnList);

View file

@ -114,6 +114,8 @@ class GuiXboxListButton extends GuiControl {
} }
public override function onMouseRelease(mouseState:MouseState) { public override function onMouseRelease(mouseState:MouseState) {
if (mouseState.handled)
return;
mouseState.handled = true; mouseState.handled = true;
super.onMouseRelease(mouseState); super.onMouseRelease(mouseState);
if (this.pressedAction != null && !disabled) { if (this.pressedAction != null && !disabled) {
@ -122,6 +124,8 @@ class GuiXboxListButton extends GuiControl {
} }
public override function onMouseEnter(mouseState:MouseState) { public override function onMouseEnter(mouseState:MouseState) {
if (mouseState.handled)
return;
mouseState.handled = true; mouseState.handled = true;
super.onMouseEnter(mouseState); super.onMouseEnter(mouseState);