@rpgjs/client 3.0.0-beta.8 → 3.0.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/lib/Components/ColorComponent.d.ts +8 -0
- package/lib/Components/ColorComponent.js +20 -0
- package/lib/Components/ColorComponent.js.map +1 -0
- package/lib/Components/Component.d.ts +102 -0
- package/lib/Components/Component.js +236 -0
- package/lib/Components/Component.js.map +1 -0
- package/lib/Components/ImageComponent.d.ts +8 -0
- package/lib/Components/ImageComponent.js +18 -0
- package/lib/Components/ImageComponent.js.map +1 -0
- package/lib/Components/TextComponent.d.ts +5 -0
- package/lib/Components/TextComponent.js +12 -0
- package/lib/Components/TextComponent.js.map +1 -0
- package/lib/Components/TileComponent.d.ts +8 -0
- package/lib/Components/TileComponent.js +32 -0
- package/lib/Components/TileComponent.js.map +1 -0
- package/lib/Effects/Animation.d.ts +2 -2
- package/lib/Effects/Animation.js +9 -6
- package/lib/Effects/Animation.js.map +1 -1
- package/lib/GameEngine.d.ts +36 -2
- package/lib/GameEngine.js +120 -40
- package/lib/GameEngine.js.map +1 -1
- package/lib/KeyboardControls.js +0 -1
- package/lib/KeyboardControls.js.map +1 -1
- package/lib/Renderer.js +2 -2
- package/lib/Renderer.js.map +1 -1
- package/lib/Resources.js +2 -2
- package/lib/Resources.js.map +1 -1
- package/lib/RpgClient.d.ts +9 -9
- package/lib/RpgClientEngine.d.ts +10 -3
- package/lib/RpgClientEngine.js +126 -27
- package/lib/RpgClientEngine.js.map +1 -1
- package/lib/RpgGui.js +3 -3
- package/lib/RpgGui.js.map +1 -1
- package/lib/Scene/Map.d.ts +5 -5
- package/lib/Scene/Map.js +40 -67
- package/lib/Scene/Map.js.map +1 -1
- package/lib/Scene/Scene.d.ts +9 -7
- package/lib/Scene/Scene.js +10 -8
- package/lib/Scene/Scene.js.map +1 -1
- package/lib/Sound/RpgSound.js +1 -1
- package/lib/Sound/RpgSound.js.map +1 -1
- package/lib/Sound/Sounds.js +1 -1
- package/lib/Sound/Sounds.js.map +1 -1
- package/lib/Sprite/Character.d.ts +5 -74
- package/lib/Sprite/Character.js +22 -137
- package/lib/Sprite/Character.js.map +1 -1
- package/lib/Sprite/Spritesheets.js +1 -1
- package/lib/Sprite/Spritesheets.js.map +1 -1
- package/lib/Tilemap/CommonLayer.d.ts +9 -0
- package/lib/Tilemap/CommonLayer.js +21 -0
- package/lib/Tilemap/CommonLayer.js.map +1 -0
- package/lib/Tilemap/ImageLayer.d.ts +3 -2
- package/lib/Tilemap/ImageLayer.js +11 -7
- package/lib/Tilemap/ImageLayer.js.map +1 -1
- package/lib/Tilemap/Tile.d.ts +6 -7
- package/lib/Tilemap/Tile.js +29 -32
- package/lib/Tilemap/Tile.js.map +1 -1
- package/lib/Tilemap/TileLayer.d.ts +9 -6
- package/lib/Tilemap/TileLayer.js +28 -31
- package/lib/Tilemap/TileLayer.js.map +1 -1
- package/lib/Tilemap/TileSet.d.ts +4 -15
- package/lib/Tilemap/TileSet.js +11 -18
- package/lib/Tilemap/TileSet.js.map +1 -1
- package/lib/Tilemap/index.d.ts +16 -9
- package/lib/Tilemap/index.js +47 -28
- package/lib/Tilemap/index.js.map +1 -1
- package/lib/clientEntryPoint.js +1 -1
- package/lib/clientEntryPoint.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +9 -4
- package/lib/index.js.map +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorComponent = void 0;
|
|
4
|
+
class ColorComponent extends PIXI.Graphics {
|
|
5
|
+
constructor(component, color) {
|
|
6
|
+
super();
|
|
7
|
+
this.component = component;
|
|
8
|
+
this.color = color;
|
|
9
|
+
this.setBackgroundColor();
|
|
10
|
+
}
|
|
11
|
+
setBackgroundColor() {
|
|
12
|
+
const color = this.color.replace('#', '');
|
|
13
|
+
this.beginFill(parseInt(color, 16));
|
|
14
|
+
this.drawRect(0, 0, this.component.w, this.component.h);
|
|
15
|
+
this.endFill();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ColorComponent = ColorComponent;
|
|
19
|
+
ColorComponent.id = 'color';
|
|
20
|
+
//# sourceMappingURL=ColorComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorComponent.js","sourceRoot":"","sources":["../../src/Components/ColorComponent.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAe,SAAQ,IAAI,CAAC,QAAQ;IAG7C,YAAoB,SAAuB,EAAS,KAAa;QAC7D,KAAK,EAAE,CAAA;QADS,cAAS,GAAT,SAAS,CAAc;QAAS,UAAK,GAAL,KAAK,CAAQ;QAE7D,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC7B,CAAC;IAED,kBAAkB;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;QACnC,IAAI,CAAC,QAAQ,CACT,CAAC,EACD,CAAC,EACD,IAAI,CAAC,SAAS,CAAC,CAAC,EAChB,IAAI,CAAC,SAAS,CAAC,CAAC,CACnB,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAA;IAClB,CAAC;;AAlBL,wCAmBC;AAlBmB,iBAAE,GAAW,OAAO,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Direction, RpgCommonPlayer, RpgShape } from "@rpgjs/common";
|
|
2
|
+
import { Scene } from "../Scene/Scene";
|
|
3
|
+
export interface IComponent {
|
|
4
|
+
id: string;
|
|
5
|
+
value: any;
|
|
6
|
+
}
|
|
7
|
+
export declare class RpgComponent<T = any> extends PIXI.Container {
|
|
8
|
+
private data;
|
|
9
|
+
private scene;
|
|
10
|
+
protected _x: number;
|
|
11
|
+
protected _y: number;
|
|
12
|
+
private _rotation;
|
|
13
|
+
protected teleported: number;
|
|
14
|
+
protected map: string;
|
|
15
|
+
protected z: number;
|
|
16
|
+
protected fixed: boolean;
|
|
17
|
+
private components;
|
|
18
|
+
private direction;
|
|
19
|
+
private container;
|
|
20
|
+
private registerComponents;
|
|
21
|
+
constructor(data: RpgCommonPlayer | RpgShape, scene: Scene);
|
|
22
|
+
/**
|
|
23
|
+
* the direction of the sprite
|
|
24
|
+
*
|
|
25
|
+
* @prop {Direction} dir
|
|
26
|
+
* @readonly
|
|
27
|
+
* @memberof RpgSprite
|
|
28
|
+
* */
|
|
29
|
+
get dir(): Direction;
|
|
30
|
+
/**
|
|
31
|
+
* To know if the sprite is a player
|
|
32
|
+
*
|
|
33
|
+
* @prop {boolean} isPlayer
|
|
34
|
+
* @readonly
|
|
35
|
+
* @memberof RpgSprite
|
|
36
|
+
* */
|
|
37
|
+
get isPlayer(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* To know if the sprite is an event
|
|
40
|
+
*
|
|
41
|
+
* @prop {boolean} isEvent
|
|
42
|
+
* @readonly
|
|
43
|
+
* @memberof RpgSprite
|
|
44
|
+
* */
|
|
45
|
+
get isEvent(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* To know if the sprite is a shape
|
|
48
|
+
*
|
|
49
|
+
* @prop {boolean} isShape
|
|
50
|
+
* @since 3.0.0-rc
|
|
51
|
+
* @readonly
|
|
52
|
+
* @memberof RpgSprite
|
|
53
|
+
* */
|
|
54
|
+
get isShape(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* To know if the sprite is the sprite controlled by the player
|
|
57
|
+
*
|
|
58
|
+
* @prop {boolean} isCurrentPlayer
|
|
59
|
+
* @readonly
|
|
60
|
+
* @memberof RpgSprite
|
|
61
|
+
* */
|
|
62
|
+
get isCurrentPlayer(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the logic of the sprite
|
|
65
|
+
*
|
|
66
|
+
* @prop {RpgSpriteLogic} logic
|
|
67
|
+
* @readonly
|
|
68
|
+
* @since 3.0.0-beta.4
|
|
69
|
+
* @memberof RpgSprite
|
|
70
|
+
* */
|
|
71
|
+
get logic(): RpgCommonPlayer | RpgShape | null;
|
|
72
|
+
get guiDisplay(): boolean;
|
|
73
|
+
set guiDisplay(val: boolean);
|
|
74
|
+
setPosition(smooth?: boolean): void;
|
|
75
|
+
update(obj: any): {
|
|
76
|
+
moving: boolean;
|
|
77
|
+
};
|
|
78
|
+
showAnimation(graphic: string | string[], animationName: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Recover the position according to the graphic
|
|
81
|
+
* Normally, the position is that of the hitbox but, we retrieve the top left corner of the graphic
|
|
82
|
+
*
|
|
83
|
+
* You can also pass the `middle` value as first parameter to retrieve the positions from the middle of the sprite
|
|
84
|
+
*
|
|
85
|
+
* @title Get Positions of Graphic
|
|
86
|
+
* @method sprite.getPositionsOfGraphic(align)
|
|
87
|
+
* @param {string} [align] middle
|
|
88
|
+
* @returns { x: number, y: number }
|
|
89
|
+
* @memberof RpgSprite
|
|
90
|
+
*/
|
|
91
|
+
getPositionsOfGraphic(align: string): {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
};
|
|
95
|
+
private callMethodInComponents;
|
|
96
|
+
private updateComponents;
|
|
97
|
+
getScene<T>(): T;
|
|
98
|
+
onInit(): void;
|
|
99
|
+
onUpdate(obj: any): void;
|
|
100
|
+
onMove(): void;
|
|
101
|
+
onChanges(data: any, old: any): void;
|
|
102
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RpgComponent = void 0;
|
|
4
|
+
const common_1 = require("@rpgjs/common");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const Logger_1 = require("../Logger");
|
|
7
|
+
const Player_1 = require("../Sprite/Player");
|
|
8
|
+
const ColorComponent_1 = require("./ColorComponent");
|
|
9
|
+
const ImageComponent_1 = require("./ImageComponent");
|
|
10
|
+
const TextComponent_1 = require("./TextComponent");
|
|
11
|
+
const TileComponent_1 = require("./TileComponent");
|
|
12
|
+
class RpgComponent extends PIXI.Container {
|
|
13
|
+
constructor(data, scene) {
|
|
14
|
+
super();
|
|
15
|
+
this.data = data;
|
|
16
|
+
this.scene = scene;
|
|
17
|
+
/** @internal */
|
|
18
|
+
this.h = 1;
|
|
19
|
+
/** @internal */
|
|
20
|
+
this.w = 1;
|
|
21
|
+
this._x = 0;
|
|
22
|
+
this._y = 0;
|
|
23
|
+
this._rotation = 0;
|
|
24
|
+
this.teleported = 0;
|
|
25
|
+
this.map = '';
|
|
26
|
+
this.z = 0;
|
|
27
|
+
this.fixed = false;
|
|
28
|
+
this.components = [];
|
|
29
|
+
this.direction = 0;
|
|
30
|
+
this.container = new PIXI.Container();
|
|
31
|
+
this.registerComponents = new Map();
|
|
32
|
+
this.setPosition(false);
|
|
33
|
+
this.registerComponents.set(Player_1.RpgSprite.id, Player_1.RpgSprite);
|
|
34
|
+
this.registerComponents.set(TextComponent_1.TextComponent.id, TextComponent_1.TextComponent);
|
|
35
|
+
this.registerComponents.set(ColorComponent_1.ColorComponent.id, ColorComponent_1.ColorComponent);
|
|
36
|
+
this.registerComponents.set(TileComponent_1.TileComponent.id, TileComponent_1.TileComponent);
|
|
37
|
+
this.registerComponents.set(ImageComponent_1.ImageComponent.id, ImageComponent_1.ImageComponent);
|
|
38
|
+
this.addChild(this.container);
|
|
39
|
+
common_1.RpgPlugin.emit(common_1.HookClient.AddSprite, this);
|
|
40
|
+
common_1.RpgPlugin.emit(common_1.HookClient.SceneAddSprite, [this.scene, this], true);
|
|
41
|
+
this.scene.game.listenObject(data.id)
|
|
42
|
+
.pipe((0, operators_1.map)(object => object === null || object === void 0 ? void 0 : object.paramsChanged), (0, operators_1.tap)(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
common_1.RpgPlugin.emit(common_1.HookClient.ChangesSprite, [this, (_a = this.logic) === null || _a === void 0 ? void 0 : _a['paramsChanged'], (_b = this.logic) === null || _b === void 0 ? void 0 : _b['prevParamsChanged']], true);
|
|
45
|
+
}), (0, operators_1.filter)(object => {
|
|
46
|
+
return object && object.components && object.components.length;
|
|
47
|
+
}))
|
|
48
|
+
.subscribe((val) => {
|
|
49
|
+
this.updateComponents(val);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* the direction of the sprite
|
|
54
|
+
*
|
|
55
|
+
* @prop {Direction} dir
|
|
56
|
+
* @readonly
|
|
57
|
+
* @memberof RpgSprite
|
|
58
|
+
* */
|
|
59
|
+
get dir() {
|
|
60
|
+
return this.direction;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* To know if the sprite is a player
|
|
64
|
+
*
|
|
65
|
+
* @prop {boolean} isPlayer
|
|
66
|
+
* @readonly
|
|
67
|
+
* @memberof RpgSprite
|
|
68
|
+
* */
|
|
69
|
+
get isPlayer() {
|
|
70
|
+
return this.data.type == common_1.PlayerType.Player;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* To know if the sprite is an event
|
|
74
|
+
*
|
|
75
|
+
* @prop {boolean} isEvent
|
|
76
|
+
* @readonly
|
|
77
|
+
* @memberof RpgSprite
|
|
78
|
+
* */
|
|
79
|
+
get isEvent() {
|
|
80
|
+
return this.data.type == common_1.PlayerType.Event;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* To know if the sprite is a shape
|
|
84
|
+
*
|
|
85
|
+
* @prop {boolean} isShape
|
|
86
|
+
* @since 3.0.0-rc
|
|
87
|
+
* @readonly
|
|
88
|
+
* @memberof RpgSprite
|
|
89
|
+
* */
|
|
90
|
+
get isShape() {
|
|
91
|
+
return common_1.Utils.isInstanceOf(this.data, common_1.RpgShape);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* To know if the sprite is the sprite controlled by the player
|
|
95
|
+
*
|
|
96
|
+
* @prop {boolean} isCurrentPlayer
|
|
97
|
+
* @readonly
|
|
98
|
+
* @memberof RpgSprite
|
|
99
|
+
* */
|
|
100
|
+
get isCurrentPlayer() {
|
|
101
|
+
return this.data.id === this.scene.game.playerId;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves the logic of the sprite
|
|
105
|
+
*
|
|
106
|
+
* @prop {RpgSpriteLogic} logic
|
|
107
|
+
* @readonly
|
|
108
|
+
* @since 3.0.0-beta.4
|
|
109
|
+
* @memberof RpgSprite
|
|
110
|
+
* */
|
|
111
|
+
get logic() {
|
|
112
|
+
return this.scene.game.world.getAll(this.data.id);
|
|
113
|
+
}
|
|
114
|
+
get guiDisplay() {
|
|
115
|
+
return this.logic.guiDisplay;
|
|
116
|
+
}
|
|
117
|
+
set guiDisplay(val) {
|
|
118
|
+
this.logic.guiDisplay = val;
|
|
119
|
+
}
|
|
120
|
+
setPosition(smooth = true) {
|
|
121
|
+
var _a, _b, _c, _d;
|
|
122
|
+
if (this.isShape) {
|
|
123
|
+
const { width, height, x, y } = this.data;
|
|
124
|
+
this.w = width;
|
|
125
|
+
this.h = height;
|
|
126
|
+
this._x = Math.floor(x);
|
|
127
|
+
this._y = Math.floor(y);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const { position, direction } = this.data;
|
|
131
|
+
this._x = Math.floor((_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : 0);
|
|
132
|
+
this._y = Math.floor((_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : 0);
|
|
133
|
+
this.z = Math.floor((_c = position === null || position === void 0 ? void 0 : position.z) !== null && _c !== void 0 ? _c : 0);
|
|
134
|
+
this.direction = direction;
|
|
135
|
+
}
|
|
136
|
+
this._rotation = (_d = this.data['rotation']) !== null && _d !== void 0 ? _d : 0;
|
|
137
|
+
if (!smooth) {
|
|
138
|
+
this.x = this._x;
|
|
139
|
+
this.y = this._y;
|
|
140
|
+
this.angle = this._rotation;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
update(obj) {
|
|
144
|
+
const { speed, teleported, map, fixed, rotation } = obj;
|
|
145
|
+
this.data = obj;
|
|
146
|
+
this.setPosition();
|
|
147
|
+
if (this._rotation != this.angle) {
|
|
148
|
+
this.angle += Math.min(speed, this._rotation - this.angle);
|
|
149
|
+
}
|
|
150
|
+
let moving = false;
|
|
151
|
+
if (!fixed) {
|
|
152
|
+
if (teleported != this.teleported || map != this.map) {
|
|
153
|
+
this.x = this._x;
|
|
154
|
+
this.y = this._y;
|
|
155
|
+
this.teleported = teleported;
|
|
156
|
+
this.map = map;
|
|
157
|
+
}
|
|
158
|
+
this.parent.parent.zIndex = this._y;
|
|
159
|
+
obj.posX = this._x;
|
|
160
|
+
obj.posY = this._y;
|
|
161
|
+
if (this._x > this.x) {
|
|
162
|
+
this.x += Math.min(speed, this._x - this.x);
|
|
163
|
+
moving = true;
|
|
164
|
+
}
|
|
165
|
+
if (this._x < this.x) {
|
|
166
|
+
this.x -= Math.min(speed, this.x - this._x);
|
|
167
|
+
moving = true;
|
|
168
|
+
}
|
|
169
|
+
if (this._y > this.y) {
|
|
170
|
+
this.y += Math.min(speed, this._y - this.y);
|
|
171
|
+
moving = true;
|
|
172
|
+
}
|
|
173
|
+
if (this._y < this.y) {
|
|
174
|
+
this.y -= Math.min(speed, this.y - this._y);
|
|
175
|
+
moving = true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.callMethodInComponents('update', [obj, { moving }]);
|
|
179
|
+
this.onUpdate(obj);
|
|
180
|
+
return {
|
|
181
|
+
moving
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
showAnimation(graphic, animationName) {
|
|
185
|
+
return this.callMethodInComponents('showAnimation', [graphic, animationName]);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Recover the position according to the graphic
|
|
189
|
+
* Normally, the position is that of the hitbox but, we retrieve the top left corner of the graphic
|
|
190
|
+
*
|
|
191
|
+
* You can also pass the `middle` value as first parameter to retrieve the positions from the middle of the sprite
|
|
192
|
+
*
|
|
193
|
+
* @title Get Positions of Graphic
|
|
194
|
+
* @method sprite.getPositionsOfGraphic(align)
|
|
195
|
+
* @param {string} [align] middle
|
|
196
|
+
* @returns { x: number, y: number }
|
|
197
|
+
* @memberof RpgSprite
|
|
198
|
+
*/
|
|
199
|
+
getPositionsOfGraphic(align) {
|
|
200
|
+
const sprite = this.getChildAt(0);
|
|
201
|
+
const isMiddle = align == 'middle';
|
|
202
|
+
return {
|
|
203
|
+
x: this.x - this.w * sprite.anchor.x + (isMiddle ? this.w / 2 : 0),
|
|
204
|
+
y: this.y - this.h * sprite.anchor.y + (isMiddle ? this.h / 2 : 0)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
callMethodInComponents(name, params) {
|
|
208
|
+
for (let component of this.container.children) {
|
|
209
|
+
if (component[name])
|
|
210
|
+
component[name](...params);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
updateComponents(object) {
|
|
214
|
+
const components = object.components;
|
|
215
|
+
this.container.removeChildren();
|
|
216
|
+
for (let component of components) {
|
|
217
|
+
const compClass = this.registerComponents.get(component.id);
|
|
218
|
+
if (!compClass) {
|
|
219
|
+
throw (0, Logger_1.log)(`Impossible to find ${component.id} component`);
|
|
220
|
+
}
|
|
221
|
+
const instance = new compClass(this, component.value);
|
|
222
|
+
this.container.addChild(instance);
|
|
223
|
+
}
|
|
224
|
+
this.components = components;
|
|
225
|
+
}
|
|
226
|
+
getScene() {
|
|
227
|
+
return this.scene;
|
|
228
|
+
}
|
|
229
|
+
// Hooks
|
|
230
|
+
onInit() { }
|
|
231
|
+
onUpdate(obj) { }
|
|
232
|
+
onMove() { }
|
|
233
|
+
onChanges(data, old) { }
|
|
234
|
+
}
|
|
235
|
+
exports.RpgComponent = RpgComponent;
|
|
236
|
+
//# sourceMappingURL=Component.js.map
|
|
@@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MAAM,CAAC,CAAA;SAClD;IACL,CAAC;IAEO,gBAAgB,CAAC,MAAW;QAChC,MAAM,UAAU,GAAiB,MAAM,CAAC,UAAU,CAAA;QAClD,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAA;QAC/B,KAAK,IAAI,SAAS,IAAI,UAAU,EAAE;YAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAC3D,IAAI,CAAC,SAAS,EAAE;gBACZ,MAAM,IAAA,YAAG,EAAC,sBAAsB,SAAS,CAAC,EAAE,YAAY,CAAC,CAAA;aAC5D;YACD,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;YACrD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;SACpC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAChC,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAY,CAAA;IAC5B,CAAC;IAED,QAAQ;IACR,MAAM,KAAI,CAAC;IACX,QAAQ,CAAC,GAAG,IAAG,CAAC;IAChB,MAAM,KAAI,CAAC;IACX,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;CAC3B;AA5PD,oCA4PC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageComponent = void 0;
|
|
4
|
+
class ImageComponent extends PIXI.Container {
|
|
5
|
+
constructor(component, source) {
|
|
6
|
+
super();
|
|
7
|
+
this.component = component;
|
|
8
|
+
this.source = source;
|
|
9
|
+
this.setImage();
|
|
10
|
+
}
|
|
11
|
+
setImage() {
|
|
12
|
+
const engine = this.component.getScene().game.clientEngine;
|
|
13
|
+
this.addChild(PIXI.Sprite.from(engine.getResourceUrl(this.source)));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ImageComponent = ImageComponent;
|
|
17
|
+
ImageComponent.id = 'image';
|
|
18
|
+
//# sourceMappingURL=ImageComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageComponent.js","sourceRoot":"","sources":["../../src/Components/ImageComponent.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAe,SAAQ,IAAI,CAAC,SAAS;IAG9C,YAAoB,SAAuB,EAAU,MAAc;QAC/D,KAAK,EAAE,CAAA;QADS,cAAS,GAAT,SAAS,CAAc;QAAU,WAAM,GAAN,MAAM,CAAQ;QAE/D,IAAI,CAAC,QAAQ,EAAE,CAAA;IACnB,CAAC;IAED,QAAQ;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAY,CAAC,IAAI,CAAC,YAAY,CAAA;QACpE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC;;AAXL,wCAYC;AAXmB,iBAAE,GAAW,OAAO,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextComponent = void 0;
|
|
4
|
+
class TextComponent extends PIXI.Text {
|
|
5
|
+
constructor(data, _text) {
|
|
6
|
+
super(_text);
|
|
7
|
+
this.data = data;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.TextComponent = TextComponent;
|
|
11
|
+
TextComponent.id = 'text';
|
|
12
|
+
//# sourceMappingURL=TextComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextComponent.js","sourceRoot":"","sources":["../../src/Components/TextComponent.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,IAAI,CAAC,IAAI;IAGxC,YAAoB,IAAI,EAAE,KAAa;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;QADI,SAAI,GAAJ,IAAI,CAAA;IAExB,CAAC;;AALL,sCAMC;AALmB,gBAAE,GAAW,MAAM,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TileComponent = void 0;
|
|
7
|
+
const Tile_1 = __importDefault(require("../Tilemap/Tile"));
|
|
8
|
+
const TileLayer_1 = __importDefault(require("../Tilemap/TileLayer"));
|
|
9
|
+
class TileComponent extends PIXI.Container {
|
|
10
|
+
constructor(component, gid) {
|
|
11
|
+
super();
|
|
12
|
+
this.component = component;
|
|
13
|
+
this.gid = gid;
|
|
14
|
+
this.setTile();
|
|
15
|
+
}
|
|
16
|
+
setTile() {
|
|
17
|
+
const scene = this.component.getScene();
|
|
18
|
+
const tilemap = scene.tilemap;
|
|
19
|
+
const tileset = TileLayer_1.default.findTileSet(this.gid, tilemap.tilesets);
|
|
20
|
+
if (tileset) {
|
|
21
|
+
const tile = new Tile_1.default({
|
|
22
|
+
gid: this.gid
|
|
23
|
+
}, tileset);
|
|
24
|
+
tile.width = this.component.w;
|
|
25
|
+
tile.height = this.component.h;
|
|
26
|
+
this.addChild(tile);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.TileComponent = TileComponent;
|
|
31
|
+
TileComponent.id = 'tile';
|
|
32
|
+
//# sourceMappingURL=TileComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TileComponent.js","sourceRoot":"","sources":["../../src/Components/TileComponent.ts"],"names":[],"mappings":";;;;;;AACA,2DAAkC;AAClC,qEAA4C;AAG5C,MAAa,aAAc,SAAQ,IAAI,CAAC,SAAS;IAG7C,YAAoB,SAAuB,EAAU,GAAW;QAC5D,KAAK,EAAE,CAAA;QADS,cAAS,GAAT,SAAS,CAAc;QAAU,QAAG,GAAH,GAAG,CAAQ;QAE5D,IAAI,CAAC,OAAO,EAAE,CAAA;IAClB,CAAC;IAED,OAAO;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAY,CAAA;QACjD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC7B,MAAM,OAAO,GAAG,mBAAS,CAAC,WAAW,CACjC,IAAI,CAAC,GAAG,EACR,OAAO,CAAC,QAAQ,CACnB,CAAA;QACD,IAAI,OAAO,EAAE;YACP,MAAM,IAAI,GAAG,IAAI,cAAI,CAAC;gBACpB,GAAG,EAAE,IAAI,CAAC,GAAG;aACT,EAAE,OAAO,CAAC,CAAA;YAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;YAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;SACtB;IACL,CAAC;;AAvBL,sCAwBC;AAvBmB,gBAAE,GAAW,MAAM,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnimationFrames, FrameOptions } from '../Sprite/Spritesheet';
|
|
2
|
-
import
|
|
2
|
+
import { RpgComponent } from '../Components/Component';
|
|
3
3
|
declare type AnimationDataFrames = {
|
|
4
4
|
container: PIXI.Container;
|
|
5
5
|
sprites: {
|
|
@@ -14,7 +14,7 @@ declare type AnimationDataFrames = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare class Animation extends PIXI.Sprite {
|
|
16
16
|
id: string;
|
|
17
|
-
attachTo:
|
|
17
|
+
attachTo: RpgComponent;
|
|
18
18
|
hitbox: {
|
|
19
19
|
w: number;
|
|
20
20
|
h: number;
|
package/lib/Effects/Animation.js
CHANGED
|
@@ -16,7 +16,7 @@ class Animation extends PIXI.Sprite {
|
|
|
16
16
|
this.animations = new Map();
|
|
17
17
|
this.spritesheet = Spritesheets_1.spritesheets.get(this.id);
|
|
18
18
|
if (!this.spritesheet) {
|
|
19
|
-
throw Logger_1.log(`Impossible to find the ${this.id} spritesheet. Did you put the right name or create the spritesheet?`);
|
|
19
|
+
throw (0, Logger_1.log)(`Impossible to find the ${this.id} spritesheet. Did you put the right name or create the spritesheet?`);
|
|
20
20
|
}
|
|
21
21
|
this.createAnimations();
|
|
22
22
|
}
|
|
@@ -34,10 +34,10 @@ class Animation extends PIXI.Sprite {
|
|
|
34
34
|
const rectX = j * spriteWidth + offsetX;
|
|
35
35
|
const rectY = i * spriteHeight + offsetY;
|
|
36
36
|
if (rectY > height) {
|
|
37
|
-
throw Logger_1.log(`Warning, there is a problem with the height of the "${this.id}" spritesheet. When cutting into frames, the frame exceeds the height of the image.`);
|
|
37
|
+
throw (0, Logger_1.log)(`Warning, there is a problem with the height of the "${this.id}" spritesheet. When cutting into frames, the frame exceeds the height of the image.`);
|
|
38
38
|
}
|
|
39
39
|
if (rectX > width) {
|
|
40
|
-
throw Logger_1.log(`Warning, there is a problem with the width of the "${this.id}" spritesheet. When cutting into frames, the frame exceeds the width of the image.`);
|
|
40
|
+
throw (0, Logger_1.log)(`Warning, there is a problem with the width of the "${this.id}" spritesheet. When cutting into frames, the frame exceeds the width of the image.`);
|
|
41
41
|
}
|
|
42
42
|
frames[i].push(new PIXI.Texture(baseTexture, new PIXI.Rectangle(rectX, rectY, spriteWidth, spriteHeight)));
|
|
43
43
|
}
|
|
@@ -121,9 +121,12 @@ class Animation extends PIXI.Sprite {
|
|
|
121
121
|
return;
|
|
122
122
|
const { frames, container, sprites, data } = this.currentAnimation;
|
|
123
123
|
if (this.attachTo) {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
const sprite = this.attachTo;
|
|
125
|
+
const pos = sprite === null || sprite === void 0 ? void 0 : sprite.getPositionsOfGraphic('middle');
|
|
126
|
+
if (pos) {
|
|
127
|
+
container.x = pos.x;
|
|
128
|
+
container.y = pos.y;
|
|
129
|
+
}
|
|
127
130
|
}
|
|
128
131
|
for (let _sprite of container.children) {
|
|
129
132
|
const sprite = _sprite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../src/Effects/Animation.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AACrC,yDAAqD;
|
|
1
|
+
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../src/Effects/Animation.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AACrC,yDAAqD;AAErD,sCAA+B;AAC/B,gDAA4C;AAI5C,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,cAAK,CAAA;AAezC,MAAa,SAAU,SAAQ,IAAI,CAAC,MAAM;IAatC,YAAmB,EAAU;QACzB,KAAK,EAAE,CAAA;QADQ,OAAE,GAAF,EAAE,CAAQ;QARrB,WAAM,GAAqB,EAAE,CAAA;QAE7B,qBAAgB,GAA+B,IAAI,CAAA;QACnD,SAAI,GAAW,CAAC,CAAA;QAChB,eAAU,GAAqC,IAAI,GAAG,EAAE,CAAA;QAM5D,IAAI,CAAC,WAAW,GAAG,2BAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,MAAM,IAAA,YAAG,EAAC,0BAA0B,IAAI,CAAC,EAAE,qEAAqE,CAAC,CAAA;SACpH;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAA;IAC3B,CAAC;IAEO,cAAc,CAAC,OAAuB;QAC1C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,GAAQ,OAAO,CAAA;QAChF,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC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,CAAC,GAAG,CAAC,CAAA;YACxB,mBAAmB,CAAC,OAAO,CAAC,CAAA;YAC5B,mBAAmB,CAAC,UAAU,CAAC,CAAA;YAC/B,mBAAmB,CAAC,SAAS,CAAC,CAAA;SACjC;QACD,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC3C,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;YACb,IAAI,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;SACrC;IACL,CAAC;CACJ;AAzND,8BAyNC"}
|
package/lib/GameEngine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpgCommonGame, RpgCommonPlayer } from "@rpgjs/common";
|
|
1
|
+
import { RpgCommonGame, RpgCommonPlayer, RpgShape } from "@rpgjs/common";
|
|
2
2
|
import { Observable } from "rxjs";
|
|
3
3
|
import { RpgRenderer } from "./Renderer";
|
|
4
4
|
import { RpgClientEngine } from "./RpgClientEngine";
|
|
@@ -12,23 +12,57 @@ export declare class GameEngineClient extends RpgCommonGame {
|
|
|
12
12
|
clientEngine: RpgClientEngine;
|
|
13
13
|
renderer: RpgRenderer;
|
|
14
14
|
private _objects;
|
|
15
|
+
private _obsObjects;
|
|
16
|
+
private _shapes;
|
|
17
|
+
private _objectsChanged;
|
|
15
18
|
world: {
|
|
16
19
|
getObjects: () => {
|
|
17
20
|
[id: string]: ObjectFixture;
|
|
18
21
|
};
|
|
19
22
|
getObject: (id: string) => RpgCommonPlayer | null;
|
|
23
|
+
getShape: (id: string) => RpgShape | null;
|
|
24
|
+
getAll: (id: string) => RpgCommonPlayer | RpgShape | null;
|
|
20
25
|
removeObject: (id: any) => boolean;
|
|
21
26
|
getObjectsOfGroup: () => any;
|
|
27
|
+
getShapesOfGroup: () => {
|
|
28
|
+
[id: string]: ObjectFixture;
|
|
29
|
+
};
|
|
22
30
|
};
|
|
23
31
|
constructor();
|
|
32
|
+
private _get;
|
|
33
|
+
get objectsChanged(): Observable<{
|
|
34
|
+
[id: string]: ObjectFixture;
|
|
35
|
+
}>;
|
|
36
|
+
setObjectsChanged(val: {
|
|
37
|
+
[playerId: string]: ObjectFixture;
|
|
38
|
+
}): void;
|
|
39
|
+
listenObject(id: string): Observable<ObjectFixture>;
|
|
24
40
|
get objects(): Observable<{
|
|
25
41
|
[id: string]: ObjectFixture;
|
|
26
42
|
}>;
|
|
43
|
+
get shapes(): Observable<{
|
|
44
|
+
[id: string]: ObjectFixture;
|
|
45
|
+
}>;
|
|
46
|
+
get all(): Observable<{
|
|
47
|
+
[id: string]: ObjectFixture;
|
|
48
|
+
}>;
|
|
49
|
+
getShapes(): {
|
|
50
|
+
[id: string]: ObjectFixture;
|
|
51
|
+
};
|
|
27
52
|
getObjects(): {
|
|
28
53
|
[id: string]: ObjectFixture;
|
|
29
54
|
};
|
|
30
55
|
getObject(id: string): ObjectFixture | null;
|
|
56
|
+
getShape(id: string): ObjectFixture | null;
|
|
57
|
+
getObjectAndShape(id: string): ObjectFixture | null;
|
|
31
58
|
resetObjects(): void;
|
|
59
|
+
private _remove;
|
|
32
60
|
removeObject(id: any): boolean;
|
|
33
|
-
|
|
61
|
+
removeShape(id: any): boolean;
|
|
62
|
+
removeObjectAndShape(id: string): boolean;
|
|
63
|
+
static toArray(obj: any, prop: string): void;
|
|
64
|
+
updateObject(obj: any): {
|
|
65
|
+
object: any;
|
|
66
|
+
paramsChanged: any;
|
|
67
|
+
};
|
|
34
68
|
}
|