(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/scripts/item.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '9cdb2ehEPlBNp8P6T2+hlEi', 'item', __filename);
// 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();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=item.js.map
        