@dcl/playground-assets 7.0.6-3824930139.commit-9bd6c05 → 7.0.6-3832097301.commit-4e46b20
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 +162 -46
- package/dist/beta.d.ts +162 -46
- package/dist/index.bundled.d.ts +162 -46
- package/dist/index.js +995 -532
- 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-assets.d.ts +162 -46
- package/etc/playground-assets.api.json +1608 -431
- package/etc/playground-assets.api.md +166 -46
- package/package.json +3 -3
package/dist/alpha.d.ts
CHANGED
|
@@ -202,10 +202,6 @@ export declare type ByteBuffer = {
|
|
|
202
202
|
* @returns The offset when this reserving starts.
|
|
203
203
|
*/
|
|
204
204
|
incrementWriteOffset(amount: number): number;
|
|
205
|
-
/**
|
|
206
|
-
* @returns The total number of bytes writen in the buffer.
|
|
207
|
-
*/
|
|
208
|
-
size(): number;
|
|
209
205
|
/**
|
|
210
206
|
* Take care using this function, if you modify the data after, the
|
|
211
207
|
* returned subarray will change too. If you'll modify the content of the
|
|
@@ -1057,6 +1053,57 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1057
1053
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1058
1054
|
};
|
|
1059
1055
|
|
|
1056
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1057
|
+
|
|
1058
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1059
|
+
|
|
1060
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessage;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Min length = 8 bytes
|
|
1064
|
+
* All message length including
|
|
1065
|
+
* @param length - Uint32 the length of all message (including the header)
|
|
1066
|
+
* @param type - define the function which handles the data
|
|
1067
|
+
*/
|
|
1068
|
+
export declare type CrdtMessageHeader = {
|
|
1069
|
+
length: Uint32;
|
|
1070
|
+
type: Uint32;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
export declare namespace CrdtMessageProtocol {
|
|
1074
|
+
/**
|
|
1075
|
+
* Validate if the message incoming is completed
|
|
1076
|
+
* @param buf - ByteBuffer
|
|
1077
|
+
*/
|
|
1078
|
+
export function validate(buf: ByteBuffer): boolean;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get the current header, consuming the bytes involved.
|
|
1081
|
+
* @param buf - ByteBuffer
|
|
1082
|
+
* @returns header or null if there is no validated message
|
|
1083
|
+
*/
|
|
1084
|
+
export function readHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1085
|
+
/**
|
|
1086
|
+
* Get the current header, without consuming the bytes involved.
|
|
1087
|
+
* @param buf - ByteBuffer
|
|
1088
|
+
* @returns header or null if there is no validated message
|
|
1089
|
+
*/
|
|
1090
|
+
export function getHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1091
|
+
/**
|
|
1092
|
+
* Consume the incoming message without processing it.
|
|
1093
|
+
* @param buf - ByteBuffer
|
|
1094
|
+
* @returns true in case of success or false if there is no valid message.
|
|
1095
|
+
*/
|
|
1096
|
+
export function consumeMessage(buf: ByteBuffer): boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export declare enum CrdtMessageType {
|
|
1100
|
+
RESERVED = 0,
|
|
1101
|
+
PUT_COMPONENT = 1,
|
|
1102
|
+
DELETE_COMPONENT = 2,
|
|
1103
|
+
DELETE_ENTITY = 3,
|
|
1104
|
+
MAX_MESSAGE_TYPE = 4
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1060
1107
|
export declare function createEthereumProvider(): {
|
|
1061
1108
|
send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
|
|
1062
1109
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
@@ -1150,6 +1197,40 @@ export declare function defineComponent<T>(componentId: number, spec: ISchema<T>
|
|
|
1150
1197
|
*/
|
|
1151
1198
|
export declare const DEG2RAD: number;
|
|
1152
1199
|
|
|
1200
|
+
export declare namespace DeleteComponent {
|
|
1201
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
1202
|
+
/**
|
|
1203
|
+
* Write DeleteComponent message
|
|
1204
|
+
*/
|
|
1205
|
+
export function write(entity: Entity, componentId: number, timestamp: number, buf: ByteBuffer): void;
|
|
1206
|
+
export function read(buf: ByteBuffer): DeleteComponentMessage | null;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1210
|
+
|
|
1211
|
+
export declare type DeleteComponentMessageBody = {
|
|
1212
|
+
type: CrdtMessageType.DELETE_COMPONENT;
|
|
1213
|
+
entityId: Entity;
|
|
1214
|
+
componentId: number;
|
|
1215
|
+
timestamp: number;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
export declare namespace DeleteEntity {
|
|
1219
|
+
const MESSAGE_HEADER_LENGTH = 4;
|
|
1220
|
+
export function write(entity: Entity, buf: ByteBuffer): void;
|
|
1221
|
+
export function read(buf: ByteBuffer): DeleteEntityMessage | null;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* @param entity - Uint32 number of the entity
|
|
1228
|
+
*/
|
|
1229
|
+
export declare type DeleteEntityMessageBody = {
|
|
1230
|
+
type: CrdtMessageType.DELETE_ENTITY;
|
|
1231
|
+
entityId: Entity;
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1153
1234
|
/**
|
|
1154
1235
|
* @public
|
|
1155
1236
|
*/
|
|
@@ -1183,7 +1264,7 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1183
1264
|
* Convertion from its compound numbers to entity:
|
|
1184
1265
|
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1185
1266
|
*/
|
|
1186
|
-
export declare type Entity =
|
|
1267
|
+
export declare type Entity = number & {
|
|
1187
1268
|
__entity_type: '';
|
|
1188
1269
|
};
|
|
1189
1270
|
|
|
@@ -1197,14 +1278,16 @@ export declare type EntityComponents = {
|
|
|
1197
1278
|
onMouseUp: Callback;
|
|
1198
1279
|
};
|
|
1199
1280
|
|
|
1200
|
-
export declare function EntityContainer():
|
|
1281
|
+
export declare function EntityContainer(): EntityContainer;
|
|
1282
|
+
|
|
1283
|
+
export declare type EntityContainer = {
|
|
1201
1284
|
generateEntity(): Entity;
|
|
1202
1285
|
removeEntity(entity: Entity): boolean;
|
|
1203
|
-
|
|
1286
|
+
getEntityState(entity: Entity): EntityState;
|
|
1204
1287
|
getExistingEntities(): Set<Entity>;
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1288
|
+
releaseRemovedEntities(): Entity[];
|
|
1289
|
+
updateRemovedEntity(entity: Entity): boolean;
|
|
1290
|
+
updateUsedEntity(entity: Entity): boolean;
|
|
1208
1291
|
};
|
|
1209
1292
|
|
|
1210
1293
|
/**
|
|
@@ -1215,6 +1298,36 @@ export declare type EntityPropTypes = {
|
|
|
1215
1298
|
uiBackground?: UiBackgroundProps;
|
|
1216
1299
|
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1217
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* @public
|
|
1303
|
+
*/
|
|
1304
|
+
export declare enum EntityState {
|
|
1305
|
+
Unknown = 0,
|
|
1306
|
+
/**
|
|
1307
|
+
* The entity was generated and added to the usedEntities set
|
|
1308
|
+
*/
|
|
1309
|
+
UsedEntity = 1,
|
|
1310
|
+
/**
|
|
1311
|
+
* The entity was removed from current engine or remotely
|
|
1312
|
+
*/
|
|
1313
|
+
Removed = 2,
|
|
1314
|
+
/**
|
|
1315
|
+
* The entity is reserved number.
|
|
1316
|
+
*/
|
|
1317
|
+
Reserved = 3
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
export declare namespace EntityUtils {
|
|
1321
|
+
/**
|
|
1322
|
+
* @returns [entityNumber, entityVersion]
|
|
1323
|
+
*/
|
|
1324
|
+
export function fromEntityId(entityId: Entity): [number, number];
|
|
1325
|
+
/**
|
|
1326
|
+
* @returns compound number from entityNumber and entityVerison
|
|
1327
|
+
*/
|
|
1328
|
+
export function toEntityId(entityNumber: number, entityVersion: number): Entity;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1218
1331
|
/**
|
|
1219
1332
|
* Constant used to define the minimal number value in Babylon.js
|
|
1220
1333
|
* @public
|
|
@@ -1298,11 +1411,11 @@ export declare type IEngine = {
|
|
|
1298
1411
|
*/
|
|
1299
1412
|
removeEntityWithChildren(firstEntity: Entity): void;
|
|
1300
1413
|
/**
|
|
1301
|
-
* Check
|
|
1414
|
+
* Check the state of an entityin the engine
|
|
1302
1415
|
* @param entity - the entity to validate
|
|
1303
|
-
* @returns
|
|
1416
|
+
* @returns known enum value
|
|
1304
1417
|
*/
|
|
1305
|
-
|
|
1418
|
+
getEntityState(entity: Entity): EntityState;
|
|
1306
1419
|
/**
|
|
1307
1420
|
* Add the system to the engine. It will be called every tick updated.
|
|
1308
1421
|
* @param system - function that receives the delta time between last tick and current one.
|
|
@@ -1418,6 +1531,10 @@ export declare type IEngine = {
|
|
|
1418
1531
|
* @param transport - transport which changes its onmessage to process CRDT messages
|
|
1419
1532
|
*/
|
|
1420
1533
|
addTransport(transport: Transport): void;
|
|
1534
|
+
/**
|
|
1535
|
+
* Entity continaer
|
|
1536
|
+
*/
|
|
1537
|
+
entityContainer: EntityContainer;
|
|
1421
1538
|
/**
|
|
1422
1539
|
* Iterator of registered components
|
|
1423
1540
|
*/
|
|
@@ -2651,7 +2768,7 @@ export declare class ObserverEventState {
|
|
|
2651
2768
|
/**
|
|
2652
2769
|
* @public
|
|
2653
2770
|
*/
|
|
2654
|
-
export declare type OnChangeFunction = (entity: Entity,
|
|
2771
|
+
export declare type OnChangeFunction = (entity: Entity, operation: CrdtMessageType, component?: ComponentDefinition<any>) => void;
|
|
2655
2772
|
|
|
2656
2773
|
export declare const onCommsMessage: Observable<{
|
|
2657
2774
|
sender: string;
|
|
@@ -3758,6 +3875,34 @@ export declare type Position = {
|
|
|
3758
3875
|
|
|
3759
3876
|
export declare type PositionUnit = `${number}px` | `${number}%` | number;
|
|
3760
3877
|
|
|
3878
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3879
|
+
|
|
3880
|
+
/**
|
|
3881
|
+
* Min. length = header (8 bytes) + 20 bytes = 28 bytes
|
|
3882
|
+
*
|
|
3883
|
+
* @param entity - Uint32 number of the entity
|
|
3884
|
+
* @param componentId - Uint32 number of id
|
|
3885
|
+
* @param timestamp - Uint64 Lamport timestamp
|
|
3886
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
3887
|
+
*/
|
|
3888
|
+
export declare type PutComponentMessageBody = {
|
|
3889
|
+
type: CrdtMessageType.PUT_COMPONENT;
|
|
3890
|
+
entityId: Entity;
|
|
3891
|
+
componentId: number;
|
|
3892
|
+
timestamp: number;
|
|
3893
|
+
data: Uint8Array;
|
|
3894
|
+
};
|
|
3895
|
+
|
|
3896
|
+
export declare namespace PutComponentOperation {
|
|
3897
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
3898
|
+
/**
|
|
3899
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
3900
|
+
* already allocated
|
|
3901
|
+
*/
|
|
3902
|
+
export function write(entity: Entity, timestamp: number, componentDefinition: ComponentDefinition<unknown>, buf: ByteBuffer): void;
|
|
3903
|
+
export function read(buf: ByteBuffer): PutComponentMessage | null;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3761
3906
|
/**
|
|
3762
3907
|
* @public
|
|
3763
3908
|
* Quaternion is a type and a namespace.
|
|
@@ -4086,13 +4231,8 @@ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition<unkno
|
|
|
4086
4231
|
*/
|
|
4087
4232
|
export declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
|
|
4088
4233
|
|
|
4089
|
-
export declare type ReceiveMessage = {
|
|
4090
|
-
type: WireMessage.Enum;
|
|
4091
|
-
entity: Entity;
|
|
4092
|
-
componentId: number;
|
|
4093
|
-
timestamp: number;
|
|
4234
|
+
export declare type ReceiveMessage = CrdtMessageBody & {
|
|
4094
4235
|
transportId?: number;
|
|
4095
|
-
data?: Uint8Array;
|
|
4096
4236
|
messageBuffer: Uint8Array;
|
|
4097
4237
|
};
|
|
4098
4238
|
|
|
@@ -4541,6 +4681,8 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4541
4681
|
/** @public */
|
|
4542
4682
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4543
4683
|
|
|
4684
|
+
export declare type Uint32 = number;
|
|
4685
|
+
|
|
4544
4686
|
/**
|
|
4545
4687
|
* @public It only defines the type explicitly, no effects.
|
|
4546
4688
|
*/
|
|
@@ -5208,32 +5350,6 @@ export declare type Vector3Type = {
|
|
|
5208
5350
|
/** @public */
|
|
5209
5351
|
export declare const VisibilityComponent: ComponentDefinition<PBVisibilityComponent>;
|
|
5210
5352
|
|
|
5211
|
-
export declare namespace WireMessage {
|
|
5212
|
-
export type Uint32 = number;
|
|
5213
|
-
export enum Enum {
|
|
5214
|
-
RESERVED = 0,
|
|
5215
|
-
PUT_COMPONENT = 1,
|
|
5216
|
-
DELETE_COMPONENT = 2,
|
|
5217
|
-
MAX_MESSAGE_TYPE = 3
|
|
5218
|
-
}
|
|
5219
|
-
/**
|
|
5220
|
-
* @param length - Uint32 the length of all message (including the header)
|
|
5221
|
-
* @param type - define the function which handles the data
|
|
5222
|
-
*/
|
|
5223
|
-
export type Header = {
|
|
5224
|
-
length: Uint32;
|
|
5225
|
-
type: Uint32;
|
|
5226
|
-
};
|
|
5227
|
-
const HEADER_LENGTH = 8;
|
|
5228
|
-
/**
|
|
5229
|
-
* Validate if the message incoming is completed
|
|
5230
|
-
* @param buf - ByteBuffer
|
|
5231
|
-
*/
|
|
5232
|
-
export function validate(buf: ByteBuffer): boolean;
|
|
5233
|
-
export function readHeader(buf: ByteBuffer): Header | null;
|
|
5234
|
-
export function getType(component: ComponentDefinition<unknown>, entity: Entity): Enum;
|
|
5235
|
-
}
|
|
5236
|
-
|
|
5237
5353
|
export declare const enum YGAlign {
|
|
5238
5354
|
YGA_AUTO = 0,
|
|
5239
5355
|
YGA_FLEX_START = 1,
|
package/dist/beta.d.ts
CHANGED
|
@@ -202,10 +202,6 @@ export declare type ByteBuffer = {
|
|
|
202
202
|
* @returns The offset when this reserving starts.
|
|
203
203
|
*/
|
|
204
204
|
incrementWriteOffset(amount: number): number;
|
|
205
|
-
/**
|
|
206
|
-
* @returns The total number of bytes writen in the buffer.
|
|
207
|
-
*/
|
|
208
|
-
size(): number;
|
|
209
205
|
/**
|
|
210
206
|
* Take care using this function, if you modify the data after, the
|
|
211
207
|
* returned subarray will change too. If you'll modify the content of the
|
|
@@ -1057,6 +1053,57 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1057
1053
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1058
1054
|
};
|
|
1059
1055
|
|
|
1056
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1057
|
+
|
|
1058
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1059
|
+
|
|
1060
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessage;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Min length = 8 bytes
|
|
1064
|
+
* All message length including
|
|
1065
|
+
* @param length - Uint32 the length of all message (including the header)
|
|
1066
|
+
* @param type - define the function which handles the data
|
|
1067
|
+
*/
|
|
1068
|
+
export declare type CrdtMessageHeader = {
|
|
1069
|
+
length: Uint32;
|
|
1070
|
+
type: Uint32;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
export declare namespace CrdtMessageProtocol {
|
|
1074
|
+
/**
|
|
1075
|
+
* Validate if the message incoming is completed
|
|
1076
|
+
* @param buf - ByteBuffer
|
|
1077
|
+
*/
|
|
1078
|
+
export function validate(buf: ByteBuffer): boolean;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get the current header, consuming the bytes involved.
|
|
1081
|
+
* @param buf - ByteBuffer
|
|
1082
|
+
* @returns header or null if there is no validated message
|
|
1083
|
+
*/
|
|
1084
|
+
export function readHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1085
|
+
/**
|
|
1086
|
+
* Get the current header, without consuming the bytes involved.
|
|
1087
|
+
* @param buf - ByteBuffer
|
|
1088
|
+
* @returns header or null if there is no validated message
|
|
1089
|
+
*/
|
|
1090
|
+
export function getHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1091
|
+
/**
|
|
1092
|
+
* Consume the incoming message without processing it.
|
|
1093
|
+
* @param buf - ByteBuffer
|
|
1094
|
+
* @returns true in case of success or false if there is no valid message.
|
|
1095
|
+
*/
|
|
1096
|
+
export function consumeMessage(buf: ByteBuffer): boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export declare enum CrdtMessageType {
|
|
1100
|
+
RESERVED = 0,
|
|
1101
|
+
PUT_COMPONENT = 1,
|
|
1102
|
+
DELETE_COMPONENT = 2,
|
|
1103
|
+
DELETE_ENTITY = 3,
|
|
1104
|
+
MAX_MESSAGE_TYPE = 4
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1060
1107
|
export declare function createEthereumProvider(): {
|
|
1061
1108
|
send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
|
|
1062
1109
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
@@ -1150,6 +1197,40 @@ export declare function defineComponent<T>(componentId: number, spec: ISchema<T>
|
|
|
1150
1197
|
*/
|
|
1151
1198
|
export declare const DEG2RAD: number;
|
|
1152
1199
|
|
|
1200
|
+
export declare namespace DeleteComponent {
|
|
1201
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
1202
|
+
/**
|
|
1203
|
+
* Write DeleteComponent message
|
|
1204
|
+
*/
|
|
1205
|
+
export function write(entity: Entity, componentId: number, timestamp: number, buf: ByteBuffer): void;
|
|
1206
|
+
export function read(buf: ByteBuffer): DeleteComponentMessage | null;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1210
|
+
|
|
1211
|
+
export declare type DeleteComponentMessageBody = {
|
|
1212
|
+
type: CrdtMessageType.DELETE_COMPONENT;
|
|
1213
|
+
entityId: Entity;
|
|
1214
|
+
componentId: number;
|
|
1215
|
+
timestamp: number;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
export declare namespace DeleteEntity {
|
|
1219
|
+
const MESSAGE_HEADER_LENGTH = 4;
|
|
1220
|
+
export function write(entity: Entity, buf: ByteBuffer): void;
|
|
1221
|
+
export function read(buf: ByteBuffer): DeleteEntityMessage | null;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* @param entity - Uint32 number of the entity
|
|
1228
|
+
*/
|
|
1229
|
+
export declare type DeleteEntityMessageBody = {
|
|
1230
|
+
type: CrdtMessageType.DELETE_ENTITY;
|
|
1231
|
+
entityId: Entity;
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1153
1234
|
/**
|
|
1154
1235
|
* @public
|
|
1155
1236
|
*/
|
|
@@ -1183,7 +1264,7 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1183
1264
|
* Convertion from its compound numbers to entity:
|
|
1184
1265
|
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1185
1266
|
*/
|
|
1186
|
-
export declare type Entity =
|
|
1267
|
+
export declare type Entity = number & {
|
|
1187
1268
|
__entity_type: '';
|
|
1188
1269
|
};
|
|
1189
1270
|
|
|
@@ -1197,14 +1278,16 @@ export declare type EntityComponents = {
|
|
|
1197
1278
|
onMouseUp: Callback;
|
|
1198
1279
|
};
|
|
1199
1280
|
|
|
1200
|
-
export declare function EntityContainer():
|
|
1281
|
+
export declare function EntityContainer(): EntityContainer;
|
|
1282
|
+
|
|
1283
|
+
export declare type EntityContainer = {
|
|
1201
1284
|
generateEntity(): Entity;
|
|
1202
1285
|
removeEntity(entity: Entity): boolean;
|
|
1203
|
-
|
|
1286
|
+
getEntityState(entity: Entity): EntityState;
|
|
1204
1287
|
getExistingEntities(): Set<Entity>;
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1288
|
+
releaseRemovedEntities(): Entity[];
|
|
1289
|
+
updateRemovedEntity(entity: Entity): boolean;
|
|
1290
|
+
updateUsedEntity(entity: Entity): boolean;
|
|
1208
1291
|
};
|
|
1209
1292
|
|
|
1210
1293
|
/**
|
|
@@ -1215,6 +1298,36 @@ export declare type EntityPropTypes = {
|
|
|
1215
1298
|
uiBackground?: UiBackgroundProps;
|
|
1216
1299
|
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1217
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* @public
|
|
1303
|
+
*/
|
|
1304
|
+
export declare enum EntityState {
|
|
1305
|
+
Unknown = 0,
|
|
1306
|
+
/**
|
|
1307
|
+
* The entity was generated and added to the usedEntities set
|
|
1308
|
+
*/
|
|
1309
|
+
UsedEntity = 1,
|
|
1310
|
+
/**
|
|
1311
|
+
* The entity was removed from current engine or remotely
|
|
1312
|
+
*/
|
|
1313
|
+
Removed = 2,
|
|
1314
|
+
/**
|
|
1315
|
+
* The entity is reserved number.
|
|
1316
|
+
*/
|
|
1317
|
+
Reserved = 3
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
export declare namespace EntityUtils {
|
|
1321
|
+
/**
|
|
1322
|
+
* @returns [entityNumber, entityVersion]
|
|
1323
|
+
*/
|
|
1324
|
+
export function fromEntityId(entityId: Entity): [number, number];
|
|
1325
|
+
/**
|
|
1326
|
+
* @returns compound number from entityNumber and entityVerison
|
|
1327
|
+
*/
|
|
1328
|
+
export function toEntityId(entityNumber: number, entityVersion: number): Entity;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1218
1331
|
/**
|
|
1219
1332
|
* Constant used to define the minimal number value in Babylon.js
|
|
1220
1333
|
* @public
|
|
@@ -1298,11 +1411,11 @@ export declare type IEngine = {
|
|
|
1298
1411
|
*/
|
|
1299
1412
|
removeEntityWithChildren(firstEntity: Entity): void;
|
|
1300
1413
|
/**
|
|
1301
|
-
* Check
|
|
1414
|
+
* Check the state of an entityin the engine
|
|
1302
1415
|
* @param entity - the entity to validate
|
|
1303
|
-
* @returns
|
|
1416
|
+
* @returns known enum value
|
|
1304
1417
|
*/
|
|
1305
|
-
|
|
1418
|
+
getEntityState(entity: Entity): EntityState;
|
|
1306
1419
|
/**
|
|
1307
1420
|
* Add the system to the engine. It will be called every tick updated.
|
|
1308
1421
|
* @param system - function that receives the delta time between last tick and current one.
|
|
@@ -1418,6 +1531,10 @@ export declare type IEngine = {
|
|
|
1418
1531
|
* @param transport - transport which changes its onmessage to process CRDT messages
|
|
1419
1532
|
*/
|
|
1420
1533
|
addTransport(transport: Transport): void;
|
|
1534
|
+
/**
|
|
1535
|
+
* Entity continaer
|
|
1536
|
+
*/
|
|
1537
|
+
entityContainer: EntityContainer;
|
|
1421
1538
|
/**
|
|
1422
1539
|
* Iterator of registered components
|
|
1423
1540
|
*/
|
|
@@ -2651,7 +2768,7 @@ export declare class ObserverEventState {
|
|
|
2651
2768
|
/**
|
|
2652
2769
|
* @public
|
|
2653
2770
|
*/
|
|
2654
|
-
export declare type OnChangeFunction = (entity: Entity,
|
|
2771
|
+
export declare type OnChangeFunction = (entity: Entity, operation: CrdtMessageType, component?: ComponentDefinition<any>) => void;
|
|
2655
2772
|
|
|
2656
2773
|
export declare const onCommsMessage: Observable<{
|
|
2657
2774
|
sender: string;
|
|
@@ -3758,6 +3875,34 @@ export declare type Position = {
|
|
|
3758
3875
|
|
|
3759
3876
|
export declare type PositionUnit = `${number}px` | `${number}%` | number;
|
|
3760
3877
|
|
|
3878
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3879
|
+
|
|
3880
|
+
/**
|
|
3881
|
+
* Min. length = header (8 bytes) + 20 bytes = 28 bytes
|
|
3882
|
+
*
|
|
3883
|
+
* @param entity - Uint32 number of the entity
|
|
3884
|
+
* @param componentId - Uint32 number of id
|
|
3885
|
+
* @param timestamp - Uint64 Lamport timestamp
|
|
3886
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
3887
|
+
*/
|
|
3888
|
+
export declare type PutComponentMessageBody = {
|
|
3889
|
+
type: CrdtMessageType.PUT_COMPONENT;
|
|
3890
|
+
entityId: Entity;
|
|
3891
|
+
componentId: number;
|
|
3892
|
+
timestamp: number;
|
|
3893
|
+
data: Uint8Array;
|
|
3894
|
+
};
|
|
3895
|
+
|
|
3896
|
+
export declare namespace PutComponentOperation {
|
|
3897
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
3898
|
+
/**
|
|
3899
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
3900
|
+
* already allocated
|
|
3901
|
+
*/
|
|
3902
|
+
export function write(entity: Entity, timestamp: number, componentDefinition: ComponentDefinition<unknown>, buf: ByteBuffer): void;
|
|
3903
|
+
export function read(buf: ByteBuffer): PutComponentMessage | null;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3761
3906
|
/**
|
|
3762
3907
|
* @public
|
|
3763
3908
|
* Quaternion is a type and a namespace.
|
|
@@ -4086,13 +4231,8 @@ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition<unkno
|
|
|
4086
4231
|
*/
|
|
4087
4232
|
export declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
|
|
4088
4233
|
|
|
4089
|
-
export declare type ReceiveMessage = {
|
|
4090
|
-
type: WireMessage.Enum;
|
|
4091
|
-
entity: Entity;
|
|
4092
|
-
componentId: number;
|
|
4093
|
-
timestamp: number;
|
|
4234
|
+
export declare type ReceiveMessage = CrdtMessageBody & {
|
|
4094
4235
|
transportId?: number;
|
|
4095
|
-
data?: Uint8Array;
|
|
4096
4236
|
messageBuffer: Uint8Array;
|
|
4097
4237
|
};
|
|
4098
4238
|
|
|
@@ -4541,6 +4681,8 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4541
4681
|
/** @public */
|
|
4542
4682
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4543
4683
|
|
|
4684
|
+
export declare type Uint32 = number;
|
|
4685
|
+
|
|
4544
4686
|
/**
|
|
4545
4687
|
* @public It only defines the type explicitly, no effects.
|
|
4546
4688
|
*/
|
|
@@ -5208,32 +5350,6 @@ export declare type Vector3Type = {
|
|
|
5208
5350
|
/** @public */
|
|
5209
5351
|
export declare const VisibilityComponent: ComponentDefinition<PBVisibilityComponent>;
|
|
5210
5352
|
|
|
5211
|
-
export declare namespace WireMessage {
|
|
5212
|
-
export type Uint32 = number;
|
|
5213
|
-
export enum Enum {
|
|
5214
|
-
RESERVED = 0,
|
|
5215
|
-
PUT_COMPONENT = 1,
|
|
5216
|
-
DELETE_COMPONENT = 2,
|
|
5217
|
-
MAX_MESSAGE_TYPE = 3
|
|
5218
|
-
}
|
|
5219
|
-
/**
|
|
5220
|
-
* @param length - Uint32 the length of all message (including the header)
|
|
5221
|
-
* @param type - define the function which handles the data
|
|
5222
|
-
*/
|
|
5223
|
-
export type Header = {
|
|
5224
|
-
length: Uint32;
|
|
5225
|
-
type: Uint32;
|
|
5226
|
-
};
|
|
5227
|
-
const HEADER_LENGTH = 8;
|
|
5228
|
-
/**
|
|
5229
|
-
* Validate if the message incoming is completed
|
|
5230
|
-
* @param buf - ByteBuffer
|
|
5231
|
-
*/
|
|
5232
|
-
export function validate(buf: ByteBuffer): boolean;
|
|
5233
|
-
export function readHeader(buf: ByteBuffer): Header | null;
|
|
5234
|
-
export function getType(component: ComponentDefinition<unknown>, entity: Entity): Enum;
|
|
5235
|
-
}
|
|
5236
|
-
|
|
5237
5353
|
export declare const enum YGAlign {
|
|
5238
5354
|
YGA_AUTO = 0,
|
|
5239
5355
|
YGA_FLEX_START = 1,
|