game-min.js 258 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128
  1. var egret;
  2. (function(t) {
  3. var e = function() {
  4. function t() {
  5. this._hashCode = t.hashCount++
  6. }
  7. Object.defineProperty(t.prototype, "hashCode", {
  8. get: function() {
  9. return this._hashCode
  10. },
  11. enumerable: !0,
  12. configurable: !0
  13. });
  14. t.hashCount = 1;
  15. return t
  16. }();
  17. t.HashObject = e;
  18. e.prototype.__class__ = "egret.HashObject"
  19. })(egret || (egret = {}));
  20. var __extends = this.__extends || function(t, e) {
  21. function i() {
  22. this.constructor = t
  23. }
  24. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  25. i.prototype = e.prototype;
  26. t.prototype = new i
  27. };
  28. (function(t) {
  29. var e = function(t) {
  30. function e(e) {
  31. void 0 === e && (e = 300);
  32. t.call(this);
  33. this.objectPool = [];
  34. this._length = 0;
  35. 1 > e && (e = 1);
  36. this.autoDisposeTime = e;
  37. this.frameCount = 0
  38. }
  39. __extends(e, t);
  40. e.prototype._checkFrame = function() {
  41. this.frameCount--;
  42. 0 >= this.frameCount && this.dispose()
  43. };
  44. Object.defineProperty(e.prototype, "length", {
  45. get: function() {
  46. return this._length
  47. },
  48. enumerable: !0,
  49. configurable: !0
  50. });
  51. e.prototype.push = function(t) {
  52. var i = this.objectPool; - 1 == i.indexOf(t) && (i.push(t), this._length++, 0 == this.frameCount && (this.frameCount = this.autoDisposeTime, e._callBackList.push(this)))
  53. };
  54. e.prototype.pop = function() {
  55. if (0 == this._length) return null;
  56. this._length--;
  57. return this.objectPool.pop()
  58. };
  59. e.prototype.dispose = function() {
  60. 0 < this._length && (this.objectPool = [], this._length = 0);
  61. this.frameCount = 0;
  62. var t = e._callBackList,
  63. i = t.indexOf(this); - 1 != i && t.splice(i, 1)
  64. };
  65. e._callBackList = [];
  66. return e
  67. }(t.HashObject);
  68. t.Recycler = e;
  69. e.prototype.__class__ = "egret.Recycler"
  70. })(egret || (egret = {}));
  71. (function(t) {
  72. t.__START_TIME;
  73. t.getTimer = function() {
  74. return Date.now() - t.__START_TIME
  75. }
  76. })(egret || (egret = {}));
  77. (function(t) {
  78. t.__callLaterFunctionList = [];
  79. t.__callLaterThisList = [];
  80. t.__callLaterArgsList = [];
  81. t.callLater = function(e, i) {
  82. for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
  83. t.__callLaterFunctionList.push(e);
  84. t.__callLaterThisList.push(i);
  85. t.__callLaterArgsList.push(n)
  86. };
  87. t.__callAsyncFunctionList = [];
  88. t.__callAsyncThisList = [];
  89. t.__callAsyncArgsList = [];
  90. t.__callAsync = function(e, i) {
  91. for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
  92. t.__callAsyncFunctionList.push(e);
  93. t.__callAsyncThisList.push(i);
  94. t.__callAsyncArgsList.push(n)
  95. }
  96. })(egret || (egret = {}));
  97. var egret_dom;
  98. (function(t) {
  99. function e() {
  100. for (var t = document.createElement("div").style, e = ["t", "webkitT", "msT", "MozT", "OT"], i = 0; i < e.length; i++)
  101. if (e[i] + "ransform" in t) return e[i];
  102. return e[0]
  103. }
  104. t.header = "";
  105. t.getHeader = e;
  106. t.getTrans = function(i) {
  107. "" == t.header && (t.header = e());
  108. return t.header + i.substring(1, i.length)
  109. }
  110. })(egret_dom || (egret_dom = {}));
  111. __extends = this.__extends || function(t, e) {
  112. function i() {
  113. this.constructor = t
  114. }
  115. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  116. i.prototype = e.prototype;
  117. t.prototype = new i
  118. };
  119. (function(t) {
  120. var e = function(e) {
  121. function i(t, i, n) {
  122. void 0 === i && (i = !1);
  123. void 0 === n && (n = !1);
  124. e.call(this);
  125. this._eventPhase = 2;
  126. this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1;
  127. this.isNew = !0;
  128. this._type = t;
  129. this._bubbles = i;
  130. this._cancelable = n
  131. }
  132. __extends(i, e);
  133. Object.defineProperty(i.prototype, "type", {
  134. get: function() {
  135. return this._type
  136. },
  137. enumerable: !0,
  138. configurable: !0
  139. });
  140. Object.defineProperty(i.prototype, "bubbles", {
  141. get: function() {
  142. return this._bubbles
  143. },
  144. enumerable: !0,
  145. configurable: !0
  146. });
  147. Object.defineProperty(i.prototype, "cancelable", {
  148. get: function() {
  149. return this._cancelable
  150. },
  151. enumerable: !0,
  152. configurable: !0
  153. });
  154. Object.defineProperty(i.prototype, "eventPhase", {
  155. get: function() {
  156. return this._eventPhase
  157. },
  158. enumerable: !0,
  159. configurable: !0
  160. });
  161. Object.defineProperty(i.prototype, "currentTarget", {
  162. get: function() {
  163. return this._currentTarget
  164. },
  165. enumerable: !0,
  166. configurable: !0
  167. });
  168. Object.defineProperty(i.prototype, "target", {
  169. get: function() {
  170. return this._target
  171. },
  172. enumerable: !0,
  173. configurable: !0
  174. });
  175. i.prototype.isDefaultPrevented = function() {
  176. return this._isDefaultPrevented
  177. };
  178. i.prototype.preventDefault = function() {
  179. this._cancelable && (this._isDefaultPrevented = !0)
  180. };
  181. i.prototype.stopPropagation = function() {
  182. this._bubbles && (this._isPropagationStopped = !0)
  183. };
  184. i.prototype.stopImmediatePropagation = function() {
  185. this._bubbles && (this._isPropagationImmediateStopped = !0)
  186. };
  187. i.prototype._reset = function() {
  188. this.isNew ? this.isNew = !1 : (this._isPropagationImmediateStopped = this._isPropagationStopped = this._isDefaultPrevented = !1, this._currentTarget = this._target = null, this._eventPhase = 2)
  189. };
  190. i._dispatchByTarget = function(e, i, n, r, o, s) {
  191. void 0 === o && (o = !1);
  192. void 0 === s && (s = !1);
  193. var a = e.eventRecycler;
  194. a || (a = e.eventRecycler = new t.Recycler);
  195. var h = a.pop();
  196. h ? h._type = n : h = new e(n);
  197. h._bubbles = o;
  198. h._cancelable = s;
  199. if (r)
  200. for (var c in r) h[c] = r[c], null !== h[c] && (r[c] = null);
  201. e = i.dispatchEvent(h);
  202. a.push(h);
  203. return e
  204. };
  205. i._getPropertyData = function(t) {
  206. var e = t._props;
  207. e || (e = t._props = {});
  208. return e
  209. };
  210. i.dispatchEvent = function(t, e, n, r) {
  211. void 0 === n && (n = !1);
  212. var o = i._getPropertyData(i);
  213. r && (o.data = r);
  214. i._dispatchByTarget(i, t, e, o, n)
  215. };
  216. i.ADDED_TO_STAGE = "addedToStage";
  217. i.REMOVED_FROM_STAGE = "removedFromStage";
  218. i.ADDED = "added";
  219. i.REMOVED = "removed";
  220. i.COMPLETE = "complete";
  221. i.ENTER_FRAME = "enterFrame";
  222. i.RENDER = "render";
  223. i.FINISH_RENDER = "finishRender";
  224. i.FINISH_UPDATE_TRANSFORM = "finishUpdateTransform";
  225. i.LEAVE_STAGE = "leaveStage";
  226. i.RESIZE = "resize";
  227. i.CHANGE = "change";
  228. i.ACTIVATE = "activate";
  229. i.DEACTIVATE = "deactivate";
  230. i.CLOSE = "close";
  231. i.CONNECT = "connect";
  232. return i
  233. }(t.HashObject);
  234. t.Event = e;
  235. e.prototype.__class__ = "egret.Event"
  236. })(egret || (egret = {}));
  237. __extends = this.__extends || function(t, e) {
  238. function i() {
  239. this.constructor = t
  240. }
  241. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  242. i.prototype = e.prototype;
  243. t.prototype = new i
  244. };
  245. (function(t) {
  246. var e = function(t) {
  247. function e(e, i, n) {
  248. void 0 === i && (i = !1);
  249. void 0 === n && (n = !1);
  250. t.call(this, e, i, n);
  251. this._status = 0
  252. }
  253. __extends(e, t);
  254. Object.defineProperty(e.prototype, "status", {
  255. get: function() {
  256. return this._status
  257. },
  258. enumerable: !0,
  259. configurable: !0
  260. });
  261. e.dispatchHTTPStatusEvent = function(t, i) {
  262. null == e.httpStatusEvent && (e.httpStatusEvent = new e(e.HTTP_STATUS));
  263. e.httpStatusEvent._status = i;
  264. t.dispatchEvent(e.httpStatusEvent)
  265. };
  266. e.HTTP_STATUS = "httpStatus";
  267. e.httpStatusEvent = null;
  268. return e
  269. }(t.Event);
  270. t.HTTPStatusEvent = e;
  271. e.prototype.__class__ = "egret.HTTPStatusEvent"
  272. })(egret || (egret = {}));
  273. __extends = this.__extends || function(t, e) {
  274. function i() {
  275. this.constructor = t
  276. }
  277. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  278. i.prototype = e.prototype;
  279. t.prototype = new i
  280. };
  281. (function(t) {
  282. var e = function(e) {
  283. function i(t, i, n) {
  284. void 0 === i && (i = !1);
  285. void 0 === n && (n = !1);
  286. e.call(this, t, i, n)
  287. }
  288. __extends(i, e);
  289. i.dispatchIOErrorEvent = function(e) {
  290. t.Event._dispatchByTarget(i, e, i.IO_ERROR)
  291. };
  292. i.IO_ERROR = "ioError";
  293. return i
  294. }(t.Event);
  295. t.IOErrorEvent = e;
  296. e.prototype.__class__ = "egret.IOErrorEvent"
  297. })(egret || (egret = {}));
  298. __extends = this.__extends || function(t, e) {
  299. function i() {
  300. this.constructor = t
  301. }
  302. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  303. i.prototype = e.prototype;
  304. t.prototype = new i
  305. };
  306. (function(t) {
  307. var e = function(e) {
  308. function i(t, i, n, r, o, s, a, h, c, u) {
  309. void 0 === i && (i = !0);
  310. void 0 === n && (n = !0);
  311. void 0 === r && (r = 0);
  312. void 0 === o && (o = 0);
  313. void 0 === s && (s = 0);
  314. void 0 === a && (a = !1);
  315. void 0 === h && (h = !1);
  316. void 0 === u && (u = !1);
  317. e.call(this, t, i, n);
  318. this._stageY = this._stageX = 0;
  319. this.touchPointID = r;
  320. this._stageX = o;
  321. this._stageY = s;
  322. this.ctrlKey = a;
  323. this.altKey = h;
  324. this.touchDown = u
  325. }
  326. __extends(i, e);
  327. Object.defineProperty(i.prototype, "stageX", {
  328. get: function() {
  329. return this._stageX
  330. },
  331. enumerable: !0,
  332. configurable: !0
  333. });
  334. Object.defineProperty(i.prototype, "stageY", {
  335. get: function() {
  336. return this._stageY
  337. },
  338. enumerable: !0,
  339. configurable: !0
  340. });
  341. Object.defineProperty(i.prototype, "localX", {
  342. get: function() {
  343. return this._currentTarget.globalToLocal(this._stageX, this._stageY, t.Point.identity).x
  344. },
  345. enumerable: !0,
  346. configurable: !0
  347. });
  348. Object.defineProperty(i.prototype, "localY", {
  349. get: function() {
  350. return this._currentTarget.globalToLocal(this._stageX, this._stageY, t.Point.identity).y
  351. },
  352. enumerable: !0,
  353. configurable: !0
  354. });
  355. i.dispatchTouchEvent = function(e, n, r, o, s, a, h, c, u) {
  356. void 0 === r && (r = 0);
  357. void 0 === o && (o = 0);
  358. void 0 === s && (s = 0);
  359. void 0 === a && (a = !1);
  360. void 0 === h && (h = !1);
  361. void 0 === c && (c = !1);
  362. void 0 === u && (u = !1);
  363. var l = t.Event._getPropertyData(i);
  364. l.touchPointID = r;
  365. l._stageX = o;
  366. l._stageY = s;
  367. l.ctrlKey = a;
  368. l.altKey = h;
  369. l.shiftKey = c;
  370. l.touchDown = u;
  371. t.Event._dispatchByTarget(i, e, n, l, !0, !0)
  372. };
  373. i.TOUCH_TAP = "touchTap";
  374. i.TOUCH_MOVE = "touchMove";
  375. i.TOUCH_BEGIN = "touchBegin";
  376. i.TOUCH_END = "touchEnd";
  377. i.TOUCH_RELEASE_OUTSIDE = "touchReleaseOutside";
  378. i.TOUCH_ROLL_OUT = "touchRollOut";
  379. i.TOUCH_ROLL_OVER = "touchRollOver";
  380. i.TOUCH_OUT = "touchOut";
  381. i.TOUCH_OVER = "touchOver";
  382. return i
  383. }(t.Event);
  384. t.TouchEvent = e;
  385. e.prototype.__class__ = "egret.TouchEvent"
  386. })(egret || (egret = {}));
  387. __extends = this.__extends || function(t, e) {
  388. function i() {
  389. this.constructor = t
  390. }
  391. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  392. i.prototype = e.prototype;
  393. t.prototype = new i
  394. };
  395. (function(t) {
  396. var e = function(e) {
  397. function i(t, i, n) {
  398. void 0 === i && (i = !1);
  399. void 0 === n && (n = !1);
  400. e.call(this, t, i, n)
  401. }
  402. __extends(i, e);
  403. i.dispatchTimerEvent = function(e, n) {
  404. t.Event._dispatchByTarget(i, e, n)
  405. };
  406. i.TIMER = "timer";
  407. i.TIMER_COMPLETE = "timerComplete";
  408. return i
  409. }(t.Event);
  410. t.TimerEvent = e;
  411. e.prototype.__class__ = "egret.TimerEvent"
  412. })(egret || (egret = {}));
  413. __extends = this.__extends || function(t, e) {
  414. function i() {
  415. this.constructor = t
  416. }
  417. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  418. i.prototype = e.prototype;
  419. t.prototype = new i
  420. };
  421. (function(t) {
  422. var e = function(e) {
  423. function i(t, i, n, r, o) {
  424. void 0 === i && (i = !1);
  425. void 0 === n && (n = !1);
  426. void 0 === r && (r = 0);
  427. void 0 === o && (o = 0);
  428. e.call(this, t, i, n);
  429. this.bytesLoaded = r;
  430. this.bytesTotal = o
  431. }
  432. __extends(i, e);
  433. i.dispatchProgressEvent = function(e, n, r, o) {
  434. void 0 === r && (r = 0);
  435. void 0 === o && (o = 0);
  436. t.Event._dispatchByTarget(i, e, n, {
  437. bytesLoaded: r,
  438. bytesTotal: o
  439. })
  440. };
  441. i.PROGRESS = "progress";
  442. i.SOCKET_DATA = "socketData";
  443. return i
  444. }(t.Event);
  445. t.ProgressEvent = e;
  446. e.prototype.__class__ = "egret.ProgressEvent"
  447. })(egret || (egret = {}));
  448. (function(t) {
  449. var e = function() {
  450. function t() {}
  451. t.CAPTURING_PHASE = 1;
  452. t.AT_TARGET = 2;
  453. t.BUBBLING_PHASE = 3;
  454. return t
  455. }();
  456. t.EventPhase = e;
  457. e.prototype.__class__ = "egret.EventPhase"
  458. })(egret || (egret = {}));
  459. __extends = this.__extends || function(t, e) {
  460. function i() {
  461. this.constructor = t
  462. }
  463. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  464. i.prototype = e.prototype;
  465. t.prototype = new i
  466. };
  467. (function(t) {
  468. var e = function(e) {
  469. function i(t) {
  470. void 0 === t && (t = null);
  471. e.call(this);
  472. this._eventTarget = t ? t : this
  473. }
  474. __extends(i, e);
  475. i.prototype.addEventListener = function(e, i, n, r, o) {
  476. void 0 === r && (r = !1);
  477. void 0 === o && (o = 0);
  478. "undefined" === typeof r && (r = !1);
  479. "undefined" === typeof o && (o = 0);
  480. i || t.Logger.fatal("addEventListener侦听函数不能为空");
  481. r ? (this._captureEventsMap || (this._captureEventsMap = {}), r = this._captureEventsMap) : (this._eventsMap || (this._eventsMap = {}), r = this._eventsMap);
  482. var s = r[e];
  483. s || (s = r[e] = []);
  484. this._insertEventBin(s, i, n, o)
  485. };
  486. i.prototype._insertEventBin = function(t, e, i, n, r) {
  487. void 0 === r && (r = void 0);
  488. for (var o = -1, s = t.length, a = 0; a < s; a++) {
  489. var h = t[a];
  490. if (h.listener === e && h.thisObject === i && h.display === r) return !1; - 1 == o && h.priority < n && (o = a)
  491. }
  492. e = {
  493. listener: e,
  494. thisObject: i,
  495. priority: n
  496. };
  497. r && (e.display = r); - 1 != o ? t.splice(o, 0, e) : t.push(e);
  498. return !0
  499. };
  500. i.prototype.removeEventListener = function(t, e, i, n) {
  501. void 0 === n && (n = !1);
  502. if (n = n ? this._captureEventsMap : this._eventsMap) {
  503. var r = n[t];
  504. r && (this._removeEventBin(r, e, i), 0 == r.length && delete n[t])
  505. }
  506. };
  507. i.prototype._removeEventBin = function(t, e, i, n) {
  508. void 0 === n && (n = void 0);
  509. for (var r = t.length, o = 0; o < r; o++) {
  510. var s = t[o];
  511. if (s.listener === e && s.thisObject === i && s.display === n) return t.splice(o, 1), !0
  512. }
  513. return !1
  514. };
  515. i.prototype.hasEventListener = function(t) {
  516. return this._eventsMap && this._eventsMap[t] || this._captureEventsMap && this._captureEventsMap[t]
  517. };
  518. i.prototype.willTrigger = function(t) {
  519. return this.hasEventListener(t)
  520. };
  521. i.prototype.dispatchEvent = function(t) {
  522. t._reset();
  523. t._target = this._eventTarget;
  524. t._currentTarget = this._eventTarget;
  525. return this._notifyListener(t)
  526. };
  527. i.prototype._notifyListener = function(t) {
  528. var e = 1 == t._eventPhase ? this._captureEventsMap : this._eventsMap;
  529. if (!e) return !0;
  530. e = e[t._type];
  531. if (!e) return !0;
  532. var i = e.length;
  533. if (0 == i) return !0;
  534. for (var e = e.concat(), n = 0; n < i; n++) {
  535. var r = e[n];
  536. r.listener.call(r.thisObject, t);
  537. if (t._isPropagationImmediateStopped) break
  538. }
  539. return !t._isDefaultPrevented
  540. };
  541. i.prototype.dispatchEventWith = function(e, i, n) {
  542. void 0 === i && (i = !1);
  543. t.Event.dispatchEvent(this, e, i, n)
  544. };
  545. return i
  546. }(t.HashObject);
  547. t.EventDispatcher = e;
  548. e.prototype.__class__ = "egret.EventDispatcher"
  549. })(egret || (egret = {}));
  550. __extends = this.__extends || function(t, e) {
  551. function i() {
  552. this.constructor = t
  553. }
  554. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  555. i.prototype = e.prototype;
  556. t.prototype = new i
  557. };
  558. (function(t) {
  559. var e = function(e) {
  560. function i() {
  561. e.call(this);
  562. this.reuseEvent = new t.Event("")
  563. }
  564. __extends(i, e);
  565. i.prototype.run = function() {
  566. t.Ticker.getInstance().run();
  567. t.Ticker.getInstance().register(this.renderLoop, this, Number.NEGATIVE_INFINITY);
  568. t.Ticker.getInstance().register(this.broadcastEnterFrame, this, Number.POSITIVE_INFINITY);
  569. this.touchContext.run()
  570. };
  571. i.prototype.renderLoop = function(e) {
  572. if (0 < t.__callLaterFunctionList.length) {
  573. var n = t.__callLaterFunctionList;
  574. t.__callLaterFunctionList = [];
  575. var r = t.__callLaterThisList;
  576. t.__callLaterThisList = [];
  577. var o = t.__callLaterArgsList;
  578. t.__callLaterArgsList = []
  579. }
  580. e = this.stage;
  581. var s = i.cachedEvent;
  582. s._type = t.Event.RENDER;
  583. this.dispatchEvent(s);
  584. t.Stage._invalidateRenderFlag && (this.broadcastRender(), t.Stage._invalidateRenderFlag = !1);
  585. n && this.doCallLaterList(n, r, o);
  586. 0 < t.__callAsyncFunctionList.length && this.doCallAsyncList();
  587. n = this.rendererContext;
  588. n.onRenderStart();
  589. n.clearScreen();
  590. e._updateTransform();
  591. s._type = t.Event.FINISH_UPDATE_TRANSFORM;
  592. this.dispatchEvent(s);
  593. e._draw(n);
  594. s._type = t.Event.FINISH_RENDER;
  595. this.dispatchEvent(s);
  596. n.onRenderFinish()
  597. };
  598. i.prototype.broadcastEnterFrame = function(e) {
  599. e = this.reuseEvent;
  600. e._type = t.Event.ENTER_FRAME;
  601. this.dispatchEvent(e);
  602. for (var i = t.DisplayObject._enterFrameCallBackList.concat(), n = i.length, r = 0; r < n; r++) {
  603. var o = i[r];
  604. e._target = o.display;
  605. e._currentTarget = o.display;
  606. o.listener.call(o.thisObject, e)
  607. }
  608. i = t.Recycler._callBackList;
  609. for (r = i.length - 1; 0 <= r; r--) i[r]._checkFrame()
  610. };
  611. i.prototype.broadcastRender = function() {
  612. var e = this.reuseEvent;
  613. e._type = t.Event.RENDER;
  614. for (var i = t.DisplayObject._renderCallBackList.concat(), n = i.length, r = 0; r < n; r++) {
  615. var o = i[r],
  616. s = o.display;
  617. e._target = s;
  618. e._currentTarget = s;
  619. o.listener.call(o.thisObject, e)
  620. }
  621. };
  622. i.prototype.doCallLaterList = function(t, e, i) {
  623. for (var n = t.length, r = 0; r < n; r++) {
  624. var o = t[r];
  625. null != o && o.apply(e[r], i[r])
  626. }
  627. };
  628. i.prototype.doCallAsyncList = function() {
  629. var e = t.__callAsyncFunctionList.concat(),
  630. i = t.__callAsyncThisList.concat(),
  631. n = t.__callAsyncArgsList.concat();
  632. t.__callAsyncFunctionList.length = 0;
  633. t.__callAsyncThisList.length = 0;
  634. for (var r = t.__callAsyncArgsList.length = 0; r < e.length; r++) {
  635. var o = e[r];
  636. null != o && o.apply(i[r], n[r])
  637. }
  638. };
  639. i.DEVICE_PC = "web";
  640. i.DEVICE_MOBILE = "native";
  641. i.RUNTIME_HTML5 = "runtime_html5";
  642. i.RUNTIME_NATIVE = "runtime_native";
  643. i.cachedEvent = new t.Event("");
  644. return i
  645. }(t.EventDispatcher);
  646. t.MainContext = e;
  647. e.prototype.__class__ = "egret.MainContext"
  648. })(egret || (egret = {}));
  649. var testDeviceType = function() {
  650. if (!this.navigator) return !0;
  651. var t = navigator.userAgent.toLowerCase();
  652. return -1 != t.indexOf("mobile") || -1 != t.indexOf("android")
  653. },
  654. testRuntimeType = function() {
  655. return this.navigator ? !0 : !1
  656. };
  657. egret.MainContext.instance = new egret.MainContext;
  658. egret.MainContext.deviceType = testDeviceType() ? egret.MainContext.DEVICE_MOBILE : egret.MainContext.DEVICE_PC;
  659. egret.MainContext.runtimeType = testRuntimeType() ? egret.MainContext.RUNTIME_HTML5 : egret.MainContext.RUNTIME_NATIVE;
  660. delete testDeviceType;
  661. delete testRuntimeType;
  662. (function(t) {
  663. var e = function() {
  664. function e() {
  665. this._tick = this._preDrawCount = this._updateTransformPerformanceCost = this._renderPerformanceCost = this._logicPerformanceCost = this._lastTime = 0;
  666. this._maxDeltaTime = 500;
  667. this._totalDeltaTime = 0
  668. }
  669. e.getInstance = function() {
  670. null == e.instance && (e.instance = new e);
  671. return e.instance
  672. };
  673. e.prototype.run = function() {
  674. t.Ticker.getInstance().register(this.update, this);
  675. null == this._txt && (this._txt = new t.TextField, this._txt.size = 28, this._txt.multiline = !0, t.MainContext.instance.stage.addChild(this._txt));
  676. var e = t.MainContext.instance;
  677. e.addEventListener(t.Event.ENTER_FRAME, this.onEnterFrame, this);
  678. e.addEventListener(t.Event.RENDER, this.onStartRender, this);
  679. e.addEventListener(t.Event.FINISH_RENDER, this.onFinishRender, this);
  680. e.addEventListener(t.Event.FINISH_UPDATE_TRANSFORM, this.onFinishUpdateTransform, this)
  681. };
  682. e.prototype.onEnterFrame = function(e) {
  683. this._lastTime = t.getTimer()
  684. };
  685. e.prototype.onStartRender = function(e) {
  686. e = t.getTimer();
  687. this._logicPerformanceCost = e - this._lastTime;
  688. this._lastTime = e
  689. };
  690. e.prototype.onFinishUpdateTransform = function(e) {
  691. e = t.getTimer();
  692. this._updateTransformPerformanceCost = e - this._lastTime;
  693. this._lastTime = e
  694. };
  695. e.prototype.onFinishRender = function(e) {
  696. e = t.getTimer();
  697. this._renderPerformanceCost = e - this._lastTime;
  698. this._lastTime = e
  699. };
  700. e.prototype.update = function(e) {
  701. this._tick++;
  702. this._totalDeltaTime += e;
  703. if (this._totalDeltaTime >= this._maxDeltaTime) {
  704. e = (this._preDrawCount - 1).toString();
  705. var i = Math.ceil(this._logicPerformanceCost).toString() + "," + Math.ceil(this._updateTransformPerformanceCost).toString() + "," + Math.ceil(this._renderPerformanceCost).toString() + "," + Math.ceil(t.MainContext.instance.rendererContext.renderCost).toString();
  706. this._txt.text = "draw:" + e + "\ncost:" + i + "\nFPS:" + Math.floor(1e3 * this._tick / this._totalDeltaTime).toString();
  707. this._tick = this._totalDeltaTime = 0
  708. }
  709. this._preDrawCount = 0
  710. };
  711. e.prototype.onDrawImage = function() {
  712. this._preDrawCount++
  713. };
  714. return e
  715. }();
  716. t.Profiler = e;
  717. e.prototype.__class__ = "egret.Profiler"
  718. })(egret || (egret = {}));
  719. __extends = this.__extends || function(t, e) {
  720. function i() {
  721. this.constructor = t
  722. }
  723. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  724. i.prototype = e.prototype;
  725. t.prototype = new i
  726. };
  727. (function(t) {
  728. var e = function(e) {
  729. function i() {
  730. e.apply(this, arguments);
  731. this._timeScale = 1;
  732. this._paused = !1;
  733. this.callBackList = []
  734. }
  735. __extends(i, e);
  736. i.prototype.run = function() {
  737. t.__START_TIME = (new Date).getTime();
  738. t.MainContext.instance.deviceContext.executeMainLoop(this.update, this)
  739. };
  740. i.prototype.update = function(t) {
  741. var e = this.callBackList.concat(),
  742. i = e.length;
  743. t *= this._timeScale;
  744. t *= this._timeScale;
  745. for (var n = 0; n < i; n++) {
  746. var r = e[n];
  747. r.listener.call(r.thisObject, t)
  748. }
  749. };
  750. i.prototype.register = function(t, e, i) {
  751. void 0 === i && (i = 0);
  752. this._insertEventBin(this.callBackList, t, e, i)
  753. };
  754. i.prototype.unregister = function(t, e) {
  755. this._removeEventBin(this.callBackList, t, e)
  756. };
  757. i.prototype.setTimeout = function(e, i, n) {
  758. for (var r = [], o = 3; o < arguments.length; o++) r[o - 3] = arguments[o];
  759. t.Logger.warning("Ticker#setTimeout方法即将废弃,请使用egret.setTimeout");
  760. t.setTimeout.apply(null, [e, i, n].concat(r))
  761. };
  762. i.prototype.setTimeScale = function(t) {
  763. this._timeScale = t
  764. };
  765. i.prototype.getTimeScale = function() {
  766. return this._timeScale
  767. };
  768. i.prototype.pause = function() {
  769. this._paused = !0
  770. };
  771. i.prototype.resume = function() {
  772. this._paused = !1
  773. };
  774. i.getInstance = function() {
  775. null == i.instance && (i.instance = new i);
  776. return i.instance
  777. };
  778. return i
  779. }(t.EventDispatcher);
  780. t.Ticker = e;
  781. e.prototype.__class__ = "egret.Ticker"
  782. })(egret || (egret = {}));
  783. (function(t) {
  784. var e = function() {
  785. function t() {}
  786. t.LEFT = "left";
  787. t.RIGHT = "right";
  788. t.CENTER = "center";
  789. t.JUSTIFY = "justify";
  790. t.CONTENT_JUSTIFY = "contentJustify";
  791. return t
  792. }();
  793. t.HorizontalAlign = e;
  794. e.prototype.__class__ = "egret.HorizontalAlign"
  795. })(egret || (egret = {}));
  796. (function(t) {
  797. var e = function() {
  798. function t() {}
  799. t.TOP = "top";
  800. t.BOTTOM = "bottom";
  801. t.MIDDLE = "middle";
  802. t.JUSTIFY = "justify";
  803. t.CONTENT_JUSTIFY = "contentJustify";
  804. return t
  805. }();
  806. t.VerticalAlign = e;
  807. e.prototype.__class__ = "egret.VerticalAlign"
  808. })(egret || (egret = {}));
  809. __extends = this.__extends || function(t, e) {
  810. function i() {
  811. this.constructor = t
  812. }
  813. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  814. i.prototype = e.prototype;
  815. t.prototype = new i
  816. };
  817. (function(t) {
  818. var e = function(e) {
  819. function i(t, i) {
  820. void 0 === i && (i = 0);
  821. e.call(this);
  822. this._currentCount = 0;
  823. this.delay = t;
  824. this.repeatCount = i
  825. }
  826. __extends(i, e);
  827. i.prototype.currentCount = function() {
  828. return this._currentCount
  829. };
  830. Object.defineProperty(i.prototype, "running", {
  831. get: function() {
  832. return this._running
  833. },
  834. enumerable: !0,
  835. configurable: !0
  836. });
  837. i.prototype.reset = function() {
  838. this.stop();
  839. this._currentCount = 0
  840. };
  841. i.prototype.start = function() {
  842. this._running || (this.lastTime = t.getTimer(), 0 != this._currentCount && (this._currentCount = 0), t.Ticker.getInstance().register(this.onEnterFrame, this), this._running = !0)
  843. };
  844. i.prototype.stop = function() {
  845. this._running && (t.Ticker.getInstance().unregister(this.onEnterFrame, this), this._running = !1)
  846. };
  847. i.prototype.onEnterFrame = function(e) {
  848. e = t.getTimer();
  849. e - this.lastTime > this.delay && (this.lastTime = e, this._currentCount++, t.TimerEvent.dispatchTimerEvent(this, t.TimerEvent.TIMER), 0 < this.repeatCount && this._currentCount >= this.repeatCount && (this.stop(), t.TimerEvent.dispatchTimerEvent(this, t.TimerEvent.TIMER_COMPLETE)))
  850. };
  851. return i
  852. }(t.EventDispatcher);
  853. t.Timer = e;
  854. e.prototype.__class__ = "egret.Timer"
  855. })(egret || (egret = {}));
  856. (function(t) {
  857. function e(t) {
  858. t = t.prototype ? t.prototype : Object.getPrototypeOf(t);
  859. if (t.hasOwnProperty("__class__")) return t.__class__;
  860. var e = t.constructor.toString(),
  861. i = e.indexOf("("),
  862. e = e.substring(9, i);
  863. Object.defineProperty(t, "__class__", {
  864. value: e,
  865. enumerable: !1,
  866. writable: !0
  867. });
  868. return e
  869. }
  870. t.getQualifiedClassName = e;
  871. t.getQualifiedSuperclassName = function(t) {
  872. t = t.prototype ? t.prototype : Object.getPrototypeOf(t);
  873. if (t.hasOwnProperty("__superclass__")) return t.__superclass__;
  874. var i = Object.getPrototypeOf(t);
  875. if (null == i) return null;
  876. i = e(i.constructor);
  877. if (!i) return null;
  878. Object.defineProperty(t, "__superclass__", {
  879. value: i,
  880. enumerable: !1,
  881. writable: !0
  882. });
  883. return i
  884. }
  885. })(egret || (egret = {}));
  886. (function(t) {
  887. var e = {};
  888. t.getDefinitionByName = function(t) {
  889. if (!t) return null;
  890. var i = e[t];
  891. if (i) return i;
  892. for (var n = t.split("."), r = n.length, i = __global, o = 0; o < r; o++)
  893. if (i = i[n[o]], !i) return null;
  894. return e[t] = i
  895. }
  896. })(egret || (egret = {}));
  897. var __global = __global || this;
  898. (function(t) {
  899. function e(t) {
  900. for (var e in i) {
  901. var n = i[e];
  902. n.delay -= t;
  903. 0 >= n.delay && (n.listener.apply(n.thisObject, n.params), delete i[e])
  904. }
  905. }
  906. var i = {},
  907. n = 0;
  908. t.setTimeout = function(r, o, s) {
  909. for (var a = [], h = 3; h < arguments.length; h++) a[h - 3] = arguments[h];
  910. a = {
  911. listener: r,
  912. thisObject: o,
  913. delay: s,
  914. params: a
  915. };
  916. 0 == n && t.Ticker.getInstance().register(e, null);
  917. n++;
  918. i[n] = a;
  919. return n
  920. };
  921. t.clearTimeout = function(t) {
  922. delete i[t]
  923. }
  924. })(egret || (egret = {}));
  925. (function(t) {
  926. t.hasDefinition = function(e) {
  927. return t.getDefinitionByName(e) ? !0 : !1
  928. }
  929. })(egret || (egret = {}));
  930. (function(t) {
  931. t.toColorString = function(t) {
  932. if (isNaN(t) || 0 > t) t = 0;
  933. 16777215 < t && (t = 16777215);
  934. for (t = t.toString(16).toUpperCase(); 6 > t.length;) t = "0" + t;
  935. return "#" + t
  936. }
  937. })(egret || (egret = {}));
  938. __extends = this.__extends || function(t, e) {
  939. function i() {
  940. this.constructor = t
  941. }
  942. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  943. i.prototype = e.prototype;
  944. t.prototype = new i
  945. };
  946. (function(t) {
  947. var e = function(e) {
  948. function i(t, i, n, r, o, s) {
  949. void 0 === t && (t = 1);
  950. void 0 === i && (i = 0);
  951. void 0 === n && (n = 0);
  952. void 0 === r && (r = 1);
  953. void 0 === o && (o = 0);
  954. void 0 === s && (s = 0);
  955. e.call(this);
  956. this.a = t;
  957. this.b = i;
  958. this.c = n;
  959. this.d = r;
  960. this.tx = o;
  961. this.ty = s
  962. }
  963. __extends(i, e);
  964. i.prototype.prepend = function(t, e, i, n, r, o) {
  965. var s = this.tx;
  966. if (1 != t || 0 != e || 0 != i || 1 != n) {
  967. var a = this.a,
  968. h = this.c;
  969. this.a = a * t + this.b * i;
  970. this.b = a * e + this.b * n;
  971. this.c = h * t + this.d * i;
  972. this.d = h * e + this.d * n
  973. }
  974. this.tx = s * t + this.ty * i + r;
  975. this.ty = s * e + this.ty * n + o;
  976. return this
  977. };
  978. i.prototype.append = function(t, e, i, n, r, o) {
  979. var s = this.a,
  980. a = this.b,
  981. h = this.c,
  982. c = this.d;
  983. if (1 != t || 0 != e || 0 != i || 1 != n) this.a = t * s + e * h, this.b = t * a + e * c, this.c = i * s + n * h, this.d = i * a + n * c;
  984. this.tx = r * s + o * h + this.tx;
  985. this.ty = r * a + o * c + this.ty;
  986. return this
  987. };
  988. i.prototype.prependTransform = function(e, i, n, r, o, s, a, h, c) {
  989. if (o % 360) {
  990. var u = t.NumberUtils.cos(o);
  991. o = t.NumberUtils.sin(o)
  992. } else u = 1, o = 0;
  993. if (h || c) this.tx -= h, this.ty -= c;
  994. s || a ? (this.prepend(u * n, o * n, -o * r, u * r, 0, 0), this.prepend(t.NumberUtils.cos(a), t.NumberUtils.sin(a), -t.NumberUtils.sin(s), t.NumberUtils.cos(s), e, i)) : this.prepend(u * n, o * n, -o * r, u * r, e, i);
  995. return this
  996. };
  997. i.prototype.appendTransform = function(e, i, n, r, o, s, a, h, c) {
  998. if (o % 360) {
  999. var u = t.NumberUtils.cos(o);
  1000. o = t.NumberUtils.sin(o)
  1001. } else u = 1, o = 0;
  1002. s || a ? (this.append(t.NumberUtils.cos(a), t.NumberUtils.sin(a), -t.NumberUtils.sin(s), t.NumberUtils.cos(s), e, i), this.append(u * n, o * n, -o * r, u * r, 0, 0)) : this.append(u * n, o * n, -o * r, u * r, e, i);
  1003. if (h || c) this.tx -= h * this.a + c * this.c, this.ty -= h * this.b + c * this.d;
  1004. return this
  1005. };
  1006. i.prototype.rotate = function(t) {
  1007. var e = Math.cos(t);
  1008. t = Math.sin(t);
  1009. var i = this.a,
  1010. n = this.c,
  1011. r = this.tx;
  1012. this.a = i * e - this.b * t;
  1013. this.b = i * t + this.b * e;
  1014. this.c = n * e - this.d * t;
  1015. this.d = n * t + this.d * e;
  1016. this.tx = r * e - this.ty * t;
  1017. this.ty = r * t + this.ty * e;
  1018. return this
  1019. };
  1020. i.prototype.skew = function(e, i) {
  1021. this.append(t.NumberUtils.cos(i), t.NumberUtils.sin(i), -t.NumberUtils.sin(e), t.NumberUtils.cos(e), 0, 0);
  1022. return this
  1023. };
  1024. i.prototype.scale = function(t, e) {
  1025. this.a *= t;
  1026. this.d *= e;
  1027. this.c *= t;
  1028. this.b *= e;
  1029. this.tx *= t;
  1030. this.ty *= e;
  1031. return this
  1032. };
  1033. i.prototype.translate = function(t, e) {
  1034. this.tx += t;
  1035. this.ty += e;
  1036. return this
  1037. };
  1038. i.prototype.identity = function() {
  1039. this.a = this.d = 1;
  1040. this.b = this.c = this.tx = this.ty = 0;
  1041. return this
  1042. };
  1043. i.prototype.identityMatrix = function(t) {
  1044. this.a = t.a;
  1045. this.b = t.b;
  1046. this.c = t.c;
  1047. this.d = t.d;
  1048. this.tx = t.tx;
  1049. this.ty = t.ty;
  1050. return this
  1051. };
  1052. i.prototype.invert = function() {
  1053. var t = this.a,
  1054. e = this.b,
  1055. i = this.c,
  1056. n = this.d,
  1057. r = this.tx,
  1058. o = t * n - e * i;
  1059. this.a = n / o;
  1060. this.b = -e / o;
  1061. this.c = -i / o;
  1062. this.d = t / o;
  1063. this.tx = (i * this.ty - n * r) / o;
  1064. this.ty = -(t * this.ty - e * r) / o;
  1065. return this
  1066. };
  1067. i.transformCoords = function(e, i, n) {
  1068. var r = t.Point.identity;
  1069. r.x = e.a * i + e.c * n + e.tx;
  1070. r.y = e.d * n + e.b * i + e.ty;
  1071. return r
  1072. };
  1073. i.prototype.toArray = function(t) {
  1074. this.array || (this.array = new Float32Array(9));
  1075. t ? (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);
  1076. this.array[8] = 1;
  1077. return this.array
  1078. };
  1079. i.identity = new i;
  1080. i.DEG_TO_RAD = Math.PI / 180;
  1081. return i
  1082. }(t.HashObject);
  1083. t.Matrix = e;
  1084. e.prototype.__class__ = "egret.Matrix"
  1085. })(egret || (egret = {}));
  1086. __extends = this.__extends || function(t, e) {
  1087. function i() {
  1088. this.constructor = t
  1089. }
  1090. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1091. i.prototype = e.prototype;
  1092. t.prototype = new i
  1093. };
  1094. (function(t) {
  1095. var e = function(t) {
  1096. function e(e, i) {
  1097. void 0 === e && (e = 0);
  1098. void 0 === i && (i = 0);
  1099. t.call(this);
  1100. this.x = e;
  1101. this.y = i
  1102. }
  1103. __extends(e, t);
  1104. e.prototype.clone = function() {
  1105. return new e(this.x, this.y)
  1106. };
  1107. e.prototype.equals = function(t) {
  1108. return this.x == t.x && this.y == t.y
  1109. };
  1110. e.distance = function(t, e) {
  1111. return Math.sqrt((t.x - e.x) * (t.x - e.x) + (t.y - e.y) * (t.y - e.y))
  1112. };
  1113. e.identity = new e(0, 0);
  1114. return e
  1115. }(t.HashObject);
  1116. t.Point = e;
  1117. e.prototype.__class__ = "egret.Point"
  1118. })(egret || (egret = {}));
  1119. __extends = this.__extends || function(t, e) {
  1120. function i() {
  1121. this.constructor = t
  1122. }
  1123. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1124. i.prototype = e.prototype;
  1125. t.prototype = new i
  1126. };
  1127. (function(t) {
  1128. var e = function(t) {
  1129. function e(e, i, n, r) {
  1130. void 0 === e && (e = 0);
  1131. void 0 === i && (i = 0);
  1132. void 0 === n && (n = 0);
  1133. void 0 === r && (r = 0);
  1134. t.call(this);
  1135. this.x = e;
  1136. this.y = i;
  1137. this.width = n;
  1138. this.height = r
  1139. }
  1140. __extends(e, t);
  1141. Object.defineProperty(e.prototype, "right", {
  1142. get: function() {
  1143. return this.x + this.width
  1144. },
  1145. set: function(t) {
  1146. this.width = t - this.x
  1147. },
  1148. enumerable: !0,
  1149. configurable: !0
  1150. });
  1151. Object.defineProperty(e.prototype, "bottom", {
  1152. get: function() {
  1153. return this.y + this.height
  1154. },
  1155. set: function(t) {
  1156. this.height = t - this.y
  1157. },
  1158. enumerable: !0,
  1159. configurable: !0
  1160. });
  1161. e.prototype.initialize = function(t, e, i, n) {
  1162. this.x = t;
  1163. this.y = e;
  1164. this.width = i;
  1165. this.height = n;
  1166. return this
  1167. };
  1168. e.prototype.contains = function(t, e) {
  1169. return this.x <= t && this.x + this.width >= t && this.y <= e && this.y + this.height >= e
  1170. };
  1171. e.prototype.intersects = function(t) {
  1172. var e = t.right,
  1173. i = t.bottom,
  1174. n = this.right,
  1175. r = this.bottom;
  1176. return this.contains(t.x, t.y) || this.contains(t.x, i) || this.contains(e, t.y) || this.contains(e, i) || t.contains(this.x, this.y) || t.contains(this.x, r) || t.contains(n, this.y) || t.contains(n, r) ? !0 : !1
  1177. };
  1178. e.prototype.clone = function() {
  1179. return new e(this.x, this.y, this.width, this.height)
  1180. };
  1181. e.prototype.containsPoint = function(t) {
  1182. return this.x < t.x && this.x + this.width > t.x && this.y < t.y && this.y + this.height > t.y ? !0 : !1
  1183. };
  1184. e.identity = new e(0, 0, 0, 0);
  1185. return e
  1186. }(t.HashObject);
  1187. t.Rectangle = e;
  1188. e.prototype.__class__ = "egret.Rectangle"
  1189. })(egret || (egret = {}));
  1190. (function(t) {
  1191. var e = function() {
  1192. function e() {}
  1193. e.fatal = function(e, i) {
  1194. void 0 === i && (i = null);
  1195. t.Logger.traceToConsole("Fatal", e, i);
  1196. throw Error(t.Logger.getTraceCode("Fatal", e, i))
  1197. };
  1198. e.info = function(e, i) {
  1199. void 0 === i && (i = null);
  1200. t.Logger.traceToConsole("Info", e, i)
  1201. };
  1202. e.warning = function(e, i) {
  1203. void 0 === i && (i = null);
  1204. t.Logger.traceToConsole("Warning", e, i)
  1205. };
  1206. e.traceToConsole = function(e, i, n) {
  1207. console.log(t.Logger.getTraceCode(e, i, n))
  1208. };
  1209. e.getTraceCode = function(t, e, i) {
  1210. return "[" + t + "]" + e + ":" + (null == i ? "" : i)
  1211. };
  1212. return e
  1213. }();
  1214. t.Logger = e;
  1215. e.prototype.__class__ = "egret.Logger"
  1216. })(egret || (egret = {}));
  1217. __extends = this.__extends || function(t, e) {
  1218. function i() {
  1219. this.constructor = t
  1220. }
  1221. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1222. i.prototype = e.prototype;
  1223. t.prototype = new i
  1224. };
  1225. (function(t) {
  1226. var e = function(e) {
  1227. function i() {
  1228. e.call(this);
  1229. this._isSupportDOMParser = this._xmlDict = this._parser = null;
  1230. this._xmlDict = {};
  1231. window.DOMParser ? (this._isSupportDOMParser = !0, this._parser = new DOMParser) : this._isSupportDOMParser = !1
  1232. }
  1233. __extends(i, e);
  1234. i.getInstance = function() {
  1235. i._instance || (i._instance = new i);
  1236. return i._instance
  1237. };
  1238. i.prototype.parserXML = function(e) {
  1239. for (var i = 0;
  1240. "\n" == e.charAt(i) || " " == e.charAt(i) || "\r" == e.charAt(i) || " " == e.charAt(i);) i++;
  1241. 0 != i && (e = e.substring(i, e.length));
  1242. this._isSupportDOMParser ? i = this._parser.parseFromString(e, "text/xml") : (i = new ActiveXObject("Microsoft.XMLDOM"), i.async = "false", i.loadXML(e));
  1243. null == i && t.Logger.info("xml not found!");
  1244. return i
  1245. };
  1246. i._instance = null;
  1247. return i
  1248. }(t.HashObject);
  1249. t.SAXParser = e;
  1250. e.prototype.__class__ = "egret.SAXParser"
  1251. })(egret || (egret = {}));
  1252. __extends = this.__extends || function(t, e) {
  1253. function i() {
  1254. this.constructor = t
  1255. }
  1256. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1257. i.prototype = e.prototype;
  1258. t.prototype = new i
  1259. };
  1260. (function(t) {
  1261. var e = function(e) {
  1262. function i() {
  1263. e.call(this);
  1264. this._designHeight = this._designWidth = 0;
  1265. this._scaleY = this._scaleX = 1;
  1266. this._stageHeight = this._stageWidth = this._offSetY = 0
  1267. }
  1268. __extends(i, e);
  1269. i.getInstance = function() {
  1270. null == i.instance && (n.initialize(), i.instance = new i);
  1271. return i.instance
  1272. };
  1273. i.prototype.setDesignSize = function(e, i, n) {
  1274. this._designWidth = e;
  1275. this._designHeight = i;
  1276. n && (t.Logger.warning("该方法目前不应传入 resolutionPolicy 参数,请在 docs/1.0_Final_ReleaseNote中查看如何升级"), this._setResolutionPolicy(n))
  1277. };
  1278. i.prototype._setResolutionPolicy = function(t) {
  1279. this._resolutionPolicy = t;
  1280. t.init(this);
  1281. t._apply(this, this._designWidth, this._designHeight)
  1282. };
  1283. i.prototype.getScaleX = function() {
  1284. return this._scaleX
  1285. };
  1286. i.prototype.getScaleY = function() {
  1287. return this._scaleY
  1288. };
  1289. i.prototype.getOffSetY = function() {
  1290. return this._offSetY
  1291. };
  1292. i.canvas_name = "egretCanvas";
  1293. i.canvas_div_name = "gameDiv";
  1294. return i
  1295. }(t.HashObject);
  1296. t.StageDelegate = e;
  1297. e.prototype.__class__ = "egret.StageDelegate";
  1298. var i = function() {
  1299. function t(t, e) {
  1300. this._containerStrategy = t;
  1301. this._contentStrategy = e
  1302. }
  1303. t.prototype.init = function(t) {
  1304. this._containerStrategy.init(t);
  1305. this._contentStrategy.init(t)
  1306. };
  1307. t.prototype._apply = function(t, e, i) {
  1308. this._containerStrategy._apply(t, e, i);
  1309. this._contentStrategy._apply(t, e, i)
  1310. };
  1311. return t
  1312. }();
  1313. t.ResolutionPolicy = i;
  1314. i.prototype.__class__ = "egret.ResolutionPolicy";
  1315. var n = function() {
  1316. function t() {}
  1317. t.initialize = function() {
  1318. t.EQUAL_TO_FRAME = new r
  1319. };
  1320. t.prototype.init = function(t) {};
  1321. t.prototype._apply = function(t, e, i) {};
  1322. t.prototype._setupContainer = function() {
  1323. var t = document.body,
  1324. e;
  1325. t && (e = t.style) && (e.paddingTop = e.paddingTop || "0px", e.paddingRight = e.paddingRight || "0px", e.paddingBottom = e.paddingBottom || "0px", e.paddingLeft = e.paddingLeft || "0px", e.borderTop = e.borderTop || "0px", e.borderRight = e.borderRight || "0px", e.borderBottom = e.borderBottom || "0px", e.borderLeft = e.borderLeft || "0px", e.marginTop = e.marginTop || "0px", e.marginRight = e.marginRight || "0px", e.marginBottom = e.marginBottom || "0px", e.marginLeft = e.marginLeft || "0px")
  1326. };
  1327. return t
  1328. }();
  1329. t.ContainerStrategy = n;
  1330. n.prototype.__class__ = "egret.ContainerStrategy";
  1331. var r = function(t) {
  1332. function e() {
  1333. t.apply(this, arguments)
  1334. }
  1335. __extends(e, t);
  1336. e.prototype._apply = function(t) {
  1337. this._setupContainer()
  1338. };
  1339. return e
  1340. }(n);
  1341. t.EqualToFrame = r;
  1342. r.prototype.__class__ = "egret.EqualToFrame";
  1343. i = function() {
  1344. function i() {}
  1345. i.prototype.init = function(t) {};
  1346. i.prototype._apply = function(t, e, i) {};
  1347. i.prototype.setEgretSize = function(i, n, r, o, s, a) {
  1348. void 0 === a && (a = 0);
  1349. t.StageDelegate.getInstance()._stageWidth = Math.round(i);
  1350. t.StageDelegate.getInstance()._stageHeight = Math.round(n);
  1351. i = document.getElementById(e.canvas_div_name);
  1352. i.style.width = r + "px";
  1353. i.style.height = o + "px";
  1354. i.style.top = a + "px"
  1355. };
  1356. i.prototype._getClientWidth = function() {
  1357. return document.documentElement.clientWidth
  1358. };
  1359. i.prototype._getClientHeight = function() {
  1360. return document.documentElement.clientHeight
  1361. };
  1362. return i
  1363. }();
  1364. t.ContentStrategy = i;
  1365. i.prototype.__class__ = "egret.ContentStrategy";
  1366. var o = function(t) {
  1367. function e(e) {
  1368. void 0 === e && (e = 0);
  1369. t.call(this);
  1370. this.minWidth = e
  1371. }
  1372. __extends(e, t);
  1373. e.prototype._apply = function(t, e, i) {
  1374. e = this._getClientWidth();
  1375. var n = this._getClientHeight(),
  1376. r = n / i,
  1377. o = e / r,
  1378. s = 1;
  1379. 0 != this.minWidth && (s = Math.min(1, o / this.minWidth));
  1380. this.setEgretSize(o / s, i, e, n * s);
  1381. t._scaleX = r * s;
  1382. t._scaleY = r * s
  1383. };
  1384. return e
  1385. }(i);
  1386. t.FixedHeight = o;
  1387. o.prototype.__class__ = "egret.FixedHeight";
  1388. o = function(t) {
  1389. function e(e) {
  1390. void 0 === e && (e = 0);
  1391. t.call(this);
  1392. this.minHeight = e
  1393. }
  1394. __extends(e, t);
  1395. e.prototype._apply = function(t, e, i) {
  1396. i = this._getClientWidth();
  1397. var n = this._getClientHeight(),
  1398. r = i / e,
  1399. o = n / r,
  1400. s = 1;
  1401. 0 != this.minHeight && (s = Math.min(1, o / this.minHeight));
  1402. this.setEgretSize(e, o / s, i * s, n, i * (1 - s) / 2);
  1403. t._scaleX = r * s;
  1404. t._scaleY = r * s
  1405. };
  1406. return e
  1407. }(i);
  1408. t.FixedWidth = o;
  1409. o.prototype.__class__ = "egret.FixedWidth";
  1410. o = function(t) {
  1411. function e(e, i) {
  1412. t.call(this);
  1413. this.width = e;
  1414. this.height = i
  1415. }
  1416. __extends(e, t);
  1417. e.prototype._apply = function(t, e, i) {
  1418. i = this.width;
  1419. var n = this.height,
  1420. r = i / e;
  1421. this.setEgretSize(e, n / r, i, n);
  1422. t._scaleX = r;
  1423. t._scaleY = r
  1424. };
  1425. return e
  1426. }(i);
  1427. t.FixedSize = o;
  1428. o.prototype.__class__ = "egret.FixedSize";
  1429. o = function(t) {
  1430. function e() {
  1431. t.call(this)
  1432. }
  1433. __extends(e, t);
  1434. e.prototype._apply = function(t, e, i) {
  1435. this.setEgretSize(e, i, e, i, Math.floor((e - e) / 2));
  1436. t._scaleX = 1;
  1437. t._scaleY = 1
  1438. };
  1439. return e
  1440. }(i);
  1441. t.NoScale = o;
  1442. o.prototype.__class__ = "egret.NoScale";
  1443. o = function(t) {
  1444. function e() {
  1445. t.call(this)
  1446. }
  1447. __extends(e, t);
  1448. e.prototype._apply = function(t, e, i) {
  1449. var n = this._getClientWidth(),
  1450. r = this._getClientHeight(),
  1451. o = n,
  1452. s = r,
  1453. a = o / e < s / i ? o / e : s / i,
  1454. o = e * a,
  1455. s = i * a,
  1456. n = Math.floor((n - o) / 2);
  1457. t._offSetY = Math.floor((r - s) / 2);
  1458. this.setEgretSize(e, i / 1, 1 * o, s, n, t._offSetY);
  1459. t._scaleX = 1 * a;
  1460. t._scaleY = 1 * a
  1461. };
  1462. return e
  1463. }(i);
  1464. t.ShowAll = o;
  1465. o.prototype.__class__ = "egret.ShowAll";
  1466. i = function(t) {
  1467. function e() {
  1468. t.call(this)
  1469. }
  1470. __extends(e, t);
  1471. e.prototype._apply = function(t, e, i) {
  1472. var n = this._getClientWidth(),
  1473. r = this._getClientHeight(),
  1474. n = n / e,
  1475. r = r / i;
  1476. this.setEgretSize(e, i, e * n, i * r);
  1477. t._scaleX = n;
  1478. t._scaleY = r
  1479. };
  1480. return e
  1481. }(i);
  1482. t.FullScreen = i;
  1483. i.prototype.__class__ = "egret.FullScreen"
  1484. })(egret || (egret = {}));
  1485. __extends = this.__extends || function(t, e) {
  1486. function i() {
  1487. this.constructor = t
  1488. }
  1489. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1490. i.prototype = e.prototype;
  1491. t.prototype = new i
  1492. };
  1493. (function(t) {
  1494. var e = function(e) {
  1495. function i() {
  1496. e.call(this);
  1497. this._originalData = {};
  1498. this._drawAreaList = []
  1499. }
  1500. __extends(i, e);
  1501. i.getInstance = function() {
  1502. null == i.instance && (i.instance = new i);
  1503. return i.instance
  1504. };
  1505. i.prototype.addDrawArea = function(t) {
  1506. this._drawAreaList.push(t)
  1507. };
  1508. i.prototype.clearDrawArea = function() {
  1509. this._drawAreaList = []
  1510. };
  1511. i.prototype.drawImage = function(e, i, n, r, o, s, a, h, c, u, l) {
  1512. void 0 === l && (l = void 0);
  1513. a = a || 0;
  1514. h = h || 0;
  1515. var p = i._texture_to_render;
  1516. if (null != p && 0 != s && 0 != o && 0 != c && 0 != u) {
  1517. var _ = t.MainContext.instance.rendererContext.texture_scale_factor;
  1518. o /= _;
  1519. s /= _;
  1520. if (0 != this._drawAreaList.length && t.MainContext.instance.rendererContext._cacheCanvasContext) {
  1521. _ = t.DisplayObject.getTransformBounds(i._getSize(t.Rectangle.identity), i._worldTransform);
  1522. i._worldBounds.initialize(_.x, _.y, _.width, _.height);
  1523. _ = this._originalData;
  1524. _.sourceX = n;
  1525. _.sourceY = r;
  1526. _.sourceWidth = o;
  1527. _.sourceHeight = s;
  1528. _.destX = a;
  1529. _.destY = h;
  1530. _.destWidth = c;
  1531. _.destHeight = u;
  1532. for (var d = this.getDrawAreaList(), f = 0; f < d.length; f++)
  1533. if (!this.ignoreRender(i, d[f], _.destX, _.destY)) {
  1534. e.drawImage(p, n, r, o, s, a, h, c, u, l);
  1535. break
  1536. }
  1537. } else e.drawImage(p, n, r, o, s, a, h, c, u, l)
  1538. }
  1539. };
  1540. i.prototype.ignoreRender = function(t, e, i, n) {
  1541. var r = t._worldBounds;
  1542. i *= t._worldTransform.a;
  1543. n *= t._worldTransform.d;
  1544. return r.x + r.width + i <= e.x || r.x + i >= e.x + e.width || r.y + r.height + n <= e.y || r.y + n >= e.y + e.height ? !0 : !1
  1545. };
  1546. i.prototype.getDrawAreaList = function() {
  1547. var e;
  1548. 0 == this._drawAreaList.length ? (this._defaultDrawAreaList || (this._defaultDrawAreaList = [new t.Rectangle(0, 0, t.MainContext.instance.stage.stageWidth, t.MainContext.instance.stage.stageHeight)], t.MainContext.instance.stage.addEventListener(t.Event.RESIZE, this.onResize, this)), e = this._defaultDrawAreaList) : e = this._drawAreaList;
  1549. return e
  1550. };
  1551. i.prototype.onResize = function() {
  1552. t.MainContext.instance.stage.removeEventListener(t.Event.RESIZE, this.onResize, this);
  1553. this._defaultDrawAreaList = null
  1554. };
  1555. return i
  1556. }(t.HashObject);
  1557. t.RenderFilter = e;
  1558. e.prototype.__class__ = "egret.RenderFilter"
  1559. })(egret || (egret = {}));
  1560. (function(t) {
  1561. var e = function() {
  1562. function e() {}
  1563. e.mapClass = function(t, e, i) {
  1564. void 0 === i && (i = "");
  1565. t = this.getKey(t) + "#" + i;
  1566. this.mapClassDic[t] = e
  1567. };
  1568. e.getKey = function(e) {
  1569. return "string" == typeof e ? e : t.getQualifiedClassName(e)
  1570. };
  1571. e.mapValue = function(t, e, i) {
  1572. void 0 === i && (i = "");
  1573. t = this.getKey(t) + "#" + i;
  1574. this.mapValueDic[t] = e
  1575. };
  1576. e.hasMapRule = function(t, e) {
  1577. void 0 === e && (e = "");
  1578. var i = this.getKey(t) + "#" + e;
  1579. return this.mapValueDic[i] || this.mapClassDic[i] ? !0 : !1
  1580. };
  1581. e.getInstance = function(t, e) {
  1582. void 0 === e && (e = "");
  1583. var i = this.getKey(t) + "#" + e;
  1584. if (this.mapValueDic[i]) return this.mapValueDic[i];
  1585. var n = this.mapClassDic[i];
  1586. if (n) return n = new n, this.mapValueDic[i] = n, delete this.mapClassDic[i], n;
  1587. throw Error("调用了未配置的注入规则:" + i + "。 请先在项目初始化里配置指定的注入规则,再调用对应单例。")
  1588. };
  1589. e.mapClassDic = {};
  1590. e.mapValueDic = {};
  1591. return e
  1592. }();
  1593. t.Injector = e;
  1594. e.prototype.__class__ = "egret.Injector"
  1595. })(egret || (egret = {}));
  1596. (function(t) {
  1597. var e = function() {
  1598. function t() {}
  1599. t.NORMAL = "normal";
  1600. t.ADD = "add";
  1601. return t
  1602. }();
  1603. t.BlendMode = e;
  1604. e.prototype.__class__ = "egret.BlendMode"
  1605. })(egret || (egret = {}));
  1606. __extends = this.__extends || function(t, e) {
  1607. function i() {
  1608. this.constructor = t
  1609. }
  1610. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  1611. i.prototype = e.prototype;
  1612. t.prototype = new i
  1613. };
  1614. (function(t) {
  1615. var e = function(e) {
  1616. function i() {
  1617. e.call(this);
  1618. this.__hack_local_matrix = null;
  1619. this._sizeDirty = this._normalDirty = !0;
  1620. this._parent = this._texture_to_render = null;
  1621. this._y = this._x = 0;
  1622. this._scaleY = this._scaleX = 1;
  1623. this._anchorY = this._anchorX = this._anchorOffsetY = this._anchorOffsetX = 0;
  1624. this._visible = !0;
  1625. this._rotation = 0;
  1626. this._alpha = 1;
  1627. this._skewY = this._skewX = 0;
  1628. this._touchEnabled = !1;
  1629. this._scrollRect = this.blendMode = null;
  1630. this._hasHeightSet = this._hasWidthSet = !1;
  1631. this._worldBounds = this.mask = null;
  1632. this.worldAlpha = 1;
  1633. this._rectH = this._rectW = 0;
  1634. this._stage = null;
  1635. this._cacheDirty = this._cacheAsBitmap = !1;
  1636. this._colorTransform = null;
  1637. this._worldTransform = new t.Matrix;
  1638. this._worldBounds = new t.Rectangle(0, 0, 0, 0);
  1639. this._cacheBounds = new t.Rectangle(0, 0, 0, 0)
  1640. }
  1641. __extends(i, e);
  1642. i.prototype._setDirty = function() {
  1643. this._normalDirty = !0
  1644. };
  1645. i.prototype.getDirty = function() {
  1646. return this._normalDirty || this._sizeDirty
  1647. };
  1648. i.prototype._setParentSizeDirty = function() {
  1649. var t = this._parent;
  1650. !t || t._hasWidthSet || t._hasHeightSet || t._setSizeDirty()
  1651. };
  1652. i.prototype._setSizeDirty = function() {
  1653. this._sizeDirty || (this._sizeDirty = !0, this._setDirty(), this._setCacheDirty(), this._setParentSizeDirty())
  1654. };
  1655. i.prototype._clearDirty = function() {
  1656. this._normalDirty = !1
  1657. };
  1658. i.prototype._clearSizeDirty = function() {
  1659. this._sizeDirty = !1
  1660. };
  1661. Object.defineProperty(i.prototype, "parent", {
  1662. get: function() {
  1663. return this._parent
  1664. },
  1665. enumerable: !0,
  1666. configurable: !0
  1667. });
  1668. i.prototype._parentChanged = function(t) {
  1669. this._parent = t
  1670. };
  1671. Object.defineProperty(i.prototype, "x", {
  1672. get: function() {
  1673. return this._x
  1674. },
  1675. set: function(t) {
  1676. this._setX(t)
  1677. },
  1678. enumerable: !0,
  1679. configurable: !0
  1680. });
  1681. i.prototype._setX = function(e) {
  1682. t.NumberUtils.isNumber(e) && this._x != e && (this._x = e, this._setDirty(), this._setParentSizeDirty())
  1683. };
  1684. Object.defineProperty(i.prototype, "y", {
  1685. get: function() {
  1686. return this._y
  1687. },
  1688. set: function(t) {
  1689. this._setY(t)
  1690. },
  1691. enumerable: !0,
  1692. configurable: !0
  1693. });
  1694. i.prototype._setY = function(e) {
  1695. t.NumberUtils.isNumber(e) && this._y != e && (this._y = e, this._setDirty(), this._setParentSizeDirty())
  1696. };
  1697. Object.defineProperty(i.prototype, "scaleX", {
  1698. get: function() {
  1699. return this._scaleX
  1700. },
  1701. set: function(e) {
  1702. t.NumberUtils.isNumber(e) && this._scaleX != e && (this._scaleX = e, this._setDirty(), this._setParentSizeDirty())
  1703. },
  1704. enumerable: !0,
  1705. configurable: !0
  1706. });
  1707. Object.defineProperty(i.prototype, "scaleY", {
  1708. get: function() {
  1709. return this._scaleY
  1710. },
  1711. set: function(e) {
  1712. t.NumberUtils.isNumber(e) && this._scaleY != e && (this._scaleY = e, this._setDirty(), this._setParentSizeDirty())
  1713. },
  1714. enumerable: !0,
  1715. configurable: !0
  1716. });
  1717. Object.defineProperty(i.prototype, "anchorOffsetX", {
  1718. get: function() {
  1719. return this._anchorOffsetX
  1720. },
  1721. set: function(e) {
  1722. t.NumberUtils.isNumber(e) && this._anchorOffsetX != e && (this._anchorOffsetX = e, this._setDirty(), this._setParentSizeDirty())
  1723. },
  1724. enumerable: !0,
  1725. configurable: !0
  1726. });
  1727. Object.defineProperty(i.prototype, "anchorOffsetY", {
  1728. get: function() {
  1729. return this._anchorOffsetY
  1730. },
  1731. set: function(e) {
  1732. t.NumberUtils.isNumber(e) && this._anchorOffsetY != e && (this._anchorOffsetY = e, this._setDirty(), this._setParentSizeDirty())
  1733. },
  1734. enumerable: !0,
  1735. configurable: !0
  1736. });
  1737. Object.defineProperty(i.prototype, "anchorX", {
  1738. get: function() {
  1739. return this._anchorX
  1740. },
  1741. set: function(t) {
  1742. this._setAnchorX(t)
  1743. },
  1744. enumerable: !0,
  1745. configurable: !0
  1746. });
  1747. i.prototype._setAnchorX = function(e) {
  1748. t.NumberUtils.isNumber(e) && this._anchorX != e && (this._anchorX = e, this._setDirty(), this._setParentSizeDirty())
  1749. };
  1750. Object.defineProperty(i.prototype, "anchorY", {
  1751. get: function() {
  1752. return this._anchorY
  1753. },
  1754. set: function(t) {
  1755. this._setAnchorY(t)
  1756. },
  1757. enumerable: !0,
  1758. configurable: !0
  1759. });
  1760. i.prototype._setAnchorY = function(e) {
  1761. t.NumberUtils.isNumber(e) && this._anchorY != e && (this._anchorY = e, this._setDirty(), this._setParentSizeDirty())
  1762. };
  1763. Object.defineProperty(i.prototype, "visible", {
  1764. get: function() {
  1765. return this._visible
  1766. },
  1767. set: function(t) {
  1768. this._setVisible(t)
  1769. },
  1770. enumerable: !0,
  1771. configurable: !0
  1772. });
  1773. i.prototype._setVisible = function(t) {
  1774. this._visible != t && (this._visible = t, this._setSizeDirty())
  1775. };
  1776. Object.defineProperty(i.prototype, "rotation", {
  1777. get: function() {
  1778. return this._rotation
  1779. },
  1780. set: function(e) {
  1781. t.NumberUtils.isNumber(e) && this._rotation != e && (this._rotation = e, this._setSizeDirty())
  1782. },
  1783. enumerable: !0,
  1784. configurable: !0
  1785. });
  1786. Object.defineProperty(i.prototype, "alpha", {
  1787. get: function() {
  1788. return this._alpha
  1789. },
  1790. set: function(e) {
  1791. t.NumberUtils.isNumber(e) && this._alpha != e && (this._alpha = e, this._setDirty(), this._setCacheDirty())
  1792. },
  1793. enumerable: !0,
  1794. configurable: !0
  1795. });
  1796. Object.defineProperty(i.prototype, "skewX", {
  1797. get: function() {
  1798. return this._skewX
  1799. },
  1800. set: function(e) {
  1801. t.NumberUtils.isNumber(e) && this._skewX != e && (this._skewX = e, this._setSizeDirty())
  1802. },
  1803. enumerable: !0,
  1804. configurable: !0
  1805. });
  1806. Object.defineProperty(i.prototype, "skewY", {
  1807. get: function() {
  1808. return this._skewY
  1809. },
  1810. set: function(e) {
  1811. t.NumberUtils.isNumber(e) && this._skewY != e && (this._skewY = e, this._setSizeDirty())
  1812. },
  1813. enumerable: !0,
  1814. configurable: !0
  1815. });
  1816. Object.defineProperty(i.prototype, "touchEnabled", {
  1817. get: function() {
  1818. return this._touchEnabled
  1819. },
  1820. set: function(t) {
  1821. this._setTouchEnabled(t)
  1822. },
  1823. enumerable: !0,
  1824. configurable: !0
  1825. });
  1826. i.prototype._setTouchEnabled = function(t) {
  1827. this._touchEnabled = t
  1828. };
  1829. Object.defineProperty(i.prototype, "scrollRect", {
  1830. get: function() {
  1831. return this._scrollRect
  1832. },
  1833. set: function(t) {
  1834. this._setScrollRect(t)
  1835. },
  1836. enumerable: !0,
  1837. configurable: !0
  1838. });
  1839. i.prototype._setScrollRect = function(t) {
  1840. this._scrollRect = t;
  1841. this._setSizeDirty()
  1842. };
  1843. Object.defineProperty(i.prototype, "measuredWidth", {
  1844. get: function() {
  1845. return this._measureBounds().width
  1846. },
  1847. enumerable: !0,
  1848. configurable: !0
  1849. });
  1850. Object.defineProperty(i.prototype, "measuredHeight", {
  1851. get: function() {
  1852. return this._measureBounds().height
  1853. },
  1854. enumerable: !0,
  1855. configurable: !0
  1856. });
  1857. Object.defineProperty(i.prototype, "explicitWidth", {
  1858. get: function() {
  1859. return this._explicitWidth
  1860. },
  1861. enumerable: !0,
  1862. configurable: !0
  1863. });
  1864. Object.defineProperty(i.prototype, "explicitHeight", {
  1865. get: function() {
  1866. return this._explicitHeight
  1867. },
  1868. enumerable: !0,
  1869. configurable: !0
  1870. });
  1871. Object.defineProperty(i.prototype, "width", {
  1872. get: function() {
  1873. return this._getSize(t.Rectangle.identity).width
  1874. },
  1875. set: function(t) {
  1876. this._setWidth(t)
  1877. },
  1878. enumerable: !0,
  1879. configurable: !0
  1880. });
  1881. Object.defineProperty(i.prototype, "height", {
  1882. get: function() {
  1883. return this._getSize(t.Rectangle.identity).height
  1884. },
  1885. set: function(t) {
  1886. this._setHeight(t)
  1887. },
  1888. enumerable: !0,
  1889. configurable: !0
  1890. });
  1891. i.prototype._setWidth = function(e) {
  1892. this._setSizeDirty();
  1893. this._setCacheDirty();
  1894. this._explicitWidth = e;
  1895. this._hasWidthSet = t.NumberUtils.isNumber(e)
  1896. };
  1897. i.prototype._setHeight = function(e) {
  1898. this._setSizeDirty();
  1899. this._setCacheDirty();
  1900. this._explicitHeight = e;
  1901. this._hasHeightSet = t.NumberUtils.isNumber(e)
  1902. };
  1903. i.prototype._draw = function(t) {
  1904. if (this._visible && !this.drawCacheTexture(t)) {
  1905. this._colorTransform && t.setGlobalColorTransform(this._colorTransform.matrix);
  1906. t.setAlpha(this.worldAlpha, this.blendMode);
  1907. t.setTransform(this._worldTransform);
  1908. var e = this.mask || this._scrollRect;
  1909. e && t.pushMask(e);
  1910. this._render(t);
  1911. e && t.popMask();
  1912. this._colorTransform && t.setGlobalColorTransform(null)
  1913. }
  1914. this.destroyCacheBounds()
  1915. };
  1916. i.prototype.drawCacheTexture = function(e) {
  1917. if (!1 == this._cacheAsBitmap) return !1;
  1918. if (this._cacheDirty || null == this._texture_to_render || Math.round(this.width) != Math.round(this._texture_to_render._sourceWidth) || Math.round(this.height) != Math.round(this._texture_to_render._sourceHeight)) this._cacheDirty = !this._makeBitmapCache();
  1919. if (null == this._texture_to_render) return !1;
  1920. var i = this._texture_to_render,
  1921. n = i._offsetX,
  1922. r = i._offsetY,
  1923. o = i._textureWidth,
  1924. i = i._textureHeight;
  1925. this._updateTransform();
  1926. e.setAlpha(this.worldAlpha, this.blendMode);
  1927. e.setTransform(this._worldTransform);
  1928. var s = t.MainContext.instance.rendererContext.texture_scale_factor;
  1929. t.RenderFilter.getInstance().drawImage(e, this, 0, 0, o * s, i * s, n, r, o, i);
  1930. return !0
  1931. };
  1932. i.prototype._updateTransform = function() {
  1933. this._calculateWorldTransform()
  1934. };
  1935. i.prototype._calculateWorldTransform = function() {
  1936. var t = this._worldTransform,
  1937. e = this._parent;
  1938. t.identityMatrix(e._worldTransform);
  1939. this._getMatrix(t);
  1940. var i = this._scrollRect;
  1941. i && t.append(1, 0, 0, 1, -i.x, -i.y);
  1942. this.worldAlpha = e.worldAlpha * this._alpha
  1943. };
  1944. i.prototype._render = function(t) {};
  1945. i.prototype.getBounds = function(e, i) {
  1946. void 0 === i && (i = !0);
  1947. var n = this._measureBounds(),
  1948. r = this._hasWidthSet ? this._explicitWidth : n.width,
  1949. o = this._hasHeightSet ? this._explicitHeight : n.height;
  1950. this._rectW = n.width;
  1951. this._rectH = n.height;
  1952. this._clearSizeDirty();
  1953. var s = n.x,
  1954. n = n.y,
  1955. a = 0,
  1956. h = 0;
  1957. i && (0 != this._anchorX || 0 != this._anchorY ? (a = r * this._anchorX, h = o * this._anchorY) : (a = this._anchorOffsetX, h = this._anchorOffsetY));
  1958. this._cacheBounds.initialize(s - a, n - h, r, o);
  1959. r = this._cacheBounds;
  1960. e || (e = new t.Rectangle);
  1961. return e.initialize(r.x, r.y, r.width, r.height)
  1962. };
  1963. i.prototype.destroyCacheBounds = function() {
  1964. this._cacheBounds.x = 0;
  1965. this._cacheBounds.y = 0;
  1966. this._cacheBounds.width = 0;
  1967. this._cacheBounds.height = 0
  1968. };
  1969. i.prototype._getConcatenatedMatrix = function() {
  1970. for (var e = i.identityMatrixForGetConcatenated.identity(), n = this; null != n;) {
  1971. if (0 != n._anchorX || 0 != n._anchorY) {
  1972. var r = n._getSize(t.Rectangle.identity);
  1973. e.prependTransform(n._x, n._y, n._scaleX, n._scaleY, n._rotation, n._skewX, n._skewY, r.width * n._anchorX, r.height * n._anchorY)
  1974. } else e.prependTransform(n._x, n._y, n._scaleX, n._scaleY, n._rotation, n._skewX, n._skewY, n._anchorOffsetX, n._anchorOffsetY);
  1975. n._scrollRect && e.prepend(1, 0, 0, 1, -n._scrollRect.x, -n._scrollRect.y);
  1976. n = n._parent
  1977. }
  1978. return e
  1979. };
  1980. i.prototype.localToGlobal = function(e, i, n) {
  1981. void 0 === e && (e = 0);
  1982. void 0 === i && (i = 0);
  1983. var r = this._getConcatenatedMatrix();
  1984. r.append(1, 0, 0, 1, e, i);
  1985. n || (n = new t.Point);
  1986. n.x = r.tx;
  1987. n.y = r.ty;
  1988. return n
  1989. };
  1990. i.prototype.globalToLocal = function(e, i, n) {
  1991. void 0 === e && (e = 0);
  1992. void 0 === i && (i = 0);
  1993. var r = this._getConcatenatedMatrix();
  1994. r.invert();
  1995. r.append(1, 0, 0, 1, e, i);
  1996. n || (n = new t.Point);
  1997. n.x = r.tx;
  1998. n.y = r.ty;
  1999. return n
  2000. };
  2001. i.prototype.hitTest = function(e, i, n) {
  2002. void 0 === n && (n = !1);
  2003. if (!this._visible || !n && !this._touchEnabled) return null;
  2004. n = this._getSize(t.Rectangle.identity);
  2005. return 0 <= e && e < n.width && 0 <= i && i < n.height ? this.mask || this._scrollRect ? this._scrollRect && e > this._scrollRect.x && i > this._scrollRect.y && e < this._scrollRect.x + this._scrollRect.width && i < this._scrollRect.y + this._scrollRect.height || this.mask && this.mask.x <= e && e < this.mask.x + this.mask.width && this.mask.y <= i && i < this.mask.y + this.mask.height ? this : null : this : null
  2006. };
  2007. i.prototype.hitTestPoint = function(e, i, n) {
  2008. e = this.globalToLocal(e, i);
  2009. return n ? (this._hitTestPointTexture || (this._hitTestPointTexture = new t.RenderTexture), n = this._hitTestPointTexture, n.drawToTexture(this), 0 != n.getPixel32(e.x - this._hitTestPointTexture._offsetX, e.y - this._hitTestPointTexture._offsetY)[3] ? !0 : !1) : !!this.hitTest(e.x, e.y, !0)
  2010. };
  2011. i.prototype._getMatrix = function(e) {
  2012. e || (e = t.Matrix.identity.identity());
  2013. var i, n;
  2014. n = this._getOffsetPoint();
  2015. i = n.x;
  2016. n = n.y;
  2017. var r = this.__hack_local_matrix;
  2018. r ? (e.append(r.a, r.b, r.c, r.d, r.tx, r.ty), e.append(1, 0, 0, 1, -i, -n)) : e.appendTransform(this._x, this._y, this._scaleX, this._scaleY, this._rotation, this._skewX, this._skewY, i, n);
  2019. return e
  2020. };
  2021. i.prototype._getSize = function(t) {
  2022. return this._hasHeightSet && this._hasWidthSet ? t.initialize(0, 0, this._explicitWidth, this._explicitHeight) : this._measureSize(t)
  2023. };
  2024. i.prototype._measureSize = function(t) {
  2025. this._sizeDirty ? (t = this._measureBounds(), this._rectW = t.width, this._rectH = t.height, this._clearSizeDirty()) : (t.width = this._rectW, t.height = this._rectH);
  2026. t.x = 0;
  2027. t.y = 0;
  2028. return t
  2029. };
  2030. i.prototype._measureBounds = function() {
  2031. return t.Rectangle.identity.initialize(0, 0, 0, 0)
  2032. };
  2033. i.prototype._getOffsetPoint = function() {
  2034. var e = this._anchorOffsetX,
  2035. i = this._anchorOffsetY;
  2036. if (0 != this._anchorX || 0 != this._anchorY) i = this._getSize(t.Rectangle.identity), e = this._anchorX * i.width, i = this._anchorY * i.height;
  2037. var n = t.Point.identity;
  2038. n.x = e;
  2039. n.y = i;
  2040. return n
  2041. };
  2042. i.prototype._onAddToStage = function() {
  2043. this._stage = t.MainContext.instance.stage;
  2044. t.DisplayObjectContainer.__EVENT__ADD_TO_STAGE_LIST.push(this)
  2045. };
  2046. i.prototype._onRemoveFromStage = function() {
  2047. t.DisplayObjectContainer.__EVENT__REMOVE_FROM_STAGE_LIST.push(this)
  2048. };
  2049. Object.defineProperty(i.prototype, "stage", {
  2050. get: function() {
  2051. return this._stage
  2052. },
  2053. enumerable: !0,
  2054. configurable: !0
  2055. });
  2056. i.prototype.addEventListener = function(n, r, o, s, a) {
  2057. void 0 === s && (s = !1);
  2058. void 0 === a && (a = 0);
  2059. e.prototype.addEventListener.call(this, n, r, o, s, a);
  2060. ((s = n == t.Event.ENTER_FRAME) || n == t.Event.RENDER) && this._insertEventBin(s ? i._enterFrameCallBackList : i._renderCallBackList, r, o, a, this)
  2061. };
  2062. i.prototype.removeEventListener = function(n, r, o, s) {
  2063. void 0 === s && (s = !1);
  2064. e.prototype.removeEventListener.call(this, n, r, o, s);
  2065. ((s = n == t.Event.ENTER_FRAME) || n == t.Event.RENDER) && this._removeEventBin(s ? i._enterFrameCallBackList : i._renderCallBackList, r, o, this)
  2066. };
  2067. i.prototype.dispatchEvent = function(t) {
  2068. if (!t._bubbles) return e.prototype.dispatchEvent.call(this, t);
  2069. for (var i = [], n = this; n;) i.push(n), n = n._parent;
  2070. t._reset();
  2071. this._dispatchPropagationEvent(t, i);
  2072. return !t._isDefaultPrevented
  2073. };
  2074. i.prototype._dispatchPropagationEvent = function(t, e, i) {
  2075. i = e.length;
  2076. for (var n = 1, r = i - 1; 0 <= r; r--) {
  2077. var o = e[r];
  2078. t._currentTarget = o;
  2079. t._target = this;
  2080. t._eventPhase = n;
  2081. o._notifyListener(t);
  2082. if (t._isPropagationStopped || t._isPropagationImmediateStopped) return
  2083. }
  2084. o = e[0];
  2085. t._currentTarget = o;
  2086. t._target = this;
  2087. t._eventPhase = 2;
  2088. o._notifyListener(t);
  2089. if (!t._isPropagationStopped && !t._isPropagationImmediateStopped)
  2090. for (n = 3, r = 1; r < i && (o = e[r], t._currentTarget = o, t._target = this, t._eventPhase = n, o._notifyListener(t), !t._isPropagationStopped && !t._isPropagationImmediateStopped); r++);
  2091. };
  2092. i.prototype.willTrigger = function(t) {
  2093. for (var e = this; e;) {
  2094. if (e.hasEventListener(t)) return !0;
  2095. e = e._parent
  2096. }
  2097. return !1
  2098. };
  2099. Object.defineProperty(i.prototype, "cacheAsBitmap", {
  2100. get: function() {
  2101. return this._cacheAsBitmap
  2102. },
  2103. set: function(e) {
  2104. (this._cacheAsBitmap = e) ? t.callLater(this._makeBitmapCache, this): this._texture_to_render = null
  2105. },
  2106. enumerable: !0,
  2107. configurable: !0
  2108. });
  2109. i.prototype._makeBitmapCache = function() {
  2110. this.renderTexture || (this.renderTexture = new t.RenderTexture);
  2111. var e = this.renderTexture.drawToTexture(this);
  2112. this._texture_to_render = e ? this.renderTexture : null;
  2113. return e
  2114. };
  2115. i.prototype._setCacheDirty = function(t) {
  2116. void 0 === t && (t = !0);
  2117. this._cacheDirty = t
  2118. };
  2119. i.getTransformBounds = function(t, e) {
  2120. var i = t.x,
  2121. n = t.y,
  2122. r = t.width,
  2123. o = t.height;
  2124. (i || n) && e.appendTransform(0, 0, 1, 1, 0, 0, 0, -i, -n);
  2125. var s = r * e.a,
  2126. r = r * e.b,
  2127. a = o * e.c,
  2128. o = o * e.d,
  2129. h = e.tx,
  2130. c = e.ty,
  2131. u = h,
  2132. l = h,
  2133. p = c,
  2134. _ = c;
  2135. (i = s + h) < u ? u = i : i > l && (l = i);
  2136. (i = s + a + h) < u ? u = i : i > l && (l = i);
  2137. (i = a + h) < u ? u = i : i > l && (l = i);
  2138. (n = r + c) < p ? p = n : n > _ && (_ = n);
  2139. (n = r + o + c) < p ? p = n : n > _ && (_ = n);
  2140. (n = o + c) < p ? p = n : n > _ && (_ = n);
  2141. return t.initialize(u, p, l - u, _ - p)
  2142. };
  2143. Object.defineProperty(i.prototype, "colorTransform", {
  2144. get: function() {
  2145. return this._colorTransform
  2146. },
  2147. set: function(t) {
  2148. this._colorTransform = t
  2149. },
  2150. enumerable: !0,
  2151. configurable: !0
  2152. });
  2153. i.identityMatrixForGetConcatenated = new t.Matrix;
  2154. i._enterFrameCallBackList = [];
  2155. i._renderCallBackList = [];
  2156. return i
  2157. }(t.EventDispatcher);
  2158. t.DisplayObject = e;
  2159. e.prototype.__class__ = "egret.DisplayObject";
  2160. e = function() {
  2161. function t() {
  2162. this.matrix = null
  2163. }
  2164. t.prototype.updateColor = function(t, e, i, n, r, o, s, a) {};
  2165. return t
  2166. }();
  2167. t.ColorTransform = e;
  2168. e.prototype.__class__ = "egret.ColorTransform"
  2169. })(egret || (egret = {}));
  2170. __extends = this.__extends || function(t, e) {
  2171. function i() {
  2172. this.constructor = t
  2173. }
  2174. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  2175. i.prototype = e.prototype;
  2176. t.prototype = new i
  2177. };
  2178. (function(t) {
  2179. var e = function(e) {
  2180. function i() {
  2181. e.call(this);
  2182. this._touchChildren = !0;
  2183. this._children = []
  2184. }
  2185. __extends(i, e);
  2186. Object.defineProperty(i.prototype, "touchChildren", {
  2187. get: function() {
  2188. return this._touchChildren
  2189. },
  2190. set: function(t) {
  2191. this._touchChildren = t
  2192. },
  2193. enumerable: !0,
  2194. configurable: !0
  2195. });
  2196. Object.defineProperty(i.prototype, "numChildren", {
  2197. get: function() {
  2198. return this._children.length
  2199. },
  2200. enumerable: !0,
  2201. configurable: !0
  2202. });
  2203. i.prototype.setChildIndex = function(t, e) {
  2204. this.doSetChildIndex(t, e)
  2205. };
  2206. i.prototype.doSetChildIndex = function(e, i) {
  2207. var n = this._children.indexOf(e);
  2208. 0 > n && t.Logger.fatal("child不在当前容器内");
  2209. this._children.splice(n, 1);
  2210. 0 > i || this._children.length <= i ? this._children.push(e) : this._children.splice(i, 0, e)
  2211. };
  2212. i.prototype.addChild = function(t) {
  2213. var e = this._children.length;
  2214. t._parent == this && e--;
  2215. return this._doAddChild(t, e)
  2216. };
  2217. i.prototype.addChildAt = function(t, e) {
  2218. return this._doAddChild(t, e)
  2219. };
  2220. i.prototype._doAddChild = function(e, n, r) {
  2221. void 0 === r && (r = !0);
  2222. if (e == this) return e;
  2223. if (0 > n || n > this._children.length) return t.Logger.fatal("提供的索引超出范围"), e;
  2224. var o = e._parent;
  2225. if (o == this) return this.doSetChildIndex(e, n), e;
  2226. o && (n = o._children.indexOf(e), 0 <= n && o._doRemoveChild(n));
  2227. this._children.splice(n, 0, e);
  2228. e._parentChanged(this);
  2229. r && e.dispatchEventWith(t.Event.ADDED, !0);
  2230. if (this._stage)
  2231. for (e._onAddToStage(), n = i.__EVENT__ADD_TO_STAGE_LIST; 0 < n.length;) n.shift().dispatchEventWith(t.Event.ADDED_TO_STAGE);
  2232. e._setDirty();
  2233. this._setSizeDirty();
  2234. return e
  2235. };
  2236. i.prototype.removeChild = function(e) {
  2237. e = this._children.indexOf(e);
  2238. if (0 <= e) return this._doRemoveChild(e);
  2239. t.Logger.fatal("child未被addChild到该parent");
  2240. return null
  2241. };
  2242. i.prototype.removeChildAt = function(e) {
  2243. if (0 <= e && e < this._children.length) return this._doRemoveChild(e);
  2244. t.Logger.fatal("提供的索引超出范围");
  2245. return null
  2246. };
  2247. i.prototype._doRemoveChild = function(e, n) {
  2248. void 0 === n && (n = !0);
  2249. var r = this._children,
  2250. o = r[e];
  2251. n && o.dispatchEventWith(t.Event.REMOVED, !0);
  2252. if (this._stage) {
  2253. o._onRemoveFromStage();
  2254. for (var s = i.__EVENT__REMOVE_FROM_STAGE_LIST; 0 < s.length;) {
  2255. var a = s.shift();
  2256. a.dispatchEventWith(t.Event.REMOVED_FROM_STAGE);
  2257. a._stage = null
  2258. }
  2259. }
  2260. o._parentChanged(null);
  2261. r.splice(e, 1);
  2262. this._setSizeDirty();
  2263. return o
  2264. };
  2265. i.prototype.getChildAt = function(e) {
  2266. if (0 <= e && e < this._children.length) return this._children[e];
  2267. t.Logger.fatal("提供的索引超出范围");
  2268. return null
  2269. };
  2270. i.prototype.contains = function(t) {
  2271. for (; t;) {
  2272. if (t == this) return !0;
  2273. t = t._parent
  2274. }
  2275. return !1
  2276. };
  2277. i.prototype.swapChildrenAt = function(e, i) {
  2278. 0 <= e && e < this._children.length && 0 <= i && i < this._children.length ? this._swapChildrenAt(e, i) : t.Logger.fatal("提供的索引超出范围")
  2279. };
  2280. i.prototype.swapChildren = function(e, i) {
  2281. var n = this._children.indexOf(e),
  2282. r = this._children.indexOf(i); - 1 == n || -1 == r ? t.Logger.fatal("child未被addChild到该parent") : this._swapChildrenAt(n, r)
  2283. };
  2284. i.prototype._swapChildrenAt = function(t, e) {
  2285. if (t != e) {
  2286. var i = this._children,
  2287. n = i[t];
  2288. i[t] = i[e];
  2289. i[e] = n
  2290. }
  2291. };
  2292. i.prototype.getChildIndex = function(t) {
  2293. return this._children.indexOf(t)
  2294. };
  2295. i.prototype.removeChildren = function() {
  2296. for (var t = this._children.length - 1; 0 <= t; t--) this._doRemoveChild(t)
  2297. };
  2298. i.prototype._updateTransform = function() {
  2299. if (this._visible) {
  2300. e.prototype._updateTransform.call(this);
  2301. for (var t = 0, i = this._children.length; t < i; t++) this._children[t]._updateTransform()
  2302. }
  2303. };
  2304. i.prototype._render = function(t) {
  2305. for (var e = 0, i = this._children.length; e < i; e++) this._children[e]._draw(t)
  2306. };
  2307. i.prototype._measureBounds = function() {
  2308. for (var e = 0, i = 0, n = 0, r = 0, o = this._children.length, s = 0; s < o; s++) {
  2309. var a = this._children[s];
  2310. if (a._visible) {
  2311. var h = a.getBounds(t.Rectangle.identity, !1),
  2312. c = h.x,
  2313. u = h.y,
  2314. l = h.width,
  2315. h = h.height,
  2316. a = a._getMatrix(),
  2317. a = t.DisplayObject.getTransformBounds(t.Rectangle.identity.initialize(c, u, l, h), a),
  2318. c = a.x,
  2319. u = a.y,
  2320. l = a.width + a.x,
  2321. a = a.height + a.y;
  2322. if (c < e || 0 == s) e = c;
  2323. if (l > i || 0 == s) i = l;
  2324. if (u < n || 0 == s) n = u;
  2325. if (a > r || 0 == s) r = a
  2326. }
  2327. }
  2328. return t.Rectangle.identity.initialize(e, n, i - e, r - n)
  2329. };
  2330. i.prototype.hitTest = function(i, n, r) {
  2331. void 0 === r && (r = !1);
  2332. var o;
  2333. if (!this._visible) return null;
  2334. if (this._scrollRect) {
  2335. if (i < this._scrollRect.x || n < this._scrollRect.y || i > this._scrollRect.x + this._scrollRect.width || n > this._scrollRect.y + this._scrollRect.height) return null
  2336. } else if (this.mask && (this.mask.x > i || i > this.mask.x + this.mask.width || this.mask.y > n || n > this.mask.y + this.mask.height)) return null;
  2337. for (var s = this._children, a = this._touchChildren, h = s.length - 1; 0 <= h; h--) {
  2338. var c = s[h],
  2339. u = c._getMatrix(),
  2340. l = c._scrollRect;
  2341. l && u.append(1, 0, 0, 1, -l.x, -l.y);
  2342. u.invert();
  2343. u = t.Matrix.transformCoords(u, i, n);
  2344. if (c = c.hitTest(u.x, u.y, !0)) {
  2345. if (!a) return this;
  2346. if (c._touchEnabled && a) return c;
  2347. o = this
  2348. }
  2349. }
  2350. return o ? o : this._texture_to_render || this.graphics ? e.prototype.hitTest.call(this, i, n, r) : null
  2351. };
  2352. i.prototype._onAddToStage = function() {
  2353. e.prototype._onAddToStage.call(this);
  2354. for (var t = this._children.length, i = 0; i < t; i++) this._children[i]._onAddToStage()
  2355. };
  2356. i.prototype._onRemoveFromStage = function() {
  2357. e.prototype._onRemoveFromStage.call(this);
  2358. for (var t = this._children.length, i = 0; i < t; i++) this._children[i]._onRemoveFromStage()
  2359. };
  2360. i.prototype.getChildByName = function(t) {
  2361. for (var e = this._children, i = e.length, n, r = 0; r < i; r++)
  2362. if (n = e[r], n.name == t) return n;
  2363. return null
  2364. };
  2365. i.__EVENT__ADD_TO_STAGE_LIST = [];
  2366. i.__EVENT__REMOVE_FROM_STAGE_LIST = [];
  2367. return i
  2368. }(t.DisplayObject);
  2369. t.DisplayObjectContainer = e;
  2370. e.prototype.__class__ = "egret.DisplayObjectContainer"
  2371. })(egret || (egret = {}));
  2372. __extends = this.__extends || function(t, e) {
  2373. function i() {
  2374. this.constructor = t
  2375. }
  2376. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  2377. i.prototype = e.prototype;
  2378. t.prototype = new i
  2379. };
  2380. (function(t) {
  2381. var e = function(e) {
  2382. function i(t, i) {
  2383. void 0 === t && (t = 480);
  2384. void 0 === i && (i = 800);
  2385. e.call(this);
  2386. this.touchEnabled = !0;
  2387. this._stage = this;
  2388. this._stageWidth = t;
  2389. this._stageHeight = i
  2390. }
  2391. __extends(i, e);
  2392. i.prototype.invalidate = function() {
  2393. i._invalidateRenderFlag = !0
  2394. };
  2395. Object.defineProperty(i.prototype, "scaleMode", {
  2396. get: function() {
  2397. return this._scaleMode
  2398. },
  2399. set: function(t) {
  2400. this._scaleMode != t && (this._scaleMode = t, this.setResolutionPolicy())
  2401. },
  2402. enumerable: !0,
  2403. configurable: !0
  2404. });
  2405. i.prototype.changeSize = function() {
  2406. this.setResolutionPolicy();
  2407. this.dispatchEventWith(t.Event.RESIZE)
  2408. };
  2409. i.prototype.setResolutionPolicy = function() {
  2410. var e = {};
  2411. e[t.StageScaleMode.NO_SCALE] = new t.NoScale;
  2412. e[t.StageScaleMode.SHOW_ALL] = new t.ShowAll;
  2413. e[t.StageScaleMode.NO_BORDER] = new t.FixedWidth;
  2414. e[t.StageScaleMode.EXACT_FIT] = new t.FullScreen;
  2415. e = e[this._scaleMode];
  2416. if (!e) throw Error("使用了尚未实现的ScaleMode");
  2417. var i = new t.EqualToFrame,
  2418. e = new t.ResolutionPolicy(i, e);
  2419. t.StageDelegate.getInstance()._setResolutionPolicy(e);
  2420. this._stageWidth = t.StageDelegate.getInstance()._stageWidth;
  2421. this._stageHeight = t.StageDelegate.getInstance()._stageHeight
  2422. };
  2423. Object.defineProperty(i.prototype, "stageWidth", {
  2424. get: function() {
  2425. return this._stageWidth
  2426. },
  2427. enumerable: !0,
  2428. configurable: !0
  2429. });
  2430. Object.defineProperty(i.prototype, "stageHeight", {
  2431. get: function() {
  2432. return this._stageHeight
  2433. },
  2434. enumerable: !0,
  2435. configurable: !0
  2436. });
  2437. i.prototype.hitTest = function(e, i, n) {
  2438. if (!this._touchEnabled) return null;
  2439. var r;
  2440. if (!this._touchChildren) return this;
  2441. n = this._children;
  2442. for (var o = n.length - 1; 0 <= o; o--) {
  2443. r = n[o];
  2444. var s = r._getMatrix(),
  2445. a = r._scrollRect;
  2446. a && s.append(1, 0, 0, 1, -a.x, -a.y);
  2447. s.invert();
  2448. s = t.Matrix.transformCoords(s, e, i);
  2449. if ((r = r.hitTest(s.x, s.y, !0)) && r._touchEnabled) return r
  2450. }
  2451. return this
  2452. };
  2453. i.prototype.getBounds = function(e) {
  2454. e || (e = new t.Rectangle);
  2455. return e.initialize(0, 0, this._stageWidth, this._stageHeight)
  2456. };
  2457. i.prototype._updateTransform = function() {
  2458. for (var t = 0, e = this._children.length; t < e; t++) this._children[t]._updateTransform()
  2459. };
  2460. Object.defineProperty(i.prototype, "focus", {
  2461. get: function() {
  2462. return null
  2463. },
  2464. enumerable: !0,
  2465. configurable: !0
  2466. });
  2467. i._invalidateRenderFlag = !1;
  2468. return i
  2469. }(t.DisplayObjectContainer);
  2470. t.Stage = e;
  2471. e.prototype.__class__ = "egret.Stage"
  2472. })(egret || (egret = {}));
  2473. (function(t) {
  2474. var e = function() {
  2475. function t() {}
  2476. t.NO_BORDER = "noBorder";
  2477. t.NO_SCALE = "noScale";
  2478. t.SHOW_ALL = "showAll";
  2479. t.EXACT_FIT = "exactFit";
  2480. return t
  2481. }();
  2482. t.StageScaleMode = e;
  2483. e.prototype.__class__ = "egret.StageScaleMode"
  2484. })(egret || (egret = {}));
  2485. __extends = this.__extends || function(t, e) {
  2486. function i() {
  2487. this.constructor = t
  2488. }
  2489. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  2490. i.prototype = e.prototype;
  2491. t.prototype = new i
  2492. };
  2493. (function(t) {
  2494. var e = function(e) {
  2495. function i(i) {
  2496. void 0 === i && (i = null);
  2497. e.call(this);
  2498. this._lastTouchPosition = new t.Point(0, 0);
  2499. this._lastTouchTime = 0;
  2500. this._lastTouchEvent = null;
  2501. this._velocitys = [];
  2502. this._content = null;
  2503. this._horizontalScrollPolicy = this._verticalScrollPolicy = "auto";
  2504. this._scrollTop = this._scrollLeft = 0;
  2505. this._vCanScroll = this._hCanScroll = !1;
  2506. this.touchEnabled = !0;
  2507. i && this.setContent(i)
  2508. }
  2509. __extends(i, e);
  2510. i.prototype.setContent = function(t) {
  2511. this._content !== t && (this.removeContent(), t && (this._content = t, e.prototype.addChild.call(this, t), this._addEvents()))
  2512. };
  2513. i.prototype.removeContent = function() {
  2514. this._content && (this._removeEvents(), e.prototype.removeChildAt.call(this, 0));
  2515. this._content = null
  2516. };
  2517. Object.defineProperty(i.prototype, "verticalScrollPolicy", {
  2518. get: function() {
  2519. return this._verticalScrollPolicy
  2520. },
  2521. set: function(t) {
  2522. t != this._verticalScrollPolicy && (this._verticalScrollPolicy = t)
  2523. },
  2524. enumerable: !0,
  2525. configurable: !0
  2526. });
  2527. Object.defineProperty(i.prototype, "horizontalScrollPolicy", {
  2528. get: function() {
  2529. return this._horizontalScrollPolicy
  2530. },
  2531. set: function(t) {
  2532. t != this._horizontalScrollPolicy && (this._horizontalScrollPolicy = t)
  2533. },
  2534. enumerable: !0,
  2535. configurable: !0
  2536. });
  2537. Object.defineProperty(i.prototype, "scrollLeft", {
  2538. get: function() {
  2539. return this._scrollLeft
  2540. },
  2541. set: function(t) {
  2542. t != this._scrollLeft && (this._scrollLeft = t, this._validatePosition(!1, !0), this._updateContentPosition())
  2543. },
  2544. enumerable: !0,
  2545. configurable: !0
  2546. });
  2547. Object.defineProperty(i.prototype, "scrollTop", {
  2548. get: function() {
  2549. return this._scrollTop
  2550. },
  2551. set: function(t) {
  2552. t != this._scrollTop && (this._scrollTop = t, this._validatePosition(!0, !1), this._updateContentPosition())
  2553. },
  2554. enumerable: !0,
  2555. configurable: !0
  2556. });
  2557. i.prototype.setScrollPosition = function(t, e, i) {
  2558. void 0 === i && (i = !1);
  2559. if (!i || 0 != t || 0 != e)
  2560. if (i || this._scrollTop != t || this._scrollLeft != e) {
  2561. if (i) {
  2562. i = this._isOnTheEdge(!0);
  2563. var n = this._isOnTheEdge(!1);
  2564. this._scrollTop += i ? t / 2 : t;
  2565. this._scrollLeft += n ? e / 2 : e
  2566. } else this._scrollTop = t, this._scrollLeft = e;
  2567. this._validatePosition(!0, !0);
  2568. this._updateContentPosition()
  2569. }
  2570. };
  2571. i.prototype._isOnTheEdge = function(t) {
  2572. void 0 === t && (t = !0);
  2573. var e = this._scrollTop,
  2574. i = this._scrollLeft;
  2575. return t ? 0 > e || e > this.getMaxScrollTop() : 0 > i || i > this.getMaxScrollLeft()
  2576. };
  2577. i.prototype._validatePosition = function(t, e) {
  2578. void 0 === t && (t = !1);
  2579. void 0 === e && (e = !1);
  2580. if (t) {
  2581. var i = this.height,
  2582. n = this._getContentHeight();
  2583. this._scrollTop = Math.max(this._scrollTop, (0 - i) / 2);
  2584. this._scrollTop = Math.min(this._scrollTop, n > i ? n - i / 2 : n / 2)
  2585. }
  2586. e && (i = this.width, n = this._getContentWidth(), this._scrollLeft = Math.max(this._scrollLeft, (0 - i) / 2), this._scrollLeft = Math.min(this._scrollLeft, n > i ? n - i / 2 : n / 2))
  2587. };
  2588. i.prototype._setWidth = function(t) {
  2589. this._explicitWidth != t && (e.prototype._setWidth.call(this, t), this._updateContentPosition())
  2590. };
  2591. i.prototype._setHeight = function(t) {
  2592. this._explicitHeight != t && (e.prototype._setHeight.call(this, t), this._updateContentPosition())
  2593. };
  2594. i.prototype._updateContentPosition = function() {
  2595. var e = this.getBounds(t.Rectangle.identity);
  2596. this.scrollRect = new t.Rectangle(this._scrollLeft, this._scrollTop, e.width, e.height);
  2597. this.dispatchEvent(new t.Event(t.Event.CHANGE))
  2598. };
  2599. i.prototype._checkScrollPolicy = function() {
  2600. var t = this.__checkScrollPolicy(this._horizontalScrollPolicy, this._getContentWidth(), this.width);
  2601. this._hCanScroll = t;
  2602. var e = this.__checkScrollPolicy(this._verticalScrollPolicy, this._getContentHeight(), this.height);
  2603. this._vCanScroll = e;
  2604. return t || e
  2605. };
  2606. i.prototype.__checkScrollPolicy = function(t, e, i) {
  2607. return "on" == t ? !0 : "off" == t ? !1 : e > i
  2608. };
  2609. i.prototype._addEvents = function() {
  2610. this.addEventListener(t.TouchEvent.TOUCH_BEGIN, this._onTouchBegin, this);
  2611. this.addEventListener(t.TouchEvent.TOUCH_BEGIN, this._onTouchBeginCapture, this, !0);
  2612. this.addEventListener(t.TouchEvent.TOUCH_END, this._onTouchEndCapture, this, !0)
  2613. };
  2614. i.prototype._removeEvents = function() {
  2615. this.removeEventListener(t.TouchEvent.TOUCH_BEGIN, this._onTouchBegin, this);
  2616. this.removeEventListener(t.TouchEvent.TOUCH_BEGIN, this._onTouchBeginCapture, this, !0);
  2617. this.removeEventListener(t.TouchEvent.TOUCH_END, this._onTouchEndCapture, this, !0)
  2618. };
  2619. i.prototype._onTouchBegin = function(e) {
  2620. !e._isDefaultPrevented && this._checkScrollPolicy() && (t.Tween.removeTweens(this), this.stage.addEventListener(t.TouchEvent.TOUCH_MOVE, this._onTouchMove, this), this.stage.addEventListener(t.TouchEvent.TOUCH_END, this._onTouchEnd, this), this.stage.addEventListener(t.TouchEvent.LEAVE_STAGE, this._onTouchEnd, this), this.addEventListener(t.Event.ENTER_FRAME, this._onEnterFrame, this), this._logTouchEvent(e), e.preventDefault())
  2621. };
  2622. i.prototype._onTouchBeginCapture = function(e) {
  2623. var n = this._checkScrollPolicy();
  2624. if (n) {
  2625. for (var r = e.target; r != this;) {
  2626. if (r instanceof i && (n = r._checkScrollPolicy())) return;
  2627. r = r.parent
  2628. }
  2629. e.stopPropagation();
  2630. this.delayTouchBeginEvent = this.cloneTouchEvent(e);
  2631. this.touchBeginTimer || (this.touchBeginTimer = new t.Timer(100, 1), this.touchBeginTimer.addEventListener(t.TimerEvent.TIMER_COMPLETE, this._onTouchBeginTimer, this));
  2632. this.touchBeginTimer.start();
  2633. this._onTouchBegin(e)
  2634. }
  2635. };
  2636. i.prototype._onTouchEndCapture = function(t) {
  2637. this.delayTouchBeginEvent && this._onTouchBeginTimer()
  2638. };
  2639. i.prototype._onTouchBeginTimer = function() {
  2640. this.touchBeginTimer.stop();
  2641. var t = this.delayTouchBeginEvent;
  2642. this.delayTouchBeginEvent = null;
  2643. this.dispatchPropagationEvent(t)
  2644. };
  2645. i.prototype.dispatchPropagationEvent = function(t) {
  2646. for (var e = [], i = t._target; i;) e.push(i), i = i.parent;
  2647. for (var n = this._content, r = 1;; r += 2) {
  2648. i = e[r];
  2649. if (!i || i === n) break;
  2650. e.unshift(i)
  2651. }
  2652. this._dispatchPropagationEvent(t, e)
  2653. };
  2654. i.prototype._dispatchPropagationEvent = function(t, e, i) {
  2655. for (var n = e.length, r = 0; r < n; r++) {
  2656. var o = e[r];
  2657. t._currentTarget = o;
  2658. t._target = this;
  2659. t._eventPhase = r < i ? 1 : r == i ? 2 : 3;
  2660. o._notifyListener(t);
  2661. if (t._isPropagationStopped || t._isPropagationImmediateStopped) break
  2662. }
  2663. };
  2664. i.prototype._onTouchMove = function(t) {
  2665. if (this._lastTouchPosition.x != t.stageX || this._lastTouchPosition.y != t.stageY) {
  2666. this.delayTouchBeginEvent && (this.delayTouchBeginEvent = null, this.touchBeginTimer.stop());
  2667. this.touchChildren = !1;
  2668. var e = this._getPointChange(t);
  2669. this.setScrollPosition(e.y, e.x, !0);
  2670. this._calcVelocitys(t);
  2671. this._logTouchEvent(t)
  2672. }
  2673. };
  2674. i.prototype._onTouchEnd = function(e) {
  2675. this.touchChildren = !0;
  2676. t.MainContext.instance.stage.removeEventListener(t.TouchEvent.TOUCH_MOVE, this._onTouchMove, this);
  2677. t.MainContext.instance.stage.removeEventListener(t.TouchEvent.TOUCH_END, this._onTouchEnd, this);
  2678. t.MainContext.instance.stage.removeEventListener(t.TouchEvent.LEAVE_STAGE, this._onTouchEnd, this);
  2679. this.removeEventListener(t.Event.ENTER_FRAME, this._onEnterFrame, this);
  2680. this._moveAfterTouchEnd()
  2681. };
  2682. i.prototype._onEnterFrame = function(e) {
  2683. e = t.getTimer();
  2684. 100 < e - this._lastTouchTime && 300 > e - this._lastTouchTime && this._calcVelocitys(this._lastTouchEvent)
  2685. };
  2686. i.prototype._logTouchEvent = function(e) {
  2687. this._lastTouchPosition.x = e.stageX;
  2688. this._lastTouchPosition.y = e.stageY;
  2689. this._lastTouchEvent = this.cloneTouchEvent(e);
  2690. this._lastTouchTime = t.getTimer()
  2691. };
  2692. i.prototype._getPointChange = function(t) {
  2693. return {
  2694. x: !1 === this._hCanScroll ? 0 : this._lastTouchPosition.x - t.stageX,
  2695. y: !1 === this._vCanScroll ? 0 : this._lastTouchPosition.y - t.stageY
  2696. }
  2697. };
  2698. i.prototype._calcVelocitys = function(e) {
  2699. var i = t.getTimer();
  2700. if (0 == this._lastTouchTime) this._lastTouchTime = i;
  2701. else {
  2702. var n = this._getPointChange(e),
  2703. i = i - this._lastTouchTime;
  2704. n.x /= i;
  2705. n.y /= i;
  2706. this._velocitys.push(n);
  2707. 5 < this._velocitys.length && this._velocitys.shift();
  2708. this._lastTouchPosition.x = e.stageX;
  2709. this._lastTouchPosition.y = e.stageY
  2710. }
  2711. };
  2712. i.prototype._getContentWidth = function() {
  2713. return this._content.explicitWidth || this._content.width
  2714. };
  2715. i.prototype._getContentHeight = function() {
  2716. return this._content.explicitHeight || this._content.height
  2717. };
  2718. i.prototype.getMaxScrollLeft = function() {
  2719. var t = this._getContentWidth() - this.width;
  2720. return Math.max(0, t)
  2721. };
  2722. i.prototype.getMaxScrollTop = function() {
  2723. var t = this._getContentHeight() - this.height;
  2724. return Math.max(0, t)
  2725. };
  2726. i.prototype._moveAfterTouchEnd = function() {
  2727. if (0 != this._velocitys.length) {
  2728. for (var t = 0, e = 0, n = 0, r = 0; r < this._velocitys.length; r++) var o = this._velocitys[r],
  2729. s = i.weight[r],
  2730. t = t + o.x * s,
  2731. e = e + o.y * s,
  2732. n = n + s;
  2733. this._velocitys.length = 0;
  2734. t /= n;
  2735. e /= n;
  2736. o = Math.abs(t);
  2737. n = Math.abs(e);
  2738. s = this.getMaxScrollLeft();
  2739. r = this.getMaxScrollTop();
  2740. t = .02 < o ? this.getAnimationDatas(t, this._scrollLeft, s) : {
  2741. position: this._scrollLeft,
  2742. duration: 1
  2743. };
  2744. e = .02 < n ? this.getAnimationDatas(e, this._scrollTop, r) : {
  2745. position: this._scrollTop,
  2746. duration: 1
  2747. };
  2748. this.setScrollLeft(t.position, t.duration);
  2749. this.setScrollTop(e.position, e.duration)
  2750. }
  2751. };
  2752. i.prototype.setScrollTop = function(e, i) {
  2753. void 0 === i && (i = 0);
  2754. var n = Math.min(this.getMaxScrollTop(), Math.max(e, 0));
  2755. if (0 == i) return this.scrollTop = n, null;
  2756. var r = t.Tween.get(this).to({
  2757. scrollTop: e
  2758. }, i, t.Ease.quartOut);
  2759. n != e && r.to({
  2760. scrollTop: n
  2761. }, 300, t.Ease.quintOut)
  2762. };
  2763. i.prototype.setScrollLeft = function(e, i) {
  2764. void 0 === i && (i = 0);
  2765. var n = Math.min(this.getMaxScrollLeft(), Math.max(e, 0));
  2766. if (0 == i) return this.scrollLeft = n, null;
  2767. var r = t.Tween.get(this).to({
  2768. scrollLeft: e
  2769. }, i, t.Ease.quartOut);
  2770. n != e && r.to({
  2771. scrollLeft: n
  2772. }, 300, t.Ease.quintOut)
  2773. };
  2774. i.prototype.getAnimationDatas = function(t, e, i) {
  2775. var n = Math.abs(t),
  2776. r = 0,
  2777. o = e + 500 * t;
  2778. if (0 > o || o > i)
  2779. for (o = e; Infinity != Math.abs(t) && .02 < Math.abs(t);) o += t, t = 0 > o || o > i ? .998 * t * .95 : .998 * t, r++;
  2780. else r = 500 * -Math.log(.02 / n);
  2781. return {
  2782. position: Math.min(i + 50, Math.max(o, -50)),
  2783. duration: r
  2784. }
  2785. };
  2786. i.prototype.cloneTouchEvent = function(e) {
  2787. var i = new t.TouchEvent(e._type, e._bubbles, e.cancelable);
  2788. i.touchPointID = e.touchPointID;
  2789. i._stageX = e._stageX;
  2790. i._stageY = e._stageY;
  2791. i.ctrlKey = e.ctrlKey;
  2792. i.altKey = e.altKey;
  2793. i.shiftKey = e.shiftKey;
  2794. i.touchDown = e.touchDown;
  2795. i._isDefaultPrevented = !1;
  2796. i._target = e._target;
  2797. return i
  2798. };
  2799. i.prototype.throwNotSupportedError = function() {
  2800. throw Error("此方法在ScrollView内不可用!")
  2801. };
  2802. i.prototype.addChild = function(t) {
  2803. this.throwNotSupportedError();
  2804. return null
  2805. };
  2806. i.prototype.addChildAt = function(t, e) {
  2807. this.throwNotSupportedError();
  2808. return null
  2809. };
  2810. i.prototype.removeChild = function(t) {
  2811. this.throwNotSupportedError();
  2812. return null
  2813. };
  2814. i.prototype.removeChildAt = function(t) {
  2815. this.throwNotSupportedError();
  2816. return null
  2817. };
  2818. i.prototype.setChildIndex = function(t, e) {
  2819. this.throwNotSupportedError()
  2820. };
  2821. i.prototype.swapChildren = function(t, e) {
  2822. this.throwNotSupportedError()
  2823. };
  2824. i.prototype.swapChildrenAt = function(t, e) {
  2825. this.throwNotSupportedError()
  2826. };
  2827. i.prototype.hitTest = function(i, n, r) {
  2828. void 0 === r && (r = !1);
  2829. var o = e.prototype.hitTest.call(this, i, n, r);
  2830. return o ? o : t.DisplayObject.prototype.hitTest.call(this, i, n, r)
  2831. };
  2832. i.weight = [1, 1.33, 1.66, 2, 2.33];
  2833. return i
  2834. }(t.DisplayObjectContainer);
  2835. t.ScrollView = e;
  2836. e.prototype.__class__ = "egret.ScrollView"
  2837. })(egret || (egret = {}));
  2838. (function(t) {
  2839. var e = function() {
  2840. function t() {}
  2841. t.REPEAT = "repeat";
  2842. t.SCALE = "scale";
  2843. return t
  2844. }();
  2845. t.BitmapFillMode = e;
  2846. e.prototype.__class__ = "egret.BitmapFillMode"
  2847. })(egret || (egret = {}));
  2848. __extends = this.__extends || function(t, e) {
  2849. function i() {
  2850. this.constructor = t
  2851. }
  2852. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  2853. i.prototype = e.prototype;
  2854. t.prototype = new i
  2855. };
  2856. (function(t) {
  2857. var e = function(e) {
  2858. function i(t) {
  2859. e.call(this);
  2860. this.debug = !1;
  2861. this.debugColor = 16711680;
  2862. this.scale9Grid = null;
  2863. this.fillMode = "scale";
  2864. t && (this._texture = t, this._setSizeDirty())
  2865. }
  2866. __extends(i, e);
  2867. Object.defineProperty(i.prototype, "texture", {
  2868. get: function() {
  2869. return this._texture
  2870. },
  2871. set: function(t) {
  2872. t != this._texture && (this._setSizeDirty(), this._texture = t)
  2873. },
  2874. enumerable: !0,
  2875. configurable: !0
  2876. });
  2877. i.prototype._render = function(t) {
  2878. var e = this._texture;
  2879. e ? (this._texture_to_render = e, i._drawBitmap(t, this._hasWidthSet ? this._explicitWidth : e._textureWidth, this._hasHeightSet ? this._explicitHeight : e._textureHeight, this)) : this._texture_to_render = null
  2880. };
  2881. i._drawBitmap = function(t, e, n, r) {
  2882. var o = r._texture_to_render;
  2883. if (o) {
  2884. var s = o._textureWidth,
  2885. a = o._textureHeight;
  2886. if ("scale" == r.fillMode) {
  2887. var h = r.scale9Grid || o.scale9Grid;
  2888. if (h && s - h.width < e && a - h.height < n) i.drawScale9GridImage(t, r, h, e, n);
  2889. else {
  2890. var h = o._offsetX,
  2891. c = o._offsetY,
  2892. u = o._bitmapWidth || s,
  2893. l = o._bitmapHeight || a;
  2894. e /= s;
  2895. h = Math.round(h * e);
  2896. e = Math.round(u * e);
  2897. n /= a;
  2898. c = Math.round(c * n);
  2899. n = Math.round(l * n);
  2900. i.renderFilter.drawImage(t, r, o._bitmapX, o._bitmapY, u, l, h, c, e, n)
  2901. }
  2902. } else i.drawRepeatImage(t, r, e, n, r.fillMode)
  2903. }
  2904. };
  2905. i.drawRepeatImage = function(e, i, n, r, o) {
  2906. var s = i._texture_to_render;
  2907. if (s) {
  2908. var a = s._textureWidth,
  2909. h = s._textureHeight,
  2910. c = s._bitmapX,
  2911. u = s._bitmapY,
  2912. a = s._bitmapWidth || a,
  2913. h = s._bitmapHeight || h,
  2914. l = s._offsetX,
  2915. s = s._offsetY;
  2916. t.RenderFilter.getInstance().drawImage(e, i, c, u, a, h, l, s, n, r, o)
  2917. }
  2918. };
  2919. i.drawScale9GridImage = function(e, i, n, r, o) {
  2920. var s = i._texture_to_render;
  2921. if (s && n) {
  2922. var a = t.RenderFilter.getInstance(),
  2923. h = s._textureWidth,
  2924. c = s._textureHeight,
  2925. u = s._bitmapX,
  2926. l = s._bitmapY,
  2927. p = s._bitmapWidth || h,
  2928. _ = s._bitmapHeight || c,
  2929. d = s._offsetX,
  2930. f = s._offsetY,
  2931. s = t.MainContext.instance.rendererContext.texture_scale_factor;
  2932. n = t.Rectangle.identity.initialize(n.x - Math.round(d), n.y - Math.round(d), n.width, n.height);
  2933. d = Math.round(d);
  2934. f = Math.round(f);
  2935. r -= h - p;
  2936. o -= c - _;
  2937. n.y == n.bottom && (n.bottom < _ ? n.bottom++ : n.y--);
  2938. n.x == n.right && (n.right < p ? n.right++ : n.x--);
  2939. var h = u + n.x,
  2940. c = u + n.right,
  2941. g = p - n.right,
  2942. y = l + n.y,
  2943. m = l + n.bottom,
  2944. v = _ - n.bottom,
  2945. x = d + n.x,
  2946. T = f + n.y,
  2947. _ = o - (_ - n.bottom),
  2948. p = r - (p - n.right);
  2949. a.drawImage(e, i, u / s, l / s, n.x, n.y, d, f, n.x, n.y);
  2950. a.drawImage(e, i, h / s, l / s, n.width, n.y, x, f, p - n.x, n.y);
  2951. a.drawImage(e, i, c / s, l / s, g, n.y, d + p, f, r - p, n.y);
  2952. a.drawImage(e, i, u / s, y / s, n.x, n.height, d, T, n.x, _ - n.y);
  2953. a.drawImage(e, i, h / s, y / s, n.width, n.height, x, T, p - n.x, _ - n.y);
  2954. a.drawImage(e, i, c / s, y / s, g, n.height, d + p, T, r - p, _ - n.y);
  2955. a.drawImage(e, i, u / s, m / s, n.x, v, d, f + _, n.x, o - _);
  2956. a.drawImage(e, i, h / s, m / s, n.width, v, x, f + _, p - n.x, o - _);
  2957. a.drawImage(e, i, c / s, m / s, g, v, d + p, f + _, r - p, o - _)
  2958. }
  2959. };
  2960. i.prototype._measureBounds = function() {
  2961. var i = this._texture;
  2962. return i ? t.Rectangle.identity.initialize(i._offsetX, i._offsetY, i._textureWidth, i._textureHeight) : e.prototype._measureBounds.call(this)
  2963. };
  2964. i.debug = !1;
  2965. i.renderFilter = t.RenderFilter.getInstance();
  2966. return i
  2967. }(t.DisplayObject);
  2968. t.Bitmap = e;
  2969. e.prototype.__class__ = "egret.Bitmap"
  2970. })(egret || (egret = {}));
  2971. __extends = this.__extends || function(t, e) {
  2972. function i() {
  2973. this.constructor = t
  2974. }
  2975. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  2976. i.prototype = e.prototype;
  2977. t.prototype = new i
  2978. };
  2979. (function(t) {
  2980. var e = function(e) {
  2981. function i() {
  2982. e.call(this);
  2983. this._text = "";
  2984. this._textChanged = !1;
  2985. this._spriteSheet = null;
  2986. this._spriteSheetChanged = !1;
  2987. this._bitmapPool = []
  2988. }
  2989. __extends(i, e);
  2990. Object.defineProperty(i.prototype, "text", {
  2991. get: function() {
  2992. return this._text
  2993. },
  2994. set: function(t) {
  2995. this._textChanged = !0;
  2996. this._text = t;
  2997. this._setSizeDirty()
  2998. },
  2999. enumerable: !0,
  3000. configurable: !0
  3001. });
  3002. Object.defineProperty(i.prototype, "spriteSheet", {
  3003. get: function() {
  3004. return this._spriteSheet
  3005. },
  3006. set: function(t) {
  3007. this._spriteSheet != t && (this._spriteSheet = t, this._spriteSheetChanged = !0, this._setSizeDirty())
  3008. },
  3009. enumerable: !0,
  3010. configurable: !0
  3011. });
  3012. i.prototype._updateTransform = function() {
  3013. this.visible && ((this._textChanged || this._spriteSheetChanged) && this._renderText(), e.prototype._updateTransform.call(this))
  3014. };
  3015. i.prototype._renderText = function(e) {
  3016. var i = e = 0;
  3017. (this._textChanged || this._spriteSheetChanged) && this.removeChildren();
  3018. for (var n = 0, r = this.text.length; n < r; n++) {
  3019. var o = this.text.charAt(n),
  3020. s = this.spriteSheet.getTexture(o);
  3021. if (null == s) console.log("当前没有位图文字:" + o);
  3022. else {
  3023. var o = s._offsetX,
  3024. a = s._offsetY,
  3025. h = s._textureWidth;
  3026. if (this._textChanged || this._spriteSheetChanged) {
  3027. var c = this._bitmapPool[n];
  3028. c || (c = new t.Bitmap, this._bitmapPool.push(c));
  3029. c.texture = s;
  3030. this.addChild(c);
  3031. c.x = e
  3032. }
  3033. e += h + o;
  3034. a + s._textureHeight > i && (i = a + s._textureHeight)
  3035. }
  3036. }
  3037. this._spriteSheetChanged = this._textChanged = !1;
  3038. return t.Rectangle.identity.initialize(0, 0, e, i)
  3039. };
  3040. i.prototype._measureBounds = function() {
  3041. return this._renderText(!0)
  3042. };
  3043. return i
  3044. }(t.DisplayObjectContainer);
  3045. t.BitmapText = e;
  3046. e.prototype.__class__ = "egret.BitmapText"
  3047. })(egret || (egret = {}));
  3048. (function(t) {
  3049. var e = function() {
  3050. function t() {
  3051. this._lastY = this._lastX = this._maxY = this._maxX = this._minY = this._minX = 0;
  3052. this.commandQueue = []
  3053. }
  3054. t.prototype.beginFill = function(t, e) {};
  3055. t.prototype._setStyle = function(t) {};
  3056. t.prototype.drawRect = function(t, e, i, n) {
  3057. this.checkRect(t, e, i, n)
  3058. };
  3059. t.prototype.drawCircle = function(t, e, i) {
  3060. this.checkRect(t - i, e - i, 2 * i, 2 * i)
  3061. };
  3062. t.prototype.drawRoundRect = function(t, e, i, n, r, o) {
  3063. this.checkRect(t, e, i, n)
  3064. };
  3065. t.prototype.drawEllipse = function(t, e, i, n) {
  3066. this.checkRect(t - i, e - n, 2 * i, 2 * n)
  3067. };
  3068. t.prototype.lineStyle = function(t, e, i, n, r, o, s, a) {};
  3069. t.prototype.lineTo = function(t, e) {
  3070. this.checkPoint(t, e)
  3071. };
  3072. t.prototype.curveTo = function(t, e, i, n) {
  3073. this.checkPoint(t, e);
  3074. this.checkPoint(i, n)
  3075. };
  3076. t.prototype.moveTo = function(t, e) {
  3077. this.checkPoint(t, e)
  3078. };
  3079. t.prototype.clear = function() {
  3080. this._maxY = this._maxX = this._minY = this._minX = 0
  3081. };
  3082. t.prototype.endFill = function() {};
  3083. t.prototype._draw = function(t) {};
  3084. t.prototype.checkRect = function(t, e, i, n) {
  3085. this._minX = Math.min(this._minX, t);
  3086. this._minY = Math.min(this._minY, e);
  3087. this._maxX = Math.max(this._maxX, t + i);
  3088. this._maxY = Math.max(this._maxY, e + n)
  3089. };
  3090. t.prototype.checkPoint = function(t, e) {
  3091. this._minX = Math.min(this._minX, t);
  3092. this._minY = Math.min(this._minY, e);
  3093. this._maxX = Math.max(this._maxX, t);
  3094. this._maxY = Math.max(this._maxY, e);
  3095. this._lastX = t;
  3096. this._lastY = e
  3097. };
  3098. return t
  3099. }();
  3100. t.Graphics = e;
  3101. e.prototype.__class__ = "egret.Graphics";
  3102. (function() {
  3103. return function(t, e, i) {
  3104. this.method = t;
  3105. this.thisObject = e;
  3106. this.args = i
  3107. }
  3108. })().prototype.__class__ = "egret.Command"
  3109. })(egret || (egret = {}));
  3110. __extends = this.__extends || function(t, e) {
  3111. function i() {
  3112. this.constructor = t
  3113. }
  3114. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3115. i.prototype = e.prototype;
  3116. t.prototype = new i
  3117. };
  3118. (function(t) {
  3119. var e = function(e) {
  3120. function i() {
  3121. e.call(this)
  3122. }
  3123. __extends(i, e);
  3124. Object.defineProperty(i.prototype, "graphics", {
  3125. get: function() {
  3126. this._graphics || (this._graphics = new t.Graphics);
  3127. return this._graphics
  3128. },
  3129. enumerable: !0,
  3130. configurable: !0
  3131. });
  3132. i.prototype._render = function(t) {
  3133. this._graphics && this._graphics._draw(t)
  3134. };
  3135. return i
  3136. }(t.DisplayObject);
  3137. t.Shape = e;
  3138. e.prototype.__class__ = "egret.Shape"
  3139. })(egret || (egret = {}));
  3140. __extends = this.__extends || function(t, e) {
  3141. function i() {
  3142. this.constructor = t
  3143. }
  3144. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3145. i.prototype = e.prototype;
  3146. t.prototype = new i
  3147. };
  3148. (function(t) {
  3149. var e = function(e) {
  3150. function i() {
  3151. e.call(this)
  3152. }
  3153. __extends(i, e);
  3154. Object.defineProperty(i.prototype, "graphics", {
  3155. get: function() {
  3156. this._graphics || (this._graphics = new t.Graphics);
  3157. return this._graphics
  3158. },
  3159. enumerable: !0,
  3160. configurable: !0
  3161. });
  3162. i.prototype._render = function(t) {
  3163. this._graphics && this._graphics._draw(t);
  3164. e.prototype._render.call(this, t)
  3165. };
  3166. return i
  3167. }(t.DisplayObjectContainer);
  3168. t.Sprite = e;
  3169. e.prototype.__class__ = "egret.Sprite"
  3170. })(egret || (egret = {}));
  3171. __extends = this.__extends || function(t, e) {
  3172. function i() {
  3173. this.constructor = t
  3174. }
  3175. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3176. i.prototype = e.prototype;
  3177. t.prototype = new i
  3178. };
  3179. (function(t) {
  3180. var e = function(e) {
  3181. function i() {
  3182. e.call(this);
  3183. this._inputEnabled = !1;
  3184. this._text = this._type = "";
  3185. this._displayAsPassword = !1;
  3186. this._fontFamily = i.default_fontFamily;
  3187. this._size = 30;
  3188. this._textColorString = "#FFFFFF";
  3189. this._textColor = 16777215;
  3190. this._strokeColorString = "#000000";
  3191. this._stroke = this._strokeColor = 0;
  3192. this._textAlign = "left";
  3193. this._verticalAlign = "top";
  3194. this._maxChars = 0;
  3195. this._scrollV = -1;
  3196. this._numLines = this._lineSpacing = this._maxScrollV = 0;
  3197. this._isFlow = this._multiline = !1;
  3198. this._textArr = [];
  3199. this._isArrayChanged = !1;
  3200. this._textMaxHeight = this._textMaxWidth = 0;
  3201. this._linesArr = []
  3202. }
  3203. __extends(i, e);
  3204. i.prototype.isInput = function() {
  3205. return this._type == t.TextFieldType.INPUT
  3206. };
  3207. i.prototype._setTouchEnabled = function(t) {
  3208. e.prototype._setTouchEnabled.call(this, t);
  3209. this.isInput() && (this._inputEnabled = !0)
  3210. };
  3211. Object.defineProperty(i.prototype, "type", {
  3212. get: function() {
  3213. return this._type
  3214. },
  3215. set: function(t) {
  3216. this._setType(t)
  3217. },
  3218. enumerable: !0,
  3219. configurable: !0
  3220. });
  3221. i.prototype._setType = function(e) {
  3222. this._type != e && (this._type = e, this._type == t.TextFieldType.INPUT ? (this._hasWidthSet || this._setWidth(100), this._hasHeightSet || this._setHeight(30), null == this._inputUtils && (this._inputUtils = new t.InputController), this._inputUtils.init(this), this._setDirty(), this._stage && this._inputUtils._addStageText()) : this._inputUtils && (this._inputUtils._removeStageText(), this._inputUtils = null))
  3223. };
  3224. Object.defineProperty(i.prototype, "text", {
  3225. get: function() {
  3226. return this._getText()
  3227. },
  3228. set: function(t) {
  3229. this._setText(t)
  3230. },
  3231. enumerable: !0,
  3232. configurable: !0
  3233. });
  3234. i.prototype._getText = function() {
  3235. return this._type == t.TextFieldType.INPUT ? this._inputUtils._getText() : this._text
  3236. };
  3237. i.prototype._setSizeDirty = function() {
  3238. e.prototype._setSizeDirty.call(this);
  3239. this._isArrayChanged = !0
  3240. };
  3241. i.prototype._setTextDirty = function() {
  3242. this._setSizeDirty()
  3243. };
  3244. i.prototype._setBaseText = function(t) {
  3245. null == t && (t = "");
  3246. this._isFlow = !1;
  3247. if (this._text != t || this._displayAsPassword) this._setTextDirty(), this._text = t, t = "", t = this._displayAsPassword ? this.changeToPassText(this._text) : this._text, this.setMiddleStyle([{
  3248. text: t
  3249. }])
  3250. };
  3251. i.prototype._setText = function(t) {
  3252. null == t && (t = "");
  3253. this._setBaseText(t);
  3254. this._inputUtils && this._inputUtils._setText(this._text)
  3255. };
  3256. Object.defineProperty(i.prototype, "displayAsPassword", {
  3257. get: function() {
  3258. return this._displayAsPassword
  3259. },
  3260. set: function(t) {
  3261. this._setDisplayAsPassword(t)
  3262. },
  3263. enumerable: !0,
  3264. configurable: !0
  3265. });
  3266. i.prototype._setDisplayAsPassword = function(t) {
  3267. this._displayAsPassword != t && (this._displayAsPassword = t, this._setText(this._text))
  3268. };
  3269. Object.defineProperty(i.prototype, "fontFamily", {
  3270. get: function() {
  3271. return this._fontFamily
  3272. },
  3273. set: function(t) {
  3274. this._setFontFamily(t)
  3275. },
  3276. enumerable: !0,
  3277. configurable: !0
  3278. });
  3279. i.prototype._setFontFamily = function(t) {
  3280. this._fontFamily != t && (this._setTextDirty(), this._fontFamily = t)
  3281. };
  3282. Object.defineProperty(i.prototype, "size", {
  3283. get: function() {
  3284. return this._size
  3285. },
  3286. set: function(t) {
  3287. this._setSize(t)
  3288. },
  3289. enumerable: !0,
  3290. configurable: !0
  3291. });
  3292. i.prototype._setSize = function(t) {
  3293. this._size != t && (this._setTextDirty(), this._size = t)
  3294. };
  3295. Object.defineProperty(i.prototype, "italic", {
  3296. get: function() {
  3297. return this._italic
  3298. },
  3299. set: function(t) {
  3300. this._setItalic(t)
  3301. },
  3302. enumerable: !0,
  3303. configurable: !0
  3304. });
  3305. i.prototype._setItalic = function(t) {
  3306. this._italic != t && (this._setTextDirty(), this._italic = t)
  3307. };
  3308. Object.defineProperty(i.prototype, "bold", {
  3309. get: function() {
  3310. return this._bold
  3311. },
  3312. set: function(t) {
  3313. this._setBold(t)
  3314. },
  3315. enumerable: !0,
  3316. configurable: !0
  3317. });
  3318. i.prototype._setBold = function(t) {
  3319. this._bold != t && (this._setTextDirty(), this._bold = t)
  3320. };
  3321. Object.defineProperty(i.prototype, "textColor", {
  3322. get: function() {
  3323. return this._textColor
  3324. },
  3325. set: function(t) {
  3326. this._setTextColor(t)
  3327. },
  3328. enumerable: !0,
  3329. configurable: !0
  3330. });
  3331. i.prototype._setTextColor = function(e) {
  3332. this._textColor != e && (this._setTextDirty(), this._textColor = e, this._textColorString = t.toColorString(e))
  3333. };
  3334. Object.defineProperty(i.prototype, "strokeColor", {
  3335. get: function() {
  3336. return this._strokeColor
  3337. },
  3338. set: function(t) {
  3339. this._setStrokeColor(t)
  3340. },
  3341. enumerable: !0,
  3342. configurable: !0
  3343. });
  3344. i.prototype._setStrokeColor = function(e) {
  3345. this._strokeColor != e && (this._setTextDirty(), this._strokeColor = e, this._strokeColorString = t.toColorString(e))
  3346. };
  3347. Object.defineProperty(i.prototype, "stroke", {
  3348. get: function() {
  3349. return this._stroke
  3350. },
  3351. set: function(t) {
  3352. this._setStroke(t)
  3353. },
  3354. enumerable: !0,
  3355. configurable: !0
  3356. });
  3357. i.prototype._setStroke = function(t) {
  3358. this._stroke != t && (this._setTextDirty(), this._stroke = t)
  3359. };
  3360. Object.defineProperty(i.prototype, "textAlign", {
  3361. get: function() {
  3362. return this._textAlign
  3363. },
  3364. set: function(t) {
  3365. this._setTextAlign(t)
  3366. },
  3367. enumerable: !0,
  3368. configurable: !0
  3369. });
  3370. i.prototype._setTextAlign = function(t) {
  3371. this._textAlign != t && (this._setTextDirty(), this._textAlign = t)
  3372. };
  3373. Object.defineProperty(i.prototype, "verticalAlign", {
  3374. get: function() {
  3375. return this._verticalAlign
  3376. },
  3377. set: function(t) {
  3378. this._setVerticalAlign(t)
  3379. },
  3380. enumerable: !0,
  3381. configurable: !0
  3382. });
  3383. i.prototype._setVerticalAlign = function(t) {
  3384. this._verticalAlign != t && (this._setTextDirty(), this._verticalAlign = t)
  3385. };
  3386. Object.defineProperty(i.prototype, "maxChars", {
  3387. get: function() {
  3388. return this._maxChars
  3389. },
  3390. set: function(t) {
  3391. this._setMaxChars(t)
  3392. },
  3393. enumerable: !0,
  3394. configurable: !0
  3395. });
  3396. i.prototype._setMaxChars = function(t) {
  3397. this._maxChars != t && (this._maxChars = t)
  3398. };
  3399. Object.defineProperty(i.prototype, "scrollV", {
  3400. set: function(t) {
  3401. this._scrollV = t;
  3402. this._setDirty()
  3403. },
  3404. enumerable: !0,
  3405. configurable: !0
  3406. });
  3407. Object.defineProperty(i.prototype, "maxScrollV", {
  3408. get: function() {
  3409. return this._maxScrollV
  3410. },
  3411. enumerable: !0,
  3412. configurable: !0
  3413. });
  3414. Object.defineProperty(i.prototype, "selectionBeginIndex", {
  3415. get: function() {
  3416. return 0
  3417. },
  3418. enumerable: !0,
  3419. configurable: !0
  3420. });
  3421. Object.defineProperty(i.prototype, "selectionEndIndex", {
  3422. get: function() {
  3423. return 0
  3424. },
  3425. enumerable: !0,
  3426. configurable: !0
  3427. });
  3428. Object.defineProperty(i.prototype, "caretIndex", {
  3429. get: function() {
  3430. return 0
  3431. },
  3432. enumerable: !0,
  3433. configurable: !0
  3434. });
  3435. i.prototype._setSelection = function(t, e) {};
  3436. Object.defineProperty(i.prototype, "lineSpacing", {
  3437. get: function() {
  3438. return this._lineSpacing
  3439. },
  3440. set: function(t) {
  3441. this._setLineSpacing(t)
  3442. },
  3443. enumerable: !0,
  3444. configurable: !0
  3445. });
  3446. i.prototype._setLineSpacing = function(t) {
  3447. this._lineSpacing != t && (this._setTextDirty(), this._lineSpacing = t)
  3448. };
  3449. i.prototype._getLineHeight = function() {
  3450. return this._lineSpacing + this._size
  3451. };
  3452. Object.defineProperty(i.prototype, "numLines", {
  3453. get: function() {
  3454. return this._numLines
  3455. },
  3456. enumerable: !0,
  3457. configurable: !0
  3458. });
  3459. Object.defineProperty(i.prototype, "multiline", {
  3460. get: function() {
  3461. return this._multiline
  3462. },
  3463. set: function(t) {
  3464. this._setMultiline(t)
  3465. },
  3466. enumerable: !0,
  3467. configurable: !0
  3468. });
  3469. i.prototype._setMultiline = function(t) {
  3470. this._multiline = t;
  3471. this._setDirty()
  3472. };
  3473. i.prototype.setFocus = function() {
  3474. t.Logger.warning("TextField.setFocus 没有实现")
  3475. };
  3476. i.prototype._onRemoveFromStage = function() {
  3477. e.prototype._onRemoveFromStage.call(this);
  3478. this._type == t.TextFieldType.INPUT && this._inputUtils._removeStageText()
  3479. };
  3480. i.prototype._onAddToStage = function() {
  3481. e.prototype._onAddToStage.call(this);
  3482. this._type == t.TextFieldType.INPUT && this._inputUtils._addStageText()
  3483. };
  3484. i.prototype._updateBaseTransform = function() {
  3485. e.prototype._updateTransform.call(this)
  3486. };
  3487. i.prototype._updateTransform = function() {
  3488. this._type == t.TextFieldType.INPUT ? this._normalDirty ? (this._clearDirty(), this._inputUtils._updateProperties()) : this._inputUtils._updateTransform() : this._updateBaseTransform()
  3489. };
  3490. i.prototype._render = function(t) {
  3491. this.drawText(t);
  3492. this._clearDirty()
  3493. };
  3494. i.prototype._measureBounds = function() {
  3495. return this.measureText()
  3496. };
  3497. Object.defineProperty(i.prototype, "textFlow", {
  3498. get: function() {
  3499. return this._textArr
  3500. },
  3501. set: function(t) {
  3502. this._isFlow = !0;
  3503. var e = "";
  3504. null == t && (t = []);
  3505. for (var i = 0; i < t.length; i++) e += t[i].text;
  3506. this._displayAsPassword ? this._setBaseText(e) : (this._text = e, this.setMiddleStyle(t))
  3507. },
  3508. enumerable: !0,
  3509. configurable: !0
  3510. });
  3511. i.prototype.changeToPassText = function(t) {
  3512. if (this._displayAsPassword) {
  3513. for (var e = "", i = 0, n = t.length; i < n; i++) switch (t.charAt(i)) {
  3514. case "\n":
  3515. e += "\n";
  3516. break;
  3517. case "\r":
  3518. break;
  3519. default:
  3520. e += "*"
  3521. }
  3522. return e
  3523. }
  3524. return t
  3525. };
  3526. i.prototype.setMiddleStyle = function(t) {
  3527. this._isArrayChanged = !0;
  3528. this._textArr = t;
  3529. this._setSizeDirty()
  3530. };
  3531. Object.defineProperty(i.prototype, "textWidth", {
  3532. get: function() {
  3533. return this._textMaxWidth
  3534. },
  3535. enumerable: !0,
  3536. configurable: !0
  3537. });
  3538. Object.defineProperty(i.prototype, "textHeight", {
  3539. get: function() {
  3540. return this._textMaxHeight
  3541. },
  3542. enumerable: !0,
  3543. configurable: !0
  3544. });
  3545. i.prototype.appendText = function(t) {
  3546. this.appendElement({
  3547. text: t
  3548. })
  3549. };
  3550. i.prototype.appendElement = function(t) {
  3551. this._textArr.push(t);
  3552. this.setMiddleStyle(this._textArr)
  3553. };
  3554. i.prototype._getLinesArr = function() {
  3555. if (!this._isArrayChanged) return this._linesArr;
  3556. this._isArrayChanged = !1;
  3557. var e = this._textArr,
  3558. i = t.MainContext.instance.rendererContext;
  3559. this._linesArr = [];
  3560. this._textMaxWidth = this._textMaxHeight = 0;
  3561. if (this._hasWidthSet && 0 == this._explicitWidth) return console.warn("文本宽度被设置为0"), this._numLines = 0, [{
  3562. width: 0,
  3563. height: 0,
  3564. elements: []
  3565. }];
  3566. var n = this._linesArr,
  3567. r = 0,
  3568. o = 0,
  3569. s = 0,
  3570. a;
  3571. this._isFlow || i.setupFont(this);
  3572. for (var h = 0; h < e.length; h++) {
  3573. var c = e[h];
  3574. c.style = c.style || {};
  3575. for (var u = c.text.toString().split(/(?:\r\n|\r|\n)/), l = 0; l < u.length; l++) {
  3576. null == n[s] && (a = {
  3577. width: 0,
  3578. height: 0,
  3579. elements: []
  3580. }, n[s] = a, o = r = 0);
  3581. o = this._type == t.TextFieldType.INPUT ? this._size : Math.max(o, c.style.size || this._size);
  3582. if ("" != u[l]) {
  3583. this._isFlow && i.setupFont(this, c.style);
  3584. var p = i.measureText(u[l]);
  3585. if (this._hasWidthSet)
  3586. if (r + p <= this._explicitWidth) a.elements.push({
  3587. width: p,
  3588. text: u[l],
  3589. style: c.style
  3590. }), r += p;
  3591. else {
  3592. for (var _ = 0, d = 0, f = u[l]; _ < f.length; _++) {
  3593. p = i.measureText(f.charAt(_));
  3594. if (r + p > this._explicitWidth) break;
  3595. d += p;
  3596. r += p
  3597. }
  3598. 0 < _ && (a.elements.push({
  3599. width: d,
  3600. text: f.substring(0, _),
  3601. style: c.style
  3602. }), u[l] = f.substring(_));
  3603. l--
  3604. } else r += p, a.elements.push({
  3605. width: p,
  3606. text: u[l],
  3607. style: c.style
  3608. })
  3609. }
  3610. if (l < u.length - 1) {
  3611. a.width = r;
  3612. a.height = o;
  3613. this._textMaxWidth = Math.max(this._textMaxWidth, r);
  3614. this._textMaxHeight += o;
  3615. if (this._type == t.TextFieldType.INPUT && !this._multiline) return this._numLines = n.length, n;
  3616. s++
  3617. }
  3618. }
  3619. h == e.length - 1 && a && (a.width = r, a.height = o, this._textMaxWidth = Math.max(this._textMaxWidth, r), this._textMaxHeight += o)
  3620. }
  3621. this._numLines = n.length;
  3622. return n
  3623. };
  3624. i.prototype.measureText = function() {
  3625. return this._getLinesArr() ? t.Rectangle.identity.initialize(0, 0, this._hasWidthSet ? this._explicitWidth : this._textMaxWidth, this._hasHeightSet ? this._explicitHeight : this._textMaxHeight + (this._numLines - 1) * this._lineSpacing) : t.Rectangle.identity.initialize(0, 0, 0, 0)
  3626. };
  3627. i.prototype.drawText = function(e) {
  3628. var i = this._getLinesArr();
  3629. if (i) {
  3630. this._isFlow || e.setupFont(this);
  3631. var n = this._hasWidthSet ? this._explicitWidth : this._textMaxWidth,
  3632. r = this._textMaxHeight + (this._numLines - 1) * this._lineSpacing,
  3633. o = 0,
  3634. s = 0;
  3635. if (this._hasHeightSet)
  3636. if (r < this._explicitHeight) {
  3637. var a = 0;
  3638. this._verticalAlign == t.VerticalAlign.MIDDLE ? a = .5 : this._verticalAlign == t.VerticalAlign.BOTTOM && (a = 1);
  3639. o += a * (this._explicitHeight - r)
  3640. } else r > this._explicitHeight && (s = Math.max(this._scrollV - 1, 0), s = Math.min(this._numLines - 1, s));
  3641. o = Math.round(o);
  3642. r = 0;
  3643. this._textAlign == t.HorizontalAlign.CENTER ? r = .5 : this._textAlign == t.HorizontalAlign.RIGHT && (r = 1);
  3644. for (a = 0; s < this._numLines; s++) {
  3645. var h = i[s],
  3646. c = h.height,
  3647. o = o + c / 2;
  3648. if (0 != s && this._hasHeightSet && o > this._explicitHeight) break;
  3649. for (var a = Math.round((n - h.width) * r), u = 0; u < h.elements.length; u++) {
  3650. var l = h.elements[u],
  3651. p = l.style.size || this._size;
  3652. this._type == t.TextFieldType.INPUT ? e.drawText(this, l.text, a, o + (c - p) / 2, l.width) : (this._isFlow && e.setupFont(this, l.style), e.drawText(this, l.text, a, o + (c - p) / 2, l.width, l.style));
  3653. a += l.width
  3654. }
  3655. o += c / 2 + this._lineSpacing
  3656. }
  3657. }
  3658. };
  3659. i.default_fontFamily = "Arial";
  3660. return i
  3661. }(t.DisplayObject);
  3662. t.TextField = e;
  3663. e.prototype.__class__ = "egret.TextField"
  3664. })(egret || (egret = {}));
  3665. (function(t) {
  3666. var e = function() {
  3667. function t() {
  3668. this.resutlArr = []
  3669. }
  3670. t.prototype.parser = function(t) {
  3671. this.stackArray = [];
  3672. this.resutlArr = [];
  3673. for (var e = 0, i = t.length; e < i;) {
  3674. var n = t.indexOf("<", e);
  3675. 0 > n ? (this.addToResultArr(t.substring(e)), e = i) : (this.addToResultArr(t.substring(e, n)), e = t.indexOf(">", n), "/" == t.charAt(n + 1) ? this.stackArray.pop() : this.addToArray(t.substring(n + 1, e)), e += 1)
  3676. }
  3677. return this.resutlArr
  3678. };
  3679. t.prototype.addToResultArr = function(t) {
  3680. if ("" != t) {
  3681. var e = [];
  3682. e.push(["&lt;", "<"]);
  3683. e.push(["&gt;", ">"]);
  3684. e.push(["&amp;", "&"]);
  3685. e.push(["&quot;", '"']);
  3686. e.push(["&apos;;", "'"]);
  3687. for (var i = 0; i < e.length; i++) t.replace(new RegExp(e[i][0], "g"), e[i][1]);
  3688. 0 < this.stackArray.length ? this.resutlArr.push({
  3689. text: t,
  3690. style: this.stackArray[this.stackArray.length - 1]
  3691. }) : this.resutlArr.push({
  3692. text: t
  3693. })
  3694. }
  3695. };
  3696. t.prototype.changeStringToObject = function(t) {
  3697. var e = {};
  3698. t = t.replace(/( )+/g, " ").split(" ");
  3699. for (var i = 0; i < t.length; i++) this.addProperty(e, t[i]);
  3700. return e
  3701. };
  3702. t.prototype.addProperty = function(t, e) {
  3703. var i = e.replace(/( )*=( )*/g, "=").split("=");
  3704. i[1] && (i[1] = i[1].replace(/(\"|\')/g, ""));
  3705. switch (i[0].toLowerCase()) {
  3706. case "color":
  3707. t.textColor = parseInt(i[1]);
  3708. break;
  3709. case "b":
  3710. t.bold = "true" == (i[1] || "true");
  3711. break;
  3712. case "i":
  3713. t.italic = "true" == (i[1] || "true");
  3714. break;
  3715. case "size":
  3716. t.size = parseInt(i[1]);
  3717. break;
  3718. case "fontFamily":
  3719. t.fontFamily = i[1]
  3720. }
  3721. };
  3722. t.prototype.addToArray = function(t) {
  3723. t = this.changeStringToObject(t);
  3724. if (0 != this.stackArray.length) {
  3725. var e = this.stackArray[this.stackArray.length - 1],
  3726. i;
  3727. for (i in e) null == t[i] && (t[i] = e[i])
  3728. }
  3729. this.stackArray.push(t)
  3730. };
  3731. return t
  3732. }();
  3733. t.HtmlTextParser = e;
  3734. e.prototype.__class__ = "egret.HtmlTextParser"
  3735. })(egret || (egret = {}));
  3736. (function(t) {
  3737. var e = function() {
  3738. function t() {}
  3739. t.DYNAMIC = "dynamic";
  3740. t.INPUT = "input";
  3741. return t
  3742. }();
  3743. t.TextFieldType = e;
  3744. e.prototype.__class__ = "egret.TextFieldType"
  3745. })(egret || (egret = {}));
  3746. __extends = this.__extends || function(t, e) {
  3747. function i() {
  3748. this.constructor = t
  3749. }
  3750. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3751. i.prototype = e.prototype;
  3752. t.prototype = new i
  3753. };
  3754. (function(t) {
  3755. var e = function(e) {
  3756. function i(t) {
  3757. e.call(this);
  3758. var i = t.bitmapData;
  3759. this.bitmapData = i;
  3760. this._textureMap = {};
  3761. this._sourceWidth = i.width;
  3762. this._sourceHeight = i.height;
  3763. this._bitmapX = t._bitmapX - t._offsetX;
  3764. this._bitmapY = t._bitmapY - t._offsetY
  3765. }
  3766. __extends(i, e);
  3767. i.prototype.getTexture = function(t) {
  3768. return this._textureMap[t]
  3769. };
  3770. i.prototype.createTexture = function(e, i, n, r, o, s, a, h, c) {
  3771. void 0 === s && (s = 0);
  3772. void 0 === a && (a = 0);
  3773. "undefined" === typeof h && (h = s + r);
  3774. "undefined" === typeof c && (c = a + o);
  3775. var u = new t.Texture,
  3776. l = t.MainContext.instance.rendererContext.texture_scale_factor;
  3777. u._bitmapData = this.bitmapData;
  3778. u._bitmapX = this._bitmapX + i;
  3779. u._bitmapY = this._bitmapY + n;
  3780. u._bitmapWidth = r * l;
  3781. u._bitmapHeight = o * l;
  3782. u._offsetX = s;
  3783. u._offsetY = a;
  3784. u._textureWidth = h * l;
  3785. u._textureHeight = c * l;
  3786. u._sourceWidth = this._sourceWidth;
  3787. u._sourceHeight = this._sourceHeight;
  3788. return this._textureMap[e] = u
  3789. };
  3790. return i
  3791. }(t.HashObject);
  3792. t.SpriteSheet = e;
  3793. e.prototype.__class__ = "egret.SpriteSheet"
  3794. })(egret || (egret = {}));
  3795. __extends = this.__extends || function(t, e) {
  3796. function i() {
  3797. this.constructor = t
  3798. }
  3799. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3800. i.prototype = e.prototype;
  3801. t.prototype = new i
  3802. };
  3803. (function(t) {
  3804. var e = function(e) {
  3805. function i() {
  3806. e.call(this);
  3807. this._isFocus = !1;
  3808. this._isFirst = this._isFirst = !0
  3809. }
  3810. __extends(i, e);
  3811. i.prototype.init = function(e) {
  3812. this._text = e;
  3813. this.stageText = t.StageText.create();
  3814. e = this._text.localToGlobal();
  3815. this.stageText._open(e.x, e.y, this._text._explicitWidth, this._text._explicitHeight)
  3816. };
  3817. i.prototype._addStageText = function() {
  3818. this._text._inputEnabled || (this._text._touchEnabled = !0);
  3819. this.stageText._add();
  3820. this.stageText._addListeners();
  3821. this.stageText.addEventListener("blur", this.onBlurHandler, this);
  3822. this.stageText.addEventListener("focus", this.onFocusHandler, this);
  3823. this.stageText.addEventListener("updateText", this.updateTextHandler, this);
  3824. this._text.addEventListener(t.TouchEvent.TOUCH_TAP, this.onMouseDownHandler, this);
  3825. t.MainContext.instance.stage.addEventListener(t.TouchEvent.TOUCH_TAP, this.onStageDownHandler, this)
  3826. };
  3827. i.prototype._removeStageText = function() {
  3828. this.stageText._remove();
  3829. this.stageText._removeListeners();
  3830. this._text._inputEnabled || (this._text._touchEnabled = !1);
  3831. this.stageText.removeEventListener("blur", this.onBlurHandler, this);
  3832. this.stageText.removeEventListener("focus", this.onFocusHandler, this);
  3833. this.stageText.removeEventListener("updateText", this.updateTextHandler, this);
  3834. this._text.removeEventListener(t.TouchEvent.TOUCH_TAP, this.onMouseDownHandler, this);
  3835. t.MainContext.instance.stage.removeEventListener(t.TouchEvent.TOUCH_TAP, this.onStageDownHandler, this)
  3836. };
  3837. i.prototype._getText = function() {
  3838. return this.stageText._getText()
  3839. };
  3840. i.prototype._setText = function(t) {
  3841. this.stageText._setText(t)
  3842. };
  3843. i.prototype.onFocusHandler = function(t) {
  3844. this.hideText()
  3845. };
  3846. i.prototype.onBlurHandler = function(t) {
  3847. this.showText()
  3848. };
  3849. i.prototype.onMouseDownHandler = function(t) {
  3850. t.stopPropagation();
  3851. this._text._visible && this.stageText._show()
  3852. };
  3853. i.prototype.onStageDownHandler = function(t) {
  3854. this.stageText._hide();
  3855. this.showText()
  3856. };
  3857. i.prototype.showText = function() {
  3858. this._isFocus && (this._isFocus = !1, this.resetText())
  3859. };
  3860. i.prototype.hideText = function() {
  3861. this._isFocus || (this._text._setBaseText(""), this._isFocus = !0)
  3862. };
  3863. i.prototype.updateTextHandler = function(e) {
  3864. this.resetText();
  3865. this._text.dispatchEvent(new t.Event(t.Event.CHANGE))
  3866. };
  3867. i.prototype.resetText = function() {
  3868. this._text._setBaseText(this.stageText._getText())
  3869. };
  3870. i.prototype._updateTransform = function() {
  3871. var e = this._text._worldTransform.a,
  3872. i = this._text._worldTransform.b,
  3873. n = this._text._worldTransform.c,
  3874. r = this._text._worldTransform.d,
  3875. o = this._text._worldTransform.tx,
  3876. s = this._text._worldTransform.ty;
  3877. this._text._updateBaseTransform();
  3878. var a = this._text._worldTransform;
  3879. if (this._isFirst || e != a.a || i != a.b || n != a.c || r != a.d || o != a.tx || s != a.ty) {
  3880. this._isFirst = !1;
  3881. e = this._text.localToGlobal();
  3882. this.stageText.changePosition(e.x, e.y);
  3883. var h = this;
  3884. t.callLater(function() {
  3885. h.stageText._setScale(h._text._worldTransform.a, h._text._worldTransform.d)
  3886. }, this)
  3887. }
  3888. };
  3889. i.prototype._updateProperties = function() {
  3890. var e = this._text._stage;
  3891. if (null == e) this.stageText._setVisible(!1);
  3892. else {
  3893. for (var i = this._text, n = i._visible; n;) {
  3894. i = i.parent;
  3895. if (i == e) break;
  3896. n = i._visible
  3897. }
  3898. this.stageText._setVisible(n)
  3899. }
  3900. this.stageText._setMultiline(this._text._multiline);
  3901. this.stageText._setMaxChars(this._text._maxChars);
  3902. this.stageText._setSize(this._text._size);
  3903. this.stageText._setTextColor(this._text._textColorString);
  3904. this.stageText._setTextFontFamily(this._text._fontFamily);
  3905. this.stageText._setBold(this._text._bold);
  3906. this.stageText._setItalic(this._text._italic);
  3907. this.stageText._setTextAlign(this._text._textAlign);
  3908. this.stageText._setWidth(this._text._getSize(t.Rectangle.identity).width);
  3909. this.stageText._setHeight(this._text._getSize(t.Rectangle.identity).height);
  3910. this.stageText._setTextType(this._text._displayAsPassword ? "password" : "text");
  3911. this.stageText._setText(this._text._text);
  3912. this.stageText._resetStageText();
  3913. this._updateTransform()
  3914. };
  3915. return i
  3916. }(t.HashObject);
  3917. t.InputController = e;
  3918. e.prototype.__class__ = "egret.InputController"
  3919. })(egret || (egret = {}));
  3920. __extends = this.__extends || function(t, e) {
  3921. function i() {
  3922. this.constructor = t
  3923. }
  3924. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3925. i.prototype = e.prototype;
  3926. t.prototype = new i
  3927. };
  3928. (function(t) {
  3929. var e = function(t) {
  3930. function e(e, i) {
  3931. t.call(this, e);
  3932. this.charList = this.parseConfig(i)
  3933. }
  3934. __extends(e, t);
  3935. e.prototype.getTexture = function(t) {
  3936. var e = this._textureMap[t];
  3937. if (!e) {
  3938. e = this.charList[t];
  3939. if (!e) return null;
  3940. e = this.createTexture(t, e.x, e.y, e.width, e.height, e.offsetX, e.offsetY);
  3941. this._textureMap[t] = e
  3942. }
  3943. return e
  3944. };
  3945. e.prototype.parseConfig = function(t) {
  3946. t = t.split("\r\n").join("\n");
  3947. t = t.split("\n");
  3948. for (var e = this.getConfigByKey(t[3], "count"), i = {}, n = 4; n < 4 + e; n++) {
  3949. var r = t[n],
  3950. o = String.fromCharCode(this.getConfigByKey(r, "id")),
  3951. s = {};
  3952. i[o] = s;
  3953. s.x = this.getConfigByKey(r, "x");
  3954. s.y = this.getConfigByKey(r, "y");
  3955. s.width = this.getConfigByKey(r, "width");
  3956. s.height = this.getConfigByKey(r, "height");
  3957. s.offsetX = this.getConfigByKey(r, "xoffset");
  3958. s.offsetY = this.getConfigByKey(r, "yoffset")
  3959. }
  3960. return i
  3961. };
  3962. e.prototype.getConfigByKey = function(t, e) {
  3963. for (var i = t.split(" "), n = 0, r = i.length; n < r; n++) {
  3964. var o = i[n];
  3965. if (e == o.substring(0, e.length)) return i = o.substring(e.length + 1), parseInt(i)
  3966. }
  3967. return 0
  3968. };
  3969. return e
  3970. }(t.SpriteSheet);
  3971. t.BitmapTextSpriteSheet = e;
  3972. e.prototype.__class__ = "egret.BitmapTextSpriteSheet"
  3973. })(egret || (egret = {}));
  3974. __extends = this.__extends || function(t, e) {
  3975. function i() {
  3976. this.constructor = t
  3977. }
  3978. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  3979. i.prototype = e.prototype;
  3980. t.prototype = new i
  3981. };
  3982. (function(t) {
  3983. var e = function(e) {
  3984. function n(n, r) {
  3985. e.call(this);
  3986. this.frameRate = 60;
  3987. n instanceof i ? (t.Logger.warning("MovieClip#constructor接口参数已经变更,请尽快调整用法为 new MovieClip(data,texture)"), this.delegate = n) : this.delegate = new i(n, r);
  3988. this.delegate.setMovieClip(this)
  3989. }
  3990. __extends(n, e);
  3991. n.prototype.gotoAndPlay = function(t) {
  3992. this.delegate.gotoAndPlay(t)
  3993. };
  3994. n.prototype.gotoAndStop = function(t) {
  3995. this.delegate.gotoAndStop(t)
  3996. };
  3997. n.prototype.stop = function() {
  3998. this.delegate.stop()
  3999. };
  4000. n.prototype.dispose = function() {
  4001. this.delegate.dispose()
  4002. };
  4003. n.prototype.release = function() {
  4004. t.Logger.warning("MovieClip#release方法即将废弃");
  4005. this.dispose()
  4006. };
  4007. n.prototype.getCurrentFrameIndex = function() {
  4008. t.Logger.warning("MovieClip#getCurrentFrameIndex方法即将废弃");
  4009. return this.delegate._currentFrameIndex
  4010. };
  4011. n.prototype.getTotalFrame = function() {
  4012. t.Logger.warning("MovieClip#getTotalFrame方法即将废弃");
  4013. return this.delegate._totalFrame
  4014. };
  4015. n.prototype.setInterval = function(e) {
  4016. t.Logger.warning("MovieClip#setInterval方法即将废弃,请使用MovieClip#frameRate代替");
  4017. this.frameRate = 60 / e
  4018. };
  4019. n.prototype.getIsPlaying = function() {
  4020. t.Logger.warning("MovieClip#getIsPlaying方法即将废弃");
  4021. return this.delegate.isPlaying
  4022. };
  4023. return n
  4024. }(t.DisplayObjectContainer);
  4025. t.MovieClip = e;
  4026. e.prototype.__class__ = "egret.MovieClip";
  4027. var i = function() {
  4028. function e(e, i) {
  4029. this.data = e;
  4030. this._currentFrameIndex = this._passTime = this._totalFrame = 0;
  4031. this._isPlaying = !1;
  4032. this._frameData = e;
  4033. this._spriteSheet = new t.SpriteSheet(i)
  4034. }
  4035. e.prototype.setMovieClip = function(e) {
  4036. this.movieClip = e;
  4037. this.bitmap = new t.Bitmap;
  4038. this.movieClip.addChild(this.bitmap)
  4039. };
  4040. e.prototype.gotoAndPlay = function(e) {
  4041. this.checkHasFrame(e);
  4042. this._isPlaying = !0;
  4043. this._currentFrameIndex = 0;
  4044. this._currentFrameName = e;
  4045. this._totalFrame = this._frameData.frames[e].totalFrame;
  4046. this.playNextFrame();
  4047. this._passTime = 0;
  4048. t.Ticker.getInstance().register(this.update, this)
  4049. };
  4050. e.prototype.gotoAndStop = function(t) {
  4051. this.checkHasFrame(t);
  4052. this.stop();
  4053. this._currentFrameIndex = this._passTime = 0;
  4054. this._currentFrameName = t;
  4055. this._totalFrame = this._frameData.frames[t].totalFrame;
  4056. this.playNextFrame()
  4057. };
  4058. e.prototype.stop = function() {
  4059. this._isPlaying = !1;
  4060. t.Ticker.getInstance().unregister(this.update, this)
  4061. };
  4062. e.prototype.dispose = function() {};
  4063. e.prototype.checkHasFrame = function(e) {
  4064. void 0 == this._frameData.frames[e] && t.Logger.fatal("MovieClip没有对应的frame:", e)
  4065. };
  4066. e.prototype.update = function(t) {
  4067. for (var e = 1e3 / this.movieClip.frameRate, e = Math.floor((this._passTime % e + t) / e); 1 <= e;) 1 == e ? this.playNextFrame() : this.playNextFrame(!1), e--;
  4068. this._passTime += t
  4069. };
  4070. e.prototype.playNextFrame = function(e) {
  4071. void 0 === e && (e = !0);
  4072. var i = this._frameData.frames[this._currentFrameName].childrenFrame[this._currentFrameIndex];
  4073. if (e) {
  4074. e = this.getTexture(i.res);
  4075. var n = this.bitmap;
  4076. n.x = i.x;
  4077. n.y = i.y;
  4078. n.texture = e
  4079. }
  4080. null != i.action && this.movieClip.dispatchEventWith(i.action);
  4081. this._currentFrameIndex++;
  4082. this._currentFrameIndex == this._totalFrame && (this._currentFrameIndex = 0, i.action != t.Event.COMPLETE && this.movieClip.dispatchEventWith(t.Event.COMPLETE))
  4083. };
  4084. e.prototype.getTexture = function(t) {
  4085. var e = this._frameData.res[t],
  4086. i = this._spriteSheet.getTexture(t);
  4087. i || (i = this._spriteSheet.createTexture(t, e.x, e.y, e.w, e.h));
  4088. return i
  4089. };
  4090. return e
  4091. }();
  4092. t.DefaultMovieClipDelegate = i;
  4093. i.prototype.__class__ = "egret.DefaultMovieClipDelegate"
  4094. })(egret || (egret = {}));
  4095. __extends = this.__extends || function(t, e) {
  4096. function i() {
  4097. this.constructor = t
  4098. }
  4099. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4100. i.prototype = e.prototype;
  4101. t.prototype = new i
  4102. };
  4103. (function(t) {
  4104. var e = function(t) {
  4105. function e() {
  4106. t.call(this);
  4107. this._scaleY = this._scaleX = 1;
  4108. this._size = 30;
  4109. this._color = "#FFFFFF";
  4110. this._fontFamily = "Arial";
  4111. this._italic = this._bold = !1;
  4112. this._textAlign = "left";
  4113. this._multiline = this._visible = !1;
  4114. this._maxChars = 0
  4115. }
  4116. __extends(e, t);
  4117. e.prototype._getText = function() {
  4118. return null
  4119. };
  4120. e.prototype._setText = function(t) {};
  4121. e.prototype._setTextType = function(t) {};
  4122. e.prototype._getTextType = function() {
  4123. return null
  4124. };
  4125. e.prototype._open = function(t, e, i, n) {};
  4126. e.prototype._show = function() {};
  4127. e.prototype._add = function() {};
  4128. e.prototype._remove = function() {};
  4129. e.prototype._hide = function() {};
  4130. e.prototype._addListeners = function() {};
  4131. e.prototype._removeListeners = function() {};
  4132. e.prototype._setScale = function(t, e) {
  4133. this._scaleX = t;
  4134. this._scaleY = e
  4135. };
  4136. e.prototype.changePosition = function(t, e) {};
  4137. e.prototype._setSize = function(t) {
  4138. this._size = t
  4139. };
  4140. e.prototype._setTextColor = function(t) {
  4141. this._color = t
  4142. };
  4143. e.prototype._setTextFontFamily = function(t) {
  4144. this._fontFamily = t
  4145. };
  4146. e.prototype._setBold = function(t) {
  4147. this._bold = t
  4148. };
  4149. e.prototype._setItalic = function(t) {
  4150. this._italic = t
  4151. };
  4152. e.prototype._setTextAlign = function(t) {
  4153. this._textAlign = t
  4154. };
  4155. e.prototype._setVisible = function(t) {
  4156. this._visible = t
  4157. };
  4158. e.prototype._setWidth = function(t) {};
  4159. e.prototype._setHeight = function(t) {};
  4160. e.prototype._setMultiline = function(t) {
  4161. this._multiline = t
  4162. };
  4163. e.prototype._setMaxChars = function(t) {
  4164. this._maxChars = t
  4165. };
  4166. e.prototype._resetStageText = function() {};
  4167. e.create = function() {
  4168. return null
  4169. };
  4170. return e
  4171. }(t.EventDispatcher);
  4172. t.StageText = e;
  4173. e.prototype.__class__ = "egret.StageText"
  4174. })(egret || (egret = {}));
  4175. (function(t) {
  4176. var e = function() {
  4177. function t() {}
  4178. t.GET = "get";
  4179. t.POST = "post";
  4180. return t
  4181. }();
  4182. t.URLRequestMethod = e;
  4183. e.prototype.__class__ = "egret.URLRequestMethod"
  4184. })(egret || (egret = {}));
  4185. (function(t) {
  4186. var e = function() {
  4187. function t() {}
  4188. t.BINARY = "binary";
  4189. t.TEXT = "text";
  4190. t.VARIABLES = "variables";
  4191. t.TEXTURE = "texture";
  4192. t.SOUND = "sound";
  4193. return t
  4194. }();
  4195. t.URLLoaderDataFormat = e;
  4196. e.prototype.__class__ = "egret.URLLoaderDataFormat"
  4197. })(egret || (egret = {}));
  4198. __extends = this.__extends || function(t, e) {
  4199. function i() {
  4200. this.constructor = t
  4201. }
  4202. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4203. i.prototype = e.prototype;
  4204. t.prototype = new i
  4205. };
  4206. (function(t) {
  4207. var e = function(t) {
  4208. function e(e) {
  4209. void 0 === e && (e = null);
  4210. t.call(this);
  4211. null !== e && this.decode(e)
  4212. }
  4213. __extends(e, t);
  4214. e.prototype.decode = function(t) {
  4215. this.variables || (this.variables = {});
  4216. t = t.split("+").join(" ");
  4217. for (var e, i = /[?&]?([^=]+)=([^&]*)/g; e = i.exec(t);) this.variables[decodeURIComponent(e[1])] = decodeURIComponent(e[2])
  4218. };
  4219. e.prototype.toString = function() {
  4220. if (!this.variables) return "";
  4221. var t = this.variables,
  4222. e = "",
  4223. i = !0,
  4224. n;
  4225. for (n in t) i ? i = !1 : e += "&", e += n + "=" + t[n];
  4226. return e
  4227. };
  4228. return e
  4229. }(t.HashObject);
  4230. t.URLVariables = e;
  4231. e.prototype.__class__ = "egret.URLVariables"
  4232. })(egret || (egret = {}));
  4233. (function(t) {
  4234. var e = function() {
  4235. return function(t, e) {
  4236. this.name = t;
  4237. this.value = e
  4238. }
  4239. }();
  4240. t.URLRequestHeader = e;
  4241. e.prototype.__class__ = "egret.URLRequestHeader"
  4242. })(egret || (egret = {}));
  4243. __extends = this.__extends || function(t, e) {
  4244. function i() {
  4245. this.constructor = t
  4246. }
  4247. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4248. i.prototype = e.prototype;
  4249. t.prototype = new i
  4250. };
  4251. (function(t) {
  4252. var e = function(e) {
  4253. function i(i) {
  4254. void 0 === i && (i = null);
  4255. e.call(this);
  4256. this.method = t.URLRequestMethod.GET;
  4257. this.url = i
  4258. }
  4259. __extends(i, e);
  4260. return i
  4261. }(t.HashObject);
  4262. t.URLRequest = e;
  4263. e.prototype.__class__ = "egret.URLRequest"
  4264. })(egret || (egret = {}));
  4265. __extends = this.__extends || function(t, e) {
  4266. function i() {
  4267. this.constructor = t
  4268. }
  4269. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4270. i.prototype = e.prototype;
  4271. t.prototype = new i
  4272. };
  4273. (function(t) {
  4274. var e = function(e) {
  4275. function i(i) {
  4276. void 0 === i && (i = null);
  4277. e.call(this);
  4278. this.dataFormat = t.URLLoaderDataFormat.TEXT;
  4279. this._status = -1;
  4280. i && this.load(i)
  4281. }
  4282. __extends(i, e);
  4283. i.prototype.load = function(e) {
  4284. this._request = e;
  4285. this.data = null;
  4286. t.MainContext.instance.netContext.proceed(this)
  4287. };
  4288. return i
  4289. }(t.EventDispatcher);
  4290. t.URLLoader = e;
  4291. e.prototype.__class__ = "egret.URLLoader"
  4292. })(egret || (egret = {}));
  4293. __extends = this.__extends || function(t, e) {
  4294. function i() {
  4295. this.constructor = t
  4296. }
  4297. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4298. i.prototype = e.prototype;
  4299. t.prototype = new i
  4300. };
  4301. (function(t) {
  4302. var e = function(e) {
  4303. function i() {
  4304. e.call(this);
  4305. this._textureHeight = this._textureWidth = this._offsetY = this._offsetX = this._bitmapHeight = this._bitmapWidth = this._bitmapY = this._bitmapX = 0
  4306. }
  4307. __extends(i, e);
  4308. Object.defineProperty(i.prototype, "textureWidth", {
  4309. get: function() {
  4310. return this._textureWidth
  4311. },
  4312. enumerable: !0,
  4313. configurable: !0
  4314. });
  4315. Object.defineProperty(i.prototype, "textureHeight", {
  4316. get: function() {
  4317. return this._textureHeight
  4318. },
  4319. enumerable: !0,
  4320. configurable: !0
  4321. });
  4322. Object.defineProperty(i.prototype, "bitmapData", {
  4323. get: function() {
  4324. return this._bitmapData
  4325. },
  4326. enumerable: !0,
  4327. configurable: !0
  4328. });
  4329. i.prototype._setBitmapData = function(e) {
  4330. var i = t.MainContext.instance.rendererContext.texture_scale_factor;
  4331. this._bitmapData = e;
  4332. this._sourceWidth = e.width;
  4333. this._sourceHeight = e.height;
  4334. this._textureWidth = this._sourceWidth * i;
  4335. this._textureHeight = this._sourceHeight * i;
  4336. this._bitmapWidth = this._textureWidth;
  4337. this._bitmapHeight = this._textureHeight;
  4338. this._offsetX = this._offsetY = this._bitmapX = this._bitmapY = 0
  4339. };
  4340. i.prototype.getPixel32 = function(t, e) {
  4341. return this._bitmapData.getContext("2d").getImageData(t, e, 1, 1).data
  4342. };
  4343. return i
  4344. }(t.HashObject);
  4345. t.Texture = e;
  4346. e.prototype.__class__ = "egret.Texture"
  4347. })(egret || (egret = {}));
  4348. __extends = this.__extends || function(t, e) {
  4349. function i() {
  4350. this.constructor = t
  4351. }
  4352. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4353. i.prototype = e.prototype;
  4354. t.prototype = new i
  4355. };
  4356. (function(t) {
  4357. var e = function(e) {
  4358. function i() {
  4359. e.call(this);
  4360. this._bitmapData = document.createElement("canvas");
  4361. this.renderContext = t.RendererContext.createRendererContext(this._bitmapData)
  4362. }
  4363. __extends(i, e);
  4364. i.prototype.drawToTexture = function(e) {
  4365. var n = this._bitmapData,
  4366. r = e.getBounds(t.Rectangle.identity);
  4367. if (0 == r.width || 0 == r.height) return t.Logger.warning("egret.RenderTexture#drawToTexture:显示对象测量结果宽高为0,请检查"), !1;
  4368. r.width = Math.floor(r.width);
  4369. r.height = Math.floor(r.height);
  4370. n.width = r.width;
  4371. n.height = r.height;
  4372. this.renderContext._cacheCanvas && (this.renderContext._cacheCanvas.width = r.width, this.renderContext._cacheCanvas.height = r.height);
  4373. i.identityRectangle.width = r.width;
  4374. i.identityRectangle.height = r.height;
  4375. e._worldTransform.identity();
  4376. e.worldAlpha = 1;
  4377. if (e instanceof t.DisplayObjectContainer) {
  4378. var n = e._anchorOffsetX,
  4379. o = e._anchorOffsetY;
  4380. if (0 != e._anchorX || 0 != e._anchorY) n = e._anchorX * r.width, o = e._anchorY * r.height;
  4381. this._offsetX = r.x + n;
  4382. this._offsetY = r.y + o;
  4383. e._worldTransform.append(1, 0, 0, 1, -this._offsetX, -this._offsetY);
  4384. r = e._children;
  4385. n = 0;
  4386. for (o = r.length; n < o; n++) r[n]._updateTransform()
  4387. }
  4388. r = t.RenderFilter.getInstance();
  4389. n = r._drawAreaList.concat();
  4390. r._drawAreaList.length = 0;
  4391. this.renderContext.clearScreen();
  4392. this.renderContext.onRenderStart();
  4393. this.webGLTexture = null;
  4394. (o = e.mask || e._scrollRect) && this.renderContext.pushMask(o);
  4395. e._render(this.renderContext);
  4396. o && this.renderContext.popMask();
  4397. r.addDrawArea(i.identityRectangle);
  4398. this.renderContext.onRenderFinish();
  4399. r._drawAreaList = n;
  4400. this._textureWidth = this._bitmapData.width;
  4401. this._textureHeight = this._bitmapData.height;
  4402. this._sourceWidth = this._textureWidth;
  4403. this._sourceHeight = this._textureHeight;
  4404. return !0
  4405. };
  4406. i.identityRectangle = new t.Rectangle;
  4407. return i
  4408. }(t.Texture);
  4409. t.RenderTexture = e;
  4410. e.prototype.__class__ = "egret.RenderTexture"
  4411. })(egret || (egret = {}));
  4412. __extends = this.__extends || function(t, e) {
  4413. function i() {
  4414. this.constructor = t
  4415. }
  4416. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4417. i.prototype = e.prototype;
  4418. t.prototype = new i
  4419. };
  4420. (function(t) {
  4421. var e = function(e) {
  4422. function i() {
  4423. e.call(this);
  4424. this.renderCost = 0;
  4425. this.texture_scale_factor = 1;
  4426. this.profiler = t.Profiler.getInstance()
  4427. }
  4428. __extends(i, e);
  4429. i.prototype.clearScreen = function() {};
  4430. i.prototype.clearRect = function(t, e, i, n) {};
  4431. i.prototype.drawImage = function(t, e, i, n, r, o, s, a, h, c) {
  4432. this.profiler.onDrawImage()
  4433. };
  4434. i.prototype.setTransform = function(t) {};
  4435. i.prototype.setAlpha = function(t, e) {};
  4436. i.prototype.setupFont = function(t, e) {};
  4437. i.prototype.measureText = function(t) {
  4438. return 0
  4439. };
  4440. i.prototype.drawText = function(t, e, i, n, r, o) {
  4441. this.profiler.onDrawImage()
  4442. };
  4443. i.prototype.strokeRect = function(t, e, i, n, r) {};
  4444. i.prototype.pushMask = function(t) {};
  4445. i.prototype.popMask = function() {};
  4446. i.prototype.onRenderStart = function() {};
  4447. i.prototype.onRenderFinish = function() {};
  4448. i.prototype.setGlobalColorTransform = function(t) {};
  4449. i.createRendererContext = function(t) {
  4450. return null
  4451. };
  4452. i.imageSmoothingEnabled = !0;
  4453. return i
  4454. }(t.HashObject);
  4455. t.RendererContext = e;
  4456. e.prototype.__class__ = "egret.RendererContext"
  4457. })(egret || (egret = {}));
  4458. (function(t) {
  4459. var e = function() {
  4460. function t() {}
  4461. t.MOUSE = "mouse";
  4462. t.TOUCH = "touch";
  4463. t.mode = "touch";
  4464. return t
  4465. }();
  4466. t.InteractionMode = e;
  4467. e.prototype.__class__ = "egret.InteractionMode"
  4468. })(egret || (egret = {}));
  4469. __extends = this.__extends || function(t, e) {
  4470. function i() {
  4471. this.constructor = t
  4472. }
  4473. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4474. i.prototype = e.prototype;
  4475. t.prototype = new i
  4476. };
  4477. (function(t) {
  4478. var e = function(e) {
  4479. function i() {
  4480. e.call(this);
  4481. this._currentTouchTarget = {};
  4482. this.maxTouches = 2;
  4483. this.touchDownTarget = {};
  4484. this.touchingIdentifiers = [];
  4485. this.lastTouchY = this.lastTouchX = -1
  4486. }
  4487. __extends(i, e);
  4488. i.prototype.run = function() {};
  4489. i.prototype.getTouchData = function(t, e, i) {
  4490. var n = this._currentTouchTarget[t];
  4491. null == n && (n = {}, this._currentTouchTarget[t] = n);
  4492. n.stageX = e;
  4493. n.stageY = i;
  4494. n.identifier = t;
  4495. return n
  4496. };
  4497. i.prototype.dispatchEvent = function(e, i) {
  4498. t.TouchEvent.dispatchTouchEvent(i.target, e, i.identifier, i.stageX, i.stageY, !1, !1, !1, !0 == this.touchDownTarget[i.identifier])
  4499. };
  4500. i.prototype.onTouchBegan = function(e, i, n) {
  4501. if (this.touchingIdentifiers.length != this.maxTouches) {
  4502. var r = t.MainContext.instance.stage.hitTest(e, i);
  4503. r && (e = this.getTouchData(n, e, i), this.touchDownTarget[n] = !0, e.target = r, e.beginTarget = r, this.dispatchEvent(t.TouchEvent.TOUCH_BEGIN, e));
  4504. this.touchingIdentifiers.push(n)
  4505. }
  4506. };
  4507. i.prototype.onTouchMove = function(e, i, n) {
  4508. if (-1 != this.touchingIdentifiers.indexOf(n) && (e != this.lastTouchX || i != this.lastTouchY)) {
  4509. this.lastTouchX = e;
  4510. this.lastTouchY = i;
  4511. var r = t.MainContext.instance.stage.hitTest(e, i);
  4512. r && (e = this.getTouchData(n, e, i), e.target = r, this.dispatchEvent(t.TouchEvent.TOUCH_MOVE, e))
  4513. }
  4514. };
  4515. i.prototype.onTouchEnd = function(e, i, n) {
  4516. var r = this.touchingIdentifiers.indexOf(n); - 1 != r && (this.touchingIdentifiers.splice(r, 1), r = t.MainContext.instance.stage.hitTest(e, i)) && (e = this.getTouchData(n, e, i), delete this.touchDownTarget[n], n = e.beginTarget, e.target = r, this.dispatchEvent(t.TouchEvent.TOUCH_END, e), n == r ? this.dispatchEvent(t.TouchEvent.TOUCH_TAP, e) : e.beginTarget && (e.target = e.beginTarget, this.dispatchEvent(t.TouchEvent.TOUCH_RELEASE_OUTSIDE, e)), delete this._currentTouchTarget[e.identifier])
  4517. };
  4518. return i
  4519. }(t.HashObject);
  4520. t.TouchContext = e;
  4521. e.prototype.__class__ = "egret.TouchContext"
  4522. })(egret || (egret = {}));
  4523. __extends = this.__extends || function(t, e) {
  4524. function i() {
  4525. this.constructor = t
  4526. }
  4527. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4528. i.prototype = e.prototype;
  4529. t.prototype = new i
  4530. };
  4531. (function(t) {
  4532. var e = function(e) {
  4533. function i() {
  4534. e.call(this)
  4535. }
  4536. __extends(i, e);
  4537. i.prototype.proceed = function(t) {};
  4538. i._getUrl = function(e) {
  4539. var i = e.url; - 1 == i.indexOf("?") && e.method == t.URLRequestMethod.GET && e.data && e.data instanceof t.URLVariables && (i = i + "?" + e.data.toString());
  4540. return i
  4541. };
  4542. i.prototype.getChangeList = function() {
  4543. return []
  4544. };
  4545. return i
  4546. }(t.HashObject);
  4547. t.NetContext = e;
  4548. e.prototype.__class__ = "egret.NetContext"
  4549. })(egret || (egret = {}));
  4550. __extends = this.__extends || function(t, e) {
  4551. function i() {
  4552. this.constructor = t
  4553. }
  4554. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4555. i.prototype = e.prototype;
  4556. t.prototype = new i
  4557. };
  4558. (function(t) {
  4559. var e = function(t) {
  4560. function e() {
  4561. t.call(this);
  4562. this.frameRate = 60
  4563. }
  4564. __extends(e, t);
  4565. e.prototype.executeMainLoop = function(t, e) {};
  4566. return e
  4567. }(t.HashObject);
  4568. t.DeviceContext = e;
  4569. e.prototype.__class__ = "egret.DeviceContext"
  4570. })(egret || (egret = {}));
  4571. (function(t) {
  4572. var e = function() {
  4573. function t() {}
  4574. t.call = function(t, e) {};
  4575. t.addCallback = function(t, e) {};
  4576. return t
  4577. }();
  4578. t.ExternalInterface = e;
  4579. e.prototype.__class__ = "egret.ExternalInterface"
  4580. })(egret || (egret = {}));
  4581. __extends = this.__extends || function(t, e) {
  4582. function i() {
  4583. this.constructor = t
  4584. }
  4585. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4586. i.prototype = e.prototype;
  4587. t.prototype = new i
  4588. };
  4589. (function(t) {
  4590. var e = function(e) {
  4591. function i() {
  4592. e.call(this);
  4593. this.ua = navigator.userAgent.toLowerCase();
  4594. this.trans = this._getTrans()
  4595. }
  4596. __extends(i, e);
  4597. i.getInstance = function() {
  4598. null == i.instance && (i.instance = new i);
  4599. return i.instance
  4600. };
  4601. Object.defineProperty(i.prototype, "isMobile", {
  4602. get: function() {
  4603. t.Logger.warning("Browser.isMobile接口参数已经变更,请尽快调整用法为 egret.MainContext.deviceType == egret.MainContext.DEVICE_MOBILE ");
  4604. return t.MainContext.deviceType == t.MainContext.DEVICE_MOBILE
  4605. },
  4606. enumerable: !0,
  4607. configurable: !0
  4608. });
  4609. i.prototype._getHeader = function(t) {
  4610. if ("transform" in t) return "";
  4611. for (var e = ["webkit", "ms", "Moz", "O"], i = 0; i < e.length; i++)
  4612. if (e[i] + "Transform" in t) return e[i];
  4613. return ""
  4614. };
  4615. i.prototype._getTrans = function() {
  4616. var t = document.createElement("div").style,
  4617. t = this._getHeader(t);
  4618. return "" == t ? "transform" : t + "Transform"
  4619. };
  4620. i.prototype.$new = function(t) {
  4621. return this.$(document.createElement(t))
  4622. };
  4623. i.prototype.$ = function(e) {
  4624. var n = document;
  4625. if (e = e instanceof HTMLElement ? e : n.querySelector(e)) e.find = e.find || this.$, e.hasClass = e.hasClass || function(t) {
  4626. return this.className.match(new RegExp("(\\s|^)" + t + "(\\s|$)"))
  4627. }, e.addClass = e.addClass || function(t) {
  4628. this.hasClass(t) || (this.className && (this.className += " "), this.className += t);
  4629. return this
  4630. }, e.removeClass = e.removeClass || function(t) {
  4631. this.hasClass(t) && (this.className = this.className.replace(t, ""));
  4632. return this
  4633. }, e.remove = e.remove || function() {}, e.appendTo = e.appendTo || function(t) {
  4634. t.appendChild(this);
  4635. return this
  4636. }, e.prependTo = e.prependTo || function(t) {
  4637. t.childNodes[0] ? t.insertBefore(this, t.childNodes[0]) : t.appendChild(this);
  4638. return this
  4639. }, e.transforms = e.transforms || function() {
  4640. this.style[i.getInstance().trans] = i.getInstance().translate(this.position) + i.getInstance().rotate(this.rotation) + i.getInstance().scale(this.scale) + i.getInstance().skew(this.skew);
  4641. return this
  4642. }, e.position = e.position || {
  4643. x: 0,
  4644. y: 0
  4645. }, e.rotation = e.rotation || 0, e.scale = e.scale || {
  4646. x: 1,
  4647. y: 1
  4648. }, e.skew = e.skew || {
  4649. x: 0,
  4650. y: 0
  4651. }, e.translates = function(e, i) {
  4652. this.position.x = e;
  4653. this.position.y = i - t.MainContext.instance.stage.stageHeight;
  4654. this.transforms();
  4655. return this
  4656. }, e.rotate = function(t) {
  4657. this.rotation = t;
  4658. this.transforms();
  4659. return this
  4660. }, e.resize = function(t, e) {
  4661. this.scale.x = t;
  4662. this.scale.y = e;
  4663. this.transforms();
  4664. return this
  4665. }, e.setSkew = function(t, e) {
  4666. this.skew.x = t;
  4667. this.skew.y = e;
  4668. this.transforms();
  4669. return this
  4670. };
  4671. return e
  4672. };
  4673. i.prototype.translate = function(t) {
  4674. return "translate(" + t.x + "px, " + t.y + "px) "
  4675. };
  4676. i.prototype.rotate = function(t) {
  4677. return "rotate(" + t + "deg) "
  4678. };
  4679. i.prototype.scale = function(t) {
  4680. return "scale(" + t.x + ", " + t.y + ") "
  4681. };
  4682. i.prototype.skew = function(t) {
  4683. return "skewX(" + -t.x + "deg) skewY(" + t.y + "deg)"
  4684. };
  4685. return i
  4686. }(t.HashObject);
  4687. t.Browser = e;
  4688. e.prototype.__class__ = "egret.Browser"
  4689. })(egret || (egret = {}));
  4690. (function(t) {
  4691. (function(t) {
  4692. t.getItem = function(t) {
  4693. return null
  4694. };
  4695. t.setItem = function(t, e) {
  4696. return !1
  4697. };
  4698. t.removeItem = function(t) {};
  4699. t.clear = function() {}
  4700. })(t.localStorage || (t.localStorage = {}))
  4701. })(egret || (egret = {}));
  4702. (function(t) {
  4703. var e = function() {
  4704. function e() {}
  4705. e.parse = function(i) {
  4706. i = t.SAXParser.getInstance().parserXML(i);
  4707. if (!i || !i.childNodes) return null;
  4708. for (var n = i.childNodes.length, r = !1, o = 0; o < n; o++) {
  4709. var s = i.childNodes[o];
  4710. if (1 == s.nodeType) {
  4711. r = !0;
  4712. break
  4713. }
  4714. }
  4715. return r ? e.parseNode(s) : null
  4716. };
  4717. e.parseNode = function(t) {
  4718. if (!t || 1 != t.nodeType) return null;
  4719. var i = {};
  4720. i.localName = t.localName;
  4721. i.name = t.nodeName;
  4722. t.namespaceURI && (i.namespace = t.namespaceURI);
  4723. t.prefix && (i.prefix = t.prefix);
  4724. for (var n = t.attributes, r = n.length, o = 0; o < r; o++) {
  4725. var s = n[o],
  4726. a = s.name;
  4727. 0 != a.indexOf("xmlns:") && (i["$" + a] = s.value)
  4728. }
  4729. n = t.childNodes;
  4730. r = n.length;
  4731. for (o = 0; o < r; o++)
  4732. if (s = e.parseNode(n[o])) i.children || (i.children = []), s.parent = i, i.children.push(s);!i.children && (t = t.textContent.trim()) && (i.text = t);
  4733. return i
  4734. };
  4735. e.findChildren = function(t, i, n) {
  4736. n ? n.length = 0 : n = [];
  4737. e.findByPath(t, i, n);
  4738. return n
  4739. };
  4740. e.findByPath = function(t, i, n) {
  4741. var r = i.indexOf("."),
  4742. o; - 1 == r ? (o = i, r = !0) : (o = i.substring(0, r), i = i.substring(r + 1), r = !1);
  4743. if (t = t.children)
  4744. for (var s = t.length, a = 0; a < s; a++) {
  4745. var h = t[a];
  4746. h.localName == o && (r ? n.push(h) : e.findByPath(h, i, n))
  4747. }
  4748. };
  4749. e.getAttributes = function(t, e) {
  4750. e ? e.length = 0 : e = [];
  4751. for (var i in t) "$" == i.charAt(0) && e.push(i.substring(1));
  4752. return e
  4753. };
  4754. return e
  4755. }();
  4756. t.XML = e;
  4757. e.prototype.__class__ = "egret.XML"
  4758. })(egret || (egret = {}));
  4759. (function(t) {
  4760. var e = function() {
  4761. function t() {}
  4762. t.LITTLE_ENDIAN = "LITTLE_ENDIAN";
  4763. t.BIG_ENDIAN = "BIG_ENDIAN";
  4764. return t
  4765. }();
  4766. t.Endian = e;
  4767. e.prototype.__class__ = "egret.Endian";
  4768. var i = function() {
  4769. function t() {
  4770. this.length = this.position = 0;
  4771. this._mode = "";
  4772. this.maxlength = 0;
  4773. this._endian = e.LITTLE_ENDIAN;
  4774. this.isLittleEndian = !1;
  4775. this._mode = "Typed array";
  4776. this.maxlength = 4;
  4777. this.arraybytes = new ArrayBuffer(this.maxlength);
  4778. this.unalignedarraybytestemp = new ArrayBuffer(16);
  4779. this.endian = t.DEFAULT_ENDIAN
  4780. }
  4781. Object.defineProperty(t.prototype, "endian", {
  4782. get: function() {
  4783. return this._endian
  4784. },
  4785. set: function(t) {
  4786. this._endian = t;
  4787. this.isLittleEndian = t == e.LITTLE_ENDIAN
  4788. },
  4789. enumerable: !0,
  4790. configurable: !0
  4791. });
  4792. t.prototype.ensureWriteableSpace = function(t) {
  4793. this.ensureSpace(t + this.position)
  4794. };
  4795. t.prototype.setArrayBuffer = function(t) {
  4796. this.ensureSpace(t.byteLength);
  4797. this.length = t.byteLength;
  4798. t = new Int8Array(t);
  4799. new Int8Array(this.arraybytes, 0, this.length).set(t);
  4800. this.position = 0
  4801. };
  4802. Object.defineProperty(t.prototype, "bytesAvailable", {
  4803. get: function() {
  4804. return this.length - this.position
  4805. },
  4806. enumerable: !0,
  4807. configurable: !0
  4808. });
  4809. t.prototype.ensureSpace = function(t) {
  4810. if (t > this.maxlength) {
  4811. t = t + 255 & -256;
  4812. var e = new ArrayBuffer(t),
  4813. i = new Uint8Array(this.arraybytes, 0, this.length);
  4814. new Uint8Array(e, 0, this.length).set(i);
  4815. this.arraybytes = e;
  4816. this.maxlength = t
  4817. }
  4818. };
  4819. t.prototype.writeByte = function(t) {
  4820. this.ensureWriteableSpace(1);
  4821. new Int8Array(this.arraybytes)[this.position++] = ~~t;
  4822. this.position > this.length && (this.length = this.position)
  4823. };
  4824. t.prototype.readByte = function() {
  4825. if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
  4826. return new Int8Array(this.arraybytes)[this.position++]
  4827. };
  4828. t.prototype.readBytes = function(t, e, i) {
  4829. void 0 === e && (e = 0);
  4830. void 0 === i && (i = 0);
  4831. null == i && (i = t.length);
  4832. t.ensureWriteableSpace(e + i);
  4833. var n = new Int8Array(t.arraybytes),
  4834. r = new Int8Array(this.arraybytes);
  4835. n.set(r.subarray(this.position, this.position + i), e);
  4836. this.position += i;
  4837. i + e > t.length && (t.length += i + e - t.length)
  4838. };
  4839. t.prototype.writeUnsignedByte = function(t) {
  4840. this.ensureWriteableSpace(1);
  4841. new Uint8Array(this.arraybytes)[this.position++] = ~~t & 255;
  4842. this.position > this.length && (this.length = this.position)
  4843. };
  4844. t.prototype.readUnsignedByte = function() {
  4845. if (this.position >= this.length) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
  4846. return new Uint8Array(this.arraybytes)[this.position++]
  4847. };
  4848. t.prototype.writeUnsignedShort = function(t) {
  4849. this.ensureWriteableSpace(2);
  4850. if (0 == (this.position & 1)) {
  4851. var e = new Uint16Array(this.arraybytes);
  4852. e[this.position >> 1] = ~~t & 65535
  4853. } else e = new Uint16Array(this.unalignedarraybytestemp, 0, 1), e[0] = ~~t & 65535, t = new Uint8Array(this.arraybytes, this.position, 2), e = new Uint8Array(this.unalignedarraybytestemp, 0, 2), t.set(e);
  4854. this.position += 2;
  4855. this.position > this.length && (this.length = this.position)
  4856. };
  4857. t.prototype.readUTFBytes = function(t) {
  4858. var e = "";
  4859. t = this.position + t;
  4860. for (var i = new DataView(this.arraybytes); this.position < t;) {
  4861. var n = i.getUint8(this.position++);
  4862. if (128 > n) {
  4863. if (0 == n) break;
  4864. e += String.fromCharCode(n)
  4865. } else if (224 > n) e += String.fromCharCode((n & 63) << 6 | i.getUint8(this.position++) & 127);
  4866. else if (240 > n) var r = i.getUint8(this.position++),
  4867. e = e + String.fromCharCode((n & 31) << 12 | (r & 127) << 6 | i.getUint8(this.position++) & 127);
  4868. else var r = i.getUint8(this.position++),
  4869. o = i.getUint8(this.position++),
  4870. e = e + String.fromCharCode((n & 15) << 18 | (r & 127) << 12 | o << 6 & 127 | i.getUint8(this.position++) & 127)
  4871. }
  4872. return e
  4873. };
  4874. t.prototype.readInt = function() {
  4875. var t = new DataView(this.arraybytes).getInt32(this.position, this.isLittleEndian);
  4876. this.position += 4;
  4877. return t
  4878. };
  4879. t.prototype.readShort = function() {
  4880. var t = new DataView(this.arraybytes).getInt16(this.position, this.isLittleEndian);
  4881. this.position += 2;
  4882. return t
  4883. };
  4884. t.prototype.readDouble = function() {
  4885. var t = new DataView(this.arraybytes).getFloat64(this.position, this.isLittleEndian);
  4886. this.position += 8;
  4887. return t
  4888. };
  4889. t.prototype.readUnsignedShort = function() {
  4890. if (this.position > this.length + 2) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
  4891. if (0 == (this.position & 1)) {
  4892. var t = new Uint16Array(this.arraybytes),
  4893. e = this.position >> 1;
  4894. this.position += 2;
  4895. return t[e]
  4896. }
  4897. t = new Uint16Array(this.unalignedarraybytestemp, 0, 1);
  4898. e = new Uint8Array(this.arraybytes, this.position, 2);
  4899. new Uint8Array(this.unalignedarraybytestemp, 0, 2).set(e);
  4900. this.position += 2;
  4901. return t[0]
  4902. };
  4903. t.prototype.writeUnsignedInt = function(t) {
  4904. this.ensureWriteableSpace(4);
  4905. if (0 == (this.position & 3)) {
  4906. var e = new Uint32Array(this.arraybytes);
  4907. e[this.position >> 2] = ~~t & 4294967295
  4908. } else e = new Uint32Array(this.unalignedarraybytestemp, 0, 1), e[0] = ~~t & 4294967295, t = new Uint8Array(this.arraybytes, this.position, 4), e = new Uint8Array(this.unalignedarraybytestemp, 0, 4), t.set(e);
  4909. this.position += 4;
  4910. this.position > this.length && (this.length = this.position)
  4911. };
  4912. t.prototype.readUnsignedInt = function() {
  4913. if (this.position > this.length + 4) throw "ByteArray out of bounds read. Position=" + this.position + ", Length=" + this.length;
  4914. if (0 == (this.position & 3)) {
  4915. var t = new Uint32Array(this.arraybytes),
  4916. e = this.position >> 2;
  4917. this.position += 4;
  4918. return t[e]
  4919. }
  4920. t = new Uint32Array(this.unalignedarraybytestemp, 0, 1);
  4921. e = new Uint8Array(this.arraybytes, this.position, 4);
  4922. new Uint8Array(this.unalignedarraybytestemp, 0, 4).set(e);
  4923. this.position += 4;
  4924. return t[0]
  4925. };
  4926. t.prototype.writeFloat = function(t) {
  4927. this.ensureWriteableSpace(4);
  4928. if (0 == (this.position & 3)) {
  4929. var e = new Float32Array(this.arraybytes);
  4930. e[this.position >> 2] = t
  4931. } else e = new Float32Array(this.unalignedarraybytestemp, 0, 1), e[0] = t, t = new Uint8Array(this.arraybytes, this.position, 4), e = new Uint8Array(this.unalignedarraybytestemp, 0, 4), t.set(e);
  4932. this.position += 4;
  4933. this.position > this.length && (this.length = this.position)
  4934. };
  4935. t.prototype.readFloat = function() {
  4936. if (this.position > this.length + 4) throw "ByteArray out of bounds read. Positon=" + this.position + ", Length=" + this.length;
  4937. if (0 == (this.position & 3)) {
  4938. var t = new Float32Array(this.arraybytes),
  4939. e = this.position >> 2;
  4940. this.position += 4;
  4941. return t[e]
  4942. }
  4943. t = new Float32Array(this.unalignedarraybytestemp, 0, 1);
  4944. e = new Uint8Array(this.arraybytes, this.position, 4);
  4945. new Uint8Array(this.unalignedarraybytestemp, 0, 4).set(e);
  4946. this.position += 4;
  4947. return t[0]
  4948. };
  4949. t.DEFAULT_ENDIAN = e.BIG_ENDIAN;
  4950. return t
  4951. }();
  4952. t.ByteArray = i;
  4953. i.prototype.__class__ = "egret.ByteArray"
  4954. })(egret || (egret = {}));
  4955. __extends = this.__extends || function(t, e) {
  4956. function i() {
  4957. this.constructor = t
  4958. }
  4959. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  4960. i.prototype = e.prototype;
  4961. t.prototype = new i
  4962. };
  4963. (function(t) {
  4964. var e = function(e) {
  4965. function i(t, i, n) {
  4966. e.call(this);
  4967. this._target = null;
  4968. this.loop = this.ignoreGlobalPause = this._useTicks = !1;
  4969. this._actions = this._steps = this.pluginData = null;
  4970. this.paused = !1;
  4971. this.duration = 0;
  4972. this._prevPos = -1;
  4973. this.position = null;
  4974. this._stepPosition = this._prevPosition = 0;
  4975. this.passive = !1;
  4976. this.initialize(t, i, n)
  4977. }
  4978. __extends(i, e);
  4979. i.get = function(t, e, n, r) {
  4980. void 0 === e && (e = null);
  4981. void 0 === n && (n = null);
  4982. void 0 === r && (r = !1);
  4983. r && i.removeTweens(t);
  4984. return new i(t, e, n)
  4985. };
  4986. i.removeTweens = function(t) {
  4987. if (t.tween_count) {
  4988. for (var e = i._tweens, n = e.length - 1; 0 <= n; n--) e[n]._target == t && (e[n].paused = !0, e.splice(n, 1));
  4989. t.tween_count = 0
  4990. }
  4991. };
  4992. i.pauseTweens = function(e) {
  4993. if (e.tween_count)
  4994. for (var i = t.Tween._tweens, n = i.length - 1; 0 <= n; n--) i[n]._target == e && (i[n].paused = !0)
  4995. };
  4996. i.resumeTweens = function(e) {
  4997. if (e.tween_count)
  4998. for (var i = t.Tween._tweens, n = i.length - 1; 0 <= n; n--) i[n]._target == e && (i[n].paused = !1)
  4999. };
  5000. i.tick = function(t, e) {
  5001. void 0 === e && (e = !1);
  5002. for (var n = i._tweens.concat(), r = n.length - 1; 0 <= r; r--) {
  5003. var o = n[r];
  5004. e && !o.ignoreGlobalPause || o.paused || o.tick(o._useTicks ? 1 : t)
  5005. }
  5006. };
  5007. i._register = function(e, n) {
  5008. var r = e._target,
  5009. o = i._tweens;
  5010. if (n) r && (r.tween_count = r.tween_count ? r.tween_count + 1 : 1), o.push(e), i._inited || (t.Ticker.getInstance().register(i.tick, null), i._inited = !0);
  5011. else
  5012. for (r && r.tween_count--, r = o.length; r--;)
  5013. if (o[r] == e) {
  5014. o.splice(r, 1);
  5015. break
  5016. }
  5017. };
  5018. i.removeAllTweens = function() {
  5019. for (var t = i._tweens, e = 0, n = t.length; e < n; e++) {
  5020. var r = t[e];
  5021. r.paused = !0;
  5022. r._target.tweenjs_count = 0
  5023. }
  5024. t.length = 0
  5025. };
  5026. i.prototype.initialize = function(t, e, n) {
  5027. this._target = t;
  5028. e && (this._useTicks = e.useTicks, this.ignoreGlobalPause = e.ignoreGlobalPause, this.loop = e.loop, e.onChange && this.addEventListener("change", e.onChange, e.onChangeObj), e.override && i.removeTweens(t));
  5029. this.pluginData = n || {};
  5030. this._curQueueProps = {};
  5031. this._initQueueProps = {};
  5032. this._steps = [];
  5033. this._actions = [];
  5034. e && e.paused ? this.paused = !0 : i._register(this, !0);
  5035. e && null != e.position && this.setPosition(e.position, i.NONE)
  5036. };
  5037. i.prototype.setPosition = function(t, e) {
  5038. void 0 === e && (e = 1);
  5039. 0 > t && (t = 0);
  5040. var i = t,
  5041. n = !1;
  5042. i >= this.duration && (this.loop ? i %= this.duration : (i = this.duration, n = !0));
  5043. if (i == this._prevPos) return n;
  5044. var r = this._prevPos;
  5045. this.position = this._prevPos = i;
  5046. this._prevPosition = t;
  5047. if (this._target)
  5048. if (n) this._updateTargetProps(null, 1);
  5049. else if (0 < this._steps.length) {
  5050. for (var o = 0, s = this._steps.length; o < s && !(this._steps[o].t > i); o++);
  5051. o = this._steps[o - 1];
  5052. this._updateTargetProps(o, (this._stepPosition = i - o.t) / o.d)
  5053. }
  5054. 0 != e && 0 < this._actions.length && (this._useTicks ? this._runActions(i, i) : 1 == e && i < r ? (r != this.duration && this._runActions(r, this.duration), this._runActions(0, i, !0)) : this._runActions(r, i));
  5055. n && this.setPaused(!0);
  5056. this.dispatchEventWith("change");
  5057. return n
  5058. };
  5059. i.prototype._runActions = function(t, e, i) {
  5060. void 0 === i && (i = !1);
  5061. var n = t,
  5062. r = e,
  5063. o = -1,
  5064. s = this._actions.length,
  5065. a = 1;
  5066. t > e && (n = e, r = t, o = s, s = a = -1);
  5067. for (;
  5068. (o += a) != s;) {
  5069. e = this._actions[o];
  5070. var h = e.t;
  5071. (h == r || h > n && h < r || i && h == t) && e.f.apply(e.o, e.p)
  5072. }
  5073. };
  5074. i.prototype._updateTargetProps = function(t, e) {
  5075. var n, r, o, s;
  5076. if (t || 1 != e) {
  5077. if (this.passive = !!t.v) return;
  5078. t.e && (e = t.e(e, 0, 1, 1));
  5079. n = t.p0;
  5080. r = t.p1
  5081. } else this.passive = !1, n = r = this._curQueueProps;
  5082. for (var a in this._initQueueProps) {
  5083. null == (o = n[a]) && (n[a] = o = this._initQueueProps[a]);
  5084. null == (s = r[a]) && (r[a] = s = o);
  5085. o = o == s || 0 == e || 1 == e || "number" != typeof o ? 1 == e ? s : o : o + (s - o) * e;
  5086. var h = !1;
  5087. if (s = i._plugins[a])
  5088. for (var c = 0, u = s.length; c < u; c++) {
  5089. var l = s[c].tween(this, a, o, n, r, e, !!t && n == r, !t);
  5090. l == i.IGNORE ? h = !0 : o = l
  5091. }
  5092. h || (this._target[a] = o)
  5093. }
  5094. };
  5095. i.prototype.setPaused = function(t) {
  5096. this.paused = t;
  5097. i._register(this, !t);
  5098. return this
  5099. };
  5100. i.prototype._cloneProps = function(t) {
  5101. var e = {},
  5102. i;
  5103. for (i in t) e[i] = t[i];
  5104. return e
  5105. };
  5106. i.prototype._addStep = function(t) {
  5107. 0 < t.d && (this._steps.push(t), t.t = this.duration, this.duration += t.d);
  5108. return this
  5109. };
  5110. i.prototype._appendQueueProps = function(t) {
  5111. var e, n, r, o, s, a;
  5112. for (a in t)
  5113. if (void 0 === this._initQueueProps[a]) {
  5114. n = this._target[a];
  5115. if (e = i._plugins[a])
  5116. for (r = 0, o = e.length; r < o; r++) n = e[r].init(this, a, n);
  5117. this._initQueueProps[a] = this._curQueueProps[a] = void 0 === n ? null : n
  5118. }
  5119. for (a in t) {
  5120. n = this._curQueueProps[a];
  5121. if (e = i._plugins[a])
  5122. for (s = s || {}, r = 0, o = e.length; r < o; r++) e[r].step && e[r].step(this, a, n, t[a], s);
  5123. this._curQueueProps[a] = t[a]
  5124. }
  5125. s && this._appendQueueProps(s);
  5126. return this._curQueueProps
  5127. };
  5128. i.prototype._addAction = function(t) {
  5129. t.t = this.duration;
  5130. this._actions.push(t);
  5131. return this
  5132. };
  5133. i.prototype._set = function(t, e) {
  5134. for (var i in t) e[i] = t[i]
  5135. };
  5136. i.prototype.wait = function(t, e) {
  5137. if (null == t || 0 >= t) return this;
  5138. var i = this._cloneProps(this._curQueueProps);
  5139. return this._addStep({
  5140. d: t,
  5141. p0: i,
  5142. p1: i,
  5143. v: e
  5144. })
  5145. };
  5146. i.prototype.to = function(t, e, i) {
  5147. void 0 === i && (i = void 0);
  5148. if (isNaN(e) || 0 > e) e = 0;
  5149. return this._addStep({
  5150. d: e || 0,
  5151. p0: this._cloneProps(this._curQueueProps),
  5152. e: i,
  5153. p1: this._cloneProps(this._appendQueueProps(t))
  5154. })
  5155. };
  5156. i.prototype.call = function(t, e, i) {
  5157. void 0 === e && (e = void 0);
  5158. void 0 === i && (i = void 0);
  5159. return this._addAction({
  5160. f: t,
  5161. p: i ? i : [],
  5162. o: e ? e : this._target
  5163. })
  5164. };
  5165. i.prototype.set = function(t, e) {
  5166. void 0 === e && (e = null);
  5167. return this._addAction({
  5168. f: this._set,
  5169. o: this,
  5170. p: [t, e ? e : this._target]
  5171. })
  5172. };
  5173. i.prototype.play = function(t) {
  5174. t || (t = this);
  5175. return this.call(t.setPaused, t, [!1])
  5176. };
  5177. i.prototype.pause = function(t) {
  5178. t || (t = this);
  5179. return this.call(t.setPaused, t, [!0])
  5180. };
  5181. i.prototype.tick = function(t) {
  5182. this.paused || this.setPosition(this._prevPosition + t)
  5183. };
  5184. i.NONE = 0;
  5185. i.LOOP = 1;
  5186. i.REVERSE = 2;
  5187. i._tweens = [];
  5188. i.IGNORE = {};
  5189. i._plugins = {};
  5190. i._inited = !1;
  5191. return i
  5192. }(t.EventDispatcher);
  5193. t.Tween = e;
  5194. e.prototype.__class__ = "egret.Tween"
  5195. })(egret || (egret = {}));
  5196. (function(t) {
  5197. var e = function() {
  5198. function e() {
  5199. t.Logger.fatal("Ease不能被实例化")
  5200. }
  5201. e.get = function(t) {
  5202. -1 > t && (t = -1);
  5203. 1 < t && (t = 1);
  5204. return function(e) {
  5205. return 0 == t ? e : 0 > t ? e * (e * -t + 1 + t) : e * ((2 - e) * t + (1 - t))
  5206. }
  5207. };
  5208. e.getPowIn = function(t) {
  5209. return function(e) {
  5210. return Math.pow(e, t)
  5211. }
  5212. };
  5213. e.getPowOut = function(t) {
  5214. return function(e) {
  5215. return 1 - Math.pow(1 - e, t)
  5216. }
  5217. };
  5218. e.getPowInOut = function(t) {
  5219. return function(e) {
  5220. return 1 > (e *= 2) ? .5 * Math.pow(e, t) : 1 - .5 * Math.abs(Math.pow(2 - e, t))
  5221. }
  5222. };
  5223. e.sineIn = function(t) {
  5224. return 1 - Math.cos(t * Math.PI / 2)
  5225. };
  5226. e.sineOut = function(t) {
  5227. return Math.sin(t * Math.PI / 2)
  5228. };
  5229. e.sineInOut = function(t) {
  5230. return -.5 * (Math.cos(Math.PI * t) - 1)
  5231. };
  5232. e.getBackIn = function(t) {
  5233. return function(e) {
  5234. return e * e * ((t + 1) * e - t)
  5235. }
  5236. };
  5237. e.getBackOut = function(t) {
  5238. return function(e) {
  5239. return --e * e * ((t + 1) * e + t) + 1
  5240. }
  5241. };
  5242. e.getBackInOut = function(t) {
  5243. t *= 1.525;
  5244. return function(e) {
  5245. return 1 > (e *= 2) ? .5 * e * e * ((t + 1) * e - t) : .5 * ((e -= 2) * e * ((t + 1) * e + t) + 2)
  5246. }
  5247. };
  5248. e.circIn = function(t) {
  5249. return -(Math.sqrt(1 - t * t) - 1)
  5250. };
  5251. e.circOut = function(t) {
  5252. return Math.sqrt(1 - --t * t)
  5253. };
  5254. e.circInOut = function(t) {
  5255. return 1 > (t *= 2) ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1)
  5256. };
  5257. e.bounceIn = function(t) {
  5258. return 1 - e.bounceOut(1 - t)
  5259. };
  5260. e.bounceOut = function(t) {
  5261. return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375
  5262. };
  5263. e.bounceInOut = function(t) {
  5264. return .5 > t ? .5 * e.bounceIn(2 * t) : .5 * e.bounceOut(2 * t - 1) + .5
  5265. };
  5266. e.getElasticIn = function(t, e) {
  5267. var i = 2 * Math.PI;
  5268. return function(n) {
  5269. if (0 == n || 1 == n) return n;
  5270. var r = e / i * Math.asin(1 / t);
  5271. return -(t * Math.pow(2, 10 * (n -= 1)) * Math.sin((n - r) * i / e))
  5272. }
  5273. };
  5274. e.getElasticOut = function(t, e) {
  5275. var i = 2 * Math.PI;
  5276. return function(n) {
  5277. if (0 == n || 1 == n) return n;
  5278. var r = e / i * Math.asin(1 / t);
  5279. return t * Math.pow(2, -10 * n) * Math.sin((n - r) * i / e) + 1
  5280. }
  5281. };
  5282. e.getElasticInOut = function(t, e) {
  5283. var i = 2 * Math.PI;
  5284. return function(n) {
  5285. var r = e / i * Math.asin(1 / t);
  5286. return 1 > (n *= 2) ? -.5 * t * Math.pow(2, 10 * (n -= 1)) * Math.sin((n - r) * i / e) : t * Math.pow(2, -10 * (n -= 1)) * Math.sin((n - r) * i / e) * .5 + 1
  5287. }
  5288. };
  5289. e.quadIn = e.getPowIn(2);
  5290. e.quadOut = e.getPowOut(2);
  5291. e.quadInOut = e.getPowInOut(2);
  5292. e.cubicIn = e.getPowIn(3);
  5293. e.cubicOut = e.getPowOut(3);
  5294. e.cubicInOut = e.getPowInOut(3);
  5295. e.quartIn = e.getPowIn(4);
  5296. e.quartOut = e.getPowOut(4);
  5297. e.quartInOut = e.getPowInOut(4);
  5298. e.quintIn = e.getPowIn(5);
  5299. e.quintOut = e.getPowOut(5);
  5300. e.quintInOut = e.getPowInOut(5);
  5301. e.backIn = e.getBackIn(1.7);
  5302. e.backOut = e.getBackOut(1.7);
  5303. e.backInOut = e.getBackInOut(1.7);
  5304. e.elasticIn = e.getElasticIn(1, .3);
  5305. e.elasticOut = e.getElasticOut(1, .3);
  5306. e.elasticInOut = e.getElasticInOut(1, .3 * 1.5);
  5307. return e
  5308. }();
  5309. t.Ease = e;
  5310. e.prototype.__class__ = "egret.Ease"
  5311. })(egret || (egret = {}));
  5312. (function(t) {
  5313. var e = function() {
  5314. function t() {
  5315. this.type = t.EFFECT
  5316. }
  5317. t.prototype.play = function(t) {
  5318. void 0 === t && (t = !1);
  5319. var e = this.audio;
  5320. e && (isNaN(e.duration) || (e.currentTime = 0), e.loop = t, e.play())
  5321. };
  5322. t.prototype.pause = function() {
  5323. var t = this.audio;
  5324. t && t.pause()
  5325. };
  5326. t.prototype.load = function() {
  5327. var t = this.audio;
  5328. t && t.load()
  5329. };
  5330. t.prototype.addEventListener = function(t, e) {
  5331. this.audio && this.audio.addEventListener(t, e, !1)
  5332. };
  5333. t.prototype.removeEventListener = function(t, e) {
  5334. this.audio && this.audio.removeEventListener(t, e, !1)
  5335. };
  5336. t.prototype.setVolume = function(t) {
  5337. var e = this.audio;
  5338. e && (e.volume = t)
  5339. };
  5340. t.prototype.getVolume = function() {
  5341. return this.audio ? this.audio.volume : 0
  5342. };
  5343. t.prototype.preload = function(t) {
  5344. this.type = t
  5345. };
  5346. t.prototype._setAudio = function(t) {
  5347. this.audio = t
  5348. };
  5349. t.MUSIC = "music";
  5350. t.EFFECT = "effect";
  5351. return t
  5352. }();
  5353. t.Sound = e;
  5354. e.prototype.__class__ = "egret.Sound"
  5355. })(egret || (egret = {}));
  5356. (function(t) {
  5357. var e = function() {
  5358. function t() {}
  5359. t.isNumber = function(t) {
  5360. return "number" === typeof t && !isNaN(t)
  5361. };
  5362. t.sin = function(t) {
  5363. t = Math.round(t);
  5364. t %= 360;
  5365. 0 > t && (t += 360);
  5366. return 90 > t ? egret_sin_map[t] : 180 > t ? egret_cos_map[t - 90] : 270 > t ? -egret_sin_map[t - 180] : -egret_cos_map[t - 270]
  5367. };
  5368. t.cos = function(t) {
  5369. t = Math.round(t);
  5370. t %= 360;
  5371. 0 > t && (t += 360);
  5372. return 90 > t ? egret_cos_map[t] : 180 > t ? -egret_sin_map[t - 90] : 270 > t ? -egret_cos_map[t - 180] : egret_sin_map[t - 270]
  5373. };
  5374. return t
  5375. }();
  5376. t.NumberUtils = e;
  5377. e.prototype.__class__ = "egret.NumberUtils"
  5378. })(egret || (egret = {}));
  5379. for (var egret_sin_map = {}, egret_cos_map = {}, i = 0; 90 >= i; i++) egret_sin_map[i] = Math.sin(i * egret.Matrix.DEG_TO_RAD), egret_cos_map[i] = Math.cos(i * egret.Matrix.DEG_TO_RAD);
  5380. Function.prototype.bind || (Function.prototype.bind = function(t) {
  5381. if ("function" !== typeof this) throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  5382. var e = Array.prototype.slice.call(arguments, 1),
  5383. i = this,
  5384. n = function() {},
  5385. r = function() {
  5386. return i.apply(this instanceof n && t ? this : t, e.concat(Array.prototype.slice.call(arguments)))
  5387. };
  5388. n.prototype = this.prototype;
  5389. r.prototype = new n;
  5390. return r
  5391. });
  5392. var __extends = this.__extends || function(t, e) {
  5393. function i() {
  5394. this.constructor = t
  5395. }
  5396. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5397. i.prototype = e.prototype;
  5398. t.prototype = new i
  5399. },
  5400. RES;
  5401. (function(t) {
  5402. var e = function(t) {
  5403. function e(e, i, n) {
  5404. void 0 === i && (i = !1);
  5405. void 0 === n && (n = !1);
  5406. t.call(this, e, i, n);
  5407. this.itemsTotal = this.itemsLoaded = 0
  5408. }
  5409. __extends(e, t);
  5410. e.dispatchResourceEvent = function(t, i, n, r, o, s) {
  5411. void 0 === n && (n = "");
  5412. void 0 === r && (r = null);
  5413. void 0 === o && (o = 0);
  5414. void 0 === s && (s = 0);
  5415. var a = egret.Event._getPropertyData(e);
  5416. a.groupName = n;
  5417. a.resItem = r;
  5418. a.itemsLoaded = o;
  5419. a.itemsTotal = s;
  5420. egret.Event._dispatchByTarget(e, t, i, a)
  5421. };
  5422. e.ITEM_LOAD_ERROR = "itemLoadError";
  5423. e.CONFIG_COMPLETE = "configComplete";
  5424. e.CONFIG_LOAD_ERROR = "configLoadError";
  5425. e.GROUP_PROGRESS = "groupProgress";
  5426. e.GROUP_COMPLETE = "groupComplete";
  5427. e.GROUP_LOAD_ERROR = "groupLoadError";
  5428. return e
  5429. }(egret.Event);
  5430. t.ResourceEvent = e;
  5431. e.prototype.__class__ = "RES.ResourceEvent"
  5432. })(RES || (RES = {}));
  5433. (function(t) {
  5434. var e = function() {
  5435. function t(t, e, i) {
  5436. this._loaded = !1;
  5437. this.name = t;
  5438. this.url = e;
  5439. this.type = i
  5440. }
  5441. Object.defineProperty(t.prototype, "loaded", {
  5442. get: function() {
  5443. return this.data ? this.data.loaded : this._loaded
  5444. },
  5445. set: function(t) {
  5446. this.data && (this.data.loaded = t);
  5447. this._loaded = t
  5448. },
  5449. enumerable: !0,
  5450. configurable: !0
  5451. });
  5452. t.prototype.toString = function() {
  5453. return '[ResourceItem name="' + this.name + '" url="' + this.url + '" type="' + this.type + '"]'
  5454. };
  5455. t.TYPE_XML = "xml";
  5456. t.TYPE_IMAGE = "image";
  5457. t.TYPE_BIN = "bin";
  5458. t.TYPE_TEXT = "text";
  5459. t.TYPE_JSON = "json";
  5460. t.TYPE_SHEET = "sheet";
  5461. t.TYPE_FONT = "font";
  5462. t.TYPE_SOUND = "sound";
  5463. return t
  5464. }();
  5465. t.ResourceItem = e;
  5466. e.prototype.__class__ = "RES.ResourceItem"
  5467. })(RES || (RES = {}));
  5468. (function(t) {
  5469. var e = function() {
  5470. function e() {
  5471. this.keyMap = {};
  5472. this.groupDic = {};
  5473. t.configInstance = this
  5474. }
  5475. e.prototype.getGroupByName = function(t) {
  5476. var e = [];
  5477. if (!this.groupDic[t]) return e;
  5478. t = this.groupDic[t];
  5479. for (var i = t.length, n = 0; n < i; n++) e.push(this.parseResourceItem(t[n]));
  5480. return e
  5481. };
  5482. e.prototype.getRawGroupByName = function(t) {
  5483. return this.groupDic[t] ? this.groupDic[t] : []
  5484. };
  5485. e.prototype.createGroup = function(t, e, i) {
  5486. void 0 === i && (i = !1);
  5487. if (!i && this.groupDic[t] || !e || 0 == e.length) return !1;
  5488. i = this.groupDic;
  5489. for (var n = [], r = e.length, o = 0; o < r; o++) {
  5490. var s = e[o],
  5491. a = i[s];
  5492. if (a)
  5493. for (var s = a.length, h = 0; h < s; h++) {
  5494. var c = a[h]; - 1 == n.indexOf(c) && n.push(c)
  5495. } else(c = this.keyMap[s]) && -1 == n.indexOf(c) && n.push(c)
  5496. }
  5497. if (0 == n.length) return !1;
  5498. this.groupDic[t] = n;
  5499. return !0
  5500. };
  5501. e.prototype.parseConfig = function(t, e) {
  5502. if (t) {
  5503. var i = t.resources;
  5504. if (i)
  5505. for (var n = i.length, r = 0; r < n; r++) {
  5506. var o = i[r],
  5507. s = o.url;
  5508. s && -1 == s.indexOf("://") && (o.url = e + s);
  5509. this.addItemToKeyMap(o)
  5510. }
  5511. if (i = t.groups)
  5512. for (n = i.length, r = 0; r < n; r++) {
  5513. for (var s = i[r], a = [], h = s.keys.split(","), c = h.length, u = 0; u < c; u++) o = h[u].trim(), (o = this.keyMap[o]) && -1 == a.indexOf(o) && a.push(o);
  5514. this.groupDic[s.name] = a
  5515. }
  5516. }
  5517. };
  5518. e.prototype.addSubkey = function(t, e) {
  5519. var i = this.keyMap[e];
  5520. i && !this.keyMap[t] && (this.keyMap[t] = i)
  5521. };
  5522. e.prototype.addItemToKeyMap = function(t) {
  5523. this.keyMap[t.name] || (this.keyMap[t.name] = t);
  5524. if (t.hasOwnProperty("subkeys")) {
  5525. var e = t.subkeys.split(",");
  5526. t.subkeys = e;
  5527. for (var i = e.length, n = 0; n < i; n++) {
  5528. var r = e[n];
  5529. null == this.keyMap[r] && (this.keyMap[r] = t)
  5530. }
  5531. }
  5532. };
  5533. e.prototype.getName = function(t) {
  5534. return (t = this.keyMap[t]) ? t.name : ""
  5535. };
  5536. e.prototype.getType = function(t) {
  5537. return (t = this.keyMap[t]) ? t.type : ""
  5538. };
  5539. e.prototype.getRawResourceItem = function(t) {
  5540. return this.keyMap[t]
  5541. };
  5542. e.prototype.getResourceItem = function(t) {
  5543. return (t = this.keyMap[t]) ? this.parseResourceItem(t) : null
  5544. };
  5545. e.prototype.parseResourceItem = function(e) {
  5546. var i = new t.ResourceItem(e.name, e.url, e.type);
  5547. i.data = e;
  5548. return i
  5549. };
  5550. return e
  5551. }();
  5552. t.ResourceConfig = e;
  5553. e.prototype.__class__ = "RES.ResourceConfig"
  5554. })(RES || (RES = {}));
  5555. __extends = this.__extends || function(t, e) {
  5556. function i() {
  5557. this.constructor = t
  5558. }
  5559. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5560. i.prototype = e.prototype;
  5561. t.prototype = new i
  5562. };
  5563. (function(t) {
  5564. var e = function(e) {
  5565. function i() {
  5566. e.call(this);
  5567. this.thread = 2;
  5568. this.loadingCount = 0;
  5569. this.groupTotalDic = {};
  5570. this.numLoadedDic = {};
  5571. this.itemListDic = {};
  5572. this.groupErrorDic = {};
  5573. this.retryTimesDic = {};
  5574. this.maxRetryTimes = 3;
  5575. this.failedList = [];
  5576. this.priorityQueue = {};
  5577. this.lazyLoadList = [];
  5578. this.analyzerDic = {};
  5579. this.queueIndex = 0
  5580. }
  5581. __extends(i, e);
  5582. i.prototype.isGroupInLoading = function(t) {
  5583. return void 0 !== this.itemListDic[t]
  5584. };
  5585. i.prototype.loadGroup = function(e, i, n) {
  5586. void 0 === n && (n = 0);
  5587. if (!this.itemListDic[i] && i)
  5588. if (e && 0 != e.length) {
  5589. this.priorityQueue[n] ? this.priorityQueue[n].push(i) : this.priorityQueue[n] = [i];
  5590. this.itemListDic[i] = e;
  5591. n = e.length;
  5592. for (var r = 0; r < n; r++) e[r].groupName = i;
  5593. this.groupTotalDic[i] = e.length;
  5594. this.numLoadedDic[i] = 0;
  5595. this.next()
  5596. } else egret.Logger.warning('RES加载了不存在或空的资源组:"' + i + '"'), e = new t.ResourceEvent(t.ResourceEvent.GROUP_LOAD_ERROR), e.groupName = i, this.dispatchEvent(e)
  5597. };
  5598. i.prototype.loadItem = function(t) {
  5599. this.lazyLoadList.push(t);
  5600. t.groupName = "";
  5601. this.next()
  5602. };
  5603. i.prototype.next = function() {
  5604. for (; this.loadingCount < this.thread;) {
  5605. var e = this.getOneResourceItem();
  5606. if (!e) break;
  5607. this.loadingCount++;
  5608. if (e.loaded) this.onItemComplete(e);
  5609. else {
  5610. var i = this.analyzerDic[e.type];
  5611. i || (i = this.analyzerDic[e.type] = egret.Injector.getInstance(t.AnalyzerBase, e.type));
  5612. i.loadFile(e, this.onItemComplete, this)
  5613. }
  5614. }
  5615. };
  5616. i.prototype.getOneResourceItem = function() {
  5617. if (0 < this.failedList.length) return this.failedList.shift();
  5618. var t = Number.NEGATIVE_INFINITY,
  5619. e;
  5620. for (e in this.priorityQueue) t = Math.max(t, e);
  5621. t = this.priorityQueue[t];
  5622. if (!t || 0 == t.length) return 0 == this.lazyLoadList.length ? null : this.lazyLoadList.pop();
  5623. e = t.length;
  5624. for (var i, n = 0; n < e; n++) {
  5625. this.queueIndex >= e && (this.queueIndex = 0);
  5626. i = this.itemListDic[t[this.queueIndex]];
  5627. if (0 < i.length) break;
  5628. this.queueIndex++
  5629. }
  5630. return 0 == i.length ? null : i.shift()
  5631. };
  5632. i.prototype.onItemComplete = function(e) {
  5633. this.loadingCount--;
  5634. var i = e.groupName;
  5635. if (!e.loaded) {
  5636. var n = this.retryTimesDic[e.name] || 1;
  5637. if (n > this.maxRetryTimes) delete this.retryTimesDic[e.name], t.ResourceEvent.dispatchResourceEvent(this.resInstance, t.ResourceEvent.ITEM_LOAD_ERROR, i, e);
  5638. else {
  5639. this.retryTimesDic[e.name] = n + 1;
  5640. this.failedList.push(e);
  5641. this.next();
  5642. return
  5643. }
  5644. }
  5645. if (i) {
  5646. this.numLoadedDic[i] ++;
  5647. var n = this.numLoadedDic[i],
  5648. r = this.groupTotalDic[i];
  5649. e.loaded || (this.groupErrorDic[i] = !0);
  5650. t.ResourceEvent.dispatchResourceEvent(this.resInstance, t.ResourceEvent.GROUP_PROGRESS, i, e, n, r);
  5651. n == r && (e = this.groupErrorDic[i], this.removeGroupName(i), delete this.groupTotalDic[i], delete this.numLoadedDic[i], delete this.itemListDic[i], delete this.groupErrorDic[i], e ? t.ResourceEvent.dispatchResourceEvent(this, t.ResourceEvent.GROUP_LOAD_ERROR, i) : t.ResourceEvent.dispatchResourceEvent(this, t.ResourceEvent.GROUP_COMPLETE, i))
  5652. } else this.callBack.call(this.resInstance, e);
  5653. this.next()
  5654. };
  5655. i.prototype.removeGroupName = function(t) {
  5656. for (var e in this.priorityQueue) {
  5657. for (var i = this.priorityQueue[e], n = i.length, r = 0, o = !1, n = i.length, s = 0; s < n; s++) {
  5658. if (i[s] == t) {
  5659. i.splice(r, 1);
  5660. o = !0;
  5661. break
  5662. }
  5663. r++
  5664. }
  5665. if (o) {
  5666. 0 == i.length && delete this.priorityQueue[e];
  5667. break
  5668. }
  5669. }
  5670. };
  5671. return i
  5672. }(egret.EventDispatcher);
  5673. t.ResourceLoader = e;
  5674. e.prototype.__class__ = "RES.ResourceLoader"
  5675. })(RES || (RES = {}));
  5676. __extends = this.__extends || function(t, e) {
  5677. function i() {
  5678. this.constructor = t
  5679. }
  5680. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5681. i.prototype = e.prototype;
  5682. t.prototype = new i
  5683. };
  5684. (function(t) {
  5685. var e = function(e) {
  5686. function i() {
  5687. e.call(this);
  5688. this.resourceConfig = t.configInstance
  5689. }
  5690. __extends(i, e);
  5691. i.prototype.addSubkey = function(t, e) {
  5692. this.resourceConfig.addSubkey(t, e)
  5693. };
  5694. i.prototype.loadFile = function(t, e, i) {};
  5695. i.prototype.getRes = function(t) {};
  5696. i.prototype.destroyRes = function(t) {
  5697. return !1
  5698. };
  5699. i.getStringPrefix = function(t) {
  5700. if (!t) return "";
  5701. var e = t.indexOf(".");
  5702. return -1 != e ? t.substring(0, e) : ""
  5703. };
  5704. i.getStringTail = function(t) {
  5705. if (!t) return "";
  5706. var e = t.indexOf(".");
  5707. return -1 != e ? t.substring(e + 1) : ""
  5708. };
  5709. return i
  5710. }(egret.HashObject);
  5711. t.AnalyzerBase = e;
  5712. e.prototype.__class__ = "RES.AnalyzerBase"
  5713. })(RES || (RES = {}));
  5714. __extends = this.__extends || function(t, e) {
  5715. function i() {
  5716. this.constructor = t
  5717. }
  5718. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5719. i.prototype = e.prototype;
  5720. t.prototype = new i
  5721. };
  5722. (function(t) {
  5723. var e = function(t) {
  5724. function e() {
  5725. t.call(this);
  5726. this.fileDic = {};
  5727. this.resItemDic = [];
  5728. this._dataFormat = egret.URLLoaderDataFormat.BINARY;
  5729. this.recycler = new egret.Recycler
  5730. }
  5731. __extends(e, t);
  5732. e.prototype.loadFile = function(t, e, i) {
  5733. if (this.fileDic[t.name]) e.call(i, t);
  5734. else {
  5735. var n = this.getLoader();
  5736. this.resItemDic[n.hashCode] = {
  5737. item: t,
  5738. func: e,
  5739. thisObject: i
  5740. };
  5741. n.load(new egret.URLRequest(t.url))
  5742. }
  5743. };
  5744. e.prototype.getLoader = function() {
  5745. var t = this.recycler.pop();
  5746. t || (t = new egret.URLLoader, t.addEventListener(egret.Event.COMPLETE, this.onLoadFinish, this), t.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onLoadFinish, this));
  5747. t.dataFormat = this._dataFormat;
  5748. return t
  5749. };
  5750. e.prototype.onLoadFinish = function(t) {
  5751. var e = t.target,
  5752. i = this.resItemDic[e.hashCode];
  5753. delete this.resItemDic[e.hashCode];
  5754. this.recycler.push(e);
  5755. var n = i.item,
  5756. r = i.func;
  5757. n.loaded = t.type == egret.Event.COMPLETE;
  5758. n.loaded && this.analyzeData(n, e.data);
  5759. r.call(i.thisObject, n)
  5760. };
  5761. e.prototype.analyzeData = function(t, e) {
  5762. var i = t.name;
  5763. !this.fileDic[i] && e && (this.fileDic[i] = e)
  5764. };
  5765. e.prototype.getRes = function(t) {
  5766. return this.fileDic[t]
  5767. };
  5768. e.prototype.hasRes = function(t) {
  5769. return null != this.getRes(t)
  5770. };
  5771. e.prototype.destroyRes = function(t) {
  5772. return this.fileDic[t] ? (delete this.fileDic[t], !0) : !1
  5773. };
  5774. return e
  5775. }(t.AnalyzerBase);
  5776. t.BinAnalyzer = e;
  5777. e.prototype.__class__ = "RES.BinAnalyzer"
  5778. })(RES || (RES = {}));
  5779. __extends = this.__extends || function(t, e) {
  5780. function i() {
  5781. this.constructor = t
  5782. }
  5783. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5784. i.prototype = e.prototype;
  5785. t.prototype = new i
  5786. };
  5787. (function(t) {
  5788. var e = function(t) {
  5789. function e() {
  5790. t.call(this);
  5791. this._dataFormat = egret.URLLoaderDataFormat.TEXTURE
  5792. }
  5793. __extends(e, t);
  5794. e.prototype.analyzeData = function(t, e) {
  5795. var i = t.name;
  5796. !this.fileDic[i] && e && (this.fileDic[i] = e, (i = t.data) && i.scale9grid && (i = i.scale9grid.split(","), e.scale9Grid = new egret.Rectangle(parseInt(i[0]), parseInt(i[1]), parseInt(i[2]), parseInt(i[3]))))
  5797. };
  5798. return e
  5799. }(t.BinAnalyzer);
  5800. t.ImageAnalyzer = e;
  5801. e.prototype.__class__ = "RES.ImageAnalyzer"
  5802. })(RES || (RES = {}));
  5803. __extends = this.__extends || function(t, e) {
  5804. function i() {
  5805. this.constructor = t
  5806. }
  5807. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5808. i.prototype = e.prototype;
  5809. t.prototype = new i
  5810. };
  5811. (function(t) {
  5812. var e = function(t) {
  5813. function e() {
  5814. t.call(this);
  5815. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  5816. }
  5817. __extends(e, t);
  5818. e.prototype.analyzeData = function(t, e) {
  5819. var i = t.name;
  5820. if (!this.fileDic[i] && e) try {
  5821. this.fileDic[i] = JSON.parse(e)
  5822. } catch (n) {
  5823. egret.Logger.warning("JSON文件格式不正确: " + t.url + "\ndata:" + e)
  5824. }
  5825. };
  5826. return e
  5827. }(t.BinAnalyzer);
  5828. t.JsonAnalyzer = e;
  5829. e.prototype.__class__ = "RES.JsonAnalyzer"
  5830. })(RES || (RES = {}));
  5831. __extends = this.__extends || function(t, e) {
  5832. function i() {
  5833. this.constructor = t
  5834. }
  5835. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5836. i.prototype = e.prototype;
  5837. t.prototype = new i
  5838. };
  5839. (function(t) {
  5840. var e = function(t) {
  5841. function e() {
  5842. t.call(this);
  5843. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  5844. }
  5845. __extends(e, t);
  5846. return e
  5847. }(t.BinAnalyzer);
  5848. t.TextAnalyzer = e;
  5849. e.prototype.__class__ = "RES.TextAnalyzer"
  5850. })(RES || (RES = {}));
  5851. __extends = this.__extends || function(t, e) {
  5852. function i() {
  5853. this.constructor = t
  5854. }
  5855. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5856. i.prototype = e.prototype;
  5857. t.prototype = new i
  5858. };
  5859. (function(t) {
  5860. var e = function(e) {
  5861. function i() {
  5862. e.call(this);
  5863. this.sheetMap = {};
  5864. this.textureMap = {};
  5865. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  5866. }
  5867. __extends(i, e);
  5868. i.prototype.getRes = function(e) {
  5869. var i = this.fileDic[e];
  5870. i || (i = this.textureMap[e]);
  5871. !i && (i = t.AnalyzerBase.getStringPrefix(e), i = this.fileDic[i]) && (e = t.AnalyzerBase.getStringTail(e), i = i.getTexture(e));
  5872. return i
  5873. };
  5874. i.prototype.onLoadFinish = function(t) {
  5875. var e = t.target,
  5876. i = this.resItemDic[e.hashCode];
  5877. delete this.resItemDic[e.hashCode];
  5878. this.recycler.push(e);
  5879. var n = i.item,
  5880. r = i.func;
  5881. n.loaded = t.type == egret.Event.COMPLETE;
  5882. n.loaded && this.analyzeData(n, e.data);
  5883. "string" == typeof e.data ? (this._dataFormat = egret.URLLoaderDataFormat.TEXTURE, this.loadFile(n, r, i.thisObject), this._dataFormat = egret.URLLoaderDataFormat.TEXT) : r.call(i.thisObject, n)
  5884. };
  5885. i.prototype.analyzeData = function(t, e) {
  5886. var i = t.name;
  5887. if (!this.fileDic[i] && e) {
  5888. var n;
  5889. if ("string" == typeof e) {
  5890. try {
  5891. n = JSON.parse(e)
  5892. } catch (r) {
  5893. egret.Logger.warning("JSON文件格式不正确: " + t.url)
  5894. }
  5895. n && (this.sheetMap[i] = n, t.loaded = !1, t.url = this.getRelativePath(t.url, n.file))
  5896. } else n = this.sheetMap[i], delete this.sheetMap[i], e && (n = this.parseSpriteSheet(e, n, t.data && t.data.subkeys ? "" : i), this.fileDic[i] = n)
  5897. }
  5898. };
  5899. i.prototype.getRelativePath = function(t, e) {
  5900. t = t.split("\\").join("/");
  5901. var i = t.lastIndexOf("/");
  5902. return t = -1 != i ? t.substring(0, i + 1) + e : e
  5903. };
  5904. i.prototype.parseSpriteSheet = function(t, e, i) {
  5905. e = e.frames;
  5906. if (!e) return null;
  5907. var n = new egret.SpriteSheet(t),
  5908. r = this.textureMap,
  5909. o;
  5910. for (o in e) {
  5911. var s = e[o];
  5912. t = n.createTexture(o, s.x, s.y, s.w, s.h, s.offX, s.offY, s.sourceW, s.sourceH);
  5913. s.scale9grid && (s = s.scale9grid.split(","), t.scale9Grid = new egret.Rectangle(parseInt(s[0]), parseInt(s[1]), parseInt(s[2]), parseInt(s[3])));
  5914. null == r[o] && (r[o] = t, i && this.addSubkey(o, i))
  5915. }
  5916. return n
  5917. };
  5918. return i
  5919. }(t.BinAnalyzer);
  5920. t.SheetAnalyzer = e;
  5921. e.prototype.__class__ = "RES.SheetAnalyzer"
  5922. })(RES || (RES = {}));
  5923. __extends = this.__extends || function(t, e) {
  5924. function i() {
  5925. this.constructor = t
  5926. }
  5927. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5928. i.prototype = e.prototype;
  5929. t.prototype = new i
  5930. };
  5931. (function(t) {
  5932. var e = function(t) {
  5933. function e() {
  5934. t.call(this)
  5935. }
  5936. __extends(e, t);
  5937. e.prototype.analyzeData = function(t, e) {
  5938. var i = t.name;
  5939. if (!this.fileDic[i] && e) {
  5940. var n;
  5941. "string" == typeof e ? (n = e, this.sheetMap[i] = n, t.loaded = !1, t.url = this.getTexturePath(t.url, n)) : (n = this.sheetMap[i], delete this.sheetMap[i], e && (n = new egret.BitmapTextSpriteSheet(e, n), this.fileDic[i] = n))
  5942. }
  5943. };
  5944. e.prototype.getTexturePath = function(t, e) {
  5945. var i = "",
  5946. n = e.split("\n")[2],
  5947. r = n.indexOf('file="'); - 1 != r && (n = n.substring(r + 6), r = n.indexOf('"'), i = n.substring(0, r));
  5948. t = t.split("\\").join("/");
  5949. r = t.lastIndexOf("/");
  5950. return t = -1 != r ? t.substring(0, r + 1) + i : i
  5951. };
  5952. return e
  5953. }(t.SheetAnalyzer);
  5954. t.FontAnalyzer = e;
  5955. e.prototype.__class__ = "RES.FontAnalyzer"
  5956. })(RES || (RES = {}));
  5957. __extends = this.__extends || function(t, e) {
  5958. function i() {
  5959. this.constructor = t
  5960. }
  5961. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5962. i.prototype = e.prototype;
  5963. t.prototype = new i
  5964. };
  5965. (function(t) {
  5966. var e = function(t) {
  5967. function e() {
  5968. t.call(this);
  5969. this._dataFormat = egret.URLLoaderDataFormat.SOUND
  5970. }
  5971. __extends(e, t);
  5972. e.prototype.analyzeData = function(t, e) {
  5973. var i = t.name;
  5974. !this.fileDic[i] && e && (this.fileDic[i] = e, (i = t.data) && i.soundType ? e.preload(i.soundType) : e.preload(egret.Sound.EFFECT))
  5975. };
  5976. return e
  5977. }(t.BinAnalyzer);
  5978. t.SoundAnalyzer = e;
  5979. e.prototype.__class__ = "RES.SoundAnalyzer"
  5980. })(RES || (RES = {}));
  5981. __extends = this.__extends || function(t, e) {
  5982. function i() {
  5983. this.constructor = t
  5984. }
  5985. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  5986. i.prototype = e.prototype;
  5987. t.prototype = new i
  5988. };
  5989. (function(t) {
  5990. var e = function(t) {
  5991. function e() {
  5992. t.call(this);
  5993. this._dataFormat = egret.URLLoaderDataFormat.TEXT
  5994. }
  5995. __extends(e, t);
  5996. e.prototype.analyzeData = function(t, e) {
  5997. var i = t.name;
  5998. if (!this.fileDic[i] && e) try {
  5999. var n = egret.XML.parse(e);
  6000. this.fileDic[i] = n
  6001. } catch (r) {}
  6002. };
  6003. return e
  6004. }(t.BinAnalyzer);
  6005. t.XMLAnalyzer = e;
  6006. e.prototype.__class__ = "RES.XMLAnalyzer"
  6007. })(RES || (RES = {}));
  6008. __extends = this.__extends || function(t, e) {
  6009. function i() {
  6010. this.constructor = t
  6011. }
  6012. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  6013. i.prototype = e.prototype;
  6014. t.prototype = new i
  6015. };
  6016. (function(t) {
  6017. t.loadConfig = function(t, e, n) {
  6018. void 0 === e && (e = "");
  6019. void 0 === n && (n = "json");
  6020. i.loadConfig(t, e, n)
  6021. };
  6022. t.loadGroup = function(t, e) {
  6023. void 0 === e && (e = 0);
  6024. i.loadGroup(t, e)
  6025. };
  6026. t.isGroupLoaded = function(t) {
  6027. return i.isGroupLoaded(t)
  6028. };
  6029. t.getGroupByName = function(t) {
  6030. return i.getGroupByName(t)
  6031. };
  6032. t.createGroup = function(t, e, n) {
  6033. void 0 === n && (n = !1);
  6034. return i.createGroup(t, e, n)
  6035. };
  6036. t.hasRes = function(t) {
  6037. return i.hasRes(t)
  6038. };
  6039. t.getRes = function(t) {
  6040. return i.getRes(t)
  6041. };
  6042. t.getResAsync = function(t, e, n) {
  6043. i.getResAsync(t, e, n)
  6044. };
  6045. t.getResByUrl = function(t, e, n, r) {
  6046. void 0 === r && (r = "");
  6047. i.getResByUrl(t, e, n, r)
  6048. };
  6049. t.destroyRes = function(t) {
  6050. return i.destroyRes(t)
  6051. };
  6052. t.setMaxLoadingThread = function(t) {
  6053. i.setMaxLoadingThread(t)
  6054. };
  6055. t.addEventListener = function(t, e, n, r, o) {
  6056. void 0 === r && (r = !1);
  6057. void 0 === o && (o = 0);
  6058. i.addEventListener(t, e, n, r, o)
  6059. };
  6060. t.removeEventListener = function(t, e, n, r) {
  6061. void 0 === r && (r = !1);
  6062. i.removeEventListener(t, e, n, r)
  6063. };
  6064. var e = function(e) {
  6065. function i() {
  6066. e.call(this);
  6067. this.analyzerDic = {};
  6068. this.configItemList = [];
  6069. this.configComplete = this.callLaterFlag = !1;
  6070. this.loadedGroups = [];
  6071. this.groupNameList = [];
  6072. this.asyncDic = {};
  6073. this.init()
  6074. }
  6075. __extends(i, e);
  6076. i.prototype.getAnalyzerByType = function(e) {
  6077. var i = this.analyzerDic[e];
  6078. i || (i = this.analyzerDic[e] = egret.Injector.getInstance(t.AnalyzerBase, e));
  6079. return i
  6080. };
  6081. i.prototype.init = function() {
  6082. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_BIN) || egret.Injector.mapClass(t.AnalyzerBase, t.BinAnalyzer, t.ResourceItem.TYPE_BIN);
  6083. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_IMAGE) || egret.Injector.mapClass(t.AnalyzerBase, t.ImageAnalyzer, t.ResourceItem.TYPE_IMAGE);
  6084. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_TEXT) || egret.Injector.mapClass(t.AnalyzerBase, t.TextAnalyzer, t.ResourceItem.TYPE_TEXT);
  6085. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_JSON) || egret.Injector.mapClass(t.AnalyzerBase, t.JsonAnalyzer, t.ResourceItem.TYPE_JSON);
  6086. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_SHEET) || egret.Injector.mapClass(t.AnalyzerBase, t.SheetAnalyzer, t.ResourceItem.TYPE_SHEET);
  6087. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_FONT) || egret.Injector.mapClass(t.AnalyzerBase, t.FontAnalyzer, t.ResourceItem.TYPE_FONT);
  6088. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_SOUND) || egret.Injector.mapClass(t.AnalyzerBase, t.SoundAnalyzer, t.ResourceItem.TYPE_SOUND);
  6089. egret.Injector.hasMapRule(t.AnalyzerBase, t.ResourceItem.TYPE_XML) || egret.Injector.mapClass(t.AnalyzerBase, t.XMLAnalyzer, t.ResourceItem.TYPE_XML);
  6090. this.resConfig = new t.ResourceConfig;
  6091. this.resLoader = new t.ResourceLoader;
  6092. this.resLoader.callBack = this.onResourceItemComp;
  6093. this.resLoader.resInstance = this;
  6094. this.resLoader.addEventListener(t.ResourceEvent.GROUP_COMPLETE, this.onGroupComp, this);
  6095. this.resLoader.addEventListener(t.ResourceEvent.GROUP_LOAD_ERROR, this.onGroupError, this)
  6096. };
  6097. i.prototype.loadConfig = function(t, e, i) {
  6098. void 0 === i && (i = "json");
  6099. this.configItemList.push({
  6100. url: t,
  6101. resourceRoot: e,
  6102. type: i
  6103. });
  6104. this.callLaterFlag || (egret.callLater(this.startLoadConfig, this), this.callLaterFlag = !0)
  6105. };
  6106. i.prototype.startLoadConfig = function() {
  6107. this.callLaterFlag = !1;
  6108. var e = this.configItemList;
  6109. this.configItemList = [];
  6110. this.loadingConfigList = e;
  6111. for (var n = e.length, r = [], o = 0; o < n; o++) {
  6112. var s = e[o],
  6113. s = new t.ResourceItem(s.url, s.url, s.type);
  6114. r.push(s)
  6115. }
  6116. this.resLoader.loadGroup(r, i.GROUP_CONFIG, Number.MAX_VALUE)
  6117. };
  6118. i.prototype.isGroupLoaded = function(t) {
  6119. return -1 != this.loadedGroups.indexOf(t)
  6120. };
  6121. i.prototype.getGroupByName = function(t) {
  6122. return this.resConfig.getGroupByName(t)
  6123. };
  6124. i.prototype.loadGroup = function(e, i) {
  6125. void 0 === i && (i = 0);
  6126. if (-1 != this.loadedGroups.indexOf(e)) t.ResourceEvent.dispatchResourceEvent(this, t.ResourceEvent.GROUP_COMPLETE, e);
  6127. else if (!this.resLoader.isGroupInLoading(e))
  6128. if (this.configComplete) {
  6129. var n = this.resConfig.getGroupByName(e);
  6130. this.resLoader.loadGroup(n, e, i)
  6131. } else this.groupNameList.push({
  6132. name: e,
  6133. priority: i
  6134. })
  6135. };
  6136. i.prototype.createGroup = function(t, e, i) {
  6137. void 0 === i && (i = !1);
  6138. if (i) {
  6139. var n = this.loadedGroups.indexOf(t); - 1 != n && this.loadedGroups.splice(n, 1)
  6140. }
  6141. return this.resConfig.createGroup(t, e, i)
  6142. };
  6143. i.prototype.onGroupComp = function(e) {
  6144. if (e.groupName == i.GROUP_CONFIG) {
  6145. e = this.loadingConfigList.length;
  6146. for (var n = 0; n < e; n++) {
  6147. var r = this.loadingConfigList[n],
  6148. o = this.getAnalyzerByType(r.type),
  6149. s = o.getRes(r.url);
  6150. o.destroyRes(r.url);
  6151. this.resConfig.parseConfig(s, r.resourceRoot)
  6152. }
  6153. this.configComplete = !0;
  6154. this.loadingConfigList = null;
  6155. t.ResourceEvent.dispatchResourceEvent(this, t.ResourceEvent.CONFIG_COMPLETE);
  6156. r = this.groupNameList;
  6157. e = r.length;
  6158. for (n = 0; n < e; n++) o = r[n], this.loadGroup(o.name, o.priority);
  6159. this.groupNameList = []
  6160. } else this.loadedGroups.push(e.groupName), this.dispatchEvent(e)
  6161. };
  6162. i.prototype.onGroupError = function(e) {
  6163. e.groupName == i.GROUP_CONFIG ? (this.loadingConfigList = null, t.ResourceEvent.dispatchResourceEvent(this, t.ResourceEvent.CONFIG_LOAD_ERROR)) : this.dispatchEvent(e)
  6164. };
  6165. i.prototype.hasRes = function(e) {
  6166. var i = this.resConfig.getType(e);
  6167. return "" == i && (e = t.AnalyzerBase.getStringPrefix(e), i = this.resConfig.getType(e), "" == i) ? !1 : !0
  6168. };
  6169. i.prototype.getRes = function(e) {
  6170. var i = this.resConfig.getType(e);
  6171. return "" == i && (i = t.AnalyzerBase.getStringPrefix(e), i = this.resConfig.getType(i), "" == i) ? null : this.getAnalyzerByType(i).getRes(e)
  6172. };
  6173. i.prototype.getResAsync = function(e, i, n) {
  6174. var r = this.resConfig.getType(e),
  6175. o = this.resConfig.getName(e);
  6176. if ("" == r && (o = t.AnalyzerBase.getStringPrefix(e), r = this.resConfig.getType(o), "" == r)) {
  6177. i.call(n, null);
  6178. return
  6179. }(r = this.getAnalyzerByType(r).getRes(e)) ? i.call(n, r): (e = {
  6180. key: e,
  6181. compFunc: i,
  6182. thisObject: n
  6183. }, this.asyncDic[o] ? this.asyncDic[o].push(e) : (this.asyncDic[o] = [e], o = this.resConfig.getResourceItem(o), this.resLoader.loadItem(o)))
  6184. };
  6185. i.prototype.getResByUrl = function(e, i, n, r) {
  6186. void 0 === r && (r = "");
  6187. if (e) {
  6188. r || (r = this.getTypeByUrl(e));
  6189. var o = this.getAnalyzerByType(r).getRes(e);
  6190. o ? i.call(n, o) : (i = {
  6191. key: e,
  6192. compFunc: i,
  6193. thisObject: n
  6194. }, this.asyncDic[e] ? this.asyncDic[e].push(i) : (this.asyncDic[e] = [i], e = new t.ResourceItem(e, e, r), this.resLoader.loadItem(e)))
  6195. } else i.call(n, null)
  6196. };
  6197. i.prototype.getTypeByUrl = function(e) {
  6198. (e = e.substr(e.lastIndexOf(".") + 1)) && (e = e.toLowerCase());
  6199. switch (e) {
  6200. case t.ResourceItem.TYPE_XML:
  6201. case t.ResourceItem.TYPE_JSON:
  6202. case t.ResourceItem.TYPE_SHEET:
  6203. break;
  6204. case "png":
  6205. case "jpg":
  6206. case "gif":
  6207. e = t.ResourceItem.TYPE_IMAGE;
  6208. break;
  6209. case "fnt":
  6210. e = t.ResourceItem.TYPE_FONT;
  6211. break;
  6212. case "txt":
  6213. e = t.ResourceItem.TYPE_TEXT;
  6214. break;
  6215. case "mp3":
  6216. case "ogg":
  6217. case "mpeg":
  6218. case "wav":
  6219. case "m4a":
  6220. case "mp4":
  6221. case "aiff":
  6222. case "wma":
  6223. case "mid":
  6224. e = t.ResourceItem.TYPE_SOUND;
  6225. break;
  6226. default:
  6227. e = t.ResourceItem.TYPE_BIN
  6228. }
  6229. return e
  6230. };
  6231. i.prototype.onResourceItemComp = function(t) {
  6232. var e = this.asyncDic[t.name];
  6233. delete this.asyncDic[t.name];
  6234. t = this.getAnalyzerByType(t.type);
  6235. for (var i = e.length, n = 0; n < i; n++) {
  6236. var r = e[n],
  6237. o = t.getRes(r.key);
  6238. r.compFunc.call(r.thisObject, o, r.key)
  6239. }
  6240. };
  6241. i.prototype.destroyRes = function(t) {
  6242. var e = this.resConfig.getRawGroupByName(t);
  6243. if (e) {
  6244. var i = this.loadedGroups.indexOf(t); - 1 != i && this.loadedGroups.splice(i, 1);
  6245. t = e.length;
  6246. for (var n = 0; n < t; n++) {
  6247. i = e[n];
  6248. i.loaded = !1;
  6249. var r = this.getAnalyzerByType(i.type);
  6250. r.destroyRes(i.name)
  6251. }
  6252. return !0
  6253. }
  6254. e = this.resConfig.getType(t);
  6255. if ("" == e) return !1;
  6256. i = this.resConfig.getRawResourceItem(t);
  6257. i.loaded = !1;
  6258. r = this.getAnalyzerByType(e);
  6259. return r.destroyRes(t)
  6260. };
  6261. i.prototype.setMaxLoadingThread = function(t) {
  6262. 1 > t && (t = 1);
  6263. this.resLoader.thread = t
  6264. };
  6265. i.GROUP_CONFIG = "RES__CONFIG";
  6266. return i
  6267. }(egret.EventDispatcher);
  6268. e.prototype.__class__ = "RES.Resource";
  6269. var i = new e
  6270. })(RES || (RES = {}));
  6271. __extends = this.__extends || function(t, e) {
  6272. function i() {
  6273. this.constructor = t
  6274. }
  6275. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  6276. i.prototype = e.prototype;
  6277. t.prototype = new i
  6278. };
  6279. (function(t) {
  6280. var e = function(e) {
  6281. function i(t) {
  6282. void 0 === t && (t = 60);
  6283. e.call(this);
  6284. this.frameRate = t;
  6285. this._time = 0;
  6286. this._isActivate = !0;
  6287. 60 == t && (i.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame, i.cancelAnimationFrame = window.cancelAnimationFrame || window.msCancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.oCancelAnimationFrame || window.cancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame);
  6288. i.requestAnimationFrame || (i.requestAnimationFrame = function(e) {
  6289. return window.setTimeout(e, 1e3 / t)
  6290. });
  6291. i.cancelAnimationFrame || (i.cancelAnimationFrame = function(t) {
  6292. return window.clearTimeout(t)
  6293. });
  6294. i.instance = this;
  6295. this.registerListener()
  6296. }
  6297. __extends(i, e);
  6298. i.prototype.enterFrame = function() {
  6299. var e = i.instance,
  6300. n = i._thisObject,
  6301. r = i._callback,
  6302. o = t.getTimer(),
  6303. s = o - e._time;
  6304. e._requestAnimationId = i.requestAnimationFrame.call(window, i.prototype.enterFrame);
  6305. r.call(n, s);
  6306. e._time = o
  6307. };
  6308. i.prototype.executeMainLoop = function(t, e) {
  6309. i._callback = t;
  6310. i._thisObject = e;
  6311. this.enterFrame()
  6312. };
  6313. i.prototype.reset = function() {
  6314. var e = i.instance;
  6315. e._requestAnimationId && (e._time = t.getTimer(), i.cancelAnimationFrame.call(window, e._requestAnimationId), e.enterFrame())
  6316. };
  6317. i.prototype.registerListener = function() {
  6318. var e = this,
  6319. n = function() {
  6320. e._isActivate && (e._isActivate = !1, t.MainContext.instance.stage.dispatchEvent(new t.Event(t.Event.DEACTIVATE)))
  6321. },
  6322. r = function() {
  6323. e._isActivate || (e._isActivate = !0, i.instance.reset(), t.MainContext.instance.stage.dispatchEvent(new t.Event(t.Event.ACTIVATE)))
  6324. },
  6325. o = function() {
  6326. document[s] ? n() : r()
  6327. };
  6328. window.addEventListener("focus", r, !1);
  6329. window.addEventListener("blur", n, !1);
  6330. var s, a;
  6331. "undefined" !== typeof document.hidden ? (s = "hidden", a = "visibilitychange") : "undefined" !== typeof document.mozHidden ? (s = "mozHidden", a = "mozvisibilitychange") : "undefined" !== typeof document.msHidden ? (s = "msHidden", a = "msvisibilitychange") : "undefined" !== typeof document.webkitHidden ? (s = "webkitHidden", a = "webkitvisibilitychange") : "undefined" !== typeof document.oHidden && (s = "oHidden", a = "ovisibilitychange");
  6332. "onpageshow" in window && "onpagehide" in window && (window.addEventListener("pageshow", r, !1), window.addEventListener("pagehide", n, !1));
  6333. s && a && document.addEventListener(a, o, !1)
  6334. };
  6335. return i
  6336. }(t.DeviceContext);
  6337. t.HTML5DeviceContext = e;
  6338. e.prototype.__class__ = "egret.HTML5DeviceContext"
  6339. })(egret || (egret = {}));
  6340. var egret_html5_localStorage;
  6341. (function(t) {
  6342. t.getItem = function(t) {
  6343. return window.localStorage.getItem(t)
  6344. };
  6345. t.setItem = function(t, e) {
  6346. try {
  6347. return window.localStorage.setItem(t, e), !0
  6348. } catch (i) {
  6349. return console.log("egret_html5_localStorage.setItem保存失败,key=" + t + "&value=" + e), !1
  6350. }
  6351. };
  6352. t.removeItem = function(t) {
  6353. window.localStorage.remove(t)
  6354. };
  6355. t.clear = function() {
  6356. window.localStorage.clear()
  6357. };
  6358. t.init = function() {
  6359. for (var e in t) egret.localStorage[e] = t[e]
  6360. }
  6361. })(egret_html5_localStorage || (egret_html5_localStorage = {}));
  6362. egret_html5_localStorage.init();
  6363. __extends = this.__extends || function(t, e) {
  6364. function i() {
  6365. this.constructor = t
  6366. }
  6367. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  6368. i.prototype = e.prototype;
  6369. t.prototype = new i
  6370. };
  6371. (function(t) {
  6372. var e = function(e) {
  6373. function i(t) {
  6374. e.call(this);
  6375. this.globalAlpha = 1;
  6376. this.canvas = t || this.createCanvas();
  6377. this.canvasContext = this.canvas.getContext("2d");
  6378. this._cacheCanvas = document.createElement("canvas");
  6379. this._cacheCanvas.width = this.canvas.width;
  6380. this._cacheCanvas.height = this.canvas.height;
  6381. this._cacheCanvasContext = this._cacheCanvas.getContext("2d");
  6382. this.onResize();
  6383. var i = this.canvasContext.setTransform,
  6384. n = this;
  6385. this._cacheCanvasContext.setTransform = function(t, e, r, o, s, a) {
  6386. n._matrixA = t;
  6387. n._matrixB = e;
  6388. n._matrixC = r;
  6389. n._matrixD = o;
  6390. n._matrixTx = s;
  6391. n._matrixTy = a;
  6392. i.call(n._cacheCanvasContext, t, e, r, o, s, a)
  6393. };
  6394. this._matrixA = 1;
  6395. this._matrixC = this._matrixB = 0;
  6396. this._matrixD = 1;
  6397. this._transformTy = this._transformTx = this._matrixTy = this._matrixTx = 0;
  6398. this.initBlendMode()
  6399. }
  6400. __extends(i, e);
  6401. i.prototype.createCanvas = function() {
  6402. var e = t.Browser.getInstance().$("#egretCanvas");
  6403. if (!e) {
  6404. var i = document.getElementById(t.StageDelegate.canvas_div_name),
  6405. e = t.Browser.getInstance().$new("canvas");
  6406. e.id = "egretCanvas";
  6407. i.appendChild(e)
  6408. }
  6409. t.MainContext.instance.stage.addEventListener(t.Event.RESIZE, this.onResize, this);
  6410. return e
  6411. };
  6412. i.prototype.onResize = function() {
  6413. if (this.canvas) {
  6414. var e = document.getElementById(t.StageDelegate.canvas_div_name);
  6415. this.canvas.width = t.MainContext.instance.stage.stageWidth;
  6416. this.canvas.height = t.MainContext.instance.stage.stageHeight;
  6417. this.canvas.style.width = e.style.width;
  6418. this.canvas.style.height = e.style.height;
  6419. this._cacheCanvas.width = this.canvas.width;
  6420. this._cacheCanvas.height = this.canvas.height;
  6421. this._cacheCanvasContext.imageSmoothingEnabled = t.RendererContext.imageSmoothingEnabled;
  6422. this._cacheCanvasContext.webkitImageSmoothingEnabled = t.RendererContext.imageSmoothingEnabled;
  6423. this._cacheCanvasContext.mozImageSmoothingEnabled = t.RendererContext.imageSmoothingEnabled;
  6424. this._cacheCanvasContext.msImageSmoothingEnabled = t.RendererContext.imageSmoothingEnabled
  6425. }
  6426. };
  6427. i.prototype.clearScreen = function() {
  6428. for (var e = t.RenderFilter.getInstance().getDrawAreaList(), i = 0, n = e.length; i < n; i++) {
  6429. var r = e[i];
  6430. this.clearRect(r.x, r.y, r.width, r.height)
  6431. }
  6432. e = t.MainContext.instance.stage;
  6433. this._cacheCanvasContext.clearRect(0, 0, e.stageWidth, e.stageHeight);
  6434. this.renderCost = 0
  6435. };
  6436. i.prototype.clearRect = function(t, e, i, n) {
  6437. this.canvasContext.clearRect(t, e, i, n)
  6438. };
  6439. i.prototype.drawImage = function(i, n, r, o, s, a, h, c, u, l) {
  6440. void 0 === l && (l = void 0);
  6441. var p = i._bitmapData;
  6442. a += this._transformTx;
  6443. h += this._transformTy;
  6444. var _ = t.getTimer();
  6445. void 0 === l ? this._cacheCanvasContext.drawImage(p, n, r, o, s, a, h, c, u) : this.drawRepeatImage(i, n, r, o, s, a, h, c, u, l);
  6446. e.prototype.drawImage.call(this, i, n, r, o, s, a, h, c, u, l);
  6447. this.renderCost += t.getTimer() - _
  6448. };
  6449. i.prototype.drawRepeatImage = function(e, i, n, r, o, s, a, h, c, u) {
  6450. if (void 0 === e.pattern) {
  6451. var l = t.MainContext.instance.rendererContext.texture_scale_factor,
  6452. p = e._bitmapData,
  6453. _ = p;
  6454. if (p.width != r || p.height != o || 1 != l) _ = document.createElement("canvas"), _.width = r * l, _.height = o * l, _.getContext("2d").drawImage(p, i, n, r, o, 0, 0, r * l, o * l);
  6455. i = this._cacheCanvasContext.createPattern(_, u);
  6456. e.pattern = i
  6457. }
  6458. this._cacheCanvasContext.fillStyle = e.pattern;
  6459. this._cacheCanvasContext.translate(s, a);
  6460. this._cacheCanvasContext.fillRect(0, 0, h, c);
  6461. this._cacheCanvasContext.translate(-s, -a)
  6462. };
  6463. i.prototype.setTransform = function(t) {
  6464. 1 == t.a && 0 == t.b && 0 == t.c && 1 == t.d && 1 == this._matrixA && 0 == this._matrixB && 0 == this._matrixC && 1 == this._matrixD ? (this._transformTx = t.tx - this._matrixTx, this._transformTy = t.ty - this._matrixTy) : (this._transformTx = this._transformTy = 0, this._matrixA == t.a && this._matrixB == t.b && this._matrixC == t.c && this._matrixD == t.d && this._matrixTx == t.tx && this._matrixTy == t.ty || this._cacheCanvasContext.setTransform(t.a, t.b, t.c, t.d, t.tx, t.ty))
  6465. };
  6466. i.prototype.setAlpha = function(e, i) {
  6467. e != this.globalAlpha && (this._cacheCanvasContext.globalAlpha = this.globalAlpha = e);
  6468. i ? (this.blendValue = this.blendModes[i], this._cacheCanvasContext.globalCompositeOperation = this.blendValue) : this.blendValue != t.BlendMode.NORMAL && (this.blendValue = this.blendModes[t.BlendMode.NORMAL], this._cacheCanvasContext.globalCompositeOperation = this.blendValue)
  6469. };
  6470. i.prototype.initBlendMode = function() {
  6471. this.blendModes = {};
  6472. this.blendModes[t.BlendMode.NORMAL] = "source-over";
  6473. this.blendModes[t.BlendMode.ADD] = "lighter"
  6474. };
  6475. i.prototype.setupFont = function(t, e) {
  6476. void 0 === e && (e = null);
  6477. e = e || {};
  6478. var i = null == e.size ? t._size : e.size,
  6479. n = null == e.fontFamily ? t._fontFamily : e.fontFamily,
  6480. r = this._cacheCanvasContext,
  6481. o = (null == e.italic ? t._italic : e.italic) ? "italic " : "normal ",
  6482. o = o + ((null == e.bold ? t._bold : e.bold) ? "bold " : "normal ");
  6483. r.font = o + (i + "px " + n);
  6484. r.textAlign = "left";
  6485. r.textBaseline = "middle"
  6486. };
  6487. i.prototype.measureText = function(t) {
  6488. return this._cacheCanvasContext.measureText(t).width
  6489. };
  6490. i.prototype.drawText = function(i, n, r, o, s, a) {
  6491. void 0 === a && (a = null);
  6492. this.setupFont(i, a);
  6493. a = a || {};
  6494. var h;
  6495. h = null != a.textColor ? t.toColorString(a.textColor) : i._textColorString;
  6496. var c;
  6497. c = null != a.strokeColor ? t.toColorString(a.strokeColor) : i._strokeColorString;
  6498. var u;
  6499. u = null != a.stroke ? a.stroke : i._stroke;
  6500. var l = this._cacheCanvasContext;
  6501. l.fillStyle = h;
  6502. l.strokeStyle = c;
  6503. u && (l.lineWidth = 2 * u, l.strokeText(n, r + this._transformTx, o + this._transformTy, s || 65535));
  6504. l.fillText(n, r + this._transformTx, o + this._transformTy, s || 65535);
  6505. e.prototype.drawText.call(this, i, n, r, o, s, a)
  6506. };
  6507. i.prototype.strokeRect = function(t, e, i, n, r) {
  6508. this._cacheCanvasContext.strokeStyle = r;
  6509. this._cacheCanvasContext.strokeRect(t, e, i, n)
  6510. };
  6511. i.prototype.pushMask = function(t) {
  6512. this._cacheCanvasContext.save();
  6513. this._cacheCanvasContext.beginPath();
  6514. this._cacheCanvasContext.rect(t.x + this._transformTx, t.y + this._transformTy, t.width, t.height);
  6515. this._cacheCanvasContext.clip();
  6516. this._cacheCanvasContext.closePath()
  6517. };
  6518. i.prototype.popMask = function() {
  6519. this._cacheCanvasContext.restore();
  6520. this._cacheCanvasContext.setTransform(1, 0, 0, 1, 0, 0)
  6521. };
  6522. i.prototype.onRenderStart = function() {
  6523. this._cacheCanvasContext.save()
  6524. };
  6525. i.prototype.onRenderFinish = function() {
  6526. this._cacheCanvasContext.restore();
  6527. this._cacheCanvasContext.setTransform(1, 0, 0, 1, 0, 0);
  6528. for (var e = this._cacheCanvas.width, i = this._cacheCanvas.height, n = t.RenderFilter.getInstance().getDrawAreaList(), r = 0, o = n.length; r < o; r++) {
  6529. var s = n[r],
  6530. a = s.x,
  6531. h = s.y,
  6532. c = s.width,
  6533. s = s.height;
  6534. a + c > e && (c = e - a);
  6535. h + s > i && (s = i - h);
  6536. 0 < c && 0 < s && this.canvasContext.drawImage(this._cacheCanvas, a, h, c, s, a, h, c, s)
  6537. }
  6538. };
  6539. return i
  6540. }(t.RendererContext);
  6541. t.HTML5CanvasRenderer = e;
  6542. e.prototype.__class__ = "egret.HTML5CanvasRenderer"
  6543. })(egret || (egret = {}));
  6544. var egret_h5_graphics;
  6545. (function(t) {
  6546. t.beginFill = function(t, i) {
  6547. void 0 === i && (i = 1);
  6548. var n = "rgba(" + (t >> 16) + "," + ((t & 65280) >> 8) + "," + (t & 255) + "," + i + ")";
  6549. this.fillStyleColor = n;
  6550. this.commandQueue.push(new e(this._setStyle, this, [n]))
  6551. };
  6552. t.drawRect = function(t, i, n, r) {
  6553. this.commandQueue.push(new e(function(t, e, i, n) {
  6554. var r = this.renderContext;
  6555. this.canvasContext.beginPath();
  6556. this.canvasContext.rect(r._transformTx + t, r._transformTy + e, i, n);
  6557. this.canvasContext.closePath()
  6558. }, this, [t, i, n, r]));
  6559. this._fill()
  6560. };
  6561. t.drawCircle = function(t, i, n) {
  6562. this.commandQueue.push(new e(function(t, e, i) {
  6563. var n = this.renderContext;
  6564. this.canvasContext.beginPath();
  6565. this.canvasContext.arc(n._transformTx + t, n._transformTy + e, i, 0, 2 * Math.PI);
  6566. this.canvasContext.closePath()
  6567. }, this, [t, i, n]));
  6568. this._fill()
  6569. };
  6570. t.drawRoundRect = function(t, i, n, r, o, s) {
  6571. this.commandQueue.push(new e(function(t, e, i, n, r, o) {
  6572. var s = this.renderContext;
  6573. t = s._transformTx + t;
  6574. e = s._transformTy + e;
  6575. r /= 2;
  6576. o = o ? o / 2 : r;
  6577. i = t + i;
  6578. n = e + n;
  6579. s = n - o;
  6580. this.canvasContext.beginPath();
  6581. this.canvasContext.moveTo(i, s);
  6582. this.canvasContext.quadraticCurveTo(i, n, i - r, n);
  6583. this.canvasContext.lineTo(t + r, n);
  6584. this.canvasContext.quadraticCurveTo(t, n, t, n - o);
  6585. this.canvasContext.lineTo(t, e + o);
  6586. this.canvasContext.quadraticCurveTo(t, e, t + r, e);
  6587. this.canvasContext.lineTo(i - r, e);
  6588. this.canvasContext.quadraticCurveTo(i, e, i, e + o);
  6589. this.canvasContext.lineTo(i, s);
  6590. this.canvasContext.closePath()
  6591. }, this, [t, i, n, r, o, s]));
  6592. this._fill()
  6593. };
  6594. t.drawEllipse = function(t, i, n, r) {
  6595. this.commandQueue.push(new e(function(t, e, i, n) {
  6596. var r = this.renderContext;
  6597. this.canvasContext.save();
  6598. t = r._transformTx + t;
  6599. e = r._transformTy + e;
  6600. var r = i > n ? i : n,
  6601. o = i / r;
  6602. n /= r;
  6603. this.canvasContext.scale(o, n);
  6604. this.canvasContext.beginPath();
  6605. this.canvasContext.moveTo((t + i) / o, e / n);
  6606. this.canvasContext.arc(t / o, e / n, r, 0, 2 * Math.PI);
  6607. this.canvasContext.closePath();
  6608. this.canvasContext.restore();
  6609. this.canvasContext.stroke()
  6610. }, this, [t, i, n, r]));
  6611. this._fill()
  6612. };
  6613. t.lineStyle = function(t, i, n, r, o, s, a, h) {
  6614. void 0 === t && (t = NaN);
  6615. void 0 === i && (i = 0);
  6616. void 0 === n && (n = 1);
  6617. void 0 === r && (r = !1);
  6618. void 0 === o && (o = "normal");
  6619. void 0 === s && (s = null);
  6620. void 0 === a && (a = null);
  6621. void 0 === h && (h = 3);
  6622. this.strokeStyleColor && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand));
  6623. this.strokeStyleColor = i = "rgba(" + (i >> 16) + "," + ((i & 65280) >> 8) + "," + (i & 255) + "," + n + ")";
  6624. this.commandQueue.push(new e(function(t, e) {
  6625. this.canvasContext.lineWidth = t;
  6626. this.canvasContext.strokeStyle = e;
  6627. this.canvasContext.beginPath()
  6628. }, this, [t, i]));
  6629. "undefined" === typeof this.lineX && (this.lineY = this.lineX = 0);
  6630. this.moveTo(this.lineX, this.lineY)
  6631. };
  6632. t.lineTo = function(t, i) {
  6633. this.commandQueue.push(new e(function(t, e) {
  6634. var i = this.renderContext;
  6635. this.canvasContext.lineTo(i._transformTx + t, i._transformTy + e)
  6636. }, this, [t, i]));
  6637. this.lineX = t;
  6638. this.lineY = i
  6639. };
  6640. t.curveTo = function(t, i, n, r) {
  6641. this.commandQueue.push(new e(function(t, e, i, n) {
  6642. var r = this.renderContext;
  6643. this.canvasContext.quadraticCurveTo(r._transformTx + t, r._transformTy + e, r._transformTx + i, r._transformTy + n)
  6644. }, this, [t, i, n, r]));
  6645. this.lineX = n;
  6646. this.lineY = r
  6647. };
  6648. t.moveTo = function(t, i) {
  6649. this.commandQueue.push(new e(function(t, e) {
  6650. var i = this.renderContext;
  6651. this.canvasContext.moveTo(i._transformTx + t, i._transformTy + e)
  6652. }, this, [t, i]))
  6653. };
  6654. t.clear = function() {
  6655. this.lineY = this.lineX = this.commandQueue.length = 0;
  6656. this.fillStyleColor = this.strokeStyleColor = null
  6657. };
  6658. t.createEndFillCommand = function() {
  6659. this.endFillCommand || (this.endFillCommand = new e(function() {
  6660. this.canvasContext.fill();
  6661. this.canvasContext.closePath()
  6662. }, this, null))
  6663. };
  6664. t.endFill = function() {
  6665. null != this.fillStyleColor && this._fill();
  6666. this.fillStyleColor = null
  6667. };
  6668. t._fill = function() {
  6669. this.fillStyleColor && (this.createEndFillCommand(), this.commandQueue.push(this.endFillCommand))
  6670. };
  6671. t.createEndLineCommand = function() {
  6672. this.endLineCommand || (this.endLineCommand = new e(function() {
  6673. this.canvasContext.stroke();
  6674. this.canvasContext.closePath()
  6675. }, this, null))
  6676. };
  6677. t._draw = function(t) {
  6678. var e = this.commandQueue.length;
  6679. if (0 != e) {
  6680. this.renderContext = t;
  6681. t = this.canvasContext = this.renderContext._cacheCanvasContext || this.renderContext.canvasContext;
  6682. t.save();
  6683. this.strokeStyleColor && 0 < e && this.commandQueue[e - 1] != this.endLineCommand && (this.createEndLineCommand(), this.commandQueue.push(this.endLineCommand), e = this.commandQueue.length);
  6684. for (var i = 0; i < e; i++) {
  6685. var n = this.commandQueue[i];
  6686. n.method.apply(n.thisObject, n.args)
  6687. }
  6688. t.restore()
  6689. }
  6690. };
  6691. var e = function() {
  6692. return function(t, e, i) {
  6693. this.method = t;
  6694. this.thisObject = e;
  6695. this.args = i
  6696. }
  6697. }();
  6698. e.prototype.__class__ = "egret_h5_graphics.Command";
  6699. t._setStyle = function(t) {
  6700. this.canvasContext.fillStyle = t;
  6701. this.canvasContext.beginPath()
  6702. };
  6703. t.init = function() {
  6704. for (var e in t) egret.Graphics.prototype[e] = t[e];
  6705. egret.RendererContext.createRendererContext = function(t) {
  6706. return new egret.HTML5CanvasRenderer(t)
  6707. }
  6708. }
  6709. })(egret_h5_graphics || (egret_h5_graphics = {}));
  6710. egret_h5_graphics.init();
  6711. __extends = this.__extends || function(t, e) {
  6712. function i() {
  6713. this.constructor = t
  6714. }
  6715. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  6716. i.prototype = e.prototype;
  6717. t.prototype = new i
  6718. };
  6719. (function(t) {
  6720. var e = function(e) {
  6721. function i(i) {
  6722. e.call(this);
  6723. this.size = 2e3;
  6724. this.vertSize = 5;
  6725. this.contextLost = !1;
  6726. this.glContextId = 0;
  6727. this.currentBlendMode = "";
  6728. this.currentBaseTexture = null;
  6729. this.currentBatchSize = 0;
  6730. this.maskList = [];
  6731. this.maskDataFreeList = [];
  6732. this.canvasContext = document.createElement("canvas").getContext("2d");
  6733. console.log("使用WebGL模式");
  6734. this.canvas = i || this.createCanvas();
  6735. this.canvas.addEventListener("webglcontextlost", this.handleContextLost.bind(this), !1);
  6736. this.canvas.addEventListener("webglcontextrestored", this.handleContextRestored.bind(this), !1);
  6737. this.onResize();
  6738. this.projectionX = this.canvas.width / 2;
  6739. this.projectionY = -this.canvas.height / 2;
  6740. i = 6 * this.size;
  6741. this.vertices = new Float32Array(4 * this.size * this.vertSize);
  6742. this.indices = new Uint16Array(i);
  6743. for (var n = 0, r = 0; n < i; n += 6, r += 4) this.indices[n + 0] = r + 0, this.indices[n + 1] = r + 1, this.indices[n + 2] = r + 2, this.indices[n + 3] = r + 0, this.indices[n + 4] = r + 2, this.indices[n + 5] = r + 3;
  6744. this.initWebGL();
  6745. this.shaderManager = new t.WebGLShaderManager(this.gl);
  6746. this.worldTransform = new t.Matrix;
  6747. this.initBlendMode();
  6748. t.MainContext.instance.addEventListener(t.Event.FINISH_RENDER, this._draw, this);
  6749. t.TextField.prototype._draw = function(e) {
  6750. this.getDirty() && (this.cacheAsBitmap = !0);
  6751. t.DisplayObject.prototype._draw.call(this, e)
  6752. }
  6753. }
  6754. __extends(i, e);
  6755. i.prototype.createCanvas = function() {
  6756. var e = t.Browser.getInstance().$("#egretCanvas");
  6757. if (!e) {
  6758. var i = document.getElementById(t.StageDelegate.canvas_div_name),
  6759. e = t.Browser.getInstance().$new("canvas");
  6760. e.id = "egretCanvas";
  6761. i.appendChild(e)
  6762. }
  6763. t.MainContext.instance.stage.addEventListener(t.Event.RESIZE, this.onResize, this);
  6764. return e
  6765. };
  6766. i.prototype.onResize = function() {
  6767. if (this.canvas) {
  6768. var e = document.getElementById(t.StageDelegate.canvas_div_name);
  6769. this.canvas.width = t.MainContext.instance.stage.stageWidth;
  6770. this.canvas.height = t.MainContext.instance.stage.stageHeight;
  6771. this.canvas.style.width = e.style.width;
  6772. this.canvas.style.height = e.style.height;
  6773. this.projectionX = this.canvas.width / 2;
  6774. this.projectionY = -this.canvas.height / 2
  6775. }
  6776. };
  6777. i.prototype.handleContextLost = function() {
  6778. this.contextLost = !0
  6779. };
  6780. i.prototype.handleContextRestored = function() {
  6781. this.initWebGL();
  6782. this.shaderManager.setContext(this.gl);
  6783. this.contextLost = !1
  6784. };
  6785. i.prototype.initWebGL = function() {
  6786. for (var t = {
  6787. stencil: !0
  6788. }, e, i = ["experimental-webgl", "webgl"], n = 0; n < i.length; n++) {
  6789. try {
  6790. e = this.canvas.getContext(i[n], t)
  6791. } catch (r) {}
  6792. if (e) break
  6793. }
  6794. if (!e) throw Error("当前浏览器不支持webgl");
  6795. this.setContext(e)
  6796. };
  6797. i.prototype.setContext = function(t) {
  6798. this.gl = t;
  6799. t.id = this.glContextId++;
  6800. this.vertexBuffer = t.createBuffer();
  6801. this.indexBuffer = t.createBuffer();
  6802. t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  6803. t.bufferData(t.ELEMENT_ARRAY_BUFFER, this.indices, t.STATIC_DRAW);
  6804. t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer);
  6805. t.bufferData(t.ARRAY_BUFFER, this.vertices, t.DYNAMIC_DRAW);
  6806. t.disable(t.DEPTH_TEST);
  6807. t.disable(t.CULL_FACE);
  6808. t.enable(t.BLEND);
  6809. t.colorMask(!0, !0, !0, !0)
  6810. };
  6811. i.prototype.initBlendMode = function() {
  6812. this.blendModesWebGL = {};
  6813. this.blendModesWebGL[t.BlendMode.NORMAL] = [this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA];
  6814. this.blendModesWebGL[t.BlendMode.ADD] = [this.gl.SRC_ALPHA, this.gl.ONE]
  6815. };
  6816. i.prototype.start = function() {
  6817. if (!this.contextLost) {
  6818. var t = this.gl;
  6819. t.activeTexture(t.TEXTURE0);
  6820. t.bindBuffer(t.ARRAY_BUFFER, this.vertexBuffer);
  6821. t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  6822. var e;
  6823. e = this.colorTransformMatrix ? this.shaderManager.colorTransformShader : this.shaderManager.defaultShader;
  6824. this.shaderManager.activateShader(e);
  6825. e.syncUniforms();
  6826. t.uniform2f(e.projectionVector, this.projectionX, this.projectionY);
  6827. var i = 4 * this.vertSize;
  6828. t.vertexAttribPointer(e.aVertexPosition, 2, t.FLOAT, !1, i, 0);
  6829. t.vertexAttribPointer(e.aTextureCoord, 2, t.FLOAT, !1, i, 8);
  6830. t.vertexAttribPointer(e.colorAttribute, 2, t.FLOAT, !1, i, 16)
  6831. }
  6832. };
  6833. i.prototype.clearScreen = function() {
  6834. var e = this.gl;
  6835. e.colorMask(!0, !0, !0, !0);
  6836. for (var i = t.RenderFilter.getInstance().getDrawAreaList(), n = 0, r = i.length; n < r; n++) {
  6837. var o = i[n];
  6838. e.viewport(o.x, o.y, o.width, o.height);
  6839. e.bindFramebuffer(e.FRAMEBUFFER, null);
  6840. e.clearColor(0, 0, 0, 0);
  6841. e.clear(e.COLOR_BUFFER_BIT)
  6842. }
  6843. i = t.MainContext.instance.stage;
  6844. e.viewport(0, 0, i.stageWidth, i.stageHeight);
  6845. this.renderCost = 0
  6846. };
  6847. i.prototype.setBlendMode = function(e) {
  6848. e || (e = t.BlendMode.NORMAL);
  6849. if (this.currentBlendMode != e) {
  6850. var i = this.blendModesWebGL[e];
  6851. i && (this._draw(), this.gl.blendFunc(i[0], i[1]), this.currentBlendMode = e)
  6852. }
  6853. };
  6854. i.prototype.drawRepeatImage = function(e, i, n, r, o, s, a, h, c, u) {
  6855. u = t.MainContext.instance.rendererContext.texture_scale_factor;
  6856. r *= u;
  6857. for (o *= u; s < h; s += r)
  6858. for (var l = a; l < c; l += o) {
  6859. var p = Math.min(r, h - s),
  6860. _ = Math.min(o, c - l);
  6861. this.drawImage(e, i, n, p / u, _ / u, s, l, p, _)
  6862. }
  6863. };
  6864. i.prototype.drawImage = function(t, e, i, n, r, o, s, a, h, c) {
  6865. void 0 === c && (c = void 0);
  6866. if (!this.contextLost)
  6867. if (void 0 !== c) this.drawRepeatImage(t, e, i, n, r, o, s, a, h, c);
  6868. else {
  6869. this.createWebGLTexture(t);
  6870. if (t.webGLTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size - 1) this._draw(), this.currentBaseTexture = t.webGLTexture;
  6871. var u = this.worldTransform,
  6872. l = u.a,
  6873. p = u.b,
  6874. _ = u.c,
  6875. d = u.d,
  6876. f = u.tx,
  6877. g = u.ty;
  6878. 0 == o && 0 == s || u.append(1, 0, 0, 1, o, s);
  6879. 1 == n / a && 1 == r / h || u.append(a / n, 0, 0, h / r, 0, 0);
  6880. o = u.a;
  6881. s = u.b;
  6882. a = u.c;
  6883. h = u.d;
  6884. c = u.tx;
  6885. var y = u.ty;
  6886. u.a = l;
  6887. u.b = p;
  6888. u.c = _;
  6889. u.d = d;
  6890. u.tx = f;
  6891. u.ty = g;
  6892. l = t._sourceWidth;
  6893. p = t._sourceHeight;
  6894. t = n;
  6895. u = r;
  6896. e /= l;
  6897. i /= p;
  6898. n /= l;
  6899. r /= p;
  6900. l = this.vertices;
  6901. p = 4 * this.currentBatchSize * this.vertSize;
  6902. _ = this.worldAlpha;
  6903. l[p++] = c;
  6904. l[p++] = y;
  6905. l[p++] = e;
  6906. l[p++] = i;
  6907. l[p++] = _;
  6908. l[p++] = o * t + c;
  6909. l[p++] = s * t + y;
  6910. l[p++] = n + e;
  6911. l[p++] = i;
  6912. l[p++] = _;
  6913. l[p++] = o * t + a * u + c;
  6914. l[p++] = h * u + s * t + y;
  6915. l[p++] = n + e;
  6916. l[p++] = r + i;
  6917. l[p++] = _;
  6918. l[p++] = a * u + c;
  6919. l[p++] = h * u + y;
  6920. l[p++] = e;
  6921. l[p++] = r + i;
  6922. l[p++] = _;
  6923. this.currentBatchSize++
  6924. }
  6925. };
  6926. i.prototype._draw = function() {
  6927. if (0 != this.currentBatchSize && !this.contextLost) {
  6928. var e = t.getTimer();
  6929. this.start();
  6930. var i = this.gl;
  6931. i.bindTexture(i.TEXTURE_2D, this.currentBaseTexture);
  6932. var n = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize);
  6933. i.bufferSubData(i.ARRAY_BUFFER, 0, n);
  6934. i.drawElements(i.TRIANGLES, 6 * this.currentBatchSize, i.UNSIGNED_SHORT, 0);
  6935. this.currentBatchSize = 0;
  6936. this.renderCost += t.getTimer() - e;
  6937. t.Profiler.getInstance().onDrawImage()
  6938. }
  6939. };
  6940. i.prototype.setTransform = function(t) {
  6941. var e = this.worldTransform;
  6942. e.a = t.a;
  6943. e.b = t.b;
  6944. e.c = t.c;
  6945. e.d = t.d;
  6946. e.tx = t.tx;
  6947. e.ty = t.ty
  6948. };
  6949. i.prototype.setAlpha = function(t, e) {
  6950. this.worldAlpha = t;
  6951. this.setBlendMode(e)
  6952. };
  6953. i.prototype.createWebGLTexture = function(t) {
  6954. if (!t.webGLTexture) {
  6955. var e = this.gl;
  6956. t.webGLTexture = e.createTexture();
  6957. e.bindTexture(e.TEXTURE_2D, t.webGLTexture);
  6958. e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
  6959. e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t._bitmapData);
  6960. e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR);
  6961. e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR);
  6962. e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE);
  6963. e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
  6964. e.bindTexture(e.TEXTURE_2D, null)
  6965. }
  6966. };
  6967. i.prototype.pushMask = function(t) {
  6968. this._draw();
  6969. var e = this.gl;
  6970. 0 == this.maskList.length && (e.enable(e.STENCIL_TEST), e.stencilFunc(e.ALWAYS, 1, 1));
  6971. var i = this.maskDataFreeList.pop();
  6972. i ? (i.x = t.x, i.y = t.y, i.w = t.width, i.h = t.height) : i = {
  6973. x: t.x,
  6974. y: t.y,
  6975. w: t.width,
  6976. h: t.height
  6977. };
  6978. this.maskList.push(i);
  6979. e.colorMask(!1, !1, !1, !1);
  6980. e.stencilOp(e.KEEP, e.KEEP, e.INCR);
  6981. this.renderGraphics(i);
  6982. e.colorMask(!0, !0, !0, !0);
  6983. e.stencilFunc(e.NOTEQUAL, 0, this.maskList.length);
  6984. e.stencilOp(e.KEEP, e.KEEP, e.KEEP)
  6985. };
  6986. i.prototype.popMask = function() {
  6987. this._draw();
  6988. var t = this.gl,
  6989. e = this.maskList.pop();
  6990. e && (t.colorMask(!1, !1, !1, !1), t.stencilOp(t.KEEP, t.KEEP, t.DECR), this.renderGraphics(e), t.colorMask(!0, !0, !0, !0), t.stencilFunc(t.NOTEQUAL, 0, this.maskList.length), t.stencilOp(t.KEEP, t.KEEP, t.KEEP), this.maskDataFreeList.push(e));
  6991. 0 == this.maskList.length && t.disable(t.STENCIL_TEST)
  6992. };
  6993. i.prototype.setGlobalColorTransform = function(t) {
  6994. if (this.colorTransformMatrix != t && (this._draw(), this.colorTransformMatrix = t)) {
  6995. t = t.concat();
  6996. var e = this.shaderManager.colorTransformShader;
  6997. e.uniforms.colorAdd.value.w = t.splice(19, 1)[0] / 255;
  6998. e.uniforms.colorAdd.value.z = t.splice(14, 1)[0] / 255;
  6999. e.uniforms.colorAdd.value.y = t.splice(9, 1)[0] / 255;
  7000. e.uniforms.colorAdd.value.x = t.splice(4, 1)[0] / 255;
  7001. e.uniforms.matrix.value = t
  7002. }
  7003. };
  7004. i.prototype.setupFont = function(t, e) {
  7005. var i = this.canvasContext,
  7006. n = t.italic ? "italic " : "normal ",
  7007. n = n + (t.bold ? "bold " : "normal "),
  7008. n = n + (t.size + "px " + t.fontFamily);
  7009. i.font = n;
  7010. i.textAlign = "left";
  7011. i.textBaseline = "middle"
  7012. };
  7013. i.prototype.measureText = function(t) {
  7014. return this.canvasContext.measureText(t).width
  7015. };
  7016. i.prototype.renderGraphics = function(t) {
  7017. var e = this.gl,
  7018. i = this.shaderManager.primitiveShader;
  7019. this.graphicsPoints ? (this.graphicsPoints.length = 0, this.graphicsIndices.length = 0) : (this.graphicsPoints = [], this.graphicsIndices = [], this.graphicsBuffer = e.createBuffer(), this.graphicsIndexBuffer = e.createBuffer());
  7020. this.updateGraphics(t);
  7021. this.shaderManager.activateShader(i);
  7022. e.blendFunc(e.ONE, e.ONE_MINUS_SRC_ALPHA);
  7023. e.uniformMatrix3fv(i.translationMatrix, !1, this.worldTransform.toArray(!0));
  7024. e.uniform2f(i.projectionVector, this.projectionX, -this.projectionY);
  7025. e.uniform2f(i.offsetVector, 0, 0);
  7026. e.uniform3fv(i.tintColor, [1, 1, 1]);
  7027. e.uniform1f(i.alpha, this.worldAlpha);
  7028. e.bindBuffer(e.ARRAY_BUFFER, this.graphicsBuffer);
  7029. e.vertexAttribPointer(i.aVertexPosition, 2, e.FLOAT, !1, 24, 0);
  7030. e.vertexAttribPointer(i.colorAttribute, 4, e.FLOAT, !1, 24, 8);
  7031. e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
  7032. e.drawElements(e.TRIANGLE_STRIP, this.graphicsIndices.length, e.UNSIGNED_SHORT, 0);
  7033. this.shaderManager.activateShader(this.shaderManager.defaultShader)
  7034. };
  7035. i.prototype.updateGraphics = function(t) {
  7036. var e = this.gl;
  7037. this.buildRectangle(t);
  7038. e.bindBuffer(e.ARRAY_BUFFER, this.graphicsBuffer);
  7039. e.bufferData(e.ARRAY_BUFFER, new Float32Array(this.graphicsPoints), e.STATIC_DRAW);
  7040. e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.graphicsIndexBuffer);
  7041. e.bufferData(e.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.graphicsIndices), e.STATIC_DRAW)
  7042. };
  7043. i.prototype.buildRectangle = function(t) {
  7044. var e = t.x,
  7045. i = t.y,
  7046. n = t.w;
  7047. t = t.h;
  7048. var r = this.graphicsPoints,
  7049. o = this.graphicsIndices,
  7050. s = r.length / 6;
  7051. r.push(e, i);
  7052. r.push(0, 0, 0, 1);
  7053. r.push(e + n, i);
  7054. r.push(0, 0, 0, 1);
  7055. r.push(e, i + t);
  7056. r.push(0, 0, 0, 1);
  7057. r.push(e + n, i + t);
  7058. r.push(0, 0, 0, 1);
  7059. o.push(s, s, s + 1, s + 2, s + 3, s + 3)
  7060. };
  7061. return i
  7062. }(t.RendererContext);
  7063. t.WebGLRenderer = e;
  7064. e.prototype.__class__ = "egret.WebGLRenderer"
  7065. })(egret || (egret = {}));
  7066. (function(t) {
  7067. var e = function() {
  7068. function t() {}
  7069. t.compileProgram = function(e, i, n) {
  7070. n = t.compileFragmentShader(e, n);
  7071. i = t.compileVertexShader(e, i);
  7072. var r = e.createProgram();
  7073. e.attachShader(r, i);
  7074. e.attachShader(r, n);
  7075. e.linkProgram(r);
  7076. e.getProgramParameter(r, e.LINK_STATUS) || console.log("无法初始化着色器");
  7077. return r
  7078. };
  7079. t.compileFragmentShader = function(e, i) {
  7080. return t._compileShader(e, i, e.FRAGMENT_SHADER)
  7081. };
  7082. t.compileVertexShader = function(e, i) {
  7083. return t._compileShader(e, i, e.VERTEX_SHADER)
  7084. };
  7085. t._compileShader = function(t, e, i) {
  7086. i = t.createShader(i);
  7087. t.shaderSource(i, e);
  7088. t.compileShader(i);
  7089. return t.getShaderParameter(i, t.COMPILE_STATUS) ? i : (console.log(t.getShaderInfoLog(i)), null)
  7090. };
  7091. t.checkCanUseWebGL = function() {
  7092. if (void 0 == t.canUseWebGL) try {
  7093. var e = document.createElement("canvas");
  7094. t.canUseWebGL = !!window.WebGLRenderingContext && !(!e.getContext("webgl") && !e.getContext("experimental-webgl"))
  7095. } catch (i) {
  7096. t.canUseWebGL = !1
  7097. }
  7098. return t.canUseWebGL
  7099. };
  7100. return t
  7101. }();
  7102. t.WebGLUtils = e;
  7103. e.prototype.__class__ = "egret.WebGLUtils"
  7104. })(egret || (egret = {}));
  7105. __extends = this.__extends || function(t, e) {
  7106. function i() {
  7107. this.constructor = t
  7108. }
  7109. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7110. i.prototype = e.prototype;
  7111. t.prototype = new i
  7112. };
  7113. (function(t) {
  7114. var e = function() {
  7115. function t(t) {
  7116. this.maxAttibs = 10;
  7117. this.attribState = [];
  7118. this.tempAttribState = [];
  7119. for (var e = 0; e < this.maxAttibs; e++) this.attribState[e] = !1;
  7120. this.setContext(t)
  7121. }
  7122. t.prototype.setContext = function(t) {
  7123. this.gl = t;
  7124. this.primitiveShader = new r(t);
  7125. this.defaultShader = new i(t);
  7126. this.colorTransformShader = new n(t);
  7127. this.activateShader(this.defaultShader)
  7128. };
  7129. t.prototype.activateShader = function(t) {
  7130. this.currentShader != t && (this.gl.useProgram(t.program), this.setAttribs(t.attributes), this.currentShader = t)
  7131. };
  7132. t.prototype.setAttribs = function(t) {
  7133. var e, i;
  7134. i = this.tempAttribState.length;
  7135. for (e = 0; e < i; e++) this.tempAttribState[e] = !1;
  7136. i = t.length;
  7137. for (e = 0; e < i; e++) this.tempAttribState[t[e]] = !0;
  7138. t = this.gl;
  7139. i = this.attribState.length;
  7140. for (e = 0; e < i; e++) this.attribState[e] !== this.tempAttribState[e] && (this.attribState[e] = this.tempAttribState[e], this.tempAttribState[e] ? t.enableVertexAttribArray(e) : t.disableVertexAttribArray(e))
  7141. };
  7142. return t
  7143. }();
  7144. t.WebGLShaderManager = e;
  7145. e.prototype.__class__ = "egret.WebGLShaderManager";
  7146. var i = function() {
  7147. function e(t) {
  7148. 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 vColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}";
  7149. this.program = null;
  7150. this.fragmentSrc = "precision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\ngl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;\n}";
  7151. this.gl = t;
  7152. this.init()
  7153. }
  7154. e.prototype.init = function() {
  7155. var e = this.gl,
  7156. i = t.WebGLUtils.compileProgram(e, this.defaultVertexSrc, this.fragmentSrc);
  7157. e.useProgram(i);
  7158. this.uSampler = e.getUniformLocation(i, "uSampler");
  7159. this.projectionVector = e.getUniformLocation(i, "projectionVector");
  7160. this.offsetVector = e.getUniformLocation(i, "offsetVector");
  7161. this.dimensions = e.getUniformLocation(i, "dimensions");
  7162. this.aVertexPosition = e.getAttribLocation(i, "aVertexPosition");
  7163. this.aTextureCoord = e.getAttribLocation(i, "aTextureCoord");
  7164. this.colorAttribute = e.getAttribLocation(i, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
  7165. this.attributes = [this.aVertexPosition, this.aTextureCoord, this.colorAttribute];
  7166. for (var n in this.uniforms) this.uniforms[n].uniformLocation = e.getUniformLocation(i, n);
  7167. this.initUniforms();
  7168. this.program = i
  7169. };
  7170. e.prototype.initUniforms = function() {
  7171. if (this.uniforms) {
  7172. var t = this.gl,
  7173. e, i;
  7174. for (i in this.uniforms) {
  7175. e = this.uniforms[i];
  7176. var n = e.type;
  7177. "mat2" === n || "mat3" === n || "mat4" === n ? (e.glMatrix = !0, e.glValueLength = 1, "mat2" === n ? e.glFunc = t.uniformMatrix2fv : "mat3" === n ? e.glFunc = t.uniformMatrix3fv : "mat4" === n && (e.glFunc = t.uniformMatrix4fv)) : (e.glFunc = t["uniform" + n], e.glValueLength = "2f" === n || "2i" === n ? 2 : "3f" === n || "3i" === n ? 3 : "4f" === n || "4i" === n ? 4 : 1)
  7178. }
  7179. }
  7180. };
  7181. e.prototype.syncUniforms = function() {
  7182. if (this.uniforms) {
  7183. var t, e = this.gl,
  7184. i;
  7185. for (i in this.uniforms) t = this.uniforms[i], 1 === t.glValueLength ? !0 === t.glMatrix ? t.glFunc.call(e, t.uniformLocation, t.transpose, t.value) : t.glFunc.call(e, t.uniformLocation, t.value) : 2 === t.glValueLength ? t.glFunc.call(e, t.uniformLocation, t.value.x, t.value.y) : 3 === t.glValueLength ? t.glFunc.call(e, t.uniformLocation, t.value.x, t.value.y, t.value.z) : 4 === t.glValueLength && t.glFunc.call(e, t.uniformLocation, t.value.x, t.value.y, t.value.z, t.value.w)
  7186. }
  7187. };
  7188. return e
  7189. }();
  7190. t.EgretShader = i;
  7191. i.prototype.__class__ = "egret.EgretShader";
  7192. var n = function(t) {
  7193. function e(e) {
  7194. t.call(this, e);
  7195. this.fragmentSrc = "precision mediump float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform float invert;\nuniform mat4 matrix;\nuniform vec4 colorAdd;\nuniform sampler2D uSampler;\nvoid main(void) {\nvec4 locColor = texture2D(uSampler, vTextureCoord) * matrix;\nif(locColor.a != 0.0){\nlocColor += colorAdd;\n}\ngl_FragColor = locColor;\n}";
  7196. this.uniforms = {
  7197. matrix: {
  7198. type: "mat4",
  7199. value: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
  7200. },
  7201. colorAdd: {
  7202. type: "4f",
  7203. value: {
  7204. x: 0,
  7205. y: 0,
  7206. z: 0,
  7207. w: 0
  7208. }
  7209. }
  7210. };
  7211. this.init()
  7212. }
  7213. __extends(e, t);
  7214. return e
  7215. }(i);
  7216. t.ColorTransformShader = n;
  7217. n.prototype.__class__ = "egret.ColorTransformShader";
  7218. var r = function() {
  7219. function e(t) {
  7220. this.alpha = this.translationMatrix = this.attributes = this.colorAttribute = this.aVertexPosition = this.tintColor = this.offsetVector = this.projectionVector = this.program = null;
  7221. this.fragmentSrc = "precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
  7222. 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}";
  7223. this.gl = t;
  7224. this.init()
  7225. }
  7226. e.prototype.init = function() {
  7227. var e = this.gl,
  7228. i = t.WebGLUtils.compileProgram(e, this.vertexSrc, this.fragmentSrc);
  7229. e.useProgram(i);
  7230. this.projectionVector = e.getUniformLocation(i, "projectionVector");
  7231. this.offsetVector = e.getUniformLocation(i, "offsetVector");
  7232. this.tintColor = e.getUniformLocation(i, "tint");
  7233. this.aVertexPosition = e.getAttribLocation(i, "aVertexPosition");
  7234. this.colorAttribute = e.getAttribLocation(i, "aColor");
  7235. this.attributes = [this.aVertexPosition, this.colorAttribute];
  7236. this.translationMatrix = e.getUniformLocation(i, "translationMatrix");
  7237. this.alpha = e.getUniformLocation(i, "alpha");
  7238. this.program = i
  7239. };
  7240. return e
  7241. }();
  7242. t.PrimitiveShader = r;
  7243. r.prototype.__class__ = "egret.PrimitiveShader"
  7244. })(egret || (egret = {}));
  7245. __extends = this.__extends || function(t, e) {
  7246. function i() {
  7247. this.constructor = t
  7248. }
  7249. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7250. i.prototype = e.prototype;
  7251. t.prototype = new i
  7252. };
  7253. (function(t) {
  7254. var e = function(e) {
  7255. function i() {
  7256. e.call(this)
  7257. }
  7258. __extends(i, e);
  7259. i.prototype.proceed = function(e) {
  7260. function i() {
  7261. if (4 == r.readyState)
  7262. if (r.status != e._status && (e._status = r.status, t.HTTPStatusEvent.dispatchHTTPStatusEvent(e, r.status)), 400 <= r.status || 0 == r.status) t.IOErrorEvent.dispatchIOErrorEvent(e);
  7263. else {
  7264. switch (e.dataFormat) {
  7265. case t.URLLoaderDataFormat.TEXT:
  7266. e.data = r.responseText;
  7267. break;
  7268. case t.URLLoaderDataFormat.VARIABLES:
  7269. e.data = new t.URLVariables(r.responseText);
  7270. break;
  7271. case t.URLLoaderDataFormat.BINARY:
  7272. e.data = r.response;
  7273. break;
  7274. default:
  7275. e.data = r.responseText
  7276. }
  7277. t.__callAsync(t.Event.dispatchEvent, t.Event, e, t.Event.COMPLETE)
  7278. }
  7279. }
  7280. if (e.dataFormat == t.URLLoaderDataFormat.TEXTURE) this.loadTexture(e);
  7281. else if (e.dataFormat == t.URLLoaderDataFormat.SOUND) this.loadSound(e);
  7282. else {
  7283. var n = e._request,
  7284. r = this.getXHR();
  7285. r.onreadystatechange = i;
  7286. var o = t.NetContext._getUrl(n);
  7287. r.open(n.method, o, !0);
  7288. this.setResponseType(r, e.dataFormat);
  7289. n.method != t.URLRequestMethod.GET && n.data ? n.data instanceof t.URLVariables ? (r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), r.send(n.data.toString())) : (r.setRequestHeader("Content-Type", "multipart/form-data"), r.send(n.data)) : r.send()
  7290. }
  7291. };
  7292. i.prototype.loadSound = function(e) {
  7293. function i(o) {
  7294. window.clearTimeout(r.__timeoutId);
  7295. r.removeEventListener("canplaythrough", i, !1);
  7296. r.removeEventListener("error", n, !1);
  7297. o = new t.Sound;
  7298. o._setAudio(r);
  7299. e.data = o;
  7300. t.__callAsync(t.Event.dispatchEvent, t.Event, e, t.Event.COMPLETE)
  7301. }
  7302. function n(o) {
  7303. window.clearTimeout(r.__timeoutId);
  7304. r.removeEventListener("canplaythrough", i, !1);
  7305. r.removeEventListener("error", n, !1);
  7306. t.IOErrorEvent.dispatchIOErrorEvent(e)
  7307. }
  7308. var r = new Audio(e._request.url);
  7309. r.__timeoutId = window.setTimeout(i, 100);
  7310. r.addEventListener("canplaythrough", i, !1);
  7311. r.addEventListener("error", n, !1);
  7312. r.load()
  7313. };
  7314. i.prototype.getXHR = function() {
  7315. return window.XMLHttpRequest ? new window.XMLHttpRequest : new ActiveXObject("MSXML2.XMLHTTP")
  7316. };
  7317. i.prototype.setResponseType = function(e, i) {
  7318. switch (i) {
  7319. case t.URLLoaderDataFormat.TEXT:
  7320. case t.URLLoaderDataFormat.VARIABLES:
  7321. e.responseType = t.URLLoaderDataFormat.TEXT;
  7322. break;
  7323. case t.URLLoaderDataFormat.BINARY:
  7324. e.responseType = "arraybuffer";
  7325. break;
  7326. default:
  7327. e.responseType = i
  7328. }
  7329. };
  7330. i.prototype.loadTexture = function(e) {
  7331. var i = e._request,
  7332. n = new Image;
  7333. n.onload = function(i) {
  7334. n.onerror = null;
  7335. n.onload = null;
  7336. i = new t.Texture;
  7337. i._setBitmapData(n);
  7338. e.data = i;
  7339. t.__callAsync(t.Event.dispatchEvent, t.Event, e, t.Event.COMPLETE)
  7340. };
  7341. n.onerror = function(i) {
  7342. n.onerror = null;
  7343. n.onload = null;
  7344. t.IOErrorEvent.dispatchIOErrorEvent(e)
  7345. };
  7346. n.src = i.url
  7347. };
  7348. return i
  7349. }(t.NetContext);
  7350. t.HTML5NetContext = e;
  7351. e.prototype.__class__ = "egret.HTML5NetContext"
  7352. })(egret || (egret = {}));
  7353. __extends = this.__extends || function(t, e) {
  7354. function i() {
  7355. this.constructor = t
  7356. }
  7357. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7358. i.prototype = e.prototype;
  7359. t.prototype = new i
  7360. };
  7361. (function(t) {
  7362. var e = function(e) {
  7363. function i() {
  7364. e.call(this);
  7365. this._isTouchDown = !1;
  7366. this.rootDiv = document.getElementById(t.StageDelegate.canvas_div_name)
  7367. }
  7368. __extends(i, e);
  7369. i.prototype.prevent = function(t) {
  7370. t.stopPropagation();
  7371. !0 != t.isScroll && t.preventDefault()
  7372. };
  7373. i.prototype.run = function() {
  7374. var e = this;
  7375. window.navigator.msPointerEnabled ? (this.rootDiv.addEventListener("MSPointerDown", function(t) {
  7376. e._onTouchBegin(t);
  7377. e.prevent(t)
  7378. }, !1), this.rootDiv.addEventListener("MSPointerMove", function(t) {
  7379. e._onTouchMove(t);
  7380. e.prevent(t)
  7381. }, !1), this.rootDiv.addEventListener("MSPointerUp", function(t) {
  7382. e._onTouchEnd(t);
  7383. e.prevent(t)
  7384. }, !1)) : t.MainContext.deviceType == t.MainContext.DEVICE_MOBILE ? this.addTouchListener() : t.MainContext.deviceType == t.MainContext.DEVICE_PC && (this.addTouchListener(), this.addMouseListener());
  7385. window.addEventListener("mousedown", function(t) {
  7386. e.inOutOfCanvas(t) ? e.dispatchLeaveStageEvent() : e._isTouchDown = !0
  7387. });
  7388. window.addEventListener("mouseup", function(t) {
  7389. e._isTouchDown && (e.inOutOfCanvas(t) ? e.dispatchLeaveStageEvent() : e._onTouchEnd(t));
  7390. e._isTouchDown = !1
  7391. })
  7392. };
  7393. i.prototype.addMouseListener = function() {
  7394. var t = this;
  7395. this.rootDiv.addEventListener("mousedown", function(e) {
  7396. t._onTouchBegin(e)
  7397. });
  7398. this.rootDiv.addEventListener("mousemove", function(e) {
  7399. t._onTouchMove(e)
  7400. });
  7401. this.rootDiv.addEventListener("mouseup", function(e) {
  7402. t._onTouchEnd(e)
  7403. })
  7404. };
  7405. i.prototype.addTouchListener = function() {
  7406. var t = this;
  7407. this.rootDiv.addEventListener("touchstart", function(e) {
  7408. for (var i = e.changedTouches.length, n = 0; n < i; n++) t._onTouchBegin(e.changedTouches[n]);
  7409. t.prevent(e)
  7410. }, !1);
  7411. this.rootDiv.addEventListener("touchmove", function(e) {
  7412. for (var i = e.changedTouches.length, n = 0; n < i; n++) t._onTouchMove(e.changedTouches[n]);
  7413. t.prevent(e)
  7414. }, !1);
  7415. this.rootDiv.addEventListener("touchend", function(e) {
  7416. for (var i = e.changedTouches.length, n = 0; n < i; n++) t._onTouchEnd(e.changedTouches[n]);
  7417. t.prevent(e)
  7418. }, !1);
  7419. this.rootDiv.addEventListener("touchcancel", function(e) {
  7420. for (var i = e.changedTouches.length, n = 0; n < i; n++) t._onTouchEnd(e.changedTouches[n]);
  7421. t.prevent(e)
  7422. }, !1)
  7423. };
  7424. i.prototype.inOutOfCanvas = function(e) {
  7425. var i = this.getLocation(this.rootDiv, e);
  7426. e = i.x;
  7427. var i = i.y,
  7428. n = t.MainContext.instance.stage;
  7429. return 0 > e || 0 > i || e > n.stageWidth || i > n.stageHeight ? !0 : !1
  7430. };
  7431. i.prototype.dispatchLeaveStageEvent = function() {
  7432. this.touchingIdentifiers.length = 0;
  7433. t.MainContext.instance.stage.dispatchEventWith(t.Event.LEAVE_STAGE)
  7434. };
  7435. i.prototype._onTouchBegin = function(t) {
  7436. var e = this.getLocation(this.rootDiv, t),
  7437. i = -1;
  7438. t.hasOwnProperty("identifier") && (i = t.identifier);
  7439. this.onTouchBegan(e.x, e.y, i)
  7440. };
  7441. i.prototype._onTouchMove = function(t) {
  7442. var e = this.getLocation(this.rootDiv, t),
  7443. i = -1;
  7444. t.hasOwnProperty("identifier") && (i = t.identifier);
  7445. this.onTouchMove(e.x, e.y, i)
  7446. };
  7447. i.prototype._onTouchEnd = function(t) {
  7448. var e = this.getLocation(this.rootDiv, t),
  7449. i = -1;
  7450. t.hasOwnProperty("identifier") && (i = t.identifier);
  7451. this.onTouchEnd(e.x, e.y, i)
  7452. };
  7453. i.prototype.getLocation = function(e, i) {
  7454. var n = document.documentElement,
  7455. r = window,
  7456. o, s;
  7457. "function" === typeof e.getBoundingClientRect ? (s = e.getBoundingClientRect(), o = s.left, s = s.top) : s = o = 0;
  7458. o += r.pageXOffset - n.clientLeft;
  7459. s += r.pageYOffset - n.clientTop;
  7460. null != i.pageX ? (n = i.pageX, r = i.pageY) : (o -= document.body.scrollLeft, s -= document.body.scrollTop, n = i.clientX, r = i.clientY);
  7461. var a = t.Point.identity;
  7462. a.x = (n - o) / t.StageDelegate.getInstance().getScaleX();
  7463. a.y = (r - s) / t.StageDelegate.getInstance().getScaleY();
  7464. return a
  7465. };
  7466. return i
  7467. }(t.TouchContext);
  7468. t.HTML5TouchContext = e;
  7469. e.prototype.__class__ = "egret.HTML5TouchContext"
  7470. })(egret || (egret = {}));
  7471. __extends = this.__extends || function(t, e) {
  7472. function i() {
  7473. this.constructor = t
  7474. }
  7475. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7476. i.prototype = e.prototype;
  7477. t.prototype = new i
  7478. };
  7479. (function(t) {
  7480. var e = function(e) {
  7481. function i() {
  7482. e.call(this);
  7483. this._hasListeners = !1;
  7484. this._inputType = "";
  7485. this._isShow = !1;
  7486. this.textValue = "";
  7487. this._height = this._width = 0;
  7488. this._styleInfoes = {};
  7489. var i = t.StageDelegate.getInstance().getScaleX(),
  7490. n = t.StageDelegate.getInstance().getScaleY(),
  7491. r = t.Browser.getInstance().$new("div");
  7492. r.position.x = 0;
  7493. r.position.y = 0;
  7494. r.scale.x = i;
  7495. r.scale.y = n;
  7496. r.transforms();
  7497. r.style[egret_dom.getTrans("transformOrigin")] = "0% 0% 0px";
  7498. this.div = r;
  7499. n = t.MainContext.instance.stage;
  7500. i = n.stageWidth;
  7501. n = n.stageHeight;
  7502. r = new t.Shape;
  7503. r.width = i;
  7504. r.height = n;
  7505. r.touchEnabled = !0;
  7506. this._shape = r;
  7507. this.getStageDelegateDiv().appendChild(this.div)
  7508. }
  7509. __extends(i, e);
  7510. i.prototype.getStageDelegateDiv = function() {
  7511. var e = t.Browser.getInstance().$("#StageDelegateDiv");
  7512. e || (e = t.Browser.getInstance().$new("div"), e.id = "StageDelegateDiv", document.getElementById(t.StageDelegate.canvas_div_name).appendChild(e), e.transforms());
  7513. return e
  7514. };
  7515. i.prototype._setMultiline = function(t) {
  7516. e.prototype._setMultiline.call(this, t);
  7517. this.createInput()
  7518. };
  7519. i.prototype.callHandler = function(t) {
  7520. t.stopPropagation()
  7521. };
  7522. i.prototype._add = function() {
  7523. this.div && null == this.div.parentNode && this.getStageDelegateDiv().appendChild(this.div)
  7524. };
  7525. i.prototype._remove = function() {
  7526. this._shape && this._shape.parent && this._shape.parent.removeChild(this._shape);
  7527. this.div && this.div.parentNode && this.div.parentNode.removeChild(this.div)
  7528. };
  7529. i.prototype._addListeners = function() {
  7530. this.inputElement && !this._hasListeners && (this._hasListeners = !0, this.inputElement.addEventListener("mousedown", this.callHandler), this.inputElement.addEventListener("touchstart", this.callHandler), this.inputElement.addEventListener("MSPointerDown", this.callHandler))
  7531. };
  7532. i.prototype._removeListeners = function() {
  7533. this.inputElement && this._hasListeners && (this._hasListeners = !1, this.inputElement.removeEventListener("mousedown", this.callHandler), this.inputElement.removeEventListener("touchstart", this.callHandler), this.inputElement.removeEventListener("MSPointerDown", this.callHandler))
  7534. };
  7535. i.prototype.createInput = function() {
  7536. var t = this._multiline ? "textarea" : "input";
  7537. this._inputType != t && (this._inputType = t, null != this.inputElement && (this._removeListeners(), this.div.removeChild(this.inputElement)), this._multiline ? (t = document.createElement("textarea"), t.style.resize = "none") : t = document.createElement("input"), this._styleInfoes = {}, t.type = "text", this.inputElement = t, this.inputElement.value = "", this.div.appendChild(t), this._addListeners(), this.setElementStyle("width", "0px"), this.setElementStyle("border", "none"), this.setElementStyle("margin", "0"), this.setElementStyle("padding", "0"), this.setElementStyle("outline", "medium"), this.setElementStyle("verticalAlign", "top"), this.setElementStyle("wordBreak", "break-all"), this.setElementStyle("overflow", "hidden"))
  7538. };
  7539. i.prototype._open = function(t, e, i, n) {};
  7540. i.prototype._setScale = function(i, n) {
  7541. e.prototype._setScale.call(this, i, n);
  7542. var r = t.StageDelegate.getInstance().getScaleX(),
  7543. o = t.StageDelegate.getInstance().getScaleY();
  7544. this.div.scale.x = r * i;
  7545. this.div.scale.y = o * n;
  7546. this.div.transforms()
  7547. };
  7548. i.prototype.changePosition = function(e, i) {
  7549. var n = t.StageDelegate.getInstance().getScaleX(),
  7550. r = t.StageDelegate.getInstance().getScaleY();
  7551. this.div.position.x = e * n;
  7552. this.div.position.y = i * r;
  7553. this.div.transforms()
  7554. };
  7555. i.prototype.setStyles = function() {
  7556. this.setElementStyle("fontStyle", this._italic ? "italic" : "normal");
  7557. this.setElementStyle("fontWeight", this._bold ? "bold" : "normal");
  7558. this.setElementStyle("textAlign", this._textAlign);
  7559. this.setElementStyle("fontSize", this._size + "px");
  7560. this.setElementStyle("color", "#000000");
  7561. this.setElementStyle("width", this._width + "px");
  7562. this.setElementStyle("height", this._height + "px");
  7563. this.setElementStyle("border", "1px solid red");
  7564. this.setElementStyle("display", "block")
  7565. };
  7566. i.prototype._show = function() {
  7567. 0 < this._maxChars ? this.inputElement.setAttribute("maxlength", this._maxChars) : this.inputElement.removeAttribute("maxlength");
  7568. this._isShow = !0;
  7569. var e = this._getText();
  7570. this.inputElement.value = e;
  7571. var i = this;
  7572. this.inputElement.oninput = function() {
  7573. i.textValue = i.inputElement.value;
  7574. i.dispatchEvent(new t.Event("updateText"))
  7575. };
  7576. this.setStyles();
  7577. this.inputElement.focus();
  7578. this.inputElement.selectionStart = e.length;
  7579. this.inputElement.selectionEnd = e.length;
  7580. this._shape && null == this._shape.parent && t.MainContext.instance.stage.addChild(this._shape)
  7581. };
  7582. i.prototype._hide = function() {
  7583. if (null != this.inputElement) {
  7584. this._isShow = !1;
  7585. this.inputElement.oninput = function() {};
  7586. this.setElementStyle("border", "none");
  7587. this.setElementStyle("display", "none");
  7588. this.inputElement.value = "";
  7589. this.setElementStyle("width", "0px");
  7590. window.scrollTo(0, 0);
  7591. var e = this;
  7592. t.setTimeout(function() {
  7593. e.inputElement.blur();
  7594. window.scrollTo(0, 0)
  7595. }, this, 50);
  7596. this._shape && this._shape.parent && this._shape.parent.removeChild(this._shape)
  7597. }
  7598. };
  7599. i.prototype._getText = function() {
  7600. this.textValue || (this.textValue = "");
  7601. return this.textValue
  7602. };
  7603. i.prototype._setText = function(t) {
  7604. this.textValue = t;
  7605. this.resetText()
  7606. };
  7607. i.prototype.resetText = function() {
  7608. this.inputElement && (this.inputElement.value = this.textValue)
  7609. };
  7610. i.prototype._setWidth = function(t) {
  7611. this._width = t
  7612. };
  7613. i.prototype._setHeight = function(t) {
  7614. this._height = t
  7615. };
  7616. i.prototype.setElementStyle = function(t, e) {
  7617. this.inputElement && this._styleInfoes[t] != e && (this.inputElement.style[t] = e, this._styleInfoes[t] = e)
  7618. };
  7619. return i
  7620. }(t.StageText);
  7621. t.HTML5StageText = e;
  7622. e.prototype.__class__ = "egret.HTML5StageText"
  7623. })(egret || (egret = {}));
  7624. egret.StageText.create = function() {
  7625. return new egret.HTML5StageText
  7626. };
  7627. var __extends = this.__extends || function(t, e) {
  7628. function i() {
  7629. this.constructor = t
  7630. }
  7631. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7632. i.prototype = e.prototype;
  7633. t.prototype = new i
  7634. },
  7635. Power = function(t) {
  7636. function e() {
  7637. t.call(this);
  7638. this.texture = RES.getRes("power");
  7639. this.anchorX = .5;
  7640. this.anchorY = .9
  7641. }
  7642. __extends(e, t);
  7643. e.produce = function() {
  7644. null == e.cacheDict.power && (e.cacheDict.power = []);
  7645. var t = e.cacheDict.power;
  7646. return 0 < t.length ? t.shift() : new e
  7647. };
  7648. e.reclaim = function(t) {
  7649. null == e.cacheDict.power && (e.cacheDict.power = []);
  7650. var i = e.cacheDict.power; - 1 == i.indexOf(t) && i.push(t)
  7651. };
  7652. e.cacheDict = {};
  7653. return e
  7654. }(egret.Bitmap);
  7655. Power.prototype.__class__ = "Power";
  7656. var __extends = this.__extends || function(t, e) {
  7657. function i() {
  7658. this.constructor = t
  7659. }
  7660. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7661. i.prototype = e.prototype;
  7662. t.prototype = new i
  7663. },
  7664. Block = function(t) {
  7665. function e(e) {
  7666. t.call(this);
  7667. this.type = e;
  7668. this.power = null;
  7669. this.texture = RES.getRes("block" + this.type)
  7670. }
  7671. __extends(e, t);
  7672. e.prototype.reset = function() {
  7673. this.power = null;
  7674. this.texture = RES.getRes("block" + this.type)
  7675. };
  7676. e.prototype.setPower = function(t) {
  7677. this.power = t
  7678. };
  7679. e.produce = function(t) {
  7680. null == e.cacheDict["block" + t] && (e.cacheDict["block" + t] = []);
  7681. var i = e.cacheDict["block" + t];
  7682. t = 0 < i.length ? i.shift() : new e(t);
  7683. t.reset();
  7684. return t
  7685. };
  7686. e.reclaim = function(t, i) {
  7687. null == e.cacheDict["block" + i] && (e.cacheDict["block" + i] = []);
  7688. var n = e.cacheDict["block" + i]; - 1 == n.indexOf(t) && n.push(t)
  7689. };
  7690. e.cacheDict = {};
  7691. return e
  7692. }(egret.Bitmap);
  7693. Block.prototype.__class__ = "Block";
  7694. var __extends = this.__extends || function(t, e) {
  7695. function i() {
  7696. this.constructor = t
  7697. }
  7698. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7699. i.prototype = e.prototype;
  7700. t.prototype = new i
  7701. },
  7702. Main = function(t) {
  7703. function e() {
  7704. t.call(this);
  7705. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  7706. }
  7707. __extends(e, t);
  7708. e.prototype.onAddToStage = function(t) {
  7709. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  7710. /iPhone/i.test(navigator.userAgent) ? (e.factor = 4 / 3, RES.loadConfig("resource/resource.json", "resource/assets/360/")) : (e.factor = 1, RES.loadConfig("resource/resource.json", "resource/assets/360/"))
  7711. };
  7712. e.prototype.onConfigComplete = function(t) {
  7713. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  7714. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  7715. RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
  7716. RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
  7717. RES.loadGroup("preload")
  7718. };
  7719. e.prototype.onResourceLoadComplete = function(t) {
  7720. "preload" == t.groupName && (RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this), this.createGameScene())
  7721. };
  7722. e.prototype.createGameScene = function() {
  7723. var t = new GameContainer;
  7724. this.addChild(t)
  7725. };
  7726. e.prototype.onResourceLoadError = function(t) {
  7727. console.warn("Group:" + t.groupName + " 中有加载失败的项目");
  7728. this.onResourceLoadComplete(t)
  7729. };
  7730. e.prototype.onResourceProgress = function(t) {
  7731. "preload" == t.groupName
  7732. };
  7733. return e
  7734. }(egret.DisplayObjectContainer);
  7735. Main.prototype.__class__ = "Main";
  7736. var utils;
  7737. (function(t) {
  7738. t.createBitmapByName = function(t) {
  7739. var e = new egret.Bitmap;
  7740. t = RES.getRes(t);
  7741. e.texture = t;
  7742. return e
  7743. };
  7744. t.isOnBlock = function(t, e) {
  7745. var i = e.x - t.x,
  7746. n = e.y - t.y;
  7747. return 0 < i && i < t.width && 0 < n && n < t.height && (i > t.width / 2 && (i = t.width - i), n > t.height / 2 && (n = t.height - n), 7 > (t.width / 2 - i) * Math.tan(.16667 * Math.PI) - n) ? !0 : !1
  7748. };
  7749. t.powerHitTest = function(t, e) {
  7750. var i = Math.abs(e.x - t.x),
  7751. n = Math.abs(e.y - t.y);
  7752. return 2 * i < t.width && 2 * n < t.height ? !0 : !1
  7753. };
  7754. t.storeBestScore = function(t) {
  7755. var e = egret.localStorage.getItem("best_drift");
  7756. e && (e = parseInt(e), t < e && (t = e));
  7757. egret.localStorage.setItem("best_drift", "" + t)
  7758. };
  7759. t.getBestScore = function() {
  7760. var t = egret.localStorage.getItem("best_drift");
  7761. return t ? parseInt(t) : 0
  7762. }
  7763. })(utils || (utils = {}));
  7764. var __extends = this.__extends || function(t, e) {
  7765. function i() {
  7766. this.constructor = t
  7767. }
  7768. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7769. i.prototype = e.prototype;
  7770. t.prototype = new i
  7771. },
  7772. GameOverPanel = function(t) {
  7773. function e() {
  7774. t.call(this);
  7775. this.width = 281 * Main.factor;
  7776. this.height = 309 * Main.factor;
  7777. this.createView()
  7778. }
  7779. __extends(e, t);
  7780. e.prototype.createView = function() {
  7781. var t = new egret.Bitmap(RES.getRes("gameover.bg"));
  7782. t.y = 51 * Main.factor;
  7783. this.addChild(t);
  7784. this.replayBtn = new egret.Bitmap(RES.getRes("gameover.replay"));
  7785. this.replayBtn.x = 16 * Main.factor;
  7786. this.replayBtn.y = 252 * Main.factor;
  7787. this.addChild(this.replayBtn);
  7788. this.replayBtn.touchEnabled = !0;
  7789. this.replayBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this);
  7790. this.replayBtn.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouchEnd, this);
  7791. window.haveShare || window.haveGamelist ? (this.optionalBtn = window.haveShare ? new egret.Bitmap(RES.getRes("gameover.share")) : new egret.Bitmap(RES.getRes("gameover.more")), this.optionalBtn.x = 147 * Main.factor, this.optionalBtn.y = 252 * Main.factor, this.addChild(this.optionalBtn), this.optionalBtn.touchEnabled = !0, this.optionalBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this), this.optionalBtn.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouchEnd, this)) : this.replayBtn.x = (this.width - this.replayBtn.width) / 2;
  7792. this.scoreText = new egret.BitmapText;
  7793. this.scoreText.spriteSheet = RES.getRes("gameOverNumber");
  7794. this.scoreText.anchorX = .5;
  7795. this.scoreText.y = -115 / Main.factor;
  7796. this.scoreText.x = this.width / 2;
  7797. this.addChild(this.scoreText)
  7798. };
  7799. e.prototype.setScore = function(t) {
  7800. this.scoreText.text = "" + t;
  7801. this.score = 0;
  7802. var e = t / 20;
  7803. 10 >= t && (e = t / 10);
  7804. this.scoreTimerHandler(t, e);
  7805. this.setTitle(t)
  7806. };
  7807. e.prototype.setTitle = function(t) {
  7808. t = Math.min(t, 120);
  7809. this.statusLogo = new egret.Bitmap(RES.getRes("gameover.title" + Math.floor(t / 50)));
  7810. this.statusLogo.x = (this.width - this.statusLogo.width) / 2;
  7811. this.statusLogo.y = 130 * Main.factor;
  7812. this.addChild(this.statusLogo)
  7813. };
  7814. e.prototype.scoreTimerHandler = function(t, e) {
  7815. this.score += e;
  7816. this.score >= t ? this.score = t : egret.setTimeout(function() {
  7817. this.scoreTimerHandler(t, e)
  7818. }, this, 50);
  7819. this.scoreText.text = "" + Math.floor(this.score)
  7820. };
  7821. e.prototype.setBestScore = function(t) {
  7822. var e = new egret.TextField;
  7823. e.size = 18 * Main.factor;
  7824. e.textColor = 5592405;
  7825. e.text = "最高 " + t;
  7826. e.anchorX = .5;
  7827. e.x = this.width / 2;
  7828. e.y = 84 * Main.factor;
  7829. e.fontFamily = "Microsoft Yahei";
  7830. this.addChild(e)
  7831. };
  7832. e.prototype.onTouchBegin = function(t) {
  7833. t.target == this.replayBtn ? this.replayBtn.texture = RES.getRes("gameover.replayPress") : t.target == this.optionalBtn && (this.optionalBtn.texture = window.haveShare ? RES.getRes("gameover.sharePress") : RES.getRes("gameover.morePress"))
  7834. };
  7835. e.prototype.onTouchEnd = function(t) {
  7836. t.stopImmediatePropagation();
  7837. t.target == this.replayBtn ? (this.dispatchEventWith("game_restart"), this.replayBtn.texture = RES.getRes("gameover.replay")) : t.target == this.optionalBtn && (window.haveShare ? (this.dispatchEventWith("game_share"), this.optionalBtn.texture = RES.getRes("gameover.share")) : (this.dispatchEventWith("game_get_more"), this.optionalBtn.texture = RES.getRes("gameover.more")))
  7838. };
  7839. return e
  7840. }(egret.DisplayObjectContainer);
  7841. GameOverPanel.prototype.__class__ = "GameOverPanel";
  7842. var __extends = this.__extends || function(t, e) {
  7843. function i() {
  7844. this.constructor = t
  7845. }
  7846. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7847. i.prototype = e.prototype;
  7848. t.prototype = new i
  7849. },
  7850. ScorePanel = function(t) {
  7851. function e() {
  7852. t.call(this);
  7853. var e = utils.createBitmapByName("scorePanel");
  7854. this.width = e.width;
  7855. this.height = e.height;
  7856. this.addChild(e);
  7857. this.scoreText = new egret.TextField;
  7858. this.scoreText.anchorX = this.scoreText.anchorY = .5;
  7859. this.scoreText.size = 34 * Main.factor;
  7860. this.scoreText.textColor = 2553848;
  7861. this.scoreText.x = this.width / 2;
  7862. this.scoreText.y = this.height / 2;
  7863. this.addChild(this.scoreText)
  7864. }
  7865. __extends(e, t);
  7866. e.prototype.setScore = function(t) {
  7867. this.scoreText.text = "" + t
  7868. };
  7869. return e
  7870. }(egret.DisplayObjectContainer);
  7871. ScorePanel.prototype.__class__ = "ScorePanel";
  7872. var __extends = this.__extends || function(t, e) {
  7873. function i() {
  7874. this.constructor = t
  7875. }
  7876. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7877. i.prototype = e.prototype;
  7878. t.prototype = new i
  7879. },
  7880. StartPanel = function(t) {
  7881. function e() {
  7882. t.call(this);
  7883. var e = utils.createBitmapByName("logo");
  7884. this.width = e.width;
  7885. this.addChild(e);
  7886. this.startBtn = utils.createBitmapByName("startBtn");
  7887. this.startBtn.x = (this.width - this.startBtn.width) / 2;
  7888. this.startBtn.y = e.height + 10;
  7889. this.addChild(this.startBtn);
  7890. this.startAnimation()
  7891. }
  7892. __extends(e, t);
  7893. e.prototype.startAnimation = function() {
  7894. egret.Tween.get(this.startBtn).to({
  7895. alpha: .3
  7896. }, 500).to({
  7897. alpha: 1
  7898. }, 500).call(function() {
  7899. this.startAnimation()
  7900. }, this)
  7901. };
  7902. e.prototype.hide = function() {
  7903. egret.Tween.get(this).to({
  7904. y: -400
  7905. }, 350).call(function() {
  7906. this.parent.removeChild(this)
  7907. }, this)
  7908. };
  7909. return e
  7910. }(egret.DisplayObjectContainer);
  7911. StartPanel.prototype.__class__ = "StartPanel";
  7912. var GameConfig = function() {
  7913. function t() {}
  7914. t.DIRECTION_LEFT = 1;
  7915. t.DIRECTION_RIGHT = 0;
  7916. t.MOVING_SPEED = 1.7;
  7917. t.ANGLE_RATE = 1.75;
  7918. t.BLOCK_THICKNESS = 3;
  7919. t.MIN_LEFT_MARGIN = 100;
  7920. t.MIN_RIGHT_MARGIN = 200;
  7921. return t
  7922. }();
  7923. GameConfig.prototype.__class__ = "GameConfig";
  7924. var __extends = this.__extends || function(t, e) {
  7925. function i() {
  7926. this.constructor = t
  7927. }
  7928. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  7929. i.prototype = e.prototype;
  7930. t.prototype = new i
  7931. },
  7932. GameContainer = function(t) {
  7933. function e() {
  7934. t.call(this);
  7935. window.outerStart = this.outerStart;
  7936. window.gameObj = this;
  7937. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
  7938. }
  7939. __extends(e, t);
  7940. e.prototype.onAddToStage = function() {
  7941. this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  7942. this.createGameScene()
  7943. };
  7944. e.prototype.createGameScene = function() {
  7945. this.stageW = this.stage.stageWidth;
  7946. this.stageH = this.stage.stageHeight;
  7947. GameConfig.BLOCK_THICKNESS *= Main.factor;
  7948. GameConfig.MIN_LEFT_MARGIN *= Main.factor;
  7949. GameConfig.MIN_RIGHT_MARGIN *= Main.factor;
  7950. GameConfig.MOVING_SPEED *= Main.factor;
  7951. this.initBeforeStart()
  7952. };
  7953. e.prototype.initBeforeStart = function() {
  7954. var t = utils.createBitmapByName("bg");
  7955. t.width = this.stageW;
  7956. t.height = this.stageH;
  7957. this.addChild(t);
  7958. this.resetData();
  7959. this.onGameStart()
  7960. };
  7961. e.prototype.onGameStart = function() {
  7962. this.initStartComponents()
  7963. };
  7964. e.prototype.initStartComponents = function() {
  7965. this.initBlocks();
  7966. this.ball = utils.createBitmapByName("ball");
  7967. this.ball.anchorX = .5;
  7968. this.ball.anchorY = .8;
  7969. this.ball.x = this.stageW / 2;
  7970. this.ball.y = this.stageH - 100 * Main.factor - this.blocks[0].height / 2 - 10;
  7971. this.addChild(this.ball);
  7972. this.startPanel = new StartPanel;
  7973. this.startPanel.x = (this.stageW - this.startPanel.width) / 2;
  7974. this.startPanel.y = 56 * Main.factor;
  7975. this.addChild(this.startPanel);
  7976. this.touchEnabled = !0;
  7977. this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.startGame, this)
  7978. };
  7979. e.prototype.startGame = function(t) {
  7980. // updateShare(0);
  7981. console.info("start");
  7982. this.startPanel.hide();
  7983. this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.startGame, this);
  7984. this.initScorePanel();
  7985. this.addEventListener(egret.Event.ENTER_FRAME, this.gameViewUpdate, this);
  7986. this.lastTime = egret.getTimer();
  7987. this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.changeDirection, this)
  7988. };
  7989. e.prototype.resetData = function() {
  7990. this.score = 0;
  7991. this.blocks = [];
  7992. this.dropBlocks = [];
  7993. this.powers = [];
  7994. this.currentDirection = 1;
  7995. this.ballSpeed = -GameConfig.MOVING_SPEED * GameConfig.ANGLE_RATE
  7996. };
  7997. e.prototype.initScorePanel = function() {
  7998. this.scorePanel = new ScorePanel;
  7999. this.scorePanel.x = (this.stageW - this.scorePanel.width) / 2;
  8000. this.scorePanel.y = 75 * Main.factor;
  8001. this.addChild(this.scorePanel);
  8002. this.scorePanel.setScore(this.score)
  8003. };
  8004. e.prototype.initBlocks = function() {
  8005. var t, e, i;
  8006. t = new Block(3);
  8007. t.x = (this.stageW - t.width) / 2;
  8008. t.y = this.stageH - t.height - 100 * Main.factor;
  8009. this.addChild(t);
  8010. for (this.blocks.push(t); !(1 == this.blocks.length ? (t = new Block(0), t.x = this.stageW / 2, t.y = this.blocks[0].y - t.height / 2 + GameConfig.BLOCK_THICKNESS) : (e = Math.floor(2 * Math.random()), 1 < this.blocks.length && (i = this.blocks.length - 1, this.blocks[i].x < GameConfig.MIN_LEFT_MARGIN && -1 == this.currentDirection || this.blocks[i].x > this.stageW - GameConfig.MIN_RIGHT_MARGIN && 1 == this.currentDirection) && (e = 0), t = 0 == e ? new Block(2) : new Block(1 == this.currentDirection ? 0 : 1), t.x = this.blocks[i].x + this.currentDirection * t.width / 2, t.y = this.blocks[i].y - t.height / 2 + GameConfig.BLOCK_THICKNESS, 0 == e && (this.currentDirection = -this.currentDirection)), this.addChildAt(t, 1), this.blocks.push(t), .15 > Math.random() && (e = new Power, e.x = t.x + t.width / 2, e.y = t.y + t.height / 2, this.addChildAt(e, this.getChildIndex(t) + 1), this.powers.push(e), t.setPower(e)), t.y <= -t.height - 300 * Main.factor););
  8011. };
  8012. e.prototype.gameViewUpdate = function(t) {
  8013. t = egret.getTimer();
  8014. var e = 1e3 / (t - this.lastTime);
  8015. this.lastTime = t;
  8016. t = 60 / e;
  8017. var i, e = this.blocks.length,
  8018. n = [],
  8019. r;
  8020. this.ball.x += this.ballSpeed * t;
  8021. for (i = 0; i < e; i++) r = this.blocks[i], r.y += GameConfig.MOVING_SPEED * t, r.power && (r.power.y += GameConfig.MOVING_SPEED * t, utils.powerHitTest(r.power, this.ball) && (this.removeChild(r.power), this.powerCollected(r.power.x), Power.reclaim(r.power), this.powers.splice(this.powers.indexOf(r.power), 1), r.power = null)), r.y > this.ball.y + 40 && n.push(r);
  8022. for (i = 0; i < n.length; i++) r = n[i], this.blocks.splice(this.blocks.indexOf(r), 1), this.dropBlocks.push(r);
  8023. n = [];
  8024. e = this.dropBlocks.length;
  8025. for (i = 0; i < e; i++) r = this.dropBlocks[i], r.y += GameConfig.MOVING_SPEED * t * 3, r.power && (r.power.y += GameConfig.MOVING_SPEED * t * 3), r.y > this.stageH + r.height && n.push(r);
  8026. for (i = 0; i < n.length; i++) r = n[i], this.removeChild(r), this.addBlock(), r.power && (this.removeChild(r.power), Power.reclaim(r.power), this.powers.splice(this.powers.indexOf(r.power), 1)), Block.reclaim(r, r.type), this.dropBlocks.splice(this.dropBlocks.indexOf(r), 1);
  8027. this.isOutOfBounds() && this.gameOver()
  8028. };
  8029. e.prototype.addBlock = function() {
  8030. var t, e, i;
  8031. e = Math.floor(2 * Math.random());
  8032. 0 < this.blocks.length && (i = this.blocks.length - 1, this.blocks[i].x < GameConfig.MIN_LEFT_MARGIN && -1 == this.currentDirection || this.blocks[i].x > this.stageW - GameConfig.MIN_RIGHT_MARGIN && 1 == this.currentDirection) && (e = 0);
  8033. t = 0 == e ? Block.produce(2) : Block.produce(1 == this.currentDirection ? 0 : 1);
  8034. t.x = this.blocks[i].x + this.currentDirection * t.width / 2;
  8035. t.y = this.blocks[i].y - t.height / 2 + GameConfig.BLOCK_THICKNESS;
  8036. 0 == e && (this.currentDirection = -this.currentDirection);
  8037. this.addChildAt(t, 1);
  8038. this.blocks.push(t);.15 > Math.random() && (e = Power.produce(), e.x = t.x + t.width / 2, e.y = t.y + t.height / 2, this.addChildAt(e, this.getChildIndex(t) + 1), this.powers.push(e), t.setPower(e))
  8039. };
  8040. e.prototype.changeDirection = function() {
  8041. this.ballSpeed = -this.ballSpeed;
  8042. this.ball.scaleX = -this.ball.scaleX;
  8043. this.score++;
  8044. this.scorePanel.setScore(this.score)
  8045. };
  8046. e.prototype.powerCollected = function(t) {
  8047. var e = utils.createBitmapByName("plus");
  8048. e.x = t - e.width / 2;
  8049. e.y = this.ball.y - this.ball.height;
  8050. this.addChild(e);
  8051. egret.Tween.get(e).to({
  8052. y: this.ball.y - this.ball.height - 70
  8053. }, 450).call(function() {
  8054. this.removeChild(e)
  8055. }, this);
  8056. this.score += 2;
  8057. this.scorePanel.setScore(this.score)
  8058. };
  8059. e.prototype.isOutOfBounds = function() {
  8060. var t, e;
  8061. e = this.blocks.length;
  8062. for (t = 0; t < e; t++)
  8063. if (utils.isOnBlock(this.blocks[t], this.ball)) return !1;
  8064. return !0
  8065. };
  8066. e.prototype.gameRestart = function(t) {
  8067. this.removeChildren();
  8068. this.initBeforeStart();
  8069. console.info("restart")
  8070. };
  8071. e.prototype.gameOver = function() {
  8072. // updateShare(this.score);
  8073. // Play68.setRankingScoreDesc(this.score);
  8074. // Play68.closeRecommend();
  8075. console.info("over");
  8076. this.removeEventListener(egret.Event.ENTER_FRAME, this.gameViewUpdate, this);
  8077. this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.changeDirection, this);
  8078. this.addEventListener(egret.Event.ENTER_FRAME, this.dropBall, this);
  8079. utils.storeBestScore(this.score)
  8080. };
  8081. e.prototype.dropBall = function() {
  8082. var t = egret.getTimer(),
  8083. e = 1e3 / (t - this.lastTime);
  8084. this.lastTime = t;
  8085. t = 60 / e;
  8086. this.ball.x += this.ballSpeed * t;
  8087. this.setChildIndex(this.ball, 1);
  8088. this.ball.y += 10 * t * Main.factor;
  8089. this.ball.y > this.stageH + this.ball.height && (this.removeEventListener(egret.Event.ENTER_FRAME, this.dropBall, this), this.showOverPanel())
  8090. };
  8091. e.prototype.showOverPanel = function() {
  8092. this.removeChild(this.scorePanel);
  8093. this.gameOverPanel = new GameOverPanel;
  8094. this.gameOverPanel.x = (this.stageW - this.gameOverPanel.width) / 2;
  8095. this.gameOverPanel.addEventListener("game_restart", this.gameRestart, this);
  8096. window.haveShare && this.gameOverPanel.addEventListener("game_share", this.shareGame, this);
  8097. window.haveGamelist && this.gameOverPanel.addEventListener("game_get_more", this.getMoreGame, this);
  8098. this.gameOverPanel.y = this.stageH;
  8099. this.gameOverPanel.setScore(this.score);
  8100. this.gameOverPanel.setBestScore(utils.getBestScore());
  8101. this.addChild(this.gameOverPanel);
  8102. egret.Tween.get(this.gameOverPanel).to({
  8103. y: (this.stageH - this.gameOverPanel.height) / 2
  8104. }, 450, egret.Ease.backOut)
  8105. };
  8106. e.prototype.addShadow = function(t, e) {
  8107. this.contains(this.shadow) && (this.removeChild(this.shadow), this.shadow = null);
  8108. this.shadow = new egret.Shape;
  8109. this.shadow.graphics.beginFill(t, e);
  8110. this.shadow.graphics.drawRect(0, 0, this.stageW, this.stageH);
  8111. this.shadow.name = "shadow";
  8112. this.shadow.graphics.endFill();
  8113. this.addChild(this.shadow)
  8114. };
  8115. e.prototype.shareGame = function(t) {
  8116. // play68_submitScore(this.score);
  8117. };
  8118. e.prototype.getMoreGame = function() {
  8119. // Play68.goHome();
  8120. };
  8121. e.prototype.outerStart = function() {
  8122. this.removeChildren();
  8123. this.initBeforeStart()
  8124. };
  8125. return e
  8126. }(egret.DisplayObjectContainer);
  8127. GameContainer.prototype.__class__ = "GameContainer";