@remvst/game-navigation-core 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,10 +10,14 @@ function getClientStorage() {
|
|
|
10
10
|
];
|
|
11
11
|
for (const [label, getter] of options) {
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
const storage = getter();
|
|
14
|
+
if (!storage) {
|
|
15
|
+
throw new Error(`${label} getter returned falsy`);
|
|
16
|
+
}
|
|
17
|
+
return storage;
|
|
14
18
|
}
|
|
15
19
|
catch (err) {
|
|
16
|
-
console.error(`Failed to get ${label}, falling back
|
|
20
|
+
console.error(`Failed to get ${label} (${err.message}), falling back`, err);
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
}
|
package/lib/ui/screen.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export declare abstract class Screen {
|
|
|
11
11
|
interpolationPool: InterpolationPool;
|
|
12
12
|
delegate: ScreenDelegate | null;
|
|
13
13
|
protected readonly subscreens: Screen[];
|
|
14
|
-
constructor();
|
|
15
14
|
addSubscreen(screen: Screen): void;
|
|
16
15
|
bind(game: Game): void;
|
|
17
16
|
abstract get id(): string;
|
package/lib/ui/screen.js
CHANGED
|
@@ -5,12 +5,12 @@ const animate_js_1 = require("@remvst/animate.js");
|
|
|
5
5
|
const inputs_1 = require("../interaction/inputs");
|
|
6
6
|
class Screen {
|
|
7
7
|
constructor() {
|
|
8
|
+
this.game = null;
|
|
8
9
|
this.cursorType = "default";
|
|
9
10
|
this.age = 0;
|
|
10
11
|
this.frameCount = 0;
|
|
11
12
|
this.delegate = null;
|
|
12
13
|
this.subscreens = [];
|
|
13
|
-
this.game = null;
|
|
14
14
|
}
|
|
15
15
|
addSubscreen(screen) {
|
|
16
16
|
this.subscreens.push(screen);
|
|
@@ -40,6 +40,7 @@ class Screen {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
destroy() {
|
|
43
|
+
this.interpolationPool.clear();
|
|
43
44
|
this.delegate?.onDestroy();
|
|
44
45
|
for (const sub of this.subscreens) {
|
|
45
46
|
sub.destroy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remvst/game-navigation-core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Rémi Vansteelandt",
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@remvst/animate.js": "^3.
|
|
13
|
+
"@remvst/animate.js": "^3.1.0",
|
|
14
14
|
"@remvst/client-inputs": "^1.0.4",
|
|
15
15
|
"@remvst/optimization": "^1.0.1"
|
|
16
16
|
},
|
|
@@ -9,9 +9,13 @@ export function getClientStorage(): Storage {
|
|
|
9
9
|
|
|
10
10
|
for (const [label, getter] of options) {
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
const storage = getter();
|
|
13
|
+
if (!storage) {
|
|
14
|
+
throw new Error(`${label} getter returned falsy`);
|
|
15
|
+
}
|
|
16
|
+
return storage;
|
|
13
17
|
} catch (err) {
|
|
14
|
-
console.error(`Failed to get ${label}, falling back
|
|
18
|
+
console.error(`Failed to get ${label} (${err.message}), falling back`, err);
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
}
|
package/src/ui/screen.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ScreenInputs } from "../interaction/inputs";
|
|
|
4
4
|
import { ScreenDelegate } from "./screen-delegate";
|
|
5
5
|
|
|
6
6
|
export abstract class Screen {
|
|
7
|
-
game: Game;
|
|
7
|
+
game: Game = null;
|
|
8
8
|
cursorType: string = "default";
|
|
9
9
|
|
|
10
10
|
inputs: ScreenInputs;
|
|
@@ -15,10 +15,6 @@ export abstract class Screen {
|
|
|
15
15
|
|
|
16
16
|
protected readonly subscreens: Screen[] = [];
|
|
17
17
|
|
|
18
|
-
constructor() {
|
|
19
|
-
this.game = null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
addSubscreen(screen: Screen) {
|
|
23
19
|
this.subscreens.push(screen);
|
|
24
20
|
}
|
|
@@ -72,6 +68,7 @@ export abstract class Screen {
|
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
destroy() {
|
|
71
|
+
this.interpolationPool.clear();
|
|
75
72
|
this.delegate?.onDestroy();
|
|
76
73
|
|
|
77
74
|
for (const sub of this.subscreens) {
|