LBItem.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. var Global = require("Global");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. normalBG: cc.Node,
  6. normalAni: sp.Skeleton,
  7. aniNode: cc.Node,
  8. _value: -1,
  9. _lineCount: 0,
  10. _bSpecial: false,
  11. },
  12. // LIFE-CYCLE CALLBACKS:
  13. // onLoad () {},
  14. setValue (_val, spineData, _bSpe) {
  15. this._value = _val;
  16. this._bSpecial = _bSpe;
  17. this.normalAni.skeletonData = spineData;
  18. this.showNormal();
  19. },
  20. resetCount() {
  21. this._lineCount = 0;
  22. this.showNormal();
  23. },
  24. addCount() {
  25. this._lineCount++;
  26. },
  27. setCount(_val) {
  28. this._lineCount = _val;
  29. },
  30. getCount() {
  31. return this._lineCount;
  32. },
  33. showNormal() {
  34. this.normalBG.stopAllActions();
  35. this.aniNode.active = false;
  36. this.normalAni.clearTracks();
  37. this.normalAni.setAnimation(0, "a1", false);
  38. },
  39. showLightAni() {
  40. if(this._lineCount <= 0) {
  41. this.showNormal();
  42. return;
  43. }
  44. this.aniNode.active = true;
  45. this.normalBG.stopAllActions();
  46. this.normalAni.clearTracks();
  47. this.normalAni.setAnimation(0, "a2", false);
  48. },
  49. showLightAniNoScale() {
  50. if(this._lineCount <= 0) {
  51. this.showNormal();
  52. return;
  53. }
  54. this.aniNode.active = true;
  55. this.normalBG.stopAllActions();
  56. },
  57. showSpecialAni() {
  58. if(!this._bSpecial) {
  59. return;
  60. }
  61. this.normalBG.stopAllActions();
  62. this.normalAni.clearTracks();
  63. this.normalAni.setAnimation(0, "a2", false);
  64. },
  65. // update (dt) {},
  66. });