123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962 |
- (function () {
- 'use strict';
- class GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- }
- }
- GameConfig.width = 720;
- GameConfig.height = 1280;
- GameConfig.scaleMode = "fixedwidth";
- GameConfig.screenMode = "none";
- GameConfig.alignV = "top";
- GameConfig.alignH = "left";
- GameConfig.startScene = "LoadView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = false;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = false;
- GameConfig.init();
- var AccountUser;
- (function (AccountUser) {
- AccountUser[AccountUser["buyed_kun"] = 0] = "buyed_kun";
- AccountUser[AccountUser["diamond"] = 1] = "diamond";
- AccountUser[AccountUser["equip_themes"] = 2] = "equip_themes";
- AccountUser[AccountUser["favorite_times"] = 3] = "favorite_times";
- AccountUser[AccountUser["game_times"] = 4] = "game_times";
- AccountUser[AccountUser["get_themes"] = 5] = "get_themes";
- AccountUser[AccountUser["list_kun"] = 6] = "list_kun";
- AccountUser[AccountUser["moeny"] = 7] = "moeny";
- AccountUser[AccountUser["progress_themes"] = 8] = "progress_themes";
- AccountUser[AccountUser["revival"] = 9] = "revival";
- AccountUser[AccountUser["stage"] = 10] = "stage";
- })(AccountUser || (AccountUser = {}));
- class PlayerData {
- constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_stage = null, _user_sign, _user_achievement, lottery) {
- this.openid = "";
- this.userId = "";
- this.zhengshu = _token;
- this.netzheshe = _appSetting;
- this.account = _user;
- this.accountssss = _userbase;
- this.qiandao = _user_sign;
- this.renwu = _user_achievement;
- this.userId = this.account["user_id"];
- this.openid = this.accountssss["openid"];
- this.m_invite = _useInvite;
- this.lottery = lottery;
- console.log("user_id:" + this.userId);
- }
- GainCollocation(_type) {
- return this.peizhis[_type];
- }
- GainAccount(_type) {
- return this.account[_type];
- }
- get fenxiang() {
- return this.netzheshe["share"] == "1";
- }
- get CheckScene() {
- return this.netzheshe["checkscene"] == "1";
- }
- get Cheat() {
- return this.netzheshe["cheat"] == "1";
- }
- get Banner() {
- return this.netzheshe["Banner"] == "1";
- }
- get wudaoshijian() {
- return Number(this.netzheshe["wudaoshijian"]);
- }
- GetUser(_type) {
- var type = AccountUser[_type];
- return this.account[type];
- }
- HasGun(_id) {
- var data = this.GainAccount("get_themes");
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id == hd) {
- return true;
- }
- }
- return false;
- }
- GetProgress(_id) {
- var config = this.account["progress_themes"];
- var progress = config[_id] ? config[_id] : 0;
- return progress;
- }
- get ShareTxt() {
- return this.netzheshe["sharecontent"];
- }
- }
- class Global {
- }
- Global.VERSION = "1.0.0";
- Global.CFG = "123";
- var HttpRequest = Laya.HttpRequest;
- var Event = Laya.Event;
- const JtSniperApiUrl = "https://jtsniperapi.xwxgame.com/";
- class JtSniper {
- }
- JtSniper.DengLu = "user/login";
- JtSniper.KaiShi = "game/start";
- JtSniper.JieShu = "game/play";
- JtSniper.QianDao = "sign/sign";
- JtSniper.Chengjiu = "achievement/getRewards";
- JtSniper.Config = "config/table";
- JtSniper.FenXiang = "fission/share";
- JtSniper.LiXian = "fission/offline";
- JtSniper.vd = "fission/vd";
- JtSniper.FuHuo = "game/revival";
- JtSniper.gadagdag = "treasure/click";
- JtSniper.Invite = "invite/getRewards";
- JtSniper.Lottery = "lottery/lottery";
- JtSniper.ShareGetSkin = "theme/fission";
- JtSniper.WearEquip = "theme/equip";
- JtSniper.BuyEquip = "theme/buy";
- JtSniper.ShouQuan = "user/auth";
- JtSniper.JinBi = "user/sync";
- class ServerManager {
- constructor() { }
- static get Instance() {
- if (ServerManager.ins) {
- return ServerManager.ins;
- }
- else {
- return new ServerManager();
- }
- }
- Login(progresscb, completecb, errorcb) {
- var Account = AccountManager.Instance;
- var ver = Global.VERSION;
- let Data = `code=${Account.code}&nickname=${Account.nickName}&avatar=${Account.avatarUrl}&gender=${Account.gender}&country=${Account.country}&province=${Account.province}&city=${Account.city}& device=${Account.device}$&share_id=${Account.share_id}&scene=${Account.scene}&v=${ver}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.PROGRESS, this, this.Progress, [progresscb, httpRequest]);
- httpRequest.once(Event.COMPLETE, this, this.Complete, [completecb, httpRequest]);
- httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
- httpRequest.send(JtSniperApiUrl + JtSniper.DengLu, Data, "post", "text");
- }
- Progress(_progresscb, _httpreq) {
- if (_progresscb) {
- _progresscb.run();
- }
- }
- Complete(_completecb, _httpreq) {
- let data = JSON.parse(_httpreq.data);
- console.log(data);
- if (data["code"] != "0") {
- console.log("登录异常错误!错误信息sssssssss:", _httpreq.data["code"]);
- return;
- }
- console.log("-----------sss", data["t"]);
- AccountManager.Instance.SFSFSF = data["t"];
- this.RessetConfig(data, _completecb);
- }
- RessetConfig(data, completecb) {
- AccountManager.Instance.ReSetting(data, (flag) => {
- if (flag) {
- completecb.runWith(data);
- }
- else {
- this.RessetConfig(data, completecb);
- }
- });
- }
- Errorcb(_errorcb, _httpreq) {
- if (_errorcb != null) {
- _errorcb.runWith(_httpreq);
- }
- }
- SendHttp(protocol, param, completecb, errorcb, hasToken = true) {
- let sfaasfsfa = "";
- let daadsads = JtSniperApiUrl + protocol;
- if (hasToken == true) {
- sfaasfsfa = `token=${AccountManager.Instance.curplayerData.zhengshu}&`;
- }
- if (protocol == JtSniper.KaiShi || protocol == JtSniper.JieShu || protocol == JtSniper.vd || protocol == JtSniper.Lottery || protocol == JtSniper.ShareGetSkin) {
- let asddsa = "abcdefghijkimnopqrstuvwxyz0123456789";
- let adsassda = "{";
- let saafsafs = "";
- for (let i = 0; i < 4; i++) {
- saafsafs += asddsa[Math.floor(Math.random() * 100) % asddsa.length];
- }
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- adsassda += `\"${key}\":\"${param[i][key]}\"`;
- }
- if (i < param.length - 1) {
- adsassda += ",";
- }
- else {
- adsassda += "}";
- }
- }
- sfaasfsfa += "_r=" + saafsafs + this.SFGSGSG(adsassda);
- }
- else {
- if (param != null) {
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- let val = param[i][key];
- sfaasfsfa += `${key}=${val}`;
- if (i < param.length - 1) {
- sfaasfsfa += "&";
- }
- }
- }
- }
- }
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]);
- httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
- httpRequest.send(daadsads, sfaasfsfa, "post", "text");
- }
- onHttpRequestComplete(succeedcb, failurecb, httpRequest) {
- let data = JSON.parse(httpRequest.data);
- if (data["code"] == 0) {
- AccountManager.Instance.ReSetting(data);
- if (succeedcb != null) {
- succeedcb.runWith(data);
- }
- }
- else {
- if (failurecb != null) {
- failurecb.runWith(data);
- }
- console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]);
- }
- }
- SFGSGSG(str) {
- var c1, c2, c3;
- var SFSFFSFSFSFS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var i = 0, len = str.length, SFFSSFFS = '';
- while (i < len) {
- c1 = str.charCodeAt(i++) & 0xff;
- if (i == len) {
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt((c1 & 0x3) << 4);
- SFFSSFFS += "==";
- break;
- }
- c2 = str.charCodeAt(i++);
- if (i == len) {
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- SFFSSFFS += SFSFFSFSFSFS.charAt((c2 & 0xF) << 2);
- SFFSSFFS += "=";
- break;
- }
- c3 = str.charCodeAt(i++);
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
- SFFSSFFS += SFSFFSFSFSFS.charAt(c3 & 0x3F);
- }
- return SFFSSFFS;
- }
- }
- class AccountManager {
- constructor(_code, _userinfo, _nickname, _avatarurl, _gender, _province, _city, _country, _device, _shareid, _scene, _v) {
- this.createTime = Laya.timer.currTimer;
- AccountManager.ins = this;
- this.code = _code;
- this.userInfo = _userinfo;
- this.nickName = _nickname;
- this.avatarUrl = _avatarurl;
- this.gender = _gender;
- this.province = _province;
- this.city = _city;
- this.country = _country;
- this.device = _device;
- this.share_id = _shareid;
- this.scene = _scene;
- this.v = _v;
- }
- static get Instance() {
- if (AccountManager.ins == null) {
- new AccountManager("222222", "你找谁?", "1233", "123", 1, "中国", "上海", "上海", "iphone6s", "123", "123", "123");
- }
- return AccountManager.ins;
- }
- ReSetting(data, cb = null) {
- var zhengshu = data["token"];
- var netset = data["app_setting"];
- var user = data["user"];
- var jichu = data["user_base"];
- var qiandao = data["user_sign"];
- var chengjiu = data["user_achievement"];
- var invite = data["user_invite"];
- var lottery = data["user_lottery"];
- if (this.curplayerData == null) {
- this.curplayerData = new PlayerData(zhengshu, null, netset, user, jichu, invite, null, qiandao, chengjiu, lottery);
- this.JundgCfg(data.table_version, cb);
- }
- else {
- if (netset) {
- this.curplayerData.netzheshe = netset;
- }
- if (user) {
- this.curplayerData.account = user;
- }
- if (jichu) {
- this.curplayerData.accountssss = jichu;
- }
- if (qiandao) {
- this.curplayerData.qiandao = qiandao;
- }
- if (chengjiu) {
- this.curplayerData.renwu = chengjiu;
- }
- }
- }
- JundgCfg(ver, callball) {
- var cfg = Laya.LocalStorage.getJSON(Global.CFG);
- if (cfg) {
- if (cfg.VER == ver) {
- console.log("已经拥有,不用更新");
- this.SetCfg(cfg);
- if (callball)
- callball(true);
- }
- else {
- console.log("cfg存在但是过期了");
- Laya.LocalStorage.removeItem(Global.CFG);
- ServerManager.Instance.SendHttp(JtSniper.Config, null, Laya.Handler.create(this, (data) => {
- data.configs.VER = ver;
- Laya.LocalStorage.setJSON(Global.CFG, data.configs);
- this.SetCfg(data.configs);
- if (callball)
- callball(true);
- }), Laya.Handler.create(this, (data) => {
- console.log("配置获取失败" + data);
- if (callball)
- callball(false);
- return;
- }));
- }
- }
- else {
- console.log("本地没有cfg");
- ServerManager.Instance.SendHttp(JtSniper.Config, null, Laya.Handler.create(this, (data) => {
- data.configs.VER = ver;
- Laya.LocalStorage.setJSON(Global.CFG, data.configs);
- this.SetCfg(data.configs);
- if (callball)
- callball(true);
- }), Laya.Handler.create(this, (data) => {
- console.log("配置获取失败" + data);
- }));
- }
- }
- SetCfg(data) {
- this.curplayerData.peizhis = data;
- }
- RessetConfig() {
- ServerManager.Instance.SendHttp(JtSniper.Config, null, Laya.Handler.create(this, (data) => {
- this.curplayerData.peizhis = data["configs"];
- }), null);
- }
- get ServerTime() {
- let time = Laya.timer.currTimer;
- let stime = this.SFSFSF + Math.ceil((time - this.createTime) / 1000);
- return stime;
- }
- }
- var Vector3 = Laya.Vector3;
- class GameTools {
- constructor() {
- GameTools.ins = this;
- }
- static get Instance() {
- if (GameTools.ins) {
- return GameTools.ins;
- }
- else {
- return new GameTools();
- }
- }
- lerp(form, to, t) {
- if (t <= 0) {
- return form;
- }
- else if (t >= 1) {
- return to;
- }
- var a = t * to + (1 - t) * form;
- return a;
- }
- SetCollider(setNode, CollisionGroup) {
- var numchild = setNode.numChildren;
- for (var i = 0; i < setNode.numChildren; i++) {
- var numchild2 = setNode.getChildAt(i).numChildren;
- if (numchild2 > 1) {
- this.SetCollider(setNode.getChildAt(i), CollisionGroup);
- }
- var physicsCollider = setNode.getChildAt(i).getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = CollisionGroup;
- }
- }
- }
- EnemySetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("npcfrontcollider");
- var collider2 = setNode.getChildByName("npcrearcollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- var physicsCollider2 = collider2.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- if (physicsCollider2) {
- physicsCollider2.collisionGroup = collisionGroup;
- }
- }
- PlayerSetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("playercollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- }
- HostageSetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("hostagecollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- }
- static RandomNumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static RandomANumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return Math.floor(curNumber);
- }
- static GetMoney(_num, _pos = null, _completeHandle = null) {
- if (_num == 0)
- return;
- var fafaafsfa = new Laya.Box;
- fafaafsfa.width = 400;
- fafaafsfa.height = 100;
- fafaafsfa.pivotX = fafaafsfa.width / 2;
- fafaafsfa.pivotY = fafaafsfa.height / 2;
- if (_pos == null) {
- _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2);
- }
- fafaafsfa.pos(_pos.x, _pos.y);
- var aafafaffa = new Laya.Image;
- aafafaffa.skin = "game/qiandao_1_7.png";
- aafafaffa.width = 60;
- aafafaffa.height = 60;
- aafafaffa.left = 50;
- aafafaffa.y = 10;
- fafaafsfa.addChild(aafafaffa);
- var faasfafsafs = new Laya.Text;
- faasfafsafs.width = 300;
- faasfafsafs.height = 50;
- faasfafsafs.align = "center";
- faasfafsafs.valign = "middle";
- faasfafsafs.font = "Microsoft YaHei";
- faasfafsafs.fontSize = 40;
- faasfafsafs.color = "#FFFFFF";
- faasfafsafs.bold = true;
- faasfafsafs.font = "Microsoft YaHei";
- faasfafsafs.text = "金币 +" + _num;
- faasfafsafs.x = 60;
- faasfafsafs.y = 10;
- fafaafsfa.addChild(faasfafsafs);
- Laya.stage.addChild(fafaafsfa);
- var faasfsaf = Laya.Tween.to(fafaafsfa, { y: fafaafsfa.y - 200 }, 1500, Laya.Ease.expoInOut, Laya.Handler.create(this, () => {
- faasfsaf.clear();
- fafaafsfa.destroy();
- if (_completeHandle) {
- _completeHandle.run();
- }
- }), 100);
- }
- static TweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
- var afasafsafsfa = new Laya.Text();
- afasafsafsfa.width = faafssfafsa.size.x;
- afasafsafsfa.height = faafssfafsa.size.y;
- afasafsafsfa.align = "center";
- afasafsafsfa.valign = "middle";
- afasafsafsfa.font = "Microsoft YaHei";
- afasafsafsfa.fontSize = faafssfafsa.fontSize;
- afasafsafsfa.pivotX = afasafsafsfa.width / 2;
- afasafsafsfa.pivotY = afasafsafsfa.height / 2;
- afasafsafsfa.color = "#5ad122";
- afasafsafsfa.bold = true;
- afasafsafsfa.stroke = 5;
- afasafsafsfa.strokeColor = "#ffffff";
- if (faafssfafsa.color) {
- faafssfafsa.color = faafssfafsa.color;
- }
- afasafsafsfa.text = faafssfafsa.message;
- afasafsafsfa.zOrder = 1;
- Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
- afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
- var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
- }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
- tween.clear();
- if (hide) {
- afasafsafsfa.destroy();
- }
- if (_completeHandle) {
- _completeHandle.run();
- }
- }));
- if (hide) {
- Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 500);
- }
- return afasafsafsfa;
- }
- static StationTweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
- var afasafsafsfa = new Laya.Text();
- afasafsafsfa.width = faafssfafsa.size.x;
- afasafsafsfa.height = faafssfafsa.size.y;
- afasafsafsfa.align = "center";
- afasafsafsfa.valign = "middle";
- afasafsafsfa.font = "Microsoft YaHei";
- afasafsafsfa.fontSize = 50;
- afasafsafsfa.pivotX = afasafsafsfa.width / 2;
- afasafsafsfa.pivotY = afasafsafsfa.height / 2;
- afasafsafsfa.color = "#5ad122";
- afasafsafsfa.bold = true;
- afasafsafsfa.stroke = 5;
- afasafsafsfa.strokeColor = "#ffffff";
- if (faafssfafsa.color) {
- faafssfafsa.color = faafssfafsa.color;
- }
- afasafsafsfa.text = faafssfafsa.message;
- afasafsafsfa.zOrder = 1;
- Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
- afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
- var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
- }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
- tween.clear();
- if (hide) {
- afasafsafsfa.destroy();
- }
- if (_completeHandle) {
- _completeHandle.run();
- }
- }));
- if (hide) {
- Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 10000);
- }
- return afasafsafsfa;
- }
- static tweenMove(transform, targPos, delay, ease, complete) {
- let curPos = transform.position.clone();
- return Laya.Tween.to(curPos, {
- x: targPos.x,
- y: targPos.y,
- z: targPos.z,
- update: new Laya.Handler(this, () => {
- transform.position = curPos.clone();
- })
- }, delay, ease, complete);
- }
- static tweenRotate(transform, targEuler, delay, ease, complete) {
- let curEuler = transform.rotationEuler.clone();
- return Laya.Tween.to(curEuler, {
- x: targEuler.x,
- y: targEuler.y,
- z: targEuler.z,
- update: new Laya.Handler(this, () => {
- transform.rotationEuler = curEuler.clone();
- })
- }, delay, ease, complete);
- }
- }
- class ShareUtil {
- beginShare(callBack) {
- ShareUtil.beginShareTime = new Date().getTime();
- console.log("分享点击时间=" + ShareUtil.beginShareTime);
- ShareUtil.isSharing = true;
- ShareUtil.callback = callBack;
- }
- onRegister() {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- Laya.Browser.window.wx.onShow(function (option) {
- console.log("onshow share start");
- if (ShareUtil.isSharing) {
- ShareUtil.isSharing = false;
- let time = new Date().getTime();
- console.log("分享回到游戏时间" + time);
- let wait = (time - ShareUtil.beginShareTime) / 1000;
- console.log("分享停留时间为:" + wait);
- if (wait < 3) {
- Laya.Browser.window.wx.showToast({ title: "请重试一次" });
- ShareUtil.callback(false);
- }
- else {
- var random = Math.random();
- if (random <= 0.3) {
- var message = ["你已分享过该群", "请重新换个群分享!", "请分享到30人大群中!"];
- var curmes = message[GameTools.RandomANumber(0, 2)];
- Laya.Browser.window.wx.showToast({ title: curmes });
- ShareUtil.callback(false);
- }
- else {
- Laya.Browser.window.wx.showToast({ title: "分享成功!" });
- ShareUtil.callback(true);
- }
- }
- }
- });
- }
- static ShareMessage() {
- if (!Laya.Browser.onWeiXin)
- return;
- var t = AccountManager.Instance.ServerTime;
- var _title = AccountManager.Instance.curplayerData.ShareTxt;
- _title = (_title == "" || !_title) ? "有人@你,快来比一比枪法" : _title;
- var _image = "subpackage/res/share/1.jpg";
- Laya.Browser.window.wx.onShareAppMessage(() => ({
- title: _title,
- imageUrl: _image,
- query: "shareid=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- }));
- }
- static shareImage(channel, callback = null, shareType) {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- var t = AccountManager.Instance.ServerTime;
- var _title = AccountManager.Instance.curplayerData.ShareTxt;
- _title = (_title == "" || !_title) ? "有人@你,快来比一比枪法" : _title;
- var _image = "subpackage/res/share/1.jpg";
- Laya.Browser.window.wx.aldShareAppMessage({
- title: _title,
- imageUrl: _image,
- query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- });
- if (callback) {
- ShareUtil.Instance.beginShare(callback);
- }
- }
- }
- ShareUtil.Instance = new ShareUtil();
- ShareUtil.shareSuccessTime = 0;
- ShareUtil.isSharing = false;
- class WXSDK {
- constructor() {
- WXSDK.ins = this;
- }
- static get Instance() {
- if (WXSDK.ins) {
- return WXSDK.ins;
- }
- else {
- return new WXSDK();
- }
- }
- static Init() {
- }
- static DengLu(_complete) {
- var that = this;
- Laya.Browser.window.wx.login({
- success: function (res) {
- if (res.code) {
- ShareUtil.Instance.onRegister();
- console.log("微信登陆成功----");
- that.codeValue = res.code;
- console.log("shareid:" + WXSDK.shareOpenId);
- new AccountManager(res.code, "", "", "", 0, "", "", "", "", WXSDK.shareOpenId, WXSDK.shareOpenId, Global.VERSION);
- _complete(res);
- }
- else {
- WXSDK.DengLu(WXSDK.DengLu);
- console.log('wx no code' + res.errMsg);
- }
- },
- fail: function (res) { console.log("wx.login: failed, res=" + res); }
- });
- }
- static ShowTxt(text) {
- if (Laya.Browser.onWeiXin) {
- Laya.Browser.window.wx.showToast({ title: text });
- }
- else {
- console.log(text);
- }
- }
- static OnShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.onShow(cb);
- }
- static OffShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.offShow(cb);
- }
- static OnHide(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.onHide(cb);
- }
- static OffHide(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.offHide(cb);
- }
- static ShortShake() {
- Laya.Browser.window.wx.vibrateShort({});
- }
- static LongShake() {
- Laya.Browser.window.wx.vibrateLong({});
- }
- static Shake(_short = true) {
- if (Laya.Browser.onWeiXin && WXSDK.shake) {
- if (_short) {
- this.ShortShake();
- }
- else {
- this.LongShake();
- }
- }
- }
- static LoadSubPackage(name, _complete) {
- if (Laya.Browser.onWeiXin) {
- const loadTask = Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage',
- success: function (res) {
- _complete && _complete(true);
- console.log("分包加载成功");
- },
- fail: function (res) {
- _complete && _complete(false);
- console.log("分包加载失败");
- }
- });
- }
- else {
- console.log("未进行分包加载");
- _complete && _complete(true);
- }
- }
- static stageShake(callBack = null, speed = 32) {
- if (this.isShake || !this.canshakestage)
- return;
- this.isShake = true;
- var point = new Laya.Vector2(Laya.stage.x, Laya.stage.y);
- Laya.stage.timerLoop(speed, this, this.shakeObject, [point, callBack]);
- }
- static shakeObject(_point, _callBack) {
- var count = (this.num++) % 4;
- this.offsetArr[this.num % 2] = count < 2 ? 0 : this.offset;
- Laya.stage.x = this.offsetArr[0] + _point.x;
- Laya.stage.y = this.offsetArr[1] + _point.y;
- if (this.num > (this.times * 4 + 1)) {
- Laya.stage.clearTimer(this, this.shakeObject);
- Laya.stage.pos(0, 0);
- this.num = 0;
- this.isShake = false;
- if (_callBack != null) {
- _callBack();
- }
- }
- }
- static UpdateGuide(ShowGuide = 0) {
- var kvDataList = new Array();
- let date = new Date().getTime();
- var myValue = JSON.stringify({
- "guide": {
- "ShowGuide": ShowGuide,
- "update_time": date.toString()
- }
- });
- kvDataList.push({ key: "ShowGuide", value: myValue });
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.setUserCloudStorage({
- KVDataList: kvDataList,
- success: r => {
- console.log("KVDATALIST---", kvDataList);
- console.log("上传新手指引成功:" + ShowGuide);
- }
- });
- }
- }
- static UpdateScore(max_score) {
- var kvDataList = new Array();
- let date = new Date().getTime();
- var myValue = JSON.stringify({
- "wxgame": {
- "max_score": max_score,
- "update_time": date.toString(),
- }
- });
- kvDataList.push({ key: "max_score", value: myValue });
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.setUserCloudStorage({
- KVDataList: kvDataList,
- success: r => {
- console.log("KVDATALIST---", kvDataList);
- console.log("上传分数成功:" + max_score);
- }
- });
- }
- }
- static fengxiangtupian(callback) {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- var _title = "有人@你,一起骑马仗箭走天涯";
- var t = AccountManager.Instance.ServerTime;
- Laya.Browser.window.wx.aldShareAppMessage({
- title: _title,
- imageUrl: "Game/res/textrue/share.jpg",
- query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- });
- }
- static AldEvent(eventName, key = "用户id", value = "") {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.aldSendEvent(eventName, { key: value });
- }
- static AldStart(stageId) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.aldStage.onStart({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- });
- }
- static AldEnd(stageId, isComplete) {
- if (!Laya.Browser.onWeiXin)
- return;
- let event = isComplete ? "complete" : "fail";
- let desc = isComplete ? "关卡完成" : "关卡失败";
- Laya.Browser.window.wx.aldStage.onEnd({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- event: event,
- params: {
- desc: desc
- }
- });
- }
- }
- WXSDK.codeValue = "";
- WXSDK.shareOpenId = "";
- WXSDK.openId = 0;
- WXSDK.shareScene = "";
- WXSDK.uid = "123";
- WXSDK.querychannel = "";
- WXSDK.referrerInfoappId = "";
- WXSDK.shake = true;
- WXSDK.times = 1.3;
- WXSDK.num = 0;
- WXSDK.offsetArr = [0, 0];
- WXSDK.offset = 14;
- WXSDK.canshakestage = false;
- var REG = Laya.ClassUtils.regClass;
- var ui;
- (function (ui) {
- class HomeViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(HomeViewUI.uiView);
- }
- }
- HomeViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Button", "props": { "y": 815, "x": 180, "var": "StartBtn", "stateNum": 1, "skin": "Main/zhujiemian-1-4.png" }, "compId": 7 }], "loadList": ["Main/zhujiemian-1-4.png"], "loadList3D": [] };
- ui.HomeViewUI = HomeViewUI;
- REG("ui.HomeViewUI", HomeViewUI);
- class InGameViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(InGameViewUI.uiView);
- }
- }
- InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 979, "x": 447, "var": "hand", "skin": "Main/IconHand.png", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 6 }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "scaleX", "index": 20 }] } }], "name": "click", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/IconHand.png"], "loadList3D": [] };
- ui.InGameViewUI = InGameViewUI;
- REG("ui.InGameViewUI", InGameViewUI);
- class LoadViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(LoadViewUI.uiView);
- }
- }
- LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Load/jiazai-1-5.png", "sizeGrid": "10,14,12,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "ProgressBar", "props": { "y": 868, "x": 167, "var": "jindupro", "skin": "Load/jiazai-1-4.png" }, "compId": 3 }], "loadList": ["Load/jiazai-1-5.png", "Load/jiazai-1-4.png"], "loadList3D": [] };
- ui.LoadViewUI = LoadViewUI;
- REG("ui.LoadViewUI", LoadViewUI);
- })(ui || (ui = {}));
- class GuangGao {
- constructor() {
- GuangGao.ins = this;
- }
- static get Instance() {
- if (GuangGao.ins) {
- return GuangGao.ins;
- }
- else {
- return new GuangGao();
- }
- }
- static InitVideo() {
- if (!Laya.Browser.onWeiXin)
- return;
- console.log(this.bannerAdUnitId);
- this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
- this.fsaasfafssfa.onLoad(() => {
- console.log('激励视频 广告加载成功');
- this.asfasfsaffsa = true;
- });
- this.fsaasfafssfa.onError(err => {
- console.log("激励视屏加载失败:" + err);
- this.asfasfsaffsa = false;
- });
- this.afsfsaafsfsa = true;
- }
- static ShowVideo(callback) {
- if (this.asfasfsaffsa) {
- console.log("showVideoAd:" + this.asfasfsaffsa);
- this.SetVideoCallBack(callback);
- this.fsaasfafssfa.show().catch(err => {
- this.fsaasfafssfa.load().then(() => {
- this.SetVideoCallBack(callback);
- this.fsaasfafssfa.show();
- });
- });
- }
- }
- static SetVideoCallBack(callback) {
- this.fsaasfafssfa.offClose();
- this.fsaasfafssfa.onClose(res => {
- console.log("激励视频关闭:" + res.isEnded);
- if (res && res.isEnded || res === undefined) {
- callback && callback(true);
- }
- else {
- callback && callback(false);
- }
- this.fsaasfafssfa.offClose();
- });
- }
- static OpenBanner(gap = 0, callVack = null, iswait = false) {
- if (!Laya.Browser.onWeiXin) {
- if (callVack) {
- callVack(null);
- }
- return;
- }
- this.canshowbanner = true;
- var idd = this.bannerAdUnitId;
- console.log("adUnitId:" + idd);
- let newBanner = Laya.Browser.window.wx.createBannerAd({
- adUnitId: idd,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- newBanner.onError(err => {
- console.log("广告错误onerror--");
- console.log(err);
- callVack(null);
- });
- newBanner.onLoad(() => {
- if (this.curbanner)
- this.curbanner.destroy();
- this.curbanner = newBanner;
- var hight = this.GetRealHight(gap);
- if (callVack != null) {
- callVack(hight);
- }
- if (this.canshowbanner && !iswait) {
- this.curbanner.show();
- }
- else {
- this.curbanner.hide();
- }
- });
- }
- static GetRealHight(gap) {
- if (this.curbanner) {
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this.curbanner.style.width = info.windowWidth;
- this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
- return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
- }
- }
- static Clear() {
- Laya.timer.clearAll(this);
- Laya.Tween.clearAll(this);
- this.canshowbanner = false;
- if (this.curbanner)
- this.curbanner.hide();
- }
- static hidebanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this.curbanner)
- this.curbanner.hide();
- }
- static showbanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this.curbanner)
- this.curbanner.show();
- }
- static get cancheat() {
- return false;
- }
- static SetPosBanner(btn, complete) {
- if (Laya.Browser.onPC) {
- complete(false);
- return;
- }
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- var reshight = btn.y * info.windowHeight / Laya.stage.height;
- var idd = this.bannerAdUnitId;
- console.log("adUnitId:" + idd);
- if (this.curbanner)
- this.curbanner.destroy();
- let newBanner = Laya.Browser.window.wx.createBannerAd({
- adUnitId: idd,
- style: {
- left: 0,
- top: 0,
- width: 720
- }
- });
- newBanner.onError(err => {
- console.log(err);
- complete(false);
- });
- newBanner.onLoad(() => {
- this.curbanner = newBanner;
- this.curbanner.style.top = reshight;
- if (this.curbanner) {
- console.log("banner show");
- this.curbanner.show();
- Laya.timer.once(2300, this, () => {
- this.curbanner.style.top = info.windowHeight - GuangGao.bannerhigt;
- complete(true);
- });
- }
- });
- newBanner.onResize((res) => {
- GuangGao.bannerhigt = res.height;
- this.curbanner.style.width = info.windowWidth;
- this.curbanner.style.top = reshight;
- });
- }
- static CheatBanner(btn, complete = null, gap = 0) {
- if (!AccountManager.Instance.curplayerData.Cheat) {
- console.log("ignorecheat");
- GuangGao.OpenBanner(0, (height) => {
- if (height == null) {
- console.log("banner高度为null---");
- }
- });
- }
- else {
- btn.y = Laya.stage.height - btn.height - 100;
- GuangGao.OpenBanner(gap, (height) => {
- if (height == null) ;
- else {
- console.log("cheatstart", "bottom:100");
- btn.mouseEnabled = false;
- var end = Laya.stage.height - height - btn.height - 20;
- console.log("y:" + end);
- Laya.timer.once(1000, this, () => {
- btn.mouseEnabled = true;
- this.showbanner();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- }, true);
- }
- }
- showBanner(success = null, fail = null) {
- if (!Laya.Browser.onWeiXin)
- return;
- var ran = GameTools.RandomANumber(0, 3);
- let ad = GuangGao.bannerAdUnitId;
- let bannerAd = Laya.Browser.window.wx.createBannerAd({
- adUnitId: ad,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- bannerAd.onLoad(() => {
- console.log("[LOG] Banner广告加载成功");
- this.hideBanner();
- this._bannerAd = bannerAd;
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this._bannerAd.style.width = info.windowWidth;
- this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 20;
- this._bannerAd.show();
- success && success(this._bannerAd);
- });
- bannerAd.onError(err => {
- console.log("[LOG] Banner广告加载失败");
- console.log(err);
- fail && fail();
- });
- }
- hideBanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this._bannerAd) {
- this._bannerAd.hide();
- this._bannerAd.destroy();
- this._bannerAd = null;
- }
- }
- }
- GuangGao.videlAdUnitId = "adunit-8feb4e40536601ff";
- GuangGao.bannerAdUnitId = "adunit-426c9d6299d18f7e";
- GuangGao.afsfsaafsfsa = false;
- GuangGao.asfasfsaffsa = false;
- GuangGao.canshowbanner = true;
- GuangGao.bannerhigt = 0;
- class ResourcesPath {
- }
- ResourcesPath.mainscene = "subpackage/mainscene/LayaScene_mainscene/Conventional/mainscene.ls";
- ResourcesPath.Character = [
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character1.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character2.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character3.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character4.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character5.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character6.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character7.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character8.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Character9.lh"
- ];
- ResourcesPath.Prop = [
- "subpackage/gameresources/LayaScene_gameresources/Conventional/CheckPoint1.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/CheckPoint2.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/FinishCircle.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/FinishCircle2.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/magnet.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail1.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail2.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail3.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail4.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail5.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail6.lh",
- "subpackage/gameresources/LayaScene_gameresources/Conventional/Nail7.lh"
- ];
- class Dictionary {
- constructor() {
- this._items = {};
- this.length = 0;
- }
- get container() {
- return this._items;
- }
- has(key) {
- return this._items.hasOwnProperty(key);
- }
- set(key, val) {
- if (!this.has(key)) {
- this.length++;
- }
- this._items[key] = val;
- }
- delete(key) {
- let val = null;
- if (this.has(key)) {
- val = this._items[key];
- delete this._items[key];
- this.length--;
- }
- return val;
- }
- get(key) {
- return this.has(key) ? this._items[key] : null;
- }
- values() {
- let values = [];
- for (let k in this._items) {
- if (this.has(k)) {
- values.push(this._items[k]);
- }
- }
- return values;
- }
- keys() {
- let keys = [];
- for (let k in this._items) {
- if (this.has(k)) {
- keys.push(k);
- }
- }
- return keys;
- }
- clear() {
- this._items = {};
- this.length = 0;
- }
- }
- class NodeUtil {
- static GetChild(node, cond) {
- let queue = [];
- for (let i = 0; i < node.numChildren; i++) {
- queue.push(node.getChildAt(i));
- }
- while (queue.length > 0) {
- let first = queue.shift();
- if (cond(first)) {
- return first;
- }
- else {
- for (let i = 0; i < first.numChildren; i++) {
- queue.push(first.getChildAt(i));
- }
- }
- }
- return null;
- }
- static GetChildByName(node, name) {
- return NodeUtil.GetChild(node, s => s.name == name);
- }
- static getChildren(node, cond) {
- let finded = [];
- let queue = [];
- for (let i = 0; i < node.numChildren; i++) {
- queue.push(node.getChildAt(i));
- }
- while (queue.length > 0) {
- let first = queue.shift();
- if (cond(first)) {
- finded.push(first);
- }
- for (let i = 0; i < first.numChildren; i++) {
- queue.push(first.getChildAt(i));
- }
- }
- return finded;
- }
- static SetColliderInactive(sp) {
- let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
- colliders.forEach(s => {
- let collider = s.getComponent(Laya.PhysicsCollider);
- if (collider) {
- collider.enabled = false;
- }
- }, this);
- }
- static SetColliderGroup(sp, _group) {
- let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
- colliders.forEach(s => {
- let collisionGroup = _group;
- let collider = s.getComponent(Laya.PhysicsCollider);
- collider.collisionGroup = collisionGroup;
- }, this);
- }
- }
- NodeUtil.All = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER;
- NodeUtil.Body = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER1;
- NodeUtil.Head = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER2;
- NodeUtil.Citizen = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER3;
- class Transform3DHelper {
- static getForward(transform) {
- let forward = new Laya.Vector3();
- transform.getForward(forward);
- Laya.Vector3.scale(forward, -1, forward);
- Laya.Vector3.normalize(forward, forward);
- return forward;
- }
- }
- var EventState;
- (function (EventState) {
- EventState[EventState["LoadComplete"] = 0] = "LoadComplete";
- EventState[EventState["SceneInit"] = 1] = "SceneInit";
- EventState[EventState["StageInit"] = 2] = "StageInit";
- EventState[EventState["ShowModel"] = 3] = "ShowModel";
- })(EventState || (EventState = {}));
- var StageState;
- (function (StageState) {
- StageState[StageState["Win"] = 0] = "Win";
- StageState[StageState["Lose"] = 1] = "Lose";
- StageState[StageState["Start"] = 2] = "Start";
- StageState[StageState["BackMain"] = 3] = "BackMain";
- StageState[StageState["StageCreateComPlete"] = 4] = "StageCreateComPlete";
- StageState[StageState["Over"] = 5] = "Over";
- StageState[StageState["Pause"] = 6] = "Pause";
- StageState[StageState["Resume"] = 7] = "Resume";
- })(StageState || (StageState = {}));
- class DispatcherManager {
- static EventOn(_mode, caller, fun, args = []) {
- DispatcherManager.instance.on(EventState[_mode], caller, fun, args);
- }
- static EventOff(_mode, caller, fun, args = []) {
- DispatcherManager.instance.off(EventState[_mode], caller, fun);
- }
- static EventTrigger(_mode, args = []) {
- DispatcherManager.instance.event(EventState[_mode], args);
- }
- static StageOn(_mode, caller, fun, args = []) {
- DispatcherManager.instance.on(StageState[_mode], caller, fun, args);
- }
- static StageOff(_mode, caller, fun, args = []) {
- DispatcherManager.instance.off(StageState[_mode], caller, fun);
- }
- static StageTrigger(_mode, args = []) {
- DispatcherManager.instance.event(StageState[_mode], args);
- }
- }
- DispatcherManager.instance = new Laya.EventDispatcher();
- var Vector3$1 = Laya.Vector3;
- class RoleMoveBehav extends Laya.Script3D {
- constructor() {
- super();
- this.start = false;
- this.Downhit = new Laya.HitResult();
- this.FowardHit = new Laya.HitResult();
- this.isdead = false;
- this.curpos = new Vector3$1();
- this.offest = new Vector3$1();
- this.curspeed = 0;
- }
- onAwake() {
- this.m_player = this.owner;
- DispatcherManager.StageOn(StageState.Start, this, this.Start);
- }
- Start() {
- this.start = true;
- }
- onUpdate() {
- if (!this.start)
- return;
- if (this.isdead) {
- this.ChangeDeadState();
- return;
- }
- if (this.DownRayCheck) ;
- else {
- this.isdead = true;
- }
- if (this.FowardRayCheck) ;
- let foward = Transform3DHelper.getForward(this.m_player.transform);
- this.Move(foward, 0.2);
- }
- Move(_dir, _speed) {
- var sp = GameTools.Instance.lerp(this.curspeed, _speed, 0.1);
- this.curspeed = sp;
- Vector3$1.scale(_dir, this.curspeed, this.offest);
- Vector3$1.add(this.m_player.transform.position, this.offest, this.curpos);
- Vector3$1.lerp(this.m_player.transform.position, this.curpos, 0.15, this.curpos);
- this.curpos = new Vector3$1(this.curpos.x, this.curpos.y, this.curpos.z);
- this.m_player.transform.position = this.curpos;
- }
- MoveRayJupde() {
- var isDownHit = false;
- var hitResult = new Laya.HitResult();
- var boxCollider = new Laya.BoxColliderShape(0.2, 0.2, 0.2);
- var from = new Vector3$1(this.m_player.transform.position.x, this.m_player.transform.position.y + 0.5, this.m_player.transform.position.z);
- var dir = new Vector3$1(0, -100, 0);
- var to = new Vector3$1(0, 0, 0);
- Vector3$1.add(from, dir, to);
- if (AssetManager.Instance.mainscene.physicsSimulation.shapeCast(boxCollider, from, to, hitResult)) {
- if (hitResult != null) {
- if (this.Downhit.collider.collisionGroup == 1) {
- isDownHit = true;
- }
- }
- }
- return isDownHit;
- }
- get DownRayCheck() {
- var isDownHit = false;
- var boxCollider = new Laya.BoxColliderShape(0.2, 0.2, 0.2);
- var from = new Vector3$1(this.m_player.transform.position.x, this.m_player.transform.position.y + 0.5, this.m_player.transform.position.z);
- var dir = new Vector3$1(0, -100, 0);
- var to = new Vector3$1(0, 0, 0);
- Vector3$1.add(from, dir, to);
- if (AssetManager.Instance.mainscene.physicsSimulation.shapeCast(boxCollider, from, to, this.Downhit)) {
- if (this.Downhit != null) {
- console.log("111111111111", this.Downhit.collider.owner.name);
- if (this.Downhit.collider.collisionGroup == 1 || this.Downhit.collider.collisionGroup == 100) {
- isDownHit = true;
- }
- }
- }
- return isDownHit;
- }
- get FowardRayCheck() {
- var isFowardHit = false;
- var startPos = new Vector3$1(this.m_player.transform.position.x, this.m_player.transform.position.y + 0.5, this.m_player.transform.position.z + 0.2);
- let foward = Transform3DHelper.getForward(this.m_player.transform);
- var FowardRay = new Laya.Ray(startPos, foward);
- if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 1)) {
- if (this.FowardHit) {
- console.log(this.FowardHit.collider.owner.name);
- console.log("前方有物体");
- }
- if (this.FowardHit.collider.collisionGroup == 100) {
- console.log("射线打到npc了");
- this.ForwardTarget = this.FowardHit.collider;
- isFowardHit = true;
- }
- }
- return isFowardHit;
- }
- ChangeDeadState() {
- this.destroy();
- }
- }
- class PlayerManager {
- constructor() {
- this.trun = true;
- this.first = true;
- PlayerManager.ins = this;
- }
- static get Instance() {
- if (PlayerManager.ins == null) {
- return new PlayerManager();
- }
- return PlayerManager.ins;
- }
- Init() {
- if (this.PlayerNode == null) {
- this.PlayerNode = new Laya.Sprite3D();
- LevelManager.Instance.spritepool.addChild(this.PlayerNode);
- if (this.player == null) {
- let playerpref = AssetManager.Instance.Character.get(2);
- this.player = Laya.Sprite3D.instantiate(playerpref);
- this.PlayerNode.addChild(this.player);
- }
- }
- this.PlayerNode.transform.position = AssetManager.Instance.playerpos.transform.position.clone();
- this.PlayerNode.transform.rotation = AssetManager.Instance.playerpos.transform.rotation.clone();
- this.player.transform.localPosition = new Laya.Vector3(0, 0, 0);
- }
- EnablePlayer() {
- this.PlayerNode.addComponent(RoleMoveBehav);
- Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
- }
- DisablePlayer() {
- let _move = this.PlayerNode.getComponent(RoleMoveBehav);
- if (_move) {
- _move.destroy();
- }
- Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
- }
- OnMouseDown() {
- if (this.first) {
- this.first = false;
- return;
- }
- if (this.trun) {
- this.PlayerNode.transform.rotationEuler = new Laya.Vector3(0, -90, 0);
- this.trun = !this.trun;
- }
- else {
- this.PlayerNode.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
- this.trun = !this.trun;
- }
- }
- }
- class LevelManager {
- constructor() {
- LevelManager.ins = this;
- }
- static get Instance() {
- if (LevelManager.ins == null) {
- return new LevelManager();
- }
- return LevelManager.ins;
- }
- RegEvent() {
- DispatcherManager.StageOn(StageState.Lose, this, this.GameLose);
- DispatcherManager.StageOn(StageState.Win, this, this.GameWin);
- DispatcherManager.StageOn(StageState.Pause, this, this.GamePause);
- DispatcherManager.StageOn(StageState.Resume, this, this.GameResume);
- }
- GameStart() {
- PlayerManager.Instance.Init();
- PlayerManager.Instance.EnablePlayer();
- }
- GameLose() {
- }
- GameWin() {
- }
- GamePause() {
- }
- GameResume() {
- }
- }
- class CameraManager {
- constructor() {
- this.poschazhi = new Laya.Vector3();
- this.gengsuipos = new Laya.Vector3();
- this.lllpos = new Laya.Vector3();
- this.hights = 0;
- this.wights = 0;
- CameraManager.ins = this;
- DispatcherManager.StageOn(StageState.Start, this, this.CameraFollow);
- DispatcherManager.StageOn(StageState.Win, this, this.CameraCancelFollow);
- DispatcherManager.StageOn(StageState.Lose, this, this.CameraCancelFollow);
- }
- static get Instance() {
- if (CameraManager.ins == null) {
- return new CameraManager();
- }
- return CameraManager.ins;
- }
- Init() {
- }
- CameraFollow() {
- this.hights = 0;
- this.wights = 0;
- Laya.Vector3.subtract(PlayerManager.Instance.PlayerNode.transform.position, this.camera.transform.position, this.poschazhi);
- Laya.timer.frameLoop(1, this, this.GenSui);
- }
- GenSui() {
- Laya.Vector3.subtract(PlayerManager.Instance.PlayerNode.transform.position, this.poschazhi, this.gengsuipos);
- this.hights = GameTools.Instance.lerp(this.hights, 1, 0.03);
- this.wights = GameTools.Instance.lerp(this.wights, 0.8, 0.02);
- this.gengsuipos = new Laya.Vector3(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z);
- Laya.Vector3.lerp(this.camera.transform.position, this.gengsuipos, 0.25, this.lllpos);
- this.lllpos = new Laya.Vector3(this.gengsuipos.x, this.lllpos.y, this.lllpos.z);
- this.camera.transform.position = this.lllpos;
- var qqqwe = new Laya.Quaternion();
- var eyePos = new Laya.Vector3(this.gengsuipos.x, this.gengsuipos.y - 0.8, this.gengsuipos.z);
- Laya.Quaternion.lookAt(eyePos, PlayerManager.Instance.PlayerNode.transform.position, new Laya.Vector3(0, 1, 0), qqqwe);
- qqqwe.invert(qqqwe);
- Laya.Quaternion.slerp(this.camera.transform.rotation, qqqwe, 0.1, qqqwe);
- this.camera.transform.rotation = qqqwe;
- }
- CameraCancelFollow() {
- Laya.timer.clear(this, this.GenSui);
- }
- }
- class InGameView extends ui.InGameViewUI {
- constructor() {
- super();
- InGameView.ins = this;
- }
- static get Instance() {
- if (InGameView.ins == null) {
- return new InGameView();
- }
- return InGameView.ins;
- }
- OnShow() {
- console.log("游戏界面");
- this.click.play(null, true);
- this.on(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
- }
- ClickStart() {
- this.click.stop();
- this.hand.visible = false;
- this.off(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
- }
- OnHide() {
- }
- }
- class HomeView extends ui.HomeViewUI {
- constructor() {
- super();
- HomeView.ins = this;
- }
- static get Instance() {
- if (HomeView.ins == null) {
- return new HomeView();
- }
- return HomeView.ins;
- }
- OnShow() {
- console.log("主界面");
- this.RegButton();
- }
- RegButton() {
- this.StartBtn.clickHandler = new Laya.Handler(this, this.Start);
- }
- Start() {
- ViewManager.Instance.ShowView(ViewType.InGameView);
- DispatcherManager.StageTrigger(StageState.Start);
- }
- OnHide() {
- }
- }
- var ViewType;
- (function (ViewType) {
- ViewType[ViewType["InGameView"] = 0] = "InGameView";
- ViewType[ViewType["HomeView"] = 1] = "HomeView";
- ViewType[ViewType["GameResultView"] = 2] = "GameResultView";
- ViewType[ViewType["PauseView"] = 3] = "PauseView";
- ViewType[ViewType["UpGradeView"] = 4] = "UpGradeView";
- ViewType[ViewType["SkinView"] = 5] = "SkinView";
- ViewType[ViewType["TrialView"] = 6] = "TrialView";
- ViewType[ViewType["BannerView"] = 7] = "BannerView";
- })(ViewType || (ViewType = {}));
- class ViewManager {
- constructor() {
- this.showexportview = 0;
- this.popViewDic = [];
- this.ViewSprite = new Laya.Sprite();
- this.OtherViewSprite = new Laya.Sprite();
- ViewManager.ins = this;
- Laya.stage.addChild(this.ViewSprite);
- Laya.stage.addChild(this.OtherViewSprite);
- }
- static get Instance() {
- if (ViewManager.ins) {
- return ViewManager.ins;
- }
- else {
- return new ViewManager();
- }
- }
- ShowView(_viewtype, data = null) {
- if (this.curView != null) {
- this.curView.OnHide();
- this.curView.destroy();
- this.curView.removeSelf();
- }
- this.curView = this.CreateView(_viewtype);
- this.curView.name = ViewType[_viewtype];
- this.ViewSprite.addChild(this.curView);
- this.curView.OnShow(data);
- }
- CloseView() {
- if (this.curView != null) {
- this.curView.OnHide();
- this.curView.destroy();
- this.curView.removeSelf();
- }
- }
- OpenPopView(viewType, data = null) {
- var popView;
- if (this.popViewDic[viewType]) {
- popView = this.popViewDic[viewType];
- this.OtherViewSprite.setChildIndex(popView, this.OtherViewSprite.numChildren - 1);
- popView.visible = true;
- }
- else {
- popView = this.CreateView(viewType);
- this.OtherViewSprite.addChild(popView);
- this.popViewDic[viewType] = popView;
- }
- popView.OnOpen(data);
- }
- ClosePopView(viewType) {
- var popView = this.popViewDic[viewType];
- if (popView == null) {
- return;
- }
- popView.OnHide();
- popView.visible = false;
- }
- ClearPopViews() {
- }
- CreateView(_viewtype) {
- switch (_viewtype) {
- case ViewType.InGameView:
- return new InGameView();
- case ViewType.HomeView:
- return new HomeView();
- }
- return null;
- }
- }
- class AssetManager {
- constructor() {
- this.Prop = new Dictionary();
- this.Character = new Dictionary();
- AssetManager.ins = this;
- DispatcherManager.EventOn(EventState.LoadComplete, this, this.Init);
- }
- static get Instance() {
- if (AssetManager.ins == null) {
- return new AssetManager();
- }
- return AssetManager.ins;
- }
- Init() {
- Laya.stage.addChild(this.mainscene);
- this.maincamera = this.mainscene.getChildByName("Main Camera");
- this.maincamera.enableHDR = false;
- CameraManager.Instance.camera = this.maincamera;
- let _sprite = new Laya.Sprite3D();
- this.mainscene.addChild(_sprite);
- LevelManager.Instance.spritepool = _sprite;
- this.SetCharacterPos();
- LevelManager.Instance.RegEvent();
- LevelManager.Instance.GameStart();
- ViewManager.Instance.ShowView(ViewType.HomeView);
- }
- getPref(name) {
- return this.Prop.get(name);
- }
- getRolePref(index) {
- return this.Character.get(index);
- }
- SetCharacterPos() {
- let _level = this.mainscene.getChildByName("level1");
- for (let i = 0; i < _level.numChildren; i++) {
- let item = _level.getChildAt(i);
- if (item.name == "player") {
- this.playerpos = item;
- }
- else if (item.name == "role") {
- let _pref = this.getRolePref(1);
- let _player = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_player);
- _player.transform.position = item.transform.position.clone();
- _player.transform.rotation = item.transform.rotation.clone();
- NodeUtil.SetColliderGroup(_player, 100);
- }
- }
- }
- }
- class LoadView extends ui.LoadViewUI {
- constructor() {
- super();
- this.progressnum = 0;
- this.fast = 0.07;
- this.slow = 0.005;
- this.End = false;
- this.EndProgress = false;
- LoadView.ins = this;
- Laya.stage.addChild(this);
- this.Init();
- }
- static get Instance() {
- if (LoadView.ins == null) {
- return new LoadView();
- }
- return LoadView.ins;
- }
- Init() {
- this.LoadScene();
- Laya.timer.loop(1, this, this.UpdateProgress);
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- UpdateProgress() {
- if (this.progressnum <= 0.7) {
- this.progressnum += this.fast;
- }
- else if (this.progressnum > 0.7 && this.progressnum < 0.99) {
- this.progressnum += this.slow;
- }
- else {
- if (this.End) {
- this.progressnum += this.slow;
- }
- }
- if (!this.EndProgress && this.progressnum >= 1) {
- this.EndProgress = true;
- this.progressnum = 1;
- Laya.timer.clear(this, this.UpdateProgress);
- this.LoadComplete();
- }
- this.jindupro.value = this.progressnum;
- }
- Login() {
- WXSDK.AldEvent("开始登陆");
- window['zzsdkui'].aliEvent('loading', { 'start': true });
- if (Laya.Browser.onWeiXin) {
- this.LoginWx();
- }
- else {
- this.LoginLocal();
- }
- }
- LoginWx() {
- if (Laya.Browser.onWeiXin) {
- WXSDK.DengLu((res) => {
- if (res != "error") {
- WXSDK.AldEvent("微信登陆成功");
- console.log("1微信登录成功:" + res);
- this.LoginLocal();
- }
- else {
- this.LoginWx();
- }
- });
- }
- else {
- this.LoginLocal();
- }
- }
- LoginLocal() {
- ServerManager.Instance.Login(null, Laya.Handler.create(this, this.LoginComplete), Laya.Handler.create(this, this.LoginFail));
- }
- LoginComplete() {
- WXSDK.AldEvent("本地服务器登陆成功");
- console.log("本地服务器登陆成功");
- GuangGao.InitVideo();
- if (Laya.Browser.onWeiXin) {
- this.LoadSubPackage();
- }
- else {
- this.LoadScene();
- }
- }
- LoginFail() {
- console.log("本地服务器登陆失败");
- }
- LoadSubPackage() {
- Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage',
- success: (res) => {
- WXSDK.AldEvent("分包1加载成功");
- this.LoadSubPackage2();
- },
- fail: (res) => {
- this.LoadSubPackage();
- }
- });
- }
- LoadSubPackage2() {
- Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage2',
- success: (res) => {
- WXSDK.AldEvent("分包2加载成功");
- this.LoadScene();
- },
- fail: (res) => {
- this.LoadSubPackage2();
- }
- });
- }
- LoadScene() {
- Laya.Scene3D.load(ResourcesPath.mainscene, Laya.Handler.create(this, (sprite) => {
- this.mainscene = sprite;
- AssetManager.Instance.mainscene = this.mainscene;
- WXSDK.AldEvent("场景资源加载完毕");
- this.LoadRole();
- }));
- console.log("场景资源加载成功");
- }
- LoadRole() {
- var arr = [];
- for (let i = 0; i < ResourcesPath.Character.length; i++) {
- let item = ResourcesPath.Character[i];
- arr.push(item);
- }
- Laya.loader.create(arr, Laya.Handler.create(this, () => {
- for (let i = 0; i < ResourcesPath.Character.length; i++) {
- let model = Laya.loader.getRes(ResourcesPath.Character[i]);
- AssetManager.Instance.Character.set(i + 1, model);
- Laya.loader.clearRes(ResourcesPath.Character[i]);
- }
- console.log("玩家模型加载成功");
- WXSDK.AldEvent("玩家模型加载完毕");
- this.LoadResources();
- }));
- }
- LoadResources() {
- var arr = [];
- for (let i = 0; i < ResourcesPath.Prop.length; i++) {
- let item = ResourcesPath.Prop[i];
- arr.push(item);
- }
- Laya.loader.create(arr, Laya.Handler.create(this, () => {
- arr.forEach(s => {
- if (s.progress == 1) {
- let sp = Laya.loader.getRes(s.url);
- AssetManager.Instance.Prop.set(sp.name, sp);
- }
- else {
- console.log(`[LOG]${s.url}加载失败`);
- }
- }, this);
- console.log("道具模型加载成功");
- WXSDK.AldEvent("道具模型加载完毕");
- this.complete();
- }));
- }
- complete() {
- this.End = true;
- this.slow = this.fast;
- DispatcherManager.EventTrigger(EventState.LoadComplete);
- }
- LoadComplete() {
- this.destroy();
- }
- }
- class Main {
- constructor() {
- if (window["Laya3D"])
- Laya3D.init(GameConfig.width, GameConfig.height);
- else
- Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
- Laya["Physics"] && Laya["Physics"].enable();
- Laya["DebugPanel"] && Laya["DebugPanel"].enable();
- Laya.stage.scaleMode = GameConfig.scaleMode;
- Laya.stage.screenMode = GameConfig.screenMode;
- Laya.stage.alignV = GameConfig.alignV;
- Laya.stage.alignH = GameConfig.alignH;
- Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
- if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
- Laya.enableDebugPanel();
- if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
- Laya["PhysicsDebugDraw"].enable();
- if (GameConfig.stat)
- Laya.Stat.show();
- Laya.alertGlobalError = true;
- Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
- }
- onVersionLoaded() {
- Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
- }
- onConfigLoaded() {
- new LoadView();
- }
- }
- new Main();
- }());
- //# sourceMappingURL=bundle.js.map
|