import { Global } from "./Global";
import Stage = Laya.Stage;
import { AssetPath } from "./Config/AssetPath";
import { GameContents } from "./GameContents";
import { WxApi } from "./WXSDK/Sdk";
class Main {
	constructor() {
		//根据IDE设置初始化引擎		
        // Laya.init(Global.initWidth, Global.initHeight, Laya["WebGL"]);
        Laya3D.init(Global.initWidth, Global.initHeight);
		Laya.stage.scaleMode = Stage.SCALE_FIXED_WIDTH;
        Laya.stage.alignH = Stage.ALIGN_CENTER;
        Laya.stage.alignV = Stage.ALIGN_TOP;
        Laya.stage.screenMode = Stage.SCREEN_VERTICAL;
		Laya.stage.bgColor = "#54B9F6";
        // Laya.Stat.show();
        Laya.alertGlobalError = true;
        window['Config3D'] && (window['Config3D']["_default"]["_defaultPhysicsMemory"] = 128);
        if(Laya.Browser.window.tt)
        {
            // WxApi.WxInit();
            WxApi.CheckWXUpdate();
        }
        Laya.stage.on("resize", this, this.onResize);
	}

	private onResize():void
    {
        Laya.stage.off("resize", this, this.onResize);
        Global.setVars(); 
        AssetPath.init();  
        fairygui.UIConfig.packageFileExtension = "bin";
        fairygui.UIConfig.textureLinearSampling = true;
        fairygui.UIConfig.defaultFont = "黑体";
        fairygui.UIConfig.versions=Global.versions;
        var gameContent:GameContents = new GameContents();
        gameContent.initGame();
        
    }
}
//激活启动类
new Main();
