@eva/plugin-renderer-img 1.2.7-editor.0 → 1.2.7-editor.3
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/EVA.plugin.renderer.img.js +119 -13
- package/dist/EVA.plugin.renderer.img.min.js +1 -1
- package/dist/miniprogram.js +5 -3
- package/dist/plugin-renderer-img.cjs.js +6 -1
- package/dist/plugin-renderer-img.cjs.prod.js +1 -1
- package/dist/plugin-renderer-img.esm.js +7 -2
- package/package.json +5 -5
|
@@ -12,7 +12,7 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
12
12
|
d.__proto__ = b;
|
|
13
13
|
} || function (d, b) {
|
|
14
14
|
for (var p in b) {
|
|
15
|
-
if (
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -20,6 +20,8 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
function __extends(d, b) {
|
|
23
|
+
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
24
|
+
|
|
23
25
|
_extendStatics(d, b);
|
|
24
26
|
|
|
25
27
|
function __() {
|
|
@@ -29,6 +31,22 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
29
31
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
var _assign = function __assign() {
|
|
35
|
+
_assign = Object.assign || function __assign(t) {
|
|
36
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
37
|
+
s = arguments[i];
|
|
38
|
+
|
|
39
|
+
for (var p in s) {
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return _assign.apply(this, arguments);
|
|
48
|
+
};
|
|
49
|
+
|
|
32
50
|
function __decorate(decorators, target, key, desc) {
|
|
33
51
|
var c = arguments.length,
|
|
34
52
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
@@ -39,6 +57,10 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
39
57
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
40
58
|
}
|
|
41
59
|
|
|
60
|
+
function __metadata(metadataKey, metadataValue) {
|
|
61
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
62
|
+
}
|
|
63
|
+
|
|
42
64
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
43
65
|
function adopt(value) {
|
|
44
66
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -182,24 +204,106 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
182
204
|
}
|
|
183
205
|
}
|
|
184
206
|
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
|
|
207
|
+
var SymbolKeysNotSupportedError = function (_super) {
|
|
208
|
+
__extends(SymbolKeysNotSupportedError, _super);
|
|
209
|
+
|
|
210
|
+
function SymbolKeysNotSupportedError() {
|
|
211
|
+
var _newTarget = this.constructor;
|
|
212
|
+
|
|
213
|
+
var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
|
|
214
|
+
|
|
215
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
216
|
+
return _this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return SymbolKeysNotSupportedError;
|
|
220
|
+
}(Error);
|
|
221
|
+
|
|
222
|
+
(function (_super) {
|
|
223
|
+
__extends(StaticGetPropertiesIsNotAFunctionError, _super);
|
|
224
|
+
|
|
225
|
+
function StaticGetPropertiesIsNotAFunctionError() {
|
|
226
|
+
var _newTarget = this.constructor;
|
|
227
|
+
|
|
228
|
+
var _this = _super.call(this, 'getProperties is not a function!') || this;
|
|
229
|
+
|
|
230
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
231
|
+
return _this;
|
|
188
232
|
}
|
|
189
233
|
|
|
190
|
-
|
|
191
|
-
|
|
234
|
+
return StaticGetPropertiesIsNotAFunctionError;
|
|
235
|
+
})(Error);
|
|
236
|
+
|
|
237
|
+
var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
|
|
238
|
+
|
|
239
|
+
function transformBasicType(type) {
|
|
240
|
+
if (type === String) {
|
|
241
|
+
return 'string';
|
|
192
242
|
}
|
|
193
243
|
|
|
194
|
-
|
|
195
|
-
|
|
244
|
+
if (type === Number) {
|
|
245
|
+
return 'number';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (type === Boolean) {
|
|
249
|
+
return 'boolean';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return 'unknown';
|
|
196
253
|
}
|
|
197
254
|
|
|
198
|
-
function
|
|
255
|
+
function defineTypes(target, key, options, returnTypeFunction) {
|
|
256
|
+
var type = Reflect.getMetadata('design:type', target, key);
|
|
257
|
+
var isArray = type === Array;
|
|
258
|
+
var str = transformBasicType(type);
|
|
259
|
+
|
|
260
|
+
if (str !== 'unknown') {
|
|
261
|
+
type = str;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (returnTypeFunction) {
|
|
265
|
+
var returnType = returnTypeFunction();
|
|
266
|
+
|
|
267
|
+
if (Array.isArray(returnType)) {
|
|
268
|
+
isArray = true;
|
|
269
|
+
type = returnType[0];
|
|
270
|
+
} else {
|
|
271
|
+
type = returnType;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
|
|
276
|
+
properties[key] = _assign({
|
|
277
|
+
type: type,
|
|
278
|
+
isArray: isArray
|
|
279
|
+
}, options);
|
|
280
|
+
Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
|
|
284
|
+
if (typeof returnTypeFuncOrOptions === 'function') {
|
|
285
|
+
return {
|
|
286
|
+
returnTypeFunc: returnTypeFuncOrOptions,
|
|
287
|
+
options: maybeOptions || {}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
options: returnTypeFuncOrOptions || {}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function Field(returnTypeFunction, maybeOptions) {
|
|
199
297
|
return function (target, propertyKey) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
298
|
+
if (typeof propertyKey === 'symbol') {
|
|
299
|
+
throw new SymbolKeysNotSupportedError();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
|
|
303
|
+
options = _a.options,
|
|
304
|
+
returnTypeFunc = _a.returnTypeFunc;
|
|
305
|
+
|
|
306
|
+
defineTypes(target, propertyKey, options, returnTypeFunc);
|
|
203
307
|
};
|
|
204
308
|
}
|
|
205
309
|
|
|
@@ -221,7 +325,9 @@ var _EVA_IIFE_img = function (exports, eva_js, pluginRenderer, rendererAdapter,
|
|
|
221
325
|
|
|
222
326
|
Img.componentName = 'Img';
|
|
223
327
|
|
|
224
|
-
__decorate([
|
|
328
|
+
__decorate([Field({
|
|
329
|
+
type: 'resource'
|
|
330
|
+
}), __metadata("design:type", String)], Img.prototype, "resource", void 0);
|
|
225
331
|
|
|
226
332
|
return Img;
|
|
227
333
|
}(eva_js.Component);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_img=function(e,t,r,n,o){"use strict";var i=function(e,t){return
|
|
1
|
+
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_img=function(e,t,r,n,o){"use strict";var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function s(e,t,r,n){var o,i=arguments.length,c=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(c=(i<3?o(c):i>3?o(t,r,c):o(t,r))||c);return i>3&&c&&Object.defineProperty(t,r,c),c}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))((function(o,i){function c(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}s((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var f=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return c(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}c(t,e)}(Error);var d="IDE_PROPERTY_METADATA";function g(e,t,r,n){var o=Reflect.getMetadata("design:type",e,t),i=o===Array,c=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(o);if("unknown"!==c&&(o=c),n){var s=n();Array.isArray(s)?(i=!0,o=s[0]):o=s}var u=Reflect.getMetadata(d,e.constructor)||{};u[t]=a({type:o,isArray:i},r),Reflect.defineMetadata(d,u,e.constructor)}var y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t}var r,n;return c(t,e),t.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},t.componentName="Img",s([(r={type:"resource"},function(e,t){if("symbol"==typeof t)throw new f;var o=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(r,n);g(e,t,o.options,o.returnTypeFunc)}),u("design:type",String)],t.prototype,"resource",void 0),t}(t.Component),m=y;t.resource.registerInstance(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.data,r=(void 0===t?{}:t).image;if(r)return o.Texture.from(r)})),t.resource.registerDestroy(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.instance;t&&t.destroy(!0)}));var h=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Img",t.imgs={},t}return c(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=r,this.imgs[e.id].sprite.height=n)},o.prototype.componentChanged=function(e){var r,o;return l(this,void 0,void 0,(function(){var i,c,a,s;return p(this,(function(u){switch(u.label){case 0:return"Img"!==e.componentName?[3,5]:(i=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(s=new n.Sprite(null),this.imgs[e.gameObject.id]=s,this.containerManager.getContainer(e.gameObject.id).addChildAt(s.sprite,0),c=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(i.resource)]));case 1:return a=u.sent().instance,this.validateAsyncId(e.gameObject.id,c)?(a||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=a,[3,5]):[2];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,4]:(c=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(i.resource)]);case 3:return a=u.sent().instance,this.validateAsyncId(e.gameObject.id,c)?(a||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=a,[3,5]):[2];case 4:if(e.type===t.OBSERVER_TYPE.REMOVE){if(this.increaseAsyncId(e.gameObject.id),!(s=this.imgs[e.gameObject.id]))return[2];null===(o=null===(r=this.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id))||void 0===o||o.removeChild(s.sprite),s.sprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}u.label=5;case 5:return[2]}}))}))},o.systemName="Img",o=s([t.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],o)}(r.Renderer),b=h;return e.Img=m,e.ImgSystem=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter,PIXI);window.EVA.plugin.renderer.img=window.EVA.plugin.renderer.img||_EVA_IIFE_img;
|
package/dist/miniprogram.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __extends, __decorate, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import {
|
|
1
|
+
import { __extends, __decorate, __metadata, __awaiter, __generator } from 'tslib';
|
|
2
|
+
import { Field } from '@eva/inspector-decorator';
|
|
3
3
|
import { Component, resource, RESOURCE_TYPE, OBSERVER_TYPE, decorators } from '@eva/eva.js/dist/miniprogram';
|
|
4
4
|
import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
|
|
5
5
|
import { Sprite } from '@eva/renderer-adapter/dist/miniprogram';
|
|
@@ -23,7 +23,9 @@ var Img$2 = function (_super) {
|
|
|
23
23
|
|
|
24
24
|
Img.componentName = 'Img';
|
|
25
25
|
|
|
26
|
-
__decorate([
|
|
26
|
+
__decorate([Field({
|
|
27
|
+
type: 'resource'
|
|
28
|
+
}), __metadata("design:type", String)], Img.prototype, "resource", void 0);
|
|
27
29
|
|
|
28
30
|
return Img;
|
|
29
31
|
}(Component);
|
|
@@ -44,6 +44,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
44
44
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function __metadata(metadataKey, metadataValue) {
|
|
48
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
48
52
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
53
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -95,7 +99,8 @@ var Img$2 = (function (_super) {
|
|
|
95
99
|
};
|
|
96
100
|
Img.componentName = 'Img';
|
|
97
101
|
__decorate([
|
|
98
|
-
inspectorDecorator.type
|
|
102
|
+
inspectorDecorator.Field({ type: 'resource' }),
|
|
103
|
+
__metadata("design:type", String)
|
|
99
104
|
], Img.prototype, "resource", void 0);
|
|
100
105
|
return Img;
|
|
101
106
|
}(eva_js.Component));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/inspector-decorator"),t=require("@eva/eva.js"),r=require("@eva/plugin-renderer"),n=require("@eva/renderer-adapter"),i=require("pixi.js"),o=function(e,t){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/inspector-decorator"),t=require("@eva/eva.js"),r=require("@eva/plugin-renderer"),n=require("@eva/renderer-adapter"),i=require("pixi.js"),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},o(e,t)};function c(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var i,o=arguments.length,c=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t){var r,n,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var l=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e}return c(r,t),r.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},r.componentName="Img",a([e.Field({type:"resource"}),s("design:type",String)],r.prototype,"resource",void 0),r}(t.Component),p=l;t.resource.registerInstance(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.data,r=(void 0===t?{}:t).image;if(r)return i.Texture.from(r)})),t.resource.registerDestroy(t.RESOURCE_TYPE.IMAGE,(function(e){var t=e.instance;t&&t.destroy(!0)}));var d=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Img",t.imgs={},t}return c(i,e),i.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},i.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=r,this.imgs[e.id].sprite.height=n)},i.prototype.componentChanged=function(e){var r,i,o,c,a,s;return o=this,c=void 0,s=function(){var o,c,a,s;return u(this,(function(u){switch(u.label){case 0:return"Img"!==e.componentName?[3,5]:(o=e.component,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:(s=new n.Sprite(null),this.imgs[e.gameObject.id]=s,this.containerManager.getContainer(e.gameObject.id).addChildAt(s.sprite,0),c=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(o.resource)]));case 1:return a=u.sent().instance,this.validateAsyncId(e.gameObject.id,c)?(a||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=a,[3,5]):[2];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,4]:(c=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(o.resource)]);case 3:return a=u.sent().instance,this.validateAsyncId(e.gameObject.id,c)?(a||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=a,[3,5]):[2];case 4:if(e.type===t.OBSERVER_TYPE.REMOVE){if(this.increaseAsyncId(e.gameObject.id),!(s=this.imgs[e.gameObject.id]))return[2];null===(i=null===(r=this.containerManager)||void 0===r?void 0:r.getContainer(e.gameObject.id))||void 0===i||i.removeChild(s.sprite),s.sprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}u.label=5;case 5:return[2]}}))},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{i(s.next(e))}catch(e){t(e)}}function n(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new a((function(e){e(t.value)})).then(r,n)}i((s=s.apply(o,c||[])).next())}))},i.systemName="Img",i=a([t.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],i)}(r.Renderer);exports.Img=p,exports.ImgSystem=d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Field } from '@eva/inspector-decorator';
|
|
2
2
|
import { Component, resource, RESOURCE_TYPE, decorators, OBSERVER_TYPE } from '@eva/eva.js';
|
|
3
3
|
import { RendererSystem, Renderer } from '@eva/plugin-renderer';
|
|
4
4
|
import { Sprite } from '@eva/renderer-adapter';
|
|
@@ -40,6 +40,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
40
40
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function __metadata(metadataKey, metadataValue) {
|
|
44
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
48
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
45
49
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -91,7 +95,8 @@ var Img$2 = (function (_super) {
|
|
|
91
95
|
};
|
|
92
96
|
Img.componentName = 'Img';
|
|
93
97
|
__decorate([
|
|
94
|
-
type
|
|
98
|
+
Field({ type: 'resource' }),
|
|
99
|
+
__metadata("design:type", String)
|
|
95
100
|
], Img.prototype, "resource", void 0);
|
|
96
101
|
return Img;
|
|
97
102
|
}(Component));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-img",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.3",
|
|
4
4
|
"description": "@eva/plugin-renderer-img",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-img.esm.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/inspector-decorator": "
|
|
22
|
-
"@eva/plugin-renderer": "1.2.7-editor.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.7-editor.
|
|
24
|
-
"@eva/eva.js": "1.2.7-editor.
|
|
21
|
+
"@eva/inspector-decorator": "0.1.0-alpha.1",
|
|
22
|
+
"@eva/plugin-renderer": "1.2.7-editor.3",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.7-editor.3",
|
|
24
|
+
"@eva/eva.js": "1.2.7-editor.3",
|
|
25
25
|
"pixi.js": "^4.8.7"
|
|
26
26
|
}
|
|
27
27
|
}
|