12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- cc.Class({
- extends: cc.Component,
- properties: {
- content: cc.Node,
- titleText: cc.RichText,
- subTitleLabel: cc.Label,
- levelNumAfterText: cc.RichText,
- levelNameAfterText: cc.RichText,
- confirmNode: cc.Node,
- confirmText: cc.Node,
- },
- onLoad() {
- this.confirmNode.on(cc.Node.EventType.TOUCH_END, () => {
- this.close();
- });
- },
- show(parent, title, subTitle, level, levelName, callBack) {
- this.callBack = callBack;
- this.titleText.string = this.outlineString(title, '#ffffff');
- this.subTitleLabel.string = subTitle;
- this.levelNumAfterText.string = this.outlineString(level, '#584A47');
- this.levelNameAfterText.string = this.outlineString(levelName, '#ffffff');
- 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 '<outline color=' + color + ' width=2><b>' + text + '</b></outline>';
- },
- onDestory() {
- this.confirmNode.off(cc.Node.EventType.TOUCH_END, this);
- }
- });
|