game.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. var screenWidth = 640,
  2. screenHeight = 960,
  3. renderer = PIXI.autoDetectRenderer(screenWidth, screenHeight);
  4. document.body.appendChild(renderer.view);
  5. var interactive = !1,
  6. stage = new PIXI.Stage(0, interactive),
  7. Titles = function() {
  8. this.starttitle = "123日本头号战犯已被抓进监狱, 交给你来收拾他们!!!;123请勿疲劳暴打小日本~ 手抽不负责!!;123习惯性暴揍小日本, 轻松治愈受挫心灵。;123爱国不是口号,更是行动, 快来和我一起捅鬼子;痛恨小日本侵犯我们的领土吗? 报仇的时候来了,根本停不下来, 让你爽到爆!;日本战犯正在准备越狱,快阻止 他们,什么,苍老师也在?!;123猛戳日本鬼子的时候 注意不要误伤老师哟;点击屏幕,暴打小日本! 让你爽到爆!".split(";");
  9. this.endtitle = ["胜似王二小", "强过小兵张嘎", "翻版双枪老太婆", "英雄李向阳归来", "真乃在世李云龙"];
  10. this.endratio = [[10, 39], [40, 59], [60, 79], [80, 89], [90, 99]]
  11. };
  12. Titles.constructor = Titles;
  13. Titles.prototype.getStartTitle = function() {
  14. var a = this.starttitle.length,
  15. a = Math.floor(Math.random() * a);
  16. return this.starttitle[a]
  17. };
  18. Titles.prototype.getEndTitle = function() {
  19. return 500 > userScore ? 0 : 650 > userScore ? 1 : 800 > userScore ? 2 : 1E3 > userScore ? 3 : 4
  20. };
  21. Titles.prototype.getEndratio = function(a) {
  22. return Math.floor(Math.random() * (this.endratio[a][1] - this.endratio[a][0])) + this.endratio[a][0]
  23. };
  24. var Time = function() {
  25. this.gameDuration = 35E3;
  26. this.freeze = 200;
  27. this.startTime = this.lastTime = this.timeleft = 0
  28. };
  29. Time.constructor = Time;
  30. Time.prototype.update = function() {
  31. var a = Date.now();
  32. this.timeleft = this.gameDuration - (a - this.startTime);
  33. var b = Math.round(this.timeleft / 1E3);
  34. if (0 < showhits && a > showhits) {
  35. for (var c = hitsTexture.shift(); void 0 != c;) stage.removeChild(c),
  36. c = hitsTexture.shift();
  37. stage.removeChild(hittext);
  38. showhits = 0
  39. }
  40. 0 < showminus && a > showminus && (stage.removeChild(minusscore), showminus = 0);
  41. 0 < this.timeleft ? (timeText.setText(b + "\u79d2"), a = this.timeleft - (this.gameDuration - 531 / 555 * this.gameDuration), 0 > a && (a = 0), a = a / this.gameDuration * 555, timemiddlebar.width = a, timerightbar.position.x = 55 + a) : (timeleftbar.width = 0, timemiddlebar.width = 0, timerightbar.width = 0, stage.addChild(startbackground), finalScoreText.setText(userScore), finalScoreText.position.x = (screenWidth - finalScoreText.width) / 2, stage.addChild(finalScoreText), stage.addChild(scoreprofile), a = title.getEndTitle(), shareData.sDesc = sprintf("\u6211\u706d\u4e86{count}\u53ea\u9b3c\u5b50\uff0c \u8d85{ratio}%\u7684\u4eba\uff0c{title}", {
  42. count: userScore,
  43. ratio: title.getEndratio(a),
  44. title: title.endtitle[a]
  45. }),dp_submitScore(userScore), finalTitleText.setText(shareData.sDesc + "\uff01"), finalTitleText.position.x = (screenWidth - finalTitleText.width) / 2, stage.addChild(finalTitleText), stage.addChild(restartbutton), stage.addChild(fenxiangbutton), GAME.currentScreen = "scoreScreen", console.log("times up!"))
  46. };
  47. Time.prototype.start = function() {
  48. this.startTime = this.lastTime = Date.now();
  49. userScore = gameHits = 0
  50. };
  51. Time.prototype.showGUIZI = function() {
  52. for (var a = Date.now(), b = this.getGameStage(), c = GAME.cast.SHOWTIME[0][b], d = 0; d < gameCellCount; d++) 0 < gameCells[d][3] && a - gameCells[d][1] > gameCells[d][2] && (GAME.game.resetCell(d), 1 == gameCells[d][3] ? (delete GAME.cast.onstageGUIZI[gameCells[d][0]], userScore -= GAME.game.scores[1][b], gameHits = 0, 0 > userScore && (userScore = 0), gameCells[d] = [ - 1, a, this.freeze, 5]) : 2 == gameCells[d][3] || 4 == gameCells[d][3] ? gameCells[d] = [ - 1, a, this.freeze, 5] : 3 == gameCells[d][3] ? (delete GAME.cast.onstageGUIZI[gameCells[d][0]], gameCells[d] = [ - 1, a, this.freeze, 5]) : 5 == gameCells[d][3] && (emptyCells[d] = 1, gameCells[d] = [ - 1, 0, 0, 0]));
  53. if (void 0 != GAME.cast.onstageGIRL[0] && a - this.startTime > GAME.cast.onstageGIRL[0][1] && (d = GAME.game.selectCell(), null !== d)) {
  54. var e = GAME.cast.SHOWTIME[2][b];
  55. GAME.cast.stageGirl(d, GAME.cast.onstageGIRL[0][0]);
  56. gameCells[d] = [GAME.cast.onstageGIRL[0][0], a, e, 2];
  57. GAME.cast.onstageGIRL.shift()
  58. }
  59. a - this.lastTime > c && (this.lastTime = a, d = GAME.game.selectCell(), null !== d && (c = GAME.cast.selectGuizi(), e = GAME.cast.SHOWTIME[1][b], gameCells[d] = [c, a, e, 1], GAME.cast.onstageGUIZI[c] = 1, GAME.cast.stageGuizi(d, c)))
  60. };
  61. Time.prototype.getGameStage = function() {
  62. var a = Date.now() - this.startTime;
  63. return phase = 5E3 > a ? 0 : 15E3 > a ? 1 : 25E3 > a ? 2 : 3
  64. };
  65. var Cast = function() {
  66. this.onstageGUIZI = {};
  67. this.onstageGIRL = [];
  68. this.GUIZI = [[PIXI.Texture.fromImage("images/renwu/anbei_01.png"), PIXI.Texture.fromImage("images/renwu/anbei_02.png"), 12, 38, 1, 30, 4, 12, "\u5b89\u500d\u664b\u4e09", "\u6211\u7237\u7237\u5c31\u662f\u81ed\u6d41\u6c13\uff0c \u6211\u7238\u4e5f\u662f\uff0c\u6211\u4e00\u5b9a \u8981\u5c06\u6d41\u6c13\u4e8b\u4e1a\u8fdb\u884c \u5230\u5e95\u2026."], [PIXI.Texture.fromImage("images/renwu/dongtiaoyingji_01.png"), PIXI.Texture.fromImage("images/renwu/dongtiaoyingji_02.png"), 12, 42, 4, 31, 5, 15, "\u4e1c\u6761\u82f1\u673a", "\u5f53\u5e74\u6211\u662f\u4f55\u7b49\u7684\u98ce \u5149\uff0c\u5927\u4e1c\u4e9a\u5171\u8363\uff0c \u6b7b\u5566\u6b7b\u5566\u6ef4\u3002\u6211\u4e00 \u5b9a\u4f1a\u56de\u6765\u7684\uff01"], [PIXI.Texture.fromImage("images/renwu/shanben56_01.png"), PIXI.Texture.fromImage("images/renwu/shanben56_02.png"), 10, 30, 1, 20, 3, 3, "\u5c71\u672c\u4e94\u5341\u516d", "\u6211\u5728\u73cd\u73e0\u6e2f\u6253\u98de\u673a \u6253\u5f97\u597d\u723d\uff0c\u6211\u60f3\u98de \u7684\u66f4\u9ad8\uff0c\u66f4\u9ad8\uff0c\u66f4 \u9ad8\uff0c\u66f4\u2026\u2026\u554a\u2026.."], [PIXI.Texture.fromImage("images/renwu/shiyuan_01.png"), PIXI.Texture.fromImage("images/renwu/shiyuan_02.png"), 12, 32, 1, 22, 6, 6, "\u77f3\u539f\u614e\u592a\u90ce", "\u6211\u5de6\u9752\u9f99\u53f3\u767d\u864e\uff0c \u4e2d\u95f4\u5939\u4e2a\u7c73\u8001\u9f20\uff0c \u4e13\u4e1a\u6405\u5c40\u4e00\u8f88\u5b50\uff0c \u904f\u5236\u4e2d\u56fd\u4e0d\u505c\u624b\u3002"], [PIXI.Texture.fromImage("images/renwu/tufei_01.png"), PIXI.Texture.fromImage("images/renwu/tufei_02.png"), 14, 48, 3, 30, 5, 21, "\u571f\u80a5\u539f\u8d24\u4e8c", "\u867d\u7136\u540d\u5b57\u53eb\u571f\u80a5\uff0c \u5176\u5b9e\u662f\u4e2a\u7626\u5e72\u3002\u6211 \u5728\u4e2d\u56fd\u6df7\u7684\u98ce\u751f\u6c34 \u8d77\uff0c\u8c01\u6562\u60f9\u6211\uff1f"], [PIXI.Texture.fromImage("images/renwu/xiaoquan_01.png"), PIXI.Texture.fromImage("images/renwu/xiaoquan_02.png"), -2, 27, -10, 17, -7, 3, "\u5c0f\u6cc9\u7eaf\u4e00\u90ce", "\u6b7b\u76ae\u8d56\u8138\uff0c\u6b7b\u4e0d\u8981 \u8138\u3001\u6b7b\u7f20\u86ee\u6253\u662f\u6211 \u7684\u7279\u957f\uff0c\u65e5\u672c\u4fb5\u7565 \u8fc7\u4e2d\u56fd\u5417\uff0c\u6ca1\u6709\uff01"]];
  69. this.GIRL = [[PIXI.Texture.fromImage("images/renwu/bo_01.png"), PIXI.Texture.fromImage("images/renwu/bo_02.png"), 27, 21, 30, -21, 15, 0, "\u6ce2\u591a\u91ce\u7ed3\u8863", "\u5f88\u81ea\u8c6a\u7684\u8ddf\u4f60\u8bf4\uff0c \u4f60\u7684200T\u786c\u76d8\u88ab \u6211\u627f\u5305\u4e86~"], [PIXI.Texture.fromImage("images/renwu/cang_01.png"), PIXI.Texture.fromImage("images/renwu/cang_02.png"), 35, 29, 10, -15, 25, 0, "\u82cd\u4e95\u7a7a", "\u6211\u6765\u7ed9\u4f60\u4eec\u6da8\u6da8\u59ff \u52bf\uff0c\u8bf7\u53eb\u6211\u5fb7\u827a\u53cc \u99a8\u4eba\u6c11\u827a\u672f\u5bb6\uff0c\u4e43 \u4eec\u4e0d\u8981\u518d\u9ed1\u6211\u4e86"], [PIXI.Texture.fromImage("images/renwu/long_01.png"), PIXI.Texture.fromImage("images/renwu/long_02.png"), 35, 30, 25, -12, 25, 0, "\u6cf7\u6cfd\u841d\u62c9", "\u6211\u6f02\u4eae\u5417\uff1f\u6211\u5728\u76d1 \u72f1\u98ce\u4e91\u7b49\u7740\u4f60\u54e6\uff0c \u4f60\u4e00\u5b9a\u8981\u6765\u54e6"]];
  70. this.SHOWTIME = [[800, 400, 240, 140], [900, 800, 700, 600], [1500, 1E3, 800, 600]]
  71. };
  72. Cast.constructor = Cast;
  73. Cast.prototype.selectGuizi = function(a) {
  74. for (a = Math.floor(Math.random() * guiziCount);;) if (void 0 != this.onstageGUIZI[a]) a = Math.floor(Math.random() * guiziCount);
  75. else return a
  76. };
  77. Cast.prototype.initGirls = function() {
  78. var a = 0,
  79. a = [],
  80. b;
  81. GAME.cast.onstageGIRL = [];
  82. for (var c = 0,
  83. d = GAME.game.girltime.length; c < d; c++) a = GAME.game.girltime[c],
  84. b = Math.round(1E3 * (a[0] + Math.random() * (a[1] - a[0]))),
  85. a = c % girlCount,
  86. a = [a, b],
  87. GAME.cast.onstageGIRL.push(a)
  88. };
  89. Cast.prototype.stageGuizi = function(a, b) {
  90. cellSpirits[a].setTexture(this.GUIZI[b][0]);
  91. cellSpirits[a].position.x = cellbarPositions[a][0] + this.GUIZI[b][2];
  92. cellSpirits[a].position.y = cellbarPositions[a][1] + this.GUIZI[b][3]
  93. };
  94. Cast.prototype.strikeGuizi = function(a, b) {
  95. cellSpirits[a].setTexture(this.GUIZI[b][1]);
  96. cellSpirits[a].position.x = cellbarPositions[a][0] + this.GUIZI[b][4];
  97. cellSpirits[a].position.y = cellbarPositions[a][1] + this.GUIZI[b][5]
  98. };
  99. Cast.prototype.stageGirl = function(a, b) {
  100. cellSpirits[a].setTexture(this.GIRL[b][0]);
  101. cellSpirits[a].position.x = cellbarPositions[a][0] + this.GIRL[b][2];
  102. cellSpirits[a].position.y = cellbarPositions[a][1] + this.GIRL[b][3]
  103. };
  104. Cast.prototype.strikeGirl = function(a, b) {
  105. cellSpirits[a].setTexture(this.GIRL[b][1]);
  106. cellSpirits[a].position.x = cellbarPositions[a][0] + this.GIRL[b][4];
  107. cellSpirits[a].position.y = cellbarPositions[a][1] + this.GIRL[b][5]
  108. };
  109. var Jianyu = function() {
  110. this.scores = [[1, 1, 1, 1], [0, 0, 0, 0], [2, 2, 2, 2]];
  111. this.girltime = [[5, 7], [7, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 25], [25, 27], [27, 29], [29, 30], [30, 31], [31, 32], [32, 34]]
  112. };
  113. Jianyu.constructor = Jianyu;
  114. Jianyu.prototype.update = function() {
  115. GAME.time.update();
  116. GAME.time.showGUIZI();
  117. scoreText.setText(userScore);
  118. scoreText.position.x = (screenWidth - scoreText.width) / 2
  119. };
  120. Jianyu.prototype.start = function() {
  121. null === GAME.currentScreen ? (stage.removeChild(startbackground), stage.removeChild(loadingguizibg), stage.removeChild(loadingguizi), stage.removeChild(guiziName), stage.removeChild(guiziText), stage.removeChild(titleText), stage.removeChild(startbutton)) : (timeleftbar.width = 12, timemiddlebar.width = 531, timerightbar.width = 12, 0 >= GAME.time.timeleft && (stage.removeChild(startbackground), stage.removeChild(finalScoreText), stage.removeChild(scoreprofile), stage.removeChild(finalTitleText), stage.removeChild(restartbutton), stage.removeChild(fenxiangbutton)));
  122. GAME.time.start();
  123. GAME.cast.initGirls();
  124. GAME.cast.onstageGUIZI = [];
  125. for (var a = 0; a < gameCellCount; a++) gameCells[a] = [ - 1, 0, 0, 0],
  126. emptyCells[a] = 1,
  127. this.resetCell(a);
  128. GAME.currentScreen = "gameScreen"
  129. };
  130. Jianyu.prototype.selectCell = function() {
  131. if (0 == emptyCells.length) return console.log("null cell"),
  132. null;
  133. var a = [],
  134. b;
  135. for (b in emptyCells) a[a.length] = b;
  136. b = Math.floor(Math.random() * a.length);
  137. delete emptyCells[a[b]];
  138. return a[b]
  139. };
  140. Jianyu.prototype.resetCell = function(a) {
  141. cellSpirits[a].setTexture(cellbarTexture);
  142. cellSpirits[a].position.x = cellbarPositions[a][0] + 30;
  143. cellSpirits[a].position.y = cellbarPositions[a][1]
  144. };
  145. Jianyu.prototype.getPlusScore = function() {
  146. return 3 > gameHits ? 0 : 18 > gameHits ? gameHits - 2 : 15
  147. };
  148. Jianyu.prototype.touch = function(a) {
  149. if ("gameScreen" == GAME.currentScreen) {
  150. var b = GAME.time.getGameStage();
  151. if (1 == gameCells[a][3]) {
  152. gameHits++;
  153. var c = this.getPlusScore();
  154. GAME.cast.strikeGuizi(a, gameCells[a][0]);
  155. userScore += this.scores[0][b] + c;
  156. gameCells[a] = [gameCells[a][0], Date.now(), GAME.time.freeze, 3];
  157. if (0 < c) {
  158. for (var b = gameHits.toString().split(""), d = c = 0, e = b.length; d < e; d++) {
  159. if (void 0 == hitsTexture[d]) var f = new PIXI.Sprite(digits[b[d]][0]);
  160. else f = hitsTexture[d],
  161. f.setTexture(digits[b[d]][0]);
  162. f.position.x = cellbarPositions[a][0] + 60 + c;
  163. f.position.y = cellbarPositions[a][1] + 7;
  164. c += digits[b[d]][1];
  165. void 0 == hitsTexture[d] && (hitsTexture.push(f), stage.addChild(f))
  166. }
  167. hittext.position.x = cellbarPositions[a][0] + 60 + c;
  168. hittext.position.y = cellbarPositions[a][1];
  169. 0 == showhits && stage.addChild(hittext);
  170. showhits = Date.now() + 600
  171. }
  172. } else 2 == gameCells[a][3] && (GAME.cast.strikeGirl(a, gameCells[a][0]), userScore -= this.scores[2][b], gameHits = 0, 0 > userScore && (userScore = 0), gameCells[a] = [ - 1, Date.now(), GAME.time.freeze, 4], minusscore.position.x = cellbarPositions[a][0] + 175, minusscore.position.y = cellbarPositions[a][1] + 75, 0 == showminus && stage.addChild(minusscore), showminus = Date.now() + 600)
  173. }
  174. };
  175. Startup = function() {
  176. var a = PIXI.Sprite.fromImage("images/loading_bg.jpg");
  177. stage.addChild(a);
  178. var b = PIXI.Sprite.fromImage("images/loading.png");
  179. b.position.x = 160;
  180. b.position.y = 432;
  181. stage.addChild(b);
  182. this.loader = new PIXI.AssetLoader("images/renwu/anbei_01.png images/renwu/anbei_02.png images/renwu/bo_01.png images/renwu/bo_02.png images/renwu/cang_01.png images/renwu/cang_02.png images/renwu/dongtiaoyingji_01.png images/renwu/dongtiaoyingji_02.png images/renwu/long_01.png images/renwu/long_02.png images/renwu/shanben56_01.png images/renwu/shanben56_02.png images/renwu/shiyuan_01.png images/renwu/shiyuan_02.png images/renwu/tufei_01.png images/renwu/tufei_02.png images/renwu/xiaoquan_01.png images/renwu/xiaoquan_02.png images/renwu/can.png images/jianyu_bg.jpg images/block_bg.png images/renwu_bg.jpg images/lianji.png".split(" "));
  183. this.loader.addEventListener("onComplete",
  184. function() {
  185. stage.addChild(background);
  186. stage.addChild(timeleftbar);
  187. stage.addChild(timemiddlebar);
  188. stage.addChild(timerightbar);
  189. stage.addChild(timeText);
  190. stage.addChild(refreshbutton);
  191. stage.addChild(scoreText);
  192. for (var c = 0; c < gameCellCount; c++) stage.addChild(cellSpirits[c]);
  193. stage.addChild(startbackground);
  194. stage.addChild(loadingguizibg);
  195. c = Math.floor(Math.random() * gameCellCount);
  196. 6 > c ? (loadingguizi = new PIXI.Sprite(GAME.cast.GUIZI[c][0]), loadingguizi.position.x = 130 + GAME.cast.GUIZI[c][6], loadingguizi.position.y = 285 + GAME.cast.GUIZI[c][7], guiziName.setText(GAME.cast.GUIZI[c][8]), guiziText.setText(GAME.cast.GUIZI[c][9])) : (c -= 6, loadingguizi = new PIXI.Sprite(GAME.cast.GIRL[c][0]), loadingguizi.position.x = 130 + GAME.cast.GIRL[c][6], loadingguizi.position.y = 285 + GAME.cast.GIRL[c][7], guiziName.setText(GAME.cast.GIRL[c][8]), guiziText.setText(GAME.cast.GIRL[c][9]));
  197. stage.addChild(loadingguizi);
  198. stage.addChild(guiziName);
  199. stage.addChild(guiziText);
  200. stage.addChild(titleText);
  201. stage.addChild(startbutton);
  202. stage.removeChild(a);
  203. stage.removeChild(b)
  204. })
  205. };
  206. Startup.constructor = Startup;
  207. Startup.prototype.run = function() {
  208. this.loader.load()
  209. };
  210. var GAME = {};
  211. GAME.time = new Time;
  212. GAME.game = new Jianyu;
  213. GAME.cast = new Cast;
  214. GAME.currentScreen = null;
  215. var gameCellCount = 9,
  216. girlCount = 3,
  217. guiziCount = 6,
  218. gameHits = 0,
  219. gameCells = [],
  220. emptyCells = {},
  221. cellSpirits = [],
  222. hitsTexture = [],
  223. userScore = showhits = showminus = 0,
  224. startup = new Startup,
  225. loadingguizi,
  226. background = PIXI.Sprite.fromImage("images/jianyu_bg.jpg"),
  227. timeleftbar = PIXI.Sprite.fromImage("images/time_left.png");
  228. timeleftbar.position.x = 43;
  229. timeleftbar.position.y = 16;
  230. var timemiddlebar = PIXI.Sprite.fromImage("images/time_line.jpg");
  231. timemiddlebar.position.x = 55;
  232. timemiddlebar.position.y = 16;
  233. timemiddlebar.width = 531;
  234. var timerightbar = PIXI.Sprite.fromImage("images/time_right.png");
  235. timerightbar.position.x = 586;
  236. timerightbar.position.y = 16;
  237. var refreshbutton = PIXI.Sprite.fromImage("images/shuaxin.png");
  238. refreshbutton.position.x = 514;
  239. refreshbutton.position.y = 55;
  240. refreshbutton.setInteractive(!0);
  241. refreshbutton.mousedown = refreshbutton.touchstart = function() {
  242. GAME.game.start()
  243. };
  244. var scoreText = new PIXI.Text("0", {
  245. font: "bold 48px \u9ed1\u4f53",
  246. fill: "#FFFFFF"
  247. });
  248. scoreText.position.x = (screenWidth - scoreText.width) / 2;
  249. scoreText.position.y = 65;
  250. var displayTime = Math.round(GAME.time.gameDuration / 1E3),
  251. timeText = new PIXI.Text(displayTime + "\u79d2", {
  252. font: "bold 24px \u9ed1\u4f53",
  253. fill: "#FFFFFF"
  254. });
  255. timeText.anchor.x = 1;
  256. timeText.anchor.y = 0;
  257. timeText.position.x = (screenWidth + timeText.width) / 2 + 20;
  258. timeText.position.y = 16;
  259. var finalScoreText = new PIXI.Text("", {
  260. font: "bold 48px \u9ed1\u4f53",
  261. fill: "#8ADE3A"
  262. });
  263. finalScoreText.position.x = (screenWidth - finalScoreText.width) / 2;
  264. finalScoreText.position.y = 470;
  265. var hittext = PIXI.Sprite.fromImage("images/lianji.png"),
  266. minusscore = PIXI.Sprite.fromImage("images/-2.png");
  267. minusscore.anchor.x = 1;
  268. for (var digits = [[PIXI.Texture.fromImage("images/num/0.png"), 30], [PIXI.Texture.fromImage("images/num/1.png"), 26], [PIXI.Texture.fromImage("images/num/2.png"), 31], [PIXI.Texture.fromImage("images/num/3.png"), 28], [PIXI.Texture.fromImage("images/num/4.png"), 31], [PIXI.Texture.fromImage("images/num/5.png"), 29], [PIXI.Texture.fromImage("images/num/6.png"), 29], [PIXI.Texture.fromImage("images/num/7.png"), 30], [PIXI.Texture.fromImage("images/num/8.png"), 30], [PIXI.Texture.fromImage("images/num/9.png"), 29]], cellbarTexture = PIXI.Texture.fromImage("images/langan.png"), cellbarPositions = [[40, 150], [233, 150], [426, 150], [40, 414], [233, 414], [426, 414], [40, 678], [233, 678], [426, 678]], i = 0; i < gameCellCount; i++) {
  269. var prison = new PIXI.Sprite(cellbarTexture);
  270. prison.setInteractive(!0);
  271. prison.position.x = cellbarPositions[i][0] + 30;
  272. prison.position.y = cellbarPositions[i][1];
  273. prison.mousedown = prison.touchstart = function() {
  274. GAME.game.touch(this.cellprisonIndex)
  275. };
  276. prison.cellprisonIndex = i;
  277. cellSpirits.push(prison)
  278. }
  279. var startbackground = PIXI.Sprite.fromImage("images/block_bg.png"),
  280. loadingguizibg = PIXI.Sprite.fromImage("images/renwu_bg.jpg");
  281. loadingguizibg.position.x = 130;
  282. loadingguizibg.position.y = 285;
  283. var guiziName = new PIXI.Text("", {
  284. font: "24px \u5fae\u8f6f\u96c5\u9ed1",
  285. fill: "#B3B7BA",
  286. wordWrap: "true",
  287. wordWrapWidth: "213"
  288. });
  289. guiziName.position.x = 343;
  290. guiziName.position.y = 285;
  291. var guiziText = new PIXI.Text("", {
  292. font: "24px \u5fae\u8f6f\u96c5\u9ed1",
  293. fill: "#B3B7BA",
  294. wordWrap: "true",
  295. wordWrapWidth: "213"
  296. });
  297. guiziText.position.x = 343;
  298. guiziText.position.y = 331;
  299. var title = new Titles,
  300. titleText = new PIXI.Text(title.getStartTitle(), {
  301. font: "30px \u5fae\u8f6f\u96c5\u9ed1",
  302. fill: "#FFFFFF",
  303. align: "left",
  304. wordWrap: "true",
  305. wordWrapWidth: "480"
  306. });
  307. titleText.position.x = (screenWidth - titleText.width) / 2;
  308. titleText.position.y = 600;
  309. var startbutton = PIXI.Sprite.fromImage("images/kaishi_btn.jpg");
  310. startbutton.position.x = 220;
  311. startbutton.position.y = 740;
  312. startbutton.setInteractive(!0);
  313. startbutton.mousedown = startbutton.touchstart = function() {
  314. GAME.game.start()
  315. };
  316. var scoreprofile = PIXI.Sprite.fromImage("images/renwu/can.png");
  317. scoreprofile.position.x = 250;
  318. scoreprofile.position.y = 255;
  319. var finalTitleText = new PIXI.Text("", {
  320. font: "27px \u5fae\u8f6f\u96c5\u9ed1",
  321. fill: "#FFFFFF",
  322. align: "center",
  323. wordWrap: "true",
  324. wordWrapWidth: "428"
  325. });
  326. finalTitleText.position.y = 560;
  327. var restartbutton = PIXI.Sprite.fromImage("images/zaiwan.jpg");
  328. restartbutton.position.x = 90;
  329. restartbutton.position.y = 710;
  330. restartbutton.setInteractive(!0);
  331. restartbutton.mousedown = restartbutton.touchstart = function() {
  332. GAME.game.start()
  333. };
  334. var fenxiangbutton = PIXI.Sprite.fromImage("images/fenxiang_btn.jpg");
  335. fenxiangbutton.position.x = 335;
  336. fenxiangbutton.position.y = 710;
  337. fenxiangbutton.setInteractive(!0);
  338. fenxiangbutton.mousedown = fenxiangbutton.touchstart = function() {
  339. //this.scale.x = .9;
  340. //this.scale.y = .9
  341. clickMore();
  342. };
  343. fenxiangbutton.mouseup = fenxiangbutton.touchend = function() {
  344. //this.scale.x = 1;
  345. //this.scale.y = 1;
  346. //stage.addChild(fenxiangbackground)
  347. };
  348. var fenxiangbackground = PIXI.Sprite.fromImage("images/fenxiang.png");
  349. fenxiangbackground.setInteractive(!0);
  350. fenxiangbackground.mousedown = fenxiangbackground.touchstart = function() {
  351. stage.removeChild(fenxiangbackground)
  352. };
  353. var ratio = new PIXI.Point;
  354. function onResize() {
  355. var a = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  356. ratio.x = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) / screenWidth;
  357. ratio.y = a / screenHeight;
  358. var a = ratio.x < ratio.y ? ratio.x: ratio.y,
  359. b = screenHeight * a;
  360. renderer.view.style.width = screenWidth * a + "px";
  361. renderer.view.style.height = b + "px"
  362. }
  363. function intPrintf() {
  364. var a = [].slice.call(arguments),
  365. b = 0;
  366. return a.shift().replace(/%(\w)?(\d)?([dfsx])/ig,
  367. function(c, d, e, f) {
  368. c = e ? Array(e - 0 + 1).join(d || "") : "";
  369. "d" == f && (c += parseInt(a[b++]));
  370. return e ? c.slice( - 1 * e) : c
  371. })
  372. }
  373. function sprintf(a, b) {
  374. return a.replace(/\{([^}]+)\}/g,
  375. function(a, d) {
  376. return b[d]
  377. })
  378. }
  379. function animate() {
  380. "gameScreen" == GAME.currentScreen && GAME.game.update();
  381. renderer.render(stage);
  382. requestAnimFrame(animate)
  383. }
  384. window.onresize = onResize;
  385. var shareData = {
  386. sTitle: "\u53ea\u67091%\u7684\u4eba\u624d\u80fd\u5f971\u5343\u5206\u4ee5\u4e0a\u7684\u5c0f\u6e38\u620f",
  387. sDesc: "\u65e5\u672c\u53f3\u7ffc\u52bf\u529b\u6b63\u8bd5\u56fe\u4e3a\u4fb5\u7565\u5386\u53f2\u7ffb\u6848\uff0c\u6bcf\u4e00\u4e2a\u6709\u826f\u77e5\u7684\u4e2d\u56fd\u4eba\u90fd\u4e0d\u4f1a\u7b54\u5e94\uff0c\u7acb\u5373\u963b\u51fb\u65e5\u672c\u9b3c\u5b50\u7be1\u6539\u5386\u53f2\uff01",
  388. };
  389. (function() {
  390. startup.run();
  391. requestAnimFrame(animate);
  392. onResize();
  393. document.oncontextmenu = function(a) {
  394. return ! 1
  395. }
  396. })();