@eva/plugin-renderer-tiling-sprite 1.2.7-editor.7 → 1.2.7-editor.8
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/package.json +4 -4
- package/dist/miniprogram.js +0 -201
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-tiling-sprite",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.8",
|
|
4
4
|
"description": "@eva/plugin-renderer-tiling-sprite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-tiling-sprite.esm.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "0.1.0-alpha.2",
|
|
22
|
-
"@eva/plugin-renderer": "1.2.7-editor.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.7-editor.
|
|
24
|
-
"@eva/eva.js": "1.2.7-editor.
|
|
22
|
+
"@eva/plugin-renderer": "1.2.7-editor.8",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.7-editor.8",
|
|
24
|
+
"@eva/eva.js": "1.2.7-editor.8",
|
|
25
25
|
"@types/pixi.js": "^4.8.9"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/miniprogram.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata, __extends, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { Component, OBSERVER_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
|
|
3
|
-
import { Field } from '@eva/inspector-decorator';
|
|
4
|
-
import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
|
|
5
|
-
import { TilingSprite as TilingSprite$4 } from '@eva/renderer-adapter/dist/miniprogram';
|
|
6
|
-
|
|
7
|
-
var Vector2 = function () {
|
|
8
|
-
function Vector2() {}
|
|
9
|
-
|
|
10
|
-
__decorate([Field({
|
|
11
|
-
step: 0.1
|
|
12
|
-
}), __metadata("design:type", Number)], Vector2.prototype, "x", void 0);
|
|
13
|
-
|
|
14
|
-
__decorate([Field({
|
|
15
|
-
step: 0.1
|
|
16
|
-
}), __metadata("design:type", Number)], Vector2.prototype, "y", void 0);
|
|
17
|
-
|
|
18
|
-
return Vector2;
|
|
19
|
-
}();
|
|
20
|
-
|
|
21
|
-
var IntVector2 = function () {
|
|
22
|
-
function IntVector2() {}
|
|
23
|
-
|
|
24
|
-
__decorate([Field({
|
|
25
|
-
step: 1
|
|
26
|
-
}), __metadata("design:type", Number)], IntVector2.prototype, "x", void 0);
|
|
27
|
-
|
|
28
|
-
__decorate([Field({
|
|
29
|
-
step: 1
|
|
30
|
-
}), __metadata("design:type", Number)], IntVector2.prototype, "y", void 0);
|
|
31
|
-
|
|
32
|
-
return IntVector2;
|
|
33
|
-
}();
|
|
34
|
-
|
|
35
|
-
var TilingSprite$2 = function (_super) {
|
|
36
|
-
__extends(TilingSprite, _super);
|
|
37
|
-
|
|
38
|
-
function TilingSprite() {
|
|
39
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
-
|
|
41
|
-
_this.resource = '';
|
|
42
|
-
_this.tileScale = {
|
|
43
|
-
x: 1,
|
|
44
|
-
y: 1
|
|
45
|
-
};
|
|
46
|
-
_this.tilePosition = {
|
|
47
|
-
x: 0,
|
|
48
|
-
y: 0
|
|
49
|
-
};
|
|
50
|
-
return _this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
TilingSprite.prototype.init = function (obj) {
|
|
54
|
-
if (obj) {
|
|
55
|
-
this.resource = obj.resource;
|
|
56
|
-
this.tileScale = obj.tileScale;
|
|
57
|
-
this.tilePosition = obj.tilePosition;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
TilingSprite.componentName = 'TilingSprite';
|
|
62
|
-
|
|
63
|
-
__decorate([Field(), __metadata("design:type", String)], TilingSprite.prototype, "resource", void 0);
|
|
64
|
-
|
|
65
|
-
__decorate([Field(function () {
|
|
66
|
-
return Vector2;
|
|
67
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tileScale", void 0);
|
|
68
|
-
|
|
69
|
-
__decorate([Field(function () {
|
|
70
|
-
return IntVector2;
|
|
71
|
-
}), __metadata("design:type", Object)], TilingSprite.prototype, "tilePosition", void 0);
|
|
72
|
-
|
|
73
|
-
return TilingSprite;
|
|
74
|
-
}(Component);
|
|
75
|
-
|
|
76
|
-
var TilingSprite$3 = TilingSprite$2;
|
|
77
|
-
|
|
78
|
-
var TilingSprite = function (_super) {
|
|
79
|
-
__extends(TilingSprite, _super);
|
|
80
|
-
|
|
81
|
-
function TilingSprite() {
|
|
82
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
83
|
-
|
|
84
|
-
_this.name = 'TilingSprite';
|
|
85
|
-
_this.imgs = {};
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
TilingSprite.prototype.init = function () {
|
|
90
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
91
|
-
this.renderSystem.rendererManager.register(this);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
TilingSprite.prototype.rendererUpdate = function (gameObject) {
|
|
95
|
-
var _a = gameObject.transform.size,
|
|
96
|
-
width = _a.width,
|
|
97
|
-
height = _a.height;
|
|
98
|
-
var img = this.imgs[gameObject.id];
|
|
99
|
-
|
|
100
|
-
if (img) {
|
|
101
|
-
img.tilingSprite.width = width;
|
|
102
|
-
img.tilingSprite.height = height;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
TilingSprite.prototype.componentChanged = function (changed) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
var gameObjectId, component, sprite, asyncId, data, asyncId, data, sprite;
|
|
109
|
-
return __generator(this, function (_a) {
|
|
110
|
-
switch (_a.label) {
|
|
111
|
-
case 0:
|
|
112
|
-
gameObjectId = changed.gameObject.id;
|
|
113
|
-
if (!(changed.componentName === 'TilingSprite')) return [3, 7];
|
|
114
|
-
component = changed.component;
|
|
115
|
-
if (!(changed.type === OBSERVER_TYPE.ADD)) return [3, 2];
|
|
116
|
-
sprite = new TilingSprite$4(null);
|
|
117
|
-
this.imgs[changed.gameObject.id] = sprite;
|
|
118
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite.tilingSprite, 0);
|
|
119
|
-
this.setProp(changed.gameObject.id, component);
|
|
120
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
121
|
-
return [4, resource.getResource(component.resource)];
|
|
122
|
-
|
|
123
|
-
case 1:
|
|
124
|
-
data = _a.sent().data;
|
|
125
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
126
|
-
|
|
127
|
-
if (!data) {
|
|
128
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
129
|
-
return [2];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
sprite.image = data.image;
|
|
133
|
-
return [3, 7];
|
|
134
|
-
|
|
135
|
-
case 2:
|
|
136
|
-
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
137
|
-
if (!(changed.prop.prop[0] === 'resource')) return [3, 4];
|
|
138
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
139
|
-
return [4, resource.getResource(component.resource)];
|
|
140
|
-
|
|
141
|
-
case 3:
|
|
142
|
-
data = _a.sent().data;
|
|
143
|
-
if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
|
|
144
|
-
|
|
145
|
-
if (!data) {
|
|
146
|
-
console.error("GameObject:" + changed.gameObject.name + "'s TilingSprite resource load error");
|
|
147
|
-
return [2];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
this.imgs[changed.gameObject.id].image = data.image;
|
|
151
|
-
return [3, 5];
|
|
152
|
-
|
|
153
|
-
case 4:
|
|
154
|
-
this.setProp(changed.gameObject.id, component);
|
|
155
|
-
_a.label = 5;
|
|
156
|
-
|
|
157
|
-
case 5:
|
|
158
|
-
return [3, 7];
|
|
159
|
-
|
|
160
|
-
case 6:
|
|
161
|
-
if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
162
|
-
this.increaseAsyncId(gameObjectId);
|
|
163
|
-
sprite = this.imgs[changed.gameObject.id];
|
|
164
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.tilingSprite);
|
|
165
|
-
sprite.tilingSprite.destroy({
|
|
166
|
-
children: true
|
|
167
|
-
});
|
|
168
|
-
delete this.imgs[changed.gameObject.id];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
_a.label = 7;
|
|
172
|
-
|
|
173
|
-
case 7:
|
|
174
|
-
return [2];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
TilingSprite.prototype.setProp = function (id, component) {
|
|
181
|
-
this.imgs[id].tilingSprite.tilePosition = component.tilePosition;
|
|
182
|
-
this.imgs[id].tilingSprite.tileScale = component.tileScale;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
TilingSprite = __decorate([decorators.componentObserver({
|
|
186
|
-
TilingSprite: [{
|
|
187
|
-
prop: ['resource'],
|
|
188
|
-
deep: false
|
|
189
|
-
}, {
|
|
190
|
-
prop: ['tileScale'],
|
|
191
|
-
deep: true
|
|
192
|
-
}, {
|
|
193
|
-
prop: ['tilePosition'],
|
|
194
|
-
deep: true
|
|
195
|
-
}]
|
|
196
|
-
})], TilingSprite);
|
|
197
|
-
return TilingSprite;
|
|
198
|
-
}(Renderer);
|
|
199
|
-
|
|
200
|
-
var TilingSprite$1 = TilingSprite;
|
|
201
|
-
export { TilingSprite$3 as TilingSprite, TilingSprite$1 as TilingSpriteSystem };
|