Component.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. private _enabled;
  8. uuid: string;
  9. interface: ComponentInterface;
  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. get enabled(): boolean;
  32. set enabled(value: boolean);
  33. toJSON(): {
  34. name: string;
  35. componentPrototypeName: string;
  36. interface: ComponentInterface;
  37. interfaceRefs: {
  38. [propName: string]: any;
  39. };
  40. };
  41. fromJSON(json: any): void;
  42. private serializePropRef;
  43. private serializeInterfaceRefs;
  44. private loadInterfaceRefs;
  45. private readyNotifier;
  46. private loadPropRef;
  47. awake(): void;
  48. start(): void;
  49. beforeUpdate(): void;
  50. update(): void;
  51. afterUpdate(): void;
  52. onBeforeRemoved(): void;
  53. onRemoved(): void;
  54. onBeforeObjectRemoved(): void;
  55. onObjectRemoved(): void;
  56. onDisabled(): void;
  57. }
  58. type ComponentInterfaceType = 'String' | 'Number' | 'Boolean' | 'Select' | 'Vector2' | 'Vector3' | 'Object3D' | 'Prefab' | 'Texture' | 'Material' | 'Component' | 'Audio' | 'Color' | 'PositionalAudio' | 'AnimationClip' | 'Button' | 'Data' | 'Code';
  59. export type ComponentInterface = {
  60. [propName: string]: ComponentInterfaceType | {
  61. type: ComponentInterfaceType;
  62. options?: any;
  63. };
  64. };
  65. export {};