Component.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import Lifecycle from './Lifecycle';
  2. import { Object3D } from 'three';
  3. export default class Component extends Lifecycle {
  4. private _name;
  5. private _object3d;
  6. private _isReady;
  7. uuid: string;
  8. interface: ComponentInterface;
  9. enabled: boolean;
  10. constructor(name: string, object3d: Object3D);
  11. /**
  12. * The name by which to search a component.
  13. *
  14. * For best results, make sure you don't
  15. * repeat them within the same Object3D.
  16. */
  17. get name(): string;
  18. set name(newName: string);
  19. /**
  20. * Reference to the Object3D asociated to this component.
  21. *
  22. * Caution!! It can only be set internally by the engine
  23. */
  24. get object3d(): Object3D;
  25. /**
  26. * The 'ready' status of the component. This property will
  27. * be true once all the assets referenced in the 'interface'
  28. * of this component are loaded.
  29. */
  30. get isReady(): boolean;
  31. toJSON(): {
  32. name: string;
  33. componentPrototypeName: string;
  34. interface: ComponentInterface;
  35. interfaceRefs: {
  36. [propName: string]: any;
  37. };
  38. };
  39. fromJSON(json: any): void;
  40. private serializePropRef;
  41. private serializeInterfaceRefs;
  42. private loadInterfaceRefs;
  43. private readyNotifier;
  44. loadPropRef(interfaceRefs: Object, key: string | number, object: Object, readyProps: Object, propGI: string, actualProp?: string): void;
  45. awake(): void;
  46. start(): void;
  47. beforeUpdate(): void;
  48. update(): void;
  49. afterUpdate(): void;
  50. onBeforeRemoved(): void;
  51. onRemoved(): void;
  52. onBeforeObjetRemoved(): void;
  53. onObjectRemoved(): void;
  54. }
  55. export declare type ComponentInterface = {
  56. [propName: string]: 'String' | 'Number' | 'Boolean' | 'Select' | 'Vector2' | 'Vector3' | 'Object3D' | 'Prefab' | 'Texture' | 'Material' | 'Component' | 'Audio' | 'Color' | 'PositionalAudio' | 'AnimationClip';
  57. };