@eva/plugin-renderer-spine 1.2.2-alpha.3 → 1.2.2-alpha.4

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.
@@ -184,6 +184,23 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
184
184
  }
185
185
  }
186
186
 
187
+ function __values(o) {
188
+ var s = typeof Symbol === "function" && Symbol.iterator,
189
+ m = s && o[s],
190
+ i = 0;
191
+ if (m) return m.call(o);
192
+ if (o && typeof o.length === "number") return {
193
+ next: function next() {
194
+ if (o && i >= o.length) o = void 0;
195
+ return {
196
+ value: o && o[i++],
197
+ done: !o
198
+ };
199
+ }
200
+ };
201
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
202
+ }
203
+
187
204
  function getIDEPropsPropertyObj(target, propertyKey) {
188
205
  if (!target.constructor.IDEProps) {
189
206
  target.constructor.IDEProps = {};
@@ -214,17 +231,59 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
214
231
  _this.resource = '';
215
232
  _this.animationName = '';
216
233
  _this.autoPlay = true;
234
+ _this.waitExecuteInfos = [];
217
235
  return _this;
218
236
  }
219
237
 
238
+ Object.defineProperty(Spine.prototype, "armature", {
239
+ get: function get() {
240
+ return this._armature;
241
+ },
242
+ set: function set(val) {
243
+ var e_1, _a;
244
+
245
+ this._armature = val;
246
+ if (!val) return;
247
+
248
+ if (this.autoPlay) {
249
+ this.play(this.animationName);
250
+ }
251
+
252
+ try {
253
+ for (var _b = __values(this.waitExecuteInfos), _c = _b.next(); !_c.done; _c = _b.next()) {
254
+ var info = _c.value;
255
+
256
+ if (info.playType) {
257
+ var name_1 = info.name,
258
+ loop = info.loop,
259
+ track = info.track;
260
+ this.play(name_1, loop, track);
261
+ } else {
262
+ this.stop(info.track);
263
+ }
264
+ }
265
+ } catch (e_1_1) {
266
+ e_1 = {
267
+ error: e_1_1
268
+ };
269
+ } finally {
270
+ try {
271
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
272
+ } finally {
273
+ if (e_1) throw e_1.error;
274
+ }
275
+ }
276
+
277
+ this.waitExecuteInfos = [];
278
+ },
279
+ enumerable: false,
280
+ configurable: true
281
+ });
282
+
220
283
  Spine.prototype.init = function (obj) {
221
284
  if (!obj) return;
222
285
 
223
286
  _extends(this, obj);
224
-
225
- if (this.autoPlay) {
226
- this.play(this.animationName);
227
- }
228
287
  };
229
288
 
230
289
  Spine.prototype.onDestroy = function () {
@@ -235,7 +294,14 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
235
294
  try {
236
295
  if (name) this.animationName = name;
237
296
 
238
- if (!this.armature) {} else {
297
+ if (!this.armature) {
298
+ this.waitExecuteInfos.push({
299
+ playType: true,
300
+ name: name,
301
+ loop: loop,
302
+ track: track
303
+ });
304
+ } else {
239
305
  if (track === undefined) {
240
306
  track = 0;
241
307
  }
@@ -249,6 +315,10 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
249
315
 
250
316
  Spine.prototype.stop = function (track) {
251
317
  if (!this.armature) {
318
+ this.waitExecuteInfos.push({
319
+ playType: false,
320
+ track: track
321
+ });
252
322
  return;
253
323
  }
254
324
 
@@ -596,15 +666,6 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
596
666
  armature.update();
597
667
  armature.updateTransform();
598
668
  component.armature = armature;
599
-
600
- if (component.autoPlay) {
601
- try {
602
- armature.state.setAnimation(0, component.animationName, true);
603
- } catch (e) {
604
- console.log(e);
605
- }
606
- }
607
-
608
669
  component.emit('loaded', {
609
670
  resource: component.resource
610
671
  });