@truelab/truengine 0.0.1-0
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/truengine.es.js +35354 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/src/classes/assets.class.d.ts +89 -0
- package/dist/types/src/classes/bitmap.text.class.d.ts +77 -0
- package/dist/types/src/classes/borderview.class.d.ts +204 -0
- package/dist/types/src/classes/color.class.d.ts +72 -0
- package/dist/types/src/classes/container.class.d.ts +111 -0
- package/dist/types/src/classes/di.class.d.ts +110 -0
- package/dist/types/src/classes/emitter.class.d.ts +64 -0
- package/dist/types/src/classes/engine.class.d.ts +75 -0
- package/dist/types/src/classes/loaders.class.d.ts +28 -0
- package/dist/types/src/classes/preloader.class.d.ts +15 -0
- package/dist/types/src/classes/producer.class.d.ts +135 -0
- package/dist/types/src/classes/sequence.class.d.ts +30 -0
- package/dist/types/src/classes/skipable.class.d.ts +15 -0
- package/dist/types/src/classes/spine.assets.class.d.ts +42 -0
- package/dist/types/src/classes/tile.class.d.ts +38 -0
- package/dist/types/src/components/abstract.component.d.ts +52 -0
- package/dist/types/src/components/abstract.html.component.d.ts +43 -0
- package/dist/types/src/components/bigwin.component.d.ts +109 -0
- package/dist/types/src/components/blackout.component.d.ts +32 -0
- package/dist/types/src/components/button.component.d.ts +113 -0
- package/dist/types/src/components/button.faded.component.d.ts +29 -0
- package/dist/types/src/components/button.text.component.d.ts +49 -0
- package/dist/types/src/components/cheat.component.d.ts +63 -0
- package/dist/types/src/components/fillframe.component.d.ts +37 -0
- package/dist/types/src/components/fps.component.d.ts +39 -0
- package/dist/types/src/components/grid.component.d.ts +28 -0
- package/dist/types/src/components/link.component.d.ts +78 -0
- package/dist/types/src/components/particles.component.d.ts +30 -0
- package/dist/types/src/components/progress.component.d.ts +42 -0
- package/dist/types/src/components/slideshow/slides.reel.component.d.ts +65 -0
- package/dist/types/src/components/slideshow/slideshow.component.d.ts +27 -0
- package/dist/types/src/components/slideshow/slideshow.ui.component.d.ts +28 -0
- package/dist/types/src/components/slideshow/slideshow.ui.pagination.d.ts +30 -0
- package/dist/types/src/components/slot/coefficient/coefficient.component.d.ts +66 -0
- package/dist/types/src/components/slot/frames/frames.component.d.ts +39 -0
- package/dist/types/src/components/slot/frames/frames.sequence.component.d.ts +17 -0
- package/dist/types/src/components/slot/frames/frames.spine.component.d.ts +21 -0
- package/dist/types/src/components/slot/hints/hints.component.d.ts +102 -0
- package/dist/types/src/components/slot/intrigue/intrigue.component.d.ts +41 -0
- package/dist/types/src/components/slot/intrigue/intrigue.spine.component.d.ts +18 -0
- package/dist/types/src/components/slot/lines/lines.component.d.ts +29 -0
- package/dist/types/src/components/slot/lines/lines.static.component.d.ts +38 -0
- package/dist/types/src/components/slot/reel.component.d.ts +253 -0
- package/dist/types/src/components/slot/slot.cheats.d.ts +22 -0
- package/dist/types/src/components/slot/slot.component.d.ts +132 -0
- package/dist/types/src/components/slot/slot.config.d.ts +82 -0
- package/dist/types/src/components/slot/symbol/symbol.component.d.ts +84 -0
- package/dist/types/src/components/slot/symbol/symbol.sequence.component.d.ts +18 -0
- package/dist/types/src/components/slot/symbol/symbol.spine.component.d.ts +18 -0
- package/dist/types/src/components/switch.component.d.ts +62 -0
- package/dist/types/src/components/text.component.d.ts +101 -0
- package/dist/types/src/components/volatility/volatility.component.d.ts +55 -0
- package/dist/types/src/components/volatility/volatility.symbol.component.d.ts +20 -0
- package/dist/types/src/extends/enum.types.d.ts +36 -0
- package/dist/types/src/extends/interfaces.d.ts +74 -0
- package/dist/types/src/extends/javascript.d.ts +5 -0
- package/dist/types/src/extends/short.types.d.ts +68 -0
- package/dist/types/src/extends/struct.types.d.ts +260 -0
- package/dist/types/src/functions/agent.funcs.d.ts +84 -0
- package/dist/types/src/functions/animate/counter.func.d.ts +10 -0
- package/dist/types/src/functions/animate/fadein.func.d.ts +8 -0
- package/dist/types/src/functions/animate/fadeout.func.d.ts +8 -0
- package/dist/types/src/functions/animate/from.func.d.ts +10 -0
- package/dist/types/src/functions/animate/fromto.func.d.ts +11 -0
- package/dist/types/src/functions/animate/to.func.d.ts +10 -0
- package/dist/types/src/functions/array/indexofall.func.d.ts +2 -0
- package/dist/types/src/functions/array/position.func.d.ts +6 -0
- package/dist/types/src/functions/array/unique.func.d.ts +6 -0
- package/dist/types/src/functions/arraysintersect.func.d.ts +2 -0
- package/dist/types/src/functions/cache.funcs.d.ts +20 -0
- package/dist/types/src/functions/cheats.func.d.ts +2 -0
- package/dist/types/src/functions/convert/tofixed.func.d.ts +9 -0
- package/dist/types/src/functions/debug/container.func.d.ts +7 -0
- package/dist/types/src/functions/debug/line.func.d.ts +10 -0
- package/dist/types/src/functions/demotexture.func.d.ts +3 -0
- package/dist/types/src/functions/dom.funcs.d.ts +6 -0
- package/dist/types/src/functions/draw/canvasExtract.func.d.ts +16 -0
- package/dist/types/src/functions/draw/gradient.texture.func.d.ts +14 -0
- package/dist/types/src/functions/draw/radialGradient.func.d.ts +20 -0
- package/dist/types/src/functions/draw/rect.func.d.ts +12 -0
- package/dist/types/src/functions/draw/reel.func.d.ts +9 -0
- package/dist/types/src/functions/engine.funcs.d.ts +63 -0
- package/dist/types/src/functions/is.funcs.d.ts +16 -0
- package/dist/types/src/functions/math.funcs.d.ts +38 -0
- package/dist/types/src/functions/number/between.func.d.ts +7 -0
- package/dist/types/src/functions/object/deepMerge.d.ts +7 -0
- package/dist/types/src/functions/random/exclude.func.d.ts +6 -0
- package/dist/types/src/functions/random/inrange.func.d.ts +6 -0
- package/dist/types/src/functions/random/value.func.d.ts +10 -0
- package/dist/types/src/functions/range.func.d.ts +3 -0
- package/dist/types/src/functions/speed/duration.func.d.ts +6 -0
- package/dist/types/src/functions/speed/mode.func.d.ts +7 -0
- package/dist/types/src/functions/time/full.func.d.ts +4 -0
- package/dist/types/src/functions/time/nowfull.func.d.ts +4 -0
- package/dist/types/src/functions/time/nowshort.func.d.ts +5 -0
- package/dist/types/src/functions/time/short.func.d.ts +7 -0
- package/dist/types/src/functions/timeline/create.funcs.d.ts +8 -0
- package/dist/types/src/functions/timeline/taps.func.d.ts +4 -0
- package/dist/types/src/functions/window/add.func.d.ts +7 -0
- package/dist/types/src/functions/window/get.func.d.ts +6 -0
- package/dist/types/src/index.d.ts +62 -0
- package/dist/types/src/plugins/dragon.bones/functions.d.ts +18 -0
- package/dist/types/src/plugins/dragon.bones/library.d.ts +875 -0
- package/dist/types/src/plugins/gsap/custom.ease.plugin.d.ts +2 -0
- package/dist/types/src/plugins/gsap/motion.path.plugin.d.ts +2 -0
- package/dist/types/src/plugins/modernizr/modernizr-custom.d.ts +1 -0
- package/dist/types/src/references.d.ts +4 -0
- package/dist/types/src/scenes/abstract.scene.d.ts +73 -0
- package/dist/types/src/scenes/background.scene.d.ts +35 -0
- package/dist/types/src/scenes/masked.scene.d.ts +15 -0
- package/dist/types/src/services/focus.services.d.ts +17 -0
- package/dist/types/src/services/iframe.service.d.ts +27 -0
- package/dist/types/src/services/langs.service.d.ts +31 -0
- package/dist/types/src/services/registry.service.d.ts +29 -0
- package/dist/types/src/services/settings.service.d.ts +51 -0
- package/dist/types/src/services/skip.service.d.ts +51 -0
- package/dist/types/src/services/sounds/sounds.service.d.ts +111 -0
- package/dist/types/src/services/storage.service.d.ts +38 -0
- package/dist/types/vite.config.d.ts +2 -0
- package/package.json +33 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EEventPriority } from '../extends/enum.types';
|
|
2
|
+
import { TMixedObject } from '../extends/short.types';
|
|
3
|
+
export type IEmitterListener = (params?: TMixedObject) => unknown;
|
|
4
|
+
export type IEmitterEvent = {
|
|
5
|
+
group: string;
|
|
6
|
+
listener: IEmitterListener;
|
|
7
|
+
priority: EEventPriority;
|
|
8
|
+
isOnce: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type IEmitter = {
|
|
11
|
+
on(event: string, group: string, listener: IEmitterListener, priority: EEventPriority, isOnce: boolean): IEmitter;
|
|
12
|
+
once(event: string, group: string, listener: IEmitterListener, priority: EEventPriority): IEmitter;
|
|
13
|
+
off(event: string, group?: string): IEmitter;
|
|
14
|
+
clear(group: string): IEmitter;
|
|
15
|
+
emit(event: string, params?: TMixedObject): Promise<boolean>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Эмиттер для DI
|
|
19
|
+
*
|
|
20
|
+
* @rules
|
|
21
|
+
* - события изменения настроек: this.set('balance', 0) -> emit -> on('settings.balance:set')
|
|
22
|
+
* - события задаются именем "объект:действие"
|
|
23
|
+
*/
|
|
24
|
+
export declare class Emitter implements IEmitter {
|
|
25
|
+
protected static events: Map<string, IEmitterEvent[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Подписываемся на событие
|
|
28
|
+
*
|
|
29
|
+
* @param event - listener event
|
|
30
|
+
* @param group - listener group
|
|
31
|
+
* @param listener - callback
|
|
32
|
+
* @param priority - listener priority (auto sort when adding)
|
|
33
|
+
* @param isOnce - callable at once
|
|
34
|
+
*/
|
|
35
|
+
on(event: string, group: string, listener: IEmitterListener, priority?: EEventPriority, isOnce?: boolean): Emitter;
|
|
36
|
+
/**
|
|
37
|
+
* Добавляет одноразовый слушатель на событие
|
|
38
|
+
*
|
|
39
|
+
* @param event - listener event
|
|
40
|
+
* @param group - listener group
|
|
41
|
+
* @param listener - callback
|
|
42
|
+
* @param priority - listener priority (auto sort when adding)
|
|
43
|
+
*/
|
|
44
|
+
once(event: string, group: string, listener: IEmitterListener, priority?: EEventPriority): Emitter;
|
|
45
|
+
/**
|
|
46
|
+
* Глушим слушателей
|
|
47
|
+
*
|
|
48
|
+
* @param event - listener event
|
|
49
|
+
* @param group - listener group
|
|
50
|
+
*/
|
|
51
|
+
off(event: string, group?: string): Emitter;
|
|
52
|
+
/** */
|
|
53
|
+
clear(group: string): Emitter;
|
|
54
|
+
/**
|
|
55
|
+
* Выбрасываем событие
|
|
56
|
+
*
|
|
57
|
+
* @example this.emit('animate.balance', {value: 1000}) - если не нужно ждать
|
|
58
|
+
* @example await this.emit('animate.balance', {value: 1500}); this.sounds.play('win') - если нужно дождаться
|
|
59
|
+
* @param event - listener event
|
|
60
|
+
* @param params - listener call payload
|
|
61
|
+
* @withoutcontext
|
|
62
|
+
*/
|
|
63
|
+
emit(event: string, params?: TMixedObject): Promise<boolean>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { IPixiEngine } from '../extends/interfaces';
|
|
2
|
+
import { TEngineSettings } from '../extends/struct.types';
|
|
3
|
+
import { FocusServise } from '../services/focus.services';
|
|
4
|
+
import { SkipService } from '../services/skip.service';
|
|
5
|
+
import { SoundsService } from '../services/sounds/sounds.service';
|
|
6
|
+
import { StorageService } from '../services/storage.service';
|
|
7
|
+
import { Assets } from './assets.class';
|
|
8
|
+
import { DI } from './di.class';
|
|
9
|
+
import { Producer } from './producer.class';
|
|
10
|
+
import * as PIXI from 'pixi.js';
|
|
11
|
+
/**
|
|
12
|
+
* mousedown - кнопка мыши нажата
|
|
13
|
+
* mouseup - отпущена
|
|
14
|
+
* pointerover - курсор заходит на канвас + первое движение
|
|
15
|
+
* pointerout - курсор выходит за пределы канваса
|
|
16
|
+
* pointermove - курсор перемещается по канвасу
|
|
17
|
+
*/
|
|
18
|
+
export declare enum EEngineAllowEvents {
|
|
19
|
+
mouseDown = "mousedown",
|
|
20
|
+
mouseUp = "mouseup",
|
|
21
|
+
pointerUp = "pointerup",
|
|
22
|
+
pointerDown = "pointerdown",
|
|
23
|
+
pointerOver = "pointerover",
|
|
24
|
+
pointerOut = "pointerout",
|
|
25
|
+
pointerMove = "pointermove"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Движок для геймплея всех игр (pixi)
|
|
29
|
+
* @tasks
|
|
30
|
+
* - обработчики событий
|
|
31
|
+
* - инициатор событий
|
|
32
|
+
* - управление общением с сервером
|
|
33
|
+
*/
|
|
34
|
+
export declare class Engine extends DI implements IPixiEngine {
|
|
35
|
+
producer: Producer;
|
|
36
|
+
assets: Assets;
|
|
37
|
+
name: string;
|
|
38
|
+
sounds: () => SoundsService;
|
|
39
|
+
storage: () => StorageService;
|
|
40
|
+
focus: () => FocusServise;
|
|
41
|
+
skip: () => SkipService;
|
|
42
|
+
readonly canvas: HTMLElement;
|
|
43
|
+
readonly preload: Promise<boolean>[];
|
|
44
|
+
readonly driver: PIXI.Application;
|
|
45
|
+
protected _tickerInterval: number;
|
|
46
|
+
protected _processing: boolean;
|
|
47
|
+
protected _pressedKeys: Map<number, boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* @constructor
|
|
50
|
+
* @param {jQuery} canvas
|
|
51
|
+
* @param {String} appName
|
|
52
|
+
*/
|
|
53
|
+
constructor(canvas?: HTMLElement, appName?: string, settings?: TEngineSettings, stage?: PIXI.Container);
|
|
54
|
+
/**
|
|
55
|
+
* Старт приложения
|
|
56
|
+
*/
|
|
57
|
+
start(): PIXI.Application;
|
|
58
|
+
/**
|
|
59
|
+
* Остановка приложения
|
|
60
|
+
*/
|
|
61
|
+
stop(): PIXI.Application;
|
|
62
|
+
/**
|
|
63
|
+
* Регистрация событий
|
|
64
|
+
* @param events
|
|
65
|
+
*/
|
|
66
|
+
registerRendererEvents(events: EEngineAllowEvents[]): Engine;
|
|
67
|
+
/**
|
|
68
|
+
* Регистрация событий нажатия клавиш
|
|
69
|
+
*/
|
|
70
|
+
registerKeyboardEvents(): Engine;
|
|
71
|
+
/** Обработка нажатия кнопок */
|
|
72
|
+
protected _emitKeyDown(keyCode: number): Promise<boolean>;
|
|
73
|
+
/** Обработка отжатия кнопок */
|
|
74
|
+
protected _emitKeyUp(keyCode: number): Promise<boolean>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Sound } from '@pixi/sound';
|
|
2
|
+
import { Emitter } from './emitter.class';
|
|
3
|
+
import * as PIXI from 'pixi.js';
|
|
4
|
+
export type ILoaderResource = {
|
|
5
|
+
sound: Sound;
|
|
6
|
+
url: string;
|
|
7
|
+
} & PIXI.LoaderResource;
|
|
8
|
+
/**
|
|
9
|
+
* Загрузчик ресурсов
|
|
10
|
+
*/
|
|
11
|
+
export declare class Loaders extends Emitter {
|
|
12
|
+
readonly PIXI_RESOURCES = "pixi.loader";
|
|
13
|
+
readonly WEBFONT_RESOURCES = "webfont.loader";
|
|
14
|
+
static resources: Map<string, ILoaderResource>;
|
|
15
|
+
protected _baseUrl: string;
|
|
16
|
+
protected _concurrency: number;
|
|
17
|
+
protected _bindToGPU: string[];
|
|
18
|
+
protected _queue: Map<string, Set<string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Загрузить файловые ресурсы
|
|
21
|
+
* @param tag ?
|
|
22
|
+
*/
|
|
23
|
+
protected _pixiLoader(tag?: string): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Загрузить веб шрифты (через webfontloader)
|
|
26
|
+
*/
|
|
27
|
+
protected _webfontLoader(): Promise<boolean>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Emitter } from './emitter.class';
|
|
2
|
+
/** Preloader class */
|
|
3
|
+
export declare class Preloader extends Emitter {
|
|
4
|
+
name: string;
|
|
5
|
+
protected _game: HTMLElement;
|
|
6
|
+
protected _loader: HTMLElement;
|
|
7
|
+
protected _filler: HTMLElement;
|
|
8
|
+
protected _tag: string;
|
|
9
|
+
/** @constructor */
|
|
10
|
+
constructor(game: HTMLElement, loader: HTMLElement, filler: HTMLElement, tag: string);
|
|
11
|
+
/** on loading start */
|
|
12
|
+
start(): void;
|
|
13
|
+
/** on loading end */
|
|
14
|
+
end(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { IComponent, IComponentHTML, IContainer, IScene } from '../extends/interfaces';
|
|
2
|
+
import { TComponents } from '../extends/short.types';
|
|
3
|
+
import { DI } from './di.class';
|
|
4
|
+
import { IEmitter } from './emitter.class';
|
|
5
|
+
export type IProducer = {
|
|
6
|
+
instance: IContainer;
|
|
7
|
+
currentScene: string;
|
|
8
|
+
init(): IProducer;
|
|
9
|
+
start(): Promise<boolean>;
|
|
10
|
+
startScene(name: string): Promise<IScene>;
|
|
11
|
+
scene<SceneGeneric extends IScene>(name?: string, scene?: IScene): SceneGeneric;
|
|
12
|
+
panel<PanelGeneric extends TComponents>(name: string, panel?: TComponents): PanelGeneric;
|
|
13
|
+
component<ComponentGeneric extends TComponents>(name: string, component?: TComponents): ComponentGeneric;
|
|
14
|
+
create(name: string): Promise<boolean>;
|
|
15
|
+
show(name: string, redraw?: boolean): Promise<boolean>;
|
|
16
|
+
destroy(sceneName: string): Promise<void>;
|
|
17
|
+
} & IEmitter;
|
|
18
|
+
/**
|
|
19
|
+
* Режиссер сцен и механики
|
|
20
|
+
*
|
|
21
|
+
* Панели обязательно должны быть IComponent.
|
|
22
|
+
* Компоненты обязательно должны быть IComponent или IComponentHTML.
|
|
23
|
+
*
|
|
24
|
+
* Панели создаются в корневом контейнере продюсера и никогда не уничтожаются.
|
|
25
|
+
* Компоненты создаются рядом с корневым контейнером продюсера (если это не HTML компоненты) и никогда не уничтожаются.
|
|
26
|
+
* Сцены создаются в корневом контейнере по запросу, могут уничтожаться и создаваться снова.
|
|
27
|
+
*
|
|
28
|
+
* @tasks
|
|
29
|
+
* - коллекция сцен
|
|
30
|
+
* - управление переходами между сценами
|
|
31
|
+
* - управление вызовом механики (процессинг сцены)
|
|
32
|
+
* - управление звуками
|
|
33
|
+
* - управление отрисовкой адаптивки
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* gameplay constructor: (this.producer)
|
|
37
|
+
* super()
|
|
38
|
+
* this.producer.scene('regular', new SceneRegular()) // this.registry.get('scene:regular')
|
|
39
|
+
* this.producer.scene('freespins, new SceneFreespins())
|
|
40
|
+
* gameplay:
|
|
41
|
+
* await this.producer.start('regular') // on preload
|
|
42
|
+
* response:
|
|
43
|
+
* await this.producer.action(response)
|
|
44
|
+
*/
|
|
45
|
+
export declare class Producer extends DI implements IProducer {
|
|
46
|
+
/**
|
|
47
|
+
* Сцены
|
|
48
|
+
*/
|
|
49
|
+
protected _scenes: Map<string, IScene>;
|
|
50
|
+
/**
|
|
51
|
+
* Панели
|
|
52
|
+
*/
|
|
53
|
+
protected _panels: Map<string, IComponent>;
|
|
54
|
+
/**
|
|
55
|
+
* Компоненты
|
|
56
|
+
*/
|
|
57
|
+
protected _components: Map<string, IComponentHTML | IComponent>;
|
|
58
|
+
/**
|
|
59
|
+
* Таймер на ресайз окна
|
|
60
|
+
*/
|
|
61
|
+
protected _resizeTimeout: number;
|
|
62
|
+
/**
|
|
63
|
+
* Корневой контейнер продюсера.
|
|
64
|
+
* Регистрируется на верхнем уровне в stage канваса
|
|
65
|
+
*/
|
|
66
|
+
instance: IContainer;
|
|
67
|
+
/**
|
|
68
|
+
* Запущен ли продюсер
|
|
69
|
+
*/
|
|
70
|
+
started: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Текущая сцена
|
|
73
|
+
*/
|
|
74
|
+
currentScene: string;
|
|
75
|
+
/**
|
|
76
|
+
* Инициалиация продюсера.
|
|
77
|
+
* - вешает событие ресайза.
|
|
78
|
+
* - добавляет дефолтные компоненты
|
|
79
|
+
*/
|
|
80
|
+
init(): this;
|
|
81
|
+
/**
|
|
82
|
+
* Создает зарегистрированные компоненты по ключу
|
|
83
|
+
*/
|
|
84
|
+
createComponent(key: string): Promise<this>;
|
|
85
|
+
/**
|
|
86
|
+
* Создает зарегистрированные компоненты и панели
|
|
87
|
+
*/
|
|
88
|
+
start(): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Пересчитать состояние borderView и вызвать методы адаптивности у панелей
|
|
91
|
+
*/
|
|
92
|
+
protected redraw(): Promise<Producer>;
|
|
93
|
+
/**
|
|
94
|
+
* Регистрация панели в продюсере (либо ее получение)
|
|
95
|
+
* @param name
|
|
96
|
+
* @param panel
|
|
97
|
+
*/
|
|
98
|
+
panel<PanelGeneric extends TComponents>(name: string, panel?: IComponent): PanelGeneric;
|
|
99
|
+
/**
|
|
100
|
+
* Регистрация компонента в продюсере (либо его получение)
|
|
101
|
+
* @param name
|
|
102
|
+
* @param component
|
|
103
|
+
*/
|
|
104
|
+
component<ComponentGeneric extends TComponents>(name: string, component?: TComponents): ComponentGeneric;
|
|
105
|
+
/**
|
|
106
|
+
* Регистрация сцены в продюсере (либо ее получение)
|
|
107
|
+
* @param name
|
|
108
|
+
* @param scene
|
|
109
|
+
*/
|
|
110
|
+
scene<SceneGeneric extends IScene>(name?: string, scene?: IScene): SceneGeneric;
|
|
111
|
+
/**
|
|
112
|
+
* Создание и отображение сцены.
|
|
113
|
+
* Если эта сцена уже отображается, ничего не происходит.
|
|
114
|
+
* Если есть currentScene, то она дестроится.
|
|
115
|
+
* @param sceneName
|
|
116
|
+
*/
|
|
117
|
+
startScene(sceneName: string): Promise<IScene>;
|
|
118
|
+
/**
|
|
119
|
+
* Создание сцены
|
|
120
|
+
* @param sceneName
|
|
121
|
+
*/
|
|
122
|
+
create(sceneName: string): Promise<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* Отображение сцены.
|
|
125
|
+
* Может перерисовать все сцены, панели, компоненты
|
|
126
|
+
* @param sceneName
|
|
127
|
+
* @param redrawAll
|
|
128
|
+
*/
|
|
129
|
+
show(sceneName: string, redrawAll?: boolean): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Уничтожение сцены
|
|
132
|
+
* @param sceneName
|
|
133
|
+
*/
|
|
134
|
+
destroy(sceneName: string): Promise<void>;
|
|
135
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TPixiAnimations, TPixiTextures } from '../extends/short.types';
|
|
2
|
+
import * as PIXI from 'pixi.js';
|
|
3
|
+
/** */
|
|
4
|
+
export declare class Sequence extends PIXI.AnimatedSprite {
|
|
5
|
+
/** */
|
|
6
|
+
get size(): number;
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
constructor(name: string, textures: TPixiTextures | TPixiAnimations);
|
|
11
|
+
/** */
|
|
12
|
+
play(delay?: number, reset?: boolean): Promise<void>;
|
|
13
|
+
/** */
|
|
14
|
+
playto(to: number, from?: number, delay?: number): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* await animation.speed(0.7).playto(10, 3)
|
|
17
|
+
* await animation.speed(1.4)
|
|
18
|
+
*/
|
|
19
|
+
speed(speed: number): this;
|
|
20
|
+
/**
|
|
21
|
+
* protected seq = new Sequence('example', Assets.getSpritesheet)
|
|
22
|
+
* [point, point, point].forEach(point => {
|
|
23
|
+
* const symbol = seq.clone('example' + i)
|
|
24
|
+
* container.addChild(symbol)
|
|
25
|
+
* symbol.position = point
|
|
26
|
+
* symbol.play(i * 20)
|
|
27
|
+
* })
|
|
28
|
+
*/
|
|
29
|
+
clone(name?: string): Sequence;
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TCallbackFast = (enabled: boolean) => void;
|
|
2
|
+
export type TCallbackSkip = () => void;
|
|
3
|
+
/** */
|
|
4
|
+
export declare class Skipable {
|
|
5
|
+
protected _fast: boolean;
|
|
6
|
+
protected _callbacksFast: Set<TCallbackFast>;
|
|
7
|
+
protected _callbacksSkip: Set<TCallbackSkip>;
|
|
8
|
+
/** */
|
|
9
|
+
fast(enabled: boolean): void;
|
|
10
|
+
/** */
|
|
11
|
+
skip(): void;
|
|
12
|
+
/** */
|
|
13
|
+
wait(callbackPromise: () => Promise<unknown>, callbackFast: TCallbackFast, callbackSkip: TCallbackSkip): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const skipable: Skipable;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Spine as PixiSpine, TrackEntry } from '@pixi-spine/runtime-4.1';
|
|
2
|
+
import { Assets } from '../classes/assets.class';
|
|
3
|
+
/** */
|
|
4
|
+
export declare class Spine extends PixiSpine {
|
|
5
|
+
trackSingles: number;
|
|
6
|
+
trackLoops: number;
|
|
7
|
+
loopAnimationName: string;
|
|
8
|
+
mixDuration: number;
|
|
9
|
+
/** */
|
|
10
|
+
clone(name: string): Spine;
|
|
11
|
+
/** */
|
|
12
|
+
show(): this;
|
|
13
|
+
/** */
|
|
14
|
+
hide(): this;
|
|
15
|
+
/** */
|
|
16
|
+
animate(name: string, loop?: boolean, autoStartLoop?: boolean, timeScale?: number): Promise<TrackEntry>;
|
|
17
|
+
/** */
|
|
18
|
+
getAnimationName(trackIndex?: number): string;
|
|
19
|
+
/** */
|
|
20
|
+
isAnimationPlaying(name: string, track?: number): boolean;
|
|
21
|
+
/** */
|
|
22
|
+
getDurationMs(name: string): number;
|
|
23
|
+
/**
|
|
24
|
+
* Stop spine on the first frame of animation
|
|
25
|
+
* @param name
|
|
26
|
+
*/
|
|
27
|
+
toFirstFrame(name: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Stop spine on the last frame of animation
|
|
30
|
+
* @param name
|
|
31
|
+
*/
|
|
32
|
+
toLastFrame(name: string): void;
|
|
33
|
+
/** */
|
|
34
|
+
timeScale(timeScale: number, track?: number): void;
|
|
35
|
+
/** */
|
|
36
|
+
skip(track?: number): void;
|
|
37
|
+
}
|
|
38
|
+
/** */
|
|
39
|
+
export declare class SpineAssets extends Assets {
|
|
40
|
+
/** */
|
|
41
|
+
static getSpineAnimation(assetName: string, skeletonScale?: number): Spine;
|
|
42
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* Класс для создания одной текстуры из нескольких
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const tile = new Tile()
|
|
7
|
+
* tile
|
|
8
|
+
* .addTexture(Assets.getTexture('test', 'test1.png'))
|
|
9
|
+
* .addTexture(Assets.getTexture('test', 'test2.png'), 100, 200)
|
|
10
|
+
* .generateTexture()
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class Tile extends PIXI.Sprite {
|
|
14
|
+
protected _container: PIXI.Container;
|
|
15
|
+
/**
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
constructor(name?: string);
|
|
19
|
+
/**
|
|
20
|
+
* Сгенерировать текстуру из раннее добавленных текстур и применить ее на данный спрайт
|
|
21
|
+
*/
|
|
22
|
+
generateTexture(): this;
|
|
23
|
+
/**
|
|
24
|
+
* Добавить текстуру в указанную точку
|
|
25
|
+
* @param texture
|
|
26
|
+
* @param x
|
|
27
|
+
* @param y
|
|
28
|
+
*/
|
|
29
|
+
addTexture(texture: PIXI.Texture, x: number, y: number): this;
|
|
30
|
+
/**
|
|
31
|
+
* Расположит текстуры в линию друг за другом
|
|
32
|
+
* @param textures текстуры и по сколько раз каждую текстуру повторять
|
|
33
|
+
* @param vertical вертикально или горизонтально
|
|
34
|
+
* @param x точка начала
|
|
35
|
+
* @param y точка начала
|
|
36
|
+
*/
|
|
37
|
+
arrangeInLine(textures: [number, PIXI.Texture][], vertical?: boolean, x?: number, y?: number): this;
|
|
38
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Emitter } from '../classes/emitter.class';
|
|
2
|
+
import { IComponent, IContainer, INamed } from '../extends/interfaces';
|
|
3
|
+
import { TSupportContainer } from '../extends/short.types';
|
|
4
|
+
import * as PIXI from 'pixi.js';
|
|
5
|
+
/**
|
|
6
|
+
* Абстрактный компонент
|
|
7
|
+
*
|
|
8
|
+
* @rules
|
|
9
|
+
* - должен отрисовывать свое состояние только по своим внутренним свойствам
|
|
10
|
+
* - должен только выкидывать события, не реализуя их обработку
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class AbstractComponent extends Emitter implements INamed, IComponent {
|
|
13
|
+
name: string;
|
|
14
|
+
instance: IContainer;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
alpha: number;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
position: PIXI.IPoint;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
rotation: number;
|
|
23
|
+
scale: PIXI.IPoint;
|
|
24
|
+
scaleX: number;
|
|
25
|
+
scaleY: number;
|
|
26
|
+
created: boolean;
|
|
27
|
+
destroyed: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
show: () => Promise<void>;
|
|
30
|
+
hide: () => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* @constructor
|
|
33
|
+
* @param name
|
|
34
|
+
*/
|
|
35
|
+
constructor(name?: string);
|
|
36
|
+
/**
|
|
37
|
+
* Создать компонент
|
|
38
|
+
* @param instance
|
|
39
|
+
*/
|
|
40
|
+
create(instance?: TSupportContainer): Promise<this>;
|
|
41
|
+
/**
|
|
42
|
+
* Уничтожить компонент
|
|
43
|
+
*/
|
|
44
|
+
destroy(): Promise<this>;
|
|
45
|
+
/**
|
|
46
|
+
* Отрисовать компонент
|
|
47
|
+
*
|
|
48
|
+
* @rules
|
|
49
|
+
* - не создавать никаких переменных в draw
|
|
50
|
+
*/
|
|
51
|
+
abstract draw(modeChanged?: boolean): Promise<this>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Emitter } from '../classes/emitter.class';
|
|
2
|
+
import { IComponentHTML, INamed } from '../extends/interfaces';
|
|
3
|
+
import { TCallbackVoid } from '../extends/short.types';
|
|
4
|
+
/** */
|
|
5
|
+
export declare abstract class AbstractHtmlComponent extends Emitter implements INamed, IComponentHTML {
|
|
6
|
+
name: string;
|
|
7
|
+
instance: any;
|
|
8
|
+
element: HTMLElement;
|
|
9
|
+
created: boolean;
|
|
10
|
+
protected _createdDynamically: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @constructor
|
|
13
|
+
* @param name
|
|
14
|
+
*/
|
|
15
|
+
constructor(name?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Добавить свойство компоненту с колбеками на запись.
|
|
18
|
+
* @param name
|
|
19
|
+
* @param def
|
|
20
|
+
* @param onTrue
|
|
21
|
+
* @param onFalse
|
|
22
|
+
*/
|
|
23
|
+
addProperty(name: string, def: unknown, onTrue: TCallbackVoid, onFalse?: TCallbackVoid): void;
|
|
24
|
+
/**
|
|
25
|
+
* Создать компонент
|
|
26
|
+
* @param element
|
|
27
|
+
*/
|
|
28
|
+
create(element?: HTMLElement): Promise<this>;
|
|
29
|
+
/**
|
|
30
|
+
* Уничтожить компонент
|
|
31
|
+
*/
|
|
32
|
+
destroy(): Promise<this>;
|
|
33
|
+
/** Отрисовать компонент */
|
|
34
|
+
draw(_isModeChanged?: boolean): Promise<this>;
|
|
35
|
+
/**
|
|
36
|
+
* Показать компонент
|
|
37
|
+
*/
|
|
38
|
+
show(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Скрыть компонент
|
|
41
|
+
*/
|
|
42
|
+
hide(): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Container } from '../classes/container.class';
|
|
2
|
+
import { IComponent } from '../extends/interfaces';
|
|
3
|
+
import { TGsapTimeline, TNumberArray, TPixiTextStyle, TSupportContainer } from '../extends/short.types';
|
|
4
|
+
import { AbstractComponent } from './abstract.component';
|
|
5
|
+
import { BlackoutComponent } from './blackout.component';
|
|
6
|
+
import { TextComponent } from './text.component';
|
|
7
|
+
export declare enum EBigWinLabels {
|
|
8
|
+
big = "big",
|
|
9
|
+
bigLoop = "bigLoop",
|
|
10
|
+
super = "super",
|
|
11
|
+
superLoop = "superLoop",
|
|
12
|
+
epic = "epic",
|
|
13
|
+
epicLoop = "epicLoop",
|
|
14
|
+
complete = "complete",
|
|
15
|
+
end = "end"
|
|
16
|
+
}
|
|
17
|
+
/** Component to build and control Big Win animation */
|
|
18
|
+
export declare class BigWinComponent extends AbstractComponent {
|
|
19
|
+
protected _components: IComponent[];
|
|
20
|
+
protected _hasLabel: boolean;
|
|
21
|
+
protected _isDebug: boolean;
|
|
22
|
+
protected _timeline: TGsapTimeline;
|
|
23
|
+
protected _counterTl: TGsapTimeline;
|
|
24
|
+
protected _easeCounter: string;
|
|
25
|
+
protected _coins: number;
|
|
26
|
+
protected _coinsFinal: number;
|
|
27
|
+
protected _blackoutComponent: BlackoutComponent;
|
|
28
|
+
protected _bigWinContainer: Container;
|
|
29
|
+
protected _promises: Promise<unknown>[];
|
|
30
|
+
protected _volatilityLevels: {
|
|
31
|
+
low: number[];
|
|
32
|
+
medium: number[];
|
|
33
|
+
high: number[];
|
|
34
|
+
veryHigh: number[];
|
|
35
|
+
};
|
|
36
|
+
protected _volatilityOdds: TNumberArray;
|
|
37
|
+
protected _winLevels: {
|
|
38
|
+
big: number;
|
|
39
|
+
super: number;
|
|
40
|
+
epic: number;
|
|
41
|
+
};
|
|
42
|
+
protected _coinsTextComponent: TextComponent;
|
|
43
|
+
protected _coinsTextStyle: TPixiTextStyle;
|
|
44
|
+
protected _currencyTextComponent: TextComponent;
|
|
45
|
+
protected _currencyTextStyle: TPixiTextStyle;
|
|
46
|
+
protected _labelTextComponent: TextComponent;
|
|
47
|
+
protected _durations: {
|
|
48
|
+
[key in EBigWinLabels]: number;
|
|
49
|
+
};
|
|
50
|
+
protected _blackoutParams: {
|
|
51
|
+
color: number;
|
|
52
|
+
alpha: number;
|
|
53
|
+
duration: number;
|
|
54
|
+
};
|
|
55
|
+
/** @constructor */
|
|
56
|
+
constructor(name?: string);
|
|
57
|
+
/** Returns current coins */
|
|
58
|
+
get coins(): number;
|
|
59
|
+
/** Puts coins to the labels */
|
|
60
|
+
set coins(value: number);
|
|
61
|
+
/** Shows debug log */
|
|
62
|
+
protected _debug(log: string): void;
|
|
63
|
+
/** Checks enough amount of coins for big win */
|
|
64
|
+
isBigWin(coins?: number): boolean;
|
|
65
|
+
/** Checks enough amount of coins for super win */
|
|
66
|
+
isSuperWin(coins?: number): boolean;
|
|
67
|
+
/** Checks enough amount of coins for epic win */
|
|
68
|
+
isEpicWin(coins?: number): boolean;
|
|
69
|
+
/** @inheritdoc */
|
|
70
|
+
create(instance?: TSupportContainer): Promise<this>;
|
|
71
|
+
/** Creates and add container for big win */
|
|
72
|
+
protected _addBigWinContainer(): void;
|
|
73
|
+
/** Adds blackout component */
|
|
74
|
+
protected _addBlackout(): Promise<void>;
|
|
75
|
+
/** Adds "Biw win" title */
|
|
76
|
+
protected _addTitle(): Promise<void>;
|
|
77
|
+
/** Add coins label */
|
|
78
|
+
protected _addCoinsLabel(): Promise<void>;
|
|
79
|
+
/** Add currency text component */
|
|
80
|
+
protected _addCurrencyLabel(): Promise<void>;
|
|
81
|
+
/** @inheritdoc */
|
|
82
|
+
destroy(): Promise<this>;
|
|
83
|
+
/** @inheritdoc */
|
|
84
|
+
draw(): Promise<this>;
|
|
85
|
+
/** Start Big Win animation */
|
|
86
|
+
animate(coins: number): Promise<void>;
|
|
87
|
+
/** Creates animations timeline with labels */
|
|
88
|
+
protected _createTimeline(): void;
|
|
89
|
+
/** Makes win counter animation */
|
|
90
|
+
protected _animateCounter(coinsFrom: number, consTo: number, duration: number, delay?: number): TGsapTimeline;
|
|
91
|
+
/** Starts Big Win callback */
|
|
92
|
+
protected _big(): Promise<void>;
|
|
93
|
+
/** Starts Big Win Loop callback */
|
|
94
|
+
protected _bigLoop(): Promise<void>;
|
|
95
|
+
/** Starts Super Win callback */
|
|
96
|
+
protected _super(): Promise<void>;
|
|
97
|
+
/** Starts Super Win Loop callback */
|
|
98
|
+
protected _superLoop(): Promise<void>;
|
|
99
|
+
/** Starts Epic Win callback */
|
|
100
|
+
protected _epic(): Promise<void>;
|
|
101
|
+
/** Starts Epic Win Loop callback */
|
|
102
|
+
protected _epicLoop(): Promise<void>;
|
|
103
|
+
/** Starts Big Win Complete callback */
|
|
104
|
+
protected _complete(): Promise<void>;
|
|
105
|
+
/** Starts Big Win End callback */
|
|
106
|
+
protected _end(): Promise<void>;
|
|
107
|
+
/** Jumps timeline to nex available label */
|
|
108
|
+
skip(): void;
|
|
109
|
+
}
|