var wechat = require('../net/WeChat'); var Api = require('../net/Api'); const ShareAction = require('../utils/ShareAction'); cc.Class({ extends: cc.Component, properties: { transparentBg: cc.Node, view: cc.Node, bg: cc.Node, titleLabel: cc.Label, closeNode: cc.Node, messageLabel: cc.Label, picSprite: cc.Sprite, button: cc.Node, buttonText: cc.RichText, }, // LIFE-CYCLE CALLBACKS: onLoad() { // this.transparentBg.on(cc.Node.EventType.TOUCH_START, () => { // this.dissmiss(); // }, this); this.closeNode.on(cc.Node.EventType.TOUCH_END, () => { this.dissmiss(); }, this); this.button.on(cc.Node.EventType.TOUCH_END, () => { wechat.inviteFriend(this.shareAction); this.node.destroy(); }, this); Api.createImageFromUrl('http://img.mp.itc.cn/upload/20160524/522ac3b5f4a04d97b9265099adb0ba79_th.jpg', (spriteFrame) => { this.picSprite.spriteFrame = spriteFrame; }); }, start() { this.view.scaleX = 0; this.view.scaleY = 0; this.view.runAction(cc.scaleTo(0.35, 1, 1).easing(cc.easeBackOut())); }, dissmiss() { let finish = cc.callFunc(() => { this.node.destroy(); }, this); let sq = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish) this.view.runAction(sq); }, showTalent() { this.shareAction = ShareAction.BECOME_ARTIST; this.titleLabel.string = '派出星探'; this.messageLabel.string = '派出你的星探,为你免费寻找艺人。'; this.buttonText.string = '派出'; }, showInviteFriend() { this.shareAction = ShareAction.ADD_FRIEND; this.titleLabel.string = '添加好友'; this.messageLabel.string = '发送微信链接给你的微信好友即可添加为游戏好友。'; this.buttonText.string = '邀请'; }, });