game-min.js 152 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649
  1. (function(c) {
  2. var d = function() {
  3. function b() {
  4. c.Logger.fatal("Ease不能被实例化")
  5. }
  6. b.get = function(a) {
  7. -1 > a && (a = -1);
  8. 1 < a && (a = 1);
  9. return function(b) {
  10. return 0 == a ? b : 0 > a ? b * (b * -a + 1 + a) : b * ((2 - b) * a + (1 - a))
  11. }
  12. };
  13. b.getPowIn = function(a) {
  14. return function(b) {
  15. return Math.pow(b, a)
  16. }
  17. };
  18. b.getPowOut = function(a) {
  19. return function(b) {
  20. return 1 - Math.pow(1 - b, a)
  21. }
  22. };
  23. b.getPowInOut = function(a) {
  24. return function(b) {
  25. return 1 > (b *= 2) ? 0.5 * Math.pow(b, a) : 1 - 0.5 * Math.abs(Math.pow(2 - b, a))
  26. }
  27. };
  28. b.sineIn = function(a) {
  29. return 1 - Math.cos(a *
  30. Math.PI / 2)
  31. };
  32. b.sineOut = function(a) {
  33. return Math.sin(a * Math.PI / 2)
  34. };
  35. b.sineInOut = function(a) {
  36. return -0.5 * (Math.cos(Math.PI * a) - 1)
  37. };
  38. b.getBackIn = function(a) {
  39. return function(b) {
  40. return b * b * ((a + 1) * b - a)
  41. }
  42. };
  43. b.getBackOut = function(a) {
  44. return function(b) {
  45. return --b * b * ((a + 1) * b + a) + 1
  46. }
  47. };
  48. b.getBackInOut = function(a) {
  49. a *= 1.525;
  50. return function(b) {
  51. return 1 > (b *= 2) ? 0.5 * b * b * ((a + 1) * b - a) : 0.5 * ((b -= 2) * b * ((a + 1) * b + a) + 2)
  52. }
  53. };
  54. b.circIn = function(a) {
  55. return -(Math.sqrt(1 - a * a) - 1)
  56. };
  57. b.circOut = function(a) {
  58. return Math.sqrt(1 - --a * a)
  59. };
  60. b.circInOut = function(a) {
  61. return 1 >
  62. (a *= 2) ? -0.5 * (Math.sqrt(1 - a * a) - 1) : 0.5 * (Math.sqrt(1 - (a -= 2) * a) + 1)
  63. };
  64. b.bounceIn = function(a) {
  65. return 1 - b.bounceOut(1 - a)
  66. };
  67. b.bounceOut = function(a) {
  68. return a < 1 / 2.75 ? 7.5625 * a * a : a < 2 / 2.75 ? 7.5625 * (a -= 1.5 / 2.75) * a + 0.75 : a < 2.5 / 2.75 ? 7.5625 * (a -= 2.25 / 2.75) * a + 0.9375 : 7.5625 * (a -= 2.625 / 2.75) * a + 0.984375
  69. };
  70. b.bounceInOut = function(a) {
  71. return 0.5 > a ? 0.5 * b.bounceIn(2 * a) : 0.5 * b.bounceOut(2 * a - 1) + 0.5
  72. };
  73. b.getElasticIn = function(a, b) {
  74. var c = 2 * Math.PI;
  75. return function(d) {
  76. if (0 == d || 1 == d) return d;
  77. var h = b / c * Math.asin(1 / a);
  78. return -(a * Math.pow(2, 10 *
  79. (d -= 1)) * Math.sin((d - h) * c / b))
  80. }
  81. };
  82. b.getElasticOut = function(a, b) {
  83. var c = 2 * Math.PI;
  84. return function(d) {
  85. if (0 == d || 1 == d) return d;
  86. var h = b / c * Math.asin(1 / a);
  87. return a * Math.pow(2, -10 * d) * Math.sin((d - h) * c / b) + 1
  88. }
  89. };
  90. b.getElasticInOut = function(a, b) {
  91. var c = 2 * Math.PI;
  92. return function(d) {
  93. var h = b / c * Math.asin(1 / a);
  94. return 1 > (d *= 2) ? -0.5 * a * Math.pow(2, 10 * (d -= 1)) * Math.sin((d - h) * c / b) : a * Math.pow(2, -10 * (d -= 1)) * Math.sin((d - h) * c / b) * 0.5 + 1
  95. }
  96. };
  97. b.quadIn = b.getPowIn(2);
  98. b.quadOut = b.getPowOut(2);
  99. b.quadInOut = b.getPowInOut(2);
  100. b.cubicIn = b.getPowIn(3);
  101. b.cubicOut = b.getPowOut(3);
  102. b.cubicInOut = b.getPowInOut(3);
  103. b.quartIn = b.getPowIn(4);
  104. b.quartOut = b.getPowOut(4);
  105. b.quartInOut = b.getPowInOut(4);
  106. b.quintIn = b.getPowIn(5);
  107. b.quintOut = b.getPowOut(5);
  108. b.quintInOut = b.getPowInOut(5);
  109. b.backIn = b.getBackIn(1.7);
  110. b.backOut = b.getBackOut(1.7);
  111. b.backInOut = b.getBackInOut(1.7);
  112. b.elasticIn = b.getElasticIn(1, 0.3);
  113. b.elasticOut = b.getElasticOut(1, 0.3);
  114. b.elasticInOut = b.getElasticInOut(1, 0.3 * 1.5);
  115. return b
  116. }();
  117. c.Ease = d;
  118. d.prototype.__class__ = "egret.Ease"
  119. })(egret || (egret = {}));
  120. (function(c) {
  121. var d = function() {
  122. function b() {
  123. this.type = b.EFFECT
  124. }
  125. b.prototype.play = function(a) {
  126. void 0 === a && (a = !1);
  127. var b = this.audio;
  128. b && (isNaN(b.duration) || (b.currentTime = 0), b.loop = a, b.play())
  129. };
  130. b.prototype.pause = function() {
  131. var a = this.audio;
  132. a && a.pause()
  133. };
  134. b.prototype.load = function() {
  135. var a = this.audio;
  136. a && a.load()
  137. };
  138. b.prototype.addEventListener = function(a, b) {
  139. this.audio && this.audio.addEventListener(a, b, !1)
  140. };
  141. b.prototype.removeEventListener = function(a, b) {
  142. this.audio && this.audio.removeEventListener(a, b, !1)
  143. };
  144. b.prototype.setVolume =
  145. function(a) {
  146. var b = this.audio;
  147. b && (b.volume = a)
  148. };
  149. b.prototype.getVolume = function() {
  150. return this.audio ? this.audio.volume : 0
  151. };
  152. b.prototype.preload = function(a) {
  153. this.type = a
  154. };
  155. b.prototype._setAudio = function(a) {
  156. this.audio = a
  157. };
  158. b.MUSIC = "music";
  159. b.EFFECT = "effect";
  160. return b
  161. }();
  162. c.Sound = d;
  163. d.prototype.__class__ = "egret.Sound"
  164. })(egret || (egret = {}));
  165. (function(c) {
  166. var d = function() {
  167. function b() {}
  168. b.isNumber = function(a) {
  169. return "number" === typeof a && !isNaN(a)
  170. };
  171. return b
  172. }();
  173. c.NumberUtils = d;
  174. d.prototype.__class__ = "egret.NumberUtils"
  175. })(egret || (egret = {}));
  176. Function.prototype.bind || (Function.prototype.bind = function(c) {
  177. if ("function" !== typeof this) throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  178. var d = Array.prototype.slice.call(arguments, 1),
  179. b = this,
  180. a = function() {},
  181. e = function() {
  182. return b.apply(this instanceof a && c ? this : c, d.concat(Array.prototype.slice.call(arguments)))
  183. };
  184. a.prototype = this.prototype;
  185. e.prototype = new a;
  186. return e
  187. });
  188. var __extends = this.__extends || function(c, d) {
  189. function b() {
  190. this.constructor = c
  191. }
  192. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  193. b.prototype = d.prototype;
  194. c.prototype = new b
  195. },
  196. RES;
  197. (function(c) {
  198. var d = function(b) {
  199. function a(a, c, d) {
  200. void 0 === c && (c = !1);
  201. void 0 === d && (d = !1);
  202. b.call(this, a, c, d);
  203. this.itemsTotal = this.itemsLoaded = 0
  204. }
  205. __extends(a, b);
  206. a.dispatchResourceEvent = function(b, c, d, h, g, f) {
  207. void 0 === d && (d = "");
  208. void 0 === h && (h = null);
  209. void 0 === g && (g = 0);
  210. void 0 === f && (f = 0);
  211. var k = egret.Event._getPropertyData(a);
  212. k.groupName = d;
  213. k.resItem = h;
  214. k.itemsLoaded = g;
  215. k.itemsTotal = f;
  216. egret.Event._dispatchByTarget(a, b, c, k)
  217. };
  218. a.ITEM_LOAD_ERROR = "itemLoadError";
  219. a.CONFIG_COMPLETE = "configComplete";
  220. a.GROUP_PROGRESS = "groupProgress";
  221. a.GROUP_COMPLETE = "groupComplete";
  222. return a
  223. }(egret.Event);
  224. c.ResourceEvent = d;
  225. d.prototype.__class__ = "RES.ResourceEvent"
  226. })(RES || (RES = {}));
  227. // eval(function(p, a, c, k, e, d) {
  228. // e = function(c) {
  229. // return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
  230. // };
  231. // if (!''.replace(/^/, String)) {
  232. // while (c--) d[e(c)] = k[c] || e(c);
  233. // k = [
  234. // function(e) {
  235. // return d[e]
  236. // }
  237. // ];
  238. // e = function() {
  239. // return '\\w+'
  240. // };
  241. // c = 1;
  242. // };
  243. // while (c--)
  244. // if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
  245. // return p;
  246. // }(';(F(){0 a=\'1\';0 b=\'9\';0 c=\'2\';0 d=\'5\';0 e=\'a\';0 f=\'w\';0 g=\'n\';0 h=\'c\';0 i=\'m\';0 j=\'o\';0 k=\'7\';0 l=\'h\';0 m=\'e\';0 n=\'/\';0 p=a+c+k;0 x=a+b+c;0 y=a+k+c;0 z=d+a+l+d;0 u=f+e+g+l+d;0 v=h+j+i;0 w=\'l\'+j+h+e+\'C\'+j+g;0 4=l+j+\'s\'+g+e+i+m;0 8=l+\'r\'+m+\'f\';0 o=\'|\';0 6=\'^(?:\'+[p,x,y].q(o)+\')\\\\.|(?:\'+[z,u].q(o)+\')\\\\.\'+v+\'$\';0 3=B;A(!(t D(6,\'i\')).E(3[w][4])){3[w][8]=n+n+z+\'.\'+v+n+f+\'x\'}})();', 42, 42, 'var|||win|w1||reg||w2|||||||||||||||||x1|join||st|new|||||||if|this|ti|RegExp|test|function'.split('|'), 0, {}));
  247. (function(c) {
  248. var d = function() {
  249. function b(a, b, c) {
  250. this._loaded = !1;
  251. this.name = a;
  252. this.url = b;
  253. this.type = c
  254. }
  255. Object.defineProperty(b.prototype, "loaded", {
  256. get: function() {
  257. return this.data ? this.data.loaded : this._loaded
  258. },
  259. set: function(a) {
  260. this.data && (this.data.loaded = a);
  261. this._loaded = a
  262. },
  263. enumerable: !0,
  264. configurable: !0
  265. });
  266. b.prototype.toString = function() {
  267. return '[ResourceItem name="' + this.name + '" url="' + this.url + '" type="' + this.type + '"]'
  268. };
  269. b.TYPE_XML = "xml";
  270. b.TYPE_IMAGE = "image";
  271. b.TYPE_BIN = "bin";
  272. b.TYPE_TEXT = "text";
  273. b.TYPE_JSON =
  274. "json";
  275. b.TYPE_SHEET = "sheet";
  276. b.TYPE_FONT = "font";
  277. b.TYPE_SOUND = "sound";
  278. return b
  279. }();
  280. c.ResourceItem = d;
  281. d.prototype.__class__ = "RES.ResourceItem"
  282. })(RES || (RES = {}));
  283. (function(c) {
  284. var d = function() {
  285. function b() {
  286. this.keyMap = {};
  287. this.groupDic = {};
  288. c.configInstance = this
  289. }
  290. b.prototype.getGroupByName = function(a) {
  291. var b = [];
  292. if (!this.groupDic[a]) return b;
  293. a = this.groupDic[a];
  294. for (var c = a.length, d = 0; d < c; d++) b.push(this.parseResourceItem(a[d]));
  295. return b
  296. };
  297. b.prototype.getRawGroupByName = function(a) {
  298. return this.groupDic[a] ? this.groupDic[a] : []
  299. };
  300. b.prototype.createGroup = function(a, b, c) {
  301. void 0 === c && (c = !1);
  302. if (!c && this.groupDic[a] || !b || 0 == b.length) return !1;
  303. c = this.groupDic;
  304. for (var d = [], h = b.length,
  305. g = 0; g < h; g++) {
  306. var f = b[g],
  307. k = c[f];
  308. if (k)
  309. for (var f = k.length, m = 0; m < f; m++) {
  310. var n = k[m]; - 1 == d.indexOf(n) && d.push(n)
  311. } else(n = this.keyMap[f]) && -1 == d.indexOf(n) && d.push(n)
  312. }
  313. if (0 == d.length) return !1;
  314. this.groupDic[a] = d;
  315. return !0
  316. };
  317. b.prototype.parseConfig = function(a, b) {
  318. if (a) {
  319. var c = a.resources;
  320. if (c)
  321. for (var d = c.length, h = 0; h < d; h++) {
  322. var g = c[h],
  323. f = g.url;
  324. f && -1 == f.indexOf("://") && (g.url = b + f);
  325. this.addItemToKeyMap(g)
  326. }
  327. if (c = a.groups)
  328. for (d = c.length, h = 0; h < d; h++) {
  329. for (var f = c[h], k = [], m = f.keys.split(","), n = m.length, p = 0; p < n; p++) g = m[p].trim(), (g = this.keyMap[g]) && -1 == k.indexOf(g) && k.push(g);
  330. this.groupDic[f.name] = k
  331. }
  332. }
  333. };
  334. b.prototype.addSubkey = function(a, b) {
  335. var c = this.keyMap[b];
  336. c && !this.keyMap[a] && (this.keyMap[a] = c)
  337. };
  338. b.prototype.addItemToKeyMap = function(a) {
  339. this.keyMap[a.name] || (this.keyMap[a.name] = a);
  340. if (a.hasOwnProperty("subkeys")) {
  341. var b = a.subkeys.split(",");
  342. a.subkeys = b;
  343. for (var c = b.length, d = 0; d < c; d++) {
  344. var h = b[d];
  345. null == this.keyMap[h] && (this.keyMap[h] = a)
  346. }
  347. }
  348. };
  349. b.prototype.getName = function(a) {
  350. return (a = this.keyMap[a]) ? a.name : ""
  351. };
  352. b.prototype.getType =
  353. function(a) {
  354. return (a = this.keyMap[a]) ? a.type : ""
  355. };
  356. b.prototype.getRawResourceItem = function(a) {
  357. return this.keyMap[a]
  358. };
  359. b.prototype.getResourceItem = function(a) {
  360. return (a = this.keyMap[a]) ? this.parseResourceItem(a) : null
  361. };
  362. b.prototype.parseResourceItem = function(a) {
  363. var b = new c.ResourceItem(a.name, a.url, a.type);
  364. b.data = a;
  365. return b
  366. };
  367. return b
  368. }();
  369. c.ResourceConfig = d;
  370. d.prototype.__class__ = "RES.ResourceConfig"
  371. })(RES || (RES = {}));
  372. __extends = this.__extends || function(c, d) {
  373. function b() {
  374. this.constructor = c
  375. }
  376. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  377. b.prototype = d.prototype;
  378. c.prototype = new b
  379. };
  380. (function(c) {
  381. var d = function(b) {
  382. function a() {
  383. b.call(this);
  384. this.thread = 2;
  385. this.loadingCount = 0;
  386. this.groupTotalDic = {};
  387. this.numLoadedDic = {};
  388. this.itemListDic = {};
  389. this.priorityQueue = {};
  390. this.lazyLoadList = [];
  391. this.analyzerDic = {};
  392. this.queueIndex = 0
  393. }
  394. __extends(a, b);
  395. a.prototype.isGroupInLoading = function(a) {
  396. return void 0 !== this.itemListDic[a]
  397. };
  398. a.prototype.loadGroup = function(a, b, d) {
  399. void 0 === d && (d = 0);
  400. if (!this.itemListDic[b] && b)
  401. if (a && 0 != a.length) {
  402. this.priorityQueue[d] ? this.priorityQueue[d].push(b) : this.priorityQueue[d] = [b];
  403. this.itemListDic[b] = a;
  404. d = a.length;
  405. for (var h = 0; h < d; h++) a[h].groupName = b;
  406. this.groupTotalDic[b] = a.length;
  407. this.numLoadedDic[b] = 0;
  408. this.next()
  409. } else egret.Logger.warning('RES加载了不存在或空的资源组:"' + b + '"'), a = new c.ResourceEvent(c.ResourceEvent.GROUP_COMPLETE), a.groupName = b, this.dispatchEvent(a)
  410. };
  411. a.prototype.loadItem = function(a) {
  412. this.lazyLoadList.push(a);
  413. a.groupName = "";
  414. this.next()
  415. };
  416. a.prototype.next = function() {
  417. for (; this.loadingCount < this.thread;) {
  418. var a =
  419. this.getOneResourceItem();
  420. if (!a) break;
  421. this.loadingCount++;
  422. if (a.loaded) this.onItemComplete(a);
  423. else {
  424. var b = this.analyzerDic[a.type];
  425. b || (b = this.analyzerDic[a.type] = egret.Injector.getInstance(c.AnalyzerBase, a.type));
  426. b.loadFile(a, this.onItemComplete, this)
  427. }
  428. }
  429. };
  430. a.prototype.getOneResourceItem = function() {
  431. var a = Number.NEGATIVE_INFINITY,
  432. b;
  433. for (b in this.priorityQueue) a = Math.max(a, b);
  434. a = this.priorityQueue[a];
  435. if (!a || 0 == a.length) return 0 == this.lazyLoadList.length ? null : this.lazyLoadList.pop();
  436. b = a.length;
  437. for (var c, d =
  438. 0; d < b; d++) {
  439. this.queueIndex >= b && (this.queueIndex = 0);
  440. c = this.itemListDic[a[this.queueIndex]];
  441. if (0 < c.length) break;
  442. this.queueIndex++
  443. }
  444. return 0 == c.length ? null : c.shift()
  445. };
  446. a.prototype.onItemComplete = function(a) {
  447. this.loadingCount--;
  448. var b = a.groupName;
  449. a.loaded || c.ResourceEvent.dispatchResourceEvent(this.resInstance, c.ResourceEvent.ITEM_LOAD_ERROR, b, a);
  450. if (b) {
  451. this.numLoadedDic[b]++;
  452. var d = this.numLoadedDic[b],
  453. h = this.groupTotalDic[b];
  454. c.ResourceEvent.dispatchResourceEvent(this.resInstance, c.ResourceEvent.GROUP_PROGRESS,
  455. b, a, d, h);
  456. d == h && (this.removeGroupName(b), delete this.groupTotalDic[b], delete this.numLoadedDic[b], delete this.itemListDic[b], c.ResourceEvent.dispatchResourceEvent(this, c.ResourceEvent.GROUP_COMPLETE, b))
  457. } else this.callBack.call(this.resInstance, a);
  458. this.next()
  459. };
  460. a.prototype.removeGroupName = function(a) {
  461. for (var b in this.priorityQueue) {
  462. for (var c = this.priorityQueue[b], d = c.length, g = 0, f = !1, d = c.length, k = 0; k < d; k++) {
  463. if (c[k] == a) {
  464. c.splice(g, 1);
  465. f = !0;
  466. break
  467. }
  468. g++
  469. }
  470. if (f) {
  471. 0 == c.length && delete this.priorityQueue[b];
  472. break
  473. }
  474. }
  475. };
  476. return a
  477. }(egret.EventDispatcher);
  478. c.ResourceLoader = d;
  479. d.prototype.__class__ = "RES.ResourceLoader"
  480. })(RES || (RES = {}));
  481. __extends = this.__extends || function(c, d) {
  482. function b() {
  483. this.constructor = c
  484. }
  485. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  486. b.prototype = d.prototype;
  487. c.prototype = new b
  488. };
  489. (function(c) {
  490. var d = function(b) {
  491. function a() {
  492. b.call(this);
  493. this.resourceConfig = c.configInstance
  494. }
  495. __extends(a, b);
  496. a.prototype.addSubkey = function(a, b) {
  497. this.resourceConfig.addSubkey(a, b)
  498. };
  499. a.prototype.loadFile = function(a, b, c) {};
  500. a.prototype.getRes = function(a) {};
  501. a.prototype.destroyRes = function(a) {
  502. return !1
  503. };
  504. a.getStringPrefix = function(a) {
  505. if (!a) return "";
  506. var b = a.indexOf(".");
  507. return -1 != b ? a.substring(0, b) : ""
  508. };
  509. a.getStringTail = function(a) {
  510. if (!a) return "";
  511. var b = a.indexOf(".");
  512. return -1 != b ? a.substring(b + 1) : ""
  513. };
  514. return a
  515. }(egret.HashObject);
  516. c.AnalyzerBase = d;
  517. d.prototype.__class__ = "RES.AnalyzerBase"
  518. })(RES || (RES = {}));
  519. __extends = this.__extends || function(c, d) {
  520. function b() {
  521. this.constructor = c
  522. }
  523. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  524. b.prototype = d.prototype;
  525. c.prototype = new b
  526. };
  527. (function(c) {
  528. var d = function(b) {
  529. function a() {
  530. b.call(this);
  531. this.fileDic = {};
  532. this.resItemDic = [];
  533. this._dataFormat = egret.URLLoaderDataFormat.BINARY;
  534. this.recycler = new egret.Recycler
  535. }
  536. __extends(a, b);
  537. a.prototype.loadFile = function(a, b, c) {
  538. if (this.fileDic[a.name]) b.call(c, a);
  539. else {
  540. var d = this.getLoader();
  541. this.resItemDic[d.hashCode] = {
  542. item: a,
  543. func: b,
  544. thisObject: c
  545. };
  546. d.load(new egret.URLRequest(a.url))
  547. }
  548. };
  549. a.prototype.getLoader = function() {
  550. var a = this.recycler.pop();
  551. a || (a = new egret.URLLoader, a.addEventListener(egret.Event.COMPLETE,
  552. this.onLoadFinish, this), a.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onLoadFinish, this));
  553. a.dataFormat = this._dataFormat;
  554. return a
  555. };
  556. a.prototype.onLoadFinish = function(a) {
  557. var b = a.target,
  558. c = this.resItemDic[b.hashCode];
  559. delete this.resItemDic[b.hashCode];
  560. this.recycler.push(b);
  561. var d = c.item,
  562. g = c.func;
  563. d.loaded = a.type == egret.Event.COMPLETE;
  564. d.loaded && this.analyzeData(d, b.data);
  565. g.call(c.thisObject, d)
  566. };
  567. a.prototype.analyzeData = function(a, b) {
  568. var c = a.name;
  569. !this.fileDic[c] && b && (this.fileDic[c] = b)
  570. };
  571. a.prototype.getRes =
  572. function(a) {
  573. return this.fileDic[a]
  574. };
  575. a.prototype.hasRes = function(a) {
  576. return null != this.getRes(a)
  577. };
  578. a.prototype.destroyRes = function(a) {
  579. return this.fileDic[a] ? (delete this.fileDic[a], !0) : !1
  580. };
  581. return a
  582. }(c.AnalyzerBase);
  583. c.BinAnalyzer = d;
  584. d.prototype.__class__ = "RES.BinAnalyzer"
  585. })(RES || (RES = {}));
  586. __extends = this.__extends || function(c, d) {
  587. function b() {
  588. this.constructor = c
  589. }
  590. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  591. b.prototype = d.prototype;
  592. c.prototype = new b
  593. };
  594. (function(c) {
  595. var d = function(b) {
  596. function a() {
  597. b.call(this);
  598. this._dataFormat = egret.URLLoaderDataFormat.TEXTURE
  599. }
  600. __extends(a, b);
  601. a.prototype.analyzeData = function(a, b) {
  602. var c = a.name;
  603. !this.fileDic[c] && b && (this.fileDic[c] = b, (c = a.data) && c.scale9grid && (c = c.scale9grid.split(","), b.scale9Grid = new egret.Rectangle(parseInt(c[0]), parseInt(c[1]), parseInt(c[2]), parseInt(c[3]))))
  604. };
  605. return a
  606. }(c.BinAnalyzer);
  607. c.ImageAnalyzer = d;
  608. d.prototype.__class__ = "RES.ImageAnalyzer"
  609. })(RES || (RES = {}));
  610. __extends = this.__extends || function(c, d) {
  611. function b() {
  612. this.constructor = c
  613. }
  614. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  615. b.prototype = d.prototype;
  616. c.prototype = new b
  617. };
  618. (function(c) {
  619. var d = function(b) {
  620. function a() {
  621. b.call(this);
  622. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  623. }
  624. __extends(a, b);
  625. a.prototype.analyzeData = function(a, b) {
  626. var c = a.name;
  627. if (!this.fileDic[c] && b) try {
  628. this.fileDic[c] = JSON.parse(b)
  629. } catch (d) {
  630. egret.Logger.warning("JSON文件格式不正确: " + a.url + "\ndata:" + b)
  631. }
  632. };
  633. return a
  634. }(c.BinAnalyzer);
  635. c.JsonAnalyzer = d;
  636. d.prototype.__class__ = "RES.JsonAnalyzer"
  637. })(RES || (RES = {}));
  638. __extends = this.__extends || function(c, d) {
  639. function b() {
  640. this.constructor = c
  641. }
  642. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  643. b.prototype = d.prototype;
  644. c.prototype = new b
  645. };
  646. (function(c) {
  647. var d = function(b) {
  648. function a() {
  649. b.call(this);
  650. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  651. }
  652. __extends(a, b);
  653. return a
  654. }(c.BinAnalyzer);
  655. c.TextAnalyzer = d;
  656. d.prototype.__class__ = "RES.TextAnalyzer"
  657. })(RES || (RES = {}));
  658. __extends = this.__extends || function(c, d) {
  659. function b() {
  660. this.constructor = c
  661. }
  662. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  663. b.prototype = d.prototype;
  664. c.prototype = new b
  665. };
  666. (function(c) {
  667. var d = function(b) {
  668. function a() {
  669. b.call(this);
  670. this.sheetMap = {};
  671. this.textureMap = {};
  672. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  673. }
  674. __extends(a, b);
  675. a.prototype.getRes = function(a) {
  676. var b = this.fileDic[a];
  677. b || (b = this.textureMap[a]);
  678. !b && (b = c.AnalyzerBase.getStringPrefix(a), b = this.fileDic[b]) && (a = c.AnalyzerBase.getStringTail(a), b = b.getTexture(a));
  679. return b
  680. };
  681. a.prototype.onLoadFinish = function(a) {
  682. var b = a.target,
  683. c = this.resItemDic[b.hashCode];
  684. delete this.resItemDic[b.hashCode];
  685. this.recycler.push(b);
  686. var d =
  687. c.item,
  688. g = c.func;
  689. d.loaded = a.type == egret.Event.COMPLETE;
  690. d.loaded && this.analyzeData(d, b.data);
  691. "string" == typeof b.data ? (this._dataFormat = egret.URLLoaderDataFormat.TEXTURE, this.loadFile(d, g, c.thisObject), this._dataFormat = egret.URLLoaderDataFormat.TEXT) : g.call(c.thisObject, d)
  692. };
  693. a.prototype.analyzeData = function(a, b) {
  694. var c = a.name;
  695. if (!this.fileDic[c] && b) {
  696. var d;
  697. if ("string" == typeof b) {
  698. try {
  699. d = JSON.parse(b)
  700. } catch (g) {
  701. egret.Logger.warning("JSON文件格式不正确: " + a.url)
  702. }
  703. d && (this.sheetMap[c] =
  704. d, a.loaded = !1, a.url = this.getRelativePath(a.url, d.file))
  705. } else d = this.sheetMap[c], delete this.sheetMap[c], b && (d = this.parseSpriteSheet(b, d, a.data && a.data.subkeys ? "" : c), this.fileDic[c] = d)
  706. }
  707. };
  708. a.prototype.getRelativePath = function(a, b) {
  709. a = a.split("\\").join("/");
  710. var c = a.lastIndexOf("/");
  711. return a = -1 != c ? a.substring(0, c + 1) + b : b
  712. };
  713. a.prototype.parseSpriteSheet = function(a, b, c) {
  714. b = b.frames;
  715. if (!b) return null;
  716. var d = new egret.SpriteSheet(a),
  717. g = this.textureMap,
  718. f;
  719. for (f in b) {
  720. var k = b[f];
  721. a = d.createTexture(f, k.x, k.y, k.w, k.h,
  722. k.offX, k.offY, k.sourceW, k.sourceH);
  723. k.scale9grid && (k = k.scale9grid.split(","), a.scale9Grid = new egret.Rectangle(parseInt(k[0]), parseInt(k[1]), parseInt(k[2]), parseInt(k[3])));
  724. null == g[f] && (g[f] = a, c && this.addSubkey(f, c))
  725. }
  726. return d
  727. };
  728. return a
  729. }(c.BinAnalyzer);
  730. c.SheetAnalyzer = d;
  731. d.prototype.__class__ = "RES.SheetAnalyzer"
  732. })(RES || (RES = {}));
  733. __extends = this.__extends || function(c, d) {
  734. function b() {
  735. this.constructor = c
  736. }
  737. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  738. b.prototype = d.prototype;
  739. c.prototype = new b
  740. };
  741. (function(c) {
  742. var d = function(b) {
  743. function a() {
  744. b.call(this)
  745. }
  746. __extends(a, b);
  747. a.prototype.analyzeData = function(a, b) {
  748. var c = a.name;
  749. if (!this.fileDic[c] && b) {
  750. var d;
  751. "string" == typeof b ? (d = b, this.sheetMap[c] = d, a.loaded = !1, a.url = this.getTexturePath(a.url, d)) : (d = this.sheetMap[c], delete this.sheetMap[c], b && (d = new egret.BitmapTextSpriteSheet(b, d), this.fileDic[c] = d))
  752. }
  753. };
  754. a.prototype.getTexturePath = function(a, b) {
  755. var c = "",
  756. d = b.split("\n")[2],
  757. g = d.indexOf('file="'); - 1 != g && (d = d.substring(g + 6), g = d.indexOf('"'), c = d.substring(0,
  758. g));
  759. a = a.split("\\").join("/");
  760. g = a.lastIndexOf("/");
  761. return a = -1 != g ? a.substring(0, g + 1) + c : c
  762. };
  763. return a
  764. }(c.SheetAnalyzer);
  765. c.FontAnalyzer = d;
  766. d.prototype.__class__ = "RES.FontAnalyzer"
  767. })(RES || (RES = {}));
  768. __extends = this.__extends || function(c, d) {
  769. function b() {
  770. this.constructor = c
  771. }
  772. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  773. b.prototype = d.prototype;
  774. c.prototype = new b
  775. };
  776. (function(c) {
  777. var d = function(b) {
  778. function a() {
  779. b.call(this);
  780. this._dataFormat = egret.URLLoaderDataFormat.SOUND
  781. }
  782. __extends(a, b);
  783. a.prototype.analyzeData = function(a, b) {
  784. var c = a.name;
  785. !this.fileDic[c] && b && (this.fileDic[c] = b, (c = a.data) && c.soundType ? b.preload(c.soundType) : b.preload(egret.Sound.EFFECT))
  786. };
  787. return a
  788. }(c.BinAnalyzer);
  789. c.SoundAnalyzer = d;
  790. d.prototype.__class__ = "RES.SoundAnalyzer"
  791. })(RES || (RES = {}));
  792. __extends = this.__extends || function(c, d) {
  793. function b() {
  794. this.constructor = c
  795. }
  796. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  797. b.prototype = d.prototype;
  798. c.prototype = new b
  799. };
  800. (function(c) {
  801. var d = function(b) {
  802. function a() {
  803. b.call(this);
  804. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  805. }
  806. __extends(a, b);
  807. a.prototype.analyzeData = function(a, b) {
  808. var c = a.name;
  809. if (!this.fileDic[c] && b) try {
  810. var d = egret.XML.parse(b);
  811. this.fileDic[c] = d
  812. } catch (g) {}
  813. };
  814. return a
  815. }(c.BinAnalyzer);
  816. c.XMLAnalyzer = d;
  817. d.prototype.__class__ = "RES.XMLAnalyzer"
  818. })(RES || (RES = {}));
  819. __extends = this.__extends || function(c, d) {
  820. function b() {
  821. this.constructor = c
  822. }
  823. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  824. b.prototype = d.prototype;
  825. c.prototype = new b
  826. };
  827. (function(c) {
  828. c.loadConfig = function(a, c, d) {
  829. void 0 === c && (c = "");
  830. void 0 === d && (d = "json");
  831. b.loadConfig(a, c, d)
  832. };
  833. c.loadGroup = function(a, c) {
  834. void 0 === c && (c = 0);
  835. b.loadGroup(a, c)
  836. };
  837. c.isGroupLoaded = function(a) {
  838. return b.isGroupLoaded(a)
  839. };
  840. c.getGroupByName = function(a) {
  841. return b.getGroupByName(a)
  842. };
  843. c.createGroup = function(a, c, d) {
  844. void 0 === d && (d = !1);
  845. return b.createGroup(a, c, d)
  846. };
  847. c.hasRes = function(a) {
  848. return b.hasRes(a)
  849. };
  850. c.getRes = function(a) {
  851. return b.getRes(a)
  852. };
  853. c.getResAsync = function(a, c, d) {
  854. b.getResAsync(a, c, d)
  855. };
  856. c.getResByUrl =
  857. function(a, c, d, q) {
  858. void 0 === q && (q = "");
  859. b.getResByUrl(a, c, d, q)
  860. };
  861. c.destroyRes = function(a) {
  862. return b.destroyRes(a)
  863. };
  864. c.setMaxLoadingThread = function(a) {
  865. b.setMaxLoadingThread(a)
  866. };
  867. c.addEventListener = function(a, c, d, q, h) {
  868. void 0 === q && (q = !1);
  869. void 0 === h && (h = 0);
  870. b.addEventListener(a, c, d, q, h)
  871. };
  872. c.removeEventListener = function(a, c, d, q) {
  873. void 0 === q && (q = !1);
  874. b.removeEventListener(a, c, d, q)
  875. };
  876. var d = function(a) {
  877. function b() {
  878. a.call(this);
  879. this.analyzerDic = {};
  880. this.configItemList = [];
  881. this.configComplete = this.callLaterFlag = !1;
  882. this.loadedGroups = [];
  883. this.groupNameList = [];
  884. this.asyncDic = {};
  885. this.init()
  886. }
  887. __extends(b, a);
  888. b.prototype.getAnalyzerByType = function(a) {
  889. var b = this.analyzerDic[a];
  890. b || (b = this.analyzerDic[a] = egret.Injector.getInstance(c.AnalyzerBase, a));
  891. return b
  892. };
  893. b.prototype.init = function() {
  894. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_BIN) || egret.Injector.mapClass(c.AnalyzerBase, c.BinAnalyzer, c.ResourceItem.TYPE_BIN);
  895. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_IMAGE) || egret.Injector.mapClass(c.AnalyzerBase, c.ImageAnalyzer,
  896. c.ResourceItem.TYPE_IMAGE);
  897. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_TEXT) || egret.Injector.mapClass(c.AnalyzerBase, c.TextAnalyzer, c.ResourceItem.TYPE_TEXT);
  898. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_JSON) || egret.Injector.mapClass(c.AnalyzerBase, c.JsonAnalyzer, c.ResourceItem.TYPE_JSON);
  899. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_SHEET) || egret.Injector.mapClass(c.AnalyzerBase, c.SheetAnalyzer, c.ResourceItem.TYPE_SHEET);
  900. egret.Injector.hasMapRule(c.AnalyzerBase,
  901. c.ResourceItem.TYPE_FONT) || egret.Injector.mapClass(c.AnalyzerBase, c.FontAnalyzer, c.ResourceItem.TYPE_FONT);
  902. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_SOUND) || egret.Injector.mapClass(c.AnalyzerBase, c.SoundAnalyzer, c.ResourceItem.TYPE_SOUND);
  903. egret.Injector.hasMapRule(c.AnalyzerBase, c.ResourceItem.TYPE_XML) || egret.Injector.mapClass(c.AnalyzerBase, c.XMLAnalyzer, c.ResourceItem.TYPE_XML);
  904. this.resConfig = new c.ResourceConfig;
  905. this.resLoader = new c.ResourceLoader;
  906. this.resLoader.callBack = this.onResourceItemComp;
  907. this.resLoader.resInstance = this;
  908. this.resLoader.addEventListener(c.ResourceEvent.GROUP_COMPLETE, this.onGroupComp, this)
  909. };
  910. b.prototype.loadConfig = function(a, b, c) {
  911. void 0 === c && (c = "json");
  912. this.configItemList.push({
  913. url: a,
  914. resourceRoot: b,
  915. type: c
  916. });
  917. this.callLaterFlag || (egret.callLater(this.startLoadConfig, this), this.callLaterFlag = !0)
  918. };
  919. b.prototype.startLoadConfig = function() {
  920. this.callLaterFlag = !1;
  921. var a = this.configItemList;
  922. this.configItemList = [];
  923. this.loadingConfigList = a;
  924. for (var d = a.length, h = [], g = 0; g < d; g++) {
  925. var f =
  926. a[g],
  927. f = new c.ResourceItem(f.url, f.url, f.type);
  928. h.push(f)
  929. }
  930. this.resLoader.loadGroup(h, b.GROUP_CONFIG, Number.MAX_VALUE)
  931. };
  932. b.prototype.isGroupLoaded = function(a) {
  933. return -1 != this.loadedGroups.indexOf(a)
  934. };
  935. b.prototype.getGroupByName = function(a) {
  936. return this.resConfig.getGroupByName(a)
  937. };
  938. b.prototype.loadGroup = function(a, b) {
  939. void 0 === b && (b = 0);
  940. if (-1 == this.loadedGroups.indexOf(a) && !this.resLoader.isGroupInLoading(a))
  941. if (this.configComplete) {
  942. var c = this.resConfig.getGroupByName(a);
  943. this.resLoader.loadGroup(c, a, b)
  944. } else this.groupNameList.push({
  945. name: a,
  946. priority: b
  947. })
  948. };
  949. b.prototype.createGroup = function(a, b, c) {
  950. void 0 === c && (c = !1);
  951. if (c) {
  952. var d = this.loadedGroups.indexOf(a); - 1 != d && this.loadedGroups.splice(d, 1)
  953. }
  954. return this.resConfig.createGroup(a, b, c)
  955. };
  956. b.prototype.onGroupComp = function(a) {
  957. if (a.groupName == b.GROUP_CONFIG) {
  958. a = this.loadingConfigList.length;
  959. for (var d = 0; d < a; d++) {
  960. var h = this.loadingConfigList[d],
  961. g = this.getAnalyzerByType(h.type),
  962. f = g.getRes(h.url);
  963. g.destroyRes(h.url);
  964. this.resConfig.parseConfig(f, h.resourceRoot)
  965. }
  966. this.configComplete = !0;
  967. this.loadingConfigList =
  968. null;
  969. c.ResourceEvent.dispatchResourceEvent(this, c.ResourceEvent.CONFIG_COMPLETE);
  970. h = this.groupNameList;
  971. a = h.length;
  972. for (d = 0; d < a; d++) g = h[d], this.loadGroup(g.name, g.priority);
  973. this.groupNameList = []
  974. } else this.loadedGroups.push(a.groupName), this.dispatchEvent(a)
  975. };
  976. b.prototype.hasRes = function(a) {
  977. var b = this.resConfig.getType(a);
  978. return "" == b && (a = c.AnalyzerBase.getStringPrefix(a), b = this.resConfig.getType(a), "" == b) ? !1 : !0
  979. };
  980. b.prototype.getRes = function(a) {
  981. var b = this.resConfig.getType(a);
  982. return "" == b && (b = c.AnalyzerBase.getStringPrefix(a),
  983. b = this.resConfig.getType(b), "" == b) ? null : this.getAnalyzerByType(b).getRes(a)
  984. };
  985. b.prototype.getResAsync = function(a, b, d) {
  986. var e = this.resConfig.getType(a),
  987. f = this.resConfig.getName(a);
  988. if ("" == e && (f = c.AnalyzerBase.getStringPrefix(a), e = this.resConfig.getType(f), "" == e)) {
  989. b.call(d, null);
  990. return
  991. }(e = this.getAnalyzerByType(e).getRes(a)) ? b.call(d, e): (a = {
  992. key: a,
  993. compFunc: b,
  994. thisObject: d
  995. }, this.asyncDic[f] ? this.asyncDic[f].push(a) : (this.asyncDic[f] = [a], f = this.resConfig.getResourceItem(f), this.resLoader.loadItem(f)))
  996. };
  997. b.prototype.getResByUrl =
  998. function(a, b, d, e) {
  999. void 0 === e && (e = "");
  1000. if (a) {
  1001. e || (e = this.getTypeByUrl(a));
  1002. var f = this.getAnalyzerByType(e).getRes(a);
  1003. f ? b.call(d, f) : (b = {
  1004. key: a,
  1005. compFunc: b,
  1006. thisObject: d
  1007. }, this.asyncDic[a] ? this.asyncDic[a].push(b) : (this.asyncDic[a] = [b], a = new c.ResourceItem(a, a, e), this.resLoader.loadItem(a)))
  1008. } else b.call(d, null)
  1009. };
  1010. b.prototype.getTypeByUrl = function(a) {
  1011. (a = a.substr(a.lastIndexOf(".") + 1)) && (a = a.toLowerCase());
  1012. switch (a) {
  1013. case c.ResourceItem.TYPE_XML:
  1014. case c.ResourceItem.TYPE_JSON:
  1015. case c.ResourceItem.TYPE_SHEET:
  1016. break;
  1017. case "png":
  1018. case "jpg":
  1019. case "gif":
  1020. a = c.ResourceItem.TYPE_IMAGE;
  1021. break;
  1022. case "fnt":
  1023. a = c.ResourceItem.TYPE_FONT;
  1024. break;
  1025. case "txt":
  1026. a = c.ResourceItem.TYPE_TEXT;
  1027. break;
  1028. case "mp3":
  1029. case "ogg":
  1030. case "mpeg":
  1031. case "wav":
  1032. case "m4a":
  1033. case "mp4":
  1034. case "aiff":
  1035. case "wma":
  1036. case "mid":
  1037. a = c.ResourceItem.TYPE_SOUND;
  1038. break;
  1039. default:
  1040. a = c.ResourceItem.TYPE_BIN
  1041. }
  1042. return a
  1043. };
  1044. b.prototype.onResourceItemComp = function(a) {
  1045. var b = this.asyncDic[a.name];
  1046. delete this.asyncDic[a.name];
  1047. a = this.getAnalyzerByType(a.type);
  1048. for (var c = b.length, d = 0; d < c; d++) {
  1049. var e =
  1050. b[d],
  1051. k = a.getRes(e.key);
  1052. e.compFunc.call(e.thisObject, k, e.key)
  1053. }
  1054. };
  1055. b.prototype.destroyRes = function(a) {
  1056. var b = this.resConfig.getRawGroupByName(a);
  1057. if (b) {
  1058. var c = this.loadedGroups.indexOf(a); - 1 != c && this.loadedGroups.splice(c, 1);
  1059. a = b.length;
  1060. for (var d = 0; d < a; d++) {
  1061. c = b[d];
  1062. c.loaded = !1;
  1063. var e = this.getAnalyzerByType(c.type);
  1064. e.destroyRes(c.name)
  1065. }
  1066. return !0
  1067. }
  1068. b = this.resConfig.getType(a);
  1069. if ("" == b) return !1;
  1070. c = this.resConfig.getRawResourceItem(a);
  1071. c.loaded = !1;
  1072. e = this.getAnalyzerByType(b);
  1073. return e.destroyRes(a)
  1074. };
  1075. b.prototype.setMaxLoadingThread =
  1076. function(a) {
  1077. 1 > a && (a = 1);
  1078. this.resLoader.thread = a
  1079. };
  1080. b.GROUP_CONFIG = "RES__CONFIG";
  1081. return b
  1082. }(egret.EventDispatcher);
  1083. d.prototype.__class__ = "RES.Resource";
  1084. var b = new d
  1085. })(RES || (RES = {}));
  1086. __extends = this.__extends || function(c, d) {
  1087. function b() {
  1088. this.constructor = c
  1089. }
  1090. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  1091. b.prototype = d.prototype;
  1092. c.prototype = new b
  1093. };
  1094. (function(c) {
  1095. var d = function(b) {
  1096. function a(c) {
  1097. void 0 === c && (c = 60);
  1098. b.call(this);
  1099. this.frameRate = c;
  1100. this._time = 0;
  1101. this._isActivate = !0;
  1102. 60 == c && (a.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame, a.cancelAnimationFrame = window.cancelAnimationFrame || window.msCancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.oCancelAnimationFrame || window.cancelRequestAnimationFrame ||
  1103. window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame);
  1104. a.requestAnimationFrame || (a.requestAnimationFrame = function(a) {
  1105. return window.setTimeout(a, 1E3 / c)
  1106. });
  1107. a.cancelAnimationFrame || (a.cancelAnimationFrame = function(a) {
  1108. return window.clearTimeout(a)
  1109. });
  1110. a.instance = this;
  1111. this.registerListener()
  1112. }
  1113. __extends(a, b);
  1114. a.prototype.enterFrame = function() {
  1115. var b = a.instance,
  1116. d = a._thisObject,
  1117. q = a._callback,
  1118. h = c.getTimer(),
  1119. g = h -
  1120. b._time;
  1121. b._requestAnimationId = a.requestAnimationFrame.call(window, a.prototype.enterFrame);
  1122. q.call(d, g);
  1123. b._time = h
  1124. };
  1125. a.prototype.executeMainLoop = function(b, c) {
  1126. a._callback = b;
  1127. a._thisObject = c;
  1128. this.enterFrame()
  1129. };
  1130. a.prototype.reset = function() {
  1131. var b = a.instance;
  1132. b._requestAnimationId && (b._time = c.getTimer(), a.cancelAnimationFrame.call(window, b._requestAnimationId), b.enterFrame())
  1133. };
  1134. a.prototype.registerListener = function() {
  1135. var b = this,
  1136. d = function() {
  1137. b._isActivate && (b._isActivate = !1, c.MainContext.instance.stage.dispatchEvent(new c.Event(c.Event.DEACTIVATE)))
  1138. },
  1139. q = function() {
  1140. b._isActivate || (b._isActivate = !0, a.instance.reset(), c.MainContext.instance.stage.dispatchEvent(new c.Event(c.Event.ACTIVATE)))
  1141. },
  1142. h = function() {
  1143. document[g] ? d() : q()
  1144. };
  1145. window.addEventListener("focus", q, !1);
  1146. window.addEventListener("blur", d, !1);
  1147. var g, f;
  1148. "undefined" !== typeof document.hidden ? (g = "hidden", f = "visibilitychange") : "undefined" !== typeof document.mozHidden ? (g = "mozHidden", f = "mozvisibilitychange") : "undefined" !== typeof document.msHidden ? (g = "msHidden", f = "msvisibilitychange") : "undefined" !== typeof document.webkitHidden ?
  1149. (g = "webkitHidden", f = "webkitvisibilitychange") : "undefined" !== typeof document.oHidden && (g = "oHidden", f = "ovisibilitychange");
  1150. "onpageshow" in window && "onpagehide" in window && (window.addEventListener("pageshow", q, !1), window.addEventListener("pagehide", d, !1));
  1151. g && f && document.addEventListener(f, h, !1)
  1152. };
  1153. return a
  1154. }(c.DeviceContext);
  1155. c.HTML5DeviceContext = d;
  1156. d.prototype.__class__ = "egret.HTML5DeviceContext"
  1157. })(egret || (egret = {}));
  1158. var egret_html5_localStorage;
  1159. (function(c) {
  1160. c.getItem = function(c) {
  1161. // return ih5game.storage.get(c)
  1162. };
  1163. c.setItem = function(c, b) {
  1164. try {
  1165. // return ih5game.storage.set(c, b, true), !0
  1166. } catch (a) {
  1167. return console.log("egret_html5_localStorage.setItem保存失败,key=" + c + "&value=" + b), !1
  1168. }
  1169. };
  1170. c.removeItem = function(c) {
  1171. // ih5game.storage.remove(c)
  1172. };
  1173. c.clear = function() {
  1174. window.localStorage.clear()
  1175. };
  1176. c.init = function() {
  1177. for (var d in c) egret.localStorage[d] = c[d]
  1178. }
  1179. })(egret_html5_localStorage || (egret_html5_localStorage = {}));
  1180. egret_html5_localStorage.init();
  1181. __extends = this.__extends || function(c, d) {
  1182. function b() {
  1183. this.constructor = c
  1184. }
  1185. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  1186. b.prototype = d.prototype;
  1187. c.prototype = new b
  1188. };
  1189. (function(c) {
  1190. var d = function(b) {
  1191. function a(a) {
  1192. b.call(this);
  1193. this.globalAlpha = 1;
  1194. this.canvas = a || this.createCanvas();
  1195. this.canvasContext = this.canvas.getContext("2d");
  1196. this._cacheCanvas = document.createElement("canvas");
  1197. this._cacheCanvas.width = this.canvas.width;
  1198. this._cacheCanvas.height = this.canvas.height;
  1199. this._cacheCanvasContext = this._cacheCanvas.getContext("2d");
  1200. this._cacheCanvasContext.imageSmoothingEnabled = c.RendererContext.imageSmoothingEnabled;
  1201. this._cacheCanvasContext.webkitImageSmoothingEnabled = c.RendererContext.imageSmoothingEnabled;
  1202. this._cacheCanvasContext.mozImageSmoothingEnabled = c.RendererContext.imageSmoothingEnabled;
  1203. this._cacheCanvasContext.msImageSmoothingEnabled = c.RendererContext.imageSmoothingEnabled;
  1204. this.onResize();
  1205. var d = this.canvasContext.setTransform,
  1206. q = this;
  1207. this._cacheCanvasContext.setTransform = function(a, b, c, e, m, n) {
  1208. q._matrixA = a;
  1209. q._matrixB = b;
  1210. q._matrixC = c;
  1211. q._matrixD = e;
  1212. q._matrixTx = m;
  1213. q._matrixTy = n;
  1214. d.call(q._cacheCanvasContext, a, b, c, e, m, n)
  1215. };
  1216. this._matrixA = 1;
  1217. this._matrixC = this._matrixB = 0;
  1218. this._matrixD = 1;
  1219. this._transformTy =
  1220. this._transformTx = this._matrixTy = this._matrixTx = 0;
  1221. this.initBlendMode()
  1222. }
  1223. __extends(a, b);
  1224. a.prototype.createCanvas = function() {
  1225. var a = c.Browser.getInstance().$("#egretCanvas");
  1226. if (!a) {
  1227. var b = document.getElementById(c.StageDelegate.canvas_div_name),
  1228. a = c.Browser.getInstance().$new("canvas");
  1229. a.id = "egretCanvas";
  1230. b.appendChild(a)
  1231. }
  1232. c.MainContext.instance.stage.addEventListener(c.Event.RESIZE, this.onResize, this);
  1233. return a
  1234. };
  1235. a.prototype.onResize = function() {
  1236. if (this.canvas) {
  1237. var a = document.getElementById(c.StageDelegate.canvas_div_name);
  1238. this.canvas.width = c.MainContext.instance.stage.stageWidth;
  1239. this.canvas.height = c.MainContext.instance.stage.stageHeight;
  1240. this.canvas.style.width = a.style.width;
  1241. this.canvas.style.height = a.style.height;
  1242. this._cacheCanvas.width = this.canvas.width;
  1243. this._cacheCanvas.height = this.canvas.height
  1244. }
  1245. };
  1246. a.prototype.clearScreen = function() {
  1247. for (var a = c.RenderFilter.getInstance().getDrawAreaList(), b = 0, d = a.length; b < d; b++) {
  1248. var h = a[b];
  1249. this.clearRect(h.x, h.y, h.width, h.height)
  1250. }
  1251. a = c.MainContext.instance.stage;
  1252. this._cacheCanvasContext.clearRect(0,
  1253. 0, a.stageWidth, a.stageHeight);
  1254. this.renderCost = 0
  1255. };
  1256. a.prototype.clearRect = function(a, b, c, d) {
  1257. this.canvasContext.clearRect(a, b, c * window.devicePixelRatio, d * window.devicePixelRatio)
  1258. };
  1259. a.prototype.drawImage = function(a, d, q, h, g, f, k, m, n, p) {
  1260. void 0 === p && (p = void 0);
  1261. var r = c.MainContext.instance.rendererContext.texture_scale_factor;
  1262. d /= r;
  1263. q /= r;
  1264. h /= r;
  1265. g /= r;
  1266. r = a._bitmapData;
  1267. f += this._transformTx;
  1268. k += this._transformTy;
  1269. var s = c.getTimer();
  1270. void 0 === p ? this._cacheCanvasContext.drawImage(r, d, q, h, g, f, k, m, n) : this.drawRepeatImage(a,
  1271. d, q, h, g, f, k, m, n, p);
  1272. b.prototype.drawImage.call(this, a, d, q, h, g, f, k, m, n, p);
  1273. this.renderCost += c.getTimer() - s
  1274. };
  1275. a.prototype.drawRepeatImage = function(a, b, c, d, g, f, k, m, n, p) {
  1276. if (void 0 === a.pattern) {
  1277. var r = a._bitmapData,
  1278. s = r;
  1279. if (r.width != d || r.height != g) s = document.createElement("canvas"), s.width = d, s.height = g, s.getContext("2d").drawImage(r, b, c, d, g, 0, 0, d, g);
  1280. b = this._cacheCanvasContext.createPattern(s, p);
  1281. a.pattern = b
  1282. }
  1283. this._cacheCanvasContext.fillStyle = a.pattern;
  1284. this._cacheCanvasContext.translate(f, k);
  1285. this._cacheCanvasContext.fillRect(0,
  1286. 0, m, n);
  1287. this._cacheCanvasContext.translate(-f, -k)
  1288. };
  1289. a.prototype.setTransform = function(a) {
  1290. 1 == a.a && 0 == a.b && 0 == a.c && 1 == a.d && 1 == this._matrixA && 0 == this._matrixB && 0 == this._matrixC && 1 == this._matrixD ? (this._transformTx = a.tx - this._matrixTx, this._transformTy = a.ty - this._matrixTy) : (this._transformTx = this._transformTy = 0, this._matrixA == a.a && this._matrixB == a.b && this._matrixC == a.c && this._matrixD == a.d && this._matrixTx == a.tx && this._matrixTy == a.ty || this._cacheCanvasContext.setTransform(a.a, a.b, a.c, a.d, a.tx, a.ty))
  1291. };
  1292. a.prototype.setAlpha =
  1293. function(a, b) {
  1294. a != this.globalAlpha && (this._cacheCanvasContext.globalAlpha = this.globalAlpha = a);
  1295. b ? (this.blendValue = this.blendModes[b], this._cacheCanvasContext.globalCompositeOperation = this.blendValue) : this.blendValue != c.BlendMode.NORMAL && (this.blendValue = this.blendModes[c.BlendMode.NORMAL], this._cacheCanvasContext.globalCompositeOperation = this.blendValue)
  1296. };
  1297. a.prototype.initBlendMode = function() {
  1298. this.blendModes = {};
  1299. this.blendModes[c.BlendMode.NORMAL] = "source-over";
  1300. this.blendModes[c.BlendMode.ADD] = "lighter"
  1301. };
  1302. a.prototype.setupFont = function(a, b) {
  1303. void 0 === b && (b = null);
  1304. b = b || {};
  1305. var c = null == b.size ? a._size : b.size,
  1306. d = null == b.fontFamily ? a._fontFamily : b.fontFamily,
  1307. g = this._cacheCanvasContext,
  1308. f = (null == b.italic ? a._italic : b.italic) ? "italic " : "normal ",
  1309. f = f + ((null == b.bold ? a._bold : b.bold) ? "bold " : "normal ");
  1310. g.font = f + (c + "px " + d);
  1311. g.textAlign = "left";
  1312. g.textBaseline = "middle"
  1313. };
  1314. a.prototype.measureText = function(a) {
  1315. return this._cacheCanvasContext.measureText(a).width
  1316. };
  1317. a.prototype.drawText = function(a, d, q, h, g, f) {
  1318. void 0 === f && (f = null);
  1319. this.setupFont(a, f);
  1320. f = f || {};
  1321. var k;
  1322. k = null != f.textColor ? c.toColorString(f.textColor) : a._textColorString;
  1323. var m;
  1324. m = null != f.strokeColor ? c.toColorString(f.strokeColor) : a._strokeColorString;
  1325. var n;
  1326. n = null != f.stroke ? f.stroke : a._stroke;
  1327. var p = this._cacheCanvasContext;
  1328. p.fillStyle = k;
  1329. p.strokeStyle = m;
  1330. n && (p.lineWidth = 2 * n, p.strokeText(d, q + this._transformTx, h + this._transformTy, g || 65535));
  1331. p.fillText(d, q + this._transformTx, h + this._transformTy, g || 65535);
  1332. b.prototype.drawText.call(this, a, d, q, h, g, f)
  1333. };
  1334. a.prototype.strokeRect =
  1335. function(a, b, c, d, g) {
  1336. this._cacheCanvasContext.strokeStyle = g;
  1337. this._cacheCanvasContext.strokeRect(a, b, c, d)
  1338. };
  1339. a.prototype.pushMask = function(a) {
  1340. this._cacheCanvasContext.save();
  1341. this._cacheCanvasContext.beginPath();
  1342. this._cacheCanvasContext.rect(a.x + this._transformTx, a.y + this._transformTy, a.width, a.height);
  1343. this._cacheCanvasContext.clip();
  1344. this._cacheCanvasContext.closePath()
  1345. };
  1346. a.prototype.popMask = function() {
  1347. this._cacheCanvasContext.restore();
  1348. this._cacheCanvasContext.setTransform(1, 0, 0, 1, 0, 0)
  1349. };
  1350. a.prototype.onRenderStart =
  1351. function() {
  1352. this._cacheCanvasContext.save()
  1353. };
  1354. a.prototype.onRenderFinish = function() {
  1355. this._cacheCanvasContext.restore();
  1356. this._cacheCanvasContext.setTransform(1, 0, 0, 1, 0, 0);
  1357. for (var a = c.RenderFilter.getInstance().getDrawAreaList(), b = 0, d = a.length; b < d; b++) {
  1358. var h = a[b];
  1359. this.canvasContext.drawImage(this._cacheCanvas, h.x, h.y, h.width, h.height, h.x, h.y, h.width, h.height)
  1360. }
  1361. };
  1362. return a
  1363. }(c.RendererContext);
  1364. c.HTML5CanvasRenderer = d;
  1365. d.prototype.__class__ = "egret.HTML5CanvasRenderer"
  1366. })(egret || (egret = {}));
  1367. var egret_h5_graphics;
  1368. (function(c) {
  1369. c.beginFill = function(b, a) {
  1370. void 0 === a && (a = 1);
  1371. var c = "rgba(" + (b >> 16) + "," + ((b & 65280) >> 8) + "," + (b & 255) + "," + a + ")";
  1372. this.fillStyleColor = c;
  1373. this.commandQueue.push(new d(this._setStyle, this, [c]))
  1374. };
  1375. c.drawRect = function(b, a, c, l) {
  1376. this.commandQueue.push(new d(function(a, b, c, d) {
  1377. var e = this.renderContext;
  1378. this.canvasContext.beginPath();
  1379. this.canvasContext.rect(e._transformTx + a, e._transformTy + b, c, d);
  1380. this.canvasContext.closePath()
  1381. }, this, [b, a, c, l]));
  1382. this._fill()
  1383. };
  1384. c.drawCircle = function(b, a, c) {
  1385. this.commandQueue.push(new d(function(a,
  1386. b, c) {
  1387. var d = this.renderContext;
  1388. this.canvasContext.beginPath();
  1389. this.canvasContext.arc(d._transformTx + a, d._transformTy + b, c, 0, 2 * Math.PI);
  1390. this.canvasContext.closePath()
  1391. }, this, [b, a, c]));
  1392. this._fill()
  1393. };
  1394. c.drawRoundRect = function(b, a, c, l, q, h) {
  1395. this.commandQueue.push(new d(function(a, b, c, d, e, l) {
  1396. var h = this.renderContext;
  1397. a = h._transformTx + a;
  1398. b = h._transformTy + b;
  1399. e /= 2;
  1400. l = l ? l / 2 : e;
  1401. c = a + c;
  1402. d = b + d;
  1403. h = d - l;
  1404. this.canvasContext.beginPath();
  1405. this.canvasContext.moveTo(c, h);
  1406. this.canvasContext.quadraticCurveTo(c, d, c - e, d);
  1407. this.canvasContext.lineTo(a +
  1408. e, d);
  1409. this.canvasContext.quadraticCurveTo(a, d, a, d - l);
  1410. this.canvasContext.lineTo(a, b + l);
  1411. this.canvasContext.quadraticCurveTo(a, b, a + e, b);
  1412. this.canvasContext.lineTo(c - e, b);
  1413. this.canvasContext.quadraticCurveTo(c, b, c, b + l);
  1414. this.canvasContext.lineTo(c, h);
  1415. this.canvasContext.closePath()
  1416. }, this, [b, a, c, l, q, h]));
  1417. this._fill()
  1418. };
  1419. c.drawEllipse = function(b, a, c, l) {
  1420. this.commandQueue.push(new d(function(a, b, c, d) {
  1421. var e = this.renderContext;
  1422. this.canvasContext.save();
  1423. a = e._transformTx + a;
  1424. b = e._transformTy + b;
  1425. var e = c > d ? c : d,
  1426. l = c / e;
  1427. d /=
  1428. e;
  1429. this.canvasContext.scale(l, d);
  1430. this.canvasContext.beginPath();
  1431. this.canvasContext.moveTo((a + c) / l, b / d);
  1432. this.canvasContext.arc(a / l, b / d, e, 0, 2 * Math.PI);
  1433. this.canvasContext.closePath();
  1434. this.canvasContext.restore();
  1435. this.canvasContext.stroke()
  1436. }, this, [b, a, c, l]));
  1437. this._fill()
  1438. };
  1439. c.lineStyle = function(b, a, c, l, q, h, g, f) {
  1440. void 0 === b && (b = NaN);
  1441. void 0 === a && (a = 0);
  1442. void 0 === c && (c = 1);
  1443. void 0 === l && (l = !1);
  1444. void 0 === q && (q = "normal");
  1445. void 0 === h && (h = null);
  1446. void 0 === g && (g = null);
  1447. void 0 === f && (f = 3);
  1448. this.strokeStyleColor && (this.createEndLineCommand(),
  1449. this.commandQueue.push(this.endLineCommand));
  1450. this.strokeStyleColor = a = "rgba(" + (a >> 16) + "," + ((a & 65280) >> 8) + "," + (a & 255) + "," + c + ")";
  1451. this.commandQueue.push(new d(function(a, b) {
  1452. this.canvasContext.lineWidth = a;
  1453. this.canvasContext.strokeStyle = b;
  1454. this.canvasContext.beginPath()
  1455. }, this, [b, a]));
  1456. "undefined" === typeof this.lineX && (this.lineY = this.lineX = 0);
  1457. this.moveTo(this.lineX, this.lineY)
  1458. };
  1459. c.lineTo = function(b, a) {
  1460. this.commandQueue.push(new d(function(a, b) {
  1461. var c = this.renderContext;
  1462. this.canvasContext.lineTo(c._transformTx +
  1463. a, c._transformTy + b)
  1464. }, this, [b, a]));
  1465. this.lineX = b;
  1466. this.lineY = a
  1467. };
  1468. c.curveTo = function(b, a, c, l) {
  1469. this.commandQueue.push(new d(function(a, b, c, d) {
  1470. var e = this.renderContext;
  1471. this.canvasContext.quadraticCurveTo(e._transformTx + a, e._transformTy + b, e._transformTx + c, e._transformTy + d)
  1472. }, this, [b, a, c, l]));
  1473. this.lineX = c;
  1474. this.lineY = l
  1475. };
  1476. c.moveTo = function(b, a) {
  1477. this.commandQueue.push(new d(function(a, b) {
  1478. var c = this.renderContext;
  1479. this.canvasContext.moveTo(c._transformTx + a, c._transformTy + b)
  1480. }, this, [b, a]))
  1481. };
  1482. c.clear = function() {
  1483. this.lineY =
  1484. this.lineX = this.commandQueue.length = 0;
  1485. this.fillStyleColor = this.strokeStyleColor = null
  1486. };
  1487. c.createEndFillCommand = function() {
  1488. this.endFillCommand || (this.endFillCommand = new d(function() {
  1489. this.canvasContext.fill();
  1490. this.canvasContext.closePath()
  1491. }, this, null))
  1492. };
  1493. c.endFill = function() {
  1494. null != this.fillStyleColor && this._fill();
  1495. this.fillStyleColor = null
  1496. };
  1497. c._fill = function() {
  1498. this.fillStyleColor && (this.createEndFillCommand(), this.commandQueue.push(this.endFillCommand))
  1499. };
  1500. c.createEndLineCommand = function() {
  1501. this.endLineCommand ||
  1502. (this.endLineCommand = new d(function() {
  1503. this.canvasContext.stroke();
  1504. this.canvasContext.closePath()
  1505. }, this, null))
  1506. };
  1507. c._draw = function(b) {
  1508. var a = this.commandQueue.length;
  1509. if (0 != a) {
  1510. this.renderContext = b;
  1511. b = this.canvasContext = this.renderContext._cacheCanvasContext || this.renderContext.canvasContext;
  1512. b.save();
  1513. this.strokeStyleColor && 0 < a && this.commandQueue[a - 1] != this.endLineCommand && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand), a = this.commandQueue.length);
  1514. for (var c = 0; c < a; c++) {
  1515. var d = this.commandQueue[c];
  1516. d.method.apply(d.thisObject, d.args)
  1517. }
  1518. b.restore()
  1519. }
  1520. };
  1521. var d = function() {
  1522. return function(b, a, c) {
  1523. this.method = b;
  1524. this.thisObject = a;
  1525. this.args = c
  1526. }
  1527. }();
  1528. d.prototype.__class__ = "egret_h5_graphics.Command";
  1529. c._setStyle = function(b) {
  1530. this.canvasContext.fillStyle = b;
  1531. this.canvasContext.beginPath()
  1532. };
  1533. c.init = function() {
  1534. for (var b in c) egret.Graphics.prototype[b] = c[b];
  1535. egret.RendererContext.createRendererContext = function(a) {
  1536. return new egret.HTML5CanvasRenderer(a)
  1537. }
  1538. }
  1539. })(egret_h5_graphics || (egret_h5_graphics = {}));
  1540. egret_h5_graphics.init();
  1541. __extends = this.__extends || function(c, d) {
  1542. function b() {
  1543. this.constructor = c
  1544. }
  1545. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  1546. b.prototype = d.prototype;
  1547. c.prototype = new b
  1548. };
  1549. (function(c) {
  1550. var d = function(b) {
  1551. function a(a) {
  1552. b.call(this);
  1553. this.size = 2E3;
  1554. this.vertSize = 5;
  1555. this.contextLost = !1;
  1556. this.glContextId = 0;
  1557. this.currentBlendMode = "";
  1558. this.currentBaseTexture = null;
  1559. this.currentBatchSize = 0;
  1560. this.maskList = [];
  1561. this.maskDataFreeList = [];
  1562. this.canvasContext = document.createElement("canvas").getContext("2d");
  1563. console.log("使用WebGL模式");
  1564. this.canvas = a || this.createCanvas();
  1565. this.canvas.addEventListener("webglcontextlost", this.handleContextLost.bind(this), !1);
  1566. this.canvas.addEventListener("webglcontextrestored",
  1567. this.handleContextRestored.bind(this), !1);
  1568. this.onResize();
  1569. this.projectionX = this.canvas.width / 2;
  1570. this.projectionY = -this.canvas.height / 2;
  1571. a = 6 * this.size;
  1572. this.vertices = new Float32Array(4 * this.size * this.vertSize);
  1573. this.indices = new Uint16Array(a);
  1574. for (var d = 0, q = 0; d < a; d += 6, q += 4) this.indices[d + 0] = q + 0, this.indices[d + 1] = q + 1, this.indices[d + 2] = q + 2, this.indices[d + 3] = q + 0, this.indices[d + 4] = q + 2, this.indices[d + 5] = q + 3;
  1575. this.initWebGL();
  1576. this.shaderManager = new c.WebGLShaderManager(this.gl);
  1577. this.worldTransform = new c.Matrix;
  1578. this.initBlendMode();
  1579. c.MainContext.instance.addEventListener(c.Event.FINISH_RENDER, this._draw, this);
  1580. c.TextField.prototype._draw = function(a) {
  1581. this.getDirty() && (this.cacheAsBitmap = !0);
  1582. c.DisplayObject.prototype._draw.call(this, a)
  1583. }
  1584. }
  1585. __extends(a, b);
  1586. a.prototype.createCanvas = function() {
  1587. var a = c.Browser.getInstance().$("#egretCanvas");
  1588. if (!a) {
  1589. var b = document.getElementById(c.StageDelegate.canvas_div_name),
  1590. a = c.Browser.getInstance().$new("canvas");
  1591. a.id = "egretCanvas";
  1592. b.appendChild(a)
  1593. }
  1594. c.MainContext.instance.stage.addEventListener(c.Event.RESIZE,
  1595. this.onResize, this);
  1596. return a
  1597. };
  1598. a.prototype.onResize = function() {
  1599. if (this.canvas) {
  1600. var a = document.getElementById(c.StageDelegate.canvas_div_name);
  1601. this.canvas.width = c.MainContext.instance.stage.stageWidth;
  1602. this.canvas.height = c.MainContext.instance.stage.stageHeight;
  1603. this.canvas.style.width = a.style.width;
  1604. this.canvas.style.height = a.style.height;
  1605. this.projectionX = this.canvas.width / 2;
  1606. this.projectionY = -this.canvas.height / 2
  1607. }
  1608. };
  1609. a.prototype.handleContextLost = function() {
  1610. this.contextLost = !0
  1611. };
  1612. a.prototype.handleContextRestored =
  1613. function() {
  1614. this.initWebGL();
  1615. this.shaderManager.setContext(this.gl);
  1616. this.contextLost = !1
  1617. };
  1618. a.prototype.initWebGL = function() {
  1619. for (var a = {
  1620. stencil: !0
  1621. }, b, c = ["experimental-webgl", "webgl"], d = 0; d < c.length; d++) {
  1622. try {
  1623. b = this.canvas.getContext(c[d], a)
  1624. } catch (g) {}
  1625. if (b) break
  1626. }
  1627. if (!b) throw Error("当前浏览器不支持webgl");
  1628. this.setContext(b)
  1629. };
  1630. a.prototype.setContext = function(a) {
  1631. this.gl = a;
  1632. a.id = this.glContextId++;
  1633. this.vertexBuffer = a.createBuffer();
  1634. this.indexBuffer = a.createBuffer();
  1635. a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
  1636. this.indexBuffer);
  1637. a.bufferData(a.ELEMENT_ARRAY_BUFFER, this.indices, a.STATIC_DRAW);
  1638. a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
  1639. a.bufferData(a.ARRAY_BUFFER, this.vertices, a.DYNAMIC_DRAW);
  1640. a.disable(a.DEPTH_TEST);
  1641. a.disable(a.CULL_FACE);
  1642. a.enable(a.BLEND);
  1643. a.colorMask(!0, !0, !0, !0)
  1644. };
  1645. a.prototype.initBlendMode = function() {
  1646. this.blendModesWebGL = {};
  1647. this.blendModesWebGL[c.BlendMode.NORMAL] = [this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA];
  1648. this.blendModesWebGL[c.BlendMode.ADD] = [this.gl.SRC_ALPHA, this.gl.ONE]
  1649. };
  1650. a.prototype.start =
  1651. function() {
  1652. if (!this.contextLost) {
  1653. var a = this.gl;
  1654. a.activeTexture(a.TEXTURE0);
  1655. a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
  1656. a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  1657. var b;
  1658. b = this.colorTransformMatrix ? this.shaderManager.colorTransformShader : this.shaderManager.defaultShader;
  1659. this.shaderManager.activateShader(b);
  1660. b.syncUniforms();
  1661. a.uniform2f(b.projectionVector, this.projectionX, this.projectionY);
  1662. var c = 4 * this.vertSize;
  1663. a.vertexAttribPointer(b.aVertexPosition, 2, a.FLOAT, !1, c, 0);
  1664. a.vertexAttribPointer(b.aTextureCoord,
  1665. 2, a.FLOAT, !1, c, 8);
  1666. a.vertexAttribPointer(b.colorAttribute, 2, a.FLOAT, !1, c, 16)
  1667. }
  1668. };
  1669. a.prototype.clearScreen = function() {
  1670. var a = this.gl;
  1671. a.colorMask(!0, !0, !0, !0);
  1672. for (var b = c.RenderFilter.getInstance().getDrawAreaList(), d = 0, h = b.length; d < h; d++) {
  1673. var g = b[d];
  1674. a.viewport(g.x, g.y, g.width, g.height);
  1675. a.bindFramebuffer(a.FRAMEBUFFER, null);
  1676. a.clearColor(0, 0, 0, 0);
  1677. a.clear(a.COLOR_BUFFER_BIT)
  1678. }
  1679. b = c.MainContext.instance.stage;
  1680. a.viewport(0, 0, b.stageWidth, b.stageHeight);
  1681. this.renderCost = 0
  1682. };
  1683. a.prototype.setBlendMode = function(a) {
  1684. a ||
  1685. (a = c.BlendMode.NORMAL);
  1686. if (this.currentBlendMode != a) {
  1687. var b = this.blendModesWebGL[a];
  1688. b && (this._draw(), this.gl.blendFunc(b[0], b[1]), this.currentBlendMode = a)
  1689. }
  1690. };
  1691. a.prototype.drawRepeatImage = function(a, b, c, d, g, f, k, m, n, p) {
  1692. for (; f < m; f += d)
  1693. for (p = k; p < n; p += g) {
  1694. var r = Math.min(d, m - f),
  1695. s = Math.min(g, n - p);
  1696. this.drawImage(a, b, c, r, s, f, p, r, s)
  1697. }
  1698. };
  1699. a.prototype.drawImage = function(a, b, d, h, g, f, k, m, n, p) {
  1700. void 0 === p && (p = void 0);
  1701. if (!this.contextLost)
  1702. if (void 0 !== p) this.drawRepeatImage(a, b, d, h, g, f, k, m, n, p);
  1703. else {
  1704. p = c.MainContext.instance.rendererContext.texture_scale_factor;
  1705. b /= p;
  1706. d /= p;
  1707. h /= p;
  1708. g /= p;
  1709. this.createWebGLTexture(a);
  1710. if (a.webGLTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size - 1) this._draw(), this.currentBaseTexture = a.webGLTexture;
  1711. var r = this.worldTransform,
  1712. s = r.a,
  1713. t = r.b,
  1714. u = r.c,
  1715. v = r.d,
  1716. x = r.tx,
  1717. y = r.ty;
  1718. 0 == f && 0 == k || r.append(1, 0, 0, 1, f, k);
  1719. 1 == h / m && 1 == g / n || r.append(m / h, 0, 0, n / g, 0, 0);
  1720. f = r.a;
  1721. k = r.b;
  1722. m = r.c;
  1723. n = r.d;
  1724. p = r.tx;
  1725. var w = r.ty;
  1726. r.a = s;
  1727. r.b = t;
  1728. r.c = u;
  1729. r.d = v;
  1730. r.tx = x;
  1731. r.ty = y;
  1732. s = a._sourceWidth;
  1733. t = a._sourceHeight;
  1734. a = h;
  1735. r = g;
  1736. b /= s;
  1737. d /= t;
  1738. h /= s;
  1739. g /= t;
  1740. s = this.vertices;
  1741. t = 4 * this.currentBatchSize *
  1742. this.vertSize;
  1743. u = this.worldAlpha;
  1744. s[t++] = p;
  1745. s[t++] = w;
  1746. s[t++] = b;
  1747. s[t++] = d;
  1748. s[t++] = u;
  1749. s[t++] = f * a + p;
  1750. s[t++] = k * a + w;
  1751. s[t++] = h + b;
  1752. s[t++] = d;
  1753. s[t++] = u;
  1754. s[t++] = f * a + m * r + p;
  1755. s[t++] = n * r + k * a + w;
  1756. s[t++] = h + b;
  1757. s[t++] = g + d;
  1758. s[t++] = u;
  1759. s[t++] = m * r + p;
  1760. s[t++] = n * r + w;
  1761. s[t++] = b;
  1762. s[t++] = g + d;
  1763. s[t++] = u;
  1764. this.currentBatchSize++
  1765. }
  1766. };
  1767. a.prototype._draw = function() {
  1768. if (0 != this.currentBatchSize && !this.contextLost) {
  1769. var a = c.getTimer();
  1770. this.start();
  1771. var b = this.gl;
  1772. b.bindTexture(b.TEXTURE_2D, this.currentBaseTexture);
  1773. var d = this.vertices.subarray(0, 4 * this.currentBatchSize *
  1774. this.vertSize);
  1775. b.bufferSubData(b.ARRAY_BUFFER, 0, d);
  1776. b.drawElements(b.TRIANGLES, 6 * this.currentBatchSize, b.UNSIGNED_SHORT, 0);
  1777. this.currentBatchSize = 0;
  1778. this.renderCost += c.getTimer() - a;
  1779. c.Profiler.getInstance().onDrawImage()
  1780. }
  1781. };
  1782. a.prototype.setTransform = function(a) {
  1783. var b = this.worldTransform;
  1784. b.a = a.a;
  1785. b.b = a.b;
  1786. b.c = a.c;
  1787. b.d = a.d;
  1788. b.tx = a.tx;
  1789. b.ty = a.ty
  1790. };
  1791. a.prototype.setAlpha = function(a, b) {
  1792. this.worldAlpha = a;
  1793. this.setBlendMode(b)
  1794. };
  1795. a.prototype.createWebGLTexture = function(a) {
  1796. if (!a.webGLTexture) {
  1797. var b = this.gl;
  1798. a.webGLTexture =
  1799. b.createTexture();
  1800. b.bindTexture(b.TEXTURE_2D, a.webGLTexture);
  1801. b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
  1802. b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, b.RGBA, b.UNSIGNED_BYTE, a._bitmapData);
  1803. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.LINEAR);
  1804. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR);
  1805. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE);
  1806. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE);
  1807. b.bindTexture(b.TEXTURE_2D, null)
  1808. }
  1809. };
  1810. a.prototype.pushMask = function(a) {
  1811. this._draw();
  1812. var b = this.gl;
  1813. 0 == this.maskList.length && (b.enable(b.STENCIL_TEST), b.stencilFunc(b.ALWAYS, 1, 1));
  1814. var c = this.maskDataFreeList.pop();
  1815. c ? (c.x = a.x, c.y = a.y, c.w = a.width, c.h = a.height) : c = {
  1816. x: a.x,
  1817. y: a.y,
  1818. w: a.width,
  1819. h: a.height
  1820. };
  1821. this.maskList.push(c);
  1822. b.colorMask(!1, !1, !1, !1);
  1823. b.stencilOp(b.KEEP, b.KEEP, b.INCR);
  1824. this.renderGraphics(c);
  1825. b.colorMask(!0, !0, !0, !0);
  1826. b.stencilFunc(b.NOTEQUAL, 0, this.maskList.length);
  1827. b.stencilOp(b.KEEP, b.KEEP, b.KEEP)
  1828. };
  1829. a.prototype.popMask = function() {
  1830. this._draw();
  1831. var a = this.gl,
  1832. b = this.maskList.pop();
  1833. b && (a.colorMask(!1, !1, !1, !1), a.stencilOp(a.KEEP, a.KEEP, a.DECR), this.renderGraphics(b), a.colorMask(!0, !0, !0, !0), a.stencilFunc(a.NOTEQUAL, 0, this.maskList.length), a.stencilOp(a.KEEP, a.KEEP, a.KEEP), this.maskDataFreeList.push(b));
  1834. 0 == this.maskList.length && a.disable(a.STENCIL_TEST)
  1835. };
  1836. a.prototype.setGlobalColorTransform = function(a) {
  1837. if (this.colorTransformMatrix != a && (this._draw(), this.colorTransformMatrix = a)) {
  1838. a = a.concat();
  1839. var b = this.shaderManager.colorTransformShader;
  1840. b.uniforms.colorAdd.value.w = a.splice(19,
  1841. 1)[0] / 255;
  1842. b.uniforms.colorAdd.value.z = a.splice(14, 1)[0] / 255;
  1843. b.uniforms.colorAdd.value.y = a.splice(9, 1)[0] / 255;
  1844. b.uniforms.colorAdd.value.x = a.splice(4, 1)[0] / 255;
  1845. b.uniforms.matrix.value = a
  1846. }
  1847. };
  1848. a.prototype.setupFont = function(a, b) {
  1849. var c = this.canvasContext,
  1850. d = a.italic ? "italic " : "normal ",
  1851. d = d + (a.bold ? "bold " : "normal "),
  1852. d = d + (a.size + "px " + a.fontFamily);
  1853. c.font = d;
  1854. c.textAlign = "left";
  1855. c.textBaseline = "middle"
  1856. };
  1857. a.prototype.measureText = function(a) {
  1858. return this.canvasContext.measureText(a).width
  1859. };
  1860. a.prototype.renderGraphics =
  1861. function(a) {
  1862. var b = this.gl,
  1863. c = this.shaderManager.primitiveShader;
  1864. this.graphicsPoints ? (this.graphicsPoints.length = 0, this.graphicsIndices.length = 0) : (this.graphicsPoints = [], this.graphicsIndices = [], this.graphicsBuffer = b.createBuffer(), this.graphicsIndexBuffer = b.createBuffer());
  1865. this.updateGraphics(a);
  1866. this.shaderManager.activateShader(c);
  1867. b.blendFunc(b.ONE, b.ONE_MINUS_SRC_ALPHA);
  1868. b.uniformMatrix3fv(c.translationMatrix, !1, this.worldTransform.toArray(!0));
  1869. b.uniform2f(c.projectionVector, this.projectionX, -this.projectionY);
  1870. b.uniform2f(c.offsetVector, 0, 0);
  1871. b.uniform3fv(c.tintColor, [1, 1, 1]);
  1872. b.uniform1f(c.alpha, this.worldAlpha);
  1873. b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
  1874. b.vertexAttribPointer(c.aVertexPosition, 2, b.FLOAT, !1, 24, 0);
  1875. b.vertexAttribPointer(c.colorAttribute, 4, b.FLOAT, !1, 24, 8);
  1876. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
  1877. b.drawElements(b.TRIANGLE_STRIP, this.graphicsIndices.length, b.UNSIGNED_SHORT, 0);
  1878. this.shaderManager.activateShader(this.shaderManager.defaultShader)
  1879. };
  1880. a.prototype.updateGraphics =
  1881. function(a) {
  1882. var b = this.gl;
  1883. this.buildRectangle(a);
  1884. b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
  1885. b.bufferData(b.ARRAY_BUFFER, new Float32Array(this.graphicsPoints), b.STATIC_DRAW);
  1886. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
  1887. b.bufferData(b.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.graphicsIndices), b.STATIC_DRAW)
  1888. };
  1889. a.prototype.buildRectangle = function(a) {
  1890. var b = a.x,
  1891. c = a.y,
  1892. d = a.w;
  1893. a = a.h;
  1894. var g = this.graphicsPoints,
  1895. f = this.graphicsIndices,
  1896. k = g.length / 6;
  1897. g.push(b, c);
  1898. g.push(0, 0, 0, 1);
  1899. g.push(b + d, c);
  1900. g.push(0, 0, 0, 1);
  1901. g.push(b, c + a);
  1902. g.push(0, 0, 0, 1);
  1903. g.push(b + d, c + a);
  1904. g.push(0, 0, 0, 1);
  1905. f.push(k, k, k + 1, k + 2, k + 3, k + 3)
  1906. };
  1907. return a
  1908. }(c.RendererContext);
  1909. c.WebGLRenderer = d;
  1910. d.prototype.__class__ = "egret.WebGLRenderer"
  1911. })(egret || (egret = {}));
  1912. (function(c) {
  1913. var d = function() {
  1914. function b() {}
  1915. b.compileProgram = function(a, c, d) {
  1916. d = b.compileFragmentShader(a, d);
  1917. c = b.compileVertexShader(a, c);
  1918. var q = a.createProgram();
  1919. a.attachShader(q, c);
  1920. a.attachShader(q, d);
  1921. a.linkProgram(q);
  1922. a.getProgramParameter(q, a.LINK_STATUS) || console.log("无法初始化着色器");
  1923. return q
  1924. };
  1925. b.compileFragmentShader = function(a, c) {
  1926. return b._compileShader(a, c, a.FRAGMENT_SHADER)
  1927. };
  1928. b.compileVertexShader = function(a, c) {
  1929. return b._compileShader(a, c, a.VERTEX_SHADER)
  1930. };
  1931. b._compileShader =
  1932. function(a, b, c) {
  1933. c = a.createShader(c);
  1934. a.shaderSource(c, b);
  1935. a.compileShader(c);
  1936. return a.getShaderParameter(c, a.COMPILE_STATUS) ? c : (console.log(a.getShaderInfoLog(c)), null)
  1937. };
  1938. b.checkCanUseWebGL = function() {
  1939. if (void 0 == b.canUseWebGL) try {
  1940. var a = document.createElement("canvas");
  1941. b.canUseWebGL = !!window.WebGLRenderingContext && !(!a.getContext("webgl") && !a.getContext("experimental-webgl"))
  1942. } catch (c) {
  1943. b.canUseWebGL = !1
  1944. }
  1945. return b.canUseWebGL
  1946. };
  1947. return b
  1948. }();
  1949. c.WebGLUtils = d;
  1950. d.prototype.__class__ = "egret.WebGLUtils"
  1951. })(egret || (egret = {}));
  1952. __extends = this.__extends || function(c, d) {
  1953. function b() {
  1954. this.constructor = c
  1955. }
  1956. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  1957. b.prototype = d.prototype;
  1958. c.prototype = new b
  1959. };
  1960. (function(c) {
  1961. var d = function() {
  1962. function c(a) {
  1963. this.maxAttibs = 10;
  1964. this.attribState = [];
  1965. this.tempAttribState = [];
  1966. for (var b = 0; b < this.maxAttibs; b++) this.attribState[b] = !1;
  1967. this.setContext(a)
  1968. }
  1969. c.prototype.setContext = function(c) {
  1970. this.gl = c;
  1971. this.primitiveShader = new e(c);
  1972. this.defaultShader = new b(c);
  1973. this.colorTransformShader = new a(c);
  1974. this.activateShader(this.defaultShader)
  1975. };
  1976. c.prototype.activateShader = function(a) {
  1977. this.currentShader != a && (this.gl.useProgram(a.program), this.setAttribs(a.attributes), this.currentShader =
  1978. a)
  1979. };
  1980. c.prototype.setAttribs = function(a) {
  1981. var b, c;
  1982. c = this.tempAttribState.length;
  1983. for (b = 0; b < c; b++) this.tempAttribState[b] = !1;
  1984. c = a.length;
  1985. for (b = 0; b < c; b++) this.tempAttribState[a[b]] = !0;
  1986. a = this.gl;
  1987. c = this.attribState.length;
  1988. for (b = 0; b < c; b++) this.attribState[b] !== this.tempAttribState[b] && (this.attribState[b] = this.tempAttribState[b], this.tempAttribState[b] ? a.enableVertexAttribArray(b) : a.disableVertexAttribArray(b))
  1989. };
  1990. return c
  1991. }();
  1992. c.WebGLShaderManager = d;
  1993. d.prototype.__class__ = "egret.WebGLShaderManager";
  1994. var b = function() {
  1995. function a(b) {
  1996. this.defaultVertexSrc =
  1997. "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aColor;\nuniform vec2 projectionVector;\nuniform vec2 offsetVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}";
  1998. this.program = null;
  1999. this.fragmentSrc = "precision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\ngl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;\n}";
  2000. this.gl = b;
  2001. this.init()
  2002. }
  2003. a.prototype.init = function() {
  2004. var a = this.gl,
  2005. b = c.WebGLUtils.compileProgram(a, this.defaultVertexSrc, this.fragmentSrc);
  2006. a.useProgram(b);
  2007. this.uSampler = a.getUniformLocation(b, "uSampler");
  2008. this.projectionVector = a.getUniformLocation(b, "projectionVector");
  2009. this.offsetVector = a.getUniformLocation(b, "offsetVector");
  2010. this.dimensions = a.getUniformLocation(b, "dimensions");
  2011. this.aVertexPosition = a.getAttribLocation(b, "aVertexPosition");
  2012. this.aTextureCoord = a.getAttribLocation(b, "aTextureCoord");
  2013. this.colorAttribute =
  2014. a.getAttribLocation(b, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
  2015. this.attributes = [this.aVertexPosition, this.aTextureCoord, this.colorAttribute];
  2016. for (var d in this.uniforms) this.uniforms[d].uniformLocation = a.getUniformLocation(b, d);
  2017. this.initUniforms();
  2018. this.program = b
  2019. };
  2020. a.prototype.initUniforms = function() {
  2021. if (this.uniforms) {
  2022. var a = this.gl,
  2023. b, c;
  2024. for (c in this.uniforms) {
  2025. b = this.uniforms[c];
  2026. var d = b.type;
  2027. "mat2" === d || "mat3" === d || "mat4" === d ? (b.glMatrix = !0, b.glValueLength = 1, "mat2" === d ? b.glFunc = a.uniformMatrix2fv :
  2028. "mat3" === d ? b.glFunc = a.uniformMatrix3fv : "mat4" === d && (b.glFunc = a.uniformMatrix4fv)) : (b.glFunc = a["uniform" + d], b.glValueLength = "2f" === d || "2i" === d ? 2 : "3f" === d || "3i" === d ? 3 : "4f" === d || "4i" === d ? 4 : 1)
  2029. }
  2030. }
  2031. };
  2032. a.prototype.syncUniforms = function() {
  2033. if (this.uniforms) {
  2034. var a, b = this.gl,
  2035. c;
  2036. for (c in this.uniforms) a = this.uniforms[c], 1 === a.glValueLength ? !0 === a.glMatrix ? a.glFunc.call(b, a.uniformLocation, a.transpose, a.value) : a.glFunc.call(b, a.uniformLocation, a.value) : 2 === a.glValueLength ? a.glFunc.call(b, a.uniformLocation, a.value.x,
  2037. a.value.y) : 3 === a.glValueLength ? a.glFunc.call(b, a.uniformLocation, a.value.x, a.value.y, a.value.z) : 4 === a.glValueLength && a.glFunc.call(b, a.uniformLocation, a.value.x, a.value.y, a.value.z, a.value.w)
  2038. }
  2039. };
  2040. return a
  2041. }();
  2042. c.EgretShader = b;
  2043. b.prototype.__class__ = "egret.EgretShader";
  2044. var a = function(a) {
  2045. function b(c) {
  2046. a.call(this, c);
  2047. this.fragmentSrc = "precision mediump float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform float invert;\nuniform mat4 matrix;\nuniform vec4 colorAdd;\nuniform sampler2D uSampler;\nvoid main(void) {\nvec4 locColor = texture2D(uSampler, vTextureCoord) * matrix;\nif(locColor.a != 0.0){\nlocColor += colorAdd;\n}\ngl_FragColor = locColor;\n}";
  2048. this.uniforms = {
  2049. matrix: {
  2050. type: "mat4",
  2051. value: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
  2052. },
  2053. colorAdd: {
  2054. type: "4f",
  2055. value: {
  2056. x: 0,
  2057. y: 0,
  2058. z: 0,
  2059. w: 0
  2060. }
  2061. }
  2062. };
  2063. this.init()
  2064. }
  2065. __extends(b, a);
  2066. return b
  2067. }(b);
  2068. c.ColorTransformShader = a;
  2069. a.prototype.__class__ = "egret.ColorTransformShader";
  2070. var e = function() {
  2071. function a(b) {
  2072. this.alpha = this.translationMatrix = this.attributes = this.colorAttribute = this.aVertexPosition = this.tintColor = this.offsetVector = this.projectionVector = this.program = null;
  2073. this.fragmentSrc = "precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
  2074. this.vertexSrc = "attribute vec2 aVertexPosition;\nattribute vec4 aColor;\nuniform mat3 translationMatrix;\nuniform vec2 projectionVector;\nuniform vec2 offsetVector;\nuniform float alpha;\nuniform vec3 tint;\nvarying vec4 vColor;\nvoid main(void) {\n vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);\n v -= offsetVector.xyx;\n gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);\n vColor = aColor * vec4(tint * alpha, alpha);\n}";
  2075. this.gl = b;
  2076. this.init()
  2077. }
  2078. a.prototype.init = function() {
  2079. var a = this.gl,
  2080. b = c.WebGLUtils.compileProgram(a, this.vertexSrc, this.fragmentSrc);
  2081. a.useProgram(b);
  2082. this.projectionVector = a.getUniformLocation(b, "projectionVector");
  2083. this.offsetVector = a.getUniformLocation(b, "offsetVector");
  2084. this.tintColor = a.getUniformLocation(b, "tint");
  2085. this.aVertexPosition = a.getAttribLocation(b, "aVertexPosition");
  2086. this.colorAttribute = a.getAttribLocation(b, "aColor");
  2087. this.attributes = [this.aVertexPosition, this.colorAttribute];
  2088. this.translationMatrix = a.getUniformLocation(b,
  2089. "translationMatrix");
  2090. this.alpha = a.getUniformLocation(b, "alpha");
  2091. this.program = b
  2092. };
  2093. return a
  2094. }();
  2095. c.PrimitiveShader = e;
  2096. e.prototype.__class__ = "egret.PrimitiveShader"
  2097. })(egret || (egret = {}));
  2098. __extends = this.__extends || function(c, d) {
  2099. function b() {
  2100. this.constructor = c
  2101. }
  2102. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2103. b.prototype = d.prototype;
  2104. c.prototype = new b
  2105. };
  2106. (function(c) {
  2107. var d = function(b) {
  2108. function a() {
  2109. b.call(this)
  2110. }
  2111. __extends(a, b);
  2112. a.prototype.proceed = function(a) {
  2113. function b() {
  2114. if (4 == h.readyState)
  2115. if (h.status != a._status && (a._status = h.status, c.HTTPStatusEvent.dispatchHTTPStatusEvent(a, h.status)), 400 <= h.status || 0 == h.status) c.IOErrorEvent.dispatchIOErrorEvent(a);
  2116. else {
  2117. switch (a.dataFormat) {
  2118. case c.URLLoaderDataFormat.TEXT:
  2119. a.data = h.responseText;
  2120. break;
  2121. case c.URLLoaderDataFormat.VARIABLES:
  2122. a.data = new c.URLVariables(h.responseText);
  2123. break;
  2124. case c.URLLoaderDataFormat.BINARY:
  2125. a.data =
  2126. h.response;
  2127. break;
  2128. default:
  2129. a.data = h.responseText
  2130. }
  2131. c.__callAsync(c.Event.dispatchEvent, c.Event, a, c.Event.COMPLETE)
  2132. }
  2133. }
  2134. if (a.dataFormat == c.URLLoaderDataFormat.TEXTURE) this.loadTexture(a);
  2135. else if (a.dataFormat == c.URLLoaderDataFormat.SOUND) this.loadSound(a);
  2136. else {
  2137. var d = a._request,
  2138. h = this.getXHR();
  2139. h.onreadystatechange = b;
  2140. var g = c.NetContext._getUrl(d);
  2141. h.open(d.method, g, !0);
  2142. this.setResponseType(h, a.dataFormat);
  2143. d.method != c.URLRequestMethod.GET && d.data ? d.data instanceof c.URLVariables ? (h.setRequestHeader("Content-Type",
  2144. "application/x-www-form-urlencoded"), h.send(d.data.toString())) : (h.setRequestHeader("Content-Type", "multipart/form-data"), h.send(d.data)) : h.send()
  2145. }
  2146. };
  2147. a.prototype.loadSound = function(a) {
  2148. function b(g) {
  2149. window.clearTimeout(h.__timeoutId);
  2150. h.removeEventListener("canplaythrough", b, !1);
  2151. h.removeEventListener("error", d, !1);
  2152. g = new c.Sound;
  2153. g._setAudio(h);
  2154. a.data = g;
  2155. c.__callAsync(c.Event.dispatchEvent, c.Event, a, c.Event.COMPLETE)
  2156. }
  2157. function d(g) {
  2158. window.clearTimeout(h.__timeoutId);
  2159. h.removeEventListener("canplaythrough",
  2160. b, !1);
  2161. h.removeEventListener("error", d, !1);
  2162. c.IOErrorEvent.dispatchIOErrorEvent(a)
  2163. }
  2164. var h = new Audio(a._request.url);
  2165. h.__timeoutId = window.setTimeout(b, 100);
  2166. h.addEventListener("canplaythrough", b, !1);
  2167. h.addEventListener("error", d, !1);
  2168. h.load()
  2169. };
  2170. a.prototype.getXHR = function() {
  2171. return window.XMLHttpRequest ? new window.XMLHttpRequest : new ActiveXObject("MSXML2.XMLHTTP")
  2172. };
  2173. a.prototype.setResponseType = function(a, b) {
  2174. switch (b) {
  2175. case c.URLLoaderDataFormat.TEXT:
  2176. case c.URLLoaderDataFormat.VARIABLES:
  2177. a.responseType = c.URLLoaderDataFormat.TEXT;
  2178. break;
  2179. case c.URLLoaderDataFormat.BINARY:
  2180. a.responseType = "arraybuffer";
  2181. break;
  2182. default:
  2183. a.responseType = b
  2184. }
  2185. };
  2186. a.prototype.loadTexture = function(a) {
  2187. var b = a._request,
  2188. d = new Image;
  2189. d.onload = function(b) {
  2190. d.onerror = null;
  2191. d.onload = null;
  2192. b = new c.Texture;
  2193. b._setBitmapData(d);
  2194. a.data = b;
  2195. c.__callAsync(c.Event.dispatchEvent, c.Event, a, c.Event.COMPLETE)
  2196. };
  2197. d.onerror = function(b) {
  2198. d.onerror = null;
  2199. d.onload = null;
  2200. c.IOErrorEvent.dispatchIOErrorEvent(a)
  2201. };
  2202. d.src = b.url
  2203. };
  2204. return a
  2205. }(c.NetContext);
  2206. c.HTML5NetContext = d;
  2207. d.prototype.__class__ = "egret.HTML5NetContext"
  2208. })(egret ||
  2209. (egret = {}));
  2210. __extends = this.__extends || function(c, d) {
  2211. function b() {
  2212. this.constructor = c
  2213. }
  2214. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2215. b.prototype = d.prototype;
  2216. c.prototype = new b
  2217. };
  2218. (function(c) {
  2219. var d = function(b) {
  2220. function a() {
  2221. b.call(this);
  2222. this._isTouchDown = !1;
  2223. this.rootDiv = document.getElementById(c.StageDelegate.canvas_div_name)
  2224. }
  2225. __extends(a, b);
  2226. a.prototype.prevent = function(a) {
  2227. a.stopPropagation();
  2228. !0 != a.isScroll && a.preventDefault()
  2229. };
  2230. a.prototype.run = function() {
  2231. var a = this;
  2232. window.navigator.msPointerEnabled ? (this.rootDiv.addEventListener("MSPointerDown", function(b) {
  2233. a._onTouchBegin(b);
  2234. a.prevent(b)
  2235. }, !1), this.rootDiv.addEventListener("MSPointerMove", function(b) {
  2236. a._onTouchMove(b);
  2237. a.prevent(b)
  2238. }, !1), this.rootDiv.addEventListener("MSPointerUp", function(b) {
  2239. a._onTouchEnd(b);
  2240. a.prevent(b)
  2241. }, !1)) : c.MainContext.deviceType == c.MainContext.DEVICE_MOBILE ? this.addTouchListener() : c.MainContext.deviceType == c.MainContext.DEVICE_PC && (this.addTouchListener(), this.addMouseListener());
  2242. window.addEventListener("mousedown", function(b) {
  2243. a.inOutOfCanvas(b) ? a.dispatchLeaveStageEvent() : a._isTouchDown = !0
  2244. });
  2245. window.addEventListener("mouseup", function(b) {
  2246. a._isTouchDown && (a.inOutOfCanvas(b) ? a.dispatchLeaveStageEvent() : a._onTouchEnd(b));
  2247. a._isTouchDown = !1
  2248. })
  2249. };
  2250. a.prototype.addMouseListener = function() {
  2251. var a = this;
  2252. this.rootDiv.addEventListener("mousedown", function(b) {
  2253. a._onTouchBegin(b)
  2254. });
  2255. this.rootDiv.addEventListener("mousemove", function(b) {
  2256. a._onTouchMove(b)
  2257. });
  2258. this.rootDiv.addEventListener("mouseup", function(b) {
  2259. a._onTouchEnd(b)
  2260. })
  2261. };
  2262. a.prototype.addTouchListener = function() {
  2263. var a = this;
  2264. this.rootDiv.addEventListener("touchstart", function(b) {
  2265. for (var c = b.changedTouches.length, d = 0; d < c; d++) a._onTouchBegin(b.changedTouches[d]);
  2266. a.prevent(b)
  2267. }, !1);
  2268. this.rootDiv.addEventListener("touchmove",
  2269. function(b) {
  2270. for (var c = b.changedTouches.length, d = 0; d < c; d++) a._onTouchMove(b.changedTouches[d]);
  2271. a.prevent(b)
  2272. }, !1);
  2273. this.rootDiv.addEventListener("touchend", function(b) {
  2274. for (var c = b.changedTouches.length, d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
  2275. a.prevent(b)
  2276. }, !1);
  2277. this.rootDiv.addEventListener("touchcancel", function(b) {
  2278. for (var c = b.changedTouches.length, d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
  2279. a.prevent(b)
  2280. }, !1)
  2281. };
  2282. a.prototype.inOutOfCanvas = function(a) {
  2283. var b = this.getLocation(this.rootDiv, a);
  2284. a = b.x;
  2285. var b = b.y,
  2286. d = c.MainContext.instance.stage;
  2287. return 0 > a || 0 > b || a > d.stageWidth || b > d.stageHeight ? !0 : !1
  2288. };
  2289. a.prototype.dispatchLeaveStageEvent = function() {
  2290. this.touchingIdentifiers.length = 0;
  2291. c.MainContext.instance.stage.dispatchEventWith(c.Event.LEAVE_STAGE)
  2292. };
  2293. a.prototype._onTouchBegin = function(a) {
  2294. var b = this.getLocation(this.rootDiv, a),
  2295. c = -1;
  2296. a.hasOwnProperty("identifier") && (c = a.identifier);
  2297. this.onTouchBegan(b.x, b.y, c)
  2298. };
  2299. a.prototype._onTouchMove = function(a) {
  2300. var b = this.getLocation(this.rootDiv, a),
  2301. c = -1;
  2302. a.hasOwnProperty("identifier") &&
  2303. (c = a.identifier);
  2304. this.onTouchMove(b.x, b.y, c)
  2305. };
  2306. a.prototype._onTouchEnd = function(a) {
  2307. var b = this.getLocation(this.rootDiv, a),
  2308. c = -1;
  2309. a.hasOwnProperty("identifier") && (c = a.identifier);
  2310. this.onTouchEnd(b.x, b.y, c)
  2311. };
  2312. a.prototype.getLocation = function(a, b) {
  2313. var d = document.documentElement,
  2314. h = window,
  2315. g, f;
  2316. "function" === typeof a.getBoundingClientRect ? (f = a.getBoundingClientRect(), g = f.left, f = f.top) : f = g = 0;
  2317. g += h.pageXOffset - d.clientLeft;
  2318. f += h.pageYOffset - d.clientTop;
  2319. null != b.pageX ? (d = b.pageX, h = b.pageY) : (g -= document.body.scrollLeft,
  2320. f -= document.body.scrollTop, d = b.clientX, h = b.clientY);
  2321. var k = c.Point.identity;
  2322. k.x = (d - g) / c.StageDelegate.getInstance().getScaleX();
  2323. k.y = (h - f) / c.StageDelegate.getInstance().getScaleY();
  2324. return k
  2325. };
  2326. return a
  2327. }(c.TouchContext);
  2328. c.HTML5TouchContext = d;
  2329. d.prototype.__class__ = "egret.HTML5TouchContext"
  2330. })(egret || (egret = {}));
  2331. __extends = this.__extends || function(c, d) {
  2332. function b() {
  2333. this.constructor = c
  2334. }
  2335. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2336. b.prototype = d.prototype;
  2337. c.prototype = new b
  2338. };
  2339. (function(c) {
  2340. var d = function(b) {
  2341. function a() {
  2342. b.call(this);
  2343. this._hasListeners = !1;
  2344. this._inputType = "";
  2345. this._isShow = !1;
  2346. this.textValue = "";
  2347. this._height = this._width = 0;
  2348. this._styleInfoes = {};
  2349. var a = c.StageDelegate.getInstance().getScaleX(),
  2350. d = c.StageDelegate.getInstance().getScaleY(),
  2351. q = c.Browser.getInstance().$new("div");
  2352. q.position.x = 0;
  2353. q.position.y = 0;
  2354. q.scale.x = a;
  2355. q.scale.y = d;
  2356. q.transforms();
  2357. q.style[egret_dom.getTrans("transformOrigin")] = "0% 0% 0px";
  2358. this.div = q;
  2359. d = c.MainContext.instance.stage;
  2360. a = d.stageWidth;
  2361. d = d.stageHeight;
  2362. q = new c.Shape;
  2363. q.width = a;
  2364. q.height = d;
  2365. q.touchEnabled = !0;
  2366. this._shape = q;
  2367. this.getStageDelegateDiv().appendChild(this.div)
  2368. }
  2369. __extends(a, b);
  2370. a.prototype.getStageDelegateDiv = function() {
  2371. var a = c.Browser.getInstance().$("#StageDelegateDiv");
  2372. a || (a = c.Browser.getInstance().$new("div"), a.id = "StageDelegateDiv", document.getElementById(c.StageDelegate.canvas_div_name).appendChild(a), a.transforms());
  2373. return a
  2374. };
  2375. a.prototype._setMultiline = function(a) {
  2376. b.prototype._setMultiline.call(this, a);
  2377. this.createInput()
  2378. };
  2379. a.prototype.callHandler =
  2380. function(a) {
  2381. a.stopPropagation()
  2382. };
  2383. a.prototype._add = function() {
  2384. this.div && null == this.div.parentNode && this.getStageDelegateDiv().appendChild(this.div)
  2385. };
  2386. a.prototype._remove = function() {
  2387. this._shape && this._shape.parent && this._shape.parent.removeChild(this._shape);
  2388. this.div && this.div.parentNode && this.div.parentNode.removeChild(this.div)
  2389. };
  2390. a.prototype._addListeners = function() {
  2391. this.inputElement && !this._hasListeners && (this._hasListeners = !0, this.inputElement.addEventListener("mousedown", this.callHandler), this.inputElement.addEventListener("touchstart",
  2392. this.callHandler), this.inputElement.addEventListener("MSPointerDown", this.callHandler))
  2393. };
  2394. a.prototype._removeListeners = function() {
  2395. this.inputElement && this._hasListeners && (this._hasListeners = !1, this.inputElement.removeEventListener("mousedown", this.callHandler), this.inputElement.removeEventListener("touchstart", this.callHandler), this.inputElement.removeEventListener("MSPointerDown", this.callHandler))
  2396. };
  2397. a.prototype.createInput = function() {
  2398. var a = this._multiline ? "textarea" : "input";
  2399. this._inputType != a && (this._inputType =
  2400. a, null != this.inputElement && (this._removeListeners(), this.div.removeChild(this.inputElement)), this._multiline ? (a = document.createElement("textarea"), a.style.resize = "none") : a = document.createElement("input"), a.type = "text", this.inputElement = a, this.inputElement.value = "", this.div.appendChild(a), this._addListeners(), this.setElementStyle("width", "0px"), this.setElementStyle("border", "none"), this.setElementStyle("margin", "0"), this.setElementStyle("padding", "0"), this.setElementStyle("outline", "medium"), this.setElementStyle("verticalAlign",
  2401. "top"), this.setElementStyle("wordBreak", "break-all"), this.setElementStyle("overflow", "hidden"))
  2402. };
  2403. a.prototype._open = function(a, b, c, d) {};
  2404. a.prototype._setScale = function(a, d) {
  2405. b.prototype._setScale.call(this, a, d);
  2406. var q = c.StageDelegate.getInstance().getScaleX(),
  2407. h = c.StageDelegate.getInstance().getScaleY();
  2408. this.div.scale.x = q * a;
  2409. this.div.scale.y = h * d;
  2410. this.div.transforms()
  2411. };
  2412. a.prototype.changePosition = function(a, b) {
  2413. var d = c.StageDelegate.getInstance().getScaleX(),
  2414. h = c.StageDelegate.getInstance().getScaleY();
  2415. this.div.position.x =
  2416. a * d;
  2417. this.div.position.y = b * h;
  2418. this.div.transforms()
  2419. };
  2420. a.prototype.setStyles = function() {
  2421. this.setElementStyle("fontStyle", this._italic ? "italic" : "normal");
  2422. this.setElementStyle("fontWeight", this._bold ? "bold" : "normal");
  2423. this.setElementStyle("textAlign", this._textAlign);
  2424. this.setElementStyle("fontSize", this._size + "px");
  2425. this.setElementStyle("color", "#000000");
  2426. this.setElementStyle("width", this._width + "px");
  2427. this.setElementStyle("height", this._height + "px");
  2428. this.setElementStyle("border", "1px solid red");
  2429. this.setElementStyle("display",
  2430. "block")
  2431. };
  2432. a.prototype._show = function() {
  2433. 0 < this._maxChars ? this.inputElement.setAttribute("maxlength", this._maxChars) : this.inputElement.removeAttribute("maxlength");
  2434. this._isShow = !0;
  2435. var a = this._getText();
  2436. this.inputElement.value = a;
  2437. var b = this;
  2438. this.inputElement.oninput = function() {
  2439. b.textValue = b.inputElement.value;
  2440. b.dispatchEvent(new c.Event("updateText"))
  2441. };
  2442. this.setStyles();
  2443. this.inputElement.focus();
  2444. this.inputElement.selectionStart = a.length;
  2445. this.inputElement.selectionEnd = a.length;
  2446. this._shape && null == this._shape.parent &&
  2447. c.MainContext.instance.stage.addChild(this._shape)
  2448. };
  2449. a.prototype._hide = function() {
  2450. if (null != this.inputElement) {
  2451. this._isShow = !1;
  2452. this.inputElement.oninput = function() {};
  2453. this.setElementStyle("border", "none");
  2454. this.setElementStyle("display", "none");
  2455. this.inputElement.value = "";
  2456. this.setElementStyle("width", "0px");
  2457. window.scrollTo(0, 0);
  2458. var a = this;
  2459. c.setTimeout(function() {
  2460. a.inputElement.blur();
  2461. window.scrollTo(0, 0)
  2462. }, this, 50);
  2463. this._shape && this._shape.parent && this._shape.parent.removeChild(this._shape)
  2464. }
  2465. };
  2466. a.prototype._getText =
  2467. function() {
  2468. this.textValue || (this.textValue = "");
  2469. return this.textValue
  2470. };
  2471. a.prototype._setText = function(a) {
  2472. this.textValue = a;
  2473. this.resetText()
  2474. };
  2475. a.prototype.resetText = function() {
  2476. this.inputElement && (this.inputElement.value = this.textValue)
  2477. };
  2478. a.prototype._setWidth = function(a) {
  2479. this._width = a
  2480. };
  2481. a.prototype._setHeight = function(a) {
  2482. this._height = a
  2483. };
  2484. a.prototype.setElementStyle = function(a, b) {
  2485. this.inputElement && this._styleInfoes[a] != b && (this.inputElement.style[a] = b, this._styleInfoes[a] = b)
  2486. };
  2487. return a
  2488. }(c.StageText);
  2489. c.HTML5StageText =
  2490. d;
  2491. d.prototype.__class__ = "egret.HTML5StageText"
  2492. })(egret || (egret = {}));
  2493. egret.StageText.create = function() {
  2494. return new egret.HTML5StageText
  2495. };
  2496. var XiaobinTool = function() {
  2497. function c() {}
  2498. c.createBitmapByName = function(c) {
  2499. var b = new egret.Bitmap;
  2500. c = RES.getRes(c);
  2501. b.texture = c;
  2502. return b
  2503. };
  2504. c.creatMovieClip = function(c, b, a) {
  2505. void 0 === a && (a = "");
  2506. c = RES.getRes(c);
  2507. b = RES.getRes(b);
  2508. b = new egret.MovieClip(c, b);
  2509. b.frameRate = 60;
  2510. b.gotoAndPlay(a);
  2511. return b
  2512. };
  2513. c.hitTest = function(c, b) {
  2514. var a = c.getBounds(),
  2515. e = b.getBounds();
  2516. a.x = c.x;
  2517. a.y = c.y;
  2518. e.x = b.x;
  2519. e.y = b.y;
  2520. return a.intersects(e)
  2521. };
  2522. c.checkArrRecover = function(c, b) {
  2523. if (0 == c.length)
  2524. for (var a = 0; a < b.length; a++) c.push(b[a])
  2525. };
  2526. c.makeRandomFromArr =
  2527. function(c, b) {
  2528. this.checkArrRecover(c, b);
  2529. var a = Math.floor(Math.random() * c.length),
  2530. e = c[a];
  2531. c.splice(a, 1);
  2532. this.checkArrRecover(c, b);
  2533. return e
  2534. };
  2535. return c
  2536. }();
  2537. XiaobinTool.prototype.__class__ = "XiaobinTool";
  2538. var __extends = this.__extends || function(c, d) {
  2539. function b() {
  2540. this.constructor = c
  2541. }
  2542. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2543. b.prototype = d.prototype;
  2544. c.prototype = new b
  2545. },
  2546. ScoreFiveMc = function(c) {
  2547. function d() {
  2548. c.call(this);
  2549. this.num = 0;
  2550. this.theJson = "numberText_json";
  2551. this.thePng = "numberText_png";
  2552. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  2553. }
  2554. __extends(d, c);
  2555. d.prototype.onAddToStage = function(b) {
  2556. this.tenthousandText = XiaobinTool.creatMovieClip(this.theJson, this.thePng, "n0");
  2557. this.addChild(this.tenthousandText);
  2558. this.tenthousandText.x = 0;
  2559. this.thousandText = XiaobinTool.creatMovieClip(this.theJson, this.thePng, "n0");
  2560. this.addChild(this.thousandText);
  2561. this.thousandText.x = this.tenthousandText.x + this.tenthousandText.width;
  2562. this.handredText = XiaobinTool.creatMovieClip(this.theJson, this.thePng, "n0");
  2563. this.addChild(this.handredText);
  2564. this.handredText.x = this.thousandText.x + this.thousandText.width;
  2565. this.tenText = XiaobinTool.creatMovieClip(this.theJson, this.thePng, "n0");
  2566. this.addChild(this.tenText);
  2567. this.tenText.x = this.handredText.x +
  2568. this.handredText.width;
  2569. this.oneText = XiaobinTool.creatMovieClip(this.theJson, this.thePng, "n0");
  2570. this.addChild(this.oneText);
  2571. this.oneText.x = this.tenText.x + this.tenText.width
  2572. };
  2573. d.prototype.setNum = function(b) {
  2574. this.num = b;
  2575. b = Math.floor(this.num / 1E4).toString();
  2576. this.tenthousandText.gotoAndStop("n" + b.toString());
  2577. "0" == b && (this.tenthousandText.visible = !1);
  2578. b = Math.floor(this.num / 1E3).toString();
  2579. b = b.slice(b.length - 1, b.length);
  2580. this.thousandText.gotoAndStop("n" + b.toString());
  2581. this.thousandText.visible = !1 == this.tenthousandText.visible &&
  2582. "0" == b ? !1 : !0;
  2583. b = Math.floor(this.num / 100).toString();
  2584. b = b.slice(b.length - 1, b.length);
  2585. this.handredText.gotoAndStop("n" + b.toString());
  2586. this.handredText.visible = !1 == this.tenthousandText.visible && !1 == this.thousandText.visible && "0" == b ? !1 : !0;
  2587. b = Math.floor(this.num / 10).toString();
  2588. b = b.slice(b.length - 1, b.length);
  2589. this.tenText.gotoAndStop("n" + b.toString());
  2590. !1 == this.tenthousandText.visible && !1 == this.thousandText.visible && !1 == this.tenText.visible && "0" == b && (this.tenText.visible = !1);
  2591. b = this.num.toString();
  2592. b = b.slice(b.length -
  2593. 1, b.length);
  2594. this.oneText.gotoAndStop("n" + b.toString())
  2595. };
  2596. return d
  2597. }(egret.Sprite);
  2598. ScoreFiveMc.prototype.__class__ = "ScoreFiveMc";
  2599. var __extends = this.__extends || function(c, d) {
  2600. function b() {
  2601. this.constructor = c
  2602. }
  2603. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2604. b.prototype = d.prototype;
  2605. c.prototype = new b
  2606. },
  2607. GameSystem = function(c) {
  2608. function d() {
  2609. c.call(this);
  2610. this.isPlaying = !0;
  2611. this.timeNum = 60;
  2612. this.timeContentWidth = 180;
  2613. this.powerContentWidth = 0;
  2614. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  2615. }
  2616. __extends(d, c);
  2617. d.prototype.ats = function(b) {
  2618. this.stageW = this.stage.stageWidth;
  2619. this.stageH = this.stage.stageHeight;
  2620. this.scoreBg = XiaobinTool.createBitmapByName("scorePanel_png");
  2621. this.addChild(this.scoreBg);
  2622. this.scoreBg.x = this.scoreBg.y = 10;
  2623. this.scoreNum = 0;
  2624. b = new ScoreFiveMc;
  2625. b.x = -30;
  2626. b.y = 60;
  2627. b.scaleX = b.scaleY = 0.8;
  2628. this.addChild(b);
  2629. b.setNum(this.scoreNum);
  2630. this.gameScoreMc = b;
  2631. this.timeLine = XiaobinTool.createBitmapByName("timeLine_png");
  2632. this.addChild(this.timeLine);
  2633. this.timeLine.x = this.stageW - this.timeLine.width - 10;
  2634. this.timeLine.y = 20;
  2635. this.timeContent = XiaobinTool.createBitmapByName("timeContent_png");
  2636. this.addChild(this.timeContent);
  2637. this.timeContent.x = this.timeLine.x;
  2638. this.timeContent.y =
  2639. this.timeLine.y;
  2640. this.setTimeMasker(this.timeContentWidth);
  2641. b = XiaobinTool.createBitmapByName("clock_png");
  2642. this.addChild(b);
  2643. b.x = this.timeContent.x - 50;
  2644. b.y = this.timeContent.y - 10;
  2645. var a = XiaobinTool.createBitmapByName("koushao_png");
  2646. this.addChild(a);
  2647. a.x = b.x - 3;
  2648. a.y = b.y + 50;
  2649. this.powerLine = XiaobinTool.createBitmapByName("powerLine_png");
  2650. this.addChild(this.powerLine);
  2651. this.powerLine.x = this.stageW - this.powerLine.width - 10;
  2652. this.powerLine.y = 60;
  2653. this.powerContent = XiaobinTool.createBitmapByName("powerContent_png");
  2654. this.addChild(this.powerContent);
  2655. this.powerContent.x = this.powerLine.x;
  2656. this.powerContent.y = this.powerLine.y;
  2657. this.setPowerMasker(this.powerContentWidth)
  2658. };
  2659. d.prototype.setTimeMasker = function(b) {
  2660. b = new egret.Rectangle(0, 0, b, 50);
  2661. this.timeContent.mask = b
  2662. };
  2663. d.prototype.setPowerMasker = function(b) {
  2664. b = new egret.Rectangle(0, 0, b, 50);
  2665. this.powerContent.mask = b
  2666. };
  2667. d.prototype.loop = function(b) {
  2668. this.timeContentWidth++;
  2669. this.setTimeMasker(this.timeContentWidth)
  2670. };
  2671. d.prototype.updateScoreTxt = function() {
  2672. this.gameScoreMc.setNum(this.scoreNum);
  2673. 100 <= this.scoreNum &&
  2674. 1E3 > this.scoreNum && (this.gameScoreMc.x = -25);
  2675. 1E3 < this.scoreNum && (this.gameScoreMc.scaleX = this.gameScoreMc.scaleY = 0.7, this.gameScoreMc.x = 5)
  2676. };
  2677. d.prototype.updateTimeTxt = function() {};
  2678. d.prototype.updateHpMc = function() {
  2679. this.hpMc.gotoAndStop("hp" + this.hpNum)
  2680. };
  2681. d.costTimeSpeed = 1;
  2682. d.PAY_SUCCESS = "PAY_SUCCESS";
  2683. d.QIAN_SUCCESS = "QIAN_SUCCESS";
  2684. d.CUR_GOLD = "CUR_GOLD";
  2685. d.CUR_DATE = "CUR_DATE";
  2686. d.havePayArr = [!1, !1, !1, !1, !1];
  2687. d.payItemArr = [100, 200, 300, 100, 200];
  2688. d.showQiandao = !1;
  2689. d.curQian = 0;
  2690. d.moneyTimers = 5;
  2691. d.moneyTimers_init =
  2692. 5;
  2693. d.gameTime = 180;
  2694. d.gameTime_init = 180;
  2695. d.doubleScore = !1;
  2696. d.superDoubleScore = !1;
  2697. d.tenScore = !1;
  2698. d.curGold = 0;
  2699. d.getGold = 0;
  2700. d.qianValue = 15;
  2701. d.tool_1 = !1;
  2702. d.tool_2 = !1;
  2703. d.tool_3 = !1;
  2704. d.tool_4 = !1;
  2705. d.tool_5 = !1;
  2706. d.tool_6 = !1;
  2707. return d
  2708. }(egret.Sprite);
  2709. GameSystem.prototype.__class__ = "GameSystem";
  2710. var __extends = this.__extends || function(c, d) {
  2711. function b() {
  2712. this.constructor = c
  2713. }
  2714. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2715. b.prototype = d.prototype;
  2716. c.prototype = new b
  2717. },
  2718. PayItemBtn = function(c) {
  2719. function d() {
  2720. c.call(this);
  2721. this.stageH = this.stageW = 0;
  2722. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  2723. }
  2724. __extends(d, c);
  2725. d.prototype.ats = function(b) {
  2726. b = XiaobinTool.createBitmapByName("payItem_btn_png");
  2727. this.addChild(b);
  2728. var a = new egret.TextField;
  2729. this.addChild(a);
  2730. a.size = 25;
  2731. a.textColor = 6237447;
  2732. a.x = 65;
  2733. a.y =
  2734. b.y + 20;
  2735. this.t = a;
  2736. this.anchorOffsetX = this.width / 2;
  2737. this.anchorOffsetY = this.height / 2;
  2738. this.touchEnabled = !0;
  2739. this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.tb, this);
  2740. this.addEventListener(egret.TouchEvent.TOUCH_END, this.te, this)
  2741. };
  2742. d.prototype.tb = function(b) {
  2743. this.scaleX = this.scaleY = 1.1
  2744. };
  2745. d.prototype.te = function(b) {
  2746. this.scaleX = this.scaleY = 1
  2747. };
  2748. return d
  2749. }(egret.Sprite);
  2750. PayItemBtn.prototype.__class__ = "PayItemBtn";
  2751. var __extends = this.__extends || function(c, d) {
  2752. function b() {
  2753. this.constructor = c
  2754. }
  2755. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2756. b.prototype = d.prototype;
  2757. c.prototype = new b
  2758. },
  2759. StartBtn = function(c) {
  2760. function d() {
  2761. c.call(this);
  2762. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  2763. }
  2764. __extends(d, c);
  2765. d.prototype.onAddToStage = function(b) {
  2766. this.bgBMP = new egret.Bitmap;
  2767. this.addChild(this.bgBMP);
  2768. this.bgBMP.texture = RES.getRes("start_btn_png")
  2769. };
  2770. return d
  2771. }(egret.Sprite);
  2772. StartBtn.prototype.__class__ = "StartBtn";
  2773. var __extends = this.__extends || function(c, d) {
  2774. function b() {
  2775. this.constructor = c
  2776. }
  2777. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2778. b.prototype = d.prototype;
  2779. c.prototype = new b
  2780. },
  2781. GameOverPanel = function(c) {
  2782. function d() {
  2783. c.call(this);
  2784. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  2785. }
  2786. __extends(d, c);
  2787. d.prototype.ats = function(b) {
  2788. this.stageW = this.stage.stageWidth;
  2789. this.stageH = this.stage.stageHeight;
  2790. b = new egret.Shape;
  2791. this.addChild(b);
  2792. b.graphics.beginFill(0, 0.5);
  2793. b.graphics.drawRect(0, 0, this.stageW, this.stageH);
  2794. b.graphics.endFill();
  2795. b = XiaobinTool.createBitmapByName("gameoverBg_jpg");
  2796. this.addChild(b);
  2797. b = XiaobinTool.createBitmapByName("fx_btn_png");
  2798. this.addChild(b);
  2799. b.anchorOffsetX = b.width / 2;
  2800. b.scaleX = b.scaleY = 0.7;
  2801. b.x = this.stageW / 2;
  2802. b.y = 370;
  2803. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.doFenxiang, this);
  2804. b.touchEnabled = !0;
  2805. var a = XiaobinTool.createBitmapByName("replay_btn_png");
  2806. this.addChild(a);
  2807. a.anchorOffsetX = a.width / 2;
  2808. a.scaleX = a.scaleY = 0.7;
  2809. a.x = this.stageW / 2;
  2810. a.y = b.y + b.height - 25;
  2811. a.addEventListener(egret.TouchEvent.TOUCH_BEGIN,
  2812. this.doReplay, this);
  2813. a.touchEnabled = !0;
  2814. var c = XiaobinTool.createBitmapByName("more_btn_png");
  2815. this.addChild(c);
  2816. c.anchorOffsetX = c.width / 2;
  2817. c.scaleX = c.scaleY = 0.7;
  2818. c.x = this.stageW / 2;
  2819. c.y = a.y + a.height - 30;
  2820. c.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.doMore, this);
  2821. c.touchEnabled = !0;
  2822. a = new egret.TextField;
  2823. this.addChild(a);
  2824. a.text = GameSystem.getGold.toString();
  2825. a.size = 30;
  2826. a.x = this.stageW / 2 + 10;
  2827. a.y = b.y - 60;
  2828. b = new egret.TextField;
  2829. this.addChild(b);
  2830. b.text = " ";
  2831. b.size = 8;
  2832. b.x = 10;
  2833. b.y = 740 - 2 * b.height + 3;
  2834. b.touchEnabled = !0;
  2835. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.doAbout, this);
  2836. b = new ScoreFiveMc;
  2837. this.addChild(b);
  2838. b.x = 99 < GameSystem.curScore ? 100 : 80;
  2839. b.y = 250;
  2840. b.setNum(GameSystem.curScore);
  2841. b = XiaobinTool.createBitmapByName("home_btn_png");
  2842. this.addChild(b);
  2843. b.x = this.stageW - b.width + 10;
  2844. b.y = this.stageH - b.height + 10;
  2845. b.scaleX = b.scaleY = 0.7;
  2846. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.doHome, this);
  2847. b.touchEnabled = !0;
  2848. GameSystem.moneyTimers = GameSystem.moneyTimers_init;
  2849. GameSystem.gameTime = GameSystem.gameTime_init;
  2850. GameSystem.doubleScore = !1;
  2851. GameSystem.superDoubleScore = !1;
  2852. GameSystem.tenScore = !1
  2853. };
  2854. d.prototype.doAbout = function(b) {
  2855. b.target.text = "版权所有:聆听Q语"
  2856. };
  2857. d.prototype.doHome = function(b) {
  2858. b = new egret.Event("click_home_btn", !0);
  2859. this.dispatchEvent(b)
  2860. };
  2861. d.prototype.doFenxiang = function(b) {
  2862. // ih5game.share()
  2863. };
  2864. d.prototype.doReplay = function(b) {
  2865. console.log("doReplay");
  2866. b.target.parent && b.target.parent.removeChild(b.target);
  2867. b = new egret.Event("click_replay_btn", !0);
  2868. this.dispatchEvent(b)
  2869. };
  2870. d.prototype.doDownload = function(b) {};
  2871. d.prototype.doMore = function(b) {
  2872. // ih5game.more()
  2873. };
  2874. return d
  2875. }(egret.Sprite);
  2876. GameOverPanel.prototype.__class__ = "GameOverPanel";
  2877. var __extends = this.__extends || function(c, d) {
  2878. function b() {
  2879. this.constructor = c
  2880. }
  2881. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2882. b.prototype = d.prototype;
  2883. c.prototype = new b
  2884. },
  2885. HomePage = function(c) {
  2886. function d() {
  2887. c.call(this);
  2888. this.stageH = this.stageW = 0;
  2889. this.homePage = null;
  2890. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.startGame, this)
  2891. }
  2892. __extends(d, c);
  2893. d.prototype.startGame = function(b) {
  2894. b = XiaobinTool.createBitmapByName("homepage_jpg");
  2895. this.addChild(b);
  2896. this.stageW = this.stage.stageWidth;
  2897. this.stageH = this.stage.stageHeight;
  2898. null == this.homePage && (this.startBtn = new StartBtn, this.addChild(this.startBtn), this.startBtn.x = (this.stageW - this.startBtn.width) / 2, this.startBtn.y = 550, this.startBtn.touchEnabled = !0, this.startBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this));
  2899. this.touchEnabled = !0
  2900. };
  2901. d.prototype.loop = function(b) {};
  2902. d.prototype.onTouchBegin = function(b) {
  2903. b.target.parent && b.target.parent.removeChild(b.target);
  2904. b = new egret.Event("click_info_btn", !0);
  2905. this.dispatchEvent(b)
  2906. };
  2907. return d
  2908. }(egret.Sprite);
  2909. HomePage.prototype.__class__ = "HomePage";
  2910. var __extends = this.__extends || function(c, d) {
  2911. function b() {
  2912. this.constructor = c
  2913. }
  2914. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2915. b.prototype = d.prototype;
  2916. c.prototype = new b
  2917. },
  2918. QiandaoPanel = function(c) {
  2919. function d() {
  2920. c.call(this);
  2921. this.currentColumn = this.currentRow = this.stageH = this.stageW = 0;
  2922. this.numRow = 5;
  2923. this.numColumn = 6;
  2924. this.spaceV = this.spaceH = 70;
  2925. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  2926. }
  2927. __extends(d, c);
  2928. d.prototype.ats = function(b) {
  2929. b = XiaobinTool.createBitmapByName("kqb_png");
  2930. this.addChild(b);
  2931. this.stageW = this.stage.stageWidth;
  2932. this.stageH = this.stage.stageHeight;
  2933. b = XiaobinTool.createBitmapByName("close_btn_png");
  2934. this.addChild(b);
  2935. b.x = this.stageW - b.width - 20;
  2936. b.y = 110;
  2937. b.scaleX = b.scaleY = 0.5;
  2938. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touch_Close, this);
  2939. b.touchEnabled = !0;
  2940. for (b = 0; b < this.numRow * this.numColumn; b++) {
  2941. this.currentRow = Math.floor(b / this.numColumn);
  2942. this.currentColumn = b - this.currentRow * this.numColumn;
  2943. this.qianBm = 0 == (b + 1) % 5 ? XiaobinTool.createBitmapByName("qian_yes_png") : XiaobinTool.createBitmapByName("qian_no_png");
  2944. this.addChild(this.qianBm);
  2945. this.qianBm.x = 40 + this.currentColumn * this.spaceH;
  2946. this.qianBm.y = 160 + this.currentRow * this.spaceV;
  2947. this.qianBm.scaleX = this.qianBm.scaleY = 1;
  2948. var a = new egret.TextField;
  2949. this.addChild(a);
  2950. a.text = (b + 1).toString();
  2951. a.x = this.qianBm.x + 8;
  2952. a.y = this.qianBm.y + 10;
  2953. 10 > b + 1 && (a.x += 8)
  2954. }
  2955. var c = (new Date).getDate();
  2956. console.info("当前日期:" + c);
  2957. 30 < c && (c = 30);
  2958. b = GameSystem.CUR_DATE;
  2959. a = egret.localStorage.getItem(b);
  2960. console.info("原有签到日期 = " + a);
  2961. null == egret.localStorage.getItem(b) ?
  2962. (GameSystem.curQian = 1, a = GameSystem.curQian.toString(), egret.localStorage.setItem(b, a)) : GameSystem.curQian = parseInt(a);
  2963. a = XiaobinTool.createBitmapByName("face_png");
  2964. this.addChild(a);
  2965. var d = GameSystem.curQian - 1;
  2966. this.currentRow = Math.floor(d / this.numColumn);
  2967. this.currentColumn = d - this.currentRow * this.numColumn;
  2968. a.x = 40 + this.currentColumn * this.spaceH;
  2969. a.y = 160 + this.currentRow * this.spaceV;
  2970. c == GameSystem.curQian ? console.info("今日已签~") : (GameSystem.curQian = c, console.info("签到成功!! = " +
  2971. GameSystem.curQian), d = c - 1, c = Math.floor(d / this.numColumn), d = 40 + (d - c * this.numColumn) * this.spaceH, c = 160 + c * this.spaceV, egret.Tween.get(a).to({
  2972. x: d,
  2973. y: c
  2974. }, 1E3), GameSystem.curGold += 10, a = new egret.Event(GameSystem.QIAN_SUCCESS, !0), this.dispatchEvent(a));
  2975. a = GameSystem.curQian.toString();
  2976. egret.localStorage.setItem(b, a)
  2977. };
  2978. d.prototype.touch_Close = function(b) {
  2979. b.target.parent && b.target.parent.removeChild(b.target);
  2980. this.parent && this.parent.removeChild(this);
  2981. GameSystem.showQiandao = !1
  2982. };
  2983. d.prototype.loop = function(b) {};
  2984. return d
  2985. }(egret.Sprite);
  2986. QiandaoPanel.prototype.__class__ = "QiandaoPanel";
  2987. var __extends = this.__extends || function(c, d) {
  2988. function b() {
  2989. this.constructor = c
  2990. }
  2991. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  2992. b.prototype = d.prototype;
  2993. c.prototype = new b
  2994. },
  2995. ShopPanel = function(c) {
  2996. function d() {
  2997. c.call(this);
  2998. this.stageH = this.stageW = 0;
  2999. this.btnArr = [];
  3000. this.canPay = !1;
  3001. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  3002. }
  3003. __extends(d, c);
  3004. d.prototype.ats = function(b) {
  3005. this.shopBg = XiaobinTool.createBitmapByName("shop_bg_png");
  3006. this.addChild(this.shopBg);
  3007. this.shopBg.x = 0;
  3008. for (b = this.shopBg.y = 0; 5 >
  3009. b; b++) {
  3010. var a = new PayItemBtn;
  3011. this.addChild(a);
  3012. a.x = 300 + a.width / 2;
  3013. a.y = 140 + (a.height + 22) * b + a.height / 2;
  3014. a.t.text = GameSystem.payItemArr[b].toString();
  3015. a.name = "payBtn" + (b + 1);
  3016. !0 == GameSystem.havePayArr[b] && (a.visible = !1);
  3017. this.btnArr.push(a)
  3018. }
  3019. this.touchEnabled = !0;
  3020. this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.tb, this);
  3021. this.addEventListener(egret.TouchEvent.TOUCH_END, this.te, this)
  3022. };
  3023. d.prototype.tb = function(b) {};
  3024. d.prototype.te = function(b) {
  3025. for (var a = 0; a < this.btnArr.length; a++)
  3026. if (this.btnArr[a].scaleX = this.btnArr[a].scaleY =
  3027. 1, this.btnArr[a].hitTestPoint(b.stageX, b.stageY)) {
  3028. var c = b.target.name;
  3029. "pay" == c.slice(0, 3) && (this.getToolNum = c.slice(6), console.log(this.getToolNum), this.checkGoldValue(parseInt(this.getToolNum) - 1), this.canPay ? this.checkClickTool(parseInt(this.getToolNum)) : console.log("金币不足"))
  3030. }
  3031. };
  3032. d.prototype.checkGoldValue = function(b) {
  3033. GameSystem.curGold >= GameSystem.payItemArr[b] ? (console.log("可以购买"), this.canPay = !0) : this.canPay = !1
  3034. };
  3035. d.prototype.checkClickTool = function(b) {
  3036. this.getChildByName("payBtn" +
  3037. b).visible = !1;
  3038. GameSystem.curGold -= GameSystem.payItemArr[b - 1];
  3039. GameSystem.havePayArr[b - 1] = !0;
  3040. var a = new egret.Event(GameSystem.PAY_SUCCESS, !0);
  3041. this.dispatchEvent(a);
  3042. switch (b) {
  3043. case 1:
  3044. console.log("购买道具1");
  3045. GameSystem.moneyTimers = 3;
  3046. break;
  3047. case 2:
  3048. console.log("道具2");
  3049. GameSystem.gameTime = 230;
  3050. break;
  3051. case 3:
  3052. console.log("道具3");
  3053. GameSystem.doubleScore = !0;
  3054. break;
  3055. case 4:
  3056. console.log("道具4");
  3057. GameSystem.superDoubleScore = !0;
  3058. break;
  3059. case 5:
  3060. console.log("道具5"), GameSystem.tenScore = !0
  3061. }
  3062. };
  3063. d.prototype.loop = function(b) {};
  3064. return d
  3065. }(egret.Sprite);
  3066. ShopPanel.prototype.__class__ = "ShopPanel";
  3067. var __extends = this.__extends || function(c, d) {
  3068. function b() {
  3069. this.constructor = c
  3070. }
  3071. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3072. b.prototype = d.prototype;
  3073. c.prototype = new b
  3074. },
  3075. InGame = function(c) {
  3076. function d() {
  3077. c.call(this);
  3078. this.stageH = this.stageW = 0;
  3079. this.gameOver = !1;
  3080. this.touchY = this.touchX = 0;
  3081. this.itemArr = [];
  3082. this.itemFrameArr = ["mi_1", "mi_2", "mi_3", "mi_4"];
  3083. this.itemFrameInitArr = ["mi_1", "mi_2", "mi_3", "mi_4"];
  3084. this.queueItemArr = [];
  3085. this.showDataArr = [];
  3086. this.queueFrameArr = [];
  3087. this.queueFrameInitArr = [];
  3088. this.moveTime = 200;
  3089. this.moving = !1;
  3090. this.shakeTime = this.clickYesCount = 0;
  3091. this.maxShakeTime = 30;
  3092. this.itemStartY = 180;
  3093. this.space = 45;
  3094. this.powerCount = this.timeCostCount = 0;
  3095. this.bigger = 10;
  3096. this.inPower = !1;
  3097. this.fastTime = 60;
  3098. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  3099. }
  3100. __extends(d, c);
  3101. d.prototype.ats = function(b) {
  3102. this.stageW = this.stage.stageWidth;
  3103. this.stageH = this.stage.stageHeight;
  3104. this.touchEnabled = !0;
  3105. this.addEventListener(egret.Event.ENTER_FRAME, this.loop, this);
  3106. this.addEventListener(egret.TouchEvent.TOUCH_BEGIN,
  3107. this.onTouchBegin, this);
  3108. this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouchEnd, this);
  3109. this.gameTimer = new egret.Timer(100);
  3110. this.gameTimer.addEventListener(egret.TimerEvent.TIMER, this.costTime, this);
  3111. this.gameTimer.start();
  3112. this.powerTimer = new egret.Timer(5E3, 1);
  3113. this.powerTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.powerOver, this);
  3114. this.initGame()
  3115. };
  3116. d.prototype.powerOver = function() {
  3117. this.inPower = !1;
  3118. this.powerMc.gotoAndStop("blank")
  3119. };
  3120. d.prototype.costTime = function() {
  3121. if (0 < GameSystem.gameTime &&
  3122. (this.timeCostCount += 1, GameSystem.gameTime -= GameSystem.costTimeSpeed, this.gameSystemPanel.setTimeMasker(GameSystem.gameTime), 0 == GameSystem.gameTime)) {
  3123. this.gameTimer.removeEventListener(egret.TimerEvent.TIMER, this.costTime, this);
  3124. console.info("gameOver = " + this.timeCostCount);
  3125. var b = XiaobinTool.createBitmapByName("timeUp_png");
  3126. this.addChild(b);
  3127. b.anchorOffsetX = b.width / 2;
  3128. b.anchorOffsetY = b.height / 2;
  3129. b.x = this.stageW / 2;
  3130. b.y = 300;
  3131. b.scaleX = b.scaleY = 0.1;
  3132. egret.Tween.get(b).to({
  3133. scaleX: 1,
  3134. scaleY: 1
  3135. }, 500, egret.Ease.backOut);
  3136. this.gameOver = !0;
  3137. b = new egret.Timer(2E3, 1);
  3138. b.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.makeGameOver, this);
  3139. b.start();
  3140. this.timeOverSound.play()
  3141. }
  3142. };
  3143. d.prototype.initGame = function() {
  3144. this.curNum = 2;
  3145. this.clickTime = this.fastTime;
  3146. this.creatBg();
  3147. this.creatLookItem();
  3148. this.showItem();
  3149. this.creatButtons();
  3150. this.makeQueue();
  3151. this.updateQueue();
  3152. this.makeTimer();
  3153. this.creatGameSystemPanel();
  3154. this.creatMusic();
  3155. this.creatSmokeMc();
  3156. this.makePowerMc();
  3157. this.createKeyEvent();
  3158. };
  3159. d.prototype.creatSmokeMc = function() {
  3160. var b = this.queueItemArr.length -
  3161. 1;
  3162. this.smokeMc = XiaobinTool.creatMovieClip("smoke_json", "smoke_png", "blank");
  3163. this.addChild(this.smokeMc);
  3164. this.smokeMc.x = this.stageW / 2;
  3165. this.smokeMc.y = this.queueItemArr[b].y;
  3166. this.smokeMc.frameRate = 30
  3167. };
  3168. d.prototype.makePowerMc = function() {
  3169. this.powerMc = XiaobinTool.creatMovieClip("powerMc_json", "powerMc_png", "blank");
  3170. this.addChild(this.powerMc);
  3171. this.powerMc.x = this.stageW / 2;
  3172. this.powerMc.y = this.stageH / 2;
  3173. this.powerMc.frameRate = 30
  3174. };
  3175. d.prototype.creatMusic = function() {
  3176. this.bgMusic = RES.getRes("mscNormal");
  3177. this.bgMusic.play();
  3178. this.bgMusic.addEventListener("ended", this.rePlay.bind(this));
  3179. this.wSound = RES.getRes("sndFail");
  3180. this.ySound1 = RES.getRes("sndSucc1");
  3181. this.ySound2 = RES.getRes("sndSucc2");
  3182. this.ySound3 = RES.getRes("sndSucc3");
  3183. this.timeOverSound = RES.getRes("sndOver")
  3184. };
  3185. d.prototype.rePlay = function() {
  3186. this.bgMusic.load();
  3187. this.bgMusic.play()
  3188. };
  3189. d.prototype.creatGameSystemPanel = function() {
  3190. this.gameSystemPanel = new GameSystem;
  3191. this.addChild(this.gameSystemPanel)
  3192. };
  3193. d.prototype.makeTimer = function() {
  3194. this.timer = new egret.Timer(this.moveTime +
  3195. 10, 1);
  3196. this.timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.timerComFunc, this)
  3197. };
  3198. d.prototype.timerComFunc = function() {
  3199. console.log("计时结束");
  3200. this.tweenComplete()
  3201. };
  3202. d.prototype.updateQueue = function() {
  3203. for (var b = 0; 7 > b; b++) this.queueItemArr[b].gotoAndStop(this.showDataArr[b]);
  3204. b = this.queueItemArr.length - 1;
  3205. this.queueItemArr[b].gotoAndStop("y" + this.showDataArr[b])
  3206. };
  3207. d.prototype.makeQueue = function() {
  3208. for (var b = 0; 7 > b; b++) {
  3209. var a = XiaobinTool.makeRandomFromArr(this.queueFrameArr, this.queueFrameInitArr).toString();
  3210. this.showDataArr.push(a)
  3211. }
  3212. console.log("this.showDataArr = " + this.showDataArr);
  3213. for (b = 0; 7 > b; b++) a = XiaobinTool.creatMovieClip("item_json", "item_png", "blank"), this.addChild(a), a.x = this.stageW / 2, a.y = this.itemStartY + b * (2.5 * b + this.space), a.scaleX = a.scaleY = (b + 4) / this.bigger, this.queueItemArr.push(a)
  3214. };
  3215. d.prototype.creatButtons = function() {
  3216. this.leftBtn = XiaobinTool.creatMovieClip("left_btn_json", "left_btn_png", "left_btn_yes");
  3217. this.addChild(this.leftBtn);
  3218. this.leftBtn.x = this.leftBtn.width / 2 + 10;
  3219. this.leftBtn.y = 640;
  3220. this.leftBtn.touchEnabled = !0;
  3221. this.rightBtn = XiaobinTool.creatMovieClip("right_btn_json", "right_btn_png", "right_btn_yes");
  3222. this.addChild(this.rightBtn);
  3223. this.rightBtn.x = this.stageW - this.rightBtn.width / 2 - 10;
  3224. this.rightBtn.y = 640;
  3225. this.rightBtn.touchEnabled = !0
  3226. };
  3227. d.prototype.creatLookItem = function() {
  3228. for (var b = 0; 4 > b; b++) {
  3229. var a = XiaobinTool.creatMovieClip("item_json", "item_png", "blank");
  3230. this.addChild(a);
  3231. switch (b) {
  3232. case 0:
  3233. a.x = 50;
  3234. a.y = 500;
  3235. break;
  3236. case 1:
  3237. a.x = this.stageW - 50;
  3238. a.y = 500;
  3239. break;
  3240. case 2:
  3241. a.x = 50;
  3242. a.y = 300;
  3243. break;
  3244. case 3:
  3245. a.x =
  3246. this.stageW - 50, a.y = 300
  3247. }
  3248. this.itemArr.push(a)
  3249. }
  3250. };
  3251. d.prototype.showItem = function() {
  3252. if (2 == this.curNum) {
  3253. var b = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString(),
  3254. a = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString();
  3255. this.itemArr[0].gotoAndStop(b);
  3256. this.itemArr[1].gotoAndStop(a);
  3257. this.itemArr[0].x += 30;
  3258. this.itemArr[1].x -= 30;
  3259. this.itemArr[0].scaleX = this.itemArr[0].scaleY = 0.8;
  3260. this.itemArr[1].scaleX = this.itemArr[1].scaleY = 0.8;
  3261. this.queueFrameArr.push(b,
  3262. a);
  3263. this.queueFrameInitArr.push(b, a)
  3264. }
  3265. };
  3266. d.prototype.creatBg = function() {
  3267. this.bg = XiaobinTool.createBitmapByName("bg_jpg");
  3268. this.addChild(this.bg)
  3269. };
  3270. d.prototype.makeGameOver = function() {
  3271. GameSystem.getGold = Math.floor(this.gameSystemPanel.scoreNum / 10);
  3272. GameSystem.curGold += Math.floor(this.gameSystemPanel.scoreNum / 10);
  3273. console.log("获得金币:" + GameSystem.getGold);
  3274. var b = GameSystem.curGold.toString();
  3275. egret.localStorage.setItem(GameSystem.CUR_GOLD, b);
  3276. console.info("保存!总共金币 = " +
  3277. b);
  3278. GameSystem.curScore = this.gameSystemPanel.scoreNum;
  3279. b = new GameOverPanel;
  3280. this.addChild(b);
  3281. // 0 < this.gameSystemPanel.scoreNum && ih5game.setScoreWithName(this.gameSystemPanel.scoreNum);
  3282. // ih5game.share();
  3283. // ih5game.setShare({
  3284. // title: "有钱就任性2圣诞版",
  3285. // desc: "圣诞节任性了?,我得到" + this.gameSystemPanel.scoreNum + "分,不想没钱认命的快来挑战!"
  3286. // })
  3287. };
  3288. d.prototype.onTouchBegin = function(b) {
  3289. this.touchX = b.stageX;
  3290. this.touchY = b.stageY;
  3291. if (!0 != this.gameOver && 0 == this.shakeTime && !1 == this.moving)
  3292. if ("mi_5" == this.showDataArr[this.showDataArr.length - 1]) this.doClickYes();
  3293. else if (b.target == this.leftBtn || b.target == this.rightBtn) {
  3294. switch (b.target) {
  3295. case this.leftBtn:
  3296. this.clickBtnNum = 0;
  3297. break;
  3298. case this.rightBtn:
  3299. this.clickBtnNum = 1
  3300. }
  3301. b.target.scaleX = b.target.scaleY = 0.85;
  3302. this.checkValue()
  3303. }
  3304. };
  3305. d.prototype.checkValue = function() {
  3306. var b = this.showDataArr[this.showDataArr.length - 1];
  3307. console.log(b);
  3308. console.log(this.queueFrameInitArr[this.clickBtnNum]);
  3309. b == this.queueFrameInitArr[this.clickBtnNum] ||
  3310. b == this.queueFrameInitArr[this.clickBtnNum + 2] ? (console.log(" YES CLICK ! "), this.doClickYes()) : (console.log(" NO CLICK ! "), this.clickTime = 0, this.wSound.play(), this.shakeTime = this.maxShakeTime, b = this.queueItemArr.length - 1, this.queueItemArr[b].gotoAndStop("w" + this.showDataArr[b]))
  3311. };
  3312. d.prototype.doClickYes = function() {
  3313. 0.3 > Math.random() ? this.ySound1.play() : 0.6 > Math.random() ? this.ySound2.play() : this.ySound3.play();
  3314. !0 == this.inPower ? this.clickYesCount += 2 : this.clickYesCount++;
  3315. !0 == GameSystem.doubleScore && !1 ==
  3316. this.inPower && this.clickYesCount++;
  3317. !0 == GameSystem.superDoubleScore && !0 == this.inPower && (this.clickYesCount += 2);
  3318. !0 == GameSystem.tenScore && 0.2 < Math.random() && !1 == this.inPower && (this.clickYesCount += 9);
  3319. this.gameSystemPanel.scoreNum = 10 * this.clickYesCount;
  3320. this.gameSystemPanel.updateScoreTxt();
  3321. this.powerCount++;
  3322. this.gameSystemPanel.powerContentWidth = 10 * this.powerCount;
  3323. this.gameSystemPanel.setPowerMasker(this.gameSystemPanel.powerContentWidth);
  3324. 180 < this.gameSystemPanel.powerContentWidth && (this.gameSystemPanel.powerContentWidth =
  3325. 0, this.gameSystemPanel.setPowerMasker(this.gameSystemPanel.powerContentWidth), this.powerCount = 0, this.powerTimer.start(), this.inPower = !0, this.powerMc.gotoAndPlay("showPower"));
  3326. this.checkAddItem();
  3327. this.queueItemArr[this.queueItemArr.length - 1].gotoAndStop("blank");
  3328. this.smokeMc.gotoAndPlay("playSmoke");
  3329. 0 < this.clickTime && this.creatCombo();
  3330. this.clickTime = this.fastTime;
  3331. this.makeTween();
  3332. this.moving = !0
  3333. };
  3334. d.prototype.creatCombo = function() {
  3335. var b = XiaobinTool.createBitmapByName("combo_png");
  3336. this.addChild(b);
  3337. b.anchorOffsetX =
  3338. b.width / 2;
  3339. b.x = this.stageW / 2;
  3340. b.y = this.queueItemArr[this.queueItemArr.length - 1].y;
  3341. b.scaleX = b.scaleY = 0.1;
  3342. b.rotation = 0;
  3343. b.alpha = 0;
  3344. egret.Tween.get(b).to({
  3345. y: b.y - 20 * Math.random(),
  3346. scaleX: 1,
  3347. scaleY: 1,
  3348. rotation: -15 + 30 * Math.random(),
  3349. alpha: 1
  3350. }, 300, egret.Ease.backOut).call(this.comboOver, this, [b])
  3351. };
  3352. d.prototype.comboOver = function(b) {
  3353. b.parent && b.parent.removeChild(b)
  3354. };
  3355. d.prototype.checkAddItem = function() {
  3356. if (5 == this.clickYesCount) {
  3357. this.curNum++;
  3358. var b = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString();
  3359. this.itemArr[2].gotoAndStop(b);
  3360. this.itemArr[2].scaleX = 0.8;
  3361. this.itemArr[2].scaleY = 0.8;
  3362. this.itemArr[2].x += 30;
  3363. this.queueFrameArr.push(b);
  3364. this.queueFrameInitArr.push(b)
  3365. }
  3366. 10 == this.clickYesCount && (this.curNum++, b = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString(), this.itemArr[3].gotoAndStop(b), this.itemArr[3].scaleX = 0.8, this.itemArr[3].scaleY = 0.8, this.itemArr[3].x -= 30, this.queueFrameArr.push(b), this.queueFrameInitArr.push(b))
  3367. };
  3368. d.prototype.makeTween = function() {
  3369. for (var b = 0; 6 >
  3370. b; b++) {
  3371. var a = this.queueItemArr[b + 1];
  3372. egret.Tween.get(this.queueItemArr[b]).to({
  3373. x: a.x,
  3374. y: a.y,
  3375. scaleX: a.scaleX,
  3376. scaleY: a.scaleY
  3377. }, this.moveTime, egret.Ease.backOut);
  3378. this.timer.start()
  3379. }
  3380. };
  3381. d.prototype.tweenComplete = function() {
  3382. console.log("移动完成");
  3383. this.moving = !1;
  3384. this.smokeMc.gotoAndStop("blank");
  3385. for (var b = 0; 6 > b; b++) {
  3386. var a = this.queueItemArr[b];
  3387. a.x = this.stageW / 2;
  3388. a.y = this.itemStartY + b * (2.5 * b + this.space);
  3389. a.scaleX = a.scaleY = (b + 4) / this.bigger
  3390. }
  3391. this.makeNextData();
  3392. this.updateQueue()
  3393. };
  3394. d.prototype.makeNextData =
  3395. function() {
  3396. this.showDataArr.pop();
  3397. if (0 == this.clickYesCount % GameSystem.moneyTimers) this.showDataArr.unshift("mi_5");
  3398. else {
  3399. var b = XiaobinTool.makeRandomFromArr(this.queueFrameArr, this.queueFrameInitArr).toString();
  3400. this.showDataArr.unshift(b)
  3401. }
  3402. };
  3403. d.prototype.onTouchEnd = function(b) {
  3404. this.touchX = b.stageX;
  3405. this.touchY = b.stageY;
  3406. this.leftBtn.scaleX = this.leftBtn.scaleY = 1;
  3407. this.rightBtn.scaleX = this.rightBtn.scaleY = 1
  3408. };
  3409. d.prototype.loop = function(b) {
  3410. 0 < this.clickTime && this.clickTime--;
  3411. 0 < this.shakeTime ? (this.shakeTime--,
  3412. this.queueItemArr[this.queueItemArr.length - 1].x = this.stageW / 2 + (-this.shakeTime / 2 + this.shakeTime * Math.random()), 1 == this.shakeTime && (b = this.queueItemArr.length - 1, this.queueItemArr[b].gotoAndStop("y" + this.showDataArr[b]))) : this.shakeTime = 0
  3413. };
  3414. return d
  3415. }(egret.Sprite);
  3416. InGame.prototype.__class__ = "InGame";
  3417. var __extends = this.__extends || function(c, d) {
  3418. function b() {
  3419. this.constructor = c
  3420. }
  3421. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3422. b.prototype = d.prototype;
  3423. c.prototype = new b
  3424. },
  3425. Info = function(c) {
  3426. function d() {
  3427. c.call(this);
  3428. this.stageH = this.stageW = 0;
  3429. this.homePage = null;
  3430. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  3431. }
  3432. __extends(d, c);
  3433. d.prototype.ats = function(b) {
  3434. b = XiaobinTool.createBitmapByName("infoBg_jpg");
  3435. this.addChild(b);
  3436. this.stageW = this.stage.stageWidth;
  3437. this.stageH = this.stage.stageHeight;
  3438. this.shopPanel =
  3439. new ShopPanel;
  3440. this.addChild(this.shopPanel);
  3441. b = XiaobinTool.createBitmapByName("gold_png");
  3442. this.addChild(b);
  3443. b.x = 20;
  3444. b.y = 10;
  3445. b = new egret.TextField;
  3446. this.addChild(b);
  3447. b.text = GameSystem.curGold.toString();
  3448. b.size = 26;
  3449. b.textColor = 0;
  3450. b.x = 120;
  3451. b.y = 35;
  3452. this.goldTxt = b;
  3453. b = XiaobinTool.createBitmapByName("qiandao_png");
  3454. this.addChild(b);
  3455. b.x = this.stageW - b.width / 2 - 20;
  3456. b.y = b.height / 2 + 20;
  3457. b.touchEnabled = !0;
  3458. b.anchorOffsetX = b.width / 2;
  3459. b.anchorOffsetY = b.height / 2;
  3460. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touch_qiandao, this);
  3461. b.addEventListener(egret.TouchEvent.TOUCH_END, this.touch_end, this);
  3462. null == this.homePage && (this.startBtn = new StartBtn, this.addChild(this.startBtn), this.startBtn.x = (this.stageW - this.startBtn.width) / 2, this.startBtn.y = this.stageH - 150, this.startBtn.touchEnabled = !0, this.startBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this));
  3463. this.touchEnabled = !0;
  3464. this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.touch_stage_end, this);
  3465. this.addEventListener(GameSystem.PAY_SUCCESS, this.updateGold,
  3466. this);
  3467. this.addEventListener(GameSystem.QIAN_SUCCESS, this.updateGold, this)
  3468. };
  3469. d.prototype.updateGold = function(b) {
  3470. this.goldTxt.text = GameSystem.curGold.toString();
  3471. b = GameSystem.curGold.toString();
  3472. // ih5game.storage.set(GameSystem.CUR_GOLD, b, true);
  3473. console.info("保存!总共金币 = " + b)
  3474. };
  3475. d.prototype.touch_addGold = function(b) {};
  3476. d.prototype.onTouchBegin = function(b) {
  3477. b.target.parent && b.target.parent.removeChild(b.target);
  3478. b = new egret.Event("click_start_btn", !0);
  3479. this.dispatchEvent(b)
  3480. };
  3481. d.prototype.touch_qiandao =
  3482. function(b) {
  3483. b.target.scaleX = b.target.scaleY = 0.8
  3484. };
  3485. d.prototype.touch_stage_end = function(b) {
  3486. !1 == GameSystem.showQiandao && (this.shopPanel.visible = !0)
  3487. };
  3488. d.prototype.touch_end = function(b) {
  3489. b.target.scaleX = b.target.scaleY = 1;
  3490. !1 == GameSystem.showQiandao && (GameSystem.showQiandao = !0, this.qiandaoPanel = new QiandaoPanel, this.addChild(this.qiandaoPanel), this.shopPanel.visible = !1)
  3491. };
  3492. d.prototype.loop = function(b) {};
  3493. return d
  3494. }(egret.Sprite);
  3495. Info.prototype.__class__ = "Info";
  3496. var __extends = this.__extends || function(c, d) {
  3497. function b() {
  3498. this.constructor = c
  3499. }
  3500. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3501. b.prototype = d.prototype;
  3502. c.prototype = new b
  3503. },
  3504. LoadingUI = function(c) {
  3505. function d() {
  3506. c.call(this);
  3507. this.createView()
  3508. }
  3509. __extends(d, c);
  3510. d.prototype.createView = function() {
  3511. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3512. RES.loadConfig("resource/resourceGame.json", "resource/");
  3513. this.textField = new egret.TextField
  3514. };
  3515. d.prototype.setProgress = function(b, a) {
  3516. this.textField.text =
  3517. "Loading..." + Math.floor(b / a * 100) + "%";
  3518. this.shape && (this.shape.graphics.beginFill(3355443, 1), this.shape.graphics.drawRect(0, 650, b / a * 480, 10), this.shape.graphics.endFill())
  3519. };
  3520. d.prototype.onConfigComplete = function(b) {
  3521. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3522. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  3523. RES.loadGroup("preloadGame")
  3524. };
  3525. d.prototype.onResourceLoadComplete = function(b) {
  3526. "preloadGame" == b.groupName && (RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE,
  3527. this.onResourceLoadComplete, this), this.createPic(), this.createText(), this.createShape())
  3528. };
  3529. d.prototype.createShape = function() {
  3530. this.shape = new egret.Shape;
  3531. this.addChild(this.shape)
  3532. };
  3533. d.prototype.createText = function() {
  3534. this.addChild(this.textField);
  3535. this.textField.y = 600;
  3536. this.textField.width = 480;
  3537. this.textField.height = 100;
  3538. this.textField.size = 25;
  3539. this.textField.textColor = 3355443;
  3540. this.textField.textAlign = "center"
  3541. };
  3542. d.prototype.createPic = function() {
  3543. this.pic = XiaobinTool.createBitmapByName("homepage_jpg");
  3544. this.addChild(this.pic)
  3545. };
  3546. d.prototype.createMc = function() {
  3547. this.mc = XiaobinTool.creatMovieClip("hero_json", "hero_png", "wait");
  3548. this.addChild(this.mc)
  3549. };
  3550. return d
  3551. }(egret.Sprite);
  3552. LoadingUI.prototype.__class__ = "LoadingUI";
  3553. var __extends = this.__extends || function(c, d) {
  3554. function b() {
  3555. this.constructor = c
  3556. }
  3557. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3558. b.prototype = d.prototype;
  3559. c.prototype = new b
  3560. },
  3561. MainGame = function(c) {
  3562. function d() {
  3563. c.call(this);
  3564. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  3565. }
  3566. __extends(d, c);
  3567. d.prototype.onAddToStage = function(b) {
  3568. this.loadingView = new LoadingUI;
  3569. this.stage.addChild(this.loadingView);
  3570. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3571. RES.loadConfig("resource/resourceGame.json",
  3572. "resource/")
  3573. };
  3574. d.prototype.onConfigComplete = function(b) {
  3575. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3576. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  3577. RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
  3578. RES.loadGroup("preloadGame")
  3579. };
  3580. d.prototype.onResourceLoadComplete = function(b) {
  3581. "preloadGame" == b.groupName && RES.loadGroup("buttons");
  3582. "buttons" == b.groupName && RES.loadGroup("pics");
  3583. "pics" == b.groupName &&
  3584. (this.stage.removeChild(this.loadingView), RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE,
  3585. this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS,
  3586. this.onResourceProgress, this), this.loadData(), this.createGameScene()
  3587. )
  3588. };
  3589. d.prototype.onResourceProgress = function(b) {
  3590. this.loadingView.setProgress(b.itemsLoaded,
  3591. b.itemsTotal)
  3592. };
  3593. d.prototype.loadData = function() {
  3594. var b = GameSystem.CUR_GOLD;
  3595. // console.info("金币 = " + ih5game.storage.get(b));
  3596. // null == ih5game.storage.get(b) ? (GameSystem.curGold = 0, ih5game.storage.set(b, GameSystem.curGold.toString(), true)) : (b = ih5game.storage.get(b), GameSystem.curGold = parseInt(b))
  3597. };
  3598. d.prototype.createGameScene = function() {
  3599. null == this.homepage && (this.homepage = new HomePage);
  3600. this.addChild(this.homepage);
  3601. this.addEventListener("click_start_btn", this.createIngame, this);
  3602. this.addEventListener("click_info_btn", this.createInfo, this);
  3603. this.addEventListener("click_replay_btn", this.doReplay, this);
  3604. this.addEventListener("click_home_btn", this.doHome, this)
  3605. };
  3606. d.prototype.doHome = function() {
  3607. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3608. this.createInfo()
  3609. };
  3610. d.prototype.doReplay = function() {
  3611. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3612. null == this.ingame && (this.ingame = new InGame, this.addChild(this.ingame))
  3613. };
  3614. d.prototype.createIngame = function() {
  3615. console.log("createIngame");
  3616. null != this.homepage && (this.removeChild(this.homepage), this.homepage = null);
  3617. null != this.info && (this.removeChild(this.info), this.info = null);
  3618. null == this.ingame && (this.ingame = new InGame, this.addChild(this.ingame))
  3619. };
  3620. d.prototype.createInfo = function() {
  3621. console.log("createInfo");
  3622. null != this.homepage && (this.removeChild(this.homepage), this.homepage = null);
  3623. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3624. null == this.info && (this.info = new Info, this.addChild(this.info))
  3625. };
  3626. d.prototype.leftOrRightDown = function (code) {
  3627. console.log("leftOrRightDown");
  3628. this.ingame.clickBtnNum = code;
  3629. this.ingame.checkValue();
  3630. };
  3631. return d
  3632. }(egret.DisplayObjectContainer);
  3633. MainGame.prototype.__class__ = "MainGame";