// 程序入口 var Loader = Laya.Loader; var E_PlayerState; (function (E_PlayerState) { E_PlayerState[E_PlayerState["idle"] = 0] = "idle"; E_PlayerState[E_PlayerState["up"] = 1] = "up"; E_PlayerState[E_PlayerState["scale"] = 2] = "scale"; E_PlayerState[E_PlayerState["down"] = 3] = "down"; E_PlayerState[E_PlayerState["click"] = 4] = "click"; E_PlayerState[E_PlayerState["die"] = 5] = "die"; //死亡 })(E_PlayerState || (E_PlayerState = {})); var E_LiftNum; (function (E_LiftNum) { E_LiftNum[E_LiftNum["first"] = 0] = "first"; E_LiftNum[E_LiftNum["firstUp"] = 1] = "firstUp"; E_LiftNum[E_LiftNum["firstOver"] = 2] = "firstOver"; })(E_LiftNum || (E_LiftNum = {})); var Main = /** @class */ (function () { function Main() { this.soundable = true; this.mWX = null; this.moreGame = null; this.loadPng = false; this.mSDKVersion = ""; // 微信客户端基础库版本 this.mVersion = ""; // 微信版本号 // 保存onLauch的回调 this.mOnLauchCallback = null; this.miniGame_4399 = true; this.adUtil = null; console.log("登录1111111111111111111111111111111111111111111"); // Laya.MiniAdpter.init(true); this.initStage(); manager.Formula.init(); Laya.timer.callLater(this, function () { // if (wxCore.uo == null) // new wxCore(); // wxCore.uo.initWX(2); if (oppoCore.uo == null) { oppoCore.uo = new oppoCore(); oppoCore.uo.initWX(1, false, 9); } }); } Main.prototype.initStage = function () { // if (Laya.Browser.onIOS) { // Laya.init(STAGE_W, 0, Laya.WebGL); // } else { // Laya.init(STAGE_W, 0); // } Laya.init(750, 1334, laya.webgl.WebGL); Laya.stage.alignH = Laya.Stage.ALIGN_CENTER; Laya.stage.alignV = Laya.Stage.ALIGN_MIDDLE; Laya.stage.screenMode = Laya.Stage.SCREEN_VERTICAL; // Laya.stage.scaleMode = Laya.Stage.SCALE_SHOWALL; Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_WIDTH; var shejib = 1334 / 750; var shijib = window.innerHeight / window.innerWidth; console.log(window.innerHeight, window.innerWidth); if (shejib > shijib) { console.log(shejib, shijib); //宽屏 手机 this.kuanP = true; var h = shijib * 750; this.kuanPScale = h / 1334; } }; Main.prototype.loadAtlas = function (callback) { // Laya.URL.basePath = "https://tcdn.wanzhushipin.cn/xcx/paogao/3.5/"; var res = [ { url: "res/atlas/pngs/my_like.atlas", type: Loader.ATLAS }, { url: "res/atlas/pngs/4.0.atlas", type: Loader.ATLAS }, // { url: "res/atlas/login.atlas", type: Loader.ATLAS }, { url: "res/atlas/pngs.atlas", type: Loader.ATLAS }, // { url: "res/atlas/pngs/relay.atlas", type: Loader.ATLAS }, // { url: "res/atlas/pngs/getlevel.atlas", type: Loader.ATLAS }, // { url: "res/atlas/pngs/2.0.atlas", type: Loader.ATLAS }, { url: "res/atlas/pngs/shop.atlas", type: Loader.ATLAS }, { url: "pngs/btn_pop.png", type: Loader.IMAGE }, { url: "pngs/best_line.png", type: Loader.IMAGE }, { url: "pngs/bg_center.png", type: Loader.IMAGE }, { url: "pngs/bg_left1.png", type: Loader.IMAGE }, { url: "pngs/bg_left3.png", type: Loader.IMAGE }, { url: "pngs/bg_left5.png", type: Loader.IMAGE }, { url: "pngs/bg_left7.png", type: Loader.IMAGE }, { url: "pngs/bg_left9.png", type: Loader.IMAGE }, { url: "pngs/bg_left11.png", type: Loader.IMAGE }, { url: "pngs/bg_right2.png", type: Loader.IMAGE }, { url: "pngs/bg_right4.png", type: Loader.IMAGE }, { url: "pngs/bg_right6.png", type: Loader.IMAGE }, { url: "pngs/bg_right8.png", type: Loader.IMAGE }, { url: "pngs/bg_right10.png", type: Loader.IMAGE }, { url: "pngs/cur_line.png", type: Loader.IMAGE }, { url: "pngs/guide.png", type: Loader.IMAGE }, { url: "pngs/btn_req_friend.png", type: Loader.IMAGE }, { url: "pngs/3.0/award_title.png", type: Loader.IMAGE }, { url: "pngs/ys/bg_ys_type_6.png", type: Loader.IMAGE }, ]; console.log("开始加载资源"); Laya.loader.load(res, Laya.Handler.create(this, this.enterGame, [callback])); }; Main.prototype.enterGame = function (callback) { console.log("加载资源结束"); mainInst.loadPng = true; if (this.startView != null) { this.startView.reset(); } else { this.startView = new view.StartView(); } if (callback != undefined && callback != null) { callback(); } // this.loadAtlas1(); }; Main.prototype.loadAtlas1 = function () { var _this = this; // Laya.URL.basePath = "https://tcdn.wanzhushipin.cn/xcx/paogao/3.5/"; var res = [ { url: "res/atlas/pngs/4.0.atlas", type: Loader.ATLAS }, // { url: "res/atlas/pngs/relay.atlas", type: Loader.ATLAS }, // { url: "res/atlas/pngs/getlevel.atlas", type: Loader.ATLAS }, { url: "res/atlas/pngs/shop.atlas", type: Loader.ATLAS }, { url: "pngs/btn_pop.png", type: Loader.IMAGE }, { url: "pngs/best_line.png", type: Loader.IMAGE }, { url: "pngs/bg_center.png", type: Loader.IMAGE }, { url: "pngs/bg_left1.png", type: Loader.IMAGE }, { url: "pngs/bg_left3.png", type: Loader.IMAGE }, { url: "pngs/bg_left5.png", type: Loader.IMAGE }, { url: "pngs/bg_left7.png", type: Loader.IMAGE }, { url: "pngs/bg_left9.png", type: Loader.IMAGE }, { url: "pngs/bg_left11.png", type: Loader.IMAGE }, { url: "pngs/bg_right2.png", type: Loader.IMAGE }, { url: "pngs/bg_right4.png", type: Loader.IMAGE }, { url: "pngs/bg_right6.png", type: Loader.IMAGE }, { url: "pngs/bg_right8.png", type: Loader.IMAGE }, { url: "pngs/bg_right10.png", type: Loader.IMAGE }, { url: "pngs/cur_line.png", type: Loader.IMAGE }, { url: "pngs/guide.png", type: Loader.IMAGE }, { url: "pngs/btn_req_friend.png", type: Loader.IMAGE }, { url: "pngs/3.0/award_title.png", type: Loader.IMAGE }, { url: "pngs/ys.atlas", type: Loader.ATLAS }, ]; Laya.loader.load(res, Laya.Handler.create(this, function () { console.log("结束123"); console.log("进度"+ e) mainInst.loadPng = true; _this.startView.controlBtn(true); }),laya); }; //4399广告 Main.prototype.playAd = function (call) { //window['h5api'].canPlayAd() //播放广告 call.run(); /* window['h5api'].playAd(function (obj) { console.log('代码:' + obj.code + ',消息:' + obj.message); if (obj.code === 10000) { console.log('开始播放'); } else if (obj.code === 10001) { console.log('播放结束'); call.run(); } else { console.log('广告异常'); } }); */ }; /** * 调出复活界面 */ Main.prototype.showRebirth = function () { if (this.rebirthView == null) { this.rebirthView = new view.RebirthView(); } this.rebirthView.reset(); // Laya.stage.setChildIndex(mainInst.audioMgr._muteSp, Laya.stage.numChildren-1); }; Main.prototype.showResult = function () { if (this.resultView != null) { this.resultView.reset(); } else { this.resultView = new view.ResultView(); } // Laya.stage.setChildIndex(mainInst.audioMgr._muteSp, Laya.stage.numChildren-1); }; /** * 展示复活卡数量的页面 */ Main.prototype.ShowRebirthCard = function (type) { if (this.rebirthView == null) { this.rebirthView = new view.RebirthView(); } this.rebirthView.resetBox_card(type); // Laya.stage.setChildIndex(mainInst.audioMgr._muteSp, Laya.stage.numChildren-1); }; Main.prototype.ShowFriendRank = function () { if (this.rankView == null) { this.rankView = new view.RankView(); } this.rankView.selfbox.visible = false; this.rankView.mTitle.visible = false; this.rankView.onShowRank(); }; Main.prototype.ShowWorldRank = function () { if (this.rankView == null) { this.rankView = new view.RankView(); } this.rankView.selfbox.visible = true; this.rankView.mTitle.visible = true; this.rankView.onWRank(); }; Main.prototype.closeViews = function () { mainInst.mWX.hideBannerAd(); if (mainInst.gameView != null) { mainInst.gameView.clearGuide(); mainInst.gameView.mIsGameRunning = false; } if (Laya.stage.contains(mainInst.gloryView)) { Laya.stage.removeChild(mainInst.gloryView); } if (Laya.stage.contains(mainInst.resultView)) { mainInst.resultView.back2Home(); } if (Laya.stage.contains(view.AwardView.instance)) { view.AwardView.instance.hide(); } if (Laya.stage.contains(view.DoubleAwardView.instance)) { view.DoubleAwardView.instance.hide(false); } if (Laya.stage.contains(view.ShopView.instance)) { view.ShopView.instance.close(); } if (Laya.stage.contains(view.StartAwardViewV2.instance)) { view.StartAwardViewV2.instance.close(); } if (Laya.stage.contains(view.GamingAwardView.instance)) { view.GamingAwardView.instance.close(); } if (Laya.stage.contains(view.WelfareView.instance)) { view.WelfareView.instance.close(); } // 关闭自定义集合页 MoreGame.CloseList(); if (Laya.stage.contains(mainInst.rankView)) { mainInst.rankView.close(); } if (mainInst.startView != null) { mainInst.startView.indexBox.visible = false; mainInst.startView.coinBox.visible = false; } }; Main.prototype.queryGroupRank = function () { this.closeViews(); if (this.rankView == null) { this.rankView = new view.RankView(); } else { this.rankView.reset(); } this.rankView.selfbox.visible = false; this.rankView.mTitle.visible = false; this.rankView.onGRank(); }; Main.prototype.ShowGlory = function () { if (this.gloryView != null) { this.gloryView.reset(); } else { this.gloryView = new view.GloryView(); } }; Main.prototype.showGetLevel = function () { this.showResult(); // if (this.getLevelView != null) { // this.getLevelView.reset(); // } // else { // this.getLevelView = new view.GetLevelView(); // } }; return Main; }()); if (window['qg']) laya.quickgame.mini.MiniAdpter.init(); var mainInst = new Main(); //主入口的单例 //# sourceMappingURL=Main.js.map