12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- var wechat = require('../net/WeChat');
- var Api = require('../net/Api');
- 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();
- // if (this.callback != undefined) {
- // this.callback();
- // }
- 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.titleLabel.string = '派出星探';
- this.messageLabel.string = '派出你的星探,为你免费寻找艺人。';
- this.buttonText.string = '<outline color=#55000000><b>派出</b></outline>';
- },
- showInviteFriend() {
- this.titleLabel.string = '添加好友';
- this.messageLabel.string = '发送微信链接给你的微信好友即可添加为游戏好友。';
- this.buttonText.string = '<outline color=#55000000><b>邀请</b></outline>';
- },
- });
|