12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578 |
- (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
- module.exports={
- "O_RDONLY": 0,
- "O_WRONLY": 1,
- "O_RDWR": 2,
- "S_IFMT": 61440,
- "S_IFREG": 32768,
- "S_IFDIR": 16384,
- "S_IFCHR": 8192,
- "S_IFBLK": 24576,
- "S_IFIFO": 4096,
- "S_IFLNK": 40960,
- "S_IFSOCK": 49152,
- "O_CREAT": 512,
- "O_EXCL": 2048,
- "O_NOCTTY": 131072,
- "O_TRUNC": 1024,
- "O_APPEND": 8,
- "O_DIRECTORY": 1048576,
- "O_NOFOLLOW": 256,
- "O_SYNC": 128,
- "O_SYMLINK": 2097152,
- "O_NONBLOCK": 4,
- "S_IRWXU": 448,
- "S_IRUSR": 256,
- "S_IWUSR": 128,
- "S_IXUSR": 64,
- "S_IRWXG": 56,
- "S_IRGRP": 32,
- "S_IWGRP": 16,
- "S_IXGRP": 8,
- "S_IRWXO": 7,
- "S_IROTH": 4,
- "S_IWOTH": 2,
- "S_IXOTH": 1,
- "E2BIG": 7,
- "EACCES": 13,
- "EADDRINUSE": 48,
- "EADDRNOTAVAIL": 49,
- "EAFNOSUPPORT": 47,
- "EAGAIN": 35,
- "EALREADY": 37,
- "EBADF": 9,
- "EBADMSG": 94,
- "EBUSY": 16,
- "ECANCELED": 89,
- "ECHILD": 10,
- "ECONNABORTED": 53,
- "ECONNREFUSED": 61,
- "ECONNRESET": 54,
- "EDEADLK": 11,
- "EDESTADDRREQ": 39,
- "EDOM": 33,
- "EDQUOT": 69,
- "EEXIST": 17,
- "EFAULT": 14,
- "EFBIG": 27,
- "EHOSTUNREACH": 65,
- "EIDRM": 90,
- "EILSEQ": 92,
- "EINPROGRESS": 36,
- "EINTR": 4,
- "EINVAL": 22,
- "EIO": 5,
- "EISCONN": 56,
- "EISDIR": 21,
- "ELOOP": 62,
- "EMFILE": 24,
- "EMLINK": 31,
- "EMSGSIZE": 40,
- "EMULTIHOP": 95,
- "ENAMETOOLONG": 63,
- "ENETDOWN": 50,
- "ENETRESET": 52,
- "ENETUNREACH": 51,
- "ENFILE": 23,
- "ENOBUFS": 55,
- "ENODATA": 96,
- "ENODEV": 19,
- "ENOENT": 2,
- "ENOEXEC": 8,
- "ENOLCK": 77,
- "ENOLINK": 97,
- "ENOMEM": 12,
- "ENOMSG": 91,
- "ENOPROTOOPT": 42,
- "ENOSPC": 28,
- "ENOSR": 98,
- "ENOSTR": 99,
- "ENOSYS": 78,
- "ENOTCONN": 57,
- "ENOTDIR": 20,
- "ENOTEMPTY": 66,
- "ENOTSOCK": 38,
- "ENOTSUP": 45,
- "ENOTTY": 25,
- "ENXIO": 6,
- "EOPNOTSUPP": 102,
- "EOVERFLOW": 84,
- "EPERM": 1,
- "EPIPE": 32,
- "EPROTO": 100,
- "EPROTONOSUPPORT": 43,
- "EPROTOTYPE": 41,
- "ERANGE": 34,
- "EROFS": 30,
- "ESPIPE": 29,
- "ESRCH": 3,
- "ESTALE": 70,
- "ETIME": 101,
- "ETIMEDOUT": 60,
- "ETXTBSY": 26,
- "EWOULDBLOCK": 35,
- "EXDEV": 18,
- "SIGHUP": 1,
- "SIGINT": 2,
- "SIGQUIT": 3,
- "SIGILL": 4,
- "SIGTRAP": 5,
- "SIGABRT": 6,
- "SIGIOT": 6,
- "SIGBUS": 10,
- "SIGFPE": 8,
- "SIGKILL": 9,
- "SIGUSR1": 30,
- "SIGSEGV": 11,
- "SIGUSR2": 31,
- "SIGPIPE": 13,
- "SIGALRM": 14,
- "SIGTERM": 15,
- "SIGCHLD": 20,
- "SIGCONT": 19,
- "SIGSTOP": 17,
- "SIGTSTP": 18,
- "SIGTTIN": 21,
- "SIGTTOU": 22,
- "SIGURG": 16,
- "SIGXCPU": 24,
- "SIGXFSZ": 25,
- "SIGVTALRM": 26,
- "SIGPROF": 27,
- "SIGWINCH": 28,
- "SIGIO": 23,
- "SIGSYS": 12,
- "SSL_OP_ALL": 2147486719,
- "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
- "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
- "SSL_OP_CISCO_ANYCONNECT": 32768,
- "SSL_OP_COOKIE_EXCHANGE": 8192,
- "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
- "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
- "SSL_OP_EPHEMERAL_RSA": 0,
- "SSL_OP_LEGACY_SERVER_CONNECT": 4,
- "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32,
- "SSL_OP_MICROSOFT_SESS_ID_BUG": 1,
- "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0,
- "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912,
- "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2,
- "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824,
- "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8,
- "SSL_OP_NO_COMPRESSION": 131072,
- "SSL_OP_NO_QUERY_MTU": 4096,
- "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
- "SSL_OP_NO_SSLv2": 16777216,
- "SSL_OP_NO_SSLv3": 33554432,
- "SSL_OP_NO_TICKET": 16384,
- "SSL_OP_NO_TLSv1": 67108864,
- "SSL_OP_NO_TLSv1_1": 268435456,
- "SSL_OP_NO_TLSv1_2": 134217728,
- "SSL_OP_PKCS1_CHECK_1": 0,
- "SSL_OP_PKCS1_CHECK_2": 0,
- "SSL_OP_SINGLE_DH_USE": 1048576,
- "SSL_OP_SINGLE_ECDH_USE": 524288,
- "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128,
- "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0,
- "SSL_OP_TLS_BLOCK_PADDING_BUG": 512,
- "SSL_OP_TLS_D5_BUG": 256,
- "SSL_OP_TLS_ROLLBACK_BUG": 8388608,
- "ENGINE_METHOD_DSA": 2,
- "ENGINE_METHOD_DH": 4,
- "ENGINE_METHOD_RAND": 8,
- "ENGINE_METHOD_ECDH": 16,
- "ENGINE_METHOD_ECDSA": 32,
- "ENGINE_METHOD_CIPHERS": 64,
- "ENGINE_METHOD_DIGESTS": 128,
- "ENGINE_METHOD_STORE": 256,
- "ENGINE_METHOD_PKEY_METHS": 512,
- "ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
- "ENGINE_METHOD_ALL": 65535,
- "ENGINE_METHOD_NONE": 0,
- "DH_CHECK_P_NOT_SAFE_PRIME": 2,
- "DH_CHECK_P_NOT_PRIME": 1,
- "DH_UNABLE_TO_CHECK_GENERATOR": 4,
- "DH_NOT_SUITABLE_GENERATOR": 8,
- "NPN_ENABLED": 1,
- "RSA_PKCS1_PADDING": 1,
- "RSA_SSLV23_PADDING": 2,
- "RSA_NO_PADDING": 3,
- "RSA_PKCS1_OAEP_PADDING": 4,
- "RSA_X931_PADDING": 5,
- "RSA_PKCS1_PSS_PADDING": 6,
- "POINT_CONVERSION_COMPRESSED": 2,
- "POINT_CONVERSION_UNCOMPRESSED": 4,
- "POINT_CONVERSION_HYBRID": 6,
- "F_OK": 0,
- "R_OK": 4,
- "W_OK": 2,
- "X_OK": 1,
- "UV_UDP_REUSEADDR": 4
- }
- },{}],2:[function(require,module,exports){
- "use strict";
- cc.Assembler2D.prototype.updateWorldVerts = function (comp) {
- var local = this._local;
- var verts = this._renderData.vDatas[0];
- var vl = local[0],
- vr = local[2],
- vb = local[1],
- vt = local[3];
- var floatsPerVert = this.floatsPerVert;
- var vertexOffset = 0; // left bottom
- verts[vertexOffset] = vl;
- verts[vertexOffset + 1] = vb;
- vertexOffset += floatsPerVert; // right bottom
- verts[vertexOffset] = vr;
- verts[vertexOffset + 1] = vb;
- vertexOffset += floatsPerVert; // left top
- verts[vertexOffset] = vl;
- verts[vertexOffset + 1] = vt;
- vertexOffset += floatsPerVert; // right top
- verts[vertexOffset] = vr;
- verts[vertexOffset + 1] = vt;
- };
- var _updateColor = cc.Assembler2D.prototype.updateColor;
- cc.Assembler2D.prototype.updateColor = function (comp, color) {
- this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_OPACITY_CHANGED;
- _updateColor.call(this, comp, color);
- };
- },{}],3:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Assembler3D) return;
- cc.Assembler3D.updateWorldVerts = function (comp) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var vl = local[0],
- vr = local[2],
- vb = local[1],
- vt = local[3]; // left bottom
- var floatsPerVert = this.floatsPerVert;
- var offset = 0;
- world[offset] = vl;
- world[offset + 1] = vb;
- world[offset + 2] = 0;
- offset += floatsPerVert; // right bottom
- world[offset] = vr;
- world[offset + 1] = vb;
- world[offset + 2] = 0;
- offset += floatsPerVert; // left top
- world[offset] = vl;
- world[offset + 1] = vt;
- world[offset + 2] = 0;
- offset += floatsPerVert; // right top
- world[offset] = vr;
- world[offset + 1] = vt;
- world[offset + 2] = 0;
- };
- })();
- },{}],4:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var RenderFlow = cc.RenderFlow;
- var originInit = cc.Assembler.prototype.init;
- var FLAG_VERTICES_OPACITY_CHANGED = 1 << 0;
- var FLAG_VERTICES_DIRTY = 1 << 1;
- var Assembler = {
- _ctor: function _ctor() {
- this._dirtyPtr = new Uint32Array(1);
- this.setDirty(this._dirtyPtr);
- this.initVertexFormat();
- },
- destroy: function destroy() {
- this._renderComp = null;
- this._effect = null;
- },
- clear: function clear() {
- this._renderData.clear();
- },
- _extendNative: function _extendNative() {
- renderer.Assembler.prototype.ctor.call(this);
- },
- initVertexFormat: function initVertexFormat() {
- var vfmt = this.getVfmt();
- if (!vfmt) return;
- this.setVertexFormat(vfmt._nativeObj);
- },
- init: function init(renderComp) {
- this._effect = [];
- originInit.call(this, renderComp);
- if (renderComp.node && renderComp.node._proxy) {
- renderComp.node._proxy.setAssembler(this);
- }
- },
- _updateRenderData: function _updateRenderData() {
- if (!this._renderComp || !this._renderComp.isValid) return;
- this.updateRenderData(this._renderComp);
- var materials = this._renderComp._materials;
- for (var i = 0; i < materials.length; i++) {
- var m = materials[i]; // TODO: find why material can be null
- if (!m) continue;
- m.getHash();
- this.updateMaterial(i, m);
- }
- },
- updateRenderData: function updateRenderData(comp) {
- comp._assembler.updateMaterial(0, comp._materials[0]);
- },
- updateMaterial: function updateMaterial(iaIndex, material) {
- var effect = material && material.effect;
- if (this._effect[iaIndex] !== effect) {
- this._effect[iaIndex] = effect;
- this.updateEffect(iaIndex, effect ? effect._nativeObj : null);
- }
- },
- updateColor: function updateColor(comp, color) {
- this._dirtyPtr[0] |= FLAG_VERTICES_OPACITY_CHANGED;
- },
- updateIADatas: function updateIADatas(iaIndex, meshIndex) {
- // When the MeshBuffer is switched, it is necessary to synchronize the iaData of the native assembler.
- this.updateMeshIndex(iaIndex, meshIndex);
- var materials = this._renderComp._materials;
- var material = materials[iaIndex] || materials[0];
- this.updateMaterial(iaIndex, material);
- }
- };
- cc.Assembler.FLAG_VERTICES_OPACITY_CHANGED = FLAG_VERTICES_OPACITY_CHANGED;
- cc.Assembler.FLAG_VERTICES_DIRTY = FLAG_VERTICES_DIRTY;
- Object.setPrototypeOf(cc.Assembler.prototype, renderer.Assembler.prototype);
- cc.js.mixin(cc.Assembler.prototype, Assembler);
- module.exports = Assembler;
- },{}],5:[function(require,module,exports){
- "use strict";
- var proto = cc.Graphics.__assembler__.prototype;
- var _init = proto.init;
- proto.init = function (renderComp) {
- _init.call(this, renderComp);
- this.ignoreOpacityFlag();
- };
- proto.genBuffer = function (graphics, cverts) {
- var buffers = this.getBuffers();
- var buffer = buffers[this._bufferOffset];
- var meshbuffer = buffer.meshbuffer;
- meshbuffer.requestStatic(cverts, cverts * 3);
- this._buffer = buffer;
- meshbuffer.setNativeAssembler(this);
- return buffer;
- };
- var _stroke = proto.stroke;
- proto.stroke = function (graphics) {
- _stroke.call(this, graphics);
- var buffer = this._buffer;
- buffer.meshbuffer.used(buffer.vertexStart, buffer.indiceStart);
- };
- var _fill = proto.fill;
- proto.fill = function (graphics) {
- _fill.call(this, graphics);
- var buffer = this._buffer;
- buffer.meshbuffer.used(buffer.vertexStart, buffer.indiceStart);
- };
- var _updateIADatas = proto.updateIADatas;
- proto.updateIADatas = function (iaIndex, meshIndex) {
- _updateIADatas.call(this, iaIndex, meshIndex); // Reset vertexStart and indiceStart when buffer is switched.
- this._buffer.vertexStart = 0;
- this._buffer.indiceStart = 0;
- };
- },{}],6:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var originReserveQuads = cc.Label.__assembler__.Bmfont.prototype._reserveQuads;
- Object.assign(cc.Label.__assembler__.Bmfont.prototype, {
- updateWorldVerts: function updateWorldVerts(comp) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var offset = 0, l = local.length; offset < l; offset += floatsPerVert) {
- world[offset] = local[offset];
- world[offset + 1] = local[offset + 1];
- }
- }
- });
- },{}],7:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Label.__assembler__.Bmfont3D) return;
- var proto = cc.Label.__assembler__.Bmfont3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: function updateWorldVerts(comp) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
- world[offset] = local[offset];
- world[offset + 1] = local[offset + 1];
- world[offset + 2] = 0;
- }
- }
- });
- })();
- },{}],8:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Label.__assembler__.Letter3D) return;
- var proto = cc.Label.__assembler__.Letter3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: function updateWorldVerts(comp) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
- world[offset] = local[offset];
- world[offset + 1] = local[offset + 1];
- world[offset + 2] = 0;
- }
- }
- });
- })();
- },{}],9:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Label.__assembler__.TTF3D) return;
- var proto = cc.Label.__assembler__.TTF3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: cc.Assembler3D.updateWorldVerts
- });
- })();
- },{}],10:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- require('./2d/bmfont.js');
- require('./3d/bmfont.js');
- require('./3d/ttf.js');
- require('./3d/letter.js');
- },{"./2d/bmfont.js":6,"./3d/bmfont.js":7,"./3d/letter.js":8,"./3d/ttf.js":9}],11:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var Mask = cc.Mask;
- var RenderFlow = cc.RenderFlow;
- var spriteAssembler = cc.Sprite.__assembler__.Simple.prototype;
- var graphicsAssembler = cc.Graphics.__assembler__.prototype;
- var proto = cc.Mask.__assembler__.prototype;
- var _updateRenderData = proto.updateRenderData; // Avoid constructor being overridden.
- renderer.MaskAssembler.prototype.constructor = cc.Mask.__assembler__;
- cc.js.mixin(proto, {
- _extendNative: function _extendNative() {
- renderer.MaskAssembler.prototype.ctor.call(this);
- },
- initLocal: function initLocal() {
- this._local = new Float32Array(4);
- renderer.MaskAssembler.prototype.setLocalData.call(this, this._local);
- },
- updateRenderData: function updateRenderData(mask) {
- _updateRenderData.call(this, mask);
- mask._clearGraphics._assembler.updateMaterial(0, mask._clearMaterial);
- this.setMaskInverted(mask.inverted);
- this.setUseModel(mask._type !== Mask.Type.IMAGE_STENCIL);
- this.setImageStencil(mask._type === Mask.Type.IMAGE_STENCIL);
- if (mask._graphics) {
- mask._graphics._assembler.setUseModel(mask._type !== Mask.Type.IMAGE_STENCIL);
- }
- mask.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
- }
- }, renderer.MaskAssembler.prototype);
- var originCreateGraphics = cc.Mask.prototype._createGraphics;
- var originRemoveGraphics = cc.Mask.prototype._removeGraphics;
- cc.js.mixin(cc.Mask.prototype, {
- _createGraphics: function _createGraphics() {
- originCreateGraphics.call(this);
- if (this._graphics) {
- this._assembler.setRenderSubHandle(this._graphics._assembler);
- } // TODO: remove clearGraphics
- if (!this._clearGraphics) {
- this._clearGraphics = new cc.Graphics();
- cc.Assembler.init(this._clearGraphics);
- this._clearGraphics.node = new cc.Node();
- this._clearGraphics._activateMaterial();
- this._clearGraphics.lineWidth = 0;
- this._clearGraphics.rect(-1, -1, 2, 2);
- this._clearGraphics.fill();
- this._clearGraphics._assembler.ignoreWorldMatrix();
- this._assembler.setClearSubHandle(this._clearGraphics._assembler);
- }
- },
- _removeGraphics: function _removeGraphics() {
- originRemoveGraphics.call(this); // TODO: remove clearGraphics
- if (this._clearGraphics) {
- this._clearGraphics.destroy();
- this._clearGraphics = null;
- }
- }
- });
- },{}],12:[function(require,module,exports){
- "use strict";
- (function () {
- var Mesh = cc.MeshRenderer;
- if (Mesh === undefined) return;
- var proto = cc.MeshRenderer.__assembler__.prototype;
- var _init = proto.init;
- cc.js.mixin(proto, {
- initVertexFormat: function initVertexFormat() {},
- _extendNative: function _extendNative() {
- renderer.MeshAssembler.prototype.ctor.call(this);
- },
- init: function init(comp) {
- _init.call(this, comp);
- this.updateMeshData(true);
- },
- setRenderNode: function setRenderNode(node) {
- this.setNode(node._proxy);
- },
- updateRenderData: function updateRenderData(comp) {
- this.updateMeshData();
- comp.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
- },
- updateMeshData: function updateMeshData(force) {
- var comp = this._renderComp;
- var mesh = comp.mesh;
- if (!mesh || !mesh.loaded) return;
- var subdatas = comp.mesh.subDatas;
- for (var i = 0, len = subdatas.length; i < len; i++) {
- var data = subdatas[i];
- if (force || data.vDirty || data.iDirty) {
- this.updateIAData(i, data.vfm._nativeObj, data.vData, data.iData);
- data.vDirty = false;
- data.iDirty = false;
- }
- }
- }
- }, renderer.MeshAssembler.prototype);
- })();
- },{}],13:[function(require,module,exports){
- "use strict";
- var proto = cc.MotionStreak.__assembler__.prototype;
- var _init = proto.init;
- var _update = proto.update;
- cc.js.mixin(proto, {
- init: function init(comp) {
- _init.call(this, comp);
- this.setUseModel(false);
- this.ignoreWorldMatrix();
- this.ignoreOpacityFlag();
- },
- update: function update(comp, dt) {
- comp.node._updateWorldMatrix();
- _update.call(this, comp, dt);
- var _this$_renderData$_fl = this._renderData._flexBuffer,
- iData = _this$_renderData$_fl.iData,
- usedVertices = _this$_renderData$_fl.usedVertices;
- var indiceOffset = 0;
- for (var i = 0, l = usedVertices; i < l; i += 2) {
- iData[indiceOffset++] = i;
- iData[indiceOffset++] = i + 2;
- iData[indiceOffset++] = i + 1;
- iData[indiceOffset++] = i + 1;
- iData[indiceOffset++] = i + 2;
- iData[indiceOffset++] = i + 3;
- }
- }
- });
- },{}],14:[function(require,module,exports){
- "use strict";
- (function () {
- var PS = cc.ParticleSystem3D;
- if (PS === undefined) return;
- var proto = PS.__assembler__.prototype;
- var _init = proto.init;
- var _updateRenderData = proto.updateRenderData;
- cc.js.mixin(proto, {
- initVertexFormat: function initVertexFormat() {},
- _extendNative: function _extendNative() {
- renderer.Particle3DAssembler.prototype.ctor.call(this);
- },
- init: function init(comp) {
- _init.call(this, comp);
- this._renderDataList = new renderer.RenderDataList();
- this.setRenderDataList(this._renderDataList);
- this.ignoreOpacityFlag();
- this.updateMeshData();
- this.setUseModel(true);
- },
- updateRenderData: function updateRenderData(comp) {
- _updateRenderData.call(this, comp);
- if (comp._vertsDirty) {
- this.updateMeshData();
- comp._vertsDirty = false;
- }
- },
- setRenderNode: function setRenderNode(node) {
- this.setNode(node._proxy);
- },
- updateMeshData: function updateMeshData() {
- if (!this._model) {
- return;
- }
- var subdatas = this._model._subDatas;
- for (var i = 0, len = subdatas.length; i < len; i++) {
- var data = subdatas[i];
- if (data.vDirty && data.enable) {
- this._renderDataList.updateMesh(i, data.vData, data.iData);
- }
- }
- this.setVertexFormat(subdatas[0].vfm._nativeObj);
- this.setSimulationSpace(this._particleSystem.simulationSpace);
- if (subdatas[1] && subdatas[1].enable) {
- this.setTrailVertexFormat(subdatas[1].vfm._nativeObj);
- this.setTrailModuleSpace(this._particleSystem.trailModule.space);
- }
- },
- setSimulationSpace: function setSimulationSpace(space) {
- this.setParticleSpace(space);
- },
- setTrailModuleSpace: function setTrailModuleSpace(space) {
- this.setTrailSpace(space);
- },
- updateIA: function updateIA(index, count, vDirty, iDirty) {
- this.updateIndicesRange(index, 0, count);
- }
- }, renderer.Particle3DAssembler.prototype);
- })();
- },{}],15:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- Object.assign(cc.Sprite.__assembler__.Mesh.prototype, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var i = 0, l = local.length / 2; i < l; i++) {
- world[i * floatsPerVert] = local[i * 2];
- world[i * floatsPerVert + 1] = local[i * 2 + 1];
- }
- }
- });
- },{}],16:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- Object.assign(cc.Sprite.__assembler__.RadialFilled.prototype, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
- world[offset] = local[offset];
- world[offset + 1] = local[offset + 1];
- }
- }
- });
- },{}],17:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var proto = cc.Sprite.__assembler__.Simple.prototype;
- var nativeProto = renderer.SimpleSprite2D.prototype;
- proto.updateWorldVerts = function (comp) {
- this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_DIRTY;
- };
- proto._extendNative = function () {
- nativeProto.ctor.call(this);
- };
- proto.initLocal = function () {
- this._local = new Float32Array(4);
- nativeProto.setLocalData.call(this, this._local);
- };
- },{}],18:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var proto = cc.Sprite.__assembler__.Sliced.prototype;
- var nativeProto = renderer.SlicedSprite2D.prototype;
- proto.updateWorldVerts = function (comp) {
- this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_DIRTY;
- };
- proto._extendNative = function () {
- nativeProto.ctor.call(this);
- };
- proto.initLocal = function () {
- this._local = new Float32Array(8);
- nativeProto.setLocalData.call(this, this._local);
- };
- },{}],19:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- Object.assign(cc.Sprite.__assembler__.Tiled.prototype, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var renderData = this._renderData;
- var local = this._local;
- var localX = local.x,
- localY = local.y;
- var world = renderData.vDatas[0];
- var row = this.row,
- col = this.col;
- var x, x1, y, y1;
- var floatsPerVert = this.floatsPerVert;
- var vertexOffset = 0;
- for (var yindex = 0, ylength = row; yindex < ylength; ++yindex) {
- y = localY[yindex];
- y1 = localY[yindex + 1];
- for (var xindex = 0, xlength = col; xindex < xlength; ++xindex) {
- x = localX[xindex];
- x1 = localX[xindex + 1]; // lb
- world[vertexOffset] = x;
- world[vertexOffset + 1] = y;
- vertexOffset += floatsPerVert; // rb
- world[vertexOffset] = x1;
- world[vertexOffset + 1] = y;
- vertexOffset += floatsPerVert; // lt
- world[vertexOffset] = x;
- world[vertexOffset + 1] = y1;
- vertexOffset += floatsPerVert; // rt
- world[vertexOffset] = x1;
- world[vertexOffset + 1] = y1;
- vertexOffset += floatsPerVert;
- }
- }
- }
- });
- },{}],20:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.BarFilled3D) return;
- var proto = cc.Sprite.__assembler__.BarFilled3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: cc.Assembler3D.updateWorldVerts
- });
- })();
- },{}],21:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.Mesh3D) return;
- var proto = cc.Sprite.__assembler__.Mesh3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert,
- offset = 0;
- for (var i = 0, j = 0, l = local.length / 2; i < l; i++, offset += floatsPerVert) {
- j = i * 2;
- world[offset] = local[j];
- world[offset + 1] = local[j + 1];
- world[offset + 2] = 0;
- }
- }
- });
- })();
- },{}],22:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.RadialFilled3D) return;
- var proto = cc.Sprite.__assembler__.RadialFilled3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var local = this._local;
- var world = this._renderData.vDatas[0];
- var floatsPerVert = this.floatsPerVert;
- for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
- world[offset] = local[offset];
- world[offset + 1] = local[offset + 1];
- world[offset + 2] = 0;
- }
- }
- });
- })();
- },{}],23:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.Simple3D) return;
- var proto = cc.Sprite.__assembler__.Simple3D.prototype;
- var nativeProto = renderer.SimpleSprite3D.prototype;
- Object.assign(proto, {
- _extendNative: nativeProto.ctor
- });
- })();
- },{}],24:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.Sliced3D) return;
- var proto = cc.Sprite.__assembler__.Sliced3D.prototype;
- var nativeProto = renderer.SlicedSprite3D.prototype;
- Object.assign(proto, {
- _extendNative: nativeProto.ctor
- });
- })();
- },{}],25:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.Sprite.__assembler__.Tiled3D) return;
- var proto = cc.Sprite.__assembler__.Tiled3D.prototype;
- Object.assign(proto, {
- updateWorldVerts: function updateWorldVerts(sprite) {
- var local = this._local;
- var localX = local.x,
- localY = local.y;
- var world = this._renderData.vDatas[0];
- var row = this.row,
- col = this.col;
- var x, x1, y, y1;
- var vertexOffset = 0;
- for (var yindex = 0, ylength = row; yindex < ylength; ++yindex) {
- y = localY[yindex];
- y1 = localY[yindex + 1];
- for (var xindex = 0, xlength = col; xindex < xlength; ++xindex) {
- x = localX[xindex];
- x1 = localX[xindex + 1]; // left bottom
- var padding = 6;
- world[vertexOffset] = x;
- world[vertexOffset + 1] = y;
- world[vertexOffset + 2] = 0;
- vertexOffset += padding; // right bottom
- world[vertexOffset] = x1;
- world[vertexOffset + 1] = y;
- world[vertexOffset + 2] = 0;
- vertexOffset += padding; // left top
- world[vertexOffset] = x;
- world[vertexOffset + 1] = y1;
- world[vertexOffset + 2] = 0;
- vertexOffset += padding; // right top
- world[vertexOffset] = x1;
- world[vertexOffset + 1] = y1;
- world[vertexOffset + 2] = 0;
- vertexOffset += padding;
- }
- }
- }
- });
- })();
- },{}],26:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- require('./2d/sliced.js');
- require('./2d/tiled.js');
- require('./2d/radial-filled.js');
- require('./2d/simple.js');
- require('./2d/mesh.js');
- require('./3d/sliced.js');
- require('./3d/simple.js');
- require('./3d/tiled.js');
- require('./3d/mesh.js');
- require('./3d/bar-filled.js');
- require('./3d/radial-filled.js');
- },{"./2d/mesh.js":15,"./2d/radial-filled.js":16,"./2d/simple.js":17,"./2d/sliced.js":18,"./2d/tiled.js":19,"./3d/bar-filled.js":20,"./3d/mesh.js":21,"./3d/radial-filled.js":22,"./3d/simple.js":23,"./3d/sliced.js":24,"./3d/tiled.js":25}],27:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- require('./jsb-sys.js');
- require('./jsb-game.js');
- require('./jsb-videoplayer.js');
- require('./jsb-webview.js');
- require('./jsb-audio.js');
- require('./jsb-loader.js');
- require('./jsb-editbox.js');
- require('./jsb-reflection.js');
- require('./jsb-assets-manager.js');
- require('./jsb-safearea.js');
- if (CC_NATIVERENDERER) {
- require('./jsb-effect.js');
- require('./jsb-effect-variant.js');
- require('./scene/camera.js');
- require('./scene/light.js');
- require('./scene/node-proxy.js');
- require('./scene/render-flow.js'); // must be required after render flow
- require('./scene/node.js');
- cc.game.on(cc.game.EVENT_ENGINE_INITED, function () {
- require('./scene/mesh-buffer.js');
- require('./scene/quad-buffer.js');
- require('./scene/render-data.js');
- require('./assemblers/assembler.js');
- require('./assemblers/assembler-2d.js');
- require('./assemblers/assembler-3d.js');
- require('./assemblers/sprite/index.js');
- require('./assemblers/label/index.js');
- require('./assemblers/mask-assembler.js');
- require('./assemblers/graphics-assembler.js');
- require('./assemblers/motion-streak.js');
- require('./assemblers/mesh-renderer.js');
- require('./assemblers/particle-3d-assembler.js');
- require('./jsb-dragonbones.js');
- require('./jsb-spine-skeleton.js');
- require('./jsb-particle.js');
- require('./jsb-tiledmap.js');
- require('./jsb-skin-mesh.js');
- });
- }
- },{"./assemblers/assembler-2d.js":2,"./assemblers/assembler-3d.js":3,"./assemblers/assembler.js":4,"./assemblers/graphics-assembler.js":5,"./assemblers/label/index.js":10,"./assemblers/mask-assembler.js":11,"./assemblers/mesh-renderer.js":12,"./assemblers/motion-streak.js":13,"./assemblers/particle-3d-assembler.js":14,"./assemblers/sprite/index.js":26,"./jsb-assets-manager.js":28,"./jsb-audio.js":29,"./jsb-dragonbones.js":31,"./jsb-editbox.js":32,"./jsb-effect-variant.js":33,"./jsb-effect.js":34,"./jsb-game.js":36,"./jsb-loader.js":37,"./jsb-particle.js":38,"./jsb-reflection.js":39,"./jsb-safearea.js":40,"./jsb-skin-mesh.js":41,"./jsb-spine-skeleton.js":42,"./jsb-sys.js":43,"./jsb-tiledmap.js":44,"./jsb-videoplayer.js":45,"./jsb-webview.js":46,"./scene/camera.js":47,"./scene/light.js":48,"./scene/mesh-buffer.js":49,"./scene/node-proxy.js":50,"./scene/node.js":51,"./scene/quad-buffer.js":52,"./scene/render-data.js":53,"./scene/render-flow.js":54}],28:[function(require,module,exports){
- "use strict";
- /*
- * Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
- if (jsb.AssetsManager) {
- jsb.AssetsManager.State = {
- UNINITED: 0,
- UNCHECKED: 1,
- PREDOWNLOAD_VERSION: 2,
- DOWNLOADING_VERSION: 3,
- VERSION_LOADED: 4,
- PREDOWNLOAD_MANIFEST: 5,
- DOWNLOADING_MANIFEST: 6,
- MANIFEST_LOADED: 7,
- NEED_UPDATE: 8,
- READY_TO_UPDATE: 9,
- UPDATING: 10,
- UNZIPPING: 11,
- UP_TO_DATE: 12,
- FAIL_TO_UPDATE: 13
- };
- jsb.Manifest.DownloadState = {
- UNSTARTED: 0,
- DOWNLOADING: 1,
- SUCCESSED: 2,
- UNMARKED: 3
- };
- jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
- jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
- jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
- jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
- jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
- jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
- jsb.EventAssetsManager.ASSET_UPDATED = 6;
- jsb.EventAssetsManager.ERROR_UPDATING = 7;
- jsb.EventAssetsManager.UPDATE_FINISHED = 8;
- jsb.EventAssetsManager.UPDATE_FAILED = 9;
- jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;
- }
- },{}],29:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2013-2016 Chukong Technologies Inc.
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var cacheManager = require('./jsb-cache-manager');
- var Audio = cc._Audio = function (src) {
- this.src = src;
- this.volume = 1;
- this.loop = false;
- this.id = -1;
- };
- var handleVolume = function handleVolume(volume) {
- if (volume === undefined) {
- // set default volume as 1
- volume = 1;
- } else if (typeof volume === 'string') {
- volume = Number.parseFloat(volume);
- }
- return volume;
- };
- (function (proto, audioEngine) {
- if (!audioEngine) return; // Using the new audioEngine
- cc.audioEngine = audioEngine;
- audioEngine.setMaxWebAudioSize = function () {};
- Audio.State = audioEngine.AudioState;
- proto.play = function () {
- audioEngine.stop(this.id);
- var clip = this.src;
- this.id = audioEngine.play(clip, this.loop, this.volume);
- };
- proto.pause = function () {
- audioEngine.pause(this.id);
- };
- proto.resume = function () {
- audioEngine.resume(this.id);
- };
- proto.stop = function () {
- audioEngine.stop(this.id);
- };
- proto.destroy = function () {};
- proto.setLoop = function (loop) {
- this.loop = loop;
- audioEngine.setLoop(this.id, loop);
- };
- proto.getLoop = function () {
- return this.loop;
- };
- proto.setVolume = function (volume) {
- volume = handleVolume(volume);
- this.volume = volume;
- return audioEngine.setVolume(this.id, volume);
- };
- proto.getVolume = function () {
- return this.volume;
- };
- proto.setCurrentTime = function (time) {
- audioEngine.setCurrentTime(this.id, time);
- };
- proto.getCurrentTime = function () {
- return audioEngine.getCurrentTime(this.id);
- };
- proto.getDuration = function () {
- return audioEngine.getDuration(this.id);
- };
- proto.getState = function () {
- return audioEngine.getState(this.id);
- }; // polyfill audioEngine
- var _music = {
- id: -1,
- clip: '',
- loop: false,
- volume: 1
- };
- var _effect = {
- volume: 1
- };
- audioEngine.play = function (clip, loop, volume) {
- if (typeof volume !== 'number') {
- volume = 1;
- }
- var audioFilePath;
- if (typeof clip === 'string') {
- // backward compatibility since 1.10
- cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
- audioFilePath = clip;
- } else {
- if (clip.loaded) {
- audioFilePath = clip._nativeAsset;
- } else {
- // audio delay loading
- clip._nativeAsset = audioFilePath = cacheManager.getCache(clip.nativeUrl) || clip.nativeUrl;
- clip.loaded = true;
- }
- }
- return audioEngine.play2d(audioFilePath, loop, volume);
- };
- audioEngine.playMusic = function (clip, loop) {
- audioEngine.stop(_music.id);
- _music.id = audioEngine.play(clip, loop, _music.volume);
- _music.loop = loop;
- _music.clip = clip;
- return _music.id;
- };
- audioEngine.stopMusic = function () {
- audioEngine.stop(_music.id);
- };
- audioEngine.pauseMusic = function () {
- audioEngine.pause(_music.id);
- return _music.id;
- };
- audioEngine.resumeMusic = function () {
- audioEngine.resume(_music.id);
- return _music.id;
- };
- audioEngine.getMusicVolume = function () {
- return _music.volume;
- };
- audioEngine.setMusicVolume = function (volume) {
- _music.volume = handleVolume(volume);
- audioEngine.setVolume(_music.id, _music.volume);
- return volume;
- };
- audioEngine.isMusicPlaying = function () {
- return audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
- };
- audioEngine.playEffect = function (filePath, loop) {
- return audioEngine.play(filePath, loop || false, _effect.volume);
- };
- audioEngine.setEffectsVolume = function (volume) {
- _effect.volume = handleVolume(volume);
- };
- audioEngine.getEffectsVolume = function () {
- return _effect.volume;
- };
- audioEngine.pauseEffect = function (audioID) {
- return audioEngine.pause(audioID);
- };
- audioEngine.pauseAllEffects = function () {
- var musicPlay = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
- audioEngine.pauseAll();
- if (musicPlay) {
- audioEngine.resume(_music.id);
- }
- };
- audioEngine.resumeEffect = function (id) {
- audioEngine.resume(id);
- };
- audioEngine.resumeAllEffects = function () {
- var musicPaused = audioEngine.getState(_music.id) === audioEngine.AudioState.PAUSED;
- audioEngine.resumeAll();
- if (musicPaused && audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING) {
- audioEngine.pause(_music.id);
- }
- };
- audioEngine.stopEffect = function (id) {
- return audioEngine.stop(id);
- };
- audioEngine.stopAllEffects = function () {
- var musicPlaying = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
- var currentTime = audioEngine.getCurrentTime(_music.id);
- audioEngine.stopAll();
- if (musicPlaying) {
- _music.id = audioEngine.play(_music.clip, _music.loop);
- audioEngine.setCurrentTime(_music.id, currentTime);
- }
- }; // Unnecessary on native platform
- audioEngine._break = function () {};
- audioEngine._restore = function () {}; // deprecated
- audioEngine._uncache = audioEngine.uncache;
- audioEngine.uncache = function (clip) {
- var path;
- if (typeof clip === 'string') {
- // backward compatibility since 1.10
- cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
- path = clip;
- } else {
- if (!clip) {
- return;
- }
- path = clip._nativeAsset;
- }
- audioEngine._uncache(path);
- };
- audioEngine._preload = audioEngine.preload;
- audioEngine.preload = function (filePath, callback) {
- cc.warn('`cc.audioEngine.preload` is deprecated, use `cc.assetManager.loadRes(url, cc.AudioClip)` instead please.');
- audioEngine._preload(filePath, callback);
- };
- })(Audio.prototype, jsb.AudioEngine);
- },{"./jsb-cache-manager":30}],30:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2019 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of cache-manager software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in cache-manager License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var _require = require('./jsb-fs-utils'),
- getUserDataPath = _require.getUserDataPath,
- readJsonSync = _require.readJsonSync,
- makeDirSync = _require.makeDirSync,
- writeFileSync = _require.writeFileSync,
- writeFile = _require.writeFile,
- deleteFile = _require.deleteFile,
- rmdirSync = _require.rmdirSync;
- var writeCacheFileList = null;
- var startWrite = false;
- var nextCallbacks = [];
- var callbacks = [];
- var cleaning = false;
- var REGEX = /^\w+:\/\/.*/;
- var cacheManager = {
- cacheDir: 'gamecaches',
- cachedFileName: 'cacheList.json',
- deleteInterval: 500,
- writeFileInterval: 2000,
- cachedFiles: null,
- version: '1.1',
- getCache: function getCache(url) {
- this.updateLastTime(url);
- return this.cachedFiles.has(url) ? "".concat(this.cacheDir, "/").concat(this.cachedFiles.get(url).url) : '';
- },
- getTemp: function getTemp(url) {
- return '';
- },
- init: function init() {
- this.cacheDir = getUserDataPath() + '/' + this.cacheDir;
- var cacheFilePath = this.cacheDir + '/' + this.cachedFileName;
- var result = readJsonSync(cacheFilePath);
- if (result instanceof Error || !result.version || result.version !== this.version) {
- if (!(result instanceof Error)) rmdirSync(this.cacheDir, true);
- this.cachedFiles = new cc.AssetManager.Cache();
- makeDirSync(this.cacheDir, true);
- writeFileSync(cacheFilePath, JSON.stringify({
- files: this.cachedFiles._map,
- version: this.version
- }), 'utf8');
- } else {
- this.cachedFiles = new cc.AssetManager.Cache(result.files);
- }
- },
- updateLastTime: function updateLastTime(url) {
- if (this.cachedFiles.has(url)) {
- var cache = this.cachedFiles.get(url);
- cache.lastTime = Date.now();
- }
- },
- _write: function _write() {
- writeCacheFileList = null;
- startWrite = true;
- writeFile(this.cacheDir + '/' + this.cachedFileName, JSON.stringify({
- files: this.cachedFiles._map,
- version: this.version
- }), 'utf8', function () {
- startWrite = false;
- for (var i = 0, j = callbacks.length; i < j; i++) {
- callbacks[i]();
- }
- callbacks.length = 0;
- callbacks.push.apply(callbacks, nextCallbacks);
- nextCallbacks.length = 0;
- });
- },
- writeCacheFile: function writeCacheFile(cb) {
- if (!writeCacheFileList) {
- writeCacheFileList = setTimeout(this._write.bind(this), this.writeFileInterval);
- if (startWrite === true) {
- cb && nextCallbacks.push(cb);
- } else {
- cb && callbacks.push(cb);
- }
- } else {
- cb && callbacks.push(cb);
- }
- },
- cacheFile: function cacheFile(id, url, cacheBundleRoot) {
- this.cachedFiles.add(id, {
- bundle: cacheBundleRoot,
- url: url,
- lastTime: Date.now()
- });
- this.writeCacheFile();
- },
- clearCache: function clearCache() {
- var _this = this;
- rmdirSync(this.cacheDir, true);
- this.cachedFiles = new cc.AssetManager.Cache();
- makeDirSync(this.cacheDir, true);
- var cacheFilePath = this.cacheDir + '/' + this.cachedFileName;
- writeFileSync(cacheFilePath, JSON.stringify({
- files: this.cachedFiles._map,
- version: this.version
- }), 'utf8');
- cc.assetManager.bundles.forEach(function (bundle) {
- if (REGEX.test(bundle.base)) _this.makeBundleFolder(bundle.name);
- });
- },
- clearLRU: function clearLRU() {
- var _this2 = this;
- if (cleaning) return;
- cleaning = true;
- var caches = [];
- var self = this;
- this.cachedFiles.forEach(function (val, key) {
- if (val.bundle === 'internal') return;
- caches.push({
- originUrl: key,
- url: _this2.getCache(key),
- lastTime: val.lastTime
- });
- });
- caches.sort(function (a, b) {
- return a.lastTime - b.lastTime;
- });
- caches.length = Math.floor(this.cachedFiles.count / 3);
- if (caches.length === 0) return;
- for (var i = 0, l = caches.length; i < l; i++) {
- this.cachedFiles.remove(caches[i].originUrl);
- }
- this.writeCacheFile(function () {
- function deferredDelete() {
- var item = caches.pop();
- deleteFile(item.url);
- if (caches.length > 0) {
- setTimeout(deferredDelete, self.deleteInterval);
- } else {
- cleaning = false;
- }
- }
- setTimeout(deferredDelete, self.deleteInterval);
- });
- },
- removeCache: function removeCache(url) {
- if (this.cachedFiles.has(url)) {
- var path = this.getCache(url);
- this.cachedFiles.remove(url);
- this.writeCacheFile(function () {
- deleteFile(path);
- });
- }
- },
- makeBundleFolder: function makeBundleFolder(bundleName) {
- makeDirSync(this.cacheDir + '/' + bundleName, true);
- }
- };
- cc.assetManager.cacheManager = module.exports = cacheManager;
- },{"./jsb-fs-utils":35}],31:[function(require,module,exports){
- "use strict";
- var _constants = require("constants");
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var cacheManager = require('./jsb-cache-manager');
- (function () {
- if (window.dragonBones === undefined || window.middleware === undefined) return;
- if (dragonBones.DragonBonesAtlasAsset === undefined) return; // dragonbones global time scale.
- Object.defineProperty(dragonBones, 'timeScale', {
- get: function get() {
- return this._timeScale;
- },
- set: function set(value) {
- this._timeScale = value;
- var factory = this.CCFactory.getInstance();
- factory.setTimeScale(value);
- },
- configurable: true
- });
- jsb.generateGetSet(dragonBones);
- var _slotColor = cc.color(0, 0, 255, 255);
- var _boneColor = cc.color(255, 0, 0, 255);
- var _originColor = cc.color(0, 255, 0, 255); ////////////////////////////////////////////////////////////
- // override dragonBones library by native dragonBones
- ////////////////////////////////////////////////////////////
- //--------------------
- // adapt event name
- //--------------------
- dragonBones.EventObject.START = "start";
- dragonBones.EventObject.LOOP_COMPLETE = "loopComplete";
- dragonBones.EventObject.COMPLETE = "complete";
- dragonBones.EventObject.FADE_IN = "fadeIn";
- dragonBones.EventObject.FADE_IN_COMPLETE = "fadeInComplete";
- dragonBones.EventObject.FADE_OUT = "fadeOut";
- dragonBones.EventObject.FADE_OUT_COMPLETE = "fadeOutComplete";
- dragonBones.EventObject.FRAME_EVENT = "frameEvent";
- dragonBones.EventObject.SOUND_EVENT = "soundEvent";
- dragonBones.DragonBones = {
- ANGLE_TO_RADIAN: Math.PI / 180,
- RADIAN_TO_ANGLE: 180 / Math.PI
- }; //-------------------
- // native factory
- //-------------------
- var factoryProto = dragonBones.CCFactory.prototype;
- factoryProto.createArmatureNode = function (comp, armatureName, node) {
- node = node || new cc.Node();
- var display = node.getComponent(dragonBones.ArmatureDisplay);
- if (!display) {
- display = node.addComponent(dragonBones.ArmatureDisplay);
- }
- node.name = armatureName;
- display._armatureName = armatureName;
- display._N$dragonAsset = comp.dragonAsset;
- display._N$dragonAtlasAsset = comp.dragonAtlasAsset;
- display._init();
- return display;
- };
- var _replaceSkin = factoryProto.replaceSkin;
- factoryProto.replaceSkin = function (armatrue, skinData, isOverride, exclude) {
- if (isOverride == undefined) isOverride = false;
- exclude = exclude || [];
- _replaceSkin.call(this, armatrue, skinData, isOverride, exclude);
- };
- var _changeSkin = factoryProto.changeSkin;
- factoryProto.changeSkin = function (armatrue, skinData, exclude) {
- _changeSkin.call(this, armatrue, skinData, exclude);
- }; //-------------------
- // native animation state
- //-------------------
- var animationStateProto = dragonBones.AnimationState.prototype;
- var _isPlaying = animationStateProto.isPlaying;
- Object.defineProperty(animationStateProto, 'isPlaying', {
- get: function get() {
- return _isPlaying.call(this);
- }
- }); //-------------------
- // native armature
- //-------------------
- var armatureProto = dragonBones.Armature.prototype;
- armatureProto.addEventListener = function (eventType, listener, target) {
- if (!this.__persistentDisplay__) {
- this.__persistentDisplay__ = this.getDisplay();
- }
- this.__persistentDisplay__.on(eventType, listener, target);
- };
- armatureProto.removeEventListener = function (eventType, listener, target) {
- if (!this.__persistentDisplay__) {
- this.__persistentDisplay__ = this.getDisplay();
- }
- this.__persistentDisplay__.off(eventType, listener, target);
- }; //--------------------------
- // native CCArmatureDisplay
- //--------------------------
- var nativeArmatureDisplayProto = dragonBones.CCArmatureDisplay.prototype;
- Object.defineProperty(nativeArmatureDisplayProto, "node", {
- get: function get() {
- return this;
- }
- });
- nativeArmatureDisplayProto.getRootNode = function () {
- var rootDisplay = this.getRootDisplay();
- return rootDisplay && rootDisplay._ccNode;
- };
- nativeArmatureDisplayProto.convertToWorldSpace = function (point) {
- var newPos = this.convertToRootSpace(point);
- newPos = cc.v2(newPos.x, newPos.y);
- var ccNode = this.getRootNode();
- if (!ccNode) return newPos;
- var finalPos = ccNode.convertToWorldSpaceAR(newPos);
- return finalPos;
- };
- nativeArmatureDisplayProto.initEvent = function () {
- if (this._eventTarget) {
- return;
- }
- this._eventTarget = new cc.EventTarget();
- this.setDBEventCallback(function (eventObject) {
- this._eventTarget.emit(eventObject.type, eventObject);
- });
- };
- nativeArmatureDisplayProto.on = function (type, listener, target) {
- this.initEvent();
- this._eventTarget.on(type, listener, target);
- this.addDBEventListener(type, listener);
- };
- nativeArmatureDisplayProto.off = function (type, listener, target) {
- this.initEvent();
- this._eventTarget.off(type, listener, target);
- this.removeDBEventListener(type, listener);
- };
- nativeArmatureDisplayProto.once = function (type, listener, target) {
- this.initEvent();
- this._eventTarget.once(type, listener, target);
- this.addDBEventListener(type, listener);
- }; ////////////////////////////////////////////////////////////
- // override DragonBonesAtlasAsset
- ////////////////////////////////////////////////////////////
- var dbAtlas = dragonBones.DragonBonesAtlasAsset.prototype;
- var _gTextureIdx = 1;
- var _textureKeyMap = {};
- var _textureMap = new WeakMap();
- var _textureIdx2Name = {};
- dbAtlas.removeRecordTexture = function (texture) {
- if (!texture) return;
- delete _textureIdx2Name[texture.url];
- var index = texture.__textureIndex__;
- if (index) {
- var texKey = _textureKeyMap[index];
- if (texKey && _textureMap.has(texKey)) {
- _textureMap["delete"](texKey);
- delete _textureKeyMap[index];
- }
- }
- };
- dbAtlas.recordTexture = function () {
- if (this._texture && this._oldTexture !== this._texture) {
- this.removeRecordTexture(this._oldTexture);
- var texKey = _textureKeyMap[_gTextureIdx] = {
- key: _gTextureIdx
- };
- _textureMap.set(texKey, this._texture);
- this._oldTexture = this._texture;
- this._texture.__textureIndex__ = _gTextureIdx;
- _gTextureIdx++;
- }
- };
- dbAtlas.getTextureByIndex = function (textureIdx) {
- var texKey = _textureKeyMap[textureIdx];
- if (!texKey) return;
- return _textureMap.get(texKey);
- };
- dbAtlas.updateTextureAtlasData = function (factory) {
- var url = this._texture.url;
- var preAtlasInfo = _textureIdx2Name[url];
- var index; // If the texture has store the atlas info before,then get native atlas object,and
- // update script texture map.
- if (preAtlasInfo) {
- index = preAtlasInfo.index;
- this._textureAtlasData = factory.getTextureAtlasDataByIndex(preAtlasInfo.name, index);
- var texKey = _textureKeyMap[preAtlasInfo.index];
- _textureMap.set(texKey, this._texture);
- this._texture.__textureIndex__ = index; // If script has store the atlas info,but native has no atlas object,then
- // still new native texture2d object,but no call recordTexture to increase
- // textureIndex.
- if (this._textureAtlasData) {
- return;
- }
- } else {
- this.recordTexture();
- }
- index = this._texture.__textureIndex__;
- this.jsbTexture = new middleware.Texture2D();
- this.jsbTexture.setRealTextureIndex(index);
- this.jsbTexture.setPixelsWide(this._texture.width);
- this.jsbTexture.setPixelsHigh(this._texture.height);
- this._textureAtlasData = factory.parseTextureAtlasData(this.atlasJson, this.jsbTexture, this._uuid);
- this.jsbTexture.setNativeTexture(this._texture.getImpl());
- _textureIdx2Name[url] = {
- name: this._textureAtlasData.name,
- index: index
- };
- };
- dbAtlas.init = function (factory) {
- this._factory = factory; // If create by manual, uuid is empty.
- if (!this._uuid) {
- var atlasJsonObj = JSON.parse(this.atlasJson);
- this._uuid = atlasJsonObj.name;
- }
- if (this._textureAtlasData) {
- factory.addTextureAtlasData(this._textureAtlasData, this._uuid);
- } else {
- this.updateTextureAtlasData(factory);
- }
- };
- dbAtlas._clear = function (dontRecordTexture) {
- if (this._factory) {
- this._factory.removeTextureAtlasData(this._uuid, true);
- this._factory.removeDragonBonesDataByUUID(this._uuid, true);
- }
- this._textureAtlasData = null;
- if (!dontRecordTexture) {
- this.recordTexture();
- }
- };
- dbAtlas.destroy = function () {
- this.removeRecordTexture(this._texture);
- this._clear(true);
- cc.Asset.prototype.destroy.call(this);
- }; ////////////////////////////////////////////////////////////
- // override DragonBonesAsset
- ////////////////////////////////////////////////////////////
- var dbAsset = dragonBones.DragonBonesAsset.prototype;
- dbAsset.init = function (factory, atlasUUID) {
- this._factory = factory; // If create by manual, uuid is empty.
- // Only support json format, if remote load dbbin, must set uuid by manual.
- if (!this._uuid && this.dragonBonesJson) {
- var rawData = JSON.parse(this.dragonBonesJson);
- this._uuid = rawData.name;
- }
- var armatureKey = this._uuid + "#" + atlasUUID;
- var dragonBonesData = this._factory.getDragonBonesData(armatureKey);
- if (dragonBonesData) return armatureKey;
- var filePath = null;
- if (this.dragonBonesJson) {
- filePath = this.dragonBonesJson;
- } else {
- filePath = cacheManager.getCache(this.nativeUrl) || this.nativeUrl;
- }
- this._factory.parseDragonBonesDataByPath(filePath, armatureKey);
- return armatureKey;
- };
- var armatureCacheMgr = dragonBones.ArmatureCacheMgr.getInstance();
- dragonBones.armatureCacheMgr = armatureCacheMgr;
- dbAsset._clear = function () {
- if (this._factory) {
- this._factory.removeDragonBonesDataByUUID(this._uuid, true);
- }
- armatureCacheMgr.removeArmatureCache(this._uuid);
- }; ////////////////////////////////////////////////////////////
- // adapt attach util
- ////////////////////////////////////////////////////////////
- var attachUtilProto = dragonBones.AttachUtil.prototype;
- var _attachUtilInit = attachUtilProto.init;
- attachUtilProto.init = function (armatureDisplay) {
- _attachUtilInit.call(this, armatureDisplay);
- this._nativeDisplay = armatureDisplay._nativeDisplay;
- this._attachUtilNative = null;
- };
- var _generateAllAttachedNodes = attachUtilProto.generateAllAttachedNodes;
- attachUtilProto.generateAllAttachedNodes = function () {
- var res = _generateAllAttachedNodes.call(this);
- this._associateAttachedNode();
- return res;
- };
- var _generateAttachedNodes = attachUtilProto.generateAttachedNodes;
- attachUtilProto.generateAttachedNodes = function (boneName) {
- var res = _generateAttachedNodes.call(this, boneName);
- this._associateAttachedNode();
- return res;
- };
- var _associateAttachedNode = attachUtilProto._associateAttachedNode;
- attachUtilProto._associateAttachedNode = function () {
- if (!this._inited) return;
- var rootNode = this._armatureNode.getChildByName('ATTACHED_NODE_TREE');
- if (!rootNode || !rootNode.isValid) return; // associate js
- _associateAttachedNode.call(this); // associate native
- if (!this._attachUtilNative) {
- if (this._armatureDisplay.isAnimationCached()) {
- this._attachUtilNative = new dragonBones.CacheModeAttachUtil();
- } else {
- this._attachUtilNative = new dragonBones.RealTimeAttachUtil();
- }
- this._nativeDisplay.setAttachUtil(this._attachUtilNative);
- }
- this._attachUtilNative.associateAttachedNode(this._armature, this._armatureNode._proxy);
- }; ////////////////////////////////////////////////////////////
- // override ArmatureDisplay
- ////////////////////////////////////////////////////////////
- dragonBones.ArmatureDisplay._assembler = null;
- var armatureDisplayProto = dragonBones.ArmatureDisplay.prototype;
- var renderCompProto = cc.RenderComponent.prototype;
- var AnimationCacheMode = dragonBones.ArmatureDisplay.AnimationCacheMode;
- Object.defineProperty(armatureDisplayProto, 'armatureName', {
- get: function get() {
- return this._armatureName;
- },
- set: function set(value) {
- this._armatureName = value;
- var animNames = this.getAnimationNames(this._armatureName);
- if (!this.animationName || animNames.indexOf(this.animationName) < 0) {
- this.animationName = '';
- }
- var oldArmature = this._armature;
- if (this._armature) {
- if (!this.isAnimationCached()) {
- this._factory.remove(this._armature);
- }
- this._armature = null;
- }
- this._nativeDisplay = null;
- this._refresh();
- if (oldArmature && oldArmature != this._armature) {
- oldArmature.dispose();
- }
- if (this._armature && !this.isAnimationCached()) {
- this._factory.add(this._armature);
- }
- },
- visible: false
- });
- Object.defineProperty(armatureDisplayProto, "premultipliedAlpha", {
- get: function get() {
- if (this._premultipliedAlpha === undefined) {
- return false;
- }
- return this._premultipliedAlpha;
- },
- set: function set(value) {
- this._premultipliedAlpha = value;
- if (this._nativeDisplay) {
- this._nativeDisplay.setOpacityModifyRGB(this._premultipliedAlpha);
- }
- }
- });
- var _initDebugDraw = armatureDisplayProto._initDebugDraw;
- armatureDisplayProto._initDebugDraw = function () {
- _initDebugDraw.call(this);
- if (this._armature && !this.isAnimationCached()) {
- this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
- }
- };
- var _updateBatch = armatureDisplayProto._updateBatch;
- armatureDisplayProto._updateBatch = function () {
- _updateBatch.call(this);
- if (this._nativeDisplay) {
- this._nativeDisplay.setBatchEnabled(this.enableBatch);
- }
- this._assembler && this._assembler.clearEffect();
- };
- armatureDisplayProto._clearRenderData = function () {
- this._nativeDisplay = null;
- };
- armatureDisplayProto._resetAssembler = function () {
- this._assembler = new renderer.CustomAssembler();
- this.node._proxy.setAssembler(this._assembler);
- };
- var _updateMaterial = armatureDisplayProto._updateMaterial;
- var _materialHash2IDMap = {};
- var _materialId = 1;
- armatureDisplayProto._updateMaterial = function () {
- _updateMaterial.call(this);
- this._assembler && this._assembler.clearEffect();
- var baseMaterial = this.getMaterial(0);
- if (this._nativeDisplay && baseMaterial) {
- var originHash = baseMaterial.effect.getHash();
- var id = _materialHash2IDMap[originHash] || _materialId++;
- _materialHash2IDMap[originHash] = id;
- baseMaterial.effect.updateHash(id);
- var nativeEffect = baseMaterial.effect._nativeObj;
- this._nativeDisplay.setEffect(nativeEffect);
- }
- };
- armatureDisplayProto._buildArmature = function () {
- if (!this.dragonAsset || !this.dragonAtlasAsset || !this.armatureName) {
- this._clearRenderData();
- return;
- }
- if (this._nativeDisplay) {
- this._nativeDisplay.dispose();
- this._nativeDisplay._comp = null;
- this._nativeDisplay = null;
- }
- var atlasUUID = this.dragonAtlasAsset._uuid;
- this._armatureKey = this.dragonAsset.init(this._factory, atlasUUID);
- if (this.isAnimationCached()) {
- this._nativeDisplay = new dragonBones.CCArmatureCacheDisplay(this.armatureName, this._armatureKey, atlasUUID, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
- this._armature = this._nativeDisplay.armature();
- } else {
- this._nativeDisplay = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", atlasUUID);
- if (!this._nativeDisplay) {
- this._clearRenderData();
- return;
- }
- this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
- this._armature = this._nativeDisplay.armature();
- this._armature.animation.timeScale = this.timeScale;
- this._factory.add(this._armature);
- } // add all event into native display
- var callbackTable = this._eventTarget._callbackTable; // just use to adapt to native api
- var emptyHandle = function emptyHandle() {};
- for (var key in callbackTable) {
- var list = callbackTable[key];
- if (!list || !list.callbackInfos || !list.callbackInfos.length) continue;
- if (this.isAnimationCached()) {
- this._nativeDisplay.addDBEventListener(key);
- } else {
- this._nativeDisplay.addDBEventListener(key, emptyHandle);
- }
- }
- this._preCacheMode = this._cacheMode;
- this._nativeDisplay._ccNode = this.node;
- this._nativeDisplay._comp = this;
- this._nativeDisplay._eventTarget = this._eventTarget;
- this._nativeDisplay.bindNodeProxy(this.node._proxy);
- this._nativeDisplay.setOpacityModifyRGB(this.premultipliedAlpha);
- this._nativeDisplay.setBatchEnabled(this.enableBatch);
- this._nativeDisplay.setColor(this.node.color);
- this._nativeDisplay.setDBEventCallback(function (eventObject) {
- this._eventTarget.emit(eventObject.type, eventObject);
- });
- this.attachUtil.init(this);
- this.attachUtil._associateAttachedNode();
- if (this.animationName) {
- this.playAnimation(this.animationName, this.playTimes);
- }
- this._updateMaterial();
- this.markForRender(true);
- };
- armatureDisplayProto._updateColor = function () {
- if (this._nativeDisplay) {
- this._nativeDisplay.setColor(this.node.color);
- }
- };
- armatureDisplayProto.playAnimation = function (animName, playTimes) {
- this.playTimes = playTimes === undefined ? -1 : playTimes;
- this.animationName = animName;
- if (this._nativeDisplay) {
- if (this.isAnimationCached()) {
- return this._nativeDisplay.playAnimation(animName, this.playTimes);
- } else {
- if (this._armature) {
- return this._armature.animation.play(animName, this.playTimes);
- }
- }
- }
- return null;
- };
- armatureDisplayProto.updateAnimationCache = function (animName) {
- if (!this.isAnimationCached()) return;
- if (this._nativeDisplay) {
- if (animName) {
- this._nativeDisplay.updateAnimationCache(animName);
- } else {
- this._nativeDisplay.updateAllAnimationCache();
- }
- }
- };
- armatureDisplayProto.invalidAnimationCache = function () {
- if (!this.isAnimationCached()) return;
- if (this._nativeDisplay) {
- this._nativeDisplay.updateAllAnimationCache();
- }
- };
- armatureDisplayProto.onEnable = function () {
- renderCompProto.onEnable.call(this);
- if (this._armature && !this.isAnimationCached()) {
- this._factory.add(this._armature);
- }
- };
- armatureDisplayProto.onDisable = function () {
- renderCompProto.onDisable.call(this);
- if (this._armature && !this.isAnimationCached()) {
- this._factory.remove(this._armature);
- }
- };
- var _onLoad = armatureDisplayProto.onLoad;
- armatureDisplayProto.onLoad = function () {
- if (_onLoad) {
- _onLoad.call(this);
- }
- };
- armatureDisplayProto.once = function (eventType, listener, target) {
- if (this._nativeDisplay) {
- if (this.isAnimationCached()) {
- this._nativeDisplay.addDBEventListener(eventType);
- } else {
- this._nativeDisplay.addDBEventListener(eventType, listener);
- }
- }
- this._eventTarget.once(eventType, listener, target);
- };
- armatureDisplayProto.addEventListener = function (eventType, listener, target) {
- if (this._nativeDisplay) {
- if (this.isAnimationCached()) {
- this._nativeDisplay.addDBEventListener(eventType);
- } else {
- this._nativeDisplay.addDBEventListener(eventType, listener);
- }
- }
- this._eventTarget.on(eventType, listener, target);
- };
- armatureDisplayProto.removeEventListener = function (eventType, listener, target) {
- if (this._nativeDisplay) {
- if (this.isAnimationCached()) {
- this._nativeDisplay.removeDBEventListener(eventType);
- } else {
- this._nativeDisplay.removeDBEventListener(eventType, listener);
- }
- }
- this._eventTarget.off(eventType, listener, target);
- };
- var _onDestroy = armatureDisplayProto.onDestroy;
- armatureDisplayProto.onDestroy = function () {
- _onDestroy.call(this);
- if (this._nativeDisplay) {
- this._nativeDisplay.dispose();
- this._nativeDisplay._comp = null;
- this._nativeDisplay = null;
- }
- this._materialCache = null;
- };
- armatureDisplayProto.update = function () {
- var nativeDisplay = this._nativeDisplay;
- if (!nativeDisplay) return;
- var node = this.node;
- if (!node) return;
- if (!this.isAnimationCached() && this._debugDraw && this.debugBones) {
- var _nativeDisplay = this._nativeDisplay;
- this._debugData = this._debugData || _nativeDisplay.getDebugData();
- if (!this._debugData) return;
- var graphics = this._debugDraw;
- graphics.clear();
- var debugData = this._debugData;
- var debugIdx = 0;
- graphics.lineWidth = 5;
- graphics.strokeColor = _boneColor;
- graphics.fillColor = _slotColor; // Root bone color is same as slot color.
- var debugBonesLen = debugData[debugIdx++];
- for (var i = 0; i < debugBonesLen; i += 4) {
- var bx = debugData[debugIdx++];
- var by = debugData[debugIdx++];
- var x = debugData[debugIdx++];
- var y = debugData[debugIdx++]; // Bone lengths.
- graphics.moveTo(bx, by);
- graphics.lineTo(x, y);
- graphics.stroke(); // Bone origins.
- graphics.circle(bx, by, Math.PI * 2);
- graphics.fill();
- if (i === 0) {
- graphics.fillColor = _originColor;
- }
- }
- }
- };
- })();
- },{"./jsb-cache-manager":30,"constants":1}],32:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!(cc && cc.EditBox)) {
- return;
- }
- var EditBox = cc.EditBox;
- var js = cc.js;
- var KeyboardReturnType = EditBox.KeyboardReturnType;
- var InputMode = EditBox.InputMode;
- var InputFlag = EditBox.InputFlag;
- var MAX_VALUE = 65535;
- var worldMat = new cc.Mat4(),
- cameraMat = new cc.Mat4();
- function getInputType(type) {
- switch (type) {
- case InputMode.EMAIL_ADDR:
- return 'email';
- case InputMode.NUMERIC:
- case InputMode.DECIMAL:
- return 'number';
- case InputMode.PHONE_NUMBER:
- return 'phone';
- case InputMode.URL:
- return 'url';
- case InputMode.SINGLE_LINE:
- case InputMode.ANY:
- default:
- return 'text';
- }
- }
- function getKeyboardReturnType(type) {
- switch (type) {
- case KeyboardReturnType.DEFAULT:
- case KeyboardReturnType.DONE:
- return 'done';
- case KeyboardReturnType.SEND:
- return 'send';
- case KeyboardReturnType.SEARCH:
- return 'search';
- case KeyboardReturnType.GO:
- return 'go';
- case KeyboardReturnType.NEXT:
- return 'next';
- }
- return 'done';
- }
- var BaseClass = EditBox._ImplClass;
- function JsbEditBoxImpl() {
- BaseClass.call(this);
- }
- js.extend(JsbEditBoxImpl, BaseClass);
- EditBox._ImplClass = JsbEditBoxImpl;
- Object.assign(JsbEditBoxImpl.prototype, {
- init: function init(delegate) {
- if (!delegate) {
- cc.error('EditBox init failed');
- return;
- }
- this._delegate = delegate;
- },
- _onResize: function _onResize() {
- var _this$_getRect = this._getRect(),
- x = _this$_getRect.x,
- y = _this$_getRect.y,
- width = _this$_getRect.width,
- height = _this$_getRect.height;
- jsb.inputBox.updateRect(x, y, width, height);
- },
- beginEditing: function beginEditing() {
- var self = this;
- var delegate = this._delegate;
- var multiline = delegate.inputMode === InputMode.ANY;
- var rect = this._getRect();
- var maxLength = delegate.maxLength < 0 ? MAX_VALUE : delegate.maxLength;
- var inputTypeString = getInputType(delegate.inputMode);
- if (delegate.inputFlag === InputFlag.PASSWORD) {
- inputTypeString = 'password';
- }
- function onConfirm(res) {
- delegate.editBoxEditingReturn();
- }
- function onInput(res) {
- if (delegate._string !== res.value) {
- delegate.editBoxTextChanged(res.value);
- }
- }
- function onComplete(res) {
- self.endEditing();
- }
- jsb.inputBox.onInput(onInput);
- jsb.inputBox.onConfirm(onConfirm);
- jsb.inputBox.onComplete(onComplete);
- if (!cc.sys.isMobile) {
- this._delegate._hideLabels();
- }
- jsb.inputBox.show({
- defaultValue: delegate._string,
- maxLength: maxLength,
- multiple: multiline,
- confirmHold: false,
- confirmType: getKeyboardReturnType(delegate.returnType),
- inputType: inputTypeString,
- originX: rect.x,
- originY: rect.y,
- width: rect.width,
- height: rect.height
- });
- this._editing = true;
- delegate.editBoxEditingDidBegan();
- if (!cc.sys.isMobile) {
- cc.view.on('canvas-resize', this._onResize, this);
- }
- },
- endEditing: function endEditing() {
- jsb.inputBox.offConfirm();
- jsb.inputBox.offInput();
- jsb.inputBox.offComplete();
- this._editing = false;
- if (!cc.sys.isMobile) {
- this._delegate._showLabels();
- }
- jsb.inputBox.hide();
- this._delegate.editBoxEditingDidEnded();
- if (!cc.sys.isMobile) {
- cc.view.off('canvas-resize', this._onResize, this);
- }
- },
- _getRect: function _getRect() {
- var node = this._delegate.node,
- viewScaleX = cc.view._scaleX,
- viewScaleY = cc.view._scaleY;
- var dpr = cc.view._devicePixelRatio;
- node.getWorldMatrix(worldMat);
- var camera = cc.Camera.findCamera(node);
- if (!camera) {
- return new cc.Rect();
- }
- camera.getWorldToScreenMatrix2D(cameraMat);
- cc.Mat4.multiply(cameraMat, cameraMat, worldMat);
- var contentSize = node._contentSize;
- var vec3 = cc.v3();
- vec3.x = -node._anchorPoint.x * contentSize.width;
- vec3.y = -node._anchorPoint.y * contentSize.height;
- cc.Mat4.translate(cameraMat, cameraMat, vec3);
- viewScaleX /= dpr;
- viewScaleY /= dpr;
- var finalScaleX = cameraMat.m[0] * viewScaleX;
- var finaleScaleY = cameraMat.m[5] * viewScaleY;
- var viewportRect = cc.view._viewportRect;
- var offsetX = viewportRect.x / dpr,
- offsetY = viewportRect.y / dpr;
- return {
- x: cameraMat.m[12] * viewScaleX + offsetX,
- y: cameraMat.m[13] * viewScaleY + offsetY,
- width: contentSize.width * finalScaleX,
- height: contentSize.height * finaleScaleY
- };
- }
- });
- })();
- },{}],33:[function(require,module,exports){
- "use strict";
- // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- (function () {
- if (!cc.EffectVariant) return;
- var EffectVariant = cc.EffectVariant;
- var _init = EffectVariant.prototype.init;
- Object.assign(EffectVariant.prototype, {
- init: function init(effect) {
- _init.call(this, effect);
- this._nativeObj = new renderer.EffectVariant(effect._nativeObj);
- },
- _onEffectChanged: function _onEffectChanged() {
- var nativeEffect = this._effect ? this._effect._nativeObj : null;
- this._nativeObj.setEffect(nativeEffect);
- },
- updateHash: function updateHash(hash) {
- this._nativeObj.updateHash(hash);
- }
- });
- })();
- },{}],34:[function(require,module,exports){
- "use strict";
- // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- var gfx = window.gfx; // Effect
- var Effect = cc.Effect;
- var _init = Effect.prototype.init;
- var _clone = Effect.prototype.clone;
- var _switchTechnique = Effect.prototype.switchTechnique;
- Object.assign(Effect.prototype, {
- init: function init(name, techniques, techniqueIndex, asset, createNative) {
- _init.call(this, name, techniques, techniqueIndex, asset);
- if (createNative) {
- this._nativeObj = new renderer.EffectNative();
- this._nativeObj.init(techniques);
- this._nativePtr = this._nativeObj.self();
- }
- },
- clone: function clone() {
- var effect = _clone.call(this);
- effect._nativeObj = new renderer.EffectNative();
- effect._nativeObj.copy(this._nativeObj);
- effect._nativePtr = effect._nativeObj.self();
- return effect;
- },
- switchTechnique: function switchTechnique(techniqueIndex) {
- _switchTechnique.call(this, techniqueIndex);
- this._nativeObj.switchTechnique(techniqueIndex);
- }
- }); // EffectBase
- var EffectBase = cc.EffectBase;
- var _setCullMode = EffectBase.prototype.setCullMode;
- var _setBlend = EffectBase.prototype.setBlend;
- var _setStencilEnabled = EffectBase.prototype.setStencilEnabled;
- var _setStencil = EffectBase.prototype.setStencil;
- var _setDepth = EffectBase.prototype.setDepth;
- var _define = EffectBase.prototype.define;
- var _setProperty = EffectBase.prototype.setProperty;
- Object.assign(EffectBase.prototype, {
- setCullMode: function setCullMode() {
- var cullMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gfx.CULL_BACK;
- var passIdx = arguments.length > 1 ? arguments[1] : undefined;
- _setCullMode.call(this, cullMode, passIdx);
- this._nativeObj.setCullMode(cullMode, passIdx === undefined ? -1 : passIdx);
- },
- setBlend: function setBlend() {
- var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var blendEq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gfx.BLEND_FUNC_ADD;
- var blendSrc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : gfx.BLEND_SRC_ALPHA;
- var blendDst = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : gfx.BLEND_ONE_MINUS_SRC_ALPHA;
- var blendAlphaEq = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : gfx.BLEND_FUNC_ADD;
- var blendSrcAlpha = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : gfx.BLEND_SRC_ALPHA;
- var blendDstAlpha = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : gfx.BLEND_ONE_MINUS_SRC_ALPHA;
- var blendColor = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0xffffffff;
- var passIdx = arguments.length > 8 ? arguments[8] : undefined;
- _setBlend.call(this, enabled, blendEq, blendSrc, blendDst, blendAlphaEq, blendSrcAlpha, blendDstAlpha, blendColor, passIdx);
- this._nativeObj.setBlend(enabled, blendEq, blendSrc, blendDst, blendAlphaEq, blendSrcAlpha, blendDstAlpha, blendColor, passIdx === undefined ? -1 : passIdx);
- },
- setDepth: function setDepth(depthTest, depthWrite, depthFunc, passIdx) {
- _setDepth.call(this, depthTest, depthWrite, depthFunc, passIdx);
- this._nativeObj.setDepth(depthTest, depthWrite, depthFunc, passIdx === undefined ? -1 : passIdx);
- },
- setStencilEnabled: function setStencilEnabled(enabled, passIdx) {
- _setStencilEnabled.call(this, enabled, passIdx);
- this._nativeObj.setStencilTest(enabled, passIdx === undefined ? -1 : passIdx);
- },
- setStencil: function setStencil() {
- var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gfx.STENCIL_INHERIT;
- var stencilFunc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gfx.DS_FUNC_ALWAYS;
- var stencilRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var stencilMask = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0xff;
- var stencilFailOp = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : gfx.STENCIL_OP_KEEP;
- var stencilZFailOp = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : gfx.STENCIL_OP_KEEP;
- var stencilZPassOp = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : gfx.STENCIL_OP_KEEP;
- var stencilWriteMask = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0xff;
- var passIdx = arguments.length > 8 ? arguments[8] : undefined;
- _setStencil.call(this, enabled, stencilFunc, stencilRef, stencilMask, stencilFailOp, stencilZFailOp, stencilZPassOp, stencilWriteMask, passIdx);
- this._nativeObj.setStencil(stencilFunc, stencilRef, stencilMask, stencilFailOp, stencilZFailOp, stencilZPassOp, stencilWriteMask, passIdx === undefined ? -1 : passIdx);
- },
- define: function define(name, value, passIdx, force) {
- _define.call(this, name, value, passIdx, force);
- this._nativeObj.define(name, value, passIdx === undefined ? -1 : passIdx);
- },
- updateHash: function updateHash(hash) {
- this._nativeObj.updateHash(hash);
- },
- setProperty: function setProperty(name, val, passIdx, directly) {
- _setProperty.call(this, name, val, passIdx);
- var prop = this.getProperty(name);
- if (prop !== undefined) {
- this._nativeObj.setProperty(name, prop, passIdx === undefined ? -1 : passIdx, directly);
- }
- }
- });
- },{}],35:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2017-2019 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of fsUtils software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in fsUtils License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var fs = jsb.fileUtils;
- var jsb_downloader = null;
- var downloading = new cc.AssetManager.Cache();
- var tempDir = '';
- var fsUtils = {
- fs: fs,
- initJsbDownloader: function initJsbDownloader(jsbDownloaderMaxTasks, jsbDownloaderTimeout) {
- jsb_downloader = new jsb.Downloader({
- countOfMaxProcessingTasks: jsbDownloaderMaxTasks || 32,
- timeoutInSeconds: jsbDownloaderTimeout || 30,
- tempFileNameSuffix: '.tmp'
- });
- tempDir = fsUtils.getUserDataPath() + '/temp';
- !fs.isDirectoryExist(tempDir) && fs.createDirectory(tempDir);
- jsb_downloader.setOnFileTaskSuccess(function (task) {
- if (!downloading.has(task.requestURL)) return;
- var _downloading$remove = downloading.remove(task.requestURL),
- onComplete = _downloading$remove.onComplete;
- onComplete && onComplete(null, task.storagePath);
- });
- jsb_downloader.setOnTaskError(function (task, errorCode, errorCodeInternal, errorStr) {
- if (!downloading.has(task.requestURL)) return;
- var _downloading$remove2 = downloading.remove(task.requestURL),
- onComplete = _downloading$remove2.onComplete;
- cc.error("Download file failed: path: ".concat(task.requestURL, " message: ").concat(errorStr, ", ").concat(errorCode));
- onComplete(new Error(errorStr), null);
- });
- jsb_downloader.setOnTaskProgress(function (task, bytesReceived, totalBytesReceived, totalBytesExpected) {
- if (!downloading.has(task.requestURL)) return;
- var _downloading$get = downloading.get(task.requestURL),
- onProgress = _downloading$get.onProgress;
- onProgress && onProgress(totalBytesReceived, totalBytesExpected);
- });
- },
- getUserDataPath: function getUserDataPath() {
- return fs.getWritablePath().replace(/[\/\\]*$/, '');
- },
- checkFsValid: function checkFsValid() {
- if (!fs) {
- cc.warn('can not get the file system!');
- return false;
- }
- return true;
- },
- deleteFile: function deleteFile(filePath, onComplete) {
- var result = fs.removeFile(filePath);
- if (result === true) {
- onComplete && onComplete(null);
- } else {
- cc.warn("Delete file failed: path: ".concat(filePath));
- onComplete && onComplete(new Error('delete file failed'));
- }
- },
- downloadFile: function downloadFile(remoteUrl, filePath, header, onProgress, onComplete) {
- downloading.add(remoteUrl, {
- onProgress: onProgress,
- onComplete: onComplete
- });
- var storagePath = filePath;
- if (!storagePath) storagePath = tempDir + '/' + performance.now() + cc.path.extname(remoteUrl);
- jsb_downloader.createDownloadFileTask(remoteUrl, storagePath, header);
- },
- saveFile: function saveFile(srcPath, destPath, onComplete) {
- var err = null;
- var result = fs.writeDataToFile(fs.getDataFromFile(srcPath), destPath);
- fs.removeFile(srcPath);
- if (!result) {
- err = new Error("Save file failed: path: ".concat(srcPath));
- cc.warn(err.message);
- }
- onComplete && onComplete(err);
- },
- copyFile: function copyFile(srcPath, destPath, onComplete) {
- var err = null;
- var result = fs.writeDataToFile(fs.getDataFromFile(srcPath), destPath);
- if (!result) {
- err = new Error("Copy file failed: path: ".concat(srcPath));
- cc.warn(err.message);
- }
- onComplete && onComplete(err);
- },
- writeFile: function writeFile(path, data, encoding, onComplete) {
- var result = null;
- var err = null;
- if (encoding === 'utf-8' || encoding === 'utf8') {
- result = fs.writeStringToFile(data, path);
- } else {
- result = fs.writeDataToFile(data, path);
- }
- if (!result) {
- err = new Error("Write file failed: path: ".concat(path));
- cc.warn(err.message);
- }
- onComplete && onComplete(err);
- },
- writeFileSync: function writeFileSync(path, data, encoding) {
- var result = null;
- if (encoding === 'utf-8' || encoding === 'utf8') {
- result = fs.writeStringToFile(data, path);
- } else {
- result = fs.writeDataToFile(data, path);
- }
- if (!result) {
- cc.warn("Write file failed: path: ".concat(path));
- return new Error("Write file failed: path: ".concat(path));
- }
- },
- readFile: function readFile(filePath, encoding, onComplete) {
- var content = null,
- err = null;
- if (encoding === 'utf-8' || encoding === 'utf8') {
- content = fs.getStringFromFile(filePath);
- } else {
- content = fs.getDataFromFile(filePath);
- }
- if (!content) {
- err = new Error("Read file failed: path: ".concat(filePath));
- cc.warn(err.message);
- }
- onComplete && onComplete(err, content);
- },
- readDir: function readDir(filePath, onComplete) {
- var files = null,
- err = null;
- try {
- files = fs.listFiles(filePath);
- } catch (e) {
- cc.warn("Read dir failed: path: ".concat(filePath, " message: ").concat(e.message));
- err = new Error(e.message);
- }
- onComplete && onComplete(err, files);
- },
- readText: function readText(filePath, onComplete) {
- fsUtils.readFile(filePath, 'utf8', onComplete);
- },
- readArrayBuffer: function readArrayBuffer(filePath, onComplete) {
- fsUtils.readFile(filePath, '', onComplete);
- },
- readJson: function readJson(filePath, onComplete) {
- fsUtils.readFile(filePath, 'utf8', function (err, text) {
- var out = null;
- if (!err) {
- try {
- out = JSON.parse(text);
- } catch (e) {
- cc.warn("Read json failed: path: ".concat(filePath, " message: ").concat(e.message));
- err = new Error(e.message);
- }
- }
- onComplete && onComplete(err, out);
- });
- },
- readJsonSync: function readJsonSync(path) {
- try {
- var str = fs.getStringFromFile(path);
- return JSON.parse(str);
- } catch (e) {
- cc.warn("Read json failed: path: ".concat(path, " message: ").concat(e.message));
- return new Error(e.message);
- }
- },
- makeDirSync: function makeDirSync(path, recursive) {
- var result = fs.createDirectory(path);
- if (!result) {
- cc.warn("Make directory failed: path: ".concat(path));
- return new Error("Make directory failed: path: ".concat(path));
- }
- },
- rmdirSync: function rmdirSync(dirPath, recursive) {
- var result = fs.removeDirectory(dirPath);
- if (!result) {
- cc.warn("rm directory failed: path: ".concat(dirPath));
- return new Error("rm directory failed: path: ".concat(dirPath));
- }
- },
- exists: function exists(filePath, onComplete) {
- var result = fs.isFileExist(filePath);
- onComplete && onComplete(result);
- },
- loadSubpackage: function loadSubpackage(name, onProgress, onComplete) {
- throw new Error('not implement');
- }
- };
- window.fsUtils = module.exports = fsUtils;
- },{}],36:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- cc.game.restart = function () {
- // Need to clear scene, or native object destructor won't be invoke.
- cc.director.getScene().destroy();
- cc.Object._deferredDestroy();
- cc.game.pause();
- __restartVM();
- };
- jsb.onError(function (location, message, stack) {
- console.error(location, message, stack);
- });
- jsb.onPause = function () {
- cc.game.emit(cc.game.EVENT_HIDE);
- };
- jsb.onResume = function () {
- cc.game.emit(cc.game.EVENT_SHOW);
- };
- jsb.onResize = function (size) {
- if (size.width === 0 || size.height === 0) return;
- size.width /= window.devicePixelRatio;
- size.height /= window.devicePixelRatio;
- window.resize(size.width, size.height);
- };
- },{}],37:[function(require,module,exports){
- /****************************************************************************
- Copyright (c) 2013-2016 Chukong Technologies Inc.
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- 'use strict';
- var cacheManager = require('./jsb-cache-manager');
- var _require = require('./jsb-fs-utils'),
- downloadFile = _require.downloadFile,
- readText = _require.readText,
- readArrayBuffer = _require.readArrayBuffer,
- readJson = _require.readJson,
- getUserDataPath = _require.getUserDataPath,
- initJsbDownloader = _require.initJsbDownloader;
- var REGEX = /^\w+:\/\/.*/;
- var downloader = cc.assetManager.downloader;
- var parser = cc.assetManager.parser;
- var presets = cc.assetManager.presets;
- downloader.maxConcurrency = 30;
- downloader.maxRequestsPerFrame = 60;
- presets['preload'].maxConcurrency = 15;
- presets['preload'].maxRequestsPerFrame = 30;
- presets['scene'].maxConcurrency = 32;
- presets['scene'].maxRequestsPerFrame = 64;
- presets['bundle'].maxConcurrency = 32;
- presets['bundle'].maxRequestsPerFrame = 64;
- var suffix = 0;
- var REMOTE_SERVER_ROOT = '';
- var remoteBundles = {};
- var failureMap = {};
- var maxRetryCountFromBreakpoint = 5;
- var loadedScripts = {};
- function downloadScript(url, options, onComplete) {
- if (typeof options === 'function') {
- onComplete = options;
- options = null;
- }
- if (loadedScripts[url]) return onComplete && onComplete();
- download(url, function (src, options, onComplete) {
- window.require(src);
- loadedScripts[url] = true;
- onComplete && onComplete(null);
- }, options, options.onFileProgress, onComplete);
- }
- function download(url, func, options, onFileProgress, onComplete) {
- var result = transformUrl(url, options);
- if (result.inLocal) {
- func(result.url, options, onComplete);
- } else if (result.inCache) {
- cacheManager.updateLastTime(url);
- func(result.url, options, function (err, data) {
- if (err) {
- cacheManager.removeCache(url);
- }
- onComplete(err, data);
- });
- } else {
- var time = Date.now();
- var storagePath = '';
- var failureRecord = failureMap[url];
- if (failureRecord) {
- storagePath = failureRecord.storagePath;
- } else if (options.__cacheBundleRoot__) {
- storagePath = "".concat(options.__cacheBundleRoot__, "/").concat(time).concat(suffix++).concat(cc.path.extname(url));
- } else {
- storagePath = "".concat(time).concat(suffix++).concat(cc.path.extname(url));
- }
- downloadFile(url, "".concat(cacheManager.cacheDir, "/").concat(storagePath), options.header, onFileProgress, function (err, path) {
- if (err) {
- if (failureRecord) {
- failureRecord.retryCount++;
- if (failureRecord.retryCount >= maxRetryCountFromBreakpoint) {
- delete failureMap[url];
- }
- } else {
- failureMap[url] = {
- retryCount: 0,
- storagePath: storagePath
- };
- }
- onComplete(err, null);
- return;
- }
- delete failureMap[url];
- func(path, options, function (err, data) {
- if (!err) {
- cacheManager.cacheFile(url, storagePath, options.__cacheBundleRoot__);
- }
- onComplete(err, data);
- });
- });
- }
- }
- function transformUrl(url, options) {
- var inLocal = false;
- var inCache = false;
- if (REGEX.test(url)) {
- if (options.reload) {
- return {
- url: url
- };
- } else {
- var cache = cacheManager.getCache(url);
- if (cache) {
- inCache = true;
- url = cache;
- }
- }
- } else {
- inLocal = true;
- }
- return {
- url: url,
- inLocal: inLocal,
- inCache: inCache
- };
- }
- function doNothing(content, options, onComplete) {
- onComplete(null, content);
- }
- function downloadAsset(url, options, onComplete) {
- download(url, doNothing, options, options.onFileProgress, onComplete);
- }
- function _getFontFamily(fontHandle) {
- var ttfIndex = fontHandle.lastIndexOf(".ttf");
- if (ttfIndex === -1) return fontHandle;
- var slashPos = fontHandle.lastIndexOf("/");
- var fontFamilyName;
- if (slashPos === -1) {
- fontFamilyName = fontHandle.substring(0, ttfIndex) + "_LABEL";
- } else {
- fontFamilyName = fontHandle.substring(slashPos + 1, ttfIndex) + "_LABEL";
- }
- if (fontFamilyName.indexOf(' ') !== -1) {
- fontFamilyName = '"' + fontFamilyName + '"';
- }
- return fontFamilyName;
- }
- function parseText(url, options, onComplete) {
- readText(url, onComplete);
- }
- function parseJson(url, options, onComplete) {
- readJson(url, onComplete);
- }
- function downloadText(url, options, onComplete) {
- download(url, parseText, options, options.onFileProgress, onComplete);
- }
- function parseArrayBuffer(url, options, onComplete) {
- readArrayBuffer(url, onComplete);
- }
- function downloadJson(url, options, onComplete) {
- download(url, parseJson, options, options.onFileProgress, onComplete);
- }
- function downloadBundle(nameOrUrl, options, onComplete) {
- var bundleName = cc.path.basename(nameOrUrl);
- var version = options.version || cc.assetManager.downloader.bundleVers[bundleName];
- var url;
- if (REGEX.test(nameOrUrl) || nameOrUrl.startsWith(getUserDataPath())) {
- url = nameOrUrl;
- cacheManager.makeBundleFolder(bundleName);
- } else {
- if (remoteBundles[bundleName]) {
- url = "".concat(REMOTE_SERVER_ROOT, "remote/").concat(bundleName);
- cacheManager.makeBundleFolder(bundleName);
- } else {
- url = "assets/".concat(bundleName);
- }
- }
- var config = "".concat(url, "/config.").concat(version ? version + '.' : '', "json");
- options.__cacheBundleRoot__ = bundleName;
- downloadJson(config, options, function (err, response) {
- if (err) {
- return onComplete(err, null);
- }
- var out = response;
- out && (out.base = url + '/');
- var js = "".concat(url, "/index.").concat(version ? version + '.' : '').concat(out.encrypted ? 'jsc' : "js");
- downloadScript(js, options, function (err) {
- if (err) {
- return onComplete(err, null);
- }
- onComplete(err, out);
- });
- });
- }
- ;
- function loadFont(url, options, onComplete) {
- var fontFamilyName = _getFontFamily(url);
- var fontFace = new FontFace(fontFamilyName, "url('" + url + "')");
- document.fonts.add(fontFace);
- fontFace.load();
- fontFace.loaded.then(function () {
- onComplete(null, fontFamilyName);
- }, function () {
- cc.warnID(4933, fontFamilyName);
- onComplete(null, fontFamilyName);
- });
- }
- function parsePlist(url, options, onComplete) {
- readText(url, function (err, file) {
- var result = null;
- if (!err) {
- result = cc.plistParser.parse(file);
- if (!result) err = new Error('parse failed');
- }
- onComplete && onComplete(err, result);
- });
- }
- parser.parsePVRTex = downloader.downloadDomImage;
- parser.parsePKMTex = downloader.downloadDomImage;
- downloader.downloadScript = downloadScript;
- downloader.register({
- // JS
- '.js': downloadScript,
- '.jsc': downloadScript,
- // Images
- '.png': downloadAsset,
- '.jpg': downloadAsset,
- '.bmp': downloadAsset,
- '.jpeg': downloadAsset,
- '.gif': downloadAsset,
- '.ico': downloadAsset,
- '.tiff': downloadAsset,
- '.webp': downloadAsset,
- '.image': downloadAsset,
- '.pvr': downloadAsset,
- '.pkm': downloadAsset,
- // Audio
- '.mp3': downloadAsset,
- '.ogg': downloadAsset,
- '.wav': downloadAsset,
- '.m4a': downloadAsset,
- // Video
- '.mp4': downloadAsset,
- '.avi': downloadAsset,
- '.mov': downloadAsset,
- '.mpg': downloadAsset,
- '.mpeg': downloadAsset,
- '.rm': downloadAsset,
- '.rmvb': downloadAsset,
- // Text
- '.txt': downloadAsset,
- '.xml': downloadAsset,
- '.vsh': downloadAsset,
- '.fsh': downloadAsset,
- '.atlas': downloadAsset,
- '.tmx': downloadAsset,
- '.tsx': downloadAsset,
- '.fnt': downloadAsset,
- '.plist': downloadAsset,
- '.json': downloadJson,
- '.ExportJson': downloadAsset,
- '.binary': downloadAsset,
- '.bin': downloadAsset,
- '.dbbin': downloadAsset,
- '.skel': downloadAsset,
- // Font
- '.font': downloadAsset,
- '.eot': downloadAsset,
- '.ttf': downloadAsset,
- '.woff': downloadAsset,
- '.svg': downloadAsset,
- '.ttc': downloadAsset,
- 'bundle': downloadBundle,
- 'default': downloadText
- });
- parser.register({
- // Images
- '.png': downloader.downloadDomImage,
- '.jpg': downloader.downloadDomImage,
- '.bmp': downloader.downloadDomImage,
- '.jpeg': downloader.downloadDomImage,
- '.gif': downloader.downloadDomImage,
- '.ico': downloader.downloadDomImage,
- '.tiff': downloader.downloadDomImage,
- '.webp': downloader.downloadDomImage,
- '.image': downloader.downloadDomImage,
- // compressed texture
- '.pvr': downloader.downloadDomImage,
- '.pkm': downloader.downloadDomImage,
- '.binary': parseArrayBuffer,
- '.bin': parseArrayBuffer,
- '.dbbin': parseArrayBuffer,
- '.skel': parseArrayBuffer,
- // Text
- '.txt': parseText,
- '.xml': parseText,
- '.vsh': parseText,
- '.fsh': parseText,
- '.atlas': parseText,
- '.tmx': parseText,
- '.tsx': parseText,
- '.fnt': parseText,
- '.plist': parsePlist,
- // Font
- '.font': loadFont,
- '.eot': loadFont,
- '.ttf': loadFont,
- '.woff': loadFont,
- '.svg': loadFont,
- '.ttc': loadFont,
- '.ExportJson': parseJson
- });
- cc.assetManager.transformPipeline.append(function (task) {
- var input = task.output = task.input;
- for (var i = 0, l = input.length; i < l; i++) {
- var item = input[i];
- if (item.config) {
- item.options.__cacheBundleRoot__ = item.config.name;
- }
- }
- });
- var originInit = cc.assetManager.init;
- cc.assetManager.init = function (options) {
- originInit.call(cc.assetManager, options);
- options.remoteBundles && options.remoteBundles.forEach(function (x) {
- return remoteBundles[x] = true;
- });
- REMOTE_SERVER_ROOT = options.server || '';
- if (REMOTE_SERVER_ROOT && !REMOTE_SERVER_ROOT.endsWith('/')) REMOTE_SERVER_ROOT += '/';
- initJsbDownloader(options.jsbDownloaderMaxTasks, options.jsbDownloaderTimeout);
- cacheManager.init();
- };
- },{"./jsb-cache-manager":30,"./jsb-fs-utils":35}],38:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (window.middleware === undefined) return;
- var ParticleSystem = cc.ParticleSystem;
- if (ParticleSystem === undefined) return;
- var PSProto = ParticleSystem.prototype;
- PSProto.initProperties = function () {
- this._simulator = new middleware.ParticleSimulator();
- this._previewTimer = null;
- this._focused = false;
- this._texture = null;
- this._renderData = null;
- this._simulator.__particleSystem__ = this;
- this._simulator.setFinishedCallback(function () {
- var self = this.__particleSystem__;
- self._finishedSimulation();
- });
- this._simulator.setStopCallback(function () {
- var self = this.__particleSystem__;
- self.stopSystem();
- });
- this._initProperties();
- }; // value type properties
- var propertiesList = ["positionType", "emissionRate", "totalParticles", "duration", "emitterMode", "life", "lifeVar", "startSize", "startSizeVar", "endSize", "endSizeVar", "startSpin", "startSpinVar", "endSpin", "endSpinVar", "angle", "angleVar", "speed", "speedVar", "radialAccel", "radialAccelVar", "tangentialAccel", "tangentialAccelVar", "rotationIsDir", "startRadius", "startRadiusVar", "endRadius", "endRadiusVar", "rotatePerS", "rotatePerSVar"];
- propertiesList.forEach(function (getSetName) {
- var varName = "_" + getSetName;
- Object.defineProperty(PSProto, getSetName, {
- get: function get() {
- this[varName] === undefined && (this[varName] = 0);
- return this[varName];
- },
- set: function set(val) {
- this[varName] = val;
- this._simulator && (this._simulator[getSetName] = val);
- }
- });
- }); // object type properties
- var objPropList = ['gravity', 'sourcePos', 'posVar', 'startColor', 'startColorVar', 'endColor', 'endColorVar'];
- PSProto._initProperties = function () {
- // init properties
- for (var key in propertiesList) {
- var propName = propertiesList[key];
- this[propName] = this[propName];
- }
- for (var _key in objPropList) {
- var _propName = objPropList[_key];
- this[_propName] = this[_propName];
- }
- }, Object.defineProperty(PSProto, 'gravity', {
- get: function get() {
- !this._gravity && (this._gravity = cc.v2(0, 0));
- return this._gravity;
- },
- set: function set(val) {
- if (!val) return;
- !this._gravity && (this._gravity = cc.v2(0, 0));
- this.gravity.x = val.x;
- this.gravity.y = val.y;
- this._simulator && this._simulator.setGravity(val.x, val.y, 0);
- }
- });
- Object.defineProperty(PSProto, 'sourcePos', {
- get: function get() {
- !this._sourcePos && (this._sourcePos = cc.v2(0, 0));
- return this._sourcePos;
- },
- set: function set(val) {
- if (!val) return;
- !this._sourcePos && (this._sourcePos = cc.v2(0, 0));
- this._sourcePos.x = val.x;
- this._sourcePos.y = val.y;
- this._simulator && this._simulator.setSourcePos(val.x, val.y, 0);
- }
- });
- Object.defineProperty(PSProto, 'posVar', {
- get: function get() {
- !this._posVar && (this._posVar = cc.v2(0, 0));
- return this._posVar;
- },
- set: function set(val) {
- if (!val) return;
- !this._posVar && (this._posVar = cc.v2(0, 0));
- this._posVar.x = val.x;
- this._posVar.y = val.y;
- this._simulator && this._simulator.setPosVar(val.x, val.y, 0);
- }
- });
- Object.defineProperty(PSProto, 'startColor', {
- get: function get() {
- !this._startColor && (this._startColor = cc.color(255, 255, 255, 255));
- return this._startColor;
- },
- set: function set(val) {
- if (!val) return;
- !this._startColor && (this._startColor = cc.color(255, 255, 255, 255));
- this._startColor.r = val.r;
- this._startColor.g = val.g;
- this._startColor.b = val.b;
- this._startColor.a = val.a;
- this._simulator && this._simulator.setStartColor(val.r, val.g, val.b, val.a);
- }
- });
- Object.defineProperty(PSProto, 'startColorVar', {
- get: function get() {
- !this._startColorVar && (this._startColorVar = cc.color(0, 0, 0, 0));
- return this._startColorVar;
- },
- set: function set(val) {
- if (!val) return;
- !this._startColorVar && (this._startColorVar = cc.color(0, 0, 0, 0));
- this._startColorVar.r = val.r;
- this._startColorVar.g = val.g;
- this._startColorVar.b = val.b;
- this._startColorVar.a = val.a;
- this._simulator && this._simulator.setStartColorVar(val.r, val.g, val.b, val.a);
- }
- });
- Object.defineProperty(PSProto, 'endColor', {
- get: function get() {
- !this._endColor && (this._endColor = cc.color(255, 255, 255, 0));
- return this._endColor;
- },
- set: function set(val) {
- if (!val) return;
- !this._endColor && (this._endColor = cc.color(255, 255, 255, 0));
- this._endColor.r = val.r;
- this._endColor.g = val.g;
- this._endColor.b = val.b;
- this._endColor.a = val.a;
- this._simulator && this._simulator.setEndColor(val.r, val.g, val.b, val.a);
- }
- });
- Object.defineProperty(PSProto, 'endColorVar', {
- get: function get() {
- !this._endColorVar && (this._endColorVar = cc.color(0, 0, 0, 0));
- return this._endColorVar;
- },
- set: function set(val) {
- if (!val) return;
- !this._endColorVar && (this._endColorVar = cc.color(0, 0, 0, 0));
- this._endColorVar.r = val.r;
- this._endColorVar.g = val.g;
- this._endColorVar.b = val.b;
- this._endColorVar.a = val.a;
- this._simulator && this._simulator.setEndColorVar(val.r, val.g, val.b, val.a);
- }
- });
- Object.defineProperty(PSProto, 'particleCount', {
- get: function get() {
- if (!this._simulator) {
- return 0;
- }
- return this._simulator.getParticleCount();
- }
- });
- Object.defineProperty(PSProto, 'active', {
- get: function get() {
- if (!this._simulator) {
- return false;
- }
- return this._simulator.active();
- }
- });
- PSProto.onLoad = function () {
- this._simulator.bindNodeProxy(this.node._proxy);
- }; // shield in native
- PSProto.update = null;
- PSProto.lateUpdate = null;
- PSProto._resetAssembler = function () {
- this._assembler = new renderer.CustomAssembler();
- this._assembler.setUseModel(true);
- this.node._proxy.setAssembler(this._assembler);
- };
- var _onEnable = PSProto.onEnable;
- PSProto.onEnable = function () {
- _onEnable.call(this);
- if (this._simulator) {
- this._simulator.onEnable();
- }
- };
- var _onDisable = PSProto.onDisable;
- PSProto.onDisable = function () {
- _onDisable.call(this);
- if (this._simulator) {
- this._simulator.onDisable();
- }
- };
- PSProto._onTextureLoaded = function () {
- this._simulator.updateUVs(this._renderSpriteFrame.uv);
- this._syncAspect();
- this._simulator.aspectRatio = this._aspectRatio || 1.0;
- this._updateMaterial();
- this.markForRender(true);
- };
- var _updateMaterial = PSProto._updateMaterial;
- PSProto._updateMaterial = function () {
- _updateMaterial.call(this);
- var material = this._materials[0];
- material && this._simulator.setEffect(material.effect._nativeObj); // upload hash value to native
- material && material.getHash();
- };
- var _initWithDictionary = PSProto._initWithDictionary;
- PSProto._initWithDictionary = function (content) {
- _initWithDictionary.call(this, content);
- this._initProperties();
- };
- var __preload = PSProto.__preload;
- PSProto.__preload = function () {
- __preload.call(this);
- this._initProperties();
- };
- })();
- },{}],39:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- // JS to Native bridges
- if (window.JavascriptJavaBridge && cc.sys.os == cc.sys.OS_ANDROID) {
- jsb.reflection = new JavascriptJavaBridge();
- cc.sys.capabilities["keyboard"] = true;
- } else if (window.JavaScriptObjCBridge && (cc.sys.os == cc.sys.OS_IOS || cc.sys.os == cc.sys.OS_OSX)) {
- jsb.reflection = new JavaScriptObjCBridge();
- }
- },{}],40:[function(require,module,exports){
- "use strict";
- var SafeArea = cc.SafeArea;
- if (SafeArea) {
- var _onEnable = SafeArea.prototype.onEnable;
- var _onDisable = SafeArea.prototype.onDisable;
- Object.assign(SafeArea.prototype, {
- onEnable: function onEnable() {
- _onEnable.call(this);
- this._adaptSafeAreaChangeWithThis = this.adaptSafeAreaChange.bind(this);
- this._updateAreaWithThis = this.adaptSafeAreaChange.bind(this);
- window.addEventListener('orientationchange', this._adaptSafeAreaChangeWithThis);
- window.addEventListener('safearea-change', this._updateAreaWithThis);
- },
- onDisable: function onDisable() {
- _onDisable.call(this);
- window.removeEventListener('orientationchange', this._adaptSafeAreaChangeWithThis);
- window.removeEventListener('safearea-change', this._updateAreaWithThis);
- },
- adaptSafeAreaChange: function adaptSafeAreaChange() {
- var _this = this;
- if (CC_JSB && (cc.sys.os === cc.sys.OS_IOS || cc.sys.os === cc.sys.OS_ANDROID)) {
- setTimeout(function () {
- _this.updateArea();
- }, 200);
- }
- }
- });
- }
- },{}],41:[function(require,module,exports){
- "use strict";
- (function () {
- if (!cc.SkinnedMeshRenderer) return;
- var SkinnedMeshAssembler = cc.SkinnedMeshRenderer.__assembler__.prototype;
- cc.js.mixin(SkinnedMeshAssembler, {
- updateRenderData: function updateRenderData(comp) {
- comp.calcJointMatrix();
- comp.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
- }
- });
- })();
- },{}],42:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var cacheManager = require('./jsb-cache-manager');
- (function () {
- if (window.sp === undefined || window.spine === undefined || window.middleware === undefined) return;
- sp.VertexEffectDelegate = spine.VertexEffectDelegate;
- jsb.generateGetSet(spine); // spine global time scale
- Object.defineProperty(sp, 'timeScale', {
- get: function get() {
- return this._timeScale;
- },
- set: function set(value) {
- this._timeScale = value;
- spine.SkeletonAnimation.setGlobalTimeScale(value);
- },
- configurable: true
- });
- var _slotColor = cc.color(0, 0, 255, 255);
- var _boneColor = cc.color(255, 0, 0, 255);
- var _meshColor = cc.color(255, 255, 0, 255);
- var _originColor = cc.color(0, 255, 0, 255);
- var skeletonDataProto = sp.SkeletonData.prototype;
- var _gTextureIdx = 1;
- var _textureKeyMap = {};
- var _textureMap = new WeakMap();
- var skeletonDataMgr = spine.SkeletonDataMgr.getInstance();
- spine.skeletonDataMgr = skeletonDataMgr;
- skeletonDataMgr.setDestroyCallback(function (textureIndex) {
- if (!textureIndex) return;
- var texKey = _textureKeyMap[textureIndex];
- if (texKey && _textureMap.has(texKey)) {
- _textureMap["delete"](texKey);
- delete _textureKeyMap[textureIndex];
- }
- });
- var skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance();
- spine.skeletonCacheMgr = skeletonCacheMgr;
- skeletonDataProto.destroy = function () {
- this.reset();
- skeletonCacheMgr.removeSkeletonCache(this._uuid);
- cc.Asset.prototype.destroy.call(this);
- };
- skeletonDataProto.reset = function () {
- if (this._skeletonCache) {
- spine.disposeSkeletonData(this._uuid);
- this._jsbTextures = null;
- this._skeletonCache = null;
- }
- this._atlasCache = null;
- };
- skeletonDataProto.getRuntimeData = function () {
- if (!this._skeletonCache) {
- this.init();
- }
- return this._skeletonCache;
- };
- skeletonDataProto.init = function () {
- if (this._skeletonCache) return;
- var uuid = this._uuid;
- if (!uuid) {
- cc.errorID(7504);
- return;
- }
- var skeletonCache = spine.retainSkeletonData(uuid);
- if (skeletonCache) {
- this._skeletonCache = skeletonCache;
- this.width = this._skeletonCache.getWidth();
- this.height = this._skeletonCache.getHeight();
- return;
- }
- var atlasText = this.atlasText;
- if (!atlasText) {
- cc.errorID(7508, this.name);
- return;
- }
- var textures = this.textures;
- var textureNames = this.textureNames;
- if (!(textures && textures.length > 0 && textureNames && textureNames.length > 0)) {
- cc.errorID(7507, this.name);
- return;
- }
- var jsbTextures = {};
- for (var i = 0; i < textures.length; ++i) {
- var texture = textures[i];
- var textureIdx = this.recordTexture(texture);
- var spTex = new middleware.Texture2D();
- spTex.setRealTextureIndex(textureIdx);
- spTex.setPixelsWide(texture.width);
- spTex.setPixelsHigh(texture.height);
- spTex.setTexParamCallback(function (texIdx, minFilter, magFilter, wrapS, warpT) {
- var tex = this.getTextureByIndex(texIdx);
- tex.setFilters(minFilter, magFilter);
- tex.setWrapMode(wrapS, warpT);
- }.bind(this));
- spTex.setNativeTexture(texture.getImpl());
- jsbTextures[textureNames[i]] = spTex;
- }
- this._jsbTextures = jsbTextures;
- var filePath = null;
- if (this.skeletonJsonStr) {
- filePath = this.skeletonJsonStr;
- } else {
- filePath = cacheManager.getCache(this.nativeUrl) || this.nativeUrl;
- }
- this._skeletonCache = spine.initSkeletonData(uuid, filePath, atlasText, jsbTextures, this.scale);
- if (this._skeletonCache) {
- this.width = this._skeletonCache.getWidth();
- this.height = this._skeletonCache.getHeight();
- }
- };
- skeletonDataProto.recordTexture = function (texture) {
- var index = _gTextureIdx;
- var texKey = _textureKeyMap[index] = {
- key: index
- };
- _textureMap.set(texKey, texture);
- _gTextureIdx++;
- return index;
- };
- skeletonDataProto.getTextureByIndex = function (textureIdx) {
- var texKey = _textureKeyMap[textureIdx];
- if (!texKey) return;
- return _textureMap.get(texKey);
- };
- var renderCompProto = cc.RenderComponent.prototype;
- var animation = spine.SkeletonAnimation.prototype; // The methods are added to be compatibility with old versions.
- animation.setCompleteListener = function (listener) {
- this._compeleteListener = listener;
- this.setCompleteListenerNative(function (trackEntry) {
- var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
- this._compeleteListener && this._compeleteListener(trackEntry, loopCount);
- });
- }; // The methods are added to be compatibility with old versions.
- animation.setTrackCompleteListener = function (trackEntry, listener) {
- this._trackCompeleteListener = listener;
- this.setTrackCompleteListenerNative(trackEntry, function (trackEntryNative) {
- var loopCount = Math.floor(trackEntryNative.trackTime / trackEntryNative.animationEnd);
- this._trackCompeleteListener && this._trackCompeleteListener(trackEntryNative, loopCount);
- });
- }; // Temporary solution before upgrade the Spine API
- animation.setAnimationListener = function (target, callback) {
- this._target = target;
- this._callback = callback;
- this.setStartListener(function (trackEntry) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.START, null, 0);
- }
- });
- this.setInterruptListener(function (trackEntry) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.INTERRUPT, null, 0);
- }
- });
- this.setEndListener(function (trackEntry) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.END, null, 0);
- }
- });
- this.setDisposeListener(function (trackEntry) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.DISPOSE, null, 0);
- }
- });
- this.setCompleteListener(function (trackEntry, loopCount) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.COMPLETE, null, loopCount);
- }
- });
- this.setEventListener(function (trackEntry, event) {
- if (this._target && this._callback) {
- this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.EVENT, event, 0);
- }
- });
- };
- sp.Skeleton._assembler = null;
- var skeleton = sp.Skeleton.prototype;
- var AnimationCacheMode = sp.Skeleton.AnimationCacheMode;
- Object.defineProperty(skeleton, 'paused', {
- get: function get() {
- return this._paused || false;
- },
- set: function set(value) {
- this._paused = value;
- if (this._nativeSkeleton) {
- this._nativeSkeleton.paused(value);
- }
- }
- });
- Object.defineProperty(skeleton, "premultipliedAlpha", {
- get: function get() {
- if (this._premultipliedAlpha === undefined) {
- return true;
- }
- return this._premultipliedAlpha;
- },
- set: function set(value) {
- this._premultipliedAlpha = value;
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setOpacityModifyRGB(this._premultipliedAlpha);
- }
- }
- });
- Object.defineProperty(skeleton, "timeScale", {
- get: function get() {
- if (this._timeScale === undefined) return 1.0;
- return this._timeScale;
- },
- set: function set(value) {
- this._timeScale = value;
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setTimeScale(this._timeScale);
- }
- }
- });
- var _updateDebugDraw = skeleton._updateDebugDraw;
- skeleton._updateDebugDraw = function () {
- _updateDebugDraw.call(this);
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
- this._nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
- this._nativeSkeleton.setDebugBonesEnabled(this.debugBones);
- }
- };
- var _updateUseTint = skeleton._updateUseTint;
- skeleton._updateUseTint = function () {
- _updateUseTint.call(this);
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setUseTint(this.useTint);
- }
- this._assembler && this._assembler.clearEffect();
- };
- var _updateBatch = skeleton._updateBatch;
- skeleton._updateBatch = function () {
- _updateBatch.call(this);
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setBatchEnabled(this.enableBatch);
- }
- this._assembler && this._assembler.clearEffect();
- };
- var _onLoad = skeleton.onLoad;
- skeleton.onLoad = function () {
- if (_onLoad) {
- _onLoad.call(this);
- }
- };
- skeleton._resetAssembler = function () {
- this._assembler = new renderer.CustomAssembler();
- this.node._proxy.setAssembler(this._assembler);
- };
- var _updateMaterial = skeleton._updateMaterial;
- var _materialHashMap = {};
- var _materialId = 1;
- skeleton._updateMaterial = function () {
- _updateMaterial.call(this);
- this._assembler && this._assembler.clearEffect();
- var baseMaterial = this.getMaterial(0);
- if (this._nativeSkeleton && baseMaterial) {
- var originHash = baseMaterial.effect.getHash();
- var id = _materialHashMap[originHash] || _materialId++;
- _materialHashMap[originHash] = id;
- baseMaterial.effect.updateHash(id);
- var nativeEffect = baseMaterial.effect._nativeObj;
- this._nativeSkeleton.setEffect(nativeEffect);
- }
- };
- skeleton.setSkeletonData = function (skeletonData) {
- null != skeletonData.width && null != skeletonData.height && this.node.setContentSize(skeletonData.width, skeletonData.height);
- var uuid = skeletonData._uuid;
- if (!uuid) {
- cc.errorID(7504);
- return;
- }
- var texValues = skeletonData.textures;
- var texKeys = skeletonData.textureNames;
- if (!(texValues && texValues.length > 0 && texKeys && texKeys.length > 0)) {
- cc.errorID(7507, skeletonData.name);
- return;
- }
- if (this._nativeSkeleton) {
- this._nativeSkeleton.stopSchedule();
- this._nativeSkeleton._comp = null;
- this._nativeSkeleton = null;
- }
- var nativeSkeleton = null;
- if (this.isAnimationCached()) {
- nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
- } else {
- nativeSkeleton = new spine.SkeletonAnimation();
- try {
- spine.initSkeletonRenderer(nativeSkeleton, uuid);
- } catch (e) {
- cc._throw(e);
- return;
- }
- nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
- nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
- nativeSkeleton.setDebugBonesEnabled(this.debugBones);
- }
- this._nativeSkeleton = nativeSkeleton;
- nativeSkeleton._comp = this;
- nativeSkeleton.setUseTint(this.useTint);
- nativeSkeleton.setOpacityModifyRGB(this.premultipliedAlpha);
- nativeSkeleton.setTimeScale(this.timeScale);
- nativeSkeleton.setBatchEnabled(this.enableBatch);
- nativeSkeleton.bindNodeProxy(this.node._proxy);
- nativeSkeleton.setColor(this.node.color);
- this._skeleton = nativeSkeleton.getSkeleton(); // init skeleton listener
- this._startListener && this.setStartListener(this._startListener);
- this._endListener && this.setEndListener(this._endListener);
- this._completeListener && this.setCompleteListener(this._completeListener);
- this._eventListener && this.setEventListener(this._eventListener);
- this._interruptListener && this.setInterruptListener(this._interruptListener);
- this._disposeListener && this.setDisposeListener(this._disposeListener);
- this._updateMaterial();
- this.markForRender(true);
- };
- skeleton._updateColor = function () {
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setColor(this.node.color);
- }
- };
- skeleton.setAnimationStateData = function (stateData) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._stateData = stateData;
- return this._nativeSkeleton.setAnimationStateData(stateData);
- }
- };
- skeleton.onEnable = function () {
- renderCompProto.onEnable.call(this);
- if (this._nativeSkeleton) {
- this._nativeSkeleton.onEnable();
- }
- };
- skeleton.onDisable = function () {
- renderCompProto.onDisable.call(this);
- if (this._nativeSkeleton) {
- this._nativeSkeleton.onDisable();
- }
- };
- skeleton.setVertexEffectDelegate = function (effectDelegate) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setVertexEffectDelegate(effectDelegate);
- }
- };
- skeleton.update = function () {
- var nativeSkeleton = this._nativeSkeleton;
- if (!nativeSkeleton) return;
- var node = this.node;
- if (!node) return;
- if (!this.isAnimationCached() && (this.debugBones || this.debugSlots || this.debugMesh) && this._debugRenderer) {
- var graphics = this._debugRenderer;
- graphics.clear();
- graphics.lineWidth = 2;
- var debugData = this._debugData || nativeSkeleton.getDebugData();
- if (!debugData) return;
- var debugIdx = 0,
- debugType = 0,
- debugLen = 0;
- while (true) {
- debugType = debugData[debugIdx++];
- if (debugType == 0) break;
- debugLen = debugData[debugIdx++];
- switch (debugType) {
- case 1:
- // slots
- graphics.strokeColor = _slotColor;
- for (var i = 0; i < debugLen; i += 8) {
- graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.close();
- graphics.stroke();
- }
- break;
- case 2:
- // mesh
- graphics.strokeColor = _meshColor;
- for (var _i = 0; _i < debugLen; _i += 6) {
- graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
- graphics.close();
- graphics.stroke();
- }
- break;
- case 3:
- // bones
- graphics.strokeColor = _boneColor;
- graphics.fillColor = _slotColor; // Root bone color is same as slot color.
- for (var _i2 = 0; _i2 < debugLen; _i2 += 4) {
- var bx = debugData[debugIdx++];
- var by = debugData[debugIdx++];
- var x = debugData[debugIdx++];
- var y = debugData[debugIdx++]; // Bone lengths.
- graphics.moveTo(bx, by);
- graphics.lineTo(x, y);
- graphics.stroke(); // Bone origins.
- graphics.circle(bx, by, Math.PI * 1.5);
- graphics.fill();
- if (_i2 === 0) {
- graphics.fillColor = _originColor;
- }
- }
- break;
- default:
- return;
- }
- }
- }
- };
- skeleton.updateWorldTransform = function () {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.updateWorldTransform();
- }
- };
- skeleton.setToSetupPose = function () {
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setToSetupPose();
- }
- };
- skeleton.setBonesToSetupPose = function () {
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setBonesToSetupPose();
- }
- };
- skeleton.setSlotsToSetupPose = function () {
- if (this._nativeSkeleton) {
- this._nativeSkeleton.setSlotsToSetupPose();
- }
- };
- skeleton.setSlotsRange = function (startSlotIndex, endSlotIndex) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setSlotsRange(startSlotIndex, endSlotIndex);
- }
- };
- skeleton.updateAnimationCache = function (animName) {
- if (!this.isAnimationCached()) return;
- if (this._nativeSkeleton) {
- if (animName) {
- this._nativeSkeleton.updateAnimationCache(animName);
- } else {
- this._nativeSkeleton.updateAllAnimationCache();
- }
- }
- };
- skeleton.invalidAnimationCache = function () {
- if (!this.isAnimationCached()) return;
- if (this._nativeSkeleton) {
- this._nativeSkeleton.updateAllAnimationCache();
- }
- };
- skeleton.findBone = function (boneName) {
- if (this._nativeSkeleton) return this._nativeSkeleton.findBone(boneName);
- return null;
- };
- skeleton.findSlot = function (slotName) {
- if (this._nativeSkeleton) return this._nativeSkeleton.findSlot(slotName);
- return null;
- };
- skeleton.setSkin = function (skinName) {
- if (this._nativeSkeleton) return this._nativeSkeleton.setSkin(skinName);
- return null;
- };
- skeleton.getAttachment = function (slotName, attachmentName) {
- if (this._nativeSkeleton) return this._nativeSkeleton.getAttachment(slotName, attachmentName);
- return null;
- };
- skeleton.setAttachment = function (slotName, attachmentName) {
- this._nativeSkeleton && this._nativeSkeleton.setAttachment(slotName, attachmentName);
- };
- skeleton.getTextureAtlas = function (regionAttachment) {
- cc.warn("sp.Skeleton getTextureAtlas not support in native");
- return null;
- };
- skeleton.setMix = function (fromAnimation, toAnimation, duration) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setMix(fromAnimation, toAnimation, duration);
- }
- };
- skeleton.setAnimation = function (trackIndex, name, loop) {
- if (this._nativeSkeleton) {
- if (this.isAnimationCached()) {
- return this._nativeSkeleton.setAnimation(name, loop);
- } else {
- return this._nativeSkeleton.setAnimation(trackIndex, name, loop);
- }
- }
- return null;
- };
- skeleton.addAnimation = function (trackIndex, name, loop, delay) {
- if (this._nativeSkeleton) {
- delay = delay || 0;
- if (this.isAnimationCached()) {
- return this._nativeSkeleton.addAnimation(name, loop, delay);
- } else {
- return this._nativeSkeleton.addAnimation(trackIndex, name, loop, delay);
- }
- }
- return null;
- };
- skeleton.findAnimation = function (name) {
- if (this._nativeSkeleton) return this._nativeSkeleton.findAnimation(name);
- return null;
- };
- skeleton.getCurrent = function (trackIndex) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- return this._nativeSkeleton.getCurrent(trackIndex);
- }
- return null;
- };
- skeleton.clearTracks = function () {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.clearTracks();
- }
- };
- skeleton.clearTrack = function (trackIndex) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.clearTrack(trackIndex);
- }
- };
- skeleton.setStartListener = function (listener) {
- this._startListener = listener;
- if (this._nativeSkeleton) {
- if (this.isAnimationCached()) {
- this._nativeSkeleton.setStartListener(function (animationName) {
- var self = this._comp;
- self._startEntry.animation.name = animationName;
- self._startListener && self._startListener(self._startEntry);
- });
- } else {
- this._nativeSkeleton.setStartListener(listener);
- }
- }
- };
- skeleton.setInterruptListener = function (listener) {
- this._interruptListener = listener;
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setInterruptListener(listener);
- }
- };
- skeleton.setEndListener = function (listener) {
- this._endListener = listener;
- if (this._nativeSkeleton) {
- if (this.isAnimationCached()) {
- this._nativeSkeleton.setEndListener(function (animationName) {
- var self = this._comp;
- self._endEntry.animation.name = animationName;
- self._endListener && self._endListener(self._endEntry);
- });
- } else {
- this._nativeSkeleton.setEndListener(listener);
- }
- }
- };
- skeleton.setDisposeListener = function (listener) {
- this._disposeListener = listener;
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setDisposeListener(listener);
- }
- };
- skeleton.setCompleteListener = function (listener) {
- this._completeListener = listener;
- if (this._nativeSkeleton) {
- if (this.isAnimationCached()) {
- this._nativeSkeleton.setCompleteListener(function (animationName) {
- var self = this._comp;
- self._endEntry.animation.name = animationName;
- self._completeListener && self._completeListener(self._endEntry);
- });
- } else {
- this._nativeSkeleton.setCompleteListener(listener);
- }
- }
- };
- skeleton.setEventListener = function (listener) {
- this._eventListener = listener;
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setEventListener(listener);
- }
- };
- skeleton.setTrackStartListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackStartListener(entry, listener);
- }
- };
- skeleton.setTrackInterruptListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackInterruptListener(entry, listener);
- }
- };
- skeleton.setTrackEndListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackEndListener(entry, listener);
- }
- };
- skeleton.setTrackDisposeListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackDisposeListener(entry, listener);
- }
- };
- skeleton.setTrackCompleteListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackCompleteListener(entry, listener);
- }
- };
- skeleton.setTrackEventListener = function (entry, listener) {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- this._nativeSkeleton.setTrackEventListener(entry, listener);
- }
- };
- skeleton.getState = function () {
- if (this._nativeSkeleton && !this.isAnimationCached()) {
- return this._nativeSkeleton.getState();
- }
- };
- skeleton._ensureListener = function () {
- cc.warn("sp.Skeleton _ensureListener not need in native");
- };
- skeleton._updateSkeletonData = function () {
- if (this.skeletonData) {
- this.skeletonData.init();
- this.setSkeletonData(this.skeletonData);
- this.attachUtil.init(this);
- this.attachUtil._associateAttachedNode();
- this._preCacheMode = this._cacheMode;
- this.defaultSkin && this._nativeSkeleton.setSkin(this.defaultSkin);
- this.animation = this.defaultAnimation;
- } else {
- if (this._nativeSkeleton) {
- this._nativeSkeleton.stopSchedule();
- this._nativeSkeleton._comp = null;
- this._nativeSkeleton = null;
- }
- }
- };
- var _onDestroy = skeleton.onDestroy;
- skeleton.onDestroy = function () {
- _onDestroy.call(this);
- if (this._nativeSkeleton) {
- this._nativeSkeleton.stopSchedule();
- this._nativeSkeleton._comp = null;
- this._nativeSkeleton = null;
- }
- this._stateData = null;
- this._materialCache = null;
- }; ////////////////////////////////////////////////////////////
- // adapt attach util
- ////////////////////////////////////////////////////////////
- var attachUtilProto = sp.AttachUtil.prototype;
- var _attachUtilInit = attachUtilProto.init;
- attachUtilProto.init = function (skeletonComp) {
- _attachUtilInit.call(this, skeletonComp);
- this._nativeSkeleton = skeletonComp._nativeSkeleton;
- this._attachUtilNative = null;
- };
- var _generateAllAttachedNodes = attachUtilProto.generateAllAttachedNodes;
- attachUtilProto.generateAllAttachedNodes = function () {
- var res = _generateAllAttachedNodes.call(this);
- this._associateAttachedNode();
- return res;
- };
- var _generateAttachedNodes = attachUtilProto.generateAttachedNodes;
- attachUtilProto.generateAttachedNodes = function (boneName) {
- var res = _generateAttachedNodes.call(this, boneName);
- this._associateAttachedNode();
- return res;
- };
- var _associateAttachedNode = attachUtilProto._associateAttachedNode;
- attachUtilProto._associateAttachedNode = function () {
- if (!this._inited) return;
- var rootNode = this._skeletonNode.getChildByName('ATTACHED_NODE_TREE');
- if (!rootNode || !rootNode.isValid) return; // associate js
- _associateAttachedNode.call(this); // associate native
- if (!this._attachUtilNative) {
- if (this._skeletonComp.isAnimationCached()) {
- this._attachUtilNative = new spine.CacheModeAttachUtil();
- } else {
- this._attachUtilNative = new spine.RealTimeAttachUtil();
- }
- this._nativeSkeleton.setAttachUtil(this._attachUtilNative);
- }
- this._attachUtilNative.associateAttachedNode(this._skeleton, this._skeletonNode._proxy);
- };
- })();
- },{"./jsb-cache-manager":30}],43:[function(require,module,exports){
- /****************************************************************************
- Copyright (c) 2013-2016 Chukong Technologies Inc.
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- 'use strict';
- var sys = cc.sys;
- sys.getNetworkType = jsb.Device.getNetworkType;
- sys.getBatteryLevel = jsb.Device.getBatteryLevel;
- sys.garbageCollect = jsb.garbageCollect;
- sys.restartVM = __restartVM;
- sys.isObjectValid = __isObjectValid;
- sys.getSafeAreaRect = function () {
- // x(top), y(left), z(bottom), w(right)
- var edge = jsb.Device.getSafeAreaEdge();
- var screenSize = cc.view.getFrameSize(); // Get leftBottom and rightTop point in UI coordinates
- var leftBottom = new cc.Vec2(edge.y, screenSize.height - edge.z);
- var rightTop = new cc.Vec2(screenSize.width - edge.w, edge.x); // Returns the real location in view.
- var relatedPos = {
- left: 0,
- top: 0,
- width: screenSize.width,
- height: screenSize.height
- };
- cc.view.convertToLocationInView(leftBottom.x, leftBottom.y, relatedPos, leftBottom);
- cc.view.convertToLocationInView(rightTop.x, rightTop.y, relatedPos, rightTop); // convert view point to design resolution size
- cc.view._convertPointWithScale(leftBottom);
- cc.view._convertPointWithScale(rightTop);
- return cc.rect(leftBottom.x, leftBottom.y, rightTop.x - leftBottom.x, rightTop.y - leftBottom.y);
- };
- },{}],44:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!cc.TiledMap) return;
- var RenderFlow = cc.RenderFlow; // tiled layer
- var TiledLayer = cc.TiledLayer.prototype;
- var _addUserNode = TiledLayer.addUserNode;
- TiledLayer.addUserNode = function (node) {
- var result = _addUserNode.call(this, node);
- if (result) {
- var proxy = node._proxy;
- proxy && proxy.enableVisit(false);
- }
- };
- var _removeUserNode = TiledLayer.removeUserNode;
- TiledLayer.removeUserNode = function (node) {
- var result = _removeUserNode.call(this, node);
- if (result) {
- var proxy = node._proxy;
- proxy && proxy.enableVisit(true);
- }
- }; // override _buildMaterial to upload hash value to native
- var _buildMaterial = TiledLayer._buildMaterial;
- TiledLayer._buildMaterial = function (tilesetIdx) {
- var material = _buildMaterial.call(this, tilesetIdx);
- if (material) material.getHash();
- }; // tiledmap buffer
- var TiledMapBuffer = cc.TiledMapBuffer.prototype;
- TiledMapBuffer._updateOffset = function () {
- var offsetInfo = this._offsetInfo;
- offsetInfo.vertexOffset = this.vertexOffset;
- offsetInfo.indiceOffset = this.indiceOffset;
- offsetInfo.byteOffset = this.byteOffset;
- }; // tiledmap render data list
- var TiledMapRenderDataList = cc.TiledMapRenderDataList.prototype;
- TiledMapRenderDataList._pushRenderData = function () {
- var renderData = {};
- renderData.ia = {};
- renderData.nodesRenderList = [];
- this._dataList.push(renderData);
- };
- TiledMapRenderDataList.reset = function () {
- this._offset = 0;
- var assembler = this._nativeAssembler;
- assembler._effect.length = 0;
- assembler.reset();
- };
- TiledMapRenderDataList.setNativeAssembler = function (assembler) {
- this._nativeAssembler = assembler;
- };
- TiledMapRenderDataList.popRenderData = function (buffer) {
- if (this._offset >= this._dataList.length) {
- this._pushRenderData();
- }
- var renderData = this._dataList[this._offset];
- renderData.nodesRenderList.length = 0;
- this._nativeAssembler.clearNodes(this._offset);
- var ia = renderData.ia;
- ia._meshIndex = buffer.getCurMeshIndex();
- ia._start = buffer.indiceOffset;
- ia._count = 0;
- ia._verticesStart = buffer.vertexOffset;
- ia._index = this._offset;
- this._offset++;
- return renderData;
- };
- TiledMapRenderDataList.pushNodesList = function (renderData, nodesList) {
- var nodesRenderList = renderData.nodesRenderList;
- nodesRenderList.push(nodesList);
- var nativeNodes = [];
- for (var j = 0; j < nodesRenderList.length; j++) {
- var _nodesList = nodesRenderList[j];
- if (!_nodesList) continue;
- for (var idx = 0; idx < _nodesList.length; idx++) {
- var dataComp = _nodesList[idx];
- if (!dataComp) continue;
- nativeNodes.push(dataComp.node._id);
- }
- }
- this._nativeAssembler.updateNodes(renderData.ia._index, nativeNodes);
- };
- var ModelBatcherDelegate = cc.Class({
- ctor: function ctor() {
- this._nativeAssembler = null;
- },
- setNativeAssembler: function setNativeAssembler(assembler) {
- this._nativeAssembler = assembler;
- },
- setBuffer: function setBuffer(buffer) {
- this._buffer = buffer;
- },
- _flushIA: function _flushIA(ia) {
- var iaIndex = ia._index;
- var meshIndex = ia._meshIndex;
- this._nativeAssembler.updateMeshIndex(iaIndex, meshIndex);
- var verticesStart = ia._verticesStart;
- var verticesOffset = this._buffer.vertexOffset;
- var vertexCount = verticesOffset - verticesStart;
- this._nativeAssembler.updateVerticesRange(iaIndex, verticesStart, vertexCount);
- this._nativeAssembler.updateIndicesRange(iaIndex, ia._start, ia._count);
- this._nativeAssembler.updateMaterial(iaIndex, this.material);
- },
- _flush: function _flush() {}
- });
- var TiledMapAssembler = cc.TiledLayer.__assembler__.prototype;
- var _fillBuffers = TiledMapAssembler.fillBuffers;
- cc.js.mixin(TiledMapAssembler, {
- _extendNative: function _extendNative() {
- renderer.TiledMapAssembler.prototype.ctor.call(this);
- },
- // override _updateRenderData function avoid base class cover material
- _updateRenderData: function _updateRenderData() {
- if (!this._renderComp || !this._renderComp.isValid) return;
- this.updateRenderData(this._renderComp);
- },
- updateRenderData: function updateRenderData(comp) {
- if (!comp._modelBatcherDelegate) {
- comp._buffer = new cc.TiledMapBuffer(null, cc.gfx.VertexFormat.XY_UV_Color);
- comp._renderDataList = new cc.TiledMapRenderDataList();
- comp._modelBatcherDelegate = new ModelBatcherDelegate();
- comp._buffer.setNativeAssembler(this);
- comp._renderDataList.setNativeAssembler(this);
- comp._modelBatcherDelegate.setBuffer(comp._buffer);
- comp._modelBatcherDelegate.setNativeAssembler(this);
- }
- _fillBuffers.call(this, comp, comp._modelBatcherDelegate);
- comp.node._renderFlag |= RenderFlow.FLAG_UPDATE_RENDER_DATA;
- }
- }, renderer.TiledMapAssembler.prototype);
- })();
- },{}],45:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!(cc && cc.VideoPlayer && cc.VideoPlayer.Impl)) {
- return;
- }
- var vec3 = cc.Vec3;
- var _worldMat = new cc.Mat4();
- var _topLeft = new vec3();
- var _bottomRight = new vec3();
- var _impl = cc.VideoPlayer.Impl;
- var _p = cc.VideoPlayer.Impl.prototype;
- _p._bindEvent = function () {
- var video = this._video,
- self = this;
- if (!video) {
- return;
- } //binding event
- var cbs = this.__eventListeners;
- cbs.loadedmetadata = function () {
- self._loadedmeta = true;
- self._dispatchEvent(_impl.EventType.META_LOADED);
- if (self._playing) {
- self._video.play();
- }
- };
- cbs.ended = function () {
- if (self._video !== video) return;
- self._playing = false;
- self._dispatchEvent(_impl.EventType.COMPLETED);
- };
- cbs.play = function () {
- if (self._video !== video) return;
- self._playing = true;
- self._dispatchEvent(_impl.EventType.PLAYING);
- };
- cbs.pause = function () {
- if (self._ignorePause || self._video !== video) return;
- self._playing = false;
- self._dispatchEvent(_impl.EventType.PAUSED);
- };
- cbs.click = function () {
- self._dispatchEvent(_impl.EventType.CLICKED);
- };
- cbs.stoped = function () {
- self._dispatchEvent(_impl.EventType.STOPPED);
- self._ignorePause = false;
- };
- video.addEventListener("loadedmetadata", cbs.loadedmetadata);
- video.addEventListener("ended", cbs.ended);
- video.addEventListener("play", cbs.play);
- video.addEventListener("pause", cbs.pause);
- video.addEventListener("click", cbs.click);
- video.addEventListener("stoped", cbs.stoped);
- function onCanPlay() {
- if (this._loaded) return;
- this._loaded = true;
- this._dispatchEvent(_impl.EventType.READY_TO_PLAY);
- this._updateVisibility();
- }
- cbs.onCanPlay = onCanPlay.bind(this);
- video.addEventListener('canplay', cbs.onCanPlay);
- video.addEventListener('canplaythrough', cbs.onCanPlay);
- video.addEventListener('suspend', cbs.onCanPlay);
- };
- _p._updateVisibility = function () {
- if (!this._video) return;
- var video = this._video;
- if (this._visible) {
- this._video.setVisible(true);
- } else {
- this._video.setVisible(false);
- video.pause();
- this._playing = false;
- }
- };
- _p._updateSize = function (width, height) {};
- _p.createDomElementIfNeeded = function () {
- if (!jsb.VideoPlayer) {
- cc.warn('VideoPlayer is not supported.');
- return null;
- }
- if (!this._video) {
- this._video = new jsb.VideoPlayer();
- }
- };
- _p.removeDom = function () {
- var video = this._video;
- if (video) {
- video.stop();
- video.setVisible(false);
- var cbs = this.__eventListeners;
- cbs.loadedmetadata = null;
- cbs.ended = null;
- cbs.play = null;
- cbs.pause = null;
- cbs.click = null;
- cbs.onCanPlay = null;
- video.destroy();
- }
- this._video = null;
- this._url = "";
- };
- _p.setURL = function (path) {
- var source, extname;
- if (this._url === path) {
- return;
- }
- this.removeDom();
- this._url = path;
- this.createDomElementIfNeeded();
- this._bindEvent();
- var video = this._video;
- if (!video) {
- return;
- }
- video.setVisible(this._visible);
- this._loaded = false;
- this._played = false;
- this._playing = false;
- this._loadedmeta = false;
- video.setURL(this._url);
- this._forceUpdate = true;
- };
- _p.getURL = function () {
- return this._url;
- };
- _p.play = function () {
- var video = this._video;
- if (!video || !this._visible || this._playing) return;
- video.play();
- this._playing = true;
- };
- _p.setStayOnBottom = function (enabled) {};
- _p.pause = function () {
- var video = this._video;
- if (!this._playing || !video) return;
- video.pause();
- this._playing = false;
- };
- _p.resume = function () {
- var video = this._video;
- if (this._playing || !video) return;
- video.resume();
- this._playing = true;
- };
- _p.stop = function () {
- var video = this._video;
- if (!video || !this._visible) return;
- this._ignorePause = true;
- video.stop();
- this._playing = false;
- };
- _p.setVolume = function (volume) {};
- _p.seekTo = function (time) {
- var video = this._video;
- if (!video) return;
- if (this._loaded) {
- video.seekTo(time);
- } else {
- var cb = function cb() {
- video.seekTo(time);
- };
- video.addEventListener(_impl._polyfill.event, cb);
- }
- };
- _p.isPlaying = function () {
- return this._playing;
- };
- _p.duration = function () {
- var video = this._video;
- var duration = -1;
- if (!video) return duration;
- duration = video.duration();
- if (duration <= 0) {
- cc.logID(7702);
- }
- return duration;
- };
- _p.currentTime = function () {
- var video = this._video;
- if (!video) return -1;
- return video.currentTime();
- };
- _p.setKeepAspectRatioEnabled = function (isEnabled) {
- if (!this._video) {
- return false;
- }
- return this._video.setKeepAspectRatioEnabled(isEnabled);
- };
- _p.isKeepAspectRatioEnabled = function () {
- if (!this._video) {
- return false;
- }
- return this._video.isKeepAspectRatioEnabled();
- };
- _p.isFullScreenEnabled = function () {
- return this._fullScreenEnabled;
- };
- _p.setEventListener = function (event, callback) {
- this._EventList[event] = callback;
- };
- _p.removeEventListener = function (event) {
- this._EventList[event] = null;
- };
- _p._dispatchEvent = function (event) {
- var callback = this._EventList[event];
- if (callback) callback.call(this, this, this._video.src);
- };
- _p.onPlayEvent = function () {
- var callback = this._EventList[_impl.EventType.PLAYING];
- callback.call(this, this, this._video.src);
- };
- _p.enable = function () {
- var list = _impl.elements;
- if (list.indexOf(this) === -1) list.push(this);
- this.setVisible(true);
- };
- _p.disable = function () {
- var list = _impl.elements;
- var index = list.indexOf(this);
- if (index !== -1) list.splice(index, 1);
- this.setVisible(false);
- };
- _p.destroy = function () {
- this.disable();
- this.removeDom();
- };
- _p.setVisible = function (visible) {
- if (this._visible !== visible) {
- this._visible = !!visible;
- this._updateVisibility();
- }
- };
- _p.setFullScreenEnabled = function (enable) {
- var video = this._video;
- if (!video) {
- return;
- }
- this._fullScreenEnabled = enable;
- video.setFullScreenEnabled(enable);
- };
- _p.updateMatrix = function (node) {
- if (!this._video || !this._visible) return;
- var camera = cc.Camera.findCamera(node)._camera;
- if (!camera) {
- return;
- }
- node.getWorldMatrix(_worldMat);
- if (!this._forceUpdate && this._m00 === _worldMat.m[0] && this._m01 === _worldMat.m[1] && this._m04 === _worldMat.m[4] && this._m05 === _worldMat.m[5] && this._m12 === _worldMat.m[12] && this._m13 === _worldMat.m[13] && this._w === node._contentSize.width && this._h === node._contentSize.height) {
- return;
- } // update matrix cache
- this._m00 = _worldMat.m[0];
- this._m01 = _worldMat.m[1];
- this._m04 = _worldMat.m[4];
- this._m05 = _worldMat.m[5];
- this._m12 = _worldMat.m[12];
- this._m13 = _worldMat.m[13];
- this._w = node._contentSize.width;
- this._h = node._contentSize.height;
- var canvas_width = cc.game.canvas.width;
- var canvas_height = cc.game.canvas.height;
- var ap = node._anchorPoint; // Vectors in node space
- vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0);
- vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); // Convert to world space
- vec3.transformMat4(_topLeft, _topLeft, _worldMat);
- vec3.transformMat4(_bottomRight, _bottomRight, _worldMat); // Convert to Screen space
- camera.worldToScreen(_topLeft, _topLeft, canvas_width, canvas_height);
- camera.worldToScreen(_bottomRight, _bottomRight, canvas_width, canvas_height);
- var finalWidth = _bottomRight.x - _topLeft.x;
- var finalHeight = _topLeft.y - _bottomRight.y;
- this._video.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight);
- };
- _impl.EventType = {
- PLAYING: 0,
- PAUSED: 1,
- STOPPED: 2,
- COMPLETED: 3,
- META_LOADED: 4,
- CLICKED: 5,
- READY_TO_PLAY: 6
- }; // video 队列,所有 vidoe 在 onEnter 的时候都会插入这个队列
- _impl.elements = []; // video 在 game_hide 事件中被自动暂停的队列,用于回复的时候重新开始播放
- _impl.pauseElements = [];
- cc.game.on(cc.game.EVENT_HIDE, function () {
- var list = _impl.elements;
- for (var element, i = 0; i < list.length; i++) {
- element = list[i];
- if (element.isPlaying()) {
- element.pause();
- _impl.pauseElements.push(element);
- }
- }
- });
- cc.game.on(cc.game.EVENT_SHOW, function () {
- var list = _impl.pauseElements;
- var element = list.pop();
- while (element) {
- element.play();
- element = list.pop();
- }
- });
- })();
- },{}],46:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!(cc && cc.WebView && cc.WebView.Impl)) {
- return;
- }
- var vec3 = cc.Vec3;
- var _worldMat = new cc.Mat4();
- var _topLeft = new vec3();
- var _bottomRight = new vec3();
- cc.WebView.Impl = cc.Class({
- "extends": cc.WebView.Impl,
- ctor: function ctor() {
- // keep webview data
- this.jsCallback = null;
- this.interfaceSchema = null;
- }
- });
- var _impl = cc.WebView.Impl;
- var _p = cc.WebView.Impl.prototype;
- _p._updateVisibility = function () {
- if (!this._iframe) return;
- this._iframe.setVisible(this._visible);
- };
- _p._updateSize = function (w, h) {};
- _p._initEvent = function () {
- var iframe = this._iframe;
- if (iframe) {
- var cbs = this.__eventListeners,
- self = this;
- cbs.load = function () {
- self._dispatchEvent(_impl.EventType.LOADED);
- };
- cbs.error = function () {
- self._dispatchEvent(_impl.EventType.ERROR);
- }; // native event callback
- this._iframe.setOnDidFinishLoading(cbs.load);
- this._iframe.setOnDidFailLoading(cbs.error);
- }
- };
- _p._initExtraSetting = function () {
- this.jsCallback && this.setOnJSCallback(this.jsCallback);
- this.interfaceSchema && this.setJavascriptInterfaceScheme(this.interfaceSchema); // remove obj
- this.jsCallback = null;
- this.interfaceSchema = null;
- };
- _p._setOpacity = function (opacity) {
- var iframe = this._iframe;
- if (iframe && iframe.style) {
- iframe.style.opacity = opacity / 255; // TODO, add impl to Native
- }
- };
- _p.createDomElementIfNeeded = function (w, h) {
- if (!jsb.WebView) {
- cc.warn('WebView only supports mobile platform.');
- return;
- }
- if (!this._iframe) {
- this._iframe = jsb.WebView.create();
- this._initEvent();
- this._initExtraSetting();
- }
- };
- _p.removeDom = function () {
- var iframe = this._iframe;
- if (iframe) {
- var cbs = this.__eventListeners;
- cbs.load = null;
- cbs.error = null;
- iframe.destroy();
- this._iframe = null;
- }
- };
- _p.setOnJSCallback = function (callback) {
- var iframe = this._iframe;
- if (iframe) {
- iframe.setOnJSCallback(callback);
- } else {
- this.jsCallback = callback;
- }
- };
- _p.setJavascriptInterfaceScheme = function (scheme) {
- var iframe = this._iframe;
- if (iframe) {
- iframe.setJavascriptInterfaceScheme(scheme);
- } else {
- this.interfaceSchema = scheme;
- }
- };
- _p.loadData = function (data, MIMEType, encoding, baseURL) {
- var iframe = this._iframe;
- if (iframe) {
- iframe.loadData(data, MIMEType, encoding, baseURL);
- }
- };
- _p.loadHTMLString = function (string, baseURL) {
- var iframe = this._iframe;
- if (iframe) {
- iframe.loadHTMLString(string, baseURL);
- }
- };
- /**
- * Load an URL
- * @param {String} url
- */
- _p.loadURL = function (url) {
- var iframe = this._iframe;
- if (iframe) {
- iframe.src = url;
- iframe.loadURL(url);
- this._dispatchEvent(_impl.EventType.LOADING);
- }
- };
- /**
- * Stop loading
- */
- _p.stopLoading = function () {
- cc.logID(7800);
- };
- /**
- * Reload the WebView
- */
- _p.reload = function () {
- var iframe = this._iframe;
- if (iframe) {
- iframe.reload();
- }
- };
- /**
- * Determine whether to go back
- */
- _p.canGoBack = function () {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.canGoBack();
- }
- };
- /**
- * Determine whether to go forward
- */
- _p.canGoForward = function () {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.canGoForward();
- }
- };
- /**
- * go back
- */
- _p.goBack = function () {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.goBack();
- }
- };
- /**
- * go forward
- */
- _p.goForward = function () {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.goForward();
- }
- };
- /**
- * In the webview execution within a period of js string
- * @param {String} str
- */
- _p.evaluateJS = function (str) {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.evaluateJS(str);
- }
- };
- /**
- * Limited scale
- */
- _p.setScalesPageToFit = function () {
- var iframe = this._iframe;
- if (iframe) {
- return iframe.setScalesPageToFit();
- }
- };
- /**
- * The binding event
- * @param {_impl.EventType} event
- * @param {Function} callback
- */
- _p.setEventListener = function (event, callback) {
- this._EventList[event] = callback;
- };
- /**
- * Delete events
- * @param {_impl.EventType} event
- */
- _p.removeEventListener = function (event) {
- this._EventList[event] = null;
- };
- _p._dispatchEvent = function (event) {
- var callback = this._EventList[event];
- if (callback) callback.call(this, this, this._iframe.src);
- };
- _p._createRenderCmd = function () {
- return new _impl.RenderCmd(this);
- };
- _p.destroy = function () {
- this.removeDom();
- };
- _p.setVisible = function (visible) {
- if (this._visible !== visible) {
- this._visible = !!visible;
- this._updateVisibility();
- }
- };
- _p.updateMatrix = function (node) {
- if (!this._iframe || !this._visible) return;
- var camera = cc.Camera.findCamera(node)._camera;
- if (!camera) {
- return;
- }
- node.getWorldMatrix(_worldMat);
- if (this._m00 === _worldMat.m[0] && this._m01 === _worldMat.m[1] && this._m04 === _worldMat.m[4] && this._m05 === _worldMat.m[5] && this._m12 === _worldMat.m[12] && this._m13 === _worldMat.m[13] && this._w === node._contentSize.width && this._h === node._contentSize.height) {
- return;
- } // update matrix cache
- this._m00 = _worldMat.m[0];
- this._m01 = _worldMat.m[1];
- this._m04 = _worldMat.m[4];
- this._m05 = _worldMat.m[5];
- this._m12 = _worldMat.m[12];
- this._m13 = _worldMat.m[13];
- this._w = node._contentSize.width;
- this._h = node._contentSize.height;
- var canvas_width = cc.game.canvas.width;
- var canvas_height = cc.game.canvas.height;
- var ap = node._anchorPoint; // Vectors in node space
- vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0);
- vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); // Convert to world space
- vec3.transformMat4(_topLeft, _topLeft, _worldMat);
- vec3.transformMat4(_bottomRight, _bottomRight, _worldMat); // Convert to screen space
- camera.worldToScreen(_topLeft, _topLeft, canvas_width, canvas_height);
- camera.worldToScreen(_bottomRight, _bottomRight, canvas_width, canvas_height);
- var finalWidth = _bottomRight.x - _topLeft.x;
- var finalHeight = _topLeft.y - _bottomRight.y;
- this._iframe.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight);
- };
- })();
- },{}],47:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var nativeCameraProto = renderer.Camera.prototype;
- var _setNode = nativeCameraProto.setNode;
- cc.js.mixin(nativeCameraProto, {
- setNode: function setNode(node) {
- this._persistentNode = node;
- _setNode.call(this, node);
- }
- });
- },{}],48:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var nativeLightProto = renderer.Light.prototype;
- var _setNode = nativeLightProto.setNode;
- cc.js.mixin(nativeLightProto, {
- setNode: function setNode(node) {
- this._node = node;
- _setNode.call(this, node);
- }
- });
- },{}],49:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!cc.MeshBuffer) return;
- var MeshBuffer = cc.MeshBuffer.prototype;
- MeshBuffer.init = function (batcher, vertexFormat) {
- this.byteOffset = 0;
- this.indiceOffset = 0;
- this.vertexOffset = 0;
- this._vertexFormat = vertexFormat;
- this._vertexBytes = this._vertexFormat._bytes;
- this._vDatas = [];
- this._uintVDatas = [];
- this._iDatas = [];
- this._arrOffset = 0;
- this._vData = null;
- this._uintVData = null;
- this._iData = null;
- this._initVDataCount = 256 * vertexFormat._bytes; // actually 256 * 4 * (vertexFormat._bytes / 4)
- this._initIDataCount = 256 * 6;
- this._offsetInfo = {
- byteOffset: 0,
- vertexOffset: 0,
- indiceOffset: 0
- };
- this._renderDataList = new renderer.RenderDataList();
- this._reallocBuffer();
- };
- MeshBuffer.setNativeAssembler = function (assembler) {
- if (assembler !== this._nativeAssembler) {
- this._nativeAssembler = assembler;
- assembler.setRenderDataList(this._renderDataList);
- }
- };
- MeshBuffer._updateVIDatas = function () {
- var offset = this._arrOffset;
- this._vDatas[offset] = this._vData;
- this._uintVDatas[offset] = this._uintVData;
- this._iDatas[offset] = this._iData;
- this._renderDataList.updateMesh(offset, this._vData, this._iData);
- };
- MeshBuffer.getNativeAssembler = function () {
- return this._nativeAssembler;
- };
- MeshBuffer.getCurMeshIndex = function () {
- return this._arrOffset;
- };
- MeshBuffer.uploadData = function () {};
- MeshBuffer.switchBuffer = function () {
- var offset = ++this._arrOffset;
- this.byteOffset = 0;
- this.vertexOffset = 0;
- this.indiceOffset = 0;
- if (offset < this._vDatas.length) {
- this._vData = this._vDatas[offset];
- this._uintVData = this._uintVDatas[offset];
- this._iData = this._iDatas[offset];
- } else {
- this._reallocBuffer();
- }
- };
- MeshBuffer.checkAndSwitchBuffer = function (vertexCount) {
- if (this.vertexOffset + vertexCount > 65535) {
- this.switchBuffer();
- if (!this._nativeAssembler) return;
- this._nativeAssembler.updateIADatas && this._nativeAssembler.updateIADatas(this._arrOffset, this._arrOffset);
- }
- };
- MeshBuffer.used = function (vertexCount, indiceCount) {
- if (!this._nativeAssembler) return;
- this._nativeAssembler.updateVerticesRange(this._arrOffset, 0, vertexCount);
- this._nativeAssembler.updateIndicesRange(this._arrOffset, 0, indiceCount);
- };
- MeshBuffer.request = function (vertexCount, indiceCount) {
- this.requestStatic(vertexCount, indiceCount);
- return this._offsetInfo;
- };
- MeshBuffer._reallocBuffer = function () {
- this._reallocVData(true);
- this._reallocIData(true);
- this._updateVIDatas();
- };
- MeshBuffer._reallocVData = function (copyOldData) {
- var oldVData;
- if (this._vData) {
- oldVData = new Uint8Array(this._vData.buffer);
- }
- this._vData = new Float32Array(this._initVDataCount);
- this._uintVData = new Uint32Array(this._vData.buffer);
- var newData = new Uint8Array(this._uintVData.buffer);
- if (oldVData && copyOldData) {
- for (var i = 0, l = oldVData.length; i < l; i++) {
- newData[i] = oldVData[i];
- }
- }
- };
- MeshBuffer._reallocIData = function (copyOldData) {
- var oldIData = this._iData;
- this._iData = new Uint16Array(this._initIDataCount);
- if (oldIData && copyOldData) {
- var iData = this._iData;
- for (var i = 0, l = oldIData.length; i < l; i++) {
- iData[i] = oldIData[i];
- }
- }
- };
- MeshBuffer.reset = function () {
- this._arrOffset = 0;
- this._vData = this._vDatas[0];
- this._uintVData = this._uintVDatas[0];
- this._iData = this._iDatas[0];
- this.byteOffset = 0;
- this.indiceOffset = 0;
- this.vertexOffset = 0;
- if (!this._nativeAssembler) return;
- for (var i = 0, len = this._vDatas.length; i < len; i++) {
- this._nativeAssembler.updateVerticesRange(i, 0, 0);
- this._nativeAssembler.updateIndicesRange(i, 0, 0);
- }
- };
- MeshBuffer.destroy = function () {
- this.reset();
- };
- })();
- },{}],50:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var RenderFlow = cc.RenderFlow;
- cc.js.mixin(renderer.NodeProxy.prototype, {
- _ctor: function _ctor() {
- this._owner = null;
- },
- init: function init(owner) {
- this._owner = owner;
- var spaceInfo = owner._spaceInfo;
- this._owner._dirtyPtr = spaceInfo.dirty;
- this._dirtyPtr = spaceInfo.dirty;
- this._parentPtr = spaceInfo.parent;
- this._zOrderPtr = spaceInfo.zOrder;
- this._cullingMaskPtr = spaceInfo.cullingMask;
- this._opacityPtr = spaceInfo.opacity;
- this._is3DPtr = spaceInfo.is3D;
- this._skewPtr = spaceInfo.skew;
- this._isVisitingTraversal = false;
- owner._proxy = this;
- this.updateOpacity();
- this.update3DNode();
- this.updateZOrder();
- this.updateCullingMask();
- this.updateSkew();
- owner.on(cc.Node.EventType.SIBLING_ORDER_CHANGED, this.updateZOrder, this);
- },
- initNative: function initNative() {
- this.setName(this._owner._name);
- this.updateParent();
- this.updateOpacity();
- this.update3DNode();
- this.updateZOrder();
- this.updateSkew();
- this.updateCullingMask();
- },
- destroy: function destroy() {
- this.destroyImmediately();
- this._owner.off(cc.Node.EventType.SIBLING_ORDER_CHANGED, this.updateZOrder, this);
- this._owner._proxy = null;
- this._owner = null;
- },
- updateParent: function updateParent() {
- var parent = this._owner._parent;
- if (parent) {
- var parentSpaceInfo = parent._spaceInfo;
- this._parentPtr[0] = parentSpaceInfo.unitID;
- this._parentPtr[1] = parentSpaceInfo.index;
- var parentDirtyPtr = parentSpaceInfo.dirty;
- parentDirtyPtr[0] |= RenderFlow.FLAG_REORDER_CHILDREN;
- this._dirtyPtr[0] |= RenderFlow.FLAG_OPACITY;
- } else {
- this._parentPtr[0] = 0xffffffff;
- this._parentPtr[1] = 0xffffffff;
- }
- this.notifyUpdateParent();
- },
- updateZOrder: function updateZOrder() {
- this._zOrderPtr[0] = this._owner._localZOrder;
- var parent = this._owner._parent;
- if (parent && parent._proxy) {
- parent._proxy._dirtyPtr[0] |= RenderFlow.FLAG_REORDER_CHILDREN;
- }
- },
- updateCullingMask: function updateCullingMask() {
- this._cullingMaskPtr[0] = this._owner._cullingMask;
- },
- updateOpacity: function updateOpacity() {
- this._opacityPtr[0] = this._owner.opacity;
- this._dirtyPtr[0] |= RenderFlow.FLAG_OPACITY;
- },
- update3DNode: function update3DNode() {
- this._is3DPtr[0] = this._owner.is3DNode ? 0x1 : 0x0;
- this._dirtyPtr[0] |= RenderFlow.FLAG_LOCAL_TRANSFORM;
- },
- updateSkew: function updateSkew() {
- var skewPtr = this._skewPtr;
- var owner = this._owner;
- var skx = owner._skewX;
- var sky = owner._skewY;
- skewPtr[0] = skx;
- skewPtr[1] = sky;
- if (!this._isVisitingTraversal && (skx !== 0 || sky !== 0)) {
- this.switchTraverseToVisit();
- this._isVisitingTraversal = true;
- }
- }
- });
- },{}],51:[function(require,module,exports){
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- 'use strict';
- var RenderFlow = cc.RenderFlow;
- var LOCAL_TRANSFORM = RenderFlow.FLAG_LOCAL_TRANSFORM;
- var COLOR = RenderFlow.FLAG_COLOR;
- var UPDATE_RENDER_DATA = RenderFlow.FLAG_UPDATE_RENDER_DATA;
- var POSITION_ON = 1 << 0;
- cc.Node.prototype.setLocalDirty = function (flag) {
- this._localMatDirty |= flag;
- this._worldMatDirty = true;
- this._dirtyPtr[0] |= RenderFlow.FLAG_TRANSFORM;
- };
- cc.js.getset(cc.Node.prototype, "_renderFlag", function () {
- return this._dirtyPtr[0];
- }, function (flag) {
- this._dirtyPtr[0] = flag;
- if (flag & UPDATE_RENDER_DATA || flag & COLOR) {
- cc.RenderFlow.register(this);
- }
- });
- cc.PrivateNode.prototype._posDirty = function (sendEvent) {
- var parent = this.parent;
- if (parent) {
- // Position correction for transform calculation
- this._trs[0] = this._originPos.x - (parent._anchorPoint.x - 0.5) * parent._contentSize.width;
- this._trs[1] = this._originPos.y - (parent._anchorPoint.y - 0.5) * parent._contentSize.height;
- }
- this.setLocalDirty(cc.Node._LocalDirtyFlag.POSITION);
- if (sendEvent === true && this._eventMask & POSITION_ON) {
- this.emit(cc.Node.EventType.POSITION_CHANGED);
- }
- };
- },{}],52:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
- https://www.cocos.com/
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- (function () {
- if (!cc.QuadBuffer) return;
- var QuadBuffer = cc.QuadBuffer.prototype;
- QuadBuffer._fillQuadBuffer = function () {
- var count = this._initIDataCount / 6;
- var buffer = this._iData;
- for (var i = 0, idx = 0; i < count; i++) {
- var vertextID = i * 4;
- buffer[idx++] = vertextID;
- buffer[idx++] = vertextID + 1;
- buffer[idx++] = vertextID + 2;
- buffer[idx++] = vertextID + 1;
- buffer[idx++] = vertextID + 3;
- buffer[idx++] = vertextID + 2;
- }
- };
- QuadBuffer._reallocBuffer = function () {
- this._reallocVData(true);
- this._reallocIData();
- this._fillQuadBuffer();
- this._updateVIDatas();
- };
- QuadBuffer.uploadData = function () {};
- QuadBuffer.switchBuffer = function () {
- cc.MeshBuffer.prototype.switchBuffer.call(this);
- };
- })();
- },{}],53:[function(require,module,exports){
- "use strict";
- var proto = cc.RenderData.prototype;
- cc.RenderData.prototype.init = function (assembler) {
- this._renderDataList = new renderer.RenderDataList();
- assembler.setRenderDataList(this._renderDataList);
- this._nativeAssembler = assembler;
- };
- var originClear = proto.clear;
- proto.clear = function () {
- originClear.call(this);
- this._renderDataList.clear();
- };
- var originUpdateMesh = proto.updateMesh;
- proto.updateMesh = function (meshIndex, vertices, indices) {
- originUpdateMesh.call(this, meshIndex, vertices, indices);
- if (vertices && indices) {
- this._renderDataList.updateMesh(meshIndex, vertices, indices);
- }
- };
- proto.updateMeshRange = function (verticesCount, indicesCount) {
- this._nativeAssembler.updateVerticesRange(0, 0, verticesCount);
- this._nativeAssembler.updateIndicesRange(0, 0, indicesCount);
- };
- },{}],54:[function(require,module,exports){
- "use strict";
- /****************************************************************************
- Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
- http://www.cocos.com
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated engine source code (the "Software"), a limited,
- worldwide, royalty-free, non-assignable, revocable and non-exclusive license
- to use Cocos Creator solely to develop games on your target platforms. You shall
- not use Cocos Creator software for developing other software or tools that's
- used for developing games. You are not granted to publish, distribute,
- sublicense, and/or sell copies of Cocos Creator.
- The software or tools in this License Agreement are licensed, not sold.
- Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- var RenderFlow = cc.RenderFlow;
- RenderFlow.FLAG_REORDER_CHILDREN = 1 << 29;
- RenderFlow.FLAG_WORLD_TRANSFORM_CHANGED = 1 << 30;
- RenderFlow.FLAG_OPACITY_CHANGED = 1 << 31;
- var _dirtyTargets = [];
- var _dirtyWaiting = [];
- var _rendering = false;
- var director = cc.director;
- RenderFlow.render = function (scene, dt) {
- var camera = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- _rendering = true;
- RenderFlow.validateRenderers();
- for (var i = 0, l = _dirtyTargets.length; i < l; i++) {
- var node = _dirtyTargets[i];
- node._inJsbDirtyList = false;
- var comp = node._renderComponent;
- if (!comp) continue;
- var assembler = comp._assembler;
- if (!assembler) continue;
- var flag = node._dirtyPtr[0];
- if (flag & RenderFlow.FLAG_UPDATE_RENDER_DATA) {
- node._dirtyPtr[0] &= ~RenderFlow.FLAG_UPDATE_RENDER_DATA;
- assembler._updateRenderData && assembler._updateRenderData();
- }
- if (flag & RenderFlow.FLAG_COLOR) {
- node._dirtyPtr[0] &= ~RenderFlow.FLAG_COLOR;
- comp._updateColor && comp._updateColor();
- }
- }
- _dirtyTargets.length = 0;
- dt = dt || 0;
- this._nativeFlow.render(scene._proxy, dt, camera);
- _dirtyTargets = _dirtyWaiting.slice(0);
- _dirtyWaiting.length = 0;
- _rendering = false;
- };
- RenderFlow.renderCamera = function (camera, scene) {
- RenderFlow.render(scene, 0, camera);
- };
- RenderFlow.init = function (nativeFlow) {
- cc.EventTarget.call(this);
- this._nativeFlow = nativeFlow;
- };
- RenderFlow.register = function (target) {
- if (target._inJsbDirtyList) return;
- if (_rendering) {
- _dirtyWaiting.push(target);
- } else {
- _dirtyTargets.push(target);
- }
- target._inJsbDirtyList = true;
- };
- },{}]},{},[27]);
|