JobLevelUpSuccess.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. content: cc.Node,
  5. // titleText: cc.RichText,
  6. // subTitleLabel: cc.Label,
  7. levelNumAfterText: cc.RichText,
  8. levelNameAfterText: cc.RichText,
  9. confirmNode: cc.Node,
  10. confirmText: cc.Node,
  11. },
  12. onLoad() {
  13. let self = this;
  14. this.confirmNode.on(cc.Node.EventType.TOUCH_END, () => {
  15. self.close();
  16. });
  17. },
  18. show(parent, title, subTitle, level, levelName, callback) {
  19. this.callback = callback;
  20. // this.titleText.string = this.outlineString(title, '#ffffff');
  21. // this.subTitleLabel.string = subTitle;
  22. this.levelNumAfterText.string = this.outlineString(level, '#584A47');
  23. this.levelNameAfterText.string = this.outlineString(levelName, '#ffffff');
  24. this.node.parent = parent;
  25. this.content.scaleX = 0;
  26. this.content.scaleY = 0;
  27. this.content.runAction(cc.scaleTo(0.35, 1, 1).easing(cc.easeBackOut()));
  28. },
  29. close() {
  30. let cb = this.callback
  31. let finish = cc.callFunc(() => {
  32. cb && cb();
  33. this.node.destroy();
  34. }, this);
  35. let sq = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish)
  36. this.content.runAction(sq);
  37. },
  38. outlineString(text, color) {
  39. return '<outline color=' + color + ' width=2><b>' + text + '</b></outline>';
  40. },
  41. onDestory() {
  42. this.confirmNode.off(cc.Node.EventType.TOUCH_END, this);
  43. }
  44. });