@dcl/playground-assets 7.0.6-3939099974.commit-727d673 → 7.0.6-3987590195.commit-4fc1536
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/alpha.d.ts +137 -38
- package/dist/beta.d.ts +137 -38
- package/dist/index.bundled.d.ts +137 -38
- package/dist/index.js +434 -147
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground/snippets/billboard.ts +4 -7
- package/dist/playground/snippets/ui-backgrounds.tsx +8 -8
- package/dist/playground/snippets/ui-dropdown.tsx +23 -10
- package/dist/playground/snippets/ui.tsx +9 -12
- package/dist/playground-assets.d.ts +137 -38
- package/etc/playground-assets.api.json +630 -162
- package/etc/playground-assets.api.md +91 -28
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -12390,34 +12390,34 @@
|
|
|
12390
12390
|
}
|
|
12391
12391
|
};
|
|
12392
12392
|
|
|
12393
|
-
/** @public */ const Animator$2 = engine => engine.defineComponentFromSchema(
|
|
12394
|
-
/** @public */ const AudioSource$1 = engine => engine.defineComponentFromSchema(
|
|
12395
|
-
/** @public */ const AudioStream$1 = engine => engine.defineComponentFromSchema(
|
|
12396
|
-
/** @public */ const AvatarAttach$1 = engine => engine.defineComponentFromSchema(
|
|
12397
|
-
/** @public */ const AvatarModifierArea$1 = engine => engine.defineComponentFromSchema(
|
|
12398
|
-
/** @public */ const AvatarShape$1 = engine => engine.defineComponentFromSchema(
|
|
12399
|
-
/** @public */ const Billboard$1 = engine => engine.defineComponentFromSchema(
|
|
12400
|
-
/** @public */ const CameraMode$1 = engine => engine.defineComponentFromSchema(
|
|
12401
|
-
/** @public */ const CameraModeArea$1 = engine => engine.defineComponentFromSchema(
|
|
12402
|
-
/** @public */ const GltfContainer$1 = engine => engine.defineComponentFromSchema(
|
|
12403
|
-
/** @public */ const Material$2 = engine => engine.defineComponentFromSchema(
|
|
12404
|
-
/** @public */ const MeshCollider$2 = engine => engine.defineComponentFromSchema(
|
|
12405
|
-
/** @public */ const MeshRenderer$2 = engine => engine.defineComponentFromSchema(
|
|
12406
|
-
/** @public */ const NftShape$1 = engine => engine.defineComponentFromSchema(
|
|
12407
|
-
/** @public */ const PointerEvents$1 = engine => engine.defineComponentFromSchema(
|
|
12408
|
-
/** @public */ const PointerEventsResult$1 = engine => engine.defineComponentFromSchema(
|
|
12409
|
-
/** @public */ const PointerLock$1 = engine => engine.defineComponentFromSchema(
|
|
12410
|
-
/** @public */ const Raycast$1 = engine => engine.defineComponentFromSchema(
|
|
12411
|
-
/** @public */ const RaycastResult$1 = engine => engine.defineComponentFromSchema(
|
|
12412
|
-
/** @public */ const TextShape$1 = engine => engine.defineComponentFromSchema(
|
|
12413
|
-
/** @public */ const UiBackground$1 = engine => engine.defineComponentFromSchema(
|
|
12414
|
-
/** @public */ const UiDropdown$1 = engine => engine.defineComponentFromSchema(
|
|
12415
|
-
/** @public */ const UiDropdownResult$1 = engine => engine.defineComponentFromSchema(
|
|
12416
|
-
/** @public */ const UiInput$1 = engine => engine.defineComponentFromSchema(
|
|
12417
|
-
/** @public */ const UiInputResult$1 = engine => engine.defineComponentFromSchema(
|
|
12418
|
-
/** @public */ const UiText$1 = engine => engine.defineComponentFromSchema(
|
|
12419
|
-
/** @public */ const UiTransform$1 = engine => engine.defineComponentFromSchema(
|
|
12420
|
-
/** @public */ const VisibilityComponent$1 = engine => engine.defineComponentFromSchema(
|
|
12393
|
+
/** @public */ const Animator$2 = engine => engine.defineComponentFromSchema("core::Animator", AnimatorSchema);
|
|
12394
|
+
/** @public */ const AudioSource$1 = engine => engine.defineComponentFromSchema("core::AudioSource", AudioSourceSchema);
|
|
12395
|
+
/** @public */ const AudioStream$1 = engine => engine.defineComponentFromSchema("core::AudioStream", AudioStreamSchema);
|
|
12396
|
+
/** @public */ const AvatarAttach$1 = engine => engine.defineComponentFromSchema("core::AvatarAttach", AvatarAttachSchema);
|
|
12397
|
+
/** @public */ const AvatarModifierArea$1 = engine => engine.defineComponentFromSchema("core::AvatarModifierArea", AvatarModifierAreaSchema);
|
|
12398
|
+
/** @public */ const AvatarShape$1 = engine => engine.defineComponentFromSchema("core::AvatarShape", AvatarShapeSchema);
|
|
12399
|
+
/** @public */ const Billboard$1 = engine => engine.defineComponentFromSchema("core::Billboard", BillboardSchema);
|
|
12400
|
+
/** @public */ const CameraMode$1 = engine => engine.defineComponentFromSchema("core::CameraMode", CameraModeSchema);
|
|
12401
|
+
/** @public */ const CameraModeArea$1 = engine => engine.defineComponentFromSchema("core::CameraModeArea", CameraModeAreaSchema);
|
|
12402
|
+
/** @public */ const GltfContainer$1 = engine => engine.defineComponentFromSchema("core::GltfContainer", GltfContainerSchema);
|
|
12403
|
+
/** @public */ const Material$2 = engine => engine.defineComponentFromSchema("core::Material", MaterialSchema);
|
|
12404
|
+
/** @public */ const MeshCollider$2 = engine => engine.defineComponentFromSchema("core::MeshCollider", MeshColliderSchema);
|
|
12405
|
+
/** @public */ const MeshRenderer$2 = engine => engine.defineComponentFromSchema("core::MeshRenderer", MeshRendererSchema);
|
|
12406
|
+
/** @public */ const NftShape$1 = engine => engine.defineComponentFromSchema("core::NftShape", NftShapeSchema);
|
|
12407
|
+
/** @public */ const PointerEvents$1 = engine => engine.defineComponentFromSchema("core::PointerEvents", PointerEventsSchema);
|
|
12408
|
+
/** @public */ const PointerEventsResult$1 = engine => engine.defineComponentFromSchema("core::PointerEventsResult", PointerEventsResultSchema);
|
|
12409
|
+
/** @public */ const PointerLock$1 = engine => engine.defineComponentFromSchema("core::PointerLock", PointerLockSchema);
|
|
12410
|
+
/** @public */ const Raycast$1 = engine => engine.defineComponentFromSchema("core::Raycast", RaycastSchema);
|
|
12411
|
+
/** @public */ const RaycastResult$1 = engine => engine.defineComponentFromSchema("core::RaycastResult", RaycastResultSchema);
|
|
12412
|
+
/** @public */ const TextShape$1 = engine => engine.defineComponentFromSchema("core::TextShape", TextShapeSchema);
|
|
12413
|
+
/** @public */ const UiBackground$1 = engine => engine.defineComponentFromSchema("core::UiBackground", UiBackgroundSchema);
|
|
12414
|
+
/** @public */ const UiDropdown$1 = engine => engine.defineComponentFromSchema("core::UiDropdown", UiDropdownSchema);
|
|
12415
|
+
/** @public */ const UiDropdownResult$1 = engine => engine.defineComponentFromSchema("core::UiDropdownResult", UiDropdownResultSchema);
|
|
12416
|
+
/** @public */ const UiInput$1 = engine => engine.defineComponentFromSchema("core::UiInput", UiInputSchema);
|
|
12417
|
+
/** @public */ const UiInputResult$1 = engine => engine.defineComponentFromSchema("core::UiInputResult", UiInputResultSchema);
|
|
12418
|
+
/** @public */ const UiText$1 = engine => engine.defineComponentFromSchema("core::UiText", UiTextSchema);
|
|
12419
|
+
/** @public */ const UiTransform$1 = engine => engine.defineComponentFromSchema("core::UiTransform", UiTransformSchema);
|
|
12420
|
+
/** @public */ const VisibilityComponent$1 = engine => engine.defineComponentFromSchema("core::VisibilityComponent", VisibilityComponentSchema);
|
|
12421
12421
|
|
|
12422
12422
|
function defineAnimatorComponent(engine) {
|
|
12423
12423
|
const theComponent = Animator$2(engine);
|
|
@@ -12590,7 +12590,6 @@
|
|
|
12590
12590
|
/**
|
|
12591
12591
|
* @internal
|
|
12592
12592
|
*/
|
|
12593
|
-
const COMPONENT_ID = 1;
|
|
12594
12593
|
/** @internal */
|
|
12595
12594
|
const TRANSFORM_LENGTH = 44;
|
|
12596
12595
|
/** @internal */
|
|
@@ -12648,7 +12647,7 @@
|
|
|
12648
12647
|
}
|
|
12649
12648
|
};
|
|
12650
12649
|
function defineTransformComponent(engine) {
|
|
12651
|
-
const transformDef = engine.defineComponentFromSchema(
|
|
12650
|
+
const transformDef = engine.defineComponentFromSchema('core::Transform', TransformSchema);
|
|
12652
12651
|
return {
|
|
12653
12652
|
...transformDef,
|
|
12654
12653
|
create(entity, val) {
|
|
@@ -12764,6 +12763,114 @@
|
|
|
12764
12763
|
VisibilityComponent: VisibilityComponent$1
|
|
12765
12764
|
});
|
|
12766
12765
|
|
|
12766
|
+
/**
|
|
12767
|
+
* Autogenerated mapping of core components to their component numbers
|
|
12768
|
+
*/
|
|
12769
|
+
const coreComponentMappings = {
|
|
12770
|
+
"core::Transform": 1,
|
|
12771
|
+
"core::Animator": 1042,
|
|
12772
|
+
"core::AudioSource": 1020,
|
|
12773
|
+
"core::AudioStream": 1021,
|
|
12774
|
+
"core::AvatarAttach": 1073,
|
|
12775
|
+
"core::AvatarModifierArea": 1070,
|
|
12776
|
+
"core::AvatarShape": 1080,
|
|
12777
|
+
"core::Billboard": 1090,
|
|
12778
|
+
"core::CameraMode": 1072,
|
|
12779
|
+
"core::CameraModeArea": 1071,
|
|
12780
|
+
"core::GltfContainer": 1041,
|
|
12781
|
+
"core::Material": 1017,
|
|
12782
|
+
"core::MeshCollider": 1019,
|
|
12783
|
+
"core::MeshRenderer": 1018,
|
|
12784
|
+
"core::NftShape": 1040,
|
|
12785
|
+
"core::PointerEvents": 1062,
|
|
12786
|
+
"core::PointerEventsResult": 1063,
|
|
12787
|
+
"core::PointerLock": 1074,
|
|
12788
|
+
"core::Raycast": 1067,
|
|
12789
|
+
"core::RaycastResult": 1068,
|
|
12790
|
+
"core::TextShape": 1030,
|
|
12791
|
+
"core::UiBackground": 1053,
|
|
12792
|
+
"core::UiDropdown": 1094,
|
|
12793
|
+
"core::UiDropdownResult": 1096,
|
|
12794
|
+
"core::UiInput": 1093,
|
|
12795
|
+
"core::UiInputResult": 1095,
|
|
12796
|
+
"core::UiText": 1052,
|
|
12797
|
+
"core::UiTransform": 1050,
|
|
12798
|
+
"core::VisibilityComponent": 1081
|
|
12799
|
+
};
|
|
12800
|
+
|
|
12801
|
+
var utf8Exports = requireUtf8();
|
|
12802
|
+
|
|
12803
|
+
const CRC_TABLE = new Int32Array([
|
|
12804
|
+
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
|
12805
|
+
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
|
12806
|
+
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
|
12807
|
+
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
|
12808
|
+
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
|
12809
|
+
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
|
12810
|
+
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
|
12811
|
+
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
|
12812
|
+
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
|
12813
|
+
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
|
12814
|
+
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
|
12815
|
+
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
|
12816
|
+
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
|
12817
|
+
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
|
12818
|
+
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
|
12819
|
+
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
|
12820
|
+
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
|
12821
|
+
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
|
12822
|
+
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
|
12823
|
+
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
|
12824
|
+
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
|
12825
|
+
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
|
12826
|
+
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
|
12827
|
+
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
|
12828
|
+
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
|
12829
|
+
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
|
12830
|
+
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
|
12831
|
+
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
|
12832
|
+
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
|
12833
|
+
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
|
12834
|
+
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
|
12835
|
+
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
|
12836
|
+
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
|
12837
|
+
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
|
12838
|
+
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
|
12839
|
+
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
|
12840
|
+
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
|
12841
|
+
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
|
12842
|
+
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
|
12843
|
+
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
|
12844
|
+
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
|
12845
|
+
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
|
12846
|
+
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
|
12847
|
+
]);
|
|
12848
|
+
function _crc32(buf, previous) {
|
|
12849
|
+
let crc = ~~previous ^ -1;
|
|
12850
|
+
for (let n = 0; n < buf.length; n++) {
|
|
12851
|
+
crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
|
|
12852
|
+
}
|
|
12853
|
+
return crc ^ -1;
|
|
12854
|
+
}
|
|
12855
|
+
function unsignedCRC32(data, prev = 0) {
|
|
12856
|
+
return _crc32(data, prev) >>> 0;
|
|
12857
|
+
}
|
|
12858
|
+
|
|
12859
|
+
// Max possible pre-defined (static) component.
|
|
12860
|
+
const MAX_STATIC_COMPONENT = 1 << 11; // 2048
|
|
12861
|
+
/**
|
|
12862
|
+
* All components that are not part of the coreComponentMappings MUST yield
|
|
12863
|
+
* a componentNumber (componentId) greather than MAX_STATIC_COMPONENT.
|
|
12864
|
+
* For that reason, we simply add MAX_STATIC_COMPONENT and trim to the domain 2^32
|
|
12865
|
+
*/
|
|
12866
|
+
function componentNumberFromName(componentName) {
|
|
12867
|
+
if (coreComponentMappings[componentName])
|
|
12868
|
+
return coreComponentMappings[componentName];
|
|
12869
|
+
const bytes = new Uint8Array(128);
|
|
12870
|
+
utf8Exports.write(componentName, bytes, 0);
|
|
12871
|
+
return ((unsignedCRC32(bytes) + MAX_STATIC_COMPONENT) & 4294967295) >>> 0;
|
|
12872
|
+
}
|
|
12873
|
+
|
|
12767
12874
|
function checkNotThenable(t, error) {
|
|
12768
12875
|
if (globalThis.DEBUG) {
|
|
12769
12876
|
if (t &&
|
|
@@ -13682,8 +13789,6 @@
|
|
|
13682
13789
|
};
|
|
13683
13790
|
}
|
|
13684
13791
|
|
|
13685
|
-
var utf8Exports = requireUtf8();
|
|
13686
|
-
|
|
13687
13792
|
var __classPrivateFieldGet = (globalThis && globalThis.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13688
13793
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13689
13794
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -13872,7 +13977,7 @@
|
|
|
13872
13977
|
return this.view.getUint16(offset);
|
|
13873
13978
|
}
|
|
13874
13979
|
getUint32(offset) {
|
|
13875
|
-
return this.view.getUint32(offset);
|
|
13980
|
+
return this.view.getUint32(offset) >>> 0;
|
|
13876
13981
|
}
|
|
13877
13982
|
getUint64(offset) {
|
|
13878
13983
|
return this.view.getBigUint64(offset);
|
|
@@ -13972,7 +14077,7 @@
|
|
|
13972
14077
|
const msg = {
|
|
13973
14078
|
...header,
|
|
13974
14079
|
entityId: buf.readUint32(),
|
|
13975
|
-
componentId: buf.
|
|
14080
|
+
componentId: buf.readUint32(),
|
|
13976
14081
|
timestamp: Number(buf.readUint64())
|
|
13977
14082
|
};
|
|
13978
14083
|
// TODO: remove buffer length
|
|
@@ -14000,7 +14105,7 @@
|
|
|
14000
14105
|
buf.setUint32(startMessageOffset + 4, exports.CrdtMessageType.PUT_COMPONENT);
|
|
14001
14106
|
// Write ComponentOperation header
|
|
14002
14107
|
buf.setUint32(startMessageOffset + 8, entity);
|
|
14003
|
-
buf.setUint32(startMessageOffset + 12, componentDefinition.
|
|
14108
|
+
buf.setUint32(startMessageOffset + 12, componentDefinition.componentId);
|
|
14004
14109
|
buf.setUint64(startMessageOffset + 16, BigInt(timestamp));
|
|
14005
14110
|
const newLocal = messageLength - PutComponentOperation.MESSAGE_HEADER_LENGTH - CRDT_MESSAGE_HEADER_LENGTH;
|
|
14006
14111
|
buf.setUint32(startMessageOffset + 24, newLocal);
|
|
@@ -14017,7 +14122,7 @@
|
|
|
14017
14122
|
return {
|
|
14018
14123
|
...header,
|
|
14019
14124
|
entityId: buf.readUint32(),
|
|
14020
|
-
componentId: buf.
|
|
14125
|
+
componentId: buf.readUint32(),
|
|
14021
14126
|
timestamp: Number(buf.readUint64()),
|
|
14022
14127
|
data: buf.readBuffer()
|
|
14023
14128
|
};
|
|
@@ -14233,7 +14338,7 @@
|
|
|
14233
14338
|
// The state isn't updated because the dirty was set
|
|
14234
14339
|
// out of the block of systems update between `receiveMessage` and `updateState`
|
|
14235
14340
|
if (component?.isDirty(msg.entityId)) {
|
|
14236
|
-
crdtClient.createComponentDataEvent(component.
|
|
14341
|
+
crdtClient.createComponentDataEvent(component.componentId, msg.entityId, component.toBinaryOrNull(msg.entityId)?.toBinary() || null);
|
|
14237
14342
|
}
|
|
14238
14343
|
const processResult = crdtClient.processMessage(crdtMessage);
|
|
14239
14344
|
if (!component) {
|
|
@@ -14270,7 +14375,7 @@
|
|
|
14270
14375
|
exports.PutComponentOperation.write(msg.entityId, ts, component, bufferForOutdated);
|
|
14271
14376
|
}
|
|
14272
14377
|
else {
|
|
14273
|
-
exports.DeleteComponent.write(msg.entityId, component.
|
|
14378
|
+
exports.DeleteComponent.write(msg.entityId, component.componentId, ts, bufferForOutdated);
|
|
14274
14379
|
}
|
|
14275
14380
|
outdatedMessages.push({
|
|
14276
14381
|
...msg,
|
|
@@ -14320,7 +14425,7 @@
|
|
|
14320
14425
|
const componentValue = component.toBinaryOrNull(entity)?.toBinary() ?? null;
|
|
14321
14426
|
// TODO: do not emit event if componentValue equals the value didn't change
|
|
14322
14427
|
// if update goes bad, the entity doesn't accept put anymore (it's added to deleted entities set)
|
|
14323
|
-
if (crdtClient.createComponentDataEvent(component.
|
|
14428
|
+
if (crdtClient.createComponentDataEvent(component.componentId, entity, componentValue) === null) {
|
|
14324
14429
|
component.deleteFrom(entity, false);
|
|
14325
14430
|
}
|
|
14326
14431
|
else {
|
|
@@ -14347,7 +14452,7 @@
|
|
|
14347
14452
|
// Component will be always defined here since dirtyMap its an iterator of engine.componentsDefinition
|
|
14348
14453
|
const { timestamp } = crdtClient
|
|
14349
14454
|
.getState()
|
|
14350
|
-
.components.get(component.
|
|
14455
|
+
.components.get(component.componentId)
|
|
14351
14456
|
.get(entity);
|
|
14352
14457
|
const offset = buffer.currentWriteOffset();
|
|
14353
14458
|
const type = component.has(entity)
|
|
@@ -14356,7 +14461,7 @@
|
|
|
14356
14461
|
const transportMessage = {
|
|
14357
14462
|
type,
|
|
14358
14463
|
entityId: entity,
|
|
14359
|
-
componentId: component.
|
|
14464
|
+
componentId: component.componentId,
|
|
14360
14465
|
timestamp
|
|
14361
14466
|
};
|
|
14362
14467
|
// Avoid creating messages if there is no transport that will handle it
|
|
@@ -14365,7 +14470,7 @@
|
|
|
14365
14470
|
exports.PutComponentOperation.write(entity, timestamp, component, buffer);
|
|
14366
14471
|
}
|
|
14367
14472
|
else {
|
|
14368
|
-
exports.DeleteComponent.write(entity, component.
|
|
14473
|
+
exports.DeleteComponent.write(entity, component.componentId, timestamp, buffer);
|
|
14369
14474
|
}
|
|
14370
14475
|
crdtMessages.push({
|
|
14371
14476
|
...transportMessage,
|
|
@@ -14452,15 +14557,18 @@
|
|
|
14452
14557
|
return Object.freeze({ ...val });
|
|
14453
14558
|
}
|
|
14454
14559
|
|
|
14455
|
-
function
|
|
14456
|
-
// meta: { syncFlags }
|
|
14457
|
-
) {
|
|
14560
|
+
function createComponentDefinitionFromSchema(componentName, componentId, schema) {
|
|
14458
14561
|
const data = new Map();
|
|
14459
14562
|
const dirtyIterator = new Set();
|
|
14460
14563
|
return {
|
|
14461
|
-
|
|
14564
|
+
get componentId() {
|
|
14565
|
+
return componentId;
|
|
14566
|
+
},
|
|
14567
|
+
get componentName() {
|
|
14568
|
+
return componentName;
|
|
14569
|
+
},
|
|
14462
14570
|
default() {
|
|
14463
|
-
return
|
|
14571
|
+
return schema.create();
|
|
14464
14572
|
},
|
|
14465
14573
|
isDirty(entity) {
|
|
14466
14574
|
return dirtyIterator.has(entity);
|
|
@@ -14486,19 +14594,19 @@
|
|
|
14486
14594
|
get(entity) {
|
|
14487
14595
|
const component = data.get(entity);
|
|
14488
14596
|
if (!component) {
|
|
14489
|
-
throw new Error(`[getFrom] Component ${
|
|
14597
|
+
throw new Error(`[getFrom] Component ${componentName} for entity #${entity} not found`);
|
|
14490
14598
|
}
|
|
14491
14599
|
return deepReadonly(component);
|
|
14492
14600
|
},
|
|
14493
14601
|
create(entity, value) {
|
|
14494
14602
|
const component = data.get(entity);
|
|
14495
14603
|
if (component) {
|
|
14496
|
-
throw new Error(`[create] Component ${
|
|
14604
|
+
throw new Error(`[create] Component ${componentName} for ${entity} already exists`);
|
|
14497
14605
|
}
|
|
14498
14606
|
const usedValue = value === undefined
|
|
14499
|
-
?
|
|
14500
|
-
:
|
|
14501
|
-
?
|
|
14607
|
+
? schema.create()
|
|
14608
|
+
: schema.extend
|
|
14609
|
+
? schema.extend(value)
|
|
14502
14610
|
: value;
|
|
14503
14611
|
data.set(entity, usedValue);
|
|
14504
14612
|
dirtyIterator.add(entity);
|
|
@@ -14506,9 +14614,9 @@
|
|
|
14506
14614
|
},
|
|
14507
14615
|
createOrReplace(entity, value) {
|
|
14508
14616
|
const usedValue = value === undefined
|
|
14509
|
-
?
|
|
14510
|
-
:
|
|
14511
|
-
?
|
|
14617
|
+
? schema.create()
|
|
14618
|
+
: schema.extend
|
|
14619
|
+
? schema.extend(value)
|
|
14512
14620
|
: value;
|
|
14513
14621
|
data.set(entity, usedValue);
|
|
14514
14622
|
dirtyIterator.add(entity);
|
|
@@ -14525,7 +14633,7 @@
|
|
|
14525
14633
|
getMutable(entity) {
|
|
14526
14634
|
const component = this.getMutableOrNull(entity);
|
|
14527
14635
|
if (component === null) {
|
|
14528
|
-
throw new Error(`[mutable] Component ${
|
|
14636
|
+
throw new Error(`[mutable] Component ${componentName} for ${entity} not found`);
|
|
14529
14637
|
}
|
|
14530
14638
|
return component;
|
|
14531
14639
|
},
|
|
@@ -14542,10 +14650,10 @@
|
|
|
14542
14650
|
toBinary(entity) {
|
|
14543
14651
|
const component = data.get(entity);
|
|
14544
14652
|
if (!component) {
|
|
14545
|
-
throw new Error(`[toBinary] Component ${
|
|
14653
|
+
throw new Error(`[toBinary] Component ${componentName} for ${entity} not found`);
|
|
14546
14654
|
}
|
|
14547
14655
|
const writeBuffer = new ReadWriteByteBuffer();
|
|
14548
|
-
|
|
14656
|
+
schema.serialize(component, writeBuffer);
|
|
14549
14657
|
return writeBuffer;
|
|
14550
14658
|
},
|
|
14551
14659
|
toBinaryOrNull(entity) {
|
|
@@ -14554,25 +14662,25 @@
|
|
|
14554
14662
|
return null;
|
|
14555
14663
|
}
|
|
14556
14664
|
const writeBuffer = new ReadWriteByteBuffer();
|
|
14557
|
-
|
|
14665
|
+
schema.serialize(component, writeBuffer);
|
|
14558
14666
|
return writeBuffer;
|
|
14559
14667
|
},
|
|
14560
14668
|
writeToByteBuffer(entity, buffer) {
|
|
14561
14669
|
const component = data.get(entity);
|
|
14562
14670
|
if (!component) {
|
|
14563
|
-
throw new Error(`[writeToByteBuffer] Component ${
|
|
14671
|
+
throw new Error(`[writeToByteBuffer] Component ${componentName} for entity #${entity} not found`);
|
|
14564
14672
|
}
|
|
14565
|
-
|
|
14673
|
+
schema.serialize(component, buffer);
|
|
14566
14674
|
},
|
|
14567
14675
|
updateFromBinary(entity, buffer, markAsDirty = true) {
|
|
14568
14676
|
const component = data.get(entity);
|
|
14569
14677
|
if (!component) {
|
|
14570
|
-
throw new Error(`[updateFromBinary] Component ${
|
|
14678
|
+
throw new Error(`[updateFromBinary] Component ${componentName} for ${entity} not found`);
|
|
14571
14679
|
}
|
|
14572
14680
|
return this.upsertFromBinary(entity, buffer, markAsDirty);
|
|
14573
14681
|
},
|
|
14574
14682
|
upsertFromBinary(entity, buffer, markAsDirty = true) {
|
|
14575
|
-
const newValue =
|
|
14683
|
+
const newValue = schema.deserialize(buffer);
|
|
14576
14684
|
data.set(entity, newValue);
|
|
14577
14685
|
if (markAsDirty) {
|
|
14578
14686
|
dirtyIterator.add(entity);
|
|
@@ -14583,7 +14691,7 @@
|
|
|
14583
14691
|
return newValue;
|
|
14584
14692
|
},
|
|
14585
14693
|
deserialize(buffer) {
|
|
14586
|
-
return
|
|
14694
|
+
return schema.deserialize(buffer);
|
|
14587
14695
|
},
|
|
14588
14696
|
clearDirty() {
|
|
14589
14697
|
dirtyIterator.clear();
|
|
@@ -14659,12 +14767,11 @@
|
|
|
14659
14767
|
ts: exports.Schemas.Number
|
|
14660
14768
|
}))
|
|
14661
14769
|
};
|
|
14662
|
-
const InternalInputStateComponentId = 1500;
|
|
14663
14770
|
const TimestampUpdateSystemPriority = 1 << 20;
|
|
14664
14771
|
const ButtonStateUpdateSystemPriority = 0;
|
|
14665
14772
|
function createInputSystem(engine) {
|
|
14666
14773
|
const PointerEventsResult = PointerEventsResult$1(engine);
|
|
14667
|
-
const InternalInputStateComponent = engine.defineComponent(InternalInputStateSchema,
|
|
14774
|
+
const InternalInputStateComponent = engine.defineComponent('@dcl/sdk/InternalInputStateSchema', InternalInputStateSchema);
|
|
14668
14775
|
InternalInputStateComponent.create(engine.RootEntity, {
|
|
14669
14776
|
buttonState: Array.from({ length: InputCommands.length }, () => ({
|
|
14670
14777
|
ts: 0,
|
|
@@ -14795,6 +14902,7 @@
|
|
|
14795
14902
|
const entityContainer = EntityContainer();
|
|
14796
14903
|
const componentsDefinition = new Map();
|
|
14797
14904
|
const systems = SystemContainer();
|
|
14905
|
+
let sealed = false;
|
|
14798
14906
|
function addSystem(fn, priority = SYSTEMS_REGULAR_PRIORITY, name) {
|
|
14799
14907
|
systems.add(fn, priority, name);
|
|
14800
14908
|
}
|
|
@@ -14813,32 +14921,51 @@
|
|
|
14813
14921
|
}
|
|
14814
14922
|
return entityContainer.removeEntity(entity);
|
|
14815
14923
|
}
|
|
14816
|
-
function
|
|
14924
|
+
function registerComponentDefinition(componentName, component) {
|
|
14925
|
+
/* istanbul ignore next */
|
|
14926
|
+
if (sealed)
|
|
14927
|
+
throw new Error('Engine is already sealed. No components can be added at this stage');
|
|
14928
|
+
const componentId = componentNumberFromName(componentName);
|
|
14817
14929
|
const prev = componentsDefinition.get(componentId);
|
|
14818
14930
|
if (prev) {
|
|
14819
14931
|
throw new Error(`Component number ${componentId} was already registered.`);
|
|
14820
14932
|
}
|
|
14933
|
+
/* istanbul ignore next */
|
|
14934
|
+
if (component.componentName !== componentName) {
|
|
14935
|
+
throw new Error(`Component name doesn't match componentDefinition.componentName ${componentName} != ${component.componentName}`);
|
|
14936
|
+
}
|
|
14937
|
+
/* istanbul ignore next */
|
|
14938
|
+
if (component.componentId !== componentId) {
|
|
14939
|
+
throw new Error(`Component number doesn't match componentDefinition.componentId ${componentId} != ${component.componentId}`);
|
|
14940
|
+
}
|
|
14821
14941
|
componentsDefinition.set(componentId, component);
|
|
14822
14942
|
return component;
|
|
14823
14943
|
}
|
|
14824
|
-
function defineComponentFromSchema(
|
|
14944
|
+
function defineComponentFromSchema(componentName, schema) {
|
|
14945
|
+
/* istanbul ignore next */
|
|
14946
|
+
if (sealed)
|
|
14947
|
+
throw new Error('Engine is already sealed. No components can be added at this stage');
|
|
14948
|
+
const componentId = componentNumberFromName(componentName);
|
|
14825
14949
|
const prev = componentsDefinition.get(componentId);
|
|
14826
14950
|
if (prev) {
|
|
14827
14951
|
// TODO: assert spec === prev.spec
|
|
14828
14952
|
return prev;
|
|
14829
14953
|
}
|
|
14830
|
-
const newComponent =
|
|
14954
|
+
const newComponent = createComponentDefinitionFromSchema(componentName, componentId, schema);
|
|
14831
14955
|
componentsDefinition.set(componentId, newComponent);
|
|
14832
14956
|
return newComponent;
|
|
14833
14957
|
}
|
|
14834
|
-
function defineComponent
|
|
14958
|
+
function defineComponent(componentName, mapSpec, constructorDefault) {
|
|
14959
|
+
if (sealed)
|
|
14960
|
+
throw new Error('Engine is already sealed. No components can be added at this stage');
|
|
14961
|
+
const componentId = componentNumberFromName(componentName);
|
|
14835
14962
|
const prev = componentsDefinition.get(componentId);
|
|
14836
14963
|
if (prev) {
|
|
14837
14964
|
// TODO: assert spec === prev.spec
|
|
14838
14965
|
return prev;
|
|
14839
14966
|
}
|
|
14840
14967
|
const schemaSpec = exports.Schemas.Map(mapSpec, constructorDefault);
|
|
14841
|
-
const def =
|
|
14968
|
+
const def = createComponentDefinitionFromSchema(componentName, componentId, schemaSpec);
|
|
14842
14969
|
const newComponent = {
|
|
14843
14970
|
...def,
|
|
14844
14971
|
create(entity, val) {
|
|
@@ -14910,22 +15037,28 @@
|
|
|
14910
15037
|
removeEntity(entity);
|
|
14911
15038
|
}
|
|
14912
15039
|
}
|
|
15040
|
+
function seal() {
|
|
15041
|
+
if (!sealed) {
|
|
15042
|
+
sealed = true;
|
|
15043
|
+
}
|
|
15044
|
+
}
|
|
14913
15045
|
return {
|
|
14914
15046
|
addEntity,
|
|
14915
15047
|
removeEntity,
|
|
14916
15048
|
addSystem,
|
|
14917
15049
|
getSystems,
|
|
14918
15050
|
removeSystem,
|
|
14919
|
-
defineComponent
|
|
15051
|
+
defineComponent,
|
|
14920
15052
|
defineComponentFromSchema,
|
|
14921
15053
|
getEntitiesWith,
|
|
14922
15054
|
getComponent,
|
|
14923
15055
|
getComponentOrNull,
|
|
14924
15056
|
removeComponentDefinition,
|
|
14925
15057
|
removeEntityWithChildren,
|
|
14926
|
-
|
|
15058
|
+
registerComponentDefinition,
|
|
14927
15059
|
entityContainer,
|
|
14928
|
-
componentsIter
|
|
15060
|
+
componentsIter,
|
|
15061
|
+
seal
|
|
14929
15062
|
};
|
|
14930
15063
|
}
|
|
14931
15064
|
/**
|
|
@@ -14955,12 +15088,13 @@
|
|
|
14955
15088
|
removeSystem: engine.removeSystem,
|
|
14956
15089
|
defineComponent: engine.defineComponent,
|
|
14957
15090
|
defineComponentFromSchema: engine.defineComponentFromSchema,
|
|
14958
|
-
|
|
15091
|
+
registerComponentDefinition: engine.registerComponentDefinition,
|
|
14959
15092
|
getEntitiesWith: engine.getEntitiesWith,
|
|
14960
15093
|
getComponent: engine.getComponent,
|
|
14961
15094
|
getComponentOrNull: engine.getComponentOrNull,
|
|
14962
15095
|
removeComponentDefinition: engine.removeComponentDefinition,
|
|
14963
15096
|
componentsIter: engine.componentsIter,
|
|
15097
|
+
seal: engine.seal,
|
|
14964
15098
|
update,
|
|
14965
15099
|
RootEntity: 0,
|
|
14966
15100
|
PlayerEntity: 1,
|
|
@@ -40562,12 +40696,110 @@
|
|
|
40562
40696
|
[unitKey]: unit
|
|
40563
40697
|
};
|
|
40564
40698
|
}
|
|
40699
|
+
/**
|
|
40700
|
+
* @internal
|
|
40701
|
+
*/
|
|
40702
|
+
function getDisplay(display) {
|
|
40703
|
+
const value = display ? parseDisplay[display] : 0 /* YGDisplay.YGD_FLEX */;
|
|
40704
|
+
return { display: value };
|
|
40705
|
+
}
|
|
40706
|
+
const parseDisplay = {
|
|
40707
|
+
flex: 0 /* YGDisplay.YGD_FLEX */,
|
|
40708
|
+
none: 1 /* YGDisplay.YGD_NONE */
|
|
40709
|
+
};
|
|
40710
|
+
/**
|
|
40711
|
+
* @internal
|
|
40712
|
+
*/
|
|
40713
|
+
function getJustify(justify) {
|
|
40714
|
+
const value = justify
|
|
40715
|
+
? parseJustify[justify]
|
|
40716
|
+
: 0 /* YGJustify.YGJ_FLEX_START */;
|
|
40717
|
+
return { justifyContent: value };
|
|
40718
|
+
}
|
|
40719
|
+
const parseJustify = {
|
|
40720
|
+
center: 1 /* YGJustify.YGJ_CENTER */,
|
|
40721
|
+
'flex-end': 2 /* YGJustify.YGJ_FLEX_END */,
|
|
40722
|
+
'flex-start': 0 /* YGJustify.YGJ_FLEX_START */,
|
|
40723
|
+
'space-around': 4 /* YGJustify.YGJ_SPACE_AROUND */,
|
|
40724
|
+
'space-between': 3 /* YGJustify.YGJ_SPACE_BETWEEN */,
|
|
40725
|
+
'space-evenly': 5 /* YGJustify.YGJ_SPACE_EVENLY */
|
|
40726
|
+
};
|
|
40727
|
+
/**
|
|
40728
|
+
* @internal
|
|
40729
|
+
*/
|
|
40730
|
+
function getAlign(prop, align, defaultValue) {
|
|
40731
|
+
const value = align ? parseAligns[align] : defaultValue;
|
|
40732
|
+
return { [prop]: value };
|
|
40733
|
+
}
|
|
40734
|
+
const parseAligns = {
|
|
40735
|
+
auto: 0 /* YGAlign.YGA_AUTO */,
|
|
40736
|
+
baseline: 5 /* YGAlign.YGA_BASELINE */,
|
|
40737
|
+
center: 2 /* YGAlign.YGA_CENTER */,
|
|
40738
|
+
'flex-end': 3 /* YGAlign.YGA_FLEX_END */,
|
|
40739
|
+
'flex-start': 1 /* YGAlign.YGA_FLEX_START */,
|
|
40740
|
+
stretch: 4 /* YGAlign.YGA_STRETCH */,
|
|
40741
|
+
'space-between': 6 /* YGAlign.YGA_SPACE_BETWEEN */,
|
|
40742
|
+
'space-around': 7 /* YGAlign.YGA_SPACE_AROUND */
|
|
40743
|
+
};
|
|
40744
|
+
/**
|
|
40745
|
+
* @internal
|
|
40746
|
+
*/
|
|
40747
|
+
function getFlexDirection(flexDirection) {
|
|
40748
|
+
const value = flexDirection
|
|
40749
|
+
? parseFlexDirection[flexDirection]
|
|
40750
|
+
: 0 /* YGFlexDirection.YGFD_ROW */;
|
|
40751
|
+
return { flexDirection: value };
|
|
40752
|
+
}
|
|
40753
|
+
const parseFlexDirection = {
|
|
40754
|
+
row: 0 /* YGFlexDirection.YGFD_ROW */,
|
|
40755
|
+
column: 1 /* YGFlexDirection.YGFD_COLUMN */,
|
|
40756
|
+
'row-reverse': 3 /* YGFlexDirection.YGFD_ROW_REVERSE */,
|
|
40757
|
+
'column-reverse': 2 /* YGFlexDirection.YGFD_COLUMN_REVERSE */
|
|
40758
|
+
};
|
|
40759
|
+
/**
|
|
40760
|
+
* @internal
|
|
40761
|
+
*/
|
|
40762
|
+
function getFlexWrap(flexWrap) {
|
|
40763
|
+
const value = flexWrap ? parseFlexWrap[flexWrap] : 1 /* YGWrap.YGW_WRAP */;
|
|
40764
|
+
return { flexWrap: value };
|
|
40765
|
+
}
|
|
40766
|
+
const parseFlexWrap = {
|
|
40767
|
+
wrap: 1 /* YGWrap.YGW_WRAP */,
|
|
40768
|
+
nowrap: 0 /* YGWrap.YGW_NO_WRAP */,
|
|
40769
|
+
'wrap-reverse': 2 /* YGWrap.YGW_WRAP_REVERSE */
|
|
40770
|
+
};
|
|
40771
|
+
/**
|
|
40772
|
+
* @internal
|
|
40773
|
+
*/
|
|
40774
|
+
function getOverflow(overflow) {
|
|
40775
|
+
const value = overflow
|
|
40776
|
+
? parseOverflow[overflow]
|
|
40777
|
+
: 0 /* YGOverflow.YGO_VISIBLE */;
|
|
40778
|
+
return { overflow: value };
|
|
40779
|
+
}
|
|
40780
|
+
const parseOverflow = {
|
|
40781
|
+
visible: 0 /* YGOverflow.YGO_VISIBLE */,
|
|
40782
|
+
scroll: 2 /* YGOverflow.YGO_SCROLL */,
|
|
40783
|
+
hidden: 1 /* YGOverflow.YGO_HIDDEN */
|
|
40784
|
+
};
|
|
40785
|
+
/**
|
|
40786
|
+
* @internal
|
|
40787
|
+
*/
|
|
40788
|
+
function getPoistionType(position) {
|
|
40789
|
+
const value = position
|
|
40790
|
+
? parsePositionType[position]
|
|
40791
|
+
: 0 /* YGPositionType.YGPT_RELATIVE */;
|
|
40792
|
+
return { positionType: value };
|
|
40793
|
+
}
|
|
40794
|
+
const parsePositionType = {
|
|
40795
|
+
relative: 0 /* YGPositionType.YGPT_RELATIVE */,
|
|
40796
|
+
absolute: 1 /* YGPositionType.YGPT_ABSOLUTE */
|
|
40797
|
+
};
|
|
40565
40798
|
|
|
40566
40799
|
const CANVAS_ROOT_ENTITY = 0;
|
|
40567
40800
|
const defaultUiTransform = {
|
|
40568
40801
|
parent: CANVAS_ROOT_ENTITY,
|
|
40569
40802
|
rightOf: 0,
|
|
40570
|
-
display: 0 /* YGDisplay.YGD_FLEX */,
|
|
40571
40803
|
flexBasis: 0,
|
|
40572
40804
|
width: 0,
|
|
40573
40805
|
height: 0,
|
|
@@ -40575,10 +40807,6 @@
|
|
|
40575
40807
|
minHeight: 0,
|
|
40576
40808
|
maxWidth: 0,
|
|
40577
40809
|
maxHeight: 0,
|
|
40578
|
-
justifyContent: 0 /* YGJustify.YGJ_FLEX_START */,
|
|
40579
|
-
alignSelf: 0 /* YGAlign.YGA_AUTO */,
|
|
40580
|
-
flexDirection: 0 /* YGFlexDirection.YGFD_ROW */,
|
|
40581
|
-
positionType: 0 /* YGPositionType.YGPT_RELATIVE */,
|
|
40582
40810
|
flexGrow: 0,
|
|
40583
40811
|
marginBottom: 0,
|
|
40584
40812
|
marginBottomUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
@@ -40592,9 +40820,8 @@
|
|
|
40592
40820
|
maxWidthUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40593
40821
|
minHeightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40594
40822
|
minWidthUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40595
|
-
overflow: 0 /* YGOverflow.YGO_VISIBLE */,
|
|
40596
40823
|
paddingBottom: 0,
|
|
40597
|
-
paddingBottomUnit:
|
|
40824
|
+
paddingBottomUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40598
40825
|
paddingLeft: 0,
|
|
40599
40826
|
paddingLeftUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40600
40827
|
paddingTopUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
@@ -40618,34 +40845,60 @@
|
|
|
40618
40845
|
*/
|
|
40619
40846
|
|
|
40620
40847
|
function parseUiTransform(props = {}) {
|
|
40621
|
-
const {
|
|
40848
|
+
const { height, minHeight, maxHeight, width, minWidth, maxWidth, ...otherProps } = props;
|
|
40622
40849
|
return {
|
|
40623
40850
|
...defaultUiTransform,
|
|
40624
40851
|
...otherProps,
|
|
40625
|
-
...parsePosition(position, 'position'),
|
|
40626
|
-
...parsePosition(margin, 'margin'),
|
|
40627
|
-
...parsePosition(padding, 'padding'),
|
|
40628
|
-
...parseSize(height, 'height'),
|
|
40629
|
-
...parseSize(minHeight, 'minHeight'),
|
|
40630
|
-
...parseSize(maxHeight, 'maxHeight'),
|
|
40631
|
-
...parseSize(width, 'width'),
|
|
40632
|
-
...parseSize(minWidth, 'minWidth'),
|
|
40633
|
-
...parseSize(maxWidth, 'maxWidth')
|
|
40852
|
+
...parsePosition(props.position, 'position'),
|
|
40853
|
+
...parsePosition(props.margin, 'margin'),
|
|
40854
|
+
...parsePosition(props.padding, 'padding'),
|
|
40855
|
+
...parseSize(props.height, 'height'),
|
|
40856
|
+
...parseSize(props.minHeight, 'minHeight'),
|
|
40857
|
+
...parseSize(props.maxHeight, 'maxHeight'),
|
|
40858
|
+
...parseSize(props.width, 'width'),
|
|
40859
|
+
...parseSize(props.minWidth, 'minWidth'),
|
|
40860
|
+
...parseSize(props.maxWidth, 'maxWidth'),
|
|
40861
|
+
...getDisplay(props.display),
|
|
40862
|
+
...getAlign('alignContent', props.alignContent, 1 /* YGAlign.YGA_FLEX_START */),
|
|
40863
|
+
...getAlign('alignSelf', props.alignSelf, 1 /* YGAlign.YGA_FLEX_START */),
|
|
40864
|
+
...getAlign('alignItems', props.alignItems, 1 /* YGAlign.YGA_FLEX_START */),
|
|
40865
|
+
...getJustify(props.justifyContent),
|
|
40866
|
+
...getFlexDirection(props.flexDirection),
|
|
40867
|
+
...getFlexWrap(props.flexWrap),
|
|
40868
|
+
...getOverflow(props.overflow),
|
|
40869
|
+
...getPoistionType(props.positionType)
|
|
40634
40870
|
};
|
|
40635
40871
|
}
|
|
40636
40872
|
|
|
40873
|
+
const parseTextureMode = {
|
|
40874
|
+
'nine-slices': 0 /* BackgroundTextureMode.NINE_SLICES */,
|
|
40875
|
+
center: 1 /* BackgroundTextureMode.CENTER */,
|
|
40876
|
+
stretch: 2 /* BackgroundTextureMode.STRETCH */
|
|
40877
|
+
};
|
|
40878
|
+
/**
|
|
40879
|
+
* @internal
|
|
40880
|
+
*/
|
|
40881
|
+
function getTextureMode(mode) {
|
|
40882
|
+
const value = mode
|
|
40883
|
+
? parseTextureMode[mode]
|
|
40884
|
+
: 1 /* BackgroundTextureMode.CENTER */;
|
|
40885
|
+
return { textureMode: value };
|
|
40886
|
+
}
|
|
40637
40887
|
function isAvatarTexture(props) {
|
|
40638
40888
|
return !!props.avatarTexture;
|
|
40639
40889
|
}
|
|
40640
40890
|
function isTexture(props) {
|
|
40641
40891
|
return !!props.texture;
|
|
40642
40892
|
}
|
|
40893
|
+
/**
|
|
40894
|
+
* @internal
|
|
40895
|
+
*/
|
|
40643
40896
|
function getTexture(props) {
|
|
40644
40897
|
if (isTexture(props) && props.texture) {
|
|
40645
40898
|
return {
|
|
40646
40899
|
tex: {
|
|
40647
40900
|
$case: 'texture',
|
|
40648
|
-
texture: props.texture
|
|
40901
|
+
texture: parseTexture(props.texture)
|
|
40649
40902
|
}
|
|
40650
40903
|
};
|
|
40651
40904
|
}
|
|
@@ -40653,12 +40906,31 @@
|
|
|
40653
40906
|
return {
|
|
40654
40907
|
tex: {
|
|
40655
40908
|
$case: 'avatarTexture',
|
|
40656
|
-
avatarTexture: props.avatarTexture
|
|
40909
|
+
avatarTexture: parseTexture(props.avatarTexture)
|
|
40657
40910
|
}
|
|
40658
40911
|
};
|
|
40659
40912
|
}
|
|
40660
40913
|
return undefined;
|
|
40661
40914
|
}
|
|
40915
|
+
function parseTexture(texture) {
|
|
40916
|
+
return {
|
|
40917
|
+
...texture,
|
|
40918
|
+
wrapMode: texture.wrapMode ? parseWrap[texture.wrapMode] : undefined,
|
|
40919
|
+
filterMode: texture.filterMode ? parseFilter[texture.filterMode] : undefined
|
|
40920
|
+
};
|
|
40921
|
+
}
|
|
40922
|
+
const parseWrap = {
|
|
40923
|
+
repeat: 0 /* TextureWrapMode.TWM_REPEAT */,
|
|
40924
|
+
clamp: 1 /* TextureWrapMode.TWM_CLAMP */,
|
|
40925
|
+
mirror: 2 /* TextureWrapMode.TWM_MIRROR */,
|
|
40926
|
+
'mirror-once': 3 /* TextureWrapMode.TWM_MIRROR_ONCE */
|
|
40927
|
+
};
|
|
40928
|
+
const parseFilter = {
|
|
40929
|
+
point: 0 /* TextureFilterMode.TFM_POINT */,
|
|
40930
|
+
'bi-linear': 1 /* TextureFilterMode.TFM_BILINEAR */,
|
|
40931
|
+
'tri-linear': 2 /* TextureFilterMode.TFM_TRILINEAR */
|
|
40932
|
+
};
|
|
40933
|
+
|
|
40662
40934
|
/**
|
|
40663
40935
|
* @public
|
|
40664
40936
|
*/
|
|
@@ -40669,9 +40941,9 @@
|
|
|
40669
40941
|
const texture = getTexture(props);
|
|
40670
40942
|
return {
|
|
40671
40943
|
...props,
|
|
40944
|
+
...getTextureMode(props.textureMode),
|
|
40672
40945
|
uvs: props.uvs ?? [],
|
|
40673
|
-
texture
|
|
40674
|
-
textureMode: props.textureMode ?? 1 /* BackgroundTextureMode.CENTER */
|
|
40946
|
+
texture
|
|
40675
40947
|
};
|
|
40676
40948
|
}
|
|
40677
40949
|
|
|
@@ -40698,13 +40970,49 @@
|
|
|
40698
40970
|
const listenersKey = Object.keys(listeners);
|
|
40699
40971
|
const isListener = (key) => listenersKey.includes(key);
|
|
40700
40972
|
|
|
40973
|
+
const parseFont = {
|
|
40974
|
+
'sans-serif': 0 /* Font.F_SANS_SERIF */,
|
|
40975
|
+
serif: 1 /* Font.F_SERIF */,
|
|
40976
|
+
monospace: 2 /* Font.F_MONOSPACE */
|
|
40977
|
+
};
|
|
40978
|
+
/**
|
|
40979
|
+
* @internal
|
|
40980
|
+
*/
|
|
40981
|
+
function getFont(font) {
|
|
40982
|
+
if (!font)
|
|
40983
|
+
return undefined;
|
|
40984
|
+
return { font: parseFont[font] };
|
|
40985
|
+
}
|
|
40986
|
+
const parseTextAlign = {
|
|
40987
|
+
'top-left': 0 /* TextAlignMode.TAM_TOP_LEFT */,
|
|
40988
|
+
'top-center': 1 /* TextAlignMode.TAM_TOP_CENTER */,
|
|
40989
|
+
'top-right': 2 /* TextAlignMode.TAM_TOP_RIGHT */,
|
|
40990
|
+
'middle-left': 3 /* TextAlignMode.TAM_MIDDLE_LEFT */,
|
|
40991
|
+
'middle-center': 4 /* TextAlignMode.TAM_MIDDLE_CENTER */,
|
|
40992
|
+
'middle-right': 5 /* TextAlignMode.TAM_MIDDLE_RIGHT */,
|
|
40993
|
+
'bottom-left': 6 /* TextAlignMode.TAM_BOTTOM_LEFT */,
|
|
40994
|
+
'bottom-center': 7 /* TextAlignMode.TAM_BOTTOM_CENTER */,
|
|
40995
|
+
'bottom-right': 8 /* TextAlignMode.TAM_BOTTOM_RIGHT */
|
|
40996
|
+
};
|
|
40997
|
+
/**
|
|
40998
|
+
* @internal
|
|
40999
|
+
*/
|
|
41000
|
+
function getTextAlign(textAlign) {
|
|
41001
|
+
if (!textAlign)
|
|
41002
|
+
return undefined;
|
|
41003
|
+
return { textAlign: parseTextAlign[textAlign] };
|
|
41004
|
+
}
|
|
41005
|
+
|
|
40701
41006
|
function parseUiDropdown(props) {
|
|
41007
|
+
const { textAlign, font, ...otherProps } = props;
|
|
40702
41008
|
return {
|
|
40703
41009
|
acceptEmpty: false,
|
|
40704
41010
|
options: [],
|
|
40705
41011
|
selectedIndex: props.acceptEmpty ? -1 : 0,
|
|
40706
41012
|
disabled: false,
|
|
40707
|
-
...
|
|
41013
|
+
...otherProps,
|
|
41014
|
+
...getTextAlign(textAlign),
|
|
41015
|
+
...getFont(font)
|
|
40708
41016
|
};
|
|
40709
41017
|
}
|
|
40710
41018
|
/**
|
|
@@ -40724,10 +41032,13 @@
|
|
|
40724
41032
|
}
|
|
40725
41033
|
|
|
40726
41034
|
function parseUiInput(props) {
|
|
41035
|
+
const { textAlign, font, ...otherProps } = props;
|
|
40727
41036
|
return {
|
|
40728
41037
|
disabled: false,
|
|
40729
41038
|
placeholder: '',
|
|
40730
|
-
...
|
|
41039
|
+
...otherProps,
|
|
41040
|
+
...getTextAlign(textAlign),
|
|
41041
|
+
...getFont(font)
|
|
40731
41042
|
};
|
|
40732
41043
|
}
|
|
40733
41044
|
/**
|
|
@@ -40758,7 +41069,13 @@
|
|
|
40758
41069
|
onMouseDown,
|
|
40759
41070
|
onMouseUp
|
|
40760
41071
|
});
|
|
40761
|
-
|
|
41072
|
+
const { font, textAlign, ...textProps } = uiTextProps;
|
|
41073
|
+
const uiText = {
|
|
41074
|
+
...textProps,
|
|
41075
|
+
...getFont(font),
|
|
41076
|
+
...getTextAlign(textAlign)
|
|
41077
|
+
};
|
|
41078
|
+
return ReactEcs$1.createElement("entity", { ...commonProps, uiText: uiText });
|
|
40762
41079
|
}
|
|
40763
41080
|
|
|
40764
41081
|
function getButtonProps(props) {
|
|
@@ -40781,15 +41098,18 @@
|
|
|
40781
41098
|
*/
|
|
40782
41099
|
|
|
40783
41100
|
function Button(props) {
|
|
40784
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...
|
|
41101
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...otherProps } = props;
|
|
40785
41102
|
const buttonProps = getButtonProps(props);
|
|
40786
41103
|
const uiBackgroundProps = parseUiBackground({
|
|
40787
41104
|
...buttonProps.uiBackground,
|
|
40788
41105
|
...uiBackground
|
|
40789
41106
|
});
|
|
41107
|
+
const { font, textAlign, ...uiTexProps } = otherProps;
|
|
40790
41108
|
const textProps = {
|
|
40791
41109
|
...buttonProps.uiText,
|
|
40792
|
-
...
|
|
41110
|
+
...uiTexProps,
|
|
41111
|
+
...getFont(font),
|
|
41112
|
+
...getTextAlign(textAlign)
|
|
40793
41113
|
};
|
|
40794
41114
|
const uiTransformProps = parseUiTransform({
|
|
40795
41115
|
height: 36,
|
|
@@ -40978,11 +41298,11 @@
|
|
|
40978
41298
|
const UiDropdownResult = UiDropdownResult$1(engine);
|
|
40979
41299
|
// Component ID Helper
|
|
40980
41300
|
const getComponentId = {
|
|
40981
|
-
uiTransform: UiTransform.
|
|
40982
|
-
uiText: UiText.
|
|
40983
|
-
uiBackground: UiBackground.
|
|
40984
|
-
uiInput: UiInput.
|
|
40985
|
-
uiDropdown: UiDropdown.
|
|
41301
|
+
uiTransform: UiTransform.componentId,
|
|
41302
|
+
uiText: UiText.componentId,
|
|
41303
|
+
uiBackground: UiBackground.componentId,
|
|
41304
|
+
uiInput: UiInput.componentId,
|
|
41305
|
+
uiDropdown: UiDropdown.componentId
|
|
40986
41306
|
};
|
|
40987
41307
|
function updateTree(instance, props) {
|
|
40988
41308
|
upsertComponent(instance, props, 'uiTransform');
|
|
@@ -41176,8 +41496,8 @@
|
|
|
41176
41496
|
return {
|
|
41177
41497
|
update: function (component) {
|
|
41178
41498
|
if (changeEvents.size) {
|
|
41179
|
-
handleOnChange(UiInput.
|
|
41180
|
-
handleOnChange(UiDropdown.
|
|
41499
|
+
handleOnChange(UiInput.componentId, UiInputResult);
|
|
41500
|
+
handleOnChange(UiDropdown.componentId, UiDropdownResult);
|
|
41181
41501
|
}
|
|
41182
41502
|
return reconciler.updateContainer(component, root, null);
|
|
41183
41503
|
},
|
|
@@ -41546,43 +41866,6 @@
|
|
|
41546
41866
|
return getEthereumProvider(EthereumController.sendAsync);
|
|
41547
41867
|
}
|
|
41548
41868
|
|
|
41549
|
-
/** @public */
|
|
41550
|
-
var ECSComponentIDs;
|
|
41551
|
-
(function (ECSComponentIDs) {
|
|
41552
|
-
ECSComponentIDs[ECSComponentIDs["Transform"] = 1] = "Transform";
|
|
41553
|
-
ECSComponentIDs[ECSComponentIDs["Animator"] = 1042] = "Animator";
|
|
41554
|
-
ECSComponentIDs[ECSComponentIDs["AudioSource"] = 1020] = "AudioSource";
|
|
41555
|
-
ECSComponentIDs[ECSComponentIDs["AudioStream"] = 1021] = "AudioStream";
|
|
41556
|
-
ECSComponentIDs[ECSComponentIDs["AvatarAttach"] = 1073] = "AvatarAttach";
|
|
41557
|
-
ECSComponentIDs[ECSComponentIDs["AvatarModifierArea"] = 1070] = "AvatarModifierArea";
|
|
41558
|
-
ECSComponentIDs[ECSComponentIDs["AvatarShape"] = 1080] = "AvatarShape";
|
|
41559
|
-
ECSComponentIDs[ECSComponentIDs["Billboard"] = 1090] = "Billboard";
|
|
41560
|
-
ECSComponentIDs[ECSComponentIDs["CameraMode"] = 1072] = "CameraMode";
|
|
41561
|
-
ECSComponentIDs[ECSComponentIDs["CameraModeArea"] = 1071] = "CameraModeArea";
|
|
41562
|
-
ECSComponentIDs[ECSComponentIDs["GltfContainer"] = 1041] = "GltfContainer";
|
|
41563
|
-
ECSComponentIDs[ECSComponentIDs["Material"] = 1017] = "Material";
|
|
41564
|
-
ECSComponentIDs[ECSComponentIDs["MeshCollider"] = 1019] = "MeshCollider";
|
|
41565
|
-
ECSComponentIDs[ECSComponentIDs["MeshRenderer"] = 1018] = "MeshRenderer";
|
|
41566
|
-
ECSComponentIDs[ECSComponentIDs["NftShape"] = 1040] = "NftShape";
|
|
41567
|
-
ECSComponentIDs[ECSComponentIDs["PointerEvents"] = 1062] = "PointerEvents";
|
|
41568
|
-
ECSComponentIDs[ECSComponentIDs["PointerEventsResult"] = 1063] = "PointerEventsResult";
|
|
41569
|
-
ECSComponentIDs[ECSComponentIDs["PointerLock"] = 1074] = "PointerLock";
|
|
41570
|
-
ECSComponentIDs[ECSComponentIDs["Raycast"] = 1067] = "Raycast";
|
|
41571
|
-
ECSComponentIDs[ECSComponentIDs["RaycastResult"] = 1068] = "RaycastResult";
|
|
41572
|
-
ECSComponentIDs[ECSComponentIDs["TextShape"] = 1030] = "TextShape";
|
|
41573
|
-
ECSComponentIDs[ECSComponentIDs["UiBackground"] = 1053] = "UiBackground";
|
|
41574
|
-
ECSComponentIDs[ECSComponentIDs["UiDropdown"] = 1094] = "UiDropdown";
|
|
41575
|
-
ECSComponentIDs[ECSComponentIDs["UiDropdownResult"] = 1096] = "UiDropdownResult";
|
|
41576
|
-
ECSComponentIDs[ECSComponentIDs["UiInput"] = 1093] = "UiInput";
|
|
41577
|
-
ECSComponentIDs[ECSComponentIDs["UiInputResult"] = 1095] = "UiInputResult";
|
|
41578
|
-
ECSComponentIDs[ECSComponentIDs["UiText"] = 1052] = "UiText";
|
|
41579
|
-
ECSComponentIDs[ECSComponentIDs["UiTransform"] = 1050] = "UiTransform";
|
|
41580
|
-
ECSComponentIDs[ECSComponentIDs["VisibilityComponent"] = 1081] = "VisibilityComponent";
|
|
41581
|
-
})(ECSComponentIDs || (ECSComponentIDs = {}));
|
|
41582
|
-
|
|
41583
|
-
const componentIds = Object.values(ECSComponentIDs)
|
|
41584
|
-
.filter((a) => typeof a === 'number')
|
|
41585
|
-
.map(Number);
|
|
41586
41869
|
function createRendererTransport(engineApi) {
|
|
41587
41870
|
async function sendToRenderer(message) {
|
|
41588
41871
|
const response = await engineApi.crdtSendToRenderer({
|
|
@@ -41609,7 +41892,7 @@
|
|
|
41609
41892
|
filter(message) {
|
|
41610
41893
|
if ((message.type === exports.CrdtMessageType.PUT_COMPONENT ||
|
|
41611
41894
|
message.type === exports.CrdtMessageType.DELETE_COMPONENT) &&
|
|
41612
|
-
|
|
41895
|
+
message.componentId > MAX_STATIC_COMPONENT) {
|
|
41613
41896
|
return false;
|
|
41614
41897
|
}
|
|
41615
41898
|
return !!message;
|
|
@@ -41624,6 +41907,9 @@
|
|
|
41624
41907
|
await engine.update(deltaTime);
|
|
41625
41908
|
await pollEvents(EngineApi.sendBatch);
|
|
41626
41909
|
}
|
|
41910
|
+
async function onStart() {
|
|
41911
|
+
await engine.seal();
|
|
41912
|
+
}
|
|
41627
41913
|
|
|
41628
41914
|
exports.AMOUNT_VERSION_AVAILABLE = AMOUNT_VERSION_AVAILABLE;
|
|
41629
41915
|
exports.Animator = Animator;
|
|
@@ -41727,6 +42013,7 @@
|
|
|
41727
42013
|
exports.UiTransform = UiTransform;
|
|
41728
42014
|
exports.VisibilityComponent = VisibilityComponent;
|
|
41729
42015
|
exports.components = index;
|
|
42016
|
+
exports.createComponentDefinitionFromSchema = createComponentDefinitionFromSchema;
|
|
41730
42017
|
exports.createEthereumProvider = createEthereumProvider;
|
|
41731
42018
|
exports.createInputSystem = createInputSystem;
|
|
41732
42019
|
exports.createPointerEventSystem = createPointerEventSystem;
|
|
@@ -41734,7 +42021,6 @@
|
|
|
41734
42021
|
exports.createTaskSystem = createTaskSystem;
|
|
41735
42022
|
exports.cyclicParentingChecker = cyclicParentingChecker;
|
|
41736
42023
|
exports.deepReadonly = deepReadonly;
|
|
41737
|
-
exports.defineComponent = defineComponent;
|
|
41738
42024
|
exports.engine = engine;
|
|
41739
42025
|
exports.executeTask = executeTask;
|
|
41740
42026
|
exports.inputSystem = inputSystem;
|
|
@@ -41751,6 +42037,7 @@
|
|
|
41751
42037
|
exports.onProfileChanged = onProfileChanged;
|
|
41752
42038
|
exports.onRealmChangedObservable = onRealmChangedObservable;
|
|
41753
42039
|
exports.onSceneReadyObservable = onSceneReadyObservable;
|
|
42040
|
+
exports.onStart = onStart;
|
|
41754
42041
|
exports.onUpdate = onUpdate;
|
|
41755
42042
|
exports.onVideoEvent = onVideoEvent;
|
|
41756
42043
|
exports.pointerEventsSystem = pointerEventsSystem;
|