@@ -2329,6 +2329,160 @@ var BlendMode = {
23292329module.exports = BlendMode;
23302330
23312331
2332+ /***/ }),
2333+
2334+ /***/ "../../../src/gameobjects/components/ComputedSize.js":
2335+ /*!*********************************************************************!*\
2336+ !*** D:/wamp/www/phaser/src/gameobjects/components/ComputedSize.js ***!
2337+ \*********************************************************************/
2338+ /*! no static exports found */
2339+ /***/ (function(module, exports) {
2340+
2341+ /**
2342+ * @author Richard Davey <rich@photonstorm.com>
2343+ * @copyright 2019 Photon Storm Ltd.
2344+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
2345+ */
2346+
2347+ /**
2348+ * Provides methods used for calculating and setting the size of a non-Frame based Game Object.
2349+ * Should be applied as a mixin and not used directly.
2350+ *
2351+ * @namespace Phaser.GameObjects.Components.ComputedSize
2352+ * @since 3.0.0
2353+ */
2354+
2355+ var ComputedSize = {
2356+
2357+ /**
2358+ * The native (un-scaled) width of this Game Object.
2359+ *
2360+ * Changing this value will not change the size that the Game Object is rendered in-game.
2361+ * For that you need to either set the scale of the Game Object (`setScale`) or use
2362+ * the `displayWidth` property.
2363+ *
2364+ * @name Phaser.GameObjects.Components.ComputedSize#width
2365+ * @type {number}
2366+ * @since 3.0.0
2367+ */
2368+ width: 0,
2369+
2370+ /**
2371+ * The native (un-scaled) height of this Game Object.
2372+ *
2373+ * Changing this value will not change the size that the Game Object is rendered in-game.
2374+ * For that you need to either set the scale of the Game Object (`setScale`) or use
2375+ * the `displayHeight` property.
2376+ *
2377+ * @name Phaser.GameObjects.Components.ComputedSize#height
2378+ * @type {number}
2379+ * @since 3.0.0
2380+ */
2381+ height: 0,
2382+
2383+ /**
2384+ * The displayed width of this Game Object.
2385+ *
2386+ * This value takes into account the scale factor.
2387+ *
2388+ * Setting this value will adjust the Game Object's scale property.
2389+ *
2390+ * @name Phaser.GameObjects.Components.ComputedSize#displayWidth
2391+ * @type {number}
2392+ * @since 3.0.0
2393+ */
2394+ displayWidth: {
2395+
2396+ get: function ()
2397+ {
2398+ return this.scaleX * this.width;
2399+ },
2400+
2401+ set: function (value)
2402+ {
2403+ this.scaleX = value / this.width;
2404+ }
2405+
2406+ },
2407+
2408+ /**
2409+ * The displayed height of this Game Object.
2410+ *
2411+ * This value takes into account the scale factor.
2412+ *
2413+ * Setting this value will adjust the Game Object's scale property.
2414+ *
2415+ * @name Phaser.GameObjects.Components.ComputedSize#displayHeight
2416+ * @type {number}
2417+ * @since 3.0.0
2418+ */
2419+ displayHeight: {
2420+
2421+ get: function ()
2422+ {
2423+ return this.scaleY * this.height;
2424+ },
2425+
2426+ set: function (value)
2427+ {
2428+ this.scaleY = value / this.height;
2429+ }
2430+
2431+ },
2432+
2433+ /**
2434+ * Sets the internal size of this Game Object, as used for frame or physics body creation.
2435+ *
2436+ * This will not change the size that the Game Object is rendered in-game.
2437+ * For that you need to either set the scale of the Game Object (`setScale`) or call the
2438+ * `setDisplaySize` method, which is the same thing as changing the scale but allows you
2439+ * to do so by giving pixel values.
2440+ *
2441+ * If you have enabled this Game Object for input, changing the size will _not_ change the
2442+ * size of the hit area. To do this you should adjust the `input.hitArea` object directly.
2443+ *
2444+ * @method Phaser.GameObjects.Components.ComputedSize#setSize
2445+ * @since 3.4.0
2446+ *
2447+ * @param {number} width - The width of this Game Object.
2448+ * @param {number} height - The height of this Game Object.
2449+ *
2450+ * @return {this} This Game Object instance.
2451+ */
2452+ setSize: function (width, height)
2453+ {
2454+ this.width = width;
2455+ this.height = height;
2456+
2457+ return this;
2458+ },
2459+
2460+ /**
2461+ * Sets the display size of this Game Object.
2462+ *
2463+ * Calling this will adjust the scale.
2464+ *
2465+ * @method Phaser.GameObjects.Components.ComputedSize#setDisplaySize
2466+ * @since 3.4.0
2467+ *
2468+ * @param {number} width - The width of this Game Object.
2469+ * @param {number} height - The height of this Game Object.
2470+ *
2471+ * @return {this} This Game Object instance.
2472+ */
2473+ setDisplaySize: function (width, height)
2474+ {
2475+ this.displayWidth = width;
2476+ this.displayHeight = height;
2477+
2478+ return this;
2479+ }
2480+
2481+ };
2482+
2483+ module.exports = ComputedSize;
2484+
2485+
23322486/***/ }),
23332487
23342488/***/ "../../../src/gameobjects/components/Depth.js":
@@ -11536,7 +11690,7 @@ var SpinePlugin = new Class({
1153611690 this.debugRenderer;
1153711691 this.debugShader;
1153811692
11539- console.log('SpinePlugin created. WebGL:', this.isWebGL);
11693+ console.log('SpinePlugin created', '- WebGL:', this.isWebGL, this.cache, this.spineTextures );
1154011694
1154111695 if (this.isWebGL)
1154211696 {
@@ -11570,6 +11724,11 @@ var SpinePlugin = new Class({
1157011724 {
1157111725 this.bootCanvas();
1157211726 }
11727+
11728+ var eventEmitter = this.systems.events;
11729+
11730+ eventEmitter.once('shutdown', this.shutdown, this);
11731+ eventEmitter.once('destroy', this.destroy, this);
1157311732 },
1157411733
1157511734 bootCanvas: function ()
@@ -11777,10 +11936,7 @@ var SpinePlugin = new Class({
1177711936 {
1177811937 var eventEmitter = this.systems.events;
1177911938
11780- eventEmitter.off('update', this.update, this);
1178111939 eventEmitter.off('shutdown', this.shutdown, this);
11782-
11783- this.removeAll();
1178411940 },
1178511941
1178611942 /**
@@ -11795,10 +11951,25 @@ var SpinePlugin = new Class({
1179511951 {
1179611952 this.shutdown();
1179711953
11954+ this.pluginManager.removeGameObject('spine', true, true);
11955+
1179811956 this.pluginManager = null;
1179911957 this.game = null;
1180011958 this.scene = null;
1180111959 this.systems = null;
11960+
11961+ // Create a custom cache to store the spine data (.atlas files)
11962+ this.cache = null;
11963+ this.spineTextures = null;
11964+ this.json = null;
11965+ this.textures = null;
11966+ this.skeletonRenderer = null;
11967+ this.gl = null;
11968+ this.mvp = null;
11969+ this.shader = null;
11970+ this.batcher = null;
11971+ this.debugRenderer = null;
11972+ this.debugShader = null;
1180211973 }
1180311974
1180411975});
@@ -11824,6 +11995,7 @@ module.exports = SpinePlugin;
1182411995var Class = __webpack_require__(/*! ../../../../src/utils/Class */ "../../../src/utils/Class.js");
1182511996var ComponentsAlpha = __webpack_require__(/*! ../../../../src/gameobjects/components/Alpha */ "../../../src/gameobjects/components/Alpha.js");
1182611997var ComponentsBlendMode = __webpack_require__(/*! ../../../../src/gameobjects/components/BlendMode */ "../../../src/gameobjects/components/BlendMode.js");
11998+ var ComponentsComputedSize = __webpack_require__(/*! ../../../../src/gameobjects/components/ComputedSize */ "../../../src/gameobjects/components/ComputedSize.js");
1182711999var ComponentsDepth = __webpack_require__(/*! ../../../../src/gameobjects/components/Depth */ "../../../src/gameobjects/components/Depth.js");
1182812000var ComponentsFlip = __webpack_require__(/*! ../../../../src/gameobjects/components/Flip */ "../../../src/gameobjects/components/Flip.js");
1182912001var ComponentsScrollFactor = __webpack_require__(/*! ../../../../src/gameobjects/components/ScrollFactor */ "../../../src/gameobjects/components/ScrollFactor.js");
@@ -11850,6 +12022,7 @@ var SpineGameObject = new Class({
1185012022 Mixins: [
1185112023 ComponentsAlpha,
1185212024 ComponentsBlendMode,
12025+ ComponentsComputedSize,
1185312026 ComponentsDepth,
1185412027 ComponentsFlip,
1185512028 ComponentsScrollFactor,
@@ -11877,6 +12050,9 @@ var SpineGameObject = new Class({
1187712050
1187812051 this.timeScale = 1;
1187912052
12053+ this.displayOriginX = 0;
12054+ this.displayOriginY = 0;
12055+
1188012056 this.setPosition(x, y);
1188112057
1188212058 if (key)
@@ -11953,6 +12129,15 @@ var SpineGameObject = new Class({
1195312129
1195412130 this.root = this.getRootBone();
1195512131
12132+ var w = this.skeletonData.width;
12133+ var h = this.skeletonData.height;
12134+
12135+ this.width = w;
12136+ this.height = h;
12137+
12138+ this.displayOriginX = w / 2;
12139+ this.displayOriginY = h / 2;
12140+
1195612141 return this;
1195712142 },
1195812143
0 commit comments