Highscores

This commit is contained in:
Martin 2023-01-02 13:24:06 +01:00
parent b7c93283f4
commit 9ebeeddb8c
2 changed files with 140 additions and 23 deletions

View File

@ -24,11 +24,11 @@
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 73 "__id__": 76
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 74 "__id__": 77
}, },
"_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0" "_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0"
}, },
@ -177,24 +177,27 @@
}, },
{ {
"__id__": 59 "__id__": 59
},
{
"__id__": 68
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 68
},
{
"__id__": 69
},
{
"__id__": 70
},
{ {
"__id__": 71 "__id__": 71
}, },
{ {
"__id__": 72 "__id__": 72
},
{
"__id__": 73
},
{
"__id__": 74
},
{
"__id__": 75
} }
], ],
"_prefab": null, "_prefab": null,
@ -2230,6 +2233,114 @@
}, },
"_id": "6bWmS+us9G55ZQR94w+B3i" "_id": "6bWmS+us9G55ZQR94w+B3i"
}, },
{
"__type__": "cc.Node",
"_name": "HighscoreLabel",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 69
},
{
"__id__": 70
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -51,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "2bG95VhbNDN6iiv88LPyjH"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 150.43,
"height": 26
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "65/u2Ii8lF6ZE+x4Bk14JD"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "Highscore: 0",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 26,
"_fontSize": 26,
"_fontFamily": "Arial",
"_lineHeight": 26,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "c96b42a9-d20d-4c59-8e99-8ed749a715c8",
"__expectedType__": "cc.BitmapFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": "3fd6mbQOZH9ZnXu+ryqYhj"
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@ -2312,7 +2423,10 @@
"__id__": 66 "__id__": 66
}, },
"menuCanvas": { "menuCanvas": {
"__id__": 69 "__id__": 72
},
"highscoreLabel": {
"__id__": 70
}, },
"_id": "4cQFnvx1xB65sFsTPGRrB7" "_id": "4cQFnvx1xB65sFsTPGRrB7"
}, },
@ -2350,19 +2464,19 @@
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 75
},
"shadows": {
"__id__": 76
},
"_skybox": {
"__id__": 77
},
"fog": {
"__id__": 78 "__id__": 78
}, },
"octree": { "shadows": {
"__id__": 79 "__id__": 79
},
"_skybox": {
"__id__": 80
},
"fog": {
"__id__": 81
},
"octree": {
"__id__": 82
} }
}, },
{ {

View File

@ -1,4 +1,4 @@
import { Canvas, Component, _decorator } from "cc"; import { Canvas, Component, Label, _decorator } from "cc";
import { AppRoot } from "../AppRoot/AppRoot"; import { AppRoot } from "../AppRoot/AppRoot";
import { requireAppRootAsync } from "../AppRoot/AppRootUtils"; import { requireAppRootAsync } from "../AppRoot/AppRootUtils";
import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager";
@ -15,6 +15,7 @@ export class Menu extends Component {
@property(UIButton) private upgradeBtn: UIButton; @property(UIButton) private upgradeBtn: UIButton;
@property(UIButton) private audioSettingsBtn: UIButton; @property(UIButton) private audioSettingsBtn: UIButton;
@property(Canvas) private menuCanvas: Canvas; @property(Canvas) private menuCanvas: Canvas;
@property(Label) private highscoreLabel: Label;
private menuModalLauncher: MenuModalLauncher; private menuModalLauncher: MenuModalLauncher;
@ -27,6 +28,8 @@ export class Menu extends Component {
this.audioSettingsBtn.InteractedEvent.on(this.openAudioSettingsWindow, this); this.audioSettingsBtn.InteractedEvent.on(this.openAudioSettingsWindow, this);
this.menuModalLauncher = new MenuModalLauncher(AppRoot.Instance.ModalWindowManager); this.menuModalLauncher = new MenuModalLauncher(AppRoot.Instance.ModalWindowManager);
this.highscoreLabel.string = `Highscore: ${Math.floor(AppRoot.Instance.LiveUserData.game.highscore)}`;
} }
private startGame(): void { private startGame(): void {