mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-03-25 08:34:16 +08:00
commitb421082374Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Fri Dec 31 20:26:20 2021 +0800 update specialthanks commit765a69294bAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Dec 14 19:10:03 2021 +0800 fix ios goto commit8eb8c3ca72Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Dec 14 19:03:37 2021 +0800 add event grade commitab705dd46cAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Dec 14 18:48:42 2021 +0800 build version commita1e4232369Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Dec 14 18:47:05 2021 +0800 change talent replace before property allocate commitf4d7b3ae3cAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Dec 14 18:06:18 2021 +0800 add event grade commit0567e40ddcAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 21:28:10 2021 +0800 add particle commitf17003925eAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 20:14:26 2021 +0800 change ui commitf8beda1d8fAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 19:08:30 2021 +0800 change popup message ui commit915a2aa17dAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 18:34:29 2021 +0800 new build commitb5edabc104Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 18:18:46 2021 +0800 add hint message commita143feadafAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 17:57:31 2021 +0800 fix copy bug commiteab1975791Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 17:56:28 2021 +0800 add save/load commitacf9b92134Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Dec 2 14:35:33 2021 +0800 add theme switch commit488a6054abAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Wed Dec 1 18:30:36 2021 +0800 fix uiManager bug commitf0317eaf14Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Wed Dec 1 16:07:03 2021 +0800 add message popup commiteb02d1ee6fAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 21:22:54 2021 +0800 change relocation commit60503eae47Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 19:27:16 2021 +0800 change ScaleButton -> Laya.runtime.ScaleButton commit52ef5909c1Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 19:26:31 2021 +0800 change ScaleButton -> Laya.runtime.ScaleButton commit0284f6aa71Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 19:05:24 2021 +0800 config webpack commit0e272ffd99Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 13:17:41 2021 +0800 add thanks commite1e2ab4701Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 28 11:40:21 2021 +0800 add light theme commit4f55c00f86Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sat Nov 27 22:27:39 2021 +0800 fix bug commit1d07bdfc46Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sat Nov 27 21:48:47 2021 +0800 daily update commit52d6a0ca8fAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Wed Nov 24 23:10:04 2021 +0800 daily update commitf8dd720d4dAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Wed Nov 24 19:08:13 2021 +0800 daily update commitd088c1a862Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 21 21:41:46 2021 +0800 remove useless commita711fcf3edAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Nov 16 00:53:05 2021 +0800 add achievement popup add page adaptive add talent extends commit05e02de3dbAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Sat Nov 13 01:24:04 2021 +0800 add github and discord commitbff0109cc5Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sat Nov 13 00:30:01 2021 +0800 add trajectory auto mode commit54c04f65c2Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Fri Nov 12 19:54:31 2021 +0800 fix property judge negative number bug commit660739530bAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Fri Nov 12 19:48:58 2021 +0800 update achievement commitc94e9e7433Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Thu Nov 11 21:37:45 2021 +0800 update daily commitc06cd9ea62Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Tue Nov 9 00:08:05 2021 +0800 update daily commit2666983f89Author: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 7 23:00:22 2021 +0800 add uiManager auto scan and load skin resource commit22fa5d755aAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Nov 7 22:17:04 2021 +0800 update framework commitf40698d63eAuthor: Vick Scarlet <scarlet_vick@outlook.com> Date: Sun Oct 31 00:13:22 2021 +0800 add laya
1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
!function(t,o){o.un,o.uns;var i=o.static,n=o.class,a=o.getset,d=(o.__newvec,laya.utils.Browser),s=(laya.events.Event,laya.events.EventDispatcher),r=laya.resource.HTMLImage,m=laya.utils.Handler,l=laya.display.Input,p=laya.net.Loader,u=laya.net.LocalStorage,e=(laya.maths.Matrix,laya.renders.Render),c=laya.utils.RunDriver,f=(laya.media.Sound,laya.media.SoundChannel),h=laya.media.SoundManager,w=laya.net.URL,g=laya.utils.Utils,y=(n(v,"laya.wx.mini.MiniAdpter"),v.getJson=function(e){return JSON.parse(e)},v.init=function(e,i){if(void 0===e&&(e=!1),void 0===i&&(i=!1),!v._inited&&(v._inited=!0,(v.window=t).hasOwnProperty("wx")&&!(v.window.navigator.userAgent.indexOf("MiniGame")<0))){v.isZiYu=i,v.isPosMsgYu=e,v.EnvConfig={};try{laya.webgl.resource.WebGLCanvas.premulAlpha=!0}catch(e){}if(v.isZiYu||(_.setNativeFileDir("/layaairGame"),_.existDir(_.fileNativeDir,m.create(v,v.onMkdirCallBack))),"ios 10.1.1"===(v.systemInfo=v.window.wx.getSystemInfoSync()).system.toLowerCase())try{laya.webgl.resource.WebGLCharImage.canUseCanvas=!1}catch(e){}v.window.focus=function(){},o._getUrlPath=function(){},o.getUrlPath=function(){},v.window.logtime=function(e){},v.window.alertTimeLog=function(e){},v.window.resetShareInfo=function(){},v.window.CanvasRenderingContext2D=function(){},v.window.CanvasRenderingContext2D.prototype=v.window.wx.createCanvas().getContext("2d").__proto__,v.window.document.body.appendChild=function(){},v.EnvConfig.pixelRatioInt=0,c.getPixelRatio=v.pixelRatio,v._preCreateElement=d.createElement,d.createElement=v.createElement,c.createShaderCondition=v.createShaderCondition,g.parseXMLFromString=v.parseXMLFromString,l._createInputElement=E._createInputElement,v.EnvConfig.load=p.prototype.load,p.prototype.load=S.prototype.load,p.prototype._loadImage=F.prototype._loadImage,(u._baseClass=b).__init__(),v.onReciveData()}},v.onReciveData=function(){laya.wx.mini.MiniAdpter.isZiYu&&v.window.wx.onMessage(function(e){"opendatacontext"==e.isLoad?e.url&&(_.ziyuFileData[e.url]=e.atlasdata,_.ziyuFileTextureData[e.imgReadyUrl]=e.imgNativeUrl):"openJsondatacontext"==e.isLoad?e.url&&(_.ziyuFileData[e.url]=e.atlasdata):"openJsondatacontextPic"==e.isLoad&&(_.ziyuFileTextureData[e.imgReadyUrl]=e.imgNativeUrl)})},v.measureText=function(e){e=v._measureText(e);return e||(e={width:16},console.warn("-------微信获取文字宽度失败----等待修复---------")),e},v.getUrlEncode=function(e,i){return"arraybuffer"==i?"":"utf8"},v.downLoadFile=function(e,i,t,n){void 0===i&&(i=""),void 0===n&&(n="utf8"),_.getFileInfo(e)?null!=t&&t.runWith([0]):_.downLoadFile(e,i,t,n)},v.remove=function(e,i){_.deleteFile("",e,i,"",0)},v.removeAll=function(){_.deleteAll()},v.hasNativeFile=function(e){return _.isLocalNativeFile(e)},v.getFileInfo=function(e){return _.getFileInfo(e)},v.getFileList=function(){return _.filesListObj},v.exitMiniProgram=function(){v.window.wx.exitMiniProgram()},v.onMkdirCallBack=function(e,i){e||(_.filesListObj=JSON.parse(i.data),_.fakeObj=JSON.parse(i.data))},v.pixelRatio=function(){if(!v.EnvConfig.pixelRatioInt)try{return v.EnvConfig.pixelRatioInt=v.systemInfo.pixelRatio,v.systemInfo.pixelRatio}catch(e){}return v.EnvConfig.pixelRatioInt},v.createElement=function(e){var i;if("canvas"==e)return 1==v.idx?v.isZiYu?(i=v.window.sharedCanvas).style={}:i=v.window.canvas:i=v.window.wx.createCanvas(),v.idx++,i;if("textarea"==e||"input"==e)return v.onCreateInput(e);if("div"!=e)return v._preCreateElement(e);e=v._preCreateElement(e);return e.contains=function(e){return null},e.removeChild=function(e){},e},v.onCreateInput=function(e){e=v._preCreateElement(e);return e.focus=E.wxinputFocus,e.blur=E.wxinputblur,e.style={},e.value=0,e.parentElement={},e.placeholder={},e.type={},e.setColor=function(e){},e.setType=function(e){},e.setFontFace=function(e){},e.addEventListener=function(e){},e.contains=function(e){return null},e.removeChild=function(e){},e},v.createShaderCondition=function(e){var i=this;return function(){return i[e.replace("this.","")]}},v.sendAtlasToOpenDataContext=function(e){if(!laya.wx.mini.MiniAdpter.isZiYu){var i=p.getRes(w.formatURL(e));if(!i)throw"传递的url没有获取到对应的图集数据信息,请确保图集已经过!";i.meta.image.split(",");if(i.meta&&i.meta.image)for(var t=i.meta.image.split(","),n=0<=e.indexOf("/")?"/":"\\",n=e.lastIndexOf(n),o=0<=n?e.substr(0,n+1):"",a=0,l=t.length;a<l;a++)t[a]=o+t[a];else t=[e.replace(".json",".png")];for(a=0;a<t.length;a++){var s=t[a];v.postInfoToContext(e,s,i)}}},v.postInfoToContext=function(e,i,t){var n={frames:t.frames,meta:t.meta},t=i,i=_.getFileInfo(w.formatURL(i)),o=i?(o=i.md5,_.getFileNativePath(o)):t;if(!o)throw"获取图集的磁盘url路径不存在!";v.window.wx.postMessage({url:e,atlasdata:n,imgNativeUrl:o,imgReadyUrl:t,isLoad:"opendatacontext"})},v.sendSinglePicToOpenDataContext=function(e){var i,t=w.formatURL(e),n=_.getFileInfo(t);if(n?(i=n.md5,i=_.getFileNativePath(i),e=t):i=e,!i)throw"获取图集的磁盘url路径不存在!";v.window.wx.postMessage({url:e,imgNativeUrl:i,imgReadyUrl:e,isLoad:"openJsondatacontextPic"})},v.sendJsonDataToDataContext=function(e){if(!laya.wx.mini.MiniAdpter.isZiYu){var i=p.getRes(e);if(!i)throw"传递的url没有获取到对应的图集数据信息,请确保图集已经过!";v.window.wx.postMessage({url:e,atlasdata:i,isLoad:"openJsondatacontext"})}},v.EnvConfig=null,v.window=null,v._preCreateElement=null,v._inited=!1,v.systemInfo=null,v.isZiYu=!1,v.isPosMsgYu=!1,v.autoCacheFile=!0,v.minClearSize=5242880,v.subNativeFiles=null,v.subNativeheads=[],v.subMaps=[],v.AutoCacheDownFile=!1,v._measureText=null,v.parseXMLFromString=function(e){var i;e=e.replace(/>\s+</g,"><");try{i=(new t.Parser.DOMParser).parseFromString(e,"text/xml")}catch(e){throw"需要引入xml解析库文件"}return i},v.idx=1,i(v,["nativefiles",function(){return this.nativefiles=["layaNativeDir","wxlocal"]}]),v);function v(){}var _=(n(x,"laya.wx.mini.MiniFileMgr"),x.isLocalNativeFile=function(e){for(var i=0,t=y.nativefiles.length;i<t;i++)if(-1!=e.indexOf(y.nativefiles[i]))return!0;return!1},x.getFileInfo=function(e){e=x.fakeObj[e];return null==e?null:e},x.read=function(e,i,t,n,o,a){void 0===i&&(i="utf8"),void 0===o&&(o=!1),void 0===a&&(a=""),e=""==(n=void 0===n?"":n)||-1==n.indexOf("http://")&&-1==n.indexOf("https://")?e:x.getFileNativePath(e),x.fs.readFile({filePath:e,encoding:i,success:function(e){null!=t&&t.runWith([0,e])},fail:function(e){e&&""!=n?x.downFiles(n,i,t,n,o,a):null!=t&&t.runWith([1])}})},x.downFiles=function(i,t,n,o,a,l,s){void 0===t&&(t="ascii"),void 0===o&&(o=""),void 0===a&&(a=!1),void 0===l&&(l=""),void 0===s&&(s=!0),x.wxdown({url:i,success:function(e){200===e.statusCode?x.readFile(e.tempFilePath,t,n,o,a,l,s):403===e.statusCode?null!=n&&n.runWith([0,i]):null!=n&&n.runWith([1,e])},fail:function(e){null!=n&&n.runWith([1,e])}}).onProgressUpdate(function(e){null!=n&&n.runWith([2,e.progress])})},x.readFile=function(i,t,n,o,a,e,l){void 0===o&&(o=""),void 0===a&&(a=!1),void 0===e&&(e=""),void 0===l&&(l=!0),x.fs.readFile({filePath:i,encoding:t=void 0===t?"utf8":t,success:function(e){(-1!=i.indexOf("http://")||-1!=i.indexOf("https://"))&&(y.autoCacheFile||a)?(null!=n&&n.runWith([0,e]),x.copyFile(i,o,null,t,l)):null!=n&&n.runWith([0,e])},fail:function(e){e&&null!=n&&n.runWith([1,e])}})},x.downOtherFiles=function(e,i,t,n,o){void 0===t&&(t=""),void 0===n&&(n=!1),void 0===o&&(o=!0),x.wxdown({url:e,success:function(e){200===e.statusCode?(y.autoCacheFile||n)&&-1==t.indexOf("wx.qlogo.cn")&&-1==t.indexOf(".php")?(null!=i&&i.runWith([0,e.tempFilePath]),x.copyFile(e.tempFilePath,t,null,"",o)):null!=i&&i.runWith([0,e.tempFilePath]):null!=i&&i.runWith([1,e])},fail:function(e){null!=i&&i.runWith([1,e])}})},x.downLoadFile=function(e,i,t,n){void 0===i&&(i=""),void 0===n&&(n="ascii"),y.window.navigator.userAgent.indexOf("MiniGame")<0?o.loader.load(e,t):"image"==i||"sound"==i?x.downOtherFiles(e,t,e,!0,!1):x.downFiles(e,n,t,e,!0,i,!1)},x.copyFile=function(t,n,o,a,l){void 0===a&&(a=""),void 0===l&&(l=!0);var e=t.split("/"),s=e[e.length-1],e=x.getFileInfo(n),r=x.getFileNativePath(s);x.fakeObj[n]={md5:s,readyUrl:n,size:0,times:d.now(),encoding:a};var u=x.getCacheUseSize();e?e.readyUrl!=n?x.fs.getFileInfo({filePath:t,success:function(e){l&&52428800<=u+4194304+e.size&&(e.size>y.minClearSize&&(y.minClearSize=e.size),x.onClearCacheRes()),x.deleteFile(t,n,o,a,e.size)},fail:function(e){null!=o&&o.runWith([1,e])}}):null!=o&&o.runWith([0]):x.fs.getFileInfo({filePath:t,success:function(i){l&&52428800<=u+4194304+i.size&&(i.size>y.minClearSize&&(y.minClearSize=i.size),x.onClearCacheRes()),x.fs.copyFile({srcPath:t,destPath:r,success:function(e){x.onSaveFile(n,s,!0,a,o,i.size)},fail:function(e){null!=o&&o.runWith([1,e])}})},fail:function(e){null!=o&&o.runWith([1,e])}})},x.onClearCacheRes=function(){var e,i=y.minClearSize,t=[];for(e in x.filesListObj)"fileUsedSize"!=e&&t.push(x.filesListObj[e]);x.sortOn(t,"times",16);for(var n=0,o=1,a=t.length;o<a;o++){var l=t[o];if(i<=n)break;n+=l.size,x.deleteFile("",l.readyUrl)}},x.sortOn=function(e,t,i){return 16==(i=void 0===i?0:i)?e.sort(function(e,i){return e[t]-i[t]}):18==i?e.sort(function(e,i){return i[t]-e[t]}):e.sort(function(e,i){return e[t]-i[t]})},x.getFileNativePath=function(e){return laya.wx.mini.MiniFileMgr.fileNativeDir+"/"+e},x.deleteFile=function(n,o,a,l,s){void 0===l&&(l=""),void 0===s&&(s=0);var e=x.getFileInfo(o=void 0===o?"":o),e=x.getFileNativePath(e.md5);x.fs.unlink({filePath:e,success:function(e){var i,t=""!=n;""!=n?(i=x.getFileNativePath(n),x.fs.copyFile({srcPath:n,destPath:i,success:function(e){x.onSaveFile(o,n,t,l,a,e.size)},fail:function(e){null!=a&&a.runWith([1,e])}})):x.onSaveFile(o,n,t,l,a,s)},fail:function(e){}})},x.deleteAll=function(){var e,i=[];for(e in x.filesListObj)i.push(x.filesListObj[e]);for(var t=1,n=i.length;t<n;t++){var o=i[t];x.deleteFile("",o.readyUrl)}laya.wx.mini.MiniFileMgr.filesListObj&&laya.wx.mini.MiniFileMgr.filesListObj.fileUsedSize&&(laya.wx.mini.MiniFileMgr.filesListObj.fileUsedSize=0),laya.wx.mini.MiniFileMgr.writeFilesList("",JSON.stringify({}),!1)},x.onSaveFile=function(e,i,t,n,o,a){void 0===t&&(t=!0),void 0===n&&(n=""),void 0===a&&(a=0);var l=e;null==x.filesListObj.fileUsedSize&&(x.filesListObj.fileUsedSize=0),t?(x.getFileNativePath(i),x.filesListObj[l]={md5:i,readyUrl:e,size:a,times:d.now(),encoding:n},x.filesListObj.fileUsedSize=parseInt(x.filesListObj.fileUsedSize)+a,x.writeFilesList(l,JSON.stringify(x.filesListObj),!0),null!=o&&o.runWith([0])):x.filesListObj[l]&&(a=parseInt(x.filesListObj[l].size),x.filesListObj.fileUsedSize=parseInt(x.filesListObj.fileUsedSize)-a,x.fakeObj[l].md5==x.filesListObj[l].md5&&delete x.fakeObj[l],delete x.filesListObj[l],x.writeFilesList(l,JSON.stringify(x.filesListObj),!1),null!=o&&o.runWith([0]))},x.writeFilesList=function(e,i,t){x.fs.writeFile({filePath:x.fileNativeDir+"/"+x.fileListName,encoding:"utf8",data:i,success:function(e){},fail:function(e){}}),!y.isZiYu&&y.isPosMsgYu&&y.window.wx.postMessage&&y.window.wx.postMessage({url:e,data:x.filesListObj[e],isLoad:"filenative",isAdd:t})},x.getCacheUseSize=function(){return x.filesListObj&&x.filesListObj.fileUsedSize?x.filesListObj.fileUsedSize:0},x.existDir=function(e,i){x.fs.mkdir({dirPath:e,success:function(e){null!=i&&i.runWith([0,{data:JSON.stringify({})}])},fail:function(e){-1!=e.errMsg.indexOf("file already exists")?x.readSync(x.fileListName,"utf8",i):null!=i&&i.runWith([1,e])}})},x.readSync=function(e,i,t,n){void 0===i&&(i="utf8"),void 0===n&&(n="");var o,e=x.getFileNativePath(e);try{o=x.fs.readFileSync(e,i),null!=t&&t.runWith([0,{data:o}])}catch(e){null!=t&&t.runWith([1])}},x.setNativeFileDir=function(e){x.fileNativeDir=y.window.wx.env.USER_DATA_PATH+e},x.filesListObj={},x.fakeObj={},x.fileNativeDir=null,x.fileListName="layaairfiles.txt",x.ziyuFileData={},x.ziyuFileTextureData={},x.loadPath="",x.DESCENDING=2,x.NUMERIC=16,i(x,["fs",function(){return this.fs=y.window.wx.getFileSystemManager()},"wxdown",function(){return this.wxdown=y.window.wx.downloadFile}]),x);function x(){}var F=(n(C,"laya.wx.mini.MiniImage"),C.prototype._loadImage=function(e){var i=this;if(y.isZiYu)C.onCreateImage(e,i,!0);else{var t,n,o=!1;if(_.isLocalNativeFile(e)){if(-1==e.indexOf("http://")&&-1==e.indexOf("https://")||(e=""!=_.loadPath?e.split(_.loadPath)[1]:(n=e,(e=""!=(t=""!=w.rootPath?w.rootPath:w.basePath)?e.split(t)[1]:e)||n)),y.subNativeFiles&&0==y.subNativeheads.length)for(var a in y.subNativeFiles){var l=y.subNativeFiles[a];y.subNativeheads=y.subNativeheads.concat(l);for(var s=0;s<l.length;s++)y.subMaps[l[s]]=a+"/"+l[s]}!y.subNativeFiles||-1==e.indexOf("/")||(t=e.split("/")[0]+"/")&&-1!=y.subNativeheads.indexOf(t)&&(n=y.subMaps[t],e=e.replace(t,n))}else o=!0,e=w.formatURL(e);_.getFileInfo(e)?C.onCreateImage(e,i,!o):-1==e.indexOf("http://")&&-1==e.indexOf("https://")||y.isZiYu?C.onCreateImage(e,i,!0):_.downOtherFiles(e,new m(C,C.onDownImgCallBack,[e,i]),e)}},C.onDownImgCallBack=function(e,i,t,n){void 0===n&&(n=""),t?i.onError(null):C.onCreateImage(e,i,!1,n)},C.onCreateImage=function(i,t,e,n){var o,a,l;function s(){l.onload=null,l.onerror=null,delete t.imgCache[i]}void 0===e&&(e=!1),void 0===n&&(n=""),a=y.autoCacheFile?e?y.isZiYu?(o=w.formatURL(i),_.ziyuFileTextureData[o]||i):i:""!=n?n:(a=_.getFileInfo(i).md5,_.getFileNativePath(a)):e?i:n,null==t.imgCache&&(t.imgCache={});e=function(){s(),t.onLoaded(l)},n=function(){s(),delete _.filesListObj[i],delete _.fakeObj[i],t.event("error","Load image failed")};"nativeimage"==t._type?((l=new d.window.Image).crossOrigin="",l.onload=e,l.onerror=n,l.src=a,t.imgCache[i]=l):new r.create(a,{onload:e,onerror:n,onCreate:function(e){l=e,t.imgCache[i]=e}})},C);function C(){}var E=(n(L,"laya.wx.mini.MiniInput"),L._createInputElement=function(){l._initInput(l.area=d.createElement("textarea")),l._initInput(l.input=d.createElement("input")),l.inputContainer=d.createElement("div"),l.inputContainer.style.position="absolute",l.inputContainer.style.zIndex=1e5,d.container.appendChild(l.inputContainer),l.inputContainer.setPos=function(e,i){l.inputContainer.style.left=e+"px",l.inputContainer.style.top=i+"px"},o.stage.on("resize",null,L._onStageResize),wx.onWindowResize&&wx.onWindowResize(function(e){t.dispatchEvent&&t.dispatchEvent("resize")}),h._soundClass=I,h._musicClass=I;var e=y.systemInfo.model,i=y.systemInfo.system;-1!=e.indexOf("iPhone")&&(d.onIPhone=!0,d.onIOS=!0,d.onIPad=!0,d.onAndroid=!1),-1==i.indexOf("Android")&&-1==i.indexOf("Adr")||(d.onAndroid=!0,d.onIPhone=!1,d.onIOS=!1,d.onIPad=!1)},L._onStageResize=function(){o.stage._canvasTransform.identity().scale(d.width/e.canvas.width/c.getPixelRatio(),d.height/e.canvas.height/c.getPixelRatio())},L.wxinputFocus=function(e){var i=l.inputElement.target;i&&!i.editable||(y.window.wx.offKeyboardConfirm(),y.window.wx.offKeyboardInput(),y.window.wx.showKeyboard({defaultValue:i.text,maxLength:i.maxChars,multiple:i.multiline,confirmHold:!0,confirmType:"done",success:function(e){},fail:function(e){}}),y.window.wx.onKeyboardConfirm(function(e){e=e?e.value:"";i.text=e,i.event("input"),laya.wx.mini.MiniInput.inputEnter()}),y.window.wx.onKeyboardInput(function(e){e=e?e.value:"";i.multiline||-1==e.indexOf("\n")?(i.text=e,i.event("input")):laya.wx.mini.MiniInput.inputEnter()}))},L.inputEnter=function(){l.inputElement.target.focus=!1},L.wxinputblur=function(){L.hideKeyboard()},L.hideKeyboard=function(){y.window.wx.offKeyboardConfirm(),y.window.wx.offKeyboardInput(),y.window.wx.hideKeyboard({success:function(e){console.log("隐藏键盘")},fail:function(e){console.log("隐藏键盘出错:"+(e?e.errMsg:""))}})},L);function L(){}var b=(n(O,"laya.wx.mini.MiniLocalStorage"),O.__init__=function(){O.items=O},O.setItem=function(i,t){try{wx.setStorageSync(i,t)}catch(e){wx.setStorage({key:i,data:t})}},O.getItem=function(e){return wx.getStorageSync(e)},O.setJSON=function(e,i){O.setItem(e,i)},O.getJSON=function(e){return O.getItem(e)},O.removeItem=function(e){wx.removeStorageSync(e)},O.clear=function(){wx.clearStorageSync()},O.getStorageInfoSync=function(){try{var e=wx.getStorageInfoSync();return console.log(e.keys),console.log(e.currentSize),console.log(e.limitSize),e}catch(e){}return null},O.support=!0,O.items=null,O);function O(){}n(P,"laya.wx.mini.MiniLocation"),P.__init__=function(){y.window.navigator.geolocation.getCurrentPosition=P.getCurrentPosition,y.window.navigator.geolocation.watchPosition=P.watchPosition,y.window.navigator.geolocation.clearWatch=P.clearWatch},P.getCurrentPosition=function(i,e,t){var n;(n={success:function(e){null!=i&&i(e)}}).fail=e,y.window.wx.getLocation(n)},P.watchPosition=function(e,i,t){var n;return P._curID++,(n={}).success=e,n.error=i,P._watchDic[P._curID]=n,o.timer.loop(1e3,null,P._myLoop),P._curID},P.clearWatch=function(e){delete P._watchDic[e],P._hasWatch()||o.timer.clear(null,P._myLoop)},P._hasWatch=function(){for(var e in P._watchDic)if(P._watchDic[e])return!0;return!1},P._myLoop=function(){P.getCurrentPosition(P._mySuccess,P._myError)},P._mySuccess=function(e){var i,t={};for(i in t.coords=e,t.timestamp=d.now(),P._watchDic)P._watchDic[i].success&&P._watchDic[i].success(t)},P._myError=function(e){for(var i in P._watchDic)P._watchDic[i].error&&P._watchDic[i].error(e)},P._watchDic={},P._curID=0;function P(){}(function(){function e(e,i){this.videoend=!1,this.videourl="",this.videoElement=null,this.onPlayFunc=null,this.onEndedFunC=null,this._duration=NaN,this.position=NaN,this.videoElement=y.window.wx.createVideo({width:e=void 0===e?320:e,height:i=void 0===i?240:i,autoplay:!0})}n(e,"laya.wx.mini.MiniVideo");var i=e.prototype;i.on=function(e,i,t){"loadedmetadata"==e?(this.onPlayFunc=t.bind(i),this.videoElement.onPlay=this.onPlayFunction.bind(this)):"ended"==e&&(this.onEndedFunC=t.bind(i),this.videoElement.onEnded=this.onEndedFunction.bind(this)),this.videoElement.onTimeUpdate=this.onTimeUpdateFunc.bind(this)},i.onTimeUpdateFunc=function(e){this.position=e.position,this._duration=e.duration},i.onPlayFunction=function(){this.videoElement&&(this.videoElement.readyState=200),console.log("=====视频加载完成========"),null!=this.onPlayFunc&&this.onPlayFunc()},i.onEndedFunction=function(){this.videoElement&&(this.videoend=!0,console.log("=====视频播放完毕========"),null!=this.onEndedFunC&&this.onEndedFunC())},i.off=function(e,i,t){"loadedmetadata"==e?(this.onPlayFunc=t.bind(i),this.videoElement.offPlay=this.onPlayFunction.bind(this)):"ended"==e&&(this.onEndedFunC=t.bind(i),this.videoElement.offEnded=this.onEndedFunction.bind(this))},i.load=function(e){this.videoElement&&(this.videoElement.src=e)},i.play=function(){this.videoElement&&(this.videoend=!1,this.videoElement.play())},i.pause=function(){this.videoElement&&(this.videoend=!0,this.videoElement.pause())},i.size=function(e,i){this.videoElement&&(this.videoElement.width=e,this.videoElement.height=i)},i.destroy=function(){this.videoElement&&this.videoElement.destroy(),this.videoElement=null,this.onEndedFunC=null,this.onPlayFunc=null,this.videoend=!1,this.videourl=null},i.reload=function(){this.videoElement&&(this.videoElement.src=this.videourl)},a(0,i,"duration",function(){return this._duration}),a(0,i,"paused",function(){return!!this.videoElement&&this.videoElement.paused}),a(0,i,"loop",function(){return!!this.videoElement&&this.videoElement.loop},function(e){this.videoElement&&(this.videoElement.loop=e)}),a(0,i,"currentTime",function(){return this.videoElement?this.videoElement.initialTime:0},function(e){this.videoElement&&(this.videoElement.initialTime=e)}),a(0,i,"ended",function(){return this.videoend}),a(0,i,"muted",function(){return!!this.videoElement&&this.videoElement.muted},function(e){this.videoElement&&(this.videoElement.muted=e)}),a(0,i,"videoWidth",function(){return this.videoElement?this.videoElement.width:0}),a(0,i,"videoHeight",function(){return this.videoElement?this.videoElement.height:0}),a(0,i,"playbackRate",function(){return this.videoElement?this.videoElement.playbackRate:0},function(e){this.videoElement&&(this.videoElement.playbackRate=e)}),a(0,i,"x",function(){return this.videoElement?this.videoElement.x:0},function(e){this.videoElement&&(this.videoElement.x=e)}),a(0,i,"y",function(){return this.videoElement?this.videoElement.y:0},function(e){this.videoElement&&(this.videoElement.y=e)}),a(0,i,"currentSrc",function(){return this.videoElement.src}),e.__init__=function(){laya.device.media.Video=e}})(),function(o){function a(){a.__super.call(this)}n(a,"laya.wx.mini.MiniAccelerator",o);var e=a.prototype;e.on=function(e,i,t,n){return o.prototype.on.call(this,e,i,t,n),a.startListen(this.onDeviceOrientationChange),this},e.off=function(e,i,t,n){return void 0===n&&(n=!1),this.hasListener(e)||a.stopListen(),o.prototype.off.call(this,e,i,t,n)},a.__init__=function(){try{var e=laya.device.motion.Accelerator;if(!e)return;e.prototype.on=a.prototype.on,e.prototype.off=a.prototype.off}catch(e){}},a.startListen=function(e){if(a._callBack=e,!a._isListening){a._isListening=!0;try{y.window.wx.onAccelerometerChange(laya.wx.mini.MiniAccelerator.onAccelerometerChange)}catch(e){}}},a.stopListen=function(){a._isListening=!1;try{y.window.wx.stopAccelerometer({})}catch(e){}},a.onAccelerometerChange=function(e){var i={};i.acceleration=e,i.accelerationIncludingGravity=e,i.rotationRate={},null!=a._callBack&&a._callBack(i)},a._isListening=!1,a._callBack=null}(s);var S=function(){function v(){v.__super.call(this)}n(v,"laya.wx.mini.MiniLoader",s);var e=v.prototype;return e.load=function(e,i,t,n,o){void 0===t&&(t=!0),void 0===o&&(o=!1);var a=this;if(0===(a._url=e).indexOf("data:image")?a._type=i="image":a._type=i=i||a.getTypeFromUrl(e),a._cache=t,a._data=null,!o&&p.loadedMap[w.formatURL(e)])return a._data=p.loadedMap[w.formatURL(e)],this.event("progress",1),void this.event("complete",a._data);if(null!=p.parserMap[i])return a._customParse=!0,void(p.parserMap[i]instanceof laya.utils.Handler?p.parserMap[i].runWith(this):p.parserMap[i].call(null,this));var l=y.getUrlEncode(e,i),s=g.getFileExtension(e);if(-1!=v._fileTypeArr.indexOf(s)||"image"==i)y.EnvConfig.load.call(this,e,i,t,n,o);else if(y.isZiYu&&!_.ziyuFileData[e]&&(e=w.formatURL(e)),y.isZiYu&&_.ziyuFileData[e]){s=_.ziyuFileData[e];a.onLoaded(s)}else if(_.getFileInfo(w.formatURL(e))){var r=_.getFileInfo(w.formatURL(e));r.encoding=null==r.encoding?"utf8":r.encoding;var u=_.getFileNativePath(r.md5);_.readFile(u,r.encoding,new m(v,v.onReadNativeCallBack,[l,e,i,t,n,o,a]),w.formatURL(e))}else{if(_.isLocalNativeFile(e)){if(y.subNativeFiles&&0==y.subNativeheads.length)for(var d in y.subNativeFiles){var c=y.subNativeFiles[d];y.subNativeheads=y.subNativeheads.concat(c);for(var f=0;f<c.length;f++)y.subMaps[c[f]]=d+"/"+c[f]}return!y.subNativeFiles||-1==e.indexOf("/")||(u=e.split("/")[0]+"/")&&-1!=y.subNativeheads.indexOf(u)&&(h=y.subMaps[u],e=e.replace(u,h)),void("sound"==i?a._loadSound(e):_.read(e,l,new m(v,v.onReadNativeCallBack,[l,e,i,t,n,o,a])))}var h=e;-1!=w.formatURL(e).indexOf(y.window.wx.env.USER_DATA_PATH)||-1==e.indexOf("http://")&&-1==e.indexOf("https://")||y.AutoCacheDownFile?(r=_.getFileInfo(e))?(r.encoding=null==r.encoding?"utf8":r.encoding,_.readFile(r.url,l,new m(v,v.onReadNativeCallBack,[l,e,i,t,n,o,a]),e)):"image"==a.type||"htmlimage"==a.type?y.EnvConfig.load.call(a,e,i,t,n,o):(e=w.formatURL(e),"image"!=i&&(-1==e.indexOf("http://")&&-1==e.indexOf("https://")||_.isLocalNativeFile(e))?_.readFile(e,l,new m(v,v.onReadNativeCallBack,[l,e,i,t,n,o,a]),e):_.downFiles(e,l,new m(v,v.onReadNativeCallBack,[l,e,i,t,n,o,a]),e,!0)):"sound"==i?a._loadSound(e):y.EnvConfig.load.call(a,h,i,t,n,o)}},e._loadSound=function(e){var i,t,n;_.isLocalNativeFile(e)?(t=e,n=(n=""==(i=""!=w.rootPath?w.rootPath:w.basePath)||-1==e.indexOf("http://")&&-1==e.indexOf("https://")?n:e.split(i)[1])||t,laya.wx.mini.MiniLoader.onDownLoadCallBack(e,this,0)):(n=w.formatURL(e),!_.isLocalNativeFile(e)&&-1==n.indexOf("http://")&&-1==n.indexOf("https://")||-1!=n.indexOf(y.window.wx.env.USER_DATA_PATH)?laya.wx.mini.MiniLoader.onDownLoadCallBack(e,this,0):_.downOtherFiles(encodeURI(n),m.create(v,laya.wx.mini.MiniLoader.onDownLoadCallBack,[n,this]),n))},v.onDownLoadCallBack=function(e,i,t,n){var o,a;t?i.event("error","Load sound failed"):(e=a=y.autoCacheFile?n||(_.isLocalNativeFile(e)?(o=e,(a=""==(n=""!=w.rootPath?w.rootPath:w.basePath)||-1==e.indexOf("http://")&&-1==e.indexOf("https://")?a:e.split(n)[1])||o):(o=_.getFileInfo(e))&&o.md5?(o=o.md5,_.getFileNativePath(o)):e):a,(a=new h._soundClass).load(encodeURI(e)),i.onLoaded(a))},v.onReadNativeCallBack=function(e,i,t,n,o,a,l,s,r){void 0===n&&(n=!0),void 0===a&&(a=!1),(s=void 0===s?0:s)?1==s&&(console.log("-----------本地加载失败,尝试外网加载----url:"+i),y.EnvConfig.load.call(l,i,t,n,o,a)):(r="json"==t||"atlas"==t?y.getJson(r.data):"xml"==t?g.parseXMLFromString(r.data):r.data,!y.isZiYu&&y.isPosMsgYu&&"arraybuffer"!=t&&y.window.wx&&y.window.wx.postMessage({url:i,data:r,isLoad:"filedata"}),l.onLoaded(r))},i(v,["_fileTypeArr",function(){return this._fileTypeArr=["png","jpg","bmp","jpeg","gif"]}]),v}(),I=function(){function l(){this._sound=null,this.url=null,this.loaded=!1,this.readyUrl=null,l.__super.call(this)}n(l,"laya.wx.mini.MiniSound",s);var e=l.prototype;return e.load=function(e){if(_.isLocalNativeFile(e)?-1==e.indexOf("http://")&&-1==e.indexOf("https://")||(""!=_.loadPath?e=e.split(_.loadPath)[1]:""!=(i=""!=w.rootPath?w.rootPath:w.basePath)&&(e=e.split(i)[1])):e=w.formatURL(e),this.url=e,this.readyUrl=e,l._audioCache[this.readyUrl])this.event("complete");else if(y.autoCacheFile&&_.getFileInfo(e))this.onDownLoadCallBack(e,0);else if(y.autoCacheFile)if(_.isLocalNativeFile(e)){var i,t=e;if(e=(e=""!=(i=""!=w.rootPath?w.rootPath:w.basePath)?e.split(i)[1]:e)||t,y.subNativeFiles&&0==y.subNativeheads.length)for(var n in y.subNativeFiles){var o=y.subNativeFiles[n];y.subNativeheads=y.subNativeheads.concat(o);for(var a=0;a<o.length;a++)y.subMaps[o[a]]=n+"/"+o[a]}!y.subNativeFiles||-1==e.indexOf("/")||(i=e.split("/")[0]+"/")&&-1!=y.subNativeheads.indexOf(i)&&(t=y.subMaps[i],e=e.replace(i,t)),this.onDownLoadCallBack(e,0)}else _.downOtherFiles(encodeURI(e),m.create(this,this.onDownLoadCallBack,[e]),e);else this.onDownLoadCallBack(e,0)},e.onDownLoadCallBack=function(e,i){var t,n;i?this.event("error"):(y.autoCacheFile?(t=_.isLocalNativeFile(e)?(n=e,(t=""==(i=""!=w.rootPath?w.rootPath:w.basePath)||-1==e.indexOf("http://")&&-1==e.indexOf("https://")?t:e.split(i)[1])||n):(n=_.getFileInfo(e))&&n.md5?(n=n.md5,_.getFileNativePath(n)):encodeURI(e),this._sound=l._createSound(),this._sound.src=this.url=t):(this._sound=l._createSound(),this._sound.src=encodeURI(e)),this._sound.onCanplay(l.bindToThis(this.onCanPlay,this)),this._sound.onError(l.bindToThis(this.onError,this)))},e.onError=function(e){this.event("error"),this._sound.offError(null)},e.onCanPlay=function(){this.loaded=!0,this.event("complete"),this._sound.offCanplay(null)},e.play=function(e,i){var t;void 0===e&&(e=0),void 0===i&&(i=0),n=this.url==h._tMusic?(l._musicAudio||(l._musicAudio=l._createSound()),l._musicAudio):l._audioCache[this.readyUrl]?l._audioCache[this.readyUrl]._sound:l._createSound(),y.autoCacheFile&&_.getFileInfo(this.url)?(t=_.getFileInfo(this.url).md5,n.src=this.url=_.getFileNativePath(t)):n.src=encodeURI(this.url);var n=new N(n,this);return n.url=this.url,n.loops=i,n.loop=0===i,n.startTime=e,n.play(),h.addChannel(n),n},e.dispose=function(){var e=l._audioCache[this.readyUrl];e&&(e.src="",e._sound&&(e._sound.destroy(),e._sound=null,e=null),delete l._audioCache[this.readyUrl]),this._sound&&(this._sound.destroy(),this._sound=null),this.url=this.readyUrl=null},a(0,e,"duration",function(){return this._sound.duration}),l._createSound=function(){return l._id++,y.window.wx.createInnerAudioContext()},l.bindToThis=function(e,i){return e.bind(i)},l._musicAudio=null,l._id=0,l._audioCache={},l}(),N=function(){function t(e,i){this._audio=null,this._onEnd=null,this._miniSound=null,t.__super.call(this),this._audio=e,this._miniSound=i,this._onEnd=t.bindToThis(this.__onEnd,this),e.onEnded(this._onEnd)}n(t,"laya.wx.mini.MiniSoundChannel",f);var e=t.prototype;return e.__onEnd=function(){if(1==this.loops)return this.completeHandler&&(o.timer.once(10,this,this.__runComplete,[this.completeHandler],!1),this.completeHandler=null),this.stop(),void this.event("complete");0<this.loops&&this.loops--,this.startTime=0,this.play()},e.play=function(){this.isStopped=!1,h.addChannel(this),this._audio.play()},e.stop=function(){this.isStopped=!0,h.removeChannel(this),this.completeHandler=null,this._audio&&(this._audio.stop(),this._audio.offEnded(null),this._audio.destroy(),this._audio=null,this._miniSound=null,this._onEnd=null)},e.pause=function(){this.isStopped=!0,this._audio.pause()},e.resume=function(){this._audio&&(this.isStopped=!1,h.addChannel(this),this._audio.play())},a(0,e,"startTime",null,function(e){this._audio&&(this._audio.startTime=e)}),a(0,e,"autoplay",function(){return this._audio.autoplay},function(e){this._audio.autoplay=e}),a(0,e,"position",function(){return this._audio?this._audio.currentTime:0}),a(0,e,"duration",function(){return this._audio?this._audio.duration:0}),a(0,e,"loop",function(){return this._audio.loop},function(e){this._audio.loop=e}),a(0,e,"volume",function(){return this._audio?this._audio.volume:1},function(e){this._audio&&(this._audio.volume=e)}),t.bindToThis=function(e,i){return e.bind(i)},t}()}(window,(document,Laya)),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(e,i){"use strict";for(var t in Object.defineProperty(i,"__esModule",{value:!0}),Laya){var n=Laya[t];n&&n.__isclass&&(i[t]=n)}}); |