
import { IWindow } from "./Component/IWindow";
import { WindowManager, WindowType } from "./WindowManager";
import JionTool from "../W_Rank/JionTool";
import { ui } from "../ui/layaMaxUI";


export class RankWindow extends ui.Window.RankWindowUI implements IWindow
{
    private static instance:RankWindow;
    constructor()
    {
        super();
        RankWindow.instance = this;
    }

    public static get Instance()
    {
        return RankWindow.instance;
    }

    OnOpen(_data = null)
    {
        console.log("排行榜界面打开了----");
        JionTool.showShareCanvas();
        JionTool.showFriendRank("stage");

        this.closeBtn.clickHandler = Laya.Handler.create(this,this.OnCloseRank);
        this.uppageBtn.clickHandler = Laya.Handler.create(this,this.OnUpPage,null,false);
        this.nextpageBtn.clickHandler = Laya.Handler.create(this,this.OnNextPage,null,false);

        // this.goldclip.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money);
        // this.diamondclip.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.diamond);
        
        this.height = Laya.stage.height;
    }

    OnUpPage()
    {
        JionTool.upPage();
    }

    OnNextPage()
    {
        JionTool.nextPage();
    }

    OnCloseRank()
    {
        JionTool.hideShareCanvas();
        WindowManager.Instance.ShowWindow(WindowType.HomeWindow);
    }

    OnHide()
    {

    }
}