JobPageFail.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. content: cc.Node,
  5. messageText: cc.RichText,
  6. confirmNode: cc.Node,
  7. },
  8. onLoad() {
  9. this.confirmNode.on(cc.Node.EventType.TOUCH_END, () => {
  10. this.close();
  11. });
  12. },
  13. show(parent, text, callback) {
  14. this.callback = callback;
  15. this.node.parent = parent;
  16. this.content.scaleX = 0;
  17. this.content.scaleY = 0;
  18. this.content.runAction(cc.scaleTo(0.35, 1, 1).easing(cc.easeBackOut()));
  19. this.messageText.string = text;
  20. },
  21. close() {
  22. let cb = this.callback
  23. let finish = cc.callFunc(() => {
  24. cb && cb();
  25. this.node.destroy();
  26. }, this);
  27. let sq = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish)
  28. this.content.runAction(sq);
  29. },
  30. outlineString(text, color) {
  31. return '<outline color=' + color + ' width=2><b>' + text + '</b></outline>';
  32. },
  33. onDestory() {
  34. this.confirmNode.off(cc.Node.EventType.TOUCH_END, this);
  35. }
  36. });