1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- const Api = require('../net/Api');
- const ShareAction = require('../utils/ShareAction');
- cc.Class({
- extends: cc.Component,
- properties: {
- inviteNode: cc.Node,
- avatarNode: cc.Node,
- avatarSprite: cc.Sprite,
- hasUser: {
- get: function () {
- if (!this._hasUser) {
- this._hasUser = false;
- }
- return this._hasUser;
- },
- set: function (value) {
- this._hasUser = value;
- if (this._hasUser) {
- this.inviteNode.active = false;
- this.avatarNode.active = true;
- } else {
- this.inviteNode.active = true;
- this.avatarNode.active = false;
- }
- }
- },
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad() {
- },
- start() {
- },
- onDisable() {
- this.hasUser = false;
- },
- configData(userData) {
- this.hasUser = true;
- // if (userData.head) {
- Api.createImageFromUrl(userData.head, (spriteFrame) => {
- this.avatarSprite.spriteFrame = spriteFrame;
- });
- // } else {
- // this.avatarSprite.spriteFrame = null;
- // }
- },
- // update (dt) {},
- });
|