TalentPage.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
  2. const JobPageType = require('../utils/GameEnum').JobPageType;
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. alert: cc.Node,
  7. talentSprite: cc.Node,
  8. },
  9. onLoad() {
  10. this.alert.on(cc.Node.EventType.TOUCH_END, () => {
  11. this.toTalent();
  12. }, this)
  13. this.talentSprite.on(cc.Node.EventType.TOUCH_END, () => {
  14. this.toTalent();
  15. }, this)
  16. },
  17. start() {
  18. },
  19. show() {
  20. this.node.parent = cc.find('Canvas');
  21. this.node.active = true;
  22. this.talentSprite.x = -471;
  23. this.alert.opacity = 0;
  24. let animEnd = cc.callFunc(() => {
  25. this.alert.runAction(cc.fadeIn(0.5));
  26. }, this);
  27. this.talentSprite.runAction(cc.sequence(cc.moveBy(0.3, 300, 0).easing(cc.easeBackOut()), animEnd));
  28. },
  29. toTalent() {
  30. let animEnd = cc.callFunc(() => {
  31. GameEvent.fire(GameNotificationKey.ShowJobPageFromTalent, JobPageType.ChooseJob);
  32. this.close();
  33. }, this);
  34. this.alert.opacity = 0;
  35. this.talentSprite.runAction(cc.sequence(cc.moveBy(0.4, -471, 0).easing(cc.easeBackOut()), animEnd));
  36. },
  37. close() {
  38. this.node.active = false;
  39. }
  40. // update (dt) {},
  41. });