123456789101112131415161718192021222324252627 |
- const Api = require('../net/Api');
- var DWTool = require('../utils/DWTool');
- cc.Class({
- extends: cc.Component,
- properties: {
- avatarSprite: cc.Sprite,
- genderSprite: cc.Sprite,
- nickLabel: cc.Label,
- starCountLabel: cc.Label,
- },
- bind(user) {
- Api.createImageFromUrl(user.head, (spriteFrame) => {
- this.avatarSprite.spriteFrame = spriteFrame;
- });
- DWTool.setGenderIcon(user.gender).then(spriteFrame => {
- this.genderSprite.spriteFrame = spriteFrame;
- });
- this.nickLabel.string = user.nick;
- this.starCountLabel.string = user.stars;
- },
- });
|