@combos-fun/plugin-renderer-nine-patch 0.0.34 → 0.0.36
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/plugin-renderer-nine-patch.cjs.js +50 -10
- package/dist/plugin-renderer-nine-patch.cjs.js.map +1 -1
- package/dist/plugin-renderer-nine-patch.cjs.prod.js +1 -1
- package/dist/plugin-renderer-nine-patch.esm.js +51 -11
- package/dist/plugin-renderer-nine-patch.esm.js.map +1 -1
- package/package.json +6 -6
|
@@ -30,26 +30,66 @@ let NinePatch$1 = class NinePatch extends engine.Component {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
tslib.__decorate([
|
|
33
|
-
inspectorDecorator.
|
|
33
|
+
inspectorDecorator.Field({
|
|
34
|
+
type: 'string',
|
|
35
|
+
group: 'NinePatch',
|
|
36
|
+
label: 'resource',
|
|
37
|
+
description: 'Nine-patch image or atlas resource id.',
|
|
38
|
+
editor: 'text',
|
|
39
|
+
})
|
|
34
40
|
], NinePatch$1.prototype, "resource", void 0);
|
|
35
41
|
tslib.__decorate([
|
|
36
|
-
inspectorDecorator.
|
|
42
|
+
inspectorDecorator.Field({
|
|
43
|
+
type: 'string',
|
|
44
|
+
group: 'NinePatch',
|
|
45
|
+
label: 'spriteName',
|
|
46
|
+
description: 'Optional atlas frame name for the nine-patch source.',
|
|
47
|
+
editor: 'text',
|
|
48
|
+
})
|
|
37
49
|
], NinePatch$1.prototype, "spriteName", void 0);
|
|
38
50
|
tslib.__decorate([
|
|
39
|
-
inspectorDecorator.
|
|
40
|
-
|
|
51
|
+
inspectorDecorator.Field({
|
|
52
|
+
type: 'number',
|
|
53
|
+
step: 1,
|
|
54
|
+
min: 0,
|
|
55
|
+
group: 'NinePatch',
|
|
56
|
+
label: 'leftWidth',
|
|
57
|
+
description: 'Left border width preserved when stretching.',
|
|
58
|
+
editor: 'number-stepper',
|
|
59
|
+
})
|
|
41
60
|
], NinePatch$1.prototype, "leftWidth", void 0);
|
|
42
61
|
tslib.__decorate([
|
|
43
|
-
inspectorDecorator.
|
|
44
|
-
|
|
62
|
+
inspectorDecorator.Field({
|
|
63
|
+
type: 'number',
|
|
64
|
+
step: 1,
|
|
65
|
+
min: 0,
|
|
66
|
+
group: 'NinePatch',
|
|
67
|
+
label: 'topHeight',
|
|
68
|
+
description: 'Top border height preserved when stretching.',
|
|
69
|
+
editor: 'number-stepper',
|
|
70
|
+
})
|
|
45
71
|
], NinePatch$1.prototype, "topHeight", void 0);
|
|
46
72
|
tslib.__decorate([
|
|
47
|
-
inspectorDecorator.
|
|
48
|
-
|
|
73
|
+
inspectorDecorator.Field({
|
|
74
|
+
type: 'number',
|
|
75
|
+
step: 1,
|
|
76
|
+
min: 0,
|
|
77
|
+
group: 'NinePatch',
|
|
78
|
+
label: 'rightWidth',
|
|
79
|
+
description: 'Right border width preserved when stretching.',
|
|
80
|
+
editor: 'number-stepper',
|
|
81
|
+
})
|
|
49
82
|
], NinePatch$1.prototype, "rightWidth", void 0);
|
|
50
83
|
tslib.__decorate([
|
|
51
|
-
inspectorDecorator.
|
|
52
|
-
|
|
84
|
+
inspectorDecorator.Field({
|
|
85
|
+
type: 'number',
|
|
86
|
+
step: 1,
|
|
87
|
+
min: 0,
|
|
88
|
+
group: 'NinePatch',
|
|
89
|
+
label: 'bottomHeight',
|
|
90
|
+
description: 'Bottom border height preserved when stretching.',
|
|
91
|
+
editor: 'number-stepper',
|
|
92
|
+
})
|
|
53
93
|
], NinePatch$1.prototype, "bottomHeight", void 0);
|
|
54
94
|
|
|
55
95
|
const resourceKeySplit = pluginRenderer.RESOURCE_KEY_SPLIT;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-renderer-nine-patch.cjs.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { type, step } from '@combos-fun/inspector-decorator';\nimport { NinePatch as NinePatchSprite } from \"@combos-fun/renderer-adapter\";\n\nexport interface NinePatchParams {\n resource: string;\n spriteName?: string;\n leftWidth?: number;\n topHeight?: number;\n rightWidth?: number;\n bottomHeight?: number;\n}\n\nexport default class NinePatch extends Component<NinePatchParams> {\n static componentName: string = 'NinePatch';\n ninePatch: NinePatchSprite;\n @type('string') resource: string = '';\n @type('string') spriteName: string = '';\n\n @type('number') @step(1) leftWidth: number = 0;\n @type('number') @step(1) topHeight: number = 0;\n @type('number') @step(1) rightWidth: number = 0;\n @type('number') @step(1) bottomHeight: number = 0;\n init(obj?: NinePatchParams) {\n if (!obj) return;\n this.resource = obj.resource;\n this.spriteName = obj.spriteName;\n this.leftWidth = obj.leftWidth;\n this.topHeight = obj.topHeight;\n this.rightWidth = obj.rightWidth;\n this.bottomHeight = obj.bottomHeight;\n }\n}\n","import { GameObject, decorators, resource, ComponentChanged, RESOURCE_TYPE, OBSERVER_TYPE } from '@combos-fun/engine';\nimport { RendererManager, ContainerManager, RendererSystem, Renderer, RESOURCE_KEY_SPLIT } from '@combos-fun/plugin-renderer';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\nimport NinePatchComponent from './component';\nimport { Texture } from 'pixi.js';\n\nconst resourceKeySplit = RESOURCE_KEY_SPLIT;\n\n@decorators.componentObserver({\n NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight'],\n})\nexport default class NinePatch extends Renderer {\n static systemName: string = 'NinePatch';\n name: string = 'NinePatch';\n ninePatch: { [propName: number]: NinePatchSprite } = {};\n renderSystem: RendererSystem;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n init() {\n this.renderSystem = this.game.getSystem(RendererSystem) as RendererSystem;\n this.renderSystem.rendererManager.register(this);\n }\n rendererUpdate(gameObject: GameObject) {\n const { width, height } = gameObject.transform.size;\n if (this.ninePatch[gameObject.id]) {\n this.ninePatch[gameObject.id].width = width;\n this.ninePatch[gameObject.id].height = height;\n }\n }\n async componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'NinePatch') {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.add(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.remove(changed);\n } else {\n this.remove(changed);\n this.add(changed);\n }\n }\n }\n async add(changed: ComponentChanged) {\n const component = changed.component as NinePatchComponent;\n const gameObjectId = changed.gameObject.id;\n const asyncId = this.increaseAsyncId(gameObjectId);\n const { type, data } = await resource.getResource(component.resource);\n if (!this.validateAsyncId(gameObjectId, asyncId)) return;\n if (!data) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch resource load error`);\n return\n }\n let img: string | Texture;\n if (type === RESOURCE_TYPE.SPRITE) {\n img = component.resource + resourceKeySplit + component.spriteName;\n } else {\n img = Texture.from(data.image as HTMLImageElement);\n }\n const { leftWidth, topHeight, rightWidth, bottomHeight } = component;\n const np = new NinePatchSprite(img, leftWidth, topHeight, rightWidth, bottomHeight);\n\n this.ninePatch[changed.gameObject.id] = np;\n component.ninePatch = np;\n const parent = this.containerManager.getContainer(changed.gameObject.id);\n if (!parent) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch missing display container`);\n return;\n }\n parent.addChildAt(np, 0);\n }\n remove(changed: ComponentChanged) {\n const gameObjectId = changed.gameObject.id;\n this.increaseAsyncId(gameObjectId);\n const sprite = this.ninePatch[gameObjectId];\n if (sprite) {\n this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);\n delete this.ninePatch[changed.gameObject.id];\n sprite.destroy({ children: true });\n }\n }\n}\n"],"names":["Component","__decorate","type","NinePatch","step","RESOURCE_KEY_SPLIT","Renderer","RendererSystem","OBSERVER_TYPE","resource","RESOURCE_TYPE","Texture","NinePatchSprite","decorators"],"mappings":";;;;;;;;;kBAac,MAAO,SAAU,SAAQA,gBAA0B,CAAA;AAAjE,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACrB,IAAA,CAAA,UAAU,GAAW,EAAE;QAEd,IAAA,CAAA,SAAS,G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AA,SAAS,CAAC,SAAS,GAAG,EAAE;AACxB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACxE,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,CAAA,WAAA,EAAc,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,sCAAA,CAAwC,CAAC;YAC5F;QACF;AACA,QAAA,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1B;AACA,IAAA,MAAM,CAAC,OAAyB,EAAA;AAC9B,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE;AAC1C,QAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QAC3C,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YAC7E,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACpC;IACF;;AAnEmB,SAAS,GAAAX,gBAAA,CAAA;IAH7BY,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC;KAC9F;AACoB,CAAA,EAAA,SAAS,CAoE7B;wBApEoB,SAAS;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin-renderer-nine-patch.cjs.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\n\nexport interface NinePatchParams {\n resource: string;\n spriteName?: string;\n leftWidth?: number;\n topHeight?: number;\n rightWidth?: number;\n bottomHeight?: number;\n}\n\nexport default class NinePatch extends Component<NinePatchParams> {\n static componentName: string = 'NinePatch';\n ninePatch: NinePatchSprite;\n\n @Field({\n type: 'string',\n group: 'NinePatch',\n label: 'resource',\n description: 'Nine-patch image or atlas resource id.',\n editor: 'text',\n })\n resource: string = '';\n\n @Field({\n type: 'string',\n group: 'NinePatch',\n label: 'spriteName',\n description: 'Optional atlas frame name for the nine-patch source.',\n editor: 'text',\n })\n spriteName: string = '';\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'leftWidth',\n description: 'Left border width preserved when stretching.',\n editor: 'number-stepper',\n })\n leftWidth: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'topHeight',\n description: 'Top border height preserved when stretching.',\n editor: 'number-stepper',\n })\n topHeight: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'rightWidth',\n description: 'Right border width preserved when stretching.',\n editor: 'number-stepper',\n })\n rightWidth: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'bottomHeight',\n description: 'Bottom border height preserved when stretching.',\n editor: 'number-stepper',\n })\n bottomHeight: number = 0;\n\n init(obj?: NinePatchParams) {\n if (!obj) return;\n this.resource = obj.resource;\n this.spriteName = obj.spriteName;\n this.leftWidth = obj.leftWidth;\n this.topHeight = obj.topHeight;\n this.rightWidth = obj.rightWidth;\n this.bottomHeight = obj.bottomHeight;\n }\n}\n","import { GameObject, decorators, resource, ComponentChanged, RESOURCE_TYPE, OBSERVER_TYPE } from '@combos-fun/engine';\nimport { RendererManager, ContainerManager, RendererSystem, Renderer, RESOURCE_KEY_SPLIT } from '@combos-fun/plugin-renderer';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\nimport NinePatchComponent from './component';\nimport { Texture } from 'pixi.js';\n\nconst resourceKeySplit = RESOURCE_KEY_SPLIT;\n\n@decorators.componentObserver({\n NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight'],\n})\nexport default class NinePatch extends Renderer {\n static systemName: string = 'NinePatch';\n name: string = 'NinePatch';\n ninePatch: { [propName: number]: NinePatchSprite } = {};\n renderSystem: RendererSystem;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n init() {\n this.renderSystem = this.game.getSystem(RendererSystem) as RendererSystem;\n this.renderSystem.rendererManager.register(this);\n }\n rendererUpdate(gameObject: GameObject) {\n const { width, height } = gameObject.transform.size;\n if (this.ninePatch[gameObject.id]) {\n this.ninePatch[gameObject.id].width = width;\n this.ninePatch[gameObject.id].height = height;\n }\n }\n async componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'NinePatch') {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.add(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.remove(changed);\n } else {\n this.remove(changed);\n this.add(changed);\n }\n }\n }\n async add(changed: ComponentChanged) {\n const component = changed.component as NinePatchComponent;\n const gameObjectId = changed.gameObject.id;\n const asyncId = this.increaseAsyncId(gameObjectId);\n const { type, data } = await resource.getResource(component.resource);\n if (!this.validateAsyncId(gameObjectId, asyncId)) return;\n if (!data) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch resource load error`);\n return\n }\n let img: string | Texture;\n if (type === RESOURCE_TYPE.SPRITE) {\n img = component.resource + resourceKeySplit + component.spriteName;\n } else {\n img = Texture.from(data.image as HTMLImageElement);\n }\n const { leftWidth, topHeight, rightWidth, bottomHeight } = component;\n const np = new NinePatchSprite(img, leftWidth, topHeight, rightWidth, bottomHeight);\n\n this.ninePatch[changed.gameObject.id] = np;\n component.ninePatch = np;\n const parent = this.containerManager.getContainer(changed.gameObject.id);\n if (!parent) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch missing display container`);\n return;\n }\n parent.addChildAt(np, 0);\n }\n remove(changed: ComponentChanged) {\n const gameObjectId = changed.gameObject.id;\n this.increaseAsyncId(gameObjectId);\n const sprite = this.ninePatch[gameObjectId];\n if (sprite) {\n this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);\n delete this.ninePatch[changed.gameObject.id];\n sprite.destroy({ children: true });\n }\n }\n}\n"],"names":["Component","__decorate","Field","NinePatch","RESOURCE_KEY_SPLIT","Renderer","RendererSystem","OBSERVER_TYPE","resource","RESOURCE_TYPE","Texture","NinePatchSprite","decorators"],"mappings":";;;;;;;;;kBAac,MAAO,SAAU,SAAQA,gBAA0B,CAAA;AAAjE,IAAA,WAAA,GAAA;;QAWE,IAAA,CAAA,QAAQ,GAAW,EAAE;QASrB,IAAA,CAAA,UAAU,GAAW,EAAE;QAWvB,IAAA,CAAA,SAAS,GAAW,CAAC;QAWrB,IAAA,CAAA,SAAS,GAAW,CAAC;QAWrB,IAAA,CAAA,UAAU,GAAW,CAAC;QAWtB,IAAA,CAAA,YAAY,GAAW,CAAC;IAW1B;aA1ES,IAAA,CAAA,aAAa,GAAW,WAAX,CAAuB;AAiE3C,IAAA,IAAI,CAAC,GAAqB,EAAA;AACxB,QAAA,IAAI,CAAC,GAAG;YAAE;AACV,QAAA,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ;AAC5B,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;AAChC,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;AAC9B,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;AAC9B,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;AAChC,QAAA,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY;IACtC;;AA/DAC,gBAAA,CAAA;AAPC,IAAAC,wBAAK,CAAC;AACL,QAAA,IAA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AC;QACpC;IACF;;AAnEmB,SAAS,GAAAV,gBAAA,CAAA;IAH7BW,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC;KAC9F;AACoB,CAAA,EAAA,SAAS,CAoE7B;wBApEoB,SAAS;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),t=require("@combos-fun/engine"),i=require("@combos-fun/inspector-decorator"),r=require("@combos-fun/plugin-renderer"),
|
|
1
|
+
"use strict";var e=require("tslib"),t=require("@combos-fun/engine"),i=require("@combos-fun/inspector-decorator"),r=require("@combos-fun/plugin-renderer"),o=require("@combos-fun/renderer-adapter"),n=require("pixi.js");let s=class extends t.Component{constructor(){super(...arguments),this.resource="",this.spriteName="",this.leftWidth=0,this.topHeight=0,this.rightWidth=0,this.bottomHeight=0}static{this.componentName="NinePatch"}init(e){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)}};e.__decorate([i.Field({type:"string",group:"NinePatch",label:"resource",description:"Nine-patch image or atlas resource id.",editor:"text"})],s.prototype,"resource",void 0),e.__decorate([i.Field({type:"string",group:"NinePatch",label:"spriteName",description:"Optional atlas frame name for the nine-patch source.",editor:"text"})],s.prototype,"spriteName",void 0),e.__decorate([i.Field({type:"number",step:1,min:0,group:"NinePatch",label:"leftWidth",description:"Left border width preserved when stretching.",editor:"number-stepper"})],s.prototype,"leftWidth",void 0),e.__decorate([i.Field({type:"number",step:1,min:0,group:"NinePatch",label:"topHeight",description:"Top border height preserved when stretching.",editor:"number-stepper"})],s.prototype,"topHeight",void 0),e.__decorate([i.Field({type:"number",step:1,min:0,group:"NinePatch",label:"rightWidth",description:"Right border width preserved when stretching.",editor:"number-stepper"})],s.prototype,"rightWidth",void 0),e.__decorate([i.Field({type:"number",step:1,min:0,group:"NinePatch",label:"bottomHeight",description:"Bottom border height preserved when stretching.",editor:"number-stepper"})],s.prototype,"bottomHeight",void 0);const h=r.RESOURCE_KEY_SPLIT;let a=class extends r.Renderer{constructor(){super(...arguments),this.name="NinePatch",this.ninePatch={}}static{this.systemName="NinePatch"}init(){this.renderSystem=this.game.getSystem(r.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)}async componentChanged(e){"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)))}async add(e){const i=e.component,r=e.gameObject.id,s=this.increaseAsyncId(r),{type:a,data:c}=await t.resource.getResource(i.resource);if(!this.validateAsyncId(r,s))return;if(!c)return void console.error(`GameObject:${e.gameObject.name}'s NinePatch resource load error`);let d;d=a===t.RESOURCE_TYPE.SPRITE?i.resource+h+i.spriteName:n.Texture.from(c.image);const{leftWidth:p,topHeight:m,rightWidth:g,bottomHeight:u}=i,l=new o.NinePatch(d,p,m,g,u);this.ninePatch[e.gameObject.id]=l,i.ninePatch=l;const b=this.containerManager.getContainer(e.gameObject.id);b?b.addChildAt(l,0):console.error(`GameObject:${e.gameObject.name}'s NinePatch missing display container`)}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}))}};a=e.__decorate([t.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],a);var c=a;exports.NinePatch=s,exports.NinePatchSystem=c;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { Component, OBSERVER_TYPE, resource, RESOURCE_TYPE, decorators } from '@combos-fun/engine';
|
|
3
|
-
import {
|
|
3
|
+
import { Field } from '@combos-fun/inspector-decorator';
|
|
4
4
|
import { Renderer, RendererSystem, RESOURCE_KEY_SPLIT } from '@combos-fun/plugin-renderer';
|
|
5
5
|
import { NinePatch as NinePatch$2 } from '@combos-fun/renderer-adapter';
|
|
6
6
|
import { Texture } from 'pixi.js';
|
|
@@ -28,26 +28,66 @@ let NinePatch$1 = class NinePatch extends Component {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
__decorate([
|
|
31
|
-
|
|
31
|
+
Field({
|
|
32
|
+
type: 'string',
|
|
33
|
+
group: 'NinePatch',
|
|
34
|
+
label: 'resource',
|
|
35
|
+
description: 'Nine-patch image or atlas resource id.',
|
|
36
|
+
editor: 'text',
|
|
37
|
+
})
|
|
32
38
|
], NinePatch$1.prototype, "resource", void 0);
|
|
33
39
|
__decorate([
|
|
34
|
-
|
|
40
|
+
Field({
|
|
41
|
+
type: 'string',
|
|
42
|
+
group: 'NinePatch',
|
|
43
|
+
label: 'spriteName',
|
|
44
|
+
description: 'Optional atlas frame name for the nine-patch source.',
|
|
45
|
+
editor: 'text',
|
|
46
|
+
})
|
|
35
47
|
], NinePatch$1.prototype, "spriteName", void 0);
|
|
36
48
|
__decorate([
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
Field({
|
|
50
|
+
type: 'number',
|
|
51
|
+
step: 1,
|
|
52
|
+
min: 0,
|
|
53
|
+
group: 'NinePatch',
|
|
54
|
+
label: 'leftWidth',
|
|
55
|
+
description: 'Left border width preserved when stretching.',
|
|
56
|
+
editor: 'number-stepper',
|
|
57
|
+
})
|
|
39
58
|
], NinePatch$1.prototype, "leftWidth", void 0);
|
|
40
59
|
__decorate([
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
Field({
|
|
61
|
+
type: 'number',
|
|
62
|
+
step: 1,
|
|
63
|
+
min: 0,
|
|
64
|
+
group: 'NinePatch',
|
|
65
|
+
label: 'topHeight',
|
|
66
|
+
description: 'Top border height preserved when stretching.',
|
|
67
|
+
editor: 'number-stepper',
|
|
68
|
+
})
|
|
43
69
|
], NinePatch$1.prototype, "topHeight", void 0);
|
|
44
70
|
__decorate([
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
Field({
|
|
72
|
+
type: 'number',
|
|
73
|
+
step: 1,
|
|
74
|
+
min: 0,
|
|
75
|
+
group: 'NinePatch',
|
|
76
|
+
label: 'rightWidth',
|
|
77
|
+
description: 'Right border width preserved when stretching.',
|
|
78
|
+
editor: 'number-stepper',
|
|
79
|
+
})
|
|
47
80
|
], NinePatch$1.prototype, "rightWidth", void 0);
|
|
48
81
|
__decorate([
|
|
49
|
-
|
|
50
|
-
|
|
82
|
+
Field({
|
|
83
|
+
type: 'number',
|
|
84
|
+
step: 1,
|
|
85
|
+
min: 0,
|
|
86
|
+
group: 'NinePatch',
|
|
87
|
+
label: 'bottomHeight',
|
|
88
|
+
description: 'Bottom border height preserved when stretching.',
|
|
89
|
+
editor: 'number-stepper',
|
|
90
|
+
})
|
|
51
91
|
], NinePatch$1.prototype, "bottomHeight", void 0);
|
|
52
92
|
|
|
53
93
|
const resourceKeySplit = RESOURCE_KEY_SPLIT;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-renderer-nine-patch.esm.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { type, step } from '@combos-fun/inspector-decorator';\nimport { NinePatch as NinePatchSprite } from \"@combos-fun/renderer-adapter\";\n\nexport interface NinePatchParams {\n resource: string;\n spriteName?: string;\n leftWidth?: number;\n topHeight?: number;\n rightWidth?: number;\n bottomHeight?: number;\n}\n\nexport default class NinePatch extends Component<NinePatchParams> {\n static componentName: string = 'NinePatch';\n ninePatch: NinePatchSprite;\n @type('string') resource: string = '';\n @type('string') spriteName: string = '';\n\n @type('number') @step(1) leftWidth: number = 0;\n @type('number') @step(1) topHeight: number = 0;\n @type('number') @step(1) rightWidth: number = 0;\n @type('number') @step(1) bottomHeight: number = 0;\n init(obj?: NinePatchParams) {\n if (!obj) return;\n this.resource = obj.resource;\n this.spriteName = obj.spriteName;\n this.leftWidth = obj.leftWidth;\n this.topHeight = obj.topHeight;\n this.rightWidth = obj.rightWidth;\n this.bottomHeight = obj.bottomHeight;\n }\n}\n","import { GameObject, decorators, resource, ComponentChanged, RESOURCE_TYPE, OBSERVER_TYPE } from '@combos-fun/engine';\nimport { RendererManager, ContainerManager, RendererSystem, Renderer, RESOURCE_KEY_SPLIT } from '@combos-fun/plugin-renderer';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\nimport NinePatchComponent from './component';\nimport { Texture } from 'pixi.js';\n\nconst resourceKeySplit = RESOURCE_KEY_SPLIT;\n\n@decorators.componentObserver({\n NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight'],\n})\nexport default class NinePatch extends Renderer {\n static systemName: string = 'NinePatch';\n name: string = 'NinePatch';\n ninePatch: { [propName: number]: NinePatchSprite } = {};\n renderSystem: RendererSystem;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n init() {\n this.renderSystem = this.game.getSystem(RendererSystem) as RendererSystem;\n this.renderSystem.rendererManager.register(this);\n }\n rendererUpdate(gameObject: GameObject) {\n const { width, height } = gameObject.transform.size;\n if (this.ninePatch[gameObject.id]) {\n this.ninePatch[gameObject.id].width = width;\n this.ninePatch[gameObject.id].height = height;\n }\n }\n async componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'NinePatch') {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.add(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.remove(changed);\n } else {\n this.remove(changed);\n this.add(changed);\n }\n }\n }\n async add(changed: ComponentChanged) {\n const component = changed.component as NinePatchComponent;\n const gameObjectId = changed.gameObject.id;\n const asyncId = this.increaseAsyncId(gameObjectId);\n const { type, data } = await resource.getResource(component.resource);\n if (!this.validateAsyncId(gameObjectId, asyncId)) return;\n if (!data) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch resource load error`);\n return\n }\n let img: string | Texture;\n if (type === RESOURCE_TYPE.SPRITE) {\n img = component.resource + resourceKeySplit + component.spriteName;\n } else {\n img = Texture.from(data.image as HTMLImageElement);\n }\n const { leftWidth, topHeight, rightWidth, bottomHeight } = component;\n const np = new NinePatchSprite(img, leftWidth, topHeight, rightWidth, bottomHeight);\n\n this.ninePatch[changed.gameObject.id] = np;\n component.ninePatch = np;\n const parent = this.containerManager.getContainer(changed.gameObject.id);\n if (!parent) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch missing display container`);\n return;\n }\n parent.addChildAt(np, 0);\n }\n remove(changed: ComponentChanged) {\n const gameObjectId = changed.gameObject.id;\n this.increaseAsyncId(gameObjectId);\n const sprite = this.ninePatch[gameObjectId];\n if (sprite) {\n this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);\n delete this.ninePatch[changed.gameObject.id];\n sprite.destroy({ children: true });\n }\n }\n}\n"],"names":["NinePatch","NinePatchSprite"],"mappings":";;;;;;;kBAac,MAAO,SAAU,SAAQ,SAA0B,CAAA;AAAjE,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACrB,IAAA,CAAA,UAAU,GAAW,EAAE;QAEd,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,UAAU,GAAW,CAAC;QACtB,IAAA,CAAA,YAAY,GAAW,CAAC;IAUnD;aAlBS,IAAA,CAAA,aAAa,GAAW,WAAX,CAAuB;AAS3C,IAAA,IAAI,CAAC,GAAqB,EAAA;AACxB,QAAA,IAAI,CAAC,GAAG;YAAE;AACV,QAAA,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ;AAC5B,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;AAChC,QAAA,IA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CAAC,UAAU,CAAC,EAAE;AAC1C,QAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QAC3C,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YAC7E,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACpC;IACF;;AAnEmB,SAAS,GAAA,UAAA,CAAA;IAH7B,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC;KAC9F;AACoB,CAAA,EAAA,SAAS,CAoE7B;wBApEoB,SAAS;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin-renderer-nine-patch.esm.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\n\nexport interface NinePatchParams {\n resource: string;\n spriteName?: string;\n leftWidth?: number;\n topHeight?: number;\n rightWidth?: number;\n bottomHeight?: number;\n}\n\nexport default class NinePatch extends Component<NinePatchParams> {\n static componentName: string = 'NinePatch';\n ninePatch: NinePatchSprite;\n\n @Field({\n type: 'string',\n group: 'NinePatch',\n label: 'resource',\n description: 'Nine-patch image or atlas resource id.',\n editor: 'text',\n })\n resource: string = '';\n\n @Field({\n type: 'string',\n group: 'NinePatch',\n label: 'spriteName',\n description: 'Optional atlas frame name for the nine-patch source.',\n editor: 'text',\n })\n spriteName: string = '';\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'leftWidth',\n description: 'Left border width preserved when stretching.',\n editor: 'number-stepper',\n })\n leftWidth: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'topHeight',\n description: 'Top border height preserved when stretching.',\n editor: 'number-stepper',\n })\n topHeight: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'rightWidth',\n description: 'Right border width preserved when stretching.',\n editor: 'number-stepper',\n })\n rightWidth: number = 0;\n\n @Field({\n type: 'number',\n step: 1,\n min: 0,\n group: 'NinePatch',\n label: 'bottomHeight',\n description: 'Bottom border height preserved when stretching.',\n editor: 'number-stepper',\n })\n bottomHeight: number = 0;\n\n init(obj?: NinePatchParams) {\n if (!obj) return;\n this.resource = obj.resource;\n this.spriteName = obj.spriteName;\n this.leftWidth = obj.leftWidth;\n this.topHeight = obj.topHeight;\n this.rightWidth = obj.rightWidth;\n this.bottomHeight = obj.bottomHeight;\n }\n}\n","import { GameObject, decorators, resource, ComponentChanged, RESOURCE_TYPE, OBSERVER_TYPE } from '@combos-fun/engine';\nimport { RendererManager, ContainerManager, RendererSystem, Renderer, RESOURCE_KEY_SPLIT } from '@combos-fun/plugin-renderer';\nimport { NinePatch as NinePatchSprite } from '@combos-fun/renderer-adapter';\nimport NinePatchComponent from './component';\nimport { Texture } from 'pixi.js';\n\nconst resourceKeySplit = RESOURCE_KEY_SPLIT;\n\n@decorators.componentObserver({\n NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight'],\n})\nexport default class NinePatch extends Renderer {\n static systemName: string = 'NinePatch';\n name: string = 'NinePatch';\n ninePatch: { [propName: number]: NinePatchSprite } = {};\n renderSystem: RendererSystem;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n init() {\n this.renderSystem = this.game.getSystem(RendererSystem) as RendererSystem;\n this.renderSystem.rendererManager.register(this);\n }\n rendererUpdate(gameObject: GameObject) {\n const { width, height } = gameObject.transform.size;\n if (this.ninePatch[gameObject.id]) {\n this.ninePatch[gameObject.id].width = width;\n this.ninePatch[gameObject.id].height = height;\n }\n }\n async componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'NinePatch') {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.add(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.remove(changed);\n } else {\n this.remove(changed);\n this.add(changed);\n }\n }\n }\n async add(changed: ComponentChanged) {\n const component = changed.component as NinePatchComponent;\n const gameObjectId = changed.gameObject.id;\n const asyncId = this.increaseAsyncId(gameObjectId);\n const { type, data } = await resource.getResource(component.resource);\n if (!this.validateAsyncId(gameObjectId, asyncId)) return;\n if (!data) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch resource load error`);\n return\n }\n let img: string | Texture;\n if (type === RESOURCE_TYPE.SPRITE) {\n img = component.resource + resourceKeySplit + component.spriteName;\n } else {\n img = Texture.from(data.image as HTMLImageElement);\n }\n const { leftWidth, topHeight, rightWidth, bottomHeight } = component;\n const np = new NinePatchSprite(img, leftWidth, topHeight, rightWidth, bottomHeight);\n\n this.ninePatch[changed.gameObject.id] = np;\n component.ninePatch = np;\n const parent = this.containerManager.getContainer(changed.gameObject.id);\n if (!parent) {\n console.error(`GameObject:${changed.gameObject.name}'s NinePatch missing display container`);\n return;\n }\n parent.addChildAt(np, 0);\n }\n remove(changed: ComponentChanged) {\n const gameObjectId = changed.gameObject.id;\n this.increaseAsyncId(gameObjectId);\n const sprite = this.ninePatch[gameObjectId];\n if (sprite) {\n this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);\n delete this.ninePatch[changed.gameObject.id];\n sprite.destroy({ children: true });\n }\n }\n}\n"],"names":["NinePatch","NinePatchSprite"],"mappings":";;;;;;;kBAac,MAAO,SAAU,SAAQ,SAA0B,CAAA;AAAjE,IAAA,WAAA,GAAA;;QAWE,IAAA,CAAA,QAAQ,GAAW,EAAE;QASrB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,OAAO,CAAC,KAAK,CAAC,CAAA,WAAA,EAAc,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,sCAAA,CAAwC,CAAC;YAC5F;QACF;AACA,QAAA,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1B;AACA,IAAA,MAAM,CAAC,OAAyB,EAAA;AAC9B,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE;AAC1C,QAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QAC3C,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YAC7E,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACpC;IACF;;AAnEmB,SAAS,GAAA,UAAA,CAAA;IAH7B,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC;KAC9F;AACoB,CAAA,EAAA,SAAS,CAoE7B;wBApEoB,SAAS;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-nine-patch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "9-patch (nine-slice) panels",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-nine-patch.esm.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
],
|
|
37
37
|
"author": "sun668 <q947692259@gmail.com>",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"@combos-fun/renderer-adapter": "0.0.
|
|
41
|
-
"@combos-fun/
|
|
42
|
-
"@combos-fun/
|
|
43
|
-
"
|
|
39
|
+
"@combos-fun/plugin-renderer": "0.0.36",
|
|
40
|
+
"@combos-fun/renderer-adapter": "0.0.36",
|
|
41
|
+
"@combos-fun/engine": "0.0.36",
|
|
42
|
+
"@combos-fun/inspector-decorator": "0.0.36",
|
|
43
|
+
"pixi.js": "^8.18.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "node ../../scripts/build-package.mjs"
|