1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Multiple users for the puzzle dlc

This commit is contained in:
tobspr 2021-05-03 15:51:24 +02:00
parent 26dd7dfd39
commit 50f599a5c1
6 changed files with 38 additions and 10 deletions

View File

@ -30,5 +30,7 @@
@include Heading;
text-align: center;
@include DarkThemeInvert;
@include DarkThemeOverride {
color: #eee;
}
}

View File

@ -16,11 +16,16 @@
> label {
text-transform: uppercase;
@include SuperSmallText;
@include SuperDuperSmallText;
color: $accentColorDark;
}
> span {
display: flex;
color: darken($accentColorDark, 25);
@include SuperSmallText;
@include DarkThemeOverride {
color: lighten($accentColorDark, 15);
}
}
}
@ -30,9 +35,12 @@
justify-self: end;
align-self: end;
flex-direction: row;
@include S(margin-bottom, 10px);
opacity: 0.8;
@include DarkThemeInvert;
opacity: 0.4;
@include DarkThemeOverride {
opacity: 0.8;
}
> .downloads {
@include SuperSmallText;
@ -63,7 +71,6 @@
font-weight: bold;
@include S(padding-left, 14px);
opacity: 0.7;
& {
/* @load-async */
background: uiResource("icons/puzzle_upvotes.png") #{D(2px)} center / #{D(8px)} #{D(8px)} no-repeat;
@ -115,4 +122,8 @@
@include PlainText;
opacity: 0.5;
}
@include DarkThemeOverride {
color: #eee;
}
}

View File

@ -132,7 +132,7 @@
grid-row: 3 / 4;
@include SuperSmallText;
color: $accentColorDark;
align-self: end;
align-self: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@ -146,6 +146,7 @@
justify-self: end;
justify-content: center;
align-self: end;
@include S(height, 14px);
@include DarkThemeInvert;

View File

@ -22,7 +22,7 @@ export class HUDPuzzlePlayMetadata extends BaseHUDPart {
this.element = makeDiv(parent, "ingame_HUD_PuzzlePlayMetadata");
this.element.innerHTML = `
<div class="info plays">
<div class="plays">
<span class="downloads">${formatBigNumberFull(puzzle.meta.downloads)}</span>
<span class="likes">${formatBigNumberFull(puzzle.meta.likes)}</span>
</div>
@ -36,7 +36,10 @@ export class HUDPuzzlePlayMetadata extends BaseHUDPart {
<label>${T.ingame.puzzleMetadata.rating}</label>
<span>${
puzzle.meta.difficulty
? puzzle.meta.difficulty.toFixed(1)
? puzzle.meta.difficulty.toFixed(2) +
" (" +
T.ingame.puzzleCompletion.difficulties[Math.round(puzzle.meta.difficulty)] +
")"
: T.puzzleMenu.difficultyNotDetermined
}</span>
</div>

View File

@ -4,8 +4,10 @@ import { Application } from "../application";
import { createLogger } from "../core/logging";
import { compressX64 } from "../core/lzstring";
import { T } from "../translations";
import { ShapezGameAnalytics } from "./browser/game_analytics";
const logger = createLogger("puzzle-api");
const rusha = require("rusha");
export class ClientAPI {
/**
@ -20,6 +22,15 @@ export class ClientAPI {
* @type {string|null}
*/
this.token = null;
this.syncToken = window.localStorage.getItem("tmp.syncToken");
if (!this.syncToken || G_IS_DEV) {
this.syncToken = rusha
.createHash()
.update(new Date().getTime() + "=" + Math.random())
.digest("hex");
window.localStorage.setItem("tmp.syncToken", this.syncToken);
}
}
getEndpoint() {
@ -102,7 +113,7 @@ export class ClientAPI {
return this._request("/v1/public/login", {
method: "POST",
body: {
hello: "world",
token: this.syncToken,
},
});
}

View File

@ -636,7 +636,7 @@ ingame:
puzzleMetadata:
author: Author
shortKey: Short Key
rating: Difficulty
rating: Difficulty score
averageDuration: Avg. Duration
# All shop upgrades