import { ui } from "../ui/layaMaxUI";
import { SC, ViewManager, ViewType } from "./ViewManager";
import RankSDK from "../Rank/RankSDK";

export default class RankView extends ui.RankViewUI implements SC{
    private static ins:RankView;
    constructor(){
        super();
    }
    public static get Instance():RankView{
        if(RankView.ins){
            return RankView.ins
        }
        else{
            return new RankView();
        }
    }
    Show(){
        RankSDK.OpenPan();
        RankSDK.OpenRank("Level");
        this.CloseBtn.clickHandler = Laya.Handler.create(this,this.ClickClose);
        this.UpPageBtn.clickHandler = Laya.Handler.create(this,this.UpPage);
        this.DownPageBtn.clickHandler = Laya.Handler.create(this,this.DownPage);
        this.height = Laya.stage.height; 
        Laya.stage.on(Laya.Event.RESIZE,this,()=>
        {
            this.height = Laya.stage.height;
        })
    }
    ClickClose(){
        ViewManager.Instance.ShowView(ViewType.MainView);
    }
    UpPage(){
        RankSDK.Leftpe();
    }
    DownPage(){
        RankSDK.Rightpe();
    }
    Close(){
        RankSDK.ClosePan();
    }
    

} 