import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import { Sprite } from 'cc';
import { PetEquip } from '../../consts/API';
import { resources } from 'cc';
import { SpriteFrame } from 'cc';
import TbResource, { IconTypeEnum } from '../../tools/TbResource';
import { TB } from '../../config/data/schema';
import { app, TD } from '../../App';
import { TablePetEquipIcon } from '../Consts/PetEquip/table/TablePetEquipIcon';
import PetEquipData from '../../data/PetEquipData';
import { PetEquipIcon } from '../Consts/PetEquip/icon/PetEquipIcon';
import { PetEquipAttributeView } from '../Consts/PetEquip/PetEquipAttributeView/PetEquipAttributeView';
const { ccclass, property } = _decorator;

//弹出锻造装备页面
@ccclass('PetEquipForgingPopupView')
export class PetEquipForgingPopupView extends JNLayerBase {

    //装备展示
    @property(PetEquipIcon)
    icon:PetEquipIcon;

    //装备属性展示
    @property(PetEquipAttributeView)
    attribute:PetEquipAttributeView;

    info:PetEquip;

    onJNLoad(info:PetEquip){

        super.onJNLoad(info);

        this.info = info;
        this.onUpdateView();

    }

    //刷新页面
    onUpdateView(){
        this.icon.set(this.info);
        this.attribute.set(this.info);
    }

    //点击穿戴装备
    async onClickWear(){
        await PetEquipData.getIns().wear(this.info);
        app.layer.CloseNode(this.node);
    }

}


