Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/ai-agent-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ Uses esbuild with `platform: 'browser'`, `format: 'cjs'`, `target: 'es2020'`, an
| `-p, --port <number>` | HTTP port (auto-detected if omitted) |
| `--dclenv <env>` | Explorer environment: `org` (mainnet production, default), `zone` (staging), `today` |
| `--realm <name>` | Realm name shown in Explorer (default: `Localhost`) |
| `--web3` | Enable Web3 wallet integration in the preview |
| `--web3` | (deprecated) No effect; kept for backwards compatibility |
| `--skip-build` | Serve pre-built files without rebuilding |
| `--no-watch` | Disable file watching / hot reload |
| `--no-browser` | Don't auto-open Explorer |
| `--ci` | CI mode: disable browser and debug panel |
| `--debug` | Enable scene debug panel (on by default with `--explorer-alpha`) |
| `--explorer-alpha` | Use the new Alpha Explorer deeplink (default) |
| `--web-explorer` | Use legacy web-based Explorer |
| `--web, --bevy-web` | Open the preview in Bevy Web (`https://decentraland.org/bevy-web/`) instead of the desktop Explorer. Chrome 142+ requires the Local Network Access permission ("Apps on device" in 145+) for the page to reach the localhost preview server; the CLI prints instructions |
| `--mobile` | Print ASCII QR code for mobile preview |
| `--position <x,y>` | Initial spawn position (default: from `scene.json`) |
| `--skip-auth-screen` | Skip Explorer's authentication screen |
Expand Down
108 changes: 7 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
"dependencies": {
"@actions/core": "^1.10.0",
"@dcl/protocol": "1.0.0-30376440685.commit-2726089",
"@dcl/protocol": "1.0.0-30862383737.commit-36e5967",
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
"@dcl/ts-proto": "1.153.0",
"@types/fs-extra": "^9.0.12",
Expand Down
113 changes: 113 additions & 0 deletions packages/@dcl/ecs/src/components/extended/TouchScreenControls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { Entity, IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine'
import { TouchScreenControls, PBTouchScreenControls, PBTouchScreenControls_TouchInput } from '../generated/index.gen'
import { InputAction } from '../generated/pb/decentraland/sdk/components/common/input_action.gen'

const ROOT_ENTITY = 0 as Entity

// Every on-screen gamepad action button.
const ALL_BUTTONS: InputAction[] = [
InputAction.IA_POINTER,
InputAction.IA_PRIMARY,
InputAction.IA_SECONDARY,
InputAction.IA_JUMP,
InputAction.IA_ACTION_3,
InputAction.IA_ACTION_4,
InputAction.IA_ACTION_5,
InputAction.IA_ACTION_6
]

/**
* @public
* TouchScreenControls with convenience helpers. All helpers write the component onto the
* RootEntity (where the client reads it) and merge with the current value.
*/
export interface TouchScreenControlsComponentDefinitionExtended
extends LastWriteWinElementSetComponentDefinition<PBTouchScreenControls> {
/** Hide every on-screen gamepad button. */
hideAll(): void
/**
* Show every on-screen gamepad button (clears the button hide list).
* Does NOT change the joystick/crosshair — use `showJoystick()` / `showCrosshair()` for those.
*/
showAll(): void
/** Hide the given on-screen buttons (merged into the current config). */
hide(actions: InputAction[]): void
/** Set which action the large central button triggers. */
setMainAction(action: InputAction): void
/** Hide the native virtual joystick. */
hideJoystick(): void
/** Show the native virtual joystick. */
showJoystick(): void
/** Hide the on-screen crosshair / reticle. */
hideCrosshair(): void
/** Show the on-screen crosshair / reticle. */
showCrosshair(): void
}

export function defineTouchScreenControlsComponent(
engine: Pick<IEngine, 'defineComponentFromSchema'>
): TouchScreenControlsComponentDefinitionExtended {
const theComponent = TouchScreenControls(engine)

// A mutable copy of the current RootEntity value (or a fresh default).
function current(): PBTouchScreenControls {
const value = theComponent.getOrNull(ROOT_ENTITY)
return {
touchInputs: value?.touchInputs
? value.touchInputs.map((t) => ({ ...t, icon: t.icon ? { ...t.icon } : t.icon }))
: [],
mainAction: value?.mainAction,
hideJoystick: value?.hideJoystick ?? false,
hideCrosshair: value?.hideCrosshair ?? false
}
}

function setHidden(actions: InputAction[]): void {
const value = current()
const byAction = new Map<InputAction, PBTouchScreenControls_TouchInput>()
for (const input of value.touchInputs) byAction.set(input.inputAction, input)
for (const action of actions) byAction.set(action, { ...byAction.get(action), inputAction: action, hide: true })
value.touchInputs = [...byAction.values()]
theComponent.createOrReplace(ROOT_ENTITY, value)
}

return {
...theComponent,
hideAll(): void {
setHidden(ALL_BUTTONS)
},
showAll(): void {
const value = current()
value.touchInputs = []
theComponent.createOrReplace(ROOT_ENTITY, value)
},
hide(actions: InputAction[]): void {
setHidden(actions)
},
setMainAction(action: InputAction): void {
const value = current()
value.mainAction = action
theComponent.createOrReplace(ROOT_ENTITY, value)
},
hideJoystick(): void {
const value = current()
value.hideJoystick = true
theComponent.createOrReplace(ROOT_ENTITY, value)
},
showJoystick(): void {
const value = current()
value.hideJoystick = false
theComponent.createOrReplace(ROOT_ENTITY, value)
},
hideCrosshair(): void {
const value = current()
value.hideCrosshair = true
theComponent.createOrReplace(ROOT_ENTITY, value)
},
showCrosshair(): void {
const value = current()
value.hideCrosshair = false
theComponent.createOrReplace(ROOT_ENTITY, value)
}
}
}
8 changes: 8 additions & 0 deletions packages/@dcl/ecs/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import { defineInputModifierComponent, InputModifierComponentDefinitionExtended
import { defineLightSourceComponent, LightSourceComponentDefinitionExtended } from './extended/LightSource'
import { defineTriggerAreaComponent, TriggerAreaComponentDefinitionExtended } from './extended/TriggerArea'
import { defineParticleSystemComponent, ParticleSystemComponentDefinitionExtended } from './extended/ParticleSystem'
import {
defineTouchScreenControlsComponent,
TouchScreenControlsComponentDefinitionExtended
} from './extended/TouchScreenControls'
import defineTagsComponent, { TagsComponentDefinitionExtended } from './manual/Tags'

export * from './generated/index.gen'
Expand Down Expand Up @@ -87,6 +91,10 @@ export const TriggerArea: LwwComponentGetter<TriggerAreaComponentDefinitionExten
export const ParticleSystem: LwwComponentGetter<ParticleSystemComponentDefinitionExtended> = (engine) =>
defineParticleSystemComponent(engine)

/* @__PURE__ */
export const TouchScreenControls: LwwComponentGetter<TouchScreenControlsComponentDefinitionExtended> = (engine) =>
defineTouchScreenControlsComponent(engine)

/**
* @alpha
*/
Expand Down
1 change: 1 addition & 0 deletions packages/@dcl/ecs/src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type { INetowrkParent, INetowrkParentType } from './manual/NetworkParent'
export type { InputModifierHelper, InputModifierComponentDefinitionExtended } from './extended/InputModifier'
export type { LightSourceHelper, LightSourceComponentDefinitionExtended } from './extended/LightSource'
export type { TriggerAreaComponentDefinitionExtended } from './extended/TriggerArea'
export type { TouchScreenControlsComponentDefinitionExtended } from './extended/TouchScreenControls'
export type {
ParticleSystemHelper,
ParticleSystemComponentDefinitionExtended,
Expand Down
5 changes: 4 additions & 1 deletion packages/@dcl/ecs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import {
InputModifierComponentDefinitionExtended,
LightSourceComponentDefinitionExtended,
TriggerAreaComponentDefinitionExtended,
ParticleSystemComponentDefinitionExtended
ParticleSystemComponentDefinitionExtended,
TouchScreenControlsComponentDefinitionExtended
} from './components/types'
import { NameComponent } from './components/manual/Name'
import { TagsComponentDefinitionExtended } from './components/manual/Tags'
Expand All @@ -64,6 +65,8 @@ export const LightSource: LightSourceComponentDefinitionExtended = /* @__PURE__*
export const TriggerArea: TriggerAreaComponentDefinitionExtended = /* @__PURE__*/ components.TriggerArea(engine)
export const ParticleSystem: ParticleSystemComponentDefinitionExtended =
/* @__PURE__*/ components.ParticleSystem(engine)
export const TouchScreenControls: TouchScreenControlsComponentDefinitionExtended =
/* @__PURE__*/ components.TouchScreenControls(engine)

/**
* @alpha
Expand Down
18 changes: 17 additions & 1 deletion packages/@dcl/playground-assets/etc/playground-assets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,7 @@ export type EntityComponents = {
uiBackground: PBUiBackground;
uiInput: PBUiInput;
uiDropdown: PBUiDropdown;
uiInputBinding: PBUiInputBinding;
onMouseDown: Callback;
onMouseUp: Callback;
onMouseEnter: Callback;
Expand All @@ -1215,6 +1216,7 @@ export enum EntityMappingMode {
export interface EntityPropTypes extends Listeners {
key?: Key;
uiBackground?: UiBackgroundProps;
uiInputBinding?: PBUiInputBinding;
uiTransform?: UiTransformProps;
}

Expand Down Expand Up @@ -5111,8 +5113,22 @@ export const ToLinearSpace = 2.2;
// @public (undocumented)
export type ToOptional<T> = OnlyOptionalUndefinedTypes<T> & OnlyNonUndefinedTypes<T>;

// Warning: (ae-missing-release-tag) "TouchScreenControls" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const TouchScreenControls: LastWriteWinElementSetComponentDefinition<PBTouchScreenControls>;
export const TouchScreenControls: TouchScreenControlsComponentDefinitionExtended;

// @public
export interface TouchScreenControlsComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBTouchScreenControls> {
hide(actions: InputAction[]): void;
hideAll(): void;
hideCrosshair(): void;
hideJoystick(): void;
setMainAction(action: InputAction): void;
showAll(): void;
showCrosshair(): void;
showJoystick(): void;
}

// Warning: (ae-missing-release-tag) "Transform" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down
3 changes: 3 additions & 0 deletions packages/@dcl/react-ecs/src/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PBUiInputBinding } from '@dcl/ecs'
import { ReactEcs } from '../react-ecs'
import { Listeners } from './listeners/types'
import { UiBackgroundProps } from './uiBackground/types'
Expand All @@ -12,6 +13,8 @@ export interface EntityPropTypes extends Listeners {
uiTransform?: UiTransformProps
/** To define a background color or image */
uiBackground?: UiBackgroundProps
/** Bind input actions to this element, held down while it's pressed (touch or pointer) */
uiInputBinding?: PBUiInputBinding
/** Uinique key to identiy elments when iterating arrays */
key?: Key
}
Expand Down
3 changes: 2 additions & 1 deletion packages/@dcl/react-ecs/src/react-ecs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { PBUiBackground, PBUiText, PBUiTransform, PBUiInput, PBUiDropdown } from '@dcl/ecs'
import { PBUiBackground, PBUiText, PBUiTransform, PBUiInput, PBUiDropdown, PBUiInputBinding } from '@dcl/ecs'
import React from 'react'
import { Callback, Key } from './components'

Expand All @@ -19,6 +19,7 @@ export type EntityComponents = {
uiBackground: PBUiBackground
uiInput: PBUiInput
uiDropdown: PBUiDropdown
uiInputBinding: PBUiInputBinding
onMouseDown: Callback
onMouseUp: Callback
onMouseEnter: Callback
Expand Down
Loading
Loading