@dcl/ecs 7.25.1-30447792919.commit-c06a494 → 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.
- package/dist/components/extended/TouchScreenControls.d.ts +30 -0
- package/dist/components/extended/TouchScreenControls.js +77 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_shape.gen.d.ts +0 -8
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_shape.gen.js +0 -9
- package/dist/components/generated/pb/google/protobuf/descriptor.gen.d.ts +1 -640
- package/dist/components/generated/pb/google/protobuf/descriptor.gen.js +4 -260
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +3 -0
- package/dist/components/types.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/systems/triggerArea.js +2 -1
- package/dist-cjs/components/extended/TouchScreenControls.d.ts +30 -0
- package/dist-cjs/components/extended/TouchScreenControls.js +81 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_shape.gen.d.ts +0 -8
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_shape.gen.js +1 -10
- package/dist-cjs/components/generated/pb/google/protobuf/descriptor.gen.d.ts +1 -640
- package/dist-cjs/components/generated/pb/google/protobuf/descriptor.gen.js +5 -261
- package/dist-cjs/components/index.d.ts +2 -0
- package/dist-cjs/components/index.js +5 -1
- package/dist-cjs/components/types.d.ts +1 -0
- package/dist-cjs/index.d.ts +2 -1
- package/dist-cjs/index.js +3 -1
- package/dist-cjs/systems/triggerArea.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
|
|
2
|
+
import { PBTouchScreenControls } from '../generated/index.gen';
|
|
3
|
+
import { InputAction } from '../generated/pb/decentraland/sdk/components/common/input_action.gen';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
* TouchScreenControls with convenience helpers. All helpers write the component onto the
|
|
7
|
+
* RootEntity (where the client reads it) and merge with the current value.
|
|
8
|
+
*/
|
|
9
|
+
export interface TouchScreenControlsComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBTouchScreenControls> {
|
|
10
|
+
/** Hide every on-screen gamepad button. */
|
|
11
|
+
hideAll(): void;
|
|
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
|
+
*/
|
|
16
|
+
showAll(): void;
|
|
17
|
+
/** Hide the given on-screen buttons (merged into the current config). */
|
|
18
|
+
hide(actions: InputAction[]): void;
|
|
19
|
+
/** Set which action the large central button triggers. */
|
|
20
|
+
setMainAction(action: InputAction): void;
|
|
21
|
+
/** Hide the native virtual joystick. */
|
|
22
|
+
hideJoystick(): void;
|
|
23
|
+
/** Show the native virtual joystick. */
|
|
24
|
+
showJoystick(): void;
|
|
25
|
+
/** Hide the on-screen crosshair / reticle. */
|
|
26
|
+
hideCrosshair(): void;
|
|
27
|
+
/** Show the on-screen crosshair / reticle. */
|
|
28
|
+
showCrosshair(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function defineTouchScreenControlsComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TouchScreenControlsComponentDefinitionExtended;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { TouchScreenControls } from '../generated/index.gen';
|
|
2
|
+
const ROOT_ENTITY = 0;
|
|
3
|
+
// Every on-screen gamepad action button.
|
|
4
|
+
const ALL_BUTTONS = [
|
|
5
|
+
0 /* InputAction.IA_POINTER */,
|
|
6
|
+
1 /* InputAction.IA_PRIMARY */,
|
|
7
|
+
2 /* InputAction.IA_SECONDARY */,
|
|
8
|
+
8 /* InputAction.IA_JUMP */,
|
|
9
|
+
10 /* InputAction.IA_ACTION_3 */,
|
|
10
|
+
11 /* InputAction.IA_ACTION_4 */,
|
|
11
|
+
12 /* InputAction.IA_ACTION_5 */,
|
|
12
|
+
13 /* InputAction.IA_ACTION_6 */
|
|
13
|
+
];
|
|
14
|
+
export function defineTouchScreenControlsComponent(engine) {
|
|
15
|
+
const theComponent = TouchScreenControls(engine);
|
|
16
|
+
// A mutable copy of the current RootEntity value (or a fresh default).
|
|
17
|
+
function current() {
|
|
18
|
+
const value = theComponent.getOrNull(ROOT_ENTITY);
|
|
19
|
+
return {
|
|
20
|
+
touchInputs: value?.touchInputs
|
|
21
|
+
? value.touchInputs.map((t) => ({ ...t, icon: t.icon ? { ...t.icon } : t.icon }))
|
|
22
|
+
: [],
|
|
23
|
+
mainAction: value?.mainAction,
|
|
24
|
+
hideJoystick: value?.hideJoystick ?? false,
|
|
25
|
+
hideCrosshair: value?.hideCrosshair ?? false
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function setHidden(actions) {
|
|
29
|
+
const value = current();
|
|
30
|
+
const byAction = new Map();
|
|
31
|
+
for (const input of value.touchInputs)
|
|
32
|
+
byAction.set(input.inputAction, input);
|
|
33
|
+
for (const action of actions)
|
|
34
|
+
byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true });
|
|
35
|
+
value.touchInputs = [...byAction.values()];
|
|
36
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
...theComponent,
|
|
40
|
+
hideAll() {
|
|
41
|
+
setHidden(ALL_BUTTONS);
|
|
42
|
+
},
|
|
43
|
+
showAll() {
|
|
44
|
+
const value = current();
|
|
45
|
+
value.touchInputs = [];
|
|
46
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
47
|
+
},
|
|
48
|
+
hide(actions) {
|
|
49
|
+
setHidden(actions);
|
|
50
|
+
},
|
|
51
|
+
setMainAction(action) {
|
|
52
|
+
const value = current();
|
|
53
|
+
value.mainAction = action;
|
|
54
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
55
|
+
},
|
|
56
|
+
hideJoystick() {
|
|
57
|
+
const value = current();
|
|
58
|
+
value.hideJoystick = true;
|
|
59
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
60
|
+
},
|
|
61
|
+
showJoystick() {
|
|
62
|
+
const value = current();
|
|
63
|
+
value.hideJoystick = false;
|
|
64
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
65
|
+
},
|
|
66
|
+
hideCrosshair() {
|
|
67
|
+
const value = current();
|
|
68
|
+
value.hideCrosshair = true;
|
|
69
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
70
|
+
},
|
|
71
|
+
showCrosshair() {
|
|
72
|
+
const value = current();
|
|
73
|
+
value.hideCrosshair = false;
|
|
74
|
+
theComponent.createOrReplace(ROOT_ENTITY, value);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import _m0 from "protobufjs/minimal";
|
|
2
2
|
import { Color3 } from "../../common/colors.gen";
|
|
3
|
-
/** Mask for which bones an animation applies to. */
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare const enum AvatarEmoteMask {
|
|
8
|
-
AEM_FULL_BODY = 0,
|
|
9
|
-
AEM_UPPER_BODY = 1
|
|
10
|
-
}
|
|
11
3
|
/**
|
|
12
4
|
* The AvatarShape component contains the information required to draw and animate avatar, acting as
|
|
13
5
|
* a simplified GLTF container for this specific case.
|
|
@@ -3,15 +3,6 @@ import Long from "long";
|
|
|
3
3
|
import _m0 from "protobufjs/minimal";
|
|
4
4
|
import { Color3 } from "../../common/colors.gen";
|
|
5
5
|
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
6
|
-
/** Mask for which bones an animation applies to. */
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export var AvatarEmoteMask;
|
|
11
|
-
(function (AvatarEmoteMask) {
|
|
12
|
-
AvatarEmoteMask[AvatarEmoteMask["AEM_FULL_BODY"] = 0] = "AEM_FULL_BODY";
|
|
13
|
-
AvatarEmoteMask[AvatarEmoteMask["AEM_UPPER_BODY"] = 1] = "AEM_UPPER_BODY";
|
|
14
|
-
})(AvatarEmoteMask || (AvatarEmoteMask = {}));
|
|
15
6
|
function createBasePBAvatarShape() {
|
|
16
7
|
return {
|
|
17
8
|
id: "",
|