import { getSkinPath } from "../utils";

/**
 * 单条收支记录
 */
export default class DogItem extends eui.Component {


    public dogGroup:eui.Group;
    public dog_lv_1:eui.Image;
    public dog_lv_2:eui.Image;
    public dog_lv_3:eui.Image;
    public dog_lv_4:eui.Image;
    public dog_lv_5:eui.Image;
    public dog_lv_6:eui.Image;
    public dog_lv_7:eui.Image;
    public dog_lv_8:eui.Image;
    public dog_lv_9:eui.Image;
    public dog_lv_10:eui.Image;
    public dog_lv_11:eui.Image;
    public dog_lv_12:eui.Image;
    public dog_lv_13:eui.Image;
    public dog_lv_14:eui.Image;
    public dog_lv_15:eui.Image;
    public dog_lv_16:eui.Image;
    public dog_lv_17:eui.Image;
    public dog_lv_18:eui.Image;
    public dog_lv_19:eui.Image;
    public dog_lv_20:eui.Image;
    public dog_lv_21:eui.Image;
    public dog_lv_22:eui.Image;
    public dog_lv_23:eui.Image;
    public dog_lv_24:eui.Image;
    public dog_lv_25:eui.Image;
    public dog_lv_26:eui.Image;
    public dog_lv_27:eui.Image;
    public dog_lv_28:eui.Image;
    public dog_lv_29:eui.Image;
    public dog_lv_30:eui.Image;
    public tipsGroup:eui.Group;
    public addGoldText:eui.Label;
    public lvGroup:eui.Group;
    public lvText:eui.Label;

    
    

    lv
 
    constructor(data?){
        super();
        this.skinName = getSkinPath('DogItem');
        this.touchChildren = true;
        this.init();
    }

    public init():void{
      for(let i=1;i<=30;i++){
          this["dog_lv_"+i].visible=false;
      }
      this.visible=false;

      this["loop"].play(0)
      this["loop"].items.forEach((item)=>{
         item.tween.loop=true;
      })
     
    }

    //设置等级
    setLv(lv){
        if(lv!=0){
            this.visible=true;
            this["dog_lv_"+lv].visible=true;
            this.lvText.text="lv."+lv
        }else{
            this.visible=false;
        }
    }

     //设置单位产量
    setRate(rate){
        this.addGoldText.text=rate
    }

    //加积分动画
    addGold(){
        this["tips"].play(0)
    }


     //加积分
    first(){
        this["first"].play(0)
    }


   
}