@eva/plugin-renderer-nine-patch 2.0.0-beta.17 → 2.0.0-beta.19
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
globalThis.EVA = globalThis.EVA || {};
|
|
2
|
+
globalThis.EVA.plugin = globalThis.EVA.plugin || {};
|
|
3
|
+
globalThis.EVA.plugin.renderer = globalThis.EVA.plugin.renderer || {};
|
|
4
4
|
var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAdapter) {
|
|
5
5
|
'use strict';
|
|
6
6
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -183,4 +183,4 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
|
|
|
183
183
|
});
|
|
184
184
|
return exports;
|
|
185
185
|
}({}, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
|
|
186
|
-
|
|
186
|
+
globalThis.EVA.plugin.renderer.ninePatch = globalThis.EVA.plugin.renderer.ninePatch || _EVA_IIFE_ninePatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_ninePatch=function(e,t,i,r){"use strict";function n(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}function o(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{h(r.next(e))}catch(e){o(e)}}function c(e){try{h(r.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}h((r=r.apply(e,t||[])).next())}))}function s(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}function c(e){return function(t,i){var r=s(t,i);r.key=i,r.type=e}}function h(e){return function(t,i){s(t,i).step=e}}class a extends t.Component{constructor(){super(...arguments),this.resource="",this.spriteName="",this.leftWidth=0,this.topHeight=0,this.rightWidth=0,this.bottomHeight=0}init(e){this.resource=e.resource,this.spriteName=e.spriteName,this.leftWidth=e.leftWidth,this.topHeight=e.topHeight,this.rightWidth=e.rightWidth,this.bottomHeight=e.bottomHeight}}a.componentName="NinePatch",n([c("string")],a.prototype,"resource",void 0),n([c("string")],a.prototype,"spriteName",void 0),n([c("number"),h(1)],a.prototype,"leftWidth",void 0),n([c("number"),h(1)],a.prototype,"topHeight",void 0),n([c("number"),h(1)],a.prototype,"rightWidth",void 0),n([c("number"),h(1)],a.prototype,"bottomHeight",void 0);let d=class extends i.Renderer{constructor(){super(...arguments),this.name="NinePatch",this.ninePatch={}}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:i}=e.transform.size;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=t,this.ninePatch[e.id].height=i)}componentChanged(e){return o(this,void 0,void 0,(function*(){"NinePatch"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.add(e):e.type===t.OBSERVER_TYPE.REMOVE?this.remove(e):(this.remove(e),this.add(e)))}))}add(e){return o(this,void 0,void 0,(function*(){const i=e.component,n=e.gameObject.id,o=this.increaseAsyncId(n),{type:s,data:c,instance:h}=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(n,o))return;if(!c)return void console.error(`GameObject:${e.gameObject.name}'s NinePatch resource load error`);let a;if(s===t.RESOURCE_TYPE.SPRITE&&i.spriteName){if(!h)return void console.error("GameObjectNinePatch Sprite resource rely on the Sprite system");a=h[i.resource+"_s|r|c_"+i.spriteName]}else a=c.image;const{leftWidth:d,topHeight:u,rightWidth:p,bottomHeight:g}=i,l=new r.NinePatch(a,d,u,p,g);this.ninePatch[e.gameObject.id]=l,i.ninePatch=l,this.containerManager.getContainer(e.gameObject.id).addChildAt(l,0)}))}remove(e){const t=e.gameObject.id;this.increaseAsyncId(t);const i=this.ninePatch[t];i&&(this.containerManager.getContainer(e.gameObject.id).removeChild(i),delete this.ninePatch[e.gameObject.id],i.destroy({children:!0}))}};d.systemName="NinePatch",d=n([t.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],d);var u=d;return e.NinePatch=a,e.NinePatchSystem=u,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.ninePatch=globalThis.EVA.plugin.renderer.ninePatch||_EVA_IIFE_ninePatch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-nine-patch",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.19",
|
|
4
4
|
"description": "@eva/plugin-renderer-nine-patch",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-nine-patch.esm.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
-
"@eva/plugin-renderer": "2.0.0-beta.
|
|
23
|
-
"@eva/renderer-adapter": "2.0.0-beta.
|
|
24
|
-
"@eva/eva.js": "2.0.0-beta.
|
|
22
|
+
"@eva/plugin-renderer": "2.0.0-beta.19",
|
|
23
|
+
"@eva/renderer-adapter": "2.0.0-beta.19",
|
|
24
|
+
"@eva/eva.js": "2.0.0-beta.19"
|
|
25
25
|
}
|
|
26
26
|
}
|