!function(a){"function"==typeof bootstrap?bootstrap("pf",a):"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof ses?ses.ok()&&(ses.makePF=a):"undefined"!=typeof window?window.PF=a():global.PF=a()}(function(){return function(a,b,c){function d(h,f){if(!b[h]){if(!a[h]){var c="function"==typeof require&&require;if(!f&&c)return c(h,!0);if(e)return e(h,!0);throw Error("Cannot find module '"+h+"'");}c=b[h]={exports:{}};a[h][0].call(c.exports,function(b){var f= a[h][1][b];return d(f?f:b)},c,c.exports)}return b[h].exports}for(var e="function"==typeof require&&require,l=0;la?-1:a>h?1:0};r=function(a,h,b,f,c){var l;if(null==b&&(b=0),null==c&&(c=d),0>b)throw Error("lo must be non-negative");for(null==f&&(f=a.length);f>b;)l=e((b+f)/2),0>c(h,a[l])?f=l:b=l+ 1;return[].splice.apply(a,[b,b-b].concat(h)),h};f=function(a,h,b){return null==b&&(b=d),a.push(h),t(a,0,a.length-1,b)};h=function(a,h){var b,f;return null==h&&(h=d),b=a.pop(),a.length?(f=a[0],a[0]=b,s(a,0,h)):f=b,f};n=function(a,h,b){var f;return null==b&&(b=d),f=a[0],a[0]=h,s(a,0,b),f};u=function(a,h,b){var f;return null==b&&(b=d),a.length&&0>b(a[0],h)&&(f=[a[0],h],h=f[0],a[0]=f[1],s(a,0,b)),h};l=function(a,h){var b,f,c,l,u,n;null==h&&(h=d);l=function(){n=[];for(var h=0,b=e(a.length/2);0<=b?b>h: h>b;0<=b?h++:h--)n.push(h);return n}.apply(this).reverse();u=[];f=0;for(c=l.length;c>f;f++)b=l[f],u.push(s(a,b,h));return u};q=function(a,h,b){var f;return null==b&&(b=d),f=a.indexOf(h),-1!==f?(t(a,0,f,b),s(a,f,b)):void 0};p=function(a,h,b){var f,c,e;if(null==b&&(b=d),f=a.slice(0,h),!f.length)return f;l(f,b);e=a.slice(h);h=0;for(c=e.length;c>h;h++)a=e[h],u(f,a,b);return f.sort(b).reverse()};g=function(a,b,f){var c,e,u,n;if(null==f&&(f=d),10*b<=a.length){if(e=a.slice(0,b).sort(f),!e.length)return e; c=e[e.length-1];n=a.slice(b);b=0;for(u=n.length;u>b;b++)a=n[b],0>f(a,c)&&(r(e,a,0,null,f),e.pop(),c=e[e.length-1]);return e}l(a,f);e=[];c=0;for(b=m(b,a.length);0<=b?b>c:c>b;0<=b?++c:--c)e.push(h(a,f));return e};t=function(a,h,b,f){var c,e,l;null==f&&(f=d);for(c=a[b];b>h&&(l=b-1>>1,e=a[l],0>f(c,e));)a[b]=e,b=l;return a[b]=c};s=function(a,b,h){var f,c,e,l,u;null==h&&(h=d);c=a.length;u=b;e=a[b];for(f=2*b+1;c>f;)l=f+1,c>l&&!(0>h(a[f],a[l]))&&(f=l),a[b]=a[f],b=f,f=2*b+1;return a[b]=e,t(a,u,b,h)};a=function(){function a(b){this.cmp= null!=b?b:d;this.nodes=[]}return a.push=f,a.pop=h,a.replace=n,a.pushpop=u,a.heapify=l,a.nlargest=p,a.nsmallest=g,a.prototype.push=function(a){return f(this.nodes,a,this.cmp)},a.prototype.pop=function(){return h(this.nodes,this.cmp)},a.prototype.peek=function(){return this.nodes[0]},a.prototype.contains=function(a){return-1!==this.nodes.indexOf(a)},a.prototype.replace=function(a){return n(this.nodes,a,this.cmp)},a.prototype.pushpop=function(a){return u(this.nodes,a,this.cmp)},a.prototype.heapify=function(){return l(this.nodes, this.cmp)},a.prototype.updateItem=function(a){return q(this.nodes,a,this.cmp)},a.prototype.clear=function(){return this.nodes=[]},a.prototype.empty=function(){return 0===this.nodes.length},a.prototype.size=function(){return this.nodes.length},a.prototype.clone=function(){var b;return b=new a,b.nodes=this.nodes.slice(0),b},a.prototype.toArray=function(){return this.nodes.slice(0)},a.prototype.insert=a.prototype.push,a.prototype.remove=a.prototype.pop,a.prototype.top=a.prototype.peek,a.prototype.front= a.prototype.peek,a.prototype.has=a.prototype.contains,a.prototype.copy=a.prototype.clone,a}();"undefined"!=typeof b&&null!==b&&b.exports?b.exports=a:window.Heap=a}.call(this)},{}],3:[function(a,b){b.exports={Heap:a("heap"),Node:a("./core/Node"),Grid:a("./core/Grid"),Util:a("./core/Util"),Heuristic:a("./core/Heuristic"),AStarFinder:a("./finders/AStarFinder"),BestFirstFinder:a("./finders/BestFirstFinder"),BreadthFirstFinder:a("./finders/BreadthFirstFinder"),DijkstraFinder:a("./finders/DijkstraFinder"), BiAStarFinder:a("./finders/BiAStarFinder"),BiBestFirstFinder:a("./finders/BiBestFirstFinder"),BiBreadthFirstFinder:a("./finders/BiBreadthFirstFinder"),BiDijkstraFinder:a("./finders/BiDijkstraFinder"),IDAStarFinder:a("./finders/IDAStarFinder"),JumpPointFinder:a("./finders/JumpPointFinder"),OrthogonalJumpPointFinder:a("./finders/OrthogonalJumpPointFinder"),TraceFinder:a("./finders/TraceFinder")}},{"./core/Grid":4,"./core/Heuristic":5,"./core/Node":6,"./core/Util":7,"./finders/AStarFinder":8,"./finders/BestFirstFinder":9, "./finders/BiAStarFinder":10,"./finders/BiBestFirstFinder":11,"./finders/BiBreadthFirstFinder":12,"./finders/BiDijkstraFinder":13,"./finders/BreadthFirstFinder":14,"./finders/DijkstraFinder":15,"./finders/IDAStarFinder":16,"./finders/JumpPointFinder":17,"./finders/OrthogonalJumpPointFinder":18,"./finders/TraceFinder":19,heap:1}],4:[function(a,b){function c(a,b,h){this.width=a;this.height=b;this.nodes=this._buildNodes(a,b,h)}var d=a("./Node");c.prototype._buildNodes=function(a,b,h){var f,c,n=Array(b); for(f=0;b>f;++f){n[f]=Array(a);for(c=0;a>c;++c)n[f][c]=new d(c,f)}if(void 0===h)return n;if(h.length!==b||h[0].length!==a)throw Error("Matrix size does not fit");for(f=0;b>f;++f)for(c=0;a>c;++c)h[f][c]&&(n[f][c].walkable=!1);return n};c.prototype.getNodeAt=function(a,b){return this.nodes[b][a]};c.prototype.isWalkableAt=function(a,b){return this.isInside(a,b)&&this.nodes[b][a].walkable};c.prototype.isInside=function(a,b){return 0<=a&&aa;++a){r[a]=Array(h);for(b=0;h>b;++b)r[a][b]=new d(b,a,u[a][b].walkable)}return n.nodes=r,n};b.exports=c},{"./Node":6}],5:[function(a,b){b.exports={manhattan:function(a,b){return a+b},euclidean:function(a,b){return Math.sqrt(a*a+b*b)},chebyshev:function(a, b){return Math.max(a,b)}}},{}],6:[function(a,b){b.exports=function(a,b,e){this.x=a;this.y=b;this.walkable=void 0===e?!0:e}},{}],7:[function(a,b,c){function d(a){for(var b=[[a.x,a.y]];a.parent;)a=a.parent,b.push([a.x,a.y]);return b.reverse()}function e(a,b,f,c){var n,e,d,p,g,q;n=Math.abs;var t=[];d=n(f-a);p=n(c-b);n=f>a?1:-1;e=c>b?1:-1;for(g=d-p;!(t.push([a,b]),a===f&&b===c);)q=2*g,q>-p&&(g-=p,a+=n),d>q&&(g+=d,b+=e);return t}c.backtrace=d;c.biBacktrace=function(a,b){var f=d(a),c=d(b);return f.concat(c.reverse())}; c.pathLength=function(a){var b,f,c,n,e=0;for(b=1;bm)return d;for(c=0;m-1>c;++c){b=a[c];f=a[c+1];b=e(b[0],b[1],f[0],f[1]);f=b.length;for(n=0;f-1>n;++n)d.push(b[n])}return d.push(a[m-1]),d};c.smoothenPath=function(a,b){var f,c,n,d,m,p,g,q,t,s,v,x,w=b.length;c=b[0][1];var y=b[w-1][0],A=b[w-1][1];f=b[0][0];m=b[1][0];p=b[1][1];g=[[f,c]];for(q=2;w> q;++q){d=b[q];n=d[0];d=d[1];s=e(f,c,n,d);x=!1;for(t=1;ta.length)return a;var b,f,c,e,d,m,p=[];b=a[0][0];f=a[0][1];var g=a[1][0],q=a[1][1],t=g-b,s=q-f;d=Math.sqrt(t*t+s*s);t/=d;s/=d;p.push([b,f]);for(m=2;mq;++q)g=p[q],g.closed||(s=g.x,v=g.y,x=m.g+(0===s-m.x||0===v-m.y?1:C),(!g.opened||xq;++q)if(g=p[q],!g.closed){if(2===g.opened)return e.biBacktrace(m,g);s=g.x;v=g.y;x=m.g+(0===s-m.x||0===v-m.y?1:E);(!g.opened||xq;++q)if(g=p[q],!g.closed){if(1===g.opened)return e.biBacktrace(g,m);s=g.x;v=g.y;x=m.g+(0===s-m.x||0===v-m.y?1:E);(!g.opened||xp;++p)if(r=n[p],!r.closed)if(r.opened){if(1===r.by)return d.biBacktrace(m,r)}else c.push(r),r.parent=m,r.opened=!0,r.by=0;m=f.shift();m.closed=!0;n=u.getNeighbors(m,a,b);p=0;for(g=n.length;g>p;++p)if(r=n[p],!r.closed)if(r.opened){if(0===r.by)return d.biBacktrace(r,m)}else f.push(r),r.parent=m,r.opened=!0,r.by=1}return[]};b.exports=c},{"../core/Util":7}],13:[function(a,b){function c(a){d.call(this,a);this.heuristic=function(){return 0}}var d=a("./BiAStarFinder"); c.prototype=new d;c.prototype.constructor=c;b.exports=c},{"./BiAStarFinder":10}],14:[function(a,b){function c(a){a=a||{};this.allowDiagonal=a.allowDiagonal;this.dontCrossCorners=a.dontCrossCorners}var d=a("../core/Util");c.prototype.findPath=function(a,b,c,f,u){var n,r,m=[],p=this.allowDiagonal,g=this.dontCrossCorners;a=u.getNodeAt(a,b);c=u.getNodeAt(c,f);m.push(a);for(a.opened=!0;m.length;){if(n=m.shift(),n.closed=!0,n===c)return d.backtrace(c);f=u.getNeighbors(n,p,g);b=0;for(r=f.length;r>b;++b)a= f[b],a.closed||a.opened||(m.push(a),a.opened=!0,a.parent=n)}return[]};b.exports=c},{"../core/Util":7}],15:[function(a,b){function c(a){d.call(this,a);this.heuristic=function(){return 0}}var d=a("./AStarFinder");c.prototype=new d;c.prototype.constructor=c;b.exports=c},{"./AStarFinder":8}],16:[function(a,b){function c(a){a=a||{};this.allowDiagonal=a.allowDiagonal;this.dontCrossCorners=a.dontCrossCorners;this.heuristic=a.heuristic||d.manhattan;this.weight=a.weight||1;this.trackRecursion=a.trackRecursion|| !1;this.timeLimit=a.timeLimit||1/0}a("../core/Util");var d=a("../core/Heuristic"),e=a("../core/Node");c.prototype.findPath=function(a,b,c,d,n){var r,m,p=0,g=(new Date).getTime(),q=function(a,b){return this.heuristic(Math.abs(b.x-a.x),Math.abs(b.y-a.y))}.bind(this),t=function(a,b,c,f,h){if(p++,01E3*this.timeLimit)return 1/0;var d=b+q(a,s)*this.weight;if(d>c)return d;if(a==s)return f[h]=[a.x,a.y],a;var l,m,u,r=n.getNeighbors(a,this.allowDiagonal,this.dontCrossCorners); m=0;for(d=1/0;u=r[m];++m){if(this.trackRecursion&&(u.retainCount=u.retainCount+1||1,!0!==u.tested&&(u.tested=!0)),l=t(u,b+(a.x===u.x||a.y===u.y?1:Math.SQRT2),c,f,h+1),l instanceof e)return f[h]=[a.x,a.y],l;this.trackRecursion&&0===--u.retainCount&&(u.tested=!1);d>l&&(d=l)}return d}.bind(this);a=n.getNodeAt(a,b);var s=n.getNodeAt(c,d);d=q(a,s);for(c=0;!(r=[],m=t(a,0,d,r,0),1/0===m);++c){if(m instanceof e)return r;d=m}return[]};b.exports=c},{"../core/Heuristic":5,"../core/Node":6,"../core/Util":7}], 17:[function(a,b){function c(a){a=a||{};this.heuristic=a.heuristic||l.manhattan;this.trackJumpRecursion=a.trackJumpRecursion||!1}var d=a("heap"),e=a("../core/Util"),l=a("../core/Heuristic");c.prototype.findPath=function(a,b,c,n,l){var m,p=this.openList=new d(function(a,b){return a.f-b.f});a=this.startNode=l.getNodeAt(a,b);c=this.endNode=l.getNodeAt(c,n);this.grid=l;a.g=0;a.f=0;p.push(a);for(a.opened=!0;!p.empty();){if(m=p.pop(),m.closed=!0,m===c)return e.expandPath(e.backtrace(c));this._identifySuccessors(m)}return[]}; c.prototype._identifySuccessors=function(a){var b,c,d,e,m,p,g,q,t=this.grid,s=this.heuristic,v=this.openList,x=this.endNode.x,w=this.endNode.y,y=a.x,A=a.y,z=Math.abs;Math.max;b=this._findNeighbors(a);e=0;for(m=b.length;m>e;++e)if(c=b[e],d=this._jump(c[0],c[1],y,A))if(!(p=d[0],g=d[1],q=t.getNodeAt(p,g),q.closed))d=l.euclidean(z(p-y),z(g-A)),d=a.g+d,(!q.opened||de;++e)d=c[e],l.push([d.x,d.y])}return l};b.exports= c},{"../core/Heuristic":5,"../core/Util":7,heap:1}],18:[function(a,b){function c(a){e.call(this,a);a=a||{};this.heuristic=a.heuristic||d.manhattan}var d=a("../core/Heuristic"),e=a("./JumpPointFinder");c.prototype=new e;c.prototype.constructor=c;c.prototype._jump=function(a,b,c,d){var e=this.grid;c=a-c;d=b-d;if(!e.isWalkableAt(a,b))return null;if(!0===this.trackJumpRecursion&&(e.getNodeAt(a,b).tested=!0),e.getNodeAt(a,b)===this.endNode)return[a,b];if(0!==c){if(e.isWalkableAt(a,b-1)&&!e.isWalkableAt(a- c,b-1)||e.isWalkableAt(a,b+1)&&!e.isWalkableAt(a-c,b+1))return[a,b]}else{if(0===d)throw Error("Only horizontal and vertical movements are allowed");if(e.isWalkableAt(a-1,b)&&!e.isWalkableAt(a-1,b-d)||e.isWalkableAt(a+1,b)&&!e.isWalkableAt(a+1,b-d)||this._jump(a+1,b,a,b)||this._jump(a-1,b,a,b))return[a,b]}return this._jump(a+c,b+d,a,b)};c.prototype._findNeighbors=function(a){var b,c,d,e;b=a.parent;c=a.x;d=a.y;e=this.grid;var r=[];if(b)a=b.x,b=b.y,a=(c-a)/Math.max(Math.abs(c-a),1),b=(d-b)/Math.max(Math.abs(d- b),1),0!==a?(e.isWalkableAt(c,d-1)&&r.push([c,d-1]),e.isWalkableAt(c,d+1)&&r.push([c,d+1]),e.isWalkableAt(c+a,d)&&r.push([c+a,d])):0!==b&&(e.isWalkableAt(c-1,d)&&r.push([c-1,d]),e.isWalkableAt(c+1,d)&&r.push([c+1,d]),e.isWalkableAt(c,d+b)&&r.push([c,d+b]));else{c=e.getNeighbors(a,!1);e=0;for(a=c.length;a>e;++e)d=c[e],r.push([d.x,d.y])}return r};b.exports=c},{"../core/Heuristic":5,"./JumpPointFinder":17}],19:[function(a,b){function c(a){a=a||{};this.allowDiagonal=a.allowDiagonal;this.dontCrossCorners= a.dontCrossCorners;this.heuristic=a.heuristic||l.manhattan}var d=a("heap"),e=a("../core/Util"),l=a("../core/Heuristic");c.prototype.findPath=function(a,b,c,l,r){var m,p,g,q,t,s,v,x,w=new d(function(a,b){return a.f-b.f});p=r.getNodeAt(a,b);a=r.getNodeAt(c,l);b=this.heuristic;var y=this.allowDiagonal,A=this.dontCrossCorners,z=Math.abs,B=Math.SQRT2;p.g=0;p.f=0;w.push(p);for(p.opened=!0;!w.empty();){if(m=w.pop(),m.closed=!0,m===a)return e.backtrace(a);p=r.getNeighbors(m,y,A);var C=p.length;q=0;for(t= p.length;t>q;++q)g=p[q],g.closed||(s=g.x,v=g.y,x=m.g+(0===s-m.x||0===v-m.y?1:B),(!g.opened||x=i;i++)g_mainmenu.push(res["bg"+i]="res/bg/map1_0"+ i+".jpg");GD.isApp?(res.other_plist="res/app.plist",res.other_png="res/app.png"):(res.other_plist="res/web.plist",res.other_png="res/web.plist");g_mainmenu.push(res.other_plist);g_mainmenu.push(res.other_png);var GD=GD||{}; GD.mapdata=[60,[[1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0]]];GD.LIFE=10;GD.PETKIND=0;GD.SHOWLEVEL=0;GD.SCORE=0;var winSize,centerPos;GD.word=["0","1"];var BitNumLayer=cc.Layer.extend({timeLabel:null,scoreLabel:null,time:null,timeAction:null,_bg:null,ctor:function(){this._super()},step:function(a){this.time+=a},init:function(){this._super();this.timeLabel=cc.LabelTTF.create("","Arial",45);this.timeLabel._textAlign=cc.TEXT_ALIGNMENT_LEFT;this.addChild(this.timeLabel);this.timeLabel.anchorX=0.5;this.timeLabel.anchorY=0.5;this.timeLabel.x=0.5*winSize.width+150;this.timeLabel.y=-30+winSize.height;this.timeLabel._textAlign=cc.TEXT_ALIGNMENT_RIGHT;this.timeLabel.scaleX= this.timeLabel.scaleY=0.5;this.schedule(this.step);this.setTimeNum(0)},setNum:function(a){GD.SCORE+=a;trace("--------SCORE---"+GD.SCORE);this.scoreLabel.scale=0.8;this.scoreLabel.runAction(this.timeAction);this.scoreLabel.setString(GD.SCORE+"")},setTimeNum:function(a){this.timeLabel.setString(a+'"')}});BitNumLayer.create=function(){var a=new BitNumLayer;a.init();return a};var Helo=cc.Sprite.extend({eID:0,active:!0,direct:[1,1],hurtAction:null,standAction:null,hasFired:!1,attactKind:0,lock:!1,ax:0,ay:0,ox:0,oy:0,apot:null,addpot:null,speednum:10,speedp:null,nextaim:null,isOpen:!1,roadlist:[],_draw:null,circle:140,_linep:null,frameObj:{},_state:"r",dirList:[[-1,1],[1,1],[1,-1],[-1,-1]],curPot:null,oricolor:null,ctor:function(){this._super("#r0026.png");this.install();this.anchorX=0.5;this.anchorY=0.3;this.oricolor=this.color;this.isOpen=!0},install:function(){this.apot= this.getPosition();this.attactActionList=[];var a;this.frameObj={};for(var b=["s1","s2","r1","r2","die"],c=0;4>=c;c++){for(var d=[],e=1;7>=e;e++)a=e+7*c,a=10>a?"00"+a:100>a?"0"+a:a,a="r0"+a+".png",a=cc.spriteFrameCache.getSpriteFrame(a),d.push(a);this.frameObj[b[c]]=4==c?cc.Sequence.create(cc.Animate.create(cc.Animation.create(d,0.08)),cc.CallFunc.create(this.destroy,this)):cc.RepeatForever.create(cc.Animate.create(cc.Animation.create(d,0.08)))}b=["r0032.png","r0033.png","r0034.png","r0035.png","r0035.png"]; c=[];for(a=0;5>a;a++)c.push(cc.spriteFrameCache.getSpriteFrame(b[a]));this.frameObj.die2=cc.Sequence.create(cc.Animate.create(cc.Animation.create(c,0.2)),cc.CallFunc.create(this.destroy,this));this.setState(-1,-1,"r")},setState:function(a,b,c){if(this.direct[1]!=b||this._state!=c){var d=-1==b?c+"2":c+"1";this.stopAllActions();this.runAction(this.frameObj[d])}this._state=c;this.direct[1]=b;this.scaleX=this.direct[0]=a},findRoad:function(){this.roadlist=[];this.refreshNext()},destroy:function(){trace("-------------destroy------------"); this.scheduleOnce(this.callBackOver,1);this.stopAllActions();this.frameObj=null},callBackOver:function(){g_sharedGameLayer.onGameOver()},attactRect:function(){},toDie:function(a){this.stopAllActions();this.runAction(2==a?this.frameObj.die2:this.frameObj.die)}});Helo.create=function(){return new Helo};var MapLayer=cc.Layer.extend({_bgs:null,_start:null,_bglist:[],_bgshowlist:[],_viewRect:[],offPot:cc.p(0,0),zonew:1580,zoneh:1264,imgIndex:[7,8,9,4,5,6,1,2,3],cellw:60,cellh:60,maxw:0,maxh:0,npcSpts:null,npcList:[],xjSpts:null,grassPotList:[],xjList:[],map:[],maxcol:0,maxrow:0,mgList:[],mgPotList:[],grid:null,finder:null,path:null,curCR:[0,0],aimCR:[],speed:10,_draw:null,_draw2:null,roadList:[[0,0]],nextaim:null,speedp:null,butspeedp:null,aimPot:null,maxableCR:[],roadLineList:[],helo:null,sreenPot:null, npcPotList:[],recordSpeed:5,isLock:!1,taSender:[[1600,3697],[2995,2401],[4585,1330]],taAttactPotlist:[],otherXjList:[],shoePotList:[],xj1PotList:[],shoeList:[],attackList:[],bullet:null,mgbgList:[],smallMap:null,shelo:null,sMgBgList:[],sShoeList:[],mapscale:[],activeXJ:null,ctor:function(){this._super()},init:function(a){this._super();this.mgPotList=[];this.otherXjList=[];this.shoePotList=[];this.xj1PotList=[];this.shoeList=[];this.sMgBgList=[];this.sShoeList=[];this.mapscale=[];this.attackList=[]; this.helo=a;this._viewRect=[-20,winSize.height+80,winSize.width+50,-50];this._bgs=cc.Node.create();this._bgs.y=0;this._bgs.x=0;this.addChild(this._bgs);cc.spriteFrameCache.addSpriteFrames(res.def_plist);a=cc.textureCache.addImage(res.def_png);this.xjSpts=cc.SpriteBatchNode.create(a);this.xjSpts.setBlendFunc(cc.SRC_ALPHA,cc.ONE);this._bgs.addChild(this.xjSpts,12);cc.spriteFrameCache.addSpriteFrames(res.npc_plist);a=cc.textureCache.addImage(res.npc_png);this.npcSpts=cc.SpriteBatchNode.create(a);this.npcSpts.setBlendFunc(cc.SRC_ALPHA, cc.ONE);this._bgs.addChild(this.npcSpts,11);for(a=0;9>a;a++){var b=cc.Sprite.create(res["bg"+this.imgIndex[a]]);this._bgs.addChild(b,0);b.anchorX=0;b.anchorY=0;b.scale=1580/1097;b.visible=!0;var c=Math.floor(a/3);b.x=(this.zonew-2)*(a%3);b.y=c*(this.zoneh-2);this._bglist.push(b);this._bgshowlist.push(b)}this.maxw=3*this.zonew;this.maxh=3*this.zoneh;trace(GD.mapdata[1]);extend(this.map,GD.mapdata[1]);this.cellw=this.cellh=GD.mapdata[0];this.maxrow=this.map.length;this.maxcol=this.map[0].length;trace("num"+ this.maxrow+":"+this.maxcol);this._draw2||(this._draw2=cc.DrawNode.create(),this._bgs.addChild(this._draw2,20));this._draw||(this._draw=cc.DrawNode.create(),this._bgs.addChild(this._draw,100));this.initRoad();this.initMap();this.helo.curPot=cc.p(250,200);this.helo.setPosition(this.helo.curPot);this.offPot=cc.p(0,0);this._bgs.setPosition(cc.pNeg(this.offPot));this.initSmallMap();this.curCR=this.getCurCR()},getMapIndex:function(a,b){return 0},initRoad:function(){this.grid=new PF.Grid(this.maxcol,this.maxrow, this.map);this.finder=new PF.TraceFinder({allowDiagonal:!0})},initSmallMap:function(){this.mapscale=[140/this.maxw,140/this.maxh];this.smallMap=cc.Node.create();g_sharedGameLayer.addChild(this.smallMap,30);this.smallMap.x=winSize.width/2+60;this.smallMap.y=10;this.shelo=cc.Sprite.create("#ssrole.png");this.smallMap.addChild(this.shelo);this.shelo.x=this.helo.curPot.x*this.mapscale[0];this.shelo.y=100;trace("---shelo---"+this.shelo.x);for(var a=0;3>a;a++){var b=cc.Sprite.create("#ssmgbg.png"),c=cc.Sprite.create("#ssshoe.png"); this.smallMap.addChild(b);this.smallMap.addChild(c);b.x=this.mgbgList[a][1]*this.mapscale[0]*this.cellw;b.y=this.mgbgList[a][2]*this.mapscale[1]*this.cellh;c.x=this.shoeList[a][1]*this.mapscale[0]*this.cellw;c.y=this.shoeList[a][2]*this.mapscale[1]*this.cellh;this.sMgBgList.push(b);this.sShoeList.push(c)}},initMap:function(){this.mgPotList=[];this.grassPotList=[];for(var a=0;ab&&5a&&0==a%6&&0==b%4&&this.shoePotList.push([b, a]);break;case 1:this.grid.setWalkableAt(b,a,!1);break;case 2:this.grid.setWalkableAt(b,a,!0);this.grassPotList.push([b,a]);break;case 3:this.mgPotList.push([b,a]);this.grid.setWalkableAt(b,a,!0);break;case 4:this.npcPotList.push([b,a]);break;case 5:this.grid.setWalkableAt(b,a,!0);break;case 6:this.xj1PotList.push([b,a]),this.grid.setWalkableAt(b,a,!0);default:this.grid.setWalkableAt(b,a,!0)}if(GD.isApp)for(a=0;3>a;a++);this.createShoe();this.createMgBG();this.createNpc();this.createXJ()},getRandomArr:function(a){for(var b= [];0c;c++){var d=a.shift()[0];trace("createShoe"+d);b.push(d);var e=this.cellw*(d[0]+0.5),l=this.cellh*(d[1]+0.5),h=cc.Sprite.create("#xz"+(c+1)+".png");h.x=e;h.y=l;h.scale=0.71;h.anchorX=h.anchorY=0.5;this.map[d[1]][d[0]]=10;this._bgs.addChild(h,21);this.shoeList.push([h,d[0],d[1]])}this.shoePotList=a},createMgBG:function(){trace("-mgPotList---"+ this.mgPotList);for(var a=this.getRandomArr(this.mgPotList),b=[],c=0;3>c;c++){b.push(a.shift());var d=this.cellw*(b[c][0][0]+0.5),e=this.cellh*(b[c][0][1]+0.5),l=cc.Sprite.create("#mgbg.png");l.x=d;l.y=e;l.anchorX=l.anchorY=0.5;l.scale=0.8;this._bgs.addChild(l,20);this.map[b[c][0][1]][b[c][0][0]]=12;this.mgbgList.push([l,b[c][0][0],b[c][0][1]])}this.mgPotList=b;this.otherXjList=a},createXJ:function(){for(var a=this.getRandomArr(this.grassPotList),b=[18,3,18],a=[this.getRandomArr(this.xj1PotList), this.otherXjList,a],c=0;3>c;c++)for(var d=0;db;b++){var c=this.cellw*(this.npcPotList[b][0]+0.5),d=this.cellh*(this.npcPotList[b][1]+0.5),e=new Npc(a[b]-1,this.getMapIndex(c,d),this.npcPotList[b]);this.npcSpts.addChild(e);e.x=c;e.y=d}},checkShopPot:function(){},findPathPot:function(){this.roadList=[];for(var a=this.path.length,b=[],c=0;cb?0:b>=this.maxcol?this.maxcol-1:b;a=0>a?0:a>=this.maxrow?this.maxrow-1:a;return[b,a]},cellKind:function(a){return this.map[a[1]][a[0]]},getWorkAble:function(a){return this.grid.isWalkableAt(a[0],a[1])},findRoad:function(a){this.curCR=this.getCurCR();var b=this.grid.clone();a=this.finder.findPath(this.curCR[0],this.curCR[1],a[0],a[1],b); 1h;h++){for(var f=0;4>f;f++)e=[a[0]+l[h][f][0]*d,a[1]+l[h][f][1]*d],this.getWorkAble(e)&&b.push(e);if(0c;c++)for(var d=0;3>d;d++)if(b[1]+c==this.curCR[0]&&b[2]+d==this.curCR[1])return this.createMg([b[1],b[2]]),this._bgs.removeChild(b[0]),this.mgbgList.splice(a,1),trace("-----mgbg---"+this.mgbgList.length),g_sharedGameLayer.completeOneWork(this.mgbgList.length), !0;this.createMg(this.curCR);return!0},setNewPot:function(a){if(!this.isLock&&(this.sreenPot=a,a=cc.pAdd(this.offPot,a))){var b=this.getCR(a);this.aimCR=b;this.getWorkAble(b)?this.aimPot=a:(this.aimCR=this.getLineAblePot(b),this.aimPot=cc.p((this.aimCR[0]+0.5)*this.cellw,(this.aimCR[1]+0.5)*this.cellh));this.findRoad(this.aimCR)}},dosomething:function(){this.curCR=this.getCurCR();switch(this.cellKind(this.curCR)){case 10:trace("clickshop----------");for(var a=0;athis.curCR[0]?this.sendAttackLine(0):65this.maxw-winSize.width/2? this.helo.x=a.x-this.offPot.x:this.offPot.x=a.x-winSize.width/2;a.ythis.maxh-winSize.height/2?this.helo.y=a.y-this.offPot.y:this.offPot.y=a.y-winSize.height/2;2==this.cellKind(this.getCurCR())?this.helo.setOpacity(50):this.helo.setOpacity(255);var a=Math.floor(this.offPot.x),b=Math.floor(this.offPot.y);this._bgs.x=-a;this._bgs.y=-b;this.offPot.x=a;this.offPot.y=b;a=cc.rect(a,b,this._viewRect[2],this._viewRect[1]);for(b=0;bthis.speed?this.helo.curPot=cc.pAdd(this.helo.curPot,this.speedp):(this.helo.curPot=this.nextaim,this.roadList.shift(),this.refreshNextRoad());this.checkMap()}this.bullet&&this.butspeedp&&(40=d;d++){var e=d;k=10>e?"00"+e:100>e?"0"+e:e;str="xj0"+k+".png";e=cc.spriteFrameCache.getSpriteFrame(str);c.push(e)}this.liveAction=cc.RepeatForever.create(cc.Animate.create(cc.Animation.create(c,0.08)));this.toActive()},toActive:function(a){this.visible=!0;this.runAction(this.liveAction)},inActive:function(){this.stopAllActions(); this.visible=!1},update:function(a){}});var Mogu=cc.Sprite.extend({liveAction:null,inmap:0,rc:[],ctor:function(a,b){this._super("#mg0001.png");this.anchorY=this.anchorX=0.5;this.inmap=a;this.rc=b;for(var c=[],d=1;10>=d;d++){var e=d;k=10>e?"00"+e:100>e?"0"+e:e;str="mg0"+k+".png";e=cc.spriteFrameCache.getSpriteFrame(str);c.push(e)}this.liveAction=cc.RepeatForever.create(cc.Animate.create(cc.Animation.create(c,0.08)));this.toActive()},toActive:function(a){this.visible=!0;this.runAction(this.liveAction)},inActive:function(){this.stopAllActions(); this.visible=!1},update:function(a){}});var Npc=cc.Sprite.extend({race:1,kind:0,power:1,liveAction:null,inmap:0,rc:[],ctor:function(a,b,c){this.kind=a;this._super("#n"+(this.kind+1)+"0001.png");this.rc=b;this.anchorY=this.anchorX=0.5;this.inmap=c;this.scale=1.3;a=[7,14,9,6,8,10,7,7];b=[];for(c=1;c<=a[this.kind];c++){var d=c;k=10>d?"00"+d:100>d?"0"+d:d;str="n"+(this.kind+1)+"0"+k+".png";d=cc.spriteFrameCache.getSpriteFrame(str);b.push(d)}this.liveAction=cc.RepeatForever.create(cc.Animate.create(cc.Animation.create(b,0.08)));this.toActive()}, toActive:function(){this.visible=!0;this.runAction(this.liveAction)},inActive:function(){this.stopAllActions();this.visible=!1},update:function(a){}});function ShakeCls(){this.shakeee=null;var a=this;this.bool=!1;this.hitAndShake=function(a,c,d,e,l){this.bool=!0;this.shakeee=a;null==this.shakeee.basex&&(this.shakeee.basex=this.shakeee.x);null==this.shakeee.basey&&(this.shakeee.basey=this.shakeee.y);this.shakeee.rangeX=null==c?20:c;this.shakeee.rangeY=null==d?20:d;this.shakeee.x=this.shakeee.basex-this.shakeee.rangeX/2+this.shakeee.rangeX*Math.random();this.shakeee.y=this.shakeee.basey-this.shakeee.rangeY+2*this.shakeee.rangeY*Math.random();this.shakeee.flashTime= 6;this.shakeee.funcCall=null==l?null:l;this.shakeee.shakeTimeCount=0;this.shakeee.cframe=0};this.update=function(){this.bool&&(this.shakeee.cframe+=1,2>this.shakeee.cframe||(this.shakeee.cframe=0,5==this.shakeee.shakeTimeCount?a.cancelHitAndShake(this.shakeee):(this.shakeee.shakeTimeCount++,this.shakeee.x+=1.7*(this.shakeee.basex-this.shakeee.x),this.shakeee.y+=1.7*(this.shakeee.basey-this.shakeee.y))))};this.cancelHitAndShake=function(a){this.bool=!1;a||(a=this.shakeee);a.x=a.basex;a.y=a.basey}} var shake=new ShakeCls;var MenuLayer=cc.Layer.extend({menu:null,ctor:function(){this._super()},init:function(){this._super();cc.spriteFrameCache.addSpriteFrames(res.game_plist);centerPos=cc.p(winSize.width/2,winSize.height/2);var a=cc.Sprite.create(res.intro);this.addChild(a);this.menu=cc.Sprite.create(res.start);this.menu.x=winSize.width/2;this.addChild(this.menu);a.y=winSize.height/2+265.5-224.5;this.menu.y=a.y-265.5;a.x=winSize.width/2;this.initEvent();a=cc.Sprite.create(cc.tglogotexture2d);a.y=10;a.anchorY=0;a.anchorX= 0.5;a.x=winSize.width/2;this.addChild(a)},initEvent:function(){var a=this,b=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!1,onTouchBegan:function(b,d){var e=d.getCurrentTarget(),l=e.convertToNodeSpace(b.getLocation()),e=e.getContentSize(),e=cc.rect(0,0,e.width,e.height);return cc.rectContainsPoint(e,l)?(a.menu.y-=3,a.menu.color=cc.color(150,150,150,150),a.onPlayG(),!0):!1},onTouchEnded:function(a,b){return!1}});cc.eventManager.addListener(b,a.menu)},onPlayG:function(){cc.director.runScene(cc.TransitionFade.create(0.3, GameScene.create()))}}),MenuScene=cc.Scene.extend({onEnter:function(){this._super();var a=new MenuLayer;a.init();this.addChild(a)}});MenuScene.create=function(){var a=new MenuScene;return a&&a.init()?a:null};STATE_PLAYING=0;STATE_GAMEOVER=1; var g_sharedGameLayer,GameLayer=cc.Layer.extend({_size:0,_helo:null,_roles:null,_time:GD.MAXTIME,_midx:0,_leftmidx:0,_rightmidx:0,_attactzone:[],_npcontainer:null,_introscene:null,_live:0,_blood:null,_attackLeft:null,_attackRight:null,_dataLayer:null,_state:STATE_PLAYING,_hitUI:null,numLayer:null,_hitNum:0,_liveBar:null,_barRenderer:null,_time2:0,_others:null,_BtnColor:null,_space:60,_barsize:[168,17],_locktime:3,_ta:null,_mapLayer:null,moved:!0,banner:null,mgIcon:null,isPress:!1,shoplist:[],isMgCD:!1, mgCDAction:null,mgcdbg:null,workBanner:null,workList:[],ctor:function(){this._super()},init:function(){this._super()&&(this.shoplist=[],this._space=0,GD.SCORE=0,this._time2=this._time=GD.MAXTIME,this._midx=winSize.width/2,this._leftmidx=this._midx/2-120,this._rightmidx=this._midx+120,g_sharedGameLayer=this,this.initRoles(),this.initBg(),this.initUserControl(),this.initData(),this._state=STATE_PLAYING,this.schedule(this.clockCounter2,1),this.scheduleUpdate(),this.clockCounter2())},initRoles:function(){cc.spriteFrameCache.addSpriteFrames(res.npc_plist); cc.spriteFrameCache.addSpriteFrames(res.role_plist);var a=cc.textureCache.addImage(res.role_png);this._roles=cc.SpriteBatchNode.create(a);this._roles.setBlendFunc(cc.SRC_ALPHA,cc.ONE);this.addChild(this._roles,11);this._helo=Helo.create();this._roles.addChild(this._helo);this._helo.y=winSize.height/2;this._helo.x=winSize.width/2},initData:function(){this._time=this._time2=GD.MAXTIME;this._dataLayer=BitNumLayer.create();this.addChild(this._dataLayer,100);this.mgcdbg=cc.Sprite.create("#mgmask.png"); this.mgcdbg.x=winSize.width/2+15;this.banner.addChild(this.mgcdbg);this.mgcdbg.y=36;this.mgcdbg.visible=!1;this.mgCDAction=cc.Sequence.create(cc.ProgressTo.create(5,100),cc.CallFunc.create(this.mgCDEnd,this));this.mgIcon=cc.ProgressTimer.create(cc.Sprite.create("#mgcd.png"));this.mgIcon.type=cc.ProgressTimer.TYPE_RADIAL;this.banner.addChild(this.mgIcon);this.mgIcon.x=winSize.width/2+15;this.mgIcon.y=36;this.workBanner=cc.Sprite.create("#wkbg.png");this.addChild(this.workBanner,200);this.workBanner.x= winSize.width/2-100;this.workBanner.y=winSize.height-30;for(var a=1;3>=a;a++){var b=cc.Sprite.create("#wkb"+a+".png");this.workBanner.addChild(b);b.x=25*a+65;b.y=10;this.workList.push(b)}a=cc.Sprite.create("#mask.png");this.addChild(a);a.anchorX=a.anchorY=0.5;a.x=0.5*winSize.width;a.y=0.5*winSize.height;a.scale=1.15;a.alpha=1},setLive:function(a){this._ta.setLive(a)},initUserControl:function(){this.banner=cc.Node.create();var a=cc.Sprite.create("#banner.png");a.scale=0.71;this.banner.addChild(a); this.banner.y=0;this.banner.x=10;this.banner.anchorX=this.banner.anchorY=0;a.y=95;a.x=222;this.addChild(this.banner,20);var b=this,a=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!1,onTouchBegan:function(a,d){var e=a.getLocation();if(65>e.y)return e.x>winSize.width/2-8&&e.xwinSize.height/2+50?this.reorderChild(this._roles,9):this.reorderChild(this._roles,11)},updateUI:function(){shake&&shake.update();this._mapLayer.update()},clearEmeny:function(){},addRoad:function(a){this.addChild(a,0)},loseGame:function(a){this._state!=STATE_GAMEOVER&&(GD.isWin=!1,this._helo.toDie(a),this.toGameEnd())},winGame:function(){GD.isWin=!0;this.toGameEnd();this.scheduleOnce(this.onGameOver,0.3)},toGameEnd:function(){this._state=STATE_GAMEOVER;this._mapLayer&& this._mapLayer.gameOver();this.unschedule(this.clockCounter2,0.1);cc.eventManager.removeAllListeners()},onGameOver:function(){this._mapLayer.removeAllChildren();this._mapLayer=null;this._roles.removeAllChildren();cc.spriteFrameCache.removeSpriteFramesFromFile(res.role_plist);cc.spriteFrameCache.removeSpriteFramesFromFile(res.game_plist);cc.spriteFrameCache.removeSpriteFramesFromFile(res.npc_plist);cc.director.runScene(cc.TransitionFade.create(0.6,GameOverScene.create()))},reStart:function(){this.init()}}), GameScene=cc.Scene.extend({onEnter:function(){this._super();var a=new GameLayer;a.init();this.addChild(a)}});GameScene.create=function(){var a=new GameScene;return a&&a.init()?a:null};var GameOverLayer=cc.Layer.extend({_time:null,_bg:null,_scoreLabel:null,_sharelayer:null,_viewB:null,sharemenu:null,againmenu:null,downmenu:null,_commentLabel:null,_iconLabel:null,ctor:function(){this._super()},init:function(){cc.spriteFrameCache.addSpriteFrames(res.other_plist);this.initBg();this.initMenu();var a=cc.Sprite.create(cc.tglogotexture2d);a.y=10;a.anchorY=0;a.x=winSize.width/2;this.addChild(a)},initEvent:function(){var a=this,b=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE, swallowTouches:!1,onTouchBegan:function(b,d){var e=d.getCurrentTarget(),l=e.convertToNodeSpace(b.getLocation()),h=e.getContentSize(),h=cc.rect(0,0,h.width,h.height);if(cc.rectContainsPoint(h,l)){e.y-=2;if(e==a.sharemenu)a.onShare();else if(e==a.againmenu)a.onAgain();return!0}return!1},onTouchEnded:function(a,b){var e=b.getCurrentTarget();e.y+=2}});cc.eventManager.addListener(b,a.sharemenu);cc.eventManager.addListener(b.clone(),a.againmenu)},initMenu:function(){this.sharemenu=cc.Sprite.create("#share.png"); this.againmenu=cc.Sprite.create("#again.png");this.addChild(this.sharemenu);this.addChild(this.againmenu);this._bg.x=winSize.width/2;this._bg.y=winSize.height/2+235-190+70;GD.isWin&&(this._scoreLabel.x=this._bg.x-40,this._scoreLabel.y=this._bg.y+60,this._iconLabel.x=this._bg.x-20,this._iconLabel.y=this._bg.y-30);this.sharemenu.x=this._bg.x+101;this.againmenu.y=this.sharemenu.y=this._bg.y-235;this.againmenu.x=this._bg.x-101;var a=this;setTimeout(function(){a.initEvent()},500)},initBg:function(){this._sharelayer= null;this._bg=cc.Sprite.create(!0==GD.isWin?"#over.png":"#over2.png");this.addChild(this._bg);if(GD.isWin){this._scoreLabel=cc.LabelTTF.create("","Arial",38);this.addChild(this._scoreLabel);this._scoreLabel.color=cc.color(253,244,158,255);this._scoreLabel.anchorX=0.5;this._scoreLabel.setString(GD.USETIME+"\u79d2");this._iconLabel=cc.LabelTTF.create("","Arial",38);this._iconLabel.color=cc.color(253,244,158,255);this._iconLabel.anchorX=0.5;this.addChild(this._iconLabel);var a=Math.floor(100*(GD.MAXTIME- GD.USETIME)/GD.MAXTIME)+30;this._iconLabel.setString((99