@dcl-regenesislabs/ecs 7.33.1-45462038000.commit-b0a4272 → 7.33.1-45463223330.commit-bb0e4a4
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.
|
@@ -14,6 +14,12 @@ export interface TouchScreenControlsComponentDefinitionExtended extends LastWrit
|
|
|
14
14
|
* Does NOT change the joystick/crosshair — use `showJoystick()` / `showCrosshair()` for those.
|
|
15
15
|
*/
|
|
16
16
|
showAll(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Show the default button set: jump, pointer and primary visible, secondary and
|
|
19
|
+
* actions 3-6 hidden. This is the state every scene starts in.
|
|
20
|
+
* Does NOT change the joystick/crosshair, the main action or custom icons.
|
|
21
|
+
*/
|
|
22
|
+
showDefault(): void;
|
|
17
23
|
/** Hide the given on-screen buttons (merged into the current config). */
|
|
18
24
|
hide(actions: InputAction[]): void;
|
|
19
25
|
/** Set which action the large central button triggers. */
|
|
@@ -11,6 +11,17 @@ const ALL_BUTTONS = [
|
|
|
11
11
|
12 /* InputAction.IA_ACTION_5 */,
|
|
12
12
|
13 /* InputAction.IA_ACTION_6 */
|
|
13
13
|
];
|
|
14
|
+
// Buttons hidden in the default set; the rest of ALL_BUTTONS stay visible.
|
|
15
|
+
const DEFAULT_HIDDEN_BUTTONS = [
|
|
16
|
+
2 /* InputAction.IA_SECONDARY */,
|
|
17
|
+
10 /* InputAction.IA_ACTION_3 */,
|
|
18
|
+
11 /* InputAction.IA_ACTION_4 */,
|
|
19
|
+
12 /* InputAction.IA_ACTION_5 */,
|
|
20
|
+
13 /* InputAction.IA_ACTION_6 */
|
|
21
|
+
];
|
|
22
|
+
// Component definitions on which a button-visibility helper ran. Keyed by the definition, which is
|
|
23
|
+
// shared by every wrapper built for the same engine.
|
|
24
|
+
const visibilityExpressed = new WeakSet();
|
|
14
25
|
export function defineTouchScreenControlsComponent(engine) {
|
|
15
26
|
const theComponent = TouchScreenControls(engine);
|
|
16
27
|
// A mutable copy of the current RootEntity value (or a fresh default).
|
|
@@ -26,6 +37,7 @@ export function defineTouchScreenControlsComponent(engine) {
|
|
|
26
37
|
};
|
|
27
38
|
}
|
|
28
39
|
function setHidden(actions) {
|
|
40
|
+
visibilityExpressed.add(theComponent);
|
|
29
41
|
const value = current();
|
|
30
42
|
const byAction = new Map();
|
|
31
43
|
for (const input of value.touchInputs)
|
|
@@ -35,16 +47,40 @@ export function defineTouchScreenControlsComponent(engine) {
|
|
|
35
47
|
value.touchInputs = [...byAction.values()];
|
|
36
48
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
37
49
|
}
|
|
50
|
+
// Every button visible except DEFAULT_HIDDEN_BUTTONS; existing entries keep their position and icon.
|
|
51
|
+
function writeDefault() {
|
|
52
|
+
const value = current();
|
|
53
|
+
const byAction = new Map();
|
|
54
|
+
for (const input of value.touchInputs)
|
|
55
|
+
byAction.set(input.inputAction, { ...input, hide: false });
|
|
56
|
+
for (const action of DEFAULT_HIDDEN_BUTTONS) {
|
|
57
|
+
byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true });
|
|
58
|
+
}
|
|
59
|
+
value.touchInputs = [...byAction.values()];
|
|
60
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
61
|
+
}
|
|
38
62
|
return {
|
|
39
63
|
...theComponent,
|
|
40
64
|
hideAll() {
|
|
41
65
|
setHidden(ALL_BUTTONS);
|
|
42
66
|
},
|
|
43
67
|
showAll() {
|
|
68
|
+
visibilityExpressed.add(theComponent);
|
|
44
69
|
const value = current();
|
|
45
70
|
value.touchInputs = [];
|
|
46
71
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
47
72
|
},
|
|
73
|
+
showDefault() {
|
|
74
|
+
visibilityExpressed.add(theComponent);
|
|
75
|
+
writeDefault();
|
|
76
|
+
},
|
|
77
|
+
applyDefaultIfUnset() {
|
|
78
|
+
if (visibilityExpressed.has(theComponent))
|
|
79
|
+
return;
|
|
80
|
+
if (theComponent.getOrNull(ROOT_ENTITY)?.touchInputs.length)
|
|
81
|
+
return;
|
|
82
|
+
writeDefault();
|
|
83
|
+
},
|
|
48
84
|
hide(actions) {
|
|
49
85
|
setHidden(actions);
|
|
50
86
|
},
|
|
@@ -14,6 +14,12 @@ export interface TouchScreenControlsComponentDefinitionExtended extends LastWrit
|
|
|
14
14
|
* Does NOT change the joystick/crosshair — use `showJoystick()` / `showCrosshair()` for those.
|
|
15
15
|
*/
|
|
16
16
|
showAll(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Show the default button set: jump, pointer and primary visible, secondary and
|
|
19
|
+
* actions 3-6 hidden. This is the state every scene starts in.
|
|
20
|
+
* Does NOT change the joystick/crosshair, the main action or custom icons.
|
|
21
|
+
*/
|
|
22
|
+
showDefault(): void;
|
|
17
23
|
/** Hide the given on-screen buttons (merged into the current config). */
|
|
18
24
|
hide(actions: InputAction[]): void;
|
|
19
25
|
/** Set which action the large central button triggers. */
|
|
@@ -14,6 +14,17 @@ const ALL_BUTTONS = [
|
|
|
14
14
|
12 /* InputAction.IA_ACTION_5 */,
|
|
15
15
|
13 /* InputAction.IA_ACTION_6 */
|
|
16
16
|
];
|
|
17
|
+
// Buttons hidden in the default set; the rest of ALL_BUTTONS stay visible.
|
|
18
|
+
const DEFAULT_HIDDEN_BUTTONS = [
|
|
19
|
+
2 /* InputAction.IA_SECONDARY */,
|
|
20
|
+
10 /* InputAction.IA_ACTION_3 */,
|
|
21
|
+
11 /* InputAction.IA_ACTION_4 */,
|
|
22
|
+
12 /* InputAction.IA_ACTION_5 */,
|
|
23
|
+
13 /* InputAction.IA_ACTION_6 */
|
|
24
|
+
];
|
|
25
|
+
// Component definitions on which a button-visibility helper ran. Keyed by the definition, which is
|
|
26
|
+
// shared by every wrapper built for the same engine.
|
|
27
|
+
const visibilityExpressed = new WeakSet();
|
|
17
28
|
function defineTouchScreenControlsComponent(engine) {
|
|
18
29
|
const theComponent = (0, index_gen_1.TouchScreenControls)(engine);
|
|
19
30
|
// A mutable copy of the current RootEntity value (or a fresh default).
|
|
@@ -29,6 +40,7 @@ function defineTouchScreenControlsComponent(engine) {
|
|
|
29
40
|
};
|
|
30
41
|
}
|
|
31
42
|
function setHidden(actions) {
|
|
43
|
+
visibilityExpressed.add(theComponent);
|
|
32
44
|
const value = current();
|
|
33
45
|
const byAction = new Map();
|
|
34
46
|
for (const input of value.touchInputs)
|
|
@@ -38,16 +50,40 @@ function defineTouchScreenControlsComponent(engine) {
|
|
|
38
50
|
value.touchInputs = [...byAction.values()];
|
|
39
51
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
40
52
|
}
|
|
53
|
+
// Every button visible except DEFAULT_HIDDEN_BUTTONS; existing entries keep their position and icon.
|
|
54
|
+
function writeDefault() {
|
|
55
|
+
const value = current();
|
|
56
|
+
const byAction = new Map();
|
|
57
|
+
for (const input of value.touchInputs)
|
|
58
|
+
byAction.set(input.inputAction, { ...input, hide: false });
|
|
59
|
+
for (const action of DEFAULT_HIDDEN_BUTTONS) {
|
|
60
|
+
byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true });
|
|
61
|
+
}
|
|
62
|
+
value.touchInputs = [...byAction.values()];
|
|
63
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
64
|
+
}
|
|
41
65
|
return {
|
|
42
66
|
...theComponent,
|
|
43
67
|
hideAll() {
|
|
44
68
|
setHidden(ALL_BUTTONS);
|
|
45
69
|
},
|
|
46
70
|
showAll() {
|
|
71
|
+
visibilityExpressed.add(theComponent);
|
|
47
72
|
const value = current();
|
|
48
73
|
value.touchInputs = [];
|
|
49
74
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
50
75
|
},
|
|
76
|
+
showDefault() {
|
|
77
|
+
visibilityExpressed.add(theComponent);
|
|
78
|
+
writeDefault();
|
|
79
|
+
},
|
|
80
|
+
applyDefaultIfUnset() {
|
|
81
|
+
if (visibilityExpressed.has(theComponent))
|
|
82
|
+
return;
|
|
83
|
+
if (theComponent.getOrNull(ROOT_ENTITY)?.touchInputs.length)
|
|
84
|
+
return;
|
|
85
|
+
writeDefault();
|
|
86
|
+
},
|
|
51
87
|
hide(actions) {
|
|
52
88
|
setHidden(actions);
|
|
53
89
|
},
|
package/package.json
CHANGED