12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- const WeChat = require('../net/WeChat');
- const AlertManager = require('../utils/AlertManager');
- const GameModule = require("../utils/GameModule");
- const { GameNotificationKey, WechatShareType } = require('../utils/GameEnum');
- const InviteApi = require('../net/InviteApi');
- cc.Class({
- extends: cc.Component,
- properties: {
- itemPrefab: cc.Prefab,
- listScrollViewNode: cc.ScrollView,
- shareButtonNode: cc.Node
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- },
- start () {
- let scaleAction1 = cc.scaleTo(0.6, 1.1, 1.1);
- let scaleAction2 = cc.scaleTo(0.6, 0.8, 0.8);
- let seq = cc.repeatForever(cc.sequence(scaleAction1, scaleAction2));
- this.shareButtonNode.runAction(seq);
- this.getNetworkData();
- },
- getNetworkData() {
- InviteApi.getFriendRewardList((responseData) => {
- this.configData(responseData);
- }, (error) => {
- console.log('mission error' + error);
- });
- },
- configData(responseData) {
- this.list = responseData.list;
- for (var i = 0; i < this.list.length; i++) {
- let model = this.list[i];
- let item = cc.instantiate(this.itemPrefab);
- item = item.getComponent('FriendHelpItem');
- item.node.width = this.listScrollViewNode.node._contentSize.width;
- item.node.parent = this.listScrollViewNode.content;
- item.configData(model);
- }
- },
- closeNode() {
- GameModule.audioMng.playClickButton();
- this.node.destroy();
- },
- inviteFriend() {
- GameModule.audioMng.playClickButton();
- WeChat.shareAction(WechatShareType.InviteFriend, () => {
- }, () => {
- console.log('分享失败或取消');
- });
- },
- // update (dt) {},
- });
|