main2.js 115 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584
  1. var link, jsGame;
  2. (function() {
  3. var e = window.eval,
  4. t = function(e, t, n) {
  5. var r = n || {};
  6. if (t) {
  7. var i = function() {};
  8. i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e, e.prototype.superClass = t.prototype, i = null
  9. }
  10. for (var s in r)
  11. e.prototype[s] = r[s];
  12. return r = null, e
  13. };
  14. window.requestAnimationFrame = function() {
  15. return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout
  16. }(), window.cancelAnimationFrame = function() {
  17. return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || window.clearTimeout
  18. }(), String || (String = {}), String.format || (String.format = function() {
  19. if (arguments.length == 0)
  20. return null;
  21. var e = arguments[0] || "",
  22. t;
  23. for (var n = 1, r = arguments.length; n < r; n++)
  24. t = new RegExp("\\{" + (n - 1) + "\\}", "gm"), e = e.replace(t, arguments[n]);
  25. return t = null, e
  26. }), String.getByteLength || (String.getByteLength = function(e) {
  27. var t, n = 0,
  28. r = e || "",
  29. i = r.length;
  30. for (t = 0; t < i; t++)
  31. r.charCodeAt(t) >= 0 & r.charCodeAt(t) <= 255 ? n += 1 : n += 2;
  32. return t = r = i = null, n
  33. });
  34. if (!Array || !Array.prototype)
  35. Array.prototype = {};
  36. Array.prototype.indexOfAttr = function(e, t) {
  37. var n = (typeof e).toLowerCase(),
  38. r = -1;
  39. for (var i = 0, s = this.length; i < s; i++)
  40. if (n == "string" && this[i][e] == t || n == "number" && this[i] == e) {
  41. r = i;
  42. break
  43. }
  44. return n = null, r
  45. };
  46. var n = {
  47. canvas: {
  48. id: "linkScreen",
  49. defaultId: "linkScreen",
  50. defaultFont: "12px Arial",
  51. defaultWidth: 240,
  52. defaultHeight: 320,
  53. defaultColor: "rgb(0, 0, 0)",
  54. bgColor: "#000",
  55. cavansDoms: [],
  56. ctxs: [],
  57. device: "",
  58. fps: 1,
  59. touch: !1,
  60. zoom: 1
  61. },
  62. system: {
  63. loadRes: null,
  64. pageLoad: null,
  65. menu: null,
  66. run: null,
  67. runFn: function() {},
  68. rafRun: null,
  69. stop: null,
  70. over: null,
  71. zone: null,
  72. active: null,
  73. lastDate: Date.now(),
  74. timeout: 30,
  75. isPause: !1,
  76. gameFlow: -1,
  77. loadedImageToGameFlow: -1,
  78. zoneArgs: null,
  79. activeArgs: null,
  80. spendTime: 0,
  81. loadResTimer: null,
  82. playTimer: null
  83. },
  84. event: {
  85. key: 0,
  86. keys: {
  87. up: !1,
  88. down: !1,
  89. left: !1,
  90. right: !1,
  91. a: !1,
  92. b: !1,
  93. c: !1,
  94. menu: !1,
  95. quit: !1
  96. },
  97. lastKey: {
  98. up: !1,
  99. down: !1,
  100. left: !1,
  101. right: !1,
  102. a: !1,
  103. b: !1,
  104. c: !1,
  105. menu: !1,
  106. quit: !1
  107. },
  108. pressedKey: {
  109. up: !1,
  110. down: !1,
  111. left: !1,
  112. right: !1,
  113. a: !1,
  114. b: !1,
  115. c: !1,
  116. menu: !1,
  117. quit: !1
  118. },
  119. keyPressCtrl: {
  120. up: !0,
  121. down: !0,
  122. left: !0,
  123. right: !0,
  124. a: !0,
  125. b: !0,
  126. c: !0,
  127. menu: !0,
  128. quit: !0
  129. },
  130. keyDownGo: !1,
  131. keyUpGo: !1,
  132. keyPressedGo: !1,
  133. keyDownCallBack: null,
  134. keyUpCallBack: null,
  135. orientationChange: null,
  136. touchStart: null,
  137. touchEnd: null,
  138. touchMove: null,
  139. touchCancel: null,
  140. clickCallBack: null,
  141. mouseDownCallBack: null,
  142. mouseUpCallBack: null,
  143. mouseMoveCallBack: null,
  144. focused: !1,
  145. pageFocusCallBack: null,
  146. pageUnFocusCallBack: null,
  147. swipeCallBack: null,
  148. pageOffX: 0,
  149. pageOffY: 0,
  150. pageStarOffX: 0,
  151. pageStarOffY: 0,
  152. swipeDate: null,
  153. swipeTimeout: 200,
  154. swipeRange: 50
  155. },
  156. image: {
  157. imgs: {},
  158. imgObjs: [],
  159. initImgs: {},
  160. asyncImgObjs: {},
  161. imgCount: 0,
  162. countLoaded: 0,
  163. version: "",
  164. inited: !1
  165. },
  166. audio: {
  167. audios: {}
  168. },
  169. ajax: {
  170. xhrObj: null,
  171. pool: [],
  172. poolLength: 5,
  173. date: null,
  174. isTimeout: !1,
  175. param: {
  176. type: "get",
  177. data: null,
  178. dataType: "json",
  179. url: "",
  180. xhr: null,
  181. timeout: 5e3,
  182. before: function(e) {},
  183. success: function(e, t) {},
  184. error: function(e, t) {},
  185. complete: function(e) {}
  186. }
  187. },
  188. request: {
  189. gets: []
  190. },
  191. buttonLayout: {
  192. buttons: [],
  193. Button: t(function(e) {
  194. this.id = e.id, this.value = e.value, this.x = e.x, this.y = e.y, this.width = e.width, this.height = e.height, this.bgColor = e.bgColor, this.bgStroke = e.bgStroke, this.stroke = e.stroke, this.font = e.font, this.imageId = e.imageId, this.sx = e.sx, this.sy = e.sy, this.color = e.color, this.hx = e.hx, this.hy = e.hy, this.hColor = e.hColor, this.dex = e.dex, this.dey = e.dey, this.deColor = e.deColor, this.hided = e.hided, this.disabled = e.disabled, this.path = e.path, this.hovered = !1, this.repeated = !1, this.pressed = !1, this.released = !1, this.goned = !1, this.cacheId = "buttonLayoutCache_" + this.id, this.setDelay(e.delay).refresh()
  195. }, null, {
  196. refresh: function() {
  197. m.canvas.pass(this.cacheId, this.width * 3, this.height), this.imageId == "" ? (this.bgColor != "" && m.canvas.fillStyle(this.bgColor).fillRect(0, 0, this.width, this.height).fillRect(this.width, 0, this.width, this.height).fillRect(this.width * 2, 0, this.width, this.height), this.bgStroke != "" && m.canvas.strokeStyle(this.bgStroke).strokeRect(1, 1, this.width - 2, this.height - 2).strokeRect(this.width + 1, 1, this.width - 2, this.height - 2).strokeRect(this.width * 2 + 1, 1, this.width - 2, this.height - 2)) : m.canvas.drawImage(this.imageId, this.sx, this.sy, this.width, this.height, 0, 0, this.width, this.height).drawImage(this.imageId, this.hx, this.hy, this.width, this.height, this.width, 0, this.width, this.height).drawImage(this.imageId, this.dex, this.dey, this.width * 2, this.height, this.width * 2, 0, this.width, this.height);
  198. if (this.value != "") {
  199. var e = m.canvas.font(this.font).measureText(this.value),
  200. t = this.width - e.width >> 1,
  201. n = (this.height - e.height >> 1) + parseInt(this.font) - 2;
  202. this.stroke != "" && m.canvas.fillStyle(this.stroke).fillText(this.value, t - 1, n).fillText(this.value, t, n - 1).fillText(this.value, t + 1, n).fillText(this.value, t, n + 1).fillText(this.value, t + this.width - 1, n).fillText(this.value, t + this.width, n - 1).fillText(this.value, t + this.width + 1, n).fillText(this.value, t + this.width, n + 1).fillText(this.value, t + this.width * 2 - 1, n).fillText(this.value, t + this.width * 2, n - 1).fillText(this.value, t + this.width * 2 + 1, n).fillText(this.value, t + this.width * 2, n + 1), m.canvas.fillStyle(this.color).fillText(this.value, t, n).fillStyle(this.hColor).fillText(this.value, t + this.width, n).fillStyle(this.deColor).fillText(this.value, t + this.width * 2, n), e = t = n = null
  203. }
  204. return m.canvas.pass(), this
  205. },
  206. show: function() {
  207. return this.hided = !1, this
  208. },
  209. hide: function() {
  210. return this.hided = !0, this
  211. },
  212. disable: function(e) {
  213. return this.disabled = e, this
  214. },
  215. setPath: function(e, t) {
  216. return this.setDelay(t).path = e || [], this
  217. },
  218. endPath: function() {
  219. return this.path.length == 0
  220. },
  221. gone: function(e, t) {
  222. return this.setPath(e, t).goned = !0, this
  223. },
  224. setDelay: function(e) {
  225. return this.delay = e || 0, this.delayDate = null, this.delay > 0 && (this.delayDate = Date.now()), this
  226. },
  227. action: function() {
  228. if (this.hided)
  229. return this;
  230. this.delayDate && Date.now() - this.delayDate >= this.delay && (this.delayDate = null);
  231. if (!this.delayDate && this.path.length > 0) {
  232. var e = this.path.shift();
  233. this.x += e[0], this.y += e[1], e = null
  234. }
  235. return this
  236. },
  237. render: function() {
  238. return this.hided ? this : (m.canvas.drawCache(this.cacheId, this.hovered ? this.width : this.disabled ? this.width * 2 : 0, 0, this.width, this.height, this.x, this.y, this.width, this.height), this)
  239. },
  240. disposed: function() {
  241. return this
  242. }
  243. })
  244. }
  245. },
  246. r = {
  247. canvas: {
  248. context: {
  249. base: 0
  250. },
  251. graphics: {
  252. HCENTER: 1,
  253. VCENTER: 2,
  254. LEFT: 4,
  255. RIGHT: 8,
  256. TOP: 16,
  257. BOTTOM: 32,
  258. ANCHOR_LT: 20,
  259. ANCHOR_LV: 6,
  260. ANCHOR_LB: 36,
  261. ANCHOR_HT: 17,
  262. ANCHOR_HV: 3,
  263. ANCHOR_HB: 33,
  264. ANCHOR_RT: 24,
  265. ANCHOR_RV: 10,
  266. ANCHOR_RB: 40
  267. },
  268. trans: {
  269. TRANS_MIRROR: 2,
  270. TRANS_NONE: 0,
  271. TRANS_ROT90: 5,
  272. TRANS_ROT180: 3,
  273. TRANS_ROT270: 6,
  274. TRANS_MIRROR_ROT90: 7,
  275. TRANS_MIRROR_ROT180: 1,
  276. TRANS_MIRROR_ROT270: 4
  277. }
  278. },
  279. event: {
  280. key: {
  281. up: 38,
  282. down: 40,
  283. left: 37,
  284. right: 39,
  285. a: 90,
  286. b: 88,
  287. c: 67,
  288. menu: 49,
  289. quit: 50
  290. }
  291. },
  292. system: {
  293. gameFlowType: {
  294. menu: 0,
  295. run: 1,
  296. stop: 2,
  297. over: 3,
  298. zone: 4,
  299. active: 5,
  300. loadImage: 6,
  301. loadedImage: 7
  302. }
  303. }
  304. },
  305. i = {
  306. getCanvasDom: function() {
  307. var e;
  308. return function() {
  309. return e || (e = m.getDom(n.canvas.defaultId)), e
  310. }
  311. }(),
  312. getOffsetX: function(e) {
  313. return e.offsetX || (e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientX - i.getCanvasDom().offsetLeft : e.clientX - i.getCanvasDom().offsetLeft) || 0
  314. },
  315. getOffsetY: function(e) {
  316. return e.offsetY || (e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientY - i.getCanvasDom().offsetTop : e.clientY - i.getCanvasDom().offsetTop) || 0
  317. },
  318. keydown: function(e) {
  319. var t = i.checkKey(e.keyCode);
  320. n.event.keyDownGo && n.event.keys[t] != undefined && (n.event.keys[t] = !0), n.event.keyUpGo && n.event.lastKey[t] != undefined && (n.event.lastKey[t] = !1), n.event.keyPressCtrl[t] && n.event.keyPressedGo && (n.event.pressedKey[t] != undefined && (n.event.pressedKey[t] = !0), n.event.keyPressCtrl[t] = !1), n.event.keyDownCallBack != null && n.event.keyDownCallBack(e), t = null
  321. },
  322. keyup: function(e) {
  323. var t = i.checkKey(e.keyCode);
  324. n.event.keyDownGo && n.event.keys[t] != undefined && (n.event.keys[t] = !1), n.event.keyUpGo && n.event.lastKey[t] != undefined && (n.event.lastKey[t] = !0), n.event.keyPressedGo && (n.event.pressedKey[t] != undefined && (n.event.pressedKey[t] = !1), n.event.keyPressCtrl[t] = !0), n.event.keyUpCallBack != null && n.event.keyUpCallBack(e), t = null
  325. },
  326. orientationchange: function(e) {
  327. n.event.orientationChange != null && n.event.orientationChange(e)
  328. },
  329. swipeStart: function(e, t) {
  330. n.event.swipeCallBack != null && (n.event.swipeDate = Date.now(), n.event.pageStarOffX = e, n.event.pageStarOffY = t)
  331. },
  332. swipeSuccess: function(e, t) {
  333. if (n.event.swipeDate) {
  334. if (Date.now() - n.event.swipeDate < n.event.swipeTimeout)
  335. if (Math.abs(e - n.event.pageStarOffX) >= n.event.swipeRange || Math.abs(t - n.event.pageStarOffY) >= n.event.swipeRange)
  336. return n.event.swipeCallBack(n.event.pageStarOffX, n.event.pageStarOffY, e, t), !0;
  337. n.event.swipeDate = null
  338. }
  339. return !1
  340. },
  341. touchstart: function(e) {
  342. e.preventDefault(), n.event.pageOffX = i.getOffsetX(e), n.event.pageOffY = i.getOffsetY(e), n.event.touchStart != null && n.event.touchStart(e, n.event.pageOffX, n.event.pageOffY);
  343. if (i.buttonLayoutEventHandler(e.type, n.event.pageOffX, n.event.pageOffY))
  344. return !1;
  345. i.swipeStart(n.event.pageOffX, n.event.pageOffY)
  346. },
  347. touchend: function(e) {
  348. e.preventDefault();
  349. if (i.swipeSuccess(n.event.pageOffX, n.event.pageOffY))
  350. return !1;
  351. if (i.buttonLayoutEventHandler(e.type, n.event.pageOffX, n.event.pageOffY))
  352. return !1;
  353. n.event.touchEnd != null && n.event.touchEnd(e, n.event.pageOffX, n.event.pageOffY)
  354. },
  355. touchmove: function(e) {
  356. e.preventDefault(), n.event.pageOffX = i.getOffsetX(e), n.event.pageOffY = i.getOffsetY(e), n.event.touchMove != null && n.event.touchMove(e, n.event.pageOffX, n.event.pageOffY)
  357. },
  358. touchcancel: function(e) {
  359. n.event.pageOffX = i.getOffsetX(e), n.event.pageOffY = i.getOffsetY(e), n.event.touchCancel != null && n.event.touchCancel(e, n.event.pageOffX, n.event.pageOffY)
  360. },
  361. click: function(e) {
  362. n.event.clickCallBack != null && n.event.clickCallBack(e, i.getOffsetX(e), i.getOffsetY(e))
  363. },
  364. mouseDown: function(e) {
  365. var t = i.getOffsetX(e),
  366. r = i.getOffsetY(e);
  367. if (i.buttonLayoutEventHandler(e.type, t, r))
  368. return !1;
  369. n.event.mouseDownCallBack != null && n.event.mouseDownCallBack(e, t, r), i.swipeStart(t, r), t = r = null
  370. },
  371. mouseUp: function(e) {
  372. var t = i.getOffsetX(e),
  373. r = i.getOffsetY(e);
  374. if (i.buttonLayoutEventHandler(e.type, t, r))
  375. return !1;
  376. if (i.swipeSuccess(t, r))
  377. return !1;
  378. n.event.mouseUpCallBack != null && n.event.mouseUpCallBack(e, t, r), t = r = null
  379. },
  380. mouseMove: function(e) {
  381. n.event.mouseMoveCallBack != null && n.event.mouseMoveCallBack(e, i.getOffsetX(e), i.getOffsetY(e))
  382. },
  383. pageFocus: function(e) {
  384. if (n.event.focused)
  385. return n.event.focused = !1, !1;
  386. n.event.pageFocusCallBack != null && n.event.pageFocusCallBack(e)
  387. },
  388. pageUnFocus: function(e) {
  389. n.event.pageUnFocusCallBack != null && n.event.pageUnFocusCallBack(e)
  390. },
  391. checkKey: function(e) {
  392. var t = "0";
  393. for (var n in r.event.key)
  394. if (r.event.key[n] == e) {
  395. t = n;
  396. break
  397. }
  398. return t
  399. },
  400. getDeviceConfig: function() {
  401. var e = navigator.userAgent.toLowerCase();
  402. return e.indexOf("duopaosafari") != -1 ? {
  403. device: "duopaoSafari",
  404. fps: 1,
  405. touch: !0,
  406. zoom: 1
  407. } : e.indexOf("iphone") != -1 || e.indexOf("ipod") != -1 ? {
  408. device: "iphone",
  409. fps: 1,
  410. touch: !0,
  411. zoom: 1
  412. } : e.indexOf("ipad") != -1 ? {
  413. device: "ipad",
  414. fps: 1,
  415. touch: !0,
  416. zoom: 1
  417. } : e.indexOf("duopaoandroid") != -1 ? {
  418. device: "duopaoAndroid",
  419. fps: 1,
  420. touch: !0,
  421. zoom: 1
  422. } : e.indexOf("duopaowindowsphone") != -1 ? {
  423. device: "duopaoWindowsPhone",
  424. fps: 1,
  425. touch: !0,
  426. zoom: 1
  427. } : e.indexOf("opera mobi") != -1 ? {
  428. device: "operamobile",
  429. fps: 1,
  430. touch: !0,
  431. zoom: 1
  432. } : e.indexOf("flyflow") != -1 ? {
  433. device: "flyflow",
  434. fps: 1,
  435. touch: !0,
  436. zoom: 1
  437. } : e.indexOf("android") != -1 ? {
  438. device: "android",
  439. fps: 1,
  440. touch: !0,
  441. zoom: 1
  442. } : e.indexOf("iemobile") != -1 ? {
  443. device: "iemobile",
  444. fps: 1,
  445. touch: !1,
  446. zoom: 1
  447. } : e.indexOf("j2me") != -1 ? {
  448. device: "j2me",
  449. fps: 1,
  450. touch: !1,
  451. zoom: 1
  452. } : e.indexOf("symbian v5") != -1 ? {
  453. device: "symbian5",
  454. fps: 1,
  455. touch: !0,
  456. zoom: 1
  457. } : e.indexOf("symbian v3") != -1 ? {
  458. device: "symbian3",
  459. fps: 1,
  460. touch: !1,
  461. zoom: 1
  462. } : e.indexOf("chrome") != -1 ? {
  463. device: "chrome",
  464. fps: 1,
  465. touch: !1,
  466. zoom: 1
  467. } : e.indexOf("firefox") != -1 ? {
  468. device: "firefox",
  469. fps: 1,
  470. touch: !1,
  471. zoom: 1
  472. } : e.indexOf("msie") != -1 ? {
  473. device: "ie",
  474. fps: .5,
  475. touch: !1,
  476. zoom: 1
  477. } : e.indexOf("windows") != -1 ? {
  478. device: "ie",
  479. fps: .5,
  480. touch: !1,
  481. zoom: 1
  482. } : e.indexOf("safari") != -1 ? {
  483. device: "safari",
  484. fps: 1,
  485. touch: !1,
  486. zoom: 1
  487. } : e.indexOf("opera") != -1 ? {
  488. device: "opera",
  489. fps: 1,
  490. touch: !1,
  491. zoom: 1
  492. } : {
  493. device: "",
  494. fps: 1,
  495. touch: !1,
  496. zoom: 1
  497. }
  498. },
  499. setImage: function(e, t, r, i, s) {
  500. if (!e || !t)
  501. return !1;
  502. n.image.imgs[e] || (n.image.imgs[e] = new Image, n.image.imgs[e].onload = function() {
  503. n.image.countLoaded++, this.loaded = !0, this.cache && m.canvas.pass(this.id, this.width, this.height).drawImage(this.id, 0, 0).pass().base().delImage(this.id, !0)
  504. }, n.image.imgs[e].src = t + (n.image.version != "" ? "?v=" + n.image.version : ""), n.image.imgs[e].id = e, n.image.imgs[e].url = t, n.image.imgs[e].benchId = r, n.image.imgs[e].bench = i, n.image.imgs[e].cache = s, n.image.imgs[e].refreshed = !1)
  505. },
  506. setAudio: function(e, t, r, i, s, o) {
  507. if (!e || !t)
  508. return !1;
  509. if (!n.audio.audios[e]) {
  510. var u = new Audio(t + (n.image.version != "" ? "?v=" + n.image.version : ""));
  511. u.id = e, u.autoplay = i, u.preload = s, u.autobuffer = o, u.loop = r, n.audio.audios[u.id] = u, u = null
  512. }
  513. },
  514. loadingCallBack: function(e, t, r) {
  515. var i = m.canvas.screen.getWidth(),
  516. s = m.canvas.screen.getHeight(),
  517. o = i,
  518. u = 5,
  519. a = parseInt(i - o >> 1),
  520. f = s - u,
  521. e = e > t ? t : e,
  522. l = parseInt(e / t * 100) + "%";
  523. m.canvas.fillStyle(n.canvas.bgColor).fillRect(0, 0, i, s).fillStyle("#00FFFF").fillRect(a, f, parseInt(e / t * o), u).fillStyle("#FFF").fillText("loading " + r, 5, s - 10).fillText(l, i - m.canvas.measureText(l).width - 5, s - 10), i = s = o = u = a = f = l = null
  524. },
  525. loadingEndCallBack: null,
  526. getAnchor: function(e, t, n, i, s) {
  527. var o = e,
  528. u = t;
  529. switch (s) {
  530. case r.canvas.graphics.ANCHOR_HV:
  531. o -= parseInt(n / 2), u -= parseInt(i / 2);
  532. break;
  533. case r.canvas.graphics.ANCHOR_LV:
  534. u -= parseInt(i / 2);
  535. break;
  536. case r.canvas.graphics.ANCHOR_RV:
  537. o -= n, u -= parseInt(i / 2);
  538. break;
  539. case r.canvas.graphics.ANCHOR_HT:
  540. o -= parseInt(n / 2);
  541. break;
  542. case 0:
  543. case r.canvas.graphics.ANCHOR_LT:
  544. default:
  545. break;
  546. case r.canvas.graphics.ANCHOR_RT:
  547. o -= n;
  548. break;
  549. case r.canvas.graphics.ANCHOR_HB:
  550. o -= parseInt(n / 2), u -= i;
  551. break;
  552. case r.canvas.graphics.ANCHOR_LB:
  553. u -= i;
  554. break;
  555. case r.canvas.graphics.ANCHOR_RB:
  556. o -= n, u -= i
  557. }
  558. return {
  559. x: o,
  560. y: u
  561. }
  562. },
  563. initUrlParams: function(e) {
  564. if (e.indexOf("?") >= 0) {
  565. var t = e.split("?"),
  566. r = [];
  567. t[1].indexOf("&") >= 0 ? r = t[1].split("&") : r.push(t[1]);
  568. var i = [];
  569. for (var s = 0; s < r.length; s++)
  570. r[s].indexOf("=") >= 0 && (i = r[s].split("="), n.request.gets[i[0]] = i[1]);
  571. i = null, r = null, t = null
  572. }
  573. },
  574. audioEnded: function() {
  575. m.audio.replay(this.id)
  576. },
  577. pageLoaded: function() {
  578. n.image.inited = !0, n.system.pageLoad(m)
  579. },
  580. buttonLayoutAction: function() {
  581. var e = n.buttonLayout.buttons,
  582. t;
  583. for (var r = e.length - 1; r >= 0; r--)
  584. if (t = e[r])
  585. t.action().render(), t.goned && t.endPath() && e.splice(r, 1);
  586. e = t = null
  587. },
  588. buttonLayoutEventHandler: function(e, t, r) {
  589. var i = n.buttonLayout.buttons,
  590. s, o = !1;
  591. for (var u = i.length - 1; u >= 0; u--)
  592. if (s = i[u])
  593. if (m.comm.collision(s.x, s.y, s.width, s.height, t - 5, r - 5, 10, 10)) {
  594. switch (e) {
  595. case "mousedown":
  596. case "touchstart":
  597. s.hovered = !0, s.repeated = !0, s.pressed = !0, s.released = !1;
  598. break;
  599. case "mouseup":
  600. case "touchend":
  601. s.hovered && (s.released = !0, s.hovered = !1), s.repeated = !1, s.pressed = !1;
  602. break;
  603. default:
  604. }
  605. o = !0
  606. } else if (e == "mouseup" || e == "touchend")
  607. s.hovered = !1, s.repeated = !1;
  608. return i = s = null, o
  609. }
  610. },
  611. s, o, u, a, f, l, c, h, p, d, v = {
  612. arr: [],
  613. len: 0,
  614. v: 0
  615. };
  616. link = {
  617. init: function(e, t) {
  618. return !e && !t ? (this.version = 1,
  619. this.request.init(),
  620. this.canvas.initDevice(),
  621. this.localStorage.init(),
  622. this.sessionStorage.init()) : (n.canvas.defaultWidth = e, n.canvas.defaultHeight = t), this
  623. },
  624. extend: t,
  625. setAjax: function(e) {
  626. return n.ajax.param = this.objExtend(n.ajax.param, e || {}), this
  627. },
  628. ajax: function(e) {
  629. e && n.ajax.pool.length < n.ajax.poolLength && n.ajax.pool.push(e),
  630. e && e.clear && (n.ajax.pool = []),
  631. n.ajax.xhr || (n.ajax.xhr = new XMLHttpRequest,
  632. n.ajax.xhr.onreadystatechange = function() {
  633. if (n.ajax.isTimeout)
  634. return !1;
  635. var e = n.ajax.xhr,
  636. t = n.ajax.xhrObj;
  637. if (t && e.readyState == 4) {
  638. n.ajax.date && (clearTimeout(n.ajax.date), n.ajax.date = null);
  639. if (e.status == 200) {
  640. var r;
  641. switch (t.dataType) {
  642. case "HTML":
  643. case "SCRIPT":
  644. case "XML":
  645. r = e.responseText;
  646. break;
  647. case "TEXT":
  648. default:
  649. r = e.responseText.replace(/<[^>].*?>/g, "");
  650. break;
  651. case "JSON":
  652. r = m.getJson(e.responseText)
  653. }
  654. t.success(r, t), t.complete(t)
  655. } else
  656. t.error(t, "error");
  657. n.ajax.xhrObj = null, m.ajax()
  658. }
  659. e = t = null
  660. });
  661. if (n.ajax.xhrObj == null && n.ajax.pool.length > 0) {
  662. n.ajax.xhrObj = this.objExtend(n.ajax.param, n.ajax.pool.shift() || {});
  663. var t = n.ajax.xhr,
  664. r = n.ajax.xhrObj,
  665. i = n.ajax.xhrObj.url,
  666. s = null,
  667. o = r.data;
  668. r.type = r.type.toUpperCase(), r.dataType = r.dataType.toUpperCase(), n.ajax.isTimeout = !1;
  669. if (typeof o == "string")
  670. s = o;
  671. else if (typeof o == "object") {
  672. s = [];
  673. for (var u in o)
  674. s.push(u + "=" + o[u]);
  675. s = s.join("&")
  676. }
  677. r.type == "GET" && (i += "?" + s), t.open(r.type, i, !0), r.before(n.ajax.xhrObj), r.type == "POST" && t.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"), t.send(s), t = r = s = o = i = null, n.ajax.date = setTimeout(function() {
  678. m.ajax({
  679. clear: !0
  680. }), n.ajax.isTimeout = !0, n.ajax.xhrObj && (n.ajax.xhrObj.error(n.ajax.xhrObj, "timeout"), n.ajax.xhrObj = null)
  681. }, n.ajax.xhrObj.timeout)
  682. }
  683. return this
  684. },
  685. getDom: function(e) {
  686. try {
  687. return document.getElementById(e)
  688. } catch (t) {
  689. return document.all[e]
  690. }
  691. },
  692. objExtend: function() {
  693. var e = this.clone(arguments[0]) || {},
  694. t = 1,
  695. n = arguments.length,
  696. r = !1,
  697. i;
  698. typeof e == "boolean" && (r = e, e = arguments[1] || {}, t = 2), typeof e != "object" && (e = {}), n == t && (e = this, --t);
  699. if (!arguments[1])
  700. return e;
  701. for (; t < n; t++)
  702. if ((i = arguments[t]) != null)
  703. for (var s in i) {
  704. var o = e[s],
  705. u = i[s];
  706. if (e === u)
  707. continue;
  708. r && u && typeof u == "object" && !u.nodeType ? e[s] = this.objExtend(r, o || (u.length != null ? [] : {}), u) : u !== undefined && (e[s] = u)
  709. }
  710. return e
  711. },
  712. getJson: function(t) {
  713. var n = {};
  714. try {
  715. window.JSON ? n = JSON.parse(t) : n = e("(" + t + ")")
  716. } catch (r) {}
  717. return n
  718. },
  719. clone: function() {
  720. var e = arguments[0],
  721. t = e || [];
  722. if (typeof t == "object")
  723. if (t.length != undefined) {
  724. e = [];
  725. for (var n = 0, r = t.length; n < r; n++) {
  726. if (t[n] === undefined)
  727. continue;
  728. t[n] != null && typeof t[n] == "object" ? t[n].length != undefined ? e[n] = t[n].slice(0) : e[n] = t[n] : e[n] = t[n]
  729. }
  730. } else {
  731. e = {};
  732. for (var n in t) {
  733. if (t[n] === undefined)
  734. continue;
  735. t[n] != null && typeof t[n] == "object" ? t[n].length != undefined ? e[n] = t[n].slice(0) : e[n] = t[n] : e[n] = t[n]
  736. }
  737. }
  738. return t = null, e
  739. },
  740. classes: {},
  741. comm: {
  742. registerNotify: function(e, t) {
  743. e != null && e.register(t)
  744. },
  745. rangeRegisterNotify: function(e, t) {
  746. for (var n = 0; n < t.length; n++)
  747. m.commandFuns.registerNotify(e, t[n])
  748. },
  749. unRegisterNotify: function(e, t) {
  750. e != null && e.unregister(t)
  751. },
  752. rangeUnRegisterNotify: function(e, t) {
  753. for (var n = 0; n < t.length; n++)
  754. m.commandFuns.unRegisterNotify(e, t[n])
  755. },
  756. getRandom: function(e, t) {
  757. if (!t) {
  758. var n = e;
  759. if (!n || n < 0)
  760. n = 0;
  761. return Math.round(Math.random() * n)
  762. }
  763. return Math.round(Math.random() * (t - e) + e)
  764. },
  765. getArray: function(e, t) {
  766. v.arr = [], v.len = e.toString().length, v.v = e;
  767. for (var n = 0; n < v.len; n++)
  768. v.arr.push(v.v % 10), v.v = parseInt(v.v / 10);
  769. return t || v.arr.reverse(), v.arr
  770. },
  771. inArray: function(e, t) {
  772. var n, r = t.length;
  773. for (n = 0; n < r; n++)
  774. if (e == t[n])
  775. return n;
  776. return -1
  777. },
  778. collision: function(e, t, n, r, i, s, o, u) {
  779. return o && Math.abs(e + (n >> 1) - (i + (o >> 1))) < n + o >> 1 && Math.abs(t + (r >> 1) - (s + (u >> 1))) < r + u >> 1 ? !0 : !1
  780. },
  781. circleCollision: function(e, t, n, r, i, s) {
  782. var o = Math.abs(e - r),
  783. u = Math.abs(t - i);
  784. return Math.sqrt(o * o + u * u) < n + s ? !0 : !1
  785. },
  786. rect2CircleCollision: function(e, t, n, r, i, s, o) {
  787. var u = !1;
  788. return (u = this.circleCollision(e, t, 1, i, s, o)) || (u = this.circleCollision(e + n, t, 1, i, s, o)) || (u = this.circleCollision(e + n, t + r, 1, i, s, o)) || (u = this.circleCollision(e, t + r, 1, i, s, o)) || (u = this.collision(e, t, n, r, i - (o >> 1), s - (o >> 1), o, o)), u
  789. },
  790. polygonCollision: function(e, t, n, r, i, s, o, u) {
  791. return this.polygonSAT(e, t, n, r, i, s, o, u) && this.polygonSAT(t, e, i, s, n, r, u, o)
  792. },
  793. polygonSAT: function(e, t, n, r, i, s, o, u) {
  794. var a = e.length,
  795. f = t.length,
  796. l = n || 0,
  797. c = r || 0,
  798. h = i || 0,
  799. p = s || 0,
  800. d = o,
  801. v = u,
  802. m = l + e[e.length - 1][0],
  803. g = c + e[e.length - 1][1],
  804. y, b, w, E, S, x, T, N, C, k, L;
  805. for (k = 0; k < a; k++) {
  806. y = l + e[k][0], b = c + e[k][1], w = b - g, E = m - y, S = w * m + E * g, x = !0;
  807. for (L = 0; L < f; L++) {
  808. T = h + t[L][0], N = p + t[L][1], C = w * T + E * N - S;
  809. if (C < 0) {
  810. x = !1;
  811. break
  812. }
  813. }
  814. if (x) {
  815. if (d[0] != 0 || d[1] != 0 || v[0] != 0 || v[1] != 0) {
  816. S = w * (m + d[0]) + E * (g + d[1]);
  817. for (L = 0; L < f; L++) {
  818. T = h + t[L][0] + v[0], N = p + t[L][1] + v[1], C = w * T + E * N - S;
  819. if (C < 0) {
  820. x = !1;
  821. break
  822. }
  823. }
  824. }
  825. if (x)
  826. return !1
  827. }
  828. m = y, g = b
  829. }
  830. return !0
  831. },
  832. setMatrixRotate: function(e, t) {
  833. if (!e || !e[0])
  834. return null;
  835. var n = 50,
  836. r = 50,
  837. i, s, o = Math.PI / 180 * t,
  838. u = Math.sin(o),
  839. a = Math.cos(o);
  840. for (var f = 0; f < e.length; f++)
  841. i = e[f][0], s = e[f][1], e[f][0] = a * i - u * s, e[f][1] = u * i + a * s;
  842. return this
  843. },
  844. createPath: function(e, t, n, r, i) {
  845. var s = [],
  846. o = e || 0,
  847. u = t || 0,
  848. a = n || 0,
  849. f = r || 0,
  850. l = a - o,
  851. c = f - u,
  852. h = Math.sqrt(Math.pow(l, 2) + Math.pow(c, 2)),
  853. p = i || 5,
  854. d = p,
  855. v = 0,
  856. m = 0,
  857. g, y, b = Math.atan2(c, l) / Math.PI * 180;
  858. b = b >= 0 ? b : b + 360, d >= h && (d = h >> 1);
  859. while (d < h + p)
  860. d = d > h ? h : d, g = d * Math.cos(b / 180 * Math.PI), y = d * Math.sin(b / 180 * Math.PI), s.unshift([g - v, y - m]), v = g, m = y, d += p;
  861. return s.angle = b + 90, o = u = a = f = l = c = h = p = d = b = null, s
  862. }
  863. },
  864. localStorage: function() {
  865. var e, t, n = function() {
  866. var e;
  867. try {
  868. e = window.localStorage, e.getItem || (e.getItem = function() {
  869. return null
  870. }),
  871. e.setItem || (e.setItem = function() {})
  872. } catch (t) {
  873. e = {
  874. getItem: function() {
  875. return null
  876. },
  877. setItem: function() {}
  878. }
  879. }
  880. return e
  881. };
  882. return {
  883. init: function() {
  884. return e = this, t || (t = n()), e
  885. },
  886. setItem: function(n, r) {
  887. try {
  888. t.setItem(n, r)
  889. } catch (i) {}
  890. return e
  891. },
  892. getItem: function(e) {
  893. return t.getItem(e)
  894. },
  895. removeItem: function(n) {
  896. return t.removeItem(n), e
  897. },
  898. clear: function() {
  899. return t.clear(), e
  900. },
  901. key: function(e) {
  902. return t.key(e)
  903. },
  904. getLength: function() {
  905. return t.length
  906. },
  907. base: function() {
  908. return m
  909. }
  910. }
  911. }(),
  912. sessionStorage: function() {
  913. var e,
  914. t,
  915. n = function() {
  916. var e;
  917. try {
  918. //e={},
  919. //e.getItem=function(){return null},
  920. //e.setItem=function(){}
  921. e = window.sessionStorage,
  922. e.getItem || (e.getItem = function() {
  923. return null
  924. }),
  925. e.setItem || (e.setItem = function() {})
  926. } catch (t) {
  927. e = {
  928. getItem: function() {
  929. return null
  930. },
  931. setItem: function() {}
  932. }
  933. }
  934. return e
  935. };
  936. return {
  937. init: function() {
  938. return e = this, t || (t = n()), e
  939. },
  940. setItem: function(n, r) {
  941. return t.setItem(n, r), e
  942. },
  943. getItem: function(e) {
  944. return t.getItem(e)
  945. },
  946. removeItem: function(n) {
  947. return t.removeItem(n), e
  948. },
  949. clear: function() {
  950. return t.clear(), e
  951. },
  952. key: function(e) {
  953. return t.key(e)
  954. },
  955. getLength: function() {
  956. return t.length
  957. },
  958. base: function() {
  959. return m
  960. }
  961. }
  962. }(),
  963. pageLoad: function(e) {
  964. return n.system.pageLoad == null && (n.system.pageLoad = e, window.addEventListener("load", function() {
  965. m.main(n.system.pageLoad)
  966. }, !1)), m
  967. },
  968. main: function(e) {
  969. n.system.pageLoad == null && (n.system.pageLoad = e), this.canvas.init(), this.graphics.ANCHOR_LT = r.canvas.graphics.ANCHOR_LT, this.graphics.ANCHOR_LV = r.canvas.graphics.ANCHOR_LV, this.graphics.ANCHOR_LB = r.canvas.graphics.ANCHOR_LB, this.graphics.ANCHOR_HT = r.canvas.graphics.ANCHOR_HT, this.graphics.ANCHOR_HV = r.canvas.graphics.ANCHOR_HV, this.graphics.ANCHOR_HB = r.canvas.graphics.ANCHOR_HB, this.graphics.ANCHOR_RT = r.canvas.graphics.ANCHOR_RT, this.graphics.ANCHOR_RV = r.canvas.graphics.ANCHOR_RV, this.graphics.ANCHOR_RB = r.canvas.graphics.ANCHOR_RB;
  970. var t = this.getDom(n.canvas.defaultId);
  971. t && (this.canvas.screen.getTouch() ? (window.addEventListener("orientationchange", i.orientationchange, !1), t.addEventListener("touchstart", i.touchstart, !1), t.addEventListener("touchend", i.touchend, !1), t.addEventListener("touchmove", i.touchmove, !1), t.addEventListener("touchcancel", i.touchcancel, !1)) : (document.onkeydown = i.keydown, document.onkeyup = i.keyup, t.addEventListener("click", i.click, !1), t.addEventListener("mousedown", i.mouseDown, !1), t.addEventListener("mouseup", i.mouseUp, !1), t.addEventListener("mousemove", i.mouseMove, !1))), t = null;
  972. var s = this.canvas.screen.getDevice();
  973. return s == "ipad" || s == "iphone" ? (n.event.focused = !0, window.addEventListener("pageshow", i.pageFocus, !1), window.addEventListener("pagehide", i.pageUnFocus, !1)) : (s == "firefox" && (n.event.focused = !0), window.addEventListener("focus", i.pageFocus, !1), window.addEventListener("blur", i.pageUnFocus, !1)), this.canvas.fillStyle(n.canvas.bgColor).fillRect(0, 0, this.canvas.screen.getWidth(), this.canvas.screen.getHeight()), n.image.inited = !1, this.gameFlow.run().base().play(), n.image.imgObjs.length > 0 ? this.loadImage(n.image.imgObjs) : i.pageLoaded(), this
  974. },
  975. menu: function(e) {
  976. return typeof e == "function" && (n.system.menu = e), this
  977. },
  978. run: function(e) {
  979. return typeof e == "function" && (n.system.runFn = e), this
  980. },
  981. stop: function(e) {
  982. return typeof e == "function" && (n.system.stop = e), this
  983. },
  984. over: function(e) {
  985. return typeof e == "function" && (n.system.over = e), this
  986. },
  987. zone: function(e) {
  988. return typeof e == "function" && (n.system.zone = e), this
  989. },
  990. active: function(e) {
  991. return typeof e == "function" && (n.system.active = e), this
  992. },
  993. play: function() {
  994. return n.system.run || (n.system.run = function() {
  995. var e = Date.now();
  996. switch (n.system.gameFlow) {
  997. case r.system.gameFlowType.menu:
  998. n.system.menu();
  999. break;
  1000. case r.system.gameFlowType.run:
  1001. n.system.runFn();
  1002. break;
  1003. case r.system.gameFlowType.stop:
  1004. n.system.stop();
  1005. break;
  1006. case r.system.gameFlowType.over:
  1007. n.system.over();
  1008. break;
  1009. case r.system.gameFlowType.zone:
  1010. n.system.zone(n.system.zoneArgs);
  1011. break;
  1012. case r.system.gameFlowType.active:
  1013. n.system.active(n.system.activeArgs);
  1014. break;
  1015. case r.system.gameFlowType.loadImage:
  1016. if (i.loadingCallBack != null) {
  1017. var t = n.image.imgCount,
  1018. s = n.image.countLoaded > t ? t : n.image.countLoaded;
  1019. s == t && (n.system.gameFlow = r.system.gameFlowType.loadedImage), t > 0 && i.loadingCallBack(s, t, "image"), s == t && i.loadingEndCallBack && (i.loadingEndCallBack(s, t, "image"), i.loadingEndCallBack = null), s = t = null
  1020. }
  1021. break;
  1022. case r.system.gameFlowType.loadedImage:
  1023. n.system.gameFlow = n.system.loadedImageToGameFlow, n.image.imgObjs = [], n.image.countLoaded = 0, n.image.inited || i.pageLoaded();
  1024. break;
  1025. default:
  1026. }
  1027. i.buttonLayoutAction(), n.system.spendTime = Date.now() - e, e = null
  1028. }), n.system.playTimer || (n.system.isPause = !1, (n.system.rafRun = function() {
  1029. var e = Date.now();
  1030. e - n.system.lastDate >= n.system.timeout - n.system.spendTime && (n.system.lastDate = e, n.system.isPause || n.system.run()), e = null, n.system.rafRun && (n.system.playTimer = requestAnimationFrame(n.system.rafRun))
  1031. })()), this
  1032. },
  1033. pause: function() {
  1034. return n.system.playTimer && (n.system.isPause = !0, n.system.rafRun = null, cancelAnimationFrame(n.system.playTimer), n.system.playTimer = null), this
  1035. },
  1036. gameFlow: {
  1037. menu: function() {
  1038. return n.system.menu != null && (n.system.gameFlow = r.system.gameFlowType.menu, m.resetKeys()), this
  1039. },
  1040. run: function() {
  1041. return n.system.runFn != null && (n.system.gameFlow = r.system.gameFlowType.run, m.resetKeys()), this
  1042. },
  1043. stop: function() {
  1044. return n.system.stop != null && (n.system.gameFlow = r.system.gameFlowType.stop, m.resetKeys()), this
  1045. },
  1046. over: function() {
  1047. return n.system.over != null && (n.system.gameFlow = r.system.gameFlowType.over, m.resetKeys()), this
  1048. },
  1049. zone: function(e) {
  1050. return n.system.zone != null && (n.system.gameFlow = r.system.gameFlowType.zone, n.system.zoneArgs = e, m.resetKeys()), this
  1051. },
  1052. active: function(e) {
  1053. return n.system.active != null && (n.system.gameFlow = r.system.gameFlowType.active, n.system.activeArgs = e, m.resetKeys()), this
  1054. },
  1055. isIn: function(e) {
  1056. return n.system.gameFlow == r.system.gameFlowType[e]
  1057. },
  1058. base: function() {
  1059. return m
  1060. }
  1061. },
  1062. keyRepeated: function(e) {
  1063. return n.event.keyDownGo || (n.event.keyDownGo = !0), n.event.keys[e]
  1064. },
  1065. keyPressed: function(e) {
  1066. n.event.keyPressedGo || (n.event.keyPressedGo = !0);
  1067. var t = n.event.pressedKey[e];
  1068. return n.event.pressedKey[e] = !1, t
  1069. },
  1070. keyReleased: function(e) {
  1071. n.event.keyUpGo || (n.event.keyUpGo = !0);
  1072. var t = n.event.lastKey[e];
  1073. return n.event.lastKey[e] = !1, t
  1074. },
  1075. setKeyCode: function(e, t) {
  1076. return n.event.keys[e] = !1, n.event.lastKey[e] = !1, n.event.pressedKey[e] = !1, n.event.keyPressCtrl[e] = !0, r.event.key[e] = t, this
  1077. },
  1078. resetKeys: function() {
  1079. for (var e in n.event.keys)
  1080. n.event.keys[e] = !1;
  1081. for (var e in n.event.lastKey)
  1082. n.event.lastKey[e] = !1;
  1083. for (var e in n.event.pressedKey)
  1084. n.event.pressedKey[e] = !1;
  1085. for (var e in n.event.keyPressCtrl)
  1086. n.event.keyPressCtrl[e] = !0;
  1087. return this
  1088. },
  1089. canvas: {
  1090. init: function() {
  1091. return o = {
  1092. x: 0,
  1093. y: 0
  1094. }, u = {
  1095. fillColor: "#000000",
  1096. strokeColor: "#000000"
  1097. }, a = {
  1098. x: 0,
  1099. y: 0
  1100. }, f = {
  1101. x: 0,
  1102. y: 0
  1103. }, l = {
  1104. x: 0,
  1105. y: 0,
  1106. fillStyle: "#FFFFFF",
  1107. strokeStyle: "#CCCCCC"
  1108. }, this.pass()
  1109. },
  1110. initDevice: function() {
  1111. return h = i.getDeviceConfig(), n.canvas.device = h.device, n.canvas.fps = h.fps, n.canvas.touch = h.touch, n.canvas.zoom = h.zoom, this
  1112. },
  1113. pass: function(e, t, r) {
  1114. var i, o;
  1115. return !e || e == "" ? i = n.canvas.defaultId : i = e, n.canvas.ctxs[i] || (o = this.base().getDom(i) || document.createElement("canvas"), n.canvas.ctxs[i] = null, delete n.canvas.ctxs[i], n.canvas.ctxs[i] = o.getContext("2d"), o.width = t ? t : n.canvas.defaultWidth, o.style.width = parseInt(o.width * n.canvas.zoom) + "px", o.height = r ? r : n.canvas.defaultHeight, o.style.height = parseInt(o.height * n.canvas.zoom) + "px", n.canvas.cavansDoms[i] = null, delete n.canvas.cavansDoms[i], n.canvas.cavansDoms[i] = o), s = n.canvas.ctxs[i], s.font = n.canvas.defaultFont, c = n.canvas.cavansDoms[i], p = parseInt(c.width), d = parseInt(c.height), this.screen.setId(i), this
  1116. },
  1117. font: function(e) {
  1118. return n.canvas.defaultFont = e, s.font = n.canvas.defaultFont, this
  1119. },
  1120. del: function(e) {
  1121. return n.canvas.ctxs[e] && (n.canvas.ctxs[e] = null, delete n.canvas.ctxs[e], n.canvas.cavansDoms[e] = null, delete n.canvas.cavansDoms[e]), this
  1122. },
  1123. setCurrent: function(e) {
  1124. return _canvas.pass(e)
  1125. },
  1126. screen: {
  1127. setId: function(e) {
  1128. return n.canvas.ctxs[e] && (n.canvas.id = e), this
  1129. },
  1130. getId: function() {
  1131. return n.canvas.id
  1132. },
  1133. getWidth: function() {
  1134. return p
  1135. },
  1136. setWidth: function(e) {
  1137. return n.canvas.defaultWidth = e, c && (c.width = n.canvas.defaultWidth, c.style.width = c.width + "px", p = parseInt(c.width)), this
  1138. },
  1139. getHeight: function() {
  1140. return d
  1141. },
  1142. setHeight: function(e) {
  1143. return n.canvas.defaultHeight = e, c && (c.height = n.canvas.defaultHeight, c.style.height = c.height + "px", d = parseInt(c.height)), this
  1144. },
  1145. getDevice: function() {
  1146. return n.canvas.device
  1147. },
  1148. getFps: function() {
  1149. return n.canvas.fps
  1150. },
  1151. setFps: function(e) {
  1152. return e > 0 && (n.canvas.fps = e), this
  1153. },
  1154. getTouch: function() {
  1155. return n.canvas.touch
  1156. },
  1157. getZoom: function() {
  1158. return n.canvas.zoom
  1159. }
  1160. },
  1161. fillStyle: function(e) {
  1162. return s.fillStyle = e, this
  1163. },
  1164. fillRect: function(e, t, n, r, o) {
  1165. return n = n ? n : 0, r = r ? r : 0, o ? f = i.getAnchor(e, t, n, r, o) : (f.x = e, f.y = t), s.fillRect(f.x, f.y, n, r), this
  1166. },
  1167. fillText: function(e, t, r, i) {
  1168. return s.font = i || n.canvas.defaultFont, s.fillText(e, t, r), this
  1169. },
  1170. clearRect: function(e, t, n, r) {
  1171. return s.clearRect(e, t, n, r), this
  1172. },
  1173. clearScreen: function() {
  1174. return this.clearRect(0, 0, p, d)
  1175. },
  1176. fillScreen: function() {
  1177. return this.fillRect(0, 0, p, d)
  1178. },
  1179. strokeStyle: function(e) {
  1180. return s.strokeStyle = e, this
  1181. },
  1182. lineWidth: function(e) {
  1183. return s.lineWidth = e || 1, this
  1184. },
  1185. strokeRect: function(e, t, n, r, o) {
  1186. return o ? a = i.getAnchor(e, t, n, r, o) : (a.x = e, a.y = t), s.strokeRect(a.x, a.y, n, r), this
  1187. },
  1188. strokeText: function(e, t, r, i) {
  1189. return s.font = i || n.canvas.defaultFont, s.strokeText(e, t, r), this
  1190. },
  1191. setColor: function(e, t, n) {
  1192. return n == null ? (u.fillColor = e, u.strokeColor = t ? t : e) : (u.fillColor = "rgb(" + e + ", " + t + ", " + n + ")", u.strokeColor = u.fillColor), this.fillStyle(u.fillColor).strokeStyle(u.strokeColor)
  1193. },
  1194. drawImage: function(e, t, r, u, a, f, l, c, h, p) {
  1195. var d = m.getImage(e);
  1196. if (d.refreshed)
  1197. this.drawCache(e, t, r, u, a, f, l, c, h, p);
  1198. else if (d.src != null)
  1199. c != null && (t = t < 0 ? 0 : t, c = c <= 0 ? .1 : c), h != null && (r = r < 0 ? 0 : r, h = h <= 0 ? .1 : h), u != null && c != null && (u = u <= 0 ? .1 : t + u <= d.width ? u : d.width - t), a != null && h != null && (a = a <= 0 ? .1 : r + a <= d.height ? a : d.height - r), d.loaded && (u ? a ? p ? (o = i.getAnchor(f, l, c, h, p), s.drawImage(d, t, r, u, a, o.x, o.y, c, h)) : s.drawImage(d, t, r, u, a, f, l, c, h) : (o = i.getAnchor(t, r, d.width, d.height, u), s.drawImage(d, o.x, o.y)) : s.drawImage(d, t, r));
  1200. else {
  1201. var v = n.image.asyncImgObjs[e];
  1202. v && !v.inited && (i.setImage(v.id, v.src, v.benchId, v.bench, v.cache), v.inited = !0), v = null
  1203. }
  1204. return d = null, this
  1205. },
  1206. drawRotate: function(e, t, r, i, o, u, a, f, l, c) {
  1207. var h = parseInt(f >> 1),
  1208. p = parseInt(l >> 1),
  1209. d = m.getImage(e),
  1210. v = d.src ? d : n.canvas.cavansDoms[e];
  1211. return u -= h, a -= p, s.save(), s.translate(u + h, a + p), s.rotate(c * Math.PI / 180), s.translate(-(u + h), -(a + p)), s.drawImage(v, t, r, i, o, u, a, f, l), s.restore(), v = null, d = null, p = null, h = null, this
  1212. },
  1213. drawCache: function(e, t, r, u, a, f, l, c, h, p) {
  1214. var d = n.canvas.cavansDoms[e];
  1215. return d && (c != null && (t = t < 0 ? 0 : t, c = c <= 0 ? .1 : c), h != null && (r = r < 0 ? 0 : r, h = h <= 0 ? .1 : h), u != null && c != null && (u = u <= 0 ? .1 : t + u <= d.width ? u : d.width - t), a != null && h != null && (a = a <= 0 ? .1 : r + a <= d.height ? a : d.height - r), u ? a ? p ? (o = i.getAnchor(f, l, c, h, p), s.drawImage(d, t, r, u, a, o.x, o.y, c, h)) : s.drawImage(d, t, r, u, a, f, l, c, h) : (o = i.getAnchor(t, r, d.width, d.height, u), s.drawImage(d, o.x, o.y)) : s.drawImage(d, t, r)), d = null, this
  1216. },
  1217. drawRegion: function(e, t, n, i, o, u, a, f, l) {
  1218. switch (u) {
  1219. case r.canvas.trans.TRANS_NONE:
  1220. default:
  1221. s.transform(1, 0, 0, 1, a, f);
  1222. break;
  1223. case r.canvas.trans.TRANS_ROT90:
  1224. s.transform(0, 1, -1, 0, o + a, f);
  1225. break;
  1226. case r.canvas.trans.TRANS_ROT180:
  1227. s.transform(-1, 0, 0, -1, i + a, o + f);
  1228. break;
  1229. case r.canvas.trans.TRANS_ROT270:
  1230. s.transform(0, -1, 1, 0, a, i + f);
  1231. break;
  1232. case r.canvas.trans.TRANS_MIRROR:
  1233. s.transform(-1, 0, 0, 1, i + a, f);
  1234. break;
  1235. case r.canvas.trans.TRANS_MIRROR_ROT90:
  1236. s.transform(0, -1, -1, 0, o + a, i + f);
  1237. break;
  1238. case r.canvas.trans.TRANS_MIRROR_ROT180:
  1239. s.transform(1, 0, 0, -1, a, o + f);
  1240. break;
  1241. case r.canvas.trans.TRANS_MIRROR_ROT270:
  1242. s.transform(0, 1, 1, 0, a, f)
  1243. }
  1244. var c = m.getImage(e),
  1245. h = c.cache ? this.drawCache : this.drawImage;
  1246. return h(e, t, n, i, o, 0, 0, i, o), s.setTransform(1, 0, 0, 1, 0, 0), h = null, c = null, this
  1247. },
  1248. drawRegionAndZoom: function(e, t, n, i, o, u, a, f, l, c, h) {
  1249. switch (u) {
  1250. case r.canvas.trans.TRANS_NONE:
  1251. default:
  1252. s.transform(1, 0, 0, 1, a, f);
  1253. break;
  1254. case r.canvas.trans.TRANS_ROT90:
  1255. s.transform(0, 1, -1, 0, h + a, f);
  1256. break;
  1257. case r.canvas.trans.TRANS_ROT180:
  1258. s.transform(-1, 0, 0, -1, c + a, h + f);
  1259. break;
  1260. case r.canvas.trans.TRANS_ROT270:
  1261. s.transform(0, -1, 1, 0, a, c + f);
  1262. break;
  1263. case r.canvas.trans.TRANS_MIRROR:
  1264. s.transform(-1, 0, 0, 1, c + a, f);
  1265. break;
  1266. case r.canvas.trans.TRANS_MIRROR_ROT90:
  1267. s.transform(0, -1, -1, 0, h + a, c + f);
  1268. break;
  1269. case r.canvas.trans.TRANS_MIRROR_ROT180:
  1270. s.transform(1, 0, 0, -1, a, h + f);
  1271. break;
  1272. case r.canvas.trans.TRANS_MIRROR_ROT270:
  1273. s.transform(0, 1, 1, 0, a, f)
  1274. }
  1275. var p = m.getImage(e),
  1276. d = p.cache ? this.drawCache : this.drawImage;
  1277. return d(e, t, n, i, o, 0, 0, c, h), s.setTransform(1, 0, 0, 1, 0, 0), d = null, p = null, this
  1278. },
  1279. drawNumber: function(e, t, n, r, i, s, o, u, a) {
  1280. var f = e.toString(),
  1281. l = f.length,
  1282. c = u ? u : n,
  1283. h = a ? a : r;
  1284. if (o == "center") {
  1285. var d = i + parseInt(p - c * l >> 1);
  1286. for (var v = 0; v < l; v++)
  1287. this.drawImage(t, parseInt(f.charAt(v)) * n, 0, n, r, d + v * c, s, c, h);
  1288. d = null
  1289. } else if (o == 1)
  1290. for (var v = 0; v < l; v++)
  1291. this.drawImage(t, parseInt(f.charAt(v)) * n, 0, n, r, i + v * c, s, c, h);
  1292. else if (o == 0)
  1293. for (var v = l - 1; v >= 0; v--)
  1294. this.drawImage(t, parseInt(f.charAt(v)) * n, 0, n, r, i - (l - 1 - v) * c, s, c, h, m.graphics.ANCHOR_RT);
  1295. return h = null, c = null, l = null, f = null, this
  1296. },
  1297. moveTo: function(e, t) {
  1298. return s.moveTo(e, t), this
  1299. },
  1300. lineTo: function(e, t) {
  1301. return s.lineTo(e, t), this
  1302. },
  1303. stroke: function() {
  1304. return s.stroke(), this
  1305. },
  1306. fill: function() {
  1307. return s.fill(), this
  1308. },
  1309. beginPath: function() {
  1310. return s.beginPath(), this
  1311. },
  1312. closePath: function() {
  1313. return s.closePath(), this
  1314. },
  1315. arc: function(e, t, n, r, i, o) {
  1316. return s.arc(e, t, n, r, i, o), this
  1317. },
  1318. quadraticCurveTo: function(e, t, n, r) {
  1319. return s.quadraticCurveTo(e, t, n, r), this
  1320. },
  1321. bezierCurveTo: function(e, t, n, r, i, o) {
  1322. return s.bezierCurveTo(e, t, n, r, i, o), this
  1323. },
  1324. measureText: function(e) {
  1325. var t = s.measureText(e),
  1326. n = t.width,
  1327. r = t.height ? t.height : parseInt(s.font);
  1328. return {
  1329. width: this.screen.getDevice() == "j2me" ? s.measureText(e) : n,
  1330. height: r
  1331. }
  1332. },
  1333. translate: function(e, t) {
  1334. return s.translate(e, t), this
  1335. },
  1336. drawLine: function(e, t, n, r) {
  1337. return this.beginPath().moveTo(e, t).lineTo(n, r).closePath().stroke()
  1338. },
  1339. drawRect: function(e, t, n, r, i) {
  1340. return this.strokeRect(e, t, n, r, i)
  1341. },
  1342. drawString: function(e, t, i, o, u, a, f, c) {
  1343. l.x = t, l.y = i, s.font = c || n.canvas.defaultFont;
  1344. if (o)
  1345. switch (o) {
  1346. case r.canvas.graphics.LEFT:
  1347. l.x = 0;
  1348. break;
  1349. case r.canvas.graphics.VCENTER:
  1350. l.x = parseInt(this.screen.getWidth() - this.measureText(e).width >> 1);
  1351. break;
  1352. case r.canvas.graphics.RIGHT:
  1353. l.x = this.screen.getWidth() - this.measureText(e).width;
  1354. break;
  1355. default:
  1356. }
  1357. return u && (a ? l.fillStyle = a : l.fillStyle = "#000000", f ? l.strokeStyle = f : l.strokeStyle = "#CCCCCC", this.fillStyle(l.strokeStyle).fillText(e, l.x + 1, l.y + 1, c).fillStyle(l.fillStyle)), this.fillText(e, l.x, l.y, c).fillStyle(n.canvas.defaultColor)
  1358. },
  1359. drawSubstring: function(e, t, n, r, i, s, o, u, a, f) {
  1360. return this.drawString(e.substring(t, t + n), r, i, s, o, u, a, f)
  1361. },
  1362. clip: function() {
  1363. return s.clip(), this
  1364. },
  1365. save: function() {
  1366. return s.save(), this
  1367. },
  1368. restore: function() {
  1369. return s.restore(), this
  1370. },
  1371. rect: function(e, t, n, r) {
  1372. return s.rect(e, t, n, r), this
  1373. },
  1374. rotate: function(e) {
  1375. return s.rotate(e), this
  1376. },
  1377. setTransform: function(e, t, n, r, i, o) {
  1378. return s.setTransform(e, t, n, r, i, o), this
  1379. },
  1380. scale: function(e, t) {
  1381. return s.scale(e, t), this
  1382. },
  1383. globalAlpha: function(e) {
  1384. return s.globalAlpha = e, this
  1385. },
  1386. getContext: function() {
  1387. return s
  1388. },
  1389. base: function() {
  1390. return m
  1391. }
  1392. },
  1393. pushImage: function(e, t) {
  1394. if (n.image.inited)
  1395. return this;
  1396. var r;
  1397. for (var i = 0, s = e.length; i < s; i++)
  1398. r = e[i], r && !n.image.initImgs[r.id] && (n.image.initImgs[r.id] = !0, n.image.imgObjs.push(e[i]));
  1399. return this.loadingEndCallBack(t), r = null, this
  1400. },
  1401. loadImage: function(e, t) {
  1402. if (n.system.gameFlow != r.system.gameFlowType.loadImage && e.length > 0) {
  1403. n.system.loadedImageToGameFlow = n.system.gameFlow, n.system.gameFlow = r.system.gameFlowType.loadImage, n.image.imgObjs = e, n.image.imgCount = n.image.imgObjs.length, n.image.countLoaded = 0;
  1404. for (var s = 0, o; o = n.image.imgObjs[s]; s++)
  1405. n.image.imgs[o.id] ? n.image.countLoaded++ : i.setImage(o.id, o.src, o.benchId);
  1406. this.loadingEndCallBack(t)
  1407. }
  1408. return this
  1409. },
  1410. asyncImage: function(e) {
  1411. var t;
  1412. for (var r = 0, i = e.length; r < i; r++)
  1413. t = e[r] || {}, n.image.asyncImgObjs[t.id] || (n.image.asyncImgObjs[t.id] = t);
  1414. return t = null, this
  1415. },
  1416. verImage: function(e) {
  1417. return n.image.version == "" && (n.image.version = e), this
  1418. },
  1419. loadingCallBack: function(e) {
  1420. return typeof e == "function" && (i.loadingCallBack = e), this
  1421. },
  1422. loadingEndCallBack: function(e) {
  1423. return typeof e == "function" && (i.loadingEndCallBack = e), this
  1424. },
  1425. addImage: function(e, t) {
  1426. return e && t && !n.image.imgs[e] && (n.image.imgs[e] = t), this
  1427. },
  1428. getImage: function(e) {
  1429. return n.image.imgs[e] ? n.image.imgs[e] : {
  1430. src: null
  1431. }
  1432. },
  1433. delImage: function(e, t) {
  1434. return n.image.imgs[e] && (n.image.imgs[e] = null, delete n.image.imgs[e], t && (n.image.imgs[e] = {
  1435. id: e,
  1436. loaded: !0,
  1437. cache: !0,
  1438. refreshed: !0
  1439. })), this
  1440. },
  1441. getAsyncImage: function(e) {
  1442. return n.image.asyncImgObjs[e] ? n.image.asyncImgObjs[e] : {
  1443. src: null
  1444. }
  1445. },
  1446. clearAsyncImageCache: function() {
  1447. try {
  1448. var e = n.image.imgs,
  1449. t, r;
  1450. for (var i in e)
  1451. t = e[i], t && (r = n.image.asyncImgObjs[i], r && (r.inited = !1, this.delImage(i).canvas.del(i)));
  1452. e = t = r = null
  1453. } catch (s) {}
  1454. return this
  1455. },
  1456. audio: {
  1457. play: function(e) {
  1458. var t = n.audio.audios[e];
  1459. if (t)
  1460. try {
  1461. t.currentTime >= t.duration ? this.replay(e) : t.paused && t.play()
  1462. } catch (r) {}
  1463. return t = null, this
  1464. },
  1465. playRange: function(e, t, r) {
  1466. var i = n.audio.audios[e];
  1467. if (i)
  1468. try {
  1469. i.__timeupdateCallBack__ || i.addEventListener("timeupdate", i.__timeupdateCallBack__ = function() {
  1470. this.currentTime >= this.__to__ && (this.loop ? this.currentTime = this.__from__ : this.pause())
  1471. }, !1), i.__from__ = t == null ? 0 : t, i.__to__ = r == null ? i.duration : r, this.setCurrentTime(i.id, i.__from__).play(i.id)
  1472. } catch (s) {}
  1473. return i = null, this
  1474. },
  1475. pause: function(e) {
  1476. if (n.audio.audios[e])
  1477. try {
  1478. n.audio.audios[e].pause()
  1479. } catch (t) {}
  1480. return this
  1481. },
  1482. pauseAll: function() {
  1483. for (var e in n.audio.audios)
  1484. this.pause(e);
  1485. return this
  1486. },
  1487. mute: function(e, t) {
  1488. if (n.audio.audios[e])
  1489. try {
  1490. n.audio.audios[e].muted = t
  1491. } catch (r) {}
  1492. },
  1493. vol: function(e, t) {
  1494. if (n.audio.audios[e])
  1495. try {
  1496. n.audio.audios[e].volume = t
  1497. } catch (r) {}
  1498. return this
  1499. },
  1500. loop: function(e, t) {
  1501. if (n.audio.audios[e])
  1502. try {
  1503. n.audio.audios[e].loop = t
  1504. } catch (r) {}
  1505. return this
  1506. },
  1507. replay: function(e) {
  1508. return this.setCurrentTime(e, 0).play(e), this
  1509. },
  1510. setCurrentTime: function(e, t) {
  1511. var r = n.audio.audios[e];
  1512. if (r)
  1513. try {
  1514. t < 0 ? t = 0 : t > r.duration && (t = r.duration), r.currentTime = t || 0
  1515. } catch (i) {}
  1516. return r = null, this
  1517. },
  1518. getAudio: function(e) {
  1519. return n.audio.audios[e]
  1520. },
  1521. del: function(e) {
  1522. var t = n.audio.audios[e];
  1523. return t && t.__timeupdateCallBack__ && (t.pause(), t.removeEventListener("timeupdate", t.__timeupdateCallBack__, !1), n.audio.audios[e] = null, delete n.audio.audios[e]), t = null, this
  1524. },
  1525. base: function() {
  1526. return m
  1527. }
  1528. },
  1529. initAudio: function(e) {
  1530. if (!window.Audio)
  1531. return this;
  1532. if (e.length > 0) {
  1533. n.audio.audios = {};
  1534. var t, r, s, o, u;
  1535. for (var a = 0; a < e.length; a++)
  1536. t = e[a], t && i.setAudio(t.id, t.src, t.loop, t.autoplay, t.preload, t.autobuffer);
  1537. t = r = s = o = u = null
  1538. }
  1539. return this
  1540. },
  1541. setRunFrequency: function(e) {
  1542. return n.system.timeout = e, this
  1543. },
  1544. events: {
  1545. keyDown: function(e) {
  1546. return n.event.keyDownGo || (n.event.keyDownGo = !0), n.event.keyUpGo || (n.event.keyUpGo = !0), n.event.keyPressedGo || (n.event.keyPressedGo = !0), n.event.keyDownCallBack = e, this
  1547. },
  1548. keyUp: function(e) {
  1549. return n.event.keyDownGo || (n.event.keyDownGo = !0), n.event.keyUpGo || (n.event.keyUpGo = !0), n.event.keyPressedGo || (n.event.keyPressedGo = !0), n.event.keyUpCallBack = e, this
  1550. },
  1551. orientationChange: function(e) {
  1552. return n.event.orientationChange = e, this
  1553. },
  1554. touchStart: function(e) {
  1555. return n.event.touchStart = e, this
  1556. },
  1557. touchEnd: function(e) {
  1558. return n.event.touchEnd = e, this
  1559. },
  1560. touchMove: function(e) {
  1561. return n.event.touchMove = e, this
  1562. },
  1563. touchCancel: function(e) {
  1564. return n.event.touchCancel = e, this
  1565. },
  1566. click: function(e) {
  1567. return n.event.clickCallBack = e, this
  1568. },
  1569. mouseDown: function(e) {
  1570. return n.event.mouseDownCallBack = e, this
  1571. },
  1572. mouseUp: function(e) {
  1573. return n.event.mouseUpCallBack = e, this
  1574. },
  1575. mouseMove: function(e) {
  1576. return n.event.mouseMoveCallBack = e, this
  1577. },
  1578. createEvent: function(e, t) {
  1579. var n = document.getElementById(e);
  1580. if (n) {
  1581. var r = document.createEvent("HTMLEvents");
  1582. r.initEvent(t, !1, !0), n.dispatchEvent(r), r = null
  1583. }
  1584. n = null
  1585. },
  1586. pageFocus: function(e) {
  1587. return n.event.pageFocusCallBack = e, this
  1588. },
  1589. pageUnFocus: function(e) {
  1590. return n.event.pageUnFocusCallBack = e, this
  1591. },
  1592. swipe: function(e, t, r) {
  1593. n.event.swipeCallBack = e, t != null && (n.event.swipeTimeout = t), r != null && (n.event.swipeRange = r)
  1594. },
  1595. base: function() {
  1596. return m
  1597. }
  1598. },
  1599. ui: {},
  1600. graphics: {
  1601. HCENTER: r.canvas.graphics.HCENTER,
  1602. VCENTER: r.canvas.graphics.VCENTER,
  1603. LEFT: r.canvas.graphics.LEFT,
  1604. RIGHT: r.canvas.graphics.RIGHT,
  1605. TOP: r.canvas.graphics.TOP,
  1606. BOTTOM: r.canvas.graphics.BOTTOM
  1607. },
  1608. trans: {
  1609. TRANS_NONE: r.canvas.trans.TRANS_NONE,
  1610. TRANS_ROT90: r.canvas.trans.TRANS_ROT90,
  1611. TRANS_ROT180: r.canvas.trans.TRANS_ROT180,
  1612. TRANS_ROT270: r.canvas.trans.TRANS_ROT270,
  1613. TRANS_MIRROR: r.canvas.trans.TRANS_MIRROR,
  1614. TRANS_MIRROR_ROT90: r.canvas.trans.TRANS_MIRROR_ROT90,
  1615. TRANS_MIRROR_ROT180: r.canvas.trans.TRANS_MIRROR_ROT180,
  1616. TRANS_MIRROR_ROT270: r.canvas.trans.TRANS_MIRROR_ROT270
  1617. },
  1618. request: {
  1619. init: function() {
  1620. i.initUrlParams(location.href)
  1621. },
  1622. get: function(e) {
  1623. return n.request.gets[e] ? n.request.gets[e] : ""
  1624. }
  1625. },
  1626. buttonLayout: {
  1627. create: function(e) {
  1628. var t = this.base().objExtend({
  1629. id: "",
  1630. value: "",
  1631. x: 0,
  1632. y: 0,
  1633. width: 60,
  1634. height: 30,
  1635. bgColor: "#000",
  1636. bgStroke: "#FFF",
  1637. stroke: "#000",
  1638. font: "12px Arial",
  1639. imageId: "",
  1640. sx: 0,
  1641. sy: 0,
  1642. color: "#FFF",
  1643. hx: 0,
  1644. hy: 0,
  1645. hColor: "#0FF",
  1646. dex: 0,
  1647. dey: 0,
  1648. deColor: "#CCC",
  1649. hided: !1,
  1650. disabled: !1,
  1651. path: []
  1652. }, e || {});
  1653. return this.get(t.id) || n.buttonLayout.buttons.push(new n.buttonLayout.Button(t)), t = null, this
  1654. },
  1655. destroy: function(e) {
  1656. var t = n.buttonLayout.buttons,
  1657. r;
  1658. for (var i = t.length - 1; i >= 0; i--)
  1659. if (r = t[i])
  1660. if (r.id == e) {
  1661. r.disposed(), t.splice(i, 1);
  1662. break
  1663. }
  1664. return t = r = null, this
  1665. },
  1666. clear: function() {
  1667. var e = n.buttonLayout.buttons,
  1668. t;
  1669. for (var r = e.length - 1; r >= 0; r--)
  1670. if (t = e[r])
  1671. t.disposed(), e.splice(r, 1);
  1672. return e = t = null, this
  1673. },
  1674. gone: function(e, t, n) {
  1675. var r = this.get(e);
  1676. if (r) {
  1677. var i = t || [];
  1678. r.gone(i, n), i = null
  1679. }
  1680. return r = null, this
  1681. },
  1682. get: function(e) {
  1683. var t = n.buttonLayout.buttons;
  1684. return t[t.indexOfAttr("id", e)]
  1685. },
  1686. show: function(e) {
  1687. var t = this.get(e);
  1688. return t && t.show(), t = null, this
  1689. },
  1690. hide: function(e) {
  1691. var t = this.get(e);
  1692. return t && t.hide(), t = null, this
  1693. },
  1694. disable: function(e, t) {
  1695. var n = this.get(e);
  1696. return n && n.disable(t), n = null, this
  1697. },
  1698. repeated: function(e) {
  1699. var t = this.get(e);
  1700. if (t)
  1701. return t.repeated
  1702. },
  1703. pressed: function(e) {
  1704. var t = this.get(e);
  1705. if (t) {
  1706. var n = t.pressed;
  1707. return t.pressed = !1, n
  1708. }
  1709. },
  1710. released: function(e) {
  1711. var t = this.get(e);
  1712. if (t) {
  1713. var n = t.released;
  1714. return t.released = !1, n
  1715. }
  1716. },
  1717. base: function() {
  1718. return m
  1719. }
  1720. }
  1721. }.init();
  1722. var m = jsGame = link,
  1723. g = document.getElementsByTagName("head")[0],
  1724. y = null,
  1725. b = null,
  1726. w = null,
  1727. E = null,
  1728. S = function() {
  1729. b && (clearTimeout(b), b = null)
  1730. };
  1731. link.getScript = function(e) {
  1732. if (!g || y)
  1733. return !1;
  1734. var t = m.objExtend({
  1735. url: "",
  1736. before: function() {},
  1737. success: function() {},
  1738. error: function(e) {},
  1739. timeout: 5e3,
  1740. contentType: "text/javascript",
  1741. destroyed: !0
  1742. }, e || {});
  1743. return t.url != "" && (t.before(), y = document.createElement("script"), y.type = t.contentType, y.async = !0, y.src = t.url, y.destroyed = t.destroyed, w = t.success, E = t.error, y.onload = function() {
  1744. S(), w && (w(), w = null), this.destroyed && g.removeChild(this), y = null
  1745. }, g.appendChild(y), S(), b = setTimeout(function() {
  1746. S(), E && (E("timeout"), E = null), y && y.destroyed && g.removeChild(y), y = null
  1747. }, t.timeout)), t = null, m
  1748. };
  1749. var x = function() {
  1750. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1)
  1751. };
  1752. link.getNewGuid = function() {
  1753. return x() + x() + "-" + x() + "-" + x() + "-" + x() + "-" + x() + x() + x()
  1754. }, link.classes.Observer = function() {
  1755. this.group = []
  1756. }, link.classes.Observer.prototype.register = function(e) {
  1757. if (e == null)
  1758. return this;
  1759. var t = m.comm.inArray(e, this.group);
  1760. return t == -1 && this.group.push(e), this
  1761. }, link.classes.Observer.prototype.unregister = function(e) {
  1762. if (e == null)
  1763. return this;
  1764. var t = m.commandFuns.inArray(e, this.group);
  1765. return t > -1 && this.group.splice(t, 1), this
  1766. }, link.classes.Observer.prototype.notify = function(e) {
  1767. for (var t = 0; t < this.group.length; t++)
  1768. this.group[t] != null && this.group[t](e);
  1769. return this
  1770. }, link.classes.Observer.prototype.clear = function() {
  1771. return this.group.length > 0 && this.group.splice(0, this.group.length), this
  1772. }, link.classes.Timer = function(e, t, n, r, i) {
  1773. this.id = e, this._initTime = t, this._dateTime = Date.now(), this.time = this._initTime, this.callBack = n, this.millisec = r || 1e3, this.data = i, this.timeout = null
  1774. }, link.classes.Timer.prototype.stop = function() {
  1775. this.timeout && (clearTimeout(this.timeout), this.timeout = null)
  1776. }, link.classes.Timer.prototype.start = function(e) {
  1777. e && (this.time = this._initTime, this._dateTime = Date.now()), this.stop(), this.timeout = setTimeout(function(e) {
  1778. var t = Date.now(),
  1779. n = parseInt(Math.round((t - e._dateTime) / e.millisec));
  1780. e._dateTime = t, e.time -= n, e.callBack ? e.callBack(e) : e.stop(), e.time >= 0 ? e.start() : (e.stop(), e.time = 0), t = n = null
  1781. }, this.millisec, this)
  1782. }, link.classes.WebSocket = function(e, t, n, r, i) {
  1783. this.ipPort = e || "", this.socket = new WebSocket(this.ipPort), this.socket.onopen = t, this.socket.onmessage = n, this.socket.onclose = r, this.socket.onerror = i
  1784. }, link.classes.WebSocket.prototype.send = function(e) {
  1785. this.socket.send(e)
  1786. }, link.classes.WebSocket.prototype.close = function() {
  1787. this.socket.close()
  1788. }, link.classes.observer = link.classes.Observer, link.classes.timer = link.classes.Timer, link.classes.webSocket = link.classes.websocket = link.classes.WebSocket, link.commandFuns = link.comm, link.commandFuns.collisionCheck = link.commandFuns.collision, link.commandFuns.circleCollisionCheck = link.commandFuns.circleCollision, link.initImage = link.pushImage, typeof define == "function" && define("lib/link", [], function() {
  1789. return link
  1790. })
  1791. })(), define("lib/action", ["lib/link"], function(e) {
  1792. var t = function(e, t) {
  1793. return e == 0 && t == 0 ? 0 : e > 0 && t < 0 ? 1 : e > 0 && t == 0 ? 2 : e > 0 && t > 0 ? 3 : e == 0 && t > 0 ? 4 : e < 0 && t > 0 ? 5 : e < 0 && t == 0 ? 6 : e < 0 && t < 0 ? 7 : 0
  1794. },
  1795. n = function(t, n, r, i, s) {
  1796. var o = [];
  1797. if (s.length > 0) {
  1798. var i, u;
  1799. for (var a = 0; a < s.length; a++) {
  1800. i = [], u = s[a].frames;
  1801. for (var f = 0; f < u.length; f++)
  1802. i.push({
  1803. args: [u[f][0], u[f][1], u[f][2]],
  1804. step: u[f][3]
  1805. });
  1806. o.push(new e.action.sprite(i, s[a].loop, 0))
  1807. }
  1808. return i = u = null, o
  1809. }
  1810. return t
  1811. };
  1812. e.action = {}, e.action.Role = function(e, t, r, i, s, o, u, a) {
  1813. this.imageNames = s || [], this.rects = o || [], this.frames = u || [], this.actions = a || [], this.sprites = n(e, this.imageNames, this.rects, this.frames, this.actions) || [], this.x = t || 0, this.y = r || 0, this.dx = 0, this.dy = 0, this.step = 0, this.id = "", this.mapOffx = this.x, this.mapOffy = this.y, this.svx = null, this.svy = null, this.current = i || 0, this._cr = this.current, this.zoom = 1, this.angle = 0, this._zooms = [], this._angles = [], this._moveDs = [4, 7, 5, 5, 6, -5, -5, -7], this._stopDs = [0, -3, 1, 1, 2, -1, -1, -3], this.dsIndex = 4, this._path = [];
  1814. var f = this.getSprite(),
  1815. l = f.getFrame(),
  1816. c = this.frames[l.args[0]];
  1817. this._fA = c.fA, this.aR = c.aR, this.bR = c.bR, this._skipMoveDs = !1, this._stopedAction = null, c = l = f = null, this.onend = null, this.onstart = null, this._locked = !1, this.speed = 5, this.links = [], this.polyAR = [
  1818. [0, 0],
  1819. [0, 0],
  1820. [0, 0],
  1821. [0, 0]
  1822. ], this.aabbAR = [
  1823. [0, 0],
  1824. [0, 0],
  1825. [0, 0],
  1826. [0, 0]
  1827. ], this.polyBR = [
  1828. [0, 0],
  1829. [0, 0],
  1830. [0, 0],
  1831. [0, 0]
  1832. ], this.aabbBR = [
  1833. [0, 0],
  1834. [0, 0],
  1835. [0, 0],
  1836. [0, 0]
  1837. ]
  1838. }, e.action.Role.prototype.setSprite = function(t, n, r) {
  1839. if (this._locked)
  1840. return this;
  1841. var i = t != undefined ? t : 0,
  1842. s = i >= 0 ? e.trans.TRANS_NONE : e.trans.TRANS_MIRROR,
  1843. o, u;
  1844. this._cr != i && (this._cr = i, i < 0 && (i = Math.abs(i)), this.current = i >= this.sprites.length ? this.sprites.length - 1 : i, this.sprites.length > 1 && this.setTrans(s), o = this.getSprite(), u = o.getFrame(), n || o.setFrame(0), r && (this._stopedAction = this._cr), this.updateFrameParam());
  1845. for (var a = 0, f; f = this.links[a]; a++)
  1846. f.setSprite(t, n, r);
  1847. return i = trans = o = u = null, this
  1848. }, e.action.Role.prototype.addLinks = function(t) {
  1849. this.links = t || [];
  1850. for (var n = 0, r; r = this.links[n]; n++)
  1851. r.setSprite(this.getSprite().trans == e.trans.TRANS_NONE ? this.current : -this.current).setStep(this.step);
  1852. return this
  1853. }, e.action.Role.prototype.clearLinks = function() {
  1854. return this.links = [], this
  1855. }, e.action.Role.prototype.lockSprite = function() {
  1856. return this._locked = !0, this
  1857. }, e.action.Role.prototype.unlockSprite = function() {
  1858. return this._locked = !1, this
  1859. }, e.action.Role.prototype.setTrans = function(e) {
  1860. return this.getSprite().trans = e, this
  1861. }, e.action.Role.prototype.getSprite = function(e) {
  1862. return this.sprites[e == null ? this.current : e]
  1863. }, e.action.Role.prototype.getFrame = function(e) {
  1864. return this.frames[e == null ? this.getSprite().getFrame().args[0] : e]
  1865. }, e.action.Role.prototype.updateFrameParam = function(t) {
  1866. var n = this.getSprite();
  1867. if (!n)
  1868. return n = null, this;
  1869. var r = n.getFrame(),
  1870. i;
  1871. if (r && r.args)
  1872. if (i = this.frames[r.args[0]]) {
  1873. this._fA = i.fA, this.aR = i.aR, this.bR = i.bR;
  1874. var s = this.getAttackRect(),
  1875. o = this.getBodyRect(),
  1876. u = 0,
  1877. a = 0,
  1878. f = 0,
  1879. l = 0;
  1880. this.polyAR[0][0] = s.x, this.polyAR[0][1] = s.y, this.polyAR[1][0] = s.x + s.width, this.polyAR[1][1] = s.y, this.polyAR[2][0] = s.x + s.width, this.polyAR[2][1] = s.y + s.height, this.polyAR[3][0] = s.x, this.polyAR[3][1] = s.y + s.height, this.polyBR[0][0] = o.x, this.polyBR[0][1] = o.y, this.polyBR[1][0] = o.x + o.width, this.polyBR[1][1] = o.y, this.polyBR[2][0] = o.x + o.width, this.polyBR[2][1] = o.y + o.height, this.polyBR[3][0] = o.x, this.polyBR[3][1] = o.y + o.height, this.angle != 0 && e.comm.setMatrixRotate(this.polyAR, this.angle).setMatrixRotate(this.polyBR, this.angle);
  1881. var c = 0,
  1882. h = this.polyAR,
  1883. p = this.aabbAR;
  1884. while (c++ < 2) {
  1885. for (var d = 0, v; v = h[d]; d++)
  1886. v[0] > a && (a = v[0]), v[0] < u && (u = v[0]), v[1] > l && (l = v[1]), v[1] < f && (f = v[1]);
  1887. p[0][0] = u, p[0][1] = f, p[1][0] = a, p[1][1] = f, p[2][0] = a, p[2][1] = l, p[3][0] = u, p[3][1] = l, h = this.polyBR, p = this.aabbBR
  1888. }
  1889. s = o = u = a = f = l = null
  1890. }
  1891. return n = r = i = null, this
  1892. }, e.action.Role.prototype.action = function() {
  1893. var e = this.getSprite();
  1894. if (!e)
  1895. return this;
  1896. var n = e.getFrame(),
  1897. r = 0,
  1898. i = 0;
  1899. if (n) {
  1900. this.updateFrameParam();
  1901. if (this._path.length > 0) {
  1902. var s = this._path.shift();
  1903. r = s[0] || 0, i = s[1] || 0, s = null, this._skipMoveDs || this.setSprite(this._moveDs[this.dsIndex = t(r, i)], !0), this.svx = r, this.svy = i, this.mapOffx += this.svx, this.mapOffy += this.svy
  1904. } else
  1905. this.svx != null && this.svy != null && (this._skipMoveDs || (this.setSprite(this._stopedAction || this._stopDs[this.dsIndex = t(this.svx, this.svy)]), this._stopedAction = null), this.onend && this.onend(this), this._skipMoveDs = !1, this.svx = null, this.svy = null);
  1906. if (this._zooms.length > 0) {
  1907. var o = this._zooms.shift();
  1908. typeof~~ o == "number" && this.setZoom(o), o = null
  1909. }
  1910. if (this._angles.length > 0) {
  1911. var u = this._angles.shift();
  1912. typeof~~ u == "number" && this.setRotate(u), o = null
  1913. }
  1914. this.x += n.args[1] + r, this.y += n.args[2] + i;
  1915. var a;
  1916. for (var f = 0, l; l = this.links[f]; f++)
  1917. l.x = this.x + (l.dx || 0), l.y = this.y + (l.dy || 0), l.getSprite().setFrame(e.current), l.updateFrameParam();
  1918. a = null
  1919. }
  1920. return e.nextFrame(), e = r = i = n = null, this
  1921. }, e.action.Role.prototype.render = function(t) {
  1922. var n = this.getSprite();
  1923. if (n && this._fA) {
  1924. var r = this._fA,
  1925. i = r.length,
  1926. s = e.canvas,
  1927. o = n.trans,
  1928. u, a, f;
  1929. if (this.angle > 0) {
  1930. var l = r[0],
  1931. c = this.x,
  1932. h = this.y;
  1933. e.canvas.save().translate(c, h).rotate(this.angle * Math.PI / 180).translate(-c, -h), l = c = h = null
  1934. }
  1935. for (var p = 0; p < i; p++)
  1936. u = this.rects[r[p][0]][r[p][1]], a = this.imageNames[r[p][0]], f = e.getImage(a), o == e.trans.TRANS_NONE ? s.drawImage(a, u[0], u[1], u[2], u[3], this.zoom == 1 ? ~~(this.x + this.dx + r[p][2] * this.zoom) : this.x + this.dx + r[p][2] * this.zoom, this.zoom == 1 ? ~~(this.y + this.dy + r[p][3] * this.zoom) : this.y + this.dy + r[p][3] * this.zoom, u[2] * this.zoom, u[3] * this.zoom) : this.zoom == 1 ? s.drawRegion(a, u[0], u[1], u[2], u[3], o, ~~ (this.x + this.dx - (r[p][2] + u[2])), ~~ (this.y + this.dy + r[p][3])) : s.drawRegionAndZoom(a, u[0], u[1], u[2], u[3], o, this.x + this.dx - (r[p][2] + u[2]) * this.zoom, this.y + this.dy + r[p][3] * this.zoom, null, u[2] * this.zoom, u[3] * this.zoom), !f.loaded && f.bench && s.drawImage(f.bench.id || f.benchId, f.bench.sx || 0, f.bench.sy || 0, f.bench.sw || f.bench.w, f.bench.sh || f.bench.h, ~~ (this.x + this.dx - (f.bench.w * this.zoom >> 1)), ~~ (this.y + this.dy - f.bench.h * this.zoom), f.bench.w * this.zoom, f.bench.h * this.zoom);
  1937. this.angle > 0 && e.canvas.restore();
  1938. for (var d = 0, v; v = this.links[d]; d++)
  1939. v.render();
  1940. s = i = r = o = u = a = f = null
  1941. }
  1942. return n = null, this
  1943. }, e.action.Role.prototype.setZoom = function(e) {
  1944. return this.zoom = e, this
  1945. }, e.action.Role.prototype.setZoomTransition = function(e) {
  1946. return e && e.length > 0 && (this._zooms = e), this
  1947. }, e.action.Role.prototype.endZoomTransition = function() {
  1948. return this._zooms.length == 0
  1949. }, e.action.Role.prototype.getBodyRect = function(t, n) {
  1950. var r = this.getSprite(t != null ? Math.abs(t) : null);
  1951. if (!r)
  1952. return null;
  1953. var i = r.getFrame(n);
  1954. if (!i)
  1955. return null;
  1956. var s = this.frames[i.args[0]].bR;
  1957. return t == null && r.trans != e.trans.TRANS_NONE || t < 0 ? {
  1958. x: -(s[0] + s[2] * this.zoom),
  1959. y: s[1] * this.zoom,
  1960. width: s[2] * this.zoom,
  1961. height: s[3] * this.zoom
  1962. } : {
  1963. x: s[0] * this.zoom,
  1964. y: s[1] * this.zoom,
  1965. width: s[2] * this.zoom,
  1966. height: s[3] * this.zoom
  1967. }
  1968. }, e.action.Role.prototype.getAttackRect = function(t, n) {
  1969. var r = this.getSprite(t != null ? Math.abs(t) : null);
  1970. if (!r)
  1971. return null;
  1972. var i = r.getFrame(n);
  1973. if (!i)
  1974. return null;
  1975. var s = this.frames[i.args[0]].aR;
  1976. return t == null && r.trans != e.trans.TRANS_NONE || t < 0 ? {
  1977. id: this.id,
  1978. x: -(s[0] + s[2] * this.zoom),
  1979. y: s[1] * this.zoom,
  1980. width: s[2] * this.zoom,
  1981. height: s[3] * this.zoom
  1982. } : {
  1983. id: this.id,
  1984. x: s[0] * this.zoom,
  1985. y: s[1] * this.zoom,
  1986. width: s[2] * this.zoom,
  1987. height: s[3] * this.zoom
  1988. }
  1989. }, e.action.Role.prototype.getAABBBodyRect = function() {
  1990. return {
  1991. id: this.id,
  1992. x: this.aabbBR[0][0],
  1993. y: this.aabbBR[0][1],
  1994. width: Math.abs(this.aabbBR[1][0] - this.aabbBR[0][0]),
  1995. height: Math.abs(this.aabbBR[2][1] - this.aabbBR[1][1])
  1996. }
  1997. }, e.action.Role.prototype.getAABBAttackRect = function() {
  1998. return {
  1999. id: this.id,
  2000. x: this.aabbAR[0][0],
  2001. y: this.aabbAR[0][1],
  2002. width: Math.abs(this.aabbAR[1][0] - this.aabbAR[0][0]),
  2003. height: Math.abs(this.aabbAR[2][1] - this.aabbAR[1][1])
  2004. }
  2005. }, e.action.Role.prototype.setStep = function(e) {
  2006. this.step = e || 0;
  2007. for (var t = 0, n = this.sprites.length; t < n; t++)
  2008. this.sprites[t].setStep(e);
  2009. for (var r = 0, i; i = this.links[r]; r++)
  2010. i.setStep(this.step);
  2011. return this
  2012. }, e.action.Role.prototype.collision = function(t, n, r) {
  2013. if (!t)
  2014. return !1;
  2015. var i = n || "aR",
  2016. s = r || "aR",
  2017. o, u;
  2018. return i == "aR" ? o = this.getAttackRect() : i == "bR" && (o = this.getBodyRect()), s == "aR" ? u = t.getAttackRect() : s == "bR" && (u = t.getBodyRect()), o && u ? e.comm.collision(~~(this.x + this.dx + o.x), ~~ (this.y + this.dy + o.y), ~~o.width, ~~o.height, ~~ (t.x + t.dx + u.x), ~~ (t.y + t.dy + u.y), ~~u.width, ~~u.height) : !1
  2019. }, e.action.Role.prototype.collisionInput = function(t, n, r, i, s) {
  2020. var o = s || "aR",
  2021. u;
  2022. return o == "aR" ? u = this.getAttackRect() : o == "bR" && (u = this.getBodyRect()), u ? e.comm.collision(~~(this.x + this.dx + u.x), ~~ (this.y + this.dy + u.y), ~~u.width, ~~u.height, t, n, r, i) : !1
  2023. }, e.action.Role.prototype.circleCollisionInput = function(t, n, r, i) {
  2024. var s = i || "aR",
  2025. o;
  2026. return s == "aR" ? o = this.getAttackRect() : s == "bR" && (o = this.getBodyRect()), o ? e.comm.rect2CircleCollision(~~(this.x + this.dx + o.x), ~~ (this.y + this.dy + o.y), ~~o.width, ~~o.height, t, n, r) : !1
  2027. }, e.action.Role.prototype.polygonSATCollision = function(t, n, r) {
  2028. if (!t)
  2029. return !1;
  2030. var i = n || "aR",
  2031. s = r || "aR",
  2032. o, u;
  2033. return i == "aR" ? o = this.polyAR : i == "bR" && (o = this.polyBR), s == "aR" ? u = t.polyAR : s == "bR" && (u = t.polyBR), o && u ? e.comm.polygonCollision(o, u, this.x + this.dx, this.y + this.dy, t.x + t.dx, t.y + t.dy) : !1
  2034. }, e.action.Role.prototype.setLoop = function(e) {
  2035. for (var t = 0, n = this.sprites.length; t < n; t++)
  2036. this.sprites[t].setLoop(e);
  2037. return this
  2038. }, e.action.Role.prototype.setPath = function(e, t) {
  2039. return this._path = e || [], this._path.length > 0 && this.onstart && this.onstart(this), t && (this._skipMoveDs = !0), this
  2040. }, e.action.Role.prototype.concatPath = function(e) {
  2041. return this._path = this._path.concat(e || []), this
  2042. }, e.action.Role.prototype.endPath = function() {
  2043. return this._path.length == 0
  2044. }, e.action.Role.prototype.clearPath = function() {
  2045. return this._path = [], this
  2046. }, e.action.Role.prototype.getPathCount = function() {
  2047. return this._path.length
  2048. }, e.action.Role.prototype.getFirstPath = function() {
  2049. return this._path.length > 0 ? this._path[0] : [0, 0]
  2050. }, e.action.Role.prototype.moveTo = function(t, n, r) {
  2051. return r && (this.speed = Math.abs(r)), this.setPath(e.comm.createPath(this.mapOffx, this.mapOffy, t, n, this.speed)), this
  2052. }, e.action.Role.prototype.setMoveDs = function(e) {
  2053. return this._moveDs = e || [4, 7, 5, 5, 6, -5, -5, -7], this
  2054. }, e.action.Role.prototype.setStopDs = function(e) {
  2055. return this._stopDs = e || [0, -3, 1, 1, 2, -1, -1, -3], this
  2056. }, e.action.Role.prototype.doMoveDs = function(e) {
  2057. return e != null && e >= 0 && e < 8 && (this.dsIndex = e), this.setSprite(this._moveDs[this.dsIndex]), this
  2058. }, e.action.Role.prototype.doStopDs = function(e) {
  2059. return e != null && e >= 0 && e < 8 && (this.dsIndex = e), this.setSprite(this._stopDs[this.dsIndex]), this
  2060. }, e.action.Role.prototype.mark = function(e, t, n, r) {
  2061. return e != null && (this.x = e), t != null && (this.y = t), n != null && (this.mapOffx = n), r != null && (this.mapOffy = r), this
  2062. }, e.action.Role.prototype.setSpeed = function(e, t) {
  2063. return e && (this.speed = Math.abs(e)), this.nodeXStep = e, this.nodeYStep = t, this
  2064. }, e.action.Role.prototype.setRotate = function(e) {
  2065. return e != this.angle && (Math.abs(e) > 360 && (e %= 360), this.angle = e < 0 ? 360 + e : e), this
  2066. }, e.action.Role.prototype.setRotateTransition = function(e) {
  2067. return e && e.length > 0 && (this._angles = e), this
  2068. }, e.action.Role.prototype.endRotateTransition = function() {
  2069. return this._angles.length == 0
  2070. }, e.action.Role.prototype.move = function(e, t) {
  2071. return e != null && (this.x += e), t != null && (this.y += t), this
  2072. }, e.action.Role.prototype.rotate = function(e) {
  2073. return e != null && this.setRotate(this.angle + e), this
  2074. }, e.action.Role.prototype.stoped = function() {
  2075. return this.svx == null
  2076. }, e.action.Role.prototype.getCurrent = function() {
  2077. return this.current * (this.getSprite().trans == e.trans.TRANS_NONE ? 1 : -1)
  2078. }, e.action.Sprite = function(t, n, r, i) {
  2079. this.frames = t || [], this.loop = n, this.current = r || 0, this.step = i || 0, this.trans = e.trans.TRANS_NONE, this.setFrame(r), this.runStep = this.getFrame().step || this.step
  2080. }, e.action.Sprite.prototype.setFrame = function(e) {
  2081. return this.current = e >= this.frames.length ? this.frames.length - 1 : e > 0 ? e : 0, this.getFrame().step && (this.runStep = this.getFrame().step), this
  2082. }, e.action.Sprite.prototype.getFrame = function(e) {
  2083. return this.frames[e == null ? this.current : e]
  2084. }, e.action.Sprite.prototype.nextFrame = function() {
  2085. return !this.loop && this.endFrame() ? this : (this.frames.length > 0 && (this.runStep <= 0 ? (this.loop ? (this.current++, this.current %= this.frames.length) : this.current < this.frames.length - 1 && this.current++, this.getFrame().step ? this.runStep = this.getFrame().step : this.runStep = this.step) : this.runStep--), this)
  2086. }, e.action.Sprite.prototype.preFrame = function() {
  2087. return this.frames.length > 0 && (this.runStep <= 0 ? (this.loop ? (this.current--, this.current < 0 && (this.current = this.frames.length - 1)) : this.current > 0 && this.current--, this.getFrame().step ? this.runStep = this.getFrame().step : this.runStep = this.step) : this.runStep--), this
  2088. }, e.action.Sprite.prototype.endFrame = function(e) {
  2089. var t = this.frames.length - 1;
  2090. return e != null && e >= 0 && e <= this.frames.length - 1 && (t = e), this.current >= t && this.runStep == 0
  2091. }, e.action.Sprite.prototype.firstFrame = function() {
  2092. return this.current == 0 && this.runStep == 0
  2093. }, e.action.Sprite.prototype.setStep = function(e) {
  2094. return this.step = e || 0, this.runStep = this.getFrame().step || this.step, this
  2095. }, e.action.Sprite.prototype.setLoop = function(e) {
  2096. return this.loop = e, this
  2097. };
  2098. var r, i = function(e) {
  2099. return e.sprites.length > 0 ? e.sprites[0].frames.length > 0 && (e.sprites[0].runStep <= 0 ? (e.sprites[0].runStep = e.sprites[0].step, r = e.sprites[0].frames.shift(), e.sprites[0].frames.length == 0 && e.sprites.shift()) : (r = e.sprites[0].getFrame(), e.sprites[0].runStep--)) : r = null, r
  2100. };
  2101. return e.action.Fragment = function(e) {
  2102. this.sprites = e || []
  2103. }, e.action.Fragment.prototype.queue = function() {
  2104. return i(this)
  2105. }, e.action.role = e.action.Role, e.action.sprite = e.action.Sprite, e.action.fragment = e.action.Fragment, link.action
  2106. }), define("host0", ["lib/link"], function(e) {
  2107. e.asyncImage([{
  2108. id: "host0",
  2109. src: "images/man.png"
  2110. }]);
  2111. var t = ["host0"],
  2112. n = [
  2113. [
  2114. [0, 0, 24, 47],
  2115. [24, 0, 20, 46],
  2116. [44, 0, 24, 48]
  2117. ]
  2118. ],
  2119. r = [{
  2120. aR: [-15, -30, 30, 30],
  2121. bR: [-10, -25, 20, 20],
  2122. fA: [
  2123. [0, 0, -14, -47, 0]
  2124. ]
  2125. }, {
  2126. aR: [-15, -30, 30, 30],
  2127. bR: [-10, -25, 20, 20],
  2128. fA: [
  2129. [0, 1, -9, -46, 0]
  2130. ]
  2131. }, {
  2132. aR: [-15, -30, 30, 30],
  2133. bR: [-10, -25, 20, 20],
  2134. fA: [
  2135. [0, 2, -12, -47, 0]
  2136. ]
  2137. }],
  2138. i = [{
  2139. loop: !0,
  2140. frames: [
  2141. [0, 0, 0, 0],
  2142. [1, 0, 0, 0],
  2143. [2, 0, 0, 0],
  2144. [1, 0, 0, 0]
  2145. ]
  2146. }];
  2147. return {
  2148. get: function(s, o) {
  2149. var u = s >= 0 && i[s] ? [i[s]] : i;
  2150. return new e.action.role([], 0, 0, 0, o ? o : t, n, r, u || i)
  2151. }
  2152. }
  2153. }), define("host1", ["lib/link"], function(e) {
  2154. e.asyncImage([{
  2155. id: "host1",
  2156. src: "images/woman.png"
  2157. }]);
  2158. var t = ["host1"],
  2159. n = [
  2160. [
  2161. [0, 0, 23, 47],
  2162. [22, 0, 23, 46],
  2163. [45, 0, 23, 48]
  2164. ]
  2165. ],
  2166. r = [{
  2167. aR: [-15, -30, 30, 30],
  2168. bR: [-10, -25, 20, 20],
  2169. fA: [
  2170. [0, 0, -14, -47, 0]
  2171. ]
  2172. }, {
  2173. aR: [-15, -30, 30, 30],
  2174. bR: [-10, -25, 20, 20],
  2175. fA: [
  2176. [0, 1, -14, -47, 0]
  2177. ]
  2178. }, {
  2179. aR: [-15, -30, 30, 30],
  2180. bR: [-10, -25, 20, 20],
  2181. fA: [
  2182. [0, 2, -14, -47, 0]
  2183. ]
  2184. }],
  2185. i = [{
  2186. loop: !0,
  2187. frames: [
  2188. [0, 0, 0, 0],
  2189. [1, 0, 0, 0],
  2190. [2, 0, 0, 0],
  2191. [1, 0, 0, 0]
  2192. ]
  2193. }];
  2194. return {
  2195. get: function(s, o) {
  2196. var u = s >= 0 && i[s] ? [i[s]] : i;
  2197. return new e.action.role([], 0, 0, 0, o ? o : t, n, r, u || i)
  2198. }
  2199. }
  2200. }), define("shine", ["lib/link"], function(e) {
  2201. e.asyncImage([{
  2202. id: "shine",
  2203. src: "images/die.png"
  2204. }]);
  2205. var t = ["shine"],
  2206. n = [
  2207. [
  2208. [0, 20, 101, 64],
  2209. [119, 19, 112, 66],
  2210. [238, 13, 140, 80],
  2211. [391, 0, 103, 100]
  2212. ]
  2213. ],
  2214. r = [{
  2215. aR: [-15, -30, 30, 30],
  2216. bR: [-10, -25, 20, 20],
  2217. fA: [
  2218. [0, 0, -51, -34, 0]
  2219. ]
  2220. }, {
  2221. aR: [-15, -30, 30, 30],
  2222. bR: [-10, -25, 20, 20],
  2223. fA: [
  2224. [0, 1, -54, -34, 0]
  2225. ]
  2226. }, {
  2227. aR: [-15, -30, 30, 30],
  2228. bR: [-10, -25, 20, 20],
  2229. fA: [
  2230. [0, 2, -58, -35, 0]
  2231. ]
  2232. }, {
  2233. aR: [-15, -30, 30, 30],
  2234. bR: [-10, -25, 20, 20],
  2235. fA: [
  2236. [0, 3, -49, -45, 0]
  2237. ]
  2238. }],
  2239. i = [{
  2240. loop: !1,
  2241. frames: [
  2242. [0, 0, 0, 0],
  2243. [1, 0, 0, 0],
  2244. [2, 0, 0, 0],
  2245. [3, 0, 0, 0]
  2246. ]
  2247. }];
  2248. return {
  2249. get: function(s, o) {
  2250. var u = s >= 0 && i[s] ? [i[s]] : i;
  2251. return new e.action.role([], 0, 0, 0, o ? o : t, n, r, u || i)
  2252. }
  2253. }
  2254. }), define("index", ["lib/link", "lib/action", "host0", "host1", "shine"], function(e, t, n1, n2, r) {
  2255. return {
  2256. init: function() {
  2257. var t = Date.now(),
  2258. i, s, o = 640,
  2259. u;
  2260. e.canvas.screen.getTouch() ? (i = window.innerWidth, s = window.innerHeight, e.canvas.screen.setWidth(i).setHeight(s), u = s - o >> 1) : (window.onresize = function() {
  2261. i = window.innerWidth, s = window.innerHeight, e.canvas.screen.setWidth(i).setHeight(s), u = s - o >> 1
  2262. }, window.onresize());
  2263. var a = function(e, t) {
  2264. var n = ~~ (e / 1e3 % 1 * 1e3);
  2265. return n == 0 ? n = "000" : n < 100 && (n += "0"), ~~ (e / 1e3) + "." + n + (t || '"')
  2266. };
  2267. e.run(function() {
  2268. var t = Date.now();
  2269. e.canvas.fillStyle("#FFF").fillScreen();
  2270. var n = ~~ (o / l.scenes.length - 60);
  2271. if (!l.died) {
  2272. l.time = t - l.date;
  2273. for (var s = 0, f; f = l.scenes[s]; s++) {
  2274. f.action(0, u + (s + 1) * n, i, n, -8).render();
  2275. if (f.hostDied) {
  2276. l.died = !0, l.dieDate = Date.now(), l.shine = r.get(0).mark(f.host.x, f.host.y - 20).setStep(2);
  2277. break
  2278. }
  2279. }
  2280. } else {
  2281. for (var s = 0, f; f = l.scenes[s]; s++)
  2282. f.host.action(), f.render();
  2283. l.shine && (l.shine.action().render(), l.shine.getSprite().endFrame() && (l.shine = null)), t - l.dieDate >= l.dieTimeout && (l.dieDate = null, h())
  2284. }
  2285. var c = a(l.time);
  2286. e.canvas.fillStyle("#000").font("30px Arial").fillText(c, i - e.canvas.measureText(c).width - 20, 50), t = null
  2287. }).menu(function() {
  2288. //click Event
  2289. e.canvas.fillStyle("#FFF").
  2290. fillScreen().drawImage("logo", i - 480 >> 1, u)
  2291. .drawImage("btns1", 0, 99, 480, 7, i - 480 >> 1, u + 280, 480, 7)
  2292. .drawImage("btns1", 0, 99, 480, 7, i - 480 >> 1, u + 540, 480, 7);
  2293. if(e.buttonLayout.released("difficulty1")) {
  2294. l.moduleName = "我的成绩", hideAd(), c(2);
  2295. }
  2296. if(e.buttonLayout.released("moregame")) {
  2297. location.href="http://mp.weixin.qq.com/s?__biz=MzI4MjA2MjE0MQ==&mid=246005295&idx=1&sn=490f8141976d607ba079d48f52a3fcd7#rd";
  2298. }
  2299. if(e.buttonLayout.released("difficulty2")) {
  2300. l.moduleName = "噩梦模式", c(3);
  2301. }
  2302. if(e.buttonLayout.released("difficulty3")) {
  2303. l.moduleName = "地狱模式", c(4);
  2304. }
  2305. if(e.buttonLayout.released("difficulty4")) {
  2306. l.moduleName = "炼狱模式", c(5);
  2307. }
  2308. if(e.buttonLayout.released("shareButton")) {
  2309. shareGame();
  2310. }
  2311. }).zone(function() {
  2312. e.canvas.fillStyle("#F00").
  2313. fillScreen().
  2314. fillStyle("#FFF").
  2315. drawString(l.moduleName, 0, u + 110, e.graphics.VCENTER, !1, null, null, "50px 微软雅黑")
  2316. .drawImage("btns1", 0, 106, 480, 7, i - 480 >> 1, u + 140, 480, 7)
  2317. .drawImage("btns1", 0, 106, 480, 7, i - 480 >> 1, u + 555, 480, 7)
  2318. .fillStyle("#000")
  2319. .drawString(a(l.time, "秒"), 0, u + 340, e.graphics.VCENTER, !1, null, null, "60px 微软雅黑")
  2320. .fillStyle("#000")
  2321. .drawString("最佳:" + a(l.bestTime, "秒"), 0, u + 400, e.graphics.VCENTER, !1, null, null, "30px 微软雅黑"), l.time > l.bestTime && e.canvas.fillStyle("#FF0").drawString("新纪录", 0, u + 240, e.graphics.VCENTER, !1, null, null, "50px 微软雅黑"), e.buttonLayout.released("return") ? f() : e.buttonLayout.released("wxshare") && shareGame(l.time / 1000);
  2322. }).events.mouseDown(function(e, t, n) {
  2323. if (l.died)
  2324. return !1;
  2325. for (var r = 0, i; i = l.scenes[r]; r++)
  2326. i.touchStart(t, n)
  2327. }).touchStart(function(e, t, n) {
  2328. if (l.died)
  2329. return !1;
  2330. for (var r = 0, i; i = l.scenes[r]; r++)
  2331. i.touchStart(t, n)
  2332. });
  2333. var f = function() {
  2334. showAd();
  2335. e.buttonLayout.clear();
  2336. var buttonX = 360;
  2337. if(product == 'baidubrowser') {
  2338. buttonX = 320;
  2339. e.buttonLayout.create({
  2340. id: "shareButton",
  2341. value: "分享游戏",
  2342. x: i - 272 >> 1,
  2343. y: u + 420,
  2344. width: 272,
  2345. height: 80,
  2346. font: "36px 微软雅黑",
  2347. imageId: "btns1",
  2348. sx: 0,
  2349. sy: 0,
  2350. color: "#FFF",
  2351. hx: 272,
  2352. hy: 0,
  2353. hColor: "#FFF",
  2354. dex: 272,
  2355. dey: 0,
  2356. deColor: "#000"
  2357. });
  2358. }
  2359. e.buttonLayout.create({
  2360. id: "moregame",
  2361. value: "更多游戏",
  2362. x: i - 272 >> 1,
  2363. y: u + buttonX + 90,
  2364. width: 272,
  2365. height: 80,
  2366. font: "36px 微软雅黑",
  2367. imageId: "btns1",
  2368. sx: 0,
  2369. sy: 0,
  2370. color: "#FFF",
  2371. hx: 272,
  2372. hy: 0,
  2373. hColor: "#FFF",
  2374. dex: 272,
  2375. dey: 0,
  2376. deColor: "#000"
  2377. }).base().gameFlow.menu();
  2378. e.buttonLayout.create({
  2379. id: "difficulty1",
  2380. value: "开始游戏",
  2381. x: i - 272 >> 1,
  2382. y: u + buttonX,
  2383. width: 272,
  2384. height: 80,
  2385. font: "36px 微软雅黑",
  2386. imageId: "btns1",
  2387. sx: 0,
  2388. sy: 0,
  2389. color: "#FFF",
  2390. hx: 272,
  2391. hy: 0,
  2392. hColor: "#FFF",
  2393. dex: 272,
  2394. dey: 0,
  2395. deColor: "#000"
  2396. }).base().gameFlow.menu();
  2397. };
  2398. f();
  2399. var l = {
  2400. moduleName: "",
  2401. module: 0,
  2402. time: 0,
  2403. bestTime: 0,
  2404. date: null,
  2405. died: !1,
  2406. dieTimeout: 1e3,
  2407. dieDate: null,
  2408. scenes: [],
  2409. shine: null,
  2410. Scene: e.extend(function(t) {
  2411. var n = t%2 ? n2 : n1;
  2412. this.id = t, this.x = 0, this.baseY = 0, this.width = 0, this.height = 0, this.host = n.get().setStep(2), this.hostDied = !1, this.boxes = [], this.displayDate = Date.now(), this.displayTimeout = e.comm.getRandom(1e3, 2e3)
  2413. }, null, {
  2414. render: function() {
  2415. e.canvas.fillStyle("#000").fillRect(this.x, this.baseY - 5, this.width, 5);
  2416. for (var t = this.boxes.length - 1, n; n = this.boxes[t]; t--)
  2417. e.canvas.fillRect(n.x, n.y, n.width, n.height);
  2418. return this.host.render(), this
  2419. },
  2420. action: function(t, n, r, i, s) {
  2421. this.x = t, this.baseY = n, this.width = r, this.height = i;
  2422. if (!this.hostDied) {
  2423. this.host.endPath() && this.host.mark(this.x + 100, this.baseY - 5);
  2424. var o = Date.now();
  2425. if (o - this.displayDate >= this.displayTimeout) {
  2426. this.displayDate = o;
  2427. var u = e.comm.getRandom(5, 30),
  2428. a = e.comm.getRandom(10, 50);
  2429. this.boxes.unshift({
  2430. x: this.width,
  2431. y: 0,
  2432. width: u,
  2433. height: a
  2434. }), this.displayTimeout = e.comm.getRandom(1e3, 3e3), u = a = null
  2435. }
  2436. for (var f = this.boxes.length - 1, l; l = this.boxes[f]; f--)
  2437. l.x += s, l.y = this.baseY - 5 - l.height, this.host.collisionInput(l.x, l.y, l.width, l.height, "bR") && (this.hostDied = !0, this.host.clearPath()), (l.x <= -l.width || l.x >= this.width) && this.boxes.splice(f, 1);
  2438. o = null
  2439. }
  2440. return this.host.action(), this
  2441. },
  2442. touchStart: function(t, n) {
  2443. return this.host.endPath() ? (e.comm.collision(t, n, 1, 1, this.x, this.baseY - this.height, this.width, this.height) && this.host.setPath([
  2444. [0, -20],
  2445. [0, -20],
  2446. [0, -20],
  2447. [0, -10],
  2448. [0, -10],
  2449. [0, -10],
  2450. [0, -5],
  2451. [0, -5],
  2452. [0, -5],
  2453. [0, 5],
  2454. [0, 5],
  2455. [0, 5],
  2456. [0, 10],
  2457. [0, 10],
  2458. [0, 10],
  2459. [0, 20],
  2460. [0, 20],
  2461. [0, 20]
  2462. ]), this) : this
  2463. }
  2464. })
  2465. },
  2466. c = function(t) {
  2467. e.buttonLayout.clear().base().gameFlow.run(), l.died = !1, l.scenes = [], l.time = 0, l.date = Date.now(), l.shine = null, l.module = t;
  2468. for (var n = 0; n < t; n++)
  2469. l.scenes.push(new l.Scene(n))
  2470. },
  2471. h = function() {
  2472. var t = i - 480 >> 1;
  2473. var gameTime = l.time / 1000;
  2474. if (l.time > 10000) {
  2475. alert("强!你居然坚持了" + gameTime + "秒!")
  2476. };
  2477. document.title = "我帮牛郎坚持了" + gameTime + "秒,织女没见到…你能超过我吗?";
  2478. e.buttonLayout.clear();
  2479. var buttonX = 190;
  2480. if(product == 'baidubrowser') {
  2481. buttonX = 100;
  2482. e.buttonLayout.create({
  2483. id: "shareGame",
  2484. value: "炫耀",
  2485. bgColor: "",
  2486. bgStroke: "",
  2487. stroke: "",
  2488. x: t + 280,
  2489. y: u + 580,
  2490. width: 100,
  2491. height: 80,
  2492. font: "36px 微软雅黑",
  2493. imageId: "",
  2494. sx: 0,
  2495. sy: 0,
  2496. color: "yellow",
  2497. hx: 272,
  2498. hy: 0,
  2499. hColor: "#AAA",
  2500. dex: 272,
  2501. dey: 0,
  2502. deColor: "#CCC"
  2503. });
  2504. }
  2505. e.buttonLayout.create({
  2506. id: "return",
  2507. value: "再来一次",
  2508. bgColor: "",
  2509. bgStroke: "",
  2510. stroke: "",
  2511. x: 40,
  2512. y: u + 580,
  2513. width: 250,
  2514. height: 80,
  2515. font: "36px 微软雅黑",
  2516. imageId: "",
  2517. sx: 0,
  2518. sy: 0,
  2519. color: "#FFF",
  2520. hx: 272,
  2521. hy: 0,
  2522. hColor: "#AAA",
  2523. dex: 272,
  2524. dey: 0,
  2525. deColor: "#CCC"
  2526. }).base().gameFlow.zone();
  2527. e.buttonLayout.create({
  2528. id: "wxshare",
  2529. value: "分享",
  2530. bgColor: "",
  2531. bgStroke: "",
  2532. stroke: "",
  2533. x: 300,
  2534. y: u + 580,
  2535. width: 100,
  2536. height: 80,
  2537. font: "36px 微软雅黑",
  2538. imageId: "",
  2539. sx: 0,
  2540. sy: 0,
  2541. color: "#FFF",
  2542. hx: 272,
  2543. hy: 0,
  2544. hColor: "#AAA",
  2545. dex: 272,
  2546. dey: 0,
  2547. deColor: "#CCC"
  2548. }).base().gameFlow.zone();
  2549. var n = e.localStorage.getItem("NotDieAnyoneBestTime" + l.module);
  2550. n == null && (n = "0"), l.bestTime = parseInt(n), l.time > l.bestTime && e.localStorage.setItem("NotDieAnyoneBestTime" + l.module, l.time.toString()), submitScore(l.module, l.time * (l.module - 1))
  2551. }
  2552. }
  2553. }
  2554. }), require.config({
  2555. baseUrl: "js"
  2556. }), require(["lib/link", "index"], function(e, t) {
  2557. e.init(window.innerWidth, window.innerHeight).pushImage([{
  2558. id: "logo",
  2559. src: "images/logo.jpg"
  2560. }, {
  2561. id: "btns1",
  2562. src: "images/btn.png"
  2563. }], function(e, t, n) {}).initAudio([{
  2564. id: "1",
  2565. src: "sound/1.mp3",
  2566. preload: !0
  2567. }]).loadingCallBack(function(e, t) {}).main(function() {
  2568. t.init()
  2569. })
  2570. }), define("main", function() {});