JobLevelUpSuccess .js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. this.confirmNode.on(cc.Node.EventType.TOUCH_END, () => {
  14. this.close();
  15. });
  16. },
  17. show(parent, title, subTitle, level, levelName, callBack) {
  18. this.callBack = callBack;
  19. this.titleText.string = this.outlineString(title, '#ffffff');
  20. this.subTitleLabel.string = subTitle;
  21. this.levelNumAfterText.string = this.outlineString(level, '#584A47');
  22. this.levelNameAfterText.string = this.outlineString(levelName, '#ffffff');
  23. this.node.parent = parent;
  24. this.content.scaleX = 0;
  25. this.content.scaleY = 0;
  26. this.content.runAction(cc.scaleTo(0.35, 1, 1).easing(cc.easeBackOut()));
  27. },
  28. close() {
  29. let cb = this.callback
  30. let finish = cc.callFunc(() => {
  31. cb && cb();
  32. this.node.destroy();
  33. }, this);
  34. let sq = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish)
  35. this.content.runAction(sq);
  36. },
  37. outlineString(text, color) {
  38. return '<outline color=' + color + ' width=2><b>' + text + '</b></outline>';
  39. },
  40. onDestory() {
  41. this.confirmNode.off(cc.Node.EventType.TOUCH_END, this);
  42. }
  43. });