@galacean/effects-core 2.0.0-beta.0 → 2.0.0-beta.1

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.
@@ -199,7 +199,6 @@ export declare class ParticleSystem extends Component {
199
199
  resumeParticleEmission(): void;
200
200
  getBoundingBox(): void | BoundingBoxSphere;
201
201
  getHitTestParams: (force?: boolean) => void | HitTestCustomParams;
202
- onAttached(): void;
203
202
  fromData(data: unknown): void;
204
203
  }
205
204
  export {};
@@ -1,13 +1,16 @@
1
1
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
2
  import * as spec from '@galacean/effects-specification';
3
3
  import type { VFXItemData } from './asset-loader';
4
- import type { Component, RendererComponent, Behaviour } from './components';
4
+ import type { Component } from './components';
5
+ import { RendererComponent, Behaviour } from './components';
5
6
  import type { Composition } from './composition';
6
7
  import { EffectsObject } from './effects-object';
7
8
  import type { Engine } from './engine';
8
- import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, ParticleSystem, SpriteComponent } from './plugins';
9
+ import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, SpriteComponent } from './plugins';
10
+ import { ParticleSystem } from './plugins';
9
11
  import { Transform } from './transform';
10
12
  import type { Constructor, Disposable } from './utils';
13
+ import type { EventEmitterListener, EventEmitterOptions, ItemEvent } from './events';
11
14
  export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent | undefined | {};
12
15
  export type VFXItemConstructor = new (engine: Engine, props: VFXItemProps, composition: Composition) => VFXItem;
13
16
  export type VFXItemProps = spec.Item & {
@@ -86,6 +89,7 @@ export declare class VFXItem extends EffectsObject implements Disposable {
86
89
  */
87
90
  private speed;
88
91
  private listIndex;
92
+ private eventProcessor;
89
93
  static isComposition(item: VFXItem): boolean;
90
94
  static isSprite(item: VFXItem): boolean;
91
95
  static isParticle(item: VFXItem): boolean;
@@ -107,6 +111,39 @@ export declare class VFXItem extends EffectsObject implements Disposable {
107
111
  */
108
112
  get renderOrder(): number;
109
113
  set renderOrder(value: number);
114
+ /**
115
+ * 元素监听事件
116
+ * @param eventName - 事件名称
117
+ * @param listener - 事件监听器
118
+ * @param options - 事件监听器选项
119
+ * @returns
120
+ */
121
+ on<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>, options?: EventEmitterOptions): void;
122
+ /**
123
+ * 移除事件监听器
124
+ * @param eventName - 事件名称
125
+ * @param listener - 事件监听器
126
+ * @returns
127
+ */
128
+ off<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>): void;
129
+ /**
130
+ * 一次性监听事件
131
+ * @param eventName - 事件名称
132
+ * @param listener - 事件监听器
133
+ */
134
+ once<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>): void;
135
+ /**
136
+ * 触发事件
137
+ * @param eventName - 事件名称
138
+ * @param args - 事件参数
139
+ */
140
+ emit<E extends keyof ItemEvent>(eventName: E, ...args: ItemEvent[E]): void;
141
+ /**
142
+ * 获取事件名称对应的所有监听器
143
+ * @param eventName - 事件名称
144
+ * @returns - 返回事件名称对应的所有监听器
145
+ */
146
+ getListeners<E extends keyof ItemEvent>(eventName: E): EventEmitterListener<ItemEvent[E]>[];
110
147
  /**
111
148
  * 设置元素的动画速度
112
149
  * @param speed - 速度
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",