LevelHomeSpeedUpTip.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. nameLabel: cc.Label,
  5. contentLabel: cc.Label,
  6. typeLabel: cc.Label,
  7. },
  8. // onLoad () {},
  9. show(name, type) {
  10. if (!this.node.active) {
  11. this.node.active = true;
  12. this.node.runAction(cc.moveBy(0.3, this.node.width, 0));
  13. if (this.timer) {
  14. clearInterval(this.timer);
  15. }
  16. this.timer = setInterval(() => {
  17. this.close();
  18. }, 4000);
  19. }
  20. this.nameLabel.string = name;
  21. if (type == 1) {
  22. this.contentLabel.string = '金币产出'
  23. this.typeLabel.string = 'x2';
  24. } else {
  25. this.contentLabel.string = '产出时间'
  26. this.typeLabel.string = '-50%';
  27. }
  28. },
  29. close() {
  30. if (this.timer) {
  31. clearInterval(this.timer);
  32. }
  33. let finish = cc.callFunc(() => {
  34. this.node.active = false;
  35. });
  36. this.node.runAction(cc.sequence(cc.moveBy(0.3, -this.node.width, 0), finish));
  37. },
  38. });