game-min.js 152 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648
  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. };
  3158. d.prototype.creatSmokeMc = function() {
  3159. var b = this.queueItemArr.length -
  3160. 1;
  3161. this.smokeMc = XiaobinTool.creatMovieClip("smoke_json", "smoke_png", "blank");
  3162. this.addChild(this.smokeMc);
  3163. this.smokeMc.x = this.stageW / 2;
  3164. this.smokeMc.y = this.queueItemArr[b].y;
  3165. this.smokeMc.frameRate = 30
  3166. };
  3167. d.prototype.makePowerMc = function() {
  3168. this.powerMc = XiaobinTool.creatMovieClip("powerMc_json", "powerMc_png", "blank");
  3169. this.addChild(this.powerMc);
  3170. this.powerMc.x = this.stageW / 2;
  3171. this.powerMc.y = this.stageH / 2;
  3172. this.powerMc.frameRate = 30
  3173. };
  3174. d.prototype.creatMusic = function() {
  3175. this.bgMusic = RES.getRes("mscNormal");
  3176. this.bgMusic.play();
  3177. this.bgMusic.addEventListener("ended", this.rePlay.bind(this));
  3178. this.wSound = RES.getRes("sndFail");
  3179. this.ySound1 = RES.getRes("sndSucc1");
  3180. this.ySound2 = RES.getRes("sndSucc2");
  3181. this.ySound3 = RES.getRes("sndSucc3");
  3182. this.timeOverSound = RES.getRes("sndOver")
  3183. };
  3184. d.prototype.rePlay = function() {
  3185. this.bgMusic.load();
  3186. this.bgMusic.play()
  3187. };
  3188. d.prototype.creatGameSystemPanel = function() {
  3189. this.gameSystemPanel = new GameSystem;
  3190. this.addChild(this.gameSystemPanel)
  3191. };
  3192. d.prototype.makeTimer = function() {
  3193. this.timer = new egret.Timer(this.moveTime +
  3194. 10, 1);
  3195. this.timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.timerComFunc, this)
  3196. };
  3197. d.prototype.timerComFunc = function() {
  3198. console.log("计时结束");
  3199. this.tweenComplete()
  3200. };
  3201. d.prototype.updateQueue = function() {
  3202. for (var b = 0; 7 > b; b++) this.queueItemArr[b].gotoAndStop(this.showDataArr[b]);
  3203. b = this.queueItemArr.length - 1;
  3204. this.queueItemArr[b].gotoAndStop("y" + this.showDataArr[b])
  3205. };
  3206. d.prototype.makeQueue = function() {
  3207. for (var b = 0; 7 > b; b++) {
  3208. var a = XiaobinTool.makeRandomFromArr(this.queueFrameArr, this.queueFrameInitArr).toString();
  3209. this.showDataArr.push(a)
  3210. }
  3211. console.log("this.showDataArr = " + this.showDataArr);
  3212. 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)
  3213. };
  3214. d.prototype.creatButtons = function() {
  3215. this.leftBtn = XiaobinTool.creatMovieClip("left_btn_json", "left_btn_png", "left_btn_yes");
  3216. this.addChild(this.leftBtn);
  3217. this.leftBtn.x = this.leftBtn.width / 2 + 10;
  3218. this.leftBtn.y = 640;
  3219. this.leftBtn.touchEnabled = !0;
  3220. this.rightBtn = XiaobinTool.creatMovieClip("right_btn_json", "right_btn_png", "right_btn_yes");
  3221. this.addChild(this.rightBtn);
  3222. this.rightBtn.x = this.stageW - this.rightBtn.width / 2 - 10;
  3223. this.rightBtn.y = 640;
  3224. this.rightBtn.touchEnabled = !0
  3225. };
  3226. d.prototype.creatLookItem = function() {
  3227. for (var b = 0; 4 > b; b++) {
  3228. var a = XiaobinTool.creatMovieClip("item_json", "item_png", "blank");
  3229. this.addChild(a);
  3230. switch (b) {
  3231. case 0:
  3232. a.x = 50;
  3233. a.y = 500;
  3234. break;
  3235. case 1:
  3236. a.x = this.stageW - 50;
  3237. a.y = 500;
  3238. break;
  3239. case 2:
  3240. a.x = 50;
  3241. a.y = 300;
  3242. break;
  3243. case 3:
  3244. a.x =
  3245. this.stageW - 50, a.y = 300
  3246. }
  3247. this.itemArr.push(a)
  3248. }
  3249. };
  3250. d.prototype.showItem = function() {
  3251. if (2 == this.curNum) {
  3252. var b = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString(),
  3253. a = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString();
  3254. this.itemArr[0].gotoAndStop(b);
  3255. this.itemArr[1].gotoAndStop(a);
  3256. this.itemArr[0].x += 30;
  3257. this.itemArr[1].x -= 30;
  3258. this.itemArr[0].scaleX = this.itemArr[0].scaleY = 0.8;
  3259. this.itemArr[1].scaleX = this.itemArr[1].scaleY = 0.8;
  3260. this.queueFrameArr.push(b,
  3261. a);
  3262. this.queueFrameInitArr.push(b, a)
  3263. }
  3264. };
  3265. d.prototype.creatBg = function() {
  3266. this.bg = XiaobinTool.createBitmapByName("bg_jpg");
  3267. this.addChild(this.bg)
  3268. };
  3269. d.prototype.makeGameOver = function() {
  3270. GameSystem.getGold = Math.floor(this.gameSystemPanel.scoreNum / 10);
  3271. GameSystem.curGold += Math.floor(this.gameSystemPanel.scoreNum / 10);
  3272. console.log("获得金币:" + GameSystem.getGold);
  3273. var b = GameSystem.curGold.toString();
  3274. egret.localStorage.setItem(GameSystem.CUR_GOLD, b);
  3275. console.info("保存!总共金币 = " +
  3276. b);
  3277. GameSystem.curScore = this.gameSystemPanel.scoreNum;
  3278. b = new GameOverPanel;
  3279. this.addChild(b);
  3280. // 0 < this.gameSystemPanel.scoreNum && ih5game.setScoreWithName(this.gameSystemPanel.scoreNum);
  3281. // ih5game.share();
  3282. // ih5game.setShare({
  3283. // title: "有钱就任性2圣诞版",
  3284. // desc: "圣诞节任性了?,我得到" + this.gameSystemPanel.scoreNum + "分,不想没钱认命的快来挑战!"
  3285. // })
  3286. };
  3287. d.prototype.onTouchBegin = function(b) {
  3288. this.touchX = b.stageX;
  3289. this.touchY = b.stageY;
  3290. if (!0 != this.gameOver && 0 == this.shakeTime && !1 == this.moving)
  3291. if ("mi_5" == this.showDataArr[this.showDataArr.length - 1]) this.doClickYes();
  3292. else if (b.target == this.leftBtn || b.target == this.rightBtn) {
  3293. switch (b.target) {
  3294. case this.leftBtn:
  3295. this.clickBtnNum = 0;
  3296. break;
  3297. case this.rightBtn:
  3298. this.clickBtnNum = 1
  3299. }
  3300. b.target.scaleX = b.target.scaleY = 0.85;
  3301. this.checkValue()
  3302. }
  3303. };
  3304. d.prototype.checkValue = function() {
  3305. var b = this.showDataArr[this.showDataArr.length - 1];
  3306. console.log(b);
  3307. console.log(this.queueFrameInitArr[this.clickBtnNum]);
  3308. b == this.queueFrameInitArr[this.clickBtnNum] ||
  3309. 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]))
  3310. };
  3311. d.prototype.doClickYes = function() {
  3312. 0.3 > Math.random() ? this.ySound1.play() : 0.6 > Math.random() ? this.ySound2.play() : this.ySound3.play();
  3313. !0 == this.inPower ? this.clickYesCount += 2 : this.clickYesCount++;
  3314. !0 == GameSystem.doubleScore && !1 ==
  3315. this.inPower && this.clickYesCount++;
  3316. !0 == GameSystem.superDoubleScore && !0 == this.inPower && (this.clickYesCount += 2);
  3317. !0 == GameSystem.tenScore && 0.2 < Math.random() && !1 == this.inPower && (this.clickYesCount += 9);
  3318. this.gameSystemPanel.scoreNum = 10 * this.clickYesCount;
  3319. this.gameSystemPanel.updateScoreTxt();
  3320. this.powerCount++;
  3321. this.gameSystemPanel.powerContentWidth = 10 * this.powerCount;
  3322. this.gameSystemPanel.setPowerMasker(this.gameSystemPanel.powerContentWidth);
  3323. 180 < this.gameSystemPanel.powerContentWidth && (this.gameSystemPanel.powerContentWidth =
  3324. 0, this.gameSystemPanel.setPowerMasker(this.gameSystemPanel.powerContentWidth), this.powerCount = 0, this.powerTimer.start(), this.inPower = !0, this.powerMc.gotoAndPlay("showPower"));
  3325. this.checkAddItem();
  3326. this.queueItemArr[this.queueItemArr.length - 1].gotoAndStop("blank");
  3327. this.smokeMc.gotoAndPlay("playSmoke");
  3328. 0 < this.clickTime && this.creatCombo();
  3329. this.clickTime = this.fastTime;
  3330. this.makeTween();
  3331. this.moving = !0
  3332. };
  3333. d.prototype.creatCombo = function() {
  3334. var b = XiaobinTool.createBitmapByName("combo_png");
  3335. this.addChild(b);
  3336. b.anchorOffsetX =
  3337. b.width / 2;
  3338. b.x = this.stageW / 2;
  3339. b.y = this.queueItemArr[this.queueItemArr.length - 1].y;
  3340. b.scaleX = b.scaleY = 0.1;
  3341. b.rotation = 0;
  3342. b.alpha = 0;
  3343. egret.Tween.get(b).to({
  3344. y: b.y - 20 * Math.random(),
  3345. scaleX: 1,
  3346. scaleY: 1,
  3347. rotation: -15 + 30 * Math.random(),
  3348. alpha: 1
  3349. }, 300, egret.Ease.backOut).call(this.comboOver, this, [b])
  3350. };
  3351. d.prototype.comboOver = function(b) {
  3352. b.parent && b.parent.removeChild(b)
  3353. };
  3354. d.prototype.checkAddItem = function() {
  3355. if (5 == this.clickYesCount) {
  3356. this.curNum++;
  3357. var b = XiaobinTool.makeRandomFromArr(this.itemFrameArr, this.itemFrameInitArr).toString();
  3358. this.itemArr[2].gotoAndStop(b);
  3359. this.itemArr[2].scaleX = 0.8;
  3360. this.itemArr[2].scaleY = 0.8;
  3361. this.itemArr[2].x += 30;
  3362. this.queueFrameArr.push(b);
  3363. this.queueFrameInitArr.push(b)
  3364. }
  3365. 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))
  3366. };
  3367. d.prototype.makeTween = function() {
  3368. for (var b = 0; 6 >
  3369. b; b++) {
  3370. var a = this.queueItemArr[b + 1];
  3371. egret.Tween.get(this.queueItemArr[b]).to({
  3372. x: a.x,
  3373. y: a.y,
  3374. scaleX: a.scaleX,
  3375. scaleY: a.scaleY
  3376. }, this.moveTime, egret.Ease.backOut);
  3377. this.timer.start()
  3378. }
  3379. };
  3380. d.prototype.tweenComplete = function() {
  3381. console.log("移动完成");
  3382. this.moving = !1;
  3383. this.smokeMc.gotoAndStop("blank");
  3384. for (var b = 0; 6 > b; b++) {
  3385. var a = this.queueItemArr[b];
  3386. a.x = this.stageW / 2;
  3387. a.y = this.itemStartY + b * (2.5 * b + this.space);
  3388. a.scaleX = a.scaleY = (b + 4) / this.bigger
  3389. }
  3390. this.makeNextData();
  3391. this.updateQueue()
  3392. };
  3393. d.prototype.makeNextData =
  3394. function() {
  3395. this.showDataArr.pop();
  3396. if (0 == this.clickYesCount % GameSystem.moneyTimers) this.showDataArr.unshift("mi_5");
  3397. else {
  3398. var b = XiaobinTool.makeRandomFromArr(this.queueFrameArr, this.queueFrameInitArr).toString();
  3399. this.showDataArr.unshift(b)
  3400. }
  3401. };
  3402. d.prototype.onTouchEnd = function(b) {
  3403. this.touchX = b.stageX;
  3404. this.touchY = b.stageY;
  3405. this.leftBtn.scaleX = this.leftBtn.scaleY = 1;
  3406. this.rightBtn.scaleX = this.rightBtn.scaleY = 1
  3407. };
  3408. d.prototype.loop = function(b) {
  3409. 0 < this.clickTime && this.clickTime--;
  3410. 0 < this.shakeTime ? (this.shakeTime--,
  3411. 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
  3412. };
  3413. return d
  3414. }(egret.Sprite);
  3415. InGame.prototype.__class__ = "InGame";
  3416. var __extends = this.__extends || function(c, d) {
  3417. function b() {
  3418. this.constructor = c
  3419. }
  3420. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3421. b.prototype = d.prototype;
  3422. c.prototype = new b
  3423. },
  3424. Info = function(c) {
  3425. function d() {
  3426. c.call(this);
  3427. this.stageH = this.stageW = 0;
  3428. this.homePage = null;
  3429. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.ats, this)
  3430. }
  3431. __extends(d, c);
  3432. d.prototype.ats = function(b) {
  3433. b = XiaobinTool.createBitmapByName("infoBg_jpg");
  3434. this.addChild(b);
  3435. this.stageW = this.stage.stageWidth;
  3436. this.stageH = this.stage.stageHeight;
  3437. this.shopPanel =
  3438. new ShopPanel;
  3439. this.addChild(this.shopPanel);
  3440. b = XiaobinTool.createBitmapByName("gold_png");
  3441. this.addChild(b);
  3442. b.x = 20;
  3443. b.y = 10;
  3444. b = new egret.TextField;
  3445. this.addChild(b);
  3446. b.text = GameSystem.curGold.toString();
  3447. b.size = 26;
  3448. b.textColor = 0;
  3449. b.x = 120;
  3450. b.y = 35;
  3451. this.goldTxt = b;
  3452. b = XiaobinTool.createBitmapByName("qiandao_png");
  3453. this.addChild(b);
  3454. b.x = this.stageW - b.width / 2 - 20;
  3455. b.y = b.height / 2 + 20;
  3456. b.touchEnabled = !0;
  3457. b.anchorOffsetX = b.width / 2;
  3458. b.anchorOffsetY = b.height / 2;
  3459. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touch_qiandao, this);
  3460. b.addEventListener(egret.TouchEvent.TOUCH_END, this.touch_end, this);
  3461. 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));
  3462. this.touchEnabled = !0;
  3463. this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.touch_stage_end, this);
  3464. this.addEventListener(GameSystem.PAY_SUCCESS, this.updateGold,
  3465. this);
  3466. this.addEventListener(GameSystem.QIAN_SUCCESS, this.updateGold, this)
  3467. };
  3468. d.prototype.updateGold = function(b) {
  3469. this.goldTxt.text = GameSystem.curGold.toString();
  3470. b = GameSystem.curGold.toString();
  3471. // ih5game.storage.set(GameSystem.CUR_GOLD, b, true);
  3472. console.info("保存!总共金币 = " + b)
  3473. };
  3474. d.prototype.touch_addGold = function(b) {};
  3475. d.prototype.onTouchBegin = function(b) {
  3476. b.target.parent && b.target.parent.removeChild(b.target);
  3477. b = new egret.Event("click_start_btn", !0);
  3478. this.dispatchEvent(b)
  3479. };
  3480. d.prototype.touch_qiandao =
  3481. function(b) {
  3482. b.target.scaleX = b.target.scaleY = 0.8
  3483. };
  3484. d.prototype.touch_stage_end = function(b) {
  3485. !1 == GameSystem.showQiandao && (this.shopPanel.visible = !0)
  3486. };
  3487. d.prototype.touch_end = function(b) {
  3488. b.target.scaleX = b.target.scaleY = 1;
  3489. !1 == GameSystem.showQiandao && (GameSystem.showQiandao = !0, this.qiandaoPanel = new QiandaoPanel, this.addChild(this.qiandaoPanel), this.shopPanel.visible = !1)
  3490. };
  3491. d.prototype.loop = function(b) {};
  3492. return d
  3493. }(egret.Sprite);
  3494. Info.prototype.__class__ = "Info";
  3495. var __extends = this.__extends || function(c, d) {
  3496. function b() {
  3497. this.constructor = c
  3498. }
  3499. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3500. b.prototype = d.prototype;
  3501. c.prototype = new b
  3502. },
  3503. LoadingUI = function(c) {
  3504. function d() {
  3505. c.call(this);
  3506. this.createView()
  3507. }
  3508. __extends(d, c);
  3509. d.prototype.createView = function() {
  3510. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3511. RES.loadConfig("resource/resourceGame.json", "resource/");
  3512. this.textField = new egret.TextField
  3513. };
  3514. d.prototype.setProgress = function(b, a) {
  3515. this.textField.text =
  3516. "Loading..." + Math.floor(b / a * 100) + "%";
  3517. this.shape && (this.shape.graphics.beginFill(3355443, 1), this.shape.graphics.drawRect(0, 650, b / a * 480, 10), this.shape.graphics.endFill())
  3518. };
  3519. d.prototype.onConfigComplete = function(b) {
  3520. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3521. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  3522. RES.loadGroup("preloadGame")
  3523. };
  3524. d.prototype.onResourceLoadComplete = function(b) {
  3525. "preloadGame" == b.groupName && (RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE,
  3526. this.onResourceLoadComplete, this), this.createPic(), this.createText(), this.createShape())
  3527. };
  3528. d.prototype.createShape = function() {
  3529. this.shape = new egret.Shape;
  3530. this.addChild(this.shape)
  3531. };
  3532. d.prototype.createText = function() {
  3533. this.addChild(this.textField);
  3534. this.textField.y = 600;
  3535. this.textField.width = 480;
  3536. this.textField.height = 100;
  3537. this.textField.size = 25;
  3538. this.textField.textColor = 3355443;
  3539. this.textField.textAlign = "center"
  3540. };
  3541. d.prototype.createPic = function() {
  3542. this.pic = XiaobinTool.createBitmapByName("homepage_jpg");
  3543. this.addChild(this.pic)
  3544. };
  3545. d.prototype.createMc = function() {
  3546. this.mc = XiaobinTool.creatMovieClip("hero_json", "hero_png", "wait");
  3547. this.addChild(this.mc)
  3548. };
  3549. return d
  3550. }(egret.Sprite);
  3551. LoadingUI.prototype.__class__ = "LoadingUI";
  3552. var __extends = this.__extends || function(c, d) {
  3553. function b() {
  3554. this.constructor = c
  3555. }
  3556. for (var a in d) d.hasOwnProperty(a) && (c[a] = d[a]);
  3557. b.prototype = d.prototype;
  3558. c.prototype = new b
  3559. },
  3560. MainGame = function(c) {
  3561. function d() {
  3562. c.call(this);
  3563. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  3564. }
  3565. __extends(d, c);
  3566. d.prototype.onAddToStage = function(b) {
  3567. this.loadingView = new LoadingUI;
  3568. this.stage.addChild(this.loadingView);
  3569. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3570. RES.loadConfig("resource/resourceGame.json",
  3571. "resource/")
  3572. };
  3573. d.prototype.onConfigComplete = function(b) {
  3574. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  3575. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  3576. RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
  3577. RES.loadGroup("preloadGame")
  3578. };
  3579. d.prototype.onResourceLoadComplete = function(b) {
  3580. "preloadGame" == b.groupName && RES.loadGroup("buttons");
  3581. "buttons" == b.groupName && RES.loadGroup("pics");
  3582. "pics" == b.groupName &&
  3583. (this.stage.removeChild(this.loadingView), RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE,
  3584. this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS,
  3585. this.onResourceProgress, this), this.loadData(), this.createGameScene()
  3586. )
  3587. };
  3588. d.prototype.onResourceProgress = function(b) {
  3589. this.loadingView.setProgress(b.itemsLoaded,
  3590. b.itemsTotal)
  3591. };
  3592. d.prototype.loadData = function() {
  3593. var b = GameSystem.CUR_GOLD;
  3594. // console.info("金币 = " + ih5game.storage.get(b));
  3595. // 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))
  3596. };
  3597. d.prototype.createGameScene = function() {
  3598. null == this.homepage && (this.homepage = new HomePage);
  3599. this.addChild(this.homepage);
  3600. this.addEventListener("click_start_btn", this.createIngame, this);
  3601. this.addEventListener("click_info_btn", this.createInfo, this);
  3602. this.addEventListener("click_replay_btn", this.doReplay, this);
  3603. this.addEventListener("click_home_btn", this.doHome, this)
  3604. };
  3605. d.prototype.doHome = function() {
  3606. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3607. this.createInfo()
  3608. };
  3609. d.prototype.doReplay = function() {
  3610. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3611. null == this.ingame && (this.ingame = new InGame, this.addChild(this.ingame))
  3612. };
  3613. d.prototype.createIngame = function() {
  3614. console.log("createIngame");
  3615. null != this.homepage && (this.removeChild(this.homepage), this.homepage = null);
  3616. null != this.info && (this.removeChild(this.info), this.info = null);
  3617. null == this.ingame && (this.ingame = new InGame, this.addChild(this.ingame))
  3618. };
  3619. d.prototype.createInfo = function() {
  3620. console.log("createInfo");
  3621. null != this.homepage && (this.removeChild(this.homepage), this.homepage = null);
  3622. null != this.ingame && (this.removeChild(this.ingame), this.ingame = null);
  3623. null == this.info && (this.info = new Info, this.addChild(this.info))
  3624. };
  3625. d.prototype.leftOrRightDown = function (code) {
  3626. console.log("leftOrRightDown");
  3627. this.ingame.clickBtnNum = code;
  3628. this.ingame.checkValue();
  3629. };
  3630. return d
  3631. }(egret.DisplayObjectContainer);
  3632. MainGame.prototype.__class__ = "MainGame";