mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
replay submitting, rewind pic, change endpoint
This commit is contained in:
parent
d8ae54df77
commit
7b4f28f0a7
5 changed files with 33 additions and 19 deletions
|
|
@ -21,7 +21,7 @@ enum abstract LeaderboardsKind(Int) {
|
|||
}
|
||||
|
||||
class Leaderboards {
|
||||
static var host = "http://127.0.0.1:7000";
|
||||
static var host = "https://lb.randomityguy.me";
|
||||
static var game = "Ultra";
|
||||
|
||||
public static function submitScore(mission:String, score:Float, rewindUsed:Bool, needsReplayCb:(Bool, Int) -> Void) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class MarbleGame {
|
|||
static var canvas:Canvas;
|
||||
static var instance:MarbleGame;
|
||||
|
||||
static var currentVersion = "1.1.3";
|
||||
static var currentVersion = "1.2.0";
|
||||
|
||||
var world:MarbleWorld;
|
||||
var previewWorld:PreviewWorld;
|
||||
|
|
|
|||
|
|
@ -246,10 +246,6 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
|
|||
if (position.sub(closest).dot(surfacenormal) > 0) {
|
||||
normal.normalize();
|
||||
|
||||
trace(v0);
|
||||
trace(v);
|
||||
trace(v2);
|
||||
|
||||
// We find the normal that is closest to the surface normal, sort of fixes weird edge cases of when colliding with
|
||||
// var testDot = normal.dot(surfacenormal);
|
||||
// if (testDot > bestDot) {
|
||||
|
|
|
|||
|
|
@ -194,19 +194,18 @@ class EndGameGui extends GuiImage {
|
|||
continueFunc(nextButton);
|
||||
}
|
||||
bottomBar.addChild(nextButton);
|
||||
|
||||
if (bestScore.time == score) {
|
||||
var replayData = MarbleGame.instance.world.replay.write();
|
||||
var submitScore = () -> {
|
||||
var lbScoreValue = score;
|
||||
if (scoreType == Score)
|
||||
lbScoreValue = 1000 - score;
|
||||
Leaderboards.submitScore(mission.path, lbScoreValue, MarbleGame.instance.world.rewindUsed, (needsReplay, ref) -> {
|
||||
if (needsReplay) {
|
||||
Leaderboards.submitReplay(ref, MarbleGame.instance.world.replay.write());
|
||||
Leaderboards.submitReplay(ref, replayData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (bestScore.time == score) {
|
||||
if (Settings.highscoreName == "" || Settings.highscoreName == "Player Name") {
|
||||
haxe.Timer.delay(() -> {
|
||||
MarbleGame.canvas.pushDialog(new EnterNamePopupDlg(() -> {
|
||||
|
|
@ -216,6 +215,19 @@ class EndGameGui extends GuiImage {
|
|||
} else {
|
||||
submitScore();
|
||||
}
|
||||
} else {
|
||||
Leaderboards.getScores(mission.path, All, lbscores -> {
|
||||
var foundScore = false;
|
||||
for (lb in lbscores) {
|
||||
if (lb.name == Settings.highscoreName) {
|
||||
foundScore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundScore) {
|
||||
submitScore();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ class LeaderboardsGui extends GuiImage {
|
|||
ResourceLoader.getResource("data/ui/xbox/platform_android_white.png", ResourceLoader.getImage, this.imageResources).toTile();
|
||||
case "unknown":
|
||||
ResourceLoader.getResource("data/ui/xbox/platform_unknown_white.png", ResourceLoader.getImage, this.imageResources).toTile();
|
||||
case "rewind":
|
||||
ResourceLoader.getResource("data/ui/xbox/rewind_ico.png", ResourceLoader.getImage, this.imageResources).toTile();
|
||||
case _:
|
||||
return null;
|
||||
};
|
||||
|
|
@ -168,7 +170,11 @@ class LeaderboardsGui extends GuiImage {
|
|||
var scoreTexts = [];
|
||||
var i = 1;
|
||||
for (score in scoreList) {
|
||||
var scoreText = '<offset value="10">${i}. </offset><offset value="50">${score.name}</offset><offset value="500">${Util.formatTime(score.score)}</offset><offset value="625"><img src="${platformToString(score.platform)}"/></offset>';
|
||||
var scoreText = '<offset value="10">${i}. </offset>
|
||||
<offset value="50">${score.name}</offset>
|
||||
<offset value="475">${score.rewind > 0 ? "<img src='rewind'/>" : ""}</offset>
|
||||
<offset value="500">${Util.formatTime(score.score)}</offset>
|
||||
<offset value="625"><img src="${platformToString(score.platform)}"/></offset>';
|
||||
scoreTexts.push(scoreText);
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue