cc.Class({ extends: cc.Component, properties: { content: cc.Node, // titleText: cc.RichText, // subTitleLabel: cc.Label, levelBg: cc.Sprite, levelNumAfterText: cc.RichText, levelNameAfterText: cc.RichText, confirmNode: cc.Node, confirmText: cc.Node, levelBgFrame: [cc.SpriteFrame], }, onLoad() { let self = this; this.confirmNode.on(cc.Node.EventType.TOUCH_END, () => { self.close(); }); }, show(parent, title, subTitle, level, levelName, callback) { this.callback = callback; // this.titleText.string = this.outlineString(title, '#ffffff'); // this.subTitleLabel.string = subTitle; this.levelBg.spriteFrame = this.levelBgFrame[level - 1]; // this.levelNumAfterText.string = this.outlineString(level, '#584A47'); this.levelNameAfterText.string = this.outlineString(levelName, '#787878'); this.node.parent = parent; this.content.scaleX = 0; this.content.scaleY = 0; this.content.runAction(cc.scaleTo(0.35, 1, 1).easing(cc.easeBackOut())); }, close() { let cb = this.callback let finish = cc.callFunc(() => { cb && cb(); this.node.destroy(); }, this); let sq = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish) this.content.runAction(sq); }, outlineString(text, color) { return '' + text + ''; }, onDestory() { this.confirmNode.off(cc.Node.EventType.TOUCH_END, this); } });