app2.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. var GD = GD || {};
  2. GD.GAME_STATE = {
  3. HOME: 0,
  4. PLAY: 1,
  5. OVER: 2
  6. };
  7. GD.UNIT_TAG = {
  8. ENEMY: 100,
  9. PLAYER: 1E3,
  10. PET: 1010,
  11. BLOOD: 1020
  12. };
  13. GD.ACTIVE_PETS = 0;
  14. GD.ACTIVE_ENEMIES = 0;
  15. GD.CONTAINER = {
  16. ENEMIES: [],
  17. BLOOD: [],
  18. BACKSKYS: [],
  19. HitMo: [],
  20. PET: [],
  21. BACKTILEMAPS: []
  22. };
  23. GD.LIFE = 5;
  24. GD.PETKIND = 0;
  25. GD.SHOWLEVEL = 0;
  26. GD.SCORE = 0;
  27. var winSize, centerPos;
  28. GD.word = ["0", "1"];
  29. var BitNumLayer = cc.Layer.extend({
  30. timeLabel: null,
  31. scoreLabel: null,
  32. time: null,
  33. timeAction: null,
  34. ctor: function() {
  35. this._super()
  36. },
  37. step: function(a) {
  38. this.time += a
  39. },
  40. init: function() {
  41. this._super();
  42. trace("res.num_png");
  43. this.timeLabel = cc.LabelTTF.create("", "Arial", 26);
  44. this.timeLabel._textAlign = cc.TEXT_ALIGNMENT_LEFT;
  45. this.addChild(this.timeLabel);
  46. this.timeLabel.anchorX = 0.5;
  47. this.timeLabel.x = 0.5 * winSize.width + 150;
  48. this.timeLabel.y = -70 + winSize.height;
  49. this.scoreLabel = cc.LabelAtlas.create("0", res.num_png, 65, 87, "0");
  50. this.addChild(this.scoreLabel);
  51. this.scoreLabel.anchorX = 0.5;
  52. this.scoreLabel.x = winSize.width / 2 - 21;
  53. this.scoreLabel.y = -77 + winSize.height;
  54. var a = cc.ScaleBy.create(0.1, 1.1);
  55. this.scoreLabel.scale = 0.5;
  56. this.timeAction = cc.Sequence.create(a, a.reverse());
  57. this.schedule(this.step)
  58. },
  59. setNum: function(a, b) {
  60. GD.SCORE += 10 * a + 1 * b;
  61. this.scoreLabel.scale = 0.5;
  62. this.scoreLabel.runAction(this.timeAction);
  63. this.scoreLabel.setString(GD.SCORE + "")
  64. },
  65. setTimeNum: function(a) {
  66. 10 > Number(a) && (this.timeLabel.color = cc.color(255, 0, 0, 0));
  67. this.timeLabel.setString(a + '"')
  68. }
  69. });
  70. BitNumLayer.create = function() {
  71. var a = new BitNumLayer;
  72. a.init();
  73. return a
  74. };
  75. var Light = cc.Sprite.extend({
  76. active: !1,
  77. ctor: function() {
  78. this._super("#light0001.png")
  79. },
  80. destroy: function() {
  81. this.active = this.visible = !1
  82. },
  83. init: function() {
  84. this._super()
  85. },
  86. playMo: function() {
  87. this.visible = !0;
  88. this.runAction(cc.Sequence.create(cc.Animate.create(cc.animationCache.getAnimation("Blood")), cc.CallFunc.create(this.destroy, this)))
  89. }
  90. });
  91. Light.addNew = function(a, b) {
  92. Light.getOrCreate(a, b).playMo()
  93. };
  94. Light.getOrCreate = function(a, b) {
  95. for (var e = null, d = 0; d < GD.CONTAINER.BLOOD.length; d++)
  96. if (e = GD.CONTAINER.BLOOD[d], !1 == e.active) return e.x = a, e.y = b, e;
  97. e = Light.create();
  98. e.x = a;
  99. e.y = b;
  100. return e
  101. };
  102. Light.shared = function() {
  103. for (var a = [], b = 1; 5 > b; b++) {
  104. var e = cc.spriteFrameCache.getSpriteFrame("light000" + b + ".png");
  105. a.push(e);
  106. a.push(e)
  107. }
  108. cc.animationCache.addAnimation(cc.Animation.create(a, 0.02), "Blood")
  109. };
  110. Light.create = function(a) {
  111. a = new Light(a);
  112. g_sharedGameLayer.addBlood(a);
  113. GD.CONTAINER.BLOOD.push(a);
  114. return a
  115. };
  116. Light.preSet = function() {
  117. for (var a = null, b = 0; 1 > b; b++) a = Light.create(), a.visible = !1, a.active = !1
  118. };
  119. var Pet = cc.Sprite.extend({
  120. eID: 0,
  121. active: !0,
  122. direct: 1,
  123. isFire: !1,
  124. zOrder: 10,
  125. dieAction: null,
  126. liveAction: null,
  127. speed: 2,
  128. speedV: 15,
  129. rightsidex: 0,
  130. leftsidex: 0,
  131. speedY: 0,
  132. kind: 1,
  133. _zone: 100,
  134. state: 0,
  135. id: 0,
  136. _isEmpty: !0,
  137. ctor: function(a) {
  138. trace("addNewpet-----------" + a);
  139. this._super("#pet" + a + "0001.png");
  140. this.kind = 1.5 * a;
  141. this.anchorY = this.anchorX = 0.5;
  142. this.pot = [winSize.width / 2, 0];
  143. this.dieAction = cc.RepeatForever.create(cc.Animate.create(cc.animationCache.getAnimation("pet" + a)));
  144. this.liveAction = cc.RepeatForever.create(cc.Animate.create(cc.animationCache.getAnimation("pet" +
  145. a)));
  146. this.scheduleUpdate()
  147. },
  148. update: function(a) {
  149. 1 == this.state && (a = this.x, 1 == this.direct ? a < this.pot[0] + this._zone ? a += this.speed : this.scaleX = this.direct = -1 : a > this.pot[0] - this._zone ? a -= this.speed : this.direct = this.scaleX = 1, this.x = a)
  150. },
  151. toRun: function() {
  152. this.active = !0;
  153. this.stopAllActions();
  154. this.state = 1;
  155. this.runAction(this.liveAction)
  156. },
  157. toFire: function(a, b, e) {
  158. this.isFire || (this.isFire = !0, b = cc.MoveTo.create(0.1, cc.p(b, e)), this.state = 2, this.active = !1, this.runAction(cc.Sequence.create(b, cc.CallFunc.create(function() {
  159. this.toDie(a)
  160. },
  161. this))))
  162. },
  163. toDie: function(a) {
  164. this.stopAllActions();
  165. g_sharedGameLayer.petFire(a, 3);
  166. a = cc.MoveTo.create(0.2, cc.p(this.x, -50));
  167. this.runAction(cc.Sequence.create(a, cc.CallFunc.create(this.destroy, this)))
  168. },
  169. destroy: function() {
  170. GD.ACTIVE_PETS = 0;
  171. this.visible = !1;
  172. this._isEmpty = !0;
  173. this.stopAllActions()
  174. },
  175. collideRect: function(a, b) {
  176. return cc.rect(this.x, -1, 50, -1)
  177. },
  178. toActive: function(a) {
  179. GD.ACTIVE_PETS += 1;
  180. this.state = 0;
  181. this.isFire = this.active = this._isEmpty = !1;
  182. this.y = this.pot[1] + 50;
  183. this.x = 80 * a + this.pot[0];
  184. var b = 10 * Math.floor(3 *
  185. Math.random()),
  186. e = cc.MoveTo.create(0.3, cc.p(this.x, this.pot[1] + 150)),
  187. b = cc.MoveTo.create(0.5, cc.p(this.x, this.pot[1] - b + 10)),
  188. d = cc.RotateBy.create(0.3, 360);
  189. this.running = !1;
  190. this.visible = !0;
  191. this.scaleX = -a;
  192. this.direct = -a;
  193. this.runAction(cc.Sequence.create(e, b, cc.CallFunc.create(this.toRun, this)));
  194. this.runAction(d)
  195. }
  196. });
  197. Pet.addNew = function(a) {
  198. if (1 > GD.ACTIVE_PETS) {
  199. GD.PETKIND += 1;
  200. 3 < GD.PETKIND && (GD.PETKIND = 1);
  201. var b = Pet.getOrCreate(GD.PETKIND);
  202. b ? b.toActive(a) : Pet.addNew(a)
  203. }
  204. };
  205. Pet.removeOne = function(a) {
  206. trace("removepet" + a);
  207. for (var b = 0; b < GD.CONTAINER.PET.length; b++)
  208. if (a == GD.CONTAINER.PET[b]) {
  209. GD.CONTAINER.PET.splice(b, 1);
  210. break
  211. }
  212. g_sharedGameLayer.removePet(a)
  213. };
  214. Pet.getOrCreate = function(a) {
  215. var b = null;
  216. trace("GD.CONTAINER.PET.length" + GD.CONTAINER.PET.length);
  217. for (var e = 0; e < GD.CONTAINER.PET.length; e++)
  218. if (b = GD.CONTAINER.PET[e], !0 == b._isEmpty && b.kind == a) return b;
  219. return Pet.create(a)
  220. };
  221. Pet.shared = function() {
  222. for (var a = [], b = [], e = [], d = "", c = 1; 8 > c; c++) d = "pet100" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), a.push(d), d = "pet200" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), b.push(d), d = "pet300" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), e.push(d);
  223. cc.animationCache.addAnimation(cc.Animation.create(a, 0.02), "pet1");
  224. cc.animationCache.addAnimation(cc.Animation.create(b, 0.02), "pet2");
  225. cc.animationCache.addAnimation(cc.Animation.create(e, 0.02),
  226. "pet3")
  227. };
  228. Pet.create = function(a) {
  229. a = new Pet(a);
  230. g_sharedGameLayer.addPet(a, GD.UNIT_TAG.PET, "pet");
  231. GD.CONTAINER.PET.push(a);
  232. a.id = GD.CONTAINER.PET.length;
  233. !0 == a._isEmpty;
  234. return a
  235. };
  236. Pet.preSet = function() {
  237. for (var a = null, b = 0; 2 > b; b++) a = Pet.create(b + 1), a.visible = !1, a.active = !1
  238. };
  239. var Enemy = cc.Sprite.extend({
  240. eID: 0,
  241. active: !0,
  242. isLive: !0,
  243. aimX: 0,
  244. direct: 1,
  245. zOrder: 10,
  246. dieAction: null,
  247. liveAction: null,
  248. speed: 5,
  249. speedV: 15,
  250. rightsidex: 0,
  251. leftsidex: 0,
  252. showLevel: 0,
  253. showSpace: 0,
  254. hasFired: !1,
  255. speedY: 0,
  256. livenum: 1,
  257. kind: 1,
  258. power: 1,
  259. oric: null,
  260. ctor: function(a) {
  261. this._super("#npc" + a + "0001.png");
  262. this.kind = a;
  263. this.power = 1.5 * a;
  264. this.oric = this.color;
  265. this.anchorY = this.anchorX = 0.5;
  266. this.rightsidex = winSize.width
  267. },
  268. update: function(a) {
  269. if (this.active) {
  270. a = this.x;
  271. var b = this.y; - 50 < a && -1 == this.direct || a < winSize.width + 50 && 1 == this.direct ?
  272. (a += this.speed, this.y = b += this.speedY, this.x = a) : this.destroy()
  273. }
  274. },
  275. toRun: function() {
  276. this.liveAction = cc.RepeatForever.create(cc.Animate.create(cc.animationCache.getAnimation("emy" + this.kind)));
  277. this.stopAllActions();
  278. this.runAction(this.liveAction)
  279. },
  280. toBeHurt: function(a) {
  281. this.livenum -= a;
  282. 0 >= this.livenum ? this.kill() : (this.hasFired = !1, this.x -= 0.2 * winSize.width * this.direct)
  283. },
  284. kill: function() {
  285. this.isLive = !1;
  286. this.stopAllActions();
  287. this.dieAction = cc.Animate.create(cc.animationCache.getAnimation("emy" + this.kind + "die"));
  288. this.ratoteAction = cc.RepeatForever.create(cc.RotateBy.create(0.2, 360));
  289. this.runAction(this.dieAction);
  290. this.runAction(this.ratoteAction);
  291. this.speedY = 10 * Math.random() + 5;
  292. this.x > winSize.width / 2 ? (this.direct = 1, this.speed = this.speedV) : (this.direct = -1, this.speed = -this.speedV)
  293. },
  294. destroy: function() {
  295. this.speedY = 0;
  296. this.active = this.visible = !1;
  297. this.liveAction = this.dieAction = null;
  298. GD.ACTIVE_ENEMIES--;
  299. this.stopAllActions()
  300. },
  301. attactRect: function() {
  302. return cc.rect(this.x, -1, 60, -1)
  303. },
  304. collideRect: function(a, b) {
  305. return cc.rect(this.x, -1, 50, -1)
  306. },
  307. toActive: function(a, b) {
  308. trace("----Enemy.toActive-" + a + "--");
  309. this.active = this.visible = !0;
  310. this.direct = 0 == a ? -1 : 1;
  311. this.y = [45, 60, 50][this.kind - 1];
  312. this.speedY = 0;
  313. this.livenum = this.kind;
  314. var e = 65 * b;
  315. 1 == this.direct ? (this.speed = 1.5 * this.kind + 4, this.x = this.leftsidex - e, this.scaleX = 1) : (this.scaleX = -1, this.speed = -(2 * this.kind + 3), this.x = this.rightsidex + e);
  316. this.hasFired = !1;
  317. this.isLive = !0;
  318. this.rotation = 0;
  319. this.toRun()
  320. }
  321. });
  322. Enemy.addNewEnemy = function(a, b) {
  323. if (0 < this.showSpace) this.showSpace--;
  324. else if (!(10 <= GD.ACTIVE_ENEMIES)) {
  325. GD.SHOWLEVEL += 1;
  326. var e = 0.5 < Math.random() ? 1 : 0;
  327. if (3 > b) Enemy.getOrCreateEnemy(a).toActive(e, 0);
  328. else {
  329. this.showSpace = 1;
  330. for (var d = 0; d < b; d++) Enemy.getOrCreateEnemy(a).toActive(e, d)
  331. }
  332. }
  333. };
  334. Enemy.getOrCreateEnemy = function(a) {
  335. for (var b = null, e = 0; e < GD.CONTAINER.ENEMIES.length; e++)
  336. if (b = GD.CONTAINER.ENEMIES[e], !1 == b.active && b.kind == a) return GD.ACTIVE_ENEMIES++, b;
  337. b = Enemy.create(a);
  338. GD.ACTIVE_ENEMIES++;
  339. return b
  340. };
  341. Enemy.shared = function() {
  342. for (var a = [], b = [], e = [], d = "", c = 1; 19 > c; c++) d = "npc100" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), a.push(d), d = "npc200" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), b.push(d), d = "npc300" + (10 > c ? "0" + c : c) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), e.push(d);
  343. cc.animationCache.addAnimation(cc.Animation.create(a, 0.04), "emy1");
  344. cc.animationCache.addAnimation(cc.Animation.create(b, 0.04), "emy2");
  345. cc.animationCache.addAnimation(cc.Animation.create(e,
  346. 0.04), "emy3");
  347. cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.getSpriteFrame("npc12.png")], 0.04), "emy1die");
  348. cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.getSpriteFrame("npc22.png")], 0.04), "emy2die");
  349. cc.animationCache.addAnimation(cc.Animation.create([cc.spriteFrameCache.getSpriteFrame("npc32.png")], 0.04), "emy3die")
  350. };
  351. Enemy.create = function(a) {
  352. a = new Enemy(a);
  353. g_sharedGameLayer.addEnemy(a, GD.UNIT_TAG.ENEMY, a.zOrder);
  354. GD.CONTAINER.ENEMIES.push(a);
  355. return a
  356. };
  357. Enemy.preSet = function() {
  358. for (var a = null, b = 0; 2 > b; b++) a = Enemy.create(b + 1), a.visible = !1, a.active = !1, a.stopAllActions(), a.unscheduleAllCallbacks()
  359. };
  360. var Helo = cc.Sprite.extend({
  361. eID: 0,
  362. active: !0,
  363. direct: 1,
  364. zOrder: 30,
  365. hurtAction: null,
  366. standAction: null,
  367. attactActionList: [],
  368. hasFired: !1,
  369. attactKind: 0,
  370. lock: !1,
  371. potList: [
  372. [-20, 19],
  373. [-80, 32],
  374. [-20, 40],
  375. [0, 0],
  376. [12, -6]
  377. ],
  378. ctor: function() {
  379. this._super("#role0001.png");
  380. this.install();
  381. this.toStand();
  382. this.anchorY = this.anchorX = 0.5;
  383. this.y = 50
  384. },
  385. install: function() {
  386. this.attactActionList = [];
  387. for (var a = [], b = [], e = [], d = "", c = 10; 18 > c; c++) {
  388. var f = 14 < c ? 14 : c,
  389. d = "role00" + f + ".png",
  390. d = cc.spriteFrameCache.getSpriteFrame(d);
  391. a.push(d);
  392. d = "role00" + (f +
  393. 5) + ".png";
  394. d = cc.spriteFrameCache.getSpriteFrame(d);
  395. b.push(d);
  396. d = "role00" + (f + 10) + ".png";
  397. d = cc.spriteFrameCache.getSpriteFrame(d);
  398. e.push(d)
  399. }
  400. c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(a, 0.04)), cc.CallFunc.create(this.toStand, this));
  401. c.retain();
  402. this.attactActionList.push(c);
  403. c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(b, 0.04)), cc.CallFunc.create(this.toStand, this));
  404. c.retain();
  405. this.attactActionList.push(c);
  406. c = cc.Sequence.create(cc.Animate.create(cc.Animation.create(e, 0.04)), cc.CallFunc.create(this.toStand,
  407. this));
  408. c.retain();
  409. this.attactActionList.push(c);
  410. b = [];
  411. for (c = 1; 9 > c; c++) d = "role000" + c + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), b.push(d);
  412. this.standAction = cc.RepeatForever.create(cc.Animate.create(cc.Animation.create(b, 0.08)));
  413. this.standAction.retain();
  414. b = [];
  415. for (c = 25; 36 > c; c++) f = 34 < c ? 34 : c, d = "role00" + (10 > f ? "0" + f : f) + ".png", d = cc.spriteFrameCache.getSpriteFrame(d), b.push(d);
  416. c = cc.Animation.create(b, 0.04);
  417. this.hurtAction = cc.Sequence.create(cc.Animate.create(c), cc.CallFunc.create(this.toStand, this));
  418. this.hurtAction.retain()
  419. },
  420. setDirect: function(a) {
  421. this.scaleX = this.direct = a
  422. },
  423. setNewPot: function(a) {
  424. this.x = -20 * this.direct + winSize.width / 2
  425. },
  426. update: function(a) {},
  427. toStand: function() {
  428. this.lock = !1;
  429. this.stopAllActions();
  430. this.runAction(this.standAction);
  431. this.setNewPot(3)
  432. },
  433. beHurt: function(a) {
  434. this.lock = !1;
  435. 1 == a ? this.setDirect(1) : this.setDirect(-1);
  436. this.stopAllActions();
  437. this.setNewPot(4);
  438. this.runAction(this.hurtAction)
  439. },
  440. toAttact: function() {
  441. this.lock = !0;
  442. this.stopAllActions();
  443. var a = Math.floor(3 * Math.random());
  444. this.attactKind = a;
  445. this.setNewPot(a);
  446. this.runAction(this.attactActionList[a])
  447. },
  448. destroy: function() {
  449. this.active = this.visible = !1;
  450. this.attactActionList = [];
  451. this.stopAllActions()
  452. },
  453. attactRect: function() {
  454. return cc.rect(this.x, -1, 130, -1)
  455. },
  456. collideRect: function(a, b) {
  457. return cc.rect(this.x, -1, 20, -1)
  458. }
  459. });
  460. Helo.getOrCreateEnemy = function(a) {
  461. return this
  462. };
  463. Helo.create = function() {
  464. return new Helo
  465. };
  466. var HitMo = cc.Sprite.extend({
  467. active: !0,
  468. animation: null,
  469. addScoreLabel: null,
  470. bg: null,
  471. ctor: function() {
  472. this._super();
  473. this.bg = cc.Sprite.create("#hit.png");
  474. this.addChild(this.bg);
  475. this.addScoreLabel = cc.LabelAtlas.create("0", res.num_png, 65, 87, "0");
  476. this.addScoreLabel.anchorX = 0.5;
  477. this.scale = 0.85;
  478. this.addChild(this.addScoreLabel);
  479. this.addScoreLabel.color = cc.color.RED;
  480. this.addScoreLabel.scale = 0.5;
  481. this.addScoreLabel.x = -40;
  482. this.addScoreLabel.y = 0;
  483. this.x = winSize.width / 2;
  484. this.actionMove = cc.MoveTo.create(0.3, cc.p(this.x, -130 + winSize.height / 2));
  485. this.fade = cc.FadeOut.create(0.3);
  486. this.destroy()
  487. },
  488. init: function() {
  489. this._super()
  490. },
  491. play: function() {
  492. this.visible = !0;
  493. this.stopAllActions();
  494. this.y = -200 + winSize.height / 2;
  495. this.runAction(cc.Sequence.create(this.fade, cc.CallFunc.create(this.destroy, this)));
  496. this.runAction(this.actionMove)
  497. },
  498. destroy: function() {
  499. this.visible = !1
  500. },
  501. setNum: function(a) {
  502. this.active = !0;
  503. this.addScoreLabel.setString(a + "");
  504. this.play()
  505. }
  506. });
  507. HitMo.create = function() {
  508. return new HitMo
  509. };
  510. function ShakeCls() {
  511. this.shakeee = null;
  512. var a = this;
  513. this.bool = !1;
  514. this.hitAndShake = function(a, e, d, c, f) {
  515. this.bool = !0;
  516. this.shakeee = a;
  517. null == this.shakeee.basex && (this.shakeee.basex = this.shakeee.x);
  518. null == this.shakeee.basey && (this.shakeee.basey = this.shakeee.y);
  519. this.shakeee.rangeX = null == e ? 20 : e;
  520. this.shakeee.rangeY = null == d ? 20 : d;
  521. this.shakeee.x = this.shakeee.basex - this.shakeee.rangeX / 2 + this.shakeee.rangeX * Math.random();
  522. this.shakeee.y = this.shakeee.basey - this.shakeee.rangeY + 2 * this.shakeee.rangeY * Math.random();
  523. this.shakeee.flashTime =
  524. 6;
  525. this.shakeee.funcCall = null == f ? null : f;
  526. this.shakeee.shakeTimeCount = 0;
  527. this.shakeee.cframe = 0
  528. };
  529. this.update = function() {
  530. 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))))
  531. };
  532. this.cancelHitAndShake = function(a) {
  533. this.bool = !1;
  534. a || (a = this.shakeee);
  535. a.x = a.basex;
  536. a.y = a.basey
  537. }
  538. }
  539. var shake = new ShakeCls;
  540. var MenuLayer = cc.Layer.extend({
  541. menu: null,
  542. ctor: function() {
  543. this._super()
  544. },
  545. init: function() {
  546. this._super();
  547. centerPos = cc.p(winSize.width / 2, winSize.height / 2);
  548. var a = cc.Sprite.create(res.gameintro),
  549. b = cc.DrawNode.create();
  550. this.addChild(b, 0);
  551. b.drawRect(cc.p(-56, -5), cc.p(800, winSize.height + 7), cc.color(25, 25, 25, 255), 0, 0);
  552. this.addChild(a);
  553. this.menu = cc.Sprite.create(res.start);
  554. this.menu.x = winSize.width / 2;
  555. this.addChild(this.menu);
  556. a.y = winSize.height / 2 + 267.5 - 211;
  557. this.menu.y = a.y - 267.5;
  558. a.x = winSize.width / 2;
  559. this.initEvent();
  560. a = cc.Sprite.create(cc.tglogotexture2d);
  561. a.y = 26;
  562. a.anchorX = 0.5;
  563. a.x = winSize.width / 2;
  564. this.addChild(a)
  565. },
  566. initEvent: function() {
  567. var a = this,
  568. b = cc.EventListener.create({
  569. event: cc.EventListener.TOUCH_ONE_BY_ONE,
  570. swallowTouches: !1,
  571. onTouchBegan: function(b, d) {
  572. var c = d.getCurrentTarget(),
  573. f = c.convertToNodeSpace(b.getLocation()),
  574. c = c.getContentSize(),
  575. c = cc.rect(0, 0, c.width, c.height);
  576. return cc.rectContainsPoint(c, f) ? (a.menu.y -= 3, a.menu.color = cc.color(150, 150, 150, 150), setTimeout(function() {
  577. a.onPlay()
  578. }, 20), !0) : !1
  579. },
  580. onTouchEnded: function(a,
  581. b) {
  582. return !1
  583. }
  584. });
  585. cc.eventManager.addListener(b, a.menu)
  586. },
  587. onPlay: function() {
  588. // pgvSendClick && "function" == typeof pgvSendClick && pgvSendClick({
  589. // hottag: "act.minixd.start"
  590. // });
  591. cc.director.runScene(cc.TransitionFade.create(0.3, GameScene.create()))
  592. }
  593. }),
  594. MenuScene = cc.Scene.extend({
  595. onEnter: function() {
  596. this._super();
  597. var a = new MenuLayer;
  598. a.init();
  599. this.addChild(a)
  600. }
  601. });
  602. MenuScene.create = function() {
  603. var a = new MenuScene;
  604. return a && a.init() ? a : null
  605. };
  606. STATE_PLAYING = 0;
  607. STATE_GAMEOVER = 1;
  608. var g_sharedGameLayer, GameLayer = cc.Layer.extend({
  609. _size: 0,
  610. _helo: null,
  611. _heloB: null,
  612. _time: GD.MAXTIME,
  613. _midx: 0,
  614. _leftmidx: 0,
  615. _rightmidx: 0,
  616. _attactzone: [],
  617. _npcontainer: null,
  618. _introscene: null,
  619. _live: 0,
  620. _roles: null,
  621. _attackLeft: null,
  622. _attackRight: null,
  623. _dataLayer: null,
  624. _state: STATE_PLAYING,
  625. _hitUI: null,
  626. numLayer: null,
  627. _hitNum: 0,
  628. _liveBar: null,
  629. _barRenderer: null,
  630. _time2: 0,
  631. _others: null,
  632. _BtnColor: null,
  633. _space: 60,
  634. _barsize: [168, 17],
  635. _locktime: 3,
  636. ctor: function() {
  637. this._super()
  638. },
  639. init: function() {
  640. if (this._super()) {
  641. this._space = 40;
  642. GD.SCORE =
  643. 0;
  644. this._time = GD.MAXTIME;
  645. GD.CONTAINER.ENEMIES = [];
  646. GD.CONTAINER.BLOOD = [];
  647. GD.CONTAINER.PET = [];
  648. GD.ACTIVE_PETS = 0;
  649. GD.ACTIVE_ENEMIES = 0;
  650. this._midx = winSize.width / 2;
  651. this._leftmidx = this._midx / 2 - 120;
  652. this._rightmidx = this._midx + 120;
  653. g_sharedGameLayer = this;
  654. this.initBg();
  655. this.initRoles();
  656. this.initData();
  657. this.initUserControl();
  658. var a = cc.Sprite.create(cc.tglogotexture2d);
  659. a.y = 26;
  660. a.anchorX = 0.5;
  661. a.x = winSize.width / 2;
  662. this.addChild(a);
  663. this._state = STATE_PLAYING;
  664. this.schedule(this.clockCounter2, 0.1);
  665. this.scheduleUpdate()
  666. }
  667. },
  668. initRoles: function() {
  669. cc.spriteFrameCache.addSpriteFrames(res.helo_plist);
  670. var a = cc.textureCache.addImage(res.helo_png);
  671. this._heloB = cc.SpriteBatchNode.create(a);
  672. this._heloB.setBlendFunc(cc.SRC_ALPHA, cc.ONE);
  673. this.addChild(this._heloB);
  674. this._helo = Helo.create();
  675. this._heloB.addChild(this._helo, 0);
  676. this._helo.y = winSize.height / 2 + 10;
  677. cc.spriteFrameCache.addSpriteFrames(res.npc_plist);
  678. a = cc.textureCache.addImage(res.npc_png);
  679. this._roles = cc.SpriteBatchNode.create(a);
  680. this._roles.setBlendFunc(cc.SRC_ALPHA, cc.ONE);
  681. this.addChild(this._roles);
  682. this._roles.y = winSize.height / 2 - 40;
  683. Pet.shared();
  684. Pet.preSet();
  685. Light.shared();
  686. Light.preSet();
  687. Enemy.shared();
  688. Enemy.preSet();
  689. trace("GD.CONTAINER.PET------" + GD.CONTAINER.PET.length)
  690. },
  691. initData: function() {
  692. this._time = this._time2 = GD.MAXTIME;
  693. this._barRenderer = new cc.Sprite.create("#bar.png");
  694. this._barsize = [this._barRenderer.width, this._barRenderer.height];
  695. this._live = GD.LIFE;
  696. var a = new cc.Sprite.create("#bar.png");
  697. a.color = cc.color(25, 25, 25, 150);
  698. a.anchorX = this._barRenderer.anchorX = 0;
  699. a.anchorY = this._barRenderer.anchorY = 0;
  700. a.x = this._barRenderer.x = winSize.width /
  701. 2 - 145;
  702. a.y = this._barRenderer.y = winSize.height / 2 + 239;
  703. a.y -= 3;
  704. this.addChild(a);
  705. this._barRenderer.color = cc.color.RED;
  706. this.addChild(this._barRenderer);
  707. this.setLive(0);
  708. this._dataLayer = BitNumLayer.create();
  709. this.addChild(this._dataLayer);
  710. cc.Scheduler && (this._hitUI = HitMo.create());
  711. this._roles.addChild(this._hitUI)
  712. },
  713. initUserControl: function() {
  714. this._attackLeft = new cc.Sprite("#left.png");
  715. this._attackRight = new cc.Sprite("#left.png");
  716. this._BtnColor = this._attackLeft.color;
  717. this._attackRight.scaleX = -1;
  718. this._attackLeft.x =
  719. 0.3 * winSize.width;
  720. this._attackLeft.y = this._attackRight.y = 0.2 * winSize.height;
  721. this._attackRight.x = 0.7 * winSize.width;
  722. this.addChild(this._attackLeft);
  723. this.addChild(this._attackRight);
  724. this._attackRight.scaleX = -1;
  725. var a = this,
  726. b = cc.EventListener.create({
  727. event: cc.EventListener.TOUCH_ONE_BY_ONE,
  728. swallowTouches: !1,
  729. onTouchBegan: function(b, d) {
  730. var c = d.getCurrentTarget(),
  731. f = c.convertToNodeSpace(b.getLocation());
  732. c.getContentSize();
  733. c = cc.rect(0, 0, winSize.width / 2, winSize.height);
  734. cc.rectContainsPoint(c, f) ? a.processTouchEvent(-1) :
  735. a.processTouchEvent(1);
  736. return !0
  737. },
  738. onTouchEnded: function(b, d) {
  739. a.processTouchEndEvent()
  740. }
  741. });
  742. cc.eventManager.addListener(b, this);
  743. cc.eventManager.addListener(b.clone(), this)
  744. },
  745. initBg: function() {
  746. this._bg = new cc.Sprite(res.gamebg);
  747. this._bg.setPosition(centerPos);
  748. this.addChild(this._bg)
  749. },
  750. addEnemy: function(a, b, e) {
  751. trace("----addEnemy.-" + a + "--" + b);
  752. this._roles.addChild(a, b, e)
  753. },
  754. addPet: function(a, b, e) {
  755. this._roles.addChild(a, b, e)
  756. },
  757. removePet: function(a) {
  758. this._roles.addChild(a)
  759. },
  760. addBlood: function(a, b) {
  761. this._roles.addChild(a,
  762. b)
  763. },
  764. attactEnemy: function(a) {
  765. if (!(0 < this._locktime)) {
  766. this._locktime = 6;
  767. var b, e, d = this._helo.attactRect(),
  768. c = 1,
  769. f = !1;
  770. for (e = 0; e < GD.CONTAINER.ENEMIES.length; e++)
  771. if (b = GD.CONTAINER.ENEMIES[e], b.active && b.isLive && (b.x - this._midx < d.width && 1 == a && b.x > this._midx || this._midx - b.x < d.width && -1 == a && b.x < this._midx)) b.toBeHurt(1), f = !0, Light.addNew(b.x, b.y), 0 == b.livenum && (GD.GETNUM += 1, c += b.kind, 1 < b.kind && Pet.addNew(b.x > this._midx ? 1 : -1));
  772. cc.audioEngine.stopAllEffects();
  773. f ? (this._hitNum += 1, GD.MAXHITUM < this._hitNum && (GD.MAXHITUM =
  774. this._hitNum), this._hitUI.setNum(this._hitNum), shake.hitAndShake(this._bg, 10, 10), 0 < c && this._dataLayer.setNum(c, this._hitNum), GD.SOUND && cc.audioEngine.playEffect(res.role_a2, !1)) : GD.SOUND && cc.audioEngine.playEffect(res.role_a1, !1);
  775. this._helo.toAttact()
  776. }
  777. },
  778. setLive: function(a) {
  779. this._live -= a;
  780. if (0 >= this._live) {
  781. this._live = 0;
  782. var b = this;
  783. setTimeout(function() {
  784. b.onGameOver()
  785. }, 500)
  786. }
  787. a = Math.floor(100 * this._live / GD.LIFE);
  788. a = 182 * (0 >= a ? 0 : 100 < a ? 100 : a) / 100;
  789. this._barRenderer && this._barRenderer.setTextureRect(cc.rect(0,
  790. 0, a, 11))
  791. },
  792. clockCounter2: function() {
  793. if (this._state == STATE_PLAYING)
  794. if (0 < this._time2) {
  795. this._time2 -= 0.1;
  796. this._time = Math.floor(this._time2);
  797. this._time2 = Math.floor(10 * this._time2) / 10;
  798. var a = 0 == this._time2 - this._time ? this._time2 + ".0" : this._time2;
  799. GD.USETIME = GD.MAXTIME - Number(this._time2);
  800. GD.USETIME = 0 > GD.USETIME ? 0 : GD.USETIME;
  801. GD.USETIME = Math.floor(10 * GD.USETIME) / 10;
  802. this._dataLayer.setTimeNum(a)
  803. } else this.onGameOver()
  804. },
  805. processTouchEndEvent: function() {
  806. this._attackLeft.color = this._BtnColor;
  807. this._attackRight.color =
  808. this._BtnColor
  809. },
  810. processTouchEvent: function(a) {
  811. this._state == STATE_PLAYING && (-1 == a ? (this._attackLeft.color = cc.color.RED, this._helo.setDirect(1), this.attactEnemy(-1)) : 1 == a && (this._attackRight.color = cc.color.RED, this._helo.setDirect(-1), this.attactEnemy(1)))
  812. },
  813. update: function(a) {
  814. this._state == STATE_PLAYING && (0 >= this._locktime ? this._locktime = 0 : this._locktime--, this.checkIsCollide(a), this.updateUI())
  815. },
  816. checkIsCollide: function(a) {
  817. var b, e, d;
  818. this._helo.collideRect();
  819. for (d = 0; d < GD.CONTAINER.ENEMIES.length; d++)
  820. if (b =
  821. GD.CONTAINER.ENEMIES[d], b.active && (b.update(a), b.isLive && !b.hasFired && (e = b.attactRect(), e.width + e.x > this._midx && 1 == b.direct || e.x - e.width < this._midx && -1 == b.direct))) b.hasFired = !0, this.checkPet(b) || (this._hitNum = 0, this.setLive(b.power), this._helo.beHurt(b.direct))
  822. },
  823. checkPet: function(a) {
  824. if (0 < GD.CONTAINER.PET.length)
  825. for (var b = 0; b < GD.CONTAINER.PET.length; b++) {
  826. var e = GD.CONTAINER.PET[b];
  827. if (e && e.active) return e.toFire(a, a.x, a.y), !0
  828. }
  829. return !1
  830. },
  831. petFire: function(a, b) {
  832. Light.addNew(a.x, a.y);
  833. a.toBeHurt(3)
  834. },
  835. updateUI: function() {
  836. shake &&
  837. shake.update();
  838. if (this._state == STATE_PLAYING)
  839. if (0 >= this._space) {
  840. this._space = 30;
  841. var a = 1,
  842. b;
  843. 10 > this._time ? (a = 3, b = 0.3 < Math.random() ? 4 : 3) : 20 >= this._time ? (a = 0.3 < Math.random() ? 3 : 2, b = 3) : 50 > this._time ? 20 < this._time && 24 > this._time || 30 < this._time && 34 > this._time || 40 < this._time && 44 > this._time ? (a = 0.2 < Math.random() ? 3 : 2, b == 0.7 < Math.random() ? 2 : 1) : (a = Math.floor(2 * Math.random()) + 1, b = 1 != a ? 2 : 3) : 55 > this._time ? (a = 0.3 < Math.random() ? 2 : 1, b = 2 - a + 2) : 57 != this._time ? (a = 1, b = Math.floor(1 * Math.random()) + 2) : (a = 2, b = Math.floor(1 * Math.random()) +
  844. 1);
  845. Enemy.addNewEnemy(a, b)
  846. } else this._space--
  847. },
  848. clearEmeny: function() {
  849. for (i = 0; i < GD.CONTAINER.ENEMIES.length; i++) {
  850. var a = GD.CONTAINER.ENEMIES[i];
  851. a && this._roles.removeChild(a)
  852. }
  853. GD.CONTAINER.ENEMIES = []
  854. },
  855. onGameOver: function() {
  856. trace("ENEMIES------------" + GD.CONTAINER.ENEMIES.length);
  857. trace("PET------------" + GD.CONTAINER.PET.length);
  858. trace("BLOOD------------" + GD.CONTAINER.BLOOD.length);
  859. trace("onGameOver------------" + this._roles.getChildrenCount());
  860. this._state = STATE_GAMEOVER;
  861. this.unschedule(this.clockCounter2,
  862. 0.1);
  863. this.clearEmeny();
  864. this._heloB.removeAllChildren();
  865. this._helo = null;
  866. cc.eventManager.removeAllListeners();
  867. this._roles.removeAllChildren();
  868. cc.spriteFrameCache.removeSpriteFramesFromFile(res.helo_plist);
  869. cc.spriteFrameCache.removeSpriteFramesFromFile(res.npc_plist);
  870. cc.director.runScene(cc.TransitionFade.create(0.6, GameOverScene.create()))
  871. },
  872. reStart: function() {
  873. this.init()
  874. }
  875. }),
  876. GameScene = cc.Scene.extend({
  877. onEnter: function() {
  878. this._super();
  879. var a = new GameLayer;
  880. a.init();
  881. this.addChild(a)
  882. }
  883. });
  884. GameScene.create = function() {
  885. var a = new GameScene;
  886. return a && a.init() ? a : null
  887. };
  888. var ShareLayer = cc.Layer.extend({
  889. _time: null,
  890. _bg: null,
  891. _scoreLabel: null,
  892. menu: null,
  893. listener4: null,
  894. ctor: function() {
  895. this._super()
  896. },
  897. init: function() {
  898. this.initBg();
  899. this.initMenu();
  900. var a = cc.Sprite.create(cc.tglogotexture2d);
  901. a.y = 26;
  902. a.anchorX = 0.5;
  903. a.x = winSize.width / 2;
  904. this.addChild(a)
  905. },
  906. initMenu: function() {
  907. this.menu = cc.Sprite.create("#return0001.png");
  908. this.menu.x = winSize.width / 2;
  909. this.menu.y = 100;
  910. this.addChild(this.menu);
  911. var a = this;
  912. this.listener4 = cc.EventListener.create({
  913. event: cc.EventListener.TOUCH_ONE_BY_ONE,
  914. swallowTouches: !1,
  915. onTouchBegan: function(a, e) {
  916. var d = e.getCurrentTarget(),
  917. c = d.convertToNodeSpace(a.getLocation()),
  918. f = d.getContentSize(),
  919. f = cc.rect(0, 0, f.width, f.height);
  920. cc.rectContainsPoint(f, c) && (d.y -= 2);
  921. return !0
  922. },
  923. onTouchEnded: function(b, e) {
  924. a.onReturn()
  925. }
  926. });
  927. cc.eventManager.addListener(this.listener4, this.menu)
  928. },
  929. onReturn: function() {
  930. cc.eventManager.removeListener(this.listener4, this.menu);
  931. cc.director.runScene(cc.TransitionFade.create(0.3, GameOverScene.create()))
  932. },
  933. initBg: function() {
  934. trace("initBg");
  935. var a = cc.DrawNode.create();
  936. a.drawRect(cc.p(-56, -10), cc.p(800, winSize.height + 20), cc.color(25, 25, 25, 255), 0, 0);
  937. this.addChild(a);
  938. this._bg = new cc.Sprite("#shareword.png");
  939. this._bg.x = winSize.width / 2;
  940. this._bg.y = winSize.height - 270;
  941. this.addChild(this._bg)
  942. }
  943. }),
  944. ShareScene = cc.Scene.extend({
  945. onEnter: function() {
  946. this._super();
  947. var a = new ShareLayer;
  948. a.init();
  949. this.addChild(a)
  950. }
  951. });
  952. ShareScene.create = function() {
  953. var a = new ShareScene;
  954. return a && a.init() ? a : null
  955. };
  956. var GameOverLayer = cc.Layer.extend({
  957. _time: null,
  958. _bg: null,
  959. _scoreLabel: null,
  960. _sharelayer: null,
  961. _viewB: null,
  962. sharemenu: null,
  963. againmenu: null,
  964. downmenu: null,
  965. ctor: function() {
  966. this._super()
  967. },
  968. init: function() {
  969. cc.spriteFrameCache.addSpriteFrames(res.gameover_plist);
  970. this.initBg();
  971. this.initMenu();
  972. var a = cc.Sprite.create(cc.tglogotexture2d);
  973. a.y = 26;
  974. a.anchorX = 0.5;
  975. a.x = winSize.width / 2;
  976. this.addChild(a)
  977. },
  978. initEvent: function() {
  979. var a = this,
  980. b = cc.EventListener.create({
  981. event: cc.EventListener.TOUCH_ONE_BY_ONE,
  982. swallowTouches: !1,
  983. onTouchBegan: function(b,
  984. d) {
  985. var c = d.getCurrentTarget();
  986. trace(c);
  987. var f = c.convertToNodeSpace(b.getLocation()),
  988. g = c.getContentSize(),
  989. g = cc.rect(0, 0, g.width, g.height);
  990. if (cc.rectContainsPoint(g, f)) {
  991. c.y -= 2;
  992. if (c == a.sharemenu) a.onShare();
  993. else if (c == a.againmenu) a.onAgain();
  994. else if (c == a.downmenu) a.onDownLoad();
  995. return !0
  996. }
  997. return !1
  998. },
  999. onTouchEnded: function(a, b) {
  1000. var c = b.getCurrentTarget();
  1001. c.y += 2
  1002. }
  1003. });
  1004. cc.eventManager.addListener(b, a.sharemenu);
  1005. cc.eventManager.addListener(b.clone(), a.againmenu);
  1006. cc.eventManager.addListener(b.clone(), a.downmenu)
  1007. },
  1008. initMenu: function() {
  1009. this.sharemenu = cc.Sprite.create("#share.png");
  1010. this.againmenu = cc.Sprite.create("#again.png");
  1011. this.downmenu = cc.Sprite.create("#enter.png");
  1012. this.addChild(this.sharemenu);
  1013. this.addChild(this.againmenu);
  1014. this.addChild(this.downmenu);
  1015. this._bg.x = winSize.width / 2;
  1016. this._bg.y = winSize.height / 2 + 230.5 - 189 + 70;
  1017. this._scoreLabel.x = this._bg.x;
  1018. this._scoreLabel.y = this._bg.y - 10;
  1019. this.sharemenu.x = this._bg.x + 100;
  1020. this.againmenu.y = this.sharemenu.y = this._bg.y - 230.5;
  1021. this.againmenu.x = this._bg.x - 85;
  1022. this.downmenu.x =
  1023. this._bg.x + 8;
  1024. this.downmenu.y = this._bg.y - 230.5 - 75;
  1025. var a = this;
  1026. setTimeout(function() {
  1027. a.initEvent()
  1028. }, 500)
  1029. },
  1030. initBg: function() {
  1031. this._sharelayer = null;
  1032. trace("initBg");
  1033. var a = cc.DrawNode.create();
  1034. this.addChild(a, 0);
  1035. a.drawRect(cc.p(-56, -10), cc.p(800, winSize.height + 20), cc.color(25, 25, 25, 24), 0, 0);
  1036. this._bg = new cc.Sprite("#gameover.png");
  1037. this.addChild(this._bg);
  1038. this._scoreLabel = cc.LabelAtlas.create("0", res.num_png, 65, 87, "0");
  1039. this.addChild(this._scoreLabel);
  1040. this._scoreLabel.anchorX = 0.5;
  1041. this._scoreLabel.setString(GD.SCORE)
  1042. },
  1043. onAgain: function() {
  1044. // pgvSendClick && "function" == typeof pgvSendClick && pgvSendClick({
  1045. // hottag: "act.minixd.again"
  1046. // });
  1047. cc.spriteFrameCache.removeSpriteFramesFromFile(res.npc_plist);
  1048. cc.director.runScene(cc.TransitionFade.create(0.3, MenuScene.create()))
  1049. },
  1050. onDownLoad: function() {
  1051. // pgvSendClick && "function" == typeof pgvSendClick && pgvSendClick({
  1052. // hottag: "act.minixd.download"
  1053. // });
  1054. // window.open("http://ttxd.qq.com/act/minixd/play.html", "_blank")
  1055. },
  1056. onShare: function() {
  1057. // pgvSendClick && "function" == typeof pgvSendClick && pgvSendClick({
  1058. // hottag: "act.minixd.share"
  1059. // });
  1060. cc.eventManager.removeAllListeners();
  1061. trace("onShare");
  1062. cc.director.runScene(cc.TransitionFade.create(0.3, ShareScene.create()))
  1063. },
  1064. onOver: function() {}
  1065. }),
  1066. GameOverScene = cc.Scene.extend({
  1067. onEnter: function() {
  1068. this._super();
  1069. var a = new GameOverLayer;
  1070. a.init();
  1071. this.addChild(a)
  1072. }
  1073. });
  1074. GameOverScene.create = function() {
  1075. var a = new GameOverScene;
  1076. return a && a.init() ? a : null
  1077. };
  1078. cc.game.onStart = function() {
  1079. cc.sys.isMobile ? cc.view.setDesignResolutionSize(445, 700, cc.ResolutionPolicy.FIXED_HEIGHT) : cc.view.setDesignResolutionSize(445, 700, cc.ResolutionPolicy.SHOW_ALL);
  1080. winSize = cc.director.getWinSize();
  1081. cc.LoaderScene.preload(g_mainmenu, function() {
  1082. cc.director.runScene(MenuScene.create())
  1083. }, this)
  1084. }; /* |xGv00|07811e1180a44cccec77175fcb6e7275 */