123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722 |
- function alk() {
- var e = [];
- var t = [Constants.IMAGE_TITLE_MAIN_MENU_BACK, Constants.IMAGE_GLOBAL_MAP, Constants.IMAGE_BACK];
- var n = [Constants.IMAGE_BUTTON_MORE_GAMES, Constants.IMAGE_SELECT_LEVEL_BACK, Constants.IMAGE_BORDER_SIDE, Constants.IMAGE_BORDER_CORNER, Constants.IMAGE_WIN_STRINGS, Constants.IMAGE_HEART_PARTICLE, Constants.IMAGE_SHINING, Constants.IMAGE_BIG_SHINING, Constants.IMAGE_POINTS_CONTROL_BIG, Constants.IMAGE_POINTS_CONTROL_SMALL, Constants.IMAGE_LEVEL_BUTTON, Constants.IMAGE_BACK, Constants.IMAGE_ROTATE, Constants.IMAGE_TITLE_MAIN_MENU_BACK, "cake_1", "cake_2", "cake_3", "cake_4", "cake_5", "cake_6", "cake_7", "font_0", "font_1", "font_2", "font_3", "font_4", "font_5", "font_6", "font_7", "font_8", "font_9", "sel_0", "sel_1", "sel_2", "sel_3", "sel_4", "sel_5", "sel_6", "sel_7", "sel_8", "sel_9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "p", "boom_1", "boom_2", "boom_3", "boom_4", "boom_5", "boom_6", "boom_7", "boom_8", "boom_9", "boom_10", "boom_11", Constants.IMAGE_CELL, Constants.IMAGE_AWESOME, Constants.IMAGE_SUPERB, Constants.IMAGE_SHINING, Constants.IMAGE_DROP, Constants.IMAGE_DONUT, Constants.IMAGE_ARROW_BONUS_VERT, Constants.IMAGE_ARROW_BONUS_HOR, Constants.IMAGE_BOMB, Constants.IMAGE_MESSAGE_WINDOW, Constants.IMAGE_HINT_ARROW, Constants.IMAGE_BUTTON_PLAY, Constants.IMAGE_BUTTON_SOUND_ON, Constants.IMAGE_BUTTON_SOUND_OFF, Constants.IMAGE_BUTTON_CLOSE, Constants.IMAGE_BUTTON_EXIT, Constants.IMAGE_BUTTON_PAUSE, Constants.IMAGE_BUTTON_RESTART, Constants.IMAGE_GAMEOVER_CAPTION, Constants.IMAGE_SICKLE, Constants.IMAGE_DIRT, Constants.IMAGE_GUI, Constants.IMAGE_LOCK, Constants.IMAGE_OUT_OF_MOVES, Constants.IMAGE_WIN_CAPTION, Constants.IMAGE_STONE_HEART, Constants.IMAGE_TASK_PANEL, Constants.IMAGE_GLOBAL_MAP];
- var r = [SoundManager.SOUND_MUSIC, SoundManager.SOUND_CLICK, SoundManager.SOUND_MATCH_1, SoundManager.SOUND_MATCH_2, SoundManager.SOUND_MATCH_3, SoundManager.SOUND_MATCH_4, SoundManager.SOUND_MATCH_5, SoundManager.SOUND_DROP_1, SoundManager.SOUND_DROP_2, SoundManager.SOUND_DROP_3, SoundManager.SOUND_LINE, SoundManager.SOUND_KILL_COLOR, SoundManager.SOUND_BOOM, SoundManager.SOUND_AWESOME, SoundManager.SOUND_EXCHANGE, SoundManager.SOUND_WIN, SoundManager.SOUND_LOSE];
- for (var i = 0; i < n.length; i++) {
- if (t.indexOf(n[i]) == -1) {
- e.push({
- src: "assets/art/" + n[i] + ".png",
- id: n[i]
- })
- } else {
- e.push({
- src: "assets/art/" + n[i] + ".jpg",
- id: n[i]
- })
- }
- }
- for (var i = 0; i < r.length; i++) {
- e.push({
- src: "assets/sound/" + r[i] + ".ogg",
- id: r[i]
- });
- console.log("Loading " + r[i])
- }
- Constants.g_isPC = !Utils.IsMobileBrowser();
- Constants.W = StateManager.getInnerWidth();
- Constants.H = StateManager.getInnerHeight();
- new StateManager(e)
- }
- var viewporter;
- (function() {
- var e;
- viewporter = {
- forceDetection: false,
- disableLegacyAndroid: true,
- ACTIVE: function() {
- if (viewporter.disableLegacyAndroid && /android 2/i.test(navigator.userAgent)) {
- return false
- }
- if (/ipad/i.test(navigator.userAgent)) {
- return false
- }
- if (/webos/i.test(navigator.userAgent)) {
- return true
- }
- if ("ontouchstart" in window) {
- return true
- }
- return false
- },
- READY: false,
- isLandscape: function() {
- return window.orientation === 90 || window.orientation === -90
- },
- ready: function(e) {
- window.addEventListener("viewportready", e, false)
- },
- change: function(e) {
- window.addEventListener("viewportchange", e, false)
- },
- refresh: function() {
- if (e) {
- e.prepareVisualViewport()
- }
- },
- preventPageScroll: function() {
- document.body.addEventListener("touchmove", function(e) {
- e.preventDefault()
- }, false);
- document.body.addEventListener("touchstart", function() {
- e.prepareVisualViewport()
- }, false)
- }
- };
- viewporter.ACTIVE = viewporter.ACTIVE();
- if (!viewporter.ACTIVE) {
- return
- }
- var t = function() {
- var e = this;
- this.IS_ANDROID = /Android/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
- var t = function() {
- e.prepareVisualViewport();
- var t = window.orientation;
- window.addEventListener("orientationchange", function() {
- if (window.orientation !== t) {
- e.prepareVisualViewport();
- t = window.orientation
- }
- }, false)
- };
- if (document.readyState === "loading") {
- document.addEventListener("DOMContentLoaded", function() {
- t()
- }, false)
- } else {
- t()
- }
- };
- t.prototype = {
- getProfile: function() {
- if (viewporter.forceDetection) {
- return null
- }
- for (var e in viewporter.profiles) {
- if ((new RegExp(e)).test(navigator.userAgent)) {
- return viewporter.profiles[e]
- }
- }
- return null
- },
- postProcess: function() {
- viewporter.READY = true;
- this.triggerWindowEvent(!this._firstUpdateExecuted ? "viewportready" : "viewportchange");
- this._firstUpdateExecuted = true
- },
- prepareVisualViewport: function() {
- var e = this;
- if (navigator.standalone) {
- return this.postProcess()
- }
- document.documentElement.style.minHeight = "5000px";
- var t = window.innerHeight;
- var n = this.getProfile();
- var r = viewporter.isLandscape() ? "landscape" : "portrait";
- window.scrollTo(0, e.IS_ANDROID ? 1 : 0);
- var i = 40;
- var s = window.setInterval(function() {
- function o() {
- return n ? window.innerHeight === n[r] : false
- }
- function u() {
- return window.innerHeight > t
- }
- window.scrollTo(0, e.IS_ANDROID ? 1 : 0);
- i--;
- if ((e.IS_ANDROID ? o() : u()) || i < 0) {
- document.documentElement.style.minHeight = window.innerHeight + "px";
- document.getElementById("viewporter").style.position = "relative";
- document.getElementById("viewporter").style.height = window.innerHeight + "px";
- clearInterval(s);
- e.postProcess()
- }
- }, 10)
- },
- triggerWindowEvent: function(e) {
- var t = document.createEvent("Event");
- t.initEvent(e, false, false);
- window.dispatchEvent(t)
- }
- };
- e = new t
- })();
- viewporter.profiles = {
- MZ601: {
- portrait: 696,
- landscape: 1176
- },
- "GT-I9000|GT-I9100|Nexus S": {
- portrait: 508,
- landscape: 295
- },
- "GT-P1000": {
- portrait: 657,
- landscape: 400
- },
- "Desire_A8181|DesireHD_A9191": {
- portrait: 533,
- landscape: 320
- }
- };
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- };
- var t = e.prototype;
- t.type = null;
- t.target = null;
- t.currentTarget = null;
- t.eventPhase = 0;
- t.bubbles = false;
- t.cancelable = false;
- t.timeStamp = 0;
- t.defaultPrevented = false;
- t.propagationStopped = false;
- t.immediatePropagationStopped = false;
- t.removed = false;
- t.initialize = function(e, t, n) {
- this.type = e;
- this.bubbles = t;
- this.cancelable = n;
- this.timeStamp = (new Date).getTime()
- };
- t.preventDefault = function() {
- this.defaultPrevented = true
- };
- t.stopPropagation = function() {
- this.propagationStopped = true
- };
- t.stopImmediatePropagation = function() {
- this.immediatePropagationStopped = this.propagationStopped = true
- };
- t.remove = function() {
- this.removed = true
- };
- t.clone = function() {
- return new e(this.type, this.bubbles, this.cancelable)
- };
- t.toString = function() {
- return "[Event (type=" + this.type + ")]"
- };
- createjs.Event = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {};
- var t = e.prototype;
- e.initialize = function(e) {
- e.addEventListener = t.addEventListener;
- e.on = t.on;
- e.removeEventListener = e.off = t.removeEventListener;
- e.removeAllEventListeners = t.removeAllEventListeners;
- e.hasEventListener = t.hasEventListener;
- e.dispatchEvent = t.dispatchEvent;
- e._dispatchEvent = t._dispatchEvent;
- e.willTrigger = t.willTrigger
- };
- t._listeners = null;
- t._captureListeners = null;
- t.initialize = function() {};
- t.addEventListener = function(e, t, n) {
- var r;
- if (n) {
- r = this._captureListeners = this._captureListeners || {}
- } else {
- r = this._listeners = this._listeners || {}
- }
- var i = r[e];
- if (i) {
- this.removeEventListener(e, t, n)
- }
- i = r[e];
- if (!i) {
- r[e] = [t]
- } else {
- i.push(t)
- }
- return t
- };
- t.on = function(e, t, n, r, i, s) {
- if (t.handleEvent) {
- n = n || t;
- t = t.handleEvent
- }
- n = n || this;
- return this.addEventListener(e, function(e) {
- t.call(n, e, i);
- r && e.remove()
- }, s)
- };
- t.removeEventListener = function(e, t, n) {
- var r = n ? this._captureListeners : this._listeners;
- if (!r) {
- return
- }
- var i = r[e];
- if (!i) {
- return
- }
- for (var s = 0, o = i.length; s < o; s++) {
- if (i[s] == t) {
- if (o == 1) {
- delete r[e]
- } else {
- i.splice(s, 1)
- }
- break
- }
- }
- };
- t.off = t.removeEventListener;
- t.removeAllEventListeners = function(e) {
- if (!e) {
- this._listeners = this._captureListeners = null
- } else {
- if (this._listeners) {
- delete this._listeners[e]
- }
- if (this._captureListeners) {
- delete this._captureListeners[e]
- }
- }
- };
- t.dispatchEvent = function(e, t) {
- if (typeof e == "string") {
- var n = this._listeners;
- if (!n || !n[e]) {
- return false
- }
- e = new createjs.Event(e)
- }
- try {
- e.target = t || this
- } catch (r) {}
- if (!e.bubbles || !this.parent) {
- this._dispatchEvent(e, 2)
- } else {
- var i = this,
- s = [i];
- while (i.parent) {
- s.push(i = i.parent)
- }
- var o, u = s.length;
- for (o = u - 1; o >= 0 && !e.propagationStopped; o--) {
- s[o]._dispatchEvent(e, 1 + (o == 0))
- }
- for (o = 1; o < u && !e.propagationStopped; o++) {
- s[o]._dispatchEvent(e, 3)
- }
- }
- return e.defaultPrevented
- };
- t.hasEventListener = function(e) {
- var t = this._listeners,
- n = this._captureListeners;
- return !!(t && t[e] || n && n[e])
- };
- t.willTrigger = function(e) {
- var t = this;
- while (t) {
- if (t.hasEventListener(e)) {
- return true
- }
- t = t.parent
- }
- return false
- };
- t.toString = function() {
- return "[EventDispatcher]"
- };
- t._dispatchEvent = function(e, t) {
- var n, r = t == 1 ? this._captureListeners : this._listeners;
- if (e && r) {
- var i = r[e.type];
- if (!i || !(n = i.length)) {
- return
- }
- try {
- e.currentTarget = this
- } catch (s) {}
- try {
- e.eventPhase = t
- } catch (s) {}
- e.removed = false;
- i = i.slice();
- for (var o = 0; o < n && !e.immediatePropagationStopped; o++) {
- var u = i[o];
- if (u.handleEvent) {
- u.handleEvent(e)
- } else {
- u(e)
- } if (e.removed) {
- this.off(e.type, u, t == 1);
- e.removed = false
- }
- }
- }
- };
- createjs.EventDispatcher = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- createjs.indexOf = function(e, t) {
- for (var n = 0, r = e.length; n < r; n++) {
- if (t === e[n]) {
- return n
- }
- }
- return -1
- }
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- throw "UID cannot be instantiated"
- };
- e._nextID = 0;
- e.get = function() {
- return e._nextID++
- };
- createjs.UID = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- throw "Ticker cannot be instantiated."
- };
- e.RAF_SYNCHED = "synched";
- e.RAF = "raf";
- e.TIMEOUT = "timeout";
- e.useRAF = false;
- e.timingMode = null;
- e.maxDelta = 0;
- e.removeEventListener = null;
- e.removeAllEventListeners = null;
- e.dispatchEvent = null;
- e.hasEventListener = null;
- e._listeners = null;
- createjs.EventDispatcher.initialize(e);
- e._addEventListener = e.addEventListener;
- e.addEventListener = function() {
- !e._inited && e.init();
- return e._addEventListener.apply(e, arguments)
- };
- e._paused = false;
- e._inited = false;
- e._startTime = 0;
- e._pausedTime = 0;
- e._ticks = 0;
- e._pausedTicks = 0;
- e._interval = 50;
- e._lastTime = 0;
- e._times = null;
- e._tickTimes = null;
- e._timerId = null;
- e._raf = true;
- e.init = function() {
- if (e._inited) {
- return
- }
- e._inited = true;
- e._times = [];
- e._tickTimes = [];
- e._startTime = e._getTime();
- e._times.push(e._lastTime = 0);
- e.setInterval(e._interval)
- };
- e.reset = function() {
- if (e._raf) {
- var t = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame;
- t && t(e._timerId)
- } else {
- clearTimeout(e._timerId)
- }
- e.removeAllEventListeners("tick")
- };
- e.setInterval = function(t) {
- e._interval = t;
- if (!e._inited) {
- return
- }
- e._setupTick()
- };
- e.getInterval = function() {
- return e._interval
- };
- e.setFPS = function(t) {
- e.setInterval(1e3 / t)
- };
- e.getFPS = function() {
- return 1e3 / e._interval
- };
- e.getMeasuredTickTime = function(t) {
- var n = 0,
- r = e._tickTimes;
- if (r.length < 1) {
- return -1
- }
- t = Math.min(r.length, t || e.getFPS() | 0);
- for (var i = 0; i < t; i++) {
- n += r[i]
- }
- return n / t
- };
- e.getMeasuredFPS = function(t) {
- var n = e._times;
- if (n.length < 2) {
- return -1
- }
- t = Math.min(n.length - 1, t || e.getFPS() | 0);
- return 1e3 / ((n[0] - n[t]) / t)
- };
- e.setPaused = function(t) {
- e._paused = t
- };
- e.getPaused = function() {
- return e._paused
- };
- e.getTime = function(t) {
- return e._getTime() - e._startTime - (t ? e._pausedTime : 0)
- };
- e.getEventTime = function(t) {
- return (e._lastTime || e._startTime) - (t ? e._pausedTime : 0)
- };
- e.getTicks = function(t) {
- return e._ticks - (t ? e._pausedTicks : 0)
- };
- e._handleSynch = function() {
- var t = e._getTime() - e._startTime;
- e._timerId = null;
- e._setupTick();
- if (t - e._lastTime >= (e._interval - 1) * .97) {
- e._tick()
- }
- };
- e._handleRAF = function() {
- e._timerId = null;
- e._setupTick();
- e._tick()
- };
- e._handleTimeout = function() {
- e._timerId = null;
- e._setupTick();
- e._tick()
- };
- e._setupTick = function() {
- if (e._timerId != null) {
- return
- }
- var t = e.timingMode || e.useRAF && e.RAF_SYNCHED;
- if (t == e.RAF_SYNCHED || t == e.RAF) {
- var n = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame;
- if (n) {
- e._timerId = n(t == e.RAF ? e._handleRAF : e._handleSynch);
- e._raf = true;
- return
- }
- }
- e._raf = false;
- e._timerId = setTimeout(e._handleTimeout, e._interval)
- };
- e._tick = function() {
- var t = e._getTime() - e._startTime;
- var n = t - e._lastTime;
- var r = e._paused;
- e._ticks++;
- if (r) {
- e._pausedTicks++;
- e._pausedTime += n
- }
- e._lastTime = t;
- if (e.hasEventListener("tick")) {
- var i = new createjs.Event("tick");
- var s = e.maxDelta;
- i.delta = s && n > s ? s : n;
- i.paused = r;
- i.time = t;
- i.runTime = t - e._pausedTime;
- e.dispatchEvent(i)
- }
- e._tickTimes.unshift(e._getTime() - t);
- while (e._tickTimes.length > 100) {
- e._tickTimes.pop()
- }
- e._times.unshift(t);
- while (e._times.length > 100) {
- e._times.pop()
- }
- };
- var t = window.performance && (performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow);
- e._getTime = function() {
- return t && t.call(performance) || (new Date).getTime()
- };
- createjs.Ticker = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n, r, i, s) {
- this.initialize(e, t, n, r, i, s)
- };
- var t = e.prototype;
- e.identity = null;
- e.DEG_TO_RAD = Math.PI / 180;
- t.a = 1;
- t.b = 0;
- t.c = 0;
- t.d = 1;
- t.tx = 0;
- t.ty = 0;
- t.alpha = 1;
- t.shadow = null;
- t.compositeOperation = null;
- t.visible = true;
- t.initialize = function(e, t, n, r, i, s) {
- this.a = e == null ? 1 : e;
- this.b = t || 0;
- this.c = n || 0;
- this.d = r == null ? 1 : r;
- this.tx = i || 0;
- this.ty = s || 0;
- return this
- };
- t.prepend = function(e, t, n, r, i, s) {
- var o = this.tx;
- if (e != 1 || t != 0 || n != 0 || r != 1) {
- var u = this.a;
- var a = this.c;
- this.a = u * e + this.b * n;
- this.b = u * t + this.b * r;
- this.c = a * e + this.d * n;
- this.d = a * t + this.d * r
- }
- this.tx = o * e + this.ty * n + i;
- this.ty = o * t + this.ty * r + s;
- return this
- };
- t.append = function(e, t, n, r, i, s) {
- var o = this.a;
- var u = this.b;
- var a = this.c;
- var f = this.d;
- this.a = e * o + t * a;
- this.b = e * u + t * f;
- this.c = n * o + r * a;
- this.d = n * u + r * f;
- this.tx = i * o + s * a + this.tx;
- this.ty = i * u + s * f + this.ty;
- return this
- };
- t.prependMatrix = function(e) {
- this.prepend(e.a, e.b, e.c, e.d, e.tx, e.ty);
- this.prependProperties(e.alpha, e.shadow, e.compositeOperation, e.visible);
- return this
- };
- t.appendMatrix = function(e) {
- this.append(e.a, e.b, e.c, e.d, e.tx, e.ty);
- this.appendProperties(e.alpha, e.shadow, e.compositeOperation, e.visible);
- return this
- };
- t.prependTransform = function(t, n, r, i, s, o, u, a, f) {
- if (s % 360) {
- var l = s * e.DEG_TO_RAD;
- var c = Math.cos(l);
- var h = Math.sin(l)
- } else {
- c = 1;
- h = 0
- } if (a || f) {
- this.tx -= a;
- this.ty -= f
- }
- if (o || u) {
- o *= e.DEG_TO_RAD;
- u *= e.DEG_TO_RAD;
- this.prepend(c * r, h * r, -h * i, c * i, 0, 0);
- this.prepend(Math.cos(u), Math.sin(u), -Math.sin(o), Math.cos(o), t, n)
- } else {
- this.prepend(c * r, h * r, -h * i, c * i, t, n)
- }
- return this
- };
- t.appendTransform = function(t, n, r, i, s, o, u, a, f) {
- if (s % 360) {
- var l = s * e.DEG_TO_RAD;
- var c = Math.cos(l);
- var h = Math.sin(l)
- } else {
- c = 1;
- h = 0
- } if (o || u) {
- o *= e.DEG_TO_RAD;
- u *= e.DEG_TO_RAD;
- this.append(Math.cos(u), Math.sin(u), -Math.sin(o), Math.cos(o), t, n);
- this.append(c * r, h * r, -h * i, c * i, 0, 0)
- } else {
- this.append(c * r, h * r, -h * i, c * i, t, n)
- } if (a || f) {
- this.tx -= a * this.a + f * this.c;
- this.ty -= a * this.b + f * this.d
- }
- return this
- };
- t.rotate = function(e) {
- var t = Math.cos(e);
- var n = Math.sin(e);
- var r = this.a;
- var i = this.c;
- var s = this.tx;
- this.a = r * t - this.b * n;
- this.b = r * n + this.b * t;
- this.c = i * t - this.d * n;
- this.d = i * n + this.d * t;
- this.tx = s * t - this.ty * n;
- this.ty = s * n + this.ty * t;
- return this
- };
- t.skew = function(t, n) {
- t = t * e.DEG_TO_RAD;
- n = n * e.DEG_TO_RAD;
- this.append(Math.cos(n), Math.sin(n), -Math.sin(t), Math.cos(t), 0, 0);
- return this
- };
- t.scale = function(e, t) {
- this.a *= e;
- this.d *= t;
- this.c *= e;
- this.b *= t;
- this.tx *= e;
- this.ty *= t;
- return this
- };
- t.translate = function(e, t) {
- this.tx += e;
- this.ty += t;
- return this
- };
- t.identity = function() {
- this.alpha = this.a = this.d = 1;
- this.b = this.c = this.tx = this.ty = 0;
- this.shadow = this.compositeOperation = null;
- this.visible = true;
- return this
- };
- t.invert = function() {
- var e = this.a;
- var t = this.b;
- var n = this.c;
- var r = this.d;
- var i = this.tx;
- var s = e * r - t * n;
- this.a = r / s;
- this.b = -t / s;
- this.c = -n / s;
- this.d = e / s;
- this.tx = (n * this.ty - r * i) / s;
- this.ty = -(e * this.ty - t * i) / s;
- return this
- };
- t.isIdentity = function() {
- return this.tx == 0 && this.ty == 0 && this.a == 1 && this.b == 0 && this.c == 0 && this.d == 1
- };
- t.transformPoint = function(e, t, n) {
- n = n || {};
- n.x = e * this.a + t * this.c + this.tx;
- n.y = e * this.b + t * this.d + this.ty;
- return n
- };
- t.decompose = function(t) {
- if (t == null) {
- t = {}
- }
- t.x = this.tx;
- t.y = this.ty;
- t.scaleX = Math.sqrt(this.a * this.a + this.b * this.b);
- t.scaleY = Math.sqrt(this.c * this.c + this.d * this.d);
- var n = Math.atan2(-this.c, this.d);
- var r = Math.atan2(this.b, this.a);
- if (n == r) {
- t.rotation = r / e.DEG_TO_RAD;
- if (this.a < 0 && this.d >= 0) {
- t.rotation += t.rotation <= 0 ? 180 : -180
- }
- t.skewX = t.skewY = 0
- } else {
- t.skewX = n / e.DEG_TO_RAD;
- t.skewY = r / e.DEG_TO_RAD
- }
- return t
- };
- t.reinitialize = function(e, t, n, r, i, s, o, u, a, f) {
- this.initialize(e, t, n, r, i, s);
- this.alpha = o == null ? 1 : o;
- this.shadow = u;
- this.compositeOperation = a;
- this.visible = f == null ? true : f;
- return this
- };
- t.copy = function(e) {
- return this.reinitialize(e.a, e.b, e.c, e.d, e.tx, e.ty, e.alpha, e.shadow, e.compositeOperation, e.visible)
- };
- t.appendProperties = function(e, t, n, r) {
- this.alpha *= e;
- this.shadow = t || this.shadow;
- this.compositeOperation = n || this.compositeOperation;
- this.visible = this.visible && r;
- return this
- };
- t.prependProperties = function(e, t, n, r) {
- this.alpha *= e;
- this.shadow = this.shadow || t;
- this.compositeOperation = this.compositeOperation || n;
- this.visible = this.visible && r;
- return this
- };
- t.clone = function() {
- return (new e).copy(this)
- };
- t.toString = function() {
- return "[Matrix2D (a=" + this.a + " b=" + this.b + " c=" + this.c + " d=" + this.d + " tx=" + this.tx + " ty=" + this.ty + ")]"
- };
- e.identity = new e;
- createjs.Matrix2D = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t) {
- this.initialize(e, t)
- };
- var t = e.prototype;
- t.x = 0;
- t.y = 0;
- t.initialize = function(e, t) {
- this.x = e == null ? 0 : e;
- this.y = t == null ? 0 : t;
- return this
- };
- t.copy = function(e) {
- return this.initialize(e.x, e.y)
- };
- t.clone = function() {
- return new e(this.x, this.y)
- };
- t.toString = function() {
- return "[Point (x=" + this.x + " y=" + this.y + ")]"
- };
- createjs.Point = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n, r) {
- this.initialize(e, t, n, r)
- };
- var t = e.prototype;
- t.x = 0;
- t.y = 0;
- t.width = 0;
- t.height = 0;
- t.initialize = function(e, t, n, r) {
- this.x = e || 0;
- this.y = t || 0;
- this.width = n || 0;
- this.height = r || 0;
- return this
- };
- t.copy = function(e) {
- return this.initialize(e.x, e.y, e.width, e.height)
- };
- t.clone = function() {
- return new e(this.x, this.y, this.width, this.height)
- };
- t.toString = function() {
- return "[Rectangle (x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + ")]"
- };
- createjs.Rectangle = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n, r) {
- this.initialize(e, t, n, r)
- };
- var t = e.prototype;
- e.identity = null;
- t.color = null;
- t.offsetX = 0;
- t.offsetY = 0;
- t.blur = 0;
- t.initialize = function(e, t, n, r) {
- this.color = e;
- this.offsetX = t;
- this.offsetY = n;
- this.blur = r
- };
- t.toString = function() {
- return "[Shadow]"
- };
- t.clone = function() {
- return new e(this.color, this.offsetX, this.offsetY, this.blur)
- };
- e.identity = new e("transparent", 0, 0, 0);
- createjs.Shadow = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e) {
- this.initialize(e)
- };
- var t = e.prototype = new createjs.EventDispatcher;
- t.complete = true;
- t.framerate = 0;
- t._animations = null;
- t._frames = null;
- t._images = null;
- t._data = null;
- t._loadCount = 0;
- t._frameHeight = 0;
- t._frameWidth = 0;
- t._numFrames = 0;
- t._regX = 0;
- t._regY = 0;
- t.initialize = function(e) {
- var t, n, r, i;
- if (e == null) {
- return
- }
- this.framerate = e.framerate || 0;
- if (e.images && (n = e.images.length) > 0) {
- i = this._images = [];
- for (t = 0; t < n; t++) {
- var s = e.images[t];
- if (typeof s == "string") {
- var o = s;
- s = document.createElement("img");
- s.src = o
- }
- i.push(s);
- if (!s.getContext && !s.complete) {
- this._loadCount++;
- this.complete = false;
- (function(e) {
- s.onload = function() {
- e._handleImageLoad()
- }
- })(this)
- }
- }
- }
- if (e.frames == null) {} else if (e.frames instanceof Array) {
- this._frames = [];
- i = e.frames;
- for (t = 0, n = i.length; t < n; t++) {
- var u = i[t];
- this._frames.push({
- image: this._images[u[4] ? u[4] : 0],
- rect: new createjs.Rectangle(u[0], u[1], u[2], u[3]),
- regX: u[5] || 0,
- regY: u[6] || 0
- })
- }
- } else {
- r = e.frames;
- this._frameWidth = r.width;
- this._frameHeight = r.height;
- this._regX = r.regX || 0;
- this._regY = r.regY || 0;
- this._numFrames = r.count;
- if (this._loadCount == 0) {
- this._calculateFrames()
- }
- }
- this._animations = [];
- if ((r = e.animations) != null) {
- this._data = {};
- var a;
- for (a in r) {
- var f = {
- name: a
- };
- var l = r[a];
- if (typeof l == "number") {
- i = f.frames = [l]
- } else if (l instanceof Array) {
- if (l.length == 1) {
- f.frames = [l[0]]
- } else {
- f.speed = l[3];
- f.next = l[2];
- i = f.frames = [];
- for (t = l[0]; t <= l[1]; t++) {
- i.push(t)
- }
- }
- } else {
- f.speed = l.speed;
- f.next = l.next;
- var c = l.frames;
- i = f.frames = typeof c == "number" ? [c] : c.slice(0)
- } if (f.next === true || f.next === undefined) {
- f.next = a
- }
- if (f.next === false || i.length < 2 && f.next == a) {
- f.next = null
- }
- if (!f.speed) {
- f.speed = 1
- }
- this._animations.push(a);
- this._data[a] = f
- }
- }
- };
- t.getNumFrames = function(e) {
- if (e == null) {
- return this._frames ? this._frames.length : this._numFrames
- } else {
- var t = this._data[e];
- if (t == null) {
- return 0
- } else {
- return t.frames.length
- }
- }
- };
- t.getAnimations = function() {
- return this._animations.slice(0)
- };
- t.getAnimation = function(e) {
- return this._data[e]
- };
- t.getFrame = function(e) {
- var t;
- if (this._frames && (t = this._frames[e])) {
- return t
- }
- return null
- };
- t.getFrameBounds = function(e, t) {
- var n = this.getFrame(e);
- return n ? (t || new createjs.Rectangle).initialize(-n.regX, -n.regY, n.rect.width, n.rect.height) : null
- };
- t.toString = function() {
- return "[SpriteSheet]"
- };
- t.clone = function() {
- var t = new e;
- t.complete = this.complete;
- t._animations = this._animations;
- t._frames = this._frames;
- t._images = this._images;
- t._data = this._data;
- t._frameHeight = this._frameHeight;
- t._frameWidth = this._frameWidth;
- t._numFrames = this._numFrames;
- t._loadCount = this._loadCount;
- return t
- };
- t._handleImageLoad = function() {
- if (--this._loadCount == 0) {
- this._calculateFrames();
- this.complete = true;
- this.dispatchEvent("complete")
- }
- };
- t._calculateFrames = function() {
- if (this._frames || this._frameWidth == 0) {
- return
- }
- this._frames = [];
- var e = 0;
- var t = this._frameWidth;
- var n = this._frameHeight;
- for (var r = 0, i = this._images; r < i.length; r++) {
- var s = i[r];
- var o = s.width / t | 0;
- var u = s.height / n | 0;
- var a = this._numFrames > 0 ? Math.min(this._numFrames - e, o * u) : o * u;
- for (var f = 0; f < a; f++) {
- this._frames.push({
- image: s,
- rect: new createjs.Rectangle(f % o * t, (f / o | 0) * n, t, n),
- regX: this._regX,
- regY: this._regY
- })
- }
- e += a
- }
- this._numFrames = e
- };
- createjs.SpriteSheet = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- function e(e, t, n) {
- this.f = e;
- this.params = t;
- this.path = n == null ? true : n
- }
- e.prototype.exec = function(e) {
- this.f.apply(e, this.params)
- };
- var t = function() {
- this.initialize()
- };
- var n = t.prototype;
- t.getRGB = function(e, t, n, r) {
- if (e != null && n == null) {
- r = t;
- n = e & 255;
- t = e >> 8 & 255;
- e = e >> 16 & 255
- }
- if (r == null) {
- return "rgb(" + e + "," + t + "," + n + ")"
- } else {
- return "rgba(" + e + "," + t + "," + n + "," + r + ")"
- }
- };
- t.getHSL = function(e, t, n, r) {
- if (r == null) {
- return "hsl(" + e % 360 + "," + t + "%," + n + "%)"
- } else {
- return "hsla(" + e % 360 + "," + t + "%," + n + "%," + r + ")"
- }
- };
- t.Command = e;
- t.BASE_64 = {
- A: 0,
- B: 1,
- C: 2,
- D: 3,
- E: 4,
- F: 5,
- G: 6,
- H: 7,
- I: 8,
- J: 9,
- K: 10,
- L: 11,
- M: 12,
- N: 13,
- O: 14,
- P: 15,
- Q: 16,
- R: 17,
- S: 18,
- T: 19,
- U: 20,
- V: 21,
- W: 22,
- X: 23,
- Y: 24,
- Z: 25,
- a: 26,
- b: 27,
- c: 28,
- d: 29,
- e: 30,
- f: 31,
- g: 32,
- h: 33,
- i: 34,
- j: 35,
- k: 36,
- l: 37,
- m: 38,
- n: 39,
- o: 40,
- p: 41,
- q: 42,
- r: 43,
- s: 44,
- t: 45,
- u: 46,
- v: 47,
- w: 48,
- x: 49,
- y: 50,
- z: 51,
- 0: 52,
- 1: 53,
- 2: 54,
- 3: 55,
- 4: 56,
- 5: 57,
- 6: 58,
- 7: 59,
- 8: 60,
- 9: 61,
- "+": 62,
- "/": 63
- };
- t.STROKE_CAPS_MAP = ["butt", "round", "square"];
- t.STROKE_JOINTS_MAP = ["miter", "round", "bevel"];
- var r = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas");
- if (r.getContext) {
- var i = t._ctx = r.getContext("2d");
- t.beginCmd = new e(i.beginPath, [], false);
- t.fillCmd = new e(i.fill, [], false);
- t.strokeCmd = new e(i.stroke, [], false);
- r.width = r.height = 1
- }
- n._strokeInstructions = null;
- n._strokeStyleInstructions = null;
- n._strokeIgnoreScale = false;
- n._fillInstructions = null;
- n._fillMatrix = null;
- n._instructions = null;
- n._oldInstructions = null;
- n._activeInstructions = null;
- n._active = false;
- n._dirty = false;
- n.initialize = function() {
- this.clear();
- this._ctx = t._ctx
- };
- n.isEmpty = function() {
- return !(this._instructions.length || this._oldInstructions.length || this._activeInstructions.length)
- };
- n.draw = function(e) {
- if (this._dirty) {
- this._updateInstructions()
- }
- var t = this._instructions;
- for (var n = 0, r = t.length; n < r; n++) {
- t[n].exec(e)
- }
- };
- n.drawAsPath = function(e) {
- if (this._dirty) {
- this._updateInstructions()
- }
- var t, n = this._instructions;
- for (var r = 0, i = n.length; r < i; r++) {
- if ((t = n[r]).path || r == 0) {
- t.exec(e)
- }
- }
- };
- n.moveTo = function(t, n) {
- this._activeInstructions.push(new e(this._ctx.moveTo, [t, n]));
- return this
- };
- n.lineTo = function(t, n) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(this._ctx.lineTo, [t, n]));
- return this
- };
- n.arcTo = function(t, n, r, i, s) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(this._ctx.arcTo, [t, n, r, i, s]));
- return this
- };
- n.arc = function(t, n, r, i, s, o) {
- this._dirty = this._active = true;
- if (o == null) {
- o = false
- }
- this._activeInstructions.push(new e(this._ctx.arc, [t, n, r, i, s, o]));
- return this
- };
- n.quadraticCurveTo = function(t, n, r, i) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(this._ctx.quadraticCurveTo, [t, n, r, i]));
- return this
- };
- n.bezierCurveTo = function(t, n, r, i, s, o) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(this._ctx.bezierCurveTo, [t, n, r, i, s, o]));
- return this
- };
- n.rect = function(t, n, r, i) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(this._ctx.rect, [t, n, r, i]));
- return this
- };
- n.closePath = function() {
- if (this._active) {
- this._dirty = true;
- this._activeInstructions.push(new e(this._ctx.closePath, []))
- }
- return this
- };
- n.clear = function() {
- this._instructions = [];
- this._oldInstructions = [];
- this._activeInstructions = [];
- this._strokeStyleInstructions = this._strokeInstructions = this._fillInstructions = this._fillMatrix = null;
- this._active = this._dirty = this._strokeIgnoreScale = false;
- return this
- };
- n.beginFill = function(t) {
- if (this._active) {
- this._newPath()
- }
- this._fillInstructions = t ? [new e(this._setProp, ["fillStyle", t], false)] : null;
- this._fillMatrix = null;
- return this
- };
- n.beginLinearGradientFill = function(t, n, r, i, s, o) {
- if (this._active) {
- this._newPath()
- }
- var u = this._ctx.createLinearGradient(r, i, s, o);
- for (var a = 0, f = t.length; a < f; a++) {
- u.addColorStop(n[a], t[a])
- }
- this._fillInstructions = [new e(this._setProp, ["fillStyle", u], false)];
- this._fillMatrix = null;
- return this
- };
- n.beginRadialGradientFill = function(t, n, r, i, s, o, u, a) {
- if (this._active) {
- this._newPath()
- }
- var f = this._ctx.createRadialGradient(r, i, s, o, u, a);
- for (var l = 0, c = t.length; l < c; l++) {
- f.addColorStop(n[l], t[l])
- }
- this._fillInstructions = [new e(this._setProp, ["fillStyle", f], false)];
- this._fillMatrix = null;
- return this
- };
- n.beginBitmapFill = function(t, n, r) {
- if (this._active) {
- this._newPath()
- }
- n = n || "";
- var i = this._ctx.createPattern(t, n);
- this._fillInstructions = [new e(this._setProp, ["fillStyle", i], false)];
- this._fillMatrix = r ? [r.a, r.b, r.c, r.d, r.tx, r.ty] : null;
- return this
- };
- n.endFill = function() {
- return this.beginFill()
- };
- n.setStrokeStyle = function(n, r, i, s, o) {
- if (this._active) {
- this._newPath()
- }
- this._strokeStyleInstructions = [new e(this._setProp, ["lineWidth", n == null ? "1" : n], false), new e(this._setProp, ["lineCap", r == null ? "butt" : isNaN(r) ? r : t.STROKE_CAPS_MAP[r]], false), new e(this._setProp, ["lineJoin", i == null ? "miter" : isNaN(i) ? i : t.STROKE_JOINTS_MAP[i]], false), new e(this._setProp, ["miterLimit", s == null ? "10" : s], false)];
- this._strokeIgnoreScale = o;
- return this
- };
- n.beginStroke = function(t) {
- if (this._active) {
- this._newPath()
- }
- this._strokeInstructions = t ? [new e(this._setProp, ["strokeStyle", t], false)] : null;
- return this
- };
- n.beginLinearGradientStroke = function(t, n, r, i, s, o) {
- if (this._active) {
- this._newPath()
- }
- var u = this._ctx.createLinearGradient(r, i, s, o);
- for (var a = 0, f = t.length; a < f; a++) {
- u.addColorStop(n[a], t[a])
- }
- this._strokeInstructions = [new e(this._setProp, ["strokeStyle", u], false)];
- return this
- };
- n.beginRadialGradientStroke = function(t, n, r, i, s, o, u, a) {
- if (this._active) {
- this._newPath()
- }
- var f = this._ctx.createRadialGradient(r, i, s, o, u, a);
- for (var l = 0, c = t.length; l < c; l++) {
- f.addColorStop(n[l], t[l])
- }
- this._strokeInstructions = [new e(this._setProp, ["strokeStyle", f], false)];
- return this
- };
- n.beginBitmapStroke = function(t, n) {
- if (this._active) {
- this._newPath()
- }
- n = n || "";
- var r = this._ctx.createPattern(t, n);
- this._strokeInstructions = [new e(this._setProp, ["strokeStyle", r], false)];
- return this
- };
- n.endStroke = function() {
- this.beginStroke();
- return this
- };
- n.curveTo = n.quadraticCurveTo;
- n.drawRect = n.rect;
- n.drawRoundRect = function(e, t, n, r, i) {
- this.drawRoundRectComplex(e, t, n, r, i, i, i, i);
- return this
- };
- n.drawRoundRectComplex = function(t, n, r, i, s, o, u, a) {
- var f = (r < i ? r : i) / 2;
- var l = 0,
- c = 0,
- h = 0,
- p = 0;
- if (s < 0) {
- s *= l = -1
- }
- if (s > f) {
- s = f
- }
- if (o < 0) {
- o *= c = -1
- }
- if (o > f) {
- o = f
- }
- if (u < 0) {
- u *= h = -1
- }
- if (u > f) {
- u = f
- }
- if (a < 0) {
- a *= p = -1
- }
- if (a > f) {
- a = f
- }
- this._dirty = this._active = true;
- var d = this._ctx.arcTo,
- v = this._ctx.lineTo;
- this._activeInstructions.push(new e(this._ctx.moveTo, [t + r - o, n]), new e(d, [t + r + o * c, n - o * c, t + r, n + o, o]), new e(v, [t + r, n + i - u]), new e(d, [t + r + u * h, n + i + u * h, t + r - u, n + i, u]), new e(v, [t + a, n + i]), new e(d, [t - a * p, n + i + a * p, t, n + i - a, a]), new e(v, [t, n + s]), new e(d, [t - s * l, n - s * l, t + s, n, s]), new e(this._ctx.closePath));
- return this
- };
- n.drawCircle = function(e, t, n) {
- this.arc(e, t, n, 0, Math.PI * 2);
- return this
- };
- n.drawEllipse = function(t, n, r, i) {
- this._dirty = this._active = true;
- var s = .5522848;
- var o = r / 2 * s;
- var u = i / 2 * s;
- var a = t + r;
- var f = n + i;
- var l = t + r / 2;
- var c = n + i / 2;
- this._activeInstructions.push(new e(this._ctx.moveTo, [t, c]), new e(this._ctx.bezierCurveTo, [t, c - u, l - o, n, l, n]), new e(this._ctx.bezierCurveTo, [l + o, n, a, c - u, a, c]), new e(this._ctx.bezierCurveTo, [a, c + u, l + o, f, l, f]), new e(this._ctx.bezierCurveTo, [l - o, f, t, c + u, t, c]));
- return this
- };
- n.inject = function(t, n) {
- this._dirty = this._active = true;
- this._activeInstructions.push(new e(t, [n]));
- return this
- };
- n.drawPolyStar = function(t, n, r, i, s, o) {
- this._dirty = this._active = true;
- if (s == null) {
- s = 0
- }
- s = 1 - s;
- if (o == null) {
- o = 0
- } else {
- o /= 180 / Math.PI
- }
- var u = Math.PI / i;
- this._activeInstructions.push(new e(this._ctx.moveTo, [t + Math.cos(o) * r, n + Math.sin(o) * r]));
- for (var a = 0; a < i; a++) {
- o += u;
- if (s != 1) {
- this._activeInstructions.push(new e(this._ctx.lineTo, [t + Math.cos(o) * r * s, n + Math.sin(o) * r * s]))
- }
- o += u;
- this._activeInstructions.push(new e(this._ctx.lineTo, [t + Math.cos(o) * r, n + Math.sin(o) * r]))
- }
- return this
- };
- n.decodePath = function(e) {
- var n = [this.moveTo, this.lineTo, this.quadraticCurveTo, this.bezierCurveTo, this.closePath];
- var r = [2, 2, 4, 6, 0];
- var i = 0,
- s = e.length;
- var o = [];
- var u = 0,
- a = 0;
- var f = t.BASE_64;
- while (i < s) {
- var l = e.charAt(i);
- var c = f[l];
- var h = c >> 3;
- var p = n[h];
- if (!p || c & 3) {
- throw "bad path data (@" + i + "): " + l
- }
- var d = r[h];
- if (!h) {
- u = a = 0
- }
- o.length = 0;
- i++;
- var v = (c >> 2 & 1) + 2;
- for (var m = 0; m < d; m++) {
- var g = f[e.charAt(i)];
- var y = g >> 5 ? -1 : 1;
- g = (g & 31) << 6 | f[e.charAt(i + 1)];
- if (v == 3) {
- g = g << 6 | f[e.charAt(i + 2)]
- }
- g = y * g / 10;
- if (m % 2) {
- u = g += u
- } else {
- a = g += a
- }
- o[m] = g;
- i += v
- }
- p.apply(this, o)
- }
- return this
- };
- n.clone = function() {
- var e = new t;
- e._instructions = this._instructions.slice();
- e._activeInstructions = this._activeInstructions.slice();
- e._oldInstructions = this._oldInstructions.slice();
- if (this._fillInstructions) {
- e._fillInstructions = this._fillInstructions.slice()
- }
- if (this._strokeInstructions) {
- e._strokeInstructions = this._strokeInstructions.slice()
- }
- if (this._strokeStyleInstructions) {
- e._strokeStyleInstructions = this._strokeStyleInstructions.slice()
- }
- e._active = this._active;
- e._dirty = this._dirty;
- e._fillMatrix = this._fillMatrix;
- e._strokeIgnoreScale = this._strokeIgnoreScale;
- return e
- };
- n.toString = function() {
- return "[Graphics]"
- };
- n.mt = n.moveTo;
- n.lt = n.lineTo;
- n.at = n.arcTo;
- n.bt = n.bezierCurveTo;
- n.qt = n.quadraticCurveTo;
- n.a = n.arc;
- n.r = n.rect;
- n.cp = n.closePath;
- n.c = n.clear;
- n.f = n.beginFill;
- n.lf = n.beginLinearGradientFill;
- n.rf = n.beginRadialGradientFill;
- n.bf = n.beginBitmapFill;
- n.ef = n.endFill;
- n.ss = n.setStrokeStyle;
- n.s = n.beginStroke;
- n.ls = n.beginLinearGradientStroke;
- n.rs = n.beginRadialGradientStroke;
- n.bs = n.beginBitmapStroke;
- n.es = n.endStroke;
- n.dr = n.drawRect;
- n.rr = n.drawRoundRect;
- n.rc = n.drawRoundRectComplex;
- n.dc = n.drawCircle;
- n.de = n.drawEllipse;
- n.dp = n.drawPolyStar;
- n.p = n.decodePath;
- n._updateInstructions = function() {
- this._instructions = this._oldInstructions.slice();
- this._instructions.push(t.beginCmd);
- this._appendInstructions(this._fillInstructions);
- this._appendInstructions(this._strokeInstructions);
- this._appendInstructions(this._strokeInstructions && this._strokeStyleInstructions);
- this._appendInstructions(this._activeInstructions);
- if (this._fillInstructions) {
- this._appendDraw(t.fillCmd, this._fillMatrix)
- }
- if (this._strokeInstructions) {
- this._appendDraw(t.strokeCmd, this._strokeIgnoreScale && [1, 0, 0, 1, 0, 0])
- }
- };
- n._appendInstructions = function(e) {
- if (e) {
- this._instructions.push.apply(this._instructions, e)
- }
- };
- n._appendDraw = function(t, n) {
- if (!n) {
- this._instructions.push(t)
- } else {
- this._instructions.push(new e(this._ctx.save, [], false), new e(this._ctx.transform, n, false), t, new e(this._ctx.restore, [], false))
- }
- };
- n._newPath = function() {
- if (this._dirty) {
- this._updateInstructions()
- }
- this._oldInstructions = this._instructions;
- this._activeInstructions = [];
- this._active = this._dirty = false
- };
- n._setProp = function(e, t) {
- this[e] = t
- };
- createjs.Graphics = t
- })();
- this.createjs = this.createjs || {};
- (function() {
- var e = function() {
- this.initialize()
- };
- var t = e.prototype = new createjs.EventDispatcher;
- e._MOUSE_EVENTS = ["click", "dblclick", "mousedown", "mouseout", "mouseover", "pressmove", "pressup", "rollout", "rollover"];
- e.suppressCrossDomainErrors = false;
- e._snapToPixelEnabled = false;
- var n = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas");
- if (n.getContext) {
- e._hitTestCanvas = n;
- e._hitTestContext = n.getContext("2d");
- n.width = n.height = 1
- }
- e._nextCacheID = 1;
- t.alpha = 1;
- t.cacheCanvas = null;
- t.id = -1;
- t.mouseEnabled = true;
- t.tickEnabled = true;
- t.name = null;
- t.parent = null;
- t.regX = 0;
- t.regY = 0;
- t.rotation = 0;
- t.scaleX = 1;
- t.scaleY = 1;
- t.skewX = 0;
- t.skewY = 0;
- t.shadow = null;
- t.visible = true;
- t.x = 0;
- t.y = 0;
- t.compositeOperation = null;
- t.snapToPixel = true;
- t.filters = null;
- t.cacheID = 0;
- t.mask = null;
- t.hitArea = null;
- t.cursor = null;
- t._cacheOffsetX = 0;
- t._cacheOffsetY = 0;
- t._cacheScale = 1;
- t._cacheDataURLID = 0;
- t._cacheDataURL = null;
- t._matrix = null;
- t._rectangle = null;
- t._bounds = null;
- t.initialize = function() {
- this.id = createjs.UID.get();
- this._matrix = new createjs.Matrix2D;
- this._rectangle = new createjs.Rectangle
- };
- t.isVisible = function() {
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0)
- };
- t.draw = function(e, t) {
- var n = this.cacheCanvas;
- if (t || !n) {
- return false
- }
- var r = this._cacheScale,
- i = this._cacheOffsetX,
- s = this._cacheOffsetY,
- o;
- if (o = this._applyFilterBounds(i, s, 0, 0)) {
- i = o.x;
- s = o.y
- }
- e.drawImage(n, i, s, n.width / r, n.height / r);
- return true
- };
- t.updateContext = function(t) {
- var n, r = this.mask,
- i = this;
- if (r && r.graphics && !r.graphics.isEmpty()) {
- n = r.getMatrix(r._matrix);
- t.transform(n.a, n.b, n.c, n.d, n.tx, n.ty);
- r.graphics.drawAsPath(t);
- t.clip();
- n.invert();
- t.transform(n.a, n.b, n.c, n.d, n.tx, n.ty)
- }
- n = i._matrix.identity().appendTransform(i.x, i.y, i.scaleX, i.scaleY, i.rotation, i.skewX, i.skewY, i.regX, i.regY);
- var s = n.tx,
- o = n.ty;
- if (e._snapToPixelEnabled && i.snapToPixel) {
- s = s + (s < 0 ? -.5 : .5) | 0;
- o = o + (o < 0 ? -.5 : .5) | 0
- }
- t.transform(n.a, n.b, n.c, n.d, s, o);
- t.globalAlpha *= i.alpha;
- if (i.compositeOperation) {
- t.globalCompositeOperation = i.compositeOperation
- }
- if (i.shadow) {
- this._applyShadow(t, i.shadow)
- }
- };
- t.cache = function(e, t, n, r, i) {
- i = i || 1;
- if (!this.cacheCanvas) {
- this.cacheCanvas = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas")
- }
- this._cacheWidth = n;
- this._cacheHeight = r;
- this._cacheOffsetX = e;
- this._cacheOffsetY = t;
- this._cacheScale = i;
- this.updateCache()
- };
- t.updateCache = function(t) {
- var n = this.cacheCanvas,
- r = this._cacheScale,
- i = this._cacheOffsetX * r,
- s = this._cacheOffsetY * r;
- var o = this._cacheWidth,
- u = this._cacheHeight,
- a;
- if (!n) {
- throw "cache() must be called before updateCache()"
- }
- var f = n.getContext("2d");
- if (a = this._applyFilterBounds(i, s, o, u)) {
- i = a.x;
- s = a.y;
- o = a.width;
- u = a.height
- }
- o = Math.ceil(o * r);
- u = Math.ceil(u * r);
- if (o != n.width || u != n.height) {
- n.width = o;
- n.height = u
- } else if (!t) {
- f.clearRect(0, 0, o + 1, u + 1)
- }
- f.save();
- f.globalCompositeOperation = t;
- f.setTransform(r, 0, 0, r, -i, -s);
- this.draw(f, true);
- this._applyFilters();
- f.restore();
- this.cacheID = e._nextCacheID++
- };
- t.uncache = function() {
- this._cacheDataURL = this.cacheCanvas = null;
- this.cacheID = this._cacheOffsetX = this._cacheOffsetY = 0;
- this._cacheScale = 1
- };
- t.getCacheDataURL = function() {
- if (!this.cacheCanvas) {
- return null
- }
- if (this.cacheID != this._cacheDataURLID) {
- this._cacheDataURL = this.cacheCanvas.toDataURL()
- }
- return this._cacheDataURL
- };
- t.getStage = function() {
- var e = this;
- while (e.parent) {
- e = e.parent
- }
- if (e instanceof createjs["Stage"]) {
- return e
- }
- return null
- };
- t.localToGlobal = function(e, t) {
- var n = this.getConcatenatedMatrix(this._matrix);
- if (n == null) {
- return null
- }
- n.append(1, 0, 0, 1, e, t);
- return new createjs.Point(n.tx, n.ty)
- };
- t.globalToLocal = function(e, t) {
- var n = this.getConcatenatedMatrix(this._matrix);
- if (n == null) {
- return null
- }
- n.invert();
- n.append(1, 0, 0, 1, e, t);
- return new createjs.Point(n.tx, n.ty)
- };
- t.localToLocal = function(e, t, n) {
- var r = this.localToGlobal(e, t);
- return n.globalToLocal(r.x, r.y)
- };
- t.setTransform = function(e, t, n, r, i, s, o, u, a) {
- this.x = e || 0;
- this.y = t || 0;
- this.scaleX = n == null ? 1 : n;
- this.scaleY = r == null ? 1 : r;
- this.rotation = i || 0;
- this.skewX = s || 0;
- this.skewY = o || 0;
- this.regX = u || 0;
- this.regY = a || 0;
- return this
- };
- t.getMatrix = function(e) {
- var t = this;
- return (e ? e.identity() : new createjs.Matrix2D).appendTransform(t.x, t.y, t.scaleX, t.scaleY, t.rotation, t.skewX, t.skewY, t.regX, t.regY).appendProperties(t.alpha, t.shadow, t.compositeOperation)
- };
- t.getConcatenatedMatrix = function(e) {
- if (e) {
- e.identity()
- } else {
- e = new createjs.Matrix2D
- }
- var t = this;
- while (t != null) {
- e.prependTransform(t.x, t.y, t.scaleX, t.scaleY, t.rotation, t.skewX, t.skewY, t.regX, t.regY).prependProperties(t.alpha, t.shadow, t.compositeOperation, t.visible);
- t = t.parent
- }
- return e
- };
- t.hitTest = function(t, n) {
- var r = e._hitTestContext;
- r.setTransform(1, 0, 0, 1, -t, -n);
- this.draw(r);
- var i = this._testHit(r);
- r.setTransform(1, 0, 0, 1, 0, 0);
- r.clearRect(0, 0, 2, 2);
- return i
- };
- t.set = function(e) {
- for (var t in e) {
- this[t] = e[t]
- }
- return this
- };
- t.getBounds = function() {
- if (this._bounds) {
- return this._rectangle.copy(this._bounds)
- }
- var e = this.cacheCanvas;
- if (e) {
- var t = this._cacheScale;
- return this._rectangle.initialize(this._cacheOffsetX, this._cacheOffsetY, e.width / t, e.height / t)
- }
- return null
- };
- t.getTransformedBounds = function() {
- return this._getBounds()
- };
- t.setBounds = function(e, t, n, r) {
- if (e == null) {
- this._bounds = e
- }
- this._bounds = (this._bounds || new createjs.Rectangle).initialize(e, t, n, r)
- };
- t.clone = function() {
- var t = new e;
- this.cloneProps(t);
- return t
- };
- t.toString = function() {
- return "[DisplayObject (name=" + this.name + ")]"
- };
- t.cloneProps = function(e) {
- e.alpha = this.alpha;
- e.name = this.name;
- e.regX = this.regX;
- e.regY = this.regY;
- e.rotation = this.rotation;
- e.scaleX = this.scaleX;
- e.scaleY = this.scaleY;
- e.shadow = this.shadow;
- e.skewX = this.skewX;
- e.skewY = this.skewY;
- e.visible = this.visible;
- e.x = this.x;
- e.y = this.y;
- e._bounds = this._bounds;
- e.mouseEnabled = this.mouseEnabled;
- e.compositeOperation = this.compositeOperation
- };
- t._applyShadow = function(e, t) {
- t = t || Shadow.identity;
- e.shadowColor = t.color;
- e.shadowOffsetX = t.offsetX;
- e.shadowOffsetY = t.offsetY;
- e.shadowBlur = t.blur
- };
- t._tick = function(e) {
- var t = this._listeners;
- if (t && t["tick"]) {
- var n = new createjs.Event("tick");
- n.params = e;
- this._dispatchEvent(n, this, 2)
- }
- };
- t._testHit = function(t) {
- try {
- var n = t.getImageData(0, 0, 1, 1).data[3] > 1
- } catch (r) {
- if (!e.suppressCrossDomainErrors) {
- throw "An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."
- }
- }
- return n
- };
- t._applyFilters = function() {
- if (!this.filters || this.filters.length == 0 || !this.cacheCanvas) {
- return
- }
- var e = this.filters.length;
- var t = this.cacheCanvas.getContext("2d");
- var n = this.cacheCanvas.width;
- var r = this.cacheCanvas.height;
- for (var i = 0; i < e; i++) {
- this.filters[i].applyFilter(t, 0, 0, n, r)
- }
- };
- t._applyFilterBounds = function(e, t, n, r) {
- var i, s, o = this.filters;
- if (!o || !(s = o.length)) {
- return null
- }
- for (var u = 0; u < s; u++) {
- var a = this.filters[u];
- var f = a.getBounds && a.getBounds();
- if (!f) {
- continue
- }
- if (!i) {
- i = this._rectangle.initialize(e, t, n, r)
- }
- i.x += f.x;
- i.y += f.y;
- i.width += f.width;
- i.height += f.height
- }
- return i
- };
- t._getBounds = function(e, t) {
- return this._transformBounds(this.getBounds(), e, t)
- };
- t._transformBounds = function(e, t, n) {
- if (!e) {
- return e
- }
- var r = e.x,
- i = e.y,
- s = e.width,
- o = e.height;
- var u = n ? this._matrix.identity() : this.getMatrix(this._matrix);
- if (r || i) {
- u.appendTransform(0, 0, 1, 1, 0, 0, 0, -r, -i)
- }
- if (t) {
- u.prependMatrix(t)
- }
- var a = s * u.a,
- f = s * u.b;
- var l = o * u.c,
- c = o * u.d;
- var h = u.tx,
- p = u.ty;
- var d = h,
- v = h,
- m = p,
- g = p;
- if ((r = a + h) < d) {
- d = r
- } else if (r > v) {
- v = r
- }
- if ((r = a + l + h) < d) {
- d = r
- } else if (r > v) {
- v = r
- }
- if ((r = l + h) < d) {
- d = r
- } else if (r > v) {
- v = r
- }
- if ((i = f + p) < m) {
- m = i
- } else if (i > g) {
- g = i
- }
- if ((i = f + c + p) < m) {
- m = i
- } else if (i > g) {
- g = i
- }
- if ((i = c + p) < m) {
- m = i
- } else if (i > g) {
- g = i
- }
- return e.initialize(d, m, v - d, g - m)
- };
- t._hasMouseEventListener = function() {
- var t = e._MOUSE_EVENTS;
- for (var n = 0, r = t.length; n < r; n++) {
- if (this.hasEventListener(t[n])) {
- return true
- }
- }
- return !!this.cursor
- };
- createjs.DisplayObject = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- var e = function() {
- this.initialize()
- };
- var t = e.prototype = new createjs.DisplayObject;
- t.children = null;
- t.mouseChildren = true;
- t.tickChildren = true;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function() {
- this.DisplayObject_initialize();
- this.children = []
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.children.length;
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t.DisplayObject_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return true
- }
- var n = this.children.slice(0);
- for (var r = 0, i = n.length; r < i; r++) {
- var s = n[r];
- if (!s.isVisible()) {
- continue
- }
- e.save();
- s.updateContext(e);
- s.draw(e);
- e.restore()
- }
- return true
- };
- t.addChild = function(e) {
- if (e == null) {
- return e
- }
- var t = arguments.length;
- if (t > 1) {
- for (var n = 0; n < t; n++) {
- this.addChild(arguments[n])
- }
- return arguments[t - 1]
- }
- if (e.parent) {
- e.parent.removeChild(e)
- }
- e.parent = this;
- this.children.push(e);
- return e
- };
- t.addChildAt = function(e, t) {
- var n = arguments.length;
- var r = arguments[n - 1];
- if (r < 0 || r > this.children.length) {
- return arguments[n - 2]
- }
- if (n > 2) {
- for (var i = 0; i < n - 1; i++) {
- this.addChildAt(arguments[i], r + i)
- }
- return arguments[n - 2]
- }
- if (e.parent) {
- e.parent.removeChild(e)
- }
- e.parent = this;
- this.children.splice(t, 0, e);
- return e
- };
- t.removeChild = function(e) {
- var t = arguments.length;
- if (t > 1) {
- var n = true;
- for (var r = 0; r < t; r++) {
- n = n && this.removeChild(arguments[r])
- }
- return n
- }
- return this.removeChildAt(createjs.indexOf(this.children, e))
- };
- t.removeChildAt = function(e) {
- var t = arguments.length;
- if (t > 1) {
- var n = [];
- for (var r = 0; r < t; r++) {
- n[r] = arguments[r]
- }
- n.sort(function(e, t) {
- return t - e
- });
- var i = true;
- for (var r = 0; r < t; r++) {
- i = i && this.removeChildAt(n[r])
- }
- return i
- }
- if (e < 0 || e > this.children.length - 1) {
- return false
- }
- var s = this.children[e];
- if (s) {
- s.parent = null
- }
- this.children.splice(e, 1);
- return true
- };
- t.removeAllChildren = function() {
- var e = this.children;
- while (e.length) {
- e.pop().parent = null
- }
- };
- t.getChildAt = function(e) {
- return this.children[e]
- };
- t.getChildByName = function(e) {
- var t = this.children;
- for (var n = 0, r = t.length; n < r; n++) {
- if (t[n].name == e) {
- return t[n]
- }
- }
- return null
- };
- t.sortChildren = function(e) {
- this.children.sort(e)
- };
- t.getChildIndex = function(e) {
- return createjs.indexOf(this.children, e)
- };
- t.getNumChildren = function() {
- return this.children.length
- };
- t.swapChildrenAt = function(e, t) {
- var n = this.children;
- var r = n[e];
- var i = n[t];
- if (!r || !i) {
- return
- }
- n[e] = i;
- n[t] = r
- };
- t.swapChildren = function(e, t) {
- var n = this.children;
- var r, i;
- for (var s = 0, o = n.length; s < o; s++) {
- if (n[s] == e) {
- r = s
- }
- if (n[s] == t) {
- i = s
- }
- if (r != null && i != null) {
- break
- }
- }
- if (s == o) {
- return
- }
- n[r] = t;
- n[i] = e
- };
- t.setChildIndex = function(e, t) {
- var n = this.children,
- r = n.length;
- if (e.parent != this || t < 0 || t >= r) {
- return
- }
- for (var i = 0; i < r; i++) {
- if (n[i] == e) {
- break
- }
- }
- if (i == r || i == t) {
- return
- }
- n.splice(i, 1);
- n.splice(t, 0, e)
- };
- t.contains = function(e) {
- while (e) {
- if (e == this) {
- return true
- }
- e = e.parent
- }
- return false
- };
- t.hitTest = function(e, t) {
- return this.getObjectUnderPoint(e, t) != null
- };
- t.getObjectsUnderPoint = function(e, t) {
- var n = [];
- var r = this.localToGlobal(e, t);
- this._getObjectsUnderPoint(r.x, r.y, n);
- return n
- };
- t.getObjectUnderPoint = function(e, t) {
- var n = this.localToGlobal(e, t);
- return this._getObjectsUnderPoint(n.x, n.y)
- };
- t.DisplayObject_getBounds = t.getBounds;
- t.getBounds = function() {
- return this._getBounds(null, true)
- };
- t.getTransformedBounds = function() {
- return this._getBounds()
- };
- t.clone = function(t) {
- var n = new e;
- this.cloneProps(n);
- if (t) {
- var r = n.children = [];
- for (var i = 0, s = this.children.length; i < s; i++) {
- var o = this.children[i].clone(t);
- o.parent = n;
- r.push(o)
- }
- }
- return n
- };
- t.toString = function() {
- return "[Container (name=" + this.name + ")]"
- };
- t.DisplayObject__tick = t._tick;
- t._tick = function(e) {
- if (this.tickChildren) {
- for (var t = this.children.length - 1; t >= 0; t--) {
- var n = this.children[t];
- if (n.tickEnabled && n._tick) {
- n._tick(e)
- }
- }
- }
- this.DisplayObject__tick(e)
- };
- t._getObjectsUnderPoint = function(t, n, r, i, s) {
- var o = createjs.DisplayObject._hitTestContext;
- var u = this._matrix;
- s = s || i && this._hasMouseEventListener();
- var a = this.children;
- var f = a.length;
- for (var l = f - 1; l >= 0; l--) {
- var c = a[l];
- var h = c.hitArea;
- if (!c.visible || !h && !c.isVisible() || i && !c.mouseEnabled) {
- continue
- }
- if (!h && c instanceof e) {
- var p = c._getObjectsUnderPoint(t, n, r, i, s);
- if (!r && p) {
- return i && !this.mouseChildren ? this : p
- }
- } else {
- if (i && !s && !c._hasMouseEventListener()) {
- continue
- }
- c.getConcatenatedMatrix(u);
- if (h) {
- u.appendTransform(h.x, h.y, h.scaleX, h.scaleY, h.rotation, h.skewX, h.skewY, h.regX, h.regY);
- u.alpha = h.alpha
- }
- o.globalAlpha = u.alpha;
- o.setTransform(u.a, u.b, u.c, u.d, u.tx - t, u.ty - n);
- (h || c).draw(o);
- if (!this._testHit(o)) {
- continue
- }
- o.setTransform(1, 0, 0, 1, 0, 0);
- o.clearRect(0, 0, 2, 2);
- if (r) {
- r.push(c)
- } else {
- return i && !this.mouseChildren ? this : c
- }
- }
- }
- return null
- };
- t._getBounds = function(e, t) {
- var n = this.DisplayObject_getBounds();
- if (n) {
- return this._transformBounds(n, e, t)
- }
- var r, i, s, o;
- var u = t ? this._matrix.identity() : this.getMatrix(this._matrix);
- if (e) {
- u.prependMatrix(e)
- }
- var a = this.children.length;
- for (var f = 0; f < a; f++) {
- var l = this.children[f];
- if (!l.visible || !(n = l._getBounds(u))) {
- continue
- }
- var c = n.x,
- h = n.y,
- p = c + n.width,
- d = h + n.height;
- if (c < r || r == null) {
- r = c
- }
- if (p > i || i == null) {
- i = p
- }
- if (h < s || s == null) {
- s = h
- }
- if (d > o || o == null) {
- o = d
- }
- }
- return i == null ? null : this._rectangle.initialize(r, s, i - r, o - s)
- };
- createjs.Container = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e) {
- this.initialize(e)
- };
- var t = e.prototype = new createjs.Container;
- t.autoClear = true;
- t.canvas = null;
- t.mouseX = 0;
- t.mouseY = 0;
- t.snapToPixelEnabled = false;
- t.mouseInBounds = false;
- t.tickOnUpdate = true;
- t.mouseMoveOutside = false;
- t._get_nextStage = function() {
- return this._nextStage
- };
- t._set_nextStage = function(e) {
- if (this._nextStage) {
- this._nextStage._prevStage = null
- }
- if (e) {
- e._prevStage = this
- }
- this._nextStage = e
- };
- try {
- Object.defineProperties(t, {
- nextStage: {
- get: t._get_nextStage,
- set: t._set_nextStage
- }
- })
- } catch (n) {}
- t._pointerData = null;
- t._pointerCount = 0;
- t._primaryPointerID = null;
- t._mouseOverIntervalID = null;
- t._nextStage = null;
- t._prevStage = null;
- t.Container_initialize = t.initialize;
- t.initialize = function(e) {
- this.Container_initialize();
- this.canvas = typeof e == "string" ? document.getElementById(e) : e;
- this._pointerData = {};
- this.enableDOMEvents(true)
- };
- t.update = function(e) {
- if (!this.canvas) {
- return
- }
- if (this.tickOnUpdate) {
- this.dispatchEvent("tickstart");
- this.tickEnabled && this._tick(arguments.length ? arguments : null);
- this.dispatchEvent("tickend")
- }
- this.dispatchEvent("drawstart");
- createjs.DisplayObject._snapToPixelEnabled = this.snapToPixelEnabled;
- if (this.autoClear) {
- this.clear()
- }
- var t = this.canvas.getContext("2d");
- t.save();
- this.updateContext(t);
- this.draw(t, false);
- t.restore();
- this.dispatchEvent("drawend")
- };
- t.handleEvent = function(e) {
- if (e.type == "tick") {
- this.update(e)
- }
- };
- t.clear = function() {
- if (!this.canvas) {
- return
- }
- var e = this.canvas.getContext("2d");
- e.setTransform(1, 0, 0, 1, 0, 0);
- e.clearRect(0, 0, this.canvas.width + 1, this.canvas.height + 1)
- };
- t.toDataURL = function(e, t) {
- if (!t) {
- t = "image/png"
- }
- var n = this.canvas.getContext("2d");
- var r = this.canvas.width;
- var i = this.canvas.height;
- var s;
- if (e) {
- s = n.getImageData(0, 0, r, i);
- var o = n.globalCompositeOperation;
- n.globalCompositeOperation = "destination-over";
- n.fillStyle = e;
- n.fillRect(0, 0, r, i)
- }
- var u = this.canvas.toDataURL(t);
- if (e) {
- n.clearRect(0, 0, r + 1, i + 1);
- n.putImageData(s, 0, 0);
- n.globalCompositeOperation = o
- }
- return u
- };
- t.enableMouseOver = function(e) {
- if (this._mouseOverIntervalID) {
- clearInterval(this._mouseOverIntervalID);
- this._mouseOverIntervalID = null;
- if (e == 0) {
- this._testMouseOver(true)
- }
- }
- if (e == null) {
- e = 20
- } else if (e <= 0) {
- return
- }
- var t = this;
- this._mouseOverIntervalID = setInterval(function() {
- t._testMouseOver()
- }, 1e3 / Math.min(50, e))
- };
- t.enableDOMEvents = function(e) {
- if (e == null) {
- e = true
- }
- var t, n, r = this._eventListeners;
- if (!e && r) {
- for (t in r) {
- n = r[t];
- n.t.removeEventListener(t, n.f, false)
- }
- this._eventListeners = null
- } else if (e && !r && this.canvas) {
- var i = window.addEventListener ? window : document;
- var s = this;
- r = this._eventListeners = {};
- r["mouseup"] = {
- t: i,
- f: function(e) {
- s._handleMouseUp(e)
- }
- };
- r["mousemove"] = {
- t: i,
- f: function(e) {
- s._handleMouseMove(e)
- }
- };
- r["dblclick"] = {
- t: this.canvas,
- f: function(e) {
- s._handleDoubleClick(e)
- }
- };
- r["mousedown"] = {
- t: this.canvas,
- f: function(e) {
- s._handleMouseDown(e)
- }
- };
- for (t in r) {
- n = r[t];
- n.t.addEventListener(t, n.f, false)
- }
- }
- };
- t.clone = function() {
- var t = new e(null);
- this.cloneProps(t);
- return t
- };
- t.toString = function() {
- return "[Stage (name=" + this.name + ")]"
- };
- t._getElementRect = function(e) {
- var t;
- try {
- t = e.getBoundingClientRect()
- } catch (n) {
- t = {
- top: e.offsetTop,
- left: e.offsetLeft,
- width: e.offsetWidth,
- height: e.offsetHeight
- }
- }
- var r = (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || document.body.clientLeft || 0);
- var i = (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || document.body.clientTop || 0);
- var s = window.getComputedStyle ? getComputedStyle(e) : e.currentStyle;
- var o = parseInt(s.paddingLeft) + parseInt(s.borderLeftWidth);
- var u = parseInt(s.paddingTop) + parseInt(s.borderTopWidth);
- var a = parseInt(s.paddingRight) + parseInt(s.borderRightWidth);
- var f = parseInt(s.paddingBottom) + parseInt(s.borderBottomWidth);
- return {
- left: t.left + r + o,
- right: t.right + r - a,
- top: t.top + i + u,
- bottom: t.bottom + i - f
- }
- };
- t._getPointerData = function(e) {
- var t = this._pointerData[e];
- if (!t) {
- t = this._pointerData[e] = {
- x: 0,
- y: 0
- };
- if (this._primaryPointerID == null) {
- this._primaryPointerID = e
- }
- if (this._primaryPointerID == null || this._primaryPointerID == -1) {
- this._primaryPointerID = e
- }
- }
- return t
- };
- t._handleMouseMove = function(e) {
- if (!e) {
- e = window.event
- }
- this._handlePointerMove(-1, e, e.pageX, e.pageY)
- };
- t._handlePointerMove = function(e, t, n, r, i) {
- if (this._prevStage && i === undefined) {
- return
- }
- if (!this.canvas) {
- return
- }
- var s = this._nextStage,
- o = this._getPointerData(e);
- var u = o.inBounds;
- this._updatePointerPosition(e, t, n, r);
- if (u || o.inBounds || this.mouseMoveOutside) {
- if (e == -1 && o.inBounds == !u) {
- this._dispatchMouseEvent(this, u ? "mouseleave" : "mouseenter", false, e, o, t)
- }
- this._dispatchMouseEvent(this, "stagemousemove", false, e, o, t);
- this._dispatchMouseEvent(o.target, "pressmove", true, e, o, t)
- }
- s && s._handlePointerMove(e, t, n, r, null)
- };
- t._updatePointerPosition = function(e, t, n, r) {
- var i = this._getElementRect(this.canvas);
- n -= i.left;
- r -= i.top;
- var s = this.canvas.width;
- var o = this.canvas.height;
- n /= (i.right - i.left) / s;
- r /= (i.bottom - i.top) / o;
- var u = this._getPointerData(e);
- if (u.inBounds = n >= 0 && r >= 0 && n <= s - 1 && r <= o - 1) {
- u.x = n;
- u.y = r
- } else if (this.mouseMoveOutside) {
- u.x = n < 0 ? 0 : n > s - 1 ? s - 1 : n;
- u.y = r < 0 ? 0 : r > o - 1 ? o - 1 : r
- }
- u.posEvtObj = t;
- u.rawX = n;
- u.rawY = r;
- if (e == this._primaryPointerID) {
- this.mouseX = u.x;
- this.mouseY = u.y;
- this.mouseInBounds = u.inBounds
- }
- };
- t._handleMouseUp = function(e) {
- this._handlePointerUp(-1, e, false)
- };
- t._handlePointerUp = function(e, t, n, r) {
- var i = this._nextStage,
- s = this._getPointerData(e);
- if (this._prevStage && r === undefined) {
- return
- }
- this._dispatchMouseEvent(this, "stagemouseup", false, e, s, t);
- var o = null,
- u = s.target;
- if (!r && (u || i)) {
- o = this._getObjectsUnderPoint(s.x, s.y, null, true)
- }
- if (o == u) {
- this._dispatchMouseEvent(u, "click", true, e, s, t)
- }
- this._dispatchMouseEvent(u, "pressup", true, e, s, t);
- if (n) {
- if (e == this._primaryPointerID) {
- this._primaryPointerID = null
- }
- delete this._pointerData[e]
- } else {
- s.target = null
- }
- i && i._handlePointerUp(e, t, n, r || o && this)
- };
- t._handleMouseDown = function(e) {
- this._handlePointerDown(-1, e, e.pageX, e.pageY)
- };
- t._handlePointerDown = function(e, t, n, r, i) {
- if (r != null) {
- this._updatePointerPosition(e, t, n, r)
- }
- var s = null,
- o = this._nextStage,
- u = this._getPointerData(e);
- if (u.inBounds) {
- this._dispatchMouseEvent(this, "stagemousedown", false, e, u, t)
- }
- if (!i) {
- s = u.target = this._getObjectsUnderPoint(u.x, u.y, null, true);
- this._dispatchMouseEvent(u.target, "mousedown", true, e, u, t)
- }
- o && o._handlePointerDown(e, t, n, r, i || s && this)
- };
- t._testMouseOver = function(e, t, n) {
- if (this._prevStage && t === undefined) {
- return
- }
- var r = this._nextStage;
- if (!this._mouseOverIntervalID) {
- r && r._testMouseOver(e, t, n);
- return
- }
- if (this._primaryPointerID != -1 || !e && this.mouseX == this._mouseOverX && this.mouseY == this._mouseOverY && this.mouseInBounds) {
- return
- }
- var i = this._getPointerData(-1),
- s = i.posEvtObj;
- var o = n || s && s.target == this.canvas;
- var u = null,
- a = -1,
- f = "",
- l, c, h;
- if (!t && (e || this.mouseInBounds && o)) {
- u = this._getObjectsUnderPoint(this.mouseX, this.mouseY, null, true);
- this._mouseOverX = this.mouseX;
- this._mouseOverY = this.mouseY
- }
- var p = this._mouseOverTarget || [];
- var d = p[p.length - 1];
- var v = this._mouseOverTarget = [];
- l = u;
- while (l) {
- v.unshift(l);
- if (l.cursor != null) {
- f = l.cursor
- }
- l = l.parent
- }
- this.canvas.style.cursor = f;
- if (!t && n) {
- n.canvas.style.cursor = f
- }
- for (c = 0, h = v.length; c < h; c++) {
- if (v[c] != p[c]) {
- break
- }
- a = c
- }
- if (d != u) {
- this._dispatchMouseEvent(d, "mouseout", true, -1, i, s)
- }
- for (c = p.length - 1; c > a; c--) {
- this._dispatchMouseEvent(p[c], "rollout", false, -1, i, s)
- }
- for (c = v.length - 1; c > a; c--) {
- this._dispatchMouseEvent(v[c], "rollover", false, -1, i, s)
- }
- if (d != u) {
- this._dispatchMouseEvent(u, "mouseover", true, -1, i, s)
- }
- r && r._testMouseOver(e, t || u && this, n || o && this)
- };
- t._handleDoubleClick = function(e, t) {
- var n = null,
- r = this._nextStage,
- i = this._getPointerData(-1);
- if (!t) {
- n = this._getObjectsUnderPoint(i.x, i.y, null, true);
- this._dispatchMouseEvent(n, "dblclick", true, -1, i, e)
- }
- r && r._handleDoubleClick(e, t || n && this)
- };
- t._dispatchMouseEvent = function(e, t, n, r, i, s) {
- if (!e || !n && !e.hasEventListener(t)) {
- return
- }
- var o = new createjs.MouseEvent(t, n, false, i.x, i.y, s, r, r == this._primaryPointerID, i.rawX, i.rawY);
- e.dispatchEvent(o)
- };
- createjs.Stage = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- var e = function(e) {
- this.initialize(e)
- };
- var t = e.prototype = new createjs.DisplayObject;
- t.image = null;
- t.sourceRect = null;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function(e) {
- this.DisplayObject_initialize();
- if (typeof e == "string") {
- this.image = document.createElement("img");
- this.image.src = e
- } else {
- this.image = e
- }
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.image && (this.image.complete || this.image.getContext || this.image.readyState >= 2);
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t.DisplayObject_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return true
- }
- var n = this.sourceRect;
- if (n) {
- e.drawImage(this.image, n.x, n.y, n.width, n.height, 0, 0, n.width, n.height)
- } else {
- try {
- e.drawImage(this.image, 0, 0)
- } catch (r) {}
- }
- return true
- };
- t.DisplayObject_getBounds = t.getBounds;
- t.getBounds = function() {
- var e = this.DisplayObject_getBounds();
- if (e) {
- return e
- }
- var t = this.sourceRect || this.image;
- var n = this.image && (this.image.complete || this.image.getContext || this.image.readyState >= 2);
- return n ? this._rectangle.initialize(0, 0, t.width, t.height) : null
- };
- t.clone = function() {
- var t = new e(this.image);
- if (this.sourceRect) {
- t.sourceRect = this.sourceRect.clone()
- }
- this.cloneProps(t);
- return t
- };
- t.toString = function() {
- return "[Bitmap (name=" + this.name + ")]"
- };
- createjs.Bitmap = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t) {
- this.initialize(e, t)
- };
- var t = e.prototype = new createjs.DisplayObject;
- t.currentFrame = 0;
- t.currentAnimation = null;
- t.paused = true;
- t.spriteSheet = null;
- t.offset = 0;
- t.currentAnimationFrame = 0;
- t.framerate = 0;
- t._advanceCount = 0;
- t._animation = null;
- t._currentFrame = null;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function(e, t) {
- this.DisplayObject_initialize();
- this.spriteSheet = e;
- if (t) {
- this.gotoAndPlay(t)
- }
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.spriteSheet.complete;
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t.DisplayObject_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return true
- }
- this._normalizeFrame();
- var n = this.spriteSheet.getFrame(this._currentFrame | 0);
- if (!n) {
- return false
- }
- var r = n.rect;
- e.drawImage(n.image, r.x, r.y, r.width, r.height, -n.regX, -n.regY, r.width, r.height);
- return true
- };
- t.play = function() {
- this.paused = false
- };
- t.stop = function() {
- this.paused = true
- };
- t.gotoAndPlay = function(e) {
- this.paused = false;
- this._goto(e)
- };
- t.gotoAndStop = function(e) {
- this.paused = true;
- this._goto(e)
- };
- t.advance = function(e) {
- var t = this._animation && this._animation.speed || 1;
- var n = this.framerate || this.spriteSheet.framerate;
- var r = n && e != null ? e / (1e3 / n) : 1;
- if (this._animation) {
- this.currentAnimationFrame += r * t
- } else {
- this._currentFrame += r * t
- }
- this._normalizeFrame()
- };
- t.DisplayObject_getBounds = t.getBounds;
- t.getBounds = function() {
- return this.DisplayObject_getBounds() || this.spriteSheet.getFrameBounds(this.currentFrame, this._rectangle)
- };
- t.clone = function() {
- var t = new e(this.spriteSheet);
- this.cloneProps(t);
- return t
- };
- t.toString = function() {
- return "[Sprite (name=" + this.name + ")]"
- };
- t.DisplayObject__tick = t._tick;
- t._tick = function(e) {
- if (!this.paused) {
- this.advance(e && e[0] && e[0].delta)
- }
- this.DisplayObject__tick(e)
- };
- t._normalizeFrame = function() {
- var e = this._animation;
- var t = this.paused;
- var n = this._currentFrame;
- var r = this.currentAnimationFrame;
- var i;
- if (e) {
- i = e.frames.length;
- if ((r | 0) >= i) {
- var s = e.next;
- if (this._dispatchAnimationEnd(e, n, t, s, i - 1)) {} else if (s) {
- return this._goto(s, r - i)
- } else {
- this.paused = true;
- r = this.currentAnimationFrame = e.frames.length - 1;
- this._currentFrame = e.frames[r]
- }
- } else {
- this._currentFrame = e.frames[r | 0]
- }
- } else {
- i = this.spriteSheet.getNumFrames();
- if (n >= i) {
- if (!this._dispatchAnimationEnd(e, n, t, i - 1)) {
- if ((this._currentFrame -= i) >= i) {
- return this._normalizeFrame()
- }
- }
- }
- }
- this.currentFrame = this._currentFrame | 0
- };
- t._dispatchAnimationEnd = function(e, t, n, r, i) {
- var s = e ? e.name : null;
- if (this.hasEventListener("animationend")) {
- var o = new createjs.Event("animationend");
- o.name = s;
- o.next = r;
- this.dispatchEvent(o)
- }
- var u = this._animation != e || this._currentFrame != t;
- if (!u && !n && this.paused) {
- this.currentAnimationFrame = i;
- u = true
- }
- return u
- };
- t.DisplayObject_cloneProps = t.cloneProps;
- t.cloneProps = function(e) {
- this.DisplayObject_cloneProps(e);
- e.currentFrame = this.currentFrame;
- e._currentFrame = this._currentFrame;
- e.currentAnimation = this.currentAnimation;
- e.paused = this.paused;
- e._animation = this._animation;
- e.currentAnimationFrame = this.currentAnimationFrame;
- e.framerate = this.framerate
- };
- t._goto = function(e, t) {
- if (isNaN(e)) {
- var n = this.spriteSheet.getAnimation(e);
- if (n) {
- this.currentAnimationFrame = t || 0;
- this._animation = n;
- this.currentAnimation = e;
- this._normalizeFrame()
- }
- } else {
- this.currentAnimationFrame = 0;
- this.currentAnimation = this._animation = null;
- this._currentFrame = e;
- this._normalizeFrame()
- }
- };
- createjs.Sprite = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = "BitmapAnimation is deprecated in favour of Sprite. See VERSIONS file for info on changes.";
- if (!createjs.Sprite) {
- throw e
- }(createjs.BitmapAnimation = function(t) {
- console.log(e);
- this.initialize(t)
- }).prototype = new createjs.Sprite
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- function e(e, t) {
- this.initialize(e, t)
- }
- var t = e.prototype = new createjs.Container;
- e.maxPoolSize = 100;
- e._spritePool = [];
- t.text = "";
- t.spriteSheet = null;
- t.lineHeight = 0;
- t.letterSpacing = 0;
- t.spaceWidth = 0;
- t._oldProps = null;
- t.Container_initialize = t.initialize;
- t.initialize = function(e, t) {
- this.Container_initialize();
- this.text = e;
- this.spriteSheet = t;
- this._oldProps = {
- text: 0,
- spriteSheet: 0,
- lineHeight: 0,
- letterSpacing: 0,
- spaceWidth: 0
- }
- };
- t.Container_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return
- }
- this._updateText();
- this.Container_draw(e, t)
- };
- t.Container_getBounds = t.getBounds;
- t.getBounds = function() {
- this._updateText();
- return this.Container_getBounds()
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.spriteSheet && this.spriteSheet.complete && this.text;
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t._getFrameIndex = function(e, t) {
- var n, r = t.getAnimation(e);
- if (!r) {
- e != (n = e.toUpperCase()) || e != (n = e.toLowerCase()) || (n = null);
- if (n) {
- r = t.getAnimation(n)
- }
- }
- return r && r.frames[0]
- };
- t._getFrame = function(e, t) {
- var n = this._getFrameIndex(e, t);
- return n == null ? n : t.getFrame(n)
- };
- t._getLineHeight = function(e) {
- var t = this._getFrame("1", e) || this._getFrame("T", e) || this._getFrame("L", e) || e.getFrame(0);
- return t ? t.rect.height : 1
- };
- t._getSpaceWidth = function(e) {
- var t = this._getFrame("1", e) || this._getFrame("l", e) || this._getFrame("e", e) || this._getFrame("a", e) || e.getFrame(0);
- return t ? t.rect.width : 1
- };
- t._updateText = function() {
- var t = 0,
- n = 0,
- r = this._oldProps,
- i = false,
- s = this.spaceWidth,
- o = this.lineHeight,
- u = this.spriteSheet;
- var a = e._spritePool,
- f = this.children,
- l = 0,
- c = f.length,
- h;
- for (var p in r) {
- if (r[p] != this[p]) {
- r[p] = this[p];
- i = true
- }
- }
- if (!i) {
- return
- }
- var d = !!this._getFrame(" ", u);
- if (!d && s == 0) {
- s = this._getSpaceWidth(u)
- }
- if (o == 0) {
- o = this._getLineHeight(u)
- }
- for (var v = 0, m = this.text.length; v < m; v++) {
- var g = this.text.charAt(v);
- if (g == " " && !d) {
- t += s;
- continue
- } else if (g == "\n" || g == "\r") {
- if (g == "\r" && this.text.charAt(v + 1) == "\n") {
- v++
- }
- t = 0;
- n += o;
- continue
- }
- var y = this._getFrameIndex(g, u);
- if (y == null) {
- continue
- }
- if (l < c) {
- h = f[l]
- } else {
- h = this.addChild(a.length ? a.pop() : new createjs.Sprite);
- c++
- }
- h.spriteSheet = u;
- h.gotoAndStop(y);
- h.x = t;
- h.y = n;
- l++;
- t += h.getBounds().width + this.letterSpacing
- }
- while (c > l) {
- a.push(h = f.pop());
- h.parent = null
- }
- if (a.length > e.maxPoolSize) {
- a.length = e.maxPoolSize
- }
- };
- createjs.BitmapText = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e) {
- this.initialize(e)
- };
- var t = e.prototype = new createjs.DisplayObject;
- t.graphics = null;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function(e) {
- this.DisplayObject_initialize();
- this.graphics = e ? e : new createjs.Graphics
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.graphics && !this.graphics.isEmpty();
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t.DisplayObject_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return true
- }
- this.graphics.draw(e);
- return true
- };
- t.clone = function(t) {
- var n = new e(t && this.graphics ? this.graphics.clone() : this.graphics);
- this.cloneProps(n);
- return n
- };
- t.toString = function() {
- return "[Shape (name=" + this.name + ")]"
- };
- createjs.Shape = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- };
- var t = e.prototype = new createjs.DisplayObject;
- var n = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas");
- if (n.getContext) {
- e._workingContext = n.getContext("2d");
- n.width = n.height = 1
- }
- e.H_OFFSETS = {
- start: 0,
- left: 0,
- center: -.5,
- end: -1,
- right: -1
- };
- e.V_OFFSETS = {
- top: 0,
- hanging: -.01,
- middle: -.4,
- alphabetic: -.8,
- ideographic: -.85,
- bottom: -1
- };
- t.text = "";
- t.font = null;
- t.color = null;
- t.textAlign = "left";
- t.textBaseline = "top";
- t.maxWidth = null;
- t.outline = 0;
- t.lineHeight = 0;
- t.lineWidth = null;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function(e, t, n) {
- this.DisplayObject_initialize();
- this.text = e;
- this.font = t;
- this.color = n
- };
- t.isVisible = function() {
- var e = this.cacheCanvas || this.text != null && this.text !== "";
- return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && e)
- };
- t.DisplayObject_draw = t.draw;
- t.draw = function(e, t) {
- if (this.DisplayObject_draw(e, t)) {
- return true
- }
- var n = this.color || "#000";
- if (this.outline) {
- e.strokeStyle = n;
- e.lineWidth = this.outline * 1
- } else {
- e.fillStyle = n
- }
- this._drawText(this._prepContext(e));
- return true
- };
- t.getMeasuredWidth = function() {
- return this._prepContext(e._workingContext).measureText(this.text).width
- };
- t.getMeasuredLineHeight = function() {
- return this._prepContext(e._workingContext).measureText("M").width * 1.2
- };
- t.getMeasuredHeight = function() {
- return this._drawText(null, {}).height
- };
- t.DisplayObject_getBounds = t.getBounds;
- t.getBounds = function() {
- var t = this.DisplayObject_getBounds();
- if (t) {
- return t
- }
- if (this.text == null || this.text == "") {
- return null
- }
- var n = this._drawText(null, {});
- var r = this.maxWidth && this.maxWidth < n.width ? this.maxWidth : n.width;
- var i = r * e.H_OFFSETS[this.textAlign || "left"];
- var s = this.lineHeight || this.getMeasuredLineHeight();
- var o = s * e.V_OFFSETS[this.textBaseline || "top"];
- return this._rectangle.initialize(i, o, r, n.height)
- };
- t.clone = function() {
- var t = new e(this.text, this.font, this.color);
- this.cloneProps(t);
- return t
- };
- t.toString = function() {
- return "[Text (text=" + (this.text.length > 20 ? this.text.substr(0, 17) + "..." : this.text) + ")]"
- };
- t.DisplayObject_cloneProps = t.cloneProps;
- t.cloneProps = function(e) {
- this.DisplayObject_cloneProps(e);
- e.textAlign = this.textAlign;
- e.textBaseline = this.textBaseline;
- e.maxWidth = this.maxWidth;
- e.outline = this.outline;
- e.lineHeight = this.lineHeight;
- e.lineWidth = this.lineWidth
- };
- t._prepContext = function(e) {
- e.font = this.font;
- e.textAlign = this.textAlign || "left";
- e.textBaseline = this.textBaseline || "top";
- return e
- };
- t._drawText = function(t, n) {
- var r = !!t;
- if (!r) {
- t = this._prepContext(e._workingContext)
- }
- var i = this.lineHeight || this.getMeasuredLineHeight();
- var s = 0,
- o = 0;
- var u = String(this.text).split(/(?:\r\n|\r|\n)/);
- for (var a = 0, f = u.length; a < f; a++) {
- var l = u[a];
- var c = null;
- if (this.lineWidth != null && (c = t.measureText(l).width) > this.lineWidth) {
- var h = l.split(/(\s)/);
- l = h[0];
- c = t.measureText(l).width;
- for (var p = 1, d = h.length; p < d; p += 2) {
- var v = t.measureText(h[p] + h[p + 1]).width;
- if (c + v > this.lineWidth) {
- if (r) {
- this._drawTextLine(t, l, o * i)
- }
- if (c > s) {
- s = c
- }
- l = h[p + 1];
- c = t.measureText(l).width;
- o++
- } else {
- l += h[p] + h[p + 1];
- c += v
- }
- }
- }
- if (r) {
- this._drawTextLine(t, l, o * i)
- }
- if (n && c == null) {
- c = t.measureText(l).width
- }
- if (c > s) {
- s = c
- }
- o++
- }
- if (n) {
- n.count = o;
- n.width = s;
- n.height = o * i
- }
- return n
- };
- t._drawTextLine = function(e, t, n) {
- if (this.outline) {
- e.strokeText(t, 0, n, this.maxWidth || 65535)
- } else {
- e.fillText(t, 0, n, this.maxWidth || 65535)
- }
- };
- createjs.Text = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e) {
- this.initialize(e)
- };
- var t = e.prototype = new createjs.DisplayObject;
- t.htmlElement = null;
- t._oldMtx = null;
- t._visible = false;
- t.DisplayObject_initialize = t.initialize;
- t.initialize = function(e) {
- if (typeof e == "string") {
- e = document.getElementById(e)
- }
- this.DisplayObject_initialize();
- this.mouseEnabled = false;
- this.htmlElement = e;
- var t = e.style;
- t.position = "absolute";
- t.transformOrigin = t.WebkitTransformOrigin = t.msTransformOrigin = t.MozTransformOrigin = t.OTransformOrigin = "0% 0%"
- };
- t.isVisible = function() {
- return this.htmlElement != null
- };
- t.draw = function(e, t) {
- return true
- };
- t.cache = function() {};
- t.uncache = function() {};
- t.updateCache = function() {};
- t.hitTest = function() {};
- t.localToGlobal = function() {};
- t.globalToLocal = function() {};
- t.localToLocal = function() {};
- t.clone = function() {
- throw "DOMElement cannot be cloned."
- };
- t.toString = function() {
- return "[DOMElement (name=" + this.name + ")]"
- };
- t.DisplayObject__tick = t._tick;
- t._tick = function(e) {
- var t = this.getStage();
- t && t.on("drawend", this._handleDrawEnd, this, true);
- this.DisplayObject__tick(e)
- };
- t._handleDrawEnd = function(e) {
- var t = this.htmlElement;
- if (!t) {
- return
- }
- var n = t.style;
- var r = this.getConcatenatedMatrix(this._matrix);
- var i = r.visible ? "visible" : "hidden";
- if (i != n.visibility) {
- n.visibility = i
- }
- if (!r.visible) {
- return
- }
- var s = this._oldMtx;
- var o = 1e4;
- if (!s || s.alpha != r.alpha) {
- n.opacity = "" + (r.alpha * o | 0) / o;
- if (s) {
- s.alpha = r.alpha
- }
- }
- if (!s || s.tx != r.tx || s.ty != r.ty || s.a != r.a || s.b != r.b || s.c != r.c || s.d != r.d) {
- var u = "matrix(" + (r.a * o | 0) / o + "," + (r.b * o | 0) / o + "," + (r.c * o | 0) / o + "," + (r.d * o | 0) / o + "," + (r.tx + .5 | 0);
- n.transform = n.WebkitTransform = n.OTransform = n.msTransform = u + "," + (r.ty + .5 | 0) + ")";
- n.MozTransform = u + "px," + (r.ty + .5 | 0) + "px)";
- this._oldMtx = s ? s.copy(r) : r.clone()
- }
- };
- createjs.DOMElement = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n, r, i, s, o, u, a, f) {
- this.initialize(e, t, n, r, i, s, o, u, a, f)
- };
- var t = e.prototype = new createjs.Event;
- t.stageX = 0;
- t.stageY = 0;
- t.rawX = 0;
- t.rawY = 0;
- t.nativeEvent = null;
- t.pointerID = 0;
- t.primary = false;
- t._get_localX = function() {
- return this.currentTarget.globalToLocal(this.rawX, this.rawY).x
- };
- t._get_localY = function() {
- return this.currentTarget.globalToLocal(this.rawX, this.rawY).y
- };
- try {
- Object.defineProperties(t, {
- localX: {
- get: t._get_localX
- },
- localY: {
- get: t._get_localY
- }
- })
- } catch (n) {}
- t.Event_initialize = t.initialize;
- t.initialize = function(e, t, n, r, i, s, o, u, a, f) {
- this.Event_initialize(e, t, n);
- this.stageX = r;
- this.stageY = i;
- this.nativeEvent = s;
- this.pointerID = o;
- this.primary = u;
- this.rawX = a == null ? r : a;
- this.rawY = f == null ? i : f
- };
- t.clone = function() {
- return new e(this.type, this.bubbles, this.cancelable, this.stageX, this.stageY, this.target, this.nativeEvent, this.pointerID, this.primary, this.rawX, this.rawY)
- };
- t.toString = function() {
- return "[MouseEvent (type=" + this.type + " stageX=" + this.stageX + " stageY=" + this.stageY + ")]"
- };
- createjs.MouseEvent = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- this.initialize()
- };
- var t = e.prototype;
- t.initialize = function() {};
- t.getBounds = function() {
- return null
- };
- t.applyFilter = function(e, t, n, r, i, s, o, u) {};
- t.toString = function() {
- return "[Filter]"
- };
- t.clone = function() {
- return new e
- };
- createjs.Filter = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function(e, t, n, r, i, s, o) {
- this.initialize(e, t, n, r, i, s, o)
- };
- var t = e.prototype;
- t.target = null;
- t.overLabel = null;
- t.outLabel = null;
- t.downLabel = null;
- t.play = false;
- t.setEnabled = function(e) {
- var t = this.target;
- this._enabled = e;
- if (e) {
- t.cursor = "pointer";
- t.addEventListener("rollover", this);
- t.addEventListener("rollout", this);
- t.addEventListener("mousedown", this);
- t.addEventListener("pressup", this)
- } else {
- t.cursor = null;
- t.removeEventListener("rollover", this);
- t.removeEventListener("rollout", this);
- t.removeEventListener("mousedown", this);
- t.removeEventListener("pressup", this)
- }
- };
- t.getEnabled = function() {
- return this._enabled
- };
- try {
- Object.defineProperties(t, {
- enabled: {
- get: t.getEnabled,
- set: t.setEnabled
- }
- })
- } catch (n) {}
- t._isPressed = false;
- t._isOver = false;
- t._enabled = false;
- t.initialize = function(e, t, n, r, i, s, o) {
- if (!e.addEventListener) {
- return
- }
- this.target = e;
- e.mouseChildren = false;
- this.overLabel = n == null ? "over" : n;
- this.outLabel = t == null ? "out" : t;
- this.downLabel = r == null ? "down" : r;
- this.play = i;
- this.setEnabled(true);
- this.handleEvent({});
- if (s) {
- if (o) {
- s.actionsEnabled = false;
- s.gotoAndStop && s.gotoAndStop(o)
- }
- e.hitArea = s
- }
- };
- t.toString = function() {
- return "[ButtonHelper]"
- };
- t.handleEvent = function(e) {
- var t, n = this.target,
- r = e.type;
- if (r == "mousedown") {
- this._isPressed = true;
- t = this.downLabel
- } else if (r == "pressup") {
- this._isPressed = false;
- t = this._isOver ? this.overLabel : this.outLabel
- } else if (r == "rollover") {
- this._isOver = true;
- t = this._isPressed ? this.downLabel : this.overLabel
- } else {
- this._isOver = false;
- t = this._isPressed ? this.overLabel : this.outLabel
- } if (this.play) {
- n.gotoAndPlay && n.gotoAndPlay(t)
- } else {
- n.gotoAndStop && n.gotoAndStop(t)
- }
- };
- createjs.ButtonHelper = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- throw "Touch cannot be instantiated"
- };
- e.isSupported = function() {
- return "ontouchstart" in window || window.navigator["msPointerEnabled"] && window.navigator["msMaxTouchPoints"] > 0 || window.navigator["pointerEnabled"] && window.navigator["maxTouchPoints"] > 0
- };
- e.enable = function(t, n, r) {
- if (!t || !t.canvas || !e.isSupported()) {
- return false
- }
- t.__touch = {
- pointers: {},
- multitouch: !n,
- preventDefault: !r,
- count: 0
- };
- if ("ontouchstart" in window) {
- e._IOS_enable(t)
- } else if (window.navigator["msPointerEnabled"] || window.navigator["pointerEnabled"]) {
- e._IE_enable(t)
- }
- return true
- };
- e.disable = function(t) {
- if (!t) {
- return
- }
- if ("ontouchstart" in window) {
- e._IOS_disable(t)
- } else if (window.navigator["msPointerEnabled"] || window.navigator["pointerEnabled"]) {
- e._IE_disable(t)
- }
- };
- e._IOS_enable = function(t) {
- var n = t.canvas;
- var r = t.__touch.f = function(n) {
- e._IOS_handleEvent(t, n)
- };
- n.addEventListener("touchstart", r, false);
- n.addEventListener("touchmove", r, false);
- n.addEventListener("touchend", r, false);
- n.addEventListener("touchcancel", r, false)
- };
- e._IOS_disable = function(e) {
- var t = e.canvas;
- if (!t) {
- return
- }
- var n = e.__touch.f;
- t.removeEventListener("touchstart", n, false);
- t.removeEventListener("touchmove", n, false);
- t.removeEventListener("touchend", n, false);
- t.removeEventListener("touchcancel", n, false)
- };
- e._IOS_handleEvent = function(e, t) {
- if (!e) {
- return
- }
- if (e.__touch.preventDefault) {
- t.preventDefault && t.preventDefault()
- }
- var n = t.changedTouches;
- var r = t.type;
- for (var i = 0, s = n.length; i < s; i++) {
- var o = n[i];
- var u = o.identifier;
- if (o.target != e.canvas) {
- continue
- }
- if (r == "touchstart") {
- this._handleStart(e, u, t, o.pageX, o.pageY)
- } else if (r == "touchmove") {
- this._handleMove(e, u, t, o.pageX, o.pageY)
- } else if (r == "touchend" || r == "touchcancel") {
- this._handleEnd(e, u, t)
- }
- }
- };
- e._IE_enable = function(t) {
- var n = t.canvas;
- var r = t.__touch.f = function(n) {
- e._IE_handleEvent(t, n)
- };
- if (window.navigator["pointerEnabled"] === undefined) {
- n.addEventListener("MSPointerDown", r, false);
- window.addEventListener("MSPointerMove", r, false);
- window.addEventListener("MSPointerUp", r, false);
- window.addEventListener("MSPointerCancel", r, false);
- if (t.__touch.preventDefault) {
- n.style.msTouchAction = "none"
- }
- } else {
- n.addEventListener("pointerdown", r, false);
- window.addEventListener("pointermove", r, false);
- window.addEventListener("pointerup", r, false);
- window.addEventListener("pointercancel", r, false);
- if (t.__touch.preventDefault) {
- n.style.touchAction = "none"
- }
- }
- t.__touch.activeIDs = {}
- };
- e._IE_disable = function(e) {
- var t = e.__touch.f;
- if (window.navigator["pointerEnabled"] === undefined) {
- window.removeEventListener("MSPointerMove", t, false);
- window.removeEventListener("MSPointerUp", t, false);
- window.removeEventListener("MSPointerCancel", t, false);
- if (e.canvas) {
- e.canvas.removeEventListener("MSPointerDown", t, false)
- }
- } else {
- window.removeEventListener("pointermove", t, false);
- window.removeEventListener("pointerup", t, false);
- window.removeEventListener("pointercancel", t, false);
- if (e.canvas) {
- e.canvas.removeEventListener("pointerdown", t, false)
- }
- }
- };
- e._IE_handleEvent = function(e, t) {
- if (!e) {
- return
- }
- if (e.__touch.preventDefault) {
- t.preventDefault && t.preventDefault()
- }
- var n = t.type;
- var r = t.pointerId;
- var i = e.__touch.activeIDs;
- if (n == "MSPointerDown" || n == "pointerdown") {
- if (t.srcElement != e.canvas) {
- return
- }
- i[r] = true;
- this._handleStart(e, r, t, t.pageX, t.pageY)
- } else if (i[r]) {
- if (n == "MSPointerMove" || n == "pointermove") {
- this._handleMove(e, r, t, t.pageX, t.pageY)
- } else if (n == "MSPointerUp" || n == "MSPointerCancel" || n == "pointerup" || n == "pointercancel") {
- delete i[r];
- this._handleEnd(e, r, t)
- }
- }
- };
- e._handleStart = function(e, t, n, r, i) {
- var s = e.__touch;
- if (!s.multitouch && s.count) {
- return
- }
- var o = s.pointers;
- if (o[t]) {
- return
- }
- o[t] = true;
- s.count++;
- e._handlePointerDown(t, n, r, i)
- };
- e._handleMove = function(e, t, n, r, i) {
- if (!e.__touch.pointers[t]) {
- return
- }
- e._handlePointerMove(t, n, r, i)
- };
- e._handleEnd = function(e, t, n) {
- var r = e.__touch;
- var i = r.pointers;
- if (!i[t]) {
- return
- }
- r.count--;
- e._handlePointerUp(t, n, true);
- delete i[t]
- };
- createjs.Touch = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- throw "SpriteSheetUtils cannot be instantiated"
- };
- var t = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas");
- if (t.getContext) {
- e._workingCanvas = t;
- e._workingContext = t.getContext("2d");
- t.width = t.height = 1
- }
- e.addFlippedFrames = function(t, n, r, i) {
- if (!n && !r && !i) {
- return
- }
- var s = 0;
- if (n) {
- e._flip(t, ++s, true, false)
- }
- if (r) {
- e._flip(t, ++s, false, true)
- }
- if (i) {
- e._flip(t, ++s, true, true)
- }
- };
- e.extractFrame = function(t, n) {
- if (isNaN(n)) {
- n = t.getAnimation(n).frames[0]
- }
- var r = t.getFrame(n);
- if (!r) {
- return null
- }
- var i = r.rect;
- var s = e._workingCanvas;
- s.width = i.width;
- s.height = i.height;
- e._workingContext.drawImage(r.image, i.x, i.y, i.width, i.height, 0, 0, i.width, i.height);
- var o = document.createElement("img");
- o.src = s.toDataURL("image/png");
- return o
- };
- e.mergeAlpha = function(e, t, n) {
- if (!n) {
- n = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas")
- }
- n.width = Math.max(t.width, e.width);
- n.height = Math.max(t.height, e.height);
- var r = n.getContext("2d");
- r.save();
- r.drawImage(e, 0, 0);
- r.globalCompositeOperation = "destination-in";
- r.drawImage(t, 0, 0);
- r.restore();
- return n
- };
- e._flip = function(t, n, r, i) {
- var s = t._images;
- var o = e._workingCanvas;
- var u = e._workingContext;
- var a = s.length / n;
- for (var f = 0; f < a; f++) {
- var l = s[f];
- l.__tmp = f;
- u.setTransform(1, 0, 0, 1, 0, 0);
- u.clearRect(0, 0, o.width + 1, o.height + 1);
- o.width = l.width;
- o.height = l.height;
- u.setTransform(r ? -1 : 1, 0, 0, i ? -1 : 1, r ? l.width : 0, i ? l.height : 0);
- u.drawImage(l, 0, 0);
- var c = document.createElement("img");
- c.src = o.toDataURL("image/png");
- c.width = l.width;
- c.height = l.height;
- s.push(c)
- }
- var h = t._frames;
- var p = h.length / n;
- for (f = 0; f < p; f++) {
- l = h[f];
- var d = l.rect.clone();
- c = s[l.image.__tmp + a * n];
- var v = {
- image: c,
- rect: d,
- regX: l.regX,
- regY: l.regY
- };
- if (r) {
- d.x = c.width - d.x - d.width;
- v.regX = d.width - l.regX
- }
- if (i) {
- d.y = c.height - d.y - d.height;
- v.regY = d.height - l.regY
- }
- h.push(v)
- }
- var m = "_" + (r ? "h" : "") + (i ? "v" : "");
- var g = t._animations;
- var y = t._data;
- var b = g.length / n;
- for (f = 0; f < b; f++) {
- var w = g[f];
- l = y[w];
- var E = {
- name: w + m,
- speed: l.speed,
- next: l.next,
- frames: []
- };
- if (l.next) {
- E.next += m
- }
- h = l.frames;
- for (var S = 0, x = h.length; S < x; S++) {
- E.frames.push(h[S] + p * n)
- }
- y[E.name] = E;
- g.push(E.name)
- }
- };
- createjs.SpriteSheetUtils = e
- })();
- this.createjs = this.createjs || {};
- (function() {
- "use strict";
- var e = function() {
- this.initialize()
- };
- var t = e.prototype = new createjs.EventDispatcher;
- e.ERR_DIMENSIONS = "frame dimensions exceed max spritesheet dimensions";
- e.ERR_RUNNING = "a build is already running";
- t.maxWidth = 2048;
- t.maxHeight = 2048;
- t.spriteSheet = null;
- t.scale = 1;
- t.padding = 1;
- t.timeSlice = .3;
- t.progress = -1;
- t._frames = null;
- t._animations = null;
- t._data = null;
- t._nextFrameIndex = 0;
- t._index = 0;
- t._timerID = null;
- t._scale = 1;
- t.initialize = function() {
- this._frames = [];
- this._animations = {}
- };
- t.addFrame = function(t, n, r, i, s) {
- if (this._data) {
- throw e.ERR_RUNNING
- }
- var o = n || t.bounds || t.nominalBounds;
- if (!o && t.getBounds) {
- o = t.getBounds()
- }
- if (!o) {
- return null
- }
- r = r || 1;
- return this._frames.push({
- source: t,
- sourceRect: o,
- scale: r,
- funct: i,
- data: s,
- index: this._frames.length,
- height: o.height * r
- }) - 1
- };
- t.addAnimation = function(t, n, r, i) {
- if (this._data) {
- throw e.ERR_RUNNING
- }
- this._animations[t] = {
- frames: n,
- next: r,
- frequency: i
- }
- };
- t.addMovieClip = function(t, n, r, i, s, o) {
- if (this._data) {
- throw e.ERR_RUNNING
- }
- var u = t.frameBounds;
- var a = n || t.bounds || t.nominalBounds;
- if (!a && t.getBounds) {
- a = t.getBounds()
- }
- if (!a && !u) {
- return
- }
- var f, l, c = this._frames.length;
- var h = t.timeline.duration;
- for (f = 0; f < h; f++) {
- var p = u && u[f] ? u[f] : a;
- this.addFrame(t, p, r, this._setupMovieClipFrame, {
- i: f,
- f: i,
- d: s
- })
- }
- var d = t.timeline._labels;
- var v = [];
- for (var m in d) {
- v.push({
- index: d[m],
- label: m
- })
- }
- if (v.length) {
- v.sort(function(e, t) {
- return e.index - t.index
- });
- for (f = 0, l = v.length; f < l; f++) {
- var g = v[f].label;
- var y = c + v[f].index;
- var b = c + (f == l - 1 ? h : v[f + 1].index);
- var w = [];
- for (var E = y; E < b; E++) {
- w.push(E)
- }
- if (o) {
- g = o(g, t, y, b);
- if (!g) {
- continue
- }
- }
- this.addAnimation(g, w, true)
- }
- }
- };
- t.build = function() {
- if (this._data) {
- throw e.ERR_RUNNING
- }
- this._startBuild();
- while (this._drawNext()) {}
- this._endBuild();
- return this.spriteSheet
- };
- t.buildAsync = function(t) {
- if (this._data) {
- throw e.ERR_RUNNING
- }
- this.timeSlice = t;
- this._startBuild();
- var n = this;
- this._timerID = setTimeout(function() {
- n._run()
- }, 50 - Math.max(.01, Math.min(.99, this.timeSlice || .3)) * 50)
- };
- t.stopAsync = function() {
- clearTimeout(this._timerID);
- this._data = null
- };
- t.clone = function() {
- throw "SpriteSheetBuilder cannot be cloned."
- };
- t.toString = function() {
- return "[SpriteSheetBuilder]"
- };
- t._startBuild = function() {
- var t = this.padding || 0;
- this.progress = 0;
- this.spriteSheet = null;
- this._index = 0;
- this._scale = this.scale;
- var n = [];
- this._data = {
- images: [],
- frames: n,
- animations: this._animations
- };
- var r = this._frames.slice();
- r.sort(function(e, t) {
- return e.height <= t.height ? -1 : 1
- });
- if (r[r.length - 1].height + t * 2 > this.maxHeight) {
- throw e.ERR_DIMENSIONS
- }
- var i = 0,
- s = 0;
- var o = 0;
- while (r.length) {
- var u = this._fillRow(r, i, o, n, t);
- if (u.w > s) {
- s = u.w
- }
- i += u.h;
- if (!u.h || !r.length) {
- var a = createjs.createCanvas ? createjs.createCanvas() : document.createElement("canvas");
- a.width = this._getSize(s, this.maxWidth);
- a.height = this._getSize(i, this.maxHeight);
- this._data.images[o] = a;
- if (!u.h) {
- s = i = 0;
- o++
- }
- }
- }
- };
- t._setupMovieClipFrame = function(e, t) {
- var n = e.actionsEnabled;
- e.actionsEnabled = false;
- e.gotoAndStop(t.i);
- e.actionsEnabled = n;
- t.f && t.f(e, t.d, t.i)
- };
- t._getSize = function(e, t) {
- var n = 4;
- while (Math.pow(2, ++n) < e) {}
- return Math.min(t, Math.pow(2, n))
- };
- t._fillRow = function(t, n, r, i, s) {
- var o = this.maxWidth;
- var u = this.maxHeight;
- n += s;
- var a = u - n;
- var f = s;
- var l = 0;
- for (var c = t.length - 1; c >= 0; c--) {
- var h = t[c];
- var p = this._scale * h.scale;
- var d = h.sourceRect;
- var v = h.source;
- var m = Math.floor(p * d.x - s);
- var g = Math.floor(p * d.y - s);
- var y = Math.ceil(p * d.height + s * 2);
- var b = Math.ceil(p * d.width + s * 2);
- if (b > o) {
- throw e.ERR_DIMENSIONS
- }
- if (y > a || f + b > o) {
- continue
- }
- h.img = r;
- h.rect = new createjs.Rectangle(f, n, b, y);
- l = l || y;
- t.splice(c, 1);
- i[h.index] = [f, n, b, y, r, Math.round(-m + p * v.regX - s), Math.round(-g + p * v.regY - s)];
- f += b
- }
- return {
- w: f,
- h: l
- }
- };
- t._endBuild = function() {
- this.spriteSheet = new createjs.SpriteSheet(this._data);
- this._data = null;
- this.progress = 1;
- this.dispatchEvent("complete")
- };
- t._run = function() {
- var e = Math.max(.01, Math.min(.99, this.timeSlice || .3)) * 50;
- var t = (new Date).getTime() + e;
- var n = false;
- while (t > (new Date).getTime()) {
- if (!this._drawNext()) {
- n = true;
- break
- }
- }
- if (n) {
- this._endBuild()
- } else {
- var r = this;
- this._timerID = setTimeout(function() {
- r._run()
- }, 50 - e)
- }
- var i = this.progress = this._index / this._frames.length;
- if (this.hasEventListener("progress")) {
- var s = new createjs.Event("progress");
- s.progress = i;
- this.dispatchEvent(s)
- }
- };
- t._drawNext = function() {
- var e = this._frames[this._index];
- var t = e.scale * this._scale;
- var n = e.rect;
- var r = e.sourceRect;
- var i = this._data.images[e.img];
- var s = i.getContext("2d");
- e.funct && e.funct(e.source, e.data);
- s.save();
- s.beginPath();
- s.rect(n.x, n.y, n.width, n.height);
- s.clip();
- s.translate(Math.ceil(n.x - r.x * t), Math.ceil(n.y - r.y * t));
- s.scale(t, t);
- e.source.draw(s);
- s.restore();
- return ++this._index < this._frames.length
- };
- createjs.SpriteSheetBuilder = e
- })();
- this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = createjs.PreloadJS = createjs.PreloadJS || {};
- e.version = "0.4.1", e.buildDate = "Thu, 12 Dec 2013 23:33:38 GMT"
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- },
- t = e.prototype;
- t.type = null, t.target = null, t.currentTarget = null, t.eventPhase = 0, t.bubbles = !1, t.cancelable = !1, t.timeStamp = 0, t.defaultPrevented = !1, t.propagationStopped = !1, t.immediatePropagationStopped = !1, t.removed = !1, t.initialize = function(e, t, n) {
- this.type = e, this.bubbles = t, this.cancelable = n, this.timeStamp = (new Date).getTime()
- }, t.preventDefault = function() {
- this.defaultPrevented = !0
- }, t.stopPropagation = function() {
- this.propagationStopped = !0
- }, t.stopImmediatePropagation = function() {
- this.immediatePropagationStopped = this.propagationStopped = !0
- }, t.remove = function() {
- this.removed = !0
- }, t.clone = function() {
- return new e(this.type, this.bubbles, this.cancelable)
- }, t.toString = function() {
- return "[Event (type=" + this.type + ")]"
- }, createjs.Event = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {},
- t = e.prototype;
- e.initialize = function(e) {
- e.addEventListener = t.addEventListener, e.on = t.on, e.removeEventListener = e.off = t.removeEventListener, e.removeAllEventListeners = t.removeAllEventListeners, e.hasEventListener = t.hasEventListener, e.dispatchEvent = t.dispatchEvent, e._dispatchEvent = t._dispatchEvent, e.willTrigger = t.willTrigger
- }, t._listeners = null, t._captureListeners = null, t.initialize = function() {}, t.addEventListener = function(e, t, n) {
- var r;
- r = n ? this._captureListeners = this._captureListeners || {} : this._listeners = this._listeners || {};
- var i = r[e];
- return i && this.removeEventListener(e, t, n), i = r[e], i ? i.push(t) : r[e] = [t], t
- }, t.on = function(e, t, n, r, i, s) {
- return t.handleEvent && (n = n || t, t = t.handleEvent), n = n || this, this.addEventListener(e, function(e) {
- t.call(n, e, i), r && e.remove()
- }, s)
- }, t.removeEventListener = function(e, t, n) {
- var r = n ? this._captureListeners : this._listeners;
- if (r) {
- var i = r[e];
- if (i)
- for (var s = 0, o = i.length; o > s; s++)
- if (i[s] == t) {
- 1 == o ? delete r[e] : i.splice(s, 1);
- break
- }
- }
- }, t.off = t.removeEventListener, t.removeAllEventListeners = function(e) {
- e ? (this._listeners && delete this._listeners[e], this._captureListeners && delete this._captureListeners[e]) : this._listeners = this._captureListeners = null
- }, t.dispatchEvent = function(e, t) {
- if ("string" == typeof e) {
- var n = this._listeners;
- if (!n || !n[e]) return !1;
- e = new createjs.Event(e)
- }
- if (e.target = t || this, e.bubbles && this.parent) {
- for (var r = this, i = [r]; r.parent;) i.push(r = r.parent);
- var s, o = i.length;
- for (s = o - 1; s >= 0 && !e.propagationStopped; s--) i[s]._dispatchEvent(e, 1 + (0 == s));
- for (s = 1; o > s && !e.propagationStopped; s++) i[s]._dispatchEvent(e, 3)
- } else this._dispatchEvent(e, 2);
- return e.defaultPrevented
- }, t.hasEventListener = function(e) {
- var t = this._listeners,
- n = this._captureListeners;
- return !!(t && t[e] || n && n[e])
- }, t.willTrigger = function(e) {
- for (var t = this; t;) {
- if (t.hasEventListener(e)) return !0;
- t = t.parent
- }
- return !1
- }, t.toString = function() {
- return "[EventDispatcher]"
- }, t._dispatchEvent = function(e, t) {
- var n, r = 1 == t ? this._captureListeners : this._listeners;
- if (e && r) {
- var i = r[e.type];
- if (!i || !(n = i.length)) return;
- e.currentTarget = this, e.eventPhase = t, e.removed = !1, i = i.slice();
- for (var s = 0; n > s && !e.immediatePropagationStopped; s++) {
- var o = i[s];
- o.handleEvent ? o.handleEvent(e) : o(e), e.removed && (this.off(e.type, o, 1 == t), e.removed = !1)
- }
- }
- }, createjs.EventDispatcher = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- createjs.indexOf = function(e, t) {
- for (var n = 0, r = e.length; r > n; n++)
- if (t === e[n]) return n;
- return -1
- }
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- createjs.proxy = function(e, t) {
- var n = Array.prototype.slice.call(arguments, 2);
- return function() {
- return e.apply(t, Array.prototype.slice.call(arguments, 0).concat(n))
- }
- }
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {
- this.init()
- };
- e.prototype = new createjs.EventDispatcher;
- var t = e.prototype,
- n = e;
- n.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?)|(.{0,2}\/{1}))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/, n.PATH_PATTERN = /^(?:(\w+:)\/{2})|(.{0,2}\/{1})?([/.]*?(?:[^?]+)?\/?)?$/, t.loaded = !1, t.canceled = !1, t.progress = 0, t._item = null, t.getItem = function() {
- return this._item
- }, t.init = function() {}, t.load = function() {}, t.close = function() {}, t._sendLoadStart = function() {
- this._isCanceled() || this.dispatchEvent("loadstart")
- }, t._sendProgress = function(e) {
- if (!this._isCanceled()) {
- var t = null;
- "number" == typeof e ? (this.progress = e, t = new createjs.Event("progress"), t.loaded = this.progress, t.total = 1) : (t = e, this.progress = e.loaded / e.total, (isNaN(this.progress) || 1 / 0 == this.progress) && (this.progress = 0)), t.progress = this.progress, this.hasEventListener("progress") && this.dispatchEvent(t)
- }
- }, t._sendComplete = function() {
- this._isCanceled() || this.dispatchEvent("complete")
- }, t._sendError = function(e) {
- !this._isCanceled() && this.hasEventListener("error") && (null == e && (e = new createjs.Event("error")), this.dispatchEvent(e))
- }, t._isCanceled = function() {
- return null == window.createjs || this.canceled ? !0 : !1
- }, t._parseURI = function(e) {
- return e ? e.match(n.FILE_PATTERN) : null
- }, t._parsePath = function(e) {
- return e ? e.match(n.PATH_PATTERN) : null
- }, t._formatQueryString = function(e, t) {
- if (null == e) throw new Error("You must specify data.");
- var n = [];
- for (var r in e) n.push(r + "=" + escape(e[r]));
- return t && (n = n.concat(t)), n.join("&")
- }, t.buildPath = function(e, t) {
- if (null == t) return e;
- var n = [],
- r = e.indexOf("?");
- if (-1 != r) {
- var i = e.slice(r + 1);
- n = n.concat(i.split("&"))
- }
- return -1 != r ? e.slice(0, r) + "?" + this._formatQueryString(t, n) : e + "?" + this._formatQueryString(t, n)
- }, t._isCrossDomain = function(e) {
- var t = document.createElement("a");
- t.href = e.src;
- var n = document.createElement("a");
- n.href = location.href;
- var r = "" != t.hostname && (t.port != n.port || t.protocol != n.protocol || t.hostname != n.hostname);
- return r
- }, t._isLocal = function(e) {
- var t = document.createElement("a");
- return t.href = e.src, "" == t.hostname && "file:" == t.protocol
- }, t.toString = function() {
- return "[PreloadJS AbstractLoader]"
- }, createjs.AbstractLoader = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.init(e, t, n)
- },
- t = e.prototype = new createjs.AbstractLoader,
- n = e;
- n.loadTimeout = 8e3, n.LOAD_TIMEOUT = 0, n.BINARY = "binary", n.CSS = "css", n.IMAGE = "image", n.JAVASCRIPT = "javascript", n.JSON = "json", n.JSONP = "jsonp", n.MANIFEST = "manifest", n.SOUND = "sound", n.SVG = "svg", n.TEXT = "text", n.XML = "xml", n.POST = "POST", n.GET = "GET", t._basePath = null, t._crossOrigin = "", t.useXHR = !0, t.stopOnError = !1, t.maintainScriptOrder = !0, t.next = null, t._typeCallbacks = null, t._extensionCallbacks = null, t._loadStartWasDispatched = !1, t._maxConnections = 1, t._currentlyLoadingScript = null, t._currentLoads = null, t._loadQueue = null, t._loadQueueBackup = null, t._loadItemsById = null, t._loadItemsBySrc = null, t._loadedResults = null, t._loadedRawResults = null, t._numItems = 0, t._numItemsLoaded = 0, t._scriptOrder = null, t._loadedScripts = null, t.init = function(e, t, n) {
- this._numItems = this._numItemsLoaded = 0, this._paused = !1, this._loadStartWasDispatched = !1, this._currentLoads = [], this._loadQueue = [], this._loadQueueBackup = [], this._scriptOrder = [], this._loadedScripts = [], this._loadItemsById = {}, this._loadItemsBySrc = {}, this._loadedResults = {}, this._loadedRawResults = {}, this._typeCallbacks = {}, this._extensionCallbacks = {}, this._basePath = t, this.setUseXHR(e), this._crossOrigin = n === !0 ? "Anonymous" : n === !1 || null == n ? "" : n
- }, t.setUseXHR = function(e) {
- return this.useXHR = 0 != e && null != window.XMLHttpRequest, this.useXHR
- }, t.removeAll = function() {
- this.remove()
- }, t.remove = function(e) {
- var t = null;
- if (!e || e instanceof Array) {
- if (e) t = e;
- else if (arguments.length > 0) return
- } else t = [e];
- var n = !1;
- if (t) {
- for (; t.length;) {
- var r = t.pop(),
- i = this.getResult(r);
- for (s = this._loadQueue.length - 1; s >= 0; s--)
- if (o = this._loadQueue[s].getItem(), o.id == r || o.src == r) {
- this._loadQueue.splice(s, 1)[0].cancel();
- break
- }
- for (s = this._loadQueueBackup.length - 1; s >= 0; s--)
- if (o = this._loadQueueBackup[s].getItem(), o.id == r || o.src == r) {
- this._loadQueueBackup.splice(s, 1)[0].cancel();
- break
- }
- if (i) delete this._loadItemsById[i.id], delete this._loadItemsBySrc[i.src], this._disposeItem(i);
- else
- for (var s = this._currentLoads.length - 1; s >= 0; s--) {
- var o = this._currentLoads[s].getItem();
- if (o.id == r || o.src == r) {
- this._currentLoads.splice(s, 1)[0].cancel(), n = !0;
- break
- }
- }
- }
- n && this._loadNext()
- } else {
- this.close();
- for (var u in this._loadItemsById) this._disposeItem(this._loadItemsById[u]);
- this.init(this.useXHR)
- }
- }, t.reset = function() {
- this.close();
- for (var e in this._loadItemsById) this._disposeItem(this._loadItemsById[e]);
- for (var t = [], n = 0, r = this._loadQueueBackup.length; r > n; n++) t.push(this._loadQueueBackup[n].getItem());
- this.loadManifest(t, !1)
- }, n.isBinary = function(e) {
- switch (e) {
- case createjs.LoadQueue.IMAGE:
- case createjs.LoadQueue.BINARY:
- return !0;
- default:
- return !1
- }
- }, n.isText = function(e) {
- switch (e) {
- case createjs.LoadQueue.TEXT:
- case createjs.LoadQueue.JSON:
- case createjs.LoadQueue.MANIFEST:
- case createjs.LoadQueue.XML:
- case createjs.LoadQueue.HTML:
- case createjs.LoadQueue.CSS:
- case createjs.LoadQueue.SVG:
- case createjs.LoadQueue.JAVASCRIPT:
- return !0;
- default:
- return !1
- }
- }, t.installPlugin = function(e) {
- if (null != e && null != e.getPreloadHandlers) {
- var t = e.getPreloadHandlers();
- if (t.scope = e, null != t.types)
- for (var n = 0, r = t.types.length; r > n; n++) this._typeCallbacks[t.types[n]] = t;
- if (null != t.extensions)
- for (n = 0, r = t.extensions.length; r > n; n++) this._extensionCallbacks[t.extensions[n]] = t
- }
- }, t.setMaxConnections = function(e) {
- this._maxConnections = e, !this._paused && this._loadQueue.length > 0 && this._loadNext()
- }, t.loadFile = function(e, t, n) {
- if (null == e) {
- var r = new createjs.Event("error");
- return r.text = "PRELOAD_NO_FILE", this._sendError(r), void 0
- }
- this._addItem(e, null, n), t !== !1 ? this.setPaused(!1) : this.setPaused(!0)
- }, t.loadManifest = function(e, t, r) {
- var i = null,
- s = null;
- if (e instanceof Array) {
- if (0 == e.length) {
- var o = new createjs.Event("error");
- return o.text = "PRELOAD_MANIFEST_EMPTY", this._sendError(o), void 0
- }
- i = e
- } else if ("string" == typeof e) i = [{
- src: e,
- type: n.MANIFEST
- }];
- else {
- if ("object" != typeof e) {
- var o = new createjs.Event("error");
- return o.text = "PRELOAD_MANIFEST_NULL", this._sendError(o), void 0
- }
- if (void 0 !== e.src) {
- if (null == e.type) e.type = n.MANIFEST;
- else if (e.type != n.MANIFEST) {
- var o = new createjs.Event("error");
- o.text = "PRELOAD_MANIFEST_ERROR", this._sendError(o)
- }
- i = [e]
- } else void 0 !== e.manifest && (i = e.manifest, s = e.path)
- }
- for (var u = 0, a = i.length; a > u; u++) this._addItem(i[u], s, r);
- t !== !1 ? this.setPaused(!1) : this.setPaused(!0)
- }, t.load = function() {
- this.setPaused(!1)
- }, t.getItem = function(e) {
- return this._loadItemsById[e] || this._loadItemsBySrc[e]
- }, t.getResult = function(e, t) {
- var n = this._loadItemsById[e] || this._loadItemsBySrc[e];
- if (null == n) return null;
- var r = n.id;
- return t && this._loadedRawResults[r] ? this._loadedRawResults[r] : this._loadedResults[r]
- }, t.setPaused = function(e) {
- this._paused = e, this._paused || this._loadNext()
- }, t.close = function() {
- for (; this._currentLoads.length;) this._currentLoads.pop().cancel();
- this._scriptOrder.length = 0, this._loadedScripts.length = 0, this.loadStartWasDispatched = !1
- }, t._addItem = function(e, t, n) {
- var r = this._createLoadItem(e, t, n);
- if (null != r) {
- var i = this._createLoader(r);
- null != i && (this._loadQueue.push(i), this._loadQueueBackup.push(i), this._numItems++, this._updateProgress(), this.maintainScriptOrder && r.type == createjs.LoadQueue.JAVASCRIPT && i instanceof createjs.XHRLoader && (this._scriptOrder.push(r), this._loadedScripts.push(null)))
- }
- }, t._createLoadItem = function(e, t, n) {
- var r = null;
- switch (typeof e) {
- case "string":
- r = {
- src: e
- };
- break;
- case "object":
- r = window.HTMLAudioElement && e instanceof window.HTMLAudioElement ? {
- tag: e,
- src: r.tag.src,
- type: createjs.LoadQueue.SOUND
- } : e;
- break;
- default:
- return null
- }
- var i = this._parseURI(r.src);
- null != i && (r.ext = i[6]), null == r.type && (r.type = this._getTypeByExtension(r.ext));
- var s = "",
- o = n || this._basePath,
- u = r.src;
- if (i && null == i[1] && null == i[3])
- if (t) {
- s = t;
- var a = this._parsePath(t);
- u = t + u, null != o && a && null == a[1] && null == a[2] && (s = o + s)
- } else null != o && (s = o);
- if (r.src = s + r.src, r.path = s, (r.type == createjs.LoadQueue.JSON || r.type == createjs.LoadQueue.MANIFEST) && (r._loadAsJSONP = null != r.callback), r.type == createjs.LoadQueue.JSONP && null == r.callback) throw new Error("callback is required for loading JSONP requests.");
- (void 0 === r.tag || null === r.tag) && (r.tag = this._createTag(r)), (void 0 === r.id || null === r.id || "" === r.id) && (r.id = u);
- var f = this._typeCallbacks[r.type] || this._extensionCallbacks[r.ext];
- if (f) {
- var l = f.callback.call(f.scope, r.src, r.type, r.id, r.data, s, this);
- if (l === !1) return null;
- l === !0 || (null != l.src && (r.src = l.src), null != l.id && (r.id = l.id), null != l.tag && (r.tag = l.tag), null != l.completeHandler && (r.completeHandler = l.completeHandler), l.type && (r.type = l.type), i = this._parseURI(r.src), null != i && null != i[6] && (r.ext = i[6].toLowerCase()))
- }
- return this._loadItemsById[r.id] = r, this._loadItemsBySrc[r.src] = r, r
- }, t._createLoader = function(e) {
- var t = this.useXHR;
- switch (e.type) {
- case createjs.LoadQueue.JSON:
- case createjs.LoadQueue.MANIFEST:
- t = !e._loadAsJSONP;
- break;
- case createjs.LoadQueue.XML:
- case createjs.LoadQueue.TEXT:
- t = !0;
- break;
- case createjs.LoadQueue.SOUND:
- case createjs.LoadQueue.JSONP:
- t = !1;
- break;
- case null:
- return null
- }
- return t ? new createjs.XHRLoader(e, this._crossOrigin) : new createjs.TagLoader(e)
- }, t._loadNext = function() {
- if (!this._paused) {
- this._loadStartWasDispatched || (this._sendLoadStart(), this._loadStartWasDispatched = !0), this._numItems == this._numItemsLoaded ? (this.loaded = !0, this._sendComplete(), this.next && this.next.load && this.next.load()) : this.loaded = !1;
- for (var e = 0; e < this._loadQueue.length && !(this._currentLoads.length >= this._maxConnections); e++) {
- var t = this._loadQueue[e];
- if (this.maintainScriptOrder && t instanceof createjs.TagLoader && t.getItem().type == createjs.LoadQueue.JAVASCRIPT) {
- if (this._currentlyLoadingScript) continue;
- this._currentlyLoadingScript = !0
- }
- this._loadQueue.splice(e, 1), e--, this._loadItem(t)
- }
- }
- }, t._loadItem = function(e) {
- e.on("progress", this._handleProgress, this), e.on("complete", this._handleFileComplete, this), e.on("error", this._handleFileError, this), this._currentLoads.push(e), this._sendFileStart(e.getItem()), e.load()
- }, t._handleFileError = function(e) {
- var t = e.target;
- this._numItemsLoaded++, this._updateProgress();
- var n = new createjs.Event("error");
- n.text = "FILE_LOAD_ERROR", n.item = t.getItem(), this._sendError(n), this.stopOnError || (this._removeLoadItem(t), this._loadNext())
- }, t._handleFileComplete = function(e) {
- var t = e.target,
- n = t.getItem();
- if (this._loadedResults[n.id] = t.getResult(), t instanceof createjs.XHRLoader && (this._loadedRawResults[n.id] = t.getResult(!0)), this._removeLoadItem(t), this.maintainScriptOrder && n.type == createjs.LoadQueue.JAVASCRIPT) {
- if (!(t instanceof createjs.TagLoader)) return this._loadedScripts[createjs.indexOf(this._scriptOrder, n)] = n, this._checkScriptLoadOrder(t), void 0;
- this._currentlyLoadingScript = !1
- }
- if (delete n._loadAsJSONP, n.type == createjs.LoadQueue.MANIFEST) {
- var r = t.getResult();
- null != r && void 0 !== r.manifest && this.loadManifest(r, !0)
- }
- this._processFinishedLoad(n, t)
- }, t._processFinishedLoad = function(e, t) {
- this._numItemsLoaded++, this._updateProgress(), this._sendFileComplete(e, t), this._loadNext()
- }, t._checkScriptLoadOrder = function() {
- for (var e = this._loadedScripts.length, t = 0; e > t; t++) {
- var n = this._loadedScripts[t];
- if (null === n) break;
- if (n !== !0) {
- var r = this._loadedResults[n.id];
- (document.body || document.getElementsByTagName("body")[0]).appendChild(r), this._processFinishedLoad(n), this._loadedScripts[t] = !0
- }
- }
- }, t._removeLoadItem = function(e) {
- for (var t = this._currentLoads.length, n = 0; t > n; n++)
- if (this._currentLoads[n] == e) {
- this._currentLoads.splice(n, 1);
- break
- }
- }, t._handleProgress = function(e) {
- var t = e.target;
- this._sendFileProgress(t.getItem(), t.progress), this._updateProgress()
- }, t._updateProgress = function() {
- var e = this._numItemsLoaded / this._numItems,
- t = this._numItems - this._numItemsLoaded;
- if (t > 0) {
- for (var n = 0, r = 0, i = this._currentLoads.length; i > r; r++) n += this._currentLoads[r].progress;
- e += n / t * (t / this._numItems)
- }
- this._sendProgress(e)
- }, t._disposeItem = function(e) {
- delete this._loadedResults[e.id], delete this._loadedRawResults[e.id], delete this._loadItemsById[e.id], delete this._loadItemsBySrc[e.src]
- }, t._createTag = function(e) {
- var t = null;
- switch (e.type) {
- case createjs.LoadQueue.IMAGE:
- return t = document.createElement("img"), "" == this._crossOrigin || this._isLocal(e) || (t.crossOrigin = this._crossOrigin), t;
- case createjs.LoadQueue.SOUND:
- return t = document.createElement("audio"), t.autoplay = !1, t;
- case createjs.LoadQueue.JSON:
- case createjs.LoadQueue.JSONP:
- case createjs.LoadQueue.JAVASCRIPT:
- case createjs.LoadQueue.MANIFEST:
- return t = document.createElement("script"), t.type = "text/javascript", t;
- case createjs.LoadQueue.CSS:
- return t = this.useXHR ? document.createElement("style") : document.createElement("link"), t.rel = "stylesheet", t.type = "text/css", t;
- case createjs.LoadQueue.SVG:
- return this.useXHR ? t = document.createElement("svg") : (t = document.createElement("object"), t.type = "image/svg+xml"), t
- }
- return null
- }, t._getTypeByExtension = function(e) {
- if (null == e) return createjs.LoadQueue.TEXT;
- switch (e.toLowerCase()) {
- case "jpeg":
- case "jpg":
- case "gif":
- case "png":
- case "webp":
- case "bmp":
- return createjs.LoadQueue.IMAGE;
- case "ogg":
- case "mp3":
- case "wav":
- return createjs.LoadQueue.SOUND;
- case "json":
- return createjs.LoadQueue.JSON;
- case "xml":
- return createjs.LoadQueue.XML;
- case "css":
- return createjs.LoadQueue.CSS;
- case "js":
- return createjs.LoadQueue.JAVASCRIPT;
- case "svg":
- return createjs.LoadQueue.SVG;
- default:
- return createjs.LoadQueue.TEXT
- }
- }, t._sendFileProgress = function(e, t) {
- if (this._isCanceled()) return this._cleanUp(), void 0;
- if (this.hasEventListener("fileprogress")) {
- var n = new createjs.Event("fileprogress");
- n.progress = t, n.loaded = t, n.total = 1, n.item = e, this.dispatchEvent(n)
- }
- }, t._sendFileComplete = function(e, t) {
- if (!this._isCanceled()) {
- var n = new createjs.Event("fileload");
- n.loader = t, n.item = e, n.result = this._loadedResults[e.id], n.rawResult = this._loadedRawResults[e.id], e.completeHandler && e.completeHandler(n), this.hasEventListener("fileload") && this.dispatchEvent(n)
- }
- }, t._sendFileStart = function(e) {
- var t = new createjs.Event("filestart");
- t.item = e, this.hasEventListener("filestart") && this.dispatchEvent(t)
- }, t.toString = function() {
- return "[PreloadJS LoadQueue]"
- }, createjs.LoadQueue = e;
- var r = function() {};
- r.init = function() {
- var e = navigator.userAgent;
- r.isFirefox = e.indexOf("Firefox") > -1, r.isOpera = null != window.opera, r.isChrome = e.indexOf("Chrome") > -1, r.isIOS = e.indexOf("iPod") > -1 || e.indexOf("iPhone") > -1 || e.indexOf("iPad") > -1
- }, r.init(), createjs.LoadQueue.BrowserDetect = r
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e) {
- this.init(e)
- },
- t = e.prototype = new createjs.AbstractLoader;
- t._loadTimeout = null, t._tagCompleteProxy = null, t._isAudio = !1, t._tag = null, t._jsonResult = null, t.init = function(e) {
- this._item = e, this._tag = e.tag, this._isAudio = window.HTMLAudioElement && e.tag instanceof window.HTMLAudioElement, this._tagCompleteProxy = createjs.proxy(this._handleLoad, this)
- }, t.getResult = function() {
- return this._item.type == createjs.LoadQueue.JSONP || this._item.type == createjs.LoadQueue.MANIFEST ? this._jsonResult : this._tag
- }, t.cancel = function() {
- this.canceled = !0, this._clean()
- }, t.load = function() {
- var e = this._item,
- t = this._tag;
- clearTimeout(this._loadTimeout);
- var n = createjs.LoadQueue.LOAD_TIMEOUT;
- 0 == n && (n = createjs.LoadQueue.loadTimeout), this._loadTimeout = setTimeout(createjs.proxy(this._handleTimeout, this), n), this._isAudio && (t.src = null, t.preload = "auto"), t.onerror = createjs.proxy(this._handleError, this), this._isAudio ? (t.onstalled = createjs.proxy(this._handleStalled, this), t.addEventListener("canplaythrough", this._tagCompleteProxy, !1)) : (t.onload = createjs.proxy(this._handleLoad, this), t.onreadystatechange = createjs.proxy(this._handleReadyStateChange, this));
- var r = this.buildPath(e.src, e.values);
- switch (e.type) {
- case createjs.LoadQueue.CSS:
- t.href = r;
- break;
- case createjs.LoadQueue.SVG:
- t.data = r;
- break;
- default:
- t.src = r
- }
- if (e.type == createjs.LoadQueue.JSONP || e.type == createjs.LoadQueue.JSON || e.type == createjs.LoadQueue.MANIFEST) {
- if (null == e.callback) throw new Error("callback is required for loading JSONP requests.");
- if (null != window[e.callback]) throw new Error('JSONP callback "' + e.callback + '" already exists on window. You need to specify a different callback. Or re-name the current one.');
- window[e.callback] = createjs.proxy(this._handleJSONPLoad, this)
- }(e.type == createjs.LoadQueue.SVG || e.type == createjs.LoadQueue.JSONP || e.type == createjs.LoadQueue.JSON || e.type == createjs.LoadQueue.MANIFEST || e.type == createjs.LoadQueue.JAVASCRIPT || e.type == createjs.LoadQueue.CSS) && (this._startTagVisibility = t.style.visibility, t.style.visibility = "hidden", (document.body || document.getElementsByTagName("body")[0]).appendChild(t)), null != t.load && t.load()
- }, t._handleJSONPLoad = function(e) {
- this._jsonResult = e
- }, t._handleTimeout = function() {
- this._clean();
- var e = new createjs.Event("error");
- e.text = "PRELOAD_TIMEOUT", this._sendError(e)
- }, t._handleStalled = function() {}, t._handleError = function() {
- this._clean();
- var e = new createjs.Event("error");
- this._sendError(e)
- }, t._handleReadyStateChange = function() {
- clearTimeout(this._loadTimeout);
- var e = this.getItem().tag;
- ("loaded" == e.readyState || "complete" == e.readyState) && this._handleLoad()
- }, t._handleLoad = function() {
- if (!this._isCanceled()) {
- var e = this.getItem(),
- t = e.tag;
- if (!(this.loaded || this._isAudio && 4 !== t.readyState)) {
- switch (this.loaded = !0, e.type) {
- case createjs.LoadQueue.SVG:
- case createjs.LoadQueue.JSON:
- case createjs.LoadQueue.JSONP:
- case createjs.LoadQueue.MANIFEST:
- case createjs.LoadQueue.CSS:
- t.style.visibility = this._startTagVisibility, (document.body || document.getElementsByTagName("body")[0]).removeChild(t)
- }
- this._clean(), this._sendComplete()
- }
- }
- }, t._clean = function() {
- clearTimeout(this._loadTimeout);
- var e = this.getItem(),
- t = e.tag;
- null != t && (t.onload = null, t.removeEventListener && t.removeEventListener("canplaythrough", this._tagCompleteProxy, !1), t.onstalled = null, t.onprogress = null, t.onerror = null, null != t.parentNode && e.type == createjs.LoadQueue.SVG && e.type == createjs.LoadQueue.JSON && e.type == createjs.LoadQueue.MANIFEST && e.type == createjs.LoadQueue.CSS && e.type == createjs.LoadQueue.JSONP && t.parentNode.removeChild(t));
- var e = this.getItem();
- (e.type == createjs.LoadQueue.JSONP || e.type == createjs.LoadQueue.MANIFEST) && (window[e.callback] = null)
- }, t.toString = function() {
- return "[PreloadJS TagLoader]"
- }, createjs.TagLoader = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t) {
- this.init(e, t)
- },
- t = e.prototype = new createjs.AbstractLoader;
- t._request = null, t._loadTimeout = null, t._xhrLevel = 1, t._response = null, t._rawResponse = null, t._crossOrigin = "", t.init = function(e, t) {
- this._item = e, this._crossOrigin = t, !this._createXHR(e)
- }, t.getResult = function(e) {
- return e && this._rawResponse ? this._rawResponse : this._response
- }, t.cancel = function() {
- this.canceled = !0, this._clean(), this._request.abort()
- }, t.load = function() {
- if (null == this._request) return this._handleError(), void 0;
- if (this._request.onloadstart = createjs.proxy(this._handleLoadStart, this), this._request.onprogress = createjs.proxy(this._handleProgress, this), this._request.onabort = createjs.proxy(this._handleAbort, this), this._request.onerror = createjs.proxy(this._handleError, this), this._request.ontimeout = createjs.proxy(this._handleTimeout, this), 1 == this._xhrLevel) {
- var e = createjs.LoadQueue.LOAD_TIMEOUT;
- if (0 == e) e = createjs.LoadQueue.loadTimeout;
- else try {
- console.warn("LoadQueue.LOAD_TIMEOUT has been deprecated in favor of LoadQueue.loadTimeout")
- } catch (t) {}
- this._loadTimeout = setTimeout(createjs.proxy(this._handleTimeout, this), e)
- }
- this._request.onload = createjs.proxy(this._handleLoad, this), this._request.onreadystatechange = createjs.proxy(this._handleReadyStateChange, this);
- try {
- this._item.values && this._item.method != createjs.LoadQueue.GET ? this._item.method == createjs.LoadQueue.POST && this._request.send(this._formatQueryString(this._item.values)) : this._request.send()
- } catch (n) {
- var r = new createjs.Event("error");
- r.error = n, this._sendError(r)
- }
- }, t.getAllResponseHeaders = function() {
- return this._request.getAllResponseHeaders instanceof Function ? this._request.getAllResponseHeaders() : null
- }, t.getResponseHeader = function(e) {
- return this._request.getResponseHeader instanceof Function ? this._request.getResponseHeader(e) : null
- }, t._handleProgress = function(e) {
- if (e && !(e.loaded > 0 && 0 == e.total)) {
- var t = new createjs.Event("progress");
- t.loaded = e.loaded, t.total = e.total, this._sendProgress(t)
- }
- }, t._handleLoadStart = function() {
- clearTimeout(this._loadTimeout), this._sendLoadStart()
- }, t._handleAbort = function() {
- this._clean();
- var e = new createjs.Event("error");
- e.text = "XHR_ABORTED", this._sendError(e)
- }, t._handleError = function() {
- this._clean();
- var e = new createjs.Event("error");
- this._sendError(e)
- }, t._handleReadyStateChange = function() {
- 4 == this._request.readyState && this._handleLoad()
- }, t._handleLoad = function() {
- if (!this.loaded) {
- if (this.loaded = !0, !this._checkError()) return this._handleError(), void 0;
- this._response = this._getResponse(), this._clean();
- var e = this._generateTag();
- e && this._sendComplete()
- }
- }, t._handleTimeout = function(e) {
- this._clean();
- var t = new createjs.Event("error");
- t.text = "PRELOAD_TIMEOUT", this._sendError(e)
- }, t._checkError = function() {
- var e = parseInt(this._request.status);
- switch (e) {
- case 404:
- case 0:
- return !1
- }
- return !0
- }, t._getResponse = function() {
- if (null != this._response) return this._response;
- if (null != this._request.response) return this._request.response;
- try {
- if (null != this._request.responseText) return this._request.responseText
- } catch (e) {}
- try {
- if (null != this._request.responseXML) return this._request.responseXML
- } catch (e) {}
- return null
- }, t._createXHR = function(e) {
- var t = this._isCrossDomain(e),
- n = null;
- if (t && window.XDomainRequest) n = new XDomainRequest;
- else if (window.XMLHttpRequest) n = new XMLHttpRequest;
- else try {
- n = new ActiveXObject("Msxml2.XMLHTTP.6.0")
- } catch (r) {
- try {
- n = new ActiveXObject("Msxml2.XMLHTTP.3.0")
- } catch (r) {
- try {
- n = new ActiveXObject("Msxml2.XMLHTTP")
- } catch (r) {
- return !1
- }
- }
- }
- createjs.LoadQueue.isText(e.type) && n.overrideMimeType && n.overrideMimeType("text/plain; charset=utf-8"), this._xhrLevel = "string" == typeof n.responseType ? 2 : 1;
- var i = null;
- return i = e.method == createjs.LoadQueue.GET ? this.buildPath(e.src, e.values) : e.src, n.open(e.method || createjs.LoadQueue.GET, i, !0), t && n instanceof XMLHttpRequest && 1 == this._xhrLevel && n.setRequestHeader("Origin", location.origin), e.values && e.method == createjs.LoadQueue.POST && n.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), createjs.LoadQueue.isBinary(e.type) && (n.responseType = "arraybuffer"), this._request = n, !0
- }, t._clean = function() {
- clearTimeout(this._loadTimeout);
- var e = this._request;
- e.onloadstart = null, e.onprogress = null, e.onabort = null, e.onerror = null, e.onload = null, e.ontimeout = null, e.onloadend = null, e.onreadystatechange = null
- }, t._generateTag = function() {
- var e = this._item.type,
- t = this._item.tag;
- switch (e) {
- case createjs.LoadQueue.IMAGE:
- return t.onload = createjs.proxy(this._handleTagReady, this), "" != this._crossOrigin && (t.crossOrigin = "Anonymous"), t.src = this.buildPath(this._item.src, this._item.values), this._rawResponse = this._response, this._response = t, !1;
- case createjs.LoadQueue.JAVASCRIPT:
- return t = document.createElement("script"), t.text = this._response, this._rawResponse = this._response, this._response = t, !0;
- case createjs.LoadQueue.CSS:
- var n = document.getElementsByTagName("head")[0];
- if (n.appendChild(t), t.styleSheet) t.styleSheet.cssText = this._response;
- else {
- var r = document.createTextNode(this._response);
- t.appendChild(r)
- }
- return this._rawResponse = this._response, this._response = t, !0;
- case createjs.LoadQueue.XML:
- var i = this._parseXML(this._response, "text/xml");
- return this._rawResponse = this._response, this._response = i, !0;
- case createjs.LoadQueue.SVG:
- var i = this._parseXML(this._response, "image/svg+xml");
- return this._rawResponse = this._response, null != i.documentElement ? (t.appendChild(i.documentElement), this._response = t) : this._response = i, !0;
- case createjs.LoadQueue.JSON:
- case createjs.LoadQueue.MANIFEST:
- var s = {};
- try {
- s = JSON.parse(this._response)
- } catch (o) {
- s = o
- }
- return this._rawResponse = this._response, this._response = s, !0
- }
- return !0
- }, t._parseXML = function(e, t) {
- var n = null;
- try {
- if (window.DOMParser) {
- var r = new DOMParser;
- n = r.parseFromString(e, t)
- } else n = new ActiveXObject("Microsoft.XMLDOM"), n.async = !1, n.loadXML(e)
- } catch (i) {}
- return n
- }, t._handleTagReady = function() {
- this._sendComplete()
- }, t.toString = function() {
- return "[PreloadJS XHRLoader]"
- }, createjs.XHRLoader = e
- }(), "object" != typeof JSON && (JSON = {}),
- function() {
- "use strict";
- function f(e) {
- return 10 > e ? "0" + e : e
- }
- function quote(e) {
- return escapable.lastIndex = 0, escapable.test(e) ? '"' + e.replace(escapable, function(e) {
- var t = meta[e];
- return "string" == typeof t ? t : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
- }) + '"' : '"' + e + '"'
- }
- function str(e, t) {
- var n, r, i, s, o, u = gap,
- a = t[e];
- switch (a && "object" == typeof a && "function" == typeof a.toJSON && (a = a.toJSON(e)), "function" == typeof rep && (a = rep.call(t, e, a)), typeof a) {
- case "string":
- return quote(a);
- case "number":
- return isFinite(a) ? String(a) : "null";
- case "boolean":
- case "null":
- return String(a);
- case "object":
- if (!a) return "null";
- if (gap += indent, o = [], "[object Array]" === Object.prototype.toString.apply(a)) {
- for (s = a.length, n = 0; s > n; n += 1) o[n] = str(n, a) || "null";
- return i = 0 === o.length ? "[]" : gap ? "[\n" + gap + o.join(",\n" + gap) + "\n" + u + "]" : "[" + o.join(",") + "]", gap = u, i
- }
- if (rep && "object" == typeof rep)
- for (s = rep.length, n = 0; s > n; n += 1) "string" == typeof rep[n] && (r = rep[n], i = str(r, a), i && o.push(quote(r) + (gap ? ": " : ":") + i));
- else
- for (r in a) Object.prototype.hasOwnProperty.call(a, r) && (i = str(r, a), i && o.push(quote(r) + (gap ? ": " : ":") + i));
- return i = 0 === o.length ? "{}" : gap ? "{\n" + gap + o.join(",\n" + gap) + "\n" + u + "}" : "{" + o.join(",") + "}", gap = u, i
- }
- }
- "function" != typeof Date.prototype.toJSON && (Date.prototype.toJSON = function() {
- return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null
- }, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {
- return this.valueOf()
- });
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap, indent, meta = {
- "\b": "\\b",
- " ": "\\t",
- "\n": "\\n",
- "\f": "\\f",
- "\r": "\\r",
- '"': '\\"',
- "\\": "\\\\"
- },
- rep;
- "function" != typeof JSON.stringify && (JSON.stringify = function(e, t, n) {
- var r;
- if (gap = "", indent = "", "number" == typeof n)
- for (r = 0; n > r; r += 1) indent += " ";
- else "string" == typeof n && (indent = n); if (rep = t, t && "function" != typeof t && ("object" != typeof t || "number" != typeof t.length)) throw new Error("JSON.stringify");
- return str("", {
- "": e
- })
- }), "function" != typeof JSON.parse && (JSON.parse = function(text, reviver) {
- function walk(e, t) {
- var n, r, i = e[t];
- if (i && "object" == typeof i)
- for (n in i) Object.prototype.hasOwnProperty.call(i, n) && (r = walk(i, n), void 0 !== r ? i[n] = r : delete i[n]);
- return reviver.call(e, t, i)
- }
- var j;
- if (text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function(e) {
- return "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
- })), /^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), "function" == typeof reviver ? walk({
- "": j
- }, "") : j;
- throw new SyntaxError("JSON.parse")
- })
- }();
- this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- },
- t = e.prototype;
- t.type = null, t.target = null, t.currentTarget = null, t.eventPhase = 0, t.bubbles = !1, t.cancelable = !1, t.timeStamp = 0, t.defaultPrevented = !1, t.propagationStopped = !1, t.immediatePropagationStopped = !1, t.removed = !1, t.initialize = function(e, t, n) {
- this.type = e, this.bubbles = t, this.cancelable = n, this.timeStamp = (new Date).getTime()
- }, t.preventDefault = function() {
- this.defaultPrevented = !0
- }, t.stopPropagation = function() {
- this.propagationStopped = !0
- }, t.stopImmediatePropagation = function() {
- this.immediatePropagationStopped = this.propagationStopped = !0
- }, t.remove = function() {
- this.removed = !0
- }, t.clone = function() {
- return new e(this.type, this.bubbles, this.cancelable)
- }, t.toString = function() {
- return "[Event (type=" + this.type + ")]"
- }, createjs.Event = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {},
- t = e.prototype;
- e.initialize = function(e) {
- e.addEventListener = t.addEventListener, e.on = t.on, e.removeEventListener = e.off = t.removeEventListener, e.removeAllEventListeners = t.removeAllEventListeners, e.hasEventListener = t.hasEventListener, e.dispatchEvent = t.dispatchEvent, e._dispatchEvent = t._dispatchEvent, e.willTrigger = t.willTrigger
- }, t._listeners = null, t._captureListeners = null, t.initialize = function() {}, t.addEventListener = function(e, t, n) {
- var r;
- r = n ? this._captureListeners = this._captureListeners || {} : this._listeners = this._listeners || {};
- var i = r[e];
- return i && this.removeEventListener(e, t, n), i = r[e], i ? i.push(t) : r[e] = [t], t
- }, t.on = function(e, t, n, r, i, s) {
- return t.handleEvent && (n = n || t, t = t.handleEvent), n = n || this, this.addEventListener(e, function(e) {
- t.call(n, e, i), r && e.remove()
- }, s)
- }, t.removeEventListener = function(e, t, n) {
- var r = n ? this._captureListeners : this._listeners;
- if (r) {
- var i = r[e];
- if (i)
- for (var s = 0, o = i.length; o > s; s++)
- if (i[s] == t) {
- 1 == o ? delete r[e] : i.splice(s, 1);
- break
- }
- }
- }, t.off = t.removeEventListener, t.removeAllEventListeners = function(e) {
- e ? (this._listeners && delete this._listeners[e], this._captureListeners && delete this._captureListeners[e]) : this._listeners = this._captureListeners = null
- }, t.dispatchEvent = function(e, t) {
- if ("string" == typeof e) {
- var n = this._listeners;
- if (!n || !n[e]) return !1;
- e = new createjs.Event(e)
- }
- if (e.target = t || this, e.bubbles && this.parent) {
- for (var r = this, i = [r]; r.parent;) i.push(r = r.parent);
- var s, o = i.length;
- for (s = o - 1; s >= 0 && !e.propagationStopped; s--) i[s]._dispatchEvent(e, 1 + (0 == s));
- for (s = 1; o > s && !e.propagationStopped; s++) i[s]._dispatchEvent(e, 3)
- } else this._dispatchEvent(e, 2);
- return e.defaultPrevented
- }, t.hasEventListener = function(e) {
- var t = this._listeners,
- n = this._captureListeners;
- return !!(t && t[e] || n && n[e])
- }, t.willTrigger = function(e) {
- for (var t = this; t;) {
- if (t.hasEventListener(e)) return !0;
- t = t.parent
- }
- return !1
- }, t.toString = function() {
- return "[EventDispatcher]"
- }, t._dispatchEvent = function(e, t) {
- var n, r = 1 == t ? this._captureListeners : this._listeners;
- if (e && r) {
- var i = r[e.type];
- if (!i || !(n = i.length)) return;
- e.currentTarget = this, e.eventPhase = t, e.removed = !1, i = i.slice();
- for (var s = 0; n > s && !e.immediatePropagationStopped; s++) {
- var o = i[s];
- o.handleEvent ? o.handleEvent(e) : o(e), e.removed && (this.off(e.type, o, 1 == t), e.removed = !1)
- }
- }
- }, createjs.EventDispatcher = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- },
- t = e.prototype = new createjs.EventDispatcher;
- e.NONE = 0, e.LOOP = 1, e.REVERSE = 2, e.IGNORE = {}, e._tweens = [], e._plugins = {}, e.get = function(t, n, r, i) {
- return i && e.removeTweens(t), new e(t, n, r)
- }, e.tick = function(t, n) {
- for (var r = e._tweens.slice(), i = r.length - 1; i >= 0; i--) {
- var s = r[i];
- n && !s.ignoreGlobalPause || s._paused || s.tick(s._useTicks ? 1 : t)
- }
- }, e.handleEvent = function(e) {
- "tick" == e.type && this.tick(e.delta, e.paused)
- }, e.removeTweens = function(t) {
- if (t.tweenjs_count) {
- for (var n = e._tweens, r = n.length - 1; r >= 0; r--) n[r]._target == t && (n[r]._paused = !0, n.splice(r, 1));
- t.tweenjs_count = 0
- }
- }, e.removeAllTweens = function() {
- for (var t = e._tweens, n = 0, r = t.length; r > n; n++) {
- var i = t[n];
- i.paused = !0, i.target.tweenjs_count = 0
- }
- t.length = 0
- }, e.hasActiveTweens = function(t) {
- return t ? t.tweenjs_count : e._tweens && !!e._tweens.length
- }, e.installPlugin = function(t, n) {
- var r = t.priority;
- null == r && (t.priority = r = 0);
- for (var i = 0, s = n.length, o = e._plugins; s > i; i++) {
- var u = n[i];
- if (o[u]) {
- for (var f = o[u], l = 0, c = f.length; c > l && !(r < f[l].priority); l++);
- o[u].splice(l, 0, t)
- } else o[u] = [t]
- }
- }, e._register = function(t, n) {
- var r = t._target,
- i = e._tweens;
- if (n) r && (r.tweenjs_count = r.tweenjs_count ? r.tweenjs_count + 1 : 1), i.push(t), !e._inited && createjs.Ticker && (createjs.Ticker.addEventListener("tick", e), e._inited = !0);
- else {
- r && r.tweenjs_count--;
- for (var s = i.length; s--;)
- if (i[s] == t) return i.splice(s, 1), void 0
- }
- }, t.ignoreGlobalPause = !1, t.loop = !1, t.duration = 0, t.pluginData = null, t.target = null, t.position = null, t.passive = !1, t._paused = !1, t._curQueueProps = null, t._initQueueProps = null, t._steps = null, t._actions = null, t._prevPosition = 0, t._stepPosition = 0, t._prevPos = -1, t._target = null, t._useTicks = !1, t._inited = !1, t.initialize = function(t, n, r) {
- this.target = this._target = t, n && (this._useTicks = n.useTicks, this.ignoreGlobalPause = n.ignoreGlobalPause, this.loop = n.loop, n.onChange && this.addEventListener("change", n.onChange), n.override && e.removeTweens(t)), this.pluginData = r || {}, this._curQueueProps = {}, this._initQueueProps = {}, this._steps = [], this._actions = [], n && n.paused ? this._paused = !0 : e._register(this, !0), n && null != n.position && this.setPosition(n.position, e.NONE)
- }, t.wait = function(e, t) {
- if (null == e || 0 >= e) return this;
- var n = this._cloneProps(this._curQueueProps);
- return this._addStep({
- d: e,
- p0: n,
- e: this._linearEase,
- p1: n,
- v: t
- })
- }, t.to = function(e, t, n) {
- return (isNaN(t) || 0 > t) && (t = 0), this._addStep({
- d: t || 0,
- p0: this._cloneProps(this._curQueueProps),
- e: n,
- p1: this._cloneProps(this._appendQueueProps(e))
- })
- }, t.call = function(e, t, n) {
- return this._addAction({
- f: e,
- p: t ? t : [this],
- o: n ? n : this._target
- })
- }, t.set = function(e, t) {
- return this._addAction({
- f: this._set,
- o: this,
- p: [e, t ? t : this._target]
- })
- }, t.play = function(e) {
- return e || (e = this), this.call(e.setPaused, [!1], e)
- }, t.pause = function(e) {
- return e || (e = this), this.call(e.setPaused, [!0], e)
- }, t.setPosition = function(e, t) {
- 0 > e && (e = 0), null == t && (t = 1);
- var n = e,
- r = !1;
- if (n >= this.duration && (this.loop ? n %= this.duration : (n = this.duration, r = !0)), n == this._prevPos) return r;
- var i = this._prevPos;
- if (this.position = this._prevPos = n, this._prevPosition = e, this._target)
- if (r) this._updateTargetProps(null, 1);
- else if (this._steps.length > 0) {
- for (var s = 0, o = this._steps.length; o > s && !(this._steps[s].t > n); s++);
- var u = this._steps[s - 1];
- this._updateTargetProps(u, (this._stepPosition = n - u.t) / u.d)
- }
- return 0 != t && this._actions.length > 0 && (this._useTicks ? this._runActions(n, n) : 1 == t && i > n ? (i != this.duration && this._runActions(i, this.duration), this._runActions(0, n, !0)) : this._runActions(i, n)), r && this.setPaused(!0), this.dispatchEvent("change"), r
- }, t.tick = function(e) {
- this._paused || this.setPosition(this._prevPosition + e)
- }, t.setPaused = function(t) {
- return this._paused = !!t, e._register(this, !t), this
- }, t.w = t.wait, t.t = t.to, t.c = t.call, t.s = t.set, t.toString = function() {
- return "[Tween]"
- }, t.clone = function() {
- throw "Tween can not be cloned."
- }, t._updateTargetProps = function(t, n) {
- var r, i, s, o, u, f;
- if (t || 1 != n) {
- if (this.passive = !!t.v, this.passive) return;
- t.e && (n = t.e(n, 0, 1, 1)), r = t.p0, i = t.p1
- } else this.passive = !1, r = i = this._curQueueProps;
- for (var l in this._initQueueProps) {
- null == (o = r[l]) && (r[l] = o = this._initQueueProps[l]), null == (u = i[l]) && (i[l] = u = o), s = o == u || 0 == n || 1 == n || "number" != typeof o ? 1 == n ? u : o : o + (u - o) * n;
- var c = !1;
- if (f = e._plugins[l])
- for (var h = 0, p = f.length; p > h; h++) {
- var d = f[h].tween(this, l, s, r, i, n, !!t && r == i, !t);
- d == e.IGNORE ? c = !0 : s = d
- }
- c || (this._target[l] = s)
- }
- }, t._runActions = function(e, t, n) {
- var r = e,
- i = t,
- s = -1,
- o = this._actions.length,
- u = 1;
- for (e > t && (r = t, i = e, s = o, o = u = -1);
- (s += u) != o;) {
- var a = this._actions[s],
- f = a.t;
- (f == i || f > r && i > f || n && f == e) && a.f.apply(a.o, a.p)
- }
- }, t._appendQueueProps = function(t) {
- var n, r, i, s, o;
- for (var u in t)
- if (void 0 === this._initQueueProps[u]) {
- if (r = this._target[u], n = e._plugins[u])
- for (i = 0, s = n.length; s > i; i++) r = n[i].init(this, u, r);
- this._initQueueProps[u] = this._curQueueProps[u] = void 0 === r ? null : r
- } else r = this._curQueueProps[u];
- for (var u in t) {
- if (r = this._curQueueProps[u], n = e._plugins[u])
- for (o = o || {}, i = 0, s = n.length; s > i; i++) n[i].step && n[i].step(this, u, r, t[u], o);
- this._curQueueProps[u] = t[u]
- }
- return o && this._appendQueueProps(o), this._curQueueProps
- }, t._cloneProps = function(e) {
- var t = {};
- for (var n in e) t[n] = e[n];
- return t
- }, t._addStep = function(e) {
- return e.d > 0 && (this._steps.push(e), e.t = this.duration, this.duration += e.d), this
- }, t._addAction = function(e) {
- return e.t = this.duration, this._actions.push(e), this
- }, t._set = function(e, t) {
- for (var n in e) t[n] = e[n]
- }, createjs.Tween = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- },
- t = e.prototype = new createjs.EventDispatcher;
- t.ignoreGlobalPause = !1, t.duration = 0, t.loop = !1, t.position = null, t._paused = !1, t._tweens = null, t._labels = null, t._labelList = null, t._prevPosition = 0, t._prevPos = -1, t._useTicks = !1, t.initialize = function(e, t, n) {
- this._tweens = [], n && (this._useTicks = n.useTicks, this.loop = n.loop, this.ignoreGlobalPause = n.ignoreGlobalPause, n.onChange && this.addEventListener("change", n.onChange)), e && this.addTween.apply(this, e), this.setLabels(t), n && n.paused ? this._paused = !0 : createjs.Tween._register(this, !0), n && null != n.position && this.setPosition(n.position, createjs.Tween.NONE)
- }, t.addTween = function(e) {
- var t = arguments.length;
- if (t > 1) {
- for (var n = 0; t > n; n++) this.addTween(arguments[n]);
- return arguments[0]
- }
- return 0 == t ? null : (this.removeTween(e), this._tweens.push(e), e.setPaused(!0), e._paused = !1, e._useTicks = this._useTicks, e.duration > this.duration && (this.duration = e.duration), this._prevPos >= 0 && e.setPosition(this._prevPos, createjs.Tween.NONE), e)
- }, t.removeTween = function(e) {
- var t = arguments.length;
- if (t > 1) {
- for (var n = !0, r = 0; t > r; r++) n = n && this.removeTween(arguments[r]);
- return n
- }
- if (0 == t) return !1;
- for (var i = this._tweens, r = i.length; r--;)
- if (i[r] == e) return i.splice(r, 1), e.duration >= this.duration && this.updateDuration(), !0;
- return !1
- }, t.addLabel = function(e, t) {
- this._labels[e] = t;
- var n = this._labelList;
- if (n) {
- for (var r = 0, i = n.length; i > r && !(t < n[r].position); r++);
- n.splice(r, 0, {
- label: e,
- position: t
- })
- }
- }, t.setLabels = function(e) {
- this._labels = e ? e : {}
- }, t.getLabels = function() {
- var e = this._labelList;
- if (!e) {
- e = this._labelList = [];
- var t = this._labels;
- for (var n in t) e.push({
- label: n,
- position: t[n]
- });
- e.sort(function(e, t) {
- return e.position - t.position
- })
- }
- return e
- }, t.getCurrentLabel = function() {
- var e = this.getLabels(),
- t = this.position,
- n = e.length;
- if (n) {
- for (var r = 0; n > r && !(t < e[r].position); r++);
- return 0 == r ? null : e[r - 1].label
- }
- return null
- }, t.gotoAndPlay = function(e) {
- this.setPaused(!1), this._goto(e)
- }, t.gotoAndStop = function(e) {
- this.setPaused(!0), this._goto(e)
- }, t.setPosition = function(e, t) {
- 0 > e && (e = 0);
- var n = this.loop ? e % this.duration : e,
- r = !this.loop && e >= this.duration;
- if (n == this._prevPos) return r;
- this._prevPosition = e, this.position = this._prevPos = n;
- for (var i = 0, s = this._tweens.length; s > i; i++)
- if (this._tweens[i].setPosition(n, t), n != this._prevPos) return !1;
- return r && this.setPaused(!0), this.dispatchEvent("change"), r
- }, t.setPaused = function(e) {
- this._paused = !!e, createjs.Tween._register(this, !e)
- }, t.updateDuration = function() {
- this.duration = 0;
- for (var e = 0, t = this._tweens.length; t > e; e++) {
- var n = this._tweens[e];
- n.duration > this.duration && (this.duration = n.duration)
- }
- }, t.tick = function(e) {
- this.setPosition(this._prevPosition + e)
- }, t.resolve = function(e) {
- var t = parseFloat(e);
- return isNaN(t) && (t = this._labels[e]), t
- }, t.toString = function() {
- return "[Timeline]"
- }, t.clone = function() {
- throw "Timeline can not be cloned."
- }, t._goto = function(e) {
- var t = this.resolve(e);
- null != t && this.setPosition(t)
- }, createjs.Timeline = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {
- throw "Ease cannot be instantiated."
- };
- e.linear = function(e) {
- return e
- }, e.none = e.linear, e.get = function(e) {
- return -1 > e && (e = -1), e > 1 && (e = 1),
- function(t) {
- return 0 == e ? t : 0 > e ? t * (t * -e + 1 + e) : t * ((2 - t) * e + (1 - e))
- }
- }, e.getPowIn = function(e) {
- return function(t) {
- return Math.pow(t, e)
- }
- }, e.getPowOut = function(e) {
- return function(t) {
- return 1 - Math.pow(1 - t, e)
- }
- }, e.getPowInOut = function(e) {
- return function(t) {
- return (t *= 2) < 1 ? .5 * Math.pow(t, e) : 1 - .5 * Math.abs(Math.pow(2 - t, e))
- }
- }, e.quadIn = e.getPowIn(2), e.quadOut = e.getPowOut(2), e.quadInOut = e.getPowInOut(2), e.cubicIn = e.getPowIn(3), e.cubicOut = e.getPowOut(3), e.cubicInOut = e.getPowInOut(3), e.quartIn = e.getPowIn(4), e.quartOut = e.getPowOut(4), e.quartInOut = e.getPowInOut(4), e.quintIn = e.getPowIn(5), e.quintOut = e.getPowOut(5), e.quintInOut = e.getPowInOut(5), e.sineIn = function(e) {
- return 1 - Math.cos(e * Math.PI / 2)
- }, e.sineOut = function(e) {
- return Math.sin(e * Math.PI / 2)
- }, e.sineInOut = function(e) {
- return -.5 * (Math.cos(Math.PI * e) - 1)
- }, e.getBackIn = function(e) {
- return function(t) {
- return t * t * ((e + 1) * t - e)
- }
- }, e.backIn = e.getBackIn(1.7), e.getBackOut = function(e) {
- return function(t) {
- return --t * t * ((e + 1) * t + e) + 1
- }
- }, e.backOut = e.getBackOut(1.7), e.getBackInOut = function(e) {
- return e *= 1.525,
- function(t) {
- return (t *= 2) < 1 ? .5 * t * t * ((e + 1) * t - e) : .5 * ((t -= 2) * t * ((e + 1) * t + e) + 2)
- }
- }, e.backInOut = e.getBackInOut(1.7), e.circIn = function(e) {
- return -(Math.sqrt(1 - e * e) - 1)
- }, e.circOut = function(e) {
- return Math.sqrt(1 - --e * e)
- }, e.circInOut = function(e) {
- return (e *= 2) < 1 ? -.5 * (Math.sqrt(1 - e * e) - 1) : .5 * (Math.sqrt(1 - (e -= 2) * e) + 1)
- }, e.bounceIn = function(t) {
- return 1 - e.bounceOut(1 - t)
- }, e.bounceOut = function(e) {
- return 1 / 2.75 > e ? 7.5625 * e * e : 2 / 2.75 > e ? 7.5625 * (e -= 1.5 / 2.75) * e + .75 : 2.5 / 2.75 > e ? 7.5625 * (e -= 2.25 / 2.75) * e + .9375 : 7.5625 * (e -= 2.625 / 2.75) * e + .984375
- }, e.bounceInOut = function(t) {
- return .5 > t ? .5 * e.bounceIn(2 * t) : .5 * e.bounceOut(2 * t - 1) + .5
- }, e.getElasticIn = function(e, t) {
- var n = 2 * Math.PI;
- return function(r) {
- if (0 == r || 1 == r) return r;
- var i = t / n * Math.asin(1 / e);
- return -(e * Math.pow(2, 10 * (r -= 1)) * Math.sin((r - i) * n / t))
- }
- }, e.elasticIn = e.getElasticIn(1, .3), e.getElasticOut = function(e, t) {
- var n = 2 * Math.PI;
- return function(r) {
- if (0 == r || 1 == r) return r;
- var i = t / n * Math.asin(1 / e);
- return e * Math.pow(2, -10 * r) * Math.sin((r - i) * n / t) + 1
- }
- }, e.elasticOut = e.getElasticOut(1, .3), e.getElasticInOut = function(e, t) {
- var n = 2 * Math.PI;
- return function(r) {
- var i = t / n * Math.asin(1 / e);
- return (r *= 2) < 1 ? -.5 * e * Math.pow(2, 10 * (r -= 1)) * Math.sin((r - i) * n / t) : .5 * e * Math.pow(2, -10 * (r -= 1)) * Math.sin((r - i) * n / t) + 1
- }
- }, e.elasticInOut = e.getElasticInOut(1, .3 * 1.5), createjs.Ease = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {
- throw "MotionGuidePlugin cannot be instantiated."
- };
- e.priority = 0, e._rotOffS, e._rotOffE, e._rotNormS, e._rotNormE, e.install = function() {
- return createjs.Tween.installPlugin(e, ["guide", "x", "y", "rotation"]), createjs.Tween.IGNORE
- }, e.init = function(e, t, n) {
- var r = e.target;
- return r.hasOwnProperty("x") || (r.x = 0), r.hasOwnProperty("y") || (r.y = 0), r.hasOwnProperty("rotation") || (r.rotation = 0), "rotation" == t && (e.__needsRot = !0), "guide" == t ? null : n
- }, e.step = function(t, n, r, i, s) {
- if ("rotation" == n && (t.__rotGlobalS = r, t.__rotGlobalE = i, e.testRotData(t, s)), "guide" != n) return i;
- var o, u = i;
- u.hasOwnProperty("path") || (u.path = []);
- var f = u.path;
- if (u.hasOwnProperty("end") || (u.end = 1), u.hasOwnProperty("start") || (u.start = r && r.hasOwnProperty("end") && r.path === f ? r.end : 0), u.hasOwnProperty("_segments") && u._length) return i;
- var l = f.length,
- c = 10;
- if (!(l >= 6 && 0 == (l - 2) % 4)) throw "invalid 'path' data, please see documentation for valid paths";
- u._segments = [], u._length = 0;
- for (var h = 2; l > h; h += 4) {
- for (var p, d, v = f[h - 2], m = f[h - 1], g = f[h + 0], y = f[h + 1], b = f[h + 2], w = f[h + 3], E = v, S = m, x = 0, T = [], N = 1; c >= N; N++) {
- var C = N / c,
- k = 1 - C;
- p = k * k * v + 2 * k * C * g + C * C * b, d = k * k * m + 2 * k * C * y + C * C * w, x += T[T.push(Math.sqrt((o = p - E) * o + (o = d - S) * o)) - 1], E = p, S = d
- }
- u._segments.push(x), u._segments.push(T), u._length += x
- }
- o = u.orient, u.orient = !0;
- var L = {};
- return e.calc(u, u.start, L), t.__rotPathS = Number(L.rotation.toFixed(5)), e.calc(u, u.end, L), t.__rotPathE = Number(L.rotation.toFixed(5)), u.orient = !1, e.calc(u, u.end, s), u.orient = o, u.orient ? (t.__guideData = u, e.testRotData(t, s), i) : i
- }, e.testRotData = function(e, t) {
- if (void 0 === e.__rotGlobalS || void 0 === e.__rotGlobalE) {
- if (e.__needsRot) return;
- e.__rotGlobalS = e.__rotGlobalE = void 0 !== e._curQueueProps.rotation ? e._curQueueProps.rotation : t.rotation = e.target.rotation || 0
- }
- if (void 0 !== e.__guideData) {
- var n = e.__guideData,
- r = e.__rotGlobalE - e.__rotGlobalS,
- i = e.__rotPathE - e.__rotPathS,
- s = r - i;
- if ("auto" == n.orient) s > 180 ? s -= 360 : -180 > s && (s += 360);
- else if ("cw" == n.orient) {
- for (; 0 > s;) s += 360;
- 0 == s && r > 0 && 180 != r && (s += 360)
- } else if ("ccw" == n.orient) {
- for (s = r - (i > 180 ? 360 - i : i); s > 0;) s -= 360;
- 0 == s && 0 > r && -180 != r && (s -= 360)
- }
- n.rotDelta = s, n.rotOffS = e.__rotGlobalS - e.__rotPathS, e.__rotGlobalS = e.__rotGlobalE = e.__guideData = e.__needsRot = void 0
- }
- }, e.tween = function(t, n, r, i, s, o, u) {
- var f = s.guide;
- if (void 0 == f || f === i.guide) return r;
- if (f.lastRatio != o) {
- var l = (f.end - f.start) * (u ? f.end : o) + f.start;
- switch (e.calc(f, l, t.target), f.orient) {
- case "cw":
- case "ccw":
- case "auto":
- t.target.rotation += f.rotOffS + f.rotDelta * o;
- break;
- case "fixed":
- default:
- t.target.rotation += f.rotOffS
- }
- f.lastRatio = o
- }
- return "rotation" != n || f.orient && "false" != f.orient ? t.target[n] : r
- }, e.calc = function(t, n, r) {
- void 0 == t._segments && e.validate(t), void 0 == r && (r = {
- x: 0,
- y: 0,
- rotation: 0
- });
- for (var i = t._segments, s = t.path, o = t._length * n, u = i.length - 2, f = 0; o > i[f] && u > f;) o -= i[f], f += 2;
- var l = i[f + 1],
- c = 0;
- for (u = l.length - 1; o > l[c] && u > c;) o -= l[c], c++;
- var h = c / ++u + o / (u * l[c]);
- f = 2 * f + 2;
- var p = 1 - h;
- return r.x = p * p * s[f - 2] + 2 * p * h * s[f + 0] + h * h * s[f + 2], r.y = p * p * s[f - 1] + 2 * p * h * s[f + 1] + h * h * s[f + 3], t.orient && (r.rotation = 57.2957795 * Math.atan2((s[f + 1] - s[f - 1]) * p + (s[f + 3] - s[f + 1]) * h, (s[f + 0] - s[f - 2]) * p + (s[f + 2] - s[f + 0]) * h)), r
- }, createjs.MotionGuidePlugin = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = createjs.TweenJS = createjs.TweenJS || {};
- e.version = "0.5.1", e.buildDate = "Thu, 12 Dec 2013 23:33:38 GMT"
- }();
- this.createjs = this.createjs || {},
- function() {
- var e = createjs.SoundJS = createjs.SoundJS || {};
- e.version = "0.5.2", e.buildDate = "Thu, 12 Dec 2013 23:33:37 GMT"
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function() {},
- t = e.prototype;
- e.initialize = function(e) {
- e.addEventListener = t.addEventListener, e.on = t.on, e.removeEventListener = e.off = t.removeEventListener, e.removeAllEventListeners = t.removeAllEventListeners, e.hasEventListener = t.hasEventListener, e.dispatchEvent = t.dispatchEvent, e._dispatchEvent = t._dispatchEvent, e.willTrigger = t.willTrigger
- }, t._listeners = null, t._captureListeners = null, t.initialize = function() {}, t.addEventListener = function(e, t, n) {
- var r;
- r = n ? this._captureListeners = this._captureListeners || {} : this._listeners = this._listeners || {};
- var i = r[e];
- return i && this.removeEventListener(e, t, n), i = r[e], i ? i.push(t) : r[e] = [t], t
- }, t.on = function(e, t, n, r, i, s) {
- return t.handleEvent && (n = n || t, t = t.handleEvent), n = n || this, this.addEventListener(e, function(e) {
- t.call(n, e, i), r && e.remove()
- }, s)
- }, t.removeEventListener = function(e, t, n) {
- var r = n ? this._captureListeners : this._listeners;
- if (r) {
- var i = r[e];
- if (i)
- for (var s = 0, o = i.length; o > s; s++)
- if (i[s] == t) {
- 1 == o ? delete r[e] : i.splice(s, 1);
- break
- }
- }
- }, t.off = t.removeEventListener, t.removeAllEventListeners = function(e) {
- e ? (this._listeners && delete this._listeners[e], this._captureListeners && delete this._captureListeners[e]) : this._listeners = this._captureListeners = null
- }, t.dispatchEvent = function(e, t) {
- if ("string" == typeof e) {
- var n = this._listeners;
- if (!n || !n[e]) return !1;
- e = new createjs.Event(e)
- }
- if (e.target = t || this, e.bubbles && this.parent) {
- for (var r = this, i = [r]; r.parent;) i.push(r = r.parent);
- var s, o = i.length;
- for (s = o - 1; s >= 0 && !e.propagationStopped; s--) i[s]._dispatchEvent(e, 1 + (0 == s));
- for (s = 1; o > s && !e.propagationStopped; s++) i[s]._dispatchEvent(e, 3)
- } else this._dispatchEvent(e, 2);
- return e.defaultPrevented
- }, t.hasEventListener = function(e) {
- var t = this._listeners,
- n = this._captureListeners;
- return !!(t && t[e] || n && n[e])
- }, t.willTrigger = function(e) {
- for (var t = this; t;) {
- if (t.hasEventListener(e)) return !0;
- t = t.parent
- }
- return !1
- }, t.toString = function() {
- return "[EventDispatcher]"
- }, t._dispatchEvent = function(e, t) {
- var n, r = 1 == t ? this._captureListeners : this._listeners;
- if (e && r) {
- var i = r[e.type];
- if (!i || !(n = i.length)) return;
- e.currentTarget = this, e.eventPhase = t, e.removed = !1, i = i.slice();
- for (var s = 0; n > s && !e.immediatePropagationStopped; s++) {
- var o = i[s];
- o.handleEvent ? o.handleEvent(e) : o(e), e.removed && (this.off(e.type, o, 1 == t), e.removed = !1)
- }
- }
- }, createjs.EventDispatcher = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- var e = function(e, t, n) {
- this.initialize(e, t, n)
- },
- t = e.prototype;
- t.type = null, t.target = null, t.currentTarget = null, t.eventPhase = 0, t.bubbles = !1, t.cancelable = !1, t.timeStamp = 0, t.defaultPrevented = !1, t.propagationStopped = !1, t.immediatePropagationStopped = !1, t.removed = !1, t.initialize = function(e, t, n) {
- this.type = e, this.bubbles = t, this.cancelable = n, this.timeStamp = (new Date).getTime()
- }, t.preventDefault = function() {
- this.defaultPrevented = !0
- }, t.stopPropagation = function() {
- this.propagationStopped = !0
- }, t.stopImmediatePropagation = function() {
- this.immediatePropagationStopped = this.propagationStopped = !0
- }, t.remove = function() {
- this.removed = !0
- }, t.clone = function() {
- return new e(this.type, this.bubbles, this.cancelable)
- }, t.toString = function() {
- return "[Event (type=" + this.type + ")]"
- }, createjs.Event = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- createjs.indexOf = function(e, t) {
- for (var n = 0, r = e.length; r > n; n++)
- if (t === e[n]) return n;
- return -1
- }
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- createjs.proxy = function(e, t) {
- var n = Array.prototype.slice.call(arguments, 2);
- return function() {
- return e.apply(t, Array.prototype.slice.call(arguments, 0).concat(n))
- }
- }
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- function e() {
- throw "Sound cannot be instantiated"
- }
- function t(e, t) {
- this.init(e, t)
- }
- function n() {
- this.isDefault = !0, this.addEventListener = this.removeEventListener = this.removeAllEventListeners = this.dispatchEvent = this.hasEventListener = this._listeners = this._interrupt = this._playFailed = this.pause = this.resume = this.play = this._beginPlaying = this._cleanUp = this.stop = this.setMasterVolume = this.setVolume = this.mute = this.setMute = this.getMute = this.setPan = this.getPosition = this.setPosition = this.playFailed = function() {
- return !1
- }, this.getVolume = this.getPan = this.getDuration = function() {
- return 0
- }, this.playState = e.PLAY_FAILED, this.toString = function() {
- return "[Sound Default Sound Instance]"
- }
- }
- function r() {}
- var i = e;
- i.DELIMITER = "|", i.INTERRUPT_ANY = "any", i.INTERRUPT_EARLY = "early", i.INTERRUPT_LATE = "late", i.INTERRUPT_NONE = "none", i.PLAY_INITED = "playInited", i.PLAY_SUCCEEDED = "playSucceeded", i.PLAY_INTERRUPTED = "playInterrupted", i.PLAY_FINISHED = "playFinished", i.PLAY_FAILED = "playFailed", i.SUPPORTED_EXTENSIONS = ["mp3", "ogg", "mpeg", "wav", "m4a", "mp4", "aiff", "wma", "mid"], i.EXTENSION_MAP = {
- m4a: "mp4"
- }, i.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/, i.defaultInterruptBehavior = i.INTERRUPT_NONE, i.alternateExtensions = [], i._lastID = 0, i.activePlugin = null, i._pluginsRegistered = !1, i._masterVolume = 1, i._masterMute = !1, i._instances = [], i._idHash = {}, i._preloadHash = {}, i._defaultSoundInstance = null, i.addEventListener = null, i.removeEventListener = null, i.removeAllEventListeners = null, i.dispatchEvent = null, i.hasEventListener = null, i._listeners = null, createjs.EventDispatcher.initialize(i), i._sendFileLoadEvent = function(e) {
- if (i._preloadHash[e])
- for (var t = 0, n = i._preloadHash[e].length; n > t; t++) {
- var r = i._preloadHash[e][t];
- if (i._preloadHash[e][t] = !0, i.hasEventListener("fileload")) {
- var s = new createjs.Event("fileload");
- s.src = r.src, s.id = r.id, s.data = r.data, i.dispatchEvent(s)
- }
- }
- }, i.getPreloadHandlers = function() {
- return {
- callback: createjs.proxy(i.initLoad, i),
- types: ["sound"],
- extensions: i.SUPPORTED_EXTENSIONS
- }
- }, i.registerPlugin = function(e) {
- try {
- console.log("createjs.Sound.registerPlugin has been deprecated. Please use registerPlugins.")
- } catch (t) {}
- return i._registerPlugin(e)
- }, i._registerPlugin = function(e) {
- return i._pluginsRegistered = !0, null == e ? !1 : e.isSupported() ? (i.activePlugin = new e, !0) : !1
- }, i.registerPlugins = function(e) {
- for (var t = 0, n = e.length; n > t; t++) {
- var r = e[t];
- if (i._registerPlugin(r)) return !0
- }
- return !1
- }, i.initializeDefaultPlugins = function() {
- return null != i.activePlugin ? !0 : i._pluginsRegistered ? !1 : i.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin]) ? !0 : !1
- }, i.isReady = function() {
- return null != i.activePlugin
- }, i.getCapabilities = function() {
- return null == i.activePlugin ? null : i.activePlugin._capabilities
- }, i.getCapability = function(e) {
- return null == i.activePlugin ? null : i.activePlugin._capabilities[e]
- }, i.initLoad = function(e, t, n, r, s) {
- e = e.replace(s, "");
- var o = i.registerSound(e, n, r, !1, s);
- return null == o ? !1 : o
- }, i.registerSound = function(e, n, r, s, o) {
- if (!i.initializeDefaultPlugins()) return !1;
- if (e instanceof Object && (o = n, n = e.id, r = e.data, e = e.src), i.alternateExtensions.length) var u = i._parsePath2(e, "sound", n, r);
- else var u = i._parsePath(e, "sound", n, r); if (null == u) return !1;
- null != o && (e = o + e, u.src = o + u.src), null != n && (i._idHash[n] = u.src);
- var a = null;
- null != r && (isNaN(r.channels) ? isNaN(r) || (a = parseInt(r)) : a = parseInt(r.channels));
- var f = i.activePlugin.register(u.src, a);
- if (null != f && (null != f.numChannels && (a = f.numChannels), t.create(u.src, a), null != r && isNaN(r) ? r.channels = u.data.channels = a || t.maxPerChannel() : r = u.data = a || t.maxPerChannel(), null != f.tag ? u.tag = f.tag : f.src && (u.src = f.src), null != f.completeHandler && (u.completeHandler = f.completeHandler), f.type && (u.type = f.type)), 0 != s)
- if (i._preloadHash[u.src] || (i._preloadHash[u.src] = []), i._preloadHash[u.src].push({
- src: e,
- id: n,
- data: r
- }), 1 == i._preloadHash[u.src].length) i.activePlugin.preload(u.src, f);
- else if (1 == i._preloadHash[u.src][0]) return !0;
- return u
- }, i.registerManifest = function(e, t) {
- for (var n = [], r = 0, i = e.length; i > r; r++) n[r] = createjs.Sound.registerSound(e[r].src, e[r].id, e[r].data, e[r].preload, t);
- return n
- }, i.removeSound = function(e, n) {
- if (null == i.activePlugin) return !1;
- if (e instanceof Object && (e = e.src), e = i._getSrcById(e), i.alternateExtensions.length) var r = i._parsePath2(e);
- else var r = i._parsePath(e); if (null == r) return !1;
- null != n && (r.src = n + r.src), e = r.src;
- for (var s in i._idHash) i._idHash[s] == e && delete i._idHash[s];
- return t.removeSrc(e), delete i._preloadHash[e], i.activePlugin.removeSound(e), !0
- }, i.removeManifest = function(e, t) {
- for (var n = [], r = 0, i = e.length; i > r; r++) n[r] = createjs.Sound.removeSound(e[r].src, t);
- return n
- }, i.removeAllSounds = function() {
- i._idHash = {}, i._preloadHash = {}, t.removeAll(), i.activePlugin.removeAllSounds()
- }, i.loadComplete = function(e) {
- if (i.alternateExtensions.length) var t = i._parsePath2(e, "sound");
- else var t = i._parsePath(e, "sound");
- return e = t ? i._getSrcById(t.src) : i._getSrcById(e), 1 == i._preloadHash[e][0]
- }, i._parsePath = function(e, t, n, r) {
- "string" != typeof e && (e = e.toString());
- var s = e.split(i.DELIMITER);
- if (s.length > 1) try {
- console.log('createjs.Sound.DELIMITER "|" loading approach has been deprecated. Please use the new alternateExtensions property.')
- } catch (o) {}
- for (var u = {
- type: t || "sound",
- id: n,
- data: r
- }, a = i.getCapabilities(), f = 0, l = s.length; l > f; f++) {
- var c = s[f],
- h = c.match(i.FILE_PATTERN);
- if (null == h) return !1;
- var p = h[4],
- d = h[5];
- if (a[d] && createjs.indexOf(i.SUPPORTED_EXTENSIONS, d) > -1) return u.name = p, u.src = c, u.extension = d, u
- }
- return null
- }, i._parsePath2 = function(e, t, n, r) {
- "string" != typeof e && (e = e.toString());
- var s = e.match(i.FILE_PATTERN);
- if (null == s) return !1;
- for (var o = s[4], u = s[5], a = i.getCapabilities(), f = 0; !a[u];)
- if (u = i.alternateExtensions[f++], f > i.alternateExtensions.length) return null;
- e = e.replace("." + s[5], "." + u);
- var l = {
- type: t || "sound",
- id: n,
- data: r
- };
- return l.name = o, l.src = e, l.extension = u, l
- }, i.play = function(e, t, n, r, s, o, u) {
- var a = i.createInstance(e),
- f = i._playInstance(a, t, n, r, s, o, u);
- return f || a.playFailed(), a
- }, i.createInstance = function(n) {
- if (!i.initializeDefaultPlugins()) return i._defaultSoundInstance;
- if (n = i._getSrcById(n), i.alternateExtensions.length) var r = i._parsePath2(n, "sound");
- else var r = i._parsePath(n, "sound");
- var s = null;
- return null != r && null != r.src ? (t.create(r.src), s = i.activePlugin.create(r.src)) : s = e._defaultSoundInstance, s.uniqueId = i._lastID++, s
- }, i.setVolume = function(e) {
- if (null == Number(e)) return !1;
- if (e = Math.max(0, Math.min(1, e)), i._masterVolume = e, !this.activePlugin || !this.activePlugin.setVolume || !this.activePlugin.setVolume(e))
- for (var t = this._instances, n = 0, r = t.length; r > n; n++) t[n].setMasterVolume(e)
- }, i.getVolume = function() {
- return i._masterVolume
- }, i.setMute = function(e) {
- if (null == e || void 0 == e) return !1;
- if (this._masterMute = e, !this.activePlugin || !this.activePlugin.setMute || !this.activePlugin.setMute(e))
- for (var t = this._instances, n = 0, r = t.length; r > n; n++) t[n].setMasterMute(e);
- return !0
- }, i.getMute = function() {
- return this._masterMute
- }, i.stop = function() {
- for (var e = this._instances, t = e.length; t--;) e[t].stop()
- }, i._playInstance = function(e, t, n, r, s, o, u) {
- if (t instanceof Object && (n = t.delay, r = t.offset, s = t.loop, o = t.volume, u = t.pan, t = t.interrupt), t = t || i.defaultInterruptBehavior, null == n && (n = 0), null == r && (r = e.getPosition()), null == s && (s = 0), null == o && (o = e.volume), null == u && (u = e.pan), 0 == n) {
- var a = i._beginPlaying(e, t, r, s, o, u);
- if (!a) return !1
- } else {
- var f = setTimeout(function() {
- i._beginPlaying(e, t, r, s, o, u)
- }, n);
- e._delayTimeoutId = f
- }
- return this._instances.push(e), !0
- }, i._beginPlaying = function(e, n, r, i, s, o) {
- if (!t.add(e, n)) return !1;
- var u = e._beginPlaying(r, i, s, o);
- if (!u) {
- var a = createjs.indexOf(this._instances, e);
- return a > -1 && this._instances.splice(a, 1), !1
- }
- return !0
- }, i._getSrcById = function(e) {
- return null == i._idHash || null == i._idHash[e] ? e : i._idHash[e]
- }, i._playFinished = function(e) {
- t.remove(e);
- var n = createjs.indexOf(this._instances, e);
- n > -1 && this._instances.splice(n, 1)
- }, createjs.Sound = e, t.channels = {}, t.create = function(e, n) {
- var r = t.get(e);
- return null == r ? (t.channels[e] = new t(e, n), !0) : !1
- }, t.removeSrc = function(e) {
- var n = t.get(e);
- return null == n ? !1 : (n.removeAll(), delete t.channels[e], !0)
- }, t.removeAll = function() {
- for (var e in t.channels) t.channels[e].removeAll();
- t.channels = {}
- }, t.add = function(e, n) {
- var r = t.get(e.src);
- return null == r ? !1 : r.add(e, n)
- }, t.remove = function(e) {
- var n = t.get(e.src);
- return null == n ? !1 : (n.remove(e), !0)
- }, t.maxPerChannel = function() {
- return s.maxDefault
- }, t.get = function(e) {
- return t.channels[e]
- };
- var s = t.prototype;
- s.src = null, s.max = null, s.maxDefault = 100, s.length = 0, s.init = function(e, t) {
- this.src = e, this.max = t || this.maxDefault, -1 == this.max && (this.max = this.maxDefault), this._instances = []
- }, s.get = function(e) {
- return this._instances[e]
- }, s.add = function(e, t) {
- return this.getSlot(t, e) ? (this._instances.push(e), this.length++, !0) : !1
- }, s.remove = function(e) {
- var t = createjs.indexOf(this._instances, e);
- return -1 == t ? !1 : (this._instances.splice(t, 1), this.length--, !0)
- }, s.removeAll = function() {
- for (var e = this.length - 1; e >= 0; e--) this._instances[e].stop()
- }, s.getSlot = function(t) {
- for (var n, r, i = 0, s = this.max; s > i; i++) {
- if (n = this.get(i), null == n) return !0;
- (t != e.INTERRUPT_NONE || n.playState == e.PLAY_FINISHED) && (0 != i ? n.playState == e.PLAY_FINISHED || n.playState == e.PLAY_INTERRUPTED || n.playState == e.PLAY_FAILED ? r = n : (t == e.INTERRUPT_EARLY && n.getPosition() < r.getPosition() || t == e.INTERRUPT_LATE && n.getPosition() > r.getPosition()) && (r = n) : r = n)
- }
- return null != r ? (r._interrupt(), this.remove(r), !0) : !1
- }, s.toString = function() {
- return "[Sound SoundChannel]"
- }, e._defaultSoundInstance = new n, r.init = function() {
- var e = window.navigator.userAgent;
- r.isFirefox = e.indexOf("Firefox") > -1, r.isOpera = null != window.opera, r.isChrome = e.indexOf("Chrome") > -1, r.isIOS = e.indexOf("iPod") > -1 || e.indexOf("iPhone") > -1 || e.indexOf("iPad") > -1, r.isAndroid = e.indexOf("Android") > -1, r.isBlackberry = e.indexOf("Blackberry") > -1
- }, r.init(), createjs.Sound.BrowserDetect = r
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- function e() {
- this._init()
- }
- var t = e;
- t._capabilities = null, t.isSupported = function() {
- var e = createjs.Sound.BrowserDetect.isIOS || createjs.Sound.BrowserDetect.isAndroid || createjs.Sound.BrowserDetect.isBlackberry;
- return "file:" != location.protocol || e || this._isFileXHRSupported() ? (t._generateCapabilities(), null == t.context ? !1 : !0) : !1
- }, t._isFileXHRSupported = function() {
- var e = !0,
- t = new XMLHttpRequest;
- try {
- t.open("GET", "fail.fail", !1)
- } catch (n) {
- return e = !1
- }
- t.onerror = function() {
- e = !1
- }, t.onload = function() {
- e = 404 == this.status || 200 == this.status || 0 == this.status && "" != this.response
- };
- try {
- t.send()
- } catch (n) {
- e = !1
- }
- return e
- }, t._generateCapabilities = function() {
- if (null == t._capabilities) {
- var e = document.createElement("audio");
- if (null == e.canPlayType) return null;
- if (window.webkitAudioContext) t.context = new webkitAudioContext;
- else {
- if (!window.AudioContext) return null;
- t.context = new AudioContext
- }
- t._compatibilitySetUp(), t.playEmptySound(), t._capabilities = {
- panning: !0,
- volume: !0,
- tracks: -1
- };
- for (var n = createjs.Sound.SUPPORTED_EXTENSIONS, r = createjs.Sound.EXTENSION_MAP, i = 0, s = n.length; s > i; i++) {
- var o = n[i],
- u = r[o] || o;
- t._capabilities[o] = "no" != e.canPlayType("audio/" + o) && "" != e.canPlayType("audio/" + o) || "no" != e.canPlayType("audio/" + u) && "" != e.canPlayType("audio/" + u)
- }
- t.context.destination.numberOfChannels < 2 && (t._capabilities.panning = !1), t.dynamicsCompressorNode = t.context.createDynamicsCompressor(), t.dynamicsCompressorNode.connect(t.context.destination), t.gainNode = t.context.createGain(), t.gainNode.connect(t.dynamicsCompressorNode)
- }
- }, t._compatibilitySetUp = function() {
- if (!t.context.createGain) {
- t.context.createGain = t.context.createGainNode;
- var e = t.context.createBufferSource();
- e.__proto__.start = e.__proto__.noteGrainOn, e.__proto__.stop = e.__proto__.noteOff, this._panningModel = 0
- }
- }, t.playEmptySound = function() {
- var e = this.context.createBuffer(1, 1, 22050),
- t = this.context.createBufferSource();
- t.buffer = e, t.connect(this.context.destination), t.start(0, 0, 0)
- };
- var n = e.prototype;
- n._capabilities = null, n._volume = 1, n.context = null, n._panningModel = "equalpower", n.dynamicsCompressorNode = null, n.gainNode = null, n._arrayBuffers = null, n._init = function() {
- this._capabilities = t._capabilities, this._arrayBuffers = {}, this.context = t.context, this.gainNode = t.gainNode, this.dynamicsCompressorNode = t.dynamicsCompressorNode
- }, n.register = function(e) {
- this._arrayBuffers[e] = !0;
- var t = new createjs.WebAudioPlugin.Loader(e, this);
- return {
- tag: t
- }
- }, n.isPreloadStarted = function(e) {
- return null != this._arrayBuffers[e]
- }, n.isPreloadComplete = function(e) {
- return !(null == this._arrayBuffers[e] || 1 == this._arrayBuffers[e])
- }, n.removeSound = function(e) {
- delete this._arrayBuffers[e]
- }, n.removeAllSounds = function() {
- this._arrayBuffers = {}
- }, n.addPreloadResults = function(e, t) {
- this._arrayBuffers[e] = t
- }, n._handlePreloadComplete = function() {
- createjs.Sound._sendFileLoadEvent(this.src)
- }, n.preload = function(e) {
- this._arrayBuffers[e] = !0;
- var t = new createjs.WebAudioPlugin.Loader(e, this);
- t.onload = this._handlePreloadComplete, t.load()
- }, n.create = function(e) {
- return this.isPreloadStarted(e) || this.preload(e), new createjs.WebAudioPlugin.SoundInstance(e, this)
- }, n.setVolume = function(e) {
- return this._volume = e, this._updateVolume(), !0
- }, n._updateVolume = function() {
- var e = createjs.Sound._masterMute ? 0 : this._volume;
- e != this.gainNode.gain.value && (this.gainNode.gain.value = e)
- }, n.getVolume = function() {
- return this._volume
- }, n.setMute = function() {
- return this._updateVolume(), !0
- }, n.toString = function() {
- return "[WebAudioPlugin]"
- }, createjs.WebAudioPlugin = e
- }(),
- function() {
- "use strict";
- function e(e, t) {
- this._init(e, t)
- }
- var t = e.prototype = new createjs.EventDispatcher;
- t.src = null, t.uniqueId = -1, t.playState = null, t._owner = null, t._offset = 0, t._delay = 0, t._volume = 1;
- try {
- Object.defineProperty(t, "volume", {
- get: function() {
- return this._volume
- },
- set: function(e) {
- return null == Number(e) ? !1 : (e = Math.max(0, Math.min(1, e)), this._volume = e, this._updateVolume(), void 0)
- }
- })
- } catch (n) {}
- t._pan = 0;
- try {
- Object.defineProperty(t, "pan", {
- get: function() {
- return this._pan
- },
- set: function(e) {
- return this._owner._capabilities.panning && null != Number(e) ? (e = Math.max(-1, Math.min(1, e)), this._pan = e, this.panNode.setPosition(e, 0, -.5), void 0) : !1
- }
- })
- } catch (n) {}
- t._duration = 0, t._remainingLoops = 0, t._delayTimeoutId = null, t._soundCompleteTimeout = null, t.gainNode = null, t.panNode = null, t.sourceNode = null, t._sourceNodeNext = null, t._muted = !1, t._paused = !1, t._startTime = 0, t._endedHandler = null, t._sendEvent = function(e) {
- var t = new createjs.Event(e);
- this.dispatchEvent(t)
- }, t._init = function(e, t) {
- this._owner = t, this.src = e, this.gainNode = this._owner.context.createGain(), this.panNode = this._owner.context.createPanner(), this.panNode.panningModel = this._owner._panningModel, this.panNode.connect(this.gainNode), this._owner.isPreloadComplete(this.src) && (this._duration = 1e3 * this._owner._arrayBuffers[this.src].duration), this._endedHandler = createjs.proxy(this._handleSoundComplete, this)
- }, t._cleanUp = function() {
- this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this.sourceNode = this._cleanUpAudioNode(this.sourceNode), this._sourceNodeNext = this._cleanUpAudioNode(this._sourceNodeNext)), 0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(0), clearTimeout(this._delayTimeoutId), clearTimeout(this._soundCompleteTimeout), this._startTime = 0, null != window.createjs && createjs.Sound._playFinished(this)
- }, t._cleanUpAudioNode = function(e) {
- return e && (e.stop(0), e.disconnect(this.panNode), e = null), e
- }, t._interrupt = function() {
- this._cleanUp(), this.playState = createjs.Sound.PLAY_INTERRUPTED, this._paused = !1, this._sendEvent("interrupted")
- }, t._handleSoundReady = function() {
- if (null != window.createjs) {
- if (1e3 * this._offset > this.getDuration()) return this.playFailed(), void 0;
- this._offset < 0 && (this._offset = 0), this.playState = createjs.Sound.PLAY_SUCCEEDED, this._paused = !1, this.gainNode.connect(this._owner.gainNode);
- var e = this._owner._arrayBuffers[this.src].duration;
- this.sourceNode = this._createAndPlayAudioNode(this._owner.context.currentTime - e, this._offset), this._duration = 1e3 * e, this._startTime = this.sourceNode.startTime - this._offset, this._soundCompleteTimeout = setTimeout(this._endedHandler, 1e3 * (e - this._offset)), 0 != this._remainingLoops && (this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime, 0))
- }
- }, t._createAndPlayAudioNode = function(e, t) {
- var n = this._owner.context.createBufferSource();
- return n.buffer = this._owner._arrayBuffers[this.src], n.connect(this.panNode), this._owner.context.currentTime, n.startTime = e + n.buffer.duration, n.start(n.startTime, t, n.buffer.duration - t), n
- }, t.play = function(e, t, n, r, i, s) {
- this._cleanUp(), createjs.Sound._playInstance(this, e, t, n, r, i, s)
- }, t._beginPlaying = function(e, t, n, r) {
- return null != window.createjs && this.src ? (this._offset = e / 1e3, this._remainingLoops = t, this.volume = n, this.pan = r, this._owner.isPreloadComplete(this.src) ? (this._handleSoundReady(null), this._sendEvent("succeeded"), 1) : (this.playFailed(), void 0)) : void 0
- }, t.pause = function() {
- return this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED ? !1 : (this._paused = !0, this._offset = this._owner.context.currentTime - this._startTime, this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), 0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(), clearTimeout(this._delayTimeoutId), clearTimeout(this._soundCompleteTimeout), !0)
- }, t.resume = function() {
- return this._paused ? (this._handleSoundReady(null), !0) : !1
- }, t.stop = function() {
- return this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._offset = 0, !0
- }, t.setVolume = function(e) {
- return this.volume = e, !0
- }, t._updateVolume = function() {
- var e = this._muted ? 0 : this._volume;
- return e != this.gainNode.gain.value ? (this.gainNode.gain.value = e, !0) : !1
- }, t.getVolume = function() {
- return this.volume
- }, t.setMute = function(e) {
- return null == e || void 0 == e ? !1 : (this._muted = e, this._updateVolume(), !0)
- }, t.getMute = function() {
- return this._muted
- }, t.setPan = function(e) {
- return this.pan = e, this.pan != e ? !1 : void 0
- }, t.getPan = function() {
- return this.pan
- }, t.getPosition = function() {
- if (this._paused || null == this.sourceNode) var e = this._offset;
- else var e = this._owner.context.currentTime - this._startTime;
- return 1e3 * e
- }, t.setPosition = function(e) {
- return this._offset = e / 1e3, this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), clearTimeout(this._soundCompleteTimeout)), this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED || this._handleSoundReady(null), !0
- }, t.getDuration = function() {
- return this._duration
- }, t._handleSoundComplete = function() {
- return this._offset = 0, 0 != this._remainingLoops ? (this._remainingLoops--, this._sourceNodeNext ? (this._cleanUpAudioNode(this.sourceNode), this.sourceNode = this._sourceNodeNext, this._startTime = this.sourceNode.startTime, this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime, 0), this._soundCompleteTimeout = setTimeout(this._endedHandler, this._duration)) : this._handleSoundReady(null), this._sendEvent("loop"), void 0) : (null != window.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._sendEvent("complete")), void 0)
- }, t.playFailed = function() {
- null != window.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FAILED, this._sendEvent("failed"))
- }, t.toString = function() {
- return "[WebAudioPlugin SoundInstance]"
- }, createjs.WebAudioPlugin.SoundInstance = e
- }(),
- function() {
- "use strict";
- function e(e, t) {
- this._init(e, t)
- }
- var t = e.prototype;
- t.request = null, t.owner = null, t.progress = -1, t.src = null, t.originalSrc = null, t.result = null, t.onload = null, t.onprogress = null, t.onError = null, t._init = function(e, t) {
- this.src = e, this.originalSrc = e, this.owner = t
- }, t.load = function(e) {
- null != e && (this.src = e), this.request = new XMLHttpRequest, this.request.open("GET", this.src, !0), this.request.responseType = "arraybuffer", this.request.onload = createjs.proxy(this.handleLoad, this), this.request.onError = createjs.proxy(this.handleError, this), this.request.onprogress = createjs.proxy(this.handleProgress, this), this.request.send()
- }, t.handleProgress = function(e, t) {
- this.progress = e / t, null != this.onprogress && this.onprogress({
- loaded: e,
- total: t,
- progress: this.progress
- })
- }, t.handleLoad = function() {
- this.owner.context.decodeAudioData(this.request.response, createjs.proxy(this.handleAudioDecoded, this), createjs.proxy(this.handleError, this))
- }, t.handleAudioDecoded = function(e) {
- this.progress = 1, this.result = e, this.src = this.originalSrc, this.owner.addPreloadResults(this.src, this.result), this.onload && this.onload()
- }, t.handleError = function(e) {
- this.owner.removeSound(this.src), this.onerror && this.onerror(e)
- }, t.toString = function() {
- return "[WebAudioPlugin Loader]"
- }, createjs.WebAudioPlugin.Loader = e
- }(), this.createjs = this.createjs || {},
- function() {
- "use strict";
- function e() {
- this._init()
- }
- var t = e;
- t.MAX_INSTANCES = 30, t._AUDIO_READY = "canplaythrough", t._AUDIO_ENDED = "ended", t._AUDIO_SEEKED = "seeked", t._AUDIO_STALLED = "stalled", t._capabilities = null, t.enableIOS = !1, t.isSupported = function() {
- if (createjs.Sound.BrowserDetect.isIOS && !t.enableIOS) return !1;
- t._generateCapabilities();
- var e = t.tag;
- return null == e || null == t._capabilities ? !1 : !0
- }, t._generateCapabilities = function() {
- if (null == t._capabilities) {
- var e = t.tag = document.createElement("audio");
- if (null == e.canPlayType) return null;
- t._capabilities = {
- panning: !0,
- volume: !0,
- tracks: -1
- };
- for (var n = createjs.Sound.SUPPORTED_EXTENSIONS, r = createjs.Sound.EXTENSION_MAP, i = 0, s = n.length; s > i; i++) {
- var o = n[i],
- u = r[o] || o;
- t._capabilities[o] = "no" != e.canPlayType("audio/" + o) && "" != e.canPlayType("audio/" + o) || "no" != e.canPlayType("audio/" + u) && "" != e.canPlayType("audio/" + u)
- }
- }
- };
- var n = e.prototype;
- n._capabilities = null, n._audioSources = null, n.defaultNumChannels = 2, n.loadedHandler = null, n._init = function() {
- this._capabilities = t._capabilities, this._audioSources = {}
- }, n.register = function(e, t) {
- this._audioSources[e] = !0;
- for (var n = createjs.HTMLAudioPlugin.TagPool.get(e), r = null, i = t || this.defaultNumChannels, s = 0; i > s; s++) r = this._createTag(e), n.add(r);
- if (r.id = e, this.loadedHandler = createjs.proxy(this._handleTagLoad, this), r.addEventListener && r.addEventListener("canplaythrough", this.loadedHandler), null == r.onreadystatechange) r.onreadystatechange = this.loadedHandler;
- else {
- var o = r.onreadystatechange;
- r.onreadystatechange = function() {
- o(), this.loadedHandler()
- }
- }
- return {
- tag: r,
- numChannels: i
- }
- }, n._handleTagLoad = function(e) {
- e.target.removeEventListener && e.target.removeEventListener("canplaythrough", this.loadedHandler), e.target.onreadystatechange = null, e.target.src != e.target.id && createjs.HTMLAudioPlugin.TagPool.checkSrc(e.target.id)
- }, n._createTag = function(e) {
- var t = document.createElement("audio");
- return t.autoplay = !1, t.preload = "none", t.src = e, t
- }, n.removeSound = function(e) {
- delete this._audioSources[e], createjs.HTMLAudioPlugin.TagPool.remove(e)
- }, n.removeAllSounds = function() {
- this._audioSources = {}, createjs.HTMLAudioPlugin.TagPool.removeAll()
- }, n.create = function(e) {
- if (!this.isPreloadStarted(e)) {
- var t = createjs.HTMLAudioPlugin.TagPool.get(e),
- n = this._createTag(e);
- n.id = e, t.add(n), this.preload(e, {
- tag: n
- })
- }
- return new createjs.HTMLAudioPlugin.SoundInstance(e, this)
- }, n.isPreloadStarted = function(e) {
- return null != this._audioSources[e]
- }, n.preload = function(e, t) {
- this._audioSources[e] = !0, new createjs.HTMLAudioPlugin.Loader(e, t.tag)
- }, n.toString = function() {
- return "[HTMLAudioPlugin]"
- }, createjs.HTMLAudioPlugin = e
- }(),
- function() {
- "use strict";
- function e(e, t) {
- this._init(e, t)
- }
- var t = e.prototype = new createjs.EventDispatcher;
- t.src = null, t.uniqueId = -1, t.playState = null, t._owner = null, t.loaded = !1, t._offset = 0, t._delay = 0, t._volume = 1;
- try {
- Object.defineProperty(t, "volume", {
- get: function() {
- return this._volume
- },
- set: function(e) {
- null != Number(e) && (e = Math.max(0, Math.min(1, e)), this._volume = e, this._updateVolume())
- }
- })
- } catch (n) {}
- t.pan = 0, t._duration = 0, t._remainingLoops = 0, t._delayTimeoutId = null, t.tag = null, t._muted = !1, t._paused = !1, t._endedHandler = null, t._readyHandler = null, t._stalledHandler = null, t.loopHandler = null, t._init = function(e, t) {
- this.src = e, this._owner = t, this._endedHandler = createjs.proxy(this._handleSoundComplete, this), this._readyHandler = createjs.proxy(this._handleSoundReady, this), this._stalledHandler = createjs.proxy(this._handleSoundStalled, this), this.loopHandler = createjs.proxy(this.handleSoundLoop, this)
- }, t._sendEvent = function(e) {
- var t = new createjs.Event(e);
- this.dispatchEvent(t)
- }, t._cleanUp = function() {
- var e = this.tag;
- if (null != e) {
- e.pause(), e.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED, this._endedHandler, !1), e.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), e.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
- try {
- e.currentTime = 0
- } catch (t) {}
- createjs.HTMLAudioPlugin.TagPool.setInstance(this.src, e), this.tag = null
- }
- clearTimeout(this._delayTimeoutId), null != window.createjs && createjs.Sound._playFinished(this)
- }, t._interrupt = function() {
- null != this.tag && (this.playState = createjs.Sound.PLAY_INTERRUPTED, this._cleanUp(), this._paused = !1, this._sendEvent("interrupted"))
- }, t.play = function(e, t, n, r, i, s) {
- this._cleanUp(), createjs.Sound._playInstance(this, e, t, n, r, i, s)
- }, t._beginPlaying = function(e, t, n, r) {
- if (null == window.createjs) return -1;
- var i = this.tag = createjs.HTMLAudioPlugin.TagPool.getInstance(this.src);
- return null == i ? (this.playFailed(), -1) : (i.addEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED, this._endedHandler, !1), this._offset = e, this.volume = n, this.pan = r, this._updateVolume(), this._remainingLoops = t, 4 !== i.readyState ? (i.addEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), i.addEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED, this._stalledHandler, !1), i.preload = "auto", i.load()) : this._handleSoundReady(null), this._sendEvent("succeeded"), 1)
- }, t._handleSoundStalled = function() {
- this._cleanUp(), this._sendEvent("failed")
- }, t._handleSoundReady = function() {
- if (null != window.createjs) {
- if (this._duration = 1e3 * this.tag.duration, this.playState = createjs.Sound.PLAY_SUCCEEDED, this._paused = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), this._offset >= this.getDuration()) return this.playFailed(), void 0;
- this._offset > 0 && (this.tag.currentTime = .001 * this._offset), -1 == this._remainingLoops && (this.tag.loop = !0), 0 != this._remainingLoops && (this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1), this.tag.loop = !0), this.tag.play()
- }
- }, t.pause = function() {
- return this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED || null == this.tag ? !1 : (this._paused = !0, this.tag.pause(), clearTimeout(this._delayTimeoutId), !0)
- }, t.resume = function() {
- return this._paused && null != this.tag ? (this._paused = !1, this.tag.play(), !0) : !1
- }, t.stop = function() {
- return this._offset = 0, this.pause(), this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), !0
- }, t.setMasterVolume = function() {
- return this._updateVolume(), !0
- }, t.setVolume = function(e) {
- return this.volume = e, !0
- }, t._updateVolume = function() {
- if (null != this.tag) {
- var e = this._muted || createjs.Sound._masterMute ? 0 : this._volume * createjs.Sound._masterVolume;
- return e != this.tag.volume && (this.tag.volume = e), !0
- }
- return !1
- }, t.getVolume = function() {
- return this.volume
- }, t.setMasterMute = function() {
- return this._updateVolume(), !0
- }, t.setMute = function(e) {
- return null == e || void 0 == e ? !1 : (this._muted = e, this._updateVolume(), !0)
- }, t.getMute = function() {
- return this._muted
- }, t.setPan = function() {
- return !1
- }, t.getPan = function() {
- return 0
- }, t.getPosition = function() {
- return null == this.tag ? this._offset : 1e3 * this.tag.currentTime
- }, t.setPosition = function(e) {
- if (null == this.tag) this._offset = e;
- else {
- this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
- try {
- this.tag.currentTime = .001 * e
- } catch (t) {
- return !1
- }
- this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1)
- }
- return !0
- }, t.getDuration = function() {
- return this._duration
- }, t._handleSoundComplete = function() {
- this._offset = 0, null != window.createjs && (this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), this._sendEvent("complete"))
- }, t.handleSoundLoop = function() {
- this._offset = 0, this._remainingLoops--, 0 == this._remainingLoops && (this.tag.loop = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1)), this._sendEvent("loop")
- }, t.playFailed = function() {
- null != window.createjs && (this.playState = createjs.Sound.PLAY_FAILED, this._cleanUp(), this._sendEvent("failed"))
- }, t.toString = function() {
- return "[HTMLAudioPlugin SoundInstance]"
- }, createjs.HTMLAudioPlugin.SoundInstance = e
- }(),
- function() {
- "use strict";
- function e(e, t) {
- this._init(e, t)
- }
- var t = e.prototype;
- t.src = null, t.tag = null, t.preloadTimer = null, t.loadedHandler = null, t._init = function(e, t) {
- if (this.src = e, this.tag = t, this.preloadTimer = setInterval(createjs.proxy(this.preloadTick, this), 200), this.loadedHandler = createjs.proxy(this.sendLoadedEvent, this), this.tag.addEventListener && this.tag.addEventListener("canplaythrough", this.loadedHandler), null == this.tag.onreadystatechange) this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this);
- else {
- var n = this.tag.onreadystatechange;
- this.tag.onreadystatechange = function() {
- n(), this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this)
- }
- }
- this.tag.preload = "auto", this.tag.load()
- }, t.preloadTick = function() {
- var e = this.tag.buffered,
- t = this.tag.duration;
- e.length > 0 && e.end(0) >= t - 1 && this.handleTagLoaded()
- }, t.handleTagLoaded = function() {
- clearInterval(this.preloadTimer)
- }, t.sendLoadedEvent = function() {
- this.tag.removeEventListener && this.tag.removeEventListener("canplaythrough", this.loadedHandler), this.tag.onreadystatechange = null, createjs.Sound._sendFileLoadEvent(this.src)
- }, t.toString = function() {
- return "[HTMLAudioPlugin Loader]"
- }, createjs.HTMLAudioPlugin.Loader = e
- }(),
- function() {
- "use strict";
- function e(e) {
- this._init(e)
- }
- var t = e;
- t.tags = {}, t.get = function(n) {
- var r = t.tags[n];
- return null == r && (r = t.tags[n] = new e(n)), r
- }, t.remove = function(e) {
- var n = t.tags[e];
- return null == n ? !1 : (n.removeAll(), delete t.tags[e], !0)
- }, t.removeAll = function() {
- for (var e in t.tags) t.tags[e].removeAll();
- t.tags = {}
- }, t.getInstance = function(e) {
- var n = t.tags[e];
- return null == n ? null : n.get()
- }, t.setInstance = function(e, n) {
- var r = t.tags[e];
- return null == r ? null : r.set(n)
- }, t.checkSrc = function(e) {
- var n = t.tags[e];
- return null == n ? null : (n.checkSrcChange(), void 0)
- };
- var n = e.prototype;
- n.src = null, n.length = 0, n.available = 0, n.tags = null, n._init = function(e) {
- this.src = e, this.tags = []
- }, n.add = function(e) {
- this.tags.push(e), this.length++, this.available++
- }, n.removeAll = function() {
- for (; this.length--;) delete this.tags[this.length];
- this.src = null, this.tags.length = 0
- }, n.get = function() {
- if (0 == this.tags.length) return null;
- this.available = this.tags.length;
- var e = this.tags.pop();
- return null == e.parentNode && document.body.appendChild(e), e
- }, n.set = function(e) {
- var t = createjs.indexOf(this.tags, e); - 1 == t && this.tags.push(e), this.available = this.tags.length
- }, n.checkSrcChange = function() {
- for (var e = this.tags.length - 1, t = this.tags[e].src; e--;) this.tags[e].src = t
- }, n.toString = function() {
- return "[HTMLAudioPlugin TagPool]"
- }, createjs.HTMLAudioPlugin.TagPool = e
- }();
- var g_strings = {
- en: {
- STRING_REMOVE: "消除",
- STRING_CLEAR: "消除全部冰块"
- },
- es: {
- STRING_REMOVE: "Eliminar ",
- STRING_CLEAR: "Despeja todas las casillas de hielo"
- },
- pt: {
- STRING_REMOVE: "Remover",
- STRING_CLEAR: "Limpe todas as células de gelo"
- },
- tr: {
- STRING_REMOVE: "Ortadan Kald?r",
- STRING_CLEAR: "Tüm buz hücreleri sil"
- },
- de: {
- STRING_REMOVE: "Entferne",
- STRING_CLEAR: "Entferne alle Eis K?stchen"
- },
- ru: {
- STRING_REMOVE: "Удалите",
- STRING_CLEAR: "Удали все ледяные кубы"
- }
- };
- var g_allLanguages = ["en", "es", "pt", "tr", "de", "ru"];
- var StringManager = function() {
- function e() {
- this.container = new createjs.Container;
- this.strings = new Object;
- this.allStrings = null
- }
- e.getInstance = function() {
- return e.g_instance
- };
- e.prototype.getString = function(e) {
- return this.strings[e]
- };
- e.prototype.loadStrings = function() {
- this.allStrings = g_strings
- };
- e.prototype.setLanguage = function(e) {
- this.strings = this.allStrings[e]
- };
- e.g_instance = new e;
- e.STRING_REMOVE = "STRING_REMOVE";
- e.STRING_CLEAR = "STRING_CLEAR";
- return e
- }();
- var SoundManager = function() {
- function e() {
- this.soundEnabled = true;
- this.initiliazed = false;
- this.musicInstance = null;
- this.focus = true;
- this.wasMusicPlay = false
- }
- e.prototype.onLostFocus = function() {
- if (this.focus) {
- this.focus = false;
- if (this.soundEnabled) {
- if (this.musicInstance) {
- try {
- this.musicInstance.stop()
- } catch (e) {}
- }
- this.wasMusicPlay = false
- }
- }
- };
- e.prototype.onFocus = function() {
- if (!this.focus) {
- this.focus = true;
- this.playMusic()
- }
- };
- e.prototype.init = function() {
- if (!this.initiliazed) {
- try {
- if (!createjs.Sound.initializeDefaultPlugins()) {
- return
- }
- } catch (e) {}
- this.initiliazed = true
- }
- };
- e.prototype.isSoundEnabled = function() {
- return this.soundEnabled
- };
- e.prototype.setSoundEnabled = function(e) {
- this.soundEnabled = e;
- if (!e) {
- if (this.musicInstance) {
- try {
- this.musicInstance.stop()
- } catch (t) {}
- }
- this.wasMusicPlay = false
- } else {
- this.playMusic()
- }
- };
- e.prototype.play = function(e) {
- try {
- if (this.initiliazed && this.soundEnabled) {
- try {
- return createjs.Sound.play(e, createjs.Sound.INTERRUPT_NONE, 0, 0, 0, 1)
- } catch (t) {}
- }
- } catch (t) {}
- return null
- };
- e.prototype.playMusic = function() {
- if (this.initiliazed && this.soundEnabled) {
- if (!this.wasMusicPlay) {
- this.wasMusicPlay = true;
- try {
- this.musicInstance = createjs.Sound.play(e.SOUND_MUSIC, createjs.Sound.INTERRUPT_NONE, 0, 0, -1, 1);
- if (this.musicInstance.playState == "playFailed") {
- this.wasMusicPlay = false;
- return null
- }
- } catch (t) {
- return null
- }
- return this.musicInstance
- }
- }
- return null
- };
- e.g_instance = new e;
- e.SOUND_MUSIC = "music";
- e.SOUND_CLICK = "click";
- e.SOUND_MATCH_1 = "match_1";
- e.SOUND_MATCH_2 = "match_2";
- e.SOUND_MATCH_3 = "match_3";
- e.SOUND_MATCH_4 = "match_4";
- e.SOUND_MATCH_5 = "match_5";
- e.SOUND_DROP_1 = "drop_1";
- e.SOUND_DROP_2 = "drop_2";
- e.SOUND_DROP_3 = "drop_3";
- e.SOUND_LINE = "line";
- e.SOUND_KILL_COLOR = "kill_color";
- e.SOUND_LOSE = "lose";
- e.SOUND_BOOM = "boom";
- e.SOUND_AWESOME = "awesome";
- e.SOUND_EXCHANGE = "exchange";
- e.SOUND_WIN = "win";
- return e
- }();
- var StateManager = function() {
- function e(t) {
- var n = this;
- this.statesConstainer = new createjs.Container;
- this.isMouseDown = false;
- this.timeDevider = 1;
- this.lastTime = 0;
- e.g_instance = this;
- this.states = Array();
- this.canvas = document.getElementById("canvas");
- this.stage = new createjs.Stage(this.canvas);
- this.stage.autoClear = true;
- createjs.Touch.enable(this.stage);
- this.stage.enableMouseOver(5);
- createjs.Ticker.setFPS(60);
- createjs.Ticker.addEventListener("tick", function(e) {
- return n.update(e)
- });
- if (Constants.DEBUG_MODE) {
- document.onkeydown = function(e) {
- return n.onKeyDown(e)
- };
- document.onkeyup = function(e) {
- return n.onKeyUp(e)
- }
- }
- var r = new AssetsManager(t);
- this.stage.addChild(r);
- r.addEventListener(Constants.LOAD_COMPLETE, function(e) {
- return n.allAssetsLoaded(e)
- });
- r.startDownLoad();
- this.stage.addChild(this.statesConstainer);
- Constants.PIXEL_RATIO = window.devicePixelRatio ? window.devicePixelRatio : 1;
- if (Constants.g_isPC) {
- window.onresize = function(e) {
- return n.onResize(e)
- };
- this.onResize(null)
- } else {
- if (viewporter.ACTIVE) {
- window.addEventListener("viewportready", function() {
- return n.onOrientationChanged()
- });
- window.addEventListener("viewportchange", function() {
- return n.onOrientationChanged()
- })
- } else {
- window.addEventListener("orientationchange", function() {
- return n.onOrientationChanged()
- })
- }
- this.onOrientationChanged()
- }
- }
- e.prototype.isLandscape = function() {
- if (Constants.g_isPC) {
- return false
- }
- return viewporter.isLandscape()
- };
- e.prototype.allAssetsLoaded = function(t) {
- var n = this;
- t.target.removeEventListener(Constants.LOAD_COMPLETE, this.allAssetsLoaded);
- this.stage.addEventListener(Constants.MOUSE_MOVE, function(e) {
- return n.handleMouse(e)
- });
- this.stage.addEventListener(Constants.MOUSE_DOWN, function(e) {
- return n.handleMouse(e)
- });
- this.stage.addEventListener(Constants.MOUSE_UP, function(e) {
- return n.handleMouse(e)
- });
- StringManager.getInstance().loadStrings();
- try {
- var r = SG.lang;
- StringManager.getInstance().setLanguage(r);
- SG_Hooks.setOrientationHandler(function(t) {
- e.g_instance.onOrientationChanged()
- });
- SG_Hooks.setResizeHandler(function(t, n) {
- if (t && n) {
- Constants.g_wasSetSize = true;
- Constants.W = t;
- Constants.H = n;
- if (Constants.g_isPC) {
- e.g_instance.onResize(null)
- } else {
- e.g_instance.onOrientationChanged()
- }
- }
- })
- } catch (i) {
- console.log("SG_Hooks error")
- }
- if (window.onpagehide) {
- window.onpagehide = function(e) {
- return n.onLostFocus(e)
- }
- }
- if (window.onblur) {
- window.onblur = function(e) {
- return n.onLostFocus(e)
- }
- }
- if (window.onpageshow) {
- window.onpageshow = function(e) {
- return n.onFocus(e)
- }
- }
- if (window.onfocus) {
- window.onfocus = function(e) {
- return n.onFocus(e)
- }
- }
- if (AssetsManager.g_instance.parent) {
- AssetsManager.g_instance.parent.removeChild(AssetsManager.g_instance)
- }
- GameData.getInstance().load();
- this.pushState(new MainMenuState);
- if (this.isLandscape()) {
- this.pushState(new PortraitLockState)
- }
- };
- e.prototype.update = function(e) {
- try {
- if (this.states.length != 0) {
- var t = this.states[this.states.length - 1];
- if (!t.isInitiliazed()) {
- t.init()
- }
- var n = createjs.Ticker.getTime();
- var r = n - this.lastTime;
- this.lastTime = n;
- t.update(r * .001 / this.timeDevider)
- }
- } catch (i) {
- console.log(i, "statemanager::update")
- }
- try {
- this.stage.update(e)
- } catch (i) {}
- };
- e.prototype.changeState = function(e) {
- while (this.states.length != 0) {
- this.popState()
- }
- this.pushState(e)
- };
- e.prototype.pushState = function(e) {
- this.states.push(e);
- this.statesConstainer.addChild(e)
- };
- e.prototype.popState = function() {
- if (this.states.length != 0) {
- this.states[this.states.length - 1].cleanup();
- this.statesConstainer.removeChild(this.states[this.states.length - 1]);
- this.states.pop();
- if (this.states.length != 0) {
- this.states[this.states.length - 1].resume()
- }
- }
- };
- e.getInnerWidth = function() {
- if (Constants.g_isPC) {
- return window.innerWidth
- }
- return window.innerWidth
- };
- e.getInnerHeight = function() {
- if (Constants.g_isPC) {
- return window.innerHeight
- }
- return window.innerHeight
- };
- e.prototype.onResize = function(t) {
- if (!Constants.g_wasSetSize) {
- Constants.W = e.getInnerWidth();
- Constants.H = e.getInnerHeight()
- }
- Constants.SCREEN_SCALE = Constants.H / Constants.ASSETS_HEIGHT * Constants.PIXEL_RATIO;
- Constants.SCREEN_HEIGHT = Constants.H / Constants.SCREEN_SCALE * Constants.PIXEL_RATIO;
- this.canvas.width = Constants.ASSETS_WIDTH * Constants.SCREEN_SCALE;
- this.canvas.height = Constants.ASSETS_HEIGHT * Constants.SCREEN_SCALE;
- this.canvas.style.width = this.canvas.width + "px";
- this.canvas.style.height = this.canvas.height + "px";
- this.canvas.style.marginLeft = (Constants.W - this.canvas.width) / 2 + "px";
- this.statesConstainer.scaleX = this.statesConstainer.scaleY = Constants.SCREEN_SCALE
- };
- e.prototype.onOrientationChanged = function() {
- if (!Constants.g_wasSetSize) {
- Constants.W = e.getInnerWidth();
- Constants.H = e.getInnerHeight()
- }
- var t = this.isLandscape();
- var n = Constants.W;
- var r = Constants.H;
- this.canvas.width = n * Constants.PIXEL_RATIO;
- this.canvas.height = r * Constants.PIXEL_RATIO;
- this.canvas.style.width = n + "px";
- this.canvas.style.height = r + "px";
- if (t) {
- Constants.SCREEN_SCALE = r / Constants.ASSETS_HEIGHT * Constants.PIXEL_RATIO;
- Constants.SCREEN_HEIGHT = r
- } else {
- Constants.SCREEN_SCALE = n / Constants.ASSETS_WIDTH * Constants.PIXEL_RATIO;
- Constants.SCREEN_HEIGHT = r / Constants.SCREEN_SCALE * Constants.PIXEL_RATIO
- }
- this.statesConstainer.scaleX = this.statesConstainer.scaleY = Constants.SCREEN_SCALE;
- if (this.states.length != 0) {
- this.states[this.states.length - 1].onOrientationChanged(t)
- }
- if (AssetsManager.g_instance.parent) {
- AssetsManager.g_instance.onOrientationChanged(t)
- }
- };
- e.prototype.onLostFocus = function(e) {
- SoundManager.g_instance.onLostFocus()
- };
- e.prototype.onFocus = function(e) {
- SoundManager.g_instance.onFocus()
- };
- e.prototype.isMouseDownNow = function() {
- return this.isMouseDown
- };
- e.prototype.handleMouse = function(e) {
- e.preventDefault();
- if (this.states.length == 0) {
- return
- }
- var t = this.states[this.states.length - 1];
- switch (e.type) {
- case Constants.MOUSE_DOWN:
- {
- SoundManager.g_instance.init();
- SoundManager.g_instance.playMusic();
- this.isMouseDown = true;
- t.onMouseDown(e.stageX / Constants.SCREEN_SCALE, e.stageY / Constants.SCREEN_SCALE)
- }
- break;
- case Constants.MOUSE_UP:
- {
- this.isMouseDown = false;
- t.onMouseUp(e.stageX / Constants.SCREEN_SCALE, e.stageY / Constants.SCREEN_SCALE)
- }
- break;
- case Constants.MOUSE_MOVE:
- {
- if (this.isMouseDown) {
- t.onMouseMove(e.stageX / Constants.SCREEN_SCALE, e.stageY / Constants.SCREEN_SCALE)
- }
- }
- break
- }
- DNButton.wasActionThisFrame = false
- };
- e.prototype.onKeyDown = function(e) {
- if (Constants.DEBUG_MODE) {
- switch (e.keyCode) {
- case 65:
- {
- this.timeDevider = 5
- }
- break;
- case 68:
- {
- this.timeDevider = 10
- }
- break
- }
- }
- };
- e.prototype.onKeyUp = function(e) {
- if (Constants.DEBUG_MODE) {
- switch (e.keyCode) {
- case 65:
- {
- this.timeDevider = 1
- }
- break;
- case 68:
- {
- this.timeDevider = 1
- }
- break
- }
- }
- };
- return e
- }();
- var __extends = this.__extends || function(e, t) {
- function r() {
- this.constructor = e
- }
- for (var n in t)
- if (t.hasOwnProperty(n)) e[n] = t[n];
- r.prototype = t.prototype;
- e.prototype = new r
- };
- var GameState = function(e) {
- function t() {
- e.call(this);
- this.liveTime = 0;
- this.gameObjects = new Array;
- this.gui = new Array;
- this.newGameObjects = new Array;
- this.initiliazed = false;
- this.consoleH = 200
- }
- __extends(t, e);
- t.prototype.consolePrint = function(e) {
- var t = new createjs.Text(e, "bold 35px Arial", "#000000");
- this.addChild(t);
- t.x = 50;
- t.y = this.consoleH;
- this.consoleH += 40
- };
- t.prototype.isInitiliazed = function() {
- return this.initiliazed
- };
- t.prototype.onMouseDown = function(e, t) {
- for (var n = 0; n < this.gui.length; n++) {
- this.gui[n].onMouseDown(e, t)
- }
- };
- t.prototype.onMouseMove = function(e, t) {
- for (var n = 0; n < this.gui.length; n++) {
- this.gui[n].onMouseMove(e, t)
- }
- };
- t.prototype.onMouseUp = function(e, t) {
- for (var n = 0; n < this.gui.length; n++) {
- this.gui[n].onMouseUp(e, t)
- }
- };
- t.prototype.addGuiObject = function(e) {
- this.gui.push(e);
- this.addGameObject(e)
- };
- t.prototype.update = function(e) {
- this.liveTime += e;
- this.newGameObjects = new Array;
- for (var t = 0; t < this.gameObjects.length; t++) {
- var n = this.gameObjects[t];
- n.update(e);
- if (n.isDead()) {
- n.onDead()
- } else {
- this.newGameObjects.push(n)
- }
- }
- this.gameObjects = this.newGameObjects
- };
- t.prototype.addGameObject = function(e) {
- this.gameObjects.push(e)
- };
- t.prototype.addGameObjectAt = function(e, t) {
- this.gameObjects.push(e);
- if (t) {
- t.addChild(e)
- }
- };
- t.prototype.addGameObjectAtPos = function(e, t, n, r) {
- this.gameObjects.push(e);
- if (t) {
- t.addChild(e);
- e.x = n;
- e.y = r
- }
- };
- t.prototype.cleanup = function() {};
- t.prototype.resume = function() {};
- t.prototype.init = function() {
- this.initiliazed = true
- };
- t.prototype.onOrientationChanged = function(e) {
- if (e) {
- StateManager.g_instance.pushState(new PortraitLockState)
- }
- };
- return t
- }(createjs.Container);
- var Constants = function() {
- function e() {}
- e.W = -1;
- e.H = -1;
- e.g_wasSetSize = false;
- e.g_DEBUG = false;
- e.LOAD_COMPLETE = "LOAD_COMPLETE";
- e.MOUSE_DOWN = "stagemousedown";
- e.MOUSE_UP = "stagemouseup";
- e.MOUSE_MOVE = "stagemousemove";
- e.CELL_SIZE = 85;
- e.FIELD_OFFSET_X = 9;
- e.FIELD_OFFSET_Y = 250;
- e.EXCHANGE_TIME = .22;
- e.MATCH_TIME = .25;
- e.GRAVITY_ACC = 2500;
- e.ASSETS_WIDTH = 700;
- e.ASSETS_HEIGHT = 900;
- e.PIXEL_RATIO = 1;
- e.SCREEN_HEIGHT = 900;
- e.SCREEN_SCALE = 1;
- e.DPI = -1;
- e.g_isPC = true;
- e.DEBUG_MODE = false;
- e.COLOR_PINK = "#ffE5E5";
- e.COLOR_BLUE = "#619CC4";
- e.IMAGE_BUTTON_CLOSE = "button_close";
- e.IMAGE_BUTTON_SOUND_ON = "button_sound_on";
- e.IMAGE_BUTTON_SOUND_OFF = "button_sound_off";
- e.IMAGE_BUTTON_EXIT = "button_exit";
- e.IMAGE_BUTTON_PAUSE = "button_pause";
- e.IMAGE_BUTTON_RESTART = "button_restart";
- e.IMAGE_BUTTON_PLAY = "button_play";
- e.IMAGE_AWESOME = "awesome";
- e.IMAGE_SUPERB = "superb";
- e.IMAGE_SHINING = "shining";
- e.IMAGE_DROP = "drop";
- e.IMAGE_BACK = "back";
- e.IMAGE_DONUT = "donut";
- e.IMAGE_ARROW_BONUS_VERT = "arrow_bonus_vert";
- e.IMAGE_ARROW_BONUS_HOR = "arrow_bonus_hor";
- e.IMAGE_BOMB = "bomb_bonus";
- e.IMAGE_MESSAGE_WINDOW = "message_window";
- e.IMAGE_HINT_ARROW = "hint_arrow";
- e.IMAGE_GAMEOVER_CAPTION = "gameover_caption";
- e.IMAGE_TITLE_MAIN_MENU_BACK = "main_menu_back";
- e.IMAGE_SICKLE = "sickle";
- e.IMAGE_ROTATE = "rotate";
- e.IMAGE_BIG_SHINING = "big_shining";
- e.IMAGE_POINTS_CONTROL_BIG = "point_control_big";
- e.IMAGE_POINTS_CONTROL_SMALL = "point_control_small";
- e.IMAGE_LEVEL_BUTTON = "level_button";
- e.IMAGE_DIRT = "dirt";
- e.IMAGE_GUI = "gui";
- e.IMAGE_LOCK = "lock";
- e.IMAGE_OUT_OF_MOVES = "out_of_moves";
- e.IMAGE_WIN_CAPTION = "win_caption";
- e.IMAGE_STONE_HEART = "stone_heart";
- e.IMAGE_TASK_PANEL = "task_panel";
- e.IMAGE_HEART_PARTICLE = "heart_particle";
- e.IMAGE_WIN_STRINGS = "win_strings";
- e.IMAGE_GLOBAL_MAP = "global_map";
- e.IMAGE_CELL = "cell";
- e.IMAGE_BORDER_SIDE = "border_side";
- e.IMAGE_BORDER_CORNER = "border_corner";
- e.IMAGE_SELECT_LEVEL_BACK = "select_level_back";
- e.IMAGE_BUTTON_MORE_GAMES = "button_more_games";
- return e
- }();
- var AssetsManager = function(e) {
- function t(n) {
- e.call(this);
- this.loadingShape = new createjs.Shape;
- this.loadingShapeBack1 = new createjs.Shape;
- this.loadingShapeBack2 = new createjs.Shape;
- this.shader = null;
- this.maxWidth = 100;
- this.deltaY = 50;
- this.gameplaySprites = null;
- this.mainMenuSprites = null;
- t.g_instance = this;
- this.maxWidth = 300;
- document.getElementById("loader").className = "loader";
- createjs.EventDispatcher.initialize(t.prototype);
- this.manifest = n;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#4aa4c2");
- this.shader.graphics.drawRect(0, 0, this.maxWidth * 1.2, 130);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.labelPercentDownload = new createjs.Text("100%", "bold 45px Arial", "#ffffff");
- this.labelPercentDownload.textAlign = "center";
- this.addChild(this.labelPercentDownload);
- this.deltaY = this.labelPercentDownload.getBounds().height;
- this.loadingShapeBack1.graphics.beginFill("#4a7dc2");
- this.loadingShapeBack1.graphics.drawRect(0 - 4, 0 - 4, this.maxWidth + 8, this.deltaY + 8);
- this.loadingShapeBack1.graphics.endFill();
- this.addChild(this.loadingShapeBack1);
- this.loadingShape.graphics.beginFill("#ffffff");
- this.loadingShape.graphics.drawRect(0, 0, this.maxWidth, this.deltaY);
- this.loadingShape.graphics.endFill();
- this.addChild(this.loadingShape);
- this.loadingShape.scaleX = 0;
- this.onOrientationChanged(StateManager.g_instance.isLandscape())
- }
- __extends(t, e);
- t.prototype.startDownLoad = function() {
- var e = this;
- this.loader = new createjs.LoadQueue;
- this.loader.addEventListener("progress", function(t) {
- return e.handleProgress(t)
- });
- this.loader.addEventListener("complete", function(t) {
- return e.handleComplete(t)
- });
- createjs.Sound.registerManifest(this.manifest, "");
- this.loader.installPlugin(createjs.SoundJS);
- this.loader.loadManifest(this.manifest)
- };
- t.prototype.handleProgress = function(e) {
- this.labelPercentDownload.text = (e.loaded * 100).toFixed(1) + "%";
- this.loadingShape.scaleX = e.loaded
- };
- t.prototype.handleComplete = function(e) {
- this.removeChild(this.labelPercentDownload);
- this.dispatchEvent(Constants.LOAD_COMPLETE, this);
- document.getElementById("loader").className = ""
- };
- t.prototype.getResult = function(e) {
- return this.loader.getResult(e)
- };
- t.prototype.getBitmap = function(e) {
- return new createjs.Bitmap(this.loader.getResult(e))
- };
- t.prototype.getCenteredBitmap = function(e) {
- var t = new createjs.Bitmap(this.loader.getResult(e));
- if (!t.image) {
- console.log("ERROR HERE", e)
- }
- t.x = -t.image.width / 2;
- t.y = -t.image.height / 2;
- return t
- };
- t.prototype.getImage = function(e) {
- var t = this.getBitmap(e);
- if (t.getBounds()) {
- return t
- }
- var n = this.getSprite(e);
- if (n.getBounds()) {
- return n
- }
- return null
- };
- t.prototype.getCenteredImage = function(e) {
- var t = this.getImage(e);
- t.x = -t.getBounds().width / 2;
- t.y = -t.getBounds().height / 2;
- return t
- };
- t.prototype.getCenteredImageWithProxy = function(e) {
- var t = new createjs.Container;
- t.addChild(this.getCenteredImage(e));
- return t
- };
- t.prototype.getCenteredBitmapWithProxy = function(e) {
- var t = new createjs.Container;
- t.addChild(this.getCenteredBitmap(e));
- return t
- };
- t.prototype.getSprite = function(e) {
- var t = new createjs.Sprite(this.gameplaySprites, e);
- t.stop();
- return t
- };
- t.prototype.getCenteredSprite = function(e) {
- var t = this.getSprite(e);
- t.x = -t.getBounds().width / 2;
- t.y = -t.getBounds().height / 2;
- return t
- };
- t.prototype.onOrientationChanged = function(e) {
- if (Constants.g_isPC) {
- this.labelPercentDownload.x = Constants.ASSETS_WIDTH / 2;
- this.labelPercentDownload.y = Constants.ASSETS_HEIGHT / 2
- } else {
- this.labelPercentDownload.x = Constants.W / 2 * Constants.PIXEL_RATIO;
- this.labelPercentDownload.y = Constants.H / 2 * Constants.PIXEL_RATIO
- }
- this.loadingShape.x = this.labelPercentDownload.x - this.maxWidth / 2;
- this.loadingShape.y = this.labelPercentDownload.y + this.deltaY * 1.5;
- this.loadingShapeBack1.x = this.loadingShape.x;
- this.loadingShapeBack1.y = this.loadingShape.y;
- this.shader.x = this.labelPercentDownload.x - this.maxWidth * .6;
- this.shader.y = this.labelPercentDownload.y
- };
- return t
- }(createjs.Container);
- var GameObject = function(e) {
- function t() {
- e.call(this);
- this.liveTime = 0;
- this.killed = false
- }
- __extends(t, e);
- t.prototype.update = function(e) {
- this.liveTime += e
- };
- t.prototype.kill = function() {
- this.killed = true
- };
- t.prototype.isDead = function() {
- return this.killed
- };
- t.prototype.onDead = function() {
- if (this.parent) {
- this.parent.removeChild(this)
- }
- };
- return t
- }(createjs.Container);
- var Chip = function(e) {
- function t(n, r, i, s, o) {
- e.call(this);
- this.STATE_NORMAL = "STATE_NORMAL";
- this.STATE_EXCHANGE = "STATE_EXCHANGE";
- this.STATE_SHIFT_DOWN = "STATE_SHIFT_DOWN";
- this.STATE_MATCH = "STATE_MATCH";
- this.wasClear = false;
- this.state = null;
- this.rotationSpeed = 0;
- this.selected = false;
- this.stateTime = 0;
- this.rotationTimeOffset = Utils.RandomRange(0, 20);
- this.bonusType = null;
- this.jellyAnim = false;
- this.doubleMatched = false;
- this.canBeMatched = true;
- this.matchReason = null;
- this.hole = false;
- this.stoneHeart = false;
- this.spawnYPos = s;
- this.setIncexes(r, i);
- if (n != 9 && n != 0) {
- this.chipPicture = AssetsManager.g_instance.getImage("cake_" + n);
- this.addChild(this.chipPicture);
- this.chipPicture.x = -this.chipPicture.getBounds().width / 2;
- this.chipPicture.y = -Constants.CELL_SIZE
- }
- this.colorID = n;
- this.setState(t.STATE_SPAWN_NEW);
- this.spawnDelay = o;
- if (n == 9) {
- this.convertToStoneHeart()
- }
- }
- __extends(t, e);
- t.prototype.getMatchReason = function() {
- return this.matchReason
- };
- t.prototype.isHorizontal = function() {
- return this.horizontal
- };
- t.prototype.getBonusType = function() {
- return this.bonusType
- };
- t.prototype.getColorID = function() {
- return this.colorID
- };
- t.prototype.getIndeces = function() {
- return new createjs.Point(this.indexX, this.indexY)
- };
- t.prototype.getIndexX = function() {
- return this.indexX
- };
- t.prototype.getIndexY = function() {
- return this.indexY
- };
- t.prototype.setIncexes = function(e, t) {
- this.indexX = e;
- this.indexY = t
- };
- t.prototype.isMatching = function() {
- return this.state == this.STATE_MATCH
- };
- t.prototype.update = function(e) {
- this.stateTime += e;
- switch (this.state) {
- case this.STATE_NORMAL:
- {
- if (this.stoneHeart) {
- break
- }
- var n = this.stateTime * 9;
- var r = Math.sin(n) * .13;
- this.scaleX = 1 + r;
- this.scaleY = 1 - r;
- if (n >= Math.PI * 1) {
- this.scaleX = this.scaleY = 1
- }
- this.canBeMatched = true
- }
- break;
- case this.STATE_EXCHANGE:
- {
- if (this.stateTime >= Constants.EXCHANGE_TIME) {
- this.setState(this.STATE_NORMAL)
- }
- }
- break;
- case t.STATE_SPAWN_NEW:
- {
- this.spawnDelay -= e;
- if (this.spawnDelay < 0) {
- this.speed.y += this.acceleration.y * e;
- this.x += e * this.speed.x;
- this.y += e * this.speed.y;
- if (this.y >= this.spawnYPos) {
- this.y = this.spawnYPos;
- this.setState(this.STATE_NORMAL);
- PlayState.g_instance.onShiftEnded()
- }
- }
- }
- break;
- case this.STATE_SHIFT_DOWN:
- {
- this.speed.y += this.acceleration.y * e;
- this.x += e * this.speed.x;
- this.y += e * this.speed.y;
- if (this.y >= this.spawnYPos) {
- this.y = this.spawnYPos;
- this.setState(this.STATE_NORMAL);
- PlayState.g_instance.onShiftEnded()
- }
- }
- break;
- case t.STATE_FALL_DOWN:
- {
- this.speed.y += this.acceleration.y * e;
- this.x += e * this.speed.x;
- this.y += e * this.speed.y;
- this.rotation += this.rotationSpeed * e;
- if (this.y >= 1e3) {
- this.kill()
- }
- }
- break;
- case this.STATE_MATCH:
- {
- this.scaleY = 1 - this.stateTime * 1.5;
- this.scaleX = 1 + this.stateTime * 1.5;
- this.alpha = 1 - this.stateTime / Constants.MATCH_TIME;
- if (this.stateTime >= Constants.MATCH_TIME / 2 && !this.wasClear) {
- PlayState.g_instance.addPointsAt(this, this.matchReason);
- PlayState.g_instance.clearCell(this);
- this.wasClear = true
- }
- if (this.stateTime >= Constants.MATCH_TIME) {
- this.kill()
- }
- }
- break
- }
- if (this.shiningCircle) {
- this.shiningCircle.rotation += e * 20
- }
- };
- t.prototype.setState = function(e) {
- if (e == this.state) {
- return
- }
- this.stateTime = 0;
- this.state = e;
- switch (e) {
- case this.STATE_NORMAL:
- this.jellyAnim = true;
- break;
- case this.STATE_EXCHANGE:
- break;
- case this.STATE_SHIFT_DOWN:
- createjs.Tween.get(this, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 170, createjs.Ease.linear);
- break;
- case t.STATE_SPAWN_NEW:
- {
- this.speed = new createjs.Point(0, 500);
- this.acceleration = new createjs.Point(0, Constants.GRAVITY_ACC)
- }
- break
- }
- };
- t.prototype.exchange = function(e, t) {
- this.deselect();
- this.setState(this.STATE_EXCHANGE);
- this.indexX = e;
- this.indexY = t
- };
- t.prototype.shiftDown = function(e, t) {
- this.speed = new createjs.Point(0, -250);
- this.deselect();
- this.indexY = e;
- this.spawnYPos = t;
- this.setState(this.STATE_SHIFT_DOWN)
- };
- t.prototype.match = function(e) {
- if (this.stoneHeart) {
- this.fallDown();
- return
- }
- if (this.isHole()) {
- return
- }
- if (this.state == this.STATE_MATCH) {
- this.doubleMatched = true
- }
- if (!this.canBeMatched) {
- return
- }
- this.matchReason = e;
- this.setState(this.STATE_MATCH)
- };
- t.prototype.isDoubleMatched = function() {
- return this.doubleMatched
- };
- t.prototype.select = function() {
- this.stateTime = 0;
- this.jellyAnim = true;
- this.selected = true
- };
- t.prototype.deselect = function() {
- if (this.selected) {
- this.scaleX = this.scaleY = 1;
- this.selected = false
- }
- };
- t.prototype.isNormal = function() {
- return this.state == this.STATE_NORMAL || this.state == t.STATE_HOLE
- };
- t.prototype.getState = function() {
- return this.state
- };
- t.prototype.isBonus = function() {
- return this.bonusType != null;
- };
- t.prototype.convertToBonus = function(e, n) {
- this.horizontal = n;
- this.bonusType = e;
- this.removeAllChildren();
- if (e == t.BONUS_5) {
- var r = AssetsManager.g_instance.getImage("donut");
- this.addChild(r);
- r.x = -r.getBounds().width / 2;
- r.y = -r.getBounds().height
- }
- if (e == t.BONUS_4) {
- var r = AssetsManager.g_instance.getImage(this.horizontal ? Constants.IMAGE_ARROW_BONUS_HOR : Constants.IMAGE_ARROW_BONUS_VERT);
- this.addChild(r);
- r.x = -r.getBounds().width / 2;
- r.y = -r.getBounds().height
- }
- if (e == t.BONUS_BOMB) {
- var r = AssetsManager.g_instance.getImage(Constants.IMAGE_BOMB);
- this.addChild(r);
- r.x = -r.getBounds().width / 2;
- r.y = -r.getBounds().height
- }
- if (this.state != t.STATE_SPAWN_NEW) {
- PlayState.g_instance.addConverToBonusEffect(this)
- }
- this.canBeMatched = false;
- PlayState.g_instance.takeStockMatch(this);
- this.colorID = -1;
- this.setState(this.STATE_NORMAL);
- PlayState.g_instance.tryClearDirt(this.indexX, this.indexY);
- PlayState.g_instance.tryClearStoneHeart(this.indexX, this.indexY)
- };
- t.prototype.fallDown = function() {
- if (this.state == t.STATE_FALL_DOWN) {
- return
- }
- this.setState(t.STATE_FALL_DOWN);
- this.chipPicture.y = -this.chipPicture.getBounds().height / 2;
- this.y -= this.chipPicture.getBounds().height / 2;
- this.speed = new createjs.Point(Utils.RandomRange(-100, 100), -250);
- this.rotationSpeed = Utils.RandomRange(-300, 300);
- PlayState.g_instance.addChild(this);
- if (!this.wasClear) {
- PlayState.g_instance.clearCell(this);
- this.wasClear = true
- }
- };
- t.prototype.isHole = function() {
- return this.hole
- };
- t.prototype.convertToHole = function() {
- this.removeAllChildren();
- this.hole = true;
- this.y = this.spawnYPos;
- this.setState(t.STATE_HOLE);
- this.colorID = -1
- };
- t.prototype.convertToStoneHeart = function() {
- this.stoneHeart = true;
- this.colorID = -1;
- var e = Constants.IMAGE_STONE_HEART;
- this.chipPicture = AssetsManager.g_instance.getImage(e);
- this.addChild(this.chipPicture);
- this.chipPicture.x = -this.chipPicture.getBounds().width / 2;
- this.chipPicture.y = -83
- };
- t.prototype.isStoneHeart = function() {
- return this.stoneHeart
- };
- t.BONUS_4 = "BONUS_4";
- t.BONUS_5 = "BONUS_5";
- t.BONUS_BOMB = "BONUS_BOMB";
- t.STATE_SPAWN_NEW = "STATE_SPAWN_NEW";
- t.STATE_FALL_DOWN = "STATE_FALL_DOWN";
- t.STATE_HOLE = "STATE_HOLE";
- t.MATCH_REASON_SIMPLE = "MATCH_REASON_SIMPLE";
- t.MATCH_REASON_EXCHANGE_WIHT_BONUS = "MATCH_REASON_EXCHANGE_WIHT_BONUS";
- t.MATCH_REASON_BONUS_EFFECT_5 = "MATCH_REASON_BONUS_EFFECT_5";
- t.MATCH_REASON_BONUS_EFFECT_4_HOR = "MATCH_REASON_BONUS_EFFECT_4_HOR";
- t.MATCH_REASON_BONUS_EFFECT_4_VERT = "MATCH_REASON_BONUS_EFFECT_4_VERT";
- t.MATCH_REASON_I_AM_BONUS = "MATCH_REASON_I_AM_BONUS";
- return t
- }(GameObject);
- var Utils = function() {
- function e() {}
- e.RandomRange = function(e, t) {
- return e + (t - e) * Math.random()
- };
- e.RandomRangeInt = function(e, t) {
- return Math.floor(Math.random() * (t - e + 1)) + e
- };
- e.IntToTimeString = function(e) {
- var t = Math.floor(e / 60);
- var n = t.toString();
- var r = e % 60;
- var i;
- if (r < 10) {
- i = "0" + r
- } else {
- i = r.toString()
- }
- return n + "d" + i
- };
- e.RadToGrad = function(e) {
- return e * 180 / Math.PI
- };
- e.GradToRad = function(e) {
- return e * Math.PI / 180
- };
- e.IsMobileBrowser = function() {
- if (window["orientation"] != undefined) {
- return true
- }
- var e = false;
- (function(t) {
- if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) e = true
- })(navigator.userAgent || navigator.vendor || window["opera"]);
- return e;
- return false
- };
- e.ScaledOffset = function(e) {
- return (window.devicePixelRatio ? window.devicePixelRatio : 1) * e / Constants.SCREEN_SCALE
- };
- e.GetScoreString = function(e) {
- var t = e.toString();
- switch (t.length) {
- case 1:
- t = "00000" + t;
- break;
- case 2:
- t = "0000" + t;
- break;
- case 3:
- t = "000" + t;
- break;
- case 4:
- t = "00" + t;
- break;
- case 5:
- t = "0" + t;
- break
- }
- return t
- };
- return e
- }();
- var GameOverState = function(e) {
- function t(t, n) {
- var r = this;
- e.call(this);
- this.panel = new createjs.Container;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#000000");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- this.shaderTween = createjs.Tween.get(this.shader, {
- loop: false
- }).wait(400).to({
- alpha: .4
- }, 800, createjs.Ease.linear);
- this.addChild(this.panel);
- this.panel.x = Constants.ASSETS_WIDTH / 2;
- this.panel.y = Constants.SCREEN_HEIGHT / 2;
- var i = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_MESSAGE_WINDOW);
- this.panel.addChild(i);
- var s = new DNButton(Constants.IMAGE_BUTTON_RESTART, function() {
- return r.onRestartTouch()
- });
- this.panel.addChild(s);
- this.addGuiObject(s);
- s.x = -110;
- s.y = 100;
- var o = new DNButton(Constants.IMAGE_BUTTON_EXIT, function() {
- return r.onExitTouch()
- });
- this.panel.addChild(o);
- this.addGuiObject(o);
- o.x = +110;
- o.y = 100;
- var u = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_GAMEOVER_CAPTION);
- this.panel.addChild(u);
- u.y = -210;
- var a = -180;
- var f = +180;
- this.panel.alpha = 0;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- alpha: 1
- }, 200, createjs.Ease.linear);
- this.panel.scaleX = .7;
- this.panel.scaleY = .7;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 400, createjs.Ease.backOut);
- try {
- SG_Hooks.gameOver(PlayState.g_curLevel, n)
- } catch (l) {
- console.log("error SG_Hooks.gameOver(PlayState.g_curLevel, score);")
- }
- }
- __extends(t, e);
- t.prototype.onRestartTouch = function() {
- StateManager.g_instance.pushState(new ShadeInCircleState(new PlayState(PlayState.g_curLevel, false)))
- };
- t.prototype.onExitTouch = function() {
- StateManager.g_instance.pushState(new ShadeInState(new MainMenuState))
- };
- return t
- }(GameState);
- var MainMenuState = function(e) {
- function t() {
- var t = this;
- e.call(this);
- this.someThing = true;
- t.soundTouched = false;
- this.addChild(AssetsManager.g_instance.getImage(Constants.IMAGE_TITLE_MAIN_MENU_BACK));
- var n = new createjs.Container;
- this.addChild(n);
- n.x = Constants.ASSETS_WIDTH / 2;
- n.y = 690;
- n.scaleX = n.scaleY = 1.35;
- var r = new DNButton(Constants.IMAGE_BUTTON_PLAY, function() {
- console.log("start button pressed");
- SG_Hooks.start();
- console.log("SG_Hooks triggered!");
- return t.onPlayTouch()
- });
- n.addChild(r);
- this.addGuiObject(r);
- createjs.Tween.get(r, {
- loop: true
- }).to({
- scaleX: +1.05,
- scaleY: +1.05
- }, 150, createjs.Ease.linear).to({
- scaleX: +.95,
- scaleY: +.95
- }, 300, createjs.Ease.linear).to({
- scaleX: 1,
- scaleY: 1
- }, 150, createjs.Ease.linear).wait(4e3);
- var i = new DNButton(Constants.IMAGE_BUTTON_MORE_GAMES, function() {
- return t.onMoreGamesTouch()
- });
- this.addChild(i);
- this.addGuiObject(i);
- i.x = 150;
- i.y = 700;
- this.setSoundButton();
- this.configureYAlign()
- }
- __extends(t, e);
- t.prototype.configureYAlign = function() {
- if (Constants.g_isPC) {
- return
- }
- if (Constants.SCREEN_HEIGHT > Constants.ASSETS_HEIGHT) {
- this.y = (Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT) / 2;
- var e = new createjs.Shape;
- e.graphics.beginFill("#ffffff");
- e.graphics.drawRect(0, Constants.ASSETS_HEIGHT, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT + 1);
- e.graphics.endFill();
- this.addChild(e);
- var t = new createjs.Shape;
- t.graphics.beginFill("#ffffff");
- t.graphics.drawRect(0, Constants.ASSETS_HEIGHT - Constants.SCREEN_HEIGHT, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT);
- t.graphics.endFill();
- this.addChild(t)
- }
- };
- t.prototype.onOrientationChanged = function(t) {
- e.prototype.onOrientationChanged.call(this, t);
- if (!t) {
- this.configureYAlign()
- }
- };
- t.prototype.init = function() {
- e.prototype.init.call(this)
- };
- t.prototype.runJelly = function() {
- this.liveTime = 0
- };
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t)
- };
- t.prototype.onSoundTouch = function() {
- var e = this;
- if (e.soundTouched == false) {
- e.soundTouched = true;
- SoundManager.g_instance.setSoundEnabled(!SoundManager.g_instance.isSoundEnabled());
- this.setSoundButton();
- setTimeout(function() {
- e.soundTouched = false
- }, 500)
- }
- };
- t.prototype.setSoundButton = function() {
- var e = this;
- if (this.soundButton && this.soundButton.parent) {
- this.soundButton.parent.removeChild(this.soundButton)
- }
- var t = SoundManager.g_instance.isSoundEnabled();
- this.soundButton = new DNButton(t ? Constants.IMAGE_BUTTON_SOUND_ON : Constants.IMAGE_BUTTON_SOUND_OFF, function() {
- return e.onSoundTouch()
- });
- this.addChild(this.soundButton);
- this.addGuiObject(this.soundButton);
- this.soundButton.x = +620;
- this.soundButton.y = +150
- };
- t.prototype.onMouseDown = function(t, n) {
- e.prototype.onMouseDown.call(this, t, n)
- };
- t.prototype.onCreditsTouch = function() {
- StateManager.g_instance.pushState(new CreditsState)
- };
- t.prototype.onMoreGamesTouch = function() {
- Play68.goHome()
- };
- t.prototype.onPlayTouch = function() {
- StateManager.g_instance.pushState(new ShadeInState(new SelectLevelState))
- };
- t.prototype.resume = function() {
- this.configureYAlign()
- };
- return t
- }(GameState);
- var ShadeInState = function(e) {
- function t(t) {
- var n = this;
- e.call(this);
- this.nextState = null;
- this.nextState = t;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#ffffff");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: 1
- }, 400, createjs.Ease.linear).call(function() {
- return n.onFinishShade()
- })
- }
- __extends(t, e);
- t.prototype.onFinishShade = function() {
- StateManager.g_instance.changeState(this.nextState);
- StateManager.g_instance.pushState(new ShadeOutState)
- };
- t.prototype.setNextState = function(e) {
- this.nextState = e
- };
- return t
- }(GameState);
- var ShadeOutState = function(e) {
- function t() {
- var t = this;
- e.call(this);
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#ffffff");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: 0
- }, 400, createjs.Ease.linear).call(function() {
- return t.onFinishShade()
- })
- }
- __extends(t, e);
- t.prototype.onFinishShade = function() {
- StateManager.g_instance.popState()
- };
- return t
- }(GameState);
- var ShadeInCircleState = function(e) {
- function t(t) {
- var n = this;
- e.call(this);
- this.nextState = null;
- this.nextState = t;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#ffffff");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- createjs.Tween.get(this.shader, {
- loop: false
- }).wait(400).to({
- alpha: 1
- }, 400, createjs.Ease.linear).call(function() {
- return n.onFinishShade()
- });
- this.shining = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_BIG_SHINING);
- this.addChild(this.shining);
- this.shining.x = Constants.ASSETS_WIDTH / 2;
- this.shining.y = Constants.ASSETS_HEIGHT / 2;
- createjs.Tween.get(this.shining, {
- loop: false
- }).to({
- scaleX: 3.5,
- scaleY: 3.5
- }, 800, createjs.Ease.linear);
- this.shining.alpha = 0;
- createjs.Tween.get(this.shining, {
- loop: false
- }).to({
- alpha: 1
- }, 400, createjs.Ease.linear);
- createjs.Tween.get(this.shining, {
- loop: false
- }).to({
- rotation: 100
- }, 800, createjs.Ease.linear)
- }
- __extends(t, e);
- t.prototype.onFinishShade = function() {
- StateManager.g_instance.changeState(this.nextState);
- StateManager.g_instance.pushState(new ShadeOutState)
- };
- t.prototype.setNextState = function(e) {
- this.nextState = e
- };
- return t
- }(GameState);
- var CreditsState = function(e) {
- function t() {
- e.call(this);
- this.hiddingNow = false;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#ffffff");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: .82
- }, 500, createjs.Ease.linear);
- this.container = new createjs.Container;
- this.addChild(this.container);
- this.container.alpha = 0;
- createjs.Tween.get(this.container, {
- loop: false
- }).to({
- alpha: 1
- }, 500, createjs.Ease.linear);
- var t = ["PROGRAMMING / GAME DESIGN:", "Konstantin Boronenkov", "", "", "ART:", "Vladimir Makarov", "Anna Turkova", "", "", "MUSIC / SOUND:", "Alexander Ahuro", "", "", "Hypnocat Studio 2014", "gibbetsfeedback@gmail.com"];
- for (var n = 0; n < t.length; n++) {
- var r = new createjs.Text(t[n], "bold 35px Times New Roman", "#222222");
- r.textAlign = "center";
- this.container.addChild(r);
- r.x = Constants.ASSETS_WIDTH / 2;
- r.y = 100 + n * 40
- }
- }
- __extends(t, e);
- t.prototype.onMouseDown = function(e, t) {
- this.hide()
- };
- t.prototype.hide = function() {
- if (!this.hiddingNow) {
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: 0
- }, 400, createjs.Ease.linear).call(function() {
- StateManager.g_instance.popState()
- });
- createjs.Tween.get(this.container, {
- loop: false
- }).to({
- alpha: 0
- }, 400, createjs.Ease.linear);
- this.hiddingNow = true
- }
- };
- return t
- }(GameState);
- var GameData = function() {
- function e() {
- this.levelsCompleted = 0;
- this.totalScore = 0;
- this.levels = [{
- form: [
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- dirt: null,
- chips: [
- [0, 5, 3, 2, 1, 2, 5, 0],
- [0, 1, 2, 1, 2, 1, 4, 0],
- [0, 3, 1, 5, 1, 5, 1, 0],
- [0, 1, 2, 3, 3, 2, 4, 0],
- [0, 2, 3, 5, 1, 4, 1, 0],
- [0, 2, 5, 3, 5, 1, 4, 0],
- [0, 1, 2, 3, 1, 4, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chip_types: 5,
- moves: 25,
- chip_goal: 4,
- chip_goal_count: 13
- }, {
- form: [
- [0, 0, 1, 0, 0, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 0, 0, 1, 0, 0]
- ],
- dirt: null,
- chips: [
- [0, 0, 4, 0, 0, 1, 0, 0],
- [0, 1, 2, 2, 3, 4, 5, 0],
- [2, 1, 3, 3, 4, 1, 2, 3],
- [0, 4, 1, 5, 4, 4, 2, 0],
- [0, 3, 4, 1, 2, 3, 1, 0],
- [1, 2, 3, 5, 5, 3, 5, 2],
- [0, 5, 1, 5, 4, 2, 2, 0],
- [0, 0, 5, 0, 0, 1, 0, 0]
- ],
- chip_types: 5,
- moves: 30,
- chip_goal: 1,
- chip_goal_count: 20
- }, {
- form: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 1, 2, 4, 3, 4, 5, 0],
- [0, 3, 3, 5, 2, 1, 5, 0],
- [0, 2, 4, 1, 2, 6, 6, 0],
- [0, 2, 4, 2, 3, 3, 4, 0],
- [0, 1, 2, 3, 4, 6, 6, 0],
- [0, 2, 1, 5, 5, 4, 2, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chip_types: 6,
- moves: 40,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 0, 0, 1, 1, 0],
- [0, 1, 1, 0, 0, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 0, 0, 1, 1, 0],
- [0, 1, 1, 0, 0, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [0, 4, 3, 1, 4, 3, 1, 0],
- [0, 1, 1, 2, 1, 1, 4, 0],
- [0, 2, 1, 1, 2, 3, 1, 0],
- [0, 3, 3, 0, 0, 1, 2, 0],
- [0, 4, 4, 0, 0, 2, 1, 0],
- [0, 4, 4, 2, 2, 1, 2, 0],
- [0, 2, 3, 3, 4, 4, 1, 0],
- [0, 1, 2, 2, 3, 4, 1, 0]
- ],
- chip_types: 4,
- moves: 25,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- dirt: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- chips: [
- [0, 0, 0, 2, 1, 0, 0, 0],
- [0, 0, 3, 2, 2, 1, 0, 0],
- [0, 5, 1, 9, 9, 4, 4, 0],
- [3, 1, 9, 9, 9, 9, 2, 1],
- [1, 3, 9, 9, 9, 9, 4, 5],
- [0, 1, 2, 9, 9, 1, 2, 0],
- [0, 0, 3, 2, 2, 4, 0, 0],
- [0, 0, 0, 3, 2, 0, 0, 0]
- ],
- chip_types: 5,
- moves: 25,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: null,
- chips: [
- [2, 3, 4, 5, 5, 1, 6, 6],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [1, 2, 2, 3, 3, 2, 4, 1],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [2, 2, 1, 2, 1, 5, 4, 6],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [4, 5, 6, 2, 1, 3, 2, 2],
- [9, 9, 9, 9, 9, 9, 9, 9]
- ],
- chip_types: 6,
- moves: 20,
- chip_goal: 3,
- chip_goal_count: 20
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: null,
- chips: [
- [1, 2, 6, 5, 1, 5, 1, 2],
- [4, 1, 3, 3, 2, 3, 5, 5],
- [1, 2, 1, 6, 6, 2, 1, 6],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [2, 3, 2, 5, 6, 5, 1, 2],
- [2, 3, 2, 1, 2, 4, 2, 3],
- [3, 6, 6, 2, 1, 3, 3, 2],
- [6, 1, 2, 4, 4, 1, 4, 4]
- ],
- chip_types: 6,
- moves: 30,
- chip_goal: 4,
- chip_goal_count: 12
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 0, 1, 1, 0, 1, 1],
- [1, 0, 0, 0, 0, 0, 0, 1]
- ],
- dirt: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [5, 5, 1, 3, 5, 4, 1, 2],
- [2, 2, 5, 1, 3, 4, 5, 2],
- [1, 2, 2, 1, 3, 3, 4, 5],
- [5, 3, 4, 4, 1, 4, 3, 1],
- [2, 1, 2, 3, 2, 4, 2, 5],
- [1, 2, 1, 2, 5, 1, 4, 2],
- [5, 4, 0, 2, 1, 0, 3, 3],
- [3, 0, 0, 0, 0, 0, 0, 3]
- ],
- chip_types: 5,
- moves: 30,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- dirt: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- chips: [
- [0, 0, 0, 9, 9, 0, 0, 0],
- [0, 0, 0, 9, 9, 0, 0, 0],
- [0, 2, 3, 9, 9, 2, 4, 0],
- [3, 4, 2, 9, 9, 3, 4, 1],
- [1, 2, 4, 9, 9, 2, 2, 4],
- [0, 2, 1, 9, 9, 2, 1, 0],
- [0, 0, 3, 9, 9, 3, 0, 0],
- [0, 0, 0, 9, 9, 0, 0, 0]
- ],
- chip_types: 4,
- moves: 30,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0]
- ],
- dirt: null,
- chips: [
- [0, 2, 6, 5, 1, 5, 1, 0],
- [4, 1, 3, 3, 2, 3, 5, 5],
- [1, 2, 1, 6, 6, 2, 1, 6],
- [7, 7, 1, 0, 0, 2, 1, 3],
- [1, 5, 6, 0, 0, 6, 7, 7],
- [2, 3, 2, 1, 2, 4, 2, 3],
- [3, 6, 6, 2, 1, 3, 3, 2],
- [0, 1, 2, 4, 4, 1, 4, 0]
- ],
- chip_types: 7,
- moves: 25,
- chip_goal: 7,
- chip_goal_count: 8
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 0, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 1, 1, 1, 1],
- [0, 0, 0, 0, 0, 1, 1, 1],
- [0, 0, 0, 0, 0, 0, 1, 1],
- [0, 0, 0, 0, 0, 0, 1, 1]
- ],
- dirt: null,
- chips: [
- [1, 2, 6, 5, 1, 5, 5, 9],
- [2, 1, 3, 3, 2, 3, 5, 9],
- [0, 0, 1, 6, 6, 2, 1, 9],
- [0, 0, 0, 3, 3, 2, 1, 9],
- [0, 0, 0, 0, 1, 6, 7, 9],
- [0, 0, 0, 0, 0, 3, 2, 9],
- [0, 0, 0, 0, 0, 0, 3, 9],
- [0, 0, 0, 0, 0, 0, 3, 9]
- ],
- chip_types: 7,
- moves: 21,
- chip_goal: 6,
- chip_goal_count: 12
- }, {
- form: [
- [0, 0, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 1, 1, 1, 1, 1],
- [1, 0, 0, 0, 1, 1, 1, 1],
- [1, 1, 0, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 0, 1, 1],
- [1, 1, 1, 1, 0, 0, 0, 1],
- [1, 1, 1, 1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 0, 0]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 0, 0]
- ],
- chips: [
- [0, 0, 9, 1, 1, 4, 9, 9],
- [0, 0, 0, 5, 4, 2, 9, 9],
- [2, 0, 0, 0, 2, 1, 1, 2],
- [1, 2, 0, 0, 0, 5, 5, 4],
- [2, 1, 3, 0, 0, 0, 1, 1],
- [1, 2, 5, 3, 0, 0, 0, 4],
- [9, 9, 5, 1, 5, 0, 0, 0],
- [9, 9, 1, 4, 1, 9, 0, 0]
- ],
- chip_types: 5,
- moves: 45,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 0, 1, 0, 1],
- [1, 0, 0, 0, 0, 0, 0, 1]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 0, 0, 1, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [2, 1, 5, 4, 2, 3, 3, 2],
- [4, 5, 3, 4, 4, 5, 4, 1],
- [5, 4, 3, 5, 5, 3, 5, 4],
- [3, 4, 5, 4, 3, 4, 3, 5],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [9, 0, 9, 0, 0, 9, 0, 9],
- [9, 0, 0, 0, 0, 0, 0, 9]
- ],
- chip_types: 5,
- moves: 30,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 0, 1, 1, 1, 0],
- [1, 0, 1, 1, 1, 0, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: null,
- chips: [
- [4, 4, 3, 3, 4, 4, 1, 1],
- [2, 4, 2, 0, 1, 4, 1, 0],
- [3, 0, 4, 2, 2, 0, 3, 1],
- [2, 3, 1, 4, 1, 2, 1, 3],
- [4, 4, 1, 2, 3, 1, 3, 4],
- [0, 2, 0, 1, 0, 2, 0, 4],
- [0, 1, 0, 1, 0, 1, 0, 2],
- [1, 2, 3, 4, 1, 2, 1, 1]
- ],
- chip_types: 4,
- moves: 20,
- chip_goal: 2,
- chip_goal_count: 35
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 0, 0, 0, 0, 1, 1]
- ],
- dirt: null,
- chips: [
- [9, 2, 3, 9, 9, 3, 4, 9],
- [9, 5, 6, 9, 9, 6, 1, 9],
- [9, 0, 0, 9, 9, 4, 4, 9],
- [9, 3, 2, 9, 9, 2, 2, 9],
- [9, 5, 6, 9, 9, 4, 1, 9],
- [9, 1, 6, 9, 9, 4, 6, 9],
- [9, 6, 1, 9, 9, 5, 6, 9],
- [9, 1, 0, 0, 0, 0, 1, 9]
- ],
- chip_types: 6,
- moves: 23,
- chip_goal: 1,
- chip_goal_count: 20
- }, {
- form: [
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1]
- ],
- dirt: null,
- chips: [
- [1, 1, 2, 0, 0, 2, 2, 7],
- [2, 1, 2, 0, 0, 1, 3, 1],
- [6, 6, 5, 0, 0, 2, 2, 1],
- [5, 6, 6, 9, 9, 1, 6, 5],
- [1, 2, 3, 9, 9, 3, 6, 5],
- [7, 3, 2, 0, 0, 2, 7, 1],
- [1, 7, 7, 0, 0, 1, 7, 1],
- [9, 9, 9, 0, 0, 9, 9, 9]
- ],
- chip_types: 7,
- moves: 36,
- chip_goal: 7,
- chip_goal_count: 20
- }, {
- form: [
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- dirt: null,
- chips: [
- [0, 0, 0, 2, 3, 0, 0, 0],
- [0, 0, 0, 4, 5, 0, 0, 0],
- [0, 0, 1, 2, 2, 3, 2, 0],
- [0, 1, 3, 4, 5, 3, 4, 0],
- [0, 1, 3, 4, 2, 2, 3, 0],
- [0, 0, 1, 2, 3, 4, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0]
- ],
- chip_types: 5,
- moves: 18,
- chip_goal: 5,
- chip_goal_count: 15
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- chips: [
- [5, 4, 3, 4, 5, 4, 5, 4],
- [4, 5, 4, 5, 3, 5, 4, 3],
- [3, 0, 0, 5, 3, 0, 0, 2],
- [1, 1, 3, 1, 1, 5, 1, 1],
- [2, 0, 0, 1, 3, 0, 0, 2],
- [3, 1, 4, 3, 1, 5, 2, 1],
- [1, 5, 1, 3, 1, 4, 1, 2],
- [1, 5, 1, 2, 5, 1, 2, 1]
- ],
- chip_types: 5,
- moves: 26,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [1, 2, 1, 2, 2, 3, 4, 1],
- [7, 7, 6, 5, 4, 6, 5, 7],
- [2, 3, 4, 5, 4, 5, 2, 1],
- [2, 6, 6, 4, 5, 5, 6, 7],
- [9, 9, 9, 9, 9, 9, 9, 9],
- [2, 1, 3, 4, 5, 4, 3, 3],
- [1, 2, 3, 4, 5, 4, 3, 3],
- [1, 2, 4, 3, 4, 5, 7, 7]
- ],
- chip_types: 7,
- moves: 50,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [1, 0, 1, 0, 1, 0, 1, 0],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [0, 1, 0, 1, 0, 1, 0, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [0, 1, 0, 1, 0, 1, 0, 1]
- ],
- chips: [
- [5, 5, 4, 9, 9, 2, 3, 4],
- [1, 2, 1, 9, 9, 3, 5, 5],
- [3, 4, 5, 9, 9, 5, 4, 3],
- [3, 5, 1, 9, 9, 3, 2, 1],
- [2, 1, 2, 9, 9, 1, 5, 2],
- [1, 5, 9, 9, 9, 9, 3, 1],
- [3, 9, 9, 9, 9, 9, 9, 4],
- [9, 9, 9, 9, 9, 9, 9, 9]
- ],
- chip_types: 5,
- moves: 26,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1]
- ],
- dirt: [
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [0, 1, 1, 0, 0, 1, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1],
- [1, 1, 1, 0, 0, 1, 1, 1]
- ],
- chips: [
- [1, 5, 4, 4, 1, 1, 3, 2],
- [1, 5, 3, 1, 1, 5, 1, 2],
- [0, 1, 3, 2, 4, 4, 3, 0],
- [0, 0, 4, 1, 2, 1, 0, 0],
- [0, 2, 3, 5, 5, 4, 2, 0],
- [9, 9, 9, 1, 2, 9, 9, 9],
- [9, 9, 9, 3, 4, 9, 9, 9],
- [9, 9, 9, 0, 0, 9, 9, 9]
- ],
- chip_types: 5,
- moves: 45,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 0, 0, 0, 0, 1, 1],
- [1, 1, 0, 1, 1, 0, 1, 1],
- [1, 1, 0, 0, 0, 0, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 1, 1, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0]
- ],
- chips: [
- [5, 4, 3, 5, 2, 5, 3, 4],
- [1, 2, 1, 2, 1, 2, 1, 2],
- [2, 1, 0, 0, 0, 0, 1, 1],
- [1, 3, 0, 1, 1, 0, 3, 1],
- [4, 5, 0, 0, 0, 0, 1, 5],
- [1, 4, 1, 4, 4, 5, 1, 1],
- [5, 1, 3, 4, 1, 4, 2, 5],
- [1, 5, 1, 3, 2, 3, 1, 1]
- ],
- chip_types: 5,
- moves: 30,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0]
- ],
- dirt: [
- [1, 0, 1, 0, 1, 0, 1, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 0, 1, 0, 1, 0, 1, 0]
- ],
- chips: [
- [2, 0, 5, 0, 3, 0, 2, 0],
- [3, 4, 5, 4, 1, 2, 5, 5],
- [3, 3, 4, 3, 1, 1, 2, 1],
- [5, 2, 1, 1, 2, 5, 1, 3],
- [5, 1, 4, 3, 1, 3, 2, 1],
- [1, 2, 1, 2, 3, 2, 1, 5],
- [5, 3, 4, 4, 5, 5, 2, 1],
- [1, 0, 4, 0, 3, 0, 1, 0]
- ],
- chip_types: 5,
- moves: 40,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 0, 1, 1, 1, 1, 1],
- [1, 0, 0, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 0, 0, 1],
- [1, 1, 1, 1, 1, 0, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 0, 0, 0, 0],
- [1, 1, 0, 1, 0, 0, 0, 0],
- [1, 0, 0, 1, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 1, 0, 0, 1],
- [0, 0, 0, 0, 1, 0, 1, 1],
- [0, 0, 0, 0, 1, 1, 1, 1]
- ],
- chips: [
- [5, 4, 3, 5, 2, 1, 1, 2],
- [3, 5, 4, 5, 4, 3, 1, 2],
- [1, 5, 0, 2, 1, 2, 3, 4],
- [1, 0, 0, 2, 1, 2, 3, 4],
- [4, 3, 4, 5, 2, 4, 5, 5],
- [3, 5, 4, 2, 1, 0, 0, 1],
- [3, 2, 3, 1, 2, 0, 1, 4],
- [5, 4, 4, 5, 3, 5, 1, 1]
- ],
- chip_types: 5,
- moves: 30,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 1, 1, 1, 1]
- ],
- dirt: [
- [1, 1, 1, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 0, 0],
- [0, 1, 1, 1, 1, 1, 1, 0],
- [0, 0, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 1, 1, 1, 1]
- ],
- chips: [
- [1, 7, 1, 0, 0, 0, 0, 0],
- [5, 6, 4, 5, 0, 0, 0, 0],
- [3, 2, 4, 5, 3, 0, 0, 0],
- [1, 1, 3, 2, 3, 1, 0, 0],
- [0, 4, 5, 4, 4, 7, 2, 0],
- [0, 0, 5, 1, 5, 7, 7, 1],
- [0, 0, 0, 1, 3, 5, 6, 7],
- [0, 0, 0, 0, 2, 1, 6, 7]
- ],
- chip_types: 7,
- moves: 40,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0]
- ],
- dirt: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 0, 1, 0, 1, 0, 1, 0]
- ],
- chips: [
- [1, 4, 1, 4, 1, 4, 3, 2],
- [2, 0, 1, 0, 3, 0, 3, 0],
- [3, 1, 3, 1, 4, 1, 4, 1],
- [2, 0, 4, 0, 1, 0, 3, 0],
- [4, 1, 3, 1, 3, 1, 2, 2],
- [2, 0, 1, 0, 2, 0, 4, 0],
- [1, 1, 2, 1, 3, 1, 2, 1],
- [2, 0, 1, 0, 1, 0, 2, 0]
- ],
- chip_types: 4,
- moves: 17,
- chip_goal: 0,
- chip_goal_count: 0
- }, {
- form: [
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [1, 1, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- dirt: [
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 1, 1, 1, 1, 1, 1, 1]
- ],
- chips: [
- [1, 3, 6, 6, 5, 5, 2, 1],
- [3, 1, 6, 6, 5, 5, 2, 3],
- [1, 2, 3, 3, 2, 1, 4, 6],
- [2, 1, 2, 4, 5, 6, 1, 6],
- [3, 1, 2, 4, 3, 5, 6, 1],
- [1, 3, 4, 3, 4, 5, 1, 2],
- [0, 0, 0, 0, 0, 0, 0, 0],
- [1, 3, 4, 1, 2, 1, 2, 1]
- ],
- chip_types: 6,
- moves: 20,
- chip_goal: 0,
- chip_goal_count: 0
- }]
- }
- e.getInstance = function() {
- if (this.instance == null) {
- this.instance = new e
- }
- return this.instance
- };
- e.prototype.save = function() {
- try {
- window.localStorage.setItem("levelsCompleted", this.levelsCompleted.toString());
- window.localStorage.setItem("totalScore", this.totalScore.toString())
- } catch (e) {}
- };
- e.prototype.load = function() {
- try {
- this.levelsCompleted = +window.localStorage.getItem("levelsCompleted") || 0;
- this.totalScore = +window.localStorage.getItem("totalScore") || 0
- } catch (e) {}
- };
- e.prototype.onWinLevel = function(e, t) {
- this.totalScore += t;
- if (e == this.levelsCompleted) {
- this.levelsCompleted = e + 1;
- if (this.levelsCompleted > this.getTotalLevels()) {
- this.levelsCompleted = this.getTotalLevels()
- }
- }
- updateShare(e + 1, t);
- Play68.setRankingLevelScoreDesc(e + 1, t);
- this.save()
- };
- e.prototype.getTotalScore = function() {
- return this.totalScore
- };
- e.prototype.levelsAvailable = function() {
- if (Constants.g_DEBUG) {
- return this.getTotalLevels()
- }
- return this.levelsCompleted + 1
- };
- e.prototype.getLevelDef = function(e) {
- return this.levels[e]
- };
- e.prototype.getTotalLevels = function() {
- return this.levels.length
- };
- e.instance = null;
- return e
- }();
- var DNButton = function(e) {
- function t(t, n) {
- e.call(this);
- this.selected = false;
- this.func = null;
- this.func = n;
- this.picture = AssetsManager.g_instance.getCenteredImage(t);
- this.addChild(this.picture);
- this.picWidth = this.picture.getBounds().width * 1.15;
- this.picHeight = this.picture.getBounds().height * 1.15
- }
- __extends(t, e);
- t.prototype.select = function() {
- if (!this.selected) {
- createjs.Tween.removeTweens(this);
- createjs.Tween.get(this, {
- loop: false
- }).to({
- scaleX: 1.15,
- scaleY: 1.15
- }, 150, createjs.Ease.linear);
- this.selected = true
- }
- };
- t.prototype.deselect = function() {
- if (this.selected) {
- createjs.Tween.removeTweens(this);
- createjs.Tween.get(this, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 150, createjs.Ease.linear);
- this.selected = false
- }
- };
- t.prototype.onMouseDown = function(e, n) {
- if (this.hitTestSmart(e, n)) {
- if (!t.wasActionThisFrame) {
- t.wasActionThisFrame = true
- } else {
- return
- }
- this.liveTime = 0;
- this.select()
- }
- };
- t.prototype.onMouseUp = function(e, n) {
- if (this.hitTestSmart(e, n) && this.selected) {
- if (!t.wasActionThisFrame) {
- t.wasActionThisFrame = true
- } else {
- return
- }
- SoundManager.g_instance.play(SoundManager.SOUND_CLICK);
- this.runFunc()
- }
- this.deselect()
- };
- t.prototype.runFunc = function() {
- if (this.func) {
- this.func()
- } else {
- console.log("error! DNButton without func")
- }
- };
- t.prototype.onMouseMove = function(e, n) {
- if (!this.hitTestSmart(e, n)) {
- if (!t.wasActionThisFrame) {
- t.wasActionThisFrame = true
- } else {
- return
- }
- this.deselect()
- }
- };
- t.prototype.hitTestSmart = function(e, t) {
- if (!this.parent || !this.visible) {
- return false
- }
- var n = this.localToGlobal(0, 0);
- n.x /= Constants.SCREEN_SCALE;
- n.y /= Constants.SCREEN_SCALE;
- return e > n.x - this.picWidth / 2 && e < n.x + this.picWidth / 2 && t > n.y - this.picHeight / 2 && t < n.y + this.picHeight / 2
- };
- t.wasActionThisFrame = false;
- return t
- }(GameObject);
- var DNTextField = function(e) {
- function t(t, n, r) {
- e.call(this);
- this.textWidth = 0;
- this.fontNamePrefix = "";
- this.letterDistance = 0;
- if (n) {
- this.fontNamePrefix = n
- }
- if (r) {
- this.letterDistance = r
- }
- this.setText(t)
- }
- __extends(t, e);
- t.prototype.setText = function(e) {
- this.removeAllChildren();
- var t = 0;
- for (var n = 0; n < e.length; n++) {
- var r = e.charAt(n);
- var i = AssetsManager.g_instance.getImage(this.fontNamePrefix + r);
- this.addChild(i);
- i.x = t;
- t += i.getBounds().width + this.letterDistance
- }
- this.textWidth = t
- };
- t.prototype.getWidth = function() {
- return this.textWidth
- };
- return t
- }(createjs.Container);
- var FlyingPoints = function(e) {
- function t(t) {
- e.call(this);
- this.label = new DNTextField("p" + t.toString(), "", -10);
- this.addChild(this.label)
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- this.y -= t * 150;
- if (this.liveTime > .5) {
- this.alpha -= t * 3.5
- }
- if (this.liveTime >= 1.5) {
- this.kill()
- }
- };
- return t
- }(GameObject);
- var ConvertToBonusEffect = function(e) {
- function t(t) {
- e.call(this);
- this.chip = t;
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_SHINING));
- this.scaleX = this.scaleY = 2.5
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- this.rotation += t * Math.PI * 35;
- if (this.scaleX > 1) {
- this.scaleX -= t * 3;
- this.scaleY -= t * 3
- }
- if (this.chip.isMatching()) {
- this.alpha -= t * 4
- }
- this.x = this.chip.x;
- this.y = this.chip.y - Constants.CELL_SIZE / 2;
- if (this.chip.isDead()) {
- this.kill()
- }
- };
- return t
- }(GameObject);
- var KillLineEffect = function(e) {
- function t(t) {
- e.call(this);
- this.speed = t;
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_SICKLE));
- if (t.x < 0) {
- this.rotation = 180
- }
- if (t.x > 0) {
- this.rotation = 0
- }
- if (t.y < 0) {
- this.rotation = -90
- }
- if (t.y > 0) {
- this.rotation = +90
- }
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- this.x += t * this.speed.x;
- this.y += t * this.speed.y;
- if (this.x > Constants.ASSETS_WIDTH + 172 / 2) {
- this.kill()
- }
- if (this.x < -172 / 2) {
- this.kill()
- }
- if (this.y < 300 && this.speed.y < 0) {
- this.alpha -= t * 6
- }
- if (this.y < -106 / 2) {
- this.kill()
- }
- if (this.y > Constants.SCREEN_HEIGHT + 106 / 2) {
- this.kill()
- }
- };
- return t
- }(GameObject);
- var KillColorEffect = function(e) {
- function t(t, n) {
- e.call(this);
- var r = 2e3;
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_DROP));
- var i = new createjs.Point(n.x - t.x, n.y - t.y);
- this.distance = Math.sqrt(i.x * i.x + i.y * i.y);
- this.maxTime = this.distance / r;
- var s = i.x / this.distance;
- this.speed = new createjs.Point(i.x / this.distance * r, i.y / this.distance * r);
- this.rotation = Utils.RadToGrad(Math.atan2(i.y, i.x))
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- if (this.liveTime < this.maxTime) {
- this.x += t * this.speed.x;
- this.y += t * this.speed.y
- } else {
- this.alpha -= t * 3.5;
- if (this.alpha <= 0) {
- this.kill()
- }
- }
- };
- return t
- }(GameObject);
- var TimeIsUpEffect = function(e) {
- function t(t) {
- e.call(this);
- this.stage = 0;
- this.addChild(AssetsManager.g_instance.getCenteredImage(t));
- this.x = 350;
- this.y = 400;
- this.setScale(0);
- this.alpha = -1
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- switch (this.stage) {
- case 0:
- {
- this.alpha += t * 4;
- this.setScale(this.scaleX + t * 2);
- if (this.scaleX > 1) {
- this.setScale(1);
- this.alpha = 1;
- this.liveTime = 0;
- this.stage = 1;
- createjs.Tween.get(this, {
- loop: false
- }).wait(1400).to({
- alpha: 0
- }, 500, createjs.Ease.linear)
- }
- }
- break;
- case 1:
- {
- this.setScale(1 + Math.sin(this.liveTime * 5) * .07)
- }
- break
- }
- };
- t.prototype.setScale = function(e) {
- this.scaleX = this.scaleY = e
- };
- return t
- }(GameObject);
- var MoveHint = function(e) {
- function t(t) {
- e.call(this);
- this.arrow1 = new createjs.Container;
- this.arrow2 = new createjs.Container;
- this.hidding = false;
- var n = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_HINT_ARROW);
- this.arrow1.addChild(n);
- this.addChild(this.arrow1);
- this.arrow1.y -= 18;
- var r = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_HINT_ARROW);
- this.arrow2.addChild(r);
- this.addChild(this.arrow2);
- this.arrow2.y += 18;
- this.arrow2.rotation = 180;
- if (t) {
- this.rotation = 90
- }
- this.alpha = 0
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- if (this.liveTime <= .5) {
- this.alpha = this.liveTime * 2
- }
- e.prototype.update.call(this, t);
- this.arrow1.x = Math.sin(this.liveTime * 7) * 5;
- this.arrow2.x = -this.arrow1.x;
- if (this.liveTime > 20) {
- this.hide()
- }
- if (this.hidding) {
- this.alpha -= t * 3;
- if (this.alpha <= 0) {
- this.kill()
- }
- }
- };
- t.prototype.hide = function() {
- this.hidding = true
- };
- return t
- }(GameObject);
- var ShowAwesomeEffect = function(e) {
- function t() {
- e.call(this);
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_AWESOME));
- this.alpha = 0;
- createjs.Tween.get(this, {
- loop: false
- }).to({
- alpha: 1
- }, 300, createjs.Ease.linear);
- this.scaleX = this.scaleY = .5;
- createjs.Tween.get(this, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 500, createjs.Ease.backOut)
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- if (this.liveTime > .7) {
- this.alpha -= t * 3;
- this.scaleX += t;
- this.scaleY += t;
- if (this.alpha <= 0) {
- this.kill()
- }
- }
- };
- return t
- }(GameObject);
- var SuperbEffect = function(e) {
- function t() {
- e.call(this);
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_SUPERB));
- this.alpha = 0;
- createjs.Tween.get(this, {
- loop: false
- }).to({
- alpha: 1
- }, 300, createjs.Ease.linear);
- this.scaleX = this.scaleY = .5;
- createjs.Tween.get(this, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 500, createjs.Ease.backOut)
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- if (this.liveTime > .7) {
- this.alpha -= t * 3;
- this.scaleX += t;
- this.scaleY += t;
- if (this.alpha <= 0) {
- this.kill()
- }
- }
- };
- return t
- }(GameObject);
- var PortraitLockState = function(e) {
- function t() {
- e.call(this);
- this.scaleX = this.scaleY = 1 / Constants.SCREEN_SCALE;
- var t = Constants.W * Constants.PIXEL_RATIO;
- var n = Constants.H * Constants.PIXEL_RATIO;
- var r = new createjs.Shape;
- r.graphics.beginFill("#4aa4c2");
- r.graphics.drawRect(0, 0, t, n);
- r.graphics.endFill();
- this.addChild(r);
- var i = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_ROTATE);
- var s = new createjs.Container;
- this.addChild(s);
- s.addChild(i);
- s.x = t / 2;
- s.y = n / 2
- }
- __extends(t, e);
- t.prototype.onOrientationChanged = function(e) {
- if (!e) {
- StateManager.g_instance.popState()
- }
- };
- return t
- }(GameState);
- var StatusPointsControl = function(e) {
- function t(t, n) {
- e.call(this);
- this.smallPoints = new Array;
- this.offset = 50;
- var r = this.offset * (t - 1);
- for (var i = 0; i < t; i++) {
- var s = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_POINTS_CONTROL_SMALL);
- this.smallPoints.push(s);
- this.addChild(s);
- s.x = i * this.offset - r / 2
- }
- this.bigPoint = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_POINTS_CONTROL_BIG);
- this.addChild(this.bigPoint);
- this.forcedSetActiveElement(n)
- }
- __extends(t, e);
- t.prototype.setActiveElement = function(e) {
- if (this.curElement != e && e >= 0 && e < this.smallPoints.length) {
- this.bigPoint.scaleX = this.bigPoint.scaleY = .5
- } else {
- return
- }
- for (var t = 0; t < this.smallPoints.length; t++) {
- this.smallPoints[t].visible = true
- }
- this.curElement = e;
- if (this.curElement < 0) {
- this.curElement = 0
- }
- if (this.curElement > this.smallPoints.length - 1) {
- this.curElement = this.smallPoints.length - 1
- }
- this.smallPoints[this.curElement].visible = false;
- this.bigPoint.x = this.smallPoints[this.curElement].x;
- this.bigPoint.y = this.smallPoints[this.curElement].y;
- this.bigPoint.scaleX = this.bigPoint.scaleY = .5;
- createjs.Tween.get(this.bigPoint, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 300, createjs.Ease.backOut)
- };
- t.prototype.forcedSetActiveElement = function(e) {
- this.setActiveElement(e);
- this.bigPoint.scaleX = this.bigPoint.scaleY = 1
- };
- t.prototype.getActiveElement = function() {
- return this.curElement
- };
- return t
- }(createjs.Container);
- var SelectLevelState = function(e) {
- function t() {
- var t = this;
- e.call(this);
- this.touchPointY = 0;
- this.layer = new createjs.Container;
- this.tween = null;
- this.ySpeed = 0;
- this.yAcc = 1e3;
- this.calcSpeedCache = 0;
- this.slidePositions = new Array;
- this.levelsPositions = [39, 1449, 188, 1445, 365, 1411, 465, 1338, 499, 1235, 385, 1166, 253, 1142, 113, 1086, 40, 968, 119, 851, 263, 818, 403, 800, 541, 750, 505, 630, 346, 578, 193, 548, 64, 480, 55, 352, 186, 303, 330, 348, 488, 350, 571, 252, 537, 137, 411, 87, 266, 85, 124, 97, 43, 10];
- var n = new DNButton(Constants.IMAGE_BUTTON_EXIT, function() {
- return t.onExitTouch()
- });
- this.addGuiObject(n);
- this.addChild(this.layer);
- var r = AssetsManager.g_instance.getImage(Constants.IMAGE_GLOBAL_MAP);
- this.layer.addChild(r);
- this.mapH = r.getBounds().height;
- this.layer.y = -1e3;
- var i = 62;
- var s = 200;
- for (var o = 0; o < this.levelsPositions.length / 2; o++) {
- var u = new SelectLevelButton(Constants.IMAGE_LEVEL_BUTTON, function() {}, o);
- this.addGuiObject(u);
- this.layer.addChild(u);
- u.x = Constants.ASSETS_WIDTH - (this.levelsPositions[o * 2] + i);
- u.y = this.levelsPositions[o * 2 + 1] + s
- }
- var a = AssetsManager.g_instance.getImage(Constants.IMAGE_SELECT_LEVEL_BACK);
- this.addChild(a);
- var f = new createjs.Container;
- f.addChild(n);
- f.x = 68;
- f.y = 70;
- f.scaleX = f.scaleY = .9;
- this.addChild(f);
- this.checkConstrains()
- }
- __extends(t, e);
- t.prototype.onExitTouch = function() {
- StateManager.g_instance.pushState(new ShadeInState(new MainMenuState))
- };
- t.prototype.onLevelTouch = function(e) {
- StateManager.g_instance.pushState(new ShadeInState(new PlayState(e, true)))
- };
- t.prototype.onMouseDown = function(t, n) {
- e.prototype.onMouseDown.call(this, t, n);
- this.touchPointY = this.layer.y - n;
- this.slidePositions.length = 0;
- this.slidePositions.push({
- liveTime: this.liveTime,
- y: n
- })
- };
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- if (!StateManager.g_instance.isMouseDownNow()) {
- if (this.ySpeed != 0) {
- this.layer.y += this.ySpeed * t;
- if (this.ySpeed > 0) {
- this.ySpeed -= t * this.yAcc;
- if (this.ySpeed < 0) {
- this.ySpeed = 0
- }
- } else {
- this.ySpeed += t * this.yAcc;
- if (this.ySpeed > 0) {
- this.ySpeed = 0
- }
- }
- }
- }
- this.checkConstrains()
- };
- t.prototype.onMouseMove = function(t, n) {
- e.prototype.onMouseMove.call(this, t, n);
- this.layer.y = n + this.touchPointY;
- this.checkConstrains();
- this.slidePositions.push({
- liveTime: this.liveTime,
- y: n
- });
- if (this.slidePositions.length > 100) {
- this.calcSpeedCache = this.calcYSpeed();
- this.slidePositions.length = 0
- }
- };
- t.prototype.checkConstrains = function() {
- if (this.layer.y > 0) {
- this.layer.y = 0;
- this.ySpeed = 0
- }
- if (Constants.g_isPC) {
- if (this.layer.y < Constants.ASSETS_HEIGHT - this.mapH) {
- this.layer.y = Constants.ASSETS_HEIGHT - this.mapH;
- this.ySpeed = 0
- }
- } else {
- if (this.layer.y < Constants.SCREEN_HEIGHT - this.mapH) {
- this.layer.y = Constants.SCREEN_HEIGHT - this.mapH;
- this.ySpeed = 0
- }
- }
- };
- t.prototype.onMouseUp = function(t, n) {
- e.prototype.onMouseUp.call(this, t, n);
- this.slidePositions.push({
- liveTime: this.liveTime,
- y: n
- });
- this.ySpeed = this.calcYSpeed()
- };
- t.prototype.calcYSpeed = function() {
- if (this.slidePositions.length < 2) {
- return this.calcSpeedCache
- }
- var e = .2;
- var t;
- for (t = this.slidePositions.length - 2; t > 0; --t) {
- if (this.liveTime - this.slidePositions[t]["liveTime"] >= e) {
- break
- }
- }
- var n = this.liveTime - this.slidePositions[t]["liveTime"];
- if (n < 1e-5) {
- return 0
- }
- return (this.slidePositions[this.slidePositions.length - 1]["y"] - this.slidePositions[t]["y"]) / n
- };
- return t
- }(GameState);
- var LevelDef = function() {
- function e() {}
- return e
- }();
- var HeartParticle = function(e) {
- function t(t, n) {
- e.call(this);
- this.rotSpeed = Utils.RandomRange(-120, 120);
- this.speedX = t;
- this.speedY = n;
- this.addChild(AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_HEART_PARTICLE));
- this.alpha = 0
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- this.rotation += this.rotSpeed * t;
- this.x += this.speedX * t;
- this.y += this.speedY * t;
- if (this.liveTime > .3) {
- this.alpha -= t * 3;
- if (this.alpha <= 0) {
- this.kill()
- }
- } else {
- this.alpha += t * 4
- }
- };
- return t
- }(GameObject);
- var AutoreleaseEffect = function(e) {
- function t() {
- e.call(this);
- this.frames = new Array;
- this.frame = 0;
- for (var t = 1; t <= 11; t++) {
- this.frames.push(AssetsManager.g_instance.getCenteredImageWithProxy("boom_" + t))
- }
- this.update(10)
- }
- __extends(t, e);
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t);
- if (this.liveTime > .045) {
- this.liveTime = 0;
- this.frame++;
- if (this.frame >= this.frames.length) {
- this.frame = this.frames.length - 1;
- this.kill()
- }
- this.removeAllChildren();
- var n = this.frames[this.frame];
- this.addChild(n);
- n.y = -19;
- this.scaleX = this.scaleY = 2
- }
- };
- return t
- }(GameObject);
- var PauseState = function(e) {
- function t() {
- var t = this;
- e.call(this);
- this.panel = new createjs.Container;
- this.hiddingNow = false;
- t.soundTouched = false;
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#000000");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- createjs.Tween.get(this.shader, {
- loop: false
- }).wait(300).to({
- alpha: .4
- }, 800, createjs.Ease.linear);
- this.addChild(this.panel);
- this.panel.x = Constants.ASSETS_WIDTH / 2;
- this.panel.y = Constants.SCREEN_HEIGHT * .5;
- var n = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_MESSAGE_WINDOW);
- this.panel.addChild(n);
- var r = new DNButton(Constants.IMAGE_BUTTON_CLOSE, function() {
- return t.hide()
- });
- this.panel.addChild(r);
- this.addGuiObject(r);
- r.x = 235;
- r.y = -190;
- var i = new DNButton(Constants.IMAGE_BUTTON_RESTART, function() {
- return t.onRestartTouch()
- });
- this.panel.addChild(i);
- this.addGuiObject(i);
- i.x = -150;
- i.y = 100;
- var s = new DNButton(Constants.IMAGE_BUTTON_EXIT, function() {
- return t.onExitTouch()
- });
- this.panel.addChild(s);
- this.addGuiObject(s);
- s.x = 0;
- s.y = 100;
- this.setSoundButton();
- this.panel.alpha = 0;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- alpha: 1
- }, 200, createjs.Ease.linear);
- this.panel.scaleX = .7;
- this.panel.scaleY = .7;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 400, createjs.Ease.backOut)
- }
- __extends(t, e);
- t.prototype.setSoundButton = function() {
- var e = this;
- if (this.soundButton && this.soundButton.parent) {
- this.soundButton.parent.removeChild(this.soundButton)
- }
- var t = SoundManager.g_instance.isSoundEnabled();
- this.soundButton = new DNButton(t ? Constants.IMAGE_BUTTON_SOUND_ON : Constants.IMAGE_BUTTON_SOUND_OFF, function() {
- return e.onSoundTouch()
- });
- this.panel.addChild(this.soundButton);
- this.addGuiObject(this.soundButton);
- this.soundButton.x = +150;
- this.soundButton.y = 100
- };
- t.prototype.hide = function() {
- if (!this.hiddingNow) {
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: 0
- }, 400, createjs.Ease.linear).call(function() {
- StateManager.g_instance.popState()
- });
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- y: -300
- }, 300, createjs.Ease.backIn);
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- alpha: 0
- }, 300, createjs.Ease.linear);
- this.hiddingNow = true
- }
- };
- t.prototype.update = function(t) {
- e.prototype.update.call(this, t)
- };
- t.prototype.onRestartTouch = function() {
- StateManager.g_instance.pushState(new ShadeInCircleState(new PlayState(PlayState.g_curLevel, false)))
- };
- t.prototype.onExitTouch = function() {
- StateManager.g_instance.pushState(new ShadeInState(new SelectLevelState))
- };
- t.prototype.onSoundTouch = function() {
- var e = this;
- if (e.soundTouched == false) {
- e.soundTouched = true;
- SoundManager.g_instance.setSoundEnabled(!SoundManager.g_instance.isSoundEnabled());
- this.setSoundButton();
- setTimeout(function() {
- e.soundTouched = false
- }, 500)
- }
- };
- return t
- }(GameState);
- var PlayState = function(e) {
- function t(n, r) {
- var i = this;
- e.call(this);
- this.INPUT_STATE_WAIT_SELECTION = "INPUT_STATE_WAIT_SELECTION";
- this.INPUT_STATE_LOCK = "INPUT_STATE_LOCK";
- this.INPUT_STATE_WAIT_SPAWN = "INPUT_STATE_WAIT_SPAWN";
- this.INPUT_STATE_SHIFT = "INPUT_STATE_SHIFT";
- this.INPUT_STATE_MATCHING = "INPUT_STATE_MATCHING";
- this.INPUT_STATE_WAIT_NEXT_ROUND = "INPUT_STATE_WAIT_NEXT_ROUND";
- this.matchInARow = 0;
- this.inputState = null;
- this.goal = t.GOAL_DIRT;
- this.goalLabel = new DNTextField("0", "font_", -3);
- this.dirtCount = 0;
- this.fieldWidth = 8;
- this.fieldHeight = 8;
- this.selectedChip = null;
- this.swapChip1 = null;
- this.swapChip2 = null;
- this.lastMovedChip = null;
- this.dirtLayer = new createjs.Container;
- this.underChipsLayer = new createjs.Container;
- this.backChipsLayer = new createjs.Container;
- this.holeLayer = new createjs.Container;
- this.edgesLayer = new createjs.Container;
- this.frontChipsLayer = new createjs.Container;
- this.inputStateTime = 0;
- this.score = 0;
- this.tmpScore = 0;
- this.scoreLabel = new DNTextField("00000", "font_", -3);
- this.moves = 30;
- this.movesLabel = new DNTextField("50", "font_", -3);
- this.findedMatchPos1 = null;
- this.findedMatchPos2 = null;
- this.moveHint = null;
- this.chipTypesCount = 5;
- this.awesomeEffectTime = 0;
- this.superbEffectTime = 0;
- this.waitLose = false;
- this.waitLoseTime = 0;
- this.waitWin = false;
- this.waitWinTime = 0;
- this.lastDropSoundTime = -10;
- this.lastDropID = -1;
- this.lastSound = null;
- try {
- t.g_curLevel = n;
- var s = AssetsManager.g_instance.getImage(Constants.IMAGE_BACK);
- this.addChild(s);
- t.g_instance = this;
- this.chipTypesCount = GameData.getInstance().getLevelDef(n).chip_types;
- this.field = new Array(this.fieldWidth);
- for (var o = 0; o < this.fieldWidth; o++) {
- this.field[o] = new Array(this.fieldHeight)
- }
- this.addChild(this.holeLayer);
- this.addChild(this.dirtLayer);
- this.addChild(this.edgesLayer);
- this.addChild(this.underChipsLayer);
- this.addChild(this.backChipsLayer);
- this.addChild(this.frontChipsLayer);
- this.matchInARow = 0;
- this.spawnDefinedChips(GameData.getInstance().getLevelDef(n).chips);
- var u = GameData.getInstance().getLevelDef(n).form;
- for (var a = 0; a < this.fieldWidth; a++) {
- for (var f = 0; f < this.fieldHeight; f++) {
- if (u[f][a] == 0) {
- this.field[a][f].convertToHole();
- this.holeLayer.addChild(this.field[a][f]);
- var l = this.getXPosByXIndex(a) - Constants.CELL_SIZE / 2;
- var c = this.getYPosByYIndex(f) - Constants.CELL_SIZE;
- if (f > 0 && u[f - 1][a] != 0 && a > 0 && u[f][a - 1] != 0) {
- var h = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- h.x = l - 4;
- h.y = c - 4;
- this.edgesLayer.addChild(h)
- }
- if (f > 0 && u[f - 1][a] != 0 && a < this.fieldWidth - 1 && u[f][a + 1] != 0) {
- var p = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- p.x = l + Constants.CELL_SIZE + 8 - 4;
- p.y = c - 4;
- p.rotation = +90;
- this.edgesLayer.addChild(p)
- }
- if (f < this.fieldHeight - 1 && u[f + 1][a] != 0 && a > 0 && u[f][a - 1] != 0) {
- var d = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- d.x = l - 4;
- d.y = c + Constants.CELL_SIZE + 8 - 4;
- d.rotation = -90;
- this.edgesLayer.addChild(d)
- }
- if (f < this.fieldHeight - 1 && u[f + 1][a] != 0 && a < this.fieldWidth - 1 && u[f][a + 1] != 0) {
- var v = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- v.x = l + Constants.CELL_SIZE + 8 - 4;
- v.y = c + Constants.CELL_SIZE + 8 - 4;
- v.rotation = -180;
- this.edgesLayer.addChild(v)
- }
- } else {
- var m = AssetsManager.g_instance.getImage(Constants.IMAGE_CELL);
- this.holeLayer.addChild(m);
- m.x = this.getXPosByXIndex(a) - Constants.CELL_SIZE / 2;
- m.y = this.getYPosByYIndex(f) - Constants.CELL_SIZE;
- if (a > 0 && u[f][a - 1] == 0) {
- var g = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_SIDE);
- g.rotation = -90;
- g.x = m.x - 4;
- g.y = m.y + Constants.CELL_SIZE;
- this.edgesLayer.addChildAt(g, 0)
- }
- if (a < this.fieldWidth - 1 && u[f][a + 1] == 0) {
- var y = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_SIDE);
- y.rotation = -90;
- y.x = m.x + Constants.CELL_SIZE - 4;
- y.y = m.y + Constants.CELL_SIZE;
- this.edgesLayer.addChildAt(y, 0)
- }
- if (f > 0 && u[f - 1][a] == 0) {
- var b = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_SIDE);
- b.x = m.x;
- b.y = m.y - 4;
- this.edgesLayer.addChildAt(b, 0)
- }
- if (f < this.fieldHeight - 1 && u[f + 1][a] == 0) {
- var w = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_SIDE);
- w.x = m.x;
- w.y = m.y + Constants.CELL_SIZE - 4;
- this.edgesLayer.addChildAt(w, 0)
- }
- if (f > 0 && u[f - 1][a] == 0 && a > 0 && u[f][a - 1] == 0) {
- var h = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- h.x = m.x - 4;
- h.y = m.y - 4;
- this.edgesLayer.addChild(h)
- }
- if (f > 0 && u[f - 1][a] == 0 && a < this.fieldWidth - 1 && u[f][a + 1] == 0) {
- var p = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- p.x = m.x + Constants.CELL_SIZE + 8 - 4;
- p.y = m.y - 4;
- p.rotation = +90;
- this.edgesLayer.addChild(p)
- }
- if (f < this.fieldHeight - 1 && u[f + 1][a] == 0 && a > 0 && u[f][a - 1] == 0) {
- var d = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- d.x = m.x - 4;
- d.y = m.y + Constants.CELL_SIZE + 8 - 4;
- d.rotation = -90;
- this.edgesLayer.addChild(d)
- }
- if (f < this.fieldHeight - 1 && u[f + 1][a] == 0 && a < this.fieldWidth - 1 && u[f][a + 1] == 0) {
- var v = AssetsManager.g_instance.getImage(Constants.IMAGE_BORDER_CORNER);
- v.x = m.x + Constants.CELL_SIZE + 8 - 4;
- v.y = m.y + Constants.CELL_SIZE + 8 - 4;
- v.rotation = -180;
- this.edgesLayer.addChild(v)
- }
- }
- }
- }
- this.holeLayer.cache(0, 0, Constants.ASSETS_WIDTH, Constants.ASSETS_HEIGHT, 1);
- this.edgesLayer.cache(0, 0, Constants.ASSETS_WIDTH, Constants.ASSETS_HEIGHT, 1);
- this.fieldDirt = new Array(this.fieldWidth);
- for (var o = 0; o < this.fieldWidth; o++) {
- this.fieldDirt[o] = new Array(this.fieldHeight)
- }
- var E = GameData.getInstance().getLevelDef(n).dirt;
- if (E) {
- this.goal = t.GOAL_DIRT;
- for (var a = 0; a < this.fieldWidth; a++) {
- for (var f = 0; f < this.fieldHeight; f++) {
- if (E[f][a] != 0) {
- this.dirtCount++;
- var S = AssetsManager.g_instance.getCenteredBitmapWithProxy(Constants.IMAGE_DIRT);
- S.x = this.getXPosByXIndex(a) - 1;
- S.y = this.getYPosByYIndex(f) - Constants.CELL_SIZE / 2 + 3;
- this.dirtLayer.addChild(S);
- this.fieldDirt[a][f] = S
- }
- }
- }
- this.goalLabel.setText(this.dirtCount.toString())
- } else {
- this.goal = t.GOAL_COUNT;
- this.goalChipID = GameData.getInstance().getLevelDef(n).chip_goal;
- this.chipGoalCount = GameData.getInstance().getLevelDef(n).chip_goal_count;
- this.goalLabel.setText(this.chipGoalCount.toString())
- }
- this.addChild(AssetsManager.g_instance.getImage(Constants.IMAGE_GUI));
- var x = new createjs.Container;
- x.scaleX = x.scaleY = .7;
- var T = new DNButton(Constants.IMAGE_BUTTON_PAUSE, function() {
- return i.onPauseClick()
- });
- x.addChild(T);
- this.addGuiObject(T);
- x.x = 55;
- x.y = 154;
- this.addChild(x);
- this.addChild(this.scoreLabel);
- this.scoreLabel.x = 168;
- this.scoreLabel.y = 134;
- this.moves = GameData.getInstance().getLevelDef(n).moves;
- this.addChild(this.movesLabel);
- this.movesLabel.x = 370;
- this.movesLabel.y = 134;
- this.movesLabel.setText(this.moves.toString());
- this.addChild(this.goalLabel);
- this.goalLabel.x = 570;
- this.goalLabel.y = 134;
- if (this.goal == t.GOAL_DIRT) {
- var N = AssetsManager.g_instance.getImage(Constants.IMAGE_DIRT);
- N.scaleX = N.scaleY = .45;
- this.addChild(N);
- N.x = 506;
- N.y = 130
- } else {
- var C = AssetsManager.g_instance.getCenteredImageWithProxy("cake_" + this.goalChipID);
- C.scaleX = C.scaleY = .66;
- this.addChild(C);
- C.x = 525;
- C.y = 149
- } if (r) {
- var k = new TaskEffect(this.goal, this.chipGoalCount, this.goalChipID);
- this.addGameObject(k);
- this.addChild(k)
- }
- this.configureYAlign()
- } catch (L) {
- console.log(L, "playstate::constructor")
- }
- }
- __extends(t, e);
- t.prototype.onPauseClick = function() {
- StateManager.g_instance.pushState(new PauseState)
- };
- t.prototype.createChip = function(e, t, n) {
- var r = Utils.RandomRangeInt(1, this.chipTypesCount);
- var i = new Chip(r, e, t, this.getYPosByYIndex(t), n);
- i.setIncexes(e, t);
- this.addGameObjectAtPos(i, this.backChipsLayer, this.getXPosByXIndex(e), -Constants.CELL_SIZE);
- this.field[e][t] = i
- };
- t.prototype.createChipWithColorID = function(e, t, n, r) {
- var i = new Chip(r, e, t, this.getYPosByYIndex(t), n);
- i.setIncexes(e, t);
- this.addGameObjectAtPos(i, this.backChipsLayer, this.getXPosByXIndex(e), -Constants.CELL_SIZE);
- this.field[e][t] = i
- };
- t.prototype.getXPosByXIndex = function(e) {
- return e * Constants.CELL_SIZE + Constants.CELL_SIZE / 2 + Constants.FIELD_OFFSET_X
- };
- t.prototype.getYPosByYIndex = function(e) {
- return e * Constants.CELL_SIZE + Constants.CELL_SIZE / 2 + Constants.FIELD_OFFSET_Y
- };
- t.prototype.update = function(n) {
- e.prototype.update.call(this, n);
- if (this.waitWin) {
- this.waitWinTime += n;
- if (this.waitWinTime > 2.4) {
- StateManager.g_instance.pushState(new WinState(t.g_curLevel, this.score));
- return
- }
- }
- if (this.waitLose) {
- this.waitLoseTime += n;
- if (this.waitLoseTime > 2.4) {
- StateManager.g_instance.pushState(new GameOverState(0, 0));
- return
- }
- }
- this.inputStateTime += n;
- if (this.inputState != this.INPUT_STATE_WAIT_SELECTION) {
- if (this.moveHint) {
- if (this.moveHint.isDead()) {
- this.moveHint = null
- } else {
- this.moveHint.hide()
- }
- }
- }
- switch (this.inputState) {
- case this.INPUT_STATE_WAIT_SELECTION:
- {
- try {
- var r = 3;
- if (this.inputStateTime > r && this.moveHint && !this.moveHint.parent) {
- this.addGameObjectAt(this.moveHint, this)
- }
- } catch (i) {}
- }
- break;
- case this.INPUT_STATE_WAIT_SPAWN:
- if (this.allChipsNormal()) {
- this.matchMatches(this.findMatches())
- }
- break;
- case this.INPUT_STATE_SHIFT:
- if (this.allChipsNormal()) {
- this.matchMatches(this.findMatches())
- }
- break;
- case this.INPUT_STATE_MATCHING:
- if (this.inputStateTime > Constants.MATCH_TIME / 2) {
- this.shiftChips()
- }
- break
- }
- if (this.tmpScore < this.score) {
- this.tmpScore += 17;
- if (this.tmpScore > this.score) {
- this.tmpScore = this.score
- }
- var s = this.tmpScore.toString();
- switch (s.length) {
- case 1:
- s = "0000" + s;
- break;
- case 2:
- s = "000" + s;
- break;
- case 3:
- s = "00" + s;
- break;
- case 4:
- s = "0" + s;
- break
- }
- this.scoreLabel.setText(s)
- }
- };
- t.prototype.allChipsNormal = function() {
- for (var e = 0; e < this.fieldWidth; e++) {
- for (var t = 0; t < this.fieldHeight; t++) {
- if (this.field[e][t] != null && !this.field[e][t].isNormal()) {
- return false
- }
- }
- }
- return true
- };
- t.prototype.canExchange = function(e, t) {
- try {
- if (e == t) {
- return false
- }
- if (e.isHole() || t.isHole()) {
- return false
- }
- var n = e.getIndeces().x - t.getIndeces().x;
- var r = e.getIndeces().y - t.getIndeces().y
- } catch (i) {
- return false
- }
- return Math.abs(n) == 1 && r == 0 || Math.abs(r) == 1 && n == 0
- };
- t.prototype.exchangeChips = function(e, t) {
- var n = this;
- try {
- var r = e.x;
- var i = e.y;
- var s = e.getIndexX();
- var o = e.getIndexY();
- var u = t.x;
- var a = t.y;
- var f = t.getIndexX();
- var l = t.getIndexY();
- this.field[s][o] = t;
- this.field[f][l] = e;
- e.exchange(f, l);
- t.exchange(s, o);
- this.swapChip1 = e;
- this.swapChip2 = t;
- createjs.Tween.get(e, {
- loop: false
- }).to({
- x: u,
- y: a
- }, Constants.EXCHANGE_TIME * 1e3, createjs.Ease.linear).call(function() {
- return n.onExchangeEnded()
- });
- createjs.Tween.get(t, {
- loop: false
- }).to({
- x: r,
- y: i
- }, Constants.EXCHANGE_TIME * 1e3, createjs.Ease.linear);
- this.selectedChip = null;
- this.setInpunState(this.INPUT_STATE_LOCK)
- } catch (c) {}
- };
- t.prototype.addConverToBonusEffect = function(e) {
- var t = new ConvertToBonusEffect(e);
- this.addGameObjectAtPos(t, this.underChipsLayer, e.x, e.y - Constants.CELL_SIZE / 2)
- };
- t.prototype.matchMatches = function(e) {
- try {
- if (e.length != 0) {
- switch (this.matchInARow) {
- case 0:
- SoundManager.g_instance.play(SoundManager.SOUND_MATCH_1);
- break;
- case 1:
- SoundManager.g_instance.play(SoundManager.SOUND_MATCH_2);
- break;
- case 2:
- SoundManager.g_instance.play(SoundManager.SOUND_MATCH_3);
- break;
- case 3:
- SoundManager.g_instance.play(SoundManager.SOUND_MATCH_4);
- break;
- default:
- SoundManager.g_instance.play(SoundManager.SOUND_MATCH_5);
- break
- }
- var t = false;
- for (var n = 0; n < e.length; n++) {
- for (var r = 0; r < e[n].length; r++) {
- e[n][r].match(Chip.MATCH_REASON_SIMPLE)
- }
- if (e[n].length == 4) {
- var i = false;
- for (var s = 0; s < e[n].length; s++) {
- if (e[n][s] == this.lastMovedChip) {
- i = true;
- t = true;
- this.lastMovedChip.convertToBonus(Chip.BONUS_4, Math.random() < .5);
- this.lastMovedChip = null;
- break
- }
- }
- if (!i) {
- t = true;
- e[n][Utils.RandomRangeInt(1, 2)].convertToBonus(Chip.BONUS_4)
- }
- }
- if (e[n].length >= 5) {
- var i = false;
- for (var s = 0; s < e[n].length; s++) {
- if (e[n][s] == this.lastMovedChip) {
- t = true;
- i = true;
- this.lastMovedChip.convertToBonus(Chip.BONUS_5);
- this.lastMovedChip = null;
- break
- }
- }
- if (!i) {
- t = true;
- e[n][Utils.RandomRangeInt(1, e[n].length - 2)].convertToBonus(Chip.BONUS_5)
- }
- }
- }
- if (!t) {
- for (var n = 0; n < e.length; n++) {
- for (var r = 0; r < e[n].length; r++) {
- if (e[n][r].isDoubleMatched()) {
- e[n][r].convertToBonus(Chip.BONUS_BOMB);
- n = 100;
- break
- }
- }
- }
- }
- this.setInpunState(this.INPUT_STATE_MATCHING)
- } else {
- this.shiftChips()
- }
- } catch (o) {
- console.log(o, "playstate::matchmatches")
- }
- };
- t.prototype.matchBonus = function(e, t) {
- try {
- if (e.getBonusType() == Chip.BONUS_4) {
- SoundManager.g_instance.play(SoundManager.SOUND_LINE);
- var n = e.isHorizontal();
- if (n) {
- var r = e.getIndexY();
- for (var i = 0; i < this.fieldWidth; i++) {
- if (this.field[i][r] != null) {
- this.field[i][r].match(Chip.MATCH_REASON_BONUS_EFFECT_4_HOR)
- }
- }
- this.addGameObjectAtPos(new KillLineEffect(new createjs.Point(+1200, 0)), this, e.x, e.y - Constants.CELL_SIZE / 2);
- this.addGameObjectAtPos(new KillLineEffect(new createjs.Point(-1200, 0)), this, e.x, e.y - Constants.CELL_SIZE / 2)
- } else {
- var s = e.getIndexX();
- for (var i = 0; i < this.fieldHeight; i++) {
- if (this.field[s][i] != null) {
- this.field[s][i].match(Chip.MATCH_REASON_BONUS_EFFECT_4_VERT)
- }
- }
- this.addGameObjectAtPos(new KillLineEffect(new createjs.Point(0, -1200)), this, e.x, e.y - Constants.CELL_SIZE / 2);
- this.addGameObjectAtPos(new KillLineEffect(new createjs.Point(0, +1200)), this, e.x, e.y - Constants.CELL_SIZE / 2)
- }
- }
- if (e.getBonusType() == Chip.BONUS_5) {
- SoundManager.g_instance.play(SoundManager.SOUND_KILL_COLOR);
- e.match(Chip.MATCH_REASON_I_AM_BONUS);
- var o = new createjs.Point(e.x, e.y);
- var u = t.getColorID();
- if (u != -1) {
- for (var a = 0; a < this.fieldWidth; a++) {
- for (var f = 0; f < this.fieldHeight; f++) {
- if (this.field[a][f] != null) {
- if (this.field[a][f].getColorID() == u) {
- var l = new createjs.Point(this.field[a][f].x, this.field[a][f].y - Constants.CELL_SIZE / 2);
- this.addGameObjectAtPos(new KillColorEffect(o, l), this, o.x, o.y);
- this.field[a][f].match(Chip.MATCH_REASON_BONUS_EFFECT_5)
- }
- }
- }
- }
- }
- }
- if (e.getBonusType() == Chip.BONUS_BOMB) {
- this.boom(e);
- e.match(Chip.MATCH_REASON_I_AM_BONUS);
- t.match(Chip.MATCH_REASON_EXCHANGE_WIHT_BONUS)
- }
- this.setInpunState(this.INPUT_STATE_MATCHING)
- } catch (c) {}
- };
- t.prototype.boom = function(e) {
- try {
- SoundManager.g_instance.play(SoundManager.SOUND_BOOM);
- var t = e.getIndexX();
- var n = e.getIndexY();
- var r = 1;
- for (var i = t - r; i <= t + r; i++) {
- for (var s = n - r; s <= n + r; s++) {
- if (this.validCoords(i, s) && this.field[i][s] != null) {
- this.field[i][s].match(Chip.MATCH_REASON_BONUS_EFFECT_4_HOR)
- }
- }
- }
- var o = new AutoreleaseEffect;
- this.addGameObjectAtPos(o, this, e.x, e.y)
- } catch (u) {}
- };
- t.prototype.validCoords = function(e, t) {
- return e >= 0 && e < this.fieldWidth && t >= 0 && t < this.fieldHeight
- };
- t.prototype.onExchangeEnded = function() {
- try {
- var e = this.swapChip1 != null || this.swapChip2 != null;
- var t = false;
- if (e) {
- if (this.swapChip1.isBonus()) {
- t = true
- }
- if (this.swapChip2.isBonus()) {
- t = true
- }
- }
- var n = this.findMatches();
- if (n.length == 0) {
- if (!t) {
- if (e) {
- this.exchangeChips(this.swapChip1, this.swapChip2);
- this.swapChip1 = null;
- this.swapChip2 = null
- } else {
- this.setInpunState(this.INPUT_STATE_WAIT_SELECTION)
- }
- }
- } else {
- this.decreseMoves();
- this.matchMatches(n)
- } if (e && t) {
- if (this.swapChip1.isBonus()) {
- this.matchBonus(this.swapChip1, this.swapChip2)
- }
- if (this.swapChip2.isBonus()) {
- this.matchBonus(this.swapChip2, this.swapChip1)
- }
- this.decreseMoves()
- }
- } catch (r) {
- console.log(r, "playstate::exchangeended")
- }
- };
- t.prototype.decreseMoves = function() {
- this.moves--;
- if (this.moves < 0) {
- this.moves = 0
- }
- this.movesLabel.setText(this.moves.toString())
- };
- t.prototype.findMatches = function() {
- try {
- var e = Array();
- for (var t = 0; t < this.fieldHeight; t++) {
- for (var n = 0; n < this.fieldWidth;) {
- var r = -1;
- var i = 0;
- var s = new Array;
- for (var o = n; o < this.fieldWidth; o++) {
- if (this.field[o][t] == null || this.field[o][t].isBonus() || this.field[o][t].getColorID() == -1) {
- break
- } else {
- if (r == -1) {
- r = this.field[o][t].getColorID()
- }
- } if (this.field[o][t].getColorID() == r) {
- s.push(this.field[o][t]);
- i++
- } else {
- break
- }
- }
- if (i >= 3) {
- e.push(s)
- }
- if (i != 0) {
- n += i
- } else {
- n++
- }
- }
- }
- for (var n = 0; n < this.fieldWidth; n++) {
- for (var t = 0; t < this.fieldHeight; t) {
- var r = -1;
- var i = 0;
- var s = new Array;
- for (var o = t; o < this.fieldHeight; o++) {
- if (this.field[n][o] == null || this.field[n][o].isBonus() || this.field[n][o].getColorID() == -1) {
- break
- } else {
- if (r == -1) {
- r = this.field[n][o].getColorID()
- }
- } if (this.field[n][o].getColorID() == r) {
- s.push(this.field[n][o]);
- i++
- } else {
- break
- }
- }
- if (i >= 3) {
- e.push(s)
- }
- if (i != 0) {
- t += i
- } else {
- t++
- }
- }
- }
- } catch (u) {}
- return e
- };
- t.prototype.onMouseUp = function(t, n) {
- e.prototype.onMouseUp.call(this, t, n);
- this.selectedChip = null
- };
- t.prototype.onMouseDown = function(t, n) {
- e.prototype.onMouseDown.call(this, t, n);
- n -= this.y;
- if (this.inputState != this.INPUT_STATE_WAIT_SELECTION) {
- return
- }
- var r = this.checkChipSelection(t, n);
- if (r) {
- if (r == this.selectedChip) {
- return
- }
- if (!this.selectedChip) {
- this.selectedChip = r;
- this.selectedChip.select()
- } else {
- if (this.canExchange(this.selectedChip, r)) {
- this.lastMovedChip = this.selectedChip;
- this.exchangeChips(this.selectedChip, r);
- SoundManager.g_instance.play(SoundManager.SOUND_EXCHANGE)
- } else {
- this.selectedChip.deselect();
- this.selectedChip = r;
- this.selectedChip.select()
- }
- }
- }
- };
- t.prototype.onMouseMove = function(t, n) {
- e.prototype.onMouseMove.call(this, t, n);
- if (this.inputState != this.INPUT_STATE_WAIT_SELECTION) {
- return
- }
- this.onMouseDown(t, n)
- };
- t.prototype.shiftChips = function() {
- this.matchInARow++;
- var e = false;
- for (var t = 0; t < this.fieldWidth; t++) {
- for (var n = this.fieldHeight - 1; n >= 0; n--) {
- var r = this.field[t][n];
- if (!r) {
- continue
- }
- if (r.isHole()) {
- continue
- }
- for (var i = this.fieldHeight - 1; i > n; i--) {
- if (this.field[t][i] == null) {
- e = true;
- var s = i;
- this.field[t][n].shiftDown(s, this.getYPosByYIndex(s));
- this.field[t][s] = this.field[t][n];
- this.field[t][n] = null;
- break
- }
- }
- }
- }
- if (e) {
- this.setInpunState(this.INPUT_STATE_SHIFT)
- } else {
- this.spawnNewChips()
- }
- };
- t.prototype.spawnNewChips = function() {
- var e = 0;
- for (var t = 0; t < this.fieldWidth; t++) {
- var n = -1;
- for (var r = this.fieldHeight - 1; r >= 0; r--) {
- if (this.field[t][r] == null) {
- if (n == -1) {
- n = r
- }
- e++;
- this.createChip(t, r, (n - r) * .13)
- }
- }
- }
- if (e > 0) {
- this.setInpunState(this.INPUT_STATE_WAIT_SPAWN)
- } else {
- this.setInpunState(this.INPUT_STATE_WAIT_SELECTION)
- }
- };
- t.prototype.spawnDefinedChips = function(e) {
- for (var t = 0; t < this.fieldWidth; t++) {
- for (var n = 0; n < this.fieldHeight; n++) {
- this.createChipWithColorID(t, n, (7 - n) * .13 + t * .11, e[n][t])
- }
- }
- this.setInpunState(this.INPUT_STATE_WAIT_SPAWN)
- };
- t.prototype.checkChipSelection = function(e, t) {
- for (var n = 0; n < this.fieldWidth; n++) {
- for (var r = 0; r < this.fieldHeight; r++) {
- var i = this.field[n][r];
- if (i) {
- if (Math.abs(i.x - e) < Constants.CELL_SIZE / 2 && i.y > t && i.y < t + Constants.CELL_SIZE) {
- return i
- }
- }
- }
- }
- return null
- };
- t.prototype.setInpunState = function(e) {
- try {
- this.inputState = e;
- this.inputStateTime = 0;
- if (this.inputState == this.INPUT_STATE_WAIT_SELECTION) {
- this.matchInARow = 0;
- if (this.findMoves()) {
- var t = this.field[this.findedMatchPos1.x][this.findedMatchPos1.y];
- var n = this.field[this.findedMatchPos2.x][this.findedMatchPos2.y];
- this.moveHint = new MoveHint(this.findedMatchPos1.y != this.findedMatchPos2.y);
- this.moveHint.x = (t.x + n.x) / 2;
- this.moveHint.y = (t.y + n.y) / 2 - Constants.CELL_SIZE / 2
- } else {
- this.moveHint = null;
- for (var r = 0; r < 100; r++) {
- var i = this.field[Utils.RandomRangeInt(0, this.fieldWidth - 1)][Utils.RandomRangeInt(0, this.fieldHeight - 1)];
- if (!i.isHole() && !i.isBonus() && !i.isStoneHeart()) {
- i.convertToBonus([Chip.BONUS_BOMB, Chip.BONUS_4, Chip.BONUS_5][Utils.RandomRangeInt(0, 2)]);
- break
- }
- }
- } if (this.moves <= 0) {
- this.lose()
- }
- }
- } catch (s) {
- this.inputState = this.INPUT_STATE_WAIT_SELECTION
- }
- };
- t.prototype.takeStockMatch = function(e) {
- var n = e.getIndexX();
- var r = e.getIndexY();
- if (this.field[n][r] == e) {
- if (this.goal == t.GOAL_COUNT) {
- if (e.getColorID() == this.goalChipID) {
- this.chipGoalCount--;
- if (this.chipGoalCount <= 0) {
- this.chipGoalCount = 0;
- this.win()
- }
- this.goalLabel.setText(this.chipGoalCount.toString())
- }
- }
- }
- };
- t.prototype.clearCell = function(e) {
- var n = e.getIndexX();
- var r = e.getIndexY();
- if (this.field[n][r] == e) {
- if (this.goal == t.GOAL_COUNT) {
- if (e.getColorID() == this.goalChipID) {
- this.chipGoalCount--;
- if (this.chipGoalCount <= 0) {
- this.chipGoalCount = 0;
- this.win()
- }
- this.goalLabel.setText(this.chipGoalCount.toString())
- }
- }
- if (e.getMatchReason() == Chip.MATCH_REASON_BONUS_EFFECT_5 || e.getMatchReason() == Chip.MATCH_REASON_BONUS_EFFECT_4_HOR || e.getMatchReason() == Chip.MATCH_REASON_BONUS_EFFECT_4_VERT) {
- this.runParticleEffect(e.x, e.y - Constants.CELL_SIZE / 2)
- }
- this.field[n][r] = null
- }
- this.tryClearDirt(n, r);
- if (!e.isStoneHeart()) {
- this.tryClearStoneHeart(n, r)
- }
- };
- t.prototype.tryClearDirt = function(e, n) {
- var r = this.fieldDirt[e][n];
- if (r) {
- createjs.Tween.get(r, {
- loop: false
- }).to({
- alpha: 0
- }, 250, createjs.Ease.linear);
- this.fieldDirt[e][n] = null;
- if (--this.dirtCount == 0) {
- this.win()
- }
- }
- if (this.goal == t.GOAL_DIRT) {
- this.goalLabel.setText(this.dirtCount.toString())
- }
- };
- t.prototype.tryClearStoneHeart = function(e, t) {
- try {
- var n;
- n = this.getChipAt(e + 1, t);
- if (n && n.isStoneHeart()) {
- n.fallDown()
- }
- n = this.getChipAt(e - 1, t);
- if (n && n.isStoneHeart()) {
- n.fallDown()
- }
- n = this.getChipAt(e, t + 1);
- if (n && n.isStoneHeart()) {
- n.fallDown()
- }
- n = this.getChipAt(e, t - 1);
- if (n && n.isStoneHeart()) {
- n.fallDown()
- }
- } catch (r) {}
- };
- t.prototype.finishLevel = function() {
- for (var e = 0; e < this.fieldWidth; e++) {
- for (var t = 0; t < this.fieldHeight; t++) {
- if (this.field[e][t] != null && this.field[e][t].isNormal()) {
- this.field[e][t].fallDown()
- }
- }
- }
- };
- t.prototype.lose = function() {
- if (!this.waitLose) {
- this.waitLose = true;
- this.addGameObjectAt(new TimeIsUpEffect(Constants.IMAGE_OUT_OF_MOVES), this);
- SoundManager.g_instance.play(SoundManager.SOUND_LOSE)
- }
- };
- t.prototype.win = function() {
- if (!this.waitWin) {
- this.waitWin = true;
- SoundManager.g_instance.play(SoundManager.SOUND_WIN)
- }
- };
- t.prototype.addPointsAt = function(e, t) {
- if (e.getBonusType() == null) {
- var n = 40;
- switch (t) {
- case Chip.MATCH_REASON_EXCHANGE_WIHT_BONUS:
- n = 40;
- break;
- case Chip.MATCH_REASON_BONUS_EFFECT_5:
- n = 100;
- break;
- case Chip.MATCH_REASON_BONUS_EFFECT_4_HOR:
- n = 90;
- break;
- case Chip.MATCH_REASON_BONUS_EFFECT_4_VERT:
- n = 120;
- break;
- case Chip.MATCH_REASON_I_AM_BONUS:
- n = 150;
- break;
- default:
- n = 40 + this.matchInARow * 20;
- break
- }
- var r = new FlyingPoints(n);
- this.score += n;
- var i = e.x - Constants.CELL_SIZE / 2;
- var s = e.y - Constants.CELL_SIZE / 2;
- this.tryShowAwesome(i, s);
- this.tryShowSuperb(i, s);
- this.addGameObjectAtPos(r, this, i, s)
- }
- };
- t.prototype.tryShowSuperb = function(e, t) {
- if (this.matchInARow >= 3 && this.superbEffectTime != this.liveTime) {
- this.superbEffectTime = this.liveTime;
- var n = new SuperbEffect;
- this.addGameObjectAtPos(n, this, e, t);
- SoundManager.g_instance.play(SoundManager.SOUND_AWESOME);
- if (n.x < 120) {
- n.x = 120
- }
- if (n.x > Constants.ASSETS_WIDTH - 120) {
- n.x = Constants.ASSETS_WIDTH - 120
- }
- this.score += 500;
- return true
- }
- return false
- };
- t.prototype.tryShowAwesome = function(e, t) {
- if (this.matchInARow == 2 && this.awesomeEffectTime != this.liveTime) {
- this.awesomeEffectTime = this.liveTime;
- var n = new ShowAwesomeEffect;
- this.addGameObjectAtPos(n, this, e, t);
- SoundManager.g_instance.play(SoundManager.SOUND_AWESOME);
- if (n.x < 120) {
- n.x = 120
- }
- if (n.x > Constants.ASSETS_WIDTH - 120) {
- n.x = Constants.ASSETS_WIDTH - 120
- }
- this.score += 200;
- return true
- }
- return false
- };
- t.prototype.findMoves = function() {
- try {
- var e = [
- [2, -1],
- [3, 0],
- [2, 1]
- ];
- var t = [
- [-1, -1],
- [-2, 0],
- [-1, 1]
- ];
- var n = [
- [1, -1],
- [1, 1]
- ];
- for (var r = 0; r < this.fieldHeight; r++) {
- for (var i = 0; i < this.fieldWidth - 1; i++) {
- if (this.field[i][r].getColorID() == this.field[i + 1][r].getColorID()) {
- if (this.findPattern(i, r, this.field[i][r].getColorID(), e, i + 2, r)) {
- return true
- }
- if (this.findPattern(i, r, this.field[i][r].getColorID(), t, i - 1, r)) {
- return true
- }
- }
- }
- }
- for (var r = 0; r < this.fieldHeight; r++) {
- for (var i = 0; i < this.fieldWidth - 2; i++) {
- if (this.field[i][r].getColorID() == this.field[i + 2][r].getColorID()) {
- if (this.findPattern(i, r, this.field[i][r].getColorID(), n, i + 1, r)) {
- return true
- }
- }
- }
- }
- var s = [
- [-1, 2],
- [0, 3],
- [1, 2]
- ];
- var o = [
- [-1, -1],
- [0, -2],
- [1, -1]
- ];
- var u = [
- [-1, 1],
- [1, 1]
- ];
- for (var r = 0; r < this.fieldHeight - 1; r++) {
- for (var i = 0; i < this.fieldWidth; i++) {
- if (this.field[i][r].getColorID() == this.field[i][r + 1].getColorID()) {
- if (this.findPattern(i, r, this.field[i][r].getColorID(), s, i, r + 2)) {
- return true
- }
- if (this.findPattern(i, r, this.field[i][r].getColorID(), o, i, r - 1)) {
- return true
- }
- }
- }
- }
- for (var r = 0; r < this.fieldHeight - 2; r++) {
- for (var i = 0; i < this.fieldWidth; i++) {
- if (this.field[i][r].getColorID() == this.field[i][r + 2].getColorID()) {
- if (this.findPattern(i, r, this.field[i][r].getColorID(), u, i, r + 1)) {
- return true
- }
- }
- }
- }
- } catch (a) {
- console.log(a, "playstate::findmoves");
- return false
- }
- return false
- };
- t.prototype.findPattern = function(e, t, n, r, i, s) {
- if (n <= 0) {
- return false
- }
- if (i < 0 || i >= this.fieldWidth || s < 0 || s >= this.fieldHeight) {
- return false
- }
- if (this.field[i][s] && this.field[i][s].isHole()) {
- return false
- }
- for (var o = 0; o < r.length; o++) {
- var u = this.getColorAt(e + r[o][0], t + r[o][1]);
- if (u <= 0) {
- continue
- }
- if (u == n) {
- this.findedMatchPos1 = new createjs.Point(i, s);
- this.findedMatchPos2 = new createjs.Point(e + r[o][0], t + r[o][1]);
- return true
- }
- }
- return false
- };
- t.prototype.setHintIndeces = function(e, t, n, r) {
- this.findedMatchPos1 = new createjs.Point(e, t);
- this.findedMatchPos2 = new createjs.Point(n, r)
- };
- t.prototype.getChipAt = function(e, t) {
- if (e < 0 || t < 0 || e >= this.fieldWidth || t >= this.fieldHeight || !this.field[e][t] || this.field[e][t].isHole()) {
- return null
- }
- return this.field[e][t]
- };
- t.prototype.getColorAt = function(e, t) {
- if (e < 0 || t < 0 || e >= this.fieldWidth || t >= this.fieldHeight || !this.field[e][t] == null) {
- return -1
- }
- return this.field[e][t].getColorID()
- };
- t.prototype.onShiftEnded = function() {
- if (this.liveTime != this.lastDropSoundTime) {
- this.lastDropSoundTime = this.liveTime;
- var e = Utils.RandomRangeInt(0, 2);
- for (var t = 0; e == this.lastDropID && t < 10; t++) {
- e = Utils.RandomRangeInt(0, 2)
- }
- this.lastDropID = e;
- switch (e) {
- case 0:
- SoundManager.g_instance.play(SoundManager.SOUND_DROP_1);
- break;
- case 1:
- SoundManager.g_instance.play(SoundManager.SOUND_DROP_2);
- break;
- case 2:
- SoundManager.g_instance.play(SoundManager.SOUND_DROP_3);
- break
- }
- }
- };
- t.prototype.configureYAlign = function() {
- if (Constants.g_isPC) {
- return
- }
- if (Constants.SCREEN_HEIGHT < Constants.ASSETS_HEIGHT) {
- this.y = Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT
- } else if (Constants.SCREEN_HEIGHT > Constants.ASSETS_HEIGHT) {
- this.y = (Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT) / 2;
- var e = new createjs.Shape;
- e.graphics.beginFill("#b5389c");
- e.graphics.drawRect(0, Constants.ASSETS_HEIGHT, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT + 1);
- e.graphics.endFill();
- this.addChild(e);
- var t = new createjs.Shape;
- t.graphics.beginFill("#b5389c");
- t.graphics.drawRect(0, Constants.ASSETS_HEIGHT - Constants.SCREEN_HEIGHT, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT - Constants.ASSETS_HEIGHT);
- t.graphics.endFill();
- this.addChild(t)
- }
- };
- t.prototype.runParticleEffect = function(e, t) {
- var n = 80;
- var r = Utils.RandomRangeInt(3, 4);
- for (var i = 0; i < r; i++) {
- var s = Utils.RadToGrad(Utils.RandomRange(0, 360));
- var o = new HeartParticle(Math.cos(s) * n, Math.sin(s) * n);
- this.addGameObject(o);
- this.addChild(o);
- o.x = e + Utils.RandomRange(-Constants.CELL_SIZE / 3, Constants.CELL_SIZE / 3);
- o.y = t + Utils.RandomRange(-Constants.CELL_SIZE / 3, Constants.CELL_SIZE / 3)
- }
- };
- t.g_curLevel = -1;
- t.GOAL_DIRT = "GOAL_DIRT";
- t.GOAL_COUNT = "GOAL_COUNT";
- return t
- }(GameState);
- var SelectLevelButton = function(e) {
- function t(t, n, r) {
- e.call(this, t, n);
- this.locked = false;
- this.levelNum = r;
- if (r < GameData.getInstance().levelsAvailable()) {
- var i = new DNTextField((r + 1).toString(), "sel_", -6);
- this.addChild(i);
- var s = .65;
- i.scaleX = i.scaleY = s;
- i.x = -i.getBounds().width / 2 * s + 5;
- i.y = -i.getBounds().height / 2 * s - 7
- } else {
- this.locked = true;
- var o = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_LOCK);
- o.y -= 5;
- o.x += 4;
- this.addChild(o)
- }
- }
- __extends(t, e);
- t.prototype.onMouseDown = function(t, n) {
- if (this.locked) {
- return
- }
- e.prototype.onMouseDown.call(this, t, n);
- this.touchY = n
- };
- t.prototype.onMouseUp = function(t, n) {
- if (Math.abs(n - this.touchY) > 30) {
- this.deselect();
- return
- }
- e.prototype.onMouseUp.call(this, t, n)
- };
- t.prototype.runFunc = function() {
- StateManager.g_instance.pushState(new ShadeInState(new PlayState(this.levelNum, true)))
- };
- return t
- }(DNButton);
- var TaskEffect = function(e) {
- function t(t, n, r) {
- var i = this;
- e.call(this);
- if (t == PlayState.GOAL_DIRT) {
- var s = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_TASK_PANEL);
- this.addChild(s);
- this.addChild(s);
- var o = new createjs.Text(StringManager.getInstance().getString(StringManager.STRING_CLEAR), "bold 33px Times New Roman", "#6f6aa4");
- o.textAlign = "center";
- o.y = -23;
- s.addChild(o)
- } else {
- var s = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_TASK_PANEL);
- this.addChild(s);
- var o = new createjs.Text(StringManager.getInstance().getString(StringManager.STRING_REMOVE), "bold 33px Times New Roman", "#6f6aa4");
- o.textAlign = "right";
- o.y = -23;
- s.addChild(o);
- var u = new DNTextField(n.toString(), "font_", -3);
- s.addChild(u);
- u.x = 10;
- u.y = -20;
- var a = AssetsManager.g_instance.getCenteredImageWithProxy("cake_" + r);
- a.scaleX = a.scaleY = .7;
- s.addChild(a);
- a.x = 92;
- a.y = -2
- }
- this.y = -200;
- this.x = Constants.ASSETS_WIDTH * .5;
- this.alpha = 0;
- createjs.Tween.get(this, {
- loop: false
- }).wait(1300).to({
- y: Constants.ASSETS_HEIGHT * .5,
- alpha: 1
- }, 650, createjs.Ease.backOut).wait(2200).to({
- y: Constants.ASSETS_HEIGHT + 200,
- alpha: 0
- }, 400, createjs.Ease.backIn).call(function() {
- return i.kill()
- })
- }
- __extends(t, e);
- return t
- }(GameObject);
- var WinState = function(e) {
- function t(t, n) {
- var r = this;
- e.call(this);
- this.panel = new createjs.Container;
- this.hiddingNow = false;
- GameData.getInstance().onWinLevel(t, n);
- this.shader = new createjs.Shape;
- this.shader.graphics.beginFill("#000000");
- this.shader.graphics.drawRect(0, 0, Constants.ASSETS_WIDTH, Constants.SCREEN_HEIGHT);
- this.shader.graphics.endFill();
- this.addChild(this.shader);
- this.shader.alpha = 0;
- this.shaderTween = createjs.Tween.get(this.shader, {
- loop: false
- }).wait(400).to({
- alpha: .4
- }, 800, createjs.Ease.linear);
- this.addChild(this.panel);
- this.panel.x = Constants.ASSETS_WIDTH / 2;
- this.panel.y = Constants.SCREEN_HEIGHT / 2;
- var i = AssetsManager.g_instance.getCenteredImage(Constants.IMAGE_MESSAGE_WINDOW);
- this.panel.addChild(i);
- var s = new DNButton(Constants.IMAGE_BUTTON_RESTART, function() {
- return r.onRestartTouch()
- });
- this.panel.addChild(s);
- this.addGuiObject(s);
- s.x = 0;
- s.y = 125;
- var o = new DNButton(Constants.IMAGE_BUTTON_EXIT, function() {
- return r.onExitTouch()
- });
- this.panel.addChild(o);
- this.addGuiObject(o);
- o.x = -150;
- o.y = 125;
- var u = new DNButton(Constants.IMAGE_BUTTON_PLAY, function() {
- return r.onNextTouch()
- });
- this.panel.addChild(u);
- this.addGuiObject(u);
- u.x = +150;
- u.y = 125;
- var a = AssetsManager.g_instance.getCenteredImageWithProxy(Constants.IMAGE_WIN_CAPTION);
- this.panel.addChild(a);
- a.y = -270;
- var f = -180;
- var l = +180;
- this.panel.alpha = 0;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- alpha: 1
- }, 200, createjs.Ease.linear);
- this.panel.scaleX = .7;
- this.panel.scaleY = .7;
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- scaleX: 1,
- scaleY: 1
- }, 400, createjs.Ease.backOut);
- var c = AssetsManager.g_instance.getImage(Constants.IMAGE_WIN_STRINGS);
- this.panel.addChild(c);
- c.x = -170;
- c.y = -120;
- var h = new DNTextField(Utils.GetScoreString(n), "font_", 0);
- this.panel.addChild(h);
- h.x = -68;
- h.y = -104;
- h.scaleX = h.scaleY = 1.15;
- var p = new DNTextField(Utils.GetScoreString(GameData.getInstance().getTotalScore()), "font_", 0);
- this.panel.addChild(p);
- p.x = -68;
- p.y = -17;
- p.scaleX = p.scaleY = 1.15;
- try {
- SG_Hooks.levelUp(t, n)
- } catch (d) {
- console.log("error SG_Hooks.levelUp(level, score);")
- }
- }
- __extends(t, e);
- t.prototype.hide = function() {
- if (!this.hiddingNow) {
- createjs.Tween.get(this.shader, {
- loop: false
- }).to({
- alpha: 0
- }, 400, createjs.Ease.linear).call(function() {
- StateManager.g_instance.popState()
- });
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- y: -300
- }, 300, createjs.Ease.backIn);
- createjs.Tween.get(this.panel, {
- loop: false
- }).to({
- alpha: 0
- }, 300, createjs.Ease.linear);
- this.hiddingNow = true
- }
- };
- t.prototype.onRestartTouch = function() {
- StateManager.g_instance.pushState(new ShadeInCircleState(new PlayState(PlayState.g_curLevel, false)))
- };
- t.prototype.onExitTouch = function() {
- StateManager.g_instance.pushState(new ShadeInState(new SelectLevelState))
- };
- t.prototype.onNextTouch = function() {
- if (PlayState.g_curLevel + 1 < GameData.getInstance().levelsAvailable()) {
- StateManager.g_instance.pushState(new ShadeInState(new PlayState(PlayState.g_curLevel + 1, true)))
- } else {
- StateManager.g_instance.pushState(new ShadeInState(new SelectLevelState))
- }
- };
- return t
- }(GameState);
- //58
|