"use strict";
cc._RF.push(module, '9cdb2ehEPlBNp8P6T2+hlEi', 'item');
// scripts/item.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {
        rankSp: cc.Sprite,
        selfSp: cc.Sprite,
        indexLb: cc.Label,
        headSp: cc.Sprite,
        nameLb: cc.Label,
        rankLb: cc.Label
    },

    start: function start() {},
    updateInfo: function updateInfo(data) {
        this.rankSp.node.active = !data.isSelf;
        this.selfSp.node.active = data.isSelf;

        this.nameLb.string = data.nickname;

        this.indexLb.string = data.index + "";

        this.rankLb.string = data.rankNum + "米";

        var target = this;
        // set avatar
        if (data.avatarUrl.length > 0) {
            cc.loader.load({ url: data.avatarUrl, type: 'png' }, function (err, texture) {
                if (err) console.error(err);
                target.headSp.spriteFrame = new cc.SpriteFrame(texture);
            });
        } else {
            cc.loader.loadRes("default", cc.SpriteFrame, function (err, spriteFrame) {
                target.headSp.spriteFrame = spriteFrame;
            });
        }
    }
});

cc._RF.pop();