123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903 |
- var egret; (function(b) {
- var c = function() {
- function b() {
- this._hashCode = b.hashCount++
- }
- Object.defineProperty(b.prototype, "hashCode", {
- get: function() {
- return this._hashCode
- },
- enumerable: !0,
- configurable: !0
- });
- b.hashCount = 1;
- return b
- } ();
- b.HashObject = c;
- c.prototype.__class__ = "egret.HashObject"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e) {
- "undefined" === typeof e && (e = 300);
- b.call(this);
- this.objectPool = [];
- this._length = 0;
- 1 > e && (e = 1);
- this.autoDisposeTime = e;
- this.frameCount = 0
- }
- __extends(a, b);
- a.prototype._checkFrame = function() {
- this.frameCount--;
- 0 >= this.frameCount && this.dispose()
- };
- Object.defineProperty(a.prototype, "length", {
- get: function() {
- return this._length
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.push = function(e) {
- var g = this.objectPool; - 1 == g.indexOf(e) && (g.push(e), this._length++, 0 == this.frameCount && (this.frameCount = this.autoDisposeTime, a._callBackList.push(this)))
- };
- a.prototype.pop = function() {
- if (0 == this._length) return null;
- this._length--;
- return this.objectPool.pop()
- };
- a.prototype.dispose = function() {
- 0 < this._length && (this.objectPool = [], this._length = 0);
- this.frameCount = 0;
- var e = a._callBackList,
- g = e.indexOf(this); - 1 != g && e.splice(g, 1)
- };
- a._callBackList = [];
- return a
- } (b.HashObject);
- b.Recycler = c;
- c.prototype.__class__ = "egret.Recycler"
- })(egret || (egret = {})); (function(b) {
- b.__START_TIME;
- b.getTimer = function() {
- return Date.now() - b.__START_TIME
- }
- })(egret || (egret = {})); (function(b) {
- b.__callLaterFunctionList = [];
- b.__callLaterThisList = [];
- b.__callLaterArgsList = [];
- b.callLater = function(c, d) {
- for (var a = [], e = 0; e < arguments.length - 2; e++) a[e] = arguments[e + 2];
- b.__callLaterFunctionList.push(c);
- b.__callLaterThisList.push(d);
- b.__callLaterArgsList.push(a)
- }
- })(egret || (egret = {}));
- var egret_dom; (function(b) {
- function c() {
- for (var b = document.createElement("div").style, a = ["t", "webkitT", "msT", "MozT", "OT"], e = 0; e < a.length; e++) if (a[e] + "ransform" in b) return a[e];
- return a[0]
- }
- b.header = "";
- b.getHeader = c;
- b.getTrans = function(d) {
- "" == b.header && (b.header = c());
- return b.header + d.substring(1, d.length)
- }
- })(egret_dom || (egret_dom = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this);
- this._eventPhase = 2;
- this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1;
- this.isNew = !0;
- this._type = e;
- this._bubbles = a;
- this._cancelable = f
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "type", {
- get: function() {
- return this._type
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bubbles", {
- get: function() {
- return this._bubbles
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "cancelable", {
- get: function() {
- return this._cancelable
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "eventPhase", {
- get: function() {
- return this._eventPhase
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "currentTarget", {
- get: function() {
- return this._currentTarget
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setCurrentTarget = function(e) {
- this._currentTarget = e
- };
- Object.defineProperty(a.prototype, "target", {
- get: function() {
- return this._target
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.isDefaultPrevented = function() {
- return this._isDefaultPrevented
- };
- a.prototype.preventDefault = function() {
- this._cancelable && (this._isDefaultPrevented = !0)
- };
- a.prototype.stopPropagation = function() {
- this._bubbles && (this._isPropagationStopped = !0)
- };
- a.prototype.stopImmediatePropagation = function() {
- this._bubbles && (this._isPropagationImmediateStopped = !0)
- };
- a.prototype._reset = function() {
- this.isNew ? this.isNew = !1 : (this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1, this._currentTarget = this._target = null, this._eventPhase = 2)
- };
- a._dispatchByTarget = function(e, a, f, d, c, h) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof h && (h = !1);
- var k = e.eventRecycler;
- k || (k = e.eventRecycler = new b.Recycler);
- var p = k.pop();
- p ? p._type = f: p = new e(f);
- p._bubbles = c;
- p._cancelable = h;
- if (d) for (var n in d) p[n] = d[n],
- null !== p[n] && (d[n] = null);
- e = a.dispatchEvent(p);
- k.push(p);
- return e
- };
- a._getPropertyData = function(e) {
- var a = e._props;
- a || (a = e._props = {});
- return a
- };
- a.dispatchEvent = function(e, g, f, b) {
- "undefined" === typeof f && (f = !1);
- var d = a._getPropertyData(a);
- b && (d.data = b);
- a._dispatchByTarget(a, e, g, d, f)
- };
- a.ADDED_TO_STAGE = "addedToStage";
- a.REMOVED_FROM_STAGE = "removedFromStage";
- a.ADDED = "added";
- a.REMOVED = "removed";
- a.COMPLETE = "complete";
- a.ENTER_FRAME = "enterFrame";
- a.RENDER = "render";
- a.FINISH_RENDER = "finishRender";
- a.FINISH_UPDATE_TRANSFORM = "finishUpdateTransform";
- a.LEAVE_STAGE = "leaveStage";
- a.RESIZE = "resize";
- a.CHANGE = "change";
- return a
- } (b.HashObject);
- b.Event = c;
- c.prototype.__class__ = "egret.Event"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this, e, a, f)
- }
- __extends(a, d);
- a.dispatchIOErrorEvent = function(e) {
- b.Event._dispatchByTarget(a, e, a.IO_ERROR)
- };
- a.IO_ERROR = "ioError";
- return a
- } (b.Event);
- b.IOErrorEvent = c;
- c.prototype.__class__ = "egret.IOErrorEvent"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f, b, c, h, k, p, n, q) {
- "undefined" === typeof a && (a = !0);
- "undefined" === typeof f && (f = !0);
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof h && (h = 0);
- "undefined" === typeof k && (k = !1);
- "undefined" === typeof p && (p = !1);
- "undefined" === typeof q && (q = !1);
- d.call(this, e, a, f);
- this._localY = this._localX = this._stageY = this._stageX = 0;
- this.touchPointID = b;
- this._stageX = c;
- this._stageY = h;
- this.ctrlKey = k;
- this.altKey = p;
- this.touchDown = q
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "stageX", {
- get: function() {
- return this._stageX
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageY", {
- get: function() {
- return this._stageY
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "localX", {
- get: function() {
- return this._localX
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "localY", {
- get: function() {
- return this._localY
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setCurrentTarget = function(e) {
- d.prototype._setCurrentTarget.call(this, e);
- e instanceof b.DisplayObject && (e = e.globalToLocal(this._stageX, this._stageY, b.Point.identity), this._localX = e.x, this._localY = e.y)
- };
- a.dispatchTouchEvent = function(e, g, f, d, c, h, k, p, n) {
- "undefined" === typeof f && (f = 0);
- "undefined" === typeof d && (d = 0);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof h && (h = !1);
- "undefined" === typeof k && (k = !1);
- "undefined" === typeof p && (p = !1);
- "undefined" === typeof n && (n = !1);
- var q = b.Event._getPropertyData(a);
- q.touchPointID = f;
- q._stageX = d;
- q._stageY = c;
- q.ctrlKey = h;
- q.altKey = k;
- q.shiftKey = p;
- q.touchDown = n;
- b.Event._dispatchByTarget(a, e, g, q, !0, !0)
- };
- a.TOUCH_TAP = "touchTap";
- a.TOUCH_MOVE = "touchMove";
- a.TOUCH_BEGIN = "touchBegin";
- a.TOUCH_END = "touchEnd";
- a.TOUCH_RELEASE_OUTSIDE = "touchReleaseOutside";
- a.TOUCH_ROLL_OUT = "touchRollOut";
- a.TOUCH_ROLL_OVER = "touchRollOver";
- a.TOUCH_OUT = "touchOut";
- a.TOUCH_OVER = "touchOver";
- return a
- } (b.Event);
- b.TouchEvent = c;
- c.prototype.__class__ = "egret.TouchEvent"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this, e, a, f)
- }
- __extends(a, d);
- a.dispatchTimerEvent = function(e, g) {
- b.Event._dispatchByTarget(a, e, g)
- };
- a.TIMER = "timer";
- a.TIMER_COMPLETE = "timerComplete";
- return a
- } (b.Event);
- b.TimerEvent = c;
- c.prototype.__class__ = "egret.TimerEvent"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.CAPTURING_PHASE = 1;
- b.AT_TARGET = 2;
- b.BUBBLING_PHASE = 3;
- return b
- } ();
- b.EventPhase = c;
- c.prototype.__class__ = "egret.EventPhase"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e) {
- "undefined" === typeof e && (e = null);
- d.call(this);
- this._eventTarget = e ? e: this
- }
- __extends(a, d);
- a.prototype.addEventListener = function(e, a, f, d, c) {
- "undefined" === typeof d && (d = !1);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof d && (d = !1);
- "undefined" === typeof c && (c = 0);
- a || b.Logger.fatal("addEventListener\u4fa6\u542c\u51fd\u6570\u4e0d\u80fd\u4e3a\u7a7a");
- d ? (this._captureEventsMap || (this._captureEventsMap = {}), d = this._captureEventsMap) : (this._eventsMap || (this._eventsMap = {}), d = this._eventsMap);
- var h = d[e];
- h || (h = d[e] = []);
- this._insertEventBin(h, a, f, c)
- };
- a.prototype._insertEventBin = function(e, a, f, b) {
- for (var d = -1,
- c = e.length,
- k = 0; k < c; k++) {
- var p = e[k];
- if (p.listener === a && p.thisObject === f) return ! 1; - 1 == d && p.priority < b && (d = k)
- }
- a = {
- listener: a,
- thisObject: f,
- priority: b
- }; - 1 != d ? e.splice(d, 0, a) : e.push(a);
- return ! 0
- };
- a.prototype.removeEventListener = function(e, a, f, b) {
- "undefined" === typeof b && (b = !1);
- if (b = b ? this._captureEventsMap: this._eventsMap) {
- var d = b[e];
- d && (this._removeEventBin(d, a, f), 0 == d.length && delete b[e])
- }
- };
- a.prototype._removeEventBin = function(e, a, f) {
- for (var b = e.length,
- d = 0; d < b; d++) {
- var c = e[d];
- if (c.listener === a && c.thisObject === f) return e.splice(d, 1),
- !0
- }
- return ! 1
- };
- a.prototype.hasEventListener = function(e) {
- return this._eventsMap && this._eventsMap[e] || this._captureEventsMap && this._captureEventsMap[e]
- };
- a.prototype.willTrigger = function(e) {
- return this.hasEventListener(e)
- };
- a.prototype.dispatchEvent = function(e) {
- e._reset();
- e._target = this._eventTarget;
- e._setCurrentTarget(this._eventTarget);
- return this._notifyListener(e)
- };
- a.prototype._notifyListener = function(e) {
- var a = 1 == e._eventPhase ? this._captureEventsMap: this._eventsMap;
- if (!a) return ! 0;
- a = a[e.type];
- if (!a) return ! 0;
- for (var a = a.concat(), f = a.length, b = 0; b < f; b++) {
- var d = a[b];
- d.listener.call(d.thisObject, e);
- if (e._isPropagationImmediateStopped) break
- }
- return ! e.isDefaultPrevented()
- };
- a.prototype.dispatchEventWith = function(e, a, f) {
- "undefined" === typeof a && (a = !1);
- b.Event.dispatchEvent(this, e, a, f)
- };
- return a
- } (b.HashObject);
- b.EventDispatcher = c;
- c.prototype.__class__ = "egret.EventDispatcher"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.reuseEvent = new b.Event("")
- }
- __extends(a, d);
- a.prototype.run = function() {
- b.Ticker.getInstance().run();
- b.Ticker.getInstance().register(this.renderLoop, this, Number.NEGATIVE_INFINITY);
- b.Ticker.getInstance().register(this.broadcastEnterFrame, this, Number.POSITIVE_INFINITY);
- this.touchContext.run()
- };
- a.prototype.renderLoop = function(e) {
- if (0 < b.__callLaterFunctionList.length) {
- var a = b.__callLaterFunctionList;
- b.__callLaterFunctionList = [];
- var f = b.__callLaterThisList;
- b.__callLaterThisList = [];
- var d = b.__callLaterArgsList;
- b.__callLaterArgsList = []
- }
- this.dispatchEventWith(b.Event.RENDER);
- b.Stage._invalidateRenderFlag && (this.broadcastRender(), b.Stage._invalidateRenderFlag = !1);
- a && this.doCallLaterList(a, f, d);
- e = this.rendererContext;
- e.onRenderStart();
- e.clearScreen();
- this.stage._updateTransform();
- this.dispatchEventWith(b.Event.FINISH_UPDATE_TRANSFORM);
- this.stage._draw(e);
- this.dispatchEventWith(b.Event.FINISH_RENDER);
- e.onRenderFinish()
- };
- a.prototype.broadcastEnterFrame = function(e) {
- e = this.reuseEvent;
- e._type = b.Event.ENTER_FRAME;
- this.dispatchEvent(e);
- for (var a = b.DisplayObject._enterFrameCallBackList.concat(), f = a.length, d = 0; d < f; d++) {
- var c = a[d];
- e._target = c.display;
- e._setCurrentTarget(c.display);
- c.listener.call(c.thisObject, e)
- }
- a = b.Recycler._callBackList;
- for (d = a.length - 1; 0 <= d; d--) a[d]._checkFrame()
- };
- a.prototype.broadcastRender = function() {
- var e = this.reuseEvent;
- e._type = b.Event.RENDER;
- for (var a = b.DisplayObject._renderCallBackList.concat(), f = a.length, d = 0; d < f; d++) {
- var c = a[d];
- e._target = c.display;
- e._setCurrentTarget(c.display);
- c.listener.call(c.thisObject, e)
- }
- };
- a.prototype.doCallLaterList = function(e, a, f) {
- for (var b = e.length,
- d = 0; d < b; d++) {
- var c = e[d];
- null != c && c.apply(a[d], f[d])
- }
- };
- a.DEVICE_PC = "web";
- a.DEVICE_MOBILE = "native";
- return a
- } (b.EventDispatcher);
- b.MainContext = c;
- c.prototype.__class__ = "egret.MainContext"
- })(egret || (egret = {}));
- var testDeviceType = function() {
- if (!this.navigator) return ! 0;
- var b = navigator.userAgent.toLowerCase();
- return - 1 != b.indexOf("mobile") || -1 != b.indexOf("android")
- };
- egret.MainContext.instance = new egret.MainContext;
- egret.MainContext.deviceType = testDeviceType() ? egret.MainContext.DEVICE_MOBILE: egret.MainContext.DEVICE_PC; (function(b) {
- var c = function() {
- function d() {
- this._tick = this._preDrawCount = this._updateTransformPerformanceCost = this._renderPerformanceCost = this._logicPerformanceCost = this._lastTime = 0;
- this._maxDeltaTime = 500;
- this._totalDeltaTime = 0
- }
- d.getInstance = function() {
- null == d.instance && (d.instance = new d);
- return d.instance
- };
- d.prototype.run = function() {
- b.Ticker.getInstance().register(this.update, this);
- null == this._txt && (this._txt = new b.TextField, this._txt.size = 28, b.MainContext.instance.stage.addChild(this._txt));
- var a = b.MainContext.instance;
- a.addEventListener(b.Event.ENTER_FRAME, this.onEnterFrame, this);
- a.addEventListener(b.Event.RENDER, this.onStartRender, this);
- a.addEventListener(b.Event.FINISH_RENDER, this.onFinishRender, this);
- a.addEventListener(b.Event.FINISH_UPDATE_TRANSFORM, this.onFinishUpdateTransform, this)
- };
- d.prototype.onEnterFrame = function(a) {
- this._lastTime = b.getTimer()
- };
- d.prototype.onStartRender = function(a) {
- a = b.getTimer();
- this._logicPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.onFinishUpdateTransform = function(a) {
- a = b.getTimer();
- this._updateTransformPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.onFinishRender = function(a) {
- a = b.getTimer();
- this._renderPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.update = function(a) {
- this._tick++;
- this._totalDeltaTime += a;
- if (this._totalDeltaTime >= this._maxDeltaTime) {
- a = (this._preDrawCount - 1).toString();
- var e = Math.ceil(this._logicPerformanceCost).toString() + "," + Math.ceil(this._updateTransformPerformanceCost).toString() + "," + Math.ceil(this._renderPerformanceCost).toString() + "," + Math.ceil(b.MainContext.instance.rendererContext.renderCost).toString();
- this._txt.text = "draw:" + a + "\ncost:" + e + "\nFPS:" + Math.floor(1E3 * this._tick / this._totalDeltaTime).toString();
- this._tick = this._totalDeltaTime = 0
- }
- this._preDrawCount = 0
- };
- d.prototype.onDrawImage = function() {
- this._preDrawCount++
- };
- return d
- } ();
- b.Profiler = c;
- c.prototype.__class__ = "egret.Profiler"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.apply(this, arguments);
- this._timeScale = 1;
- this._paused = !1;
- this.callBackList = []
- }
- __extends(a, d);
- a.prototype.run = function() {
- b.__START_TIME = (new Date).getTime();
- b.MainContext.instance.deviceContext.executeMainLoop(this.update, this)
- };
- a.prototype.update = function(e) {
- var a = this.callBackList.concat(),
- f = a.length;
- e *= this._timeScale;
- e *= this._timeScale;
- for (var b = 0; b < f; b++) {
- var d = a[b];
- d.listener.call(d.thisObject, e)
- }
- };
- a.prototype.register = function(e, a, f) {
- "undefined" === typeof f && (f = 0);
- this._insertEventBin(this.callBackList, e, a, f)
- };
- a.prototype.unregister = function(e, a) {
- this._removeEventBin(this.callBackList, e, a)
- };
- a.prototype.setTimeout = function(e, a, f) {
- for (var d = [], c = 0; c < arguments.length - 3; c++) d[c] = arguments[c + 3];
- b.Logger.warning("Ticker#setTimeout\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03,\u8bf7\u4f7f\u7528egret.setTimeout");
- b.setTimeout.apply(null, [e, a, f].concat(d))
- };
- a.prototype.setTimeScale = function(e) {
- this._timeScale = e
- };
- a.prototype.getTimeScale = function() {
- return this._timeScale
- };
- a.prototype.pause = function() {
- this._paused = !0
- };
- a.prototype.resume = function() {
- this._paused = !1
- };
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- return a
- } (b.EventDispatcher);
- b.Ticker = c;
- c.prototype.__class__ = "egret.Ticker"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.LEFT = "left";
- b.RIGHT = "right";
- b.CENTER = "center";
- b.JUSTIFY = "justify";
- b.CONTENT_JUSTIFY = "contentJustify";
- return b
- } ();
- b.HorizontalAlign = c;
- c.prototype.__class__ = "egret.HorizontalAlign"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.TOP = "top";
- b.BOTTOM = "bottom";
- b.MIDDLE = "middle";
- b.JUSTIFY = "justify";
- b.CONTENT_JUSTIFY = "contentJustify";
- return b
- } ();
- b.VerticalAlign = c;
- c.prototype.__class__ = "egret.VerticalAlign"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a) {
- "undefined" === typeof a && (a = 0);
- d.call(this);
- this._currentCount = 0;
- this.delay = e;
- this.repeatCount = a
- }
- __extends(a, d);
- a.prototype.currentCount = function() {
- return this._currentCount
- };
- Object.defineProperty(a.prototype, "running", {
- get: function() {
- return this._running
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.reset = function() {
- this.stop();
- this._currentCount = 0
- };
- a.prototype.start = function() {
- this._running || (this.lastTime = b.getTimer(), 0 != this._currentCount && (this._currentCount = 0), b.Ticker.getInstance().register(this.onEnterFrame, this), this._running = !0)
- };
- a.prototype.stop = function() {
- this._running && (b.Ticker.getInstance().unregister(this.onEnterFrame, this), this._running = !1)
- };
- a.prototype.onEnterFrame = function(e) {
- e = b.getTimer();
- e - this.lastTime > this.delay && (this.lastTime = e, this._currentCount++, b.TimerEvent.dispatchTimerEvent(this, b.TimerEvent.TIMER), 0 < this.repeatCount && this._currentCount >= this.repeatCount && (this.stop(), b.TimerEvent.dispatchTimerEvent(this, b.TimerEvent.TIMER_COMPLETE)))
- };
- return a
- } (b.EventDispatcher);
- b.Timer = c;
- c.prototype.__class__ = "egret.Timer"
- })(egret || (egret = {})); (function(b) {
- b.getQualifiedClassName = function(b) {
- b = b.prototype ? b.prototype: b.__proto__;
- if (b.hasOwnProperty("__class__")) return b.__class__;
- var d = b.constructor.toString(),
- a = d.indexOf("("),
- d = d.substring(9, a);
- return b.__class__ = d
- }
- })(egret || (egret = {})); (function(b) {
- var c = {};
- b.getDefinitionByName = function(b) {
- if (!b) return null;
- var a = c[b];
- if (a) return a;
- for (var e = b.split("."), g = e.length, a = __global, f = 0; f < g; f++) if (a = a[e[f]], !a) return null;
- return c[b] = a
- }
- })(egret || (egret = {}));
- var __global = __global || this; (function(b) {
- function c(e) {
- for (var a in d) {
- var f = d[a];
- f.delay -= e;
- 0 >= f.delay && (f.listener.apply(f.thisObject, f.params), delete d[a])
- }
- }
- var d = {},
- a = 0;
- b.setTimeout = function(e, g, f) {
- for (var m = [], l = 0; l < arguments.length - 3; l++) m[l] = arguments[l + 3];
- m = {
- listener: e,
- thisObject: g,
- delay: f,
- params: m
- };
- 0 == a && b.Ticker.getInstance().register(c, null);
- a++;
- d[a] = m;
- return a
- };
- b.clearTimeout = function(e) {
- delete d[e]
- }
- })(egret || (egret = {})); (function(b) {
- b.hasDefinition = function(c) {
- return b.getDefinitionByName(c) ? !0 : !1
- }
- })(egret || (egret = {})); (function(b) {
- b.toColorString = function(b) {
- if (isNaN(b) || 0 > b) b = 0;
- 16777215 < b && (b = 16777215);
- for (b = b.toString(16).toUpperCase(); 6 > b.length;) b = "0" + b;
- return "#" + b
- }
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, b, c, l, h) {
- "undefined" === typeof e && (e = 1);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof c && (c = 1);
- "undefined" === typeof l && (l = 0);
- "undefined" === typeof h && (h = 0);
- d.call(this);
- this.a = e;
- this.b = a;
- this.c = b;
- this.d = c;
- this.tx = l;
- this.ty = h
- }
- __extends(a, d);
- a.prototype.prepend = function(e, a, b, d, c, h) {
- var k = this.tx;
- if (1 != e || 0 != a || 0 != b || 1 != d) {
- var p = this.a,
- n = this.c;
- this.a = p * e + this.b * b;
- this.b = p * a + this.b * d;
- this.c = n * e + this.d * b;
- this.d = n * a + this.d * d
- }
- this.tx = k * e + this.ty * b + c;
- this.ty = k * a + this.ty * d + h;
- return this
- };
- a.prototype.append = function(e, a, b, d, c, h) {
- var k = this.a,
- p = this.b,
- n = this.c,
- q = this.d;
- this.a = e * k + a * n;
- this.b = e * p + a * q;
- this.c = b * k + d * n;
- this.d = b * p + d * q;
- this.tx = c * k + h * n + this.tx;
- this.ty = c * p + h * q + this.ty;
- return this
- };
- a.prototype.prependMatrix = function(e) {
- this.prepend(e.a, e.b, e.c, e.d, e.tx, e.ty);
- return this
- };
- a.prototype.appendMatrix = function(e) {
- this.append(e.a, e.b, e.c, e.d, e.tx, e.ty);
- return this
- };
- a.prototype.prependTransform = function(e, g, b, d, c, h, k, p, n) {
- if (c % 360) {
- var q = c * a.DEG_TO_RAD;
- c = Math.cos(q);
- q = Math.sin(q)
- } else c = 1,
- q = 0;
- if (p || n) this.tx -= p,
- this.ty -= n;
- h || k ? (h *= a.DEG_TO_RAD, k *= a.DEG_TO_RAD, this.prepend(c * b, q * b, -q * d, c * d, 0, 0), this.prepend(Math.cos(k), Math.sin(k), -Math.sin(h), Math.cos(h), e, g)) : this.prepend(c * b, q * b, -q * d, c * d, e, g);
- return this
- };
- a.prototype.appendTransform = function(e, g, b, d, c, h, k, p, n) {
- if (c % 360) {
- var q = c * a.DEG_TO_RAD;
- c = Math.cos(q);
- q = Math.sin(q)
- } else c = 1,
- q = 0;
- h || k ? (h *= a.DEG_TO_RAD, k *= a.DEG_TO_RAD, this.append(Math.cos(k), Math.sin(k), -Math.sin(h), Math.cos(h), e, g), this.append(c * b, q * b, -q * d, c * d, 0, 0)) : this.append(c * b, q * b, -q * d, c * d, e, g);
- if (p || n) this.tx -= p * this.a + n * this.c,
- this.ty -= p * this.b + n * this.d;
- return this
- };
- a.prototype.rotate = function(e) {
- var a = Math.cos(e);
- e = Math.sin(e);
- var b = this.a,
- d = this.c,
- c = this.tx;
- this.a = b * a - this.b * e;
- this.b = b * e + this.b * a;
- this.c = d * a - this.d * e;
- this.d = d * e + this.d * a;
- this.tx = c * a - this.ty * e;
- this.ty = c * e + this.ty * a;
- return this
- };
- a.prototype.skew = function(e, g) {
- e *= a.DEG_TO_RAD;
- g *= a.DEG_TO_RAD;
- this.append(Math.cos(g), Math.sin(g), -Math.sin(e), Math.cos(e), 0, 0);
- return this
- };
- a.prototype.scale = function(e, a) {
- this.a *= e;
- this.d *= a;
- this.c *= e;
- this.b *= a;
- this.tx *= e;
- this.ty *= a;
- return this
- };
- a.prototype.translate = function(e, a) {
- this.tx += e;
- this.ty += a;
- return this
- };
- a.prototype.identity = function() {
- this.a = this.d = 1;
- this.b = this.c = this.tx = this.ty = 0;
- return this
- };
- a.prototype.invert = function() {
- var e = this.a,
- a = this.b,
- b = this.c,
- d = this.d,
- c = this.tx,
- h = e * d - a * b;
- this.a = d / h;
- this.b = -a / h;
- this.c = -b / h;
- this.d = e / h;
- this.tx = (b * this.ty - d * c) / h;
- this.ty = -(e * this.ty - a * c) / h;
- return this
- };
- a.transformCoords = function(e, a, f) {
- var d = b.Point.identity;
- d.x = e.a * a + e.c * f + e.tx;
- d.y = e.d * f + e.b * a + e.ty;
- return d
- };
- a.prototype.toArray = function(e) {
- this.array || (this.array = new Float32Array(9));
- e ? (this.array[0] = this.a, this.array[1] = this.b, this.array[2] = 0, this.array[3] = this.c, this.array[4] = this.d, this.array[5] = 0, this.array[6] = this.tx, this.array[7] = this.ty) : (this.array[0] = this.a, this.array[1] = this.b, this.array[2] = this.tx, this.array[3] = this.c, this.array[4] = this.d, this.array[5] = this.ty, this.array[6] = 0, this.array[7] = 0);
- this.array[8] = 1;
- return this.array
- };
- a.identity = new a;
- a.DEG_TO_RAD = Math.PI / 180;
- return a
- } (b.HashObject);
- b.Matrix = c;
- c.prototype.__class__ = "egret.Matrix"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e, a) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- b.call(this);
- this.x = e;
- this.y = a
- }
- __extends(a, b);
- a.prototype.clone = function() {
- return new a(this.x, this.y)
- };
- a.prototype.equals = function(e) {
- return this.x == e.x && this.y == e.y
- };
- a.distance = function(e, a) {
- return Math.sqrt((e.x - a.x) * (e.x - a.x) + (e.y - a.y) * (e.y - a.y))
- };
- a.identity = new a(0, 0);
- return a
- } (b.HashObject);
- b.Point = c;
- c.prototype.__class__ = "egret.Point"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e, a, f, c) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof f && (f = 0);
- "undefined" === typeof c && (c = 0);
- b.call(this);
- this.x = e;
- this.y = a;
- this.width = f;
- this.height = c
- }
- __extends(a, b);
- Object.defineProperty(a.prototype, "right", {
- get: function() {
- return this.x + this.width
- },
- set: function(e) {
- this.width = e - this.x
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bottom", {
- get: function() {
- return this.y + this.height
- },
- set: function(e) {
- this.height = e - this.y
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.initialize = function(e, a, b, d) {
- this.x = e;
- this.y = a;
- this.width = b;
- this.height = d;
- return this
- };
- a.prototype.contains = function(e, a) {
- return this.x <= e && this.x + this.width >= e && this.y <= a && this.y + this.height >= a
- };
- a.prototype.intersects = function(e) {
- return this.contains(e.x, e.y) || this.contains(e.x, e.bottom) || this.contains(e.right, e.y) || this.contains(e.right, e.bottom) ? !0 : !1
- };
- a.prototype.clone = function() {
- return new a(this.x, this.y, this.width, this.height)
- };
- a.prototype.containsPoint = function(e) {
- return this.x < e.x && this.x + this.width > e.x && this.y < e.y && this.y + this.height > e.y ? !0 : !1
- };
- a.identity = new a(0, 0, 0, 0);
- return a
- } (b.HashObject);
- b.Rectangle = c;
- c.prototype.__class__ = "egret.Rectangle"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.fatal = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Fatal", a, e);
- throw Error(b.Logger.getTraceCode("Fatal", a, e));
- };
- d.info = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Info", a, e)
- };
- d.warning = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Warning", a, e)
- };
- d.traceToConsole = function(a, e, g) {
- console.log(b.Logger.getTraceCode(a, e, g))
- };
- d.getTraceCode = function(a, e, g) {
- return "[" + a + "]" + e + ":" + (null == g ? "": g)
- };
- return d
- } ();
- b.Logger = c;
- c.prototype.__class__ = "egret.Logger"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._isSupportDOMParser = this._xmlDict = this._parser = null;
- this._xmlDict = {};
- window.DOMParser ? (this._isSupportDOMParser = !0, this._parser = new DOMParser) : this._isSupportDOMParser = !1
- }
- __extends(a, d);
- a.getInstance = function() {
- a._instance || (a._instance = new a);
- return a._instance
- };
- a.prototype.parserXML = function(e) {
- for (var a = 0;
- "\n" == e.charAt(a) || "\t" == e.charAt(a) || "\r" == e.charAt(a) || " " == e.charAt(a);) a++;
- 0 != a && (e = e.substring(a, e.length));
- this._isSupportDOMParser ? a = this._parser.parseFromString(e, "text/xml") : (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(e));
- null == a && b.Logger.info("xml not found!");
- return a
- };
- a._instance = null;
- return a
- } (b.HashObject);
- b.SAXParser = c;
- c.prototype.__class__ = "egret.SAXParser"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(e) {
- function g() {
- e.call(this);
- this._designHeight = this._designWidth = 0;
- this._scaleY = this._scaleX = 1;
- var a = document.getElementById(g.canvas_name),
- b = a.height;
- this._designWidth = a.width;
- this._designHeight = b
- }
- __extends(g, e);
- g.getInstance = function() {
- null == g.instance && (a.initialize(), g.instance = new g);
- return g.instance
- };
- g.prototype.setDesignSize = function(e, a, g) {
- this._designWidth = e;
- this._designHeight = a;
- g && (b.Logger.warning("\u8be5\u65b9\u6cd5\u76ee\u524d\u4e0d\u5e94\u4f20\u5165 resolutionPolicy \u53c2\u6570\uff0c\u8bf7\u5728 docs/1.0_Final_ReleaseNote\u4e2d\u67e5\u770b\u5982\u4f55\u5347\u7ea7"), this._setResolutionPolicy(g))
- };
- g.prototype._setResolutionPolicy = function(e) {
- this._resolutionPolicy = e;
- e.init(this);
- e._apply(this, this._designWidth, this._designHeight)
- };
- g.prototype.getScaleX = function() {
- return this._scaleX
- };
- g.prototype.getScaleY = function() {
- return this._scaleY
- };
- g.canvas_name = "gameCanvas";
- g.canvas_div_name = "gameDiv";
- return g
- } (b.HashObject);
- b.StageDelegate = c;
- c.prototype.__class__ = "egret.StageDelegate";
- var d = function() {
- function e(a, g) {
- this._containerStrategy = a;
- this._contentStrategy = g
- }
- e.prototype.init = function(e) {
- this._containerStrategy.init(e);
- this._contentStrategy.init(e)
- };
- e.prototype._apply = function(e, a, g) {
- this._containerStrategy._apply(e, a, g);
- this._contentStrategy._apply(e, a, g)
- };
- return e
- } ();
- b.ResolutionPolicy = d;
- d.prototype.__class__ = "egret.ResolutionPolicy";
- var a = function() {
- function a() {}
- a.initialize = function() {
- a.EQUAL_TO_FRAME = new e
- };
- a.prototype.init = function(e) {};
- a.prototype._apply = function(e, a, g) {};
- a.prototype._setupContainer = function() {
- var e = document.body,
- a;
- e && (a = e.style) && (a.paddingTop = a.paddingTop || "0px", a.paddingRight = a.paddingRight || "0px", a.paddingBottom = a.paddingBottom || "0px", a.paddingLeft = a.paddingLeft || "0px", a.borderTop = a.borderTop || "0px", a.borderRight = a.borderRight || "0px", a.borderBottom = a.borderBottom || "0px", a.borderLeft = a.borderLeft || "0px", a.marginTop = a.marginTop || "0px", a.marginRight = a.marginRight || "0px", a.marginBottom = a.marginBottom || "0px", a.marginLeft = a.marginLeft || "0px")
- };
- return a
- } ();
- b.ContainerStrategy = a;
- a.prototype.__class__ = "egret.ContainerStrategy";
- var e = function(e) {
- function a() {
- e.apply(this, arguments)
- }
- __extends(a, e);
- a.prototype._apply = function(e) {
- this._setupContainer()
- };
- return a
- } (a);
- b.EqualToFrame = e;
- e.prototype.__class__ = "egret.EqualToFrame";
- d = function() {
- function e() {}
- e.prototype.init = function(e) {};
- e.prototype._apply = function(e, a, g) {};
- return e
- } ();
- b.ContentStrategy = d;
- d.prototype.__class__ = "egret.ContentStrategy";
- var g = function(e) {
- function a(g) {
- "undefined" === typeof g && (g = 0);
- e.call(this);
- this.minWidth = g
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- a = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = document.documentElement.clientWidth,
- d = document.documentElement.clientHeight,
- m = d / g,
- r = f / m,
- s = 1;
- 0 != this.minWidth && (s = Math.min(1, r / this.minWidth));
- a.width = r / s;
- a.height = g;
- a.style.width = f + "px";
- a.style.height = d * s + "px";
- b.style.width = f + "px";
- b.style.height = d * s + "px";
- e._scaleX = m * s;
- e._scaleY = m * s
- };
- return a
- } (d);
- b.FixedHeight = g;
- g.prototype.__class__ = "egret.FixedHeight";
- g = function(e) {
- function a(g) {
- "undefined" === typeof g && (g = 0);
- e.call(this);
- this.minHeight = g
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- g = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = document.documentElement.clientWidth,
- d = document.documentElement.clientHeight,
- m = f / a,
- r = d / m,
- s = 1;
- 0 != this.minHeight && (s = Math.min(1, r / this.minHeight));
- g.width = a;
- g.height = r / s;
- g.style.width = f * s + "px";
- g.style.height = d + "px";
- b.style.width = f * s + "px";
- b.style.height = d + "px";
- e._scaleX = m * s;
- e._scaleY = m * s
- };
- return a
- } (d);
- b.FixedWidth = g;
- g.prototype.__class__ = "egret.FixedWidth";
- g = function(e) {
- function a(g, b) {
- e.call(this);
- this.width = g;
- this.height = b
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- g = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = this.width,
- d = this.height,
- m = f / a;
- g.width = a;
- g.height = d / m;
- g.style.width = f + "px";
- g.style.height = d + "px";
- b.style.width = f + "px";
- b.style.height = d + "px";
- e._scaleX = m;
- e._scaleY = m
- };
- return a
- } (d);
- b.FixedSize = g;
- g.prototype.__class__ = "egret.FixedSize";
- g = function(e) {
- function a() {
- e.call(this)
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- a = document.getElementById(c.canvas_name);
- a.style.width = a.width + "px";
- a.style.height = a.height + "px";
- e._scaleX = 1;
- e._scaleY = 1
- };
- return a
- } (d);
- b.NoScale = g;
- g.prototype.__class__ = "egret.NoScale";
- d = function(e) {
- function a() {
- e.call(this)
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- var b = document.getElementById(c.canvas_name),
- f = document.getElementById(c.canvas_div_name),
- d = document.documentElement.clientWidth,
- m = document.documentElement.clientHeight,
- r = d / a < m / g ? d / a: m / g,
- d = a * r,
- m = g * r;
- b.width = a;
- b.height = g / 1;
- b.style.width = 1 * d + "px";
- b.style.height = m + "px";
- b.style.top = Math.floor((document.documentElement.clientHeight - m) / 2) + "px";
- f.style.width = 1 * d + "px";
- f.style.height = m + "px";
- e._scaleX = 1 * r;
- e._scaleY = 1 * r
- };
- return a
- } (d);
- b.ShowAll = d;
- d.prototype.__class__ = "egret.ShowAll"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._originalData = {};
- this._drawAreaList = []
- }
- __extends(a, d);
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- a.prototype.addDrawArea = function(e) {
- this._drawAreaList.push(e)
- };
- a.prototype.clearDrawArea = function() {
- this._drawAreaList = []
- };
- a.prototype.drawImage = function(e, a, f, d, c, h, k, p, n, q) {
- k = k || 0;
- p = p || 0;
- var t = a._texture_to_render;
- if (null != t && 0 != h && 0 != c && 0 != n && 0 != q) if (a._worldBounds) {
- var r = this._originalData;
- r.sourceX = f;
- r.sourceY = d;
- r.sourceWidth = c;
- r.sourceHeight = h;
- r.destX = k;
- r.destY = p;
- r.destWidth = n;
- r.destHeight = q;
- for (var s = this.getDrawAreaList(), u = 0; u < s.length; u++) {
- var v = s[u];
- if (!this.ignoreRender(a, v, r.destX, r.destY)) {
- if (0 != this._drawAreaList.length) if (0 != a._worldTransform.b || 0 != a._worldTransform.c) {
- if (a._worldBounds.x + r.destX < v.x || a._worldBounds.y + r.destY < v.y || a._worldBounds.x + a._worldBounds.width + r.destX > v.x + v.width || a._worldBounds.y + a._worldBounds.height + r.destY > v.y + v.height) {
- b.Logger.fatal("\u8bf7\u4e0d\u8981\u8ba9\u5e26\u6709\u65cb\u8f6c\u548c\u659c\u5207\u7684\u663e\u793a\u5bf9\u8c61\u8de8\u8fc7\u91cd\u7ed8\u533a\u57df");
- break
- }
- } else {
- var x = a._worldTransform.a,
- y = a._worldTransform.d,
- w;
- a._worldBounds.x + r.destX < v.x && (w = (v.x - a._worldBounds.x) / x - r.destX, f += w / (n / c), c -= w / (n / c), n -= w, k += w);
- a._worldBounds.y + r.destY < v.y && (w = (v.y - a._worldBounds.y) / y - r.destY, d += w / (q / h), h -= w / (q / h), q -= w, p += w);
- a._worldBounds.x + a._worldBounds.width + r.destX > v.x + v.width && (w = (a._worldBounds.x + a._worldBounds.width - v.x - v.width) / x + r.destX, c -= w / (n / c), n -= w);
- a._worldBounds.y + a._worldBounds.height + r.destY > v.y + v.height && (w = (a._worldBounds.y + a._worldBounds.height - v.y - v.height) / y + r.destY, h -= w / (q / h), q -= w)
- }
- e.drawImage(t, f, d, c, h, k, p, n, q)
- }
- }
- } else e.drawImage(t, f, d, c, h, k, p, n, q)
- };
- a.prototype.ignoreRender = function(e, a, b, d) {
- var c = e._worldBounds;
- b *= e._worldTransform.a;
- d *= e._worldTransform.d;
- return c.x + c.width + b <= a.x || c.x + b >= a.x + a.width || c.y + c.height + d <= a.y || c.y + d >= a.y + a.height ? !0 : !1
- };
- a.prototype.getDrawAreaList = function() {
- var e;
- 0 == this._drawAreaList.length ? (this._defaultDrawAreaList || (this._defaultDrawAreaList = [new b.Rectangle(0, 0, b.MainContext.instance.stage.stageWidth, b.MainContext.instance.stage.stageHeight)]), e = this._defaultDrawAreaList) : e = this._drawAreaList;
- return e
- };
- return a
- } (b.HashObject);
- b.RenderFilter = c;
- c.prototype.__class__ = "egret.RenderFilter"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.mapClass = function(a, e, g) {
- "undefined" === typeof g && (g = "");
- a = this.getKey(a) + "#" + g;
- this.mapClassDic[a] = e
- };
- d.getKey = function(a) {
- return "string" == typeof a ? a: b.getQualifiedClassName(a)
- };
- d.mapValue = function(a, e, g) {
- "undefined" === typeof g && (g = "");
- a = this.getKey(a) + "#" + g;
- this.mapValueDic[a] = e
- };
- d.hasMapRule = function(a, e) {
- "undefined" === typeof e && (e = "");
- var g = this.getKey(a) + "#" + e;
- return this.mapValueDic[g] || this.mapClassDic[g] ? !0 : !1
- };
- d.getInstance = function(a, e) {
- "undefined" === typeof e && (e = "");
- var g = this.getKey(a) + "#" + e;
- if (this.mapValueDic[g]) return this.mapValueDic[g];
- var b = this.mapClassDic[g];
- if (b) return b = new b,
- this.mapValueDic[g] = b,
- delete this.mapClassDic[g],
- b;
- throw Error("\u8c03\u7528\u4e86\u672a\u914d\u7f6e\u7684\u6ce8\u5165\u89c4\u5219:" + g + "\u3002 \u8bf7\u5148\u5728\u9879\u76ee\u521d\u59cb\u5316\u91cc\u914d\u7f6e\u6307\u5b9a\u7684\u6ce8\u5165\u89c4\u5219\uff0c\u518d\u8c03\u7528\u5bf9\u5e94\u5355\u4f8b\u3002");
- };
- d.mapClassDic = {};
- d.mapValueDic = {};
- return d
- } ();
- b.Injector = c;
- c.prototype.__class__ = "egret.Injector"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.NORMAL = "normal";
- b.ADD = "add";
- b.LAYER = "layer";
- return b
- } ();
- b.BlendMode = c;
- c.prototype.__class__ = "egret.BlendMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._sizeDirty = this._normalDirty = !0;
- this._parent = null;
- this._cacheAsBitmap = !1;
- this._y = this._x = 0;
- this._scaleY = this._scaleX = 1;
- this._anchorY = this._anchorX = this._anchorOffsetY = this._anchorOffsetX = 0;
- this._visible = !0;
- this._rotation = 0;
- this._alpha = 1;
- this._skewY = this._skewX = 0;
- this._hasHeightSet = this._hasWidthSet = !1;
- this.worldAlpha = 1;
- this._rectH = this._rectW = 0;
- this._stage = null;
- this._worldTransform = new b.Matrix;
- this._cacheBounds = new b.Rectangle(0, 0, 0, 0)
- }
- __extends(a, d);
- a.prototype._setDirty = function() {
- this._normalDirty = !0
- };
- a.prototype.getDirty = function() {
- return this._normalDirty || this._sizeDirty
- };
- a.prototype._setParentSizeDirty = function() { ! this.parent || this.parent._hasWidthSet || this.parent._hasHeightSet || this.parent._setSizeDirty()
- };
- a.prototype._setSizeDirty = function() {
- this._sizeDirty || (this._sizeDirty = !0, this._setDirty(), this._setParentSizeDirty())
- };
- a.prototype._clearDirty = function() {
- this._normalDirty = !1
- };
- a.prototype._clearSizeDirty = function() {
- this._sizeDirty = !1
- };
- Object.defineProperty(a.prototype, "parent", {
- get: function() {
- return this._parent
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._parentChanged = function(e) {
- this._parent = e
- };
- Object.defineProperty(a.prototype, "x", {
- get: function() {
- return this._x
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._x = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "y", {
- get: function() {
- return this._y
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._y = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scaleX", {
- get: function() {
- return this._scaleX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._scaleX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scaleY", {
- get: function() {
- return this._scaleY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._scaleY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorOffsetX", {
- get: function() {
- return this._anchorOffsetX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorOffsetX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorOffsetY", {
- get: function() {
- return this._anchorOffsetY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorOffsetY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorX", {
- get: function() {
- return this._anchorX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorY", {
- get: function() {
- return this._anchorY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "visible", {
- get: function() {
- return this._visible
- },
- set: function(e) {
- this._visible = e;
- this._setSizeDirty()
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "rotation", {
- get: function() {
- return this._rotation
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._rotation = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "alpha", {
- get: function() {
- return this._alpha
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._alpha = e, this._setDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "skewX", {
- get: function() {
- return this._skewX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._skewX = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "skewY", {
- get: function() {
- return this._skewY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._skewY = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "touchEnabled", {
- get: function() {
- return this._touchEnabled
- },
- set: function(e) {
- this._touchEnabled = e
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scrollRect", {
- get: function() {
- return this._scrollRect
- },
- set: function(e) {
- this._scrollRect = e;
- this._setSizeDirty()
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "measuredWidth", {
- get: function() {
- return this._measureBounds().width
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "measuredHeight", {
- get: function() {
- return this._measureBounds().height
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "explicitWidth", {
- get: function() {
- return this._explicitWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "explicitHeight", {
- get: function() {
- return this._explicitHeight
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "width", {
- get: function() {
- return this._getSize(b.Rectangle.identity).width
- },
- set: function(e) {
- this._setWidth(e)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "height", {
- get: function() {
- return this._getSize(b.Rectangle.identity).height
- },
- set: function(e) {
- this._setHeight(e)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setWidth = function(e) {
- this._setSizeDirty();
- this._explicitWidth = e;
- this._hasWidthSet = b.NumberUtils.isNumber(e)
- };
- a.prototype._setHeight = function(e) {
- this._setSizeDirty();
- this._explicitHeight = e;
- this._hasHeightSet = b.NumberUtils.isNumber(e)
- };
- a.prototype._draw = function(e) {
- if (this.visible && !this.drawCacheTexture(e)) {
- e.setAlpha(this.worldAlpha, this.blendMode);
- e.setTransform(this._worldTransform);
- var a = this.mask || this._scrollRect;
- a && e.pushMask(a);
- this._render(e);
- a && e.popMask()
- }
- this.destroyCacheBounds()
- };
- a.prototype.drawCacheTexture = function(e) {
- if (this._cacheAsBitmap) {
- var a = this._texture_to_render,
- f = a._offsetX,
- d = a._offsetY,
- c = a._textureWidth,
- a = a._textureHeight;
- this._updateTransform();
- e.setAlpha(this.worldAlpha, this.blendMode);
- e.setTransform(this._worldTransform);
- var h = b.MainContext.instance.rendererContext.texture_scale_factor;
- b.RenderFilter.getInstance().drawImage(e, this, 0, 0, c * h, a * h, f, d, c, a);
- return ! 0
- }
- return ! 1
- };
- a.prototype._updateTransform = function() {
- this._worldTransform.identity().appendMatrix(this._parent._worldTransform);
- var e = this._getOffsetPoint();
- this._worldTransform.appendTransform(this._x, this._y, this._scaleX, this._scaleY, this._rotation, this._skewX, this._skewY, e.x, e.y);
- this._scrollRect && this._worldTransform.append(1, 0, 0, 1, -this._scrollRect.x, -this._scrollRect.y);
- this.worldAlpha = this._parent.worldAlpha * this._alpha
- };
- a.prototype._render = function(e) {};
- a.prototype.getBounds = function(e) {
- var a = this._measureBounds(),
- f = this._hasWidthSet ? this._explicitWidth: a.width,
- d = this._hasHeightSet ? this._explicitHeight: a.height,
- c = a.x,
- a = a.y,
- h,
- k;
- 0 != this._anchorX || 0 != this._anchorY ? (h = f * this._anchorX, k = d * this._anchorY) : (h = this._anchorOffsetX, k = this._anchorOffsetY);
- this._cacheBounds.initialize(c - h, a - k, f, d);
- f = this._cacheBounds;
- e || (e = new b.Rectangle);
- return e.initialize(f.x, f.y, f.width, f.height)
- };
- a.prototype.destroyCacheBounds = function() {
- this._cacheBounds.x = 0;
- this._cacheBounds.y = 0;
- this._cacheBounds.width = 0;
- this._cacheBounds.height = 0
- };
- a.prototype._getConcatenatedMatrix = function() {
- for (var e = a.identityMatrixForGetConcatenated.identity(), g = this; null != g;) {
- if (0 != g._anchorX || 0 != g._anchorY) {
- var f = g._getSize(b.Rectangle.identity);
- e.prependTransform(g._x, g._y, g._scaleX, g._scaleY, g._rotation, g._skewX, g._skewY, f.width * g._anchorX, f.height * g._anchorY)
- } else e.prependTransform(g._x, g._y, g._scaleX, g._scaleY, g._rotation, g._skewX, g._skewY, g._anchorOffsetX, g._anchorOffsetY);
- g = g._parent
- }
- return e
- };
- a.prototype.localToGlobal = function(e, a, f) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- var d = this._getConcatenatedMatrix();
- d.append(1, 0, 0, 1, e, a);
- f || (f = new b.Point);
- f.x = d.tx;
- f.y = d.ty;
- return f
- };
- a.prototype.globalToLocal = function(e, a, f) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- var d = this._getConcatenatedMatrix();
- d.invert();
- d.append(1, 0, 0, 1, e, a);
- f || (f = new b.Point);
- f.x = d.tx;
- f.y = d.ty;
- return f
- };
- a.prototype.hitTest = function(e, a, f) {
- "undefined" === typeof f && (f = !1);
- if (!this.visible || !f && !this._touchEnabled) return null;
- f = this._getSize(b.Rectangle.identity);
- return 0 <= e && e < f.width && 0 <= a && a < f.height ? this.mask || this._scrollRect ? this._scrollRect && e < this._scrollRect.width && a < this._scrollRect.height || this.mask && this.mask.x <= e && e < this.mask.x + this.mask.width && this.mask.y <= a && a < this.mask.y + this.mask.height ? this: null: this: null
- };
- a.prototype.hitTestPoint = function(e, a, f) {
- e = this.globalToLocal(e, a);
- return f ? (this._hitTestPointTexture || (this._hitTestPointTexture = new b.RenderTexture), f = this._hitTestPointTexture, f.drawToTexture(this), 0 != f.getPixel32(e.x - this._hitTestPointTexture._offsetX, e.y - this._hitTestPointTexture._offsetY)[3] ? !0 : !1) : !!this.hitTest(e.x, e.y, !0)
- };
- a.prototype._getMatrix = function() {
- var e = b.Matrix.identity.identity(),
- a = this._getOffsetPoint();
- e.appendTransform(this._x, this._y, this._scaleX, this._scaleY, this._rotation, this._skewX, this._skewY, a.x, a.y);
- return e
- };
- a.prototype._getSize = function(e) {
- return this._hasHeightSet && this._hasWidthSet ? e.initialize(0, 0, this._explicitWidth, this._explicitHeight) : this._measureSize(b.Rectangle.identity)
- };
- a.prototype._measureSize = function(e) {
- this._sizeDirty ? (e = this._measureBounds(), this._rectW = e.width, this._rectH = e.height, this._clearSizeDirty()) : (e.width = this._rectW, e.height = this._rectH);
- return e
- };
- a.prototype._measureBounds = function() {
- return b.Rectangle.identity.initialize(0, 0, 0, 0)
- };
- a.prototype._getOffsetPoint = function() {
- var e = this._anchorOffsetX,
- a = this._anchorOffsetY;
- if (0 != this._anchorX || 0 != this._anchorY) a = this._getSize(b.Rectangle.identity),
- e = this._anchorX * a.width,
- a = this._anchorY * a.height;
- var f = b.Point.identity;
- f.x = e;
- f.y = a;
- return f
- };
- a.prototype._onAddToStage = function() {
- this._stage = b.MainContext.instance.stage;
- b.DisplayObjectContainer.__EVENT__ADD_TO_STAGE_LIST.push(this)
- };
- a.prototype._onRemoveFromStage = function() {
- this._stage = null;
- b.DisplayObjectContainer.__EVENT__REMOVE_FROM_STAGE_LIST.push(this)
- };
- Object.defineProperty(a.prototype, "stage", {
- get: function() {
- return this._stage
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.addEventListener = function(e, g, f, c, l) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof l && (l = 0);
- d.prototype.addEventListener.call(this, e, g, f, c, l); ((c = e == b.Event.ENTER_FRAME) || e == b.Event.RENDER) && this._insertEventBin(c ? a._enterFrameCallBackList: a._renderCallBackList, g, f, l)
- };
- a.prototype.removeEventListener = function(e, g, f, c) {
- "undefined" === typeof c && (c = !1);
- d.prototype.removeEventListener.call(this, e, g, f, c); ((c = e == b.Event.ENTER_FRAME) || e == b.Event.RENDER) && this._removeEventBin(c ? a._enterFrameCallBackList: a._renderCallBackList, g, f)
- };
- a.prototype.dispatchEvent = function(e) {
- if (!e._bubbles) return d.prototype.dispatchEvent.call(this, e);
- for (var a = [], b = this; b;) a.unshift(b),
- b = b.parent;
- for (var c = a.length,
- b = c - 1,
- c = c - 2; 0 <= c; c--) a.push(a[c]);
- e._reset();
- this._dispatchPropagationEvent(e, a, b);
- return ! e.isDefaultPrevented()
- };
- a.prototype._dispatchPropagationEvent = function(e, a, b) {
- for (var d = a.length,
- c = 0; c < d; c++) {
- var h = a[c];
- e._setCurrentTarget(h);
- e._target = this;
- e._eventPhase = c < b ? 1 : c == b ? 2 : 3;
- h._notifyListener(e);
- if (e._isPropagationStopped || e._isPropagationImmediateStopped) break
- }
- };
- a.prototype.willTrigger = function(e) {
- for (var a = this; a;) {
- if (a.hasEventListener(e)) return ! 0;
- a = a._parent
- }
- return ! 1
- };
- Object.defineProperty(a.prototype, "cacheAsBitmap", {
- get: function() {
- return this._cacheAsBitmap
- },
- set: function(e) { (this._cacheAsBitmap = e) ? (this.renderTexture || (this.renderTexture = new b.RenderTexture), this.renderTexture.drawToTexture(this), this._texture_to_render = this.renderTexture) : this._texture_to_render = null
- },
- enumerable: !0,
- configurable: !0
- });
- a.getTransformBounds = function(e, a) {
- var b, d, c = e.width,
- h = e.height,
- k = c * a.a,
- c = c * a.b,
- p = h * a.c,
- h = h * a.d,
- n = a.tx,
- q = a.ty,
- t = n,
- r = n,
- s = q,
- u = q; (b = k + n) < t ? t = b: b > r && (r = b); (b = k + p + n) < t ? t = b: b > r && (r = b); (b = p + n) < t ? t = b: b > r && (r = b); (d = c + q) < s ? s = d: d > u && (u = d); (d = c + h + q) < s ? s = d: d > u && (u = d); (d = h + q) < s ? s = d: d > u && (u = d);
- return e.initialize(t, s, r - t, u - s)
- };
- a.identityMatrixForGetConcatenated = new b.Matrix;
- a._enterFrameCallBackList = [];
- a._renderCallBackList = [];
- return a
- } (b.EventDispatcher);
- b.DisplayObject = c;
- c.prototype.__class__ = "egret.DisplayObject"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._touchChildren = !0;
- this._children = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "touchChildren", {
- get: function() {
- return this._touchChildren
- },
- set: function(e) {
- this._touchChildren = e
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "numChildren", {
- get: function() {
- return this._children.length
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.setChildIndex = function(e, a) {
- this.doSetChildIndex(e, a)
- };
- a.prototype.doSetChildIndex = function(e, a) {
- var f = this._children.indexOf(e);
- 0 > f && b.Logger.fatal("child\u4e0d\u5728\u5f53\u524d\u5bb9\u5668\u5185");
- this._children.splice(f, 1);
- 0 > a || this._children.length <= a ? this._children.push(e) : this._children.splice(a, 0, e)
- };
- a.prototype.addChild = function(e) {
- var a = this.numChildren;
- e._parent == this && a--;
- return this._doAddChild(e, a)
- };
- a.prototype.addChildAt = function(e, a) {
- return this._doAddChild(e, a)
- };
- a.prototype._doAddChild = function(e, g, f) {
- "undefined" === typeof f && (f = !0);
- if (e == this) return e;
- if (0 > g || g > this._children.length) return b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4"),
- e;
- var d = e.parent;
- if (d == this) return this.doSetChildIndex(e, g),
- e;
- d && d.removeChild(e);
- this._children.splice(g, 0, e);
- e._parentChanged(this);
- f && e.dispatchEventWith(b.Event.ADDED, !0);
- if (this._stage) for (e._onAddToStage(), g = a.__EVENT__ADD_TO_STAGE_LIST; 0 < g.length;) g.shift().dispatchEventWith(b.Event.ADDED_TO_STAGE);
- e._setDirty();
- this._setSizeDirty();
- return e
- };
- a.prototype.removeChild = function(e) {
- e = this._children.indexOf(e);
- if (0 <= e) return this._doRemoveChild(e);
- b.Logger.fatal("child\u672a\u88abaddChild\u5230\u8be5parent");
- return null
- };
- a.prototype.removeChildAt = function(e) {
- if (0 <= e && e < this._children.length) return this._doRemoveChild(e);
- b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4");
- return null
- };
- a.prototype._doRemoveChild = function(e, g) {
- "undefined" === typeof g && (g = !0);
- var f = this._children,
- d = f[e];
- g && d.dispatchEventWith(b.Event.REMOVED, !0);
- if (this._stage) {
- d._onRemoveFromStage();
- for (var c = a.__EVENT__REMOVE_FROM_STAGE_LIST; 0 < c.length;) c.shift().dispatchEventWith(b.Event.REMOVED_FROM_STAGE)
- }
- d._parentChanged(null);
- f.splice(e, 1);
- this._setSizeDirty();
- return d
- };
- a.prototype.getChildAt = function(e) {
- if (0 <= e && e < this._children.length) return this._children[e];
- b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4");
- return null
- };
- a.prototype.contains = function(e) {
- for (; e;) {
- if (e == this) return ! 0;
- e = e._parent
- }
- return ! 1
- };
- a.prototype.swapChildrenAt = function(e, a) {
- 0 <= e && e < this._children.length && 0 <= a && a < this._children.length ? this._swapChildrenAt(e, a) : b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4")
- };
- a.prototype.swapChildren = function(e, a) {
- var f = this._children.indexOf(e),
- d = this._children.indexOf(a); - 1 == f || -1 == d ? b.Logger.fatal("child\u672a\u88abaddChild\u5230\u8be5parent") : this._swapChildrenAt(f, d)
- };
- a.prototype._swapChildrenAt = function(e, a) {
- if (e != a) {
- var b = this._children,
- d = b[e];
- b[e] = b[a];
- b[a] = d
- }
- };
- a.prototype.getChildIndex = function(e) {
- return this._children.indexOf(e)
- };
- a.prototype.removeChildren = function() {
- for (var e = this._children.length - 1; 0 <= e; e--) this._doRemoveChild(e)
- };
- a.prototype._updateTransform = function() {
- if (this.visible) {
- d.prototype._updateTransform.call(this);
- for (var e = 0,
- a = this._children.length; e < a; e++) this._children[e]._updateTransform()
- }
- };
- a.prototype._render = function(e) {
- for (var a = 0,
- b = this._children.length; a < b; a++) this._children[a]._draw(e)
- };
- a.prototype._measureBounds = function() {
- for (var e = 0,
- a = 0,
- f = 0,
- d = 0,
- c = this._children.length,
- h = 0; h < c; h++) {
- var k = this._children[h],
- p;
- if (k.visible && (p = b.DisplayObject.getTransformBounds(k._getSize(b.Rectangle.identity), k._getMatrix()))) {
- var k = p.x,
- n = p.y,
- q = p.width + p.x,
- t = p.height + p.y;
- if (k < e || 0 == h) e = k;
- if (q > a || 0 == h) a = q;
- if (n < f || 0 == h) f = n;
- if (t > d || 0 == h) d = t
- }
- }
- return b.Rectangle.identity.initialize(e, f, a - e, d - f)
- };
- a.prototype.hitTest = function(e, a, f) {
- "undefined" === typeof f && (f = !1);
- var c;
- if (!this.visible) return null;
- if (this._scrollRect) {
- if (0 > e || 0 > a || e > this._scrollRect.width || a > this._scrollRect.height) return null
- } else if (this.mask && (this.mask.x > e || e > this.mask.x + this.mask.width || this.mask.y > a || a > this.mask.y + this.mask.height)) return null;
- for (var l = this._children,
- h = this._touchChildren,
- k = l.length - 1; 0 <= k; k--) {
- var p = l[k],
- n = p,
- q = n._getOffsetPoint(),
- t = n._x,
- r = n._y;
- this._scrollRect && (t -= this._scrollRect.x, r -= this._scrollRect.y);
- n = b.Matrix.identity.identity().prependTransform(t, r, n._scaleX, n._scaleY, n._rotation, 0, 0, q.x, q.y);
- n.invert();
- n = b.Matrix.transformCoords(n, e, a);
- if (p = p.hitTest(n.x, n.y, !0)) {
- if (p._touchEnabled && h) return p;
- if (this._touchEnabled) return this;
- null == c && (c = p)
- }
- }
- return c ? c: d.prototype.hitTest.call(this, e, a, f)
- };
- a.prototype._onAddToStage = function() {
- d.prototype._onAddToStage.call(this);
- for (var e = this.numChildren,
- a = 0; a < e; a++) this._children[a]._onAddToStage()
- };
- a.prototype._onRemoveFromStage = function() {
- d.prototype._onRemoveFromStage.call(this);
- for (var e = this.numChildren,
- a = 0; a < e; a++) this._children[a]._onRemoveFromStage()
- };
- a.prototype.getChildByName = function(e) {
- for (var a = this._children,
- b = this.numChildren,
- d, c = 0; c < b; c++) if (d = a[c], d.name == e) return d;
- return null
- };
- a.__EVENT__ADD_TO_STAGE_LIST = [];
- a.__EVENT__REMOVE_FROM_STAGE_LIST = [];
- return a
- } (b.DisplayObject);
- b.DisplayObjectContainer = c;
- c.prototype.__class__ = "egret.DisplayObjectContainer"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a) {
- "undefined" === typeof e && (e = 480);
- "undefined" === typeof a && (a = 800);
- d.call(this);
- this.touchEnabled = !0;
- this._stage = this;
- this._stageWidth = e;
- this._stageHeight = a
- }
- __extends(a, d);
- a.prototype.invalidate = function() {
- a._invalidateRenderFlag = !0
- };
- Object.defineProperty(a.prototype, "scaleMode", {
- get: function() {
- return this._scaleMode
- },
- set: function(e) {
- if (this._scaleMode != e) {
- this._scaleMode = e;
- var a = {};
- a[b.StageScaleMode.NO_SCALE] = new b.NoScale;
- a[b.StageScaleMode.SHOW_ALL] = new b.ShowAll;
- a[b.StageScaleMode.NO_BORDER] = new b.FixedWidth;
- e = a[e];
- if (!e) throw Error("\u4f7f\u7528\u4e86\u5c1a\u672a\u5b9e\u73b0\u7684ScaleMode");
- a = new b.EqualToFrame;
- e = new b.ResolutionPolicy(a, e);
- b.StageDelegate.getInstance()._setResolutionPolicy(e);
- e = document.getElementById(b.StageDelegate.canvas_name);
- this._stageWidth = e.width;
- this._stageHeight = e.height;
- this.dispatchEventWith(b.Event.RESIZE)
- }
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageWidth", {
- get: function() {
- return this._stageWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageHeight", {
- get: function() {
- return this._stageHeight
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.hitTest = function(a, g) {
- if (!this.touchEnabled) return null;
- var f;
- if (!this.visible) return this;
- for (var d = this._children,
- c = d.length - 1; 0 <= c; c--) {
- var h = f = d[c],
- k = h._getOffsetPoint(),
- h = b.Matrix.identity.identity().prependTransform(h.x, h.y, h.scaleX, h.scaleY, h.rotation, 0, 0, k.x, k.y);
- h.invert();
- h = b.Matrix.transformCoords(h, a, g);
- if ((f = f.hitTest(h.x, h.y, !0)) && f.touchEnabled) return f
- }
- return this
- };
- a.prototype.getBounds = function(a) {
- a || (a = new b.Rectangle);
- return a.initialize(0, 0, this._stageWidth, this._stageHeight)
- };
- a.prototype._updateTransform = function() {
- for (var a = 0,
- g = this._children.length; a < g; a++) this._children[a]._updateTransform()
- };
- a._invalidateRenderFlag = !1;
- return a
- } (b.DisplayObjectContainer);
- b.Stage = c;
- c.prototype.__class__ = "egret.Stage"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.NO_BORDER = "noBorder";
- b.NO_SCALE = "noScale";
- b.SHOW_ALL = "showAll";
- return b
- } ();
- b.StageScaleMode = c;
- c.prototype.__class__ = "egret.StageScaleMode"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.REPEAT = "repeat";
- b.SCALE = "scale";
- return b
- } ();
- b.BitmapFillMode = c;
- c.prototype.__class__ = "egret.BitmapFillMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- d.call(this);
- this.debug = !1;
- this.debugColor = 16711680;
- this.fillMode = "scale";
- a && (this._texture = a, this._setSizeDirty())
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "texture", {
- get: function() {
- return this._texture
- },
- set: function(a) {
- a != this._texture && (this._setSizeDirty(), this._texture = a)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(e) {
- var b = this._texture;
- b ? (this._texture_to_render = b, a._drawBitmap(e, this._hasWidthSet ? this._explicitWidth: b._textureWidth, this._hasHeightSet ? this._explicitHeight: b._textureHeight, this)) : this._texture_to_render = null
- };
- a._drawBitmap = function(e, g, f, d) {
- var c = d._texture_to_render;
- if (c) {
- var h = c._textureWidth,
- k = c._textureHeight;
- if ("scale" == d.fillMode) {
- var p = d.scale9Grid || c.scale9Grid;
- if (p && h - p.width < g && k - p.height < f) a.drawScale9GridImage(e, d, p, g, f);
- else {
- var p = c._offsetX,
- n = c._offsetY,
- q = c._bitmapWidth || h,
- t = c._bitmapHeight || k;
- g /= h;
- p = Math.round(p * g);
- g = Math.round(q * g);
- f /= k;
- n = Math.round(n * f);
- f = Math.round(t * f);
- b.RenderFilter.getInstance().drawImage(e, d, c._bitmapX, c._bitmapY, q, t, p, n, g, f)
- }
- } else a.drawRepeatImage(e, d, g, f)
- }
- };
- a.drawRepeatImage = function(a, g, f, d) {
- var c = g._texture_to_render;
- if (c) for (var h = c._textureWidth,
- k = c._textureHeight,
- p = c._bitmapX,
- n = c._bitmapY,
- q = c._bitmapWidth || h,
- t = c._bitmapHeight || k,
- r = c._offsetX,
- c = c._offsetY,
- s = b.RenderFilter.getInstance(); r < f; r += h) for (var u = c; u < d; u += k) {
- var v = Math.min(q, f - r),
- x = Math.min(t, d - u);
- s.drawImage(a, g, p, n, v, x, r, u, v, x)
- }
- };
- a.drawScale9GridImage = function(a, g, f, d, c) {
- var h = g._texture_to_render;
- if (h && f) {
- var k = b.RenderFilter.getInstance(),
- p = h._textureWidth,
- n = h._textureHeight,
- q = h._bitmapX,
- t = h._bitmapY,
- r = h._bitmapWidth || p,
- s = h._bitmapHeight || n,
- u = h._offsetX,
- h = h._offsetY;
- f = b.Rectangle.identity.initialize(f.x - Math.round(u), f.y - Math.round(u), f.width, f.height);
- u = Math.round(u);
- h = Math.round(h);
- d -= p - r;
- c -= n - s;
- f.y == f.bottom && (f.bottom < s ? f.bottom++:f.y--);
- f.x == f.right && (f.right < r ? f.right++:f.x--);
- var p = q + f.x,
- n = q + f.right,
- v = r - f.right,
- x = t + f.y,
- y = t + f.bottom,
- w = s - f.bottom,
- z = u + f.x,
- A = h + f.y,
- s = c - (s - f.bottom),
- r = d - (r - f.right);
- k.drawImage(a, g, q, t, f.x, f.y, u, h, f.x, f.y);
- k.drawImage(a, g, p, t, f.width, f.y, z, h, r - f.x, f.y);
- k.drawImage(a, g, n, t, v, f.y, u + r, h, d - r, f.y);
- k.drawImage(a, g, q, x, f.x, f.height, u, A, f.x, s - f.y);
- k.drawImage(a, g, p, x, f.width, f.height, z, A, r - f.x, s - f.y);
- k.drawImage(a, g, n, x, v, f.height, u + r, A, d - r, s - f.y);
- k.drawImage(a, g, q, y, f.x, w, u, h + s, f.x, c - s);
- k.drawImage(a, g, p, y, f.width, w, z, h + s, r - f.x, c - s);
- k.drawImage(a, g, n, y, v, w, u + r, h + s, d - r, c - s)
- }
- };
- a.prototype._measureBounds = function() {
- var a = this._texture;
- return a ? b.Rectangle.identity.initialize(a._offsetX, a._offsetY, a._textureWidth, a._textureHeight) : d.prototype._measureBounds.call(this)
- };
- a.debug = !1;
- return a
- } (b.DisplayObject);
- b.Bitmap = c;
- c.prototype.__class__ = "egret.Bitmap"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._text = "";
- this._textChanged = !1;
- this._bitmapPool = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "text", {
- get: function() {
- return this._text
- },
- set: function(a) {
- this._textChanged = !0;
- this._text = a
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._updateTransform = function() {
- this.visible && (this._textChanged && this._renderText(), d.prototype._updateTransform.call(this))
- };
- a.prototype._renderText = function(a) {
- var g = a = 0;
- this._textChanged && this.removeChildren();
- for (var f = 0,
- d = this.text.length; f < d; f++) {
- var c = this.text.charAt(f),
- h = this.spriteSheet.getTexture(c);
- if (null == h) console.log("\u5f53\u524d\u6ca1\u6709\u4f4d\u56fe\u6587\u5b57\uff1a" + c);
- else {
- var c = h._offsetX,
- k = h._offsetY,
- p = h._textureWidth;
- if (this._textChanged) {
- var n = this._bitmapPool[f];
- n || (n = new b.Bitmap, this._bitmapPool.push(n));
- n.texture = h;
- this.addChild(n);
- n.x = a
- }
- a += p + c;
- k + h._textureHeight > g && (g = k + h._textureHeight)
- }
- }
- this._textChanged = !1;
- return b.Rectangle.identity.initialize(0, 0, a, g)
- };
- a.prototype._measureBounds = function() {
- return this._renderText(!0)
- };
- return a
- } (b.DisplayObjectContainer);
- b.BitmapText = c;
- c.prototype.__class__ = "egret.BitmapText"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {
- this.commandQueue = []
- }
- b.prototype.beginFill = function(a, e) {};
- b.prototype._setStyle = function(a) {};
- b.prototype.drawRect = function(a, e, b, f) {};
- b.prototype.drawCircle = function(a, e, b) {};
- b.prototype.drawRoundRect = function(a, e, b, f, d, c) {};
- b.prototype.drawEllipse = function(a, e, b, f) {};
- b.prototype.lineStyle = function(a, e, b, f, d, c, h, k) {};
- b.prototype.lineTo = function(a, e) {};
- b.prototype.curveTo = function(a, e, b, f) {};
- b.prototype.moveTo = function(a, e) {};
- b.prototype.clear = function() {};
- b.prototype.endFill = function() {};
- b.prototype._draw = function(a) {};
- return b
- } ();
- b.Graphics = c;
- c.prototype.__class__ = "egret.Graphics"; (function() {
- return function(b, a, e) {
- this.method = b;
- this.thisObject = a;
- this.args = e
- }
- })().prototype.__class__ = "Command"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this)
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "graphics", {
- get: function() {
- this._graphics || (this._graphics = new b.Graphics);
- return this._graphics
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this._graphics && this._graphics._draw(a)
- };
- return a
- } (b.DisplayObject);
- b.Shape = c;
- c.prototype.__class__ = "egret.Shape"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this)
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "graphics", {
- get: function() {
- this._graphics || (this._graphics = new b.Graphics);
- return this._graphics
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this._graphics && this._graphics._draw(a);
- d.prototype._render.call(this, a)
- };
- return a
- } (b.DisplayObjectContainer);
- b.Sprite = c;
- c.prototype.__class__ = "egret.Sprite"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._fontFamily = "Arial";
- this._size = 30;
- this._textColorString = "#FFFFFF";
- this._textColor = 16777215;
- this._strokeColorString = "#000000";
- this._stroke = this._strokeColor = 0;
- this._textAlign = "left";
- this._verticalAlign = "top";
- this._numLines = this._lineSpacing = 0;
- this.measuredWidths = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "text", {
- get: function() {
- return this._text
- },
- set: function(a) {
- this._text != a && (this._setTextDirty(), this._text = a)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setTextDirty = function() {
- this._setSizeDirty()
- };
- Object.defineProperty(a.prototype, "fontFamily", {
- get: function() {
- return this._fontFamily
- },
- set: function(a) {
- this._fontFamily != a && (this._setTextDirty(), this._fontFamily = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "size", {
- get: function() {
- return this._size
- },
- set: function(a) {
- this._size != a && (this._setTextDirty(), this._size = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "italic", {
- get: function() {
- return this._italic
- },
- set: function(a) {
- this._italic != a && (this._setTextDirty(), this._italic = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bold", {
- get: function() {
- return this._bold
- },
- set: function(a) {
- this._bold != a && (this._setTextDirty(), this._bold = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textColor", {
- get: function() {
- return this._textColor
- },
- set: function(a) {
- this._textColor != a && (this._setTextDirty(), this._textColor = a, this._textColorString = b.toColorString(a))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "strokeColor", {
- get: function() {
- return this._strokeColor
- },
- set: function(a) {
- this._strokeColor != a && (this._setTextDirty(), this._strokeColor = a, this._strokeColorString = b.toColorString(a))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stroke", {
- get: function() {
- return this._stroke
- },
- set: function(a) {
- this._stroke != a && (this._setTextDirty(), this._stroke = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textAlign", {
- get: function() {
- return this._textAlign
- },
- set: function(a) {
- this._textAlign != a && (this._setTextDirty(), this._textAlign = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "verticalAlign", {
- get: function() {
- return this._verticalAlign
- },
- set: function(a) {
- this._verticalAlign != a && (this._setTextDirty(), this._verticalAlign = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "lineSpacing", {
- get: function() {
- return this._lineSpacing
- },
- set: function(a) {
- this._lineSpacing != a && (this._setTextDirty(), this._lineSpacing = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "numLines", {
- get: function() {
- return this._numLines
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this.drawText(a, !1);
- this._clearDirty()
- };
- a.prototype._measureBounds = function() {
- return this.drawText(b.MainContext.instance.rendererContext, !0)
- };
- a.prototype.drawText = function(a, g) {
- var f = this.getTextLines(a);
- if (!f) return b.Rectangle.identity.initialize(0, 0, 0, 0);
- var d = f.length,
- c = 0.5 * this._size,
- h = this._size + this._lineSpacing,
- k = d * h - this._lineSpacing;
- this._textHeight = k;
- var p = this._hasHeightSet ? this._explicitHeight: Number.POSITIVE_INFINITY;
- if (this._hasHeightSet && k < p) {
- var n = 0;
- this._verticalAlign == b.VerticalAlign.MIDDLE ? n = 0.5 : this._verticalAlign == b.VerticalAlign.BOTTOM && (n = 1);
- c += n * (p - k)
- }
- var n = c = Math.round(c),
- q = 0;
- this._textAlign == b.HorizontalAlign.CENTER ? q = 0.5 : this._textAlign == b.HorizontalAlign.RIGHT && (q = 1);
- var t = this.measuredWidths,
- r;
- r = this._hasWidthSet ? this._explicitWidth: this._textWidth;
- for (var s = Number.POSITIVE_INFINITY,
- u = 0; u < d; u++) {
- var v = f[u],
- x = Math.round((r - t[u]) * q);
- x < s && (s = x); ! g && c < p && a.drawText(this, v, x, c, r);
- c += h
- }
- return b.Rectangle.identity.initialize(s, n, r, k)
- };
- a.prototype.getTextLines = function(a) {
- var b = this.text ? this.text.toString() : "";
- if (!b) return null;
- var f = this.measuredWidths;
- f.length = 0;
- a.setupFont(this);
- var b = b.split(/(?:\r\n|\r|\n)/),
- d = b.length,
- c = 0;
- if (this._hasWidthSet) for (var h = this._explicitWidth,
- k = 0; k < d; k++) {
- var p = b[k],
- n = a.measureText(p);
- if (n > h) {
- for (var q = "",
- t = 0,
- r = p.length,
- s = 0; s < r; s++) {
- var u = p.charAt(s),
- n = a.measureText(u);
- t + n > h && (0 == t ? (b.splice(k, 0, u), f[k] = n, c < n && (c = n), n = 0, u = "") : (b.splice(k, 0, q), f[k] = t, c < t && (c = t), q = "", t = 0), k++, d++);
- t += n;
- q += u
- }
- b[k] = q;
- f[k] = t
- } else f[k] = n,
- c < n && (c = n)
- } else for (k = 0; k < d; k++) p = b[k],
- n = a.measureText(p),
- f[k] = n,
- c < n && (c = n);
- this._textWidth = c;
- return b
- };
- return a
- } (b.DisplayObject);
- b.TextField = c;
- c.prototype.__class__ = "egret.TextField"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.DYNAMIC = "dynamic";
- b.INPUT = "input";
- return b
- } ();
- b.TextFieldType = c;
- c.prototype.__class__ = "egret.TextFieldType"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- d.call(this);
- var b = a.bitmapData;
- this.bitmapData = b;
- this._textureMap = {};
- this._sourceWidth = b.width;
- this._sourceHeight = b.height;
- this._bitmapX = a._bitmapX - a._offsetX;
- this._bitmapY = a._bitmapY - a._offsetY
- }
- __extends(a, d);
- a.prototype.getTexture = function(a) {
- return this._textureMap[a]
- };
- a.prototype.createTexture = function(a, g, f, d, c, h, k, p, n) {
- "undefined" === typeof h && (h = 0);
- "undefined" === typeof k && (k = 0);
- "undefined" === typeof p && (p = h + d);
- "undefined" === typeof n && (n = k + c);
- var q = new b.Texture;
- q._bitmapData = this.bitmapData;
- q._bitmapX = this._bitmapX + g;
- q._bitmapY = this._bitmapY + f;
- q._bitmapWidth = d;
- q._bitmapHeight = c;
- q._offsetX = h;
- q._offsetY = k;
- q._textureWidth = p;
- q._textureHeight = n;
- q._sourceWidth = this._sourceWidth;
- q._sourceHeight = this._sourceHeight;
- return this._textureMap[a] = q
- };
- return a
- } (b.HashObject);
- b.SpriteSheet = c;
- c.prototype.__class__ = "egret.SpriteSheet"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._size = 30;
- this._textColorString = "#FFFFFF";
- this._textColor = 16777215;
- this.stageText = new b.StageText;
- var a = this.localToGlobal();
- this.stageText._open(a.x, a.y, this._explicitWidth, this._explicitHeight)
- }
- __extends(a, d);
- a.prototype._onAddToStage = function() {
- d.prototype._onAddToStage.call(this);
- this.stageText._add();
- this.addEventListener(b.TouchEvent.TOUCH_BEGIN, this.onMouseDownHandler, this)
- };
- a.prototype.setText = function(a) {
- this.stageText._setText(a)
- };
- a.prototype.getText = function() {
- return this.stageText._getText()
- };
- a.prototype.setTextType = function(a) {
- this.stageText._setTextType(a)
- };
- a.prototype.getTextType = function() {
- return this.stageText._getTextType()
- };
- a.prototype.onMouseDownHandler = function(a) {};
- a.prototype._onRemoveFromStage = function() {
- this.stageText._remove()
- };
- a.prototype._measureBounds = function() {
- return b.Rectangle.identity
- };
- a.prototype.hitTest = function(a, b, f) {
- return null
- };
- a.prototype._updateTransform = function() {
- var a = this._worldTransform.a,
- b = this._worldTransform.b,
- f = this._worldTransform.c,
- c = this._worldTransform.d,
- l = this._worldTransform.tx,
- h = this._worldTransform.ty;
- d.prototype._updateTransform.call(this);
- var k = this._worldTransform;
- if (a != k.a || b != k.b || f != k.c || c != k.d || l != k.tx || h != k.ty) a = this.localToGlobal(),
- this.stageText.changePosition(a.x, a.y),
- this.stageText.changeSize(this._explicitWidth, this._explicitHeight)
- };
- Object.defineProperty(a.prototype, "size", {
- get: function() {
- return this._size
- },
- set: function(a) {
- this._size != a && (this._size = a, this.stageText.setSize(this._size))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textColor", {
- get: function() {
- return this._textColor
- },
- set: function(a) {
- this._textColor != a && (this._textColor = a, this._textColorString = b.toColorString(a), this.stageText.setTextColor(this._textColorString))
- },
- enumerable: !0,
- configurable: !0
- });
- return a
- } (b.DisplayObject);
- b.TextInput = c;
- c.prototype.__class__ = "egret.TextInput"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(a, g) {
- b.call(this, a);
- this.charList = this.parseConfig(g)
- }
- __extends(a, b);
- a.prototype.getTexture = function(a) {
- var b = this._textureMap[a];
- if (!b) {
- b = this.charList[a];
- if (!b) return null;
- b = this.createTexture(a, b.x, b.y, b.width, b.height, b.offsetX, b.offsetY);
- this._textureMap[a] = b
- }
- return b
- };
- a.prototype.parseConfig = function(a) {
- a = a.split("\r\n").join("\n");
- a = a.split("\n");
- for (var b = this.getConfigByKey(a[3], "count"), f = {},
- d = 4; d < 4 + b; d++) {
- var c = a[d],
- h = String.fromCharCode(this.getConfigByKey(c, "id")),
- k = {};
- f[h] = k;
- k.x = this.getConfigByKey(c, "x");
- k.y = this.getConfigByKey(c, "y");
- k.width = this.getConfigByKey(c, "width");
- k.height = this.getConfigByKey(c, "height");
- k.offsetX = this.getConfigByKey(c, "xoffset");
- k.offsetY = this.getConfigByKey(c, "yoffset")
- }
- return f
- };
- a.prototype.getConfigByKey = function(a, b) {
- for (var f = a.split(" "), d = 0, c = f.length; d < c; d++) {
- var h = f[d];
- if (b == h.substring(0, b.length)) return f = h.substring(b.length + 1),
- parseInt(f)
- }
- return 0
- };
- return a
- } (b.SpriteSheet);
- b.BitmapTextSpriteSheet = c;
- c.prototype.__class__ = "egret.BitmapTextSpriteSheet"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(a) {
- function e(e, f) {
- a.call(this);
- this.frameRate = 60;
- e instanceof d ? (b.Logger.warning("MovieClip#constructor\u63a5\u53e3\u53c2\u6570\u5df2\u7ecf\u53d8\u66f4\uff0c\u8bf7\u5c3d\u5feb\u8c03\u6574\u7528\u6cd5\u4e3a new MovieClip(data,texture)"), this.delegate = e) : this.delegate = new d(e, f);
- this.delegate.setMovieClip(this)
- }
- __extends(e, a);
- e.prototype.gotoAndPlay = function(a) {
- this.delegate.gotoAndPlay(a)
- };
- e.prototype.gotoAndStop = function(a) {
- this.delegate.gotoAndStop(a)
- };
- e.prototype.stop = function() {
- this.delegate.stop()
- };
- e.prototype.dispose = function() {
- this.delegate.dispose()
- };
- e.prototype.release = function() {
- b.Logger.warning("MovieClip#release\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- this.dispose()
- };
- e.prototype.getCurrentFrameIndex = function() {
- b.Logger.warning("MovieClip#getCurrentFrameIndex\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate._currentFrameIndex
- };
- e.prototype.getTotalFrame = function() {
- b.Logger.warning("MovieClip#getTotalFrame\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate._totalFrame
- };
- e.prototype.setInterval = function(a) {
- b.Logger.warning("MovieClip#setInterval\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03,\u8bf7\u4f7f\u7528MovieClip#frameRate\u4ee3\u66ff");
- this.frameRate = 60 / a
- };
- e.prototype.getIsPlaying = function() {
- b.Logger.warning("MovieClip#getIsPlaying\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate.isPlaying
- };
- return e
- } (b.DisplayObjectContainer);
- b.MovieClip = c;
- c.prototype.__class__ = "egret.MovieClip";
- var d = function() {
- function a(a, g) {
- this.data = a;
- this._currentFrameIndex = this._passTime = this._totalFrame = 0;
- this._isPlaying = !1;
- this._frameData = a;
- this._spriteSheet = new b.SpriteSheet(g)
- }
- a.prototype.setMovieClip = function(a) {
- this.movieClip = a;
- this.bitmap = new b.Bitmap;
- this.movieClip.addChild(this.bitmap)
- };
- a.prototype.gotoAndPlay = function(a) {
- this.checkHasFrame(a);
- this._isPlaying = !0;
- this._currentFrameIndex = 0;
- this._currentFrameName = a;
- this._totalFrame = this._frameData.frames[a].totalFrame;
- this.playNextFrame();
- this._passTime = 0;
- b.Ticker.getInstance().register(this.update, this)
- };
- a.prototype.gotoAndStop = function(a) {
- this.checkHasFrame(a);
- this.stop();
- this._currentFrameIndex = this._passTime = 0;
- this._currentFrameName = a;
- this._totalFrame = this._frameData.frames[a].totalFrame;
- this.playNextFrame()
- };
- a.prototype.stop = function() {
- this._isPlaying = !1;
- b.Ticker.getInstance().unregister(this.update, this)
- };
- a.prototype.dispose = function() {};
- a.prototype.checkHasFrame = function(a) {
- void 0 == this._frameData.frames[a] && b.Logger.fatal("MovieClip\u6ca1\u6709\u5bf9\u5e94\u7684frame\uff1a", a)
- };
- a.prototype.update = function(a) {
- for (var b = 1E3 / this.movieClip.frameRate,
- b = Math.floor((this._passTime % b + a) / b); 1 <= b;) 1 == b ? this.playNextFrame() : this.playNextFrame(!1),
- b--;
- this._passTime += a
- };
- a.prototype.playNextFrame = function(a) {
- "undefined" === typeof a && (a = !0);
- var b = this._frameData.frames[this._currentFrameName].childrenFrame[this._currentFrameIndex];
- if (a) {
- a = this.getTexture(b.res);
- var f = this.bitmap;
- f.x = b.x;
- f.y = b.y;
- f.texture = a
- }
- null != b.action && this.movieClip.dispatchEventWith(b.action);
- this._currentFrameIndex++;
- this._currentFrameIndex == this._totalFrame && (this._currentFrameIndex = 0)
- };
- a.prototype.getTexture = function(a) {
- var b = this._frameData.res[a],
- f = this._spriteSheet.getTexture(a);
- f || (f = this._spriteSheet.createTexture(a, b.x, b.y, b.w, b.h));
- return f
- };
- return a
- } ();
- b.DefaultMovieClipDelegate = d;
- d.prototype.__class__ = "egret.DefaultMovieClipDelegate"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._size = 20
- }
- __extends(a, d);
- a.prototype._getText = function() {
- return this.inputElement.value
- };
- a.prototype._setText = function(a) {
- this.inputElement.value = a
- };
- a.prototype._setTextType = function(a) {
- this.inputElement.type = a
- };
- a.prototype._getTextType = function() {
- return this.inputElement.type
- };
- a.prototype._open = function(a, g, f, d) {
- "undefined" === typeof f && (f = 160);
- d = b.StageDelegate.getInstance().getScaleX();
- var c = b.StageDelegate.getInstance().getScaleY(),
- h = document.createElement("input");
- h.type = "text";
- h.style.fontSize = this._size + "px";
- h.style.color = "#FFFFFF";
- h.style.border = "none";
- h.style.background = "none";
- h.style.width = f + "px";
- h.style.padding = "0";
- h.style.outline = "medium";
- var k = b.Browser.getInstance().$new("div");
- k.position.x = a * d;
- k.position.y = g * c;
- k.style.width = f + "px";
- k.scale.x = d;
- k.scale.y = c;
- k.transforms();
- k.style[egret_dom.getTrans("transformOrigin")] = "0% 0% 0px";
- k.appendChild(h);
- this.div = k;
- this.inputElement = h
- };
- a.prototype.getStageDelegateDiv = function() {
- var a = b.Browser.getInstance().$("#StageDelegateDiv");
- a || (a = b.Browser.getInstance().$new("div"), a.id = "StageDelegateDiv", document.getElementById(b.StageDelegate.canvas_div_name).appendChild(a), a.transforms());
- return a
- };
- a.prototype._add = function() {
- var a = this.div;
- a && !a.parentNode && this.getStageDelegateDiv().appendChild(a)
- };
- a.prototype._remove = function() {
- var a = this.div;
- a && a.parentNode && a.parentNode.removeChild(a)
- };
- a.prototype.changePosition = function(a, g) {
- var f = b.StageDelegate.getInstance().getScaleX(),
- d = b.StageDelegate.getInstance().getScaleY();
- this.div.position.x = a * f;
- this.div.position.y = g * d;
- this.div.transforms()
- };
- a.prototype.changeSize = function(a, b) {
- this.inputElement.style.width = a + "px";
- this.div.style.width = a + "px";
- this.div.transforms()
- };
- a.prototype.setSize = function(a) {
- this._size = a;
- this.inputElement.style.fontSize = this._size + "px"
- };
- a.prototype.setTextColor = function(a) {
- this.inputElement.style.color = a
- };
- return a
- } (b.HashObject);
- b.StageText = c;
- c.prototype.__class__ = "egret.StageText"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.GET = "GET";
- b.POST = "POST";
- return b
- } ();
- b.URLRequestMethod = c;
- c.prototype.__class__ = "egret.URLRequestMethod"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.BINARY = "binary";
- b.TEXT = "text";
- b.VARIABLES = "variables";
- b.TEXTURE = "texture";
- b.SOUND = "sound";
- return b
- } ();
- b.URLLoaderDataFormat = c;
- c.prototype.__class__ = "egret.URLLoaderDataFormat"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- b.call(this);
- null !== a && this.decode(a)
- }
- __extends(a, b);
- a.prototype.decode = function(a) {
- this.variables || (this.variables = {});
- a = a.split("+").join(" ");
- for (var b, f = /[?&]?([^=]+)=([^&]*)/g; b = f.exec(a);) this.variables[decodeURIComponent(b[1])] = decodeURIComponent(b[2])
- };
- a.prototype.toString = function() {
- if (!this.variables) return "";
- var a = this.variables,
- b = "",
- f = !0,
- d;
- for (d in a) f ? f = !1 : b += "&",
- b += d + "=" + a[d];
- return b
- };
- return a
- } (b.HashObject);
- b.URLVariables = c;
- c.prototype.__class__ = "egret.URLVariables"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- d.call(this);
- this.method = b.URLRequestMethod.GET;
- this.url = a
- }
- __extends(a, d);
- return a
- } (b.HashObject);
- b.URLRequest = c;
- c.prototype.__class__ = "egret.URLRequest"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- d.call(this);
- this.dataFormat = b.URLLoaderDataFormat.TEXT;
- a && this.load(a)
- }
- __extends(a, d);
- a.prototype.load = function(a) {
- this._request = a;
- this.data = null;
- b.MainContext.instance.netContext.proceed(this)
- };
- return a
- } (b.EventDispatcher);
- b.URLLoader = c;
- c.prototype.__class__ = "egret.URLLoader"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._textureHeight = this._textureWidth = this._offsetY = this._offsetX = this._bitmapHeight = this._bitmapWidth = this._bitmapY = this._bitmapX = 0
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "textureWidth", {
- get: function() {
- return this._textureWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textureHeight", {
- get: function() {
- return this._textureHeight
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bitmapData", {
- get: function() {
- return this._bitmapData
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setBitmapData = function(a) {
- var g = b.MainContext.instance.rendererContext.texture_scale_factor;
- this._bitmapData = a;
- this._sourceWidth = a.width;
- this._sourceHeight = a.height;
- this._textureWidth = this._sourceWidth * g;
- this._textureHeight = this._sourceHeight * g;
- this._bitmapWidth = this._textureWidth;
- this._bitmapHeight = this._textureHeight;
- this._offsetX = this._offsetY = this._bitmapX = this._bitmapY = 0
- };
- a.prototype.getPixel32 = function(a, b) {
- return this._bitmapData.getContext("2d").getImageData(a, b, 1, 1).data
- };
- return a
- } (b.HashObject);
- b.Texture = c;
- c.prototype.__class__ = "egret.Texture"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._bitmapData = document.createElement("canvas");
- this.renderContext = b.RendererContext.createRendererContext(this._bitmapData)
- }
- __extends(a, d);
- a.prototype.drawToTexture = function(a) {
- var g = this._bitmapData,
- f = a.getBounds(b.Rectangle.identity);
- g.width = f.width;
- g.height = f.height;
- a._worldTransform.identity();
- a.worldAlpha = 1;
- if (a instanceof b.DisplayObjectContainer) {
- this._offsetX = f.x;
- this._offsetY = f.y;
- a._worldTransform.append(1, 0, 0, 1, -f.x, -f.y);
- for (var g = a._children,
- f = 0,
- d = g.length; f < d; f++) g[f]._updateTransform()
- }
- g = b.RenderFilter.getInstance();
- f = g._drawAreaList.concat();
- g._drawAreaList.length = 0;
- this.renderContext.clearScreen();
- this.webGLTexture = null; (d = a.mask || a._scrollRect) && this.renderContext.pushMask(d);
- a._render(this.renderContext);
- d && this.renderContext.popMask();
- g._drawAreaList = f;
- this._textureWidth = this._bitmapData.width;
- this._textureHeight = this._bitmapData.height;
- this._sourceWidth = this._textureWidth;
- this._sourceHeight = this._textureHeight
- };
- return a
- } (b.Texture);
- b.RenderTexture = c;
- c.prototype.__class__ = "egret.RenderTexture"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.renderCost = 0;
- this.texture_scale_factor = 1
- }
- __extends(a, d);
- a.prototype.clearScreen = function() {};
- a.prototype.clearRect = function(a, b, f, d) {};
- a.prototype.drawImage = function(a, g, f, d, c, h, k, p, n) {
- b.Profiler.getInstance().onDrawImage()
- };
- a.prototype.setTransform = function(a) {};
- a.prototype.setAlpha = function(a, b) {};
- a.prototype.setupFont = function(a) {};
- a.prototype.measureText = function(a) {
- return 0
- };
- a.prototype.drawText = function(a, g, f, d, c) {
- b.Profiler.getInstance().onDrawImage()
- };
- a.prototype.strokeRect = function(a, b, f, d, c) {};
- a.prototype.pushMask = function(a) {};
- a.prototype.popMask = function() {};
- a.prototype.onRenderStart = function() {};
- a.prototype.onRenderFinish = function() {};
- a.createRendererContext = function(a) {
- return null
- };
- return a
- } (b.HashObject);
- b.RendererContext = c;
- c.prototype.__class__ = "egret.RendererContext"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.MOUSE = "mouse";
- b.TOUCH = "touch";
- b.mode = "touch";
- return b
- } ();
- b.InteractionMode = c;
- c.prototype.__class__ = "egret.InteractionMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._currentTouchTarget = {};
- this.maxTouches = 2;
- this.touchDownTarget = {};
- this.touchingIdentifiers = [];
- this.lastTouchY = this.lastTouchX = -1
- }
- __extends(a, d);
- a.prototype.run = function() {};
- a.prototype.getTouchData = function(a, b, f) {
- var d = this._currentTouchTarget[a];
- null == d && (d = {},
- this._currentTouchTarget[a] = d);
- d.stageX = b;
- d.stageY = f;
- d.identifier = a;
- return d
- };
- a.prototype.dispatchEvent = function(a, g) {
- b.TouchEvent.dispatchTouchEvent(g.target, a, g.identifier, g.stageX, g.stageY, !1, !1, !1, !0 == this.touchDownTarget[g.identifier])
- };
- a.prototype.onTouchBegan = function(a, g, d) {
- if (this.touchingIdentifiers.length != this.maxTouches) {
- var c = b.MainContext.instance.stage.hitTest(a, g);
- c && (a = this.getTouchData(d, a, g), this.touchDownTarget[d] = !0, a.target = c, a.beginTarget = c, this.dispatchEvent(b.TouchEvent.TOUCH_BEGIN, a));
- this.touchingIdentifiers.push(d)
- }
- };
- a.prototype.onTouchMove = function(a, g, d) {
- if ( - 1 != this.touchingIdentifiers.indexOf(d) && (a != this.lastTouchX || g != this.lastTouchY)) {
- this.lastTouchX = a;
- this.lastTouchY = g;
- var c = b.MainContext.instance.stage.hitTest(a, g);
- c && (a = this.getTouchData(d, a, g), a.target = c, this.dispatchEvent(b.TouchEvent.TOUCH_MOVE, a))
- }
- };
- a.prototype.onTouchEnd = function(a, g, d) {
- var c = this.touchingIdentifiers.indexOf(d); - 1 != c && (this.touchingIdentifiers.splice(c, 1), c = b.MainContext.instance.stage.hitTest(a, g)) && (a = this.getTouchData(d, a, g), delete this.touchDownTarget[d], d = a.beginTarget, a.target = c, this.dispatchEvent(b.TouchEvent.TOUCH_END, a), d == c ? this.dispatchEvent(b.TouchEvent.TOUCH_TAP, a) : a.beginTarget && (a.target = a.beginTarget, this.dispatchEvent(b.TouchEvent.TOUCH_RELEASE_OUTSIDE, a)), delete this._currentTouchTarget[a.identifier])
- };
- return a
- } (b.HashObject);
- b.TouchContext = c;
- c.prototype.__class__ = "egret.TouchContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.proceed = function(a) {};
- return a
- } (b.HashObject);
- b.NetContext = c;
- c.prototype.__class__ = "egret.NetContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this.frameRate = 60
- }
- __extends(a, b);
- a.prototype.executeMainLoop = function(a, b) {};
- return a
- } (b.HashObject);
- b.DeviceContext = c;
- c.prototype.__class__ = "egret.DeviceContext"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.call = function(a, e) {};
- b.addCallback = function(a, e) {};
- return b
- } ();
- b.ExternalInterface = c;
- c.prototype.__class__ = "egret.ExternalInterface"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.translate = this.isHD ?
- function(a) {
- return "translate3d(" + a.x + "px, " + (a.y - b.MainContext.instance.stage.stageHeight) + "px, 0) "
- }: function(a) {
- return "translate(" + a.x + "px, " + a.y + "px) "
- };
- this.rotate = this.isHD ?
- function(a) {
- return "rotateZ(" + a + "deg) "
- }: function(a) {
- return "rotate(" + a + "deg) "
- };
- this.ua = navigator.userAgent.toLowerCase();
- var a = this.ua.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baidubrowser|maxthon|ie|opera|firefox/) || this.ua.match(/chrome|safari/);
- a && 0 < a.length && (a = a[0], "micromessenger" == a && (this.type = "wechat"), this.type = a);
- this.type = "unknow";
- switch (this.type) {
- case "firefox":
- this.pfx = "Moz";
- this.isHD = !0;
- break;
- case "chrome":
- case "safari":
- this.pfx = "webkit";
- this.isHD = !0;
- break;
- case "opera":
- this.pfx = "O";
- this.isHD = !1;
- break;
- case "ie":
- this.pfx = "ms";
- this.isHD = !1;
- break;
- default:
- this.pfx = "webkit",
- this.isHD = !0
- }
- this.trans = this.pfx + "Transform"
- }
- __extends(a, d);
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- Object.defineProperty(a.prototype, "isMobile", {
- get: function() {
- b.Logger.warning("Browser.isMobile\u63a5\u53e3\u53c2\u6570\u5df2\u7ecf\u53d8\u66f4\uff0c\u8bf7\u5c3d\u5feb\u8c03\u6574\u7528\u6cd5\u4e3a egret.MainContext.deviceType == egret.MainContext.DEVICE_MOBILE ");
- return b.MainContext.deviceType == b.MainContext.DEVICE_MOBILE
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.$new = function(a) {
- return this.$(document.createElement(a))
- };
- a.prototype.$ = function(e) {
- var g = document;
- if (e = e instanceof HTMLElement ? e: g.querySelector(e)) e.find = e.find || this.$,
- e.hasClass = e.hasClass ||
- function(a) {
- return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)"))
- },
- e.addClass = e.addClass ||
- function(a) {
- this.hasClass(a) || (this.className && (this.className += " "), this.className += a);
- return this
- },
- e.removeClass = e.removeClass ||
- function(a) {
- this.hasClass(a) && (this.className = this.className.replace(a, ""));
- return this
- },
- e.remove = e.remove ||
- function() {},
- e.appendTo = e.appendTo ||
- function(a) {
- a.appendChild(this);
- return this
- },
- e.prependTo = e.prependTo ||
- function(a) {
- a.childNodes[0] ? a.insertBefore(this, a.childNodes[0]) : a.appendChild(this);
- return this
- },
- e.transforms = e.transforms ||
- function() {
- this.style[a.getInstance().trans] = a.getInstance().translate(this.position) + a.getInstance().rotate(this.rotation) + a.getInstance().scale(this.scale) + a.getInstance().skew(this.skew);
- return this
- },
- e.position = e.position || {
- x: 0,
- y: 0
- },
- e.rotation = e.rotation || 0,
- e.scale = e.scale || {
- x: 1,
- y: 1
- },
- e.skew = e.skew || {
- x: 0,
- y: 0
- },
- e.translates = function(a, e) {
- this.position.x = a;
- this.position.y = e - b.MainContext.instance.stage.stageHeight;
- this.transforms();
- return this
- },
- e.rotate = function(a) {
- this.rotation = a;
- this.transforms();
- return this
- },
- e.resize = function(a, e) {
- this.scale.x = a;
- this.scale.y = e;
- this.transforms();
- return this
- },
- e.setSkew = function(a, e) {
- this.skew.x = a;
- this.skew.y = e;
- this.transforms();
- return this
- };
- return e
- };
- a.prototype.scale = function(a) {
- return "scale(" + a.x + ", " + a.y + ") "
- };
- a.prototype.skew = function(a) {
- return "skewX(" + -a.x + "deg) skewY(" + a.y + "deg)"
- };
- return a
- } (b.HashObject);
- b.Browser = c;
- c.prototype.__class__ = "egret.Browser"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.parse = function(a) {
- a = b.SAXParser.getInstance().parserXML(a);
- if (!a || !a.childNodes) return null;
- for (var e = a.childNodes.length,
- g = !1,
- c = 0; c < e; c++) {
- var m = a.childNodes[c];
- if (1 == m.nodeType) {
- g = !0;
- break
- }
- }
- return g ? d.parseNode(m) : null
- };
- d.parseNode = function(a) {
- if (!a || 1 != a.nodeType) return null;
- var e = {};
- e.localName = a.localName;
- e.name = a.nodeName;
- a.namespaceURI && (e.namespace = a.namespaceURI);
- a.prefix && (e.prefix = a.prefix);
- for (var b = a.attributes,
- c = b.length,
- m = 0; m < c; m++) {
- var l = b[m],
- h = l.name;
- 0 != h.indexOf("xmlns:") && (e["$" + h] = l.value)
- }
- b = a.childNodes;
- c = b.length;
- for (m = 0; m < c; m++) if (l = d.parseNode(b[m])) e.children || (e.children = []),
- l.parent = e,
- e.children.push(l); ! e.children && (a = a.textContent.trim()) && (e.text = a);
- return e
- };
- d.findChildren = function(a, e, b) {
- b ? b.length = 0 : b = [];
- d.findByPath(a, e, b);
- return b
- };
- d.findByPath = function(a, e, b) {
- var c = e.indexOf("."),
- m; - 1 == c ? (m = e, c = !0) : (m = e.substring(0, c), e = e.substring(c + 1), c = !1);
- if (a = a.children) for (var l = a.length,
- h = 0; h < l; h++) {
- var k = a[h];
- k.localName == m && (c ? b.push(k) : d.findByPath(k, e, b))
- }
- };
- d.getAttributes = function(a, e) {
- e ? e.length = 0 : e = [];
- for (var b in a)"$" == b.charAt(0) && e.push(b.substring(1));
- return e
- };
- return d
- } ();
- b.XML = c;
- c.prototype.__class__ = "egret.XML"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function a() {}
- a.LITTLE_ENDIAN = "LITTLE_ENDIAN";
- a.BIG_ENDIAN = "BIG_ENDIAN";
- return a
- } ();
- b.Endian = c;
- c.prototype.__class__ = "egret.Endian";
- var d = function() {
- function a() {
- this.length = this.position = 0;
- this._mode = "";
- this.maxlength = 0;
- this._endian = c.LITTLE_ENDIAN;
- this.isLittleEndian = !1;
- this._mode = "Typed array";
- this.maxlength = 4;
- this.arraybytes = new ArrayBuffer(this.maxlength);
- this.unalignedarraybytestemp = new ArrayBuffer(16);
- this.endian = a.DEFAULT_ENDIAN
- }
- Object.defineProperty(a.prototype, "endian", {
- get: function() {
- return this._endian
- },
- set: function(a) {
- this._endian = a;
- this.isLittleEndian = a == c.LITTLE_ENDIAN
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.ensureWriteableSpace = function(a) {
- this.ensureSpace(a + this.position)
- };
- a.prototype.setArrayBuffer = function(a) {
- this.ensureSpace(a.byteLength);
- this.length = a.byteLength;
- a = new Int8Array(a); (new Int8Array(this.arraybytes, 0, this.length)).set(a);
- this.position = 0
- };
- Object.defineProperty(a.prototype, "bytesAvailable", {
- get: function() {
- return this.length - this.position
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.ensureSpace = function(a) {
- if (a > this.maxlength) {
- a = a + 255 & -256;
- var b = new ArrayBuffer(a),
- d = new Uint8Array(this.arraybytes, 0, this.length); (new Uint8Array(b, 0, this.length)).set(d);
- this.arraybytes = b;
- this.maxlength = a
- }
- };
- a.prototype.writeByte = function(a) {
- this.ensureWriteableSpace(1); (new Int8Array(this.arraybytes))[this.position++] = ~~a;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readByte = function() {
- if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- return (new Int8Array(this.arraybytes))[this.position++]
- };
- a.prototype.readBytes = function(a, b, d) {
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof d && (d = 0);
- null == d && (d = a.length);
- a.ensureWriteableSpace(b + d);
- var c = new Int8Array(a.arraybytes),
- l = new Int8Array(this.arraybytes);
- c.set(l.subarray(this.position, this.position + d), b);
- this.position += d;
- d + b > a.length && (a.length += d + b - a.length)
- };
- a.prototype.writeUnsignedByte = function(a) {
- this.ensureWriteableSpace(1); (new Uint8Array(this.arraybytes))[this.position++] = ~~a & 255;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUnsignedByte = function() {
- if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- return (new Uint8Array(this.arraybytes))[this.position++]
- };
- a.prototype.writeUnsignedShort = function(a) {
- this.ensureWriteableSpace(2);
- if (0 == (this.position & 1)) {
- var b = new Uint16Array(this.arraybytes);
- b[this.position >> 1] = ~~a & 65535
- } else b = new Uint16Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = ~~a & 65535,
- a = new Uint8Array(this.arraybytes, this.position, 2),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 2),
- a.set(b);
- this.position += 2;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUTFBytes = function(a) {
- var b = "";
- a = this.position + a;
- for (var d = new DataView(this.arraybytes); this.position < a;) {
- var c = d.getUint8(this.position++);
- if (128 > c) {
- if (0 == c) break;
- b += String.fromCharCode(c)
- } else if (224 > c) b += String.fromCharCode((c & 63) << 6 | d.getUint8(this.position++) & 127);
- else if (240 > c) var l = d.getUint8(this.position++),
- b = b + String.fromCharCode((c & 31) << 12 | (l & 127) << 6 | d.getUint8(this.position++) & 127);
- else var l = d.getUint8(this.position++),
- h = d.getUint8(this.position++),
- b = b + String.fromCharCode((c & 15) << 18 | (l & 127) << 12 | h << 6 & 127 | d.getUint8(this.position++) & 127)
- }
- return b
- };
- a.prototype.readInt = function() {
- var a = (new DataView(this.arraybytes)).getInt32(this.position, this.isLittleEndian);
- this.position += 4;
- return a
- };
- a.prototype.readShort = function() {
- var a = (new DataView(this.arraybytes)).getInt16(this.position, this.isLittleEndian);
- this.position += 2;
- return a
- };
- a.prototype.readDouble = function() {
- var a = (new DataView(this.arraybytes)).getFloat64(this.position, this.isLittleEndian);
- this.position += 8;
- return a
- };
- a.prototype.readUnsignedShort = function() {
- if (this.position > this.length + 2) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 1)) {
- var a = new Uint16Array(this.arraybytes),
- b = this.position >> 1;
- this.position += 2;
- return a[b]
- }
- a = new Uint16Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 2); (new Uint8Array(this.unalignedarraybytestemp, 0, 2)).set(b);
- this.position += 2;
- return a[0]
- };
- a.prototype.writeUnsignedInt = function(a) {
- this.ensureWriteableSpace(4);
- if (0 == (this.position & 3)) {
- var b = new Uint32Array(this.arraybytes);
- b[this.position >> 2] = ~~a & 4294967295
- } else b = new Uint32Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = ~~a & 4294967295,
- a = new Uint8Array(this.arraybytes, this.position, 4),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 4),
- a.set(b);
- this.position += 4;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUnsignedInt = function() {
- if (this.position > this.length + 4) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 3)) {
- var a = new Uint32Array(this.arraybytes),
- b = this.position >> 2;
- this.position += 4;
- return a[b]
- }
- a = new Uint32Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 4); (new Uint8Array(this.unalignedarraybytestemp, 0, 4)).set(b);
- this.position += 4;
- return a[0]
- };
- a.prototype.writeFloat = function(a) {
- this.ensureWriteableSpace(4);
- if (0 == (this.position & 3)) {
- var b = new Float32Array(this.arraybytes);
- b[this.position >> 2] = a
- } else b = new Float32Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = a,
- a = new Uint8Array(this.arraybytes, this.position, 4),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 4),
- a.set(b);
- this.position += 4;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readFloat = function() {
- if (this.position > this.length + 4) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 3)) {
- var a = new Float32Array(this.arraybytes),
- b = this.position >> 2;
- this.position += 4;
- return a[b]
- }
- a = new Float32Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 4); (new Uint8Array(this.unalignedarraybytestemp, 0, 4)).set(b);
- this.position += 4;
- return a[0]
- };
- a.DEFAULT_ENDIAN = c.BIG_ENDIAN;
- return a
- } ();
- b.ByteArray = d;
- d.prototype.__class__ = "egret.ByteArray"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a, b, c) {
- d.call(this);
- this._target = null;
- this.loop = this.ignoreGlobalPause = this._useTicks = !1;
- this._actions = this._steps = this.pluginData = null;
- this.paused = !1;
- this.duration = 0;
- this._prevPos = -1;
- this.position = null;
- this._stepPosition = this._prevPosition = 0;
- this.passive = !1;
- this.initialize(a, b, c)
- }
- __extends(a, d);
- a.get = function(e, b, d, c) {
- "undefined" === typeof b && (b = null);
- "undefined" === typeof d && (d = null);
- "undefined" === typeof c && (c = !1);
- c && a.removeTweens(e);
- return new a(e, b, d)
- };
- a.removeTweens = function(e) {
- if (e.tween_count) {
- for (var b = a._tweens,
- d = b.length - 1; 0 <= d; d--) b[d]._target == e && (b[d].paused = !0, b.splice(d, 1));
- e.tween_count = 0
- }
- };
- a.tick = function(e, b) {
- "undefined" === typeof b && (b = !1);
- for (var d = a._tweens.concat(), c = d.length - 1; 0 <= c; c--) {
- var l = d[c];
- b && !l.ignoreGlobalPause || l.paused || l.tick(l._useTicks ? 1 : e)
- }
- };
- a._register = function(e, d) {
- var c = e._target,
- m = a._tweens;
- if (d) c && (c.tween_count = c.tween_count ? c.tween_count + 1 : 1),
- m.push(e),
- a._inited || (b.Ticker.getInstance().register(a.tick, null), a._inited = !0);
- else for (c && c.tween_count--, c = m.length; c--;) if (m[c] == e) {
- m.splice(c, 1);
- break
- }
- };
- a.removeAllTweens = function() {
- for (var e = a._tweens,
- b = 0,
- d = e.length; b < d; b++) {
- var c = e[b];
- c.paused = !0;
- c._target.tweenjs_count = 0
- }
- e.length = 0
- };
- a.prototype.initialize = function(e, b, d) {
- this._target = e;
- b && (this._useTicks = b.useTicks, this.ignoreGlobalPause = b.ignoreGlobalPause, this.loop = b.loop, b.onChange && this.addEventListener("change", b.onChange, b.onChangeObj), b.override && a.removeTweens(e));
- this.pluginData = d || {};
- this._curQueueProps = {};
- this._initQueueProps = {};
- this._steps = [];
- this._actions = [];
- b && b.paused ? this.paused = !0 : a._register(this, !0);
- b && null != b.position && this.setPosition(b.position, a.NONE)
- };
- a.prototype.setPosition = function(a, b) {
- "undefined" === typeof b && (b = 1);
- 0 > a && (a = 0);
- var d = a,
- c = !1;
- d >= this.duration && (this.loop ? d %= this.duration: (d = this.duration, c = !0));
- if (d == this._prevPos) return c;
- var l = this._prevPos;
- this.position = this._prevPos = d;
- this._prevPosition = a;
- if (this._target) if (c) this._updateTargetProps(null, 1);
- else if (0 < this._steps.length) {
- for (var h = 0,
- k = this._steps.length; h < k && !(this._steps[h].t > d); h++);
- h = this._steps[h - 1];
- this._updateTargetProps(h, (this._stepPosition = d - h.t) / h.d)
- }
- 0 != b && 0 < this._actions.length && (this._useTicks ? this._runActions(d, d) : 1 == b && d < l ? (l != this.duration && this._runActions(l, this.duration), this._runActions(0, d, !0)) : this._runActions(l, d));
- c && this.setPaused(!0);
- this.dispatchEventWith("change");
- return c
- };
- a.prototype._runActions = function(a, b, d) {
- "undefined" === typeof d && (d = !1);
- var c = a,
- l = b,
- h = -1,
- k = this._actions.length,
- p = 1;
- a > b && (c = b, l = a, h = k, k = p = -1);
- for (; (h += p) != k;) {
- b = this._actions[h];
- var n = b.t; (n == l || n > c && n < l || d && n == a) && b.f.apply(b.o, b.p)
- }
- };
- a.prototype._updateTargetProps = function(e, b) {
- var d, c, l, h;
- if (e || 1 != b) {
- if (this.passive = !!e.v) return;
- e.e && (b = e.e(b, 0, 1, 1));
- d = e.p0;
- c = e.p1
- } else this.passive = !1,
- d = c = this._curQueueProps;
- for (var k in this._initQueueProps) {
- null == (l = d[k]) && (d[k] = l = this._initQueueProps[k]);
- null == (h = c[k]) && (c[k] = h = l);
- l = l == h || 0 == b || 1 == b || "number" != typeof l ? 1 == b ? h: l: l + (h - l) * b;
- var p = !1;
- if (h = a._plugins[k]) for (var n = 0,
- q = h.length; n < q; n++) {
- var t = h[n].tween(this, k, l, d, c, b, !!e && d == c, !e);
- t == a.IGNORE ? p = !0 : l = t
- }
- p || (this._target[k] = l)
- }
- };
- a.prototype.setPaused = function(e) {
- this.paused = e;
- a._register(this, !e);
- return this
- };
- a.prototype._cloneProps = function(a) {
- var b = {},
- d;
- for (d in a) b[d] = a[d];
- return b
- };
- a.prototype._addStep = function(a) {
- 0 < a.d && (this._steps.push(a), a.t = this.duration, this.duration += a.d);
- return this
- };
- a.prototype._appendQueueProps = function(e) {
- var b, d, c, l, h, k;
- for (k in e) if (void 0 === this._initQueueProps[k]) {
- d = this._target[k];
- if (b = a._plugins[k]) for (c = 0, l = b.length; c < l; c++) d = b[c].init(this, k, d);
- this._initQueueProps[k] = this._curQueueProps[k] = void 0 === d ? null: d
- }
- for (k in e) {
- d = this._curQueueProps[k];
- if (b = a._plugins[k]) for (h = h || {},
- c = 0, l = b.length; c < l; c++) b[c].step && b[c].step(this, k, d, e[k], h);
- this._curQueueProps[k] = e[k]
- }
- h && this._appendQueueProps(h);
- return this._curQueueProps
- };
- a.prototype._addAction = function(a) {
- a.t = this.duration;
- this._actions.push(a);
- return this
- };
- a.prototype._set = function(a, b) {
- for (var d in a) b[d] = a[d]
- };
- a.prototype.wait = function(a, b) {
- if (null == a || 0 >= a) return this;
- var d = this._cloneProps(this._curQueueProps);
- return this._addStep({
- d: a,
- p0: d,
- p1: d,
- v: b
- })
- };
- a.prototype.to = function(a, b, d) {
- "undefined" === typeof d && (d = void 0);
- if (isNaN(b) || 0 > b) b = 0;
- return this._addStep({
- d: b || 0,
- p0: this._cloneProps(this._curQueueProps),
- e: d,
- p1: this._cloneProps(this._appendQueueProps(a))
- })
- };
- a.prototype.call = function(a, b, d) {
- "undefined" === typeof b && (b = void 0);
- "undefined" === typeof d && (d = void 0);
- return this._addAction({
- f: a,
- p: d ? d: [],
- o: b ? b: this._target
- })
- };
- a.prototype.set = function(a, b) {
- "undefined" === typeof b && (b = null);
- return this._addAction({
- f: this._set,
- o: this,
- p: [a, b ? b: this._target]
- })
- };
- a.prototype.play = function(a) {
- a || (a = this);
- return this.call(a.setPaused, a, [!1])
- };
- a.prototype.pause = function(a) {
- a || (a = this);
- return this.call(a.setPaused, a, [!0])
- };
- a.prototype.tick = function(a) {
- this.paused || this.setPosition(this._prevPosition + a)
- };
- a.NONE = 0;
- a.LOOP = 1;
- a.REVERSE = 2;
- a._tweens = [];
- a.IGNORE = {};
- a._plugins = {};
- a._inited = !1;
- return a
- } (b.EventDispatcher);
- b.Tween = c;
- c.prototype.__class__ = "egret.Tween"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {
- b.Logger.fatal("Ease\u4e0d\u80fd\u88ab\u5b9e\u4f8b\u5316")
- }
- d.get = function(a) { - 1 > a && (a = -1);
- 1 < a && (a = 1);
- return function(b) {
- return 0 == a ? b: 0 > a ? b * (b * -a + 1 + a) : b * ((2 - b) * a + (1 - a))
- }
- };
- d.getPowIn = function(a) {
- return function(b) {
- return Math.pow(b, a)
- }
- };
- d.getPowOut = function(a) {
- return function(b) {
- return 1 - Math.pow(1 - b, a)
- }
- };
- d.getPowInOut = function(a) {
- return function(b) {
- return 1 > (b *= 2) ? 0.5 * Math.pow(b, a) : 1 - 0.5 * Math.abs(Math.pow(2 - b, a))
- }
- };
- d.sineIn = function(a) {
- return 1 - Math.cos(a * Math.PI / 2)
- };
- d.sineOut = function(a) {
- return Math.sin(a * Math.PI / 2)
- };
- d.sineInOut = function(a) {
- return - 0.5 * (Math.cos(Math.PI * a) - 1)
- };
- d.getBackIn = function(a) {
- return function(b) {
- return b * b * ((a + 1) * b - a)
- }
- };
- d.getBackOut = function(a) {
- return function(b) {
- b -= 1;
- return b * b * ((a + 1) * b + a) + 1
- }
- };
- d.getBackInOut = function(a) {
- a *= 1.525;
- return function(b) {
- return 1 > (b *= 2) ? 0.5 * b * b * ((a + 1) * b - a) : 0.5 * ((b -= 2) * b * ((a + 1) * b + a) + 2)
- }
- };
- d.circIn = function(a) {
- return - (Math.sqrt(1 - a * a) - 1)
- };
- d.circOut = function(a) {
- return Math.sqrt(1 - a * a)
- };
- d.circInOut = function(a) {
- return 1 > (a *= 2) ? -0.5 * (Math.sqrt(1 - a * a) - 1) : 0.5 * (Math.sqrt(1 - (a -= 2) * a) + 1)
- };
- d.bounceIn = function(a) {
- return 1 - d.bounceOut(1 - a)
- };
- d.bounceOut = function(a) {
- 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
- };
- d.bounceInOut = function(a) {
- return 0.5 > a ? 0.5 * d.bounceIn(2 * a) : 0.5 * d.bounceOut(2 * a - 1) + 0.5
- };
- d.getElasticIn = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- if (0 == c || 1 == c) return c;
- var m = b / d * Math.asin(1 / a);
- return - (a * Math.pow(2, 10 * (c -= 1)) * Math.sin((c - m) * d / b))
- }
- };
- d.getElasticOut = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- if (0 == c || 1 == c) return c;
- var m = b / d * Math.asin(1 / a);
- return a * Math.pow(2, -10 * c) * Math.sin((c - m) * d / b) + 1
- }
- };
- d.getElasticInOut = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- var m = b / d * Math.asin(1 / a);
- return 1 > (c *= 2) ? -0.5 * a * Math.pow(2, 10 * (c -= 1)) * Math.sin((c - m) * d / b) : a * Math.pow(2, -10 * (c -= 1)) * Math.sin((c - m) * d / b) * 0.5 + 1
- }
- };
- d.quadIn = d.getPowIn(2);
- d.quadOut = d.getPowOut(2);
- d.quadInOut = d.getPowInOut(2);
- d.cubicIn = d.getPowIn(3);
- d.cubicOut = d.getPowOut(3);
- d.cubicInOut = d.getPowInOut(3);
- d.quartIn = d.getPowIn(4);
- d.quartOut = d.getPowOut(4);
- d.quartInOut = d.getPowInOut(4);
- d.quintIn = d.getPowIn(5);
- d.quintOut = d.getPowOut(5);
- d.quintInOut = d.getPowInOut(5);
- d.backIn = d.getBackIn(1.7);
- d.backOut = d.getBackOut(1.7);
- d.backInOut = d.getBackInOut(1.7);
- d.elasticIn = d.getElasticIn(1, 0.3);
- d.elasticOut = d.getElasticOut(1, 0.3);
- d.elasticInOut = d.getElasticInOut(1, 0.3 * 1.5);
- return d
- } ();
- b.Ease = c;
- c.prototype.__class__ = "egret.Ease"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {
- this.type = b.EFFECT
- }
- b.prototype.play = function(a) {
- "undefined" === typeof a && (a = !1);
- var b = this.audio;
- b && (isNaN(b.duration) || (b.currentTime = 0), b.loop = a, b.play())
- };
- b.prototype.pause = function() {
- var a = this.audio;
- a && a.pause()
- };
- b.prototype.load = function() {
- var a = this.audio;
- a && a.load()
- };
- b.prototype.addEventListener = function(a, b) {
- this.audio && this.audio.addEventListener(a, b, !1)
- };
- b.prototype.removeEventListener = function(a, b) {
- this.audio && this.audio.removeEventListener(a, b, !1)
- };
- b.prototype.setVolume = function(a) {
- var b = this.audio;
- b && (b.volume = a)
- };
- b.prototype.getVolume = function() {
- return this.audio ? this.audio.volume: 0
- };
- b.prototype.preload = function(a) {
- this.type = a
- };
- b.prototype._setAudio = function(a) {
- this.audio = a
- };
- b.MUSIC = "music";
- b.EFFECT = "effect";
- return b
- } ();
- b.Sound = c;
- c.prototype.__class__ = "egret.Sound"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.isNumber = function(a) {
- return "number" === typeof a && !isNaN(a)
- };
- return b
- } ();
- b.NumberUtils = c;
- c.prototype.__class__ = "egret.NumberUtils"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- RES; (function(b) {
- var c = function(b) {
- function a(a, c, f) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof f && (f = !1);
- b.call(this, a, c, f);
- this.itemsTotal = this.itemsLoaded = 0
- }
- __extends(a, b);
- a.dispatchResourceEvent = function(b, d, c, m, l, h) {
- "undefined" === typeof c && (c = "");
- "undefined" === typeof m && (m = null);
- "undefined" === typeof l && (l = 0);
- "undefined" === typeof h && (h = 0);
- var k = egret.Event._getPropertyData(a);
- k.groupName = c;
- k.resItem = m;
- k.itemsLoaded = l;
- k.itemsTotal = h;
- egret.Event._dispatchByTarget(a, b, d, k)
- };
- a.ITEM_LOAD_ERROR = "itemLoadError";
- a.CONFIG_COMPLETE = "configComplete";
- a.GROUP_PROGRESS = "groupProgress";
- a.GROUP_COMPLETE = "groupComplete";
- return a
- } (egret.Event);
- b.ResourceEvent = c;
- c.prototype.__class__ = "RES.ResourceEvent"
- })(RES || (RES = {})); (function(b) {
- var c = function() {
- function b(a, e, c) {
- this._loaded = !1;
- this.name = a;
- this.url = e;
- this.type = c
- }
- Object.defineProperty(b.prototype, "loaded", {
- get: function() {
- return this.data ? this.data.loaded: this._loaded
- },
- set: function(a) {
- this.data && (this.data.loaded = a);
- this._loaded = a
- },
- enumerable: !0,
- configurable: !0
- });
- b.prototype.toString = function() {
- return '[ResourceItem name="' + this.name + '" url="' + this.url + '" type="' + this.type + '"]'
- };
- b.TYPE_XML = "xml";
- b.TYPE_IMAGE = "image";
- b.TYPE_BIN = "bin";
- b.TYPE_TEXT = "text";
- b.TYPE_JSON = "json";
- b.TYPE_SHEET = "sheet";
- b.TYPE_FONT = "font";
- b.TYPE_SOUND = "sound";
- return b
- } ();
- b.ResourceItem = c;
- c.prototype.__class__ = "RES.ResourceItem"
- })(RES || (RES = {})); (function(b) {
- var c = function() {
- function c() {
- this.keyMap = {};
- this.groupDic = {}
- }
- c.prototype.getGroupByName = function(a) {
- var b = [];
- if (!this.groupDic[a]) return b;
- a = this.groupDic[a];
- for (var c = a.length,
- d = 0; d < c; d++) b.push(this.parseResourceItem(a[d]));
- return b
- };
- c.prototype.getRawGroupByName = function(a) {
- return this.groupDic[a] ? this.groupDic[a] : []
- };
- c.prototype.createGroup = function(a, b, c) {
- "undefined" === typeof c && (c = !1);
- if (!c && this.groupDic[a] || !b || 0 == b.length) return ! 1;
- c = this.groupDic;
- for (var d = [], m = b.length, l = 0; l < m; l++) {
- var h = b[l],
- k = c[h];
- if (k) for (var h = k.length,
- p = 0; p < h; p++) {
- var n = k[p]; - 1 == d.indexOf(n) && d.push(n)
- } else(n = this.keyMap[h]) && -1 == d.indexOf(n) && d.push(n)
- }
- if (0 == d.length) return ! 1;
- this.groupDic[a] = d;
- return ! 0
- };
- c.prototype.parseConfig = function(a, b) {
- if (a) {
- var c = a.resources;
- if (c) for (var d = c.length,
- m = 0; m < d; m++) {
- var l = c[m],
- h = l.url;
- h && -1 == h.indexOf("://") && (l.url = b + h);
- this.addItemToKeyMap(l)
- }
- if (c = a.groups) for (d = c.length, m = 0; m < d; m++) {
- for (var h = c[m], k = [], p = h.keys.split(","), n = p.length, q = 0; q < n; q++) l = p[q].trim(),
- (l = this.keyMap[l]) && -1 == k.indexOf(l) && k.push(l);
- this.groupDic[h.name] = k
- }
- }
- };
- c.prototype.addItemToKeyMap = function(a) {
- this.keyMap[a.name] || (this.keyMap[a.name] = a);
- if (a.hasOwnProperty("subkeys")) {
- var b = a.subkeys.split(",");
- a.subkeys = b;
- for (var c = b.length,
- d = 0; d < c; d++) {
- var m = b[d];
- null == this.keyMap[m] && (this.keyMap[m] = a)
- }
- }
- };
- c.prototype.getName = function(a) {
- return (a = this.keyMap[a]) ? a.name: ""
- };
- c.prototype.getType = function(a) {
- return (a = this.keyMap[a]) ? a.type: ""
- };
- c.prototype.getRawResourceItem = function(a) {
- return this.keyMap[a]
- };
- c.prototype.getResourceItem = function(a) {
- return (a = this.keyMap[a]) ? this.parseResourceItem(a) : null
- };
- c.prototype.parseResourceItem = function(a) {
- var e = new b.ResourceItem(a.name, a.url, a.type);
- e.data = a;
- return e
- };
- return c
- } ();
- b.ResourceConfig = c;
- c.prototype.__class__ = "RES.ResourceConfig"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this);
- this.thread = 2;
- this.loadingCount = 0;
- this.groupTotalDic = {};
- this.numLoadedDic = {};
- this.itemListDic = {};
- this.priorityQueue = {};
- this.lazyLoadList = [];
- this.analyzerDic = {};
- this.queueIndex = 0
- }
- __extends(a, c);
- a.prototype.isGroupInLoading = function(a) {
- return void 0 !== this.itemListDic[a]
- };
- a.prototype.loadGroup = function(a, c, d) {
- "undefined" === typeof d && (d = 0);
- if (!this.itemListDic[c] && c) if (a && 0 != a.length) {
- this.priorityQueue[d] ? this.priorityQueue[d].push(c) : this.priorityQueue[d] = [c];
- this.itemListDic[c] = a;
- d = a.length;
- for (var m = 0; m < d; m++) a[m].groupName = c;
- this.groupTotalDic[c] = a.length;
- this.numLoadedDic[c] = 0;
- this.next()
- } else a = new b.ResourceEvent(b.ResourceEvent.GROUP_COMPLETE),
- a.groupName = c,
- this.dispatchEvent(a)
- };
- a.prototype.loadItem = function(a) {
- this.lazyLoadList.push(a);
- a.groupName = "";
- this.next()
- };
- a.prototype.next = function() {
- for (; this.loadingCount < this.thread;) {
- var a = this.getOneResourceItem();
- if (!a) break;
- this.loadingCount++;
- if (a.loaded) this.onItemComplete(a);
- else {
- var c = this.analyzerDic[a.type];
- c || (c = this.analyzerDic[a.type] = egret.Injector.getInstance(b.AnalyzerBase, a.type));
- c.loadFile(a, this.onItemComplete, this)
- }
- }
- };
- a.prototype.getOneResourceItem = function() {
- var a = Number.NEGATIVE_INFINITY,
- b;
- for (b in this.priorityQueue) a = Math.max(a, b);
- a = this.priorityQueue[a];
- if (!a || 0 == a.length) return 0 == this.lazyLoadList.length ? null: this.lazyLoadList.pop();
- b = a.length;
- for (var c, d = 0; d < b; d++) {
- this.queueIndex >= b && (this.queueIndex = 0);
- c = this.itemListDic[a[this.queueIndex]];
- if (0 < c.length) break;
- this.queueIndex++
- }
- return 0 == c.length ? null: c.shift()
- };
- a.prototype.onItemComplete = function(a) {
- this.loadingCount--;
- var c = a.groupName;
- a.loaded || b.ResourceEvent.dispatchResourceEvent(this.resInstance, b.ResourceEvent.ITEM_LOAD_ERROR, c, a);
- if (c) {
- this.numLoadedDic[c]++;
- var d = this.numLoadedDic[c],
- m = this.groupTotalDic[c];
- b.ResourceEvent.dispatchResourceEvent(this.resInstance, b.ResourceEvent.GROUP_PROGRESS, c, a, d, m);
- d == m && (this.removeGroupName(c), delete this.groupTotalDic[c], delete this.numLoadedDic[c], delete this.itemListDic[c], b.ResourceEvent.dispatchResourceEvent(this, b.ResourceEvent.GROUP_COMPLETE, c))
- } else this.callBack.call(this.resInstance, a);
- this.next()
- };
- a.prototype.removeGroupName = function(a) {
- for (var b in this.priorityQueue) {
- for (var c = this.priorityQueue[b], d = c.length, l = 0, h = !1, d = c.length, k = 0; k < d; k++) {
- if (c[k] == a) {
- c.splice(l, 1);
- h = !0;
- break
- }
- l++
- }
- if (h) {
- 0 == c.length && delete this.priorityQueue[b];
- break
- }
- }
- };
- return a
- } (egret.EventDispatcher);
- b.ResourceLoader = c;
- c.prototype.__class__ = "RES.ResourceLoader"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.loadFile = function(a, b, c) {};
- a.prototype.getRes = function(a) {};
- a.prototype.destroyRes = function(a) {
- return ! 1
- };
- a.getStringPrefix = function(a) {
- if (!a) return "";
- var b = a.indexOf(".");
- return - 1 != b ? a.substring(0, b) : ""
- };
- a.getStringTail = function(a) {
- if (!a) return "";
- var b = a.indexOf(".");
- return - 1 != b ? a.substring(b + 1) : ""
- };
- return a
- } (egret.HashObject);
- b.AnalyzerBase = c;
- c.prototype.__class__ = "RES.AnalyzerBase"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this.fileDic = {};
- this.resItemDic = [];
- this._dataFormat = egret.URLLoaderDataFormat.BINARY;
- this.recycler = new egret.Recycler
- }
- __extends(a, b);
- a.prototype.loadFile = function(a, b, c) {
- if (this.fileDic[a.name]) b.call(c, a);
- else {
- var d = this.getLoader();
- this.resItemDic[d.hashCode] = {
- item: a,
- func: b,
- thisObject: c
- };
- d.load(new egret.URLRequest(a.url))
- }
- };
- a.prototype.getLoader = function() {
- var a = this.recycler.pop();
- a || (a = new egret.URLLoader, a.addEventListener(egret.Event.COMPLETE, this.onLoadFinish, this), a.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onLoadFinish, this));
- a.dataFormat = this._dataFormat;
- return a
- };
- a.prototype.onLoadFinish = function(a) {
- var b = a.target,
- c = this.resItemDic[b.hashCode];
- delete this.resItemDic[b.hashCode];
- this.recycler.push(b);
- var d = c.item,
- l = c.func;
- d.loaded = a.type == egret.Event.COMPLETE;
- d.loaded && this.analyzeData(d, b.data);
- l.call(c.thisObject, d)
- };
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! this.fileDic[c] && b && (this.fileDic[c] = b)
- };
- a.prototype.getRes = function(a) {
- return this.fileDic[a]
- };
- a.prototype.hasRes = function(a) {
- return null != this.getRes(a)
- };
- a.prototype.destroyRes = function(a) {
- return this.fileDic[a] ? (delete this.fileDic[a], !0) : !1
- };
- return a
- } (b.AnalyzerBase);
- b.BinAnalyzer = c;
- c.prototype.__class__ = "RES.BinAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXTURE
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! 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]))))
- };
- return a
- } (b.BinAnalyzer);
- b.ImageAnalyzer = c;
- c.prototype.__class__ = "RES.ImageAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) try {
- this.fileDic[c] = JSON.parse(b)
- } catch(d) {
- egret.Logger.warning("JSON\u6587\u4ef6\u683c\u5f0f\u4e0d\u6b63\u786e: " + a.url + NaN + b)
- }
- };
- return a
- } (b.BinAnalyzer);
- b.JsonAnalyzer = c;
- c.prototype.__class__ = "RES.JsonAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- return a
- } (b.BinAnalyzer);
- b.TextAnalyzer = c;
- c.prototype.__class__ = "RES.TextAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this);
- this.sheetMap = {};
- this.textureMap = {};
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, c);
- a.prototype.getRes = function(a) {
- var c = this.fileDic[a];
- c || (c = this.textureMap[a]); ! c && (c = b.AnalyzerBase.getStringPrefix(a), c = this.fileDic[c]) && (a = b.AnalyzerBase.getStringTail(a), c = c.getTexture(a));
- return c
- };
- a.prototype.onLoadFinish = function(a) {
- var b = a.target,
- c = this.resItemDic[b.hashCode];
- delete this.resItemDic[b.hashCode];
- this.recycler.push(b);
- var d = c.item,
- l = c.func;
- d.loaded = a.type == egret.Event.COMPLETE;
- d.loaded && this.analyzeData(d, b.data);
- "string" == typeof b.data ? (this._dataFormat = egret.URLLoaderDataFormat.TEXTURE, this.loadFile(d, l, c.thisObject), this._dataFormat = egret.URLLoaderDataFormat.TEXT) : l.call(c.thisObject, d)
- };
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) {
- var d;
- if ("string" == typeof b) {
- try {
- d = JSON.parse(b)
- } catch(l) {
- egret.Logger.warning("JSON\u6587\u4ef6\u683c\u5f0f\u4e0d\u6b63\u786e: " + a.url)
- }
- d && (this.sheetMap[c] = d, a.loaded = !1, a.url = this.getRelativePath(a.url, d.file))
- } else d = this.sheetMap[c],
- delete this.sheetMap[c],
- b && (d = this.parseSpriteSheet(b, d), this.fileDic[c] = d)
- }
- };
- a.prototype.getRelativePath = function(a, b) {
- a = a.split("\\").join("/");
- var c = a.lastIndexOf("/");
- return a = -1 != c ? a.substring(0, c + 1) + b: b
- };
- a.prototype.parseSpriteSheet = function(a, b) {
- var c = b.frames;
- if (!c) return null;
- var d = new egret.SpriteSheet(a),
- l = this.textureMap,
- h;
- for (h in c) {
- var k = c[h];
- a = d.createTexture(h, k.x, k.y, k.w, k.h, k.offX, k.offY, k.sourceW, k.sourceH);
- k.scale9grid && (k = k.scale9grid.split(","), a.scale9Grid = new egret.Rectangle(parseInt(k[0]), parseInt(k[1]), parseInt(k[2]), parseInt(k[3])));
- null == l[h] && (l[h] = a)
- }
- return d
- };
- return a
- } (b.BinAnalyzer);
- b.SheetAnalyzer = c;
- c.prototype.__class__ = "RES.SheetAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) {
- var d;
- "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))
- }
- };
- a.prototype.getTexturePath = function(a, b) {
- var c = "",
- d = b.split("\n")[2],
- l = d.indexOf('file="'); - 1 != l && (d = d.substring(l + 6), l = d.indexOf('"'), c = d.substring(0, l));
- a = a.split("\\").join("/");
- l = a.lastIndexOf("/");
- return a = -1 != l ? a.substring(0, l + 1) + c: c
- };
- return a
- } (b.SheetAnalyzer);
- b.FontAnalyzer = c;
- c.prototype.__class__ = "RES.FontAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.SOUND
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! this.fileDic[c] && b && (this.fileDic[c] = b, (c = a.data) && c.soundType && b.preload(c.soundType))
- };
- return a
- } (b.BinAnalyzer);
- b.SoundAnalyzer = c;
- c.prototype.__class__ = "RES.SoundAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) try {
- var d = egret.XML.parse(b);
- this.fileDic[c] = d
- } catch(l) {}
- };
- return a
- } (b.BinAnalyzer);
- b.XMLAnalyzer = c;
- c.prototype.__class__ = "RES.XMLAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- b.loadConfig = function(a, b, c) {
- "undefined" === typeof b && (b = "");
- "undefined" === typeof c && (c = "json");
- d.loadConfig(a, b, c)
- };
- b.loadGroup = function(a, b) {
- "undefined" === typeof b && (b = 0);
- d.loadGroup(a, b)
- };
- b.isGroupLoaded = function(a) {
- return d.isGroupLoaded(a)
- };
- b.getGroupByName = function(a) {
- return d.getGroupByName(a)
- };
- b.createGroup = function(a, b, c) {
- "undefined" === typeof c && (c = !1);
- return d.createGroup(a, b, c)
- };
- b.hasRes = function(a) {
- return d.hasRes(a)
- };
- b.getRes = function(a) {
- return d.getRes(a)
- };
- b.getResAsync = function(a, b, c) {
- d.getResAsync(a, b, c)
- };
- b.getResByUrl = function(a, b, c, f) {
- "undefined" === typeof f && (f = "");
- d.getResByUrl(a, b, c, f)
- };
- b.destroyRes = function(a) {
- return d.destroyRes(a)
- };
- b.setMaxLoadingThread = function(a) {
- d.setMaxLoadingThread(a)
- };
- b.addEventListener = function(a, b, c, f, m) {
- "undefined" === typeof f && (f = !1);
- "undefined" === typeof m && (m = 0);
- d.addEventListener(a, b, c, f, m)
- };
- b.removeEventListener = function(a, b, c, f) {
- "undefined" === typeof f && (f = !1);
- d.removeEventListener(a, b, c, f)
- };
- var c = function(a) {
- function e() {
- a.call(this);
- this.analyzerDic = {};
- this.configItemList = [];
- this.configComplete = this.callLaterFlag = !1;
- this.loadedGroups = [];
- this.groupNameList = [];
- this.asyncDic = {};
- this.init()
- }
- __extends(e, a);
- e.prototype.getAnalyzerByType = function(a) {
- var e = this.analyzerDic[a];
- e || (e = this.analyzerDic[a] = egret.Injector.getInstance(b.AnalyzerBase, a));
- return e
- };
- e.prototype.init = function() {
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_BIN) || egret.Injector.mapClass(b.AnalyzerBase, b.BinAnalyzer, b.ResourceItem.TYPE_BIN);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_IMAGE) || egret.Injector.mapClass(b.AnalyzerBase, b.ImageAnalyzer, b.ResourceItem.TYPE_IMAGE);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_TEXT) || egret.Injector.mapClass(b.AnalyzerBase, b.TextAnalyzer, b.ResourceItem.TYPE_TEXT);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_JSON) || egret.Injector.mapClass(b.AnalyzerBase, b.JsonAnalyzer, b.ResourceItem.TYPE_JSON);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_SHEET) || egret.Injector.mapClass(b.AnalyzerBase, b.SheetAnalyzer, b.ResourceItem.TYPE_SHEET);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_FONT) || egret.Injector.mapClass(b.AnalyzerBase, b.FontAnalyzer, b.ResourceItem.TYPE_FONT);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_SOUND) || egret.Injector.mapClass(b.AnalyzerBase, b.SoundAnalyzer, b.ResourceItem.TYPE_SOUND);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_XML) || egret.Injector.mapClass(b.AnalyzerBase, b.XMLAnalyzer, b.ResourceItem.TYPE_XML);
- this.resConfig = new b.ResourceConfig;
- this.resLoader = new b.ResourceLoader;
- this.resLoader.callBack = this.onResourceItemComp;
- this.resLoader.resInstance = this;
- this.resLoader.addEventListener(b.ResourceEvent.GROUP_COMPLETE, this.onGroupComp, this)
- };
- e.prototype.loadConfig = function(a, b, e) {
- "undefined" === typeof e && (e = "json");
- this.configItemList.push({
- url: a,
- resourceRoot: b,
- type: e
- });
- this.callLaterFlag || (egret.callLater(this.startLoadConfig, this), this.callLaterFlag = !0)
- };
- e.prototype.startLoadConfig = function() {
- this.callLaterFlag = !1;
- var a = this.configItemList;
- this.configItemList = [];
- this.loadingConfigList = a;
- for (var c = a.length,
- d = [], l = 0; l < c; l++) {
- var h = a[l],
- h = new b.ResourceItem(h.url, h.url, h.type);
- d.push(h)
- }
- this.resLoader.loadGroup(d, e.GROUP_CONFIG, Number.MAX_VALUE)
- };
- e.prototype.isGroupLoaded = function(a) {
- return - 1 != this.loadedGroups.indexOf(a)
- };
- e.prototype.getGroupByName = function(a) {
- return this.resConfig.getGroupByName(a)
- };
- e.prototype.loadGroup = function(a, b) {
- "undefined" === typeof b && (b = 0);
- if ( - 1 == this.loadedGroups.indexOf(a) && !this.resLoader.isGroupInLoading(a)) if (this.configComplete) {
- var e = this.resConfig.getGroupByName(a);
- this.resLoader.loadGroup(e, a, b)
- } else this.groupNameList.push({
- name: a,
- priority: b
- })
- };
- e.prototype.createGroup = function(a, b, e) {
- "undefined" === typeof e && (e = !1);
- if (e) {
- var c = this.loadedGroups.indexOf(a); - 1 != c && this.loadedGroups.splice(c, 1)
- }
- return this.resConfig.createGroup(a, b, e)
- };
- e.prototype.onGroupComp = function(a) {
- if (a.groupName == e.GROUP_CONFIG) {
- a = this.loadingConfigList.length;
- for (var c = 0; c < a; c++) {
- var d = this.loadingConfigList[c],
- l = this.getAnalyzerByType(d.type),
- h = l.getRes(d.url);
- l.destroyRes(d.url);
- this.resConfig.parseConfig(h, d.resourceRoot)
- }
- this.configComplete = !0;
- this.loadingConfigList = null;
- b.ResourceEvent.dispatchResourceEvent(this, b.ResourceEvent.CONFIG_COMPLETE);
- d = this.groupNameList;
- a = d.length;
- for (c = 0; c < a; c++) l = d[c],
- this.loadGroup(l.name, l.priority);
- this.groupNameList = []
- } else this.loadedGroups.push(a.groupName),
- this.dispatchEvent(a)
- };
- e.prototype.hasRes = function(a) {
- var e = this.resConfig.getType(a);
- return "" == e && (a = b.AnalyzerBase.getStringPrefix(a), e = this.resConfig.getType(a), "" == e) ? !1 : !0
- };
- e.prototype.getRes = function(a) {
- var e = this.resConfig.getType(a);
- return "" == e && (e = b.AnalyzerBase.getStringPrefix(a), e = this.resConfig.getType(e), "" == e) ? null: this.getAnalyzerByType(e).getRes(a)
- };
- e.prototype.getResAsync = function(a, e, c) {
- var d = this.resConfig.getType(a),
- h = this.resConfig.getName(a);
- if ("" == d && (h = b.AnalyzerBase.getStringPrefix(a), d = this.resConfig.getType(h), "" == d)) {
- e.call(c, null);
- return
- } (d = this.getAnalyzerByType(d).getRes(a)) ? e.call(c, d) : (a = {
- key: a,
- compFunc: e,
- thisObject: c
- },
- this.asyncDic[h] ? this.asyncDic[h].push(a) : (this.asyncDic[h] = [a], h = this.resConfig.getResourceItem(h), this.resLoader.loadItem(h)))
- };
- e.prototype.getResByUrl = function(a, e, c, d) {
- "undefined" === typeof d && (d = "");
- if (a) {
- d || (d = this.getTypeByUrl(a));
- var h = this.getAnalyzerByType(d).getRes(a);
- h ? e.call(c, h) : (e = {
- key: a,
- compFunc: e,
- thisObject: c
- },
- this.asyncDic[a] ? this.asyncDic[a].push(e) : (this.asyncDic[a] = [e], a = new b.ResourceItem(a, a, d), this.resLoader.loadItem(a)))
- } else e.call(c, null)
- };
- e.prototype.getTypeByUrl = function(a) { (a = a.substr(a.lastIndexOf(".") + 1)) && (a = a.toLowerCase());
- switch (a) {
- case b.ResourceItem.TYPE_XML:
- case b.ResourceItem.TYPE_JSON:
- case b.ResourceItem.TYPE_SHEET:
- break;
- case "png":
- case "jpg":
- case "gif":
- a = b.ResourceItem.TYPE_IMAGE;
- break;
- case "fnt":
- a = b.ResourceItem.TYPE_FONT;
- break;
- case "txt":
- a = b.ResourceItem.TYPE_TEXT;
- break;
- case "mp3":
- case "ogg":
- case "mpeg":
- case "wav":
- case "m4a":
- case "mp4":
- case "aiff":
- case "wma":
- case "mid":
- a = b.ResourceItem.TYPE_SOUND;
- break;
- default:
- a = b.ResourceItem.TYPE_BIN
- }
- return a
- };
- e.prototype.onResourceItemComp = function(a) {
- var b = this.asyncDic[a.name];
- delete this.asyncDic[a.name];
- a = this.getAnalyzerByType(a.type);
- for (var e = b.length,
- c = 0; c < e; c++) {
- var d = b[c],
- k = a.getRes(d.key);
- d.compFunc.call(d.thisObject, k, d.key)
- }
- };
- e.prototype.destroyRes = function(a) {
- var b = this.resConfig.getRawGroupByName(a);
- if (b) {
- var e = this.loadedGroups.indexOf(a); - 1 != e && this.loadedGroups.splice(e, 1);
- a = b.length;
- for (var c = 0; c < a; c++) {
- e = b[c];
- e.loaded = !1;
- var d = this.getAnalyzerByType(e.type);
- d.destroyRes(e.name)
- }
- return ! 0
- }
- b = this.resConfig.getType(a);
- if ("" == b) return ! 1;
- e = this.resConfig.getRawResourceItem(a);
- e.loaded = !1;
- d = this.getAnalyzerByType(b);
- return d.destroyRes(a)
- };
- e.prototype.setMaxLoadingThread = function(a) {
- 1 > a && (a = 1);
- this.resLoader.thread = a
- };
- e.GROUP_CONFIG = "RES__CONFIG";
- return e
- } (egret.EventDispatcher);
- c.prototype.__class__ = "Resource";
- var d = new c
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(b) {
- "undefined" === typeof b && (b = 60);
- c.call(this);
- this.frameRate = b;
- this._time = 0;
- 60 == b && (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 || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame);
- a.requestAnimationFrame || (a.requestAnimationFrame = function(a) {
- return window.setTimeout(a, 1E3 / b)
- });
- a.cancelAnimationFrame || (a.cancelAnimationFrame = function(a) {
- return window.clearTimeout(a)
- });
- a.instance = this;
- this.registerListener()
- }
- __extends(a, c);
- a.prototype.enterFrame = function() {
- var e = a.instance,
- c = a._thisObject,
- d = a._callback,
- m = b.getTimer(),
- l = m - e._time;
- e._requestAnimationId = a.requestAnimationFrame.call(window, a.prototype.enterFrame);
- d.call(c, l);
- e._time = m
- };
- a.prototype.executeMainLoop = function(b, c) {
- a._callback = b;
- a._thisObject = c;
- this.enterFrame()
- };
- a.prototype.reset = function() {
- var e = a.instance;
- e._requestAnimationId && (e._time = b.getTimer(), a.cancelAnimationFrame.call(window, e._requestAnimationId), e.enterFrame())
- };
- a.prototype.registerListener = function() {
- var b = function() {
- a.instance.reset()
- },
- c = function() {
- document[d] || b()
- };
- window.onfocus = b;
- window.onblur = function() {};
- var d, m;
- "undefined" !== typeof document.hidden ? (d = "hidden", m = "visibilitychange") : "undefined" !== typeof document.mozHidden ? (d = "mozHidden", m = "mozvisibilitychange") : "undefined" !== typeof document.msHidden ? (d = "msHidden", m = "msvisibilitychange") : "undefined" !== typeof document.webkitHidden && (d = "webkitHidden", m = "webkitvisibilitychange");
- "onpageshow" in window && "onpagehide" in window && window.addEventListener("pageshow", b, !1);
- d && m && document.addEventListener(m, c, !1)
- };
- return a
- } (b.DeviceContext);
- b.HTML5DeviceContext = c;
- c.prototype.__class__ = "egret.HTML5DeviceContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- this.canvas = a;
- this.canvasContext = a.getContext("2d");
- var b = this.canvasContext.setTransform,
- f = this;
- this.canvasContext.setTransform = function(a, c, e, d, p, n) {
- f._matrixA = a;
- f._matrixB = c;
- f._matrixC = e;
- f._matrixD = d;
- f._matrixTx = p;
- f._matrixTy = n;
- b.call(f.canvasContext, a, c, e, d, p, n)
- };
- this._matrixA = 1;
- this._matrixC = this._matrixB = 0;
- this._matrixD = 1;
- this._transformTy = this._transformTx = this._matrixTy = this._matrixTx = 0;
- c.call(this)
- }
- __extends(a, c);
- a.prototype.clearScreen = function() {
- for (var a = b.RenderFilter.getInstance().getDrawAreaList(), c = 0, d = a.length; c < d; c++) {
- var m = a[c];
- this.clearRect(m.x + this._transformTx, m.y + this._transformTy, m.width, m.height)
- }
- this.renderCost = 0
- };
- a.prototype.clearRect = function(a, b, c, d) {
- this.canvasContext.clearRect(a, b, c, d)
- };
- a.prototype.drawImage = function(a, g, f, m, l, h, k, p, n) {
- g /= b.MainContext.instance.rendererContext.texture_scale_factor;
- f /= b.MainContext.instance.rendererContext.texture_scale_factor;
- m /= b.MainContext.instance.rendererContext.texture_scale_factor;
- l /= b.MainContext.instance.rendererContext.texture_scale_factor;
- a = a._bitmapData;
- h += this._transformTx;
- k += this._transformTy;
- var q = b.getTimer();
- this.canvasContext.drawImage(a, g, f, m, l, h, k, p, n);
- c.prototype.drawImage.call(this, a, g, f, m, l, h, k, p, n);
- this.renderCost += b.getTimer() - q
- };
- a.prototype.setTransform = function(a) {
- 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.canvasContext.setTransform(a.a, a.b, a.c, a.d, a.tx, a.ty))
- };
- a.prototype.setAlpha = function(a, c) {
- a != this.canvasContext.globalAlpha && (this.canvasContext.globalAlpha = a);
- c ? (this.blendValue = c, this.canvasContext.globalCompositeOperation = c) : this.blendValue != b.BlendMode.NORMAL && (this.blendValue = b.BlendMode.NORMAL, this.canvasContext.globalCompositeOperation = b.BlendMode.NORMAL)
- };
- a.prototype.setupFont = function(a) {
- var b = this.canvasContext,
- c = a.italic ? "italic ": "normal ",
- c = c + (a.bold ? "bold ": "normal "),
- c = c + (a.size + "px " + a.fontFamily);
- b.font = c;
- b.textAlign = "left";
- b.textBaseline = "middle"
- };
- a.prototype.measureText = function(a) {
- return this.canvasContext.measureText(a).width
- };
- a.prototype.drawText = function(a, b, f, m, l) {
- var h = a._strokeColorString,
- k = a.stroke,
- p = this.canvasContext;
- p.fillStyle = a._textColorString;
- p.strokeStyle = h;
- k && (p.lineWidth = 2 * k, p.strokeText(b, f + this._transformTx, m + this._transformTy, l || 65535));
- p.fillText(b, f + this._transformTx, m + this._transformTy, l || 65535);
- c.prototype.drawText.call(this, a, b, f, m, l)
- };
- a.prototype.strokeRect = function(a, b, c, d, l) {
- this.canvasContext.strokeStyle = l;
- this.canvasContext.strokeRect(a, b, c, d)
- };
- a.prototype.pushMask = function(a) {
- this.canvasContext.save();
- this.canvasContext.beginPath();
- this.canvasContext.rect(a.x + this._transformTx, a.y + this._transformTy, a.width, a.height);
- this.canvasContext.clip();
- this.canvasContext.closePath()
- };
- a.prototype.popMask = function() {
- this.canvasContext.restore();
- this.canvasContext.setTransform(1, 0, 0, 1, 0, 0)
- };
- a.prototype.onRenderStart = function() {
- this.canvasContext.save()
- };
- a.prototype.onRenderFinish = function() {
- this.canvasContext.restore();
- this.canvasContext.setTransform(1, 0, 0, 1, 0, 0)
- };
- return a
- } (b.RendererContext);
- b.HTML5CanvasRenderer = c;
- c.prototype.__class__ = "egret.HTML5CanvasRenderer"
- })(egret || (egret = {}));
- var egret_h5_graphics; (function(b) {
- b.beginFill = function(b, a) {
- "undefined" === typeof a && (a = 1);
- var e = "rgba(" + (b >> 16) + "," + ((b & 65280) >> 8) + "," + (b & 255) + "," + a + ")";
- this.fillStyleColor = e;
- this.commandQueue.push(new c(this._setStyle, this, [e]))
- };
- b.drawRect = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.beginPath();
- this.canvasContext.rect(d._transformTx + a, d._transformTy + b, c, e);
- this.canvasContext.closePath()
- },
- this, [b, a, e, g]));
- this._fill()
- };
- b.drawCircle = function(b, a, e) {
- this.commandQueue.push(new c(function(a, b, c) {
- var e = this.renderContext;
- this.canvasContext.beginPath();
- this.canvasContext.arc(e._transformTx + a, e._transformTy + b, c, 0, 2 * Math.PI);
- this.canvasContext.closePath()
- },
- this, [b, a, e]));
- this._fill()
- };
- b.drawRoundRect = function(b, a, e, g, f, m) {
- this.commandQueue.push(new c(function(a, b, c, e, d, g) {
- var f = this.renderContext;
- a = f._transformTx + a;
- b = f._transformTy + b;
- d /= 2;
- g = g ? g / 2 : d;
- c = a + c;
- e = b + e;
- f = e - g;
- this.canvasContext.beginPath();
- this.canvasContext.moveTo(c, f);
- this.canvasContext.quadraticCurveTo(c, e, c - d, e);
- this.canvasContext.lineTo(a + d, e);
- this.canvasContext.quadraticCurveTo(a, e, a, e - g);
- this.canvasContext.lineTo(a, b + g);
- this.canvasContext.quadraticCurveTo(a, b, a + d, b);
- this.canvasContext.lineTo(c - d, b);
- this.canvasContext.quadraticCurveTo(c, b, c, b + g);
- this.canvasContext.lineTo(c, f);
- this.canvasContext.closePath()
- },
- this, [b, a, e, g, f, m]));
- this._fill()
- };
- b.drawEllipse = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.save();
- a = d._transformTx + a;
- b = d._transformTy + b;
- var d = c > e ? c: e,
- g = c / d;
- e /= d;
- this.canvasContext.scale(g, e);
- this.canvasContext.beginPath();
- this.canvasContext.moveTo((a + c) / g, b / e);
- this.canvasContext.arc(a / g, b / e, d, 0, 2 * Math.PI);
- this.canvasContext.closePath();
- this.canvasContext.restore();
- this.canvasContext.stroke()
- },
- this, [b, a, e, g]));
- this._fill()
- };
- b.lineStyle = function(b, a, e, g, f, m, l, h) {
- "undefined" === typeof b && (b = NaN);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof e && (e = 1);
- "undefined" === typeof g && (g = !1);
- "undefined" === typeof f && (f = "normal");
- "undefined" === typeof m && (m = null);
- "undefined" === typeof l && (l = null);
- "undefined" === typeof h && (h = 3);
- this.strokeStyleColor && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand));
- this.strokeStyleColor = a = "rgba(" + (a >> 16) + "," + ((a & 65280) >> 8) + "," + (a & 255) + "," + e + ")";
- this.commandQueue.push(new c(function(a, b) {
- this.canvasContext.lineWidth = a;
- this.canvasContext.strokeStyle = b;
- this.canvasContext.beginPath()
- },
- this, [b, a]));
- "undefined" === typeof this.lineX && (this.lineY = this.lineX = 0);
- this.moveTo(this.lineX, this.lineY)
- };
- b.lineTo = function(b, a) {
- this.commandQueue.push(new c(function(a, b) {
- var c = this.renderContext;
- this.canvasContext.lineTo(c._transformTx + a, c._transformTy + b)
- },
- this, [b, a]));
- this.lineX = b;
- this.lineY = a
- };
- b.curveTo = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.quadraticCurveTo(d._transformTx + a, d._transformTy + b, c, e)
- },
- this, [b, a, e, g]));
- this.lineX = e;
- this.lineY = g
- };
- b.moveTo = function(b, a) {
- this.commandQueue.push(new c(function(a, b) {
- var c = this.renderContext;
- this.canvasContext.moveTo(c._transformTx + a, c._transformTy + b)
- },
- this, [b, a]))
- };
- b.clear = function() {
- this.lineY = this.lineX = this.commandQueue.length = 0;
- this.fillStyleColor = this.strokeStyleColor = null
- };
- b.createEndFillCommand = function() {
- this.endFillCommand || (this.endFillCommand = new c(function() {
- this.canvasContext.fill();
- this.canvasContext.closePath()
- },
- this, null))
- };
- b.endFill = function() {
- null != this.fillStyleColor && this._fill();
- this.fillStyleColor = null
- };
- b._fill = function() {
- this.fillStyleColor && (this.createEndFillCommand(), this.commandQueue.push(this.endFillCommand))
- };
- b.createEndLineCommand = function() {
- this.endLineCommand || (this.endLineCommand = new c(function() {
- this.canvasContext.stroke();
- this.canvasContext.closePath()
- },
- this, null))
- };
- b._draw = function(b) {
- this.renderContext = b;
- b = this.canvasContext = this.renderContext.canvasContext;
- b.save();
- var a = this.commandQueue.length;
- this.strokeStyleColor && 0 < a && this.commandQueue[a - 1] != this.endLineCommand && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand), a = this.commandQueue.length);
- for (var c = 0; c < a; c++) {
- var g = this.commandQueue[c];
- g.method.apply(g.thisObject, g.args)
- }
- b.restore()
- };
- var c = function() {
- return function(b, a, c) {
- this.method = b;
- this.thisObject = a;
- this.args = c
- }
- } ();
- c.prototype.__class__ = "Command";
- b._setStyle = function(b) {
- this.canvasContext.fillStyle = b;
- this.canvasContext.beginPath()
- };
- b.init = function() {
- for (var c in b) egret.Graphics.prototype[c] = b[c];
- egret.RendererContext.createRendererContext = function(a) {
- return new egret.HTML5CanvasRenderer(a)
- }
- }
- })(egret_h5_graphics || (egret_h5_graphics = {}));
- egret_h5_graphics.init();
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- c.call(this);
- this.size = 2E3;
- this.vertSize = 6;
- this.contextLost = !1;
- this.glContextId = 0;
- this.currentBlendMode = "";
- this.currentBaseTexture = null;
- this.currentBatchSize = 0;
- this.maskList = [];
- this.maskDataFreeList = [];
- this.canvasContext = document.createElement("canvas").getContext("2d");
- console.log("\u4f7f\u7528WebGL\u6a21\u5f0f");
- this.canvas = a;
- a.addEventListener("webglcontextlost", this.handleContextLost.bind(this), !1);
- a.addEventListener("webglcontextrestored", this.handleContextRestored.bind(this), !1);
- this.projectionX = a.width / 2;
- this.projectionY = -a.height / 2;
- a = 6 * this.size;
- this.vertices = new Float32Array(4 * this.size * this.vertSize);
- this.indices = new Uint16Array(a);
- for (var g = 0,
- f = 0; g < a; g += 6, f += 4) this.indices[g + 0] = f + 0,
- this.indices[g + 1] = f + 1,
- this.indices[g + 2] = f + 2,
- this.indices[g + 3] = f + 0,
- this.indices[g + 4] = f + 2,
- this.indices[g + 5] = f + 3;
- this.initWebGL();
- this.shaderManager = new b.WebGLShaderManager(this.gl);
- this.worldTransform = new b.Matrix;
- this.initBlendMode();
- b.MainContext.instance.addEventListener(b.Event.FINISH_RENDER, this._draw, this);
- b.TextField.prototype._draw = function(a) {
- this.getDirty() && (this.cacheAsBitmap = !0);
- b.DisplayObject.prototype._draw.call(this, a)
- }
- }
- __extends(a, c);
- a.prototype.handleContextLost = function() {
- this.contextLost = !0
- };
- a.prototype.handleContextRestored = function() {
- this.initWebGL();
- this.shaderManager.setContext(this.gl);
- this.contextLost = !1
- };
- a.prototype.initWebGL = function() {
- for (var a = {
- stencil: !0
- },
- b, c = ["experimental-webgl", "webgl"], d = 0; d < c.length; d++) {
- try {
- b = this.canvas.getContext(c[d], a)
- } catch(l) {}
- if (b) break
- }
- if (!b) throw Error("\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301webgl");
- this.setContext(b)
- };
- a.prototype.setContext = function(a) {
- this.gl = a;
- a.id = this.glContextId++;
- this.vertexBuffer = a.createBuffer();
- this.indexBuffer = a.createBuffer();
- a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
- a.bufferData(a.ELEMENT_ARRAY_BUFFER, this.indices, a.STATIC_DRAW);
- a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
- a.bufferData(a.ARRAY_BUFFER, this.vertices, a.DYNAMIC_DRAW);
- a.disable(a.DEPTH_TEST);
- a.disable(a.CULL_FACE);
- a.enable(a.BLEND);
- a.colorMask(!0, !0, !0, !0)
- };
- a.prototype.initBlendMode = function() {
- a.blendModesWebGL[b.BlendMode.NORMAL] = [this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA];
- a.blendModesWebGL[b.BlendMode.ADD] = [this.gl.SRC_ALPHA, this.gl.DST_ALPHA]
- };
- a.prototype.start = function() {
- if (!this.contextLost) {
- var a = this.gl;
- a.activeTexture(a.TEXTURE0);
- a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
- a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
- var b = this.shaderManager.defaultShader;
- a.uniform2f(b.projectionVector, this.projectionX, this.projectionY);
- var c = 4 * this.vertSize;
- a.vertexAttribPointer(b.aVertexPosition, 2, a.FLOAT, !1, c, 0);
- a.vertexAttribPointer(b.aTextureCoord, 2, a.FLOAT, !1, c, 8);
- a.vertexAttribPointer(b.colorAttribute, 2, a.FLOAT, !1, c, 16)
- }
- };
- a.prototype.clearScreen = function() {
- var a = this.gl;
- a.colorMask(!0, !0, !0, !0);
- for (var c = b.RenderFilter.getInstance().getDrawAreaList(), d = 0, m = c.length; d < m; d++) {
- var l = c[d];
- a.viewport(l.x, l.y, l.width, l.height);
- a.bindFramebuffer(a.FRAMEBUFFER, null);
- a.clearColor(0, 0, 0, 0);
- a.clear(a.COLOR_BUFFER_BIT)
- }
- this.renderCost = 0
- };
- a.prototype.setBlendMode = function(c) {
- c || (c = b.BlendMode.NORMAL);
- if (this.currentBlendMode != c) {
- var d = a.blendModesWebGL[c];
- d && (this.gl.blendFunc(d[0], d[1]), this.currentBlendMode = c)
- }
- };
- a.prototype.drawImage = function(a, c, d, m, l, h, k, p, n) {
- if (!this.contextLost) {
- var q = b.MainContext.instance.rendererContext.texture_scale_factor;
- c /= q;
- d /= q;
- m /= q;
- l /= q;
- this.createWebGLTexture(a);
- if (a.webGLTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size) this._draw(),
- this.currentBaseTexture = a.webGLTexture;
- var t = this.worldTransform,
- r = t.a,
- s = t.b,
- u = t.c,
- v = t.d,
- x = t.tx,
- y = t.ty;
- 0 == h && 0 == k || t.append(1, 0, 0, 1, h, k);
- 1 == m / p && 1 == l / n || t.append(p / m, 0, 0, n / l, 0, 0);
- h = t.a;
- k = t.b;
- p = t.c;
- n = t.d;
- var q = t.tx,
- w = t.ty;
- t.a = r;
- t.b = s;
- t.c = u;
- t.d = v;
- t.tx = x;
- t.ty = y;
- r = a._sourceWidth;
- s = a._sourceHeight;
- a = m;
- t = l;
- c /= r;
- d /= s;
- m /= r;
- l /= s;
- r = this.vertices;
- s = 4 * this.currentBatchSize * this.vertSize;
- u = this.worldAlpha;
- r[s++] = q;
- r[s++] = w;
- r[s++] = c;
- r[s++] = d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = h * a + q;
- r[s++] = k * a + w;
- r[s++] = m + c;
- r[s++] = d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = h * a + p * t + q;
- r[s++] = n * t + k * a + w;
- r[s++] = m + c;
- r[s++] = l + d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = p * t + q;
- r[s++] = n * t + w;
- r[s++] = c;
- r[s++] = l + d;
- r[s++] = u;
- r[s++] = 16777215;
- this.currentBatchSize++
- }
- };
- a.prototype._draw = function() {
- if (0 != this.currentBatchSize && !this.contextLost) {
- var a = b.getTimer();
- this.start();
- var c = this.gl;
- c.bindTexture(c.TEXTURE_2D, this.currentBaseTexture);
- var d = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize);
- c.bufferSubData(c.ARRAY_BUFFER, 0, d);
- c.drawElements(c.TRIANGLES, 6 * this.currentBatchSize, c.UNSIGNED_SHORT, 0);
- this.currentBatchSize = 0;
- this.renderCost += b.getTimer() - a;
- b.Profiler.getInstance().onDrawImage()
- }
- };
- a.prototype.setTransform = function(a) {
- var b = this.worldTransform;
- b.a = a.a;
- b.b = a.b;
- b.c = a.c;
- b.d = a.d;
- b.tx = a.tx;
- b.ty = a.ty
- };
- a.prototype.setAlpha = function(a, b) {
- this.worldAlpha = a;
- this.setBlendMode(b)
- };
- a.prototype.createWebGLTexture = function(a) {
- if (!a.webGLTexture) {
- var b = this.gl;
- a.webGLTexture = b.createTexture();
- b.bindTexture(b.TEXTURE_2D, a.webGLTexture);
- b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
- b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, b.RGBA, b.UNSIGNED_BYTE, a._bitmapData);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.LINEAR);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE);
- b.bindTexture(b.TEXTURE_2D, null)
- }
- };
- a.prototype.pushMask = function(a) {
- this._draw();
- var b = this.gl;
- 0 == this.maskList.length && (b.enable(b.STENCIL_TEST), b.stencilFunc(b.ALWAYS, 1, 1));
- var c = this.maskDataFreeList.pop();
- c ? (c.x = a.x, c.y = a.y, c.w = a.width, c.h = a.height) : c = {
- x: a.x,
- y: a.y,
- w: a.width,
- h: a.height
- };
- this.maskList.push(c);
- b.colorMask(!1, !1, !1, !1);
- b.stencilOp(b.KEEP, b.KEEP, b.INCR);
- this.renderGraphics(c);
- b.colorMask(!0, !0, !0, !0);
- b.stencilFunc(b.NOTEQUAL, 0, this.maskList.length);
- b.stencilOp(b.KEEP, b.KEEP, b.KEEP)
- };
- a.prototype.popMask = function() {
- this._draw();
- var a = this.gl,
- b = this.maskList.pop();
- 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));
- 0 == this.maskList.length && a.disable(a.STENCIL_TEST)
- };
- a.prototype.setupFont = function(a) {
- var b = this.canvasContext,
- c = a.italic ? "italic ": "normal ",
- c = c + (a.bold ? "bold ": "normal "),
- c = c + (a.size + "px " + a.fontFamily);
- b.font = c;
- b.textAlign = "left";
- b.textBaseline = "middle"
- };
- a.prototype.measureText = function(a) {
- return this.canvasContext.measureText(a).width
- };
- a.prototype.renderGraphics = function(a) {
- var b = this.gl,
- c = this.shaderManager.primitiveShader;
- this.graphicsPoints ? (this.graphicsPoints.length = 0, this.graphicsIndices.length = 0) : (this.graphicsPoints = [], this.graphicsIndices = [], this.graphicsBuffer = b.createBuffer(), this.graphicsIndexBuffer = b.createBuffer());
- this.updateGraphics(a);
- this.shaderManager.activateShader(c);
- b.blendFunc(b.ONE, b.ONE_MINUS_SRC_ALPHA);
- b.uniformMatrix3fv(c.translationMatrix, !1, this.worldTransform.toArray(!0));
- b.uniform2f(c.projectionVector, this.projectionX, -this.projectionY);
- b.uniform2f(c.offsetVector, 0, 0);
- b.uniform3fv(c.tintColor, [1, 1, 1]);
- b.uniform1f(c.alpha, this.worldAlpha);
- b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
- b.vertexAttribPointer(c.aVertexPosition, 2, b.FLOAT, !1, 24, 0);
- b.vertexAttribPointer(c.colorAttribute, 4, b.FLOAT, !1, 24, 8);
- b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
- b.drawElements(b.TRIANGLE_STRIP, this.graphicsIndices.length, b.UNSIGNED_SHORT, 0);
- this.shaderManager.activateShader(this.shaderManager.defaultShader)
- };
- a.prototype.updateGraphics = function(a) {
- var b = this.gl;
- this.buildRectangle(a);
- b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
- b.bufferData(b.ARRAY_BUFFER, new Float32Array(this.graphicsPoints), b.STATIC_DRAW);
- b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
- b.bufferData(b.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.graphicsIndices), b.STATIC_DRAW)
- };
- a.prototype.buildRectangle = function(a) {
- var b = a.x,
- c = a.y,
- d = a.w;
- a = a.h;
- var l = this.graphicsPoints,
- h = this.graphicsIndices,
- k = l.length / 6;
- l.push(b, c);
- l.push(0, 0, 0, 1);
- l.push(b + d, c);
- l.push(0, 0, 0, 1);
- l.push(b, c + a);
- l.push(0, 0, 0, 1);
- l.push(b + d, c + a);
- l.push(0, 0, 0, 1);
- h.push(k, k, k + 1, k + 2, k + 3, k + 3)
- };
- a.blendModesWebGL = {};
- return a
- } (b.RendererContext);
- b.WebGLRenderer = c;
- c.prototype.__class__ = "egret.WebGLRenderer"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.compileProgram = function(a, c, g) {
- g = b.compileFragmentShader(a, g);
- c = b.compileVertexShader(a, c);
- var f = a.createProgram();
- a.attachShader(f, c);
- a.attachShader(f, g);
- a.linkProgram(f);
- a.getProgramParameter(f, a.LINK_STATUS) || console.log("\u65e0\u6cd5\u521d\u59cb\u5316\u7740\u8272\u5668");
- return f
- };
- b.compileFragmentShader = function(a, c) {
- return b._compileShader(a, c, a.FRAGMENT_SHADER)
- };
- b.compileVertexShader = function(a, c) {
- return b._compileShader(a, c, a.VERTEX_SHADER)
- };
- b._compileShader = function(a, b, c) {
- c = a.createShader(c);
- a.shaderSource(c, b);
- a.compileShader(c);
- return a.getShaderParameter(c, a.COMPILE_STATUS) ? c: (console.log(a.getShaderInfoLog(c)), null)
- };
- b.checkCanUseWebGL = function() {
- if (void 0 == b.canUseWebGL) try {
- var a = document.createElement("canvas");
- b.canUseWebGL = !!window.WebGLRenderingContext && !(!a.getContext("webgl") && !a.getContext("experimental-webgl"))
- } catch(c) {
- b.canUseWebGL = !1
- }
- return b.canUseWebGL
- };
- return b
- } ();
- b.WebGLUtils = c;
- c.prototype.__class__ = "egret.WebGLUtils"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b(a) {
- this.maxAttibs = 10;
- this.attribState = [];
- this.tempAttribState = [];
- for (var c = 0; c < this.maxAttibs; c++) this.attribState[c] = !1;
- this.setContext(a)
- }
- b.prototype.setContext = function(b) {
- this.gl = b;
- this.primitiveShader = new a(b);
- this.defaultShader = new d(b);
- this.activateShader(this.defaultShader)
- };
- b.prototype.activateShader = function(a) {
- this.gl.useProgram(a.program);
- this.setAttribs(a.attributes)
- };
- b.prototype.setAttribs = function(a) {
- var b, c;
- c = this.tempAttribState.length;
- for (b = 0; b < c; b++) this.tempAttribState[b] = !1;
- c = a.length;
- for (b = 0; b < c; b++) this.tempAttribState[a[b]] = !0;
- a = this.gl;
- c = this.attribState.length;
- 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))
- };
- return b
- } ();
- b.WebGLShaderManager = c;
- c.prototype.__class__ = "egret.WebGLShaderManager";
- var d = function() {
- function a(b) {
- this.defaultVertexSrc = "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 vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;\n vColor = vec4(color * aColor.x, aColor.x);\n}";
- this.program = null;
- this.fragmentSrc = "precision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;\n}";
- this.gl = b;
- this.init()
- }
- a.prototype.init = function() {
- var a = this.gl,
- c = b.WebGLUtils.compileProgram(a, this.defaultVertexSrc, this.fragmentSrc);
- a.useProgram(c);
- this.uSampler = a.getUniformLocation(c, "uSampler");
- this.projectionVector = a.getUniformLocation(c, "projectionVector");
- this.offsetVector = a.getUniformLocation(c, "offsetVector");
- this.dimensions = a.getUniformLocation(c, "dimensions");
- this.aVertexPosition = a.getAttribLocation(c, "aVertexPosition");
- this.aTextureCoord = a.getAttribLocation(c, "aTextureCoord");
- this.colorAttribute = a.getAttribLocation(c, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
- this.attributes = [this.aVertexPosition, this.aTextureCoord, this.colorAttribute];
- this.program = c
- };
- return a
- } ();
- b.EgretShader = d;
- d.prototype.__class__ = "egret.EgretShader";
- var a = function() {
- function a(b) {
- this.alpha = this.translationMatrix = this.attributes = this.colorAttribute = this.aVertexPosition = this.tintColor = this.offsetVector = this.projectionVector = this.program = null;
- this.fragmentSrc = "precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
- 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}";
- this.gl = b;
- this.init()
- }
- a.prototype.init = function() {
- var a = this.gl,
- c = b.WebGLUtils.compileProgram(a, this.vertexSrc, this.fragmentSrc);
- a.useProgram(c);
- this.projectionVector = a.getUniformLocation(c, "projectionVector");
- this.offsetVector = a.getUniformLocation(c, "offsetVector");
- this.tintColor = a.getUniformLocation(c, "tint");
- this.aVertexPosition = a.getAttribLocation(c, "aVertexPosition");
- this.colorAttribute = a.getAttribLocation(c, "aColor");
- this.attributes = [this.aVertexPosition, this.colorAttribute];
- this.translationMatrix = a.getUniformLocation(c, "translationMatrix");
- this.alpha = a.getUniformLocation(c, "alpha");
- this.program = c
- };
- return a
- } ();
- b.PrimitiveShader = a;
- a.prototype.__class__ = "egret.PrimitiveShader"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this)
- }
- __extends(a, c);
- a.prototype.proceed = function(a) {
- function c(d) {
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- }
- function d(c) {
- switch (a.dataFormat) {
- case b.URLLoaderDataFormat.TEXT:
- a.data = l.responseText;
- break;
- case b.URLLoaderDataFormat.VARIABLES:
- a.data = new b.URLVariables(l.responseText);
- break;
- case b.URLLoaderDataFormat.BINARY:
- a.data = l.response;
- break;
- default:
- a.data = l.responseText
- }
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- }
- if (a.dataFormat == b.URLLoaderDataFormat.TEXTURE) this.loadTexture(a);
- else if (a.dataFormat == b.URLLoaderDataFormat.SOUND) this.loadSound(a);
- else {
- var m = a._request,
- l = this.getXHR();
- l.onerror = c;
- l.onload = d;
- l.open(m.method, m.url, !0);
- this.setResponseType(l, a.dataFormat);
- m.method != b.URLRequestMethod.GET && m.data ? m.data instanceof b.URLVariables ? (l.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), l.send(m.data.toString())) : (l.setRequestHeader("Content-Type", "multipart/form-data"), l.send(m.data)) : l.send()
- }
- };
- a.prototype.loadSound = function(a) {
- function c(l) {
- window.clearTimeout(m.__timeoutId);
- m.removeEventListener("canplaythrough", c, !1);
- m.removeEventListener("error", d, !1);
- l = new b.Sound;
- l._setAudio(m);
- a.data = l;
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- }
- function d(l) {
- window.clearTimeout(m.__timeoutId);
- m.removeEventListener("canplaythrough", c, !1);
- m.removeEventListener("error", d, !1);
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- }
- var m = new Audio(a._request.url);
- m.__timeoutId = window.setTimeout(c, 100);
- m.addEventListener("canplaythrough", c, !1);
- m.addEventListener("error", d, !1);
- m.load()
- };
- a.prototype.getXHR = function() {
- return window.XMLHttpRequest ? new window.XMLHttpRequest: new ActiveXObject("MSXML2.XMLHTTP")
- };
- a.prototype.setResponseType = function(a, c) {
- switch (c) {
- case b.URLLoaderDataFormat.TEXT:
- case b.URLLoaderDataFormat.VARIABLES:
- a.responseType = b.URLLoaderDataFormat.TEXT;
- break;
- case b.URLLoaderDataFormat.BINARY:
- a.responseType = "arraybuffer";
- break;
- default:
- a.responseType = c
- }
- };
- a.prototype.loadTexture = function(a) {
- var c = a._request,
- d = new Image;
- d.crossOrigin = "Anonymous";
- d.onload = function(c) {
- d.onerror = null;
- d.onload = null;
- c = new b.Texture;
- c._setBitmapData(d);
- a.data = c;
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- };
- d.onerror = function(c) {
- d.onerror = null;
- d.onload = null;
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- };
- d.src = c.url
- };
- return a
- } (b.NetContext);
- b.HTML5NetContext = c;
- c.prototype.__class__ = "egret.HTML5NetContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- c.call(this);
- this.canvas = a;
- this._isTouchDown = !1
- }
- __extends(a, c);
- a.prototype.run = function() {
- var a = this;
- window.navigator.msPointerEnabled ? (this.canvas.addEventListener("MSPointerDown",
- function(b) {
- a._onTouchBegin(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1), this.canvas.addEventListener("MSPointerMove",
- function(b) {
- a._onTouchMove(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1), this.canvas.addEventListener("MSPointerUp",
- function(b) {
- a._onTouchEnd(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1)) : b.MainContext.deviceType == b.MainContext.DEVICE_MOBILE ? this.addTouchListener() : b.MainContext.deviceType == b.MainContext.DEVICE_PC && (this.addTouchListener(), this.addMouseListener());
- window.addEventListener("mousedown",
- function(b) {
- a.inOutOfCanvas(b) ? a.dispatchLeaveStageEvent() : a._isTouchDown = !0
- });
- window.addEventListener("mouseup",
- function(b) {
- a._isTouchDown && a.inOutOfCanvas(b) && a.dispatchLeaveStageEvent();
- a._isTouchDown = !1
- })
- };
- a.prototype.addMouseListener = function() {
- var a = this;
- this.canvas.addEventListener("mousedown",
- function(b) {
- a._onTouchBegin(b)
- });
- this.canvas.addEventListener("mousemove",
- function(b) {
- a._onTouchMove(b)
- });
- this.canvas.addEventListener("mouseup",
- function(b) {
- a._onTouchEnd(b)
- })
- };
- a.prototype.addTouchListener = function() {
- var a = this;
- this.canvas.addEventListener("touchstart",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchBegin(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchmove",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchMove(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchend",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchcancel",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1)
- };
- a.prototype.inOutOfCanvas = function(a) {
- a = this.getLocation(this.canvas, a);
- return 0 > a.x || 0 > a.y || a.x > this.canvas.width || a.y > this.canvas.height ? !0 : !1
- };
- a.prototype.dispatchLeaveStageEvent = function() {
- b.MainContext.instance.stage.dispatchEventWith(b.Event.LEAVE_STAGE)
- };
- a.prototype._onTouchBegin = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchBegan(b.x, b.y, c)
- };
- a.prototype._onTouchMove = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchMove(b.x, b.y, c)
- };
- a.prototype._onTouchEnd = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchEnd(b.x, b.y, c)
- };
- a.prototype.getLocation = function(a, c) {
- var d = document.documentElement,
- m = window,
- l, h;
- "function" === typeof a.getBoundingClientRect ? (h = a.getBoundingClientRect(), l = h.left, h = h.top) : h = l = 0;
- l += m.pageXOffset - d.clientLeft;
- h += m.pageYOffset - d.clientTop;
- null != c.pageX ? (d = c.pageX, m = c.pageY) : (l -= document.body.scrollLeft, h -= document.body.scrollTop, d = c.clientX, m = c.clientY);
- var k = b.Point.identity;
- k.x = (d - l) / b.StageDelegate.getInstance().getScaleX();
- k.y = (m - h) / b.StageDelegate.getInstance().getScaleY();
- return k
- };
- return a
- } (b.TouchContext);
- b.HTML5TouchContext = c;
- c.prototype.__class__ = "egret.HTML5TouchContext"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- LoadingUI = function(b) {
- function c() {
- b.call(this);
- this.createView()
- }
- __extends(c, b);
- c.prototype.createView = function() {
- this.textField = new egret.TextField;
- this.addChild(this.textField);
- this.textField.y = 300;
- this.textField.width = 480;
- this.textField.height = 100;
- this.textField.textAlign = "center"
- };
- c.prototype.setProgress = function(b, a) {
- this.textField.text = "\u6e38\u620f\u52a0\u8f7d\u4e2d..." + b + "/" + a
- };
- return c
- } (egret.Sprite);
- LoadingUI.prototype.__class__ = "LoadingUI";
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- MyBtn = function(b) {
- function c() {
- b.call(this);
- this.isRight = !1
- }
- __extends(c, b);
- c.prototype.createView = function(b, a, c) {
- this.touchChildren = !1;
- this.touchEnabled = !0;
- this.sprite = new egret.Sprite;
- this.sprite.graphics.beginFill(c);
- this.sprite.graphics.drawRect(0, 0, 130, 60);
- this.sprite.graphics.endFill();
- this.addChild(this.sprite);
- this.textField = new egret.TextField;
- this.addChild(this.textField);
- this.textField.width = 130;
- this.textField.text = b;
- this.textField.textColor = a;
- this.textField.textAlign = "center";
- this.textField.bold = !0;
- this.textField.size = 40;
- this.textField.y = (60 - this.textField.height) / 2
- };
- c.prototype.setLabelText = function(b) {
- this.textField.text = b
- };
- return c
- } (egret.Sprite);
- MyBtn.prototype.__class__ = "MyBtn";
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- Main = function(b) {
- function c() {
- b.call(this);
- this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
- }
- __extends(c, b);
- c.prototype.onAddToStage = function(b) {
- this.loadingView = new LoadingUI;
- this.stage.addChild(this.loadingView);
- RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.loadConfig("resource/resource.json", "resource/")
- };
- c.prototype.onConfigComplete = function(b) {
- RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
- RES.loadGroup("preload")
- };
- c.prototype.onResourceLoadComplete = function(b) {
- "preload" == b.groupName && (this.stage.removeChild(this.loadingView), RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this), this.createGameScene())
- };
- c.prototype.onResourceProgress = function(b) {
- "preload" == b.groupName && this.loadingView.setProgress(b.itemsLoaded, b.itemsTotal)
- };
- c.prototype.createGameScene = function() {
- document.title = "\u662f\u7537\u4eba\u575a\u630160\u79d2\uff01";
- this.gameText = new egret.TextField;
- this.gameText.width = 405;
- this.gameText.size = 40;
- this.gameText.text = "\u662f\u7537\u4eba\u575a\u630160\u79d2";
- this.addChild(this.gameText);
- this.gameText.textAlign = "center";
- this.gameText.bold = !0;
- this.gameText.textColor = 7349024;
- this.gameText.y = 30;
- var b = this.createBitmapByName("man");
- this.man = new egret.Sprite;
- this.man.addChild(b);
- this.man.anchorOffsetX = 96;
- this.man.anchorOffsetY = 270;
- this.man.x = 215;
- this.man.y = 380;
- this.addChild(this.man);
- this.gameBtn = new MyBtn;
- this.gameBtn.createView("\u5f00\u59cb", 16777215, 7349024);
- this.addChild(this.gameBtn);
- this.gameBtn.x = 138;
- this.gameBtn.y = 490;
- this.gameBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onGameBtnClick, this);
- b = this.createBitmapByName("btn");
- b.rotation = 180;
- this.lBtn = new egret.Sprite;
- this.lBtn.addChild(b);
- this.lBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.lBtnClick, this);
- this.lBtn.x = 75;
- this.lBtn.y = 500;
- this.lBtn.touchEnabled = !0;
- b = this.createBitmapByName("btn");
- this.rBtn = new egret.Sprite;
- this.rBtn.addChild(b);
- this.rBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.rBtnClick, this);
- this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisTap, this);
- this.rBtn.touchEnabled = !0;
- this.rBtn.x = 330;
- this.rBtn.y = 460;
- this.gameTimer = new egret.Timer(100);
- this.gameTimer.addEventListener(egret.TimerEvent.TIMER, this.onGameTimer, this);
- this.touchEnabled = !0
- };
- c.prototype.thisTap = function(b) {
- this.nr = 202.5 < b.stageX ? this.nr + (1 * Math.random() + 1) : this.nr + -(1 * Math.random() + 1)
- };
- c.prototype.onGameTimer = function(b) {
- this.nr *= 1.1;
- this.man.rotation += this.nr;
- this.gameText.text = (this.gameTimer.currentCount() / 10).toString();
- if (75 < this.man.rotation || -75 > this.man.rotation) {
- this.wx = this.createBitmapByName("wx");
- this.addChild(this.wx);
- b = this.stage.stageWidth;
- this.wx.width = 80;
- this.wx.height = 21.6;
- this.wx.x = b - this.wx.width;
- this.wx.y = 0;
- b = this.gameText.text;
- this.gameText.text = "\u4f60\u624d\u575a\u6301\u4e86" + b + "\u79d2";
- // updateShare(b);
- // Play68.setRankingScoreDesc(b);
- var a = this.gameTimer.currentCount() / 10 / 100 + 0.5;
- 0.99 < a && (a = 0.99);
- a = 1E4 * a >> 0;
- a /= 100;
- document.title = "\u6211\u575a\u6301\u4e86" + b + "\u79d2\uff0c\u8d85\u8fc7\u4e86\u5168\u56fd" + a + "%\u7684\u4eba\uff01\u4f60\u80fd\u8d85\u8fc7\u6211\u5417\uff1f\u5feb\u6765\u6311\u6218\u5427\uff01";
- this.gameBtn.setLabelText("\u91cd\u6765");
- this.addChild(this.gameBtn);
- this.gameBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onReGameBtnClick, this);
- this.gameTimer.reset()
- }
- };
- c.prototype.onReGameBtnClick = function(b) {
- document.title = "\u662f\u7537\u4eba\u575a\u630160\u79d2\uff01";
- this.removeChild(this.wx);
- this.removeChild(this.gameBtn);
- this.gameBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onReGameBtnClick, this);
- this.beginGame()
- };
- c.prototype.onGameBtnClick = function(b) {
- this.removeChild(this.gameBtn);
- this.gameBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onGameBtnClick, this);
- this.beginGame()
- };
- c.prototype.beginGame = function() {
- // updateShare(0);
- this.man.rotation = 0;
- this.nr = Math.random() + 0.5;
- this.gameTimer.reset();
- this.gameTimer.start();
- this.addChild(this.lBtn);
- this.addChild(this.rBtn)
-
- };
- c.prototype.lBtnClick = function(b) {};
- c.prototype.rBtnClick = function(b) {};
- c.prototype.createBitmapByName = function(b) {
- var a = new egret.Bitmap;
- b = RES.getRes(b);
- a.texture = b;
- return a
- };
- c.prototype.mySort = function(b, a) {
- return b > a ? 1 : -1
- };
- return c
- } (egret.DisplayObjectContainer);
- Main.prototype.__class__ = "Main";var egret; (function(b) {
- var c = function() {
- function b() {
- this._hashCode = b.hashCount++
- }
- Object.defineProperty(b.prototype, "hashCode", {
- get: function() {
- return this._hashCode
- },
- enumerable: !0,
- configurable: !0
- });
- b.hashCount = 1;
- return b
- } ();
- b.HashObject = c;
- c.prototype.__class__ = "egret.HashObject"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e) {
- "undefined" === typeof e && (e = 300);
- b.call(this);
- this.objectPool = [];
- this._length = 0;
- 1 > e && (e = 1);
- this.autoDisposeTime = e;
- this.frameCount = 0
- }
- __extends(a, b);
- a.prototype._checkFrame = function() {
- this.frameCount--;
- 0 >= this.frameCount && this.dispose()
- };
- Object.defineProperty(a.prototype, "length", {
- get: function() {
- return this._length
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.push = function(e) {
- var g = this.objectPool; - 1 == g.indexOf(e) && (g.push(e), this._length++, 0 == this.frameCount && (this.frameCount = this.autoDisposeTime, a._callBackList.push(this)))
- };
- a.prototype.pop = function() {
- if (0 == this._length) return null;
- this._length--;
- return this.objectPool.pop()
- };
- a.prototype.dispose = function() {
- 0 < this._length && (this.objectPool = [], this._length = 0);
- this.frameCount = 0;
- var e = a._callBackList,
- g = e.indexOf(this); - 1 != g && e.splice(g, 1)
- };
- a._callBackList = [];
- return a
- } (b.HashObject);
- b.Recycler = c;
- c.prototype.__class__ = "egret.Recycler"
- })(egret || (egret = {})); (function(b) {
- b.__START_TIME;
- b.getTimer = function() {
- return Date.now() - b.__START_TIME
- }
- })(egret || (egret = {})); (function(b) {
- b.__callLaterFunctionList = [];
- b.__callLaterThisList = [];
- b.__callLaterArgsList = [];
- b.callLater = function(c, d) {
- for (var a = [], e = 0; e < arguments.length - 2; e++) a[e] = arguments[e + 2];
- b.__callLaterFunctionList.push(c);
- b.__callLaterThisList.push(d);
- b.__callLaterArgsList.push(a)
- }
- })(egret || (egret = {}));
- var egret_dom; (function(b) {
- function c() {
- for (var b = document.createElement("div").style, a = ["t", "webkitT", "msT", "MozT", "OT"], e = 0; e < a.length; e++) if (a[e] + "ransform" in b) return a[e];
- return a[0]
- }
- b.header = "";
- b.getHeader = c;
- b.getTrans = function(d) {
- "" == b.header && (b.header = c());
- return b.header + d.substring(1, d.length)
- }
- })(egret_dom || (egret_dom = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this);
- this._eventPhase = 2;
- this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1;
- this.isNew = !0;
- this._type = e;
- this._bubbles = a;
- this._cancelable = f
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "type", {
- get: function() {
- return this._type
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bubbles", {
- get: function() {
- return this._bubbles
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "cancelable", {
- get: function() {
- return this._cancelable
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "eventPhase", {
- get: function() {
- return this._eventPhase
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "currentTarget", {
- get: function() {
- return this._currentTarget
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setCurrentTarget = function(e) {
- this._currentTarget = e
- };
- Object.defineProperty(a.prototype, "target", {
- get: function() {
- return this._target
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.isDefaultPrevented = function() {
- return this._isDefaultPrevented
- };
- a.prototype.preventDefault = function() {
- this._cancelable && (this._isDefaultPrevented = !0)
- };
- a.prototype.stopPropagation = function() {
- this._bubbles && (this._isPropagationStopped = !0)
- };
- a.prototype.stopImmediatePropagation = function() {
- this._bubbles && (this._isPropagationImmediateStopped = !0)
- };
- a.prototype._reset = function() {
- this.isNew ? this.isNew = !1 : (this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1, this._currentTarget = this._target = null, this._eventPhase = 2)
- };
- a._dispatchByTarget = function(e, a, f, d, c, h) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof h && (h = !1);
- var k = e.eventRecycler;
- k || (k = e.eventRecycler = new b.Recycler);
- var p = k.pop();
- p ? p._type = f: p = new e(f);
- p._bubbles = c;
- p._cancelable = h;
- if (d) for (var n in d) p[n] = d[n],
- null !== p[n] && (d[n] = null);
- e = a.dispatchEvent(p);
- k.push(p);
- return e
- };
- a._getPropertyData = function(e) {
- var a = e._props;
- a || (a = e._props = {});
- return a
- };
- a.dispatchEvent = function(e, g, f, b) {
- "undefined" === typeof f && (f = !1);
- var d = a._getPropertyData(a);
- b && (d.data = b);
- a._dispatchByTarget(a, e, g, d, f)
- };
- a.ADDED_TO_STAGE = "addedToStage";
- a.REMOVED_FROM_STAGE = "removedFromStage";
- a.ADDED = "added";
- a.REMOVED = "removed";
- a.COMPLETE = "complete";
- a.ENTER_FRAME = "enterFrame";
- a.RENDER = "render";
- a.FINISH_RENDER = "finishRender";
- a.FINISH_UPDATE_TRANSFORM = "finishUpdateTransform";
- a.LEAVE_STAGE = "leaveStage";
- a.RESIZE = "resize";
- a.CHANGE = "change";
- return a
- } (b.HashObject);
- b.Event = c;
- c.prototype.__class__ = "egret.Event"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this, e, a, f)
- }
- __extends(a, d);
- a.dispatchIOErrorEvent = function(e) {
- b.Event._dispatchByTarget(a, e, a.IO_ERROR)
- };
- a.IO_ERROR = "ioError";
- return a
- } (b.Event);
- b.IOErrorEvent = c;
- c.prototype.__class__ = "egret.IOErrorEvent"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f, b, c, h, k, p, n, q) {
- "undefined" === typeof a && (a = !0);
- "undefined" === typeof f && (f = !0);
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof h && (h = 0);
- "undefined" === typeof k && (k = !1);
- "undefined" === typeof p && (p = !1);
- "undefined" === typeof q && (q = !1);
- d.call(this, e, a, f);
- this._localY = this._localX = this._stageY = this._stageX = 0;
- this.touchPointID = b;
- this._stageX = c;
- this._stageY = h;
- this.ctrlKey = k;
- this.altKey = p;
- this.touchDown = q
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "stageX", {
- get: function() {
- return this._stageX
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageY", {
- get: function() {
- return this._stageY
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "localX", {
- get: function() {
- return this._localX
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "localY", {
- get: function() {
- return this._localY
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setCurrentTarget = function(e) {
- d.prototype._setCurrentTarget.call(this, e);
- e instanceof b.DisplayObject && (e = e.globalToLocal(this._stageX, this._stageY, b.Point.identity), this._localX = e.x, this._localY = e.y)
- };
- a.dispatchTouchEvent = function(e, g, f, d, c, h, k, p, n) {
- "undefined" === typeof f && (f = 0);
- "undefined" === typeof d && (d = 0);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof h && (h = !1);
- "undefined" === typeof k && (k = !1);
- "undefined" === typeof p && (p = !1);
- "undefined" === typeof n && (n = !1);
- var q = b.Event._getPropertyData(a);
- q.touchPointID = f;
- q._stageX = d;
- q._stageY = c;
- q.ctrlKey = h;
- q.altKey = k;
- q.shiftKey = p;
- q.touchDown = n;
- b.Event._dispatchByTarget(a, e, g, q, !0, !0)
- };
- a.TOUCH_TAP = "touchTap";
- a.TOUCH_MOVE = "touchMove";
- a.TOUCH_BEGIN = "touchBegin";
- a.TOUCH_END = "touchEnd";
- a.TOUCH_RELEASE_OUTSIDE = "touchReleaseOutside";
- a.TOUCH_ROLL_OUT = "touchRollOut";
- a.TOUCH_ROLL_OVER = "touchRollOver";
- a.TOUCH_OUT = "touchOut";
- a.TOUCH_OVER = "touchOver";
- return a
- } (b.Event);
- b.TouchEvent = c;
- c.prototype.__class__ = "egret.TouchEvent"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, f) {
- "undefined" === typeof a && (a = !1);
- "undefined" === typeof f && (f = !1);
- d.call(this, e, a, f)
- }
- __extends(a, d);
- a.dispatchTimerEvent = function(e, g) {
- b.Event._dispatchByTarget(a, e, g)
- };
- a.TIMER = "timer";
- a.TIMER_COMPLETE = "timerComplete";
- return a
- } (b.Event);
- b.TimerEvent = c;
- c.prototype.__class__ = "egret.TimerEvent"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.CAPTURING_PHASE = 1;
- b.AT_TARGET = 2;
- b.BUBBLING_PHASE = 3;
- return b
- } ();
- b.EventPhase = c;
- c.prototype.__class__ = "egret.EventPhase"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e) {
- "undefined" === typeof e && (e = null);
- d.call(this);
- this._eventTarget = e ? e: this
- }
- __extends(a, d);
- a.prototype.addEventListener = function(e, a, f, d, c) {
- "undefined" === typeof d && (d = !1);
- "undefined" === typeof c && (c = 0);
- "undefined" === typeof d && (d = !1);
- "undefined" === typeof c && (c = 0);
- a || b.Logger.fatal("addEventListener\u4fa6\u542c\u51fd\u6570\u4e0d\u80fd\u4e3a\u7a7a");
- d ? (this._captureEventsMap || (this._captureEventsMap = {}), d = this._captureEventsMap) : (this._eventsMap || (this._eventsMap = {}), d = this._eventsMap);
- var h = d[e];
- h || (h = d[e] = []);
- this._insertEventBin(h, a, f, c)
- };
- a.prototype._insertEventBin = function(e, a, f, b) {
- for (var d = -1,
- c = e.length,
- k = 0; k < c; k++) {
- var p = e[k];
- if (p.listener === a && p.thisObject === f) return ! 1; - 1 == d && p.priority < b && (d = k)
- }
- a = {
- listener: a,
- thisObject: f,
- priority: b
- }; - 1 != d ? e.splice(d, 0, a) : e.push(a);
- return ! 0
- };
- a.prototype.removeEventListener = function(e, a, f, b) {
- "undefined" === typeof b && (b = !1);
- if (b = b ? this._captureEventsMap: this._eventsMap) {
- var d = b[e];
- d && (this._removeEventBin(d, a, f), 0 == d.length && delete b[e])
- }
- };
- a.prototype._removeEventBin = function(e, a, f) {
- for (var b = e.length,
- d = 0; d < b; d++) {
- var c = e[d];
- if (c.listener === a && c.thisObject === f) return e.splice(d, 1),
- !0
- }
- return ! 1
- };
- a.prototype.hasEventListener = function(e) {
- return this._eventsMap && this._eventsMap[e] || this._captureEventsMap && this._captureEventsMap[e]
- };
- a.prototype.willTrigger = function(e) {
- return this.hasEventListener(e)
- };
- a.prototype.dispatchEvent = function(e) {
- e._reset();
- e._target = this._eventTarget;
- e._setCurrentTarget(this._eventTarget);
- return this._notifyListener(e)
- };
- a.prototype._notifyListener = function(e) {
- var a = 1 == e._eventPhase ? this._captureEventsMap: this._eventsMap;
- if (!a) return ! 0;
- a = a[e.type];
- if (!a) return ! 0;
- for (var a = a.concat(), f = a.length, b = 0; b < f; b++) {
- var d = a[b];
- d.listener.call(d.thisObject, e);
- if (e._isPropagationImmediateStopped) break
- }
- return ! e.isDefaultPrevented()
- };
- a.prototype.dispatchEventWith = function(e, a, f) {
- "undefined" === typeof a && (a = !1);
- b.Event.dispatchEvent(this, e, a, f)
- };
- return a
- } (b.HashObject);
- b.EventDispatcher = c;
- c.prototype.__class__ = "egret.EventDispatcher"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.reuseEvent = new b.Event("")
- }
- __extends(a, d);
- a.prototype.run = function() {
- b.Ticker.getInstance().run();
- b.Ticker.getInstance().register(this.renderLoop, this, Number.NEGATIVE_INFINITY);
- b.Ticker.getInstance().register(this.broadcastEnterFrame, this, Number.POSITIVE_INFINITY);
- this.touchContext.run()
- };
- a.prototype.renderLoop = function(e) {
- if (0 < b.__callLaterFunctionList.length) {
- var a = b.__callLaterFunctionList;
- b.__callLaterFunctionList = [];
- var f = b.__callLaterThisList;
- b.__callLaterThisList = [];
- var d = b.__callLaterArgsList;
- b.__callLaterArgsList = []
- }
- this.dispatchEventWith(b.Event.RENDER);
- b.Stage._invalidateRenderFlag && (this.broadcastRender(), b.Stage._invalidateRenderFlag = !1);
- a && this.doCallLaterList(a, f, d);
- e = this.rendererContext;
- e.onRenderStart();
- e.clearScreen();
- this.stage._updateTransform();
- this.dispatchEventWith(b.Event.FINISH_UPDATE_TRANSFORM);
- this.stage._draw(e);
- this.dispatchEventWith(b.Event.FINISH_RENDER);
- e.onRenderFinish()
- };
- a.prototype.broadcastEnterFrame = function(e) {
- e = this.reuseEvent;
- e._type = b.Event.ENTER_FRAME;
- this.dispatchEvent(e);
- for (var a = b.DisplayObject._enterFrameCallBackList.concat(), f = a.length, d = 0; d < f; d++) {
- var c = a[d];
- e._target = c.display;
- e._setCurrentTarget(c.display);
- c.listener.call(c.thisObject, e)
- }
- a = b.Recycler._callBackList;
- for (d = a.length - 1; 0 <= d; d--) a[d]._checkFrame()
- };
- a.prototype.broadcastRender = function() {
- var e = this.reuseEvent;
- e._type = b.Event.RENDER;
- for (var a = b.DisplayObject._renderCallBackList.concat(), f = a.length, d = 0; d < f; d++) {
- var c = a[d];
- e._target = c.display;
- e._setCurrentTarget(c.display);
- c.listener.call(c.thisObject, e)
- }
- };
- a.prototype.doCallLaterList = function(e, a, f) {
- for (var b = e.length,
- d = 0; d < b; d++) {
- var c = e[d];
- null != c && c.apply(a[d], f[d])
- }
- };
- a.DEVICE_PC = "web";
- a.DEVICE_MOBILE = "native";
- return a
- } (b.EventDispatcher);
- b.MainContext = c;
- c.prototype.__class__ = "egret.MainContext"
- })(egret || (egret = {}));
- var testDeviceType = function() {
- if (!this.navigator) return ! 0;
- var b = navigator.userAgent.toLowerCase();
- return - 1 != b.indexOf("mobile") || -1 != b.indexOf("android")
- };
- egret.MainContext.instance = new egret.MainContext;
- egret.MainContext.deviceType = testDeviceType() ? egret.MainContext.DEVICE_MOBILE: egret.MainContext.DEVICE_PC; (function(b) {
- var c = function() {
- function d() {
- this._tick = this._preDrawCount = this._updateTransformPerformanceCost = this._renderPerformanceCost = this._logicPerformanceCost = this._lastTime = 0;
- this._maxDeltaTime = 500;
- this._totalDeltaTime = 0
- }
- d.getInstance = function() {
- null == d.instance && (d.instance = new d);
- return d.instance
- };
- d.prototype.run = function() {
- b.Ticker.getInstance().register(this.update, this);
- null == this._txt && (this._txt = new b.TextField, this._txt.size = 28, b.MainContext.instance.stage.addChild(this._txt));
- var a = b.MainContext.instance;
- a.addEventListener(b.Event.ENTER_FRAME, this.onEnterFrame, this);
- a.addEventListener(b.Event.RENDER, this.onStartRender, this);
- a.addEventListener(b.Event.FINISH_RENDER, this.onFinishRender, this);
- a.addEventListener(b.Event.FINISH_UPDATE_TRANSFORM, this.onFinishUpdateTransform, this)
- };
- d.prototype.onEnterFrame = function(a) {
- this._lastTime = b.getTimer()
- };
- d.prototype.onStartRender = function(a) {
- a = b.getTimer();
- this._logicPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.onFinishUpdateTransform = function(a) {
- a = b.getTimer();
- this._updateTransformPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.onFinishRender = function(a) {
- a = b.getTimer();
- this._renderPerformanceCost = a - this._lastTime;
- this._lastTime = a
- };
- d.prototype.update = function(a) {
- this._tick++;
- this._totalDeltaTime += a;
- if (this._totalDeltaTime >= this._maxDeltaTime) {
- a = (this._preDrawCount - 1).toString();
- var e = Math.ceil(this._logicPerformanceCost).toString() + "," + Math.ceil(this._updateTransformPerformanceCost).toString() + "," + Math.ceil(this._renderPerformanceCost).toString() + "," + Math.ceil(b.MainContext.instance.rendererContext.renderCost).toString();
- this._txt.text = "draw:" + a + "\ncost:" + e + "\nFPS:" + Math.floor(1E3 * this._tick / this._totalDeltaTime).toString();
- this._tick = this._totalDeltaTime = 0
- }
- this._preDrawCount = 0
- };
- d.prototype.onDrawImage = function() {
- this._preDrawCount++
- };
- return d
- } ();
- b.Profiler = c;
- c.prototype.__class__ = "egret.Profiler"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.apply(this, arguments);
- this._timeScale = 1;
- this._paused = !1;
- this.callBackList = []
- }
- __extends(a, d);
- a.prototype.run = function() {
- b.__START_TIME = (new Date).getTime();
- b.MainContext.instance.deviceContext.executeMainLoop(this.update, this)
- };
- a.prototype.update = function(e) {
- var a = this.callBackList.concat(),
- f = a.length;
- e *= this._timeScale;
- e *= this._timeScale;
- for (var b = 0; b < f; b++) {
- var d = a[b];
- d.listener.call(d.thisObject, e)
- }
- };
- a.prototype.register = function(e, a, f) {
- "undefined" === typeof f && (f = 0);
- this._insertEventBin(this.callBackList, e, a, f)
- };
- a.prototype.unregister = function(e, a) {
- this._removeEventBin(this.callBackList, e, a)
- };
- a.prototype.setTimeout = function(e, a, f) {
- for (var d = [], c = 0; c < arguments.length - 3; c++) d[c] = arguments[c + 3];
- b.Logger.warning("Ticker#setTimeout\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03,\u8bf7\u4f7f\u7528egret.setTimeout");
- b.setTimeout.apply(null, [e, a, f].concat(d))
- };
- a.prototype.setTimeScale = function(e) {
- this._timeScale = e
- };
- a.prototype.getTimeScale = function() {
- return this._timeScale
- };
- a.prototype.pause = function() {
- this._paused = !0
- };
- a.prototype.resume = function() {
- this._paused = !1
- };
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- return a
- } (b.EventDispatcher);
- b.Ticker = c;
- c.prototype.__class__ = "egret.Ticker"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.LEFT = "left";
- b.RIGHT = "right";
- b.CENTER = "center";
- b.JUSTIFY = "justify";
- b.CONTENT_JUSTIFY = "contentJustify";
- return b
- } ();
- b.HorizontalAlign = c;
- c.prototype.__class__ = "egret.HorizontalAlign"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.TOP = "top";
- b.BOTTOM = "bottom";
- b.MIDDLE = "middle";
- b.JUSTIFY = "justify";
- b.CONTENT_JUSTIFY = "contentJustify";
- return b
- } ();
- b.VerticalAlign = c;
- c.prototype.__class__ = "egret.VerticalAlign"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a) {
- "undefined" === typeof a && (a = 0);
- d.call(this);
- this._currentCount = 0;
- this.delay = e;
- this.repeatCount = a
- }
- __extends(a, d);
- a.prototype.currentCount = function() {
- return this._currentCount
- };
- Object.defineProperty(a.prototype, "running", {
- get: function() {
- return this._running
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.reset = function() {
- this.stop();
- this._currentCount = 0
- };
- a.prototype.start = function() {
- this._running || (this.lastTime = b.getTimer(), 0 != this._currentCount && (this._currentCount = 0), b.Ticker.getInstance().register(this.onEnterFrame, this), this._running = !0)
- };
- a.prototype.stop = function() {
- this._running && (b.Ticker.getInstance().unregister(this.onEnterFrame, this), this._running = !1)
- };
- a.prototype.onEnterFrame = function(e) {
- e = b.getTimer();
- e - this.lastTime > this.delay && (this.lastTime = e, this._currentCount++, b.TimerEvent.dispatchTimerEvent(this, b.TimerEvent.TIMER), 0 < this.repeatCount && this._currentCount >= this.repeatCount && (this.stop(), b.TimerEvent.dispatchTimerEvent(this, b.TimerEvent.TIMER_COMPLETE)))
- };
- return a
- } (b.EventDispatcher);
- b.Timer = c;
- c.prototype.__class__ = "egret.Timer"
- })(egret || (egret = {})); (function(b) {
- b.getQualifiedClassName = function(b) {
- b = b.prototype ? b.prototype: b.__proto__;
- if (b.hasOwnProperty("__class__")) return b.__class__;
- var d = b.constructor.toString(),
- a = d.indexOf("("),
- d = d.substring(9, a);
- return b.__class__ = d
- }
- })(egret || (egret = {})); (function(b) {
- var c = {};
- b.getDefinitionByName = function(b) {
- if (!b) return null;
- var a = c[b];
- if (a) return a;
- for (var e = b.split("."), g = e.length, a = __global, f = 0; f < g; f++) if (a = a[e[f]], !a) return null;
- return c[b] = a
- }
- })(egret || (egret = {}));
- var __global = __global || this; (function(b) {
- function c(e) {
- for (var a in d) {
- var f = d[a];
- f.delay -= e;
- 0 >= f.delay && (f.listener.apply(f.thisObject, f.params), delete d[a])
- }
- }
- var d = {},
- a = 0;
- b.setTimeout = function(e, g, f) {
- for (var m = [], l = 0; l < arguments.length - 3; l++) m[l] = arguments[l + 3];
- m = {
- listener: e,
- thisObject: g,
- delay: f,
- params: m
- };
- 0 == a && b.Ticker.getInstance().register(c, null);
- a++;
- d[a] = m;
- return a
- };
- b.clearTimeout = function(e) {
- delete d[e]
- }
- })(egret || (egret = {})); (function(b) {
- b.hasDefinition = function(c) {
- return b.getDefinitionByName(c) ? !0 : !1
- }
- })(egret || (egret = {})); (function(b) {
- b.toColorString = function(b) {
- if (isNaN(b) || 0 > b) b = 0;
- 16777215 < b && (b = 16777215);
- for (b = b.toString(16).toUpperCase(); 6 > b.length;) b = "0" + b;
- return "#" + b
- }
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a, b, c, l, h) {
- "undefined" === typeof e && (e = 1);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof c && (c = 1);
- "undefined" === typeof l && (l = 0);
- "undefined" === typeof h && (h = 0);
- d.call(this);
- this.a = e;
- this.b = a;
- this.c = b;
- this.d = c;
- this.tx = l;
- this.ty = h
- }
- __extends(a, d);
- a.prototype.prepend = function(e, a, b, d, c, h) {
- var k = this.tx;
- if (1 != e || 0 != a || 0 != b || 1 != d) {
- var p = this.a,
- n = this.c;
- this.a = p * e + this.b * b;
- this.b = p * a + this.b * d;
- this.c = n * e + this.d * b;
- this.d = n * a + this.d * d
- }
- this.tx = k * e + this.ty * b + c;
- this.ty = k * a + this.ty * d + h;
- return this
- };
- a.prototype.append = function(e, a, b, d, c, h) {
- var k = this.a,
- p = this.b,
- n = this.c,
- q = this.d;
- this.a = e * k + a * n;
- this.b = e * p + a * q;
- this.c = b * k + d * n;
- this.d = b * p + d * q;
- this.tx = c * k + h * n + this.tx;
- this.ty = c * p + h * q + this.ty;
- return this
- };
- a.prototype.prependMatrix = function(e) {
- this.prepend(e.a, e.b, e.c, e.d, e.tx, e.ty);
- return this
- };
- a.prototype.appendMatrix = function(e) {
- this.append(e.a, e.b, e.c, e.d, e.tx, e.ty);
- return this
- };
- a.prototype.prependTransform = function(e, g, b, d, c, h, k, p, n) {
- if (c % 360) {
- var q = c * a.DEG_TO_RAD;
- c = Math.cos(q);
- q = Math.sin(q)
- } else c = 1,
- q = 0;
- if (p || n) this.tx -= p,
- this.ty -= n;
- h || k ? (h *= a.DEG_TO_RAD, k *= a.DEG_TO_RAD, this.prepend(c * b, q * b, -q * d, c * d, 0, 0), this.prepend(Math.cos(k), Math.sin(k), -Math.sin(h), Math.cos(h), e, g)) : this.prepend(c * b, q * b, -q * d, c * d, e, g);
- return this
- };
- a.prototype.appendTransform = function(e, g, b, d, c, h, k, p, n) {
- if (c % 360) {
- var q = c * a.DEG_TO_RAD;
- c = Math.cos(q);
- q = Math.sin(q)
- } else c = 1,
- q = 0;
- h || k ? (h *= a.DEG_TO_RAD, k *= a.DEG_TO_RAD, this.append(Math.cos(k), Math.sin(k), -Math.sin(h), Math.cos(h), e, g), this.append(c * b, q * b, -q * d, c * d, 0, 0)) : this.append(c * b, q * b, -q * d, c * d, e, g);
- if (p || n) this.tx -= p * this.a + n * this.c,
- this.ty -= p * this.b + n * this.d;
- return this
- };
- a.prototype.rotate = function(e) {
- var a = Math.cos(e);
- e = Math.sin(e);
- var b = this.a,
- d = this.c,
- c = this.tx;
- this.a = b * a - this.b * e;
- this.b = b * e + this.b * a;
- this.c = d * a - this.d * e;
- this.d = d * e + this.d * a;
- this.tx = c * a - this.ty * e;
- this.ty = c * e + this.ty * a;
- return this
- };
- a.prototype.skew = function(e, g) {
- e *= a.DEG_TO_RAD;
- g *= a.DEG_TO_RAD;
- this.append(Math.cos(g), Math.sin(g), -Math.sin(e), Math.cos(e), 0, 0);
- return this
- };
- a.prototype.scale = function(e, a) {
- this.a *= e;
- this.d *= a;
- this.c *= e;
- this.b *= a;
- this.tx *= e;
- this.ty *= a;
- return this
- };
- a.prototype.translate = function(e, a) {
- this.tx += e;
- this.ty += a;
- return this
- };
- a.prototype.identity = function() {
- this.a = this.d = 1;
- this.b = this.c = this.tx = this.ty = 0;
- return this
- };
- a.prototype.invert = function() {
- var e = this.a,
- a = this.b,
- b = this.c,
- d = this.d,
- c = this.tx,
- h = e * d - a * b;
- this.a = d / h;
- this.b = -a / h;
- this.c = -b / h;
- this.d = e / h;
- this.tx = (b * this.ty - d * c) / h;
- this.ty = -(e * this.ty - a * c) / h;
- return this
- };
- a.transformCoords = function(e, a, f) {
- var d = b.Point.identity;
- d.x = e.a * a + e.c * f + e.tx;
- d.y = e.d * f + e.b * a + e.ty;
- return d
- };
- a.prototype.toArray = function(e) {
- this.array || (this.array = new Float32Array(9));
- e ? (this.array[0] = this.a, this.array[1] = this.b, this.array[2] = 0, this.array[3] = this.c, this.array[4] = this.d, this.array[5] = 0, this.array[6] = this.tx, this.array[7] = this.ty) : (this.array[0] = this.a, this.array[1] = this.b, this.array[2] = this.tx, this.array[3] = this.c, this.array[4] = this.d, this.array[5] = this.ty, this.array[6] = 0, this.array[7] = 0);
- this.array[8] = 1;
- return this.array
- };
- a.identity = new a;
- a.DEG_TO_RAD = Math.PI / 180;
- return a
- } (b.HashObject);
- b.Matrix = c;
- c.prototype.__class__ = "egret.Matrix"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e, a) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- b.call(this);
- this.x = e;
- this.y = a
- }
- __extends(a, b);
- a.prototype.clone = function() {
- return new a(this.x, this.y)
- };
- a.prototype.equals = function(e) {
- return this.x == e.x && this.y == e.y
- };
- a.distance = function(e, a) {
- return Math.sqrt((e.x - a.x) * (e.x - a.x) + (e.y - a.y) * (e.y - a.y))
- };
- a.identity = new a(0, 0);
- return a
- } (b.HashObject);
- b.Point = c;
- c.prototype.__class__ = "egret.Point"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(e, a, f, c) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof f && (f = 0);
- "undefined" === typeof c && (c = 0);
- b.call(this);
- this.x = e;
- this.y = a;
- this.width = f;
- this.height = c
- }
- __extends(a, b);
- Object.defineProperty(a.prototype, "right", {
- get: function() {
- return this.x + this.width
- },
- set: function(e) {
- this.width = e - this.x
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bottom", {
- get: function() {
- return this.y + this.height
- },
- set: function(e) {
- this.height = e - this.y
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.initialize = function(e, a, b, d) {
- this.x = e;
- this.y = a;
- this.width = b;
- this.height = d;
- return this
- };
- a.prototype.contains = function(e, a) {
- return this.x <= e && this.x + this.width >= e && this.y <= a && this.y + this.height >= a
- };
- a.prototype.intersects = function(e) {
- return this.contains(e.x, e.y) || this.contains(e.x, e.bottom) || this.contains(e.right, e.y) || this.contains(e.right, e.bottom) ? !0 : !1
- };
- a.prototype.clone = function() {
- return new a(this.x, this.y, this.width, this.height)
- };
- a.prototype.containsPoint = function(e) {
- return this.x < e.x && this.x + this.width > e.x && this.y < e.y && this.y + this.height > e.y ? !0 : !1
- };
- a.identity = new a(0, 0, 0, 0);
- return a
- } (b.HashObject);
- b.Rectangle = c;
- c.prototype.__class__ = "egret.Rectangle"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.fatal = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Fatal", a, e);
- throw Error(b.Logger.getTraceCode("Fatal", a, e));
- };
- d.info = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Info", a, e)
- };
- d.warning = function(a, e) {
- "undefined" === typeof e && (e = null);
- b.Logger.traceToConsole("Warning", a, e)
- };
- d.traceToConsole = function(a, e, g) {
- console.log(b.Logger.getTraceCode(a, e, g))
- };
- d.getTraceCode = function(a, e, g) {
- return "[" + a + "]" + e + ":" + (null == g ? "": g)
- };
- return d
- } ();
- b.Logger = c;
- c.prototype.__class__ = "egret.Logger"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._isSupportDOMParser = this._xmlDict = this._parser = null;
- this._xmlDict = {};
- window.DOMParser ? (this._isSupportDOMParser = !0, this._parser = new DOMParser) : this._isSupportDOMParser = !1
- }
- __extends(a, d);
- a.getInstance = function() {
- a._instance || (a._instance = new a);
- return a._instance
- };
- a.prototype.parserXML = function(e) {
- for (var a = 0;
- "\n" == e.charAt(a) || "\t" == e.charAt(a) || "\r" == e.charAt(a) || " " == e.charAt(a);) a++;
- 0 != a && (e = e.substring(a, e.length));
- this._isSupportDOMParser ? a = this._parser.parseFromString(e, "text/xml") : (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(e));
- null == a && b.Logger.info("xml not found!");
- return a
- };
- a._instance = null;
- return a
- } (b.HashObject);
- b.SAXParser = c;
- c.prototype.__class__ = "egret.SAXParser"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(e) {
- function g() {
- e.call(this);
- this._designHeight = this._designWidth = 0;
- this._scaleY = this._scaleX = 1;
- var a = document.getElementById(g.canvas_name),
- b = a.height;
- this._designWidth = a.width;
- this._designHeight = b
- }
- __extends(g, e);
- g.getInstance = function() {
- null == g.instance && (a.initialize(), g.instance = new g);
- return g.instance
- };
- g.prototype.setDesignSize = function(e, a, g) {
- this._designWidth = e;
- this._designHeight = a;
- g && (b.Logger.warning("\u8be5\u65b9\u6cd5\u76ee\u524d\u4e0d\u5e94\u4f20\u5165 resolutionPolicy \u53c2\u6570\uff0c\u8bf7\u5728 docs/1.0_Final_ReleaseNote\u4e2d\u67e5\u770b\u5982\u4f55\u5347\u7ea7"), this._setResolutionPolicy(g))
- };
- g.prototype._setResolutionPolicy = function(e) {
- this._resolutionPolicy = e;
- e.init(this);
- e._apply(this, this._designWidth, this._designHeight)
- };
- g.prototype.getScaleX = function() {
- return this._scaleX
- };
- g.prototype.getScaleY = function() {
- return this._scaleY
- };
- g.canvas_name = "gameCanvas";
- g.canvas_div_name = "gameDiv";
- return g
- } (b.HashObject);
- b.StageDelegate = c;
- c.prototype.__class__ = "egret.StageDelegate";
- var d = function() {
- function e(a, g) {
- this._containerStrategy = a;
- this._contentStrategy = g
- }
- e.prototype.init = function(e) {
- this._containerStrategy.init(e);
- this._contentStrategy.init(e)
- };
- e.prototype._apply = function(e, a, g) {
- this._containerStrategy._apply(e, a, g);
- this._contentStrategy._apply(e, a, g)
- };
- return e
- } ();
- b.ResolutionPolicy = d;
- d.prototype.__class__ = "egret.ResolutionPolicy";
- var a = function() {
- function a() {}
- a.initialize = function() {
- a.EQUAL_TO_FRAME = new e
- };
- a.prototype.init = function(e) {};
- a.prototype._apply = function(e, a, g) {};
- a.prototype._setupContainer = function() {
- var e = document.body,
- a;
- e && (a = e.style) && (a.paddingTop = a.paddingTop || "0px", a.paddingRight = a.paddingRight || "0px", a.paddingBottom = a.paddingBottom || "0px", a.paddingLeft = a.paddingLeft || "0px", a.borderTop = a.borderTop || "0px", a.borderRight = a.borderRight || "0px", a.borderBottom = a.borderBottom || "0px", a.borderLeft = a.borderLeft || "0px", a.marginTop = a.marginTop || "0px", a.marginRight = a.marginRight || "0px", a.marginBottom = a.marginBottom || "0px", a.marginLeft = a.marginLeft || "0px")
- };
- return a
- } ();
- b.ContainerStrategy = a;
- a.prototype.__class__ = "egret.ContainerStrategy";
- var e = function(e) {
- function a() {
- e.apply(this, arguments)
- }
- __extends(a, e);
- a.prototype._apply = function(e) {
- this._setupContainer()
- };
- return a
- } (a);
- b.EqualToFrame = e;
- e.prototype.__class__ = "egret.EqualToFrame";
- d = function() {
- function e() {}
- e.prototype.init = function(e) {};
- e.prototype._apply = function(e, a, g) {};
- return e
- } ();
- b.ContentStrategy = d;
- d.prototype.__class__ = "egret.ContentStrategy";
- var g = function(e) {
- function a(g) {
- "undefined" === typeof g && (g = 0);
- e.call(this);
- this.minWidth = g
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- a = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = document.documentElement.clientWidth,
- d = document.documentElement.clientHeight,
- m = d / g,
- r = f / m,
- s = 1;
- 0 != this.minWidth && (s = Math.min(1, r / this.minWidth));
- a.width = r / s;
- a.height = g;
- a.style.width = f + "px";
- a.style.height = d * s + "px";
- b.style.width = f + "px";
- b.style.height = d * s + "px";
- e._scaleX = m * s;
- e._scaleY = m * s
- };
- return a
- } (d);
- b.FixedHeight = g;
- g.prototype.__class__ = "egret.FixedHeight";
- g = function(e) {
- function a(g) {
- "undefined" === typeof g && (g = 0);
- e.call(this);
- this.minHeight = g
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- g = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = document.documentElement.clientWidth,
- d = document.documentElement.clientHeight,
- m = f / a,
- r = d / m,
- s = 1;
- 0 != this.minHeight && (s = Math.min(1, r / this.minHeight));
- g.width = a;
- g.height = r / s;
- g.style.width = f * s + "px";
- g.style.height = d + "px";
- b.style.width = f * s + "px";
- b.style.height = d + "px";
- e._scaleX = m * s;
- e._scaleY = m * s
- };
- return a
- } (d);
- b.FixedWidth = g;
- g.prototype.__class__ = "egret.FixedWidth";
- g = function(e) {
- function a(g, b) {
- e.call(this);
- this.width = g;
- this.height = b
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- g = document.getElementById(c.canvas_name);
- var b = document.getElementById(c.canvas_div_name),
- f = this.width,
- d = this.height,
- m = f / a;
- g.width = a;
- g.height = d / m;
- g.style.width = f + "px";
- g.style.height = d + "px";
- b.style.width = f + "px";
- b.style.height = d + "px";
- e._scaleX = m;
- e._scaleY = m
- };
- return a
- } (d);
- b.FixedSize = g;
- g.prototype.__class__ = "egret.FixedSize";
- g = function(e) {
- function a() {
- e.call(this)
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- a = document.getElementById(c.canvas_name);
- a.style.width = a.width + "px";
- a.style.height = a.height + "px";
- e._scaleX = 1;
- e._scaleY = 1
- };
- return a
- } (d);
- b.NoScale = g;
- g.prototype.__class__ = "egret.NoScale";
- d = function(e) {
- function a() {
- e.call(this)
- }
- __extends(a, e);
- a.prototype._apply = function(e, a, g) {
- var b = document.getElementById(c.canvas_name),
- f = document.getElementById(c.canvas_div_name),
- d = document.documentElement.clientWidth,
- m = document.documentElement.clientHeight,
- r = d / a < m / g ? d / a: m / g,
- d = a * r,
- m = g * r;
- b.width = a;
- b.height = g / 1;
- b.style.width = 1 * d + "px";
- b.style.height = m + "px";
- b.style.top = Math.floor((document.documentElement.clientHeight - m) / 2) + "px";
- f.style.width = 1 * d + "px";
- f.style.height = m + "px";
- e._scaleX = 1 * r;
- e._scaleY = 1 * r
- };
- return a
- } (d);
- b.ShowAll = d;
- d.prototype.__class__ = "egret.ShowAll"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._originalData = {};
- this._drawAreaList = []
- }
- __extends(a, d);
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- a.prototype.addDrawArea = function(e) {
- this._drawAreaList.push(e)
- };
- a.prototype.clearDrawArea = function() {
- this._drawAreaList = []
- };
- a.prototype.drawImage = function(e, a, f, d, c, h, k, p, n, q) {
- k = k || 0;
- p = p || 0;
- var t = a._texture_to_render;
- if (null != t && 0 != h && 0 != c && 0 != n && 0 != q) if (a._worldBounds) {
- var r = this._originalData;
- r.sourceX = f;
- r.sourceY = d;
- r.sourceWidth = c;
- r.sourceHeight = h;
- r.destX = k;
- r.destY = p;
- r.destWidth = n;
- r.destHeight = q;
- for (var s = this.getDrawAreaList(), u = 0; u < s.length; u++) {
- var v = s[u];
- if (!this.ignoreRender(a, v, r.destX, r.destY)) {
- if (0 != this._drawAreaList.length) if (0 != a._worldTransform.b || 0 != a._worldTransform.c) {
- if (a._worldBounds.x + r.destX < v.x || a._worldBounds.y + r.destY < v.y || a._worldBounds.x + a._worldBounds.width + r.destX > v.x + v.width || a._worldBounds.y + a._worldBounds.height + r.destY > v.y + v.height) {
- b.Logger.fatal("\u8bf7\u4e0d\u8981\u8ba9\u5e26\u6709\u65cb\u8f6c\u548c\u659c\u5207\u7684\u663e\u793a\u5bf9\u8c61\u8de8\u8fc7\u91cd\u7ed8\u533a\u57df");
- break
- }
- } else {
- var x = a._worldTransform.a,
- y = a._worldTransform.d,
- w;
- a._worldBounds.x + r.destX < v.x && (w = (v.x - a._worldBounds.x) / x - r.destX, f += w / (n / c), c -= w / (n / c), n -= w, k += w);
- a._worldBounds.y + r.destY < v.y && (w = (v.y - a._worldBounds.y) / y - r.destY, d += w / (q / h), h -= w / (q / h), q -= w, p += w);
- a._worldBounds.x + a._worldBounds.width + r.destX > v.x + v.width && (w = (a._worldBounds.x + a._worldBounds.width - v.x - v.width) / x + r.destX, c -= w / (n / c), n -= w);
- a._worldBounds.y + a._worldBounds.height + r.destY > v.y + v.height && (w = (a._worldBounds.y + a._worldBounds.height - v.y - v.height) / y + r.destY, h -= w / (q / h), q -= w)
- }
- e.drawImage(t, f, d, c, h, k, p, n, q)
- }
- }
- } else e.drawImage(t, f, d, c, h, k, p, n, q)
- };
- a.prototype.ignoreRender = function(e, a, b, d) {
- var c = e._worldBounds;
- b *= e._worldTransform.a;
- d *= e._worldTransform.d;
- return c.x + c.width + b <= a.x || c.x + b >= a.x + a.width || c.y + c.height + d <= a.y || c.y + d >= a.y + a.height ? !0 : !1
- };
- a.prototype.getDrawAreaList = function() {
- var e;
- 0 == this._drawAreaList.length ? (this._defaultDrawAreaList || (this._defaultDrawAreaList = [new b.Rectangle(0, 0, b.MainContext.instance.stage.stageWidth, b.MainContext.instance.stage.stageHeight)]), e = this._defaultDrawAreaList) : e = this._drawAreaList;
- return e
- };
- return a
- } (b.HashObject);
- b.RenderFilter = c;
- c.prototype.__class__ = "egret.RenderFilter"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.mapClass = function(a, e, g) {
- "undefined" === typeof g && (g = "");
- a = this.getKey(a) + "#" + g;
- this.mapClassDic[a] = e
- };
- d.getKey = function(a) {
- return "string" == typeof a ? a: b.getQualifiedClassName(a)
- };
- d.mapValue = function(a, e, g) {
- "undefined" === typeof g && (g = "");
- a = this.getKey(a) + "#" + g;
- this.mapValueDic[a] = e
- };
- d.hasMapRule = function(a, e) {
- "undefined" === typeof e && (e = "");
- var g = this.getKey(a) + "#" + e;
- return this.mapValueDic[g] || this.mapClassDic[g] ? !0 : !1
- };
- d.getInstance = function(a, e) {
- "undefined" === typeof e && (e = "");
- var g = this.getKey(a) + "#" + e;
- if (this.mapValueDic[g]) return this.mapValueDic[g];
- var b = this.mapClassDic[g];
- if (b) return b = new b,
- this.mapValueDic[g] = b,
- delete this.mapClassDic[g],
- b;
- throw Error("\u8c03\u7528\u4e86\u672a\u914d\u7f6e\u7684\u6ce8\u5165\u89c4\u5219:" + g + "\u3002 \u8bf7\u5148\u5728\u9879\u76ee\u521d\u59cb\u5316\u91cc\u914d\u7f6e\u6307\u5b9a\u7684\u6ce8\u5165\u89c4\u5219\uff0c\u518d\u8c03\u7528\u5bf9\u5e94\u5355\u4f8b\u3002");
- };
- d.mapClassDic = {};
- d.mapValueDic = {};
- return d
- } ();
- b.Injector = c;
- c.prototype.__class__ = "egret.Injector"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.NORMAL = "normal";
- b.ADD = "add";
- b.LAYER = "layer";
- return b
- } ();
- b.BlendMode = c;
- c.prototype.__class__ = "egret.BlendMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._sizeDirty = this._normalDirty = !0;
- this._parent = null;
- this._cacheAsBitmap = !1;
- this._y = this._x = 0;
- this._scaleY = this._scaleX = 1;
- this._anchorY = this._anchorX = this._anchorOffsetY = this._anchorOffsetX = 0;
- this._visible = !0;
- this._rotation = 0;
- this._alpha = 1;
- this._skewY = this._skewX = 0;
- this._hasHeightSet = this._hasWidthSet = !1;
- this.worldAlpha = 1;
- this._rectH = this._rectW = 0;
- this._stage = null;
- this._worldTransform = new b.Matrix;
- this._cacheBounds = new b.Rectangle(0, 0, 0, 0)
- }
- __extends(a, d);
- a.prototype._setDirty = function() {
- this._normalDirty = !0
- };
- a.prototype.getDirty = function() {
- return this._normalDirty || this._sizeDirty
- };
- a.prototype._setParentSizeDirty = function() { ! this.parent || this.parent._hasWidthSet || this.parent._hasHeightSet || this.parent._setSizeDirty()
- };
- a.prototype._setSizeDirty = function() {
- this._sizeDirty || (this._sizeDirty = !0, this._setDirty(), this._setParentSizeDirty())
- };
- a.prototype._clearDirty = function() {
- this._normalDirty = !1
- };
- a.prototype._clearSizeDirty = function() {
- this._sizeDirty = !1
- };
- Object.defineProperty(a.prototype, "parent", {
- get: function() {
- return this._parent
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._parentChanged = function(e) {
- this._parent = e
- };
- Object.defineProperty(a.prototype, "x", {
- get: function() {
- return this._x
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._x = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "y", {
- get: function() {
- return this._y
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._y = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scaleX", {
- get: function() {
- return this._scaleX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._scaleX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scaleY", {
- get: function() {
- return this._scaleY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._scaleY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorOffsetX", {
- get: function() {
- return this._anchorOffsetX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorOffsetX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorOffsetY", {
- get: function() {
- return this._anchorOffsetY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorOffsetY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorX", {
- get: function() {
- return this._anchorX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorX = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "anchorY", {
- get: function() {
- return this._anchorY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._anchorY = e, this._setDirty(), this._setParentSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "visible", {
- get: function() {
- return this._visible
- },
- set: function(e) {
- this._visible = e;
- this._setSizeDirty()
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "rotation", {
- get: function() {
- return this._rotation
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._rotation = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "alpha", {
- get: function() {
- return this._alpha
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._alpha = e, this._setDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "skewX", {
- get: function() {
- return this._skewX
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._skewX = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "skewY", {
- get: function() {
- return this._skewY
- },
- set: function(e) {
- b.NumberUtils.isNumber(e) && (this._skewY = e, this._setSizeDirty())
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "touchEnabled", {
- get: function() {
- return this._touchEnabled
- },
- set: function(e) {
- this._touchEnabled = e
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "scrollRect", {
- get: function() {
- return this._scrollRect
- },
- set: function(e) {
- this._scrollRect = e;
- this._setSizeDirty()
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "measuredWidth", {
- get: function() {
- return this._measureBounds().width
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "measuredHeight", {
- get: function() {
- return this._measureBounds().height
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "explicitWidth", {
- get: function() {
- return this._explicitWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "explicitHeight", {
- get: function() {
- return this._explicitHeight
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "width", {
- get: function() {
- return this._getSize(b.Rectangle.identity).width
- },
- set: function(e) {
- this._setWidth(e)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "height", {
- get: function() {
- return this._getSize(b.Rectangle.identity).height
- },
- set: function(e) {
- this._setHeight(e)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setWidth = function(e) {
- this._setSizeDirty();
- this._explicitWidth = e;
- this._hasWidthSet = b.NumberUtils.isNumber(e)
- };
- a.prototype._setHeight = function(e) {
- this._setSizeDirty();
- this._explicitHeight = e;
- this._hasHeightSet = b.NumberUtils.isNumber(e)
- };
- a.prototype._draw = function(e) {
- if (this.visible && !this.drawCacheTexture(e)) {
- e.setAlpha(this.worldAlpha, this.blendMode);
- e.setTransform(this._worldTransform);
- var a = this.mask || this._scrollRect;
- a && e.pushMask(a);
- this._render(e);
- a && e.popMask()
- }
- this.destroyCacheBounds()
- };
- a.prototype.drawCacheTexture = function(e) {
- if (this._cacheAsBitmap) {
- var a = this._texture_to_render,
- f = a._offsetX,
- d = a._offsetY,
- c = a._textureWidth,
- a = a._textureHeight;
- this._updateTransform();
- e.setAlpha(this.worldAlpha, this.blendMode);
- e.setTransform(this._worldTransform);
- var h = b.MainContext.instance.rendererContext.texture_scale_factor;
- b.RenderFilter.getInstance().drawImage(e, this, 0, 0, c * h, a * h, f, d, c, a);
- return ! 0
- }
- return ! 1
- };
- a.prototype._updateTransform = function() {
- this._worldTransform.identity().appendMatrix(this._parent._worldTransform);
- var e = this._getOffsetPoint();
- this._worldTransform.appendTransform(this._x, this._y, this._scaleX, this._scaleY, this._rotation, this._skewX, this._skewY, e.x, e.y);
- this._scrollRect && this._worldTransform.append(1, 0, 0, 1, -this._scrollRect.x, -this._scrollRect.y);
- this.worldAlpha = this._parent.worldAlpha * this._alpha
- };
- a.prototype._render = function(e) {};
- a.prototype.getBounds = function(e) {
- var a = this._measureBounds(),
- f = this._hasWidthSet ? this._explicitWidth: a.width,
- d = this._hasHeightSet ? this._explicitHeight: a.height,
- c = a.x,
- a = a.y,
- h,
- k;
- 0 != this._anchorX || 0 != this._anchorY ? (h = f * this._anchorX, k = d * this._anchorY) : (h = this._anchorOffsetX, k = this._anchorOffsetY);
- this._cacheBounds.initialize(c - h, a - k, f, d);
- f = this._cacheBounds;
- e || (e = new b.Rectangle);
- return e.initialize(f.x, f.y, f.width, f.height)
- };
- a.prototype.destroyCacheBounds = function() {
- this._cacheBounds.x = 0;
- this._cacheBounds.y = 0;
- this._cacheBounds.width = 0;
- this._cacheBounds.height = 0
- };
- a.prototype._getConcatenatedMatrix = function() {
- for (var e = a.identityMatrixForGetConcatenated.identity(), g = this; null != g;) {
- if (0 != g._anchorX || 0 != g._anchorY) {
- var f = g._getSize(b.Rectangle.identity);
- e.prependTransform(g._x, g._y, g._scaleX, g._scaleY, g._rotation, g._skewX, g._skewY, f.width * g._anchorX, f.height * g._anchorY)
- } else e.prependTransform(g._x, g._y, g._scaleX, g._scaleY, g._rotation, g._skewX, g._skewY, g._anchorOffsetX, g._anchorOffsetY);
- g = g._parent
- }
- return e
- };
- a.prototype.localToGlobal = function(e, a, f) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- var d = this._getConcatenatedMatrix();
- d.append(1, 0, 0, 1, e, a);
- f || (f = new b.Point);
- f.x = d.tx;
- f.y = d.ty;
- return f
- };
- a.prototype.globalToLocal = function(e, a, f) {
- "undefined" === typeof e && (e = 0);
- "undefined" === typeof a && (a = 0);
- var d = this._getConcatenatedMatrix();
- d.invert();
- d.append(1, 0, 0, 1, e, a);
- f || (f = new b.Point);
- f.x = d.tx;
- f.y = d.ty;
- return f
- };
- a.prototype.hitTest = function(e, a, f) {
- "undefined" === typeof f && (f = !1);
- if (!this.visible || !f && !this._touchEnabled) return null;
- f = this._getSize(b.Rectangle.identity);
- return 0 <= e && e < f.width && 0 <= a && a < f.height ? this.mask || this._scrollRect ? this._scrollRect && e < this._scrollRect.width && a < this._scrollRect.height || this.mask && this.mask.x <= e && e < this.mask.x + this.mask.width && this.mask.y <= a && a < this.mask.y + this.mask.height ? this: null: this: null
- };
- a.prototype.hitTestPoint = function(e, a, f) {
- e = this.globalToLocal(e, a);
- return f ? (this._hitTestPointTexture || (this._hitTestPointTexture = new b.RenderTexture), f = this._hitTestPointTexture, f.drawToTexture(this), 0 != f.getPixel32(e.x - this._hitTestPointTexture._offsetX, e.y - this._hitTestPointTexture._offsetY)[3] ? !0 : !1) : !!this.hitTest(e.x, e.y, !0)
- };
- a.prototype._getMatrix = function() {
- var e = b.Matrix.identity.identity(),
- a = this._getOffsetPoint();
- e.appendTransform(this._x, this._y, this._scaleX, this._scaleY, this._rotation, this._skewX, this._skewY, a.x, a.y);
- return e
- };
- a.prototype._getSize = function(e) {
- return this._hasHeightSet && this._hasWidthSet ? e.initialize(0, 0, this._explicitWidth, this._explicitHeight) : this._measureSize(b.Rectangle.identity)
- };
- a.prototype._measureSize = function(e) {
- this._sizeDirty ? (e = this._measureBounds(), this._rectW = e.width, this._rectH = e.height, this._clearSizeDirty()) : (e.width = this._rectW, e.height = this._rectH);
- return e
- };
- a.prototype._measureBounds = function() {
- return b.Rectangle.identity.initialize(0, 0, 0, 0)
- };
- a.prototype._getOffsetPoint = function() {
- var e = this._anchorOffsetX,
- a = this._anchorOffsetY;
- if (0 != this._anchorX || 0 != this._anchorY) a = this._getSize(b.Rectangle.identity),
- e = this._anchorX * a.width,
- a = this._anchorY * a.height;
- var f = b.Point.identity;
- f.x = e;
- f.y = a;
- return f
- };
- a.prototype._onAddToStage = function() {
- this._stage = b.MainContext.instance.stage;
- b.DisplayObjectContainer.__EVENT__ADD_TO_STAGE_LIST.push(this)
- };
- a.prototype._onRemoveFromStage = function() {
- this._stage = null;
- b.DisplayObjectContainer.__EVENT__REMOVE_FROM_STAGE_LIST.push(this)
- };
- Object.defineProperty(a.prototype, "stage", {
- get: function() {
- return this._stage
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.addEventListener = function(e, g, f, c, l) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof l && (l = 0);
- d.prototype.addEventListener.call(this, e, g, f, c, l); ((c = e == b.Event.ENTER_FRAME) || e == b.Event.RENDER) && this._insertEventBin(c ? a._enterFrameCallBackList: a._renderCallBackList, g, f, l)
- };
- a.prototype.removeEventListener = function(e, g, f, c) {
- "undefined" === typeof c && (c = !1);
- d.prototype.removeEventListener.call(this, e, g, f, c); ((c = e == b.Event.ENTER_FRAME) || e == b.Event.RENDER) && this._removeEventBin(c ? a._enterFrameCallBackList: a._renderCallBackList, g, f)
- };
- a.prototype.dispatchEvent = function(e) {
- if (!e._bubbles) return d.prototype.dispatchEvent.call(this, e);
- for (var a = [], b = this; b;) a.unshift(b),
- b = b.parent;
- for (var c = a.length,
- b = c - 1,
- c = c - 2; 0 <= c; c--) a.push(a[c]);
- e._reset();
- this._dispatchPropagationEvent(e, a, b);
- return ! e.isDefaultPrevented()
- };
- a.prototype._dispatchPropagationEvent = function(e, a, b) {
- for (var d = a.length,
- c = 0; c < d; c++) {
- var h = a[c];
- e._setCurrentTarget(h);
- e._target = this;
- e._eventPhase = c < b ? 1 : c == b ? 2 : 3;
- h._notifyListener(e);
- if (e._isPropagationStopped || e._isPropagationImmediateStopped) break
- }
- };
- a.prototype.willTrigger = function(e) {
- for (var a = this; a;) {
- if (a.hasEventListener(e)) return ! 0;
- a = a._parent
- }
- return ! 1
- };
- Object.defineProperty(a.prototype, "cacheAsBitmap", {
- get: function() {
- return this._cacheAsBitmap
- },
- set: function(e) { (this._cacheAsBitmap = e) ? (this.renderTexture || (this.renderTexture = new b.RenderTexture), this.renderTexture.drawToTexture(this), this._texture_to_render = this.renderTexture) : this._texture_to_render = null
- },
- enumerable: !0,
- configurable: !0
- });
- a.getTransformBounds = function(e, a) {
- var b, d, c = e.width,
- h = e.height,
- k = c * a.a,
- c = c * a.b,
- p = h * a.c,
- h = h * a.d,
- n = a.tx,
- q = a.ty,
- t = n,
- r = n,
- s = q,
- u = q; (b = k + n) < t ? t = b: b > r && (r = b); (b = k + p + n) < t ? t = b: b > r && (r = b); (b = p + n) < t ? t = b: b > r && (r = b); (d = c + q) < s ? s = d: d > u && (u = d); (d = c + h + q) < s ? s = d: d > u && (u = d); (d = h + q) < s ? s = d: d > u && (u = d);
- return e.initialize(t, s, r - t, u - s)
- };
- a.identityMatrixForGetConcatenated = new b.Matrix;
- a._enterFrameCallBackList = [];
- a._renderCallBackList = [];
- return a
- } (b.EventDispatcher);
- b.DisplayObject = c;
- c.prototype.__class__ = "egret.DisplayObject"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._touchChildren = !0;
- this._children = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "touchChildren", {
- get: function() {
- return this._touchChildren
- },
- set: function(e) {
- this._touchChildren = e
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "numChildren", {
- get: function() {
- return this._children.length
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.setChildIndex = function(e, a) {
- this.doSetChildIndex(e, a)
- };
- a.prototype.doSetChildIndex = function(e, a) {
- var f = this._children.indexOf(e);
- 0 > f && b.Logger.fatal("child\u4e0d\u5728\u5f53\u524d\u5bb9\u5668\u5185");
- this._children.splice(f, 1);
- 0 > a || this._children.length <= a ? this._children.push(e) : this._children.splice(a, 0, e)
- };
- a.prototype.addChild = function(e) {
- var a = this.numChildren;
- e._parent == this && a--;
- return this._doAddChild(e, a)
- };
- a.prototype.addChildAt = function(e, a) {
- return this._doAddChild(e, a)
- };
- a.prototype._doAddChild = function(e, g, f) {
- "undefined" === typeof f && (f = !0);
- if (e == this) return e;
- if (0 > g || g > this._children.length) return b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4"),
- e;
- var d = e.parent;
- if (d == this) return this.doSetChildIndex(e, g),
- e;
- d && d.removeChild(e);
- this._children.splice(g, 0, e);
- e._parentChanged(this);
- f && e.dispatchEventWith(b.Event.ADDED, !0);
- if (this._stage) for (e._onAddToStage(), g = a.__EVENT__ADD_TO_STAGE_LIST; 0 < g.length;) g.shift().dispatchEventWith(b.Event.ADDED_TO_STAGE);
- e._setDirty();
- this._setSizeDirty();
- return e
- };
- a.prototype.removeChild = function(e) {
- e = this._children.indexOf(e);
- if (0 <= e) return this._doRemoveChild(e);
- b.Logger.fatal("child\u672a\u88abaddChild\u5230\u8be5parent");
- return null
- };
- a.prototype.removeChildAt = function(e) {
- if (0 <= e && e < this._children.length) return this._doRemoveChild(e);
- b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4");
- return null
- };
- a.prototype._doRemoveChild = function(e, g) {
- "undefined" === typeof g && (g = !0);
- var f = this._children,
- d = f[e];
- g && d.dispatchEventWith(b.Event.REMOVED, !0);
- if (this._stage) {
- d._onRemoveFromStage();
- for (var c = a.__EVENT__REMOVE_FROM_STAGE_LIST; 0 < c.length;) c.shift().dispatchEventWith(b.Event.REMOVED_FROM_STAGE)
- }
- d._parentChanged(null);
- f.splice(e, 1);
- this._setSizeDirty();
- return d
- };
- a.prototype.getChildAt = function(e) {
- if (0 <= e && e < this._children.length) return this._children[e];
- b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4");
- return null
- };
- a.prototype.contains = function(e) {
- for (; e;) {
- if (e == this) return ! 0;
- e = e._parent
- }
- return ! 1
- };
- a.prototype.swapChildrenAt = function(e, a) {
- 0 <= e && e < this._children.length && 0 <= a && a < this._children.length ? this._swapChildrenAt(e, a) : b.Logger.fatal("\u63d0\u4f9b\u7684\u7d22\u5f15\u8d85\u51fa\u8303\u56f4")
- };
- a.prototype.swapChildren = function(e, a) {
- var f = this._children.indexOf(e),
- d = this._children.indexOf(a); - 1 == f || -1 == d ? b.Logger.fatal("child\u672a\u88abaddChild\u5230\u8be5parent") : this._swapChildrenAt(f, d)
- };
- a.prototype._swapChildrenAt = function(e, a) {
- if (e != a) {
- var b = this._children,
- d = b[e];
- b[e] = b[a];
- b[a] = d
- }
- };
- a.prototype.getChildIndex = function(e) {
- return this._children.indexOf(e)
- };
- a.prototype.removeChildren = function() {
- for (var e = this._children.length - 1; 0 <= e; e--) this._doRemoveChild(e)
- };
- a.prototype._updateTransform = function() {
- if (this.visible) {
- d.prototype._updateTransform.call(this);
- for (var e = 0,
- a = this._children.length; e < a; e++) this._children[e]._updateTransform()
- }
- };
- a.prototype._render = function(e) {
- for (var a = 0,
- b = this._children.length; a < b; a++) this._children[a]._draw(e)
- };
- a.prototype._measureBounds = function() {
- for (var e = 0,
- a = 0,
- f = 0,
- d = 0,
- c = this._children.length,
- h = 0; h < c; h++) {
- var k = this._children[h],
- p;
- if (k.visible && (p = b.DisplayObject.getTransformBounds(k._getSize(b.Rectangle.identity), k._getMatrix()))) {
- var k = p.x,
- n = p.y,
- q = p.width + p.x,
- t = p.height + p.y;
- if (k < e || 0 == h) e = k;
- if (q > a || 0 == h) a = q;
- if (n < f || 0 == h) f = n;
- if (t > d || 0 == h) d = t
- }
- }
- return b.Rectangle.identity.initialize(e, f, a - e, d - f)
- };
- a.prototype.hitTest = function(e, a, f) {
- "undefined" === typeof f && (f = !1);
- var c;
- if (!this.visible) return null;
- if (this._scrollRect) {
- if (0 > e || 0 > a || e > this._scrollRect.width || a > this._scrollRect.height) return null
- } else if (this.mask && (this.mask.x > e || e > this.mask.x + this.mask.width || this.mask.y > a || a > this.mask.y + this.mask.height)) return null;
- for (var l = this._children,
- h = this._touchChildren,
- k = l.length - 1; 0 <= k; k--) {
- var p = l[k],
- n = p,
- q = n._getOffsetPoint(),
- t = n._x,
- r = n._y;
- this._scrollRect && (t -= this._scrollRect.x, r -= this._scrollRect.y);
- n = b.Matrix.identity.identity().prependTransform(t, r, n._scaleX, n._scaleY, n._rotation, 0, 0, q.x, q.y);
- n.invert();
- n = b.Matrix.transformCoords(n, e, a);
- if (p = p.hitTest(n.x, n.y, !0)) {
- if (p._touchEnabled && h) return p;
- if (this._touchEnabled) return this;
- null == c && (c = p)
- }
- }
- return c ? c: d.prototype.hitTest.call(this, e, a, f)
- };
- a.prototype._onAddToStage = function() {
- d.prototype._onAddToStage.call(this);
- for (var e = this.numChildren,
- a = 0; a < e; a++) this._children[a]._onAddToStage()
- };
- a.prototype._onRemoveFromStage = function() {
- d.prototype._onRemoveFromStage.call(this);
- for (var e = this.numChildren,
- a = 0; a < e; a++) this._children[a]._onRemoveFromStage()
- };
- a.prototype.getChildByName = function(e) {
- for (var a = this._children,
- b = this.numChildren,
- d, c = 0; c < b; c++) if (d = a[c], d.name == e) return d;
- return null
- };
- a.__EVENT__ADD_TO_STAGE_LIST = [];
- a.__EVENT__REMOVE_FROM_STAGE_LIST = [];
- return a
- } (b.DisplayObject);
- b.DisplayObjectContainer = c;
- c.prototype.__class__ = "egret.DisplayObjectContainer"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(e, a) {
- "undefined" === typeof e && (e = 480);
- "undefined" === typeof a && (a = 800);
- d.call(this);
- this.touchEnabled = !0;
- this._stage = this;
- this._stageWidth = e;
- this._stageHeight = a
- }
- __extends(a, d);
- a.prototype.invalidate = function() {
- a._invalidateRenderFlag = !0
- };
- Object.defineProperty(a.prototype, "scaleMode", {
- get: function() {
- return this._scaleMode
- },
- set: function(e) {
- if (this._scaleMode != e) {
- this._scaleMode = e;
- var a = {};
- a[b.StageScaleMode.NO_SCALE] = new b.NoScale;
- a[b.StageScaleMode.SHOW_ALL] = new b.ShowAll;
- a[b.StageScaleMode.NO_BORDER] = new b.FixedWidth;
- e = a[e];
- if (!e) throw Error("\u4f7f\u7528\u4e86\u5c1a\u672a\u5b9e\u73b0\u7684ScaleMode");
- a = new b.EqualToFrame;
- e = new b.ResolutionPolicy(a, e);
- b.StageDelegate.getInstance()._setResolutionPolicy(e);
- e = document.getElementById(b.StageDelegate.canvas_name);
- this._stageWidth = e.width;
- this._stageHeight = e.height;
- this.dispatchEventWith(b.Event.RESIZE)
- }
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageWidth", {
- get: function() {
- return this._stageWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stageHeight", {
- get: function() {
- return this._stageHeight
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.hitTest = function(a, g) {
- if (!this.touchEnabled) return null;
- var f;
- if (!this.visible) return this;
- for (var d = this._children,
- c = d.length - 1; 0 <= c; c--) {
- var h = f = d[c],
- k = h._getOffsetPoint(),
- h = b.Matrix.identity.identity().prependTransform(h.x, h.y, h.scaleX, h.scaleY, h.rotation, 0, 0, k.x, k.y);
- h.invert();
- h = b.Matrix.transformCoords(h, a, g);
- if ((f = f.hitTest(h.x, h.y, !0)) && f.touchEnabled) return f
- }
- return this
- };
- a.prototype.getBounds = function(a) {
- a || (a = new b.Rectangle);
- return a.initialize(0, 0, this._stageWidth, this._stageHeight)
- };
- a.prototype._updateTransform = function() {
- for (var a = 0,
- g = this._children.length; a < g; a++) this._children[a]._updateTransform()
- };
- a._invalidateRenderFlag = !1;
- return a
- } (b.DisplayObjectContainer);
- b.Stage = c;
- c.prototype.__class__ = "egret.Stage"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.NO_BORDER = "noBorder";
- b.NO_SCALE = "noScale";
- b.SHOW_ALL = "showAll";
- return b
- } ();
- b.StageScaleMode = c;
- c.prototype.__class__ = "egret.StageScaleMode"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.REPEAT = "repeat";
- b.SCALE = "scale";
- return b
- } ();
- b.BitmapFillMode = c;
- c.prototype.__class__ = "egret.BitmapFillMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- d.call(this);
- this.debug = !1;
- this.debugColor = 16711680;
- this.fillMode = "scale";
- a && (this._texture = a, this._setSizeDirty())
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "texture", {
- get: function() {
- return this._texture
- },
- set: function(a) {
- a != this._texture && (this._setSizeDirty(), this._texture = a)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(e) {
- var b = this._texture;
- b ? (this._texture_to_render = b, a._drawBitmap(e, this._hasWidthSet ? this._explicitWidth: b._textureWidth, this._hasHeightSet ? this._explicitHeight: b._textureHeight, this)) : this._texture_to_render = null
- };
- a._drawBitmap = function(e, g, f, d) {
- var c = d._texture_to_render;
- if (c) {
- var h = c._textureWidth,
- k = c._textureHeight;
- if ("scale" == d.fillMode) {
- var p = d.scale9Grid || c.scale9Grid;
- if (p && h - p.width < g && k - p.height < f) a.drawScale9GridImage(e, d, p, g, f);
- else {
- var p = c._offsetX,
- n = c._offsetY,
- q = c._bitmapWidth || h,
- t = c._bitmapHeight || k;
- g /= h;
- p = Math.round(p * g);
- g = Math.round(q * g);
- f /= k;
- n = Math.round(n * f);
- f = Math.round(t * f);
- b.RenderFilter.getInstance().drawImage(e, d, c._bitmapX, c._bitmapY, q, t, p, n, g, f)
- }
- } else a.drawRepeatImage(e, d, g, f)
- }
- };
- a.drawRepeatImage = function(a, g, f, d) {
- var c = g._texture_to_render;
- if (c) for (var h = c._textureWidth,
- k = c._textureHeight,
- p = c._bitmapX,
- n = c._bitmapY,
- q = c._bitmapWidth || h,
- t = c._bitmapHeight || k,
- r = c._offsetX,
- c = c._offsetY,
- s = b.RenderFilter.getInstance(); r < f; r += h) for (var u = c; u < d; u += k) {
- var v = Math.min(q, f - r),
- x = Math.min(t, d - u);
- s.drawImage(a, g, p, n, v, x, r, u, v, x)
- }
- };
- a.drawScale9GridImage = function(a, g, f, d, c) {
- var h = g._texture_to_render;
- if (h && f) {
- var k = b.RenderFilter.getInstance(),
- p = h._textureWidth,
- n = h._textureHeight,
- q = h._bitmapX,
- t = h._bitmapY,
- r = h._bitmapWidth || p,
- s = h._bitmapHeight || n,
- u = h._offsetX,
- h = h._offsetY;
- f = b.Rectangle.identity.initialize(f.x - Math.round(u), f.y - Math.round(u), f.width, f.height);
- u = Math.round(u);
- h = Math.round(h);
- d -= p - r;
- c -= n - s;
- f.y == f.bottom && (f.bottom < s ? f.bottom++:f.y--);
- f.x == f.right && (f.right < r ? f.right++:f.x--);
- var p = q + f.x,
- n = q + f.right,
- v = r - f.right,
- x = t + f.y,
- y = t + f.bottom,
- w = s - f.bottom,
- z = u + f.x,
- A = h + f.y,
- s = c - (s - f.bottom),
- r = d - (r - f.right);
- k.drawImage(a, g, q, t, f.x, f.y, u, h, f.x, f.y);
- k.drawImage(a, g, p, t, f.width, f.y, z, h, r - f.x, f.y);
- k.drawImage(a, g, n, t, v, f.y, u + r, h, d - r, f.y);
- k.drawImage(a, g, q, x, f.x, f.height, u, A, f.x, s - f.y);
- k.drawImage(a, g, p, x, f.width, f.height, z, A, r - f.x, s - f.y);
- k.drawImage(a, g, n, x, v, f.height, u + r, A, d - r, s - f.y);
- k.drawImage(a, g, q, y, f.x, w, u, h + s, f.x, c - s);
- k.drawImage(a, g, p, y, f.width, w, z, h + s, r - f.x, c - s);
- k.drawImage(a, g, n, y, v, w, u + r, h + s, d - r, c - s)
- }
- };
- a.prototype._measureBounds = function() {
- var a = this._texture;
- return a ? b.Rectangle.identity.initialize(a._offsetX, a._offsetY, a._textureWidth, a._textureHeight) : d.prototype._measureBounds.call(this)
- };
- a.debug = !1;
- return a
- } (b.DisplayObject);
- b.Bitmap = c;
- c.prototype.__class__ = "egret.Bitmap"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._text = "";
- this._textChanged = !1;
- this._bitmapPool = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "text", {
- get: function() {
- return this._text
- },
- set: function(a) {
- this._textChanged = !0;
- this._text = a
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._updateTransform = function() {
- this.visible && (this._textChanged && this._renderText(), d.prototype._updateTransform.call(this))
- };
- a.prototype._renderText = function(a) {
- var g = a = 0;
- this._textChanged && this.removeChildren();
- for (var f = 0,
- d = this.text.length; f < d; f++) {
- var c = this.text.charAt(f),
- h = this.spriteSheet.getTexture(c);
- if (null == h) console.log("\u5f53\u524d\u6ca1\u6709\u4f4d\u56fe\u6587\u5b57\uff1a" + c);
- else {
- var c = h._offsetX,
- k = h._offsetY,
- p = h._textureWidth;
- if (this._textChanged) {
- var n = this._bitmapPool[f];
- n || (n = new b.Bitmap, this._bitmapPool.push(n));
- n.texture = h;
- this.addChild(n);
- n.x = a
- }
- a += p + c;
- k + h._textureHeight > g && (g = k + h._textureHeight)
- }
- }
- this._textChanged = !1;
- return b.Rectangle.identity.initialize(0, 0, a, g)
- };
- a.prototype._measureBounds = function() {
- return this._renderText(!0)
- };
- return a
- } (b.DisplayObjectContainer);
- b.BitmapText = c;
- c.prototype.__class__ = "egret.BitmapText"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {
- this.commandQueue = []
- }
- b.prototype.beginFill = function(a, e) {};
- b.prototype._setStyle = function(a) {};
- b.prototype.drawRect = function(a, e, b, f) {};
- b.prototype.drawCircle = function(a, e, b) {};
- b.prototype.drawRoundRect = function(a, e, b, f, d, c) {};
- b.prototype.drawEllipse = function(a, e, b, f) {};
- b.prototype.lineStyle = function(a, e, b, f, d, c, h, k) {};
- b.prototype.lineTo = function(a, e) {};
- b.prototype.curveTo = function(a, e, b, f) {};
- b.prototype.moveTo = function(a, e) {};
- b.prototype.clear = function() {};
- b.prototype.endFill = function() {};
- b.prototype._draw = function(a) {};
- return b
- } ();
- b.Graphics = c;
- c.prototype.__class__ = "egret.Graphics"; (function() {
- return function(b, a, e) {
- this.method = b;
- this.thisObject = a;
- this.args = e
- }
- })().prototype.__class__ = "Command"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this)
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "graphics", {
- get: function() {
- this._graphics || (this._graphics = new b.Graphics);
- return this._graphics
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this._graphics && this._graphics._draw(a)
- };
- return a
- } (b.DisplayObject);
- b.Shape = c;
- c.prototype.__class__ = "egret.Shape"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this)
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "graphics", {
- get: function() {
- this._graphics || (this._graphics = new b.Graphics);
- return this._graphics
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this._graphics && this._graphics._draw(a);
- d.prototype._render.call(this, a)
- };
- return a
- } (b.DisplayObjectContainer);
- b.Sprite = c;
- c.prototype.__class__ = "egret.Sprite"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._fontFamily = "Arial";
- this._size = 30;
- this._textColorString = "#FFFFFF";
- this._textColor = 16777215;
- this._strokeColorString = "#000000";
- this._stroke = this._strokeColor = 0;
- this._textAlign = "left";
- this._verticalAlign = "top";
- this._numLines = this._lineSpacing = 0;
- this.measuredWidths = []
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "text", {
- get: function() {
- return this._text
- },
- set: function(a) {
- this._text != a && (this._setTextDirty(), this._text = a)
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setTextDirty = function() {
- this._setSizeDirty()
- };
- Object.defineProperty(a.prototype, "fontFamily", {
- get: function() {
- return this._fontFamily
- },
- set: function(a) {
- this._fontFamily != a && (this._setTextDirty(), this._fontFamily = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "size", {
- get: function() {
- return this._size
- },
- set: function(a) {
- this._size != a && (this._setTextDirty(), this._size = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "italic", {
- get: function() {
- return this._italic
- },
- set: function(a) {
- this._italic != a && (this._setTextDirty(), this._italic = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bold", {
- get: function() {
- return this._bold
- },
- set: function(a) {
- this._bold != a && (this._setTextDirty(), this._bold = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textColor", {
- get: function() {
- return this._textColor
- },
- set: function(a) {
- this._textColor != a && (this._setTextDirty(), this._textColor = a, this._textColorString = b.toColorString(a))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "strokeColor", {
- get: function() {
- return this._strokeColor
- },
- set: function(a) {
- this._strokeColor != a && (this._setTextDirty(), this._strokeColor = a, this._strokeColorString = b.toColorString(a))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "stroke", {
- get: function() {
- return this._stroke
- },
- set: function(a) {
- this._stroke != a && (this._setTextDirty(), this._stroke = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textAlign", {
- get: function() {
- return this._textAlign
- },
- set: function(a) {
- this._textAlign != a && (this._setTextDirty(), this._textAlign = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "verticalAlign", {
- get: function() {
- return this._verticalAlign
- },
- set: function(a) {
- this._verticalAlign != a && (this._setTextDirty(), this._verticalAlign = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "lineSpacing", {
- get: function() {
- return this._lineSpacing
- },
- set: function(a) {
- this._lineSpacing != a && (this._setTextDirty(), this._lineSpacing = a)
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "numLines", {
- get: function() {
- return this._numLines
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._render = function(a) {
- this.drawText(a, !1);
- this._clearDirty()
- };
- a.prototype._measureBounds = function() {
- return this.drawText(b.MainContext.instance.rendererContext, !0)
- };
- a.prototype.drawText = function(a, g) {
- var f = this.getTextLines(a);
- if (!f) return b.Rectangle.identity.initialize(0, 0, 0, 0);
- var d = f.length,
- c = 0.5 * this._size,
- h = this._size + this._lineSpacing,
- k = d * h - this._lineSpacing;
- this._textHeight = k;
- var p = this._hasHeightSet ? this._explicitHeight: Number.POSITIVE_INFINITY;
- if (this._hasHeightSet && k < p) {
- var n = 0;
- this._verticalAlign == b.VerticalAlign.MIDDLE ? n = 0.5 : this._verticalAlign == b.VerticalAlign.BOTTOM && (n = 1);
- c += n * (p - k)
- }
- var n = c = Math.round(c),
- q = 0;
- this._textAlign == b.HorizontalAlign.CENTER ? q = 0.5 : this._textAlign == b.HorizontalAlign.RIGHT && (q = 1);
- var t = this.measuredWidths,
- r;
- r = this._hasWidthSet ? this._explicitWidth: this._textWidth;
- for (var s = Number.POSITIVE_INFINITY,
- u = 0; u < d; u++) {
- var v = f[u],
- x = Math.round((r - t[u]) * q);
- x < s && (s = x); ! g && c < p && a.drawText(this, v, x, c, r);
- c += h
- }
- return b.Rectangle.identity.initialize(s, n, r, k)
- };
- a.prototype.getTextLines = function(a) {
- var b = this.text ? this.text.toString() : "";
- if (!b) return null;
- var f = this.measuredWidths;
- f.length = 0;
- a.setupFont(this);
- var b = b.split(/(?:\r\n|\r|\n)/),
- d = b.length,
- c = 0;
- if (this._hasWidthSet) for (var h = this._explicitWidth,
- k = 0; k < d; k++) {
- var p = b[k],
- n = a.measureText(p);
- if (n > h) {
- for (var q = "",
- t = 0,
- r = p.length,
- s = 0; s < r; s++) {
- var u = p.charAt(s),
- n = a.measureText(u);
- t + n > h && (0 == t ? (b.splice(k, 0, u), f[k] = n, c < n && (c = n), n = 0, u = "") : (b.splice(k, 0, q), f[k] = t, c < t && (c = t), q = "", t = 0), k++, d++);
- t += n;
- q += u
- }
- b[k] = q;
- f[k] = t
- } else f[k] = n,
- c < n && (c = n)
- } else for (k = 0; k < d; k++) p = b[k],
- n = a.measureText(p),
- f[k] = n,
- c < n && (c = n);
- this._textWidth = c;
- return b
- };
- return a
- } (b.DisplayObject);
- b.TextField = c;
- c.prototype.__class__ = "egret.TextField"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.DYNAMIC = "dynamic";
- b.INPUT = "input";
- return b
- } ();
- b.TextFieldType = c;
- c.prototype.__class__ = "egret.TextFieldType"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- d.call(this);
- var b = a.bitmapData;
- this.bitmapData = b;
- this._textureMap = {};
- this._sourceWidth = b.width;
- this._sourceHeight = b.height;
- this._bitmapX = a._bitmapX - a._offsetX;
- this._bitmapY = a._bitmapY - a._offsetY
- }
- __extends(a, d);
- a.prototype.getTexture = function(a) {
- return this._textureMap[a]
- };
- a.prototype.createTexture = function(a, g, f, d, c, h, k, p, n) {
- "undefined" === typeof h && (h = 0);
- "undefined" === typeof k && (k = 0);
- "undefined" === typeof p && (p = h + d);
- "undefined" === typeof n && (n = k + c);
- var q = new b.Texture;
- q._bitmapData = this.bitmapData;
- q._bitmapX = this._bitmapX + g;
- q._bitmapY = this._bitmapY + f;
- q._bitmapWidth = d;
- q._bitmapHeight = c;
- q._offsetX = h;
- q._offsetY = k;
- q._textureWidth = p;
- q._textureHeight = n;
- q._sourceWidth = this._sourceWidth;
- q._sourceHeight = this._sourceHeight;
- return this._textureMap[a] = q
- };
- return a
- } (b.HashObject);
- b.SpriteSheet = c;
- c.prototype.__class__ = "egret.SpriteSheet"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._size = 30;
- this._textColorString = "#FFFFFF";
- this._textColor = 16777215;
- this.stageText = new b.StageText;
- var a = this.localToGlobal();
- this.stageText._open(a.x, a.y, this._explicitWidth, this._explicitHeight)
- }
- __extends(a, d);
- a.prototype._onAddToStage = function() {
- d.prototype._onAddToStage.call(this);
- this.stageText._add();
- this.addEventListener(b.TouchEvent.TOUCH_BEGIN, this.onMouseDownHandler, this)
- };
- a.prototype.setText = function(a) {
- this.stageText._setText(a)
- };
- a.prototype.getText = function() {
- return this.stageText._getText()
- };
- a.prototype.setTextType = function(a) {
- this.stageText._setTextType(a)
- };
- a.prototype.getTextType = function() {
- return this.stageText._getTextType()
- };
- a.prototype.onMouseDownHandler = function(a) {};
- a.prototype._onRemoveFromStage = function() {
- this.stageText._remove()
- };
- a.prototype._measureBounds = function() {
- return b.Rectangle.identity
- };
- a.prototype.hitTest = function(a, b, f) {
- return null
- };
- a.prototype._updateTransform = function() {
- var a = this._worldTransform.a,
- b = this._worldTransform.b,
- f = this._worldTransform.c,
- c = this._worldTransform.d,
- l = this._worldTransform.tx,
- h = this._worldTransform.ty;
- d.prototype._updateTransform.call(this);
- var k = this._worldTransform;
- if (a != k.a || b != k.b || f != k.c || c != k.d || l != k.tx || h != k.ty) a = this.localToGlobal(),
- this.stageText.changePosition(a.x, a.y),
- this.stageText.changeSize(this._explicitWidth, this._explicitHeight)
- };
- Object.defineProperty(a.prototype, "size", {
- get: function() {
- return this._size
- },
- set: function(a) {
- this._size != a && (this._size = a, this.stageText.setSize(this._size))
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textColor", {
- get: function() {
- return this._textColor
- },
- set: function(a) {
- this._textColor != a && (this._textColor = a, this._textColorString = b.toColorString(a), this.stageText.setTextColor(this._textColorString))
- },
- enumerable: !0,
- configurable: !0
- });
- return a
- } (b.DisplayObject);
- b.TextInput = c;
- c.prototype.__class__ = "egret.TextInput"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(a, g) {
- b.call(this, a);
- this.charList = this.parseConfig(g)
- }
- __extends(a, b);
- a.prototype.getTexture = function(a) {
- var b = this._textureMap[a];
- if (!b) {
- b = this.charList[a];
- if (!b) return null;
- b = this.createTexture(a, b.x, b.y, b.width, b.height, b.offsetX, b.offsetY);
- this._textureMap[a] = b
- }
- return b
- };
- a.prototype.parseConfig = function(a) {
- a = a.split("\r\n").join("\n");
- a = a.split("\n");
- for (var b = this.getConfigByKey(a[3], "count"), f = {},
- d = 4; d < 4 + b; d++) {
- var c = a[d],
- h = String.fromCharCode(this.getConfigByKey(c, "id")),
- k = {};
- f[h] = k;
- k.x = this.getConfigByKey(c, "x");
- k.y = this.getConfigByKey(c, "y");
- k.width = this.getConfigByKey(c, "width");
- k.height = this.getConfigByKey(c, "height");
- k.offsetX = this.getConfigByKey(c, "xoffset");
- k.offsetY = this.getConfigByKey(c, "yoffset")
- }
- return f
- };
- a.prototype.getConfigByKey = function(a, b) {
- for (var f = a.split(" "), d = 0, c = f.length; d < c; d++) {
- var h = f[d];
- if (b == h.substring(0, b.length)) return f = h.substring(b.length + 1),
- parseInt(f)
- }
- return 0
- };
- return a
- } (b.SpriteSheet);
- b.BitmapTextSpriteSheet = c;
- c.prototype.__class__ = "egret.BitmapTextSpriteSheet"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(a) {
- function e(e, f) {
- a.call(this);
- this.frameRate = 60;
- e instanceof d ? (b.Logger.warning("MovieClip#constructor\u63a5\u53e3\u53c2\u6570\u5df2\u7ecf\u53d8\u66f4\uff0c\u8bf7\u5c3d\u5feb\u8c03\u6574\u7528\u6cd5\u4e3a new MovieClip(data,texture)"), this.delegate = e) : this.delegate = new d(e, f);
- this.delegate.setMovieClip(this)
- }
- __extends(e, a);
- e.prototype.gotoAndPlay = function(a) {
- this.delegate.gotoAndPlay(a)
- };
- e.prototype.gotoAndStop = function(a) {
- this.delegate.gotoAndStop(a)
- };
- e.prototype.stop = function() {
- this.delegate.stop()
- };
- e.prototype.dispose = function() {
- this.delegate.dispose()
- };
- e.prototype.release = function() {
- b.Logger.warning("MovieClip#release\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- this.dispose()
- };
- e.prototype.getCurrentFrameIndex = function() {
- b.Logger.warning("MovieClip#getCurrentFrameIndex\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate._currentFrameIndex
- };
- e.prototype.getTotalFrame = function() {
- b.Logger.warning("MovieClip#getTotalFrame\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate._totalFrame
- };
- e.prototype.setInterval = function(a) {
- b.Logger.warning("MovieClip#setInterval\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03,\u8bf7\u4f7f\u7528MovieClip#frameRate\u4ee3\u66ff");
- this.frameRate = 60 / a
- };
- e.prototype.getIsPlaying = function() {
- b.Logger.warning("MovieClip#getIsPlaying\u65b9\u6cd5\u5373\u5c06\u5e9f\u5f03");
- return this.delegate.isPlaying
- };
- return e
- } (b.DisplayObjectContainer);
- b.MovieClip = c;
- c.prototype.__class__ = "egret.MovieClip";
- var d = function() {
- function a(a, g) {
- this.data = a;
- this._currentFrameIndex = this._passTime = this._totalFrame = 0;
- this._isPlaying = !1;
- this._frameData = a;
- this._spriteSheet = new b.SpriteSheet(g)
- }
- a.prototype.setMovieClip = function(a) {
- this.movieClip = a;
- this.bitmap = new b.Bitmap;
- this.movieClip.addChild(this.bitmap)
- };
- a.prototype.gotoAndPlay = function(a) {
- this.checkHasFrame(a);
- this._isPlaying = !0;
- this._currentFrameIndex = 0;
- this._currentFrameName = a;
- this._totalFrame = this._frameData.frames[a].totalFrame;
- this.playNextFrame();
- this._passTime = 0;
- b.Ticker.getInstance().register(this.update, this)
- };
- a.prototype.gotoAndStop = function(a) {
- this.checkHasFrame(a);
- this.stop();
- this._currentFrameIndex = this._passTime = 0;
- this._currentFrameName = a;
- this._totalFrame = this._frameData.frames[a].totalFrame;
- this.playNextFrame()
- };
- a.prototype.stop = function() {
- this._isPlaying = !1;
- b.Ticker.getInstance().unregister(this.update, this)
- };
- a.prototype.dispose = function() {};
- a.prototype.checkHasFrame = function(a) {
- void 0 == this._frameData.frames[a] && b.Logger.fatal("MovieClip\u6ca1\u6709\u5bf9\u5e94\u7684frame\uff1a", a)
- };
- a.prototype.update = function(a) {
- for (var b = 1E3 / this.movieClip.frameRate,
- b = Math.floor((this._passTime % b + a) / b); 1 <= b;) 1 == b ? this.playNextFrame() : this.playNextFrame(!1),
- b--;
- this._passTime += a
- };
- a.prototype.playNextFrame = function(a) {
- "undefined" === typeof a && (a = !0);
- var b = this._frameData.frames[this._currentFrameName].childrenFrame[this._currentFrameIndex];
- if (a) {
- a = this.getTexture(b.res);
- var f = this.bitmap;
- f.x = b.x;
- f.y = b.y;
- f.texture = a
- }
- null != b.action && this.movieClip.dispatchEventWith(b.action);
- this._currentFrameIndex++;
- this._currentFrameIndex == this._totalFrame && (this._currentFrameIndex = 0)
- };
- a.prototype.getTexture = function(a) {
- var b = this._frameData.res[a],
- f = this._spriteSheet.getTexture(a);
- f || (f = this._spriteSheet.createTexture(a, b.x, b.y, b.w, b.h));
- return f
- };
- return a
- } ();
- b.DefaultMovieClipDelegate = d;
- d.prototype.__class__ = "egret.DefaultMovieClipDelegate"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._size = 20
- }
- __extends(a, d);
- a.prototype._getText = function() {
- return this.inputElement.value
- };
- a.prototype._setText = function(a) {
- this.inputElement.value = a
- };
- a.prototype._setTextType = function(a) {
- this.inputElement.type = a
- };
- a.prototype._getTextType = function() {
- return this.inputElement.type
- };
- a.prototype._open = function(a, g, f, d) {
- "undefined" === typeof f && (f = 160);
- d = b.StageDelegate.getInstance().getScaleX();
- var c = b.StageDelegate.getInstance().getScaleY(),
- h = document.createElement("input");
- h.type = "text";
- h.style.fontSize = this._size + "px";
- h.style.color = "#FFFFFF";
- h.style.border = "none";
- h.style.background = "none";
- h.style.width = f + "px";
- h.style.padding = "0";
- h.style.outline = "medium";
- var k = b.Browser.getInstance().$new("div");
- k.position.x = a * d;
- k.position.y = g * c;
- k.style.width = f + "px";
- k.scale.x = d;
- k.scale.y = c;
- k.transforms();
- k.style[egret_dom.getTrans("transformOrigin")] = "0% 0% 0px";
- k.appendChild(h);
- this.div = k;
- this.inputElement = h
- };
- a.prototype.getStageDelegateDiv = function() {
- var a = b.Browser.getInstance().$("#StageDelegateDiv");
- a || (a = b.Browser.getInstance().$new("div"), a.id = "StageDelegateDiv", document.getElementById(b.StageDelegate.canvas_div_name).appendChild(a), a.transforms());
- return a
- };
- a.prototype._add = function() {
- var a = this.div;
- a && !a.parentNode && this.getStageDelegateDiv().appendChild(a)
- };
- a.prototype._remove = function() {
- var a = this.div;
- a && a.parentNode && a.parentNode.removeChild(a)
- };
- a.prototype.changePosition = function(a, g) {
- var f = b.StageDelegate.getInstance().getScaleX(),
- d = b.StageDelegate.getInstance().getScaleY();
- this.div.position.x = a * f;
- this.div.position.y = g * d;
- this.div.transforms()
- };
- a.prototype.changeSize = function(a, b) {
- this.inputElement.style.width = a + "px";
- this.div.style.width = a + "px";
- this.div.transforms()
- };
- a.prototype.setSize = function(a) {
- this._size = a;
- this.inputElement.style.fontSize = this._size + "px"
- };
- a.prototype.setTextColor = function(a) {
- this.inputElement.style.color = a
- };
- return a
- } (b.HashObject);
- b.StageText = c;
- c.prototype.__class__ = "egret.StageText"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.GET = "GET";
- b.POST = "POST";
- return b
- } ();
- b.URLRequestMethod = c;
- c.prototype.__class__ = "egret.URLRequestMethod"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.BINARY = "binary";
- b.TEXT = "text";
- b.VARIABLES = "variables";
- b.TEXTURE = "texture";
- b.SOUND = "sound";
- return b
- } ();
- b.URLLoaderDataFormat = c;
- c.prototype.__class__ = "egret.URLLoaderDataFormat"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- b.call(this);
- null !== a && this.decode(a)
- }
- __extends(a, b);
- a.prototype.decode = function(a) {
- this.variables || (this.variables = {});
- a = a.split("+").join(" ");
- for (var b, f = /[?&]?([^=]+)=([^&]*)/g; b = f.exec(a);) this.variables[decodeURIComponent(b[1])] = decodeURIComponent(b[2])
- };
- a.prototype.toString = function() {
- if (!this.variables) return "";
- var a = this.variables,
- b = "",
- f = !0,
- d;
- for (d in a) f ? f = !1 : b += "&",
- b += d + "=" + a[d];
- return b
- };
- return a
- } (b.HashObject);
- b.URLVariables = c;
- c.prototype.__class__ = "egret.URLVariables"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- d.call(this);
- this.method = b.URLRequestMethod.GET;
- this.url = a
- }
- __extends(a, d);
- return a
- } (b.HashObject);
- b.URLRequest = c;
- c.prototype.__class__ = "egret.URLRequest"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a) {
- "undefined" === typeof a && (a = null);
- d.call(this);
- this.dataFormat = b.URLLoaderDataFormat.TEXT;
- a && this.load(a)
- }
- __extends(a, d);
- a.prototype.load = function(a) {
- this._request = a;
- this.data = null;
- b.MainContext.instance.netContext.proceed(this)
- };
- return a
- } (b.EventDispatcher);
- b.URLLoader = c;
- c.prototype.__class__ = "egret.URLLoader"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._textureHeight = this._textureWidth = this._offsetY = this._offsetX = this._bitmapHeight = this._bitmapWidth = this._bitmapY = this._bitmapX = 0
- }
- __extends(a, d);
- Object.defineProperty(a.prototype, "textureWidth", {
- get: function() {
- return this._textureWidth
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "textureHeight", {
- get: function() {
- return this._textureHeight
- },
- enumerable: !0,
- configurable: !0
- });
- Object.defineProperty(a.prototype, "bitmapData", {
- get: function() {
- return this._bitmapData
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype._setBitmapData = function(a) {
- var g = b.MainContext.instance.rendererContext.texture_scale_factor;
- this._bitmapData = a;
- this._sourceWidth = a.width;
- this._sourceHeight = a.height;
- this._textureWidth = this._sourceWidth * g;
- this._textureHeight = this._sourceHeight * g;
- this._bitmapWidth = this._textureWidth;
- this._bitmapHeight = this._textureHeight;
- this._offsetX = this._offsetY = this._bitmapX = this._bitmapY = 0
- };
- a.prototype.getPixel32 = function(a, b) {
- return this._bitmapData.getContext("2d").getImageData(a, b, 1, 1).data
- };
- return a
- } (b.HashObject);
- b.Texture = c;
- c.prototype.__class__ = "egret.Texture"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._bitmapData = document.createElement("canvas");
- this.renderContext = b.RendererContext.createRendererContext(this._bitmapData)
- }
- __extends(a, d);
- a.prototype.drawToTexture = function(a) {
- var g = this._bitmapData,
- f = a.getBounds(b.Rectangle.identity);
- g.width = f.width;
- g.height = f.height;
- a._worldTransform.identity();
- a.worldAlpha = 1;
- if (a instanceof b.DisplayObjectContainer) {
- this._offsetX = f.x;
- this._offsetY = f.y;
- a._worldTransform.append(1, 0, 0, 1, -f.x, -f.y);
- for (var g = a._children,
- f = 0,
- d = g.length; f < d; f++) g[f]._updateTransform()
- }
- g = b.RenderFilter.getInstance();
- f = g._drawAreaList.concat();
- g._drawAreaList.length = 0;
- this.renderContext.clearScreen();
- this.webGLTexture = null; (d = a.mask || a._scrollRect) && this.renderContext.pushMask(d);
- a._render(this.renderContext);
- d && this.renderContext.popMask();
- g._drawAreaList = f;
- this._textureWidth = this._bitmapData.width;
- this._textureHeight = this._bitmapData.height;
- this._sourceWidth = this._textureWidth;
- this._sourceHeight = this._textureHeight
- };
- return a
- } (b.Texture);
- b.RenderTexture = c;
- c.prototype.__class__ = "egret.RenderTexture"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.renderCost = 0;
- this.texture_scale_factor = 1
- }
- __extends(a, d);
- a.prototype.clearScreen = function() {};
- a.prototype.clearRect = function(a, b, f, d) {};
- a.prototype.drawImage = function(a, g, f, d, c, h, k, p, n) {
- b.Profiler.getInstance().onDrawImage()
- };
- a.prototype.setTransform = function(a) {};
- a.prototype.setAlpha = function(a, b) {};
- a.prototype.setupFont = function(a) {};
- a.prototype.measureText = function(a) {
- return 0
- };
- a.prototype.drawText = function(a, g, f, d, c) {
- b.Profiler.getInstance().onDrawImage()
- };
- a.prototype.strokeRect = function(a, b, f, d, c) {};
- a.prototype.pushMask = function(a) {};
- a.prototype.popMask = function() {};
- a.prototype.onRenderStart = function() {};
- a.prototype.onRenderFinish = function() {};
- a.createRendererContext = function(a) {
- return null
- };
- return a
- } (b.HashObject);
- b.RendererContext = c;
- c.prototype.__class__ = "egret.RendererContext"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.MOUSE = "mouse";
- b.TOUCH = "touch";
- b.mode = "touch";
- return b
- } ();
- b.InteractionMode = c;
- c.prototype.__class__ = "egret.InteractionMode"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this._currentTouchTarget = {};
- this.maxTouches = 2;
- this.touchDownTarget = {};
- this.touchingIdentifiers = [];
- this.lastTouchY = this.lastTouchX = -1
- }
- __extends(a, d);
- a.prototype.run = function() {};
- a.prototype.getTouchData = function(a, b, f) {
- var d = this._currentTouchTarget[a];
- null == d && (d = {},
- this._currentTouchTarget[a] = d);
- d.stageX = b;
- d.stageY = f;
- d.identifier = a;
- return d
- };
- a.prototype.dispatchEvent = function(a, g) {
- b.TouchEvent.dispatchTouchEvent(g.target, a, g.identifier, g.stageX, g.stageY, !1, !1, !1, !0 == this.touchDownTarget[g.identifier])
- };
- a.prototype.onTouchBegan = function(a, g, d) {
- if (this.touchingIdentifiers.length != this.maxTouches) {
- var c = b.MainContext.instance.stage.hitTest(a, g);
- c && (a = this.getTouchData(d, a, g), this.touchDownTarget[d] = !0, a.target = c, a.beginTarget = c, this.dispatchEvent(b.TouchEvent.TOUCH_BEGIN, a));
- this.touchingIdentifiers.push(d)
- }
- };
- a.prototype.onTouchMove = function(a, g, d) {
- if ( - 1 != this.touchingIdentifiers.indexOf(d) && (a != this.lastTouchX || g != this.lastTouchY)) {
- this.lastTouchX = a;
- this.lastTouchY = g;
- var c = b.MainContext.instance.stage.hitTest(a, g);
- c && (a = this.getTouchData(d, a, g), a.target = c, this.dispatchEvent(b.TouchEvent.TOUCH_MOVE, a))
- }
- };
- a.prototype.onTouchEnd = function(a, g, d) {
- var c = this.touchingIdentifiers.indexOf(d); - 1 != c && (this.touchingIdentifiers.splice(c, 1), c = b.MainContext.instance.stage.hitTest(a, g)) && (a = this.getTouchData(d, a, g), delete this.touchDownTarget[d], d = a.beginTarget, a.target = c, this.dispatchEvent(b.TouchEvent.TOUCH_END, a), d == c ? this.dispatchEvent(b.TouchEvent.TOUCH_TAP, a) : a.beginTarget && (a.target = a.beginTarget, this.dispatchEvent(b.TouchEvent.TOUCH_RELEASE_OUTSIDE, a)), delete this._currentTouchTarget[a.identifier])
- };
- return a
- } (b.HashObject);
- b.TouchContext = c;
- c.prototype.__class__ = "egret.TouchContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.proceed = function(a) {};
- return a
- } (b.HashObject);
- b.NetContext = c;
- c.prototype.__class__ = "egret.NetContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this.frameRate = 60
- }
- __extends(a, b);
- a.prototype.executeMainLoop = function(a, b) {};
- return a
- } (b.HashObject);
- b.DeviceContext = c;
- c.prototype.__class__ = "egret.DeviceContext"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.call = function(a, e) {};
- b.addCallback = function(a, e) {};
- return b
- } ();
- b.ExternalInterface = c;
- c.prototype.__class__ = "egret.ExternalInterface"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a() {
- d.call(this);
- this.translate = this.isHD ?
- function(a) {
- return "translate3d(" + a.x + "px, " + (a.y - b.MainContext.instance.stage.stageHeight) + "px, 0) "
- }: function(a) {
- return "translate(" + a.x + "px, " + a.y + "px) "
- };
- this.rotate = this.isHD ?
- function(a) {
- return "rotateZ(" + a + "deg) "
- }: function(a) {
- return "rotate(" + a + "deg) "
- };
- this.ua = navigator.userAgent.toLowerCase();
- var a = this.ua.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baidubrowser|maxthon|ie|opera|firefox/) || this.ua.match(/chrome|safari/);
- a && 0 < a.length && (a = a[0], "micromessenger" == a && (this.type = "wechat"), this.type = a);
- this.type = "unknow";
- switch (this.type) {
- case "firefox":
- this.pfx = "Moz";
- this.isHD = !0;
- break;
- case "chrome":
- case "safari":
- this.pfx = "webkit";
- this.isHD = !0;
- break;
- case "opera":
- this.pfx = "O";
- this.isHD = !1;
- break;
- case "ie":
- this.pfx = "ms";
- this.isHD = !1;
- break;
- default:
- this.pfx = "webkit",
- this.isHD = !0
- }
- this.trans = this.pfx + "Transform"
- }
- __extends(a, d);
- a.getInstance = function() {
- null == a.instance && (a.instance = new a);
- return a.instance
- };
- Object.defineProperty(a.prototype, "isMobile", {
- get: function() {
- b.Logger.warning("Browser.isMobile\u63a5\u53e3\u53c2\u6570\u5df2\u7ecf\u53d8\u66f4\uff0c\u8bf7\u5c3d\u5feb\u8c03\u6574\u7528\u6cd5\u4e3a egret.MainContext.deviceType == egret.MainContext.DEVICE_MOBILE ");
- return b.MainContext.deviceType == b.MainContext.DEVICE_MOBILE
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.$new = function(a) {
- return this.$(document.createElement(a))
- };
- a.prototype.$ = function(e) {
- var g = document;
- if (e = e instanceof HTMLElement ? e: g.querySelector(e)) e.find = e.find || this.$,
- e.hasClass = e.hasClass ||
- function(a) {
- return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)"))
- },
- e.addClass = e.addClass ||
- function(a) {
- this.hasClass(a) || (this.className && (this.className += " "), this.className += a);
- return this
- },
- e.removeClass = e.removeClass ||
- function(a) {
- this.hasClass(a) && (this.className = this.className.replace(a, ""));
- return this
- },
- e.remove = e.remove ||
- function() {},
- e.appendTo = e.appendTo ||
- function(a) {
- a.appendChild(this);
- return this
- },
- e.prependTo = e.prependTo ||
- function(a) {
- a.childNodes[0] ? a.insertBefore(this, a.childNodes[0]) : a.appendChild(this);
- return this
- },
- e.transforms = e.transforms ||
- function() {
- this.style[a.getInstance().trans] = a.getInstance().translate(this.position) + a.getInstance().rotate(this.rotation) + a.getInstance().scale(this.scale) + a.getInstance().skew(this.skew);
- return this
- },
- e.position = e.position || {
- x: 0,
- y: 0
- },
- e.rotation = e.rotation || 0,
- e.scale = e.scale || {
- x: 1,
- y: 1
- },
- e.skew = e.skew || {
- x: 0,
- y: 0
- },
- e.translates = function(a, e) {
- this.position.x = a;
- this.position.y = e - b.MainContext.instance.stage.stageHeight;
- this.transforms();
- return this
- },
- e.rotate = function(a) {
- this.rotation = a;
- this.transforms();
- return this
- },
- e.resize = function(a, e) {
- this.scale.x = a;
- this.scale.y = e;
- this.transforms();
- return this
- },
- e.setSkew = function(a, e) {
- this.skew.x = a;
- this.skew.y = e;
- this.transforms();
- return this
- };
- return e
- };
- a.prototype.scale = function(a) {
- return "scale(" + a.x + ", " + a.y + ") "
- };
- a.prototype.skew = function(a) {
- return "skewX(" + -a.x + "deg) skewY(" + a.y + "deg)"
- };
- return a
- } (b.HashObject);
- b.Browser = c;
- c.prototype.__class__ = "egret.Browser"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {}
- d.parse = function(a) {
- a = b.SAXParser.getInstance().parserXML(a);
- if (!a || !a.childNodes) return null;
- for (var e = a.childNodes.length,
- g = !1,
- c = 0; c < e; c++) {
- var m = a.childNodes[c];
- if (1 == m.nodeType) {
- g = !0;
- break
- }
- }
- return g ? d.parseNode(m) : null
- };
- d.parseNode = function(a) {
- if (!a || 1 != a.nodeType) return null;
- var e = {};
- e.localName = a.localName;
- e.name = a.nodeName;
- a.namespaceURI && (e.namespace = a.namespaceURI);
- a.prefix && (e.prefix = a.prefix);
- for (var b = a.attributes,
- c = b.length,
- m = 0; m < c; m++) {
- var l = b[m],
- h = l.name;
- 0 != h.indexOf("xmlns:") && (e["$" + h] = l.value)
- }
- b = a.childNodes;
- c = b.length;
- for (m = 0; m < c; m++) if (l = d.parseNode(b[m])) e.children || (e.children = []),
- l.parent = e,
- e.children.push(l); ! e.children && (a = a.textContent.trim()) && (e.text = a);
- return e
- };
- d.findChildren = function(a, e, b) {
- b ? b.length = 0 : b = [];
- d.findByPath(a, e, b);
- return b
- };
- d.findByPath = function(a, e, b) {
- var c = e.indexOf("."),
- m; - 1 == c ? (m = e, c = !0) : (m = e.substring(0, c), e = e.substring(c + 1), c = !1);
- if (a = a.children) for (var l = a.length,
- h = 0; h < l; h++) {
- var k = a[h];
- k.localName == m && (c ? b.push(k) : d.findByPath(k, e, b))
- }
- };
- d.getAttributes = function(a, e) {
- e ? e.length = 0 : e = [];
- for (var b in a)"$" == b.charAt(0) && e.push(b.substring(1));
- return e
- };
- return d
- } ();
- b.XML = c;
- c.prototype.__class__ = "egret.XML"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function a() {}
- a.LITTLE_ENDIAN = "LITTLE_ENDIAN";
- a.BIG_ENDIAN = "BIG_ENDIAN";
- return a
- } ();
- b.Endian = c;
- c.prototype.__class__ = "egret.Endian";
- var d = function() {
- function a() {
- this.length = this.position = 0;
- this._mode = "";
- this.maxlength = 0;
- this._endian = c.LITTLE_ENDIAN;
- this.isLittleEndian = !1;
- this._mode = "Typed array";
- this.maxlength = 4;
- this.arraybytes = new ArrayBuffer(this.maxlength);
- this.unalignedarraybytestemp = new ArrayBuffer(16);
- this.endian = a.DEFAULT_ENDIAN
- }
- Object.defineProperty(a.prototype, "endian", {
- get: function() {
- return this._endian
- },
- set: function(a) {
- this._endian = a;
- this.isLittleEndian = a == c.LITTLE_ENDIAN
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.ensureWriteableSpace = function(a) {
- this.ensureSpace(a + this.position)
- };
- a.prototype.setArrayBuffer = function(a) {
- this.ensureSpace(a.byteLength);
- this.length = a.byteLength;
- a = new Int8Array(a); (new Int8Array(this.arraybytes, 0, this.length)).set(a);
- this.position = 0
- };
- Object.defineProperty(a.prototype, "bytesAvailable", {
- get: function() {
- return this.length - this.position
- },
- enumerable: !0,
- configurable: !0
- });
- a.prototype.ensureSpace = function(a) {
- if (a > this.maxlength) {
- a = a + 255 & -256;
- var b = new ArrayBuffer(a),
- d = new Uint8Array(this.arraybytes, 0, this.length); (new Uint8Array(b, 0, this.length)).set(d);
- this.arraybytes = b;
- this.maxlength = a
- }
- };
- a.prototype.writeByte = function(a) {
- this.ensureWriteableSpace(1); (new Int8Array(this.arraybytes))[this.position++] = ~~a;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readByte = function() {
- if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- return (new Int8Array(this.arraybytes))[this.position++]
- };
- a.prototype.readBytes = function(a, b, d) {
- "undefined" === typeof b && (b = 0);
- "undefined" === typeof d && (d = 0);
- null == d && (d = a.length);
- a.ensureWriteableSpace(b + d);
- var c = new Int8Array(a.arraybytes),
- l = new Int8Array(this.arraybytes);
- c.set(l.subarray(this.position, this.position + d), b);
- this.position += d;
- d + b > a.length && (a.length += d + b - a.length)
- };
- a.prototype.writeUnsignedByte = function(a) {
- this.ensureWriteableSpace(1); (new Uint8Array(this.arraybytes))[this.position++] = ~~a & 255;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUnsignedByte = function() {
- if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- return (new Uint8Array(this.arraybytes))[this.position++]
- };
- a.prototype.writeUnsignedShort = function(a) {
- this.ensureWriteableSpace(2);
- if (0 == (this.position & 1)) {
- var b = new Uint16Array(this.arraybytes);
- b[this.position >> 1] = ~~a & 65535
- } else b = new Uint16Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = ~~a & 65535,
- a = new Uint8Array(this.arraybytes, this.position, 2),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 2),
- a.set(b);
- this.position += 2;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUTFBytes = function(a) {
- var b = "";
- a = this.position + a;
- for (var d = new DataView(this.arraybytes); this.position < a;) {
- var c = d.getUint8(this.position++);
- if (128 > c) {
- if (0 == c) break;
- b += String.fromCharCode(c)
- } else if (224 > c) b += String.fromCharCode((c & 63) << 6 | d.getUint8(this.position++) & 127);
- else if (240 > c) var l = d.getUint8(this.position++),
- b = b + String.fromCharCode((c & 31) << 12 | (l & 127) << 6 | d.getUint8(this.position++) & 127);
- else var l = d.getUint8(this.position++),
- h = d.getUint8(this.position++),
- b = b + String.fromCharCode((c & 15) << 18 | (l & 127) << 12 | h << 6 & 127 | d.getUint8(this.position++) & 127)
- }
- return b
- };
- a.prototype.readInt = function() {
- var a = (new DataView(this.arraybytes)).getInt32(this.position, this.isLittleEndian);
- this.position += 4;
- return a
- };
- a.prototype.readShort = function() {
- var a = (new DataView(this.arraybytes)).getInt16(this.position, this.isLittleEndian);
- this.position += 2;
- return a
- };
- a.prototype.readDouble = function() {
- var a = (new DataView(this.arraybytes)).getFloat64(this.position, this.isLittleEndian);
- this.position += 8;
- return a
- };
- a.prototype.readUnsignedShort = function() {
- if (this.position > this.length + 2) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 1)) {
- var a = new Uint16Array(this.arraybytes),
- b = this.position >> 1;
- this.position += 2;
- return a[b]
- }
- a = new Uint16Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 2); (new Uint8Array(this.unalignedarraybytestemp, 0, 2)).set(b);
- this.position += 2;
- return a[0]
- };
- a.prototype.writeUnsignedInt = function(a) {
- this.ensureWriteableSpace(4);
- if (0 == (this.position & 3)) {
- var b = new Uint32Array(this.arraybytes);
- b[this.position >> 2] = ~~a & 4294967295
- } else b = new Uint32Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = ~~a & 4294967295,
- a = new Uint8Array(this.arraybytes, this.position, 4),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 4),
- a.set(b);
- this.position += 4;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readUnsignedInt = function() {
- if (this.position > this.length + 4) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 3)) {
- var a = new Uint32Array(this.arraybytes),
- b = this.position >> 2;
- this.position += 4;
- return a[b]
- }
- a = new Uint32Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 4); (new Uint8Array(this.unalignedarraybytestemp, 0, 4)).set(b);
- this.position += 4;
- return a[0]
- };
- a.prototype.writeFloat = function(a) {
- this.ensureWriteableSpace(4);
- if (0 == (this.position & 3)) {
- var b = new Float32Array(this.arraybytes);
- b[this.position >> 2] = a
- } else b = new Float32Array(this.unalignedarraybytestemp, 0, 1),
- b[0] = a,
- a = new Uint8Array(this.arraybytes, this.position, 4),
- b = new Uint8Array(this.unalignedarraybytestemp, 0, 4),
- a.set(b);
- this.position += 4;
- this.position > this.length && (this.length = this.position)
- };
- a.prototype.readFloat = function() {
- if (this.position > this.length + 4) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
- if (0 == (this.position & 3)) {
- var a = new Float32Array(this.arraybytes),
- b = this.position >> 2;
- this.position += 4;
- return a[b]
- }
- a = new Float32Array(this.unalignedarraybytestemp, 0, 1);
- b = new Uint8Array(this.arraybytes, this.position, 4); (new Uint8Array(this.unalignedarraybytestemp, 0, 4)).set(b);
- this.position += 4;
- return a[0]
- };
- a.DEFAULT_ENDIAN = c.BIG_ENDIAN;
- return a
- } ();
- b.ByteArray = d;
- d.prototype.__class__ = "egret.ByteArray"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(d) {
- function a(a, b, c) {
- d.call(this);
- this._target = null;
- this.loop = this.ignoreGlobalPause = this._useTicks = !1;
- this._actions = this._steps = this.pluginData = null;
- this.paused = !1;
- this.duration = 0;
- this._prevPos = -1;
- this.position = null;
- this._stepPosition = this._prevPosition = 0;
- this.passive = !1;
- this.initialize(a, b, c)
- }
- __extends(a, d);
- a.get = function(e, b, d, c) {
- "undefined" === typeof b && (b = null);
- "undefined" === typeof d && (d = null);
- "undefined" === typeof c && (c = !1);
- c && a.removeTweens(e);
- return new a(e, b, d)
- };
- a.removeTweens = function(e) {
- if (e.tween_count) {
- for (var b = a._tweens,
- d = b.length - 1; 0 <= d; d--) b[d]._target == e && (b[d].paused = !0, b.splice(d, 1));
- e.tween_count = 0
- }
- };
- a.tick = function(e, b) {
- "undefined" === typeof b && (b = !1);
- for (var d = a._tweens.concat(), c = d.length - 1; 0 <= c; c--) {
- var l = d[c];
- b && !l.ignoreGlobalPause || l.paused || l.tick(l._useTicks ? 1 : e)
- }
- };
- a._register = function(e, d) {
- var c = e._target,
- m = a._tweens;
- if (d) c && (c.tween_count = c.tween_count ? c.tween_count + 1 : 1),
- m.push(e),
- a._inited || (b.Ticker.getInstance().register(a.tick, null), a._inited = !0);
- else for (c && c.tween_count--, c = m.length; c--;) if (m[c] == e) {
- m.splice(c, 1);
- break
- }
- };
- a.removeAllTweens = function() {
- for (var e = a._tweens,
- b = 0,
- d = e.length; b < d; b++) {
- var c = e[b];
- c.paused = !0;
- c._target.tweenjs_count = 0
- }
- e.length = 0
- };
- a.prototype.initialize = function(e, b, d) {
- this._target = e;
- b && (this._useTicks = b.useTicks, this.ignoreGlobalPause = b.ignoreGlobalPause, this.loop = b.loop, b.onChange && this.addEventListener("change", b.onChange, b.onChangeObj), b.override && a.removeTweens(e));
- this.pluginData = d || {};
- this._curQueueProps = {};
- this._initQueueProps = {};
- this._steps = [];
- this._actions = [];
- b && b.paused ? this.paused = !0 : a._register(this, !0);
- b && null != b.position && this.setPosition(b.position, a.NONE)
- };
- a.prototype.setPosition = function(a, b) {
- "undefined" === typeof b && (b = 1);
- 0 > a && (a = 0);
- var d = a,
- c = !1;
- d >= this.duration && (this.loop ? d %= this.duration: (d = this.duration, c = !0));
- if (d == this._prevPos) return c;
- var l = this._prevPos;
- this.position = this._prevPos = d;
- this._prevPosition = a;
- if (this._target) if (c) this._updateTargetProps(null, 1);
- else if (0 < this._steps.length) {
- for (var h = 0,
- k = this._steps.length; h < k && !(this._steps[h].t > d); h++);
- h = this._steps[h - 1];
- this._updateTargetProps(h, (this._stepPosition = d - h.t) / h.d)
- }
- 0 != b && 0 < this._actions.length && (this._useTicks ? this._runActions(d, d) : 1 == b && d < l ? (l != this.duration && this._runActions(l, this.duration), this._runActions(0, d, !0)) : this._runActions(l, d));
- c && this.setPaused(!0);
- this.dispatchEventWith("change");
- return c
- };
- a.prototype._runActions = function(a, b, d) {
- "undefined" === typeof d && (d = !1);
- var c = a,
- l = b,
- h = -1,
- k = this._actions.length,
- p = 1;
- a > b && (c = b, l = a, h = k, k = p = -1);
- for (; (h += p) != k;) {
- b = this._actions[h];
- var n = b.t; (n == l || n > c && n < l || d && n == a) && b.f.apply(b.o, b.p)
- }
- };
- a.prototype._updateTargetProps = function(e, b) {
- var d, c, l, h;
- if (e || 1 != b) {
- if (this.passive = !!e.v) return;
- e.e && (b = e.e(b, 0, 1, 1));
- d = e.p0;
- c = e.p1
- } else this.passive = !1,
- d = c = this._curQueueProps;
- for (var k in this._initQueueProps) {
- null == (l = d[k]) && (d[k] = l = this._initQueueProps[k]);
- null == (h = c[k]) && (c[k] = h = l);
- l = l == h || 0 == b || 1 == b || "number" != typeof l ? 1 == b ? h: l: l + (h - l) * b;
- var p = !1;
- if (h = a._plugins[k]) for (var n = 0,
- q = h.length; n < q; n++) {
- var t = h[n].tween(this, k, l, d, c, b, !!e && d == c, !e);
- t == a.IGNORE ? p = !0 : l = t
- }
- p || (this._target[k] = l)
- }
- };
- a.prototype.setPaused = function(e) {
- this.paused = e;
- a._register(this, !e);
- return this
- };
- a.prototype._cloneProps = function(a) {
- var b = {},
- d;
- for (d in a) b[d] = a[d];
- return b
- };
- a.prototype._addStep = function(a) {
- 0 < a.d && (this._steps.push(a), a.t = this.duration, this.duration += a.d);
- return this
- };
- a.prototype._appendQueueProps = function(e) {
- var b, d, c, l, h, k;
- for (k in e) if (void 0 === this._initQueueProps[k]) {
- d = this._target[k];
- if (b = a._plugins[k]) for (c = 0, l = b.length; c < l; c++) d = b[c].init(this, k, d);
- this._initQueueProps[k] = this._curQueueProps[k] = void 0 === d ? null: d
- }
- for (k in e) {
- d = this._curQueueProps[k];
- if (b = a._plugins[k]) for (h = h || {},
- c = 0, l = b.length; c < l; c++) b[c].step && b[c].step(this, k, d, e[k], h);
- this._curQueueProps[k] = e[k]
- }
- h && this._appendQueueProps(h);
- return this._curQueueProps
- };
- a.prototype._addAction = function(a) {
- a.t = this.duration;
- this._actions.push(a);
- return this
- };
- a.prototype._set = function(a, b) {
- for (var d in a) b[d] = a[d]
- };
- a.prototype.wait = function(a, b) {
- if (null == a || 0 >= a) return this;
- var d = this._cloneProps(this._curQueueProps);
- return this._addStep({
- d: a,
- p0: d,
- p1: d,
- v: b
- })
- };
- a.prototype.to = function(a, b, d) {
- "undefined" === typeof d && (d = void 0);
- if (isNaN(b) || 0 > b) b = 0;
- return this._addStep({
- d: b || 0,
- p0: this._cloneProps(this._curQueueProps),
- e: d,
- p1: this._cloneProps(this._appendQueueProps(a))
- })
- };
- a.prototype.call = function(a, b, d) {
- "undefined" === typeof b && (b = void 0);
- "undefined" === typeof d && (d = void 0);
- return this._addAction({
- f: a,
- p: d ? d: [],
- o: b ? b: this._target
- })
- };
- a.prototype.set = function(a, b) {
- "undefined" === typeof b && (b = null);
- return this._addAction({
- f: this._set,
- o: this,
- p: [a, b ? b: this._target]
- })
- };
- a.prototype.play = function(a) {
- a || (a = this);
- return this.call(a.setPaused, a, [!1])
- };
- a.prototype.pause = function(a) {
- a || (a = this);
- return this.call(a.setPaused, a, [!0])
- };
- a.prototype.tick = function(a) {
- this.paused || this.setPosition(this._prevPosition + a)
- };
- a.NONE = 0;
- a.LOOP = 1;
- a.REVERSE = 2;
- a._tweens = [];
- a.IGNORE = {};
- a._plugins = {};
- a._inited = !1;
- return a
- } (b.EventDispatcher);
- b.Tween = c;
- c.prototype.__class__ = "egret.Tween"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function d() {
- b.Logger.fatal("Ease\u4e0d\u80fd\u88ab\u5b9e\u4f8b\u5316")
- }
- d.get = function(a) { - 1 > a && (a = -1);
- 1 < a && (a = 1);
- return function(b) {
- return 0 == a ? b: 0 > a ? b * (b * -a + 1 + a) : b * ((2 - b) * a + (1 - a))
- }
- };
- d.getPowIn = function(a) {
- return function(b) {
- return Math.pow(b, a)
- }
- };
- d.getPowOut = function(a) {
- return function(b) {
- return 1 - Math.pow(1 - b, a)
- }
- };
- d.getPowInOut = function(a) {
- return function(b) {
- return 1 > (b *= 2) ? 0.5 * Math.pow(b, a) : 1 - 0.5 * Math.abs(Math.pow(2 - b, a))
- }
- };
- d.sineIn = function(a) {
- return 1 - Math.cos(a * Math.PI / 2)
- };
- d.sineOut = function(a) {
- return Math.sin(a * Math.PI / 2)
- };
- d.sineInOut = function(a) {
- return - 0.5 * (Math.cos(Math.PI * a) - 1)
- };
- d.getBackIn = function(a) {
- return function(b) {
- return b * b * ((a + 1) * b - a)
- }
- };
- d.getBackOut = function(a) {
- return function(b) {
- b -= 1;
- return b * b * ((a + 1) * b + a) + 1
- }
- };
- d.getBackInOut = function(a) {
- a *= 1.525;
- return function(b) {
- return 1 > (b *= 2) ? 0.5 * b * b * ((a + 1) * b - a) : 0.5 * ((b -= 2) * b * ((a + 1) * b + a) + 2)
- }
- };
- d.circIn = function(a) {
- return - (Math.sqrt(1 - a * a) - 1)
- };
- d.circOut = function(a) {
- return Math.sqrt(1 - a * a)
- };
- d.circInOut = function(a) {
- return 1 > (a *= 2) ? -0.5 * (Math.sqrt(1 - a * a) - 1) : 0.5 * (Math.sqrt(1 - (a -= 2) * a) + 1)
- };
- d.bounceIn = function(a) {
- return 1 - d.bounceOut(1 - a)
- };
- d.bounceOut = function(a) {
- 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
- };
- d.bounceInOut = function(a) {
- return 0.5 > a ? 0.5 * d.bounceIn(2 * a) : 0.5 * d.bounceOut(2 * a - 1) + 0.5
- };
- d.getElasticIn = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- if (0 == c || 1 == c) return c;
- var m = b / d * Math.asin(1 / a);
- return - (a * Math.pow(2, 10 * (c -= 1)) * Math.sin((c - m) * d / b))
- }
- };
- d.getElasticOut = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- if (0 == c || 1 == c) return c;
- var m = b / d * Math.asin(1 / a);
- return a * Math.pow(2, -10 * c) * Math.sin((c - m) * d / b) + 1
- }
- };
- d.getElasticInOut = function(a, b) {
- var d = 2 * Math.PI;
- return function(c) {
- var m = b / d * Math.asin(1 / a);
- return 1 > (c *= 2) ? -0.5 * a * Math.pow(2, 10 * (c -= 1)) * Math.sin((c - m) * d / b) : a * Math.pow(2, -10 * (c -= 1)) * Math.sin((c - m) * d / b) * 0.5 + 1
- }
- };
- d.quadIn = d.getPowIn(2);
- d.quadOut = d.getPowOut(2);
- d.quadInOut = d.getPowInOut(2);
- d.cubicIn = d.getPowIn(3);
- d.cubicOut = d.getPowOut(3);
- d.cubicInOut = d.getPowInOut(3);
- d.quartIn = d.getPowIn(4);
- d.quartOut = d.getPowOut(4);
- d.quartInOut = d.getPowInOut(4);
- d.quintIn = d.getPowIn(5);
- d.quintOut = d.getPowOut(5);
- d.quintInOut = d.getPowInOut(5);
- d.backIn = d.getBackIn(1.7);
- d.backOut = d.getBackOut(1.7);
- d.backInOut = d.getBackInOut(1.7);
- d.elasticIn = d.getElasticIn(1, 0.3);
- d.elasticOut = d.getElasticOut(1, 0.3);
- d.elasticInOut = d.getElasticInOut(1, 0.3 * 1.5);
- return d
- } ();
- b.Ease = c;
- c.prototype.__class__ = "egret.Ease"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {
- this.type = b.EFFECT
- }
- b.prototype.play = function(a) {
- "undefined" === typeof a && (a = !1);
- var b = this.audio;
- b && (isNaN(b.duration) || (b.currentTime = 0), b.loop = a, b.play())
- };
- b.prototype.pause = function() {
- var a = this.audio;
- a && a.pause()
- };
- b.prototype.load = function() {
- var a = this.audio;
- a && a.load()
- };
- b.prototype.addEventListener = function(a, b) {
- this.audio && this.audio.addEventListener(a, b, !1)
- };
- b.prototype.removeEventListener = function(a, b) {
- this.audio && this.audio.removeEventListener(a, b, !1)
- };
- b.prototype.setVolume = function(a) {
- var b = this.audio;
- b && (b.volume = a)
- };
- b.prototype.getVolume = function() {
- return this.audio ? this.audio.volume: 0
- };
- b.prototype.preload = function(a) {
- this.type = a
- };
- b.prototype._setAudio = function(a) {
- this.audio = a
- };
- b.MUSIC = "music";
- b.EFFECT = "effect";
- return b
- } ();
- b.Sound = c;
- c.prototype.__class__ = "egret.Sound"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.isNumber = function(a) {
- return "number" === typeof a && !isNaN(a)
- };
- return b
- } ();
- b.NumberUtils = c;
- c.prototype.__class__ = "egret.NumberUtils"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- RES; (function(b) {
- var c = function(b) {
- function a(a, c, f) {
- "undefined" === typeof c && (c = !1);
- "undefined" === typeof f && (f = !1);
- b.call(this, a, c, f);
- this.itemsTotal = this.itemsLoaded = 0
- }
- __extends(a, b);
- a.dispatchResourceEvent = function(b, d, c, m, l, h) {
- "undefined" === typeof c && (c = "");
- "undefined" === typeof m && (m = null);
- "undefined" === typeof l && (l = 0);
- "undefined" === typeof h && (h = 0);
- var k = egret.Event._getPropertyData(a);
- k.groupName = c;
- k.resItem = m;
- k.itemsLoaded = l;
- k.itemsTotal = h;
- egret.Event._dispatchByTarget(a, b, d, k)
- };
- a.ITEM_LOAD_ERROR = "itemLoadError";
- a.CONFIG_COMPLETE = "configComplete";
- a.GROUP_PROGRESS = "groupProgress";
- a.GROUP_COMPLETE = "groupComplete";
- return a
- } (egret.Event);
- b.ResourceEvent = c;
- c.prototype.__class__ = "RES.ResourceEvent"
- })(RES || (RES = {})); (function(b) {
- var c = function() {
- function b(a, e, c) {
- this._loaded = !1;
- this.name = a;
- this.url = e;
- this.type = c
- }
- Object.defineProperty(b.prototype, "loaded", {
- get: function() {
- return this.data ? this.data.loaded: this._loaded
- },
- set: function(a) {
- this.data && (this.data.loaded = a);
- this._loaded = a
- },
- enumerable: !0,
- configurable: !0
- });
- b.prototype.toString = function() {
- return '[ResourceItem name="' + this.name + '" url="' + this.url + '" type="' + this.type + '"]'
- };
- b.TYPE_XML = "xml";
- b.TYPE_IMAGE = "image";
- b.TYPE_BIN = "bin";
- b.TYPE_TEXT = "text";
- b.TYPE_JSON = "json";
- b.TYPE_SHEET = "sheet";
- b.TYPE_FONT = "font";
- b.TYPE_SOUND = "sound";
- return b
- } ();
- b.ResourceItem = c;
- c.prototype.__class__ = "RES.ResourceItem"
- })(RES || (RES = {})); (function(b) {
- var c = function() {
- function c() {
- this.keyMap = {};
- this.groupDic = {}
- }
- c.prototype.getGroupByName = function(a) {
- var b = [];
- if (!this.groupDic[a]) return b;
- a = this.groupDic[a];
- for (var c = a.length,
- d = 0; d < c; d++) b.push(this.parseResourceItem(a[d]));
- return b
- };
- c.prototype.getRawGroupByName = function(a) {
- return this.groupDic[a] ? this.groupDic[a] : []
- };
- c.prototype.createGroup = function(a, b, c) {
- "undefined" === typeof c && (c = !1);
- if (!c && this.groupDic[a] || !b || 0 == b.length) return ! 1;
- c = this.groupDic;
- for (var d = [], m = b.length, l = 0; l < m; l++) {
- var h = b[l],
- k = c[h];
- if (k) for (var h = k.length,
- p = 0; p < h; p++) {
- var n = k[p]; - 1 == d.indexOf(n) && d.push(n)
- } else(n = this.keyMap[h]) && -1 == d.indexOf(n) && d.push(n)
- }
- if (0 == d.length) return ! 1;
- this.groupDic[a] = d;
- return ! 0
- };
- c.prototype.parseConfig = function(a, b) {
- if (a) {
- var c = a.resources;
- if (c) for (var d = c.length,
- m = 0; m < d; m++) {
- var l = c[m],
- h = l.url;
- h && -1 == h.indexOf("://") && (l.url = b + h);
- this.addItemToKeyMap(l)
- }
- if (c = a.groups) for (d = c.length, m = 0; m < d; m++) {
- for (var h = c[m], k = [], p = h.keys.split(","), n = p.length, q = 0; q < n; q++) l = p[q].trim(),
- (l = this.keyMap[l]) && -1 == k.indexOf(l) && k.push(l);
- this.groupDic[h.name] = k
- }
- }
- };
- c.prototype.addItemToKeyMap = function(a) {
- this.keyMap[a.name] || (this.keyMap[a.name] = a);
- if (a.hasOwnProperty("subkeys")) {
- var b = a.subkeys.split(",");
- a.subkeys = b;
- for (var c = b.length,
- d = 0; d < c; d++) {
- var m = b[d];
- null == this.keyMap[m] && (this.keyMap[m] = a)
- }
- }
- };
- c.prototype.getName = function(a) {
- return (a = this.keyMap[a]) ? a.name: ""
- };
- c.prototype.getType = function(a) {
- return (a = this.keyMap[a]) ? a.type: ""
- };
- c.prototype.getRawResourceItem = function(a) {
- return this.keyMap[a]
- };
- c.prototype.getResourceItem = function(a) {
- return (a = this.keyMap[a]) ? this.parseResourceItem(a) : null
- };
- c.prototype.parseResourceItem = function(a) {
- var e = new b.ResourceItem(a.name, a.url, a.type);
- e.data = a;
- return e
- };
- return c
- } ();
- b.ResourceConfig = c;
- c.prototype.__class__ = "RES.ResourceConfig"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this);
- this.thread = 2;
- this.loadingCount = 0;
- this.groupTotalDic = {};
- this.numLoadedDic = {};
- this.itemListDic = {};
- this.priorityQueue = {};
- this.lazyLoadList = [];
- this.analyzerDic = {};
- this.queueIndex = 0
- }
- __extends(a, c);
- a.prototype.isGroupInLoading = function(a) {
- return void 0 !== this.itemListDic[a]
- };
- a.prototype.loadGroup = function(a, c, d) {
- "undefined" === typeof d && (d = 0);
- if (!this.itemListDic[c] && c) if (a && 0 != a.length) {
- this.priorityQueue[d] ? this.priorityQueue[d].push(c) : this.priorityQueue[d] = [c];
- this.itemListDic[c] = a;
- d = a.length;
- for (var m = 0; m < d; m++) a[m].groupName = c;
- this.groupTotalDic[c] = a.length;
- this.numLoadedDic[c] = 0;
- this.next()
- } else a = new b.ResourceEvent(b.ResourceEvent.GROUP_COMPLETE),
- a.groupName = c,
- this.dispatchEvent(a)
- };
- a.prototype.loadItem = function(a) {
- this.lazyLoadList.push(a);
- a.groupName = "";
- this.next()
- };
- a.prototype.next = function() {
- for (; this.loadingCount < this.thread;) {
- var a = this.getOneResourceItem();
- if (!a) break;
- this.loadingCount++;
- if (a.loaded) this.onItemComplete(a);
- else {
- var c = this.analyzerDic[a.type];
- c || (c = this.analyzerDic[a.type] = egret.Injector.getInstance(b.AnalyzerBase, a.type));
- c.loadFile(a, this.onItemComplete, this)
- }
- }
- };
- a.prototype.getOneResourceItem = function() {
- var a = Number.NEGATIVE_INFINITY,
- b;
- for (b in this.priorityQueue) a = Math.max(a, b);
- a = this.priorityQueue[a];
- if (!a || 0 == a.length) return 0 == this.lazyLoadList.length ? null: this.lazyLoadList.pop();
- b = a.length;
- for (var c, d = 0; d < b; d++) {
- this.queueIndex >= b && (this.queueIndex = 0);
- c = this.itemListDic[a[this.queueIndex]];
- if (0 < c.length) break;
- this.queueIndex++
- }
- return 0 == c.length ? null: c.shift()
- };
- a.prototype.onItemComplete = function(a) {
- this.loadingCount--;
- var c = a.groupName;
- a.loaded || b.ResourceEvent.dispatchResourceEvent(this.resInstance, b.ResourceEvent.ITEM_LOAD_ERROR, c, a);
- if (c) {
- this.numLoadedDic[c]++;
- var d = this.numLoadedDic[c],
- m = this.groupTotalDic[c];
- b.ResourceEvent.dispatchResourceEvent(this.resInstance, b.ResourceEvent.GROUP_PROGRESS, c, a, d, m);
- d == m && (this.removeGroupName(c), delete this.groupTotalDic[c], delete this.numLoadedDic[c], delete this.itemListDic[c], b.ResourceEvent.dispatchResourceEvent(this, b.ResourceEvent.GROUP_COMPLETE, c))
- } else this.callBack.call(this.resInstance, a);
- this.next()
- };
- a.prototype.removeGroupName = function(a) {
- for (var b in this.priorityQueue) {
- for (var c = this.priorityQueue[b], d = c.length, l = 0, h = !1, d = c.length, k = 0; k < d; k++) {
- if (c[k] == a) {
- c.splice(l, 1);
- h = !0;
- break
- }
- l++
- }
- if (h) {
- 0 == c.length && delete this.priorityQueue[b];
- break
- }
- }
- };
- return a
- } (egret.EventDispatcher);
- b.ResourceLoader = c;
- c.prototype.__class__ = "RES.ResourceLoader"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.loadFile = function(a, b, c) {};
- a.prototype.getRes = function(a) {};
- a.prototype.destroyRes = function(a) {
- return ! 1
- };
- a.getStringPrefix = function(a) {
- if (!a) return "";
- var b = a.indexOf(".");
- return - 1 != b ? a.substring(0, b) : ""
- };
- a.getStringTail = function(a) {
- if (!a) return "";
- var b = a.indexOf(".");
- return - 1 != b ? a.substring(b + 1) : ""
- };
- return a
- } (egret.HashObject);
- b.AnalyzerBase = c;
- c.prototype.__class__ = "RES.AnalyzerBase"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this.fileDic = {};
- this.resItemDic = [];
- this._dataFormat = egret.URLLoaderDataFormat.BINARY;
- this.recycler = new egret.Recycler
- }
- __extends(a, b);
- a.prototype.loadFile = function(a, b, c) {
- if (this.fileDic[a.name]) b.call(c, a);
- else {
- var d = this.getLoader();
- this.resItemDic[d.hashCode] = {
- item: a,
- func: b,
- thisObject: c
- };
- d.load(new egret.URLRequest(a.url))
- }
- };
- a.prototype.getLoader = function() {
- var a = this.recycler.pop();
- a || (a = new egret.URLLoader, a.addEventListener(egret.Event.COMPLETE, this.onLoadFinish, this), a.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onLoadFinish, this));
- a.dataFormat = this._dataFormat;
- return a
- };
- a.prototype.onLoadFinish = function(a) {
- var b = a.target,
- c = this.resItemDic[b.hashCode];
- delete this.resItemDic[b.hashCode];
- this.recycler.push(b);
- var d = c.item,
- l = c.func;
- d.loaded = a.type == egret.Event.COMPLETE;
- d.loaded && this.analyzeData(d, b.data);
- l.call(c.thisObject, d)
- };
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! this.fileDic[c] && b && (this.fileDic[c] = b)
- };
- a.prototype.getRes = function(a) {
- return this.fileDic[a]
- };
- a.prototype.hasRes = function(a) {
- return null != this.getRes(a)
- };
- a.prototype.destroyRes = function(a) {
- return this.fileDic[a] ? (delete this.fileDic[a], !0) : !1
- };
- return a
- } (b.AnalyzerBase);
- b.BinAnalyzer = c;
- c.prototype.__class__ = "RES.BinAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXTURE
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! 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]))))
- };
- return a
- } (b.BinAnalyzer);
- b.ImageAnalyzer = c;
- c.prototype.__class__ = "RES.ImageAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) try {
- this.fileDic[c] = JSON.parse(b)
- } catch(d) {
- egret.Logger.warning("JSON\u6587\u4ef6\u683c\u5f0f\u4e0d\u6b63\u786e: " + a.url + NaN + b)
- }
- };
- return a
- } (b.BinAnalyzer);
- b.JsonAnalyzer = c;
- c.prototype.__class__ = "RES.JsonAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- return a
- } (b.BinAnalyzer);
- b.TextAnalyzer = c;
- c.prototype.__class__ = "RES.TextAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this);
- this.sheetMap = {};
- this.textureMap = {};
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, c);
- a.prototype.getRes = function(a) {
- var c = this.fileDic[a];
- c || (c = this.textureMap[a]); ! c && (c = b.AnalyzerBase.getStringPrefix(a), c = this.fileDic[c]) && (a = b.AnalyzerBase.getStringTail(a), c = c.getTexture(a));
- return c
- };
- a.prototype.onLoadFinish = function(a) {
- var b = a.target,
- c = this.resItemDic[b.hashCode];
- delete this.resItemDic[b.hashCode];
- this.recycler.push(b);
- var d = c.item,
- l = c.func;
- d.loaded = a.type == egret.Event.COMPLETE;
- d.loaded && this.analyzeData(d, b.data);
- "string" == typeof b.data ? (this._dataFormat = egret.URLLoaderDataFormat.TEXTURE, this.loadFile(d, l, c.thisObject), this._dataFormat = egret.URLLoaderDataFormat.TEXT) : l.call(c.thisObject, d)
- };
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) {
- var d;
- if ("string" == typeof b) {
- try {
- d = JSON.parse(b)
- } catch(l) {
- egret.Logger.warning("JSON\u6587\u4ef6\u683c\u5f0f\u4e0d\u6b63\u786e: " + a.url)
- }
- d && (this.sheetMap[c] = d, a.loaded = !1, a.url = this.getRelativePath(a.url, d.file))
- } else d = this.sheetMap[c],
- delete this.sheetMap[c],
- b && (d = this.parseSpriteSheet(b, d), this.fileDic[c] = d)
- }
- };
- a.prototype.getRelativePath = function(a, b) {
- a = a.split("\\").join("/");
- var c = a.lastIndexOf("/");
- return a = -1 != c ? a.substring(0, c + 1) + b: b
- };
- a.prototype.parseSpriteSheet = function(a, b) {
- var c = b.frames;
- if (!c) return null;
- var d = new egret.SpriteSheet(a),
- l = this.textureMap,
- h;
- for (h in c) {
- var k = c[h];
- a = d.createTexture(h, k.x, k.y, k.w, k.h, k.offX, k.offY, k.sourceW, k.sourceH);
- k.scale9grid && (k = k.scale9grid.split(","), a.scale9Grid = new egret.Rectangle(parseInt(k[0]), parseInt(k[1]), parseInt(k[2]), parseInt(k[3])));
- null == l[h] && (l[h] = a)
- }
- return d
- };
- return a
- } (b.BinAnalyzer);
- b.SheetAnalyzer = c;
- c.prototype.__class__ = "RES.SheetAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this)
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) {
- var d;
- "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))
- }
- };
- a.prototype.getTexturePath = function(a, b) {
- var c = "",
- d = b.split("\n")[2],
- l = d.indexOf('file="'); - 1 != l && (d = d.substring(l + 6), l = d.indexOf('"'), c = d.substring(0, l));
- a = a.split("\\").join("/");
- l = a.lastIndexOf("/");
- return a = -1 != l ? a.substring(0, l + 1) + c: c
- };
- return a
- } (b.SheetAnalyzer);
- b.FontAnalyzer = c;
- c.prototype.__class__ = "RES.FontAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.SOUND
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name; ! this.fileDic[c] && b && (this.fileDic[c] = b, (c = a.data) && c.soundType && b.preload(c.soundType))
- };
- return a
- } (b.BinAnalyzer);
- b.SoundAnalyzer = c;
- c.prototype.__class__ = "RES.SoundAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(b) {
- function a() {
- b.call(this);
- this._dataFormat = egret.URLLoaderDataFormat.TEXT
- }
- __extends(a, b);
- a.prototype.analyzeData = function(a, b) {
- var c = a.name;
- if (!this.fileDic[c] && b) try {
- var d = egret.XML.parse(b);
- this.fileDic[c] = d
- } catch(l) {}
- };
- return a
- } (b.BinAnalyzer);
- b.XMLAnalyzer = c;
- c.prototype.__class__ = "RES.XMLAnalyzer"
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- b.loadConfig = function(a, b, c) {
- "undefined" === typeof b && (b = "");
- "undefined" === typeof c && (c = "json");
- d.loadConfig(a, b, c)
- };
- b.loadGroup = function(a, b) {
- "undefined" === typeof b && (b = 0);
- d.loadGroup(a, b)
- };
- b.isGroupLoaded = function(a) {
- return d.isGroupLoaded(a)
- };
- b.getGroupByName = function(a) {
- return d.getGroupByName(a)
- };
- b.createGroup = function(a, b, c) {
- "undefined" === typeof c && (c = !1);
- return d.createGroup(a, b, c)
- };
- b.hasRes = function(a) {
- return d.hasRes(a)
- };
- b.getRes = function(a) {
- return d.getRes(a)
- };
- b.getResAsync = function(a, b, c) {
- d.getResAsync(a, b, c)
- };
- b.getResByUrl = function(a, b, c, f) {
- "undefined" === typeof f && (f = "");
- d.getResByUrl(a, b, c, f)
- };
- b.destroyRes = function(a) {
- return d.destroyRes(a)
- };
- b.setMaxLoadingThread = function(a) {
- d.setMaxLoadingThread(a)
- };
- b.addEventListener = function(a, b, c, f, m) {
- "undefined" === typeof f && (f = !1);
- "undefined" === typeof m && (m = 0);
- d.addEventListener(a, b, c, f, m)
- };
- b.removeEventListener = function(a, b, c, f) {
- "undefined" === typeof f && (f = !1);
- d.removeEventListener(a, b, c, f)
- };
- var c = function(a) {
- function e() {
- a.call(this);
- this.analyzerDic = {};
- this.configItemList = [];
- this.configComplete = this.callLaterFlag = !1;
- this.loadedGroups = [];
- this.groupNameList = [];
- this.asyncDic = {};
- this.init()
- }
- __extends(e, a);
- e.prototype.getAnalyzerByType = function(a) {
- var e = this.analyzerDic[a];
- e || (e = this.analyzerDic[a] = egret.Injector.getInstance(b.AnalyzerBase, a));
- return e
- };
- e.prototype.init = function() {
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_BIN) || egret.Injector.mapClass(b.AnalyzerBase, b.BinAnalyzer, b.ResourceItem.TYPE_BIN);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_IMAGE) || egret.Injector.mapClass(b.AnalyzerBase, b.ImageAnalyzer, b.ResourceItem.TYPE_IMAGE);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_TEXT) || egret.Injector.mapClass(b.AnalyzerBase, b.TextAnalyzer, b.ResourceItem.TYPE_TEXT);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_JSON) || egret.Injector.mapClass(b.AnalyzerBase, b.JsonAnalyzer, b.ResourceItem.TYPE_JSON);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_SHEET) || egret.Injector.mapClass(b.AnalyzerBase, b.SheetAnalyzer, b.ResourceItem.TYPE_SHEET);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_FONT) || egret.Injector.mapClass(b.AnalyzerBase, b.FontAnalyzer, b.ResourceItem.TYPE_FONT);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_SOUND) || egret.Injector.mapClass(b.AnalyzerBase, b.SoundAnalyzer, b.ResourceItem.TYPE_SOUND);
- egret.Injector.hasMapRule(b.AnalyzerBase, b.ResourceItem.TYPE_XML) || egret.Injector.mapClass(b.AnalyzerBase, b.XMLAnalyzer, b.ResourceItem.TYPE_XML);
- this.resConfig = new b.ResourceConfig;
- this.resLoader = new b.ResourceLoader;
- this.resLoader.callBack = this.onResourceItemComp;
- this.resLoader.resInstance = this;
- this.resLoader.addEventListener(b.ResourceEvent.GROUP_COMPLETE, this.onGroupComp, this)
- };
- e.prototype.loadConfig = function(a, b, e) {
- "undefined" === typeof e && (e = "json");
- this.configItemList.push({
- url: a,
- resourceRoot: b,
- type: e
- });
- this.callLaterFlag || (egret.callLater(this.startLoadConfig, this), this.callLaterFlag = !0)
- };
- e.prototype.startLoadConfig = function() {
- this.callLaterFlag = !1;
- var a = this.configItemList;
- this.configItemList = [];
- this.loadingConfigList = a;
- for (var c = a.length,
- d = [], l = 0; l < c; l++) {
- var h = a[l],
- h = new b.ResourceItem(h.url, h.url, h.type);
- d.push(h)
- }
- this.resLoader.loadGroup(d, e.GROUP_CONFIG, Number.MAX_VALUE)
- };
- e.prototype.isGroupLoaded = function(a) {
- return - 1 != this.loadedGroups.indexOf(a)
- };
- e.prototype.getGroupByName = function(a) {
- return this.resConfig.getGroupByName(a)
- };
- e.prototype.loadGroup = function(a, b) {
- "undefined" === typeof b && (b = 0);
- if ( - 1 == this.loadedGroups.indexOf(a) && !this.resLoader.isGroupInLoading(a)) if (this.configComplete) {
- var e = this.resConfig.getGroupByName(a);
- this.resLoader.loadGroup(e, a, b)
- } else this.groupNameList.push({
- name: a,
- priority: b
- })
- };
- e.prototype.createGroup = function(a, b, e) {
- "undefined" === typeof e && (e = !1);
- if (e) {
- var c = this.loadedGroups.indexOf(a); - 1 != c && this.loadedGroups.splice(c, 1)
- }
- return this.resConfig.createGroup(a, b, e)
- };
- e.prototype.onGroupComp = function(a) {
- if (a.groupName == e.GROUP_CONFIG) {
- a = this.loadingConfigList.length;
- for (var c = 0; c < a; c++) {
- var d = this.loadingConfigList[c],
- l = this.getAnalyzerByType(d.type),
- h = l.getRes(d.url);
- l.destroyRes(d.url);
- this.resConfig.parseConfig(h, d.resourceRoot)
- }
- this.configComplete = !0;
- this.loadingConfigList = null;
- b.ResourceEvent.dispatchResourceEvent(this, b.ResourceEvent.CONFIG_COMPLETE);
- d = this.groupNameList;
- a = d.length;
- for (c = 0; c < a; c++) l = d[c],
- this.loadGroup(l.name, l.priority);
- this.groupNameList = []
- } else this.loadedGroups.push(a.groupName),
- this.dispatchEvent(a)
- };
- e.prototype.hasRes = function(a) {
- var e = this.resConfig.getType(a);
- return "" == e && (a = b.AnalyzerBase.getStringPrefix(a), e = this.resConfig.getType(a), "" == e) ? !1 : !0
- };
- e.prototype.getRes = function(a) {
- var e = this.resConfig.getType(a);
- return "" == e && (e = b.AnalyzerBase.getStringPrefix(a), e = this.resConfig.getType(e), "" == e) ? null: this.getAnalyzerByType(e).getRes(a)
- };
- e.prototype.getResAsync = function(a, e, c) {
- var d = this.resConfig.getType(a),
- h = this.resConfig.getName(a);
- if ("" == d && (h = b.AnalyzerBase.getStringPrefix(a), d = this.resConfig.getType(h), "" == d)) {
- e.call(c, null);
- return
- } (d = this.getAnalyzerByType(d).getRes(a)) ? e.call(c, d) : (a = {
- key: a,
- compFunc: e,
- thisObject: c
- },
- this.asyncDic[h] ? this.asyncDic[h].push(a) : (this.asyncDic[h] = [a], h = this.resConfig.getResourceItem(h), this.resLoader.loadItem(h)))
- };
- e.prototype.getResByUrl = function(a, e, c, d) {
- "undefined" === typeof d && (d = "");
- if (a) {
- d || (d = this.getTypeByUrl(a));
- var h = this.getAnalyzerByType(d).getRes(a);
- h ? e.call(c, h) : (e = {
- key: a,
- compFunc: e,
- thisObject: c
- },
- this.asyncDic[a] ? this.asyncDic[a].push(e) : (this.asyncDic[a] = [e], a = new b.ResourceItem(a, a, d), this.resLoader.loadItem(a)))
- } else e.call(c, null)
- };
- e.prototype.getTypeByUrl = function(a) { (a = a.substr(a.lastIndexOf(".") + 1)) && (a = a.toLowerCase());
- switch (a) {
- case b.ResourceItem.TYPE_XML:
- case b.ResourceItem.TYPE_JSON:
- case b.ResourceItem.TYPE_SHEET:
- break;
- case "png":
- case "jpg":
- case "gif":
- a = b.ResourceItem.TYPE_IMAGE;
- break;
- case "fnt":
- a = b.ResourceItem.TYPE_FONT;
- break;
- case "txt":
- a = b.ResourceItem.TYPE_TEXT;
- break;
- case "mp3":
- case "ogg":
- case "mpeg":
- case "wav":
- case "m4a":
- case "mp4":
- case "aiff":
- case "wma":
- case "mid":
- a = b.ResourceItem.TYPE_SOUND;
- break;
- default:
- a = b.ResourceItem.TYPE_BIN
- }
- return a
- };
- e.prototype.onResourceItemComp = function(a) {
- var b = this.asyncDic[a.name];
- delete this.asyncDic[a.name];
- a = this.getAnalyzerByType(a.type);
- for (var e = b.length,
- c = 0; c < e; c++) {
- var d = b[c],
- k = a.getRes(d.key);
- d.compFunc.call(d.thisObject, k, d.key)
- }
- };
- e.prototype.destroyRes = function(a) {
- var b = this.resConfig.getRawGroupByName(a);
- if (b) {
- var e = this.loadedGroups.indexOf(a); - 1 != e && this.loadedGroups.splice(e, 1);
- a = b.length;
- for (var c = 0; c < a; c++) {
- e = b[c];
- e.loaded = !1;
- var d = this.getAnalyzerByType(e.type);
- d.destroyRes(e.name)
- }
- return ! 0
- }
- b = this.resConfig.getType(a);
- if ("" == b) return ! 1;
- e = this.resConfig.getRawResourceItem(a);
- e.loaded = !1;
- d = this.getAnalyzerByType(b);
- return d.destroyRes(a)
- };
- e.prototype.setMaxLoadingThread = function(a) {
- 1 > a && (a = 1);
- this.resLoader.thread = a
- };
- e.GROUP_CONFIG = "RES__CONFIG";
- return e
- } (egret.EventDispatcher);
- c.prototype.__class__ = "Resource";
- var d = new c
- })(RES || (RES = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(b) {
- "undefined" === typeof b && (b = 60);
- c.call(this);
- this.frameRate = b;
- this._time = 0;
- 60 == b && (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 || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame);
- a.requestAnimationFrame || (a.requestAnimationFrame = function(a) {
- return window.setTimeout(a, 1E3 / b)
- });
- a.cancelAnimationFrame || (a.cancelAnimationFrame = function(a) {
- return window.clearTimeout(a)
- });
- a.instance = this;
- this.registerListener()
- }
- __extends(a, c);
- a.prototype.enterFrame = function() {
- var e = a.instance,
- c = a._thisObject,
- d = a._callback,
- m = b.getTimer(),
- l = m - e._time;
- e._requestAnimationId = a.requestAnimationFrame.call(window, a.prototype.enterFrame);
- d.call(c, l);
- e._time = m
- };
- a.prototype.executeMainLoop = function(b, c) {
- a._callback = b;
- a._thisObject = c;
- this.enterFrame()
- };
- a.prototype.reset = function() {
- var e = a.instance;
- e._requestAnimationId && (e._time = b.getTimer(), a.cancelAnimationFrame.call(window, e._requestAnimationId), e.enterFrame())
- };
- a.prototype.registerListener = function() {
- var b = function() {
- a.instance.reset()
- },
- c = function() {
- document[d] || b()
- };
- window.onfocus = b;
- window.onblur = function() {};
- var d, m;
- "undefined" !== typeof document.hidden ? (d = "hidden", m = "visibilitychange") : "undefined" !== typeof document.mozHidden ? (d = "mozHidden", m = "mozvisibilitychange") : "undefined" !== typeof document.msHidden ? (d = "msHidden", m = "msvisibilitychange") : "undefined" !== typeof document.webkitHidden && (d = "webkitHidden", m = "webkitvisibilitychange");
- "onpageshow" in window && "onpagehide" in window && window.addEventListener("pageshow", b, !1);
- d && m && document.addEventListener(m, c, !1)
- };
- return a
- } (b.DeviceContext);
- b.HTML5DeviceContext = c;
- c.prototype.__class__ = "egret.HTML5DeviceContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- this.canvas = a;
- this.canvasContext = a.getContext("2d");
- var b = this.canvasContext.setTransform,
- f = this;
- this.canvasContext.setTransform = function(a, c, e, d, p, n) {
- f._matrixA = a;
- f._matrixB = c;
- f._matrixC = e;
- f._matrixD = d;
- f._matrixTx = p;
- f._matrixTy = n;
- b.call(f.canvasContext, a, c, e, d, p, n)
- };
- this._matrixA = 1;
- this._matrixC = this._matrixB = 0;
- this._matrixD = 1;
- this._transformTy = this._transformTx = this._matrixTy = this._matrixTx = 0;
- c.call(this)
- }
- __extends(a, c);
- a.prototype.clearScreen = function() {
- for (var a = b.RenderFilter.getInstance().getDrawAreaList(), c = 0, d = a.length; c < d; c++) {
- var m = a[c];
- this.clearRect(m.x + this._transformTx, m.y + this._transformTy, m.width, m.height)
- }
- this.renderCost = 0
- };
- a.prototype.clearRect = function(a, b, c, d) {
- this.canvasContext.clearRect(a, b, c, d)
- };
- a.prototype.drawImage = function(a, g, f, m, l, h, k, p, n) {
- g /= b.MainContext.instance.rendererContext.texture_scale_factor;
- f /= b.MainContext.instance.rendererContext.texture_scale_factor;
- m /= b.MainContext.instance.rendererContext.texture_scale_factor;
- l /= b.MainContext.instance.rendererContext.texture_scale_factor;
- a = a._bitmapData;
- h += this._transformTx;
- k += this._transformTy;
- var q = b.getTimer();
- this.canvasContext.drawImage(a, g, f, m, l, h, k, p, n);
- c.prototype.drawImage.call(this, a, g, f, m, l, h, k, p, n);
- this.renderCost += b.getTimer() - q
- };
- a.prototype.setTransform = function(a) {
- 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.canvasContext.setTransform(a.a, a.b, a.c, a.d, a.tx, a.ty))
- };
- a.prototype.setAlpha = function(a, c) {
- a != this.canvasContext.globalAlpha && (this.canvasContext.globalAlpha = a);
- c ? (this.blendValue = c, this.canvasContext.globalCompositeOperation = c) : this.blendValue != b.BlendMode.NORMAL && (this.blendValue = b.BlendMode.NORMAL, this.canvasContext.globalCompositeOperation = b.BlendMode.NORMAL)
- };
- a.prototype.setupFont = function(a) {
- var b = this.canvasContext,
- c = a.italic ? "italic ": "normal ",
- c = c + (a.bold ? "bold ": "normal "),
- c = c + (a.size + "px " + a.fontFamily);
- b.font = c;
- b.textAlign = "left";
- b.textBaseline = "middle"
- };
- a.prototype.measureText = function(a) {
- return this.canvasContext.measureText(a).width
- };
- a.prototype.drawText = function(a, b, f, m, l) {
- var h = a._strokeColorString,
- k = a.stroke,
- p = this.canvasContext;
- p.fillStyle = a._textColorString;
- p.strokeStyle = h;
- k && (p.lineWidth = 2 * k, p.strokeText(b, f + this._transformTx, m + this._transformTy, l || 65535));
- p.fillText(b, f + this._transformTx, m + this._transformTy, l || 65535);
- c.prototype.drawText.call(this, a, b, f, m, l)
- };
- a.prototype.strokeRect = function(a, b, c, d, l) {
- this.canvasContext.strokeStyle = l;
- this.canvasContext.strokeRect(a, b, c, d)
- };
- a.prototype.pushMask = function(a) {
- this.canvasContext.save();
- this.canvasContext.beginPath();
- this.canvasContext.rect(a.x + this._transformTx, a.y + this._transformTy, a.width, a.height);
- this.canvasContext.clip();
- this.canvasContext.closePath()
- };
- a.prototype.popMask = function() {
- this.canvasContext.restore();
- this.canvasContext.setTransform(1, 0, 0, 1, 0, 0)
- };
- a.prototype.onRenderStart = function() {
- this.canvasContext.save()
- };
- a.prototype.onRenderFinish = function() {
- this.canvasContext.restore();
- this.canvasContext.setTransform(1, 0, 0, 1, 0, 0)
- };
- return a
- } (b.RendererContext);
- b.HTML5CanvasRenderer = c;
- c.prototype.__class__ = "egret.HTML5CanvasRenderer"
- })(egret || (egret = {}));
- var egret_h5_graphics; (function(b) {
- b.beginFill = function(b, a) {
- "undefined" === typeof a && (a = 1);
- var e = "rgba(" + (b >> 16) + "," + ((b & 65280) >> 8) + "," + (b & 255) + "," + a + ")";
- this.fillStyleColor = e;
- this.commandQueue.push(new c(this._setStyle, this, [e]))
- };
- b.drawRect = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.beginPath();
- this.canvasContext.rect(d._transformTx + a, d._transformTy + b, c, e);
- this.canvasContext.closePath()
- },
- this, [b, a, e, g]));
- this._fill()
- };
- b.drawCircle = function(b, a, e) {
- this.commandQueue.push(new c(function(a, b, c) {
- var e = this.renderContext;
- this.canvasContext.beginPath();
- this.canvasContext.arc(e._transformTx + a, e._transformTy + b, c, 0, 2 * Math.PI);
- this.canvasContext.closePath()
- },
- this, [b, a, e]));
- this._fill()
- };
- b.drawRoundRect = function(b, a, e, g, f, m) {
- this.commandQueue.push(new c(function(a, b, c, e, d, g) {
- var f = this.renderContext;
- a = f._transformTx + a;
- b = f._transformTy + b;
- d /= 2;
- g = g ? g / 2 : d;
- c = a + c;
- e = b + e;
- f = e - g;
- this.canvasContext.beginPath();
- this.canvasContext.moveTo(c, f);
- this.canvasContext.quadraticCurveTo(c, e, c - d, e);
- this.canvasContext.lineTo(a + d, e);
- this.canvasContext.quadraticCurveTo(a, e, a, e - g);
- this.canvasContext.lineTo(a, b + g);
- this.canvasContext.quadraticCurveTo(a, b, a + d, b);
- this.canvasContext.lineTo(c - d, b);
- this.canvasContext.quadraticCurveTo(c, b, c, b + g);
- this.canvasContext.lineTo(c, f);
- this.canvasContext.closePath()
- },
- this, [b, a, e, g, f, m]));
- this._fill()
- };
- b.drawEllipse = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.save();
- a = d._transformTx + a;
- b = d._transformTy + b;
- var d = c > e ? c: e,
- g = c / d;
- e /= d;
- this.canvasContext.scale(g, e);
- this.canvasContext.beginPath();
- this.canvasContext.moveTo((a + c) / g, b / e);
- this.canvasContext.arc(a / g, b / e, d, 0, 2 * Math.PI);
- this.canvasContext.closePath();
- this.canvasContext.restore();
- this.canvasContext.stroke()
- },
- this, [b, a, e, g]));
- this._fill()
- };
- b.lineStyle = function(b, a, e, g, f, m, l, h) {
- "undefined" === typeof b && (b = NaN);
- "undefined" === typeof a && (a = 0);
- "undefined" === typeof e && (e = 1);
- "undefined" === typeof g && (g = !1);
- "undefined" === typeof f && (f = "normal");
- "undefined" === typeof m && (m = null);
- "undefined" === typeof l && (l = null);
- "undefined" === typeof h && (h = 3);
- this.strokeStyleColor && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand));
- this.strokeStyleColor = a = "rgba(" + (a >> 16) + "," + ((a & 65280) >> 8) + "," + (a & 255) + "," + e + ")";
- this.commandQueue.push(new c(function(a, b) {
- this.canvasContext.lineWidth = a;
- this.canvasContext.strokeStyle = b;
- this.canvasContext.beginPath()
- },
- this, [b, a]));
- "undefined" === typeof this.lineX && (this.lineY = this.lineX = 0);
- this.moveTo(this.lineX, this.lineY)
- };
- b.lineTo = function(b, a) {
- this.commandQueue.push(new c(function(a, b) {
- var c = this.renderContext;
- this.canvasContext.lineTo(c._transformTx + a, c._transformTy + b)
- },
- this, [b, a]));
- this.lineX = b;
- this.lineY = a
- };
- b.curveTo = function(b, a, e, g) {
- this.commandQueue.push(new c(function(a, b, c, e) {
- var d = this.renderContext;
- this.canvasContext.quadraticCurveTo(d._transformTx + a, d._transformTy + b, c, e)
- },
- this, [b, a, e, g]));
- this.lineX = e;
- this.lineY = g
- };
- b.moveTo = function(b, a) {
- this.commandQueue.push(new c(function(a, b) {
- var c = this.renderContext;
- this.canvasContext.moveTo(c._transformTx + a, c._transformTy + b)
- },
- this, [b, a]))
- };
- b.clear = function() {
- this.lineY = this.lineX = this.commandQueue.length = 0;
- this.fillStyleColor = this.strokeStyleColor = null
- };
- b.createEndFillCommand = function() {
- this.endFillCommand || (this.endFillCommand = new c(function() {
- this.canvasContext.fill();
- this.canvasContext.closePath()
- },
- this, null))
- };
- b.endFill = function() {
- null != this.fillStyleColor && this._fill();
- this.fillStyleColor = null
- };
- b._fill = function() {
- this.fillStyleColor && (this.createEndFillCommand(), this.commandQueue.push(this.endFillCommand))
- };
- b.createEndLineCommand = function() {
- this.endLineCommand || (this.endLineCommand = new c(function() {
- this.canvasContext.stroke();
- this.canvasContext.closePath()
- },
- this, null))
- };
- b._draw = function(b) {
- this.renderContext = b;
- b = this.canvasContext = this.renderContext.canvasContext;
- b.save();
- var a = this.commandQueue.length;
- this.strokeStyleColor && 0 < a && this.commandQueue[a - 1] != this.endLineCommand && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand), a = this.commandQueue.length);
- for (var c = 0; c < a; c++) {
- var g = this.commandQueue[c];
- g.method.apply(g.thisObject, g.args)
- }
- b.restore()
- };
- var c = function() {
- return function(b, a, c) {
- this.method = b;
- this.thisObject = a;
- this.args = c
- }
- } ();
- c.prototype.__class__ = "Command";
- b._setStyle = function(b) {
- this.canvasContext.fillStyle = b;
- this.canvasContext.beginPath()
- };
- b.init = function() {
- for (var c in b) egret.Graphics.prototype[c] = b[c];
- egret.RendererContext.createRendererContext = function(a) {
- return new egret.HTML5CanvasRenderer(a)
- }
- }
- })(egret_h5_graphics || (egret_h5_graphics = {}));
- egret_h5_graphics.init();
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- c.call(this);
- this.size = 2E3;
- this.vertSize = 6;
- this.contextLost = !1;
- this.glContextId = 0;
- this.currentBlendMode = "";
- this.currentBaseTexture = null;
- this.currentBatchSize = 0;
- this.maskList = [];
- this.maskDataFreeList = [];
- this.canvasContext = document.createElement("canvas").getContext("2d");
- console.log("\u4f7f\u7528WebGL\u6a21\u5f0f");
- this.canvas = a;
- a.addEventListener("webglcontextlost", this.handleContextLost.bind(this), !1);
- a.addEventListener("webglcontextrestored", this.handleContextRestored.bind(this), !1);
- this.projectionX = a.width / 2;
- this.projectionY = -a.height / 2;
- a = 6 * this.size;
- this.vertices = new Float32Array(4 * this.size * this.vertSize);
- this.indices = new Uint16Array(a);
- for (var g = 0,
- f = 0; g < a; g += 6, f += 4) this.indices[g + 0] = f + 0,
- this.indices[g + 1] = f + 1,
- this.indices[g + 2] = f + 2,
- this.indices[g + 3] = f + 0,
- this.indices[g + 4] = f + 2,
- this.indices[g + 5] = f + 3;
- this.initWebGL();
- this.shaderManager = new b.WebGLShaderManager(this.gl);
- this.worldTransform = new b.Matrix;
- this.initBlendMode();
- b.MainContext.instance.addEventListener(b.Event.FINISH_RENDER, this._draw, this);
- b.TextField.prototype._draw = function(a) {
- this.getDirty() && (this.cacheAsBitmap = !0);
- b.DisplayObject.prototype._draw.call(this, a)
- }
- }
- __extends(a, c);
- a.prototype.handleContextLost = function() {
- this.contextLost = !0
- };
- a.prototype.handleContextRestored = function() {
- this.initWebGL();
- this.shaderManager.setContext(this.gl);
- this.contextLost = !1
- };
- a.prototype.initWebGL = function() {
- for (var a = {
- stencil: !0
- },
- b, c = ["experimental-webgl", "webgl"], d = 0; d < c.length; d++) {
- try {
- b = this.canvas.getContext(c[d], a)
- } catch(l) {}
- if (b) break
- }
- if (!b) throw Error("\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301webgl");
- this.setContext(b)
- };
- a.prototype.setContext = function(a) {
- this.gl = a;
- a.id = this.glContextId++;
- this.vertexBuffer = a.createBuffer();
- this.indexBuffer = a.createBuffer();
- a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
- a.bufferData(a.ELEMENT_ARRAY_BUFFER, this.indices, a.STATIC_DRAW);
- a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
- a.bufferData(a.ARRAY_BUFFER, this.vertices, a.DYNAMIC_DRAW);
- a.disable(a.DEPTH_TEST);
- a.disable(a.CULL_FACE);
- a.enable(a.BLEND);
- a.colorMask(!0, !0, !0, !0)
- };
- a.prototype.initBlendMode = function() {
- a.blendModesWebGL[b.BlendMode.NORMAL] = [this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA];
- a.blendModesWebGL[b.BlendMode.ADD] = [this.gl.SRC_ALPHA, this.gl.DST_ALPHA]
- };
- a.prototype.start = function() {
- if (!this.contextLost) {
- var a = this.gl;
- a.activeTexture(a.TEXTURE0);
- a.bindBuffer(a.ARRAY_BUFFER, this.vertexBuffer);
- a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
- var b = this.shaderManager.defaultShader;
- a.uniform2f(b.projectionVector, this.projectionX, this.projectionY);
- var c = 4 * this.vertSize;
- a.vertexAttribPointer(b.aVertexPosition, 2, a.FLOAT, !1, c, 0);
- a.vertexAttribPointer(b.aTextureCoord, 2, a.FLOAT, !1, c, 8);
- a.vertexAttribPointer(b.colorAttribute, 2, a.FLOAT, !1, c, 16)
- }
- };
- a.prototype.clearScreen = function() {
- var a = this.gl;
- a.colorMask(!0, !0, !0, !0);
- for (var c = b.RenderFilter.getInstance().getDrawAreaList(), d = 0, m = c.length; d < m; d++) {
- var l = c[d];
- a.viewport(l.x, l.y, l.width, l.height);
- a.bindFramebuffer(a.FRAMEBUFFER, null);
- a.clearColor(0, 0, 0, 0);
- a.clear(a.COLOR_BUFFER_BIT)
- }
- this.renderCost = 0
- };
- a.prototype.setBlendMode = function(c) {
- c || (c = b.BlendMode.NORMAL);
- if (this.currentBlendMode != c) {
- var d = a.blendModesWebGL[c];
- d && (this.gl.blendFunc(d[0], d[1]), this.currentBlendMode = c)
- }
- };
- a.prototype.drawImage = function(a, c, d, m, l, h, k, p, n) {
- if (!this.contextLost) {
- var q = b.MainContext.instance.rendererContext.texture_scale_factor;
- c /= q;
- d /= q;
- m /= q;
- l /= q;
- this.createWebGLTexture(a);
- if (a.webGLTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size) this._draw(),
- this.currentBaseTexture = a.webGLTexture;
- var t = this.worldTransform,
- r = t.a,
- s = t.b,
- u = t.c,
- v = t.d,
- x = t.tx,
- y = t.ty;
- 0 == h && 0 == k || t.append(1, 0, 0, 1, h, k);
- 1 == m / p && 1 == l / n || t.append(p / m, 0, 0, n / l, 0, 0);
- h = t.a;
- k = t.b;
- p = t.c;
- n = t.d;
- var q = t.tx,
- w = t.ty;
- t.a = r;
- t.b = s;
- t.c = u;
- t.d = v;
- t.tx = x;
- t.ty = y;
- r = a._sourceWidth;
- s = a._sourceHeight;
- a = m;
- t = l;
- c /= r;
- d /= s;
- m /= r;
- l /= s;
- r = this.vertices;
- s = 4 * this.currentBatchSize * this.vertSize;
- u = this.worldAlpha;
- r[s++] = q;
- r[s++] = w;
- r[s++] = c;
- r[s++] = d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = h * a + q;
- r[s++] = k * a + w;
- r[s++] = m + c;
- r[s++] = d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = h * a + p * t + q;
- r[s++] = n * t + k * a + w;
- r[s++] = m + c;
- r[s++] = l + d;
- r[s++] = u;
- r[s++] = 16777215;
- r[s++] = p * t + q;
- r[s++] = n * t + w;
- r[s++] = c;
- r[s++] = l + d;
- r[s++] = u;
- r[s++] = 16777215;
- this.currentBatchSize++
- }
- };
- a.prototype._draw = function() {
- if (0 != this.currentBatchSize && !this.contextLost) {
- var a = b.getTimer();
- this.start();
- var c = this.gl;
- c.bindTexture(c.TEXTURE_2D, this.currentBaseTexture);
- var d = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize);
- c.bufferSubData(c.ARRAY_BUFFER, 0, d);
- c.drawElements(c.TRIANGLES, 6 * this.currentBatchSize, c.UNSIGNED_SHORT, 0);
- this.currentBatchSize = 0;
- this.renderCost += b.getTimer() - a;
- b.Profiler.getInstance().onDrawImage()
- }
- };
- a.prototype.setTransform = function(a) {
- var b = this.worldTransform;
- b.a = a.a;
- b.b = a.b;
- b.c = a.c;
- b.d = a.d;
- b.tx = a.tx;
- b.ty = a.ty
- };
- a.prototype.setAlpha = function(a, b) {
- this.worldAlpha = a;
- this.setBlendMode(b)
- };
- a.prototype.createWebGLTexture = function(a) {
- if (!a.webGLTexture) {
- var b = this.gl;
- a.webGLTexture = b.createTexture();
- b.bindTexture(b.TEXTURE_2D, a.webGLTexture);
- b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
- b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, b.RGBA, b.UNSIGNED_BYTE, a._bitmapData);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.LINEAR);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE);
- b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE);
- b.bindTexture(b.TEXTURE_2D, null)
- }
- };
- a.prototype.pushMask = function(a) {
- this._draw();
- var b = this.gl;
- 0 == this.maskList.length && (b.enable(b.STENCIL_TEST), b.stencilFunc(b.ALWAYS, 1, 1));
- var c = this.maskDataFreeList.pop();
- c ? (c.x = a.x, c.y = a.y, c.w = a.width, c.h = a.height) : c = {
- x: a.x,
- y: a.y,
- w: a.width,
- h: a.height
- };
- this.maskList.push(c);
- b.colorMask(!1, !1, !1, !1);
- b.stencilOp(b.KEEP, b.KEEP, b.INCR);
- this.renderGraphics(c);
- b.colorMask(!0, !0, !0, !0);
- b.stencilFunc(b.NOTEQUAL, 0, this.maskList.length);
- b.stencilOp(b.KEEP, b.KEEP, b.KEEP)
- };
- a.prototype.popMask = function() {
- this._draw();
- var a = this.gl,
- b = this.maskList.pop();
- 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));
- 0 == this.maskList.length && a.disable(a.STENCIL_TEST)
- };
- a.prototype.setupFont = function(a) {
- var b = this.canvasContext,
- c = a.italic ? "italic ": "normal ",
- c = c + (a.bold ? "bold ": "normal "),
- c = c + (a.size + "px " + a.fontFamily);
- b.font = c;
- b.textAlign = "left";
- b.textBaseline = "middle"
- };
- a.prototype.measureText = function(a) {
- return this.canvasContext.measureText(a).width
- };
- a.prototype.renderGraphics = function(a) {
- var b = this.gl,
- c = this.shaderManager.primitiveShader;
- this.graphicsPoints ? (this.graphicsPoints.length = 0, this.graphicsIndices.length = 0) : (this.graphicsPoints = [], this.graphicsIndices = [], this.graphicsBuffer = b.createBuffer(), this.graphicsIndexBuffer = b.createBuffer());
- this.updateGraphics(a);
- this.shaderManager.activateShader(c);
- b.blendFunc(b.ONE, b.ONE_MINUS_SRC_ALPHA);
- b.uniformMatrix3fv(c.translationMatrix, !1, this.worldTransform.toArray(!0));
- b.uniform2f(c.projectionVector, this.projectionX, -this.projectionY);
- b.uniform2f(c.offsetVector, 0, 0);
- b.uniform3fv(c.tintColor, [1, 1, 1]);
- b.uniform1f(c.alpha, this.worldAlpha);
- b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
- b.vertexAttribPointer(c.aVertexPosition, 2, b.FLOAT, !1, 24, 0);
- b.vertexAttribPointer(c.colorAttribute, 4, b.FLOAT, !1, 24, 8);
- b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
- b.drawElements(b.TRIANGLE_STRIP, this.graphicsIndices.length, b.UNSIGNED_SHORT, 0);
- this.shaderManager.activateShader(this.shaderManager.defaultShader)
- };
- a.prototype.updateGraphics = function(a) {
- var b = this.gl;
- this.buildRectangle(a);
- b.bindBuffer(b.ARRAY_BUFFER, this.graphicsBuffer);
- b.bufferData(b.ARRAY_BUFFER, new Float32Array(this.graphicsPoints), b.STATIC_DRAW);
- b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
- b.bufferData(b.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.graphicsIndices), b.STATIC_DRAW)
- };
- a.prototype.buildRectangle = function(a) {
- var b = a.x,
- c = a.y,
- d = a.w;
- a = a.h;
- var l = this.graphicsPoints,
- h = this.graphicsIndices,
- k = l.length / 6;
- l.push(b, c);
- l.push(0, 0, 0, 1);
- l.push(b + d, c);
- l.push(0, 0, 0, 1);
- l.push(b, c + a);
- l.push(0, 0, 0, 1);
- l.push(b + d, c + a);
- l.push(0, 0, 0, 1);
- h.push(k, k, k + 1, k + 2, k + 3, k + 3)
- };
- a.blendModesWebGL = {};
- return a
- } (b.RendererContext);
- b.WebGLRenderer = c;
- c.prototype.__class__ = "egret.WebGLRenderer"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b() {}
- b.compileProgram = function(a, c, g) {
- g = b.compileFragmentShader(a, g);
- c = b.compileVertexShader(a, c);
- var f = a.createProgram();
- a.attachShader(f, c);
- a.attachShader(f, g);
- a.linkProgram(f);
- a.getProgramParameter(f, a.LINK_STATUS) || console.log("\u65e0\u6cd5\u521d\u59cb\u5316\u7740\u8272\u5668");
- return f
- };
- b.compileFragmentShader = function(a, c) {
- return b._compileShader(a, c, a.FRAGMENT_SHADER)
- };
- b.compileVertexShader = function(a, c) {
- return b._compileShader(a, c, a.VERTEX_SHADER)
- };
- b._compileShader = function(a, b, c) {
- c = a.createShader(c);
- a.shaderSource(c, b);
- a.compileShader(c);
- return a.getShaderParameter(c, a.COMPILE_STATUS) ? c: (console.log(a.getShaderInfoLog(c)), null)
- };
- b.checkCanUseWebGL = function() {
- if (void 0 == b.canUseWebGL) try {
- var a = document.createElement("canvas");
- b.canUseWebGL = !!window.WebGLRenderingContext && !(!a.getContext("webgl") && !a.getContext("experimental-webgl"))
- } catch(c) {
- b.canUseWebGL = !1
- }
- return b.canUseWebGL
- };
- return b
- } ();
- b.WebGLUtils = c;
- c.prototype.__class__ = "egret.WebGLUtils"
- })(egret || (egret = {})); (function(b) {
- var c = function() {
- function b(a) {
- this.maxAttibs = 10;
- this.attribState = [];
- this.tempAttribState = [];
- for (var c = 0; c < this.maxAttibs; c++) this.attribState[c] = !1;
- this.setContext(a)
- }
- b.prototype.setContext = function(b) {
- this.gl = b;
- this.primitiveShader = new a(b);
- this.defaultShader = new d(b);
- this.activateShader(this.defaultShader)
- };
- b.prototype.activateShader = function(a) {
- this.gl.useProgram(a.program);
- this.setAttribs(a.attributes)
- };
- b.prototype.setAttribs = function(a) {
- var b, c;
- c = this.tempAttribState.length;
- for (b = 0; b < c; b++) this.tempAttribState[b] = !1;
- c = a.length;
- for (b = 0; b < c; b++) this.tempAttribState[a[b]] = !0;
- a = this.gl;
- c = this.attribState.length;
- 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))
- };
- return b
- } ();
- b.WebGLShaderManager = c;
- c.prototype.__class__ = "egret.WebGLShaderManager";
- var d = function() {
- function a(b) {
- this.defaultVertexSrc = "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 vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;\n vColor = vec4(color * aColor.x, aColor.x);\n}";
- this.program = null;
- this.fragmentSrc = "precision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;\n}";
- this.gl = b;
- this.init()
- }
- a.prototype.init = function() {
- var a = this.gl,
- c = b.WebGLUtils.compileProgram(a, this.defaultVertexSrc, this.fragmentSrc);
- a.useProgram(c);
- this.uSampler = a.getUniformLocation(c, "uSampler");
- this.projectionVector = a.getUniformLocation(c, "projectionVector");
- this.offsetVector = a.getUniformLocation(c, "offsetVector");
- this.dimensions = a.getUniformLocation(c, "dimensions");
- this.aVertexPosition = a.getAttribLocation(c, "aVertexPosition");
- this.aTextureCoord = a.getAttribLocation(c, "aTextureCoord");
- this.colorAttribute = a.getAttribLocation(c, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
- this.attributes = [this.aVertexPosition, this.aTextureCoord, this.colorAttribute];
- this.program = c
- };
- return a
- } ();
- b.EgretShader = d;
- d.prototype.__class__ = "egret.EgretShader";
- var a = function() {
- function a(b) {
- this.alpha = this.translationMatrix = this.attributes = this.colorAttribute = this.aVertexPosition = this.tintColor = this.offsetVector = this.projectionVector = this.program = null;
- this.fragmentSrc = "precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
- 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}";
- this.gl = b;
- this.init()
- }
- a.prototype.init = function() {
- var a = this.gl,
- c = b.WebGLUtils.compileProgram(a, this.vertexSrc, this.fragmentSrc);
- a.useProgram(c);
- this.projectionVector = a.getUniformLocation(c, "projectionVector");
- this.offsetVector = a.getUniformLocation(c, "offsetVector");
- this.tintColor = a.getUniformLocation(c, "tint");
- this.aVertexPosition = a.getAttribLocation(c, "aVertexPosition");
- this.colorAttribute = a.getAttribLocation(c, "aColor");
- this.attributes = [this.aVertexPosition, this.colorAttribute];
- this.translationMatrix = a.getUniformLocation(c, "translationMatrix");
- this.alpha = a.getUniformLocation(c, "alpha");
- this.program = c
- };
- return a
- } ();
- b.PrimitiveShader = a;
- a.prototype.__class__ = "egret.PrimitiveShader"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a() {
- c.call(this)
- }
- __extends(a, c);
- a.prototype.proceed = function(a) {
- function c(d) {
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- }
- function d(c) {
- switch (a.dataFormat) {
- case b.URLLoaderDataFormat.TEXT:
- a.data = l.responseText;
- break;
- case b.URLLoaderDataFormat.VARIABLES:
- a.data = new b.URLVariables(l.responseText);
- break;
- case b.URLLoaderDataFormat.BINARY:
- a.data = l.response;
- break;
- default:
- a.data = l.responseText
- }
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- }
- if (a.dataFormat == b.URLLoaderDataFormat.TEXTURE) this.loadTexture(a);
- else if (a.dataFormat == b.URLLoaderDataFormat.SOUND) this.loadSound(a);
- else {
- var m = a._request,
- l = this.getXHR();
- l.onerror = c;
- l.onload = d;
- l.open(m.method, m.url, !0);
- this.setResponseType(l, a.dataFormat);
- m.method != b.URLRequestMethod.GET && m.data ? m.data instanceof b.URLVariables ? (l.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), l.send(m.data.toString())) : (l.setRequestHeader("Content-Type", "multipart/form-data"), l.send(m.data)) : l.send()
- }
- };
- a.prototype.loadSound = function(a) {
- function c(l) {
- window.clearTimeout(m.__timeoutId);
- m.removeEventListener("canplaythrough", c, !1);
- m.removeEventListener("error", d, !1);
- l = new b.Sound;
- l._setAudio(m);
- a.data = l;
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- }
- function d(l) {
- window.clearTimeout(m.__timeoutId);
- m.removeEventListener("canplaythrough", c, !1);
- m.removeEventListener("error", d, !1);
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- }
- var m = new Audio(a._request.url);
- m.__timeoutId = window.setTimeout(c, 100);
- m.addEventListener("canplaythrough", c, !1);
- m.addEventListener("error", d, !1);
- m.load()
- };
- a.prototype.getXHR = function() {
- return window.XMLHttpRequest ? new window.XMLHttpRequest: new ActiveXObject("MSXML2.XMLHTTP")
- };
- a.prototype.setResponseType = function(a, c) {
- switch (c) {
- case b.URLLoaderDataFormat.TEXT:
- case b.URLLoaderDataFormat.VARIABLES:
- a.responseType = b.URLLoaderDataFormat.TEXT;
- break;
- case b.URLLoaderDataFormat.BINARY:
- a.responseType = "arraybuffer";
- break;
- default:
- a.responseType = c
- }
- };
- a.prototype.loadTexture = function(a) {
- var c = a._request,
- d = new Image;
- d.crossOrigin = "Anonymous";
- d.onload = function(c) {
- d.onerror = null;
- d.onload = null;
- c = new b.Texture;
- c._setBitmapData(d);
- a.data = c;
- b.callLater(b.Event.dispatchEvent, b.Event, a, b.Event.COMPLETE)
- };
- d.onerror = function(c) {
- d.onerror = null;
- d.onload = null;
- b.IOErrorEvent.dispatchIOErrorEvent(a)
- };
- d.src = c.url
- };
- return a
- } (b.NetContext);
- b.HTML5NetContext = c;
- c.prototype.__class__ = "egret.HTML5NetContext"
- })(egret || (egret = {}));
- __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- }; (function(b) {
- var c = function(c) {
- function a(a) {
- c.call(this);
- this.canvas = a;
- this._isTouchDown = !1
- }
- __extends(a, c);
- a.prototype.run = function() {
- var a = this;
- window.navigator.msPointerEnabled ? (this.canvas.addEventListener("MSPointerDown",
- function(b) {
- a._onTouchBegin(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1), this.canvas.addEventListener("MSPointerMove",
- function(b) {
- a._onTouchMove(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1), this.canvas.addEventListener("MSPointerUp",
- function(b) {
- a._onTouchEnd(b);
- b.stopPropagation();
- b.preventDefault()
- },
- !1)) : b.MainContext.deviceType == b.MainContext.DEVICE_MOBILE ? this.addTouchListener() : b.MainContext.deviceType == b.MainContext.DEVICE_PC && (this.addTouchListener(), this.addMouseListener());
- window.addEventListener("mousedown",
- function(b) {
- a.inOutOfCanvas(b) ? a.dispatchLeaveStageEvent() : a._isTouchDown = !0
- });
- window.addEventListener("mouseup",
- function(b) {
- a._isTouchDown && a.inOutOfCanvas(b) && a.dispatchLeaveStageEvent();
- a._isTouchDown = !1
- })
- };
- a.prototype.addMouseListener = function() {
- var a = this;
- this.canvas.addEventListener("mousedown",
- function(b) {
- a._onTouchBegin(b)
- });
- this.canvas.addEventListener("mousemove",
- function(b) {
- a._onTouchMove(b)
- });
- this.canvas.addEventListener("mouseup",
- function(b) {
- a._onTouchEnd(b)
- })
- };
- a.prototype.addTouchListener = function() {
- var a = this;
- this.canvas.addEventListener("touchstart",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchBegin(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchmove",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchMove(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchend",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1);
- this.canvas.addEventListener("touchcancel",
- function(b) {
- for (var c = b.changedTouches.length,
- d = 0; d < c; d++) a._onTouchEnd(b.changedTouches[d]);
- b.stopPropagation();
- b.preventDefault()
- },
- !1)
- };
- a.prototype.inOutOfCanvas = function(a) {
- a = this.getLocation(this.canvas, a);
- return 0 > a.x || 0 > a.y || a.x > this.canvas.width || a.y > this.canvas.height ? !0 : !1
- };
- a.prototype.dispatchLeaveStageEvent = function() {
- b.MainContext.instance.stage.dispatchEventWith(b.Event.LEAVE_STAGE)
- };
- a.prototype._onTouchBegin = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchBegan(b.x, b.y, c)
- };
- a.prototype._onTouchMove = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchMove(b.x, b.y, c)
- };
- a.prototype._onTouchEnd = function(a) {
- var b = this.getLocation(this.canvas, a),
- c = -1;
- a.hasOwnProperty("identifier") && (c = a.identifier);
- this.onTouchEnd(b.x, b.y, c)
- };
- a.prototype.getLocation = function(a, c) {
- var d = document.documentElement,
- m = window,
- l, h;
- "function" === typeof a.getBoundingClientRect ? (h = a.getBoundingClientRect(), l = h.left, h = h.top) : h = l = 0;
- l += m.pageXOffset - d.clientLeft;
- h += m.pageYOffset - d.clientTop;
- null != c.pageX ? (d = c.pageX, m = c.pageY) : (l -= document.body.scrollLeft, h -= document.body.scrollTop, d = c.clientX, m = c.clientY);
- var k = b.Point.identity;
- k.x = (d - l) / b.StageDelegate.getInstance().getScaleX();
- k.y = (m - h) / b.StageDelegate.getInstance().getScaleY();
- return k
- };
- return a
- } (b.TouchContext);
- b.HTML5TouchContext = c;
- c.prototype.__class__ = "egret.HTML5TouchContext"
- })(egret || (egret = {}));
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- LoadingUI = function(b) {
- function c() {
- b.call(this);
- this.createView()
- }
- __extends(c, b);
- c.prototype.createView = function() {
- this.textField = new egret.TextField;
- this.addChild(this.textField);
- this.textField.y = 300;
- this.textField.width = 480;
- this.textField.height = 100;
- this.textField.textAlign = "center"
- };
- c.prototype.setProgress = function(b, a) {
- this.textField.text = "\u6e38\u620f\u52a0\u8f7d\u4e2d..." + b + "/" + a
- };
- return c
- } (egret.Sprite);
- LoadingUI.prototype.__class__ = "LoadingUI";
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- MyBtn = function(b) {
- function c() {
- b.call(this);
- this.isRight = !1
- }
- __extends(c, b);
- c.prototype.createView = function(b, a, c) {
- this.touchChildren = !1;
- this.touchEnabled = !0;
- this.sprite = new egret.Sprite;
- this.sprite.graphics.beginFill(c);
- this.sprite.graphics.drawRect(0, 0, 130, 60);
- this.sprite.graphics.endFill();
- this.addChild(this.sprite);
- this.textField = new egret.TextField;
- this.addChild(this.textField);
- this.textField.width = 130;
- this.textField.text = b;
- this.textField.textColor = a;
- this.textField.textAlign = "center";
- this.textField.bold = !0;
- this.textField.size = 40;
- this.textField.y = (60 - this.textField.height) / 2
- };
- c.prototype.setLabelText = function(b) {
- this.textField.text = b
- };
- return c
- } (egret.Sprite);
- MyBtn.prototype.__class__ = "MyBtn";
- var __extends = this.__extends ||
- function(b, c) {
- function d() {
- this.constructor = b
- }
- for (var a in c) c.hasOwnProperty(a) && (b[a] = c[a]);
- d.prototype = c.prototype;
- b.prototype = new d
- },
- Main = function(b) {
- function c() {
- b.call(this);
- this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
- }
- __extends(c, b);
- c.prototype.onAddToStage = function(b) {
- this.loadingView = new LoadingUI;
- this.stage.addChild(this.loadingView);
- RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.loadConfig("resource/resource.json", "resource/")
- };
- c.prototype.onConfigComplete = function(b) {
- RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
- RES.loadGroup("preload")
- };
- c.prototype.onResourceLoadComplete = function(b) {
- "preload" == b.groupName && (this.stage.removeChild(this.loadingView), RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this), this.createGameScene())
- };
- c.prototype.onResourceProgress = function(b) {
- "preload" == b.groupName && this.loadingView.setProgress(b.itemsLoaded, b.itemsTotal)
- };
- c.prototype.createGameScene = function() {
- document.title = "\u662f\u7537\u4eba\u575a\u630160\u79d2\uff01";
- this.gameText = new egret.TextField;
- this.gameText.width = 405;
- this.gameText.size = 40;
- this.gameText.text = "\u662f\u7537\u4eba\u575a\u630160\u79d2";
- this.addChild(this.gameText);
- this.gameText.textAlign = "center";
- this.gameText.bold = !0;
- this.gameText.textColor = 7349024;
- this.gameText.y = 30;
- var b = this.createBitmapByName("man");
- this.man = new egret.Sprite;
- this.man.addChild(b);
- this.man.anchorOffsetX = 96;
- this.man.anchorOffsetY = 270;
- this.man.x = 215;
- this.man.y = 380;
- this.addChild(this.man);
- this.gameBtn = new MyBtn;
- this.gameBtn.createView("\u5f00\u59cb", 16777215, 7349024);
- this.addChild(this.gameBtn);
- this.gameBtn.x = 138;
- this.gameBtn.y = 490;
- this.gameBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onGameBtnClick, this);
- b = this.createBitmapByName("btn");
- b.rotation = 180;
- this.lBtn = new egret.Sprite;
- this.lBtn.addChild(b);
- this.lBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.lBtnClick, this);
- this.lBtn.x = 75;
- this.lBtn.y = 500;
- this.lBtn.touchEnabled = !0;
- b = this.createBitmapByName("btn");
- this.rBtn = new egret.Sprite;
- this.rBtn.addChild(b);
- this.rBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.rBtnClick, this);
- this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisTap, this);
- this.rBtn.touchEnabled = !0;
- this.rBtn.x = 330;
- this.rBtn.y = 460;
- this.gameTimer = new egret.Timer(100);
- this.gameTimer.addEventListener(egret.TimerEvent.TIMER, this.onGameTimer, this);
- this.touchEnabled = !0
- };
- c.prototype.thisTap = function(b) {
- this.nr = 202.5 < b.stageX ? this.nr + (1 * Math.random() + 1) : this.nr + -(1 * Math.random() + 1)
- };
- c.prototype.onGameTimer = function(b) {
- this.nr *= 1.1;
- this.man.rotation += this.nr;
- this.gameText.text = (this.gameTimer.currentCount() / 10).toString();
- if (75 < this.man.rotation || -75 > this.man.rotation) {
- this.wx = this.createBitmapByName("wx");
- this.addChild(this.wx);
- b = this.stage.stageWidth;
- this.wx.width = 80;
- this.wx.height = 21.6;
- this.wx.x = b - this.wx.width;
- this.wx.y = 0;
- b = this.gameText.text;
- this.gameText.text = "\u4f60\u624d\u575a\u6301\u4e86" + b + "\u79d2";
- // updateShare(b);
- // Play68.setRankingScoreDesc(b);
- var a = this.gameTimer.currentCount() / 10 / 100 + 0.5;
- 0.99 < a && (a = 0.99);
- a = 1E4 * a >> 0;
- a /= 100;
- document.title = "\u6211\u575a\u6301\u4e86" + b + "\u79d2\uff0c\u8d85\u8fc7\u4e86\u5168\u56fd" + a + "%\u7684\u4eba\uff01\u4f60\u80fd\u8d85\u8fc7\u6211\u5417\uff1f\u5feb\u6765\u6311\u6218\u5427\uff01";
- this.gameBtn.setLabelText("\u91cd\u6765");
- this.addChild(this.gameBtn);
- this.gameBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onReGameBtnClick, this);
- this.gameTimer.reset()
- }
- };
- c.prototype.onReGameBtnClick = function(b) {
- document.title = "\u662f\u7537\u4eba\u575a\u630160\u79d2\uff01";
- this.removeChild(this.wx);
- this.removeChild(this.gameBtn);
- this.gameBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onReGameBtnClick, this);
- this.beginGame()
- };
- c.prototype.onGameBtnClick = function(b) {
- this.removeChild(this.gameBtn);
- this.gameBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onGameBtnClick, this);
- this.beginGame()
- };
- c.prototype.beginGame = function() {
- // updateShare(0);
- this.man.rotation = 0;
- this.nr = Math.random() + 0.5;
- this.gameTimer.reset();
- this.gameTimer.start();
- this.addChild(this.lBtn);
- this.addChild(this.rBtn)
-
- };
- c.prototype.lBtnClick = function(b) {};
- c.prototype.rBtnClick = function(b) {};
- c.prototype.createBitmapByName = function(b) {
- var a = new egret.Bitmap;
- b = RES.getRes(b);
- a.texture = b;
- return a
- };
- c.prototype.mySort = function(b, a) {
- return b > a ? 1 : -1
- };
- return c
- } (egret.DisplayObjectContainer);
- Main.prototype.__class__ = "Main";
|