pixi-rainman-game-engine 0.1.1 → 0.1.2
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 +59 -3
- package/dist/application/ButtonsEventManager/ButtonsEventManager.js +1 -1
- package/dist/components/AbstractFreeSpinContainer/AbstractFreeSpinContainer.js +1 -1
- package/dist/components/AbstractMainContainer/AbstractMainContainer.js +1 -1
- package/dist/components/buttons/BaseButton/BaseButton.js +1 -1
- package/dist/components/common/FreeSpinBox.js +2 -3
- package/dist/components/symbols/AbstractSymbolBase.js +2 -2
- package/dist/winComponents/PositioningFrame.d.ts +3 -3
- package/dist/winComponents/PositioningFrame.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,9 +6,65 @@ This repository contains all of the mechanics that used in rainMan games. This l
|
|
|
6
6
|
|
|
7
7
|
1. To build library
|
|
8
8
|
```sh
|
|
9
|
-
|
|
9
|
+
yarn build
|
|
10
10
|
```
|
|
11
|
-
2.
|
|
11
|
+
2. To build library during development
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
yarn dev:build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Modifying css files does not automatically reload server, after each change manual restart is needed.
|
|
18
|
+
|
|
19
|
+
To have live updates in one of the games, link is recommended:
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
yarn dev:link
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
After that you can use following command in one of the games. If there will be problems or the changes will not reflect in the game, uninstalling npm package may be needed.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
yarn remove pixi-rainman-game-engine
|
|
29
|
+
npm link pixi-rainman-game-engine
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
By using package from npm, in vite optimizeDeps you must exclude this package, but must include each package that throws error in the console. This is probably due to problem with [excluding commonJS dependencies](https://vitejs.dev/config/dep-optimization-options#optimizedeps-exclude). An example is below.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
defineConfig({
|
|
36
|
+
optimizeDeps: {
|
|
37
|
+
include: [
|
|
38
|
+
"ts-money",
|
|
39
|
+
"adaptive-scale/lib",
|
|
40
|
+
"stats.js",
|
|
41
|
+
"url",
|
|
42
|
+
"eventemitter3",
|
|
43
|
+
"earcut",
|
|
44
|
+
"react",
|
|
45
|
+
"react-dom",
|
|
46
|
+
"use-sync-external-store/shim",
|
|
47
|
+
"classnames",
|
|
48
|
+
"react-is",
|
|
49
|
+
"react-custom-scroll",
|
|
50
|
+
"react-dom/client",
|
|
51
|
+
],
|
|
52
|
+
exclude: ["pixi-rainman-game-engine"],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For each error in the console, e.g.:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Uncaught SyntaxError: The requested module '/node_modules/eventemitter3/index.js?v=ec22a584' does not provide an export named 'default'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
you must include it in the optimizeDeps.include array. Typically it is the name after /node_modules/.
|
|
64
|
+
|
|
65
|
+
**On the other hand, when linking package with npm link, the whole optimizeDeps.include an optimzieDeps.exclude should be commented out.**
|
|
66
|
+
|
|
67
|
+
3. Lint project
|
|
12
68
|
```sh
|
|
13
69
|
npm run lint
|
|
14
70
|
```
|
|
@@ -22,4 +78,4 @@ In utils directory there all of the utility functions and types.
|
|
|
22
78
|
### Test environment
|
|
23
79
|
|
|
24
80
|
To simulate behavior of game engine mechanics, this repository contains react-pixi app, where you can test features that are included in game engine.
|
|
25
|
-
Test environment uses local built of game engine. To setup test environment go to [README](./
|
|
81
|
+
Test environment uses local built of game engine. To setup test environment go to [README](./test-environment/README.md) of test environment.
|
|
@@ -81,7 +81,7 @@ export class ButtonsEventManager {
|
|
|
81
81
|
}
|
|
82
82
|
setUpUIElementsInteractivity() {
|
|
83
83
|
const animatedBackground = RainMan.componentRegistry.get(Background.registryName);
|
|
84
|
-
animatedBackground.
|
|
84
|
+
animatedBackground.eventMode = "static";
|
|
85
85
|
animatedBackground.addListener("pointerdown", () => {
|
|
86
86
|
if (hideLayerIfPresent() && !RainMan.settingsStore.isAutoplayEnabled) {
|
|
87
87
|
this.enableButtons();
|
|
@@ -80,7 +80,7 @@ export class AbstractMainContainer extends Container {
|
|
|
80
80
|
this.overlay.parentLayer = UXLayer;
|
|
81
81
|
this.overlay.beginFill(0x000000, 0.5);
|
|
82
82
|
this.overlay.drawRect(0, 0, width, height);
|
|
83
|
-
this.overlay.
|
|
83
|
+
this.overlay.eventMode = "static";
|
|
84
84
|
this.overlay.endFill();
|
|
85
85
|
this.addChild(this.overlay);
|
|
86
86
|
}
|
|
@@ -72,7 +72,7 @@ export class BaseButton extends Sprite {
|
|
|
72
72
|
}
|
|
73
73
|
flipDisabledFlag(makeDisabled) {
|
|
74
74
|
this.isDisabled = makeDisabled;
|
|
75
|
-
this.
|
|
75
|
+
this.eventMode = makeDisabled ? "auto" : "static";
|
|
76
76
|
this.tint = makeDisabled ? TINT_DISABLED : TINT_ENABLED;
|
|
77
77
|
}
|
|
78
78
|
switchTexture(state) {
|
|
@@ -16,7 +16,7 @@ export class FreeSpinBox extends ResumableContainer {
|
|
|
16
16
|
this.spine.state.addAnimation(0, "freeBox", true, 0);
|
|
17
17
|
this.spine.state.timeScale = 1;
|
|
18
18
|
this.addChild(this.spine);
|
|
19
|
-
this.
|
|
19
|
+
this.eventMode = "static";
|
|
20
20
|
this.x = 0;
|
|
21
21
|
this.y = 0;
|
|
22
22
|
}
|
|
@@ -24,8 +24,7 @@ export class FreeSpinBox extends ResumableContainer {
|
|
|
24
24
|
this.addListener("pointerdown", onClick);
|
|
25
25
|
}
|
|
26
26
|
setInteractivity(newValue) {
|
|
27
|
-
this.
|
|
28
|
-
this.interactiveChildren = newValue;
|
|
27
|
+
this.eventMode = newValue ? "static" : "auto";
|
|
29
28
|
this.spine.tint = Number(newValue ? TINT_ENABLED : TINT_DISABLED);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -25,7 +25,7 @@ export class AbstractSymbolBase extends Container {
|
|
|
25
25
|
this.setSymbol(symbolId);
|
|
26
26
|
this.spine.x = 0;
|
|
27
27
|
this.spine.y = 0;
|
|
28
|
-
this.
|
|
28
|
+
this.eventMode = "static";
|
|
29
29
|
const symbolRadius = 150;
|
|
30
30
|
this.hitArea = new Rectangle(-symbolRadius, -symbolRadius, 2 * symbolRadius, 2 * symbolRadius);
|
|
31
31
|
this.setupClickListener();
|
|
@@ -34,7 +34,7 @@ export class AbstractSymbolBase extends Container {
|
|
|
34
34
|
return this._id;
|
|
35
35
|
}
|
|
36
36
|
setInteractiveFlag(flag) {
|
|
37
|
-
this.
|
|
37
|
+
this.eventMode = flag ? "static" : "auto";
|
|
38
38
|
}
|
|
39
39
|
updateTimeScaleOfSpine(scale = 0) {
|
|
40
40
|
this.animationSpeedMultiplier = scale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Graphics } from "pixi.js";
|
|
1
|
+
import { ColorSource, Graphics } from "pixi.js";
|
|
2
2
|
export declare class PositioningFrame extends Graphics {
|
|
3
|
-
private
|
|
4
|
-
constructor(frameWidth: number, frameHeight: number,
|
|
3
|
+
private backgroundColor;
|
|
4
|
+
constructor(frameWidth: number, frameHeight: number, backgroundColor: ColorSource);
|
|
5
5
|
resize(frameWidth: number, frameHeight: number): void;
|
|
6
6
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Graphics } from "pixi.js";
|
|
2
2
|
export class PositioningFrame extends Graphics {
|
|
3
3
|
backgroundColor;
|
|
4
|
-
constructor(frameWidth, frameHeight,
|
|
4
|
+
constructor(frameWidth, frameHeight, backgroundColor) {
|
|
5
5
|
super();
|
|
6
|
-
this.backgroundColor =
|
|
6
|
+
this.backgroundColor = backgroundColor;
|
|
7
7
|
this.resize(frameWidth, frameHeight);
|
|
8
|
-
this.
|
|
8
|
+
this.eventMode = "static";
|
|
9
9
|
}
|
|
10
10
|
resize(frameWidth, frameHeight) {
|
|
11
11
|
this.x = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixi-rainman-game-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "This repository contains all of the mechanics that used in rainman games.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"copyCss": "copyfiles -u 1 \"src/**/*.css\" dist/",
|
|
10
10
|
"build": "rimraf dist/ && tsc && yarn copyCss",
|
|
11
|
-
"dev:build": "tsc-watch",
|
|
11
|
+
"dev:build": "tsc-watch --onSuccess \"yarn copyCss\"",
|
|
12
12
|
"dev:link": "npm link && cd test-environment && npm link pixi-rainman-game-engine",
|
|
13
13
|
"dev:server": "cd test-environment && yarn dev",
|
|
14
14
|
"lint": "eslint src/** --fix",
|