我智商爆棚
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.2 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import Common5 from "../../Platform/th/Common5";
const { ccclass, property } = cc._decorator;
@ccclass
export default class HeadIconScipt extends cc.Component {
@property(cc.Label)
labelName: cc.Label = null;
@property(cc.Node)
iconNode: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
onLoad() { }
start() {
}
setHeadIconData(HeadData) {
this.refreshView(HeadData)
}
refreshView(HeadData) {
let labName = this.node.getChildByName('labName')
labName.getComponent(cc.Label).string = HeadData.name
labName.getComponent(cc.Label).fontSize = 30
let icon = this.node.getChildByName('icon');
icon['roleName'] = HeadData.name;
Common5.getSpriteFrameFromBundle(HeadData.bandleName, HeadData.url, icon.getComponent(cc.Sprite));
}
// update (dt) {}
}