@safe-engine/cocos 1.0.6 → 1.1.0

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.
@@ -21,9 +21,8 @@ interface DragonBonesProps {
21
21
  name: string;
22
22
  }) => void;
23
23
  }
24
- export declare class DragonBones extends ComponentX<DragonBonesProps> {
25
- setAnimation(name: string, loop?: boolean): void;
26
- setSkeletonData(data: string): void;
24
+ export declare class DragonBonesComp extends ComponentX<DragonBonesProps> {
25
+ setAnimation(name: string, playTimes?: number): void;
27
26
  }
28
27
  export declare class DragonBonesSystem implements System {
29
28
  configure(event_manager: EventManager): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragonbones/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,MAAM,EACP,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,UAAU,gBAAgB;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACzD;A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Aa,eAAgB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC/D,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAI;CAgBzC;AAED,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,SAAS,CAAC,aAAa,EAAE,YAAY;IAMrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAkDzC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAKjE;AAED,wBAAgB,gBAAgB,SAI/B"}
@@ -15,47 +15,42 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DragonBonesSystem = exports.DragonBones = void 0;
18
+ exports.DragonBonesSystem = exports.DragonBonesComp = void 0;
19
19
  exports.setupDragonBones = setupDragonBones;
20
20
  var entityx_ts_1 = require("entityx-ts");
21
21
  var gworld_1 = require("../gworld");
22
22
  var NodeComp_1 = require("../gworld/components/NodeComp");
23
23
  var decorator_1 = require("../gworld/core/decorator");
24
24
  var CocosFactory_1 = require("./cocos/CocosFactory");
25
- var DragonBones = /** @class */ (function (_super) {
26
- __extends(DragonBones, _super);
27
- function DragonBones() {
25
+ var DragonBonesComp = /** @class */ (function (_super) {
26
+ __extends(DragonBonesComp, _super);
27
+ function DragonBonesComp() {
28
28
  return _super !== null && _super.apply(this, arguments) || this;
29
29
  }
30
- DragonBones.prototype.setAnimation = function (name, loop) {
31
- if (loop === void 0) { loop = false; }
30
+ DragonBonesComp.prototype.setAnimation = function (name, playTimes) {
31
+ if (playTimes === void 0) { playTimes = 0; }
32
32
  var skel = this.node.instance;
33
- if (skel.setAnimation) {
34
- skel.setAnimation(0, name, loop);
33
+ if (skel.armature) {
34
+ skel.armature.animation.gotoAndPlayByTime(name, 0, playTimes);
35
35
  }
36
36
  };
37
- DragonBones.prototype.setSkeletonData = function (data) {
38
- var skel = this.node.instance;
39
- var atlas = data.replace('.json', '.atlas');
40
- skel.initWithArgs(data, atlas, this.node.scale);
41
- };
42
- return DragonBones;
37
+ return DragonBonesComp;
43
38
  }(decorator_1.ComponentX));
44
- exports.DragonBones = DragonBones;
39
+ exports.DragonBonesComp = DragonBonesComp;
45
40
  var DragonBonesSystem = /** @class */ (function () {
46
41
  function DragonBonesSystem() {
47
42
  }
48
43
  DragonBonesSystem.prototype.configure = function (event_manager) {
49
- event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(DragonBones), this);
50
- event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(DragonBones), this);
44
+ event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(DragonBonesComp), this);
45
+ event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(DragonBonesComp), this);
51
46
  CocosFactory_1.CocosFactory.newInstance();
52
47
  };
53
48
  DragonBonesSystem.prototype.receive = function (type, event) {
54
49
  switch (type) {
55
- case (0, entityx_ts_1.ComponentAddedEvent)(DragonBones): {
56
- console.log('DragonBones', event);
50
+ case (0, entityx_ts_1.ComponentAddedEvent)(DragonBonesComp): {
51
+ console.log('DragonBonesComp', event);
57
52
  var ett = event.entity;
58
- var dbComp = event.entity.getComponent(DragonBones);
53
+ var dbComp = event.entity.getComponent(DragonBonesComp);
59
54
  var _a = dbComp.props, data = _a.data, animation = _a.animation, _b = _a.playTimes, playTimes = _b === void 0 ? 0 : _b;
60
55
  // const texturePath = atlas.replace('.json', '.png')
61
56
  var atlas = data.atlas, skeleton = data.skeleton, texture = data.texture;
@@ -84,7 +79,7 @@ var DragonBonesSystem = /** @class */ (function () {
84
79
  dbComp.node = ett.assign(new NodeComp_1.NodeComp(node, ett));
85
80
  break;
86
81
  }
87
- case (0, entityx_ts_1.ComponentRemovedEvent)(DragonBones): {
82
+ case (0, entityx_ts_1.ComponentRemovedEvent)(DragonBonesComp): {
88
83
  // const { component } = event
89
84
  break;
90
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safe-engine/cocos",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "safe-engine with cocos renderer support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",