12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072 |
- function LEvent(e) {
- this.eventType = e;
- this._ll_preventDefault = false
- }
- function LStageAlign() {
- throw "LStageAlign cannot be instantiated"
- }
- function LStageScaleMode() {
- throw "LStageScaleMode cannot be instantiated"
- }
- function trace() {
- if (!LGlobal.traceDebug) return;
- var e = document.getElementById("traceObject"),
- t;
- if (trace.arguments.length > 0 && e == null) {
- e = document.createElement("TEXTAREA");
- e.id = "traceObject";
- e.style.position = "absolute";
- e.style.top = LGlobal.height + 20 + "px";
- e.style.width = LGlobal.width + "px";
- e.style.height = "200px";
- document.body.appendChild(e)
- }
- for (t = 0; t < trace.arguments.length; t++) {
- e.value = e.value + trace.arguments[t] + "\r\n";
- e.scrollTop = e.scrollHeight
- }
- }
- function addChild(e) {
- LGlobal.stage.addChild(e)
- }
- function removeChild(e) {
- LGlobal.stage.removeChild(e)
- }
- function init(e, t, n, r, i, s) {
- // updateShare(0);
- LGlobal.speed = e;
- var o = function() {
- if (LGlobal.canTouch && LGlobal.aspectRatio == LANDSCAPE && window.innerWidth < window.innerHeight) {
- LGlobal.horizontalError()
- } else if (LGlobal.canTouch && LGlobal.aspectRatio == PORTRAIT && window.innerWidth > window.innerHeight) {
- LGlobal.verticalError()
- } else {
- setTimeout(i, 100)
- }
- LGlobal.startTimer = (new Date).getTime()
- };
- if (s != null && s == LEvent.INIT) {
- LGlobal.frameRate = setInterval(function() {
- LGlobal.onShow()
- }, e);
- LGlobal.setCanvas(t, n, r);
- o()
- } else {
- LEvent.addEventListener(window, "load", function() {
- LGlobal.frameRate = setInterval(function() {
- LGlobal.onShow()
- }, e);
- LGlobal.setCanvas(t, n, r);
- o()
- })
- }
- }
- function base(e, t, n) {
- var r = null,
- i = e.constructor.prototype,
- s = {};
- if (e.constructor.name == "Object") {
- console.warn("When you use the extends. You must make a method like 'XX.prototype.xxx=function(){}'. but not 'XX.prototype={xxx:function(){}}'.")
- }
- if (typeof e.__ll__parent__ == UNDEFINED) {
- e.__ll__parent__ = [];
- e.__ll__parent__ = []
- }
- e.__ll__parent__.push(t.prototype);
- for (r in i) {
- s[r] = 1
- }
- for (r in t.prototype) {
- if (!s[r]) {
- i[r] = t.prototype[r]
- }
- }
- if (i.toString == Object.prototype.toString) {
- i.toString = LObject.prototype.toString
- }
- t.apply(e, n)
- }
- function getTimer() {
- return (new Date).getTime() - LGlobal.startTimer
- }
- function getExtension(e) {
- var t, n = /([^#?]+\.)([^.#?]+)/;
- t = e.match(n);
- if (t.length >= 3) {
- return t[2].toLowerCase()
- }
- return null
- }
- function LBlendMode() {
- throw "LBlendMode cannot be instantiated"
- }
- function LoadingSample2(e, t, n) {
- base(this, LSprite, []);
- var r = this,
- i = LGlobal.canvas,
- s = "Loading...",
- o;
- r.backgroundColor = t == null ? "#000000" : t;
- r.graphics.drawRect(1, r.backgroundColor, [0, 0, LGlobal.width, LGlobal.height], true, r.backgroundColor);
- if (n == null) n = LGlobal._create_loading_color();
- r.color = n;
- r.progress = 0;
- r.size = e == null ? LGlobal.height * .2 : e;
- o = new LTextField;
- o.text = s;
- o.size = r.size;
- o.color = "#ffffff";
- o.x = (LGlobal.width - o.getWidth()) / 2;
- o.y = (LGlobal.height - r.size) / 2;
- r.addChild(o);
- r.backLabel = o;
- o = new LTextField;
- o.text = "***%";
- o.size = r.size * .3;
- o.color = n;
- o.x = (LGlobal.width - o.getWidth()) / 2;
- o.y = (LGlobal.height - r.size) / 2 - r.size * .4;
- r.addChild(o);
- r.progressLabel = o;
- o = new LTextField;
- o.text = s;
- o.size = r.size;
- o.color = r.color;
- o.x = (LGlobal.width - o.getWidth()) / 2;
- o.y = (LGlobal.height - r.size) / 2;
- o.mask = new LGraphics;
- r.screenX = o.x;
- r.screenY = o.y;
- r.screenWidth = o.getWidth();
- r.addChild(o);
- r.showLabel = o;
- i.shadowOffsetX = 2;
- i.shadowOffsetY = 2;
- i.shadowColor = "blue";
- r.setProgress(r.progress)
- }
- function LoadingSample3(e, t, n) {
- base(this, LSprite, []);
- var r = this,
- i = LGlobal.canvas;
- r.backgroundColor = t == null ? "#000000" : t;
- r.graphics.drawRect(1, r.backgroundColor, [0, 0, LGlobal.width, LGlobal.height], true, r.backgroundColor);
- if (n == null) n = LGlobal._create_loading_color();
- r.color = n;
- r.progress = 0;
- r.screenWidth = LGlobal.width * .75;
- r.screenHeight = e == null ? LGlobal.height * .1 : e;
- if (r.screenHeight > 5) r.screenHeight = 5;
- r.screenX = (LGlobal.width - r.screenWidth) / 2;
- r.screenY = (LGlobal.height - r.screenHeight) / 2;
- r.back = new LSprite;
- r.addChild(r.back);
- r.label = new LTextField;
- r.label.color = "#ffffff";
- r.label.weight = "bolder";
- r.label.size = r.screenHeight * 2;
- r.label.x = r.screenX + (r.screenWidth - r.label.getWidth()) * .5;
- r.label.y = r.screenY - r.screenHeight * 4;
- r.addChild(r.label);
- r.star = new Array;
- r.addEventListener(LEvent.ENTER_FRAME, r.onframe);
- r.setProgress(r.progress)
- }
- function LoadingSample4(e, t, n) {
- base(this, LSprite, []);
- var r = this,
- i = LGlobal.canvas;
- r.backgroundColor = t == null ? "#000000" : t;
- r.graphics.drawRect(1, r.backgroundColor, [0, 0, LGlobal.width, LGlobal.height], true, r.backgroundColor);
- if (n == null) n = "#FFFFFF";
- r.arc = new LSprite;
- r.arc.x = LGlobal.width * .5;
- r.arc.y = LGlobal.height * .5;
- r.addChild(r.arc);
- for (var s = 0; s < 360; s++) {
- r.arc.graphics.drawArc(1 + s / 36, n, [0, 0, 50, 2 * Math.PI / 360 * s, 2 * Math.PI / 360 * (s + 2)])
- }
- r.progress = 0;
- r.label = new LTextField;
- r.label.color = n;
- r.label.weight = "bolder";
- r.label.size = 18;
- r.label.x = LGlobal.width * .5;
- r.label.y = LGlobal.height * .5 - r.label.getHeight() * .5;
- r.addChild(r.label);
- var o = new LDropShadowFilter(0, 0, "#FFFFFF", 30);
- r.arc.filters = [o];
- r.addEventListener(LEvent.ENTER_FRAME, r.onframe);
- r.setProgress(r.progress)
- }
- function LoadingSample5(e, t, n) {
- base(this, LSprite, []);
- var r = this,
- i = LGlobal.canvas;
- r.backgroundColor = t == null ? "#000000" : t;
- r.graphics.drawRect(1, r.backgroundColor, [0, 0, LGlobal.width, LGlobal.height], true, r.backgroundColor);
- if (n == null) n = "#FFFFFF";
- r.arc = new LSprite;
- r.arc.x = LGlobal.width * .5;
- r.arc.y = LGlobal.height * .5;
- r.addChild(r.arc);
- var s = 50;
- for (var o = 0; o < 360; o += 30) {
- var u = new LSprite;
- u.graphics.drawArc(0, n, [s, 0, 7, 0, 2 * Math.PI], true, n);
- u.rotate = o;
- u.alpha = .1 + o / 360;
- r.arc.addChild(u)
- }
- r.index = 0;
- r.max = 3;
- r.progress = 0;
- r.label = new LTextField;
- r.label.color = "#FFFFFF";
- r.label.weight = "bolder";
- r.label.size = 18;
- r.label.x = LGlobal.width * .5;
- r.label.y = LGlobal.height * .5 - r.label.getHeight() * .5;
- r.addChild(r.label);
- var a = new LDropShadowFilter(0, 0, "#FFFFFF", 30);
- r.arc.filters = [a];
- r.addEventListener(LEvent.ENTER_FRAME, r.onframe);
- r.setProgress(r.progress)
- }
- function LoadingSample6(e, t, n) {
- var r = this;
- base(r, LSprite, []);
- r.progress = 0;
- r.step = 0;
- r.holeR = e || 10;
- r.holeAmount = 5;
- r.holesx = 20;
- r.loadingBarWidth = r.holeR * 2 * r.holeAmount + r.holesx * (r.holeAmount - 1);
- r.loadingBarHeight = r.holeR * 2;
- r.progressColor = t || "#2187e7";
- r.filterColor = n || "#00c6ff";
- r.backLayer = new LSprite;
- r.backLayer.graphics.drawRect(0, "", [0, 0, LGlobal.width, LGlobal.height], true, "#161616");
- r.addChild(r.backLayer);
- r.holeLayer = new LSprite;
- r.holeLayer.x = (LGlobal.width - r.loadingBarWidth) * .5;
- r.holeLayer.y = (LGlobal.height - r.loadingBarHeight) * .5;
- r.addChild(r.holeLayer);
- r.progressLayer = new LSprite;
- r.progressLayer.x = (LGlobal.width - r.loadingBarWidth) * .5;
- r.progressLayer.y = (LGlobal.height - r.loadingBarHeight) * .5;
- r.addChild(r.progressLayer);
- r._addHole()
- }
- function LoadingSample7(e, t, n) {
- var r = this;
- base(r, LSprite, []);
- r.progress = 0;
- r.step = 0;
- r.holeW = e || 10;
- r.holeH = t || 30;
- r.holeAmount = 10;
- r.holesx = 8;
- r.loadingBarWidth = r.holeW * r.holeAmount + r.holesx * (r.holeAmount - 1);
- r.loadingBarHeight = r.holeH;
- r.progressColor = n || "#2187e7";
- r.backLayer = new LSprite;
- r.backLayer.graphics.drawRect(0, "", [0, 0, LGlobal.width, LGlobal.height], true, "#161616");
- r.addChild(r.backLayer);
- r.holeLayer = new LSprite;
- r.holeLayer.x = (LGlobal.width - r.loadingBarWidth) * .5;
- r.holeLayer.y = (LGlobal.height - r.loadingBarHeight) * .5;
- r.addChild(r.holeLayer);
- r.progressLayer = new LSprite;
- r.progressLayer.x = (LGlobal.width - r.loadingBarWidth) * .5;
- r.progressLayer.y = (LGlobal.height - r.loadingBarHeight) * .5;
- r.addChild(r.progressLayer);
- r._addHole()
- }
- var OS_PC = "pc",
- OS_IPHONE = "iPhone",
- OS_IPOD = "iPod",
- OS_IPAD = "iPad",
- OS_ANDROID = "Android",
- OS_WINDOWS_PHONE = "Windows Phone",
- OS_BLACK_BERRY = "BlackBerry",
- NONE = "none",
- UNDEFINED = "undefined",
- LANDSCAPE = "landscape",
- PORTRAIT = "portrait",
- mouseX, mouseY;
- LEvent.prototype.preventDefault = function() {
- this._ll_preventDefault = true
- };
- LEvent.INIT = "init";
- LEvent.COMPLETE = "complete";
- LEvent.ENTER_FRAME = "enter_frame";
- LEvent.WINDOW_RESIZE = "resize";
- LEvent.SOUND_COMPLETE = "sound_complete";
- LEvent.END_CONTACT = "endContact";
- LEvent.PRE_SOLVE = "preSolve";
- LEvent.POST_SOLVE = "postSolve";
- LEvent.BEGIN_CONTACT = "beginContact";
- LEvent.addEventListener = function(e, t, n, r) {
- if (r == null) {
- r = false
- }
- if (e.addEventListener) {
- e.addEventListener(t, n, r)
- } else if (e.attachEvent) {
- e["e" + t + n] = n;
- e[t + n] = function() {
- e["e" + t + n]()
- };
- e.attachEvent("on" + t, e[t + n])
- }
- };
- LEvent.removeEventListener = function(e, t, n, r) {
- if (r == null) {
- r = false
- }
- if (e.removeEventListener) {
- e.removeEventListener(t, n, r)
- } else if (e.detachEvent) {
- e["e" + t + n] = n;
- e[t + n] = function() {
- e["e" + t + n]()
- };
- e.detachEvent("on" + t, e[t + n])
- }
- };
- var LMouseEvent = function() {
- throw "LMouseEvent cannot be instantiated"
- };
- LMouseEvent.MOUSE_DOWN = "mousedown";
- LMouseEvent.MOUSE_UP = "mouseup";
- LMouseEvent.TOUCH_START = "touchstart";
- LMouseEvent.TOUCH_MOVE = "touchmove";
- LMouseEvent.TOUCH_END = "touchend";
- LMouseEvent.MOUSE_MOVE = "mousemove";
- LMouseEvent.MOUSE_OVER = "mouseover";
- LMouseEvent.MOUSE_OUT = "mouseout";
- LMouseEvent.DOUBLE_CLICK = "dblclick";
- var LMultitouchInputMode = function() {
- throw "LMultitouchInputMode cannot be instantiated"
- };
- LMultitouchInputMode.NONE = "none";
- LMultitouchInputMode.GESTURE = "gesture";
- LMultitouchInputMode.TOUCH_POINT = "touchPoint";
- var LMultitouch = function() {
- throw "LMultitouch cannot be instantiated"
- };
- LMultitouch.inputMode = "none";
- LMultitouch.touchs = [];
- var LTextEvent = function() {
- throw "LTextEvent cannot be instantiated"
- };
- LTextEvent.TEXT_INPUT = "textInput";
- LTextEvent.WIND_COMPLETE = "windComplete";
- var LFocusEvent = function() {
- throw "LFocusEvent cannot be instantiated"
- };
- LFocusEvent.FOCUS_IN = "focusIn";
- LFocusEvent.FOCUS_OUT = "focusOut";
- var LMouseEventContainer = function() {
- function e() {
- var e = this;
- e.container = {};
- e.dispatchAllEvent = false;
- e.mouseDownContainer = [];
- e.mouseUpContainer = [];
- e.mouseMoveContainer = [];
- e.mouseOverContainer = [];
- e.mouseOutContainer = [];
- e.mouseDblContainer = [];
- e.textFieldInputContainer = [];
- e.buttonContainer = []
- }
- e.prototype = {
- pushInputBox: function(e) {
- var t = this,
- n = t.textFieldInputContainer,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (e.objectIndex == n[r].objectIndex) {
- return
- }
- }
- t.textFieldInputContainer.push(e)
- },
- removeInputBox: function(e) {
- var t = this,
- n = t.textFieldInputContainer,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (e.objectIndex == n[r].objectIndex) {
- t.textFieldInputContainer.splice(r, 1);
- break
- }
- }
- },
- pushButton: function(e) {
- var t = this,
- n = t.buttonContainer,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (e.objectIndex == n[r].objectIndex) {
- return
- }
- }
- t.buttonContainer.push(e)
- },
- removeButton: function(e) {
- var t = this,
- n = t.buttonContainer,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (e.objectIndex == n[r].objectIndex) {
- t.buttonContainer.splice(r, 1);
- break
- }
- }
- },
- dispatchEventButton: function(e) {
- var t = this,
- n = t.buttonContainer,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (typeof t.buttonContainer[r].ll_button_mode == "function") {
- t.buttonContainer[r].ll_button_mode(e)
- }
- }
- },
- addEvent: function(e, t, n) {
- var r = this;
- t.push({
- container: e,
- listener: n
- })
- },
- removeEvent: function(e, t, n) {
- var r = this,
- i, s;
- for (i = 0, s = t.length; i < s; i++) {
- if (t[i].container.objectIndex === e.objectIndex && (!n || t[i].listener == n)) {
- t.splice(i, 1);
- break
- }
- }
- },
- addMouseDownEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseDownContainer, t)
- },
- addMouseUpEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseUpContainer, t)
- },
- addMouseMoveEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseMoveContainer, t)
- },
- addMouseOverEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseOverContainer, t)
- },
- addMouseOutEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseOutContainer, t)
- },
- addMouseDblEvent: function(e, t) {
- var n = this;
- n.addEvent(e, n.mouseDblContainer, t)
- },
- addMouseEvent: function(e, t, n) {
- var r = this;
- if (t == LMouseEvent.MOUSE_DOWN) {
- r.addMouseDownEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_UP) {
- r.addMouseUpEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_OVER) {
- r.addMouseOverEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_OUT) {
- r.addMouseOutEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_MOVE) {
- r.addMouseMoveEvent(e, n)
- } else {
- r.addMouseDblEvent(e, n)
- }
- },
- hasEvent: function(e, t) {
- for (var n = 0, r = t.length; n < r; n++) {
- if (t[n].container.objectIndex === e.objectIndex) {
- return true
- }
- }
- return false
- },
- removeMouseDownEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseDownContainer, t)
- },
- removeMouseUpEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseUpContainer, t)
- },
- removeMouseMoveEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseMoveContainer, t)
- },
- removeMouseOverEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseOverContainer, t)
- },
- removeMouseOutEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseOutContainer, t)
- },
- removeMouseDblEvent: function(e, t) {
- var n = this;
- n.removeEvent(e, n.mouseDblContainer, t)
- },
- removeMouseEvent: function(e, t, n) {
- var r = this;
- if (t == LMouseEvent.MOUSE_DOWN) {
- r.removeMouseDownEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_UP) {
- r.removeMouseUpEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_OVER) {
- r.removeMouseOverEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_OUT) {
- r.removeMouseOutEvent(e, n)
- } else if (t == LMouseEvent.MOUSE_MOVE) {
- r.removeMouseMoveEvent(e, n)
- } else {
- r.removeMouseDblEvent(e, n)
- }
- },
- dispatchMouseEvent: function(e, t) {
- var n = this;
- if (t == LMouseEvent.MOUSE_DOWN) {
- n.dispatchEvent(e, n.mouseDownContainer, LMouseEvent.MOUSE_DOWN);
- n.dispatchEvent(e, n.textFieldInputContainer)
- } else if (t == LMouseEvent.MOUSE_UP) {
- n.dispatchEvent(e, n.mouseUpContainer, LMouseEvent.MOUSE_UP)
- } else if (t == LMouseEvent.DOUBLE_CLICK) {
- n.dispatchEvent(e, n.mouseDblContainer, LMouseEvent.DOUBLE_CLICK)
- } else {
- n.dispatchEventButton(e);
- n.dispatchEvent(e, n.mouseOutContainer, LMouseEvent.MOUSE_OUT);
- n.dispatchEvent(e, n.mouseOverContainer, LMouseEvent.MOUSE_OVER);
- n.dispatchEvent(e, n.mouseMoveContainer, LMouseEvent.MOUSE_MOVE)
- }
- },
- getRootParams: function(e) {
- var t = e.parent,
- n = {
- x: 0,
- y: 0,
- scaleX: 1,
- scaleY: 1
- };
- while (t != "root") {
- n.x *= t.scaleX;
- n.y *= t.scaleY;
- n.x += t.x;
- n.y += t.y;
- n.scaleX *= t.scaleX;
- n.scaleY *= t.scaleY;
- t = t.parent
- }
- return n
- },
- _mouseEnabled: function(e) {
- var t = this;
- if (!e || !e.parent || e.parent == "root") {
- return false
- }
- if (!e.visible || typeof e.mouseEnabled != UNDEFINED && !e.mouseEnabled) {
- return false
- }
- var n = e.parent;
- while (n != "root") {
- if (!n.mouseEnabled || !n.mouseChildren) {
- return false
- }
- n = n.parent;
- if (!n) {
- return false
- }
- }
- return true
- },
- dispatchEvent: function(e, t, n) {
- var r = this,
- i, s, o = [],
- u, a, f;
- for (a = 0, f = t.length; a < f; a++) {
- i = t[a].container || t[a];
- if (!r._mouseEnabled(i)) {
- continue
- }
- s = r.getRootParams(i);
- if (!n && i.mouseEvent) {
- i.mouseEvent(e, LMouseEvent.MOUSE_DOWN, s);
- continue
- }
- if (i.ismouseon(e, s)) {
- if (n == LMouseEvent.MOUSE_OUT) {
- continue
- }
- if (n == LMouseEvent.MOUSE_OVER) {
- if (i.ll_mousein) {
- continue
- }
- }
- if (n != LMouseEvent.MOUSE_UP) {
- i.ll_mousein = true
- }
- o.push({
- sp: i,
- co: s,
- listener: t[a].listener
- })
- } else {
- if (n != LMouseEvent.MOUSE_OUT && n != LMouseEvent.MOUSE_OVER) {
- continue
- }
- if (!i.ll_mousein) {
- continue
- }
- i.ll_mousein = false;
- o.push({
- sp: i,
- co: s,
- listener: t[a].listener
- })
- }
- }
- if (o.length == 0) {
- return
- }
- if (o.length > 1) {
- o = o.sort(r._sort.bind(r))
- }
- f = r.dispatchAllEvent ? o.length : 1;
- for (a = 0; a < f && a < o.length; a++) {
- u = o[a];
- e.currentTarget = e.clickTarget = u.sp;
- if (!e.target) {
- e.target = u.sp
- }
- e.event_type = n;
- e.selfX = (e.offsetX - u.co.x - u.sp.x) / (u.co.scaleX * u.sp.scaleX);
- e.selfY = (e.offsetY - u.co.y - u.sp.y) / (u.co.scaleY * u.sp.scaleY);
- u.listener(e, u.sp);
- if (f == 1 && a < o.length - 1 && u.sp.objectIndex == o[a + 1].sp.objectIndex) {
- o.splice(a, 1);
- a--
- }
- }
- },
- set: function(e, t) {
- this.container[e] = t
- },
- _sort: function(e, t) {
- var n = this,
- r, i, s = n._getSort(e.sp),
- o = n._getSort(t.sp),
- u, a, f;
- for (u = 0, a = s.length, f = o.length; u < a && u < f; u++) {
- r = s[u];
- i = o[u];
- if (r.objectIndex == i.objectIndex) {
- continue
- }
- return i.parent.getChildIndex(i) - r.parent.getChildIndex(r)
- }
- return o.length - s.length
- },
- _getSort: function(e) {
- var t = e.parent,
- n = [e];
- while (t != "root") {
- n.unshift(t);
- t = t.parent
- }
- return n
- }
- };
- return new e
- }();
- var LKeyboardEvent = function() {
- throw "LKeyboardEvent cannot be instantiated"
- };
- LKeyboardEvent.KEY_DOWN = "keydown";
- LKeyboardEvent.KEY_UP = "keyup";
- LKeyboardEvent.KEY_PRESS = "keypress";
- var LAccelerometerEvent = function() {
- throw "LAccelerometerEvent cannot be instantiated"
- };
- LAccelerometerEvent.DEVICEMOTION = "devicemotion";
- LStageAlign.TOP = "T";
- LStageAlign.BOTTOM = "B";
- LStageAlign.LEFT = "L";
- LStageAlign.RIGHT = "Re";
- LStageAlign.TOP_LEFT = "TL";
- LStageAlign.TOP_RIGHT = "TR";
- LStageAlign.TOP_MIDDLE = "TM";
- LStageAlign.BOTTOM_LEFT = "BL";
- LStageAlign.BOTTOM_RIGHT = "BR";
- LStageAlign.BOTTOM_MIDDLE = "BM";
- LStageAlign.MIDDLE = "M";
- LStageScaleMode.EXACT_FIT = "exactFit";
- LStageScaleMode.SHOW_ALL = "showAll";
- LStageScaleMode.NO_BORDER = "noBorder";
- LStageScaleMode.NO_SCALE = "noScale";
- var LGlobal = function() {
- function e() {
- throw "LGlobal cannot be instantiated"
- }
- e.FULL_SCREEN = "full_screen";
- e.traceDebug = false;
- e.displayState = NONE;
- e.aspectRatio = NONE;
- e.canvasObj = null;
- e.canvas = null;
- e.webAudio = true;
- e.objectIndex = 1;
- e.stage = null;
- e.width = 0;
- e.height = 0;
- e.box2d = null;
- e.speed = 50;
- e.IS_MOUSE_DOWN = false;
- e.preventDefault = true;
- e.childList = new Array;
- e.dragList = new Array;
- e.excludingContainer = new Array;
- e.stageScale = "noScale";
- e.align = "M";
- e.mobile = false;
- e.canTouch = false;
- e.os = OS_PC;
- e.ios = false;
- e.android = false;
- e.android_new = false;
- e.backgroundColor = null;
- e.destroy = true;
- e.forceRefresh = false;
- e.devicePixelRatio = window.devicePixelRatio || 1;
- e.startTimer = 0;
- e.keepClear = true;
- e.top = 0;
- e.left = 0;
- e.window = window;
- (function(t) {
- e.isFirefox = t.toLowerCase().indexOf("firefox") >= 0;
- if (t.indexOf(OS_IPHONE) > 0) {
- e.os = OS_IPHONE;
- e.canTouch = true;
- e.ios = true
- } else if (t.indexOf(OS_IPOD) > 0) {
- e.os = OS_IPOD;
- e.canTouch = true;
- e.ios = true
- } else if (t.indexOf(OS_IPAD) > 0) {
- e.os = OS_IPAD;
- e.ios = true;
- e.canTouch = true
- } else if (t.indexOf(OS_ANDROID) > 0) {
- e.os = OS_ANDROID;
- e.canTouch = true;
- e.android = true;
- var n = t.indexOf(OS_ANDROID);
- if (parseInt(t.substr(n + 8, 1)) > 3) {
- e.android_new = true
- }
- } else if (t.indexOf(OS_WINDOWS_PHONE) > 0) {
- e.os = OS_WINDOWS_PHONE;
- e.canTouch = true
- } else if (t.indexOf(OS_BLACK_BERRY) > 0) {
- e.os = OS_BLACK_BERRY;
- e.canTouch = true
- }
- e.mobile = e.canTouch
- })(navigator.userAgent);
- e.setDebug = function(t) {
- e.traceDebug = t
- };
- e.setCanvas = function(t, n, r) {
- e.ll_createCanvas(t, n, r);
- e.ll_createStage();
- if (e.displayState == LStage.FULL_SCREEN) {
- e.resize()
- } else if (typeof e.displayState == "number") {
- e.resize(e.width * e.displayState, e.height * e.displayState)
- }
- if (e.canTouch) {
- e.ll_clicks = 0;
- e.ll_prev_clickTime = 0;
- LEvent.addEventListener(e.canvasObj, LMouseEvent.TOUCH_START, e.ll_touchStart);
- LEvent.addEventListener(document, LMouseEvent.TOUCH_END, e.ll_touchEnd);
- LEvent.addEventListener(e.canvasObj, LMouseEvent.TOUCH_MOVE, e.ll_touchMove)
- } else {
- LEvent.addEventListener(e.canvasObj, LMouseEvent.DOUBLE_CLICK, e.ll_mouseDbclick);
- LEvent.addEventListener(e.canvasObj, LMouseEvent.MOUSE_DOWN, e.ll_mouseDown);
- LEvent.addEventListener(e.canvasObj, LMouseEvent.MOUSE_MOVE, e.ll_mouseMove);
- LEvent.addEventListener(e.canvasObj, LMouseEvent.MOUSE_UP, e.ll_mouseUp);
- LEvent.addEventListener(e.canvasObj, LMouseEvent.MOUSE_OUT, e.ll_mouseOut)
- }
- };
- e.ll_createCanvas = function(t, n, r) {
- e.id = t;
- e.object = document.getElementById(t);
- e.object.innerHTML = '<div style="position:absolute;margin:0;padding:0;overflow:visible;-webkit-transform:translateZ(0);z-index:0;">' + '<canvas id="' + e.id + '_canvas" style="margin:0;padding:0;width:' + n + "px;height:" + r + 'px;">' + '<div id="noCanvas">' + "<p>Hey there,it looks like you're using Microsoft's Internet Explorer. Microsoft hates the Web and doesn't support HTML5:(</p>" + "</div>" + "</canvas></div>" + '<div id="' + e.id + '_InputText" style="position:absolute;margin:0;padding:0;z-index:10;display:none;">' + '<textarea rows="1" id="' + e.id + '_InputTextareaBox" style="resize:none;background:transparent;border:0px;"></textarea>' + '<input type="text" id="' + e.id + '_InputTextBox" style="background:transparent;border:0px;"/>' + '<input type="password" id="' + e.id + '_passwordBox" style="background:transparent;border:0px;"/></div>';
- e.canvasObj = document.getElementById(e.id + "_canvas");
- e._canvas = document.createElement("canvas");
- e._context = e._canvas.getContext("2d");
- if (e._context) {
- e.canvasObj.innerHTML = ""
- }
- e.inputBox = document.getElementById(e.id + "_InputText");
- e.inputTextareaBoxObj = document.getElementById(e.id + "_InputTextareaBox");
- e.inputTextBoxObj = document.getElementById(e.id + "_InputTextBox");
- e.passwordBoxObj = document.getElementById(e.id + "_passwordBox");
- e.inputTextField = null;
- if (n) {
- e.canvasObj.width = n
- }
- if (r) {
- e.canvasObj.height = r
- }
- e.width = e.canvasObj.width;
- e.height = e.canvasObj.height;
- e.canvasStyleWidth = e.width;
- e.canvasStyleHeight = e.height;
- e.canvas = e.canvasObj.getContext("2d");
- e.offsetX = mouseX = 0;
- e.offsetY = mouseY = 0
- };
- e.ll_createStage = function() {
- e.stage = new LSprite;
- e.stage.parent = "root";
- e.childList.push(e.stage);
- e.stage.baseAddEvent = e.stage.addEventListener;
- e.stage.baseRemoveEvent = e.stage.removeEventListener;
- e.stage.addEventListener = function(t, n) {
- if (t == LEvent.WINDOW_RESIZE) {
- e.stage.onresizeListener = n;
- e.stage.onresize = function(t) {
- e.stage.onresizeEvent = t
- };
- LEvent.addEventListener(e.window, t, e.stage.onresize)
- } else if (t == LKeyboardEvent.KEY_DOWN || t == LKeyboardEvent.KEY_UP || t == LKeyboardEvent.KEY_PRESS) {
- LEvent.addEventListener(e.window, t, n)
- } else {
- e.stage.baseAddEvent(t, n)
- }
- };
- e.stage.removeEventListener = function(t, n) {
- if (t == LEvent.WINDOW_RESIZE) {
- LEvent.removeEventListener(e.window, LEvent.WINDOW_RESIZE, e.stage.onresize);
- delete e.stage.onresize;
- delete e.stage.onresizeListener
- } else if (t == LKeyboardEvent.KEY_DOWN || t == LKeyboardEvent.KEY_UP || t == LKeyboardEvent.KEY_PRESS) {
- LEvent.removeEventListener(e.window, t, n)
- } else {
- e.stage.baseRemoveEvent(t, n)
- }
- }
- };
- e.ll_touchStart = function(t) {
- if (e.inputBox.style.display != NONE) {
- e.inputTextField._ll_getValue()
- }
- var n, r, i, s, o;
- n = parseInt(0 + e.object.style.left) + parseInt(e.canvasObj.style.marginLeft);
- r = parseInt(0 + e.object.style.top) + parseInt(e.canvasObj.style.marginTop);
- if (LMultitouch.inputMode == LMultitouchInputMode.NONE) {
- i = e.ll_touchStartEvent(t, 0, n, r)
- } else if (LMultitouch.inputMode == LMultitouchInputMode.TOUCH_POINT) {
- for (var o = 0, u = t.touches.length; o < u; o++) {
- if (!LMultitouch.touchs["touch" + t.touches[o].identifier]) {
- i = e.ll_touchStartEvent(t, o, n, r)
- }
- }
- }
- var a = new Date;
- var f = a.getTime();
- e.ll_clicks = f <= e.ll_prev_clickTime + 500 ? e.ll_clicks + 1 : 1;
- e.ll_prev_clickTime = f;
- if (e.ll_clicks === 2) {
- e.mouseEvent(i, LMouseEvent.DOUBLE_CLICK);
- e.ll_clicks = 0
- }
- e.IS_MOUSE_DOWN = true;
- if (e.mouseJoint_start) {
- e.mouseJoint_start(i)
- }
- e.touchHandler(t)
- };
- e.ll_touchStartEvent = function(t, n, r, i) {
- var s = {
- offsetX: t.touches[n].pageX - r,
- offsetY: t.touches[n].pageY - i,
- touchPointID: t.touches[n].identifier
- };
- s.offsetX = e.ll_scaleX(s.offsetX);
- s.offsetY = e.ll_scaleY(s.offsetY);
- mouseX = e.offsetX = s.offsetX;
- mouseY = e.offsetY = s.offsetY;
- LMultitouch.touchs["touch" + s.touchPointID] = s;
- e.mouseEvent(s, LMouseEvent.MOUSE_DOWN);
- e.buttonStatusEvent = s;
- return s
- };
- e.ll_touchEnd = function(t) {
- var n, r, i, s, o, u;
- if (LMultitouch.inputMode == LMultitouchInputMode.TOUCH_POINT) {
- for (i in LMultitouch.touchs) {
- n = LMultitouch.touchs[i];
- u = false;
- for (s = 0, o = t.touches.length; s < o; s++) {
- if (t.touches[s].identifier == n.touchPointID) {
- u = true;
- break
- }
- }
- if (!u) {
- r = n;
- delete LMultitouch.touchs[i];
- e.mouseEvent(r, LMouseEvent.MOUSE_UP)
- }
- }
- }
- if (!r) {
- r = {
- offsetX: e.offsetX,
- offsetY: e.offsetY
- }
- }
- e.mouseEvent(r, LMouseEvent.MOUSE_UP);
- e.touchHandler(t);
- e.IS_MOUSE_DOWN = false;
- e.buttonStatusEvent = null;
- if (e.mouseJoint_end) {
- e.mouseJoint_end()
- }
- };
- e.ll_touchMove = function(t) {
- var n, r, s, o, u = t.touches.length;
- n = parseInt(0 + e.object.style.left) + parseInt(e.canvasObj.style.marginLeft);
- r = parseInt(0 + e.object.style.top) + parseInt(e.canvasObj.style.marginTop);
- if (LMultitouch.inputMode == LMultitouchInputMode.NONE) {
- u = 1
- }
- for (i = 0, o = t.touches.length; i < o && i < u; i++) {
- s = {
- offsetX: t.touches[i].pageX - n,
- offsetY: t.touches[i].pageY - r,
- touchPointID: t.touches[i].identifier
- };
- s.offsetX = e.ll_scaleX(s.offsetX);
- s.offsetY = e.ll_scaleY(s.offsetY);
- mouseX = e.offsetX = s.offsetX;
- mouseY = e.offsetY = s.offsetY;
- if (LMultitouch.touchs["touch" + s.touchPointID] && LMultitouch.touchs["touch" + s.touchPointID].offsetX == s.offsetX && LMultitouch.touchs["touch" + s.touchPointID].offsetY == s.offsetY) {
- continue
- }
- e.buttonStatusEvent = s;
- LMultitouch.touchs["touch" + s.touchPointID] = s;
- e.mouseEvent(s, LMouseEvent.MOUSE_MOVE)
- }
- e.touchHandler(t);
- if (e.mouseJoint_move) {
- e.mouseJoint_move(s)
- }
- };
- e.ll_mouseDbclick = function(t) {
- if (t.offsetX == null && t.layerX != null) {
- t.offsetX = t.layerX;
- t.offsetY = t.layerY
- }
- var n = {
- button: t.button
- };
- n.offsetX = e.ll_scaleX(t.offsetX);
- n.offsetY = e.ll_scaleY(t.offsetY);
- e.mouseEvent(n, LMouseEvent.DOUBLE_CLICK)
- };
- e.ll_mouseDown = function(t) {
- if (t.offsetX == null && t.layerX != null) {
- t.offsetX = t.layerX;
- t.offsetY = t.layerY
- }
- if (e.inputBox.style.display != NONE) {
- e.inputTextField._ll_getValue()
- }
- var n = {
- button: t.button
- };
- n.offsetX = e.ll_scaleX(t.offsetX);
- n.offsetY = e.ll_scaleY(t.offsetY);
- e.mouseEvent(n, LMouseEvent.MOUSE_DOWN);
- e.IS_MOUSE_DOWN = true;
- if (e.mouseJoint_start) {
- e.mouseJoint_start(n)
- }
- };
- e.ll_mouseMove = function(t) {
- if (t.offsetX == null && t.layerX != null) {
- t.offsetX = t.layerX;
- t.offsetY = t.layerY
- }
- var n = {};
- n.offsetX = e.ll_scaleX(t.offsetX);
- n.offsetY = e.ll_scaleY(t.offsetY);
- e.buttonStatusEvent = n;
- mouseX = e.offsetX = n.offsetX;
- mouseY = e.offsetY = n.offsetY;
- e.cursor = "default";
- e.mouseEvent(n, LMouseEvent.MOUSE_MOVE);
- document.body.style.cursor = e.cursor;
- if (e.mouseJoint_move) {
- e.mouseJoint_move(n)
- }
- };
- e.ll_mouseUp = function(t) {
- if (t.offsetX == null && t.layerX != null) {
- t.offsetX = t.layerX;
- t.offsetY = t.layerY
- }
- var n = {
- button: t.button
- };
- n.offsetX = e.ll_scaleX(t.offsetX);
- n.offsetY = e.ll_scaleY(t.offsetY);
- e.mouseEvent(n, LMouseEvent.MOUSE_UP);
- e.IS_MOUSE_DOWN = false;
- if (e.mouseJoint_end) {
- e.mouseJoint_end()
- }
- };
- e.ll_mouseOut = function(t) {
- if (t.offsetX == null && t.layerX != null) {
- t.offsetX = t.layerX;
- t.offsetY = t.layerY
- }
- var n = {};
- n.offsetX = e.ll_scaleX(t.offsetX);
- n.offsetY = e.ll_scaleY(t.offsetY);
- e.mouseEvent(n, LMouseEvent.MOUSE_OUT);
- e.IS_MOUSE_DOWN = false
- };
- e.touchHandler = function(t) {
- t.stopPropagation();
- if (e.preventDefault) {
- t.preventDefault()
- }
- if (t.stopImmediatePropagation) {
- t.stopImmediatePropagation()
- }
- return t
- };
- e.mouseEvent = function(t, n) {
- if (n == LMouseEvent.MOUSE_MOVE) {
- e.dragHandler(t)
- }
- if (LMouseEventContainer.container[n]) {
- LMouseEventContainer.dispatchMouseEvent(t, n);
- return
- }
- for (var r = e.childList.length - 1; r >= 0; r--) {
- if (e.childList[r].mouseEvent && e.childList[r].mouseEvent(t, n)) {
- break
- }
- }
- };
- e.dragHandler = function(t) {
- var n, r, i, s = e.dragList;
- for (n = s.length - 1; n >= 0; n--) {
- r = s[n];
- if (e.canTouch && r.ll_touchPointID != t.touchPointID) {
- continue
- }
- i = r.getAbsoluteScale();
- r.x = r.ll_dragStartX + (t.offsetX - r.ll_dragMX) * r.scaleX / i.scaleX;
- r.y = r.ll_dragStartY + (t.offsetY - r.ll_dragMY) * r.scaleY / i.scaleY;
- break
- }
- };
- e._ll_mobile = function() {
- var t = e.width * .3,
- n = t * 1.5,
- r = e.width * .05,
- i = t * .05,
- s = t * .15,
- o = t * .3,
- u = n * .2,
- a = "#cccccc",
- f = "#000000",
- l = "#ffffff",
- c = "#ff0000",
- h, t, n, p, d, v, m;
- h = new LSprite;
- addChild(h);
- t = e.width * .3, n = t * 1.5;
- h.graphics.drawRoundRect(1, f, [r, r, t, n, r], true, a);
- h.graphics.drawRoundRect(1, f, [r + i, r + i, t - i * 2, n - i * 2, r], true, f);
- h.graphics.drawRect(1, l, [r + s, r + u, t - s * 2, n - u * 2], true, l);
- h.graphics.drawArc(1, l, [r + t * .5, r + n - i * 3.5, i * 1.5, 0, 2 * Math.PI]);
- h.graphics.drawRoundRect(1, l, [r + o, r + s, t - o * 2, i, i * .5]);
- p = new LSprite;
- p.x = -(t - s * 2) * .5;
- p.y = -i * .5;
- p.graphics.drawRect(1, c, [0, 0, t - s * 2, i], true, c);
- d = new LSprite;
- d.y = -(t - s * 2) * .5;
- d.x = -i * .5;
- d.graphics.drawRect(1, c, [0, 0, i, t - s * 2], true, c);
- v = new LSprite;
- v.x = r + o + (t - o * 2) * .5;
- v.y = r + u + (n - u * 2) * .5;
- v.rotate = 45;
- v.addChild(p);
- v.addChild(d);
- h.addChild(v);
- m = new LSprite;
- m.graphics.drawVertices(2, f, [
- [0, 0],
- [s, s],
- [0, s * 2]
- ], true, a);
- m.x = r * 1.5 + n;
- m.y = r * 1.5 + n * .5;
- addChild(m);
- h.arrow = m;
- var g = function() {
- setTimeout(function() {
- location.href = location.href
- }, 100)
- };
- window.onorientationchange = g;
- return h
- };
- e.verticalError = function() {
- var t = e.width * .3,
- n = e.width * .05;
- var r = e._ll_mobile();
- var i = r.clone();
- i.getChildAt(0).visible = false;
- i.x = e.width * .5 + n;
- addChild(i);
- r.rotate = 90;
- r.x = e.width * .5 + n;
- r.y = t * .5
- };
- e.horizontalError = function() {
- var t = e.width * .3,
- n = e.width * .05;
- var r = e._ll_mobile();
- var i = r.clone();
- i.getChildAt(0).visible = false;
- i.rotate = 90;
- i.x = e.width - n;
- i.y = t * .5;
- addChild(i);
- r.arrow.x = n * 1.5 + t
- };
- e.onShow = function() {
- if (e.canvas == null) {
- return
- }
- if (e.stage.onresizeEvent) {
- e.stage.onresizeListener(e.stage.onresizeEvent);
- delete e.stage.onresizeEvent
- }
- if (e.forceRefresh) {
- e.canvasObj.width = e.canvasObj.width;
- e.forceRefresh = false
- }
- if (e.box2d != null) {
- e.box2d.ll_show();
- if (!e.traceDebug && e.keepClear) {
- e.canvas.clearRect(0, 0, e.width + 1, e.height + 1)
- }
- } else {
- if (e.keepClear) {
- e.canvas.clearRect(0, 0, e.width + 1, e.height + 1)
- }
- if (e.backgroundColor !== null) {
- e.canvas.fillStyle = e.backgroundColor;
- e.canvas.fillRect(0, 0, e.width, e.height)
- }
- }
- e.show(e.childList)
- };
- e.show = function(e) {
- for (var t = 0, n = e.length; t < n; t++) {
- if (e[t] && e[t].ll_show) {
- e[t].ll_show()
- }
- }
- };
- e.divideCoordinate = function(e, t, n, r) {
- var i, s, o = e / r,
- u = t / n,
- a = [],
- f;
- for (i = 0; i < n; i++) {
- f = [];
- for (s = 0; s < r; s++) {
- f.push({
- x: o * s,
- y: u * i,
- width: o,
- height: u
- })
- }
- a.push(f)
- }
- return a
- };
- e._create_loading_color = function() {
- var t = e.canvas.createRadialGradient(e.width / 2, e.height, 0, e.width / 2, 0, e.height);
- t.addColorStop(0, "red");
- t.addColorStop(.3, "orange");
- t.addColorStop(.4, "yellow");
- t.addColorStop(.5, "green");
- t.addColorStop(.8, "blue");
- t.addColorStop(1, "violet");
- return t
- };
- e.hitPolygon = function(e, t, n) {
- var r = 0,
- i = e[0],
- s = t <= i[0],
- o = n <= i[1],
- u, a, f, l, c;
- for (u = 1, a = e.length; u < a + 1; u++) {
- f = e[u % a];
- l = t <= f[0];
- c = n <= f[1];
- if (o != c) {
- if (s == l) {
- if (s) {
- r += o ? -1 : 1
- }
- } else {
- if (t <= i[0] + (f[0] - i[0]) * (n - i[1]) / (f[1] - i[1])) {
- r += o ? -1 : 1
- }
- }
- }
- i = f;
- s = l;
- o = c
- }
- return 0 != r
- };
- e.hitTestPolygon = function(e, t) {
- var n, r, i, s, o, u, a = [
- [e, [],
- []
- ],
- [t, [],
- []
- ]
- ];
- for (r = 0; r < a.length; r++) {
- s = a[r][0], o = a[r][1];
- for (n = 0, i = s.length; n < i; n++) {
- a[r][2].push(new LVec2(s[n][0], s[n][1]));
- if (n < i - 1) {
- o.push((new LVec2(s[n + 1][0] - s[n][0], s[n + 1][1] - s[n][1])).normL())
- }
- }
- o.push((new LVec2(s[0][0] - s[i - 1][0], s[0][1] - s[i - 1][1])).normL())
- }
- for (r = 0; r < a.length; r++) {
- o = a[r][1];
- for (n = 0, i = o.length; n < i; n++) {
- var f = LVec2.getMinMax(a[0][2], o[n]);
- var l = LVec2.getMinMax(a[1][2], o[n]);
- if (f.max_o < l.min_o || f.min_o > l.max_o) {
- return false
- }
- }
- }
- return true
- };
- e.hitTestPolygonArc = function(t, n) {
- if (e.hitPolygon(t, n[0], n[1])) {
- return true
- }
- var r, i, s, o, u, a, f, l, c, h;
- for (r = 0, s = t.length; r < s; r++) {
- i = r < s - 1 ? r + 1 : 0;
- o = t[r], u = t[i];
- a = new LVec2(n[0] - o[0], n[1] - o[1]), f = new LVec2(u[0] - o[0], u[1] - o[1]);
- h = f.normalize();
- c = LVec2.dot(a, h);
- if (c <= 0) {
- if (a.x * a.x + a.y * a.y < n[3]) {
- return true
- }
- } else if (c * c < f.x * f.x + f.y * f.y) {
- l = LVec2.cross(a, h);
- if (l * l < n[3]) {
- return true
- }
- }
- }
- return false
- };
- e.hitTestArc = function(e, t, n, r) {
- var i = e.getWidth() * .5,
- s = t.getWidth() * .5,
- o = e._startX ? e._startX() : e.startX(),
- u = t._startX ? t._startX() : t.startX(),
- a = e._startY ? e._startY() : e.startY(),
- f = t._startY ? t._startY() : t.startY();
- if (typeof n != UNDEFINED) {
- o += i - n;
- a += i - n;
- i = n
- }
- if (typeof r != UNDEFINED) {
- u += s - r;
- f += s - r;
- s = r
- }
- var l = o + i - u - s,
- c = a + i - f - s;
- return l * l + c * c < (i + s) * (i + s)
- };
- e.hitTestRect = function(e, t, n, r) {
- var i = e.getWidth(),
- s = t.getWidth(),
- o = e.getHeight(),
- u = t.getHeight(),
- a = e._startX ? e._startX() : e.startX(),
- f = t._startX ? t._startX() : t.startX(),
- l = e._startY ? e._startY() : e.startY(),
- c = t._startY ? t._startY() : t.startY();
- if (typeof n != UNDEFINED) {
- a += (i - n[0]) * .5;
- l += (o - n[1]) * .5;
- i = n[0];
- o = n[1]
- }
- if (typeof r != UNDEFINED) {
- f += (s - r[0]) * .5;
- c += (u - r[1]) * .5;
- s = r[0];
- u = r[1]
- }
- var h = a > f ? a : f,
- p = l > c ? l : c,
- d = a + i > f + s ? f + s : a + i,
- v = l + o > c + u ? c + u : l + o;
- return h <= d && p <= v
- };
- e.hitTest = e.hitTestRect;
- e.setFrameRate = function(t) {
- if (e.frameRate) {
- clearInterval(e.frameRate)
- }
- e.speed = t;
- e.frameRate = setInterval(function() {
- e.onShow()
- }, t)
- };
- e.ll_scaleX = function(t) {
- return (t - e.left) * e.width / e.canvasStyleWidth
- };
- e.ll_scaleY = function(t) {
- return (t - e.top) * e.height / e.canvasStyleHeight
- };
- e.ll_setStageSize = function(t, n) {
- t = Math.ceil(t);
- n = Math.ceil(n);
- e.canvasObj.style.width = t + "px";
- e.canvasObj.style.height = n + "px";
- e.canvasStyleWidth = t;
- e.canvasStyleHeight = n
- };
- e.resize = function(t, n) {
- var r, i, s = 0,
- o = 0,
- u = window.innerWidth,
- a = window.innerHeight;
- if (t) {
- r = t
- }
- if (n) {
- i = n
- }
- if (e.stageScale == "noScale") {
- r = t || e.width;
- i = n || e.height
- }
- switch (e.stageScale) {
- case "exactFit":
- r = t || u;
- i = n || a;
- break;
- case "noBorder":
- r = t || u;
- i = n || e.height * u / e.width;
- switch (e.align) {
- case LStageAlign.BOTTOM:
- case LStageAlign.BOTTOM_LEFT:
- case LStageAlign.BOTTOM_RIGHT:
- case LStageAlign.BOTTOM_MIDDLE:
- s = a - i;
- break
- }
- break;
- case "showAll":
- if (u / a > e.width / e.height) {
- i = n || a;
- r = t || e.width * a / e.height
- } else {
- r = t || u;
- i = n || e.height * u / e.width
- };
- case "noScale":
- default:
- switch (e.align) {
- case LStageAlign.BOTTOM:
- case LStageAlign.BOTTOM_LEFT:
- s = a - i;
- break;
- case LStageAlign.RIGHT:
- case LStageAlign.TOP_RIGHT:
- o = u - r;
- break;
- case LStageAlign.TOP_MIDDLE:
- o = (u - r) * .5;
- break;
- case LStageAlign.BOTTOM_RIGHT:
- s = a - i;
- o = u - r;
- break;
- case LStageAlign.BOTTOM_MIDDLE:
- s = a - i;
- o = (u - r) * .5;
- break;
- case LStageAlign.MIDDLE:
- s = (a - i) * .5;
- o = (u - r) * .5;
- break;
- case LStageAlign.TOP:
- case LStageAlign.LEFT:
- case LStageAlign.TOP_LEFT:
- default:
- }
- }
- e.canvasObj.style.marginTop = s + "px";
- e.canvasObj.style.marginLeft = o + "px";
- if (e.isFirefox) {
- e.left = parseInt(e.canvasObj.style.marginLeft);
- e.top = parseInt(e.canvasObj.style.marginTop)
- }
- e.ll_setStageSize(r, i)
- };
- e.sleep = function(e) {
- var t = new Date;
- while ((new Date).getTime() - t.getTime() < e) {}
- };
- e.screen = function(t) {
- e.displayState = t;
- if (e.stage) {
- if (typeof e.displayState == "number") {
- e.resize(e.width * e.displayState, e.height * e.displayState)
- } else {
- e.resize()
- }
- }
- };
- return e
- }();
- var LSystem = LGlobal;
- var LStage = LGlobal;
- if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function(e) {
- var t = this.length >>> 0;
- var n = Number(arguments[1]) || 0;
- n = n < 0 ? Math.ceil(n) : Math.floor(n);
- if (n < 0) {
- n += t
- }
- for (; n < t; n++) {
- if (n in this && this[n] === e) {
- return n
- }
- }
- return -1
- }
- }
- if (!Array.isArray) {
- Array.isArray = function(e) {
- return Object.prototype.toString.apply(e) == "[object Array]"
- }
- }
- if (!Function.prototype.bind) {
- Function.prototype.bind = function(e) {
- if (typeof this !== "function") {
- throw new TypeError("Function.prototype.bind-what is trying to be bound is not callable")
- }
- var t = Array.prototype.slice.call(arguments, 1),
- n = this,
- r = function() {},
- i = function() {
- return n.apply(this instanceof r && e ? this : e, t.concat(Array.prototype.slice.call(arguments)))
- };
- r.prototype = this.prototype;
- i.prototype = new r;
- return i
- }
- }
- if (!Array.prototype.find) {
- Array.prototype.find = function(e) {
- if (this == null) {
- throw new TypeError("Array.prototype.find called on null or undefined")
- }
- if (typeof e !== "function") {
- throw new TypeError("predicate must be a function")
- }
- var t = Object(this);
- var n = t.length >>> 0;
- var r = arguments[1];
- var i;
- for (var s = 0; s < n; s++) {
- i = t[s];
- if (e.call(r, i, s, t)) {
- return i
- }
- }
- return undefined
- }
- }
- if (!Array.prototype.findIndex) {
- Array.prototype.findIndex = function(e) {
- if (this == null) {
- throw new TypeError("Array.prototype.find called on null or undefined")
- }
- if (typeof e !== "function") {
- throw new TypeError("predicate must be a function")
- }
- var t = Object(this);
- var n = t.length >>> 0;
- var r = arguments[1];
- var i;
- for (var s = 0; s < n; s++) {
- i = t[s];
- if (e.call(r, i, s, t)) {
- return s
- }
- }
- return -1
- }
- }
- if (!Array.prototype.forEach) {
- Array.prototype.forEach = function(e, t) {
- var n, r;
- if (this == null) {
- throw new TypeError(" this is null or not defined")
- }
- var i = Object(this);
- var s = i.length >>> 0;
- if (typeof e !== "function") {
- throw new TypeError(e + " is not a function")
- }
- if (arguments.length > 1) {
- n = t
- }
- r = 0;
- while (r < s) {
- var o;
- if (r in i) {
- o = i[r];
- e.call(n, o, r, i)
- }
- r++
- }
- }
- }
- if (!Array.prototype.every) {
- Array.prototype.every = function(e, t) {
- "use strict";
- var n, r;
- if (this == null) {
- throw new TypeError("this is null or not defined")
- }
- var i = Object(this);
- var s = i.length >>> 0;
- if (typeof e !== "function") {
- throw new TypeError
- }
- if (arguments.length > 1) {
- n = t
- }
- r = 0;
- while (r < s) {
- var o;
- if (r in i) {
- o = i[r];
- var u = e.call(n, o, r, i);
- if (!u) {
- return false
- }
- }
- r++
- }
- return true
- }
- }
- if (!Array.prototype.some) {
- Array.prototype.some = function(e) {
- "use strict";
- if (this == null) {
- throw new TypeError("Array.prototype.some called on null or undefined")
- }
- if (typeof e !== "function") {
- throw new TypeError
- }
- var t = Object(this);
- var n = t.length >>> 0;
- var r = arguments.length >= 2 ? arguments[1] : void 0;
- for (var i = 0; i < n; i++) {
- if (i in t && e.call(r, t[i], i, t)) {
- return true
- }
- }
- return false
- }
- }
- if (!window.console) {
- window.console = {
- log: trace,
- warn: trace
- }
- }
- var LInit = init;
- var LExtends = base;
- var LObject = function() {
- function e() {
- this.type = "LObject";
- this.objectIndex = ++LGlobal.objectIndex;
- this.objectindex = this.objectIndex
- }
- e.prototype = {
- callParent: function(e, t) {
- if (!e || !t) {
- return
- }
- var n = this,
- r = false,
- i, s = "__ll__parent_call" + e;
- if (typeof n[s] == "undefined") {
- r = true;
- n[s] = 0
- } else {
- n[s]++
- } if (n[s] >= n.__ll__parent__.length) {
- return false
- }
- if (!n.__ll__parent__[n[s]][e]) {
- i = n.callParent(e, t)
- } else {
- i = n.__ll__parent__[n[s]][e].apply(n, t)
- } if (r) {
- delete n[s]
- }
- return i
- },
- toString: function() {
- return "[object " + this.constructor.name + "]"
- }
- };
- return e
- }();
- var LColorTransform = function() {
- function e(e, t, n, r, i, s, o, u) {
- var a = this;
- LExtends(a, LObject, []);
- a.redMultiplier = e;
- a.greenMultiplier = t;
- a.blueMultiplier = n;
- a.alphaMultiplier = r;
- a.redOffset = i;
- a.greenOffset = s;
- a.blueOffset = o;
- a.alphaOffset = u
- }
- return e
- }();
- var LMatrix = function() {
- function e(e, t, n, r, i, s, o, u, a) {
- var f = this;
- f.a = 1;
- f.b = 0;
- f.u = 0;
- f.c = 0;
- f.d = 1;
- f.v = 0;
- f.tx = 0;
- f.ty = 0;
- f.w = 1;
- if (typeof e != UNDEFINED) {
- f.a = e
- }
- if (typeof t != UNDEFINED) {
- f.b = t
- }
- if (typeof n != UNDEFINED) {
- f.c = n
- }
- if (typeof r != UNDEFINED) {
- f.d = r
- }
- if (typeof i != UNDEFINED) {
- f.tx = i
- }
- if (typeof s != UNDEFINED) {
- f.ty = s
- }
- if (typeof o != UNDEFINED) {
- f.u = o
- }
- if (typeof u != UNDEFINED) {
- f.v = u
- }
- if (typeof a != UNDEFINED) {
- f.w = a
- }
- }
- e.prototype = {
- setTo: function(e, t, n, r, i, s, o, u, a) {
- var f = this;
- if (typeof e != UNDEFINED) {
- f.a = e
- }
- if (typeof t != UNDEFINED) {
- f.b = t
- }
- if (typeof n != UNDEFINED) {
- f.c = n
- }
- if (typeof r != UNDEFINED) {
- f.d = r
- }
- if (typeof i != UNDEFINED) {
- f.tx = i
- }
- if (typeof s != UNDEFINED) {
- f.ty = s
- }
- if (typeof o != UNDEFINED) {
- f.u = o
- }
- if (typeof u != UNDEFINED) {
- f.v = u
- }
- if (typeof a != UNDEFINED) {
- f.w = a
- }
- return f
- },
- isIdentity: function() {
- var e = this;
- return e.a == 1 && e.b == 0 && e.c == 0 && e.d == 1 && e.tx == 0 && e.ty == 0 && u == 0 && v == 0 && w == 1
- },
- transform: function(e) {
- var t = this;
- e.transform(t.a, t.b, t.c, t.d, t.tx, t.ty);
- return t
- },
- toString: function() {
- return "[object LMatrix]"
- },
- identity: function() {
- this.setTo(1, 0, 0, 1, 0, 0, 0, 0, 1)
- },
- rotate: function(t) {
- var n = this,
- r = t * Math.PI / 180,
- i = Math.cos(r),
- s = Math.sin(r),
- o = new e(i, s, -s, i, 0, 0, 0, 0, 1);
- n.add(o)
- },
- scale: function(t, n) {
- var r = this,
- i = new e(t, 0, 0, n, 0, 0, 0, 0, 1);
- r.add(i)
- },
- translate: function(t, n) {
- var r = this,
- i = new e(1, 0, 0, 1, t, n, 0, 0, 1);
- r.add(i)
- },
- skew: function(t, n) {
- mtx = new e(0, n, t, 0, 0, 0, 0, 0, 1);
- s.add(mtx)
- },
- add: function(e) {
- var t = this,
- n, r, i, s, o, u, a, f, l;
- n = t.a * e.a + t.b * e.c + t.u * e.tx;
- r = t.a * e.b + t.b * e.d + t.u * e.ty;
- a = t.a * e.u + t.b * e.v + t.u * e.w;
- i = t.c * e.a + t.d * e.c + t.v * e.tx;
- s = t.c * e.b + t.d * e.d + t.v * e.ty;
- f = t.c * e.u + t.d * e.v + t.v * e.w;
- o = t.tx * e.a + t.ty * e.c + t.w * e.tx;
- u = t.tx * e.b + t.ty * e.d + t.w * e.ty;
- l = t.tx * e.u + t.ty * e.v + t.w * e.w;
- t.setTo(n, r, i, s, o, u, a, f, l)
- },
- toArray: function(e) {
- var t = this;
- if (Array.isArray(e) && e.length == 3) {
- var n = e[0] * t.a + e[1] * t.c + e[2] * t.tx,
- r = e[0] * t.b + e[1] * t.d + e[2] * t.ty,
- i = e[0] * t.u + e[1] * t.v + e[2] * t.w;
- return [n, r, i]
- } else {
- var s = t.a * e.a + t.b * e.c + t.u * e.tx,
- o = t.a * e.b + t.b * e.d + t.u * e.ty,
- u = t.a * e.u + t.b * e.v + t.u * e.w,
- a = t.c * e.a + t.d * e.c + t.v * e.tx,
- f = t.c * e.b + t.d * e.d + t.v * e.ty,
- l = t.c * e.u + t.d * e.v + t.v * e.w,
- c = t.tx * e.a + t.ty * e.c + t.w * e.tx,
- h = t.tx * e.b + t.ty * e.d + t.w * e.ty,
- p = t.tx * e.u + t.ty * e.v + t.w * e.w;
- return [s, o, a, f, c, h, u, l, p]
- }
- },
- clone: function() {
- var t = this;
- return new e(t.a, t.b, t.c, t.d, t.tx, t.ty, t.u, t.v, t.w)
- }
- };
- return e
- }();
- var LVec2 = function() {
- function e(e, t) {
- this.x = e || 0;
- this.y = t || 0
- }
- e.dot = function(e, t) {
- return e.x * t.x + e.y * t.y
- };
- e.cross = function(e, t) {
- return e.x * t.y - e.y * t.x
- };
- e.distance = function(e, t) {
- var n = e.x - t.x;
- var r = e.y - t.y;
- return Math.sqrt(n * n + r * r)
- };
- e.getMinMax = function(t, n) {
- var r = e.dot(t[0], n);
- var i = e.dot(t[0], n);
- var s = 0;
- var o = 0;
- for (var u = 1; u < t.length; u++) {
- var a = e.dot(t[u], n);
- if (r > a) {
- r = a;
- s = u
- }
- if (i < a) {
- i = a;
- o = u
- }
- }
- var f = {
- min_o: r,
- min_i: s,
- max_o: i,
- max_i: o
- };
- return f
- };
- e.prototype = {
- length: function() {
- var e = this;
- return Math.sqrt(e.x * e.x + e.y * e.y)
- },
- normalize: function() {
- var t = this,
- n = t.length();
- return new e(t.x / n, t.y / n)
- },
- normR: function() {
- return new e(-this.y, this.x)
- },
- normL: function() {
- return new e(this.y, -this.x)
- }
- };
- return e
- }();
- var LEventDispatcher = function() {
- function e() {
- var e = this;
- LExtends(e, LObject, []);
- e._eventList = new Array
- }
- var t = {
- addEventListener: function(e, t) {
- this._eventList.push({
- listener: t,
- type: e
- })
- },
- removeEventListener: function(e, t) {
- var n = this,
- r, i;
- i = n._eventList.length;
- for (r = 0; r < i; r++) {
- if (!n._eventList[r]) {
- continue
- }
- if (e == n._eventList[r].type && n._eventList[r].listener == t) {
- n._eventList.splice(r, 1);
- return
- }
- }
- },
- removeAllEventListener: function() {
- this._eventList = []
- },
- dispatchEvent: function(e) {
- var t = this,
- n, r = t._eventList.length,
- i = typeof e == "string" ? e : e.eventType;
- for (n = 0; n < r; n++) {
- if (!t._eventList[n]) {
- continue
- }
- if (i == t._eventList[n].type) {
- if (typeof e == "string") {
- t.currentTarget = t.target = t;
- t.eventType = t.event_type = i;
- t._eventList[n].listener(t)
- } else {
- if (!e.target) {
- e.target = t
- }
- if (!e.currentTarget) {
- e.currentTarget = e.target
- }
- e._ll_preventDefault = false;
- t._eventList[n].listener(e);
- if (e._ll_preventDefault) {
- return false
- }
- }
- return true
- }
- }
- return false
- },
- hasEventListener: function(e, t) {
- var n = this,
- r, i = n._eventList.length;
- for (r = 0; r < i; r++) {
- if (!n._eventList[r]) {
- continue
- }
- if (e == n._eventList[r].type) {
- if (typeof t == UNDEFINED || t == n._eventList[r].listener) {
- return true
- }
- }
- }
- return false
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LDisplayObject = function() {
- function e() {
- var e = this;
- LExtends(e, LEventDispatcher, []);
- e.name = "instance" + e.objectIndex;
- e.x = 0;
- e.y = 0;
- e.width = 0;
- e.height = 0;
- e.scaleX = 1;
- e.scaleY = 1;
- e.alpha = 1;
- e.visible = true;
- e.rotate = 0;
- e.mask = null;
- e.blendMode = null;
- e.filters = null
- }
- var t = {
- _createCanvas: function() {
- var e = this;
- if (!e._canvas) {
- e._canvas = document.createElement("canvas");
- e._context = e._canvas.getContext("2d")
- }
- },
- ll_show: function() {
- var e = this,
- t = LGlobal.canvas;
- if (!e._canShow()) {
- return
- }
- if (!LGlobal.box2d && typeof e._ll_loopframe == "function") {
- e._ll_loopframe()
- }
- t.save();
- e._showReady(t);
- if (e.blendMode) {
- t.globalCompositeOperation = e.blendMode
- }
- if (e.filters) {
- e._ll_setShadow()
- }
- e._rotateReady();
- if (e.mask != null && e.mask.ll_show) {
- e.mask.ll_show();
- t.clip()
- }
- e._transformRotate();
- e._transformScale();
- e._coordinate(t);
- if (e.alpha < 1) {
- t.globalAlpha = e.alpha
- }
- e._ll_show(t);
- t.restore();
- if (LGlobal.box2d != null && typeof e._ll_loopframe == "function") {
- e._ll_loopframe()
- }
- },
- _canShow: function() {
- return this.visible
- },
- _coordinate: function(e) {
- var t = this;
- if (t.x != 0 || t.y != 0) {
- e.transform(1, 0, 0, 1, t.x, t.y)
- }
- },
- _rotateReady: function() {},
- _showReady: function(e) {},
- _ll_show: function(e) {},
- _ll_setShadow: function() {
- var e = this,
- t = e.filters,
- n, r;
- if (!t) {
- return
- }
- for (n = 0, r = t.length; n < r; n++) {
- t[n].ll_show()
- }
- },
- _transformRotate: function() {
- var e = this,
- t;
- if (e.rotate == 0) {
- return
- }
- t = LGlobal.canvas, rotateFlag = Math.PI / 180, rotateObj = new LMatrix;
- if (typeof e.rotatex == UNDEFINED) {
- e.rotatex = 0;
- e.rotatey = 0
- }
- if (e.box2dBody) {
- rotateFlag = 1
- }
- rotateObj.a = Math.cos(e.rotate * rotateFlag);
- rotateObj.b = Math.sin(e.rotate * rotateFlag);
- rotateObj.c = -rotateObj.b;
- rotateObj.d = rotateObj.a;
- rotateObj.tx = e.x + e.rotatex;
- rotateObj.ty = e.y + e.rotatey;
- rotateObj.transform(t).setTo(1, 0, 0, 1, -rotateObj.tx, -rotateObj.ty).transform(t)
- },
- _transformScale: function() {
- var e = this,
- t = LGlobal.canvas,
- n;
- if (e.scaleX == 1 && e.scaleY == 1) {
- return
- }
- n = new LMatrix;
- if (e.scaleX != 1) {
- n.tx = e.x
- }
- if (e.scaleY != 1) {
- n.ty = e.y
- }
- n.a = e.scaleX;
- n.d = e.scaleY;
- n.transform(t).setTo(1, 0, 0, 1, -n.tx, -n.ty).transform(t)
- },
- copyProperty: function(e) {
- var t = this,
- n;
- for (n in e) {
- if (typeof e[n] == "number" || typeof e[n] == "string" || typeof e[n] == "boolean") {
- if (n == "objectindex" || n == "objectIndex") {
- continue
- }
- t[n] = e[n]
- } else if (Array.isArray(e[n])) {
- t[n] = e[n].slice()
- }
- }
- if (e.mask) {
- t.mask = e.mask.clone()
- }
- },
- getAbsoluteScale: function() {
- var e = this,
- t, n, r;
- t = e.scaleX;
- n = e.scaleY;
- r = e.parent;
- while (r && r != "root") {
- t *= r.scaleX;
- n *= r.scaleY;
- r = r.parent
- }
- return {
- scaleX: t,
- scaleY: n
- }
- },
- getRootCoordinate: function() {
- var e = this,
- t, n, r;
- t = e.x;
- n = e.y;
- r = e.parent;
- while (r && r != "root") {
- t *= r.scaleX;
- n *= r.scaleY;
- t += r.x;
- n += r.y;
- r = r.parent
- }
- return new LPoint(t, n)
- },
- getBounds: function(e) {
- if (typeof e == UNDEFINED) {
- return new LRectangle(0, 0, 0, 0)
- }
- var t = this,
- n = 0,
- r = 0,
- i = 0,
- s = 0,
- o, u;
- if (t.objectIndex != e.objectIndex) {
- o = t.getRootCoordinate();
- u = e.getRootCoordinate();
- n = o.x - u.x;
- r = o.y - u.y
- }
- if (e.getWidth) {
- i = e.getWidth()
- }
- if (e.getHeight) {
- s = e.getHeight()
- }
- return new LRectangle(n, r, i, s)
- },
- getDataCanvas: function() {
- var e = this,
- t, n, r, i, s, o;
- e._createCanvas();
- n = LGlobal.canvasObj;
- i = LGlobal.canvas;
- t = e._canvas;
- r = e._context;
- e.width = e.getWidth();
- e.height = e.getHeight();
- t.width = e.width;
- t.height = e.height;
- r.clearRect(0, 0, e.width, e.height);
- LGlobal.canvasObj = e._canvas;
- LGlobal.canvas = e._context;
- s = e.x;
- o = e.y;
- e.x = e.y = 0;
- e.ll_show();
- e.x = s;
- e.y = o;
- e._canvas = t;
- e._context = r;
- LGlobal.canvasObj = n;
- LGlobal.canvas = i;
- return e._canvas
- },
- getDataURL: function() {
- var e = this,
- t = e.getDataCanvas();
- return t.toDataURL.apply(t, arguments)
- },
- ismouseonShapes: function(e, t, n) {
- var r = this,
- i = r,
- s, o, u, a, f;
- if (typeof e == UNDEFINED) {
- e = r.shapes
- }
- s = r.getRootMatrix();
- for (u = e.length - 1; u >= 0; u--) {
- o = e[u];
- f = o.arg;
- a = r._changeShape(o.type, f, s);
- if (o.type == LShape.VERTICES) {
- if (LGlobal.hitPolygon(a, t, n)) {
- return true
- }
- } else if (o.type == LShape.RECT) {
- if (LGlobal.hitPolygon(a, t, n)) {
- return true
- }
- } else if (o.type == LShape.ARC) {
- if ((a[0] - t) * (a[0] - t) + (a[1] - n) * (a[1] - n) < a[3]) {
- return true
- }
- }
- }
- return false
- },
- _changeShape: function(e, t, n) {
- var r, t = t,
- i, s, o, u, a;
- if (e == LShape.VERTICES) {
- r = [];
- for (s = 0, o = t.length; s < o; s++) {
- r[s] = n.toArray([t[s][0], t[s][1], 1])
- }
- } else if (e == LShape.RECT) {
- r = [
- [t[0], t[1]],
- [t[0] + t[2], t[1]],
- [t[0] + t[2], t[1] + t[3]],
- [t[0], t[1] + t[3]]
- ];
- for (s = 0, o = r.length; s < o; s++) {
- r[s] = n.toArray([r[s][0], r[s][1], 1])
- }
- } else if (e == LShape.ARC) {
- u = n.toArray([t[0], t[1], 1]);
- a = n.toArray([t[0] + t[2], t[1], 1]);
- i = (u[0] - a[0]) * (u[0] - a[0]) + (u[1] - a[1]) * (u[1] - a[1]);
- r = [u[0], u[1], Math.sqrt(i), i]
- }
- return r
- },
- getRootMatrix: function() {
- var e = this,
- t = new LMatrix;
- while (e && e != "root") {
- if (e.scaleX != 1 || e.scaleY != 1) {
- t.scale(e.scaleX, e.scaleY)
- }
- if (e.rotate != 0) {
- t.rotate(e.rotate)
- }
- if (e.x != 0 || e.y != 0) {
- t.translate(e.x, e.y)
- }
- e = e.parent
- }
- return t
- },
- remove: function() {
- var e = this,
- t = e.parent;
- if (!t || t == "root") {
- return
- }
- t.removeChild(e)
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LInteractiveObject = function() {
- function e() {
- var e = this;
- LExtends(e, LDisplayObject, []);
- e.type = "LInteractiveObject";
- e.mouseEnabled = true;
- e.mouseList = new Array
- }
- var t = {
- addEventListener: function(e, t) {
- var n = this;
- if (e.indexOf("mouse") >= 0 || e.indexOf("touch") >= 0 || e == LMouseEvent.DOUBLE_CLICK) {
- if (LMouseEventContainer.container[e] || (e == LMouseEvent.MOUSE_OVER || e == LMouseEvent.MOUSE_OUT) && LMouseEventContainer.container[LMouseEvent.MOUSE_MOVE]) {
- LMouseEventContainer.addMouseEvent(n, e, t);
- return
- }
- n.mouseList.push({
- listener: t,
- type: e
- })
- } else {
- n._eventList.push({
- listener: t,
- type: e
- })
- }
- },
- removeEventListener: function(e, t) {
- var n = this,
- r, i;
- if (e.indexOf("mouse") >= 0 || e.indexOf("touch") >= 0 || e == LMouseEvent.DOUBLE_CLICK) {
- if (LMouseEventContainer.container[e] || (e == LMouseEvent.MOUSE_OVER || e == LMouseEvent.MOUSE_OUT) && LMouseEventContainer.container[LMouseEvent.MOUSE_MOVE]) {
- LMouseEventContainer.removeMouseEvent(n, e, t);
- return
- }
- i = n.mouseList.length;
- for (r = 0; r < i; r++) {
- if (!n.mouseList[r]) {
- continue
- }
- if (e == n.mouseList[r].type && n.mouseList[r].listener == t) {
- n.mouseList.splice(r, 1);
- return
- }
- }
- } else {
- return n.callParent("removeEventListener", arguments)
- }
- },
- removeAllEventListener: function() {
- var e = this;
- e.mouseList.length = 0;
- e._eventList.length = 0;
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_DOWN]) {
- LMouseEventContainer.removeMouseEvent(e, LMouseEvent.MOUSE_DOWN)
- }
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_UP]) {
- LMouseEventContainer.removeMouseEvent(e, LMouseEvent.MOUSE_UP)
- }
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_MOVE]) {
- LMouseEventContainer.removeMouseEvent(e, LMouseEvent.MOUSE_MOVE);
- LMouseEventContainer.removeMouseEvent(e, LMouseEvent.MOUSE_OVER);
- LMouseEventContainer.removeMouseEvent(e, LMouseEvent.MOUSE_OUT)
- }
- },
- hasEventListener: function(e) {
- var t = this,
- n, r;
- if (e.indexOf("mouse") >= 0 || e.indexOf("touch") >= 0 || e == LMouseEvent.DOUBLE_CLICK) {
- r = t.mouseList.length;
- for (n = 0; n < r; n++) {
- if (!t.mouseList[n]) {
- continue
- }
- if (e == t.mouseList[n].type) {
- return true
- }
- }
- } else {
- return t.callParent("hasEventListener", arguments)
- }
- return false
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LDisplayObjectContainer = function() {
- function e() {
- var e = this;
- LExtends(e, LInteractiveObject, []);
- e.childList = new Array;
- e.numChildren = 0;
- e.mouseChildren = true
- }
- var t = {
- addChild: function(e) {
- var t = this,
- n;
- if (e.parent) {
- n = LGlobal.destroy;
- LGlobal.destroy = false;
- e.parent.removeChild(e);
- LGlobal.destroy = n
- }
- e.parent = t;
- t.childList.push(e);
- t.numChildren = t.childList.length;
- return e
- },
- addChildAt: function(e, t) {
- var n = this,
- r;
- if (t < 0 || t > n.childList.length) {
- return
- }
- if (typeof e.remove == "function") {
- r = LGlobal.destroy;
- LGlobal.destroy = false;
- e.remove();
- LGlobal.destroy = r
- }
- e.parent = n;
- n.childList.splice(t, 0, e);
- n.numChildren = n.childList.length;
- return e
- },
- removeChild: function(e) {
- var t = this,
- n = t.childList,
- r, i;
- for (r = 0, i = n.length; r < i; r++) {
- if (e.objectIndex == n[r].objectIndex) {
- if (LGlobal.destroy && e.die) {
- e.die()
- }
- t.childList.splice(r, 1);
- break
- }
- }
- t.numChildren = t.childList.length;
- delete e.parent
- },
- getChildAt: function(e) {
- var t = this,
- n = t.childList;
- if (n.length == 0 || n.length <= e) {
- return null
- }
- return n[e]
- },
- getChildByName: function(e) {
- var t = this,
- n = t.childList;
- for (i = 0, l = n.length; i < l; i++) {
- if (!n[i]) {
- continue
- }
- if (n[i].name == e) {
- return n[i]
- }
- }
- return null
- },
- removeChildAt: function(e) {
- var t = this,
- n = t.childList;
- if (n.length <= e) {
- return
- }
- if (LGlobal.destroy && n[e].die) {
- n[e].die()
- }
- var r = t.childList.splice(e, 1);
- t.numChildren = t.childList.length;
- return r
- },
- getChildIndex: function(e) {
- if (!e) {
- return -1
- }
- var t = this,
- n = t.childList,
- r, i = n.length;
- for (r = 0; r < i; r++) {
- if (n[r].objectIndex == e.objectIndex) {
- return r
- }
- }
- return -1
- },
- setChildIndex: function(e, t) {
- var n = this,
- r = n.childList,
- i, s = r.length;
- if (e.parent == "root" || e.parent.objectIndex != n.objectIndex || t < 0 || t >= s) {
- return -1
- }
- for (i = 0; i < s; i++) {
- if (r[i].objectIndex == e.objectIndex) {
- break
- }
- }
- n.childList.splice(i, 1);
- n.childList.splice(t, 0, e);
- return t
- },
- resize: function() {
- var e = this;
- e.width = e.getWidth();
- e.height = e.getHeight()
- },
- removeAllChild: function() {
- var e = this,
- t = e.childList,
- n, r;
- for (n = 0, r = t.length; n < r; n++) {
- if (LGlobal.destroy && t[n].die) {
- t[n].die()
- }
- }
- e.childList.length = 0;
- e.width = 0;
- e.height = 0;
- e.numChildren = 0
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LLoader = function() {
- function e() {
- var e = this;
- LExtends(e, LEventDispatcher, []);
- e.type = "LLoader"
- }
- e.TYPE_BITMAPDATE = "bitmapData";
- e.prototype.load = function(t, n) {
- var r = this;
- if (!n) {
- n = e.TYPE_BITMAPDATE
- }
- r.loadtype = n;
- if (n == e.TYPE_BITMAPDATE) {
- r.content = new Image;
- r.content.onload = function() {
- r.content.onload = null;
- var e = new LEvent(LEvent.COMPLETE);
- e.currentTarget = r;
- e.target = r.content;
- r.dispatchEvent(e);
- delete r.content
- };
- r.content.src = t
- }
- };
- return e
- }();
- var LURLLoader = function() {
- function e() {
- var e = this;
- LExtends(e, LEventDispatcher, []);
- e.type = "LURLLoader";
- e.loadtype = "";
- e.content = null;
- e.event = {}
- }
- e.TYPE_TEXT = "text";
- e.TYPE_JS = "js";
- e.prototype.load = function(t, n) {
- var r = this,
- i, s;
- if (!n) {
- s = getExtension(t);
- if (s == "txt") {
- n = e.TYPE_TEXT
- } else if (s == "js") {
- n = e.TYPE_JS
- }
- }
- r.loadtype = n;
- if (n == e.TYPE_TEXT) {
- LAjax.get(t, {}, function(e) {
- i = new LEvent(LEvent.COMPLETE);
- r.data = e;
- i.currentTarget = r;
- i.target = e;
- r.dispatchEvent(i);
- delete r.content;
- delete r.data
- })
- } else if (n == e.TYPE_JS) {
- var o = document.createElement("script");
- o.onload = function() {
- i = new LEvent(LEvent.COMPLETE);
- i.currentTarget = r;
- i.target = r;
- r.dispatchEvent(i);
- delete r.content
- };
- o.src = t;
- o.type = "text/javascript";
- document.querySelector("head").appendChild(o)
- }
- };
- return e
- }();
- var LWebAudio = function() {
- function e() {
- var e = this;
- LExtends(e, LEventDispatcher, []);
- e.currentTime = 0;
- e.currentStart = 0;
- e.currentSave = 0;
- e.length = 0;
- e.loopStart = 0;
- e.loopEnd = 0;
- e.loopIndex = 0;
- e.loopLength = 1;
- e.playing = false;
- e.volume = 1;
- LSound.Container.add(e)
- }
- e.container = [];
- e.containerCount = 0;
- e.audioTag = new Audio;
- e._context = null;
- var t = {
- getWebAudio: function() {
- var t;
- if (e.containerCount > 0) {
- t = e.container.shift()
- } else {
- if (typeof webkitAudioContext !== UNDEFINED) {
- try {
- t = new webkitAudioContext
- } catch (n) {
- e.containerCount = e.container.length;
- t = e.container.shift()
- }
- } else if (typeof AudioContext !== UNDEFINED) {
- try {
- t = new AudioContext
- } catch (n) {
- e.containerCount = e.container.length;
- t = e.container.shift()
- }
- } else {
- throw "AudioContext not supported.:("
- }
- } if (!t.createGainNode) {
- t.createGainNode = t.createGain
- }
- e.container.push(t);
- return t
- },
- onload: function(e) {
- var t = this;
- if (Object.prototype.toString.apply(e) !== "[object AudioBuffer]") {
- t.load(e);
- return
- }
- if (!t.data) {
- t.data = t.getWebAudio()
- }
- t.buffer = e;
- t.length = t.buffer.duration;
- var n = new LEvent(LEvent.COMPLETE);
- n.currentTarget = t;
- n.target = t.buffer;
- t.dispatchEvent(n)
- },
- _onended: function() {
- var e = this;
- e.dispatchEvent(LEvent.SOUND_COMPLETE);
- if (++e.loopIndex < e.loopLength) {
- e.play(e.currentStart, undefined, e.currentTimeTo)
- } else {
- e.close()
- }
- },
- load: function(t) {
- var n = this;
- if (typeof t !== "string") {
- if (Object.prototype.toString.apply(t) == "[object AudioBuffer]") {
- n.onload(t)
- } else if (Object.prototype.toString.apply(t) == "[object ArrayBuffer]") {
- if (!n.data) {
- n.data = n.getWebAudio()
- }
- n.data.decodeAudioData(t, n.onload.bind(n), function(e) {
- throw "AudioContext decodeAudioData error:" + e.toString()
- })
- }
- return
- }
- var r, i, s, o, u, a = {
- mov: ["quicktime"],
- "3gp": ["3gpp"],
- midi: ["midi"],
- mid: ["midi"],
- ogv: ["ogg"],
- m4a: ["acc"],
- mp3: ["mpeg"],
- wav: ["wav", "x-wav", "wave"],
- wave: ["wav", "x-wav", "wave"],
- aac: ["mp4", "aac"]
- };
- r = t.split(",");
- for (o = 0; o < r.length; o++) {
- i = r[o].split(".");
- u = i[i.length - 1];
- if (a[u]) {
- u = a[u]
- } else {
- u = [u]
- }
- s = u.some(function(t, r, i) {
- return e.audioTag.canPlayType(n._type + "/" + t)
- });
- if (s) {
- LAjax.responseType = LAjax.ARRAY_BUFFER;
- LAjax.get(r[o], {}, n.onload.bind(n));
- return
- } else {
- console.warn("Not support " + i[i.length - 1] + ":" + r[o]);
- var f = new LEvent(LEvent.COMPLETE);
- f.currentTarget = f.target = n;
- n.dispatchEvent(f)
- }
- }
- },
- getCurrentTime: function() {
- var e = this;
- if (e.playing) {
- return e.data.currentTime - e.currentSave + e.currentTime
- } else {
- return e.currentSave
- }
- },
- setVolume: function(e) {
- var t = this;
- t.volume = e;
- if (t.playing) {
- t.volumeNode.gain.value = e
- }
- },
- getVolume: function() {
- return this.volume
- },
- play: function(e, t, n) {
- var r = this;
- if (r.length == 0) {
- return
- }
- if (typeof t !== UNDEFINED) {
- r.loopIndex = 0;
- r.loopLength = t
- }
- if (typeof e !== UNDEFINED) {
- r.currentTime = e;
- r.currentStart = e
- }
- if (typeof n !== UNDEFINED) {
- r.currentTimeTo = n > r.length ? r.length : n
- } else {
- r.currentTimeTo = r.length
- }
- r.data.loop = false;
- r.playing = true;
- if (r.timeout) {
- clearTimeout(r.timeout);
- delete r.timeout
- }
- r.timeout = setTimeout(r._onended.bind(r), (r.currentTimeTo - r.currentTime) * 1e3);
- r.bufferSource = r.data.createBufferSource();
- r.bufferSource.buffer = r.buffer;
- r.volumeNode = r.data.createGainNode();
- r.volumeNode.gain.value = r.volume;
- r.volumeNode.connect(r.data.destination);
- r.bufferSource.connect(r.volumeNode);
- r.currentSave = r.data.currentTime;
- if (r.bufferSource.start) {
- r.bufferSource.start(0, r.currentTime, r.length - r.currentTime)
- } else {
- r.bufferSource.noteGrainOn(0, r.currentTime, r.length - r.currentTime)
- }
- },
- playSegment: function(e, t, n) {
- this.playTo(e, e + t, n)
- },
- playTo: function(e, t, n) {
- this.play(e, n, t)
- },
- stop: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.timeout) {
- clearTimeout(e.timeout);
- delete e.timeout
- }
- if (e.bufferSource.stop) {
- e.bufferSource.stop(0)
- } else {
- e.bufferSource.noteOff(0)
- }
- e.currentSave = e.getCurrentTime();
- e.currentTime = e.currentSave;
- e.playing = false
- },
- close: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.timeout) {
- clearTimeout(e.timeout);
- delete e.timeout
- }
- if (e.bufferSource.stop) {
- e.bufferSource.stop(0)
- } else {
- e.bufferSource.noteOff(0)
- }
- e.playing = false;
- e.currentTime = 0;
- e.currentSave = 0
- },
- ll_check: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.currentTimeTo < e.data.currentTime - e.currentSave + LSound.Container.time * .001) {
- e._onended()
- }
- },
- die: function() {
- LSound.Container.remove(this)
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LMedia = function() {
- function e() {
- var e = this;
- LExtends(e, LDisplayObject, []);
- e.length = 0;
- e.loopIndex = 0;
- e.loopLength = 1;
- e.playing = false;
- e.oncomplete = null;
- e.onsoundcomplete = null;
- e.currentStart = 0;
- LSound.Container.add(this)
- }
- var t = {
- onload: function() {
- var e = this;
- if (e.data.readyState) {
- e.length = e.data.duration - (LGlobal.android ? .1 : 0);
- var t = new LEvent(LEvent.COMPLETE);
- t.currentTarget = e;
- t.target = e.data;
- e.dispatchEvent(t);
- return
- }
- e.data.addEventListener("canplaythrough", function() {
- e.onload()
- }, false)
- },
- _onended: function() {
- var e = this,
- t, n;
- e.dispatchEvent(LEvent.SOUND_COMPLETE);
- if (++e.loopIndex < e.loopLength) {
- t = e.loopIndex;
- n = e.loopLength;
- e.close();
- e.play(e.currentStart, e.loopLength, e.currentTimeTo);
- e.loopIndex = t
- } else {
- e.close()
- }
- },
- load: function(e) {
- var t = this;
- if (Object.prototype.toString.apply(e) == "[object HTMLAudioElement]") {
- t.data = e;
- t.onload();
- return
- }
- var n, r, i, s, o, u = {
- mov: ["quicktime"],
- "3gp": ["3gpp"],
- midi: ["midi"],
- mid: ["midi"],
- ogv: ["ogg"],
- m4a: ["acc"],
- mp3: ["mpeg"],
- wav: ["wav", "x-wav", "wave"],
- wave: ["wav", "x-wav", "wave"],
- aac: ["mp4", "aac"]
- };
- n = e.split(",");
- for (s = 0; s < n.length; s++) {
- r = n[s].split(".");
- o = r[r.length - 1];
- if (u[o]) {
- o = u[o]
- } else {
- o = [o]
- }
- i = o.some(function(e, n, r) {
- return t.data.canPlayType(t._type + "/" + e)
- });
- if (i) {
- t.data.src = n[s];
- t.onload();
- t.data.load();
- return
- } else {
- console.warn("Not support " + r[r.length - 1] + ":" + n[s]);
- var a = new LEvent(LEvent.COMPLETE);
- a.currentTarget = a.target = t;
- t.dispatchEvent(a)
- }
- }
- if (t.oncomplete) {
- t.oncomplete({})
- }
- },
- getCurrentTime: function() {
- return this.data.currentTime
- },
- setVolume: function(e) {
- this.data.volume = e
- },
- getVolume: function() {
- return this.data.volume
- },
- play: function(e, t, n) {
- var r = this;
- if (r.length == 0) {
- return
- }
- if (LGlobal.android) {
- LSound.Container.stopOther(this)
- }
- if (typeof e != UNDEFINED) {
- r.data.currentTime = e;
- r.currentStart = e
- }
- if (typeof t != UNDEFINED) {
- r.loopLength = t
- }
- if (typeof n !== UNDEFINED) {
- r.currentTimeTo = n > r.length ? r.length : n
- } else {
- r.currentTimeTo = r.length
- } if (r.timeout) {
- clearTimeout(r.timeout);
- delete r.timeout
- }
- r.timeout = setTimeout(function() {
- r._onended()
- }, (r.currentTimeTo - r.data.currentTime) * 1e3);
- r.data.loop = false;
- r.loopIndex = 0;
- r.playing = true;
- r.data.play()
- },
- playSegment: function(e, t, n) {
- this.playTo(e, e + t, n)
- },
- playTo: function(e, t, n) {
- this.play(e, n, t)
- },
- stop: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.timeout) {
- clearTimeout(e.timeout);
- delete e.timeout
- }
- e.playing = false;
- e.data.pause()
- },
- close: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.timeout) {
- clearTimeout(e.timeout);
- delete e.timeout
- }
- e.playing = false;
- e.data.pause();
- e.data.currentTime = 0;
- e.currentSave = 0
- },
- ll_check: function() {
- var e = this;
- if (!e.playing) {
- return
- }
- if (e.currentTimeTo < e.data.currentTime + LSound.Container.time * .005) {
- e._onended()
- }
- },
- die: function() {
- LSound.Container.remove(this)
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LSound = function() {
- function e(t) {
- var n = this;
- n.type = "LSound";
- n._type = "audio";
- if (e.webAudioEnabled && LGlobal.webAudio) {
- LExtends(n, LWebAudio, [])
- } else {
- LExtends(n, LMedia, []);
- n.data = new Audio;
- n.data.loop = false;
- n.data.autoplay = false
- } if (t) {
- n.load(t)
- }
- }
- e.TYPE_SOUND = "sound";
- e.webAudioEnabled = false;
- var t = location.protocol;
- if (t == "http:" || t == "https:") {
- if (typeof webkitAudioContext !== UNDEFINED) {
- try {
- LWebAudio._context = new webkitAudioContext
- } catch (n) {}
- } else if (typeof AudioContext !== UNDEFINED) {
- try {
- LWebAudio._context = new AudioContext
- } catch (n) {}
- }
- if (LWebAudio._context) {
- LWebAudio.container.push(LWebAudio._context);
- e.webAudioEnabled = true
- }
- }
- e.Container = {
- ll_save: 0,
- time: 0,
- list: [],
- ll_show: function() {
- var t = e.Container;
- var n = (new Date).getTime();
- t.time = n - (t.ll_save ? t.ll_save : n);
- t.ll_save = n;
- var r = t.list;
- for (var i = r.length - 1; i >= 0; i--) {
- if (r[i]) {
- r[i].ll_check()
- }
- }
- },
- add: function(t) {
- if (e.Container.list.indexOf(t) >= 0) {
- return
- }
- e.Container.list.push(t)
- },
- remove: function(t) {
- var n = e.Container.list;
- for (var r = n.length - 1; r >= 0; r--) {
- if (n[r].objectIndex == t.objectIndex) {
- n.splice(r, 1);
- break
- }
- }
- },
- stopOther: function(t) {
- var n = e.Container.list;
- for (var r = n.length - 1; r >= 0; r--) {
- if (n[r].objectIndex != t.objectIndex) {
- n[r].stop()
- }
- }
- }
- };
- LGlobal.childList.push(e.Container);
- return e
- }();
- var LVideo = function() {
- function e(e) {
- var t = this;
- LExtends(t, LMedia, []);
- t.type = "LVideo";
- t._type = "video";
- t.rotatex = 0;
- t.rotatey = 0;
- t.data = document.createElement("video");
- t.data.style.display = "none";
- document.body.appendChild(t.data);
- t.data.id = "video_" + t.objectIndex;
- t.data.loop = false;
- t.data.autoplay = false;
- if (e) {
- t.load(e)
- }
- }
- var t = {
- _ll_show: function(e) {
- var t = this;
- e.drawImage(t.data, t.x, t.y)
- },
- die: function() {
- var e = this;
- document.body.removeChild(e.data);
- delete e.data
- },
- getWidth: function() {
- return this.data.width
- },
- getHeight: function() {
- return this.data.height
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LPoint = function() {
- function e(e, t) {
- var n = this;
- n.x = e;
- n.y = t
- }
- e.distance = function(t, n) {
- return e.distance2(t.x, t.y, n.x, n.y)
- };
- e.distance2 = function(e, t, n, r) {
- var i = e - n,
- s = e - n;
- return Math.sqrt(i * i + s * s)
- };
- e.interpolate = function(t, n, r) {
- return new e(t.x + (n.x - t.x) * (1 - r), t.y + (n.y - t.y) * (1 - r))
- };
- e.polar = function(t, n) {
- return new e(t * Math.cos(n), t * Math.sin(n))
- };
- e.prototype = {
- toString: function() {
- return "[object LPoint(" + this.x + "," + this.y + ")]"
- },
- length: function() {
- return e.distance2(this.x, this.y, 0, 0)
- },
- add: function(t) {
- return e(this.x + t.x, this.y + t.y)
- },
- clone: function() {
- return new e(this.x, this.y)
- },
- setTo: function(e, t) {
- this.x = e, this.y = t
- },
- copyFrom: function(e) {
- this.setTo(e.x, e.y)
- },
- equals: function(e) {
- return this.x == e.x && this.y == e.y
- },
- normalize: function(e) {
- var t = this,
- n = e / t.length();
- t.x *= n, t.y *= n
- },
- offset: function(e, t) {
- this.x += e;
- this.y += t
- },
- subtract: function(t) {
- return new e(this.x - t.x, this.y - t.y)
- }
- };
- return e
- }();
- var LRectangle = function() {
- function e(e, t, n, r) {
- var i = this;
- i.x = e;
- i.y = t;
- i.width = n;
- i.height = r;
- i.setRectangle()
- }
- e.prototype = {
- setRectangle: function() {
- var e = this;
- e.bottom = e.y + e.height;
- e.right = e.x + e.width;
- e.left = e.x;
- e.top = e.y
- },
- clone: function() {
- var t = this;
- return new e(t.x, t.y, t.width, t.height)
- },
- contains: function(e, t) {
- var n = this;
- return e >= n.x && e <= n.right && t >= n.y && t <= n.bottom
- },
- containsRect: function(e) {
- var t = this;
- return e.x >= t.x && e.right <= t.right && e.y >= t.y && e.bottom <= t.bottom
- },
- equals: function(e) {
- var t = this;
- return e.x == t.x && e.width == t.width && e.y == t.y && e.height == t.height
- },
- inflate: function(e, t) {
- var n = this;
- n.width += e;
- n.height += t;
- n.setRectangle()
- },
- intersection: function(t) {
- var n = this;
- var r = n.x > t.x ? n.x : t.x;
- var i = n.y > t.y ? n.y : t.y;
- var s = n.right > t.right ? t.right : n.right;
- var o = n.bottom > t.bottom ? t.bottom : n.bottom;
- if (r <= s && i <= o) {
- return new e(r, i, s, o)
- } else {
- return new e(0, 0, 0, 0)
- }
- },
- intersects: function(e) {
- var t = this;
- var n = t.x > e.x ? t.x : e.x;
- var r = t.y > e.y ? t.y : e.y;
- var i = t.right > e.right ? e.right : t.right;
- var s = t.bottom > e.bottom ? e.bottom : t.bottom;
- return n <= i && r <= s
- },
- isEmpty: function() {
- var e = this;
- return e.x == 0 && e.y == 0 && e.width == 0 && e.height == 0
- },
- offset: function(e, t) {
- var n = this;
- n.x += e;
- n.y += t;
- n.setRectangle()
- },
- setEmpty: function() {
- var e = this;
- e.x = 0;
- e.y = 0;
- e.width = 0;
- e.height = 0;
- e.setRectangle()
- },
- setTo: function(e, t, n, r) {
- var i = this;
- i.x = e;
- i.y = t;
- i.width = n;
- i.height = r;
- i.setRectangle()
- },
- toString: function() {
- var e = this;
- return "[object LRectangle(" + e.x + "," + e.y + "," + e.width + "," + e.height + ")]"
- },
- union: function(t) {
- var n = this;
- return new e(n.x > t.x ? t.x : n.x, n.y > t.y ? t.y : n.y, n.right > t.right ? n.right : t.right, n.bottom > t.bottom ? n.bottom : t.bottom)
- }
- };
- return e
- }();
- var LGraphics = function() {
- function e() {
- var e = this;
- LExtends(e, LObject, []);
- e.type = "LGraphics";
- e.color = "#000000";
- e.alpha = 1;
- e.bitmap = null;
- e.setList = new Array;
- e.showList = new Array
- }
- var t = {
- ll_show: function() {
- var e = this,
- t, n = e.setList.length;
- if (n == 0) {
- return
- }
- for (t = 0; t < n; t++) {
- e.setList[t]()
- }
- },
- clone: function() {
- var t = this,
- n = new e,
- r, i, s;
- n.color = t.color;
- n.alpha = t.alpha;
- n.bitmap = t.bitmap;
- for (r = 0, i = t.setList.length; r < i; r++) {
- s = t.setList[r];
- n.setList.push(s)
- }
- for (r = 0, i = t.showList.length; r < i; r++) {
- s = t.showList[r];
- n.showList.push(s)
- }
- return n
- },
- lineCap: function(e) {
- var t = this;
- t.setList.push(function() {
- LGlobal.canvas.lineCap = e
- })
- },
- lineJoin: function(e) {
- var t = this;
- t.setList.push(function() {
- LGlobal.canvas.lineJoin = e
- })
- },
- lineWidth: function(e) {
- var t = this;
- t.setList.push(function() {
- LGlobal.canvas.lineWidth = e
- })
- },
- strokeStyle: function(e) {
- var t = this;
- t.setList.push(function() {
- LGlobal.canvas.strokeStyle = e
- })
- },
- stroke: function() {
- var e = this;
- e.setList.push(function() {
- LGlobal.canvas.stroke()
- })
- },
- beginPath: function() {
- var e = this;
- e.setList.push(function() {
- LGlobal.canvas.beginPath()
- })
- },
- closePath: function() {
- var e = this;
- e.setList.push(function() {
- LGlobal.canvas.closePath()
- })
- },
- moveTo: function(e, t) {
- var n = this;
- n.setList.push(function() {
- LGlobal.canvas.moveTo(e, t)
- });
- n.showList.push({
- type: LShape.POINT,
- arg: [e, t]
- })
- },
- lineTo: function(e, t) {
- var n = this;
- n.setList.push(function() {
- LGlobal.canvas.lineTo(e, t)
- });
- n.showList.push({
- type: LShape.POINT,
- arg: [e, t]
- })
- },
- rect: function(e, t, n, r) {
- var i = this;
- i.setList.push(function() {
- LGlobal.canvas.rect(e, t, n, r)
- });
- i.showList.push({
- type: LShape.RECT,
- arg: [e, t, n, r]
- })
- },
- fillStyle: function(e) {
- var t = this;
- t.setList.push(function() {
- LGlobal.canvas.fillStyle = e
- })
- },
- fill: function() {
- var e = this;
- e.setList.push(function() {
- LGlobal.canvas.fill()
- })
- },
- arc: function(e, t, n, r, i, s) {
- var o = this;
- o.setList.push(function() {
- LGlobal.canvas.arc(e, t, n, r, i, s)
- });
- o.showList.push({
- type: LShape.ARC,
- arg: r
- })
- },
- lineStyle: function(e, t) {
- var n = this,
- r;
- if (t == null) {
- t = n.color
- }
- n.color = t;
- n.setList.push(function() {
- r = LGlobal.canvas;
- r.lineWidth = e;
- r.strokeStyle = t
- })
- },
- clear: function() {
- var e = this;
- e.bitmap = null;
- e.setList.length = 0;
- e.showList.length = 0
- },
- beginBitmapFill: function(e) {
- var t = this;
- t.setList.push(function() {
- t.bitmap = e
- })
- },
- drawEllipse: function(e, t, n, r, i) {
- var s = this;
- s.setList.push(function() {
- var o, u, a, f, l, c, h, p, d, v, m, g;
- o = LGlobal.canvas;
- o.beginPath();
- c = .5522848;
- u = n[0];
- a = n[1];
- f = n[2];
- l = n[3];
- h = f / 2 * c;
- p = l / 2 * c;
- d = u + f;
- v = a + l;
- m = u + f / 2;
- g = a + l / 2;
- o.moveTo(u, g);
- o.bezierCurveTo(u, g - p, m - h, a, m, a);
- o.bezierCurveTo(m + h, a, d, g - p, d, g);
- o.bezierCurveTo(d, g + p, m + h, v, m, v);
- o.bezierCurveTo(m - h, v, u, g + p, u, g);
- if (s.bitmap) {
- o.save();
- o.clip();
- o.drawImage(s.bitmap.image, s.bitmap.x, s.bitmap.y, s.bitmap.width, s.bitmap.height, 0, 0, s.bitmap.width, s.bitmap.height);
- o.restore();
- s.bitmap = null;
- return
- }
- if (r) {
- o.fillStyle = i;
- o.fill()
- }
- if (e > 0) {
- o.lineWidth = e;
- o.strokeStyle = t;
- o.stroke()
- }
- });
- s.showList.push({
- type: LShape.RECT,
- arg: n
- })
- },
- drawArc: function(e, t, n, r, i) {
- var s = this;
- s.setList.push(function() {
- var o = LGlobal.canvas;
- o.beginPath();
- if (n.length > 6 && n[6]) {
- o.moveTo(n[0], n[1])
- }
- o.arc(n[0], n[1], n[2], n[3], n[4], n[5]);
- if (n.length > 6 && n[6]) {
- o.lineTo(n[0], n[1])
- }
- if (s.bitmap) {
- o.save();
- o.clip();
- o.drawImage(s.bitmap.image, s.bitmap.x, s.bitmap.y, s.bitmap.width, s.bitmap.height, 0, 0, s.bitmap.width, s.bitmap.height);
- o.restore();
- s.bitmap = null;
- return
- }
- if (r) {
- o.fillStyle = i;
- o.fill()
- }
- if (e > 0) {
- o.lineWidth = e;
- o.strokeStyle = t;
- o.stroke()
- }
- });
- s.showList.push({
- type: LShape.ARC,
- arg: n
- })
- },
- drawRect: function(e, t, n, r, i) {
- var s = this;
- s.setList.push(function() {
- var o = LGlobal.canvas;
- o.beginPath();
- o.rect(n[0], n[1], n[2], n[3]);
- o.closePath();
- if (s.bitmap) {
- o.save();
- o.clip();
- o.drawImage(s.bitmap.image, s.bitmap.x, s.bitmap.y, s.bitmap.width, s.bitmap.height, 0, 0, s.bitmap.width, s.bitmap.height);
- o.restore();
- s.bitmap = null;
- return
- }
- if (r) {
- o.fillStyle = i;
- o.fill()
- }
- if (e > 0) {
- o.lineWidth = e;
- o.strokeStyle = t;
- o.stroke()
- }
- });
- s.showList.push({
- type: LShape.RECT,
- arg: n
- })
- },
- drawRoundRect: function(e, t, n, r, i) {
- var s = this;
- s.setList.push(function() {
- var o = LGlobal.canvas;
- o.beginPath();
- o.moveTo(n[0] + n[4], n[1]);
- o.lineTo(n[0] + n[2] - n[4], n[1]);
- o.arcTo(n[0] + n[2], n[1], n[0] + n[2], n[1] + n[4], n[4]);
- o.lineTo(n[0] + n[2], n[1] + n[3] - n[4]);
- o.arcTo(n[0] + n[2], n[1] + n[3], n[0] + n[2] - n[4], n[1] + n[3], n[4]);
- o.lineTo(n[0] + n[4], n[1] + n[3]);
- o.arcTo(n[0], n[1] + n[3], n[0], n[1] + n[3] - n[4], n[4]);
- o.lineTo(n[0], n[1] + n[4]);
- o.arcTo(n[0], n[1], n[0] + n[4], n[1], n[4]);
- o.closePath();
- if (s.bitmap) {
- o.save();
- o.clip();
- o.drawImage(s.bitmap.image, 0, 0, s.bitmap.width, s.bitmap.height, 0, 0, s.bitmap.width, s.bitmap.height);
- o.restore();
- s.bitmap = null;
- return
- }
- if (r) {
- o.fillStyle = i;
- o.fill()
- }
- if (e > 0) {
- o.lineWidth = e;
- o.strokeStyle = t;
- o.stroke()
- }
- });
- s.showList.push({
- type: LShape.RECT,
- arg: n
- })
- },
- drawVertices: function(e, t, n, r, i) {
- var s = this;
- if (n.length < 3) {
- return
- }
- s.setList.push(function() {
- var o = LGlobal.canvas;
- o.beginPath();
- o.moveTo(n[0][0], n[0][1]);
- var u, a = n.length,
- f;
- for (u = 1; u < a; u++) {
- f = n[u];
- o.lineTo(f[0], f[1])
- }
- o.lineTo(n[0][0], n[0][1]);
- o.closePath();
- if (s.bitmap) {
- o.save();
- o.clip();
- o.drawImage(s.bitmap.image, s.bitmap.x, s.bitmap.y, s.bitmap.width, s.bitmap.height, 0, 0, s.bitmap.width, s.bitmap.height);
- o.restore();
- s.bitmap = null;
- return
- }
- if (r) {
- o.fillStyle = i;
- o.fill()
- }
- if (e > 0) {
- o.lineWidth = e;
- o.strokeStyle = t;
- o.closePath();
- o.stroke()
- }
- });
- s.showList.push({
- type: LShape.VERTICES,
- arg: n
- })
- },
- drawTriangles: function(e, t, n, r, i) {
- var s = this;
- var o, u, a = t.length,
- f;
- s.setList.push(function() {
- f = LGlobal.canvas;
- var h = e,
- p, d, v;
- for (o = 0, u = 0; o < a; o += 3) {
- p = 0;
- f.save();
- f.beginPath();
- f.moveTo(h[t[o] * 2], h[t[o] * 2 + 1]);
- f.lineTo(h[t[o + 1] * 2], h[t[o + 1] * 2 + 1]);
- f.lineTo(h[t[o + 2] * 2], h[t[o + 2] * 2 + 1]);
- f.lineTo(h[t[o] * 2], h[t[o] * 2 + 1]);
- f.closePath();
- if (r) {
- f.lineWidth = r;
- f.strokeStyle = i;
- f.stroke()
- }
- f.clip();
- if (o % 6 == 0) {
- v = -1;
- var m = (n[t[o + 1 + u] * 2] - n[t[o + u] * 2]) * s.bitmap.width;
- var g = (n[t[o + 2] * 2 + 1] - n[t[o] * 2 + 1]) * s.bitmap.height;
- if (u == 0 && m < 0) {
- for (d = o + 9; d < a; d += 3) {
- if (n[t[o + 2] * 2 + 1] == n[t[d + 2] * 2 + 1]) {
- u = d - o;
- break
- }
- }
- if (u == 0) {
- u = a - o
- }
- m = (n[t[o + 1 + u] * 2] - n[t[o + u] * 2]) * s.bitmap.width
- }
- if (o + u >= a) {
- m = (n[t[o + u - a] * 2] - n[t[o + 1] * 2]) * s.bitmap.width;
- v = n[t[o] * 2] == 1 ? 0 : s.bitmap.width * n[t[o] * 2] + m;
- if (v > s.bitmap.width) {
- v -= s.bitmap.width
- }
- } else {
- v = s.bitmap.width * n[t[o + u] * 2]
- }
- sh = s.bitmap.height * n[t[o] * 2 + 1];
- if (g < 0) {
- g = (n[t[o + 2 - (o > 0 ? 6 : -6)] * 2 + 1] - n[t[o - (o > 0 ? 6 : -6)] * 2 + 1]) * s.bitmap.height;
- sh = 0
- }
- var y = (h[t[o + 1] * 2] - h[t[o] * 2]) / m;
- var b = (h[t[o + 1] * 2 + 1] - h[t[o] * 2 + 1]) / m;
- var w = (h[t[o + 2] * 2] - h[t[o] * 2]) / g;
- var E = (h[t[o + 2] * 2 + 1] - h[t[o] * 2 + 1]) / g;
- f.transform(y, b, w, E, h[t[o] * 2], h[t[o] * 2 + 1]);
- f.drawImage(s.bitmap.image, s.bitmap.x + v, s.bitmap.y + sh, m, g, 0, 0, m, g)
- } else {
- var m = (n[t[o + 2 + u] * 2] - n[t[o + 1 + u] * 2]) * s.bitmap.width;
- var g = (n[t[o + 2] * 2 + 1] - n[t[o] * 2 + 1]) * s.bitmap.height;
- if (u == 0 && m < 0) {
- for (d = o + 9; d < a; d += 3) {
- if (n[t[o + 2] * 2 + 1] == n[t[d + 2] * 2 + 1]) {
- u = d - o;
- break
- }
- }
- if (u == 0) {
- u = a - o
- }
- m = (n[t[o + 2 + u] * 2] - n[t[o + 1 + u] * 2]) * s.bitmap.width
- }
- if (o + 1 + u >= a) {
- m = (n[t[o + 1 + u - a] * 2] - n[t[o + 2] * 2]) * s.bitmap.width;
- v = n[t[o + 1] * 2] == 1 ? 0 : s.bitmap.width * n[t[o + 1] * 2] + m;
- if (v > s.bitmap.width) {
- v -= s.bitmap.width
- }
- } else {
- v = s.bitmap.width * n[t[o + 1 + u] * 2]
- }
- sh = s.bitmap.height * n[t[o] * 2 + 1];
- if (g < 0) {
- g = (n[t[o + 2 - (o > 0 ? 6 : -6)] * 2 + 1] - n[t[o - (o > 0 ? 6 : -6)] * 2 + 1]) * s.bitmap.height;
- sh = 0
- }
- var y = (h[t[o + 2] * 2] - h[t[o + 1] * 2]) / m;
- var b = (h[t[o + 2] * 2 + 1] - h[t[o + 1] * 2 + 1]) / m;
- var w = (h[t[o + 2] * 2] - h[t[o] * 2]) / g;
- var E = (h[t[o + 2] * 2 + 1] - h[t[o] * 2 + 1]) / g;
- f.transform(y, b, w, E, h[t[o + 1] * 2], h[t[o + 1] * 2 + 1]);
- f.drawImage(s.bitmap.image, s.bitmap.x + v, s.bitmap.y + sh, m, g, 0, -g, m, g)
- }
- f.restore()
- }
- })
- },
- drawLine: function(e, t, n) {
- var r = this;
- r.setList.push(function() {
- var r = LGlobal.canvas;
- r.beginPath();
- r.moveTo(n[0], n[1]);
- r.lineTo(n[2], n[3]);
- r.lineWidth = e;
- r.strokeStyle = t;
- r.closePath();
- r.stroke()
- });
- r.showList.push({
- type: LShape.LINE,
- arg: n
- })
- },
- add: function(e) {
- this.setList.push(e)
- },
- ismouseon: function(e, t) {
- var n = this;
- if (e == null || e == UNDEFINED || n.showList.length == 0 || !n.parent) {
- return false
- }
- return n.parent.ismouseonShapes(n.showList, e.offsetX, e.offsetY)
- },
- getWidth: function() {
- var e = this,
- t, n, r, i, s, o, u;
- for (t = 0, o = e.showList.length; t < o; t++) {
- if (e.showList[t].type == LShape.RECT) {
- if (r > e.showList[t].arg[0] || typeof r == UNDEFINED) {
- r = e.showList[t].arg[0]
- }
- if (i < e.showList[t].arg[0] + e.showList[t].arg[2] || typeof i == UNDEFINED) {
- i = e.showList[t].arg[0] + e.showList[t].arg[2]
- }
- } else if (e.showList[t].type == LShape.ARC) {
- if (r > e.showList[t].arg[0] - e.showList[t].arg[2] || typeof r == UNDEFINED) {
- r = e.showList[t].arg[0] - e.showList[t].arg[2]
- }
- if (i < e.showList[t].arg[0] + e.showList[t].arg[2] || typeof i == UNDEFINED) {
- i = e.showList[t].arg[0] + e.showList[t].arg[2]
- }
- } else if (e.showList[t].type == LShape.VERTICES) {
- for (n = 0, u = e.showList[t].arg.length; n < u; n++) {
- s = e.showList[t].arg[n];
- if (r > s[0] || typeof r == UNDEFINED) {
- r = s[0]
- }
- if (i < s[0] || typeof i == UNDEFINED) {
- i = s[0]
- }
- }
- } else if (e.showList[t].type == LShape.LINE) {
- if (r > e.showList[t].arg[0] || typeof r == UNDEFINED) {
- r = e.showList[t].arg[0]
- }
- if (r > e.showList[t].arg[2] || typeof r == UNDEFINED) {
- r = e.showList[t].arg[2]
- }
- if (i < e.showList[t].arg[0] || typeof i == UNDEFINED) {
- i = e.showList[t].arg[0]
- }
- if (i < e.showList[t].arg[2] || typeof i == UNDEFINED) {
- i = e.showList[t].arg[2]
- }
- } else if (e.showList[t].type == LShape.POINT) {
- if (r > e.showList[t].arg[0] || typeof r == UNDEFINED) {
- r = e.showList[t].arg[0]
- }
- if (i < e.showList[t].arg[0] || typeof i == UNDEFINED) {
- i = e.showList[t].arg[0]
- }
- }
- }
- if (typeof r == UNDEFINED) {
- r = i = 0
- }
- e.left = r;
- if (o > 0 && i == r) {
- i = r + 1
- }
- return i - r
- },
- getHeight: function() {
- var e = this,
- t = null,
- n = null,
- r, i, s, o, u;
- for (t = 0, r = e.showList.length; t < r; t++) {
- if (e.showList[t].type == LShape.RECT) {
- if (s > e.showList[t].arg[1] || typeof s == UNDEFINED) {
- s = e.showList[t].arg[1]
- }
- if (o < e.showList[t].arg[1] + e.showList[t].arg[3] || typeof o == UNDEFINED) {
- o = e.showList[t].arg[1] + e.showList[t].arg[3]
- }
- } else if (e.showList[t].type == LShape.ARC) {
- if (s > e.showList[t].arg[1] - e.showList[t].arg[2] || typeof s == UNDEFINED) {
- s = e.showList[t].arg[1] - e.showList[t].arg[2]
- }
- if (o < e.showList[t].arg[1] + e.showList[t].arg[2] || typeof o == UNDEFINED) {
- o = e.showList[t].arg[1] + e.showList[t].arg[2]
- }
- } else if (e.showList[t].type == LShape.VERTICES) {
- for (n = 0, i = e.showList[t].arg.length; n < i; n++) {
- u = e.showList[t].arg[n];
- if (s > u[1] || typeof s == UNDEFINED) {
- s = u[1]
- }
- if (o < u[1] || typeof o == UNDEFINED) {
- o = u[1]
- }
- }
- } else if (e.showList[t].type == LShape.LINE) {
- if (s > e.showList[t].arg[1] || typeof s == UNDEFINED) {
- s = e.showList[t].arg[1]
- }
- if (s > e.showList[t].arg[3] || typeof s == UNDEFINED) {
- s = e.showList[t].arg[3]
- }
- if (o < e.showList[t].arg[1] || typeof o == UNDEFINED) {
- o = e.showList[t].arg[1]
- }
- if (o < e.showList[t].arg[3] || typeof o == UNDEFINED) {
- o = e.showList[t].arg[3]
- }
- } else if (e.showList[t].type == LShape.POINT) {
- if (s > e.showList[t].arg[1] || typeof s == UNDEFINED) {
- s = e.showList[t].arg[1]
- }
- if (o < e.showList[t].arg[1] || typeof o == UNDEFINED) {
- o = e.showList[t].arg[1]
- }
- }
- }
- if (typeof s == UNDEFINED) {
- s = o = 0
- }
- e.top = s;
- if (r > 0 && o == s) {
- o = s + 1
- }
- return o - s
- },
- startX: function() {
- var e = this;
- e.getWidth();
- return e.left
- },
- startY: function() {
- var e = this;
- e.getHeight();
- return e.top
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LShape = function() {
- function e() {
- var e = this;
- LExtends(e, LInteractiveObject, []);
- e.type = "LShape";
- e.graphics = new LGraphics;
- e.graphics.parent = e
- }
- e.POINT = "point";
- e.LINE = "line";
- e.ARC = "arc";
- e.RECT = "rect";
- e.VERTICES = "vertices";
- var t = {
- _ll_show: function(e) {
- var t = this;
- t.graphics.ll_show()
- },
- getWidth: function(e) {
- var t = this,
- n, r, i = t.graphics.startX(),
- s = i + t.graphics.getWidth();
- if (e && t.mask) {
- n = t.mask._startX ? t.mask._startX() : t.mask.startX();
- r = t.mask.getWidth();
- if (i < n) {
- i = n
- }
- if (s > n + r) {
- s = n + r
- }
- }
- t.ll_left = t.x + i;
- t.ll_right = t.x + s;
- return (s - i) * t.scaleX
- },
- getHeight: function(e) {
- var t = this,
- n, r, i = t.graphics.startY(),
- s = i + t.graphics.getHeight();
- if (e && t.mask) {
- n = t.mask._startY ? t.mask._startY() : t.mask.startY();
- r = t.mask.getHeight();
- if (i < n) {
- i = n
- }
- if (s > n + r) {
- s = n + r
- }
- }
- t.ll_top = t.y + i;
- t.ll_bottom = t.y + s;
- return (s - i) * t.scaleY
- },
- _startX: function() {
- var e = this;
- e.getWidth();
- return e.ll_left
- },
- startX: function() {
- var e = this;
- return e._startX() * e.scaleX
- },
- _startY: function() {
- var e = this;
- e.getHeight();
- return e.ll_top
- },
- startY: function() {
- var e = this;
- return e._startY() * e.scaleY
- },
- clone: function() {
- var t = this,
- n = new e,
- r, i;
- n.copyProperty(t);
- n.graphics = t.graphics.clone();
- n.graphics.parent = n;
- return n
- },
- ismouseon: function(e, t) {
- var n = this,
- r = false,
- i;
- if (!n.visible || e == null) {
- return false
- }
- if (n.mask) {
- if (!n.mask.parent) {
- n.mask.parent = n.parent
- }
- if (!n.mask.ismouseon(e, t)) {
- return false
- }
- }
- i = {
- x: n.x * t.scaleX + t.x,
- y: n.y * t.scaleY + t.y,
- scaleX: t.scaleX * n.scaleX,
- scaleY: t.scaleY * n.scaleY
- };
- if (n.graphics) {
- r = n.graphics.ismouseon(e, i)
- }
- return r
- },
- die: function() {
- var e = this;
- e.graphics.clear()
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LSprite = function() {
- function e() {
- var e = this;
- LExtends(e, LDisplayObjectContainer, []);
- e.type = "LSprite";
- e.rotatex;
- e.rotatey;
- e.graphics = new LGraphics;
- e.graphics.parent = e;
- e.box2dBody = null;
- e.shapes = new Array
- }
- var t = {
- setRotate: function(e) {
- var t = this;
- if (t.box2dBody) {
- t.box2dBody.SetAngle(e)
- } else {
- t.rotate = e
- }
- },
- _rotateReady: function() {
- var e = this;
- if (e.box2dBody) {
- if (typeof e.rotatex == UNDEFINED) {
- e.getRotateXY()
- }
- e.x = e.box2dBody.GetPosition().x * LGlobal.box2d.drawScale - e.parent.x - e.rotatex;
- e.y = e.box2dBody.GetPosition().y * LGlobal.box2d.drawScale - e.parent.y - e.rotatey;
- e.rotate = e.box2dBody.GetAngle()
- }
- },
- _ll_show: function(e) {
- var t = this;
- t.graphics.ll_show();
- LGlobal.show(t.childList);
- t._ll_debugShape()
- },
- startDrag: function(e) {
- var t = this,
- n, r;
- if (t.ll_dragStart) {
- return
- }
- t.ll_touchPointID = e;
- t.ll_dragStartX = t.x;
- t.ll_dragStartY = t.y;
- t.ll_dragMX = mouseX;
- t.ll_dragMY = mouseY;
- t.ll_dragStart = true;
- LGlobal.dragList.push(t)
- },
- stopDrag: function() {
- var e = this,
- t, n;
- for (t = 0, n = LGlobal.dragList.length; t < n; t++) {
- if (e.objectIndex == LGlobal.dragList[t].objectIndex) {
- e.ll_dragStart = false;
- LGlobal.dragList.splice(t, 1);
- break
- }
- }
- },
- getRotateXY: function(e, t) {
- var n = this;
- if (!e || !t) {
- e = n.getWidth();
- t = n.getHeight()
- }
- n.rotatex = e / 2;
- n.rotatey = t / 2
- },
- getWidth: function(e) {
- var t = this,
- n, r, i, s, o, u, a, f = t.graphics.startX(),
- l = f + t.graphics.getWidth();
- for (n = 0, r = t.childList.length; n < r; n++) {
- i = t.childList[n];
- if (typeof i.visible == UNDEFINED || !i.visible) {
- continue
- }
- s = i.x;
- if (typeof i._startX == "function") {
- s = i._startX()
- }
- o = s + i.getWidth(e);
- if (s < f) {
- f = s
- }
- if (o > l) {
- l = o
- }
- }
- if (e && t.mask) {
- u = t.mask._startX ? t.mask._startX() : t.mask.startX();
- a = t.mask.getWidth();
- if (f < u) {
- f = u
- }
- if (l > u + a) {
- l = u + a
- }
- }
- t.ll_left = t.x + f;
- t.ll_right = t.x + l;
- return (l - f) * t.scaleX
- },
- getHeight: function(e) {
- var t = this,
- n, r, i, s, o, u, a, f = t.graphics.startY(),
- l = f + t.graphics.getHeight();
- for (n = 0, r = t.childList.length; n < r; n++) {
- i = t.childList[n];
- if (typeof i.visible == UNDEFINED || !i.visible) {
- continue
- }
- s = i.y;
- if (typeof i._startY == "function") {
- s = i._startY()
- }
- o = s + i.getHeight(e);
- if (s < f) {
- f = s
- }
- if (o > l) {
- l = o
- }
- }
- if (e && t.mask) {
- u = t.mask._startY ? t.mask._startY() : t.mask.startY();
- a = t.mask.getHeight();
- if (f < u) {
- f = u
- }
- if (l > u + a) {
- l = u + a
- }
- }
- t.ll_top = t.y + f;
- t.ll_bottom = t.y + l;
- return (l - f) * t.scaleY
- },
- _startX: function() {
- var e = this;
- e.getWidth();
- return e.ll_left
- },
- startX: function() {
- var e = this;
- return e._startX() * e.scaleX
- },
- _startY: function() {
- var e = this;
- e.getHeight();
- return e.ll_top
- },
- startY: function() {
- var e = this;
- return e._startY() * e.scaleY
- },
- _ll_loopframe: function() {
- this.dispatchEvent(LEvent.ENTER_FRAME)
- },
- clone: function() {
- var t = this,
- n = new e,
- r, i, s, o;
- n.copyProperty(t);
- n.graphics = t.graphics.clone();
- n.graphics.parent = n;
- n.childList.length = 0;
- for (s = 0, o = t.childList.length; s < o; s++) {
- r = t.childList[s];
- if (r.clone) {
- i = r.clone();
- i.parent = n;
- n.childList.push(i)
- }
- }
- return n
- },
- _mevent: function(e) {
- var t = this,
- n;
- for (n = 0; n < t.mouseList.length; n++) {
- var r = t.mouseList[n];
- if (r.type == e) {
- return true
- }
- }
- return false
- },
- ll_dispatchMouseEvent: function(e, t, r, i, s) {
- var o = this;
- for (n = 0; n < o.mouseList.length; n++) {
- var u = o.mouseList[n];
- if (u.type == e) {
- t.selfX = (i - (o.x * r.scaleX + r.x)) / (r.scaleX * o.scaleX);
- t.selfY = (s - (o.y * r.scaleY + r.y)) / (r.scaleY * o.scaleY);
- t.currentTarget = t.clickTarget = o;
- if (!t.target) {
- t.target = o
- }
- u.listener(t, o)
- }
- }
- },
- ll_mouseout: function(e, t, n, r, i) {
- var s = this;
- if (t == LMouseEvent.MOUSE_MOVE && s.ll_mousein) {
- s.ll_mousein = false;
- if (s._mevent(LMouseEvent.MOUSE_OUT)) {
- s.ll_dispatchMouseEvent(LMouseEvent.MOUSE_OUT, e, n, r, i)
- }
- if (s.mouseChildren) {
- for (var o = s.childList.length - 1; o >= 0; o--) {
- if (s.childList[o].mouseEvent && s.childList[o].ll_mouseout) {
- s.childList[o].ll_mouseout(e, t, n, r, i)
- }
- }
- }
- }
- },
- mouseEvent: function(e, t, n) {
- if (!e) {
- return false
- }
- var r = this,
- i, s, o = e.offsetX,
- u = e.offsetY,
- a, f;
- if (!r.mouseEnabled || !r.visible) {
- return false
- }
- if (n == null) {
- n = {
- x: 0,
- y: 0,
- scaleX: 1,
- scaleY: 1
- }
- }
- a = r.ismouseon(e, n);
- if (a) {
- if (t == LMouseEvent.MOUSE_MOVE && !r.ll_mousein) {
- r.ll_mousein = true;
- if (r._mevent(LMouseEvent.MOUSE_OVER)) {
- r.ll_dispatchMouseEvent(LMouseEvent.MOUSE_OVER, e, n, o, u)
- }
- }
- if (r.mouseChildren) {
- f = {
- x: r.x * n.scaleX + n.x,
- y: r.y * n.scaleY + n.y,
- scaleX: n.scaleX * r.scaleX,
- scaleY: n.scaleY * r.scaleY
- };
- for (s = r.childList.length - 1; s >= 0; s--) {
- if (r.childList[s].mouseEvent) {
- i = r.childList[s].mouseEvent(e, t, f);
- if (i) {
- e.target = r.childList[s];
- if (t != LMouseEvent.MOUSE_MOVE) {
- break
- }
- }
- }
- }
- if (r._mevent(t)) {
- r.ll_dispatchMouseEvent(t, e, n, o, u)
- }
- }
- return true
- } else {
- r.ll_mouseout(e, t, n, o, u)
- }
- return false
- },
- hitTestPoint: function(e, t) {
- var n = this,
- r = n.shapes;
- if (!r || r.length == 0) {
- n.getWidth();
- n.getHeight();
- r = [{
- type: LShape.RECT,
- arg: [n.ll_left - n.x, n.ll_top - n.y, n.ll_right - n.ll_left, n.ll_bottom - n.ll_top]
- }]
- }
- return n.ismouseonShapes(r, e, t)
- },
- hitTestObject: function(e) {
- var t = this,
- n = t.shapes,
- r = e.shapes,
- i, s, o, u, a, f, l, c;
- if (!n || n.length == 0) {
- t.getWidth();
- t.getHeight();
- n = [{
- type: LShape.RECT,
- arg: [t.ll_left - t.x, t.ll_top - t.y, t.ll_right - t.ll_left, t.ll_bottom - t.ll_top]
- }]
- }
- if (!r || r.length == 0) {
- e.getWidth();
- e.getHeight();
- r = [{
- type: LShape.RECT,
- arg: [e.ll_left - e.x, e.ll_top - e.y, e.ll_right - e.ll_left, e.ll_bottom - e.ll_top]
- }]
- }
- i = t.getRootMatrix();
- s = e.getRootMatrix();
- for (o = n.length - 1; o >= 0; o--) {
- u = n[o];
- c = t._changeShape(u.type, u.arg, i);
- for (a = r.length - 1; a >= 0; a--) {
- f = r[a];
- l = e._changeShape(f.type, f.arg, s);
- if (u.type == LShape.VERTICES || u.type == LShape.RECT) {
- if (f.type == LShape.VERTICES || f.type == LShape.RECT) {
- if (LGlobal.hitTestPolygon(c, l)) {
- return true
- }
- } else if (f.type == LShape.ARC) {
- if (LGlobal.hitTestPolygonArc(c, l)) {
- return true
- }
- }
- } else {
- if (f.type == LShape.VERTICES || f.type == LShape.RECT) {
- if (LGlobal.hitTestPolygonArc(l, c)) {
- return true
- }
- } else if (f.type == LShape.ARC) {
- if (Math.sqrt((c[0] - l[0]) * (c[0] - l[0]) + (c[1] - l[1]) * (c[1] - l[1])) < c[2] + l[2]) {
- return true
- }
- }
- }
- }
- }
- return false
- },
- addShape: function(e, t) {
- var n = this;
- if (e == LShape.VERTICES && t.length < 3) {
- return
- }
- n.shapes.push({
- type: e,
- arg: t
- })
- },
- clearShape: function() {
- var e = this;
- e.shapes.length = 0
- },
- _ll_debugShape: function() {
- var e = this,
- t, n, r, i, s, o, u;
- if (!LGlobal.traceDebug || e.shapes.length == 0) {
- return
- }
- for (t = 0, n = e.shapes.length; t < n; t++) {
- r = e.shapes[t];
- i = LGlobal.canvas;
- s = r.arg;
- i.beginPath();
- if (r.type == LShape.RECT) {
- i.rect(s[0], s[1], s[2], s[3])
- } else if (r.type == LShape.ARC) {
- i.arc(s[0], s[1], s[2], 0, 2 * Math.PI)
- } else if (r.type == LShape.VERTICES) {
- i.moveTo(s[0][0], s[0][1]);
- for (o = 1, u = s.length; o < u; o++) {
- i.lineTo(s[o][0], s[o][1])
- }
- i.lineTo(s[0][0], s[0][1])
- }
- i.closePath();
- i.strokeStyle = "#00FF00";
- i.stroke()
- }
- },
- ismouseon: function(e, t) {
- var n = this;
- if (!n.visible || e == null) {
- return false
- }
- if (n.mask) {
- if (!n.mask.parent) {
- n.mask.parent = n.parent
- }
- if (!n.mask.ismouseon(e, t)) {
- return false
- }
- }
- if (n.shapes && n.shapes.length > 0) {
- return n.ismouseonShapes(n.shapes, e.offsetX, e.offsetY)
- }
- var r, i = false,
- s = n.childList,
- o = {
- x: n.x * t.scaleX + t.x,
- y: n.y * t.scaleY + t.y,
- scaleX: t.scaleX * n.scaleX,
- scaleY: t.scaleY * n.scaleY
- };
- if (n.graphics) {
- i = n.graphics.ismouseon(e, o)
- }
- if (!i) {
- for (r = s.length - 1; r >= 0; r--) {
- if (s[r].ismouseon) {
- i = s[r].ismouseon(e, o)
- }
- if (i) {
- e.target = n.childList[r];
- break
- }
- }
- }
- return i
- },
- die: function() {
- var e = this,
- t, n, r;
- e.graphics.clear();
- e.removeAllEventListener();
- e.stopDrag();
- if (e.box2dBody) {
- e.clearBody()
- }
- for (t = 0, n = e.childList, r = n.length; t < r; t++) {
- if (n[t].die) {
- n[t].die()
- }
- }
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LButton = function() {
- function e(t, n, r, i) {
- var s = this;
- LExtends(s, LSprite, []);
- s.type = "LButton";
- s.addChild(t);
- if (!n) {
- n = t
- } else {
- s.addChild(n)
- } if (!r) {
- r = n
- } else {
- s.addChild(r)
- } if (!i) {
- i = t
- } else {
- s.addChild(i)
- }
- s.upState = s.bitmap_up = t;
- s.overState = s.bitmap_over = n;
- s.downState = r;
- s.disableState = i;
- s._ll_down_sx = s.downState.scaleX;
- s._ll_down_sy = s.downState.scaleY;
- s.overState.visible = false;
- s.downState.visible = false;
- s.upState.visible = true;
- s.buttonMode = true;
- s.staticMode = false;
- s._ll_cursorEnabled = true;
- s.setState(e.STATE_ENABLE);
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_MOVE]) {
- LMouseEventContainer.pushButton(s)
- }
- s.addEventListener(LMouseEvent.MOUSE_DOWN, s.ll_modeDown)
- }
- e.STATE_DISABLE = "disable";
- e.STATE_ENABLE = "enable";
- var t = {
- setState: function(t) {
- var n = this;
- if (t == e.STATE_DISABLE) {
- n.upState.visible = false;
- n.overState.visible = false;
- n.downState.visible = false;
- n.disableState.visible = true;
- n.mouseEnabled = false
- } else if (t == e.STATE_ENABLE) {
- n.overState.visible = false;
- n.downState.visible = false;
- n.disableState.visible = false;
- n.upState.visible = true;
- n.mouseEnabled = true
- } else {
- return
- }
- n.state = t
- },
- ll_mouseout: function(e, t, n, r, i) {
- var s = this;
- if (!s.ll_mousein) {
- return
- }
- e.clickTarget = s;
- s.ll_modeOut(e);
- s.ll_mousein = false
- },
- mouseEvent: function(e, t, n) {
- if (!e) {
- return false
- }
- var r = this;
- if (t == LMouseEvent.MOUSE_MOVE && r.ll_button_mode) {
- r.ll_button_mode(e)
- }
- return this.callParent("mouseEvent", arguments)
- },
- ll_button_mode: function(e) {
- var t = this;
- if (!t.visible) {
- return
- }
- e.clickTarget = t;
- if (t.hitTestPoint(e.offsetX, e.offsetY)) {
- t.ll_modeOver(e)
- } else {
- t.ll_modeOut(e)
- }
- },
- ll_modeDown: function(t) {
- var n = t.clickTarget,
- r, i, s, o, u, a, f, l, c;
- if (!n.buttonMode || n.tween) {
- return
- }
- if (n.state == e.STATE_DISABLE) {
- n.upState.visible = false;
- n.overState.visible = false;
- n.downState.visible = false;
- n.disableState.visible = true;
- return
- }
- n.upState.visible = false;
- n.overState.visible = false;
- n.downState.visible = true;
- n._tweenOver = n.ll_modeOver;
- c = function(e) {
- var t = e.parent;
- delete t.tween;
- t._tweenOver({
- clickTarget: t
- });
- delete t._tweenOver
- };
- if (n.staticMode) {
- n.tween = LTweenLiteTimeline.to(n.downState, .3, {}).to(n.downState, .1, {
- onComplete: c
- })
- } else {
- r = n.downState.getWidth();
- i = n.downState.getHeight();
- s = r * 1.1;
- o = i * 1.1;
- u = n.downState.x;
- a = n.downState.y;
- f = u + (r - s) * .5;
- l = a + (i - o) * .5;
- n.tween = LTweenLiteTimeline.to(n.downState, .3, {
- x: f,
- y: l,
- scaleX: n._ll_down_sx * 1.1,
- scaleY: n._ll_down_sy * 1.1,
- ease: Quart.easeOut
- }).to(n.downState, .1, {
- x: u,
- y: a,
- scaleX: n._ll_down_sx,
- scaleY: n._ll_down_sy,
- ease: Quart.easeOut,
- onComplete: c
- })
- }
- },
- ll_modeOver: function(t) {
- var n = t.clickTarget;
- if (!n.buttonMode) {
- return
- }
- if (n.tween) {
- n._tweenOver = n.ll_modeOver;
- return
- }
- if (n.state == e.STATE_DISABLE) {
- n.upState.visible = false;
- n.overState.visible = false;
- n.downState.visible = false;
- n.disableState.visible = true;
- return
- }
- n.upState.visible = false;
- n.downState.visible = false;
- n.overState.visible = true;
- if (LGlobal.os == OS_PC && n._ll_cursorEnabled && n.parent) {
- LGlobal.cursor = "pointer"
- }
- },
- ll_modeOut: function(t) {
- var n = t.clickTarget;
- if (!n.buttonMode) {
- return
- }
- if (n.tween) {
- n._tweenOver = n.ll_modeOut;
- return
- }
- if (n.state == e.STATE_DISABLE) {
- n.upState.visible = false;
- n.overState.visible = false;
- n.downState.visible = false;
- n.disableState.visible = true;
- return
- }
- n.overState.visible = false;
- n.downState.visible = false;
- n.upState.visible = true
- },
- setCursorEnabled: function(e) {
- this._ll_cursorEnabled = e
- },
- clone: function() {
- var t = this;
- return new e(t.upState.clone(), t.overState.clone(), t.downState.clone(), t.disableState.clone())
- },
- die: function() {
- var e = this;
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_MOVE]) {
- LMouseEventContainer.removeButton(e)
- }
- e.callParent("die", arguments)
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- LBlendMode.SOURCE_OVER = "source-over";
- LBlendMode.SOURCE_ATOP = "source-atop";
- LBlendMode.SOURCE_IN = "source-in";
- LBlendMode.SOURCE_OUT = "source-out";
- LBlendMode.DESTINATION_OVER = "destination-over";
- LBlendMode.DESTINATION_ATOP = "destination-atop";
- LBlendMode.DESTINATION_IN = "destination-in";
- LBlendMode.DESTINATION_OUT = "destination-out";
- LBlendMode.LIGHTER = "lighter";
- LBlendMode.COPY = "copy";
- LBlendMode.XOR = "xor";
- LBlendMode.NONE = null;
- LBlendMode.NORMAL = null;
- var LTextFieldType = function() {
- throw "LTextFieldType cannot be instantiated"
- };
- LTextFieldType.INPUT = "input";
- LTextFieldType.DYNAMIC = null;
- var LTextField = function() {
- function e() {
- var t = this;
- LExtends(t, LInteractiveObject, []);
- t.type = "LTextField";
- t.texttype = null;
- t.text = "";
- t.font = "Arial";
- t.size = "11";
- t.color = "#000000";
- t.weight = "normal";
- t.textAlign = "left";
- t.textBaseline = "top";
- t.heightMode = e.HEIGHT_MODE_BOTTOM;
- t.stroke = false;
- t.lineWidth = 1;
- t.lineColor = "#000000";
- t.width = 150;
- t.height = t.size;
- t.displayAsPassword = false;
- t.wordWrap = false;
- t.multiline = false;
- t.numLines = 1;
- t.speed = 0;
- t._speedIndex = 100
- }
- e.HEIGHT_MODE_BOTTOM = "bottom";
- e.HEIGHT_MODE_BASELINE = "baseline";
- var t = {
- _showReady: function(e) {
- var t = this;
- e.font = t.weight + " " + t.size + "pt " + t.font;
- e.textAlign = t.textAlign;
- e.textBaseline = t.textBaseline
- },
- _ll_show: function(e) {
- var t = this,
- n, r, i, s, o, u, a, f, l, c;
- if (t.texttype == LTextFieldType.INPUT) {
- t.inputBackLayer.ll_show();
- s = t.getRootCoordinate();
- if (LGlobal.inputBox.name == "input" + t.objectIndex) {
- LGlobal.inputBox.style.marginTop = parseInt(LGlobal.canvasObj.style.marginTop) + ((s.y + t.inputBackLayer.startY()) * parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height >>> 0) + "px";
- LGlobal.inputBox.style.marginLeft = parseInt(LGlobal.canvasObj.style.marginLeft) + ((s.x + t.inputBackLayer.startX()) * parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width >>> 0) + "px"
- }
- if (LGlobal.inputTextField && LGlobal.inputTextField.objectIndex == t.objectIndex) {
- return
- }
- }
- r = t.text;
- if (t.displayAsPassword) {
- r = "";
- for (i = 0, u = t.text.length; i < u; i++) {
- r += "*"
- }
- }
- e.fillStyle = t.color;
- if (t.stroke) {
- e.strokeStyle = t.lineColor;
- e.lineWidth = t.lineWidth + 1
- }
- if (t.wordWrap || t.multiline) {
- o = 0, a = 0, f = 0, l = 0;
- for (i = 0, u = t.text.length; i < u; i++) {
- c = /(?:\r\n|\r|\n|¥n)/.exec(r.substr(i, 1));
- if (c) {
- o = 0;
- a = i + 1;
- f++
- }
- if (!c) {
- if (t.stroke) {
- e.strokeText(r.substr(i, 1), o, f * t.wordHeight)
- }
- e.fillText(r.substr(i, 1), o, f * t.wordHeight)
- }
- t.numLines = f;
- o = e.measureText(t.text.substr(a, i + 1 - a)).width;
- if (t.wordWrap && o + e.measureText(r.substr(i, 1)).width > t.width) {
- o = 0;
- a = i + 1;
- f++
- }
- }
- t.height = (f + 1) * t.wordHeight
- } else {
- t.numLines = 1;
- if (t.stroke) {
- e.strokeText(r, 0, 0, e.measureText(r).width)
- }
- e.fillText(r, 0, 0, e.measureText(r).width)
- } if (t.windRunning) {
- t._ll_windRun()
- }
- },
- _wordHeight: function(e) {
- var t = this;
- if (e > 0) {
- t.wordHeight = e
- } else {
- t.wordWrap = false;
- t.wordHeight = t.getHeight()
- }
- t.height = 0
- },
- setMultiline: function(e, t) {
- var n = this;
- if (e) {
- n._wordHeight(t)
- }
- n.multiline = e
- },
- setWordWrap: function(e, t) {
- var n = this;
- if (e) {
- n._wordHeight(t)
- }
- n.wordWrap = e
- },
- setType: function(e, t) {
- var n = this;
- if (n.texttype != e && e == LTextFieldType.INPUT) {
- if (t == null || t.type != "LSprite") {
- n.inputBackLayer = new LSprite;
- n.inputBackLayer.graphics.drawRect(1, "#000000", [0, -n.getHeight() * .4, n.width, n.getHeight() * 1.5])
- } else {
- n.inputBackLayer = t
- }
- n.inputBackLayer.parent = n;
- if (LMouseEventContainer.container[LMouseEvent.MOUSE_DOWN]) {
- LMouseEventContainer.pushInputBox(n)
- }
- } else {
- n.inputBackLayer = null;
- LMouseEventContainer.removeInputBox(n)
- }
- n.texttype = e
- },
- ismouseon: function(e, t) {
- var n = this;
- if (!e) {
- return false
- }
- if (!n.visible) {
- return false
- }
- if (!t) {
- t = {
- x: 0,
- y: 0,
- scaleX: 1,
- scaleY: 1
- }
- }
- if (n.mask) {
- if (!n.mask.parent) {
- n.mask.parent = n.parent
- }
- if (!n.mask.ismouseon(e, t)) {
- return false
- }
- }
- if (n.inputBackLayer) {
- return n.inputBackLayer.ismouseon(e, {
- x: n.x * t.scaleX + t.x,
- y: n.y * t.scaleY + t.y,
- scaleX: t.scaleX * n.scaleX,
- scaleY: t.scaleY * n.scaleY
- })
- }
- return n.ismouseonShapes([{
- type: LShape.RECT,
- arg: [0, 0, n._getWidth(), n._getHeight()]
- }], e.offsetX, e.offsetY)
- },
- clone: function() {
- var e = this,
- t = new e.constructor;
- t.copyProperty(e);
- t.texttype = null;
- if (e.texttype == LTextFieldType.INPUT) {
- t.setType(LTextFieldType.INPUT)
- }
- return t
- },
- mouseEvent: function(e, t, n) {
- var r = this,
- i;
- if (r.inputBackLayer == null) {
- return
- }
- i = r.ismouseon(e, n);
- if (t != LMouseEvent.MOUSE_DOWN || !i) {
- return
- }
- r.focus()
- },
- _ll_getValue: function() {
- if (LGlobal.inputBox.style.display != NONE) {
- LGlobal.inputTextField.text = LGlobal.inputTextBox.value;
- LEvent.removeEventListener(LGlobal.inputTextBox, LKeyboardEvent.KEY_DOWN, LGlobal.inputTextField._ll_input);
- LGlobal.inputBox.style.display = NONE;
- LGlobal.inputTextField.dispatchEvent(LFocusEvent.FOCUS_OUT);
- LGlobal.inputTextField = null
- }
- },
- updateInput: function() {
- var e = this;
- if (e.texttype == LTextFieldType.INPUT && LGlobal.inputTextField.objectIndex == e.objectIndex) {
- LGlobal.inputTextBox.value = LGlobal.inputTextField.text
- }
- },
- _ll_input: function(e) {
- var t = new LEvent(LTextEvent.TEXT_INPUT);
- t.keyCode = e.keyCode;
- LGlobal.inputTextField.text = LGlobal.inputTextBox.value;
- if (LGlobal.inputTextField.hasEventListener(LTextEvent.TEXT_INPUT)) {
- e.returnValue = LGlobal.inputTextField.dispatchEvent(t)
- } else {
- e.returnValue = true
- }
- },
- focus: function() {
- var e = this,
- t, n;
- if (!e.parent) {
- return
- }
- if (e.texttype != LTextFieldType.INPUT) {
- return
- }
- if (LGlobal.inputTextField && LGlobal.inputTextField.objectIndex != e.objectIndex) {
- e._ll_getValue()
- }
- e.dispatchEvent(LFocusEvent.FOCUS_IN);
- t = e.getAbsoluteScale();
- LGlobal.inputBox.style.display = "";
- LGlobal.inputBox.name = "input" + e.objectIndex;
- LGlobal.inputTextField = e;
- LGlobal.inputTextareaBoxObj.style.display = NONE;
- LGlobal.inputTextBoxObj.style.display = NONE;
- LGlobal.passwordBoxObj.style.display = NONE;
- if (e.displayAsPassword) {
- LGlobal.inputTextBox = LGlobal.passwordBoxObj
- } else if (e.multiline) {
- LGlobal.inputTextBox = LGlobal.inputTextareaBoxObj
- } else {
- LGlobal.inputTextBox = LGlobal.inputTextBoxObj
- }
- n = parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width;
- sy = parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height;
- LGlobal.inputTextBox.style.display = "";
- LGlobal.inputTextBox.value = e.text;
- LGlobal.inputTextBox.style.height = e.inputBackLayer.getHeight() * t.scaleY * e.scaleY * sy + "px";
- LGlobal.inputTextBox.style.width = e.inputBackLayer.getWidth() * t.scaleX * e.scaleX * n + "px";
- LGlobal.inputTextBox.style.color = e.color;
- LGlobal.inputTextBox.style.fontSize = (e.size * parseFloat(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height >> 0) + "px";
- LGlobal.inputTextBox.style.fontFamily = e.font;
- LEvent.addEventListener(LGlobal.inputTextBox, LKeyboardEvent.KEY_DOWN, LGlobal.inputTextField._ll_input);
- if (e.texttype == LTextFieldType.INPUT) {
- rc = e.getRootCoordinate();
- if (LGlobal.inputBox.name == "input" + e.objectIndex) {
- LGlobal.inputBox.style.marginTop = parseInt(LGlobal.canvasObj.style.marginTop) + ((rc.y + e.inputBackLayer.startY()) * parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height >>> 0) + "px";
- LGlobal.inputBox.style.marginLeft = parseInt(LGlobal.canvasObj.style.marginLeft) + ((rc.x + e.inputBackLayer.startX()) * parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width >>> 0) + "px"
- }
- }
- setTimeout(function() {
- LGlobal.inputTextBox.focus()
- }, 0)
- },
- _getWidth: function() {
- var e = this;
- if (e.wordWrap) {
- return e.width
- }
- LGlobal.canvas.font = e.size + "pt " + e.font;
- return LGlobal.canvas.measureText(e.text).width
- },
- getWidth: function(e) {
- var t = this,
- n, r, i;
- n = t._getWidth() * t.scaleX;
- if (e && t.mask) {
- r = t.mask._startX ? t.mask._startX() : t.mask.startX();
- if (r > n) {
- return 0
- }
- i = t.mask.getWidth();
- if (r + i > n) {
- return n - r
- } else {
- return i
- }
- }
- return n
- },
- _getHeight: function() {
- var t = this,
- n = LGlobal.canvas,
- r, i, s, o, u, a;
- if (t.wordWrap) {
- n.font = t.weight + " " + t.size + "pt " + t.font;
- if (t.height == 0) {
- s = 0, o = 0, u = 0;
- for (r = 0, i = t.text.length; r < i; r++) {
- s = n.measureText(t.text.substr(o, r - o)).width;
- a = /(?:\r\n|\r|\n|¥n)/.exec(t.text.substr(r, 1));
- if (t.wordWrap && s > t.width || a) {
- s = 0;
- o = r;
- u++;
- if (a) {
- o++
- }
- }
- }
- t.height = (u + 1) * t.wordHeight
- }
- return t.height
- }
- n.font = t.weight + " " + t.size + "pt " + t.font;
- i = n.measureText("O").width * 1.2;
- if (t.heightMode == e.HEIGHT_MODE_BASELINE) {
- i = i * 1.2
- }
- return i
- },
- getHeight: function(e) {
- var t = this,
- n, r, i;
- n = t._getHeight() * t.scaleY;
- if (e && t.mask) {
- r = t.mask._startY ? t.mask._startY() : t.mask.startY();
- if (r > n) {
- return 0
- }
- i = t.mask.getHeight();
- if (r + i > n) {
- return n - r
- } else {
- return i
- }
- }
- return n
- },
- wind: function(e) {
- var t = this;
- t.wind_over_function = e;
- t.windRunning = true;
- t._ll_wind_text = t.text;
- t.text = "";
- t._ll_wind_length = 0
- },
- _ll_windRun: function() {
- var e = this;
- if (e._speedIndex++ < e.speed) {
- return
- }
- e._speedIndex = 0;
- if (e._ll_wind_length > e._ll_wind_text.length) {
- e.windRunning = false;
- if (e.wind_over_function) {
- e.wind_over_function()
- }
- e.dispatchEvent(new LEvent(LTextEvent.WIND_COMPLETE));
- return
- }
- e.text = e._ll_wind_text.substring(0, e._ll_wind_length);
- e._ll_wind_length++
- },
- die: function() {
- LMouseEventContainer.removeInputBox(this)
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LBitmap = function() {
- function e(e) {
- var t = this;
- LExtends(t, LDisplayObject, []);
- t.type = "LBitmap";
- t.rotateCenter = true;
- t.bitmapData = e;
- if (t.bitmapData) {
- t.width = t.bitmapData.width;
- t.height = t.bitmapData.height
- }
- }
- var t = {
- _canShow: function() {
- return this.visible && this.bitmapData
- },
- _rotateReady: function() {
- var e = this;
- if (e.rotate != 0 && e.rotateCenter) {
- e.rotatex = e.getWidth() * .5;
- e.rotatey = e.getHeight() * .5
- } else {
- e.rotatex = e.rotatey = 0
- }
- },
- _coordinate: function(e) {},
- _ll_show: function() {
- this.ll_draw()
- },
- ll_draw: function() {
- var e = this;
- LGlobal.canvas.drawImage(e.bitmapData.image, e.bitmapData.x, e.bitmapData.y, e.bitmapData.width, e.bitmapData.height, e.x, e.y, e.bitmapData.width, e.bitmapData.height)
- },
- clone: function() {
- var t = this,
- n = new e(t.bitmapData.clone());
- n.copyProperty(t);
- n.rotateCenter = t.rotateCenter;
- return n
- },
- ismouseon: function(e, t) {
- var n = this;
- if (!e) {
- return false
- }
- if (!n.visible || !n.bitmapData) {
- return false
- }
- if (n.mask) {
- if (!n.mask.parent) {
- n.mask.parent = n.parent
- }
- if (!n.mask.ismouseon(e, t)) {
- return false
- }
- }
- return n.ismouseonShapes([{
- type: LShape.RECT,
- arg: [0, 0, n.bitmapData.width, n.bitmapData.height]
- }], e.offsetX, e.offsetY)
- },
- getWidth: function(e) {
- var t = this,
- n, r, i;
- n = t.bitmapData != null ? t.bitmapData.width * (t.scaleX > 0 ? t.scaleX : -t.scaleX) : 0;
- if (e && t.mask) {
- r = t.mask._startX ? t.mask._startX() : t.mask.startX();
- if (r > n) {
- return 0
- }
- i = t.mask.getWidth();
- if (r + i > n) {
- return n - r
- } else {
- return i
- }
- }
- return n
- },
- getHeight: function(e) {
- var t = this,
- n, r, i;
- n = t.bitmapData != null ? t.bitmapData.height * (t.scaleY > 0 ? t.scaleY : -t.scaleY) : 0;
- if (e && t.mask) {
- r = t.mask._startY ? t.mask._startY() : t.mask.startY();
- if (r > n) {
- return 0
- }
- i = t.mask.getHeight();
- if (r + i > n) {
- return n - r
- } else {
- return i
- }
- }
- return n
- },
- startX: function() {
- return this.x
- },
- startY: function() {
- return this.y
- },
- die: function() {}
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LBitmapData = function() {
- function e(t, n, r, i, s, o) {
- var u = this;
- LExtends(u, LObject, []);
- u.type = "LBitmapData";
- if (typeof o == UNDEFINED) {
- o = e.DATA_IMAGE
- }
- u.oncomplete = null;
- u._locked = false;
- u._setPixel = false;
- u.x = n == null ? 0 : n;
- u.y = r == null ? 0 : r;
- u.width = 0;
- u.height = 0;
- u.dataType = null;
- if (t && typeof t == "object") {
- u.image = t;
- u.dataType = e.DATA_IMAGE;
- u.width = i == null ? u.image.width : i;
- u.height = s == null ? u.image.height : s;
- u._setDataType(o)
- } else {
- u._createCanvas();
- u.dataType = e.DATA_CANVAS;
- u._canvas.width = u.width = i == null ? 1 : i;
- u._canvas.height = u.height = s == null ? 1 : s;
- if (typeof t == "string") {
- t = parseInt(t.replace("#", "0x"))
- }
- if (typeof t == "number") {
- var a = u._context.createImageData(u.width, u.height);
- for (var f = 0; f < a.data.length; f += 4) {
- a.data[f + 0] = t >> 16 & 255;
- a.data[f + 1] = t >> 8 & 255;
- a.data[f + 2] = t & 255;
- a.data[f + 3] = 255
- }
- u._context.putImageData(a, 0, 0)
- }
- u.image = u._canvas;
- if (o == e.DATA_IMAGE) {
- u._setDataType(o)
- }
- }
- u.resize()
- }
- e.DATA_IMAGE = "data_image";
- e.DATA_CANVAS = "data_canvas";
- var t = {
- _setDataType: function(t) {
- var n = this;
- if (n.dataType == t) {
- return
- }
- if (t == e.DATA_CANVAS) {
- n._createCanvas();
- n._canvas.width = n.image.width;
- n._canvas.height = n.image.height;
- n._context.clearRect(0, 0, n._canvas.width, n._canvas.height);
- n._context.drawImage(n.image, 0, 0);
- n.image = n._canvas
- } else if (t == e.DATA_IMAGE) {
- n.image = new Image;
- n.image.width = n._canvas.width;
- n.image.height = n._canvas.height;
- n.image.src = n._canvas.toDataURL()
- }
- n.dataType = t
- },
- _createCanvas: function() {
- var e = this;
- if (!e._canvas) {
- e._canvas = document.createElement("canvas");
- e._context = e._canvas.getContext("2d")
- }
- },
- clear: function() {
- var t = this;
- t._createCanvas();
- t._canvas.width = t.image.width;
- if (t.dataType == e.DATA_IMAGE) {
- t.image.src = t._canvas.toDataURL()
- }
- },
- setProperties: function(e, t, n, r) {
- var i = this;
- i.x = e;
- i.y = t;
- i.width = n;
- i.height = r;
- i.resize()
- },
- setCoordinate: function(e, t) {
- var n = this;
- n.x = e;
- n.y = t;
- n.resize()
- },
- clone: function() {
- var t = this;
- return new e(t.image, t.x, t.y, t.width, t.height, t.dataType)
- },
- _ready: function() {
- var t = this;
- t._dataType = t.dataType;
- t._setDataType(e.DATA_CANVAS);
- t._data = t._context.getImageData(t.x, t.y, t.width, t.height)
- },
- _update: function() {
- var e = this;
- e._context.putImageData(e._data, e.x, e.y, 0, 0, e.width, e.height);
- e._setDataType(e._dataType);
- e._data = null
- },
- getPixel: function(e, t, n) {
- var r = this,
- i, s;
- e = e >> 0;
- t = t >> 0;
- if (!r._locked) {
- r._ready()
- }
- i = r.width * 4 * t + e * 4;
- s = r._data.data;
- if (!r._locked) {
- r._update()
- }
- if (n == "number") {
- return s[i] << 16 | s[i + 1] << 8 | s[i + 2]
- } else {
- return [s[i], s[i + 1], s[i + 2], s[i + 3]]
- }
- },
- setPixel: function(e, t, n) {
- var r = this;
- e = e >> 0;
- t = t >> 0;
- if (!r._locked) {
- r._ready()
- }
- var i = r._data,
- s = r.width * 4 * t + e * 4;
- if (typeof n == "object") {
- i.data[s + 0] = n[0];
- i.data[s + 1] = n[1];
- i.data[s + 2] = n[2];
- i.data[s + 3] = n[3]
- } else {
- if (typeof n == "string") {
- n = parseInt(n.replace("#", "0x"))
- }
- i.data[s + 0] = n >> 16 & 255;
- i.data[s + 1] = n >> 8 & 255;
- i.data[s + 2] = n & 255;
- i.data[s + 3] = 255
- } if (!r._locked) {
- r._update()
- }
- },
- getPixels: function(e) {
- var t = this,
- n;
- if (!t._locked) {
- t._ready()
- }
- n = t._context.getImageData(t.x + e.x, t.y + e.y, e.width, e.height);
- if (!t._locked) {
- t._update()
- }
- return n
- },
- setPixels: function(e, t) {
- var n = this,
- r, i, s, o, u, a, f;
- if (!n._locked) {
- n._ready()
- }
- s = n._data;
- if (typeof t == "object") {
- o = n._canvas.width;
- for (a = e.x; a < e.right; a++) {
- for (f = e.y; f < e.bottom; f++) {
- r = o * 4 * (n.y + f) + (n.x + a) * 4;
- i = t.width * 4 * (f - e.y) + (a - e.x) * 4;
- s.data[r + 0] = t.data[i + 0];
- s.data[r + 1] = t.data[i + 1];
- s.data[r + 2] = t.data[i + 2];
- s.data[r + 3] = t.data[i + 3]
- }
- }
- } else {
- if (typeof t == "string") {
- t = parseInt(t.replace("#", "0x"))
- }
- t = [t >> 16 & 255, t >> 8 & 255, t & 255];
- o = n._canvas.width;
- for (a = e.x; a < e.right; a++) {
- for (f = e.y; f < e.bottom; f++) {
- r = o * 4 * (n.y + f) + (n.x + a) * 4;
- s.data[r + 0] = t[0];
- s.data[r + 1] = t[1];
- s.data[r + 2] = t[2];
- s.data[r + 3] = 255
- }
- }
- } if (!n._locked) {
- n._update()
- }
- },
- putPixels: function(t, n) {
- var r = this;
- if (r.dataType != e.DATA_CANVAS || typeof n != "object") {
- return
- }
- r._context.putImageData(n, r.x + t.x, r.y + t.y, 0, 0, t.width, t.height)
- },
- lock: function() {
- var e = this;
- e._locked = true;
- e._ready()
- },
- unlock: function() {
- var e = this;
- e._locked = false;
- e._update()
- },
- draw: function(t, n, r, i, s) {
- var o = this,
- u, a = t,
- f, l, c, h, p = false;
- var d = o.dataType;
- o._setDataType(e.DATA_CANVAS);
- if (n || r || i || s) {
- o._context.save();
- p = true
- }
- if (s) {
- if (!(a instanceof e)) {
- f = l = 0
- } else {
- f = a.x;
- l = a.y
- }
- a = new e(a.getDataCanvas(), f + s.x, l + s.y, s.width, s.height, e.DATA_CANVAS)
- }
- c = a.getWidth() >>> 0;
- h = a.getHeight() >>> 0;
- if (c == 0 || h == 0) {
- o._setDataType(d);
- return
- }
- u = a.getDataCanvas();
- if (r) {
- a.colorTransform(new LRectangle(0, 0, c, h), r);
- u = a.image
- }
- if (n) {
- o._context.setTransform(n.a, n.b, n.c, n.d, n.tx, n.ty)
- }
- if (i) {
- o._context.globalCompositeOperation = i
- }
- o._context.drawImage(u, a.x, a.y, c, h, 0, 0, c, h);
- if (p) {
- o._context.restore()
- }
- o._setDataType(d);
- o.resize()
- },
- getDataCanvas: function() {
- var t = this;
- var n = t.dataType;
- t._setDataType(e.DATA_CANVAS);
- t._setDataType(n);
- return t._canvas
- },
- getWidth: function() {
- return this.width
- },
- getHeight: function() {
- return this.height
- },
- resize: function() {
- var e = this,
- t = e.image.width - e.x,
- n = e.image.height - e.y;
- e.width = e.width < t ? e.width : t;
- e.height = e.height < n ? e.height : n
- },
- colorTransform: function(t, n) {
- var r = this;
- if (r.dataType != e.DATA_CANVAS) {
- return
- }
- var i = t.x >> 0,
- s = t.y >> 0,
- o = t.width >> 0,
- u = t.height >> 0;
- var a = r._context.getImageData(r.x + t.x, r.y + t.y, t.width, t.height);
- var f = a.data;
- for (var l = 0, c = f.length; l < c; l += 4) {
- var h = l,
- p = l + 1,
- d = l + 2,
- v = l + 3;
- f[h] = f[h] * n.redMultiplier + n.redOffset;
- f[p] = f[p] * n.greenMultiplier + n.greenOffset;
- f[d] = f[d] * n.blueMultiplier + n.blueOffset;
- f[v] = f[v] * n.alphaMultiplier + n.alphaOffset
- }
- r._context.putImageData(a, r.x + t.x, r.y + t.y, 0, 0, t.width, t.height)
- },
- copyPixels: function(t, n, r) {
- var i = this,
- s, o, u, a, f = t;
- if (i.dataType != e.DATA_CANVAS) {
- return
- }
- s = f.x;
- o = f.y;
- u = f.width;
- a = f.height;
- f.setProperties(n.x + f.x, n.y + f.y, n.width, n.height);
- i._context.drawImage(f.image, f.x, f.y, f.width, f.height, r.x, r.y, f.width, f.height);
- f.x = s;
- f.y = o;
- f.width = u;
- f.height = a
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LDropShadowFilter = function() {
- function e(e, t, n, r) {
- var i = this;
- LExtends(i, LObject, []);
- i.type = "LDropShadowFilter";
- i.distance = e ? e : 0;
- i.angle = t ? t : 0;
- i.shadowColor = n ? n : "#000000";
- i.shadowBlur = r ? r : 20;
- i.setShadowOffset()
- }
- var t = {
- setShadowOffset: function() {
- var e = this;
- var t = e.angle * Math.PI / 180;
- e.shadowOffsetX = e.distance * Math.cos(t);
- e.shadowOffsetY = e.distance * Math.sin(t)
- },
- ll_show: function() {
- var e = this,
- t = LGlobal.canvas;
- t.shadowColor = e.shadowColor;
- t.shadowBlur = e.shadowBlur;
- t.shadowOffsetX = e.shadowOffsetX;
- t.shadowOffsetY = e.shadowOffsetY
- },
- setDistance: function(e) {
- this.distance = e;
- this.setShadowOffset()
- },
- setAngle: function(e) {
- this.angle = e;
- this.setShadowOffset()
- },
- setColor: function(e) {
- this.shadowColor = e
- },
- setBlur: function(e) {
- this.shadowBlur = e
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LAnimation = function() {
- function e(e, t, n) {
- var r = this;
- LExtends(r, LSprite, []);
- r.type = "LAnimation";
- r.rowIndex = 0;
- r.colIndex = 0;
- r._ll_stepIndex = 0;
- r._ll_stepArray = [];
- r.mode = 1;
- r.isMirror = false;
- r.bitmap = new LBitmap(t);
- r.imageArray = n;
- r.addChild(r.bitmap);
- if (e != null) {
- e.addChild(r)
- }
- r.onframe();
- r.colIndex = 0
- }
- var t = {
- setAction: function(e, t, n, r) {
- var i = this,
- s = false;
- if (e != null && e >= 0 && e < i.imageArray.length) {
- i.rowIndex = e;
- s = true
- }
- if (t != null && t >= 0 && t < i.imageArray[e].length) {
- i.colIndex = t;
- s = true
- }
- if (n != null) {
- i.mode = n;
- s = true
- }
- if (r != null) {
- i.isMirror = r;
- if (i.isMirror) {
- i.bitmap.x = i.bitmap.getWidth();
- i.bitmap.scaleX = -1 * Math.abs(i.bitmap.scaleX)
- } else {
- i.bitmap.x = 0;
- i.bitmap.scaleX = Math.abs(i.bitmap.scaleX)
- }
- s = true
- }
- if (s) {
- i._ll_stepIndex = 0
- }
- },
- getAction: function() {
- var e = this;
- return [e.rowIndex, e.colIndex, e.mode, e.isMirror]
- },
- onframe: function() {
- var e = this,
- t, n = null;
- if (e.colIndex >= e.imageArray[e.rowIndex].length) {
- e.colIndex = 0
- }
- t = e.imageArray[e.rowIndex][e.colIndex];
- if (e._ll_stepArray[e.rowIndex] && e._ll_stepArray[e.rowIndex][e.colIndex]) {
- n = e._ll_stepArray[e.rowIndex][e.colIndex]
- } else {
- n = 0
- } if (e._ll_stepIndex == 0) {
- if (typeof t.script == "function") {
- t.script(e, t.params)
- }
- if (typeof t.width != UNDEFINED && typeof t.height != UNDEFINED) {
- e.bitmap.bitmapData.setProperties(t.x, t.y, t.width, t.height)
- } else {
- e.bitmap.bitmapData.setCoordinate(t.x, t.y)
- } if (typeof t.sx != UNDEFINED) {
- e.bitmap.x = t.sx
- }
- if (typeof t.sy != UNDEFINED) {
- e.bitmap.y = t.sy
- }
- if (typeof t.mirror != UNDEFINED) {
- e.bitmap.rotateCenter = false;
- if (t.mirror) {
- e.bitmap.x = e.bitmap.getWidth();
- e.bitmap.scaleX = -1 * Math.abs(e.bitmap.scaleX)
- } else {
- e.bitmap.x = 0;
- e.bitmap.scaleX = Math.abs(e.bitmap.scaleX)
- }
- }
- }
- if (e._ll_stepIndex++ < n) {
- return
- }
- e._ll_stepIndex = 0;
- e.colIndex += e.mode;
- if (e.colIndex >= e.imageArray[e.rowIndex].length || e.colIndex < 0) {
- e.colIndex = e.mode > 0 ? 0 : e.imageArray[e.rowIndex].length - 1;
- e.dispatchEvent(LEvent.COMPLETE)
- }
- },
- clone: function() {
- var t = this,
- n = new e(null, t.bitmap.bitmapData, t.imageArray.slice(0));
- n.copyProperty(t);
- n.childList.length = 0;
- n.bitmap = t.bitmap.clone();
- n.addChild(n.bitmap);
- return n
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LAnimationTimeline = function() {
- function e(e, t) {
- var n = this;
- LExtends(n, LAnimation, [null, e, t]);
- n.type = "LAnimationTimeline";
- n.speed = 0;
- n._speedIndex = 0;
- n.ll_labelList = {};
- for (var r = 0, i, s, o; r < t.length; r++) {
- i = t[r];
- for (s = 0; s < i.length; s++) {
- o = i[s];
- if (o.label) {
- n.setLabel(o.label, r, s, 1, o.isMirror ? true : false)
- }
- }
- }
- n.addEventListener(LEvent.ENTER_FRAME, n._ll_onframe)
- }
- var t = {
- clone: function() {
- var e = this,
- t, n, r = new LAnimation(null, e.bitmap.bitmapData, e.imageArray.slice(0));
- r.copyProperty(e);
- r.childList.length = 0;
- r.bitmap = e.bitmap.clone();
- r.addChild(r.bitmap);
- for (t in e.ll_labelList) {
- n = e.ll_labelList[t];
- r.ll_labelList[t] = {
- rowIndex: n.rowIndex,
- colIndex: n.colIndex,
- mode: n.mode,
- isMirror: n.isMirror
- }
- }
- return r
- },
- setFrameSpeedAt: function(e, t, n) {
- var r = this;
- if (!r._ll_stepArray[e]) {
- r._ll_stepArray[e] = []
- }
- r._ll_stepArray[e][t] = n
- },
- _ll_onframe: function(e) {
- var t = e.target;
- if (t._ll_stop) {
- return
- }
- if (t._speedIndex++ < t.speed) {
- return
- }
- t._speedIndex = 0;
- t.onframe()
- },
- setLabel: function(e, t, n, r, i) {
- this.ll_labelList[e] = {
- rowIndex: t,
- colIndex: n,
- mode: r,
- isMirror: i
- }
- },
- play: function() {
- this._ll_stop = false
- },
- stop: function() {
- this._ll_stop = true
- },
- gotoAndPlay: function(e) {
- var t = this,
- n = t.ll_labelList[e];
- t.setAction(n.rowIndex, n.colIndex, n.mode, n.isMirror);
- t.onframe();
- t.play()
- },
- gotoAndStop: function(e) {
- var t = this,
- n = t.ll_labelList[e];
- t.setAction(n.rowIndex, n.colIndex, n.mode, n.isMirror);
- t.onframe();
- t.stop()
- },
- addFrameScript: function(e, t, n) {
- var r = this.ll_labelList[e];
- var i = this.imageArray[r.rowIndex][r.colIndex];
- i.script = t;
- i.params = n ? n : null
- },
- removeFrameScript: function(e) {
- var t = this.ll_labelList[e];
- this.imageArray[t.rowIndex][t.colIndex].script = null
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var LLoadManage = function() {
- function e() {
- this.llname = "ll.file.";
- this.llload = "ll.load."
- }
- e.prototype = {
- load: function(e, t, n) {
- var r = this;
- r.list = e, r.onupdate = t, r.oncomplete = n;
- r.loader = r, r.index = 0, r.loadIndex = 0, r.result = [], r.lresult = [];
- r.loadInit()
- },
- loadInit: function() {
- var e = this;
- if (e.index >= e.list.length) {
- return
- }
- e.loadIndex = 0;
- e.loadStart();
- e.reloadtime = setTimeout(e.loadInit.bind(e), 1e4)
- },
- loadStart: function() {
- var e = this,
- t, n, r, i;
- if (e.loadIndex >= e.list.length) {
- return
- }
- t = e.list[e.loadIndex];
- if (!t.name) {
- t.name = e.llname + e.loadIndex
- }
- if (!e.lresult[e.llload + t.name]) {
- if (!t["type"]) {
- i = getExtension(t.path);
- if (i == "txt") {
- t["type"] = LURLLoader.TYPE_TEXT
- } else if (i == "js") {
- t["type"] = LURLLoader.TYPE_JS
- } else if ((new Array("mp3", "ogg", "wav", "m4a")).indexOf(i) >= 0) {
- t["type"] = LSound.TYPE_SOUND
- }
- }
- if (t["type"] == LURLLoader.TYPE_TEXT || t["type"] == LURLLoader.TYPE_JS) {
- e.loader = new LURLLoader;
- e.loader.name = t.name;
- e.loader.addEventListener(LEvent.COMPLETE, e.loadComplete.bind(e));
- e.loader.load(e.url(t.path), t["type"])
- } else if (t["type"] == LSound.TYPE_SOUND) {
- e.loader = new LSound;
- e.loader.name = t.name;
- e.loader.addEventListener(LEvent.COMPLETE, e.loadComplete.bind(e));
- e.loader.load(t.path)
- } else {
- e.loader = new LLoader;
- e.loader.name = t.name;
- e.loader.addEventListener(LEvent.COMPLETE, e.loadComplete.bind(e));
- e.loader.load(e.url(t.path), LLoader.TYPE_BITMAPDATE)
- }
- }
- e.loadIndex++;
- e.loadStart()
- },
- loadComplete: function(e) {
- var t = this;
- if (e && e.currentTarget && e.currentTarget.name) {
- e.currentTarget.removeEventListener(LEvent.COMPLETE, t.loadComplete);
- if (e.currentTarget.name.indexOf(t.llname) >= 0) {
- e.target = 1
- }
- if (t.lresult[t.llload + e.currentTarget.name]) {
- return
- }
- t.result[e.currentTarget.name] = e.target;
- t.lresult[t.llload + e.currentTarget.name] = 1
- }
- t.index++;
- if (t.onupdate) {
- t.onupdate(Math.floor(t.index * 100 / t.list.length))
- }
- if (t.index >= t.list.length) {
- if (t.reloadtime) {
- clearTimeout(t.reloadtime)
- }
- t.loader = null;
- var n = t.result;
- LGlobal.forceRefresh = true;
- t.oncomplete(n)
- }
- },
- url: function(e) {
- if (!LGlobal.traceDebug) {
- return e
- }
- return e + (e.indexOf("?") >= 0 ? "&" : "?") + "t=" + (new Date).getTime()
- }
- };
- return new e
- }();
- var LEasing = {
- None: {
- easeIn: function(e, t, n, r) {
- return t + e * n / r
- },
- easeOut: function(e, t, n, r) {
- return t + e * n / r
- },
- easeInOut: function(e, t, n, r) {
- return t + e * n / r
- }
- },
- Quad: {
- easeIn: function(e, t, n, r) {
- return n * (e /= r) * e + t
- },
- easeOut: function(e, t, n, r) {
- return -n * (e /= r) * (e - 2) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e + t
- }
- return -n / 2 * (--e * (e - 2) - 1) + t
- }
- },
- Cubic: {
- easeIn: function(e, t, n, r) {
- return n * (e /= r) * e * e + t
- },
- easeOut: function(e, t, n, r) {
- return n * ((e = e / r - 1) * e * e + 1) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e * e + t
- }
- return n / 2 * ((e -= 2) * e * e + 2) + t
- }
- },
- Quart: {
- easeIn: function(e, t, n, r) {
- return n * (e /= r) * e * e * e + t
- },
- easeOut: function(e, t, n, r) {
- return -n * ((e = e / r - 1) * e * e * e - 1) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e * e * e + t
- }
- return -n / 2 * ((e -= 2) * e * e * e - 2) + t
- }
- },
- Quint: {
- easeIn: function(e, t, n, r) {
- return n * (e /= r) * e * e * e * e + t
- },
- easeOut: function(e, t, n, r) {
- return n * ((e = e / r - 1) * e * e * e * e + 1) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e * e * e * e + t
- }
- return n / 2 * ((e -= 2) * e * e * e * e + 2) + t
- }
- },
- Sine: {
- easeIn: function(e, t, n, r) {
- return -n * Math.cos(e / r * (Math.PI / 2)) + n + t
- },
- easeOut: function(e, t, n, r) {
- return n * Math.sin(e / r * (Math.PI / 2)) + t
- },
- easeInOut: function(e, t, n, r) {
- return -n / 2 * (Math.cos(Math.PI * e / r) - 1) + t
- }
- },
- Strong: {
- easeIn: function(e, t, n, r) {
- return n * (e /= r) * e * e * e * e + t
- },
- easeOut: function(e, t, n, r) {
- return n * ((e = e / r - 1) * e * e * e * e + 1) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e * e * e * e + t
- }
- return n / 2 * ((e -= 2) * e * e * e * e + 2) + t
- }
- },
- Expo: {
- easeIn: function(e, t, n, r) {
- return e == 0 ? t : n * Math.pow(2, 10 * (e / r - 1)) + t
- },
- easeOut: function(e, t, n, r) {
- return e == r ? t + n : n * (-Math.pow(2, -10 * e / r) + 1) + t
- },
- easeInOut: function(e, t, n, r) {
- if (e == 0) {
- return t
- }
- if (e == r) {
- return t + n
- }
- if ((e /= r / 2) < 1) {
- return n / 2 * Math.pow(2, 10 * (e - 1)) + t
- }
- return n / 2 * (-Math.pow(2, -10 * --e) + 2) + t
- }
- },
- Circ: {
- easeIn: function(e, t, n, r) {
- return -n * (Math.sqrt(1 - (e /= r) * e) - 1) + t
- },
- easeOut: function(e, t, n, r) {
- return n * Math.sqrt(1 - (e = e / r - 1) * e) + t
- },
- easeInOut: function(e, t, n, r) {
- if ((e /= r / 2) < 1) {
- return -n / 2 * (Math.sqrt(1 - e * e) - 1) + t
- }
- return n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t
- }
- },
- Elastic: {
- easeIn: function(e, t, n, r, i, s) {
- var o;
- if (e == 0) {
- return t
- }
- if ((e /= r) == 1) {
- return t + n
- }
- if (!s) {
- s = r * .3
- }
- if (!i || i < Math.abs(n)) {
- i = n;
- o = s / 4
- } else {
- o = s / (2 * Math.PI) * Math.asin(n / i)
- }
- return -(i * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - o) * 2 * Math.PI / s)) + t
- },
- easeOut: function(e, t, n, r, i, s) {
- var o;
- if (e == 0) {
- return t
- }
- if ((e /= r) == 1) {
- return t + n
- }
- if (!s) {
- s = r * .3
- }
- if (!i || i < Math.abs(n)) {
- i = n;
- o = s / 4
- } else {
- o = s / (2 * Math.PI) * Math.asin(n / i)
- }
- return i * Math.pow(2, -10 * e) * Math.sin((e * r - o) * 2 * Math.PI / s) + n + t
- },
- easeInOut: function(e, t, n, r, i, s) {
- var o;
- if (e == 0) {
- return t
- }
- if ((e /= r / 2) == 2) {
- return t + n
- }
- if (!s) {
- s = r * .3 * 1.5
- }
- if (!i || i < Math.abs(n)) {
- i = n;
- o = s / 4
- } else {
- o = s / (2 * Math.PI) * Math.asin(n / i)
- } if (e < 1) {
- return -.5 * i * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - o) * 2 * Math.PI / s) + t
- }
- return i * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - o) * 2 * Math.PI / s) * .5 + n + t
- }
- },
- Back: {
- easeIn: function(e, t, n, r, i) {
- if (typeof i == UNDEFINED) {
- i = 1.70158
- }
- return n * (e /= r) * e * ((i + 1) * e - i) + t
- },
- easeOut: function(e, t, n, r, i) {
- if (typeof i == UNDEFINED) {
- i = 1.70158
- }
- return n * ((e = e / r - 1) * e * ((i + 1) * e + i) + 1) + t
- },
- easeInOut: function(e, t, n, r, i) {
- if (typeof i == UNDEFINED) {
- i = 1.70158
- }
- if ((e /= r / 2) < 1) {
- return n / 2 * e * e * (((i *= 1.525) + 1) * e - i) + t
- }
- return n / 2 * ((e -= 2) * e * (((i *= 1.525) + 1) * e + i) + 2) + t
- }
- },
- Bounce: {
- easeIn: function(e, t, n, r) {
- return n - LEasing.Bounce.easeOut(r - e, 0, n, r) + t
- },
- easeOut: function(e, t, n, r) {
- if ((e /= r) < 1 / 2.75) {
- return n * 7.5625 * e * e + t
- } else if (e < 2 / 2.75) {
- return n * (7.5625 * (e -= 1.5 / 2.75) * e + .75) + t
- } else if (e < 2.5 / 2.75) {
- return n * (7.5625 * (e -= 2.25 / 2.75) * e + .9375) + t
- } else {
- return n * (7.5625 * (e -= 2.625 / 2.75) * e + .984375) + t
- }
- },
- easeInOut: function(e, t, n, r) {
- if (e < r / 2) {
- return LEasing.Bounce.easeIn(e * 2, 0, n, r) * .5 + t
- }
- return LEasing.Bounce.easeOut(e * 2 - r, 0, n, r) * .5 + n * .5 + t
- }
- }
- };
- var Quad = LEasing.Quad,
- Cubic = LEasing.Cubic,
- Quart = LEasing.Quart,
- Quint = LEasing.Quint,
- Sine = LEasing.Sine,
- Strong = LEasing.Strong,
- Expo = LEasing.Expo,
- Circ = LEasing.Circ,
- Elastic = LEasing.Elastic,
- Back = LEasing.Back,
- Bounce = LEasing.Bounce;
- var LTweenLiteTimeline;
- var LTweenLite = function() {
- function e(e, t, n) {
- var r = this;
- LExtends(r, LObject, []);
- r.type = "LTweenLiteChild";
- r.toNew = [];
- r.init(e, t, n)
- }
- function r() {
- LExtends(this, LObject, []);
- this.type = "LTweenLite"
- }
- var t = {
- init: function(e, t, n) {
- var i = this,
- s = null;
- if (typeof n["tweenTimeline"] == UNDEFINED) {
- n["tweenTimeline"] = r.TYPE_FRAME
- }
- i.target = e;
- i.duration = t || .001;
- i.vars = n;
- i.delay = i.vars.delay || 0;
- if (i.vars["tweenTimeline"] == r.TYPE_TIMER) {
- i.currentTime = (new Date).getTime() / 1e3;
- i.initTime = i.currentTime;
- i.startTime = i.initTime + i.delay
- } else {
- i.currentTime = 0;
- i.duration *= 1e3;
- i.currentTime -= i.delay * 1e3
- }
- i.combinedTimeScale = i.vars.timeScale || 1;
- i.active = i.duration == 0 && i.delay == 0;
- i.varsto = {};
- i.varsfrom = {};
- i.stop = false;
- if (typeof i.vars.ease != "function") {
- i.vars.ease = LEasing.None.easeIn
- }
- i.ease = i.vars.ease;
- delete i.vars.ease;
- if (i.vars.onComplete) {
- i.onComplete = i.vars.onComplete;
- delete i.vars.onComplete
- }
- if (i.vars.onUpdate) {
- i.onUpdate = i.vars.onUpdate;
- delete i.vars.onUpdate
- }
- if (i.vars.onStart) {
- i.onStart = i.vars.onStart;
- delete i.vars.onStart
- }
- for (s in i.vars) {
- i.varsto[s] = i.vars[s];
- i.varsfrom[s] = i.target[s]
- }
- },
- pause: function() {
- this.stop = true
- },
- resume: function() {
- this.stop = false
- },
- tween: function() {
- var e = this,
- t;
- var n = e.vars["tweenTimeline"] == r.TYPE_TIMER;
- if (n) {
- var i = (new Date).getTime() / 1e3,
- s = i - e.startTime;
- if (s < 0) {
- return
- }
- } else {
- if (e.stop) {
- return
- }
- e.currentTime += LGlobal.speed;
- if (e.currentTime < 0) {
- return
- }
- }
- for (t in e.varsto) {
- if (t == "tweenTimeline") {
- continue
- }
- if (n) {
- e.target[t] = e.ease(s, e.varsfrom[t], e.varsto[t] - e.varsfrom[t], e.duration)
- } else {
- e.target[t] = e.ease(e.currentTime, e.varsfrom[t], e.varsto[t] - e.varsfrom[t], e.duration)
- }
- }
- if (e.onStart) {
- e.onStart(e.target);
- delete e.onStart
- }
- var o;
- if (n) {
- o = s >= e.duration
- } else {
- o = e.currentTime >= e.duration
- } if (o) {
- for (t in e.varsto) {
- e.target[t] = e.varsto[t]
- }
- if (e.onComplete) {
- e.target.target = e.target;
- e.target.currentTarget = e;
- e.onComplete(e.target);
- delete e.target.currentTarget;
- delete e.target.target
- }
- return true
- } else if (e.onUpdate) {
- e.onUpdate(e.target)
- }
- return false
- },
- to: function(e, t, n) {
- var r = this;
- r.toNew.push({
- target: e,
- duration: t,
- vars: n
- });
- return r
- },
- keep: function() {
- var e = this,
- t, n, r;
- if (e.toNew.length > 0) {
- t = e.toNew.shift();
- if (t.vars.loop) {
- e.loop = true
- }
- if (e.loop) {
- n = {};
- for (r in t.vars) {
- n[r] = t.vars[r]
- }
- e.to(t.target, t.duration, n)
- }
- e.init(t.target, t.duration, t.vars);
- return true
- }
- return false
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- r.TYPE_FRAME = "type_frame";
- r.TYPE_TIMER = "type_timer";
- t = {
- tweens: [],
- ll_show: null,
- frame: function() {
- var e = this;
- var t, n = e.tweens.length,
- r;
- for (t = 0; t < n; t++) {
- r = e.tweens[t];
- if (r && r.tween && r.tween()) {
- e.tweens.splice(t, 1);
- t--;
- n = e.tweens.length;
- if (r.keep()) {
- e.add(r)
- }
- }
- }
- if (e.tweens.length == 0) {
- e.ll_show = null
- }
- },
- to: function(t, n, r) {
- if (!t) {
- return
- }
- var i = this;
- var s = new e({}, 0, {});
- i.tweens.push(s);
- i.ll_show = i.frame;
- s.to(t, n, r);
- return s
- },
- add: function(e) {
- this.tweens.push(e)
- },
- remove: function(e) {
- var t = this;
- if (typeof e == UNDEFINED) {
- return
- }
- for (i = 0, l = t.tweens.length; i < l; i++) {
- if (e.objectIndex == t.tweens[i].objectIndex) {
- t.tweens.splice(i, 1);
- break
- }
- }
- },
- removeAll: function() {
- this.tweens.splice(0, this.tweens.length)
- }
- };
- for (var n in t) {
- r.prototype[n] = t[n]
- }
- LTweenLiteTimeline = new r;
- LGlobal.childList.push(LTweenLiteTimeline);
- var s = new r;
- s.TYPE_FRAME = r.TYPE_FRAME;
- s.TYPE_TIMER = r.TYPE_TIMER;
- LGlobal.childList.push(s);
- return s
- }();
- var LAjax = function() {
- function e() {
- this.responseType = null
- }
- e.prototype = {
- TEXT: "text",
- ARRAY_BUFFER: "arraybuffer",
- BLOB: "blob",
- get: function(e, t, n, r) {
- this.getRequest("GET", e, t, n, r)
- },
- post: function(e, t, n, r) {
- this.getRequest("POST", e, t, n, r)
- },
- getRequest: function(e, t, n, r, i) {
- var s = this,
- o, u = "",
- a = "";
- s.err = i;
- var f = s.getHttp();
- if (!f) {
- return
- }
- if (n) {
- for (o in n) {
- u += a + o + "=" + n[o];
- a = "&"
- }
- }
- if (e.toLowerCase() == "get" && u.length > 0) {
- t += (t.indexOf("?") >= 0 ? "&" : "?") + u;
- u = null
- }
- f.open(e, t, true);
- if (s.responseType) {
- f.responseType = s.responseType;
- s.responseType = s.TEXT
- }
- f.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- f.onreadystatechange = function() {
- if (f.readyState == 4) {
- if (f.status >= 200 && f.status < 300 || f.status === 304) {
- if (r) {
- if (f.responseType == s.ARRAY_BUFFER || f.responseType == s.BLOB) {
- r(f.response)
- } else if (f.responseText.length > 0) {
- r(f.responseText)
- } else {
- r(null)
- }
- }
- } else {
- if (i) {
- i(f)
- }
- }
- }
- };
- f.send(u)
- },
- getHttp: function() {
- if (typeof XMLHttpRequest != UNDEFINED) {
- return new XMLHttpRequest
- }
- try {
- return new ActiveXObject("Msxml2.XMLHTTP")
- } catch (e) {
- try {
- return new ActiveXObject("Microsoft.XMLHTTP")
- } catch (e) {
- if (!this.err) {
- this.err(e)
- }
- }
- }
- return false
- }
- };
- return new e
- }();
- var LStageWebView = function() {
- function e() {
- var e = this;
- LExtends(e, LEventDispatcher, []);
- e.display = document.createElement("div");
- e.iframe = document.createElement("iframe");
- e.display.style.position = "absolute";
- e.display.style.marginTop = "0px";
- e.display.style.marginLeft = "0px";
- e.display.style.zIndex = 11;
- e.display.appendChild(e.iframe);
- e.idAdded = false
- }
- var t = {
- loadURL: function(e) {
- var t = this;
- t.iframe.src = e;
- t.iframe.onload = function() {
- t.dispatchEvent(LEvent.COMPLETE)
- }
- },
- show: function() {
- var e = this;
- if (!e.idAdded) {
- LGlobal.object.appendChild(e.display);
- e.idAdded = true
- }
- if (e.display.style.display == "none") {
- e.display.style.display = ""
- }
- },
- die: function() {
- LGlobal.object.removeChild(this.display);
- this.idAdded = false
- },
- hide: function() {
- this.display.style.display = "none"
- },
- setViewPort: function(e) {
- var t = this,
- n = parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width,
- r = parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height;
- t.display.style.marginTop = parseInt(LGlobal.canvasObj.style.marginTop) + (e.y * r >>> 0) + "px";
- t.display.style.marginLeft = parseInt(LGlobal.canvasObj.style.marginLeft) + (e.x * n >>> 0) + "px";
- t.iframe.style.width = t.display.style.width = (e.width * n >>> 0) + "px";
- t.iframe.style.height = t.display.style.height = (e.height * r >>> 0) + "px"
- }
- };
- for (var n in t) {
- e.prototype[n] = t[n]
- }
- return e
- }();
- var FPS = function() {
- function e() {
- var e = this;
- LExtends(e, LSprite, []);
- e.fps = new LTextField;
- e.fpsCount = 0;
- e.fpsTime = (new Date).getTime();
- e.fps.color = "#ffffff";
- e.addChild(e.fps);
- e.addEventListener(LEvent.ENTER_FRAME, e.showFPS)
- }
- e.prototype.showFPS = function(e) {
- e.fpsCount++;
- var t = (new Date).getTime();
- if (t - e.fpsTime < 1e3) return;
- e.fps.text = Math.round(e.fpsCount * 1e4 / (t - e.fpsTime)) / 10;
- e.fpsTime = t;
- e.fpsCount = 0;
- e.graphics.clear();
- e.graphics.drawRect(0, "#000000", [0, 0, e.fps.getWidth(), 20], true, "#000000")
- };
- return e
- }();
- var LQuadTree = function() {
- function e(e) {
- var t = this;
- LExtends(t, LObject, []);
- t.q1 = null;
- t.q2 = null;
- t.q3 = null;
- t.q4 = null;
- t.parent = null;
- t.data = [];
- t.rect = e;
- t.root = t
- }
- e.prototype = {
- createChildren: function(t) {
- if (t == 0) {
- return
- }
- var n = this;
- var r = n.rect.width / 2,
- i = n.rect.height / 2;
- n.q1 = new e(new LRectangle(n.rect.x + r, n.rect.y, r, i));
- n.q2 = new e(new LRectangle(n.rect.x + r, n.rect.y + i, r, i));
- n.q3 = new e(new LRectangle(n.rect.x, n.rect.y + i, r, i));
- n.q4 = new e(new LRectangle(n.rect.x, n.rect.y, r, i));
- n.q1.parent = n.q2.parent = n.q3.parent = n.q4.parent = n;
- n.q1.root = n.q2.root = n.q3.root = n.q4.root = n.root;
- n.q1.createChildren(t - 1);
- n.q2.createChildren(t - 1);
- n.q3.createChildren(t - 1);
- n.q4.createChildren(t - 1)
- },
- hasChildren: function() {
- var e = this;
- return e.q1 && e.q2 && e.q3 && e.q4
- },
- clear: function() {
- var e = this;
- if (e.hasChildren()) {
- return e.q1.clear() || e.q2.clear() || e.q3.clear() || e.q4.clear()
- } else {
- e.q1 = null;
- e.q2 = null;
- e.q3 = null;
- e.q4 = null;
- e.parent = null;
- e.data = [];
- return e
- }
- },
- add: function(e, t, n) {
- var r = this;
- if (!r.isIn(t, n)) {
- return null
- }
- if (r.hasChildren()) {
- return r.q1.add(e, t, n) || r.q2.add(e, t, n) || r.q3.add(e, t, n) || r.q4.add(e, t, n)
- } else {
- r.data.push(e);
- return r
- }
- },
- remove: function(e, t, n) {
- var r = this;
- if (!r.isIn(t, n)) {
- return null
- }
- if (r.hasChildren()) {
- return r.q1.remove(e, t, n) || r.q2.remove(e, t, n) || r.q3.remove(e, t, n) || r.q4.remove(e, t, n)
- } else {
- var i = r.data.indexOf(e);
- if (i != -1) {
- r.data.splice(i, 1);
- return r
- } else {
- return null
- }
- }
- },
- isIn: function(e, t) {
- var n = this;
- return (typeof e == UNDEFINED || e >= n.rect.x && e < n.rect.right) && (typeof t == UNDEFINED || t >= n.rect.y && t < n.rect.bottom)
- },
- getDataInRect: function(e) {
- var t = this;
- if (!t.rect.intersects(e)) {
- return []
- }
- var n = t.data.concat();
- if (t.hasChildren()) {
- n.push.apply(n, t.q1.getDataInRect(e));
- n.push.apply(n, t.q2.getDataInRect(e));
- n.push.apply(n, t.q3.getDataInRect(e));
- n.push.apply(n, t.q4.getDataInRect(e))
- }
- return n
- }
- };
- return e
- }();
- var LoadingSample1 = function() {
- function e(e, t, n) {
- base(this, LSprite, []);
- var r = this;
- r.numberList = new Array([1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1], [1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1]);
- r.backgroundColor = t == null ? "#000000" : t;
- r.color = n == null ? "#ffffff" : n;
- r.progress = 0;
- r.step = e == null ? LGlobal.width * .5 / 15 : e;
- r.back = new LSprite;
- r.addChild(r.back);
- r.num = new LSprite;
- r.addChild(r.num);
- r.num.mask = new LSprite;
- r.screenX = (LGlobal.width - r.step * 15) / 2;
- r.screenY = (LGlobal.height - r.step * 5) / 2;
- r.num.x = r.screenX;
- r.num.y = r.screenY;
- r.setProgress(r.progress)
- }
- e.prototype.setProgress = function(e) {
- var t = this,
- n = LGlobal.canvas;
- var r = "",
- i, s, o;
- var u = t.step;
- if (e >= 100) {
- r = t.getNumber(1);
- i = t.getNumber(0);
- s = t.getNumber(0);
- u = t.step * 3
- } else if (e >= 10) {
- i = t.getNumber(Math.floor(e / 10));
- s = t.getNumber(e % 10)
- } else {
- i = t.getNumber(0);
- s = t.getNumber(e)
- }
- t.back.graphics.clear();
- t.back.graphics.add(function() {
- n.beginPath();
- n.fillStyle = t.backgroundColor;
- n.fillRect(0, 0, LGlobal.width, LGlobal.height);
- n.closePath();
- n.fillStyle = t.color;
- if (e >= 100) {
- for (o = 0; o < r.length; o++) {
- if (r[o] == 0) {
- continue
- }
- n.fillRect(t.screenX + Math.floor(o % 3) * t.step, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- }
- for (o = 0; o < i.length; o++) {
- if (i[o] == 0) {
- continue
- }
- n.fillRect(t.screenX + u + Math.floor(o % 3) * t.step, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- for (o = 0; o < s.length; o++) {
- if (s[o] == 0) {
- continue
- }
- n.fillRect(t.screenX + u + Math.floor(o % 3) * t.step + t.step * 4, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- n.moveTo(t.screenX + u + t.step * 9.7, t.screenY);
- n.lineTo(t.screenX + u + t.step * 10.5, t.screenY);
- n.lineTo(t.screenX + u + t.step * 9.3, t.screenY + t.step * 5);
- n.lineTo(t.screenX + u + t.step * 8.5, t.screenY + t.step * 5);
- n.lineTo(t.screenX + u + t.step * 9.7, t.screenY);
- n.fill();
- n.moveTo(t.screenX + u + t.step * 8.5, t.screenY + t.step);
- n.arc(t.screenX + u + t.step * 8.5, t.screenY + t.step, t.step * .6, 0, 360 + Math.PI / 180);
- n.moveTo(t.screenX + u + t.step * 10.5, t.screenY + t.step * 4);
- n.arc(t.screenX + u + t.step * 10.5, t.screenY + t.step * 4, t.step * .6, 0, 360 + Math.PI / 180);
- n.fill()
- });
- t.num.mask.graphics.clear();
- t.num.mask.graphics.add(function() {
- if (e >= 100) {
- for (o = 0; o < r.length; o++) {
- if (r[o] == 0) {
- continue
- }
- n.rect(t.screenX + Math.floor(o % 3) * t.step, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- }
- for (var o = 0; o < i.length; o++) {
- if (i[o] == 0) {
- continue
- }
- n.rect(t.screenX + u + Math.floor(o % 3) * t.step, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- for (var o = 0; o < s.length; o++) {
- if (s[o] == 0) {
- continue
- }
- n.rect(t.screenX + u + Math.floor(o % 3) * t.step + t.step * 4, t.screenY + Math.floor(o / 3) * t.step, t.step, t.step)
- }
- });
- n.fillStyle = LGlobal._create_loading_color();
- t.num.graphics.clear();
- t.num.graphics.drawRect(1, n.fillStyle, [0, t.step * 5 * (100 - e) * .01, LGlobal.width, LGlobal.height], true, n.fillStyle)
- };
- e.prototype.getNumber = function(e) {
- return this.numberList[e]
- };
- return e
- }();
- LoadingSample2.prototype.setProgress = function(e) {
- var t = this,
- n = LGlobal.canvas;
- t.progressLabel.text = e + "%";
- t.showLabel.mask.clear();
- t.showLabel.mask.drawRect(0, "#000000", [t.screenX, 0, t.screenWidth * e * .01, LGlobal.height]);
- if (e >= 100) {
- n.shadowOffsetX = 0;
- n.shadowOffsetY = 0
- }
- };
- LoadingSample3.prototype.onframe = function(e) {
- var t, n, r;
- if (e.progress >= 100) {
- if (e.star.length > 0) {
- for (t = 0, r = e.star.length; t < r; t++) {
- e.removeChild(e.star[t])
- }
- e.star.length = 0
- }
- return
- }
- for (t = 0, r = e.star.length; t < r; t++) {
- n = e.star[t];
- n.alpha -= .1;
- n.x += n.speedx;
- n.y += n.speedy;
- if (n.alpha <= 0) {
- e.star.splice(t, 1);
- e.removeChild(n);
- t--, r--
- }
- }
- if (e.star.length < 10) e.addStar()
- };
- LoadingSample3.prototype.addStar = function() {
- var e = this,
- t = LGlobal.canvas;
- var n = new LSprite;
- var r = 1 + Math.floor(Math.random() * 4);
- n.graphics.add(function() {
- t.beginPath();
- t.fillStyle = "#ffffff";
- t.lineTo(r * 2, r);
- t.lineTo(r * 4, 0);
- t.lineTo(r * 3, r * 2);
- t.lineTo(r * 4, r * 4);
- t.lineTo(r * 2, r * 3);
- t.lineTo(0, r * 4);
- t.lineTo(r, r * 2);
- t.lineTo(0, 0);
- t.fill()
- });
- n.x = e.screenX + e.screenWidth * e.progress * .01;
- n.y = e.screenY;
- n.speedx = 4 - 8 * Math.random();
- n.speedy = 4 - 8 * Math.random();
- e.star.push(n);
- e.addChild(n)
- };
- LoadingSample3.prototype.setProgress = function(e) {
- var t = this,
- n = LGlobal.canvas;
- if (e > 100) e = 100;
- t.progress = e;
- t.back.graphics.clear();
- t.back.graphics.add(function() {
- n.beginPath();
- n.fillStyle = "#00FFFF";
- n.rect(t.screenX - 3, t.screenY - 3, t.screenWidth + 6, t.screenHeight + 6);
- n.fill();
- n.beginPath();
- n.fillStyle = "#990033";
- n.rect(t.screenX, t.screenY, t.screenWidth, t.screenHeight);
- n.fill();
- n.beginPath();
- n.fillStyle = t.color;
- n.rect(t.screenX, t.screenY, t.screenWidth * e * .01, t.screenHeight);
- n.fill()
- });
- t.label.text = e + "%"
- };
- LoadingSample4.prototype.onframe = function(e) {
- e.target.arc.rotate += 20
- };
- LoadingSample4.prototype.setProgress = function(e) {
- var t = this;
- if (e > 100) e = 100;
- t.progress = e;
- t.label.text = e + "%";
- t.label.x = LGlobal.width * .5 - t.label.getWidth() * .5
- };
- LoadingSample5.prototype.onframe = function(e) {
- var t = e.target;
- if (t.index++ < t.max) return;
- t.index = 0;
- t.arc.rotate += 30
- };
- LoadingSample5.prototype.setProgress = function(e) {
- var t = this;
- if (e > 100) e = 100;
- t.progress = e;
- t.label.text = e + "%";
- t.label.x = LGlobal.width * .5 - t.label.getWidth() * .5
- };
- LoadingSample6.prototype._addHole = function() {
- var e = this;
- var t = e.holeAmount,
- n = e.holeR * 2 + e.holesx,
- r = e.holeR;
- for (var i = 0; i < t; i++) {
- var s = new LSprite;
- s.x = i * n;
- s.graphics.drawArc(1, "#111", [0, 0, r, 0, 2 * Math.PI], true, "#000");
- s.graphics.drawArc(1, "#333", [0, 0, r, 1.7 * Math.PI, .7 * Math.PI], false);
- e.holeLayer.addChild(s)
- }
- };
- LoadingSample6.prototype.setProgress = function(e) {
- var t = this;
- var n = t.holeR * 2 + t.holesx,
- r = t.holeR;
- t.progress = e / 100;
- var i = new Array;
- while (Math.floor(t.progress / .2) > t.step) {
- var s = r * 2;
- var o = s;
- var u = LGlobal.canvas.createLinearGradient(0, -o * 2, 0, o);
- u.addColorStop(0, "white");
- u.addColorStop(1, t.progressColor);
- var a = new LSprite;
- a.x = t.step * n;
- a.scaleX = 0;
- a.scaleY = 0;
- a.graphics.drawArc(0, "", [0, 0, r, 0, 2 * Math.PI], true, u);
- t.progressLayer.addChild(a);
- i.push(a);
- t.step++
- }
- var f = function(e) {
- var n = new LSprite;
- n.alpha = .9;
- n.x = e.x;
- n.graphics.drawArc(1, t.filterColor, [0, 0, r, 0, 2 * Math.PI], false);
- t.progressLayer.addChild(n);
- var i = new LDropShadowFilter(0, 5, t.filterColor, 10);
- n.filters = [i];
- LTweenLite.to(n, .5, {
- scaleX: 1.7,
- scaleY: 1.7,
- alpha: 0,
- onComplete: function(e) {
- e.parent.removeChild(e)
- }
- })
- };
- for (var l = 0; l < i.length; l++) {
- var c = i[l];
- LTweenLite.to(c, 1, {
- scaleX: 1,
- scaleY: 1,
- onComplete: f
- })
- }
- };
- LoadingSample7.prototype._addHole = function() {
- var e = this;
- var t = e.holeAmount,
- n = e.holeW + e.holesx,
- r = e.holeW,
- i = e.holeH;
- for (var s = 0; s < t; s++) {
- var o = new LSprite;
- o.x = s * n;
- o.graphics.drawRect(1, "#333", [1, 1, e.holeW, e.holeH], false);
- o.graphics.drawRect(1, "#111", [0, 0, e.holeW, e.holeH], true, "#000");
- e.holeLayer.addChild(o);
- var u = LGlobal.canvas.createLinearGradient(0, -i, 0, i);
- u.addColorStop(0, "white");
- u.addColorStop(1, e.progressColor);
- var a = new LSprite;
- a.alpha = 0;
- a.x = s * n;
- a.graphics.drawRect(0, "", [0, 0, e.holeW, e.holeH], true, u);
- e.progressLayer.addChild(a)
- }
- };
- LoadingSample7.prototype.setProgress = function(e) {
- var t = this;
- t.progress = e / 100;
- if (Math.floor(t.progress / .1) > t.step) {
- var n = Math.ceil(t.progress / .1);
- if (n > 10) n = 10;
- for (var r = 0; r < n; r++) {
- var i = t.progressLayer.childList;
- if (i[r].alpha > 0) continue;
- var s = t.progressLayer.childList[r];
- LTweenLite.to(s, 1, {
- alpha: 1
- })
- }
- t.step++
- }
- };
- var LBox2d = function() {
- function e(t, n, r) {
- var i = this;
- Box2D.Dynamics.b2World.prototype.LAddController = Box2D.Dynamics.b2World.prototype.AddController;
- Box2D.Dynamics.b2World.prototype.AddController = function(t) {
- var n = {},
- r;
- for (r in t) {
- n[r] = t[r]
- }
- if (e) {
- e.m_controllerList = n
- }
- return this.LAddController(t)
- };
- var s, o, u = Box2D,
- a, f = [u.Collision, u.Common, u.Common.Math, u.Dynamics, u.Dynamics.Contacts, u.Dynamics.Controllers, u.Dynamics.Joints, u.Collision.Shapes];
- for (s in f) {
- for (o in f[s]) {
- i[o] = f[s][o]
- }
- }
- if (typeof r == UNDEFINED) {
- r = 30
- }
- i.stop = false;
- i.drawScale = 30;
- i.selectedBody = null;
- i.mouseJoint = null;
- i.mousePVec = null;
- i.contactListener = null;
- if (typeof t == UNDEFINED) {
- t = new i.b2Vec2(0, 9.8)
- } else {
- t = new i.b2Vec2(t[0], t[1])
- } if (typeof n == UNDEFINED) {
- n = true
- }
- i.world = new i.b2World(t, n);
- i.removeList = new Array;
- if (LGlobal.traceDebug) {
- a = new i.b2DebugDraw;
- a.SetSprite(LGlobal.canvas);
- a.SetLineThickness(1);
- a.SetFillAlpha(.5);
- a.SetAlpha(1);
- a.SetDrawScale(i.drawScale);
- a.SetFlags(i.b2DebugDraw.e_shapeBit | i.b2DebugDraw.e_jointBit);
- i.world.SetDebugDraw(a)
- }
- LGlobal.destroy = true
- }
- e.prototype = {
- setEvent: function(e, t) {
- var n = this;
- if (e == LEvent.ENTER_FRAME) {
- n.ll_enterFrame = t;
- return
- }
- if (!n.contactListener) {
- n.contactListener = new n.b2ContactListener;
- n.world.SetContactListener(n.contactListener)
- }
- switch (e) {
- case LEvent.END_CONTACT:
- n.contactListener.EndContact = t;
- break;
- case LEvent.PRE_SOLVE:
- n.contactListener.PreSolve = t;
- break;
- case LEvent.POST_SOLVE:
- n.contactListener.PostSolve = t;
- break;
- case LEvent.BEGIN_CONTACT:
- default:
- n.contactListener.BeginContact = t
- }
- },
- setWeldJoint: function(e, t) {
- var n = this;
- var r = new n.b2WeldJointDef;
- r.Initialize(t, e, t.GetWorldCenter());
- return n.world.CreateJoint(r)
- },
- setLineJoint: function(e, t, n, r, i) {
- var s = this;
- var o = new s.b2Vec2(n[0], n[1]);
- var u = new s.b2LineJointDef;
- u.Initialize(e, t, t.GetWorldCenter(), o);
- if (r == null) {
- u.enableLimit = false
- } else {
- u.lowerTranslation = r[0];
- u.upperTranslation = r[1];
- u.enableLimit = true
- } if (i == null) {
- u.enableMotor = false
- } else {
- u.maxMotorForce = i[0];
- u.motorSpeed = i[1];
- u.enableMotor = true
- }
- return s.world.CreateJoint(u)
- },
- setGearJoint: function(e, t, n, r, i) {
- var s = this;
- var o = new s.b2GearJointDef;
- o.joint1 = r;
- o.joint2 = i;
- o.bodyA = e;
- o.bodyB = t;
- o.ratio = n * s.b2Settings.b2_pi / (300 / s.drawScale);
- return s.world.CreateJoint(o)
- },
- setPrismaticJoint: function(e, t, n, r, i) {
- var s = this;
- var o = new s.b2Vec2(n[0], n[1]);
- var u = new s.b2PrismaticJointDef;
- u.Initialize(t, e, t.GetWorldCenter(), o);
- if (r == null) {
- u.enableLimit = false
- } else {
- u.lowerTranslation = r[0];
- u.upperTranslation = r[1];
- u.enableLimit = true
- } if (i == null) {
- u.enableMotor = false
- } else {
- u.maxMotorForce = i[0];
- u.motorSpeed = i[1];
- u.enableMotor = true
- }
- return s.world.CreateJoint(u)
- },
- setRevoluteJoint: function(e, t, n, r) {
- var i = this;
- var s = new i.b2RevoluteJointDef;
- s.Initialize(e, t, t.GetWorldCenter());
- if (n == null) {
- s.enableLimit = false
- } else {
- s.lowerAngle = n[0] * i.b2Settings.b2_pi / 180;
- s.upperAngle = n[1] * i.b2Settings.b2_pi / 180;
- s.enableLimit = true
- } if (r == null) {
- s.enableMotor = false
- } else {
- s.maxMotorTorque = r[0];
- s.motorSpeed = r[1];
- s.enableMotor = true
- }
- return i.world.CreateJoint(s)
- },
- setDistanceJoint: function(e, t) {
- var n = this;
- var r = new n.b2DistanceJointDef;
- r.Initialize(e, t, e.GetWorldCenter(), t.GetWorldCenter());
- return n.world.CreateJoint(r)
- },
- setPulleyJoint: function(e, t, n, r, i) {
- var s = this;
- var o = e.GetWorldCenter();
- var u = t.GetWorldCenter();
- var a = new s.b2Vec2(o.x + n[0] / s.drawScale, o.y + n[1] / s.drawScale);
- var f = new s.b2Vec2(u.x + r[0] / s.drawScale, u.y + r[1] / s.drawScale);
- var l = new s.b2PulleyJointDef;
- l.Initialize(e, t, a, f, o, u, i);
- l.maxLengthA = n[2] / s.drawScale;
- l.maxLengthB = r[2] / s.drawScale;
- return s.world.CreateJoint(l)
- },
- addCircle: function(e, t, n, r, i, s, o) {
- var u = this;
- u.bodyDef = new u.b2BodyDef;
- u.bodyDef.type = r;
- u.fixDef = new u.b2FixtureDef;
- u.fixDef.density = i;
- u.fixDef.friction = s;
- u.fixDef.restitution = o;
- u.fixDef.shape = new u.b2CircleShape(e);
- u.bodyDef.position.x = t;
- u.bodyDef.position.y = n;
- var a = u.world.CreateBody(u.bodyDef);
- a.CreateFixture(u.fixDef);
- return a
- },
- addPolygon: function(e, t, n, r, i, s, o, u) {
- var a = this;
- a.bodyDef = new a.b2BodyDef;
- a.bodyDef.type = i;
- a.fixDef = new a.b2FixtureDef;
- a.fixDef.density = s;
- a.fixDef.friction = o;
- a.fixDef.restitution = u;
- a.fixDef.shape = new a.b2PolygonShape;
- a.fixDef.shape.SetAsBox(e, t);
- a.bodyDef.position.x = n;
- a.bodyDef.position.y = r;
- var f = a.world.CreateBody(a.bodyDef);
- f.CreateFixture(a.fixDef);
- return f
- },
- addVertices: function(e, t, n, r, i) {
- var s = this,
- o, u;
- s.bodyDef = new s.b2BodyDef;
- s.bodyDef.type = t;
- var a = s.world.CreateBody(s.bodyDef);
- for (o = 0, u = e.length; o < u; o++) {
- s.createShapeAsArray(a, e[o], t, n, r, i)
- }
- return a
- },
- createShapeAsArray: function(e, t, n, r, i, s) {
- var o = this;
- var u = new o.b2PolygonShape;
- var a = o.createVerticesArray(t);
- u.SetAsArray(a, 0);
- var f = new o.b2FixtureDef;
- f.shape = u;
- f.density = r;
- f.friction = i;
- f.restitution = s;
- e.CreateFixture(f)
- },
- createVerticesArray: function(e) {
- var t = this,
- n, r;
- var i = new Array;
- if (e.length < 3) {
- return i
- }
- for (n = 0, r = e.length; n < r; n++) {
- i.push(new t.b2Vec2(e[n][0] / t.drawScale, e[n][1] / t.drawScale))
- }
- return i
- },
- getBodyAtMouse: function(e, t) {
- var n = this;
- n.mousePVec = new n.b2Vec2(e, t);
- var r = new n.b2AABB;
- r.lowerBound.Set(e - .001, t - .001);
- r.upperBound.Set(e + .001, t + .001);
- n.selectedBody = null;
- n.world.QueryAABB(n.getBodyCallBack, r);
- return n.selectedBody
- },
- getBodyCallBack: function(e) {
- var t = LGlobal.box2d;
- if (e.GetBody().GetType() != t.b2Body.b2_staticBody) {
- if (e.GetShape().TestPoint(e.GetBody().GetTransform(), t.mousePVec)) {
- t.selectedBody = e.GetBody();
- return false
- }
- }
- return true
- },
- ll_show: function() {
- var e = this,
- t = null;
- for (t in e.removeList) {
- e.world.DestroyBody(e.removeList[t])
- }
- e.removeList.splice(0, e.removeList.length);
- if (e.stop) {
- return
- }
- if (e.ll_enterFrame) {
- e.ll_enterFrame({
- target: e
- })
- }
- e.world.Step(1 / 30, 10, 10);
- e.world.ClearForces();
- if (LGlobal.traceDebug) {
- e.world.DrawDebugData()
- }
- },
- synchronous: function() {
- var t = this;
- var n = null,
- r, i = null,
- s = 0,
- o = 0,
- u, a;
- for (u = t.world.GetBodyList(); u; u = u.GetNext()) {
- r = u.GetUserData();
- if (r) {
- if (i == null) {
- n = r.parent;
- s = u.GetPosition().x;
- o = u.GetPosition().y
- }
- u.SetPosition(new t.b2Vec2((r.x + r.rotatex + n.x) / t.drawScale, (r.y + r.rotatey + n.y) / t.drawScale));
- if (i == null) {
- i = {
- x: u.GetPosition().x - s,
- y: u.GetPosition().y - o
- }
- }
- }
- }
- for (a = t.world.GetJointList(); a; a = a.GetNext()) {
- if (a.m_groundAnchor1) {
- a.m_groundAnchor1.x += i.x;
- a.m_groundAnchor1.y += i.y
- }
- if (a.m_groundAnchor2) {
- a.m_groundAnchor2.x += i.x;
- a.m_groundAnchor2.y += i.y
- }
- }
- if (e.m_controllerList && t.world.m_controllerList && n) {
- LGlobal.box2d.world.m_controllerList.offset = e.m_controllerList.offset - n.y / LGlobal.box2d.drawScale
- }
- }
- };
- return e
- }();
- LSprite.prototype.setBodyMouseJoint = function(e) {
- var t = this;
- if (!t.box2dBody) {
- return
- }
- t.box2dBody.mouseJoint = e
- };
- LSprite.prototype.clearBody = function(e) {
- var t = this;
- if (!t.box2dBody) {
- return
- }
- LGlobal.box2d.removeList.push(t.box2dBody);
- t.box2dBody = null
- };
- LSprite.prototype.addBodyCircle = function(e, t, n, r, i, s, o) {
- var u = this;
- u.rotatex = e;
- u.rotatey = e;
- u.box2dBody = LGlobal.box2d.addCircle(e / LGlobal.box2d.drawScale, (u.x + t) / LGlobal.box2d.drawScale, (u.y + n) / LGlobal.box2d.drawScale, r == 1 ? LGlobal.box2d.b2Body.b2_dynamicBody : LGlobal.box2d.b2Body.b2_staticBody, i == null ? .5 : i, s == null ? .4 : s, o == null ? .8 : o);
- u.box2dBody.SetUserData(u)
- };
- LSprite.prototype.addBodyPolygon = function(e, t, n, r, i, s) {
- var o = this;
- o.rotatex = e / 2;
- o.rotatey = t / 2;
- o.box2dBody = LGlobal.box2d.addPolygon(e * .5 / LGlobal.box2d.drawScale, t * .5 / LGlobal.box2d.drawScale, o.x / LGlobal.box2d.drawScale, o.y / LGlobal.box2d.drawScale, n == 1 ? LGlobal.box2d.b2Body.b2_dynamicBody : LGlobal.box2d.b2Body.b2_staticBody, r == null ? .5 : r, i == null ? .4 : i, s == null ? .8 : s);
- o.box2dBody.SetUserData(o)
- };
- LSprite.prototype.addBodyVertices = function(e, t, n, r, i, s, o) {
- var u = this;
- u.rotatex = 0;
- u.rotatey = 0;
- u.box2dBody = LGlobal.box2d.addVertices(e, r == 1 ? LGlobal.box2d.b2Body.b2_dynamicBody : LGlobal.box2d.b2Body.b2_staticBody, i, s, o);
- u.box2dBody.SetUserData(u);
- u.box2dBody.SetPosition(new LGlobal.box2d.b2Vec2((u.x + t) / LGlobal.box2d.drawScale, (u.y + n) / LGlobal.box2d.drawScale))
- };
- LGlobal.mouseJoint_start = function(e) {
- if (!LGlobal.IS_MOUSE_DOWN || !LGlobal.box2d || LGlobal.box2d.mouseJoint || LGlobal.box2d.stop) {
- return
- }
- var t = e.offsetX / LGlobal.box2d.drawScale,
- n = e.offsetY / LGlobal.box2d.drawScale,
- r = LGlobal.box2d.getBodyAtMouse(t, n);
- if (r && r.mouseJoint) {
- var i = new LGlobal.box2d.b2MouseJointDef;
- i.bodyA = LGlobal.box2d.world.GetGroundBody();
- i.bodyB = r;
- i.target.Set(t, n);
- i.collideConnected = true;
- i.maxForce = 3e5 * r.GetMass();
- LGlobal.box2d.mouseJoint = LGlobal.box2d.world.CreateJoint(i);
- r.SetAwake(true)
- }
- };
- LGlobal.mouseJoint_move = function(e) {
- if (!LGlobal.IS_MOUSE_DOWN || !LGlobal.box2d || !LGlobal.box2d.mouseJoint) {
- return
- }
- mX = e.offsetX / LGlobal.box2d.drawScale, mY = e.offsetY / LGlobal.box2d.drawScale;
- LGlobal.box2d.mouseJoint.SetTarget(new LGlobal.box2d.b2Vec2(mX, mY))
- };
- LGlobal.mouseJoint_end = function() {
- if (LGlobal.box2d != null && LGlobal.box2d.mouseJoint) {
- LGlobal.box2d.world.DestroyJoint(LGlobal.box2d.mouseJoint);
- LGlobal.box2d.mouseJoint = null
- }
- };
- var LTransition = function() {
- function e(e, t) {
- this.child = e;
- this.trans = t
- }
- e.prototype = {
- startTransition: function() {
- var t = this;
- switch (t.trans.type) {
- case e.Blinds:
- t.blinds();
- break;
- case e.Fade:
- t.fade();
- break;
- case e.Fly:
- t.fly();
- break;
- case e.Iris:
- t.iris();
- break;
- case e.Squeeze:
- t.squeeze();
- break;
- case e.Wipe:
- t.wipe();
- break;
- case e.Zoom:
- t.zoom();
- break;
- case e.PixelDissolve:
- t.pixelDissolve();
- break;
- case e.Curtain:
- t.curtain();
- break;
- default:
- throw "the type is not exists."
- }
- },
- blindsComplete: function(t) {
- if (t.trans.direction == e.OUT) {
- t.child.mask.clear()
- } else {
- t.blindsUpdateRun()
- }
- t.child.mask = null;
- if (t.trans.onComplete) {
- t.trans.onComplete(t.child)
- }
- },
- blindsUpdateRun: function() {
- var e = this,
- t = e.child.mask,
- n = LGlobal.canvas;
- t.clear();
- if (e.trans.dimension) {
- t.add(function() {
- n.save();
- for (var t = 0; t < e.trans.numStrips; t++) {
- n.rect(t * e.maxSize, 0, e.blindsSize, e.child.getHeight())
- }
- n.restore()
- })
- } else {
- t.add(function() {
- n.save();
- for (var t = 0; t < e.trans.numStrips; t++) {
- n.rect(0, 0 + t * e.maxSize, e.child.getWidth(), e.blindsSize)
- }
- n.restore()
- })
- }
- },
- blindsUpdate: function(e) {
- e.blindsUpdateRun();
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- blinds: function() {
- var t = this;
- if (!t.trans.numStrips) t.trans.numStrips = 1;
- t.blindsSize = 0;
- if (t.trans.dimension) {
- t.maxSize = t.child.getWidth() / t.trans.numStrips >> 0
- } else {
- t.maxSize = t.child.getHeight() / t.trans.numStrips >> 0
- }
- var n = new LGraphics;
- t.child.mask = n;
- var r = t.maxSize;
- if (t.trans.direction == e.OUT) {
- t.blindsSize = t.maxSize;
- r = 0
- }
- LTweenLite.to(t, t.trans.duration, {
- blindsSize: r,
- onComplete: t.blindsComplete,
- onUpdate: t.blindsUpdate,
- ease: t.trans.easing
- })
- },
- fadeComplete: function(e) {
- e.child.alpha = e.alpha;
- if (e.trans.onComplete) {
- e.trans.onComplete(e.child)
- }
- },
- fadeUpdate: function(e) {
- e.child.alpha = e.alpha;
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- fade: function() {
- var t = this;
- var n = 1;
- t.alpha = 0;
- if (t.trans.direction == e.OUT) {
- t.alpha = 1;
- n = 0
- }
- t.child.alpha = t.alpha;
- LTweenLite.to(t, t.trans.duration, {
- alpha: n,
- onComplete: t.fadeComplete,
- onUpdate: t.fadeUpdate,
- ease: t.trans.easing
- })
- },
- flyComplete: function(e) {
- e.child.x = e.x;
- e.child.y = e.y;
- if (e.trans.onComplete) {
- e.trans.onComplete(e.child)
- }
- },
- flyUpdate: function(e) {
- e.child.x = e.x;
- e.child.y = e.y;
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- fly: function() {
- var t = this;
- var n = t.child.x;
- var r = t.child.y;
- switch (t.trans.startPoint) {
- case 1:
- t.x = -t.child.getWidth();
- t.y = -t.child.getHeight();
- break;
- case 2:
- t.x = (LGlobal.width - t.child.getWidth()) * .5;
- t.y = -t.child.getHeight();
- break;
- case 3:
- t.x = LGlobal.width;
- t.y = -t.child.getHeight();
- break;
- case 4:
- t.x = -t.child.getWidth();
- t.y = (LGlobal.height - t.child.getHeight()) * .5;
- break;
- case 6:
- t.x = LGlobal.width;
- t.y = (LGlobal.height - t.child.getHeight()) * .5;
- break;
- case 7:
- t.x = -t.child.getWidth();
- t.y = LGlobal.height;
- break;
- case 8:
- t.x = (LGlobal.width - t.child.getWidth()) * .5;
- t.y = LGlobal.height;
- break;
- case 9:
- t.x = LGlobal.width;
- t.y = LGlobal.height;
- break;
- case 5:
- default:
- t.x = (LGlobal.width - t.child.getWidth()) * .5;
- t.y = (LGlobal.height - t.child.getHeight()) * .5
- }
- if (t.trans.direction == e.OUT) {
- var n = t.x;
- var r = t.y;
- t.x = t.child.x;
- t.y = t.child.y
- } else {
- t.child.x = t.x;
- t.child.y = t.y
- }
- LTweenLite.to(t, t.trans.duration, {
- x: n,
- y: r,
- onComplete: t.flyComplete,
- onUpdate: t.flyUpdate,
- ease: t.trans.easing
- })
- },
- irisComplete: function(t) {
- if (t.trans.direction == e.OUT) {
- t.child.mask.clear()
- } else {
- t.irisUpdateRun()
- }
- t.child.mask = null;
- if (t.trans.onComplete) {
- t.trans.onComplete(t.child)
- }
- },
- irisUpdateRun: function() {
- var e = this,
- t = e.child.mask,
- n = LGlobal.canvas;
- t.clear();
- if (e.trans.shape == LIris.CIRCLE) {
- t.drawArc(0, "#000000", [e.x, e.y, e.r, 0, Math.PI * 2])
- } else {
- t.drawRect(0, "#000000", [e.x + e.sLeft, e.y + e.sTop, e.width, e.height])
- }
- },
- irisUpdate: function(e) {
- e.irisUpdateRun();
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- iris: function() {
- var t = this;
- t.sLeft = 0;
- t.sTop = 0;
- t.width = 0;
- t.height = 0;
- t.x = 0;
- t.y = 0;
- t.r = 0;
- t.eWidth = t.child.getWidth();
- t.eHeight = t.child.getHeight();
- switch (t.trans.startPoint) {
- case 1:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * t.eHeight);
- break;
- case 2:
- t.eR = Math.sqrt(t.eWidth * .5 * t.eWidth * .5 + t.eHeight * t.eHeight);
- t.x = t.child.getWidth() * .5;
- break;
- case 3:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * t.eHeight);
- t.x = t.child.getWidth();
- break;
- case 4:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * .5 * t.eHeight * .5);
- t.y = t.child.getHeight() * .5;
- break;
- case 6:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * .5 * t.eHeight * .5);
- t.x = t.child.getWidth();
- t.y = t.child.getHeight() * .5;
- break;
- case 7:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * t.eHeight);
- t.y = t.child.getHeight();
- break;
- case 8:
- t.eR = Math.sqrt(t.eWidth * .5 * t.eWidth * .5 + t.eHeight * t.eHeight);
- t.x = t.child.getWidth() * .5;
- t.y = t.child.getHeight();
- break;
- case 9:
- t.eR = Math.sqrt(t.eWidth * t.eWidth + t.eHeight * t.eHeight);
- t.x = t.child.getWidth();
- t.y = t.child.getHeight();
- break;
- case 5:
- default:
- t.eR = Math.sqrt(t.eWidth * .5 * t.eWidth * .5 + t.eHeight * .5 * t.eHeight * .5);
- t.x = t.child.getWidth() * .5;
- t.y = t.child.getHeight() * .5
- }
- t.eLeft = -t.x;
- t.eTop = -t.y;
- var n = new LGraphics;
- t.child.mask = n;
- var r = t.maxSize;
- if (t.trans.direction == e.OUT) {
- t.sLeft = t.eLeft;
- t.sTop = t.eTop;
- t.eLeft = 0;
- t.eTop = 0;
- t.width = t.eWidth;
- t.height = t.eHeight;
- t.eWidth = 0;
- t.eHeight = 0;
- t.r = t.eR;
- t.eR = 0
- }
- LTweenLite.to(t, t.trans.duration, {
- width: t.eWidth,
- height: t.eHeight,
- sLeft: t.eLeft,
- sTop: t.eTop,
- r: t.eR,
- onComplete: t.irisComplete,
- onUpdate: t.irisUpdate,
- ease: t.trans.easing
- })
- },
- curtainComplete: function(t) {
- if (t.trans.direction == e.OUT) {
- t.child.mask.clear()
- } else {
- t.curtainUpdateRun()
- }
- t.child.mask = null;
- if (t.trans.onComplete) {
- t.trans.onComplete(t.child)
- }
- },
- curtainUpdateRun: function() {
- var e = this,
- t = e.child.mask,
- n = LGlobal.canvas;
- t.clear();
- if (e.trans.dimension) {
- t.add(function() {
- n.save();
- n.rect(0, 0, e.width, e.child.getHeight());
- n.rect(e.child.getWidth() - e.width, 0, e.width, e.child.getHeight());
- n.restore()
- })
- } else {
- t.add(function() {
- n.save();
- n.rect(0, 0, e.child.getWidth(), e.height);
- n.rect(0, e.child.getHeight() - e.height, e.child.getWidth(), e.height);
- n.restore()
- })
- }
- },
- curtainUpdate: function(e) {
- e.curtainUpdateRun();
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- curtain: function() {
- var t = this;
- var n = t.child.getWidth() * .5;
- var r = t.child.getHeight() * .5;
- if (t.trans.dimension) {
- r = 0
- } else {
- n = 0
- }
- t.width = 0;
- t.height = 0;
- var i = new LGraphics;
- t.child.mask = i;
- var s = t.maxSize;
- if (t.trans.direction == e.OUT) {
- t.width = n;
- t.height = r;
- n = 0;
- r = 0
- }
- LTweenLite.to(t, t.trans.duration, {
- width: n,
- height: r,
- onComplete: t.curtainComplete,
- onUpdate: t.curtainUpdate,
- ease: t.trans.easing
- })
- },
- squeezeComplete: function(e) {
- e.child.scaleX = e.scaleX;
- e.child.scaleY = e.scaleY;
- if (e.trans.onComplete) {
- e.trans.onComplete(e.child)
- }
- },
- squeezeUpdate: function(e) {
- e.child.scaleX = e.scaleX;
- e.child.scaleY = e.scaleY;
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- squeeze: function() {
- var t = this;
- var n = 1,
- r = 1;
- t.scaleX = 0, t.scaleY = 0;
- if (t.trans.dimension) {
- t.scaleX = 1
- } else {
- t.scaleY = 1
- } if (t.trans.direction == e.OUT) {
- n = t.scaleX, r = t.scaleY;
- t.scaleX = 1, t.scaleY = 1
- }
- t.child.scaleX = t.scaleX;
- t.child.scaleY = t.scaleY;
- LTweenLite.to(t, t.trans.duration, {
- scaleX: n,
- scaleY: r,
- onComplete: t.squeezeComplete,
- onUpdate: t.squeezeUpdate,
- ease: t.trans.easing
- })
- },
- zoomComplete: function(e) {
- e.child.scaleX = e.scaleX;
- e.child.scaleY = e.scaleY;
- if (e.trans.onComplete) {
- e.trans.onComplete(e.child)
- }
- },
- zoomUpdate: function(e) {
- e.child.scaleX = e.scaleX;
- e.child.scaleY = e.scaleY;
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- zoom: function() {
- var t = this;
- var n = 1,
- r = 1;
- t.scaleX = 0, t.scaleY = 0;
- if (t.trans.direction == e.OUT) {
- n = 0, r = 0;
- t.scaleX = 1, t.scaleY = 1
- }
- t.child.scaleX = t.scaleX;
- t.child.scaleY = t.scaleY;
- LTweenLite.to(t, t.trans.duration, {
- scaleX: n,
- scaleY: r,
- onComplete: t.zoomComplete,
- onUpdate: t.zoomUpdate,
- ease: t.trans.easing
- })
- },
- wipeComplete: function(t) {
- if (t.trans.direction == e.OUT) {
- t.child.mask.clear()
- } else {
- t.wipeUpdateRun()
- }
- t.child.mask = null;
- if (t.trans.onComplete) {
- t.trans.onComplete(t.child)
- }
- },
- wipeUpdateRun: function() {
- var e = this,
- t = e.child.mask,
- n = LGlobal.canvas;
- t.clear();
- t.drawVertices(0, "#000000", [
- [e.leftTopX, e.leftTopY],
- [e.leftBottomX, e.leftBottomY],
- [e.rightBottomX, e.rightBottomY],
- [e.rightTopX, e.rightTopY]
- ])
- },
- wipeUpdate: function(e) {
- e.wipeUpdateRun();
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- wipe: function() {
- var t = this,
- n = t.child.getWidth(),
- r = t.child.getHeight(),
- i = t.leftTopX = 0,
- s = t.leftTopY = 0,
- o = t.leftBottomX = 0,
- u = t.leftBottomY = r,
- a = t.rightTopX = n,
- f = t.rightTopY = 0,
- l = t.rightBottomX = n,
- c = t.rightBottomY = r;
- switch (t.trans.startPoint) {
- case 1:
- i = t.leftTopX = -n;
- o = t.leftBottomX = -n * 2;
- t.rightTopX = 0;
- a = n * 2;
- t.rightBottomX = -n;
- l = n;
- break;
- case 2:
- s = t.leftTopY = -r;
- t.leftBottomY = 0;
- u = r;
- f = t.rightTopY = -r;
- t.rightBottomY = 0;
- c = r;
- break;
- case 3:
- t.leftTopX = n;
- i = -n;
- t.leftBottomX = n * 2;
- o = 0;
- a = t.rightTopX = n * 2;
- l = t.rightBottomX = n * 3;
- break;
- case 4:
- t.rightTopX = 0;
- a = n;
- t.rightBottomX = 0;
- l = n;
- break;
- case 6:
- t.leftTopX = n;
- i = 0;
- t.leftBottomX = n;
- o = 0;
- break;
- case 7:
- o = t.leftBottomX = -n;
- i = t.leftTopX = -n * 2;
- t.rightBottomX = 0;
- l = n * 2;
- t.rightTopX = -n;
- a = n;
- break;
- case 8:
- u = t.leftBottomY = r;
- t.leftTopY = r;
- s = 0;
- c = t.rightBottomY = r;
- t.rightTopY = r;
- f = 0;
- break;
- case 9:
- t.leftBottomX = n;
- o = -n;
- t.leftTopX = n * 2;
- i = 0;
- l = t.rightBottomX = n * 2;
- a = t.rightTopX = n * 3;
- break;
- case 5:
- default:
- t.leftTopX = n * .5;
- t.leftTopY = r * .5;
- t.rightTopX = n * .5;
- t.rightTopY = r * .5;
- t.leftBottomX = n * .5;
- t.leftBottomY = r * .5;
- t.rightBottomX = n * .5;
- t.rightBottomY = r * .5;
- i = 0, s = 0;
- o = 0, u = r;
- a = n, f = 0;
- l = n, c = r
- }
- var h = new LGraphics;
- t.child.mask = h;
- if (t.trans.direction == e.OUT) {
- var p = i,
- d = s,
- v = o,
- m = u,
- g = a,
- y = f,
- b = l,
- w = c;
- i = t.leftTopX, s = t.leftTopY, o = t.leftBottomX, u = t.leftBottomY, a = t.rightTopX, f = t.rightTopY, l = t.rightBottomX, c = t.rightBottomY;
- t.leftTopX = p, t.leftTopY = d, t.leftBottomX = v, t.leftBottomY = m, t.rightTopX = g, t.rightTopY = y, t.rightBottomX = b, t.rightBottomY = w
- }
- LTweenLite.to(t, t.trans.duration, {
- leftTopX: i,
- leftTopY: s,
- leftBottomX: o,
- leftBottomY: u,
- rightTopX: a,
- rightTopY: f,
- rightBottomX: l,
- rightBottomY: c,
- onComplete: t.wipeComplete,
- onUpdate: t.wipeUpdate,
- ease: t.trans.easing
- })
- },
- pixelDissolveComplete: function(t) {
- if (t.trans.direction == e.OUT) {
- t.child.mask.clear()
- } else {
- t.pixelDissolveUpdateRun()
- }
- t.child.mask = null;
- if (t.trans.onComplete) {
- t.trans.onComplete(t.child)
- }
- },
- pixelDissolveUpdateRun: function() {
- var e = this,
- t = e.child.mask,
- n = LGlobal.canvas,
- r;
- t.clear();
- t.add(function() {
- n.save();
- for (var t = 0; t < e.index; t++) {
- r = e.list[t];
- n.rect(r[0] * e.w, r[1] * e.h, e.w, e.h)
- }
- n.restore()
- })
- },
- pixelDissolveUpdate: function(e) {
- e.pixelDissolveUpdateRun();
- if (e.trans.onUpdate) {
- e.trans.onUpdate(e.child)
- }
- },
- pixelDissolve: function() {
- var t = this;
- var n = new LGraphics;
- t.child.mask = n;
- LGlobal.mg = n;
- t.w = t.child.getWidth() / t.trans.xSections, t.h = t.child.getHeight() / t.trans.ySections;
- t.list = [];
- for (var r = 0; r < t.trans.xSections; r++) {
- for (var i = 0; i < t.trans.ySections; i++) {
- t.list.push([r, i])
- }
- }
- t.index = 0;
- var s = t.trans.xSections * t.trans.ySections;
- if (t.trans.direction == e.OUT) {
- t.index = s;
- s = 0
- }
- t.list = t.list.sort(function(e, t) {
- return Math.random() > .5
- });
- t.pixelDissolveUpdateRun();
- LTweenLite.to(t, t.trans.duration, {
- index: s,
- onComplete: t.pixelDissolveComplete,
- onUpdate: t.pixelDissolveUpdate,
- ease: t.trans.easing
- })
- }
- };
- e.IN = "in";
- e.OUT = "out";
- e.Blinds = 1;
- e.Fade = 2;
- e.Fly = 3;
- e.Iris = 4;
- e.Curtain = 5;
- e.PixelDissolve = 6;
- e.Squeeze = 7;
- e.Wipe = 8;
- e.Zoom = 9;
- return e
- }();
- var LIris = function() {
- function e() {}
- e.SQUARE = 0;
- e.CIRCLE = 1;
- return e
- }();
- var LTransitionManager = function() {
- function e(e) {
- this.child = e
- }
- e.prototype = {
- startTransition: function(t) {
- return e.start(this.child, t)
- }
- };
- e.start = function(e, t) {
- var n = new LTransition(e, t);
- n.startTransition();
- return n
- };
- return e
- }();
- var LFlash = function() {
- function e() {}
- e.SpriteSheetConvert = function(e) {
- var t = [],
- n;
- for (var r = 0; r < e.length; r++) {
- n = e[r];
- t.push({
- x: n.frame.x,
- sx: n.spriteSourceSize.x,
- y: n.frame.y,
- sy: n.spriteSourceSize.y,
- width: n.frame.w,
- height: n.frame.h
- })
- }
- return t
- };
- return e
- }();
- var LString = {
- trim: function(e) {
- return e.replace(/(^\s*)|(\s*$)|(\n)/g, "")
- },
- leftTrim: function(e) {
- return e.replace(/(^\s*)|(^\n)/g, "")
- },
- rightTrim: function(e) {
- return e.replace(/(\s*$)|(\n$)/g, "")
- },
- numberFormat: function(e, t) {
- if (!t || t < 1) {
- t = 3
- }
- e = String(e).split(".");
- e[0] = e[0].replace(new RegExp("(\\d)(?=(\\d{" + t + "})+$)", "ig"), "$1,");
- return e.join(".")
- },
- isString: function(e) {
- var t = /^([a-z]|[A-Z])+$/;
- return t.exec(e)
- },
- isNumber: function(e) {
- var t = /^\d+\.\d+$/;
- return t.exec(e)
- },
- isInt: function(e) {
- var t = /^\d+$/;
- return t.exec(e)
- }
- };
- LMath = LString
|