/** * 装备强化属性变化 */ const {ccclass, property} = cc._decorator; @ccclass export default class EquipQHAttrItem extends cc.Component { @property(cc.Label) mAttrName: cc.Label = null; @property(cc.Sprite) mAttrIcon: cc.Sprite = null; @property([cc.SpriteFrame]) mAttrIcons: Array = []; @property(cc.Label) mAttrV1: cc.Label = null; @property(cc.Label) mAttrV2: cc.Label = null; /** * 设置属性 * @param type 0:攻;1:防;2:血;3:速; * @param v1 * @param v2 */ public setAttr(type:number,v1,v2){ let attrNames = ['攻击力','防御','气血','敏捷'] this.mAttrName.string = attrNames[type] this.mAttrIcon.spriteFrame = this.mAttrIcons[type] this.mAttrV1.string = ''+v1 this.mAttrV2.string = ''+v2 } }