@remvst/game-navigation-core 1.0.2 → 1.2.0
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.
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/plugins/fullscreen-button-game-plugin.d.ts +8 -0
- package/lib/plugins/fullscreen-button-game-plugin.js +44 -0
- package/lib/plugins/time-keys-game-plugin.d.ts +6 -0
- package/lib/plugins/time-keys-game-plugin.js +6 -4
- package/lib/plugins/version-label-game-plugin.d.ts +10 -0
- package/lib/plugins/version-label-game-plugin.js +34 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/plugins/fullscreen-button-game-plugin.ts +46 -0
- package/src/plugins/time-keys-game-plugin.ts +15 -2
- package/src/plugins/version-label-game-plugin.ts +36 -0
package/lib/index.d.ts
CHANGED
|
@@ -9,5 +9,7 @@ export * from './ui/screen-delegate';
|
|
|
9
9
|
export * from './ui/screen';
|
|
10
10
|
export * from './plugins/automation-game-plugin';
|
|
11
11
|
export * from './plugins/blur-pausing-game-plugin';
|
|
12
|
+
export * from './plugins/fullscreen-button-game-plugin';
|
|
12
13
|
export * from './plugins/time-keys-game-plugin';
|
|
14
|
+
export * from './plugins/version-label-game-plugin';
|
|
13
15
|
export * from './util/math';
|
package/lib/index.js
CHANGED
|
@@ -25,5 +25,7 @@ __exportStar(require("./ui/screen-delegate"), exports);
|
|
|
25
25
|
__exportStar(require("./ui/screen"), exports);
|
|
26
26
|
__exportStar(require("./plugins/automation-game-plugin"), exports);
|
|
27
27
|
__exportStar(require("./plugins/blur-pausing-game-plugin"), exports);
|
|
28
|
+
__exportStar(require("./plugins/fullscreen-button-game-plugin"), exports);
|
|
28
29
|
__exportStar(require("./plugins/time-keys-game-plugin"), exports);
|
|
30
|
+
__exportStar(require("./plugins/version-label-game-plugin"), exports);
|
|
29
31
|
__exportStar(require("./util/math"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GamePlugin } from "../game/game-plugin";
|
|
2
|
+
export declare class FullscreenButtonGamePlugin extends GamePlugin {
|
|
3
|
+
private readonly container;
|
|
4
|
+
static readonly key = "fullscreen-button";
|
|
5
|
+
readonly key = "fullscreen-button";
|
|
6
|
+
constructor(container: HTMLElement);
|
|
7
|
+
setup(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FullscreenButtonGamePlugin = void 0;
|
|
4
|
+
const game_plugin_1 = require("../game/game-plugin");
|
|
5
|
+
const ICON_DATA = 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bpSIVQYuIOASsulgQFXHUKhShQqgVWnUwufQLmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6OSk6CIl/i8ptIjx4Lgf7+497t4B/lqJqWbbOKBqlpGMx4R0ZlUIviKEHvRhFEMSM/U5UUzAc3zdw8fXuyjP8j735+hSsiYDfALxLNMNi3iDeHrT0jnvE4dZQVKIz4nHDLog8SPXZZffOOcd9vPMsJFKzhOHiYV8C8stzAqGSjxFHFFUjfL9aZcVzluc1VKFNe7JXxjKaivLXKc5iDgWsQQRAmRUUEQJFqK0aqSYSNJ+zMM/4PhFcsnkKoKRYwFlqJAcP/gf/O7WzE1OuEmhGND+Ytsfw0BwF6hXbfv72LbrJ0DgGbjSmv5yDZj5JL3a1CJHQPc2cHHd1OQ94HIH6H/SJUNypABNfy4HvJ/RN2WA3lugc83trbGP0wcgRV0lboCDQ2AkT9nrHu/uaO3t3zON/n4AqiVyvXIak4gAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnAgQQGhZq6KlXAAAAK0lEQVQY02P8////fwYoYGRkZGRAAshyqBwc4P////+ZGIYToLqvGYkNcAAblh/vxNHP4AAAAABJRU5ErkJggg==';
|
|
6
|
+
class FullscreenButtonGamePlugin extends game_plugin_1.GamePlugin {
|
|
7
|
+
constructor(container) {
|
|
8
|
+
super();
|
|
9
|
+
this.container = container;
|
|
10
|
+
this.key = FullscreenButtonGamePlugin.key;
|
|
11
|
+
}
|
|
12
|
+
setup() {
|
|
13
|
+
super.setup();
|
|
14
|
+
const styleElt = document.createElement('style');
|
|
15
|
+
styleElt.innerHTML = `
|
|
16
|
+
.fullscreen-button {
|
|
17
|
+
position: absolute;
|
|
18
|
+
z-index: 2;
|
|
19
|
+
margin: 10px;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
width: 10px;
|
|
24
|
+
height: 10px;
|
|
25
|
+
background-image: url('data:image/png;base64,${ICON_DATA}');
|
|
26
|
+
background-repeat: no-repeat;
|
|
27
|
+
background-size: contain;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media all and (display-mode: fullscreen) {
|
|
31
|
+
.fullscreen-button {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
document.head.appendChild(styleElt);
|
|
37
|
+
const button = document.createElement('div');
|
|
38
|
+
button.className = 'fullscreen-button';
|
|
39
|
+
button.addEventListener('click', () => document.body.requestFullscreen(), false);
|
|
40
|
+
this.container.appendChild(button);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.FullscreenButtonGamePlugin = FullscreenButtonGamePlugin;
|
|
44
|
+
FullscreenButtonGamePlugin.key = 'fullscreen-button';
|
|
@@ -2,5 +2,11 @@ import { GamePlugin } from "../game/game-plugin";
|
|
|
2
2
|
export declare class TimeKeysGamePlugin extends GamePlugin {
|
|
3
3
|
static readonly key = "time-keys";
|
|
4
4
|
readonly key = "time-keys";
|
|
5
|
+
speedUpFactor: number;
|
|
6
|
+
slowDownFactor: number;
|
|
7
|
+
constructor(options?: {
|
|
8
|
+
speedUpFactor?: number;
|
|
9
|
+
slowDownFactor?: number;
|
|
10
|
+
});
|
|
5
11
|
get timeFactor(): number;
|
|
6
12
|
}
|
|
@@ -4,16 +4,18 @@ exports.TimeKeysGamePlugin = void 0;
|
|
|
4
4
|
const client_inputs_1 = require("@remvst/client-inputs");
|
|
5
5
|
const game_plugin_1 = require("../game/game-plugin");
|
|
6
6
|
class TimeKeysGamePlugin extends game_plugin_1.GamePlugin {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super();
|
|
9
9
|
this.key = TimeKeysGamePlugin.key;
|
|
10
|
+
this.speedUpFactor = options.speedUpFactor || 10;
|
|
11
|
+
this.slowDownFactor = options.slowDownFactor || 0.25;
|
|
10
12
|
}
|
|
11
13
|
get timeFactor() {
|
|
12
14
|
if (this.game.inputs.keyboard.isDown(client_inputs_1.Keyboard.F)) {
|
|
13
|
-
return
|
|
15
|
+
return this.speedUpFactor;
|
|
14
16
|
}
|
|
15
17
|
else if (this.game.inputs.keyboard.isDown(client_inputs_1.Keyboard.G)) {
|
|
16
|
-
return
|
|
18
|
+
return this.slowDownFactor;
|
|
17
19
|
}
|
|
18
20
|
return 1;
|
|
19
21
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GamePlugin } from "../game/game-plugin";
|
|
2
|
+
export declare class VersionLabelGamePlugin extends GamePlugin {
|
|
3
|
+
private readonly container;
|
|
4
|
+
private readonly label;
|
|
5
|
+
private readonly extraStyle;
|
|
6
|
+
static readonly key = "version-label";
|
|
7
|
+
readonly key = "version-label";
|
|
8
|
+
constructor(container: HTMLElement, label: string, extraStyle?: string);
|
|
9
|
+
setup(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersionLabelGamePlugin = void 0;
|
|
4
|
+
const game_plugin_1 = require("../game/game-plugin");
|
|
5
|
+
class VersionLabelGamePlugin extends game_plugin_1.GamePlugin {
|
|
6
|
+
constructor(container, label, extraStyle = '') {
|
|
7
|
+
super();
|
|
8
|
+
this.container = container;
|
|
9
|
+
this.label = label;
|
|
10
|
+
this.extraStyle = extraStyle;
|
|
11
|
+
this.key = VersionLabelGamePlugin.key;
|
|
12
|
+
}
|
|
13
|
+
setup() {
|
|
14
|
+
super.setup();
|
|
15
|
+
const button = document.createElement('div');
|
|
16
|
+
button.innerText = this.label;
|
|
17
|
+
button.style.cssText = `
|
|
18
|
+
position: absolute;
|
|
19
|
+
z-index: 2;
|
|
20
|
+
margin: 10px;
|
|
21
|
+
color: #fff;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
text-shadow: 0px 2px 0px #000;
|
|
26
|
+
font-family: Courier;
|
|
27
|
+
font-size: 10px;
|
|
28
|
+
${this.extraStyle}
|
|
29
|
+
`;
|
|
30
|
+
this.container.appendChild(button);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.VersionLabelGamePlugin = VersionLabelGamePlugin;
|
|
34
|
+
VersionLabelGamePlugin.key = "version-label";
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,6 +13,8 @@ export * from './ui/screen';
|
|
|
13
13
|
|
|
14
14
|
export * from './plugins/automation-game-plugin';
|
|
15
15
|
export * from './plugins/blur-pausing-game-plugin';
|
|
16
|
+
export * from './plugins/fullscreen-button-game-plugin';
|
|
16
17
|
export * from './plugins/time-keys-game-plugin';
|
|
18
|
+
export * from './plugins/version-label-game-plugin';
|
|
17
19
|
|
|
18
20
|
export * from './util/math';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GamePlugin } from "../game/game-plugin";
|
|
2
|
+
|
|
3
|
+
const ICON_DATA = 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bpSIVQYuIOASsulgQFXHUKhShQqgVWnUwufQLmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6OSk6CIl/i8ptIjx4Lgf7+497t4B/lqJqWbbOKBqlpGMx4R0ZlUIviKEHvRhFEMSM/U5UUzAc3zdw8fXuyjP8j735+hSsiYDfALxLNMNi3iDeHrT0jnvE4dZQVKIz4nHDLog8SPXZZffOOcd9vPMsJFKzhOHiYV8C8stzAqGSjxFHFFUjfL9aZcVzluc1VKFNe7JXxjKaivLXKc5iDgWsQQRAmRUUEQJFqK0aqSYSNJ+zMM/4PhFcsnkKoKRYwFlqJAcP/gf/O7WzE1OuEmhGND+Ytsfw0BwF6hXbfv72LbrJ0DgGbjSmv5yDZj5JL3a1CJHQPc2cHHd1OQ94HIH6H/SJUNypABNfy4HvJ/RN2WA3lugc83trbGP0wcgRV0lboCDQ2AkT9nrHu/uaO3t3zON/n4AqiVyvXIak4gAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnAgQQGhZq6KlXAAAAK0lEQVQY02P8////fwYoYGRkZGRAAshyqBwc4P////+ZGIYToLqvGYkNcAAblh/vxNHP4AAAAABJRU5ErkJggg==';
|
|
4
|
+
|
|
5
|
+
export class FullscreenButtonGamePlugin extends GamePlugin {
|
|
6
|
+
|
|
7
|
+
static readonly key = 'fullscreen-button';
|
|
8
|
+
readonly key = FullscreenButtonGamePlugin.key;
|
|
9
|
+
|
|
10
|
+
constructor(private readonly container: HTMLElement) {
|
|
11
|
+
super();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setup(): void {
|
|
15
|
+
super.setup();
|
|
16
|
+
|
|
17
|
+
const styleElt = document.createElement('style');
|
|
18
|
+
styleElt.innerHTML = `
|
|
19
|
+
.fullscreen-button {
|
|
20
|
+
position: absolute;
|
|
21
|
+
z-index: 2;
|
|
22
|
+
margin: 10px;
|
|
23
|
+
top: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
width: 10px;
|
|
27
|
+
height: 10px;
|
|
28
|
+
background-image: url('data:image/png;base64,${ICON_DATA}');
|
|
29
|
+
background-repeat: no-repeat;
|
|
30
|
+
background-size: contain;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media all and (display-mode: fullscreen) {
|
|
34
|
+
.fullscreen-button {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
document.head.appendChild(styleElt);
|
|
40
|
+
|
|
41
|
+
const button = document.createElement('div');
|
|
42
|
+
button.className = 'fullscreen-button';
|
|
43
|
+
button.addEventListener('click', () => document.body.requestFullscreen(), false);
|
|
44
|
+
this.container.appendChild(button);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -6,11 +6,24 @@ export class TimeKeysGamePlugin extends GamePlugin {
|
|
|
6
6
|
static readonly key = 'time-keys';
|
|
7
7
|
readonly key = TimeKeysGamePlugin.key;
|
|
8
8
|
|
|
9
|
+
speedUpFactor: number;
|
|
10
|
+
slowDownFactor: number;
|
|
11
|
+
|
|
12
|
+
constructor(options: {
|
|
13
|
+
speedUpFactor?: number,
|
|
14
|
+
slowDownFactor?: number,
|
|
15
|
+
} = {}) {
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
this.speedUpFactor = options.speedUpFactor || 10;
|
|
19
|
+
this.slowDownFactor = options.slowDownFactor || 0.25;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
get timeFactor(): number {
|
|
10
23
|
if (this.game.inputs.keyboard.isDown(Keyboard.F)) {
|
|
11
|
-
return
|
|
24
|
+
return this.speedUpFactor;
|
|
12
25
|
} else if (this.game.inputs.keyboard.isDown(Keyboard.G)) {
|
|
13
|
-
return
|
|
26
|
+
return this.slowDownFactor;
|
|
14
27
|
}
|
|
15
28
|
|
|
16
29
|
return 1;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GamePlugin } from "../game/game-plugin";
|
|
2
|
+
|
|
3
|
+
export class VersionLabelGamePlugin extends GamePlugin {
|
|
4
|
+
|
|
5
|
+
static readonly key = "version-label";
|
|
6
|
+
readonly key = VersionLabelGamePlugin.key;
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly container: HTMLElement,
|
|
10
|
+
private readonly label: string,
|
|
11
|
+
private readonly extraStyle: string = '',
|
|
12
|
+
) {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setup(): void {
|
|
17
|
+
super.setup();
|
|
18
|
+
|
|
19
|
+
const button = document.createElement('div');
|
|
20
|
+
button.innerText = this.label;
|
|
21
|
+
button.style.cssText = `
|
|
22
|
+
position: absolute;
|
|
23
|
+
z-index: 2;
|
|
24
|
+
margin: 10px;
|
|
25
|
+
color: #fff;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
text-transform: uppercase;
|
|
29
|
+
text-shadow: 0px 2px 0px #000;
|
|
30
|
+
font-family: Courier;
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
${this.extraStyle}
|
|
33
|
+
`;
|
|
34
|
+
this.container.appendChild(button);
|
|
35
|
+
}
|
|
36
|
+
}
|