@dcl/ecs 7.25.1-30540108605.commit-82368ee → 7.25.1-30570000030.commit-eaa1fa5
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.
|
@@ -9,7 +9,10 @@ import { InputAction } from '../generated/pb/decentraland/sdk/components/common/
|
|
|
9
9
|
export interface TouchScreenControlsComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBTouchScreenControls> {
|
|
10
10
|
/** Hide every on-screen gamepad button. */
|
|
11
11
|
hideAll(): void;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Show every on-screen gamepad button (clears the button hide list).
|
|
14
|
+
* Does NOT change the joystick/crosshair — use `showJoystick()` / `showCrosshair()` for those.
|
|
15
|
+
*/
|
|
13
16
|
showAll(): void;
|
|
14
17
|
/** Hide the given on-screen buttons (merged into the current config). */
|
|
15
18
|
hide(actions: InputAction[]): void;
|
|
@@ -17,7 +20,11 @@ export interface TouchScreenControlsComponentDefinitionExtended extends LastWrit
|
|
|
17
20
|
setMainAction(action: InputAction): void;
|
|
18
21
|
/** Hide the native virtual joystick. */
|
|
19
22
|
hideJoystick(): void;
|
|
23
|
+
/** Show the native virtual joystick. */
|
|
24
|
+
showJoystick(): void;
|
|
20
25
|
/** Hide the on-screen crosshair / reticle. */
|
|
21
26
|
hideCrosshair(): void;
|
|
27
|
+
/** Show the on-screen crosshair / reticle. */
|
|
28
|
+
showCrosshair(): void;
|
|
22
29
|
}
|
|
23
30
|
export declare function defineTouchScreenControlsComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TouchScreenControlsComponentDefinitionExtended;
|
|
@@ -17,7 +17,9 @@ export function defineTouchScreenControlsComponent(engine) {
|
|
|
17
17
|
function current() {
|
|
18
18
|
const value = theComponent.getOrNull(ROOT_ENTITY);
|
|
19
19
|
return {
|
|
20
|
-
touchInputs: value?.touchInputs
|
|
20
|
+
touchInputs: value?.touchInputs
|
|
21
|
+
? value.touchInputs.map((t) => ({ ...t, icon: t.icon ? { ...t.icon } : t.icon }))
|
|
22
|
+
: [],
|
|
21
23
|
mainAction: value?.mainAction,
|
|
22
24
|
hideJoystick: value?.hideJoystick ?? false,
|
|
23
25
|
hideCrosshair: value?.hideCrosshair ?? false
|
|
@@ -29,7 +31,7 @@ export function defineTouchScreenControlsComponent(engine) {
|
|
|
29
31
|
for (const input of value.touchInputs)
|
|
30
32
|
byAction.set(input.inputAction, input);
|
|
31
33
|
for (const action of actions)
|
|
32
|
-
byAction.set(action, { inputAction: action, hide: true });
|
|
34
|
+
byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true });
|
|
33
35
|
value.touchInputs = [...byAction.values()];
|
|
34
36
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
35
37
|
}
|
|
@@ -56,10 +58,20 @@ export function defineTouchScreenControlsComponent(engine) {
|
|
|
56
58
|
value.hideJoystick = true;
|
|
57
59
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
58
60
|
},
|
|
61
|
+
showJoystick() {
|
|
62
|
+
const value = current();
|
|
63
|
+
value.hideJoystick = false;
|
|
64
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
65
|
+
},
|
|
59
66
|
hideCrosshair() {
|
|
60
67
|
const value = current();
|
|
61
68
|
value.hideCrosshair = true;
|
|
62
69
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
70
|
+
},
|
|
71
|
+
showCrosshair() {
|
|
72
|
+
const value = current();
|
|
73
|
+
value.hideCrosshair = false;
|
|
74
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
63
75
|
}
|
|
64
76
|
};
|
|
65
77
|
}
|
|
@@ -9,7 +9,10 @@ import { InputAction } from '../generated/pb/decentraland/sdk/components/common/
|
|
|
9
9
|
export interface TouchScreenControlsComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBTouchScreenControls> {
|
|
10
10
|
/** Hide every on-screen gamepad button. */
|
|
11
11
|
hideAll(): void;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Show every on-screen gamepad button (clears the button hide list).
|
|
14
|
+
* Does NOT change the joystick/crosshair — use `showJoystick()` / `showCrosshair()` for those.
|
|
15
|
+
*/
|
|
13
16
|
showAll(): void;
|
|
14
17
|
/** Hide the given on-screen buttons (merged into the current config). */
|
|
15
18
|
hide(actions: InputAction[]): void;
|
|
@@ -17,7 +20,11 @@ export interface TouchScreenControlsComponentDefinitionExtended extends LastWrit
|
|
|
17
20
|
setMainAction(action: InputAction): void;
|
|
18
21
|
/** Hide the native virtual joystick. */
|
|
19
22
|
hideJoystick(): void;
|
|
23
|
+
/** Show the native virtual joystick. */
|
|
24
|
+
showJoystick(): void;
|
|
20
25
|
/** Hide the on-screen crosshair / reticle. */
|
|
21
26
|
hideCrosshair(): void;
|
|
27
|
+
/** Show the on-screen crosshair / reticle. */
|
|
28
|
+
showCrosshair(): void;
|
|
22
29
|
}
|
|
23
30
|
export declare function defineTouchScreenControlsComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TouchScreenControlsComponentDefinitionExtended;
|
|
@@ -20,7 +20,9 @@ function defineTouchScreenControlsComponent(engine) {
|
|
|
20
20
|
function current() {
|
|
21
21
|
const value = theComponent.getOrNull(ROOT_ENTITY);
|
|
22
22
|
return {
|
|
23
|
-
touchInputs: value?.touchInputs
|
|
23
|
+
touchInputs: value?.touchInputs
|
|
24
|
+
? value.touchInputs.map((t) => ({ ...t, icon: t.icon ? { ...t.icon } : t.icon }))
|
|
25
|
+
: [],
|
|
24
26
|
mainAction: value?.mainAction,
|
|
25
27
|
hideJoystick: value?.hideJoystick ?? false,
|
|
26
28
|
hideCrosshair: value?.hideCrosshair ?? false
|
|
@@ -32,7 +34,7 @@ function defineTouchScreenControlsComponent(engine) {
|
|
|
32
34
|
for (const input of value.touchInputs)
|
|
33
35
|
byAction.set(input.inputAction, input);
|
|
34
36
|
for (const action of actions)
|
|
35
|
-
byAction.set(action, { inputAction: action, hide: true });
|
|
37
|
+
byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true });
|
|
36
38
|
value.touchInputs = [...byAction.values()];
|
|
37
39
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
38
40
|
}
|
|
@@ -59,10 +61,20 @@ function defineTouchScreenControlsComponent(engine) {
|
|
|
59
61
|
value.hideJoystick = true;
|
|
60
62
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
61
63
|
},
|
|
64
|
+
showJoystick() {
|
|
65
|
+
const value = current();
|
|
66
|
+
value.hideJoystick = false;
|
|
67
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
68
|
+
},
|
|
62
69
|
hideCrosshair() {
|
|
63
70
|
const value = current();
|
|
64
71
|
value.hideCrosshair = true;
|
|
65
72
|
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
73
|
+
},
|
|
74
|
+
showCrosshair() {
|
|
75
|
+
const value = current();
|
|
76
|
+
value.hideCrosshair = false;
|
|
77
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
66
78
|
}
|
|
67
79
|
};
|
|
68
80
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.25.1-
|
|
4
|
+
"version": "7.25.1-30570000030.commit-eaa1fa5",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
36
|
"typings": "./dist/index.d.ts",
|
|
37
|
-
"commit": "
|
|
37
|
+
"commit": "eaa1fa58d4deeb7a4102151ad91bd857be38023b"
|
|
38
38
|
}
|