mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-13 18:38:11 +02:00
Added other changes (I forgot to commit them :p )
This commit is contained in:
1 parent
8a23a7f16d
commit
09b62254ea
3 files changed
+76
-1
No files matched your search
@@ -43,11 +43,61 @@ $PageTitle = "Garden";
|
||||
<p id="GardenMessage">
|
||||
Select a seed, then choose an empty plot.
|
||||
</p>
|
||||
|
||||
<section class="GardenUser">
|
||||
<h2>Player</h2>
|
||||
|
||||
<p>
|
||||
Username:
|
||||
<strong id="UsernameDisplay">
|
||||
Loading...
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
<form
|
||||
id="UsernameForm"
|
||||
hidden
|
||||
>
|
||||
<input
|
||||
id="UsernameInput"
|
||||
type="text"
|
||||
minlength="3"
|
||||
maxlength="24"
|
||||
autocomplete="username"
|
||||
placeholder="Username"
|
||||
required
|
||||
>
|
||||
|
||||
<button type="submit">
|
||||
Set username
|
||||
</button>
|
||||
|
||||
<p id="UsernameMessage"></p>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="Leaderboard">
|
||||
<h2>Leaderboard</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Username</th>
|
||||
<th>Dew</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="LeaderboardBody"></tbody>
|
||||
</table>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="/Scripts/Garden/Plants.js"></script>
|
||||
<script src="/Scripts/Garden/Mutations.js"></script>
|
||||
<script src="/Scripts/Garden/Save.js"></script>
|
||||
<script src="/Scripts/Garden/Users.js"></script>
|
||||
<script src="/Scripts/Garden/Leaderboard.js"></script>
|
||||
<script src="/Scripts/Garden/Garden.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,7 +6,6 @@ const GardenUpdateInterval = 1000;
|
||||
|
||||
async function StartGame() {
|
||||
GameSave = await LoadGame();
|
||||
|
||||
NormalizeSave();
|
||||
|
||||
RenderGame();
|
||||
@@ -15,6 +14,8 @@ async function StartGame() {
|
||||
RenderGarden,
|
||||
GardenUpdateInterval
|
||||
);
|
||||
await RenderUser();
|
||||
await RenderLeaderboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +28,12 @@ function NormalizeSave() {
|
||||
"Rose"
|
||||
];
|
||||
|
||||
GameSave.Statistics ??= {};
|
||||
GameSave.Statistics.CurrencyEarned ??= {};
|
||||
|
||||
GameSave.Statistics.CurrencyEarned.Dew ??=
|
||||
GameSave.Currency.Dew;
|
||||
|
||||
GameSave.Garden ??= {
|
||||
Width: 3,
|
||||
Height: 3,
|
||||
@@ -377,6 +384,18 @@ function GiveReward(
|
||||
GameSave.Currency[
|
||||
Reward.Currency
|
||||
] += Reward.Amount;
|
||||
|
||||
|
||||
GameSave.Statistics ??= {};
|
||||
GameSave.Statistics.CurrencyEarned ??= {};
|
||||
|
||||
GameSave.Statistics.CurrencyEarned[
|
||||
Reward.Currency
|
||||
] ??= 0;
|
||||
|
||||
GameSave.Statistics.CurrencyEarned[
|
||||
Reward.Currency
|
||||
] += Reward.Amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ function CreateNewSave() {
|
||||
Dew: 0
|
||||
},
|
||||
|
||||
Statistics: {
|
||||
CurrencyEarned: {
|
||||
Dew: 0
|
||||
}
|
||||
},
|
||||
|
||||
Seeds: {
|
||||
Unlocked: [
|
||||
"Rose"
|
||||
|
||||
Reference in new issue
Block a user