import { ui } from "../ui/layaMaxUI";
import { SC } from "./ViewManager";
import { AccountManager } from "../Net/AccountManager";

export default class SetView extends ui.GetRewardViewUI implements SC{
    private static ins:SetView;
   
    constructor(){
        super();
    }
    public static get Instance():SetView{
        if(SetView.ins){
            return SetView.ins
        }
        else{
            return new SetView();
        }
    }
    Show(data?){
        this.FreshDescribe(data);
        this.GetBtn.clickHandler = Laya.Handler.create(this,this.GetReward);
        this.VideoGetBtn.clickHandler = Laya.Handler.create(this,this.VideoGetReward);
        this.height = Laya.stage.height; 
        Laya.stage.on(Laya.Event.RESIZE,this,()=>
        {
            this.height = Laya.stage.height;
        })
    }
    Close(){

    }
    //刷新描述
    FreshDescribe(data){
        let func = AccountManager.Instance.curplayerData.GainCollocation("function");
        let arr = [];
        for(var item in func){
            let items = func[item];
            arr.push(items);
        }
        this.des1.text = arr[data-1].des1;
        this.des2.text = arr[data-1].des2;
        this.skillicon.skin = "Game/res/Skin/func"+ arr[data-1].id + ".png";
    }
    //普通领取
    GetReward(){

    }
    //看视频双倍领取
    VideoGetReward(){

    }
        
}