CardAttrItem.ts 534 B

123456789101112131415161718192021222324252627
  1. import i18n from "../../../../i18n/i18n";
  2. /**
  3. * 神卡属性
  4. */
  5. const {ccclass, property} = cc._decorator;
  6. @ccclass
  7. export default class CardAttrItem extends cc.Component {
  8. @property(cc.Label)
  9. mName: cc.Label = null;
  10. @property(cc.Label)
  11. mValue1: cc.Label = null;
  12. public init(name:string,v1:number,v2:number){
  13. this.mName.string = i18n.t(name)
  14. let str = '+'+v1
  15. if(v2 > 0){
  16. str += '(+'+v2+')'
  17. }
  18. this.mValue1.string = str
  19. }
  20. }