@dcl/ecs 7.19.0 → 7.19.1-21592078908.commit-9452d68
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/generated/AssetLoad.gen.d.ts +1 -0
- package/dist/components/generated/AssetLoad.gen.js +25 -0
- package/dist/components/generated/AssetLoadLoadingState.gen.d.ts +1 -0
- package/dist/components/generated/AssetLoadLoadingState.gen.js +25 -0
- package/dist/components/generated/component-names.gen.js +2 -0
- package/dist/components/generated/global.gen.d.ts +4 -0
- package/dist/components/generated/global.gen.js +2 -0
- package/dist/components/generated/index.gen.d.ts +8 -0
- package/dist/components/generated/index.gen.js +12 -0
- package/dist/components/generated/pb/decentraland/sdk/components/asset_load.gen.d.ts +15 -0
- package/dist/components/generated/pb/decentraland/sdk/components/asset_load.gen.js +41 -0
- package/dist/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.d.ts +25 -0
- package/dist/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.js +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/runtime/globals.d.ts +4 -0
- package/dist/runtime/globals.js +18 -0
- package/dist/runtime/initialization/index.d.ts +7 -0
- package/dist/runtime/initialization/index.js +12 -4
- package/dist/systems/assetLoad.d.ts +13 -0
- package/dist/systems/assetLoad.js +47 -0
- package/dist/systems/tween.js +2 -1
- package/dist-cjs/components/generated/AssetLoad.gen.d.ts +1 -0
- package/dist-cjs/components/generated/AssetLoad.gen.js +28 -0
- package/dist-cjs/components/generated/AssetLoadLoadingState.gen.d.ts +1 -0
- package/dist-cjs/components/generated/AssetLoadLoadingState.gen.js +28 -0
- package/dist-cjs/components/generated/component-names.gen.js +2 -0
- package/dist-cjs/components/generated/global.gen.d.ts +4 -0
- package/dist-cjs/components/generated/global.gen.js +3 -1
- package/dist-cjs/components/generated/index.gen.d.ts +8 -0
- package/dist-cjs/components/generated/index.gen.js +16 -2
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/asset_load.gen.d.ts +15 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/asset_load.gen.js +47 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.d.ts +25 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.js +65 -0
- package/dist-cjs/index.d.ts +1 -0
- package/dist-cjs/index.js +1 -0
- package/dist-cjs/runtime/globals.d.ts +4 -0
- package/dist-cjs/runtime/globals.js +23 -0
- package/dist-cjs/runtime/initialization/index.d.ts +7 -0
- package/dist-cjs/runtime/initialization/index.js +13 -5
- package/dist-cjs/systems/assetLoad.d.ts +13 -0
- package/dist-cjs/systems/assetLoad.js +74 -0
- package/dist-cjs/systems/tween.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export const AssetLoadSchema = {
|
|
6
|
+
COMPONENT_ID: 1213,
|
|
7
|
+
serialize(value, builder) {
|
|
8
|
+
const writer = PBAssetLoad.encode(value);
|
|
9
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
10
|
+
builder.writeBuffer(buffer, false);
|
|
11
|
+
},
|
|
12
|
+
deserialize(reader) {
|
|
13
|
+
return PBAssetLoad.decode(reader.buffer(), reader.remainingBytes());
|
|
14
|
+
},
|
|
15
|
+
create() {
|
|
16
|
+
// TODO: this is a hack.
|
|
17
|
+
return PBAssetLoad.decode(new Uint8Array());
|
|
18
|
+
},
|
|
19
|
+
jsonSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {},
|
|
22
|
+
serializationType: "protocol-buffer",
|
|
23
|
+
protocolBuffer: "PBAssetLoad"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export const AssetLoadLoadingStateSchema = {
|
|
6
|
+
COMPONENT_ID: 1214,
|
|
7
|
+
serialize(value, builder) {
|
|
8
|
+
const writer = PBAssetLoadLoadingState.encode(value);
|
|
9
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
10
|
+
builder.writeBuffer(buffer, false);
|
|
11
|
+
},
|
|
12
|
+
deserialize(reader) {
|
|
13
|
+
return PBAssetLoadLoadingState.decode(reader.buffer(), reader.remainingBytes());
|
|
14
|
+
},
|
|
15
|
+
create() {
|
|
16
|
+
// TODO: this is a hack.
|
|
17
|
+
return PBAssetLoadLoadingState.decode(new Uint8Array());
|
|
18
|
+
},
|
|
19
|
+
jsonSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {},
|
|
22
|
+
serializationType: "protocol-buffer",
|
|
23
|
+
protocolBuffer: "PBAssetLoadLoadingState"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LastWriteWinElementSetComponentDefinition, GrowOnlyValueSetComponentDefinition } from '../../engine/component';
|
|
2
2
|
export * from './index.gen';
|
|
3
|
+
import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
|
|
4
|
+
import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
3
5
|
import { PBAudioEvent } from './pb/decentraland/sdk/components/audio_event.gen';
|
|
4
6
|
import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
|
|
5
7
|
import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -46,6 +48,8 @@ import { PBVideoEvent } from './pb/decentraland/sdk/components/video_event.gen';
|
|
|
46
48
|
import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen';
|
|
47
49
|
import { PBVirtualCamera } from './pb/decentraland/sdk/components/virtual_camera.gen';
|
|
48
50
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
51
|
+
/** @public */ export declare const AssetLoad: LastWriteWinElementSetComponentDefinition<PBAssetLoad>;
|
|
52
|
+
/** @public */ export declare const AssetLoadLoadingState: GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>;
|
|
49
53
|
/** @public */ export declare const AudioEvent: GrowOnlyValueSetComponentDefinition<PBAudioEvent>;
|
|
50
54
|
/** @public */ export declare const AudioSource: LastWriteWinElementSetComponentDefinition<PBAudioSource>;
|
|
51
55
|
/** @public */ export declare const AudioStream: LastWriteWinElementSetComponentDefinition<PBAudioStream>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { engine } from '../../runtime/initialization';
|
|
2
2
|
import * as components from './index.gen';
|
|
3
3
|
export * from './index.gen';
|
|
4
|
+
/** @public */ export const AssetLoad = /* @__PURE__ */ components.AssetLoad(engine);
|
|
5
|
+
/** @public */ export const AssetLoadLoadingState = /* @__PURE__ */ components.AssetLoadLoadingState(engine);
|
|
4
6
|
/** @public */ export const AudioEvent = /* @__PURE__ */ components.AudioEvent(engine);
|
|
5
7
|
/** @public */ export const AudioSource = /* @__PURE__ */ components.AudioSource(engine);
|
|
6
8
|
/** @public */ export const AudioStream = /* @__PURE__ */ components.AudioStream(engine);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IEngine } from '../../engine/types';
|
|
2
2
|
import { LastWriteWinElementSetComponentDefinition, GrowOnlyValueSetComponentDefinition } from '../../engine/component';
|
|
3
3
|
import { PBAnimator } from './pb/decentraland/sdk/components/animator.gen';
|
|
4
|
+
import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
|
|
5
|
+
import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
4
6
|
import { PBAudioEvent } from './pb/decentraland/sdk/components/audio_event.gen';
|
|
5
7
|
import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
|
|
6
8
|
import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -52,6 +54,8 @@ import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen
|
|
|
52
54
|
import { PBVirtualCamera } from './pb/decentraland/sdk/components/virtual_camera.gen';
|
|
53
55
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
54
56
|
export * from './pb/decentraland/sdk/components/animator.gen';
|
|
57
|
+
export * from './pb/decentraland/sdk/components/asset_load.gen';
|
|
58
|
+
export * from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
55
59
|
export * from './pb/decentraland/sdk/components/audio_event.gen';
|
|
56
60
|
export * from './pb/decentraland/sdk/components/audio_source.gen';
|
|
57
61
|
export * from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -105,6 +109,8 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
|
105
109
|
export type LwwComponentGetter<T extends LastWriteWinElementSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
106
110
|
export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
107
111
|
/** @public */ export declare const Animator: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
|
|
112
|
+
/** @public */ export declare const AssetLoad: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAssetLoad>>;
|
|
113
|
+
/** @public */ export declare const AssetLoadLoadingState: GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>>;
|
|
108
114
|
/** @public */ export declare const AudioEvent: GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAudioEvent>>;
|
|
109
115
|
/** @public */ export declare const AudioSource: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
|
|
110
116
|
/** @public */ export declare const AudioStream: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
|
|
@@ -158,6 +164,8 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
|
|
|
158
164
|
/** public */
|
|
159
165
|
export declare const componentDefinitionByName: {
|
|
160
166
|
"core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
|
|
167
|
+
"core::AssetLoad": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAssetLoad>>;
|
|
168
|
+
"core::AssetLoadLoadingState": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>>;
|
|
161
169
|
"core::AudioEvent": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAudioEvent>>;
|
|
162
170
|
"core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
|
|
163
171
|
"core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AnimatorSchema } from './Animator.gen';
|
|
2
|
+
import { AssetLoadSchema } from './AssetLoad.gen';
|
|
3
|
+
import { AssetLoadLoadingStateSchema } from './AssetLoadLoadingState.gen';
|
|
2
4
|
import { AudioEventSchema } from './AudioEvent.gen';
|
|
3
5
|
import { AudioSourceSchema } from './AudioSource.gen';
|
|
4
6
|
import { AudioStreamSchema } from './AudioStream.gen';
|
|
@@ -50,6 +52,8 @@ import { VideoPlayerSchema } from './VideoPlayer.gen';
|
|
|
50
52
|
import { VirtualCameraSchema } from './VirtualCamera.gen';
|
|
51
53
|
import { VisibilityComponentSchema } from './VisibilityComponent.gen';
|
|
52
54
|
export * from './pb/decentraland/sdk/components/animator.gen';
|
|
55
|
+
export * from './pb/decentraland/sdk/components/asset_load.gen';
|
|
56
|
+
export * from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
53
57
|
export * from './pb/decentraland/sdk/components/audio_event.gen';
|
|
54
58
|
export * from './pb/decentraland/sdk/components/audio_source.gen';
|
|
55
59
|
export * from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -102,6 +106,12 @@ export * from './pb/decentraland/sdk/components/virtual_camera.gen';
|
|
|
102
106
|
export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
103
107
|
/** @public */ export const Animator = engine =>
|
|
104
108
|
/* @__PURE__ */ engine.defineComponentFromSchema("core::Animator", AnimatorSchema);
|
|
109
|
+
/** @public */ export const AssetLoad = engine =>
|
|
110
|
+
/* @__PURE__ */ engine.defineComponentFromSchema("core::AssetLoad", AssetLoadSchema);
|
|
111
|
+
/** @public */ export const AssetLoadLoadingState = (engine) => /* @__PURE__ */ engine.defineValueSetComponentFromSchema("core::AssetLoadLoadingState", AssetLoadLoadingStateSchema, {
|
|
112
|
+
timestampFunction: (t) => t.timestamp,
|
|
113
|
+
maxElements: 100
|
|
114
|
+
});
|
|
105
115
|
/** @public */ export const AudioEvent = (engine) => /* @__PURE__ */ engine.defineValueSetComponentFromSchema("core::AudioEvent", AudioEventSchema, {
|
|
106
116
|
timestampFunction: (t) => t.timestamp,
|
|
107
117
|
maxElements: 100
|
|
@@ -215,6 +225,8 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
|
215
225
|
/** public */
|
|
216
226
|
export const componentDefinitionByName = /* @__PURE__ */ {
|
|
217
227
|
"core::Animator": Animator,
|
|
228
|
+
"core::AssetLoad": AssetLoad,
|
|
229
|
+
"core::AssetLoadLoadingState": AssetLoadLoadingState,
|
|
218
230
|
"core::AudioEvent": AudioEvent,
|
|
219
231
|
"core::AudioSource": AudioSource,
|
|
220
232
|
"core::AudioStream": AudioStream,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
/** AssetLoad component allows an entity to request the pre-loading of one or more assets by the renderer. */
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface PBAssetLoad {
|
|
7
|
+
assets: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare namespace PBAssetLoad {
|
|
13
|
+
function encode(message: PBAssetLoad, writer?: _m0.Writer): _m0.Writer;
|
|
14
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAssetLoad;
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
4
|
+
function createBasePBAssetLoad() {
|
|
5
|
+
return { assets: [] };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export var PBAssetLoad;
|
|
11
|
+
(function (PBAssetLoad) {
|
|
12
|
+
function encode(message, writer = _m0.Writer.create()) {
|
|
13
|
+
for (const v of message.assets) {
|
|
14
|
+
writer.uint32(10).string(v);
|
|
15
|
+
}
|
|
16
|
+
return writer;
|
|
17
|
+
}
|
|
18
|
+
PBAssetLoad.encode = encode;
|
|
19
|
+
function decode(input, length) {
|
|
20
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
21
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
22
|
+
const message = createBasePBAssetLoad();
|
|
23
|
+
while (reader.pos < end) {
|
|
24
|
+
const tag = reader.uint32();
|
|
25
|
+
switch (tag >>> 3) {
|
|
26
|
+
case 1:
|
|
27
|
+
if (tag !== 10) {
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
message.assets.push(reader.string());
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
reader.skipType(tag & 7);
|
|
37
|
+
}
|
|
38
|
+
return message;
|
|
39
|
+
}
|
|
40
|
+
PBAssetLoad.decode = decode;
|
|
41
|
+
})(PBAssetLoad || (PBAssetLoad = {}));
|
package/dist/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
import { LoadingState } from "./common/loading_state.gen";
|
|
3
|
+
/**
|
|
4
|
+
* AssetLoadLoadingState is set by the engine and provides information about
|
|
5
|
+
* the current state of the AssetLoad of an entity.
|
|
6
|
+
* The renderer appends a new object of this in each command, there can be many commands per frames
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface PBAssetLoadLoadingState {
|
|
12
|
+
/** current loading state */
|
|
13
|
+
currentState: LoadingState;
|
|
14
|
+
/** the asset being loaded (asset's scene path) */
|
|
15
|
+
asset: string;
|
|
16
|
+
/** monotonic counter */
|
|
17
|
+
timestamp: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare namespace PBAssetLoadLoadingState {
|
|
23
|
+
function encode(message: PBAssetLoadLoadingState, writer?: _m0.Writer): _m0.Writer;
|
|
24
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAssetLoadLoadingState;
|
|
25
|
+
}
|
package/dist/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
4
|
+
function createBasePBAssetLoadLoadingState() {
|
|
5
|
+
return { currentState: 0, asset: "", timestamp: 0 };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export var PBAssetLoadLoadingState;
|
|
11
|
+
(function (PBAssetLoadLoadingState) {
|
|
12
|
+
function encode(message, writer = _m0.Writer.create()) {
|
|
13
|
+
if (message.currentState !== 0) {
|
|
14
|
+
writer.uint32(8).int32(message.currentState);
|
|
15
|
+
}
|
|
16
|
+
if (message.asset !== "") {
|
|
17
|
+
writer.uint32(18).string(message.asset);
|
|
18
|
+
}
|
|
19
|
+
if (message.timestamp !== 0) {
|
|
20
|
+
writer.uint32(24).uint32(message.timestamp);
|
|
21
|
+
}
|
|
22
|
+
return writer;
|
|
23
|
+
}
|
|
24
|
+
PBAssetLoadLoadingState.encode = encode;
|
|
25
|
+
function decode(input, length) {
|
|
26
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
27
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
28
|
+
const message = createBasePBAssetLoadLoadingState();
|
|
29
|
+
while (reader.pos < end) {
|
|
30
|
+
const tag = reader.uint32();
|
|
31
|
+
switch (tag >>> 3) {
|
|
32
|
+
case 1:
|
|
33
|
+
if (tag !== 8) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
message.currentState = reader.int32();
|
|
37
|
+
continue;
|
|
38
|
+
case 2:
|
|
39
|
+
if (tag !== 18) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
message.asset = reader.string();
|
|
43
|
+
continue;
|
|
44
|
+
case 3:
|
|
45
|
+
if (tag !== 24) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
message.timestamp = reader.uint32();
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
reader.skipType(tag & 7);
|
|
55
|
+
}
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
PBAssetLoadLoadingState.decode = decode;
|
|
59
|
+
})(PBAssetLoadLoadingState || (PBAssetLoadLoadingState = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { cyclicParentingChecker } from './systems/cyclicParentingChecker';
|
|
|
7
7
|
export * from './systems/events';
|
|
8
8
|
export * from './systems/raycast';
|
|
9
9
|
export * from './systems/videoEvents';
|
|
10
|
+
export * from './systems/assetLoad';
|
|
10
11
|
export * from './systems/async-task';
|
|
11
12
|
export * from './systems/tween';
|
|
12
13
|
export * from './systems/triggerArea';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { cyclicParentingChecker } from './systems/cyclicParentingChecker';
|
|
|
8
8
|
export * from './systems/events';
|
|
9
9
|
export * from './systems/raycast';
|
|
10
10
|
export * from './systems/videoEvents';
|
|
11
|
+
export * from './systems/assetLoad';
|
|
11
12
|
export * from './systems/async-task';
|
|
12
13
|
export * from './systems/tween';
|
|
13
14
|
export * from './systems/triggerArea';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal utilities for standardized globalThis access.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Type-safe globalThis property access.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export function getGlobal(key) {
|
|
9
|
+
return globalThis[key];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sets a globalThis property as a polyfill (only if undefined/null).
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export function setGlobalPolyfill(key, value) {
|
|
16
|
+
;
|
|
17
|
+
globalThis[key] = globalThis[key] ?? value;
|
|
18
|
+
}
|
|
@@ -8,6 +8,7 @@ import { PointerEventsSystem } from '../../systems/events';
|
|
|
8
8
|
import { IInputSystem } from './../../engine/input';
|
|
9
9
|
import { RaycastSystem } from '../../systems/raycast';
|
|
10
10
|
import { VideoEventsSystem } from '../../systems/videoEvents';
|
|
11
|
+
import { AssetLoadLoadingStateSystem } from '../../systems/assetLoad';
|
|
11
12
|
import { TweenSystem } from '../../systems/tween';
|
|
12
13
|
import { TriggerAreaEventsSystem } from '../../systems/triggerArea';
|
|
13
14
|
import { createTimers, Timers } from '../helpers/timers';
|
|
@@ -52,6 +53,12 @@ export { RaycastSystem };
|
|
|
52
53
|
*/
|
|
53
54
|
export declare const videoEventsSystem: VideoEventsSystem;
|
|
54
55
|
export { VideoEventsSystem };
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
* Register callback functions to a particular entity on asset pre-load events.
|
|
59
|
+
*/
|
|
60
|
+
export declare const assetLoadLoadingStateSystem: AssetLoadLoadingStateSystem;
|
|
61
|
+
export { AssetLoadLoadingStateSystem };
|
|
55
62
|
/**
|
|
56
63
|
* @public
|
|
57
64
|
* Register callback functions to a particular entity on tween events.
|
|
@@ -8,10 +8,12 @@ import { createPointerEventsSystem } from '../../systems/events';
|
|
|
8
8
|
import { createInputSystem } from './../../engine/input';
|
|
9
9
|
import { createRaycastSystem } from '../../systems/raycast';
|
|
10
10
|
import { createVideoEventsSystem } from '../../systems/videoEvents';
|
|
11
|
+
import { createAssetLoadLoadingStateSystem } from '../../systems/assetLoad';
|
|
11
12
|
import { createTweenSystem } from '../../systems/tween';
|
|
12
13
|
import { pointerEventColliderChecker } from '../../systems/pointer-event-collider-checker';
|
|
13
14
|
import { createTriggerAreaEventsSystem } from '../../systems/triggerArea';
|
|
14
15
|
import { createTimers } from '../helpers/timers';
|
|
16
|
+
import { setGlobalPolyfill } from '../globals';
|
|
15
17
|
/**
|
|
16
18
|
* @public
|
|
17
19
|
* The engine is the part of the scene that sits in the middle and manages all of the other parts.
|
|
@@ -49,6 +51,12 @@ export const raycastSystem = /* @__PURE__ */ createRaycastSystem(engine);
|
|
|
49
51
|
* Register callback functions to a particular entity on video events.
|
|
50
52
|
*/
|
|
51
53
|
export const videoEventsSystem = /* @__PURE__ */ createVideoEventsSystem(engine);
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
* Register callback functions to a particular entity on asset pre-load events.
|
|
57
|
+
*/
|
|
58
|
+
export const assetLoadLoadingStateSystem =
|
|
59
|
+
/* @__PURE__ */ createAssetLoadLoadingStateSystem(engine);
|
|
52
60
|
/**
|
|
53
61
|
* @public
|
|
54
62
|
* Register callback functions to a particular entity on tween events.
|
|
@@ -65,10 +73,10 @@ export const triggerAreaEventsSystem = /* @__PURE__ */ createTriggerAreaEventsSy
|
|
|
65
73
|
*/
|
|
66
74
|
export const timers = /* @__PURE__ */ createTimers(engine);
|
|
67
75
|
export { createTimers };
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
setGlobalPolyfill('setTimeout', timers.setTimeout);
|
|
77
|
+
setGlobalPolyfill('clearTimeout', timers.clearTimeout);
|
|
78
|
+
setGlobalPolyfill('setInterval', timers.setInterval);
|
|
79
|
+
setGlobalPolyfill('clearInterval', timers.clearInterval);
|
|
72
80
|
/**
|
|
73
81
|
* Adds pointer event collider system only in DEV env
|
|
74
82
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DeepReadonlyObject, Entity } from '../engine';
|
|
2
|
+
import { PBAssetLoadLoadingState } from '../components';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type AssetLoadLoadingStateSystemCallback = (event: DeepReadonlyObject<PBAssetLoadLoadingState>) => void;
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface AssetLoadLoadingStateSystem {
|
|
11
|
+
removeAssetLoadLoadingStateEntity(entity: Entity): void;
|
|
12
|
+
registerAssetLoadLoadingStateEntity(entity: Entity, callback: AssetLoadLoadingStateSystemCallback): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as components from '../components';
|
|
2
|
+
import { EntityState } from '../engine/entity';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function createAssetLoadLoadingStateSystem(engine) {
|
|
7
|
+
const assetLoadLoadingStateComponent = components.AssetLoadLoadingState(engine);
|
|
8
|
+
const entitiesCallbackAssetLoadLoadingStateMap = new Map();
|
|
9
|
+
function registerAssetLoadLoadingStateEntity(entity, callback) {
|
|
10
|
+
entitiesCallbackAssetLoadLoadingStateMap.set(entity, { callback: callback, lastLoadingStateLength: 0 });
|
|
11
|
+
}
|
|
12
|
+
function removeAssetLoadLoadingStateEntity(entity) {
|
|
13
|
+
entitiesCallbackAssetLoadLoadingStateMap.delete(entity);
|
|
14
|
+
}
|
|
15
|
+
// @internal
|
|
16
|
+
engine.addSystem(function EventSystem() {
|
|
17
|
+
const garbageEntries = [];
|
|
18
|
+
for (const [entity, data] of entitiesCallbackAssetLoadLoadingStateMap) {
|
|
19
|
+
if (engine.getEntityState(entity) === EntityState.Removed) {
|
|
20
|
+
garbageEntries.push(entity);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const loadingState = assetLoadLoadingStateComponent.get(entity);
|
|
24
|
+
if (loadingState.size === 0 || loadingState.size === data.lastLoadingStateLength)
|
|
25
|
+
continue;
|
|
26
|
+
// Get last added values (can be multiple per tick, just not for the same asset)
|
|
27
|
+
const lastValues = Array.from(loadingState.values()).slice(data.lastLoadingStateLength);
|
|
28
|
+
lastValues.forEach((value) => {
|
|
29
|
+
data.callback(value);
|
|
30
|
+
});
|
|
31
|
+
entitiesCallbackAssetLoadLoadingStateMap.set(entity, {
|
|
32
|
+
callback: data.callback,
|
|
33
|
+
lastLoadingStateLength: loadingState.size
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Clean up garbage entries
|
|
37
|
+
garbageEntries.forEach((garbageEntity) => entitiesCallbackAssetLoadLoadingStateMap.delete(garbageEntity));
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
removeAssetLoadLoadingStateEntity(entity) {
|
|
41
|
+
removeAssetLoadLoadingStateEntity(entity);
|
|
42
|
+
},
|
|
43
|
+
registerAssetLoadLoadingStateEntity(entity, callback) {
|
|
44
|
+
registerAssetLoadLoadingStateEntity(entity, callback);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
package/dist/systems/tween.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as components from '../components';
|
|
2
2
|
import { ReadWriteByteBuffer } from '../serialization/ByteBuffer';
|
|
3
3
|
import { dataCompare } from './crdt/utils';
|
|
4
|
+
import { getGlobal } from '../runtime/globals';
|
|
4
5
|
/**
|
|
5
6
|
* Avoid creating multiple tween systems
|
|
6
7
|
*/
|
|
@@ -147,7 +148,7 @@ export function createTweenSystem(engine) {
|
|
|
147
148
|
}, Number.NEGATIVE_INFINITY);
|
|
148
149
|
}
|
|
149
150
|
// Some Explorers may not inject the flag and TweenSequence logic must be enabled in that case
|
|
150
|
-
const enableTweenSequenceLogic =
|
|
151
|
+
const enableTweenSequenceLogic = getGlobal('ENABLE_SDK_TWEEN_SEQUENCE');
|
|
151
152
|
if (enableTweenSequenceLogic !== false)
|
|
152
153
|
initializeTweenSequenceSystem();
|
|
153
154
|
const tweenSystem = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetLoadSchema = void 0;
|
|
4
|
+
const asset_load_gen_1 = require("./pb/decentraland/sdk/components/asset_load.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.AssetLoadSchema = {
|
|
9
|
+
COMPONENT_ID: 1213,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = asset_load_gen_1.PBAssetLoad.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return asset_load_gen_1.PBAssetLoad.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return asset_load_gen_1.PBAssetLoad.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBAssetLoad"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetLoadLoadingStateSchema = void 0;
|
|
4
|
+
const asset_load_loading_state_gen_1 = require("./pb/decentraland/sdk/components/asset_load_loading_state.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.AssetLoadLoadingStateSchema = {
|
|
9
|
+
COMPONENT_ID: 1214,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = asset_load_loading_state_gen_1.PBAssetLoadLoadingState.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return asset_load_loading_state_gen_1.PBAssetLoadLoadingState.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return asset_load_loading_state_gen_1.PBAssetLoadLoadingState.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBAssetLoadLoadingState"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -7,6 +7,8 @@ exports.coreComponentMappings = void 0;
|
|
|
7
7
|
exports.coreComponentMappings = {
|
|
8
8
|
"core::Transform": 1,
|
|
9
9
|
"core::Animator": 1042,
|
|
10
|
+
"core::AssetLoad": 1213,
|
|
11
|
+
"core::AssetLoadLoadingState": 1214,
|
|
10
12
|
"core::AudioEvent": 1105,
|
|
11
13
|
"core::AudioSource": 1020,
|
|
12
14
|
"core::AudioStream": 1021,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LastWriteWinElementSetComponentDefinition, GrowOnlyValueSetComponentDefinition } from '../../engine/component';
|
|
2
2
|
export * from './index.gen';
|
|
3
|
+
import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
|
|
4
|
+
import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
3
5
|
import { PBAudioEvent } from './pb/decentraland/sdk/components/audio_event.gen';
|
|
4
6
|
import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
|
|
5
7
|
import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -46,6 +48,8 @@ import { PBVideoEvent } from './pb/decentraland/sdk/components/video_event.gen';
|
|
|
46
48
|
import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen';
|
|
47
49
|
import { PBVirtualCamera } from './pb/decentraland/sdk/components/virtual_camera.gen';
|
|
48
50
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
51
|
+
/** @public */ export declare const AssetLoad: LastWriteWinElementSetComponentDefinition<PBAssetLoad>;
|
|
52
|
+
/** @public */ export declare const AssetLoadLoadingState: GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>;
|
|
49
53
|
/** @public */ export declare const AudioEvent: GrowOnlyValueSetComponentDefinition<PBAudioEvent>;
|
|
50
54
|
/** @public */ export declare const AudioSource: LastWriteWinElementSetComponentDefinition<PBAudioSource>;
|
|
51
55
|
/** @public */ export declare const AudioStream: LastWriteWinElementSetComponentDefinition<PBAudioStream>;
|
|
@@ -26,10 +26,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.TriggerAreaResult = exports.TriggerArea = exports.TextShape = exports.SkyboxTime = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PrimaryPointerInfo = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MainCamera = exports.LightSource = exports.InputModifier = exports.GltfNodeModifiers = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = void 0;
|
|
29
|
+
exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.TriggerAreaResult = exports.TriggerArea = exports.TextShape = exports.SkyboxTime = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PrimaryPointerInfo = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MainCamera = exports.LightSource = exports.InputModifier = exports.GltfNodeModifiers = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = exports.AssetLoadLoadingState = exports.AssetLoad = void 0;
|
|
30
30
|
const initialization_1 = require("../../runtime/initialization");
|
|
31
31
|
const components = __importStar(require("./index.gen"));
|
|
32
32
|
__exportStar(require("./index.gen"), exports);
|
|
33
|
+
/** @public */ exports.AssetLoad = components.AssetLoad(initialization_1.engine);
|
|
34
|
+
/** @public */ exports.AssetLoadLoadingState = components.AssetLoadLoadingState(initialization_1.engine);
|
|
33
35
|
/** @public */ exports.AudioEvent = components.AudioEvent(initialization_1.engine);
|
|
34
36
|
/** @public */ exports.AudioSource = components.AudioSource(initialization_1.engine);
|
|
35
37
|
/** @public */ exports.AudioStream = components.AudioStream(initialization_1.engine);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IEngine } from '../../engine/types';
|
|
2
2
|
import { LastWriteWinElementSetComponentDefinition, GrowOnlyValueSetComponentDefinition } from '../../engine/component';
|
|
3
3
|
import { PBAnimator } from './pb/decentraland/sdk/components/animator.gen';
|
|
4
|
+
import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
|
|
5
|
+
import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
4
6
|
import { PBAudioEvent } from './pb/decentraland/sdk/components/audio_event.gen';
|
|
5
7
|
import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
|
|
6
8
|
import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -52,6 +54,8 @@ import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen
|
|
|
52
54
|
import { PBVirtualCamera } from './pb/decentraland/sdk/components/virtual_camera.gen';
|
|
53
55
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
54
56
|
export * from './pb/decentraland/sdk/components/animator.gen';
|
|
57
|
+
export * from './pb/decentraland/sdk/components/asset_load.gen';
|
|
58
|
+
export * from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
|
|
55
59
|
export * from './pb/decentraland/sdk/components/audio_event.gen';
|
|
56
60
|
export * from './pb/decentraland/sdk/components/audio_source.gen';
|
|
57
61
|
export * from './pb/decentraland/sdk/components/audio_stream.gen';
|
|
@@ -105,6 +109,8 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
|
105
109
|
export type LwwComponentGetter<T extends LastWriteWinElementSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
106
110
|
export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
107
111
|
/** @public */ export declare const Animator: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
|
|
112
|
+
/** @public */ export declare const AssetLoad: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAssetLoad>>;
|
|
113
|
+
/** @public */ export declare const AssetLoadLoadingState: GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>>;
|
|
108
114
|
/** @public */ export declare const AudioEvent: GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAudioEvent>>;
|
|
109
115
|
/** @public */ export declare const AudioSource: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
|
|
110
116
|
/** @public */ export declare const AudioStream: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
|
|
@@ -158,6 +164,8 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
|
|
|
158
164
|
/** public */
|
|
159
165
|
export declare const componentDefinitionByName: {
|
|
160
166
|
"core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
|
|
167
|
+
"core::AssetLoad": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAssetLoad>>;
|
|
168
|
+
"core::AssetLoadLoadingState": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>>;
|
|
161
169
|
"core::AudioEvent": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBAudioEvent>>;
|
|
162
170
|
"core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
|
|
163
171
|
"core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
|
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.componentDefinitionByName = exports.VisibilityComponent = void 0;
|
|
17
|
+
exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.Tween = exports.TriggerAreaResult = exports.TriggerArea = exports.TextShape = exports.SkyboxTime = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PrimaryPointerInfo = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MeshRenderer = exports.MeshCollider = exports.Material = exports.MainCamera = exports.LightSource = exports.InputModifier = exports.GltfNodeModifiers = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = exports.AssetLoadLoadingState = exports.AssetLoad = exports.Animator = void 0;
|
|
18
|
+
exports.componentDefinitionByName = exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = void 0;
|
|
19
19
|
const Animator_gen_1 = require("./Animator.gen");
|
|
20
|
+
const AssetLoad_gen_1 = require("./AssetLoad.gen");
|
|
21
|
+
const AssetLoadLoadingState_gen_1 = require("./AssetLoadLoadingState.gen");
|
|
20
22
|
const AudioEvent_gen_1 = require("./AudioEvent.gen");
|
|
21
23
|
const AudioSource_gen_1 = require("./AudioSource.gen");
|
|
22
24
|
const AudioStream_gen_1 = require("./AudioStream.gen");
|
|
@@ -68,6 +70,8 @@ const VideoPlayer_gen_1 = require("./VideoPlayer.gen");
|
|
|
68
70
|
const VirtualCamera_gen_1 = require("./VirtualCamera.gen");
|
|
69
71
|
const VisibilityComponent_gen_1 = require("./VisibilityComponent.gen");
|
|
70
72
|
__exportStar(require("./pb/decentraland/sdk/components/animator.gen"), exports);
|
|
73
|
+
__exportStar(require("./pb/decentraland/sdk/components/asset_load.gen"), exports);
|
|
74
|
+
__exportStar(require("./pb/decentraland/sdk/components/asset_load_loading_state.gen"), exports);
|
|
71
75
|
__exportStar(require("./pb/decentraland/sdk/components/audio_event.gen"), exports);
|
|
72
76
|
__exportStar(require("./pb/decentraland/sdk/components/audio_source.gen"), exports);
|
|
73
77
|
__exportStar(require("./pb/decentraland/sdk/components/audio_stream.gen"), exports);
|
|
@@ -121,6 +125,14 @@ __exportStar(require("./pb/decentraland/sdk/components/visibility_component.gen"
|
|
|
121
125
|
/** @public */ const Animator = engine =>
|
|
122
126
|
/* @__PURE__ */ engine.defineComponentFromSchema("core::Animator", Animator_gen_1.AnimatorSchema);
|
|
123
127
|
exports.Animator = Animator;
|
|
128
|
+
/** @public */ const AssetLoad = engine =>
|
|
129
|
+
/* @__PURE__ */ engine.defineComponentFromSchema("core::AssetLoad", AssetLoad_gen_1.AssetLoadSchema);
|
|
130
|
+
exports.AssetLoad = AssetLoad;
|
|
131
|
+
/** @public */ const AssetLoadLoadingState = (engine) => /* @__PURE__ */ engine.defineValueSetComponentFromSchema("core::AssetLoadLoadingState", AssetLoadLoadingState_gen_1.AssetLoadLoadingStateSchema, {
|
|
132
|
+
timestampFunction: (t) => t.timestamp,
|
|
133
|
+
maxElements: 100
|
|
134
|
+
});
|
|
135
|
+
exports.AssetLoadLoadingState = AssetLoadLoadingState;
|
|
124
136
|
/** @public */ const AudioEvent = (engine) => /* @__PURE__ */ engine.defineValueSetComponentFromSchema("core::AudioEvent", AudioEvent_gen_1.AudioEventSchema, {
|
|
125
137
|
timestampFunction: (t) => t.timestamp,
|
|
126
138
|
maxElements: 100
|
|
@@ -284,6 +296,8 @@ exports.VisibilityComponent = VisibilityComponent;
|
|
|
284
296
|
/** public */
|
|
285
297
|
exports.componentDefinitionByName = {
|
|
286
298
|
"core::Animator": exports.Animator,
|
|
299
|
+
"core::AssetLoad": exports.AssetLoad,
|
|
300
|
+
"core::AssetLoadLoadingState": exports.AssetLoadLoadingState,
|
|
287
301
|
"core::AudioEvent": exports.AudioEvent,
|
|
288
302
|
"core::AudioSource": exports.AudioSource,
|
|
289
303
|
"core::AudioStream": exports.AudioStream,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
/** AssetLoad component allows an entity to request the pre-loading of one or more assets by the renderer. */
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface PBAssetLoad {
|
|
7
|
+
assets: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare namespace PBAssetLoad {
|
|
13
|
+
function encode(message: PBAssetLoad, writer?: _m0.Writer): _m0.Writer;
|
|
14
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAssetLoad;
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PBAssetLoad = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
9
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
10
|
+
function createBasePBAssetLoad() {
|
|
11
|
+
return { assets: [] };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
var PBAssetLoad;
|
|
17
|
+
(function (PBAssetLoad) {
|
|
18
|
+
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
19
|
+
for (const v of message.assets) {
|
|
20
|
+
writer.uint32(10).string(v);
|
|
21
|
+
}
|
|
22
|
+
return writer;
|
|
23
|
+
}
|
|
24
|
+
PBAssetLoad.encode = encode;
|
|
25
|
+
function decode(input, length) {
|
|
26
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
27
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
28
|
+
const message = createBasePBAssetLoad();
|
|
29
|
+
while (reader.pos < end) {
|
|
30
|
+
const tag = reader.uint32();
|
|
31
|
+
switch (tag >>> 3) {
|
|
32
|
+
case 1:
|
|
33
|
+
if (tag !== 10) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
message.assets.push(reader.string());
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
reader.skipType(tag & 7);
|
|
43
|
+
}
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
46
|
+
PBAssetLoad.decode = decode;
|
|
47
|
+
})(PBAssetLoad = exports.PBAssetLoad || (exports.PBAssetLoad = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
import { LoadingState } from "./common/loading_state.gen";
|
|
3
|
+
/**
|
|
4
|
+
* AssetLoadLoadingState is set by the engine and provides information about
|
|
5
|
+
* the current state of the AssetLoad of an entity.
|
|
6
|
+
* The renderer appends a new object of this in each command, there can be many commands per frames
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface PBAssetLoadLoadingState {
|
|
12
|
+
/** current loading state */
|
|
13
|
+
currentState: LoadingState;
|
|
14
|
+
/** the asset being loaded (asset's scene path) */
|
|
15
|
+
asset: string;
|
|
16
|
+
/** monotonic counter */
|
|
17
|
+
timestamp: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare namespace PBAssetLoadLoadingState {
|
|
23
|
+
function encode(message: PBAssetLoadLoadingState, writer?: _m0.Writer): _m0.Writer;
|
|
24
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAssetLoadLoadingState;
|
|
25
|
+
}
|
package/dist-cjs/components/generated/pb/decentraland/sdk/components/asset_load_loading_state.gen.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PBAssetLoadLoadingState = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
9
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
10
|
+
function createBasePBAssetLoadLoadingState() {
|
|
11
|
+
return { currentState: 0, asset: "", timestamp: 0 };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
var PBAssetLoadLoadingState;
|
|
17
|
+
(function (PBAssetLoadLoadingState) {
|
|
18
|
+
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
19
|
+
if (message.currentState !== 0) {
|
|
20
|
+
writer.uint32(8).int32(message.currentState);
|
|
21
|
+
}
|
|
22
|
+
if (message.asset !== "") {
|
|
23
|
+
writer.uint32(18).string(message.asset);
|
|
24
|
+
}
|
|
25
|
+
if (message.timestamp !== 0) {
|
|
26
|
+
writer.uint32(24).uint32(message.timestamp);
|
|
27
|
+
}
|
|
28
|
+
return writer;
|
|
29
|
+
}
|
|
30
|
+
PBAssetLoadLoadingState.encode = encode;
|
|
31
|
+
function decode(input, length) {
|
|
32
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
33
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
34
|
+
const message = createBasePBAssetLoadLoadingState();
|
|
35
|
+
while (reader.pos < end) {
|
|
36
|
+
const tag = reader.uint32();
|
|
37
|
+
switch (tag >>> 3) {
|
|
38
|
+
case 1:
|
|
39
|
+
if (tag !== 8) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
message.currentState = reader.int32();
|
|
43
|
+
continue;
|
|
44
|
+
case 2:
|
|
45
|
+
if (tag !== 18) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
message.asset = reader.string();
|
|
49
|
+
continue;
|
|
50
|
+
case 3:
|
|
51
|
+
if (tag !== 24) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
message.timestamp = reader.uint32();
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
reader.skipType(tag & 7);
|
|
61
|
+
}
|
|
62
|
+
return message;
|
|
63
|
+
}
|
|
64
|
+
PBAssetLoadLoadingState.decode = decode;
|
|
65
|
+
})(PBAssetLoadLoadingState = exports.PBAssetLoadLoadingState || (exports.PBAssetLoadLoadingState = {}));
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { cyclicParentingChecker } from './systems/cyclicParentingChecker';
|
|
|
7
7
|
export * from './systems/events';
|
|
8
8
|
export * from './systems/raycast';
|
|
9
9
|
export * from './systems/videoEvents';
|
|
10
|
+
export * from './systems/assetLoad';
|
|
10
11
|
export * from './systems/async-task';
|
|
11
12
|
export * from './systems/tween';
|
|
12
13
|
export * from './systems/triggerArea';
|
package/dist-cjs/index.js
CHANGED
|
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "cyclicParentingChecker", { enumerable: true, get
|
|
|
38
38
|
__exportStar(require("./systems/events"), exports);
|
|
39
39
|
__exportStar(require("./systems/raycast"), exports);
|
|
40
40
|
__exportStar(require("./systems/videoEvents"), exports);
|
|
41
|
+
__exportStar(require("./systems/assetLoad"), exports);
|
|
41
42
|
__exportStar(require("./systems/async-task"), exports);
|
|
42
43
|
__exportStar(require("./systems/tween"), exports);
|
|
43
44
|
__exportStar(require("./systems/triggerArea"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Internal utilities for standardized globalThis access.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setGlobalPolyfill = exports.getGlobal = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Type-safe globalThis property access.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function getGlobal(key) {
|
|
12
|
+
return globalThis[key];
|
|
13
|
+
}
|
|
14
|
+
exports.getGlobal = getGlobal;
|
|
15
|
+
/**
|
|
16
|
+
* Sets a globalThis property as a polyfill (only if undefined/null).
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function setGlobalPolyfill(key, value) {
|
|
20
|
+
;
|
|
21
|
+
globalThis[key] = globalThis[key] ?? value;
|
|
22
|
+
}
|
|
23
|
+
exports.setGlobalPolyfill = setGlobalPolyfill;
|
|
@@ -8,6 +8,7 @@ import { PointerEventsSystem } from '../../systems/events';
|
|
|
8
8
|
import { IInputSystem } from './../../engine/input';
|
|
9
9
|
import { RaycastSystem } from '../../systems/raycast';
|
|
10
10
|
import { VideoEventsSystem } from '../../systems/videoEvents';
|
|
11
|
+
import { AssetLoadLoadingStateSystem } from '../../systems/assetLoad';
|
|
11
12
|
import { TweenSystem } from '../../systems/tween';
|
|
12
13
|
import { TriggerAreaEventsSystem } from '../../systems/triggerArea';
|
|
13
14
|
import { createTimers, Timers } from '../helpers/timers';
|
|
@@ -52,6 +53,12 @@ export { RaycastSystem };
|
|
|
52
53
|
*/
|
|
53
54
|
export declare const videoEventsSystem: VideoEventsSystem;
|
|
54
55
|
export { VideoEventsSystem };
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
* Register callback functions to a particular entity on asset pre-load events.
|
|
59
|
+
*/
|
|
60
|
+
export declare const assetLoadLoadingStateSystem: AssetLoadLoadingStateSystem;
|
|
61
|
+
export { AssetLoadLoadingStateSystem };
|
|
55
62
|
/**
|
|
56
63
|
* @public
|
|
57
64
|
* Register callback functions to a particular entity on tween events.
|
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
* init and it'll be changing.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.executeTask = exports.createTimers = exports.timers = exports.triggerAreaEventsSystem = exports.tweenSystem = exports.videoEventsSystem = exports.raycastSystem = exports.pointerEventsSystem = exports.inputSystem = exports.engine = void 0;
|
|
7
|
+
exports.executeTask = exports.createTimers = exports.timers = exports.triggerAreaEventsSystem = exports.tweenSystem = exports.assetLoadLoadingStateSystem = exports.videoEventsSystem = exports.raycastSystem = exports.pointerEventsSystem = exports.inputSystem = exports.engine = void 0;
|
|
8
8
|
const engine_1 = require("../../engine");
|
|
9
9
|
const async_task_1 = require("../../systems/async-task");
|
|
10
10
|
const events_1 = require("../../systems/events");
|
|
11
11
|
const input_1 = require("./../../engine/input");
|
|
12
12
|
const raycast_1 = require("../../systems/raycast");
|
|
13
13
|
const videoEvents_1 = require("../../systems/videoEvents");
|
|
14
|
+
const assetLoad_1 = require("../../systems/assetLoad");
|
|
14
15
|
const tween_1 = require("../../systems/tween");
|
|
15
16
|
const pointer_event_collider_checker_1 = require("../../systems/pointer-event-collider-checker");
|
|
16
17
|
const triggerArea_1 = require("../../systems/triggerArea");
|
|
17
18
|
const timers_1 = require("../helpers/timers");
|
|
18
19
|
Object.defineProperty(exports, "createTimers", { enumerable: true, get: function () { return timers_1.createTimers; } });
|
|
20
|
+
const globals_1 = require("../globals");
|
|
19
21
|
/**
|
|
20
22
|
* @public
|
|
21
23
|
* The engine is the part of the scene that sits in the middle and manages all of the other parts.
|
|
@@ -53,6 +55,12 @@ exports.raycastSystem = (0, raycast_1.createRaycastSystem)(exports.engine);
|
|
|
53
55
|
* Register callback functions to a particular entity on video events.
|
|
54
56
|
*/
|
|
55
57
|
exports.videoEventsSystem = (0, videoEvents_1.createVideoEventsSystem)(exports.engine);
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
* Register callback functions to a particular entity on asset pre-load events.
|
|
61
|
+
*/
|
|
62
|
+
exports.assetLoadLoadingStateSystem =
|
|
63
|
+
/* @__PURE__ */ (0, assetLoad_1.createAssetLoadLoadingStateSystem)(exports.engine);
|
|
56
64
|
/**
|
|
57
65
|
* @public
|
|
58
66
|
* Register callback functions to a particular entity on tween events.
|
|
@@ -68,10 +76,10 @@ exports.triggerAreaEventsSystem = (0, triggerArea_1.createTriggerAreaEventsSyste
|
|
|
68
76
|
* Timer utilities for delayed and repeated execution.
|
|
69
77
|
*/
|
|
70
78
|
exports.timers = (0, timers_1.createTimers)(exports.engine);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
(0, globals_1.setGlobalPolyfill)('setTimeout', exports.timers.setTimeout);
|
|
80
|
+
(0, globals_1.setGlobalPolyfill)('clearTimeout', exports.timers.clearTimeout);
|
|
81
|
+
(0, globals_1.setGlobalPolyfill)('setInterval', exports.timers.setInterval);
|
|
82
|
+
(0, globals_1.setGlobalPolyfill)('clearInterval', exports.timers.clearInterval);
|
|
75
83
|
/**
|
|
76
84
|
* Adds pointer event collider system only in DEV env
|
|
77
85
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DeepReadonlyObject, Entity } from '../engine';
|
|
2
|
+
import { PBAssetLoadLoadingState } from '../components';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type AssetLoadLoadingStateSystemCallback = (event: DeepReadonlyObject<PBAssetLoadLoadingState>) => void;
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface AssetLoadLoadingStateSystem {
|
|
11
|
+
removeAssetLoadLoadingStateEntity(entity: Entity): void;
|
|
12
|
+
registerAssetLoadLoadingStateEntity(entity: Entity, callback: AssetLoadLoadingStateSystemCallback): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createAssetLoadLoadingStateSystem = void 0;
|
|
27
|
+
const components = __importStar(require("../components"));
|
|
28
|
+
const entity_1 = require("../engine/entity");
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
function createAssetLoadLoadingStateSystem(engine) {
|
|
33
|
+
const assetLoadLoadingStateComponent = components.AssetLoadLoadingState(engine);
|
|
34
|
+
const entitiesCallbackAssetLoadLoadingStateMap = new Map();
|
|
35
|
+
function registerAssetLoadLoadingStateEntity(entity, callback) {
|
|
36
|
+
entitiesCallbackAssetLoadLoadingStateMap.set(entity, { callback: callback, lastLoadingStateLength: 0 });
|
|
37
|
+
}
|
|
38
|
+
function removeAssetLoadLoadingStateEntity(entity) {
|
|
39
|
+
entitiesCallbackAssetLoadLoadingStateMap.delete(entity);
|
|
40
|
+
}
|
|
41
|
+
// @internal
|
|
42
|
+
engine.addSystem(function EventSystem() {
|
|
43
|
+
const garbageEntries = [];
|
|
44
|
+
for (const [entity, data] of entitiesCallbackAssetLoadLoadingStateMap) {
|
|
45
|
+
if (engine.getEntityState(entity) === entity_1.EntityState.Removed) {
|
|
46
|
+
garbageEntries.push(entity);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const loadingState = assetLoadLoadingStateComponent.get(entity);
|
|
50
|
+
if (loadingState.size === 0 || loadingState.size === data.lastLoadingStateLength)
|
|
51
|
+
continue;
|
|
52
|
+
// Get last added values (can be multiple per tick, just not for the same asset)
|
|
53
|
+
const lastValues = Array.from(loadingState.values()).slice(data.lastLoadingStateLength);
|
|
54
|
+
lastValues.forEach((value) => {
|
|
55
|
+
data.callback(value);
|
|
56
|
+
});
|
|
57
|
+
entitiesCallbackAssetLoadLoadingStateMap.set(entity, {
|
|
58
|
+
callback: data.callback,
|
|
59
|
+
lastLoadingStateLength: loadingState.size
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Clean up garbage entries
|
|
63
|
+
garbageEntries.forEach((garbageEntity) => entitiesCallbackAssetLoadLoadingStateMap.delete(garbageEntity));
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
removeAssetLoadLoadingStateEntity(entity) {
|
|
67
|
+
removeAssetLoadLoadingStateEntity(entity);
|
|
68
|
+
},
|
|
69
|
+
registerAssetLoadLoadingStateEntity(entity, callback) {
|
|
70
|
+
registerAssetLoadLoadingStateEntity(entity, callback);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.createAssetLoadLoadingStateSystem = createAssetLoadLoadingStateSystem;
|
|
@@ -27,6 +27,7 @@ exports.createTweenSystem = void 0;
|
|
|
27
27
|
const components = __importStar(require("../components"));
|
|
28
28
|
const ByteBuffer_1 = require("../serialization/ByteBuffer");
|
|
29
29
|
const utils_1 = require("./crdt/utils");
|
|
30
|
+
const globals_1 = require("../runtime/globals");
|
|
30
31
|
/**
|
|
31
32
|
* Avoid creating multiple tween systems
|
|
32
33
|
*/
|
|
@@ -173,7 +174,7 @@ function createTweenSystem(engine) {
|
|
|
173
174
|
}, Number.NEGATIVE_INFINITY);
|
|
174
175
|
}
|
|
175
176
|
// Some Explorers may not inject the flag and TweenSequence logic must be enabled in that case
|
|
176
|
-
const enableTweenSequenceLogic =
|
|
177
|
+
const enableTweenSequenceLogic = (0, globals_1.getGlobal)('ENABLE_SDK_TWEEN_SEQUENCE');
|
|
177
178
|
if (enableTweenSequenceLogic !== false)
|
|
178
179
|
initializeTweenSequenceSystem();
|
|
179
180
|
const tweenSystem = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.19.
|
|
4
|
+
"version": "7.19.1-21592078908.commit-9452d68",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"files": [
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"typings": "./dist/index.d.ts",
|
|
36
|
-
"commit": "
|
|
36
|
+
"commit": "9452d683ec9942986d9ad6d75a802395c2976f31"
|
|
37
37
|
}
|