import { _decorator, Component, Node } from 'cc';
import { PlayerPetOV } from '../../../../consts/API';
import { TablePetIcon } from './TablePetIcon';
import { TB } from '../../../../config/data/schema';
const { ccclass, property } = _decorator;

@ccclass('TablePetIconSelect')
export class TablePetIconSelect extends Component {

    @property(TablePetIcon)
    petIcon:TablePetIcon;

    //选中节点
    @property(Node)
    select:Node;

    //不可选中节点
    @property(Node)
    noselect:Node;

    //是否被选中
    _isSelect:boolean = false;
    get isSelect(){
        return this._isSelect;
    }
    set isSelect(data:boolean){
        this._isSelect = data;
        this.onUpdateSelect();
    }

    //是否不可选中
    _isNoSelect:boolean = false;
    get isNoSelect(){
        return this._isNoSelect;
    }
    set isNoSelect(data:boolean){
        this._isNoSelect = data;
        this.onUpdateSelect();
    }

    onLoad(){
        this.onUpdateSelect();
        this.noselect.active = false;
        this.select.active = false;
    }

    
    //设置
    set(info:TB.TbGRole){

        this.petIcon.set(info);
        
    }

    onUpdateSelect(){

        this.select.active = this.isSelect;
        this.noselect.active = this.isNoSelect;

    }

}


