var CommonUtils=function(){function a(){}return a.gameEndSubmit=function(t){var e=a.getQueryString("env"),n=a.getQueryString("memUuid");if(e){var o=decodeURIComponent(e);if(n){var i={test:"//shared.ivydad.com.cn",production:"//shared.ivydad.com"}[o]+"/api/static/resource/gameFinished?gameName="+t+"&memUuid="+n,r=new Laya.HttpRequest;r.once(Laya.Event.COMPLETE,this,function(){console.log("提交项目名称成功")}),r.once(Laya.Event.ERROR,this,function(){console.log("提交项目名称失败")}),r.send(i)}else console.log("memUuid为空字符串，或者不存在")}else console.log("dataUrl为空字符串，或者不存在dataUrl参数")},a.getNetSourceAddress=function(){var t=a.getQueryString("env"),e=a.getQueryString("gameType"),n=a.getQueryString("detailId"),o="";if(t){var i={test:"//shared.ivydad.com.cn",production:"//shared.ivydad.com"}[decodeURIComponent(t)];if("2"!=e&&"1"!=e)return console.log("获取到的gameType类型不为1，或者0"),GlobalData.netWordUrl=o,o;GlobalData.gameType=e,n?o=i+"/api/static/resource/infoToGame2?detailId="+n+"&gameType="+e:console.log("detailId为空字符串，或者不存在")}else console.log("dataUrl为空字符串，或者不存在dataUrl参数");return GlobalData.netWordUrl=o,o},a.getHttpRequestUrl=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t||console.log("请求的接口名为空，请重新输入");var o={test:"//shared.ivydad.com.cn",production:"//shared.ivydad.com"},i=a.getQueryString("env");if(i||o[i]){var r=o[i]+"/api/static/resource/"+t;if(e)for(var s=0;s<e.length;s++){r+=0==s?"?":"&";var l=a.getQueryString(e[s]);if(!l)return void console.log(e[s]+"参数不存在");r=r+e[s]+"="+l}return r}console.log("env为空字符串，或者不存在的env参数")},a.hitTest=function(a,t,e,n){if(a.parent instanceof Laya.Sprite&&e.parent instanceof Laya.Sprite){var o=a.parent.localToGlobal((new Laya.Point).setTo(a.x-a.pivotX*a.scaleX,a.y-a.pivotY*a.scaleY)),i=e.parent.localToGlobal((new Laya.Point).setTo(e.x-e.pivotX*e.scaleX,e.y-e.pivotY*e.scaleY));return t.x=o.x,t.y=o.y,n.x=i.x,n.y=i.y,t.intersects(n)}},a.coordinateTransform=function(a,t,e,n){var o=a.localToGlobal(new Laya.Point(e,n));return t.globalToLocal(o)},a.getNotRepeatArr=function(a,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var o=[];e.forEach(function(a){o.push(a)});for(;;){if(o.length>=t)return o.sort(function(a,t){return Math.random()>.5?-1:1}),o;var i=Math.round(Math.random()*(a.length-1));-1==o.indexOf(a[i])&&o.push(a[i])}},a.getNotRepeatArrNew=function(a,t,e){var n=[];e.forEach(function(a){n.push(a)});for(;;){if(n.length>=t)return n.sort(function(a,t){return Math.random()>.5?-1:1}),n;var o=Math.round(Math.random()*(a.length-1));-1==n.indexOf(a[o])&&n.push(a[o])}},a.onEventNodeAny=function(a,t,e,n){function o(a,t,e,n){if(t){n?t.on(e,this,i):t.off(e,this,i);for(var r=0;r<t.numChildren;r++)o(a,t.getChildAt(r),e,n)}}function i(i){i?(i.stopPropagation(),n.call(a,this,t,r)):o(a,t,e,!1)}for(var r=[],s=4;s<arguments.length;s++)r[s-4]=arguments[s];return o(a,t,e,!0),i},a.getQueryString=function(a){var t=new RegExp(a+"=([^&]*)(?:&)?"),e=window.location.search.substr(1).match(t);return null!=e?e[1]:""},a.objDragCollision=function(t,e,n,o,i,r){function s(a){u.x=a.stageX-e.x,u.y=a.stageY-e.y,o&&o.call(t,e,a),Laya.stage.on(Laya.Event.MOUSE_UP,this,l),Laya.stage.on(Laya.Event.MOUSE_MOVE,this,c),Laya.stage.on(Laya.Event.MOUSE_OUT,this,l)}function l(o){e.mouseEnabled=!1,Laya.stage.off(Laya.Event.MOUSE_UP,this,l),Laya.stage.off(Laya.Event.MOUSE_MOVE,this,c),Laya.stage.off(Laya.Event.MOUSE_OUT,this,l),a.hitTest(e,g,n,d)?r&&(e.off(Laya.Event.MOUSE_DOWN,this,s),e.mouseEnabled=!0,r.call(t,e,o)):(e.x=y.x,e.y=y.y,e.mouseEnabled=!0,i&&i.call(t,e,o))}function c(a){e.x=a.stageX-u.x,e.y=a.stageY-u.y}var y=new Laya.Point(e.x,e.y),u=new Laya.Point,g=e.getBounds(),d=n.getBounds();e.on(Laya.Event.MOUSE_DOWN,this,s)},a.objDynamicDragCollision=function(t,e,n,o,i,r,s){function l(a){n.x=u.x,n.y=u.y,g.x=a.stageX-u.x,g.y=a.stageY-u.y,i&&i.call(t,e,a),Laya.stage.on(Laya.Event.MOUSE_UP,this,c),Laya.stage.on(Laya.Event.MOUSE_MOVE,this,y),Laya.stage.on(Laya.Event.MOUSE_OUT,this,c)}function c(i){e.mouseEnabled=!1,Laya.stage.off(Laya.Event.MOUSE_UP,this,c),Laya.stage.off(Laya.Event.MOUSE_MOVE,this,y),Laya.stage.off(Laya.Event.MOUSE_OUT,this,c),a.hitTest(n,d,o,f)?s&&(e.off(Laya.Event.MOUSE_DOWN,this,l),e.mouseEnabled=!0,s.call(t,e,i)):(n.x=u.x,n.y=u.y,e.mouseEnabled=!0,r&&r.call(t,e,i))}function y(a){window.localStorage,n.x=a.stageX-g.x,n.y=a.stageY-g.y}var u=new Laya.Point(e.x,e.y),g=new Laya.Point,d=e.getBounds();d.width=n.width,d.height=n.height;var f=o.getBounds();e.on(Laya.Event.MOUSE_DOWN,this,l)},a}();