lyb-pixi-js 1.12.9 → 1.12.11
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/README.md +5 -0
- package/Utils/LibPixiTicker.d.ts +14 -0
- package/Utils/LibPixiTicker.js +49 -0
- package/libPixiJs.d.ts +3 -0
- package/libPixiJs.js +3 -0
- package/lyb-pixi.js +49 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @description Ticker管理器 */
|
|
2
|
+
export declare class LibPixiTicker {
|
|
3
|
+
private static _callbacks;
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id: string, fn: () => void): () => void;
|
|
6
|
+
/** @description 删除回调 */
|
|
7
|
+
static remove(id: string): void;
|
|
8
|
+
/** @description 停止某个回调(pause) */
|
|
9
|
+
static stop(id: string): void;
|
|
10
|
+
/** @description 启动某个回调(resume) */
|
|
11
|
+
static start(id: string): void;
|
|
12
|
+
/** @description 清空所有回调 */
|
|
13
|
+
static clearAll(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Ticker } from "pixi.js";
|
|
2
|
+
/** @description Ticker管理器 */
|
|
3
|
+
export class LibPixiTicker {
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id, fn) {
|
|
6
|
+
// 如果已有相同 ID,先移除旧回调
|
|
7
|
+
if (this._callbacks.has(id)) {
|
|
8
|
+
Ticker.shared.remove(this._callbacks.get(id).fn);
|
|
9
|
+
}
|
|
10
|
+
// 默认 active
|
|
11
|
+
this._callbacks.set(id, { fn, active: true });
|
|
12
|
+
Ticker.shared.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
LibPixiTicker.remove(id);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** @description 删除回调 */
|
|
18
|
+
static remove(id) {
|
|
19
|
+
const cb = this._callbacks.get(id);
|
|
20
|
+
if (cb) {
|
|
21
|
+
Ticker.shared.remove(cb.fn);
|
|
22
|
+
this._callbacks.delete(id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** @description 停止某个回调(pause) */
|
|
26
|
+
static stop(id) {
|
|
27
|
+
const cb = this._callbacks.get(id);
|
|
28
|
+
if (cb && cb.active) {
|
|
29
|
+
Ticker.shared.remove(cb.fn);
|
|
30
|
+
cb.active = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** @description 启动某个回调(resume) */
|
|
34
|
+
static start(id) {
|
|
35
|
+
const cb = this._callbacks.get(id);
|
|
36
|
+
if (cb && !cb.active) {
|
|
37
|
+
Ticker.shared.add(cb.fn);
|
|
38
|
+
cb.active = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** @description 清空所有回调 */
|
|
42
|
+
static clearAll() {
|
|
43
|
+
this._callbacks.forEach((cb) => {
|
|
44
|
+
Ticker.shared.remove(cb.fn);
|
|
45
|
+
});
|
|
46
|
+
this._callbacks.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
LibPixiTicker._callbacks = new Map();
|
package/libPixiJs.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { LibPixiRound } from "./Components/Base/LibPixiRound";
|
|
|
34
34
|
import { LibPixiRoundedRect } from "./Components/Base/LibPixiRoundedRect";
|
|
35
35
|
import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
36
36
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
37
|
+
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
37
38
|
/** @description 组件 */
|
|
38
39
|
export declare const Components: {
|
|
39
40
|
Base: {
|
|
@@ -284,4 +285,6 @@ export declare const Utils: {
|
|
|
284
285
|
* @param payload 事件携带数据
|
|
285
286
|
*/
|
|
286
287
|
LibPixiEmitContainerEvent: (container: import("pixi.js").Container, event: string, payload?: any) => void;
|
|
288
|
+
/** @description Ticker管理器 */
|
|
289
|
+
LibPixiTicker: typeof LibPixiTicker;
|
|
287
290
|
};
|
package/libPixiJs.js
CHANGED
|
@@ -53,6 +53,7 @@ import { LibPixiRound } from "./Components/Base/LibPixiRound";
|
|
|
53
53
|
import { LibPixiRoundedRect } from "./Components/Base/LibPixiRoundedRect";
|
|
54
54
|
import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
55
55
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
56
|
+
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
56
57
|
/** @description 组件 */
|
|
57
58
|
export const Components = {
|
|
58
59
|
Base: {
|
|
@@ -303,4 +304,6 @@ export const Utils = {
|
|
|
303
304
|
* @param payload 事件携带数据
|
|
304
305
|
*/
|
|
305
306
|
LibPixiEmitContainerEvent,
|
|
307
|
+
/** @description Ticker管理器 */
|
|
308
|
+
LibPixiTicker,
|
|
306
309
|
};
|
package/lyb-pixi.js
CHANGED
|
@@ -58365,6 +58365,52 @@ void main(void){
|
|
|
58365
58365
|
this._elementList = [];
|
|
58366
58366
|
}
|
|
58367
58367
|
}
|
|
58368
|
+
const _LibPixiTicker = class _LibPixiTicker2 {
|
|
58369
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
58370
|
+
static add(id2, fn) {
|
|
58371
|
+
if (this._callbacks.has(id2)) {
|
|
58372
|
+
Ticker.shared.remove(this._callbacks.get(id2).fn);
|
|
58373
|
+
}
|
|
58374
|
+
this._callbacks.set(id2, { fn, active: true });
|
|
58375
|
+
Ticker.shared.add(fn);
|
|
58376
|
+
return () => {
|
|
58377
|
+
_LibPixiTicker2.remove(id2);
|
|
58378
|
+
};
|
|
58379
|
+
}
|
|
58380
|
+
/** @description 删除回调 */
|
|
58381
|
+
static remove(id2) {
|
|
58382
|
+
const cb = this._callbacks.get(id2);
|
|
58383
|
+
if (cb) {
|
|
58384
|
+
Ticker.shared.remove(cb.fn);
|
|
58385
|
+
this._callbacks.delete(id2);
|
|
58386
|
+
}
|
|
58387
|
+
}
|
|
58388
|
+
/** @description 停止某个回调(pause) */
|
|
58389
|
+
static stop(id2) {
|
|
58390
|
+
const cb = this._callbacks.get(id2);
|
|
58391
|
+
if (cb && cb.active) {
|
|
58392
|
+
Ticker.shared.remove(cb.fn);
|
|
58393
|
+
cb.active = false;
|
|
58394
|
+
}
|
|
58395
|
+
}
|
|
58396
|
+
/** @description 启动某个回调(resume) */
|
|
58397
|
+
static start(id2) {
|
|
58398
|
+
const cb = this._callbacks.get(id2);
|
|
58399
|
+
if (cb && !cb.active) {
|
|
58400
|
+
Ticker.shared.add(cb.fn);
|
|
58401
|
+
cb.active = true;
|
|
58402
|
+
}
|
|
58403
|
+
}
|
|
58404
|
+
/** @description 清空所有回调 */
|
|
58405
|
+
static clearAll() {
|
|
58406
|
+
this._callbacks.forEach((cb) => {
|
|
58407
|
+
Ticker.shared.remove(cb.fn);
|
|
58408
|
+
});
|
|
58409
|
+
this._callbacks.clear();
|
|
58410
|
+
}
|
|
58411
|
+
};
|
|
58412
|
+
_LibPixiTicker._callbacks = /* @__PURE__ */ new Map();
|
|
58413
|
+
let LibPixiTicker = _LibPixiTicker;
|
|
58368
58414
|
const Components = {
|
|
58369
58415
|
Base: {
|
|
58370
58416
|
/** (已废弃)
|
|
@@ -58612,7 +58658,9 @@ void main(void){
|
|
|
58612
58658
|
* @param event 事件名称
|
|
58613
58659
|
* @param payload 事件携带数据
|
|
58614
58660
|
*/
|
|
58615
|
-
LibPixiEmitContainerEvent
|
|
58661
|
+
LibPixiEmitContainerEvent,
|
|
58662
|
+
/** @description Ticker管理器 */
|
|
58663
|
+
LibPixiTicker
|
|
58616
58664
|
};
|
|
58617
58665
|
const LibPixiJs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
58618
58666
|
__proto__: null,
|