diff --git a/package-lock.json b/package-lock.json index 75c4d21cf..2bff2bf6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.0", - "@dcl/protocol": "1.0.0-11599848164.commit-ef74edc", + "@dcl/protocol": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-11842507344.commit-391965e.tgz", "@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1", "@dcl/ts-proto": "1.153.0", "@types/fs-extra": "^9.0.12", @@ -577,9 +577,10 @@ } }, "node_modules/@dcl/protocol": { - "version": "1.0.0-11599848164.commit-ef74edc", - "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11599848164.commit-ef74edc.tgz", - "integrity": "sha512-XSUOA0LbchlBUk5/BMJFBl0+qOm4UOIxwMGp38A1n4LQAatGO/RXjzReJRveqiFma+X7eq3e6+KCDqTLwepN0w==", + "version": "1.0.0-11842507344.commit-391965e", + "resolved": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-11842507344.commit-391965e.tgz", + "integrity": "sha512-IlLjiuFsHeTbvaYPnrnEsRGs5iuDXMlCSRA1gmLCXjRHU94+fxrGf0x+jvu/p9kEQ4RgwczW87YxrkMwgtkBOw==", + "license": "Apache-2.0", "dependencies": { "@dcl/ts-proto": "1.154.0" } @@ -8232,9 +8233,8 @@ } }, "@dcl/protocol": { - "version": "1.0.0-11599848164.commit-ef74edc", - "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11599848164.commit-ef74edc.tgz", - "integrity": "sha512-XSUOA0LbchlBUk5/BMJFBl0+qOm4UOIxwMGp38A1n4LQAatGO/RXjzReJRveqiFma+X7eq3e6+KCDqTLwepN0w==", + "version": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-11842507344.commit-391965e.tgz", + "integrity": "sha512-IlLjiuFsHeTbvaYPnrnEsRGs5iuDXMlCSRA1gmLCXjRHU94+fxrGf0x+jvu/p9kEQ4RgwczW87YxrkMwgtkBOw==", "requires": { "@dcl/ts-proto": "1.154.0" }, diff --git a/package.json b/package.json index 28538db1a..ecac58549 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/decentraland/js-sdk-toolchain/issues", "dependencies": { "@actions/core": "^1.10.0", - "@dcl/protocol": "1.0.0-11599848164.commit-ef74edc", + "@dcl/protocol": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-11842507344.commit-391965e.tgz", "@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1", "@dcl/ts-proto": "1.153.0", "@types/fs-extra": "^9.0.12", diff --git a/packages/@dcl/ecs/src/components/extended/Tween.ts b/packages/@dcl/ecs/src/components/extended/Tween.ts index 0eab96a3c..8e262b133 100644 --- a/packages/@dcl/ecs/src/components/extended/Tween.ts +++ b/packages/@dcl/ecs/src/components/extended/Tween.ts @@ -1,5 +1,5 @@ import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine' -import { Tween, PBTween, Move, Rotate, Scale } from '../generated/index.gen' +import { Tween, PBTween, Move, Rotate, Scale, TextureMove } from '../generated/index.gen' /** * @public @@ -17,6 +17,11 @@ export interface TweenHelper { * @returns a move mode tween */ Scale: (scale: Scale) => PBTween['mode'] + + /** + * @returns a texture move mode tween + */ + TextureMove: (textureMove: TextureMove) => PBTween['mode'] } /** @@ -47,6 +52,12 @@ const TweenHelper: TweenHelper = { $case: 'scale', scale } + }, + TextureMove(textureMove) { + return { + $case: 'textureMove', + textureMove + } } } diff --git a/packages/@dcl/ecs/src/systems/tween.ts b/packages/@dcl/ecs/src/systems/tween.ts index 6955244e2..5c289212b 100644 --- a/packages/@dcl/ecs/src/systems/tween.ts +++ b/packages/@dcl/ecs/src/systems/tween.ts @@ -142,6 +142,12 @@ export function createTweenSystem(engine: IEngine): TweenSystem { if (tween.mode?.$case === 'scale' && tween.mode.scale) { return { ...tween, mode: { ...tween.mode, scale: { start: tween.mode.scale.end, end: tween.mode.scale.start } } } } + if (tween.mode?.$case === 'textureMove' && tween.mode.textureMove) { + return { + ...tween, + mode: { ...tween.mode, textureMove: { start: tween.mode.textureMove.end, end: tween.mode.textureMove.start } } + } + } /* istanbul ignore next */ throw new Error('Invalid tween') diff --git a/packages/@dcl/playground-assets/etc/playground-assets.api.md b/packages/@dcl/playground-assets/etc/playground-assets.api.md index ab07bea40..56d6a835b 100644 --- a/packages/@dcl/playground-assets/etc/playground-assets.api.md +++ b/packages/@dcl/playground-assets/etc/playground-assets.api.md @@ -2889,6 +2889,9 @@ export interface PBTween { } | { $case: "scale"; scale: Scale; + } | { + $case: "textureMove"; + textureMove: TextureMove; } | undefined; playing?: boolean | undefined; } @@ -3891,8 +3894,10 @@ export const TextShape: LastWriteWinElementSetComponentDefinition; // @public (undocumented) export interface Texture { filterMode?: TextureFilterMode | undefined; + offset?: PBVector2 | undefined; // (undocumented) src: string; + tiling?: PBVector2 | undefined; wrapMode?: TextureWrapMode | undefined; } @@ -3930,6 +3935,30 @@ export interface TextureHelper { // @public export type TextureMode = 'nine-slices' | 'center' | 'stretch'; +// @public (undocumented) +export interface TextureMove { + // (undocumented) + end: PBVector2 | undefined; + movementType?: TextureMovementType | undefined; + // (undocumented) + start: PBVector2 | undefined; +} + +// @public (undocumented) +export namespace TextureMove { + // (undocumented) + export function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMove; + // (undocumented) + export function encode(message: TextureMove, writer?: _m0.Writer): _m0.Writer; +} + +// @public (undocumented) +export const enum TextureMovementType { + TMT_OFFSET = 0, + // (undocumented) + TMT_TILING = 1 +} + // @public (undocumented) export interface TextureUnion { // (undocumented) @@ -4052,6 +4081,8 @@ export interface TweenHelper { Rotate: (rotate: Rotate) => PBTween['mode']; // (undocumented) Scale: (scale: Scale) => PBTween['mode']; + // (undocumented) + TextureMove: (textureMove: TextureMove) => PBTween['mode']; } // @public (undocumented) diff --git a/packages/@dcl/sdk-commands/package-lock.json b/packages/@dcl/sdk-commands/package-lock.json index d4487cfa7..959d5abad 100644 --- a/packages/@dcl/sdk-commands/package-lock.json +++ b/packages/@dcl/sdk-commands/package-lock.json @@ -15,7 +15,7 @@ "@dcl/inspector": "file:../inspector", "@dcl/linker-dapp": "^0.14.2", "@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be", - "@dcl/protocol": "1.0.0-11599848164.commit-ef74edc", + "@dcl/protocol": "1.0.0-11600356890.commit-8d83e14", "@dcl/quests-client": "^1.0.3", "@dcl/quests-manager": "^0.1.4", "@dcl/rpc": "^1.1.1", @@ -239,9 +239,9 @@ } }, "node_modules/@dcl/protocol": { - "version": "1.0.0-11599848164.commit-ef74edc", - "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11599848164.commit-ef74edc.tgz", - "integrity": "sha512-XSUOA0LbchlBUk5/BMJFBl0+qOm4UOIxwMGp38A1n4LQAatGO/RXjzReJRveqiFma+X7eq3e6+KCDqTLwepN0w==", + "version": "1.0.0-11600356890.commit-8d83e14", + "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11600356890.commit-8d83e14.tgz", + "integrity": "sha512-plaIZLpxkayPCW8rbM6S+EfKqjuiQ02I8KPbgGGaYw8SNi2SpTqUdARLn+GFW/FnDM9t/bLD9wMuBtUaIkW0EA==", "dependencies": { "@dcl/ts-proto": "1.154.0" } @@ -3228,9 +3228,9 @@ } }, "@dcl/protocol": { - "version": "1.0.0-11599848164.commit-ef74edc", - "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11599848164.commit-ef74edc.tgz", - "integrity": "sha512-XSUOA0LbchlBUk5/BMJFBl0+qOm4UOIxwMGp38A1n4LQAatGO/RXjzReJRveqiFma+X7eq3e6+KCDqTLwepN0w==", + "version": "1.0.0-11600356890.commit-8d83e14", + "resolved": "https://registry.npmjs.org/@dcl/protocol/-/protocol-1.0.0-11600356890.commit-8d83e14.tgz", + "integrity": "sha512-plaIZLpxkayPCW8rbM6S+EfKqjuiQ02I8KPbgGGaYw8SNi2SpTqUdARLn+GFW/FnDM9t/bLD9wMuBtUaIkW0EA==", "requires": { "@dcl/ts-proto": "1.154.0" } diff --git a/packages/@dcl/sdk-commands/package.json b/packages/@dcl/sdk-commands/package.json index aebff11ff..8a9c01cf0 100644 --- a/packages/@dcl/sdk-commands/package.json +++ b/packages/@dcl/sdk-commands/package.json @@ -13,7 +13,7 @@ "@dcl/inspector": "file:../inspector", "@dcl/linker-dapp": "^0.14.2", "@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be", - "@dcl/protocol": "1.0.0-11599848164.commit-ef74edc", + "@dcl/protocol": "1.0.0-11600356890.commit-8d83e14", "@dcl/quests-client": "^1.0.3", "@dcl/quests-manager": "^0.1.4", "@dcl/rpc": "^1.1.1", diff --git a/test/ecs/components/Material.spec.ts b/test/ecs/components/Material.spec.ts index a5f9c8e68..f10d1e517 100644 --- a/test/ecs/components/Material.spec.ts +++ b/test/ecs/components/Material.spec.ts @@ -77,7 +77,9 @@ describe('Generated Material ProtoBuf', () => { texture: { wrapMode: TextureWrapMode.TWM_MIRROR, filterMode: TextureFilterMode.TFM_POINT, - src: 'not-casla' + src: 'not-casla', + tiling: undefined, + offset: undefined } } }, @@ -87,7 +89,9 @@ describe('Generated Material ProtoBuf', () => { texture: { wrapMode: TextureWrapMode.TWM_MIRROR, filterMode: TextureFilterMode.TFM_TRILINEAR, - src: 'not-casla' + src: 'not-casla', + tiling: undefined, + offset: undefined } } }, diff --git a/test/ecs/components/Tween.spec.ts b/test/ecs/components/Tween.spec.ts index 654c776df..69fdd1f68 100644 --- a/test/ecs/components/Tween.spec.ts +++ b/test/ecs/components/Tween.spec.ts @@ -4,6 +4,9 @@ import { testComponentSerialization } from './assertion' describe('Generated Tween ProtoBuf', () => { const start = { x: 0, y: 0, z: 0 } const end = { x: 8, y: 8, z: 8 } + const start2d = { x: 0, y: 0 } + const end2d = { x: 8, y: 8 } + it('should serialize/deserialize move Tween', () => { const newEngine = Engine() const Tween = components.Tween(newEngine) @@ -31,5 +34,16 @@ describe('Generated Tween ProtoBuf', () => { playing: false, currentTime: 0 }) + + testComponentSerialization(Tween, { + duration: 1, + easingFunction: EasingFunction.EF_LINEAR, + mode: Tween.Mode.TextureMove({ + start: { ...start2d }, + end: { ...end2d } + }), + playing: false, + currentTime: 0 + }) }) }) diff --git a/test/ecs/components/UiBackground.spec.ts b/test/ecs/components/UiBackground.spec.ts index d260a7eea..984b73c8f 100644 --- a/test/ecs/components/UiBackground.spec.ts +++ b/test/ecs/components/UiBackground.spec.ts @@ -21,7 +21,9 @@ describe('Generated UiBackground ProtoBuf', () => { texture: { src: 'some-src', wrapMode: TextureWrapMode.TWM_CLAMP, - filterMode: TextureFilterMode.TFM_BILINEAR + filterMode: TextureFilterMode.TFM_BILINEAR, + offset: undefined, + tiling: undefined } } }, diff --git a/test/ecs/events/tween.spec.ts b/test/ecs/events/tween.spec.ts index 95a0fc3b5..cc1f2279f 100644 --- a/test/ecs/events/tween.spec.ts +++ b/test/ecs/events/tween.spec.ts @@ -10,7 +10,7 @@ import { components } from '../../../packages/@dcl/ecs/src' import { createTweenSystem } from '../../../packages/@dcl/ecs/src/systems/tween' -import { Quaternion, Vector3 } from '../../../packages/@dcl/sdk/math' +import { Quaternion, Vector2, Vector3 } from '../../../packages/@dcl/sdk/math' function mockTweenEngine(engine: IEngine, Tween: TweenComponentDefinitionExtended) { return async function (entity: Entity, mode?: PBTween['mode']) { @@ -103,6 +103,13 @@ describe('Tween System', () => { expect(Tween.get(entity).mode).toMatchCloseTo(Tween.Mode.Scale({ end: Vector3.Left(), start: Vector3.Right() })) }) + it('should change to backwards the TextureMove Tween when its completed', async () => { + await mockTween(entity, Tween.Mode.TextureMove({ start: Vector2.Zero(), end: Vector2.One() })) + await mockTweenStatus(entity) + expect(completed).toBeCalledTimes(1) + expect(Tween.get(entity).mode).toMatchCloseTo(Tween.Mode.TextureMove({ end: Vector2.Zero(), start: Vector2.One() })) + }) + it('should create a RESTART tweenSequence for the entity and restart the tween once its completed', async () => { TweenState.deleteFrom(entity) const tween = await mockTween(entity, Tween.Mode.Move({ start: Vector3.Forward(), end: Vector3.Down() })) diff --git a/test/snapshots/package-lock.json b/test/snapshots/package-lock.json index 401ef4a4b..41f5d71f2 100644 --- a/test/snapshots/package-lock.json +++ b/test/snapshots/package-lock.json @@ -168,7 +168,7 @@ "@dcl/inspector": "file:../inspector", "@dcl/linker-dapp": "^0.14.2", "@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be", - "@dcl/protocol": "1.0.0-11599848164.commit-ef74edc", + "@dcl/protocol": "1.0.0-11600356890.commit-8d83e14", "@dcl/quests-client": "^1.0.3", "@dcl/quests-manager": "^0.1.4", "@dcl/rpc": "^1.1.1",