EquipQHAttrItem.ts 901 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * 装备强化属性变化
  3. */
  4. const {ccclass, property} = cc._decorator;
  5. @ccclass
  6. export default class EquipQHAttrItem extends cc.Component {
  7. @property(cc.Label)
  8. mAttrName: cc.Label = null;
  9. @property(cc.Sprite)
  10. mAttrIcon: cc.Sprite = null;
  11. @property([cc.SpriteFrame])
  12. mAttrIcons: Array<cc.SpriteFrame> = [];
  13. @property(cc.Label)
  14. mAttrV1: cc.Label = null;
  15. @property(cc.Label)
  16. mAttrV2: cc.Label = null;
  17. /**
  18. * 设置属性
  19. * @param type 0:攻;1:防;2:血;3:速;
  20. * @param v1
  21. * @param v2
  22. */
  23. public setAttr(type:number,v1,v2){
  24. let attrNames = ['攻击力','防御','气血','敏捷']
  25. this.mAttrName.string = attrNames[type]
  26. this.mAttrIcon.spriteFrame = this.mAttrIcons[type]
  27. this.mAttrV1.string = ''+v1
  28. this.mAttrV2.string = ''+v2
  29. }
  30. }