jsb-engine.js 184 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962
  1. (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){
  2. module.exports={
  3. "O_RDONLY": 0,
  4. "O_WRONLY": 1,
  5. "O_RDWR": 2,
  6. "S_IFMT": 61440,
  7. "S_IFREG": 32768,
  8. "S_IFDIR": 16384,
  9. "S_IFCHR": 8192,
  10. "S_IFBLK": 24576,
  11. "S_IFIFO": 4096,
  12. "S_IFLNK": 40960,
  13. "S_IFSOCK": 49152,
  14. "O_CREAT": 512,
  15. "O_EXCL": 2048,
  16. "O_NOCTTY": 131072,
  17. "O_TRUNC": 1024,
  18. "O_APPEND": 8,
  19. "O_DIRECTORY": 1048576,
  20. "O_NOFOLLOW": 256,
  21. "O_SYNC": 128,
  22. "O_SYMLINK": 2097152,
  23. "O_NONBLOCK": 4,
  24. "S_IRWXU": 448,
  25. "S_IRUSR": 256,
  26. "S_IWUSR": 128,
  27. "S_IXUSR": 64,
  28. "S_IRWXG": 56,
  29. "S_IRGRP": 32,
  30. "S_IWGRP": 16,
  31. "S_IXGRP": 8,
  32. "S_IRWXO": 7,
  33. "S_IROTH": 4,
  34. "S_IWOTH": 2,
  35. "S_IXOTH": 1,
  36. "E2BIG": 7,
  37. "EACCES": 13,
  38. "EADDRINUSE": 48,
  39. "EADDRNOTAVAIL": 49,
  40. "EAFNOSUPPORT": 47,
  41. "EAGAIN": 35,
  42. "EALREADY": 37,
  43. "EBADF": 9,
  44. "EBADMSG": 94,
  45. "EBUSY": 16,
  46. "ECANCELED": 89,
  47. "ECHILD": 10,
  48. "ECONNABORTED": 53,
  49. "ECONNREFUSED": 61,
  50. "ECONNRESET": 54,
  51. "EDEADLK": 11,
  52. "EDESTADDRREQ": 39,
  53. "EDOM": 33,
  54. "EDQUOT": 69,
  55. "EEXIST": 17,
  56. "EFAULT": 14,
  57. "EFBIG": 27,
  58. "EHOSTUNREACH": 65,
  59. "EIDRM": 90,
  60. "EILSEQ": 92,
  61. "EINPROGRESS": 36,
  62. "EINTR": 4,
  63. "EINVAL": 22,
  64. "EIO": 5,
  65. "EISCONN": 56,
  66. "EISDIR": 21,
  67. "ELOOP": 62,
  68. "EMFILE": 24,
  69. "EMLINK": 31,
  70. "EMSGSIZE": 40,
  71. "EMULTIHOP": 95,
  72. "ENAMETOOLONG": 63,
  73. "ENETDOWN": 50,
  74. "ENETRESET": 52,
  75. "ENETUNREACH": 51,
  76. "ENFILE": 23,
  77. "ENOBUFS": 55,
  78. "ENODATA": 96,
  79. "ENODEV": 19,
  80. "ENOENT": 2,
  81. "ENOEXEC": 8,
  82. "ENOLCK": 77,
  83. "ENOLINK": 97,
  84. "ENOMEM": 12,
  85. "ENOMSG": 91,
  86. "ENOPROTOOPT": 42,
  87. "ENOSPC": 28,
  88. "ENOSR": 98,
  89. "ENOSTR": 99,
  90. "ENOSYS": 78,
  91. "ENOTCONN": 57,
  92. "ENOTDIR": 20,
  93. "ENOTEMPTY": 66,
  94. "ENOTSOCK": 38,
  95. "ENOTSUP": 45,
  96. "ENOTTY": 25,
  97. "ENXIO": 6,
  98. "EOPNOTSUPP": 102,
  99. "EOVERFLOW": 84,
  100. "EPERM": 1,
  101. "EPIPE": 32,
  102. "EPROTO": 100,
  103. "EPROTONOSUPPORT": 43,
  104. "EPROTOTYPE": 41,
  105. "ERANGE": 34,
  106. "EROFS": 30,
  107. "ESPIPE": 29,
  108. "ESRCH": 3,
  109. "ESTALE": 70,
  110. "ETIME": 101,
  111. "ETIMEDOUT": 60,
  112. "ETXTBSY": 26,
  113. "EWOULDBLOCK": 35,
  114. "EXDEV": 18,
  115. "SIGHUP": 1,
  116. "SIGINT": 2,
  117. "SIGQUIT": 3,
  118. "SIGILL": 4,
  119. "SIGTRAP": 5,
  120. "SIGABRT": 6,
  121. "SIGIOT": 6,
  122. "SIGBUS": 10,
  123. "SIGFPE": 8,
  124. "SIGKILL": 9,
  125. "SIGUSR1": 30,
  126. "SIGSEGV": 11,
  127. "SIGUSR2": 31,
  128. "SIGPIPE": 13,
  129. "SIGALRM": 14,
  130. "SIGTERM": 15,
  131. "SIGCHLD": 20,
  132. "SIGCONT": 19,
  133. "SIGSTOP": 17,
  134. "SIGTSTP": 18,
  135. "SIGTTIN": 21,
  136. "SIGTTOU": 22,
  137. "SIGURG": 16,
  138. "SIGXCPU": 24,
  139. "SIGXFSZ": 25,
  140. "SIGVTALRM": 26,
  141. "SIGPROF": 27,
  142. "SIGWINCH": 28,
  143. "SIGIO": 23,
  144. "SIGSYS": 12,
  145. "SSL_OP_ALL": 2147486719,
  146. "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
  147. "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
  148. "SSL_OP_CISCO_ANYCONNECT": 32768,
  149. "SSL_OP_COOKIE_EXCHANGE": 8192,
  150. "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
  151. "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
  152. "SSL_OP_EPHEMERAL_RSA": 0,
  153. "SSL_OP_LEGACY_SERVER_CONNECT": 4,
  154. "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32,
  155. "SSL_OP_MICROSOFT_SESS_ID_BUG": 1,
  156. "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0,
  157. "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912,
  158. "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2,
  159. "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824,
  160. "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8,
  161. "SSL_OP_NO_COMPRESSION": 131072,
  162. "SSL_OP_NO_QUERY_MTU": 4096,
  163. "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
  164. "SSL_OP_NO_SSLv2": 16777216,
  165. "SSL_OP_NO_SSLv3": 33554432,
  166. "SSL_OP_NO_TICKET": 16384,
  167. "SSL_OP_NO_TLSv1": 67108864,
  168. "SSL_OP_NO_TLSv1_1": 268435456,
  169. "SSL_OP_NO_TLSv1_2": 134217728,
  170. "SSL_OP_PKCS1_CHECK_1": 0,
  171. "SSL_OP_PKCS1_CHECK_2": 0,
  172. "SSL_OP_SINGLE_DH_USE": 1048576,
  173. "SSL_OP_SINGLE_ECDH_USE": 524288,
  174. "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128,
  175. "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0,
  176. "SSL_OP_TLS_BLOCK_PADDING_BUG": 512,
  177. "SSL_OP_TLS_D5_BUG": 256,
  178. "SSL_OP_TLS_ROLLBACK_BUG": 8388608,
  179. "ENGINE_METHOD_DSA": 2,
  180. "ENGINE_METHOD_DH": 4,
  181. "ENGINE_METHOD_RAND": 8,
  182. "ENGINE_METHOD_ECDH": 16,
  183. "ENGINE_METHOD_ECDSA": 32,
  184. "ENGINE_METHOD_CIPHERS": 64,
  185. "ENGINE_METHOD_DIGESTS": 128,
  186. "ENGINE_METHOD_STORE": 256,
  187. "ENGINE_METHOD_PKEY_METHS": 512,
  188. "ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
  189. "ENGINE_METHOD_ALL": 65535,
  190. "ENGINE_METHOD_NONE": 0,
  191. "DH_CHECK_P_NOT_SAFE_PRIME": 2,
  192. "DH_CHECK_P_NOT_PRIME": 1,
  193. "DH_UNABLE_TO_CHECK_GENERATOR": 4,
  194. "DH_NOT_SUITABLE_GENERATOR": 8,
  195. "NPN_ENABLED": 1,
  196. "RSA_PKCS1_PADDING": 1,
  197. "RSA_SSLV23_PADDING": 2,
  198. "RSA_NO_PADDING": 3,
  199. "RSA_PKCS1_OAEP_PADDING": 4,
  200. "RSA_X931_PADDING": 5,
  201. "RSA_PKCS1_PSS_PADDING": 6,
  202. "POINT_CONVERSION_COMPRESSED": 2,
  203. "POINT_CONVERSION_UNCOMPRESSED": 4,
  204. "POINT_CONVERSION_HYBRID": 6,
  205. "F_OK": 0,
  206. "R_OK": 4,
  207. "W_OK": 2,
  208. "X_OK": 1,
  209. "UV_UDP_REUSEADDR": 4
  210. }
  211. },{}],2:[function(require,module,exports){
  212. "use strict";
  213. cc.Assembler2D.prototype.updateWorldVerts = function (comp) {
  214. var local = this._local;
  215. var verts = this._renderData.vDatas[0];
  216. var vl = local[0],
  217. vr = local[2],
  218. vb = local[1],
  219. vt = local[3]; // left bottom
  220. verts[0] = vl;
  221. verts[1] = vb; // right bottom
  222. verts[5] = vr;
  223. verts[6] = vb; // left top
  224. verts[10] = vl;
  225. verts[11] = vt; // right top
  226. verts[15] = vr;
  227. verts[16] = vt;
  228. };
  229. var _updateColor = cc.Assembler2D.prototype.updateColor;
  230. cc.Assembler2D.prototype.updateColor = function (comp, color) {
  231. this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_OPACITY_CHANGED;
  232. _updateColor.call(this, comp, color);
  233. };
  234. },{}],3:[function(require,module,exports){
  235. "use strict";
  236. (function () {
  237. if (!cc.Assembler3D) return;
  238. cc.Assembler3D.updateWorldVerts = function (comp) {
  239. var local = this._local;
  240. var world = this._renderData.vDatas[0];
  241. var vl = local[0],
  242. vr = local[2],
  243. vb = local[1],
  244. vt = local[3]; // left bottom
  245. var floatsPerVert = this.floatsPerVert;
  246. var offset = 0;
  247. world[offset] = vl;
  248. world[offset + 1] = vb;
  249. world[offset + 2] = 0;
  250. offset += floatsPerVert; // right bottom
  251. world[offset] = vr;
  252. world[offset + 1] = vb;
  253. world[offset + 2] = 0;
  254. offset += floatsPerVert; // left top
  255. world[offset] = vl;
  256. world[offset + 1] = vt;
  257. world[offset + 2] = 0;
  258. offset += floatsPerVert; // right top
  259. world[offset] = vr;
  260. world[offset + 1] = vt;
  261. world[offset + 2] = 0;
  262. };
  263. })();
  264. },{}],4:[function(require,module,exports){
  265. "use strict";
  266. /****************************************************************************
  267. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  268. http://www.cocos.com
  269. Permission is hereby granted, free of charge, to any person obtaining a copy
  270. of this software and associated engine source code (the "Software"), a limited,
  271. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  272. to use Cocos Creator solely to develop games on your target platforms. You shall
  273. not use Cocos Creator software for developing other software or tools that's
  274. used for developing games. You are not granted to publish, distribute,
  275. sublicense, and/or sell copies of Cocos Creator.
  276. The software or tools in this License Agreement are licensed, not sold.
  277. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  278. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  279. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  280. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  281. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  282. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  283. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  284. THE SOFTWARE.
  285. ****************************************************************************/
  286. var RenderFlow = cc.RenderFlow;
  287. var originInit = cc.Assembler.prototype.init;
  288. var FLAG_VERTICES_OPACITY_CHANGED = 1 << 0;
  289. var FLAG_VERTICES_DIRTY = 1 << 1;
  290. var Assembler = {
  291. _ctor: function _ctor() {
  292. this._dirtyPtr = new Uint32Array(1);
  293. this.setDirty(this._dirtyPtr);
  294. this.initVertexFormat();
  295. },
  296. destroy: function destroy() {
  297. this._renderComp = null;
  298. this._effect = null;
  299. },
  300. clear: function clear() {
  301. this._renderData.clear();
  302. },
  303. _extendNative: function _extendNative() {
  304. renderer.Assembler.prototype.ctor.call(this);
  305. },
  306. initVertexFormat: function initVertexFormat() {
  307. var vfmt = this.getVfmt();
  308. if (!vfmt) return;
  309. this.setVertexFormat(vfmt._nativeObj);
  310. },
  311. init: function init(renderComp) {
  312. this._effect = [];
  313. originInit.call(this, renderComp);
  314. if (renderComp.node && renderComp.node._proxy) {
  315. renderComp.node._proxy.setAssembler(this);
  316. }
  317. },
  318. _updateRenderData: function _updateRenderData() {
  319. if (!this._renderComp || !this._renderComp.isValid) return;
  320. this.updateRenderData(this._renderComp);
  321. var materials = this._renderComp._materials;
  322. for (var i = 0; i < materials.length; i++) {
  323. var m = materials[i]; // TODO: find why material can be null
  324. if (!m) continue;
  325. m.getHash();
  326. this.updateMaterial(i, m);
  327. }
  328. },
  329. updateRenderData: function updateRenderData(comp) {
  330. comp._assembler.updateMaterial(0, comp._materials[0]);
  331. },
  332. updateMaterial: function updateMaterial(iaIndex, material) {
  333. var effect = material && material.effect;
  334. if (this._effect[iaIndex] !== effect) {
  335. this._effect[iaIndex] = effect;
  336. this.updateEffect(iaIndex, effect ? effect._nativeObj : null);
  337. }
  338. },
  339. updateColor: function updateColor(comp, color) {
  340. this._dirtyPtr[0] |= FLAG_VERTICES_OPACITY_CHANGED;
  341. },
  342. updateIADatas: function updateIADatas(iaIndex, meshIndex) {
  343. // When the MeshBuffer is switched, it is necessary to synchronize the iaData of the native assembler.
  344. this.updateMeshIndex(iaIndex, meshIndex);
  345. var materials = this._renderComp.sharedMaterials;
  346. var material = materials[iaIndex] || materials[0];
  347. this.updateMaterial(iaIndex, material);
  348. }
  349. };
  350. cc.Assembler.FLAG_VERTICES_OPACITY_CHANGED = FLAG_VERTICES_OPACITY_CHANGED;
  351. cc.Assembler.FLAG_VERTICES_DIRTY = FLAG_VERTICES_DIRTY;
  352. Object.setPrototypeOf(cc.Assembler.prototype, renderer.Assembler.prototype);
  353. cc.js.mixin(cc.Assembler.prototype, Assembler);
  354. module.exports = Assembler;
  355. },{}],5:[function(require,module,exports){
  356. "use strict";
  357. var proto = cc.Graphics.__assembler__.prototype;
  358. var _init = proto.init;
  359. proto.init = function (renderComp) {
  360. _init.call(this, renderComp);
  361. this.ignoreOpacityFlag();
  362. };
  363. proto.genBuffer = function (graphics, cverts) {
  364. var buffers = this.getBuffers();
  365. var buffer = buffers[this._bufferOffset];
  366. var meshbuffer = buffer.meshbuffer;
  367. meshbuffer.requestStatic(cverts, cverts * 3);
  368. this._buffer = buffer;
  369. meshbuffer.setNativeAssembler(this);
  370. return buffer;
  371. };
  372. var _stroke = proto.stroke;
  373. proto.stroke = function (graphics) {
  374. _stroke.call(this, graphics);
  375. var buffer = this._buffer;
  376. buffer.meshbuffer.used(buffer.vertexStart, buffer.indiceStart);
  377. };
  378. var _fill = proto.fill;
  379. proto.fill = function (graphics) {
  380. _fill.call(this, graphics);
  381. var buffer = this._buffer;
  382. buffer.meshbuffer.used(buffer.vertexStart, buffer.indiceStart);
  383. };
  384. var _updateIADatas = proto.updateIADatas;
  385. proto.updateIADatas = function (iaIndex, meshIndex) {
  386. _updateIADatas.call(this, iaIndex, meshIndex); // Reset vertexStart and indiceStart when buffer is switched.
  387. this._buffer.vertexStart = 0;
  388. this._buffer.indiceStart = 0;
  389. };
  390. },{}],6:[function(require,module,exports){
  391. "use strict";
  392. /****************************************************************************
  393. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  394. http://www.cocos.com
  395. Permission is hereby granted, free of charge, to any person obtaining a copy
  396. of this software and associated engine source code (the "Software"), a limited,
  397. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  398. to use Cocos Creator solely to develop games on your target platforms. You shall
  399. not use Cocos Creator software for developing other software or tools that's
  400. used for developing games. You are not granted to publish, distribute,
  401. sublicense, and/or sell copies of Cocos Creator.
  402. The software or tools in this License Agreement are licensed, not sold.
  403. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  404. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  405. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  406. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  407. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  408. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  409. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  410. THE SOFTWARE.
  411. ****************************************************************************/
  412. var originReserveQuads = cc.Label.__assembler__.Bmfont.prototype._reserveQuads;
  413. Object.assign(cc.Label.__assembler__.Bmfont.prototype, {
  414. updateWorldVerts: function updateWorldVerts(comp) {
  415. var local = this._local;
  416. var world = this._renderData.vDatas[0];
  417. var floatsPerVert = this.floatsPerVert;
  418. for (var offset = 0, l = local.length; offset < l; offset += floatsPerVert) {
  419. world[offset] = local[offset];
  420. world[offset + 1] = local[offset + 1];
  421. }
  422. }
  423. });
  424. },{}],7:[function(require,module,exports){
  425. "use strict";
  426. (function () {
  427. if (!cc.Label.__assembler__.Bmfont3D) return;
  428. var proto = cc.Label.__assembler__.Bmfont3D.prototype;
  429. Object.assign(proto, {
  430. updateWorldVerts: function updateWorldVerts(comp) {
  431. var local = this._local;
  432. var world = this._renderData.vDatas[0];
  433. var floatsPerVert = this.floatsPerVert;
  434. for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
  435. world[offset] = local[offset];
  436. world[offset + 1] = local[offset + 1];
  437. world[offset + 2] = 0;
  438. }
  439. }
  440. });
  441. })();
  442. },{}],8:[function(require,module,exports){
  443. "use strict";
  444. (function () {
  445. if (!cc.Label.__assembler__.TTF3D) return;
  446. var proto = cc.Label.__assembler__.TTF3D.prototype;
  447. Object.assign(proto, {
  448. updateWorldVerts: cc.Assembler3D.updateWorldVerts
  449. });
  450. })();
  451. },{}],9:[function(require,module,exports){
  452. "use strict";
  453. /****************************************************************************
  454. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  455. http://www.cocos.com
  456. Permission is hereby granted, free of charge, to any person obtaining a copy
  457. of this software and associated engine source code (the "Software"), a limited,
  458. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  459. to use Cocos Creator solely to develop games on your target platforms. You shall
  460. not use Cocos Creator software for developing other software or tools that's
  461. used for developing games. You are not granted to publish, distribute,
  462. sublicense, and/or sell copies of Cocos Creator.
  463. The software or tools in this License Agreement are licensed, not sold.
  464. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  465. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  466. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  467. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  468. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  469. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  470. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  471. THE SOFTWARE.
  472. ****************************************************************************/
  473. require('./2d/bmfont.js');
  474. require('./3d/bmfont.js');
  475. require('./3d/ttf.js');
  476. },{"./2d/bmfont.js":6,"./3d/bmfont.js":7,"./3d/ttf.js":8}],10:[function(require,module,exports){
  477. "use strict";
  478. /****************************************************************************
  479. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  480. http://www.cocos.com
  481. Permission is hereby granted, free of charge, to any person obtaining a copy
  482. of this software and associated engine source code (the "Software"), a limited,
  483. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  484. to use Cocos Creator solely to develop games on your target platforms. You shall
  485. not use Cocos Creator software for developing other software or tools that's
  486. used for developing games. You are not granted to publish, distribute,
  487. sublicense, and/or sell copies of Cocos Creator.
  488. The software or tools in this License Agreement are licensed, not sold.
  489. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  490. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  491. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  492. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  493. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  494. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  495. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  496. THE SOFTWARE.
  497. ****************************************************************************/
  498. var Mask = cc.Mask;
  499. var RenderFlow = cc.RenderFlow;
  500. var spriteAssembler = cc.Sprite.__assembler__.Simple.prototype;
  501. var graphicsAssembler = cc.Graphics.__assembler__.prototype;
  502. var proto = cc.Mask.__assembler__.prototype;
  503. var _updateRenderData = proto.updateRenderData; // Avoid constructor being overridden.
  504. renderer.MaskAssembler.prototype.constructor = cc.Mask.__assembler__;
  505. cc.js.mixin(proto, {
  506. _extendNative: function _extendNative() {
  507. renderer.MaskAssembler.prototype.ctor.call(this);
  508. },
  509. initLocal: function initLocal() {
  510. this._local = new Float32Array(4);
  511. renderer.MaskAssembler.prototype.setLocalData.call(this, this._local);
  512. },
  513. updateRenderData: function updateRenderData(mask) {
  514. _updateRenderData.call(this, mask);
  515. mask._clearGraphics._assembler.updateMaterial(0, mask._clearMaterial);
  516. this.setMaskInverted(mask.inverted);
  517. this.setUseModel(mask._type !== Mask.Type.IMAGE_STENCIL);
  518. this.setImageStencil(mask._type === Mask.Type.IMAGE_STENCIL);
  519. mask.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
  520. }
  521. }, renderer.MaskAssembler.prototype);
  522. var originCreateGraphics = cc.Mask.prototype._createGraphics;
  523. var originRemoveGraphics = cc.Mask.prototype._removeGraphics;
  524. cc.js.mixin(cc.Mask.prototype, {
  525. _createGraphics: function _createGraphics() {
  526. originCreateGraphics.call(this);
  527. if (this._graphics) {
  528. this._assembler.setRenderSubHandle(this._graphics._assembler);
  529. } // TODO: remove clearGraphics
  530. if (!this._clearGraphics) {
  531. this._clearGraphics = new cc.Graphics();
  532. cc.Assembler.init(this._clearGraphics);
  533. this._clearGraphics.node = new cc.Node();
  534. this._clearGraphics._activateMaterial();
  535. this._clearGraphics.lineWidth = 0;
  536. this._clearGraphics.rect(-1, -1, 2, 2);
  537. this._clearGraphics.fill();
  538. this._clearGraphics._assembler.ignoreWorldMatrix();
  539. this._assembler.setClearSubHandle(this._clearGraphics._assembler);
  540. }
  541. },
  542. _removeGraphics: function _removeGraphics() {
  543. originRemoveGraphics.call(this); // TODO: remove clearGraphics
  544. if (this._clearGraphics) {
  545. this._clearGraphics.destroy();
  546. this._clearGraphics = null;
  547. }
  548. }
  549. });
  550. },{}],11:[function(require,module,exports){
  551. "use strict";
  552. (function () {
  553. var Mesh = cc.MeshRenderer;
  554. if (Mesh === undefined) return;
  555. var proto = cc.MeshRenderer.__assembler__.prototype;
  556. var _init = proto.init;
  557. cc.js.mixin(proto, {
  558. initVertexFormat: function initVertexFormat() {},
  559. _extendNative: function _extendNative() {
  560. renderer.MeshAssembler.prototype.ctor.call(this);
  561. },
  562. init: function init(comp) {
  563. _init.call(this, comp);
  564. this.updateMeshData(true);
  565. },
  566. setRenderNode: function setRenderNode(node) {
  567. this.setNode(node._proxy);
  568. },
  569. updateRenderData: function updateRenderData(comp) {
  570. this.updateMeshData();
  571. comp.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
  572. },
  573. updateMeshData: function updateMeshData(force) {
  574. var comp = this._renderComp;
  575. var mesh = comp.mesh;
  576. if (!mesh || !mesh.loaded) return;
  577. var subdatas = comp.mesh.subDatas;
  578. for (var i = 0, len = subdatas.length; i < len; i++) {
  579. var data = subdatas[i];
  580. if (force || data.vDirty || data.iDirty) {
  581. this.updateIAData(i, data.vfm._nativeObj, data.vData, data.iData);
  582. data.vDirty = false;
  583. data.iDirty = false;
  584. }
  585. }
  586. }
  587. }, renderer.MeshAssembler.prototype);
  588. })();
  589. },{}],12:[function(require,module,exports){
  590. "use strict";
  591. var proto = cc.MotionStreak.__assembler__.prototype;
  592. var _init = proto.init;
  593. var _update = proto.update;
  594. cc.js.mixin(proto, {
  595. init: function init(comp) {
  596. _init.call(this, comp);
  597. this.setUseModel(false);
  598. this.ignoreWorldMatrix();
  599. this.ignoreOpacityFlag();
  600. },
  601. update: function update(comp, dt) {
  602. comp.node._updateWorldMatrix();
  603. _update.call(this, comp, dt);
  604. var _this$_renderData$_fl = this._renderData._flexBuffer,
  605. iData = _this$_renderData$_fl.iData,
  606. usedVertices = _this$_renderData$_fl.usedVertices;
  607. var indiceOffset = 0;
  608. for (var i = 0, l = usedVertices; i < l; i += 2) {
  609. iData[indiceOffset++] = i;
  610. iData[indiceOffset++] = i + 2;
  611. iData[indiceOffset++] = i + 1;
  612. iData[indiceOffset++] = i + 1;
  613. iData[indiceOffset++] = i + 2;
  614. iData[indiceOffset++] = i + 3;
  615. }
  616. }
  617. });
  618. },{}],13:[function(require,module,exports){
  619. "use strict";
  620. (function () {
  621. var PS = cc.ParticleSystem3D;
  622. if (PS === undefined) return;
  623. var proto = PS.__assembler__.prototype;
  624. var _init = proto.init;
  625. var _updateRenderData = proto.updateRenderData;
  626. cc.js.mixin(proto, {
  627. initVertexFormat: function initVertexFormat() {},
  628. _extendNative: function _extendNative() {
  629. renderer.Particle3DAssembler.prototype.ctor.call(this);
  630. },
  631. init: function init(comp) {
  632. _init.call(this, comp);
  633. this._renderDataList = new renderer.RenderDataList();
  634. this.setRenderDataList(this._renderDataList);
  635. this.ignoreOpacityFlag();
  636. this.updateMeshData();
  637. this.setUseModel(true);
  638. },
  639. updateRenderData: function updateRenderData(comp) {
  640. _updateRenderData.call(this, comp);
  641. if (comp._vertsDirty) {
  642. this.updateMeshData();
  643. comp._vertsDirty = false;
  644. }
  645. },
  646. setRenderNode: function setRenderNode(node) {
  647. this.setNode(node._proxy);
  648. },
  649. updateMeshData: function updateMeshData() {
  650. if (!this._model) {
  651. return;
  652. }
  653. var subdatas = this._model._subDatas;
  654. for (var i = 0, len = subdatas.length; i < len; i++) {
  655. var data = subdatas[i];
  656. if (data.vDirty && data.enable) {
  657. this._renderDataList.updateMesh(i, data.vData, data.iData);
  658. }
  659. }
  660. this.setVertexFormat(subdatas[0].vfm._nativeObj);
  661. this.setSimulationSpace(this._particleSystem.simulationSpace);
  662. if (subdatas[1] && subdatas[1].enable) {
  663. this.setTrailVertexFormat(subdatas[1].vfm._nativeObj);
  664. this.setTrailModuleSpace(this._particleSystem.trailModule.space);
  665. }
  666. },
  667. setSimulationSpace: function setSimulationSpace(space) {
  668. this.setParticleSpace(space);
  669. },
  670. setTrailModuleSpace: function setTrailModuleSpace(space) {
  671. this.setTrailSpace(space);
  672. },
  673. updateIA: function updateIA(index, count, vDirty, iDirty) {
  674. this.updateIndicesRange(index, 0, count);
  675. }
  676. }, renderer.Particle3DAssembler.prototype);
  677. })();
  678. },{}],14:[function(require,module,exports){
  679. "use strict";
  680. /****************************************************************************
  681. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  682. http://www.cocos.com
  683. Permission is hereby granted, free of charge, to any person obtaining a copy
  684. of this software and associated engine source code (the "Software"), a limited,
  685. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  686. to use Cocos Creator solely to develop games on your target platforms. You shall
  687. not use Cocos Creator software for developing other software or tools that's
  688. used for developing games. You are not granted to publish, distribute,
  689. sublicense, and/or sell copies of Cocos Creator.
  690. The software or tools in this License Agreement are licensed, not sold.
  691. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  692. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  693. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  694. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  695. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  696. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  697. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  698. THE SOFTWARE.
  699. ****************************************************************************/
  700. Object.assign(cc.Sprite.__assembler__.Mesh.prototype, {
  701. updateWorldVerts: function updateWorldVerts(sprite) {
  702. var local = this._local;
  703. var world = this._renderData.vDatas[0];
  704. var floatsPerVert = this.floatsPerVert;
  705. for (var i = 0, l = local.length / 2; i < l; i++) {
  706. world[i * floatsPerVert] = local[i * 2];
  707. world[i * floatsPerVert + 1] = local[i * 2 + 1];
  708. }
  709. }
  710. });
  711. },{}],15:[function(require,module,exports){
  712. "use strict";
  713. /****************************************************************************
  714. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  715. http://www.cocos.com
  716. Permission is hereby granted, free of charge, to any person obtaining a copy
  717. of this software and associated engine source code (the "Software"), a limited,
  718. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  719. to use Cocos Creator solely to develop games on your target platforms. You shall
  720. not use Cocos Creator software for developing other software or tools that's
  721. used for developing games. You are not granted to publish, distribute,
  722. sublicense, and/or sell copies of Cocos Creator.
  723. The software or tools in this License Agreement are licensed, not sold.
  724. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  725. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  726. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  727. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  728. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  729. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  730. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  731. THE SOFTWARE.
  732. ****************************************************************************/
  733. Object.assign(cc.Sprite.__assembler__.RadialFilled.prototype, {
  734. updateWorldVerts: function updateWorldVerts(sprite) {
  735. var local = this._local;
  736. var world = this._renderData.vDatas[0];
  737. var floatsPerVert = this.floatsPerVert;
  738. for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
  739. world[offset] = local[offset];
  740. world[offset + 1] = local[offset + 1];
  741. }
  742. }
  743. });
  744. },{}],16:[function(require,module,exports){
  745. "use strict";
  746. /****************************************************************************
  747. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  748. http://www.cocos.com
  749. Permission is hereby granted, free of charge, to any person obtaining a copy
  750. of this software and associated engine source code (the "Software"), a limited,
  751. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  752. to use Cocos Creator solely to develop games on your target platforms. You shall
  753. not use Cocos Creator software for developing other software or tools that's
  754. used for developing games. You are not granted to publish, distribute,
  755. sublicense, and/or sell copies of Cocos Creator.
  756. The software or tools in this License Agreement are licensed, not sold.
  757. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  758. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  759. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  760. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  761. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  762. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  763. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  764. THE SOFTWARE.
  765. ****************************************************************************/
  766. var proto = cc.Sprite.__assembler__.Simple.prototype;
  767. var nativeProto = renderer.SimpleSprite2D.prototype;
  768. proto.updateWorldVerts = function (comp) {
  769. this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_DIRTY;
  770. };
  771. proto._extendNative = function () {
  772. nativeProto.ctor.call(this);
  773. };
  774. proto.initLocal = function () {
  775. this._local = new Float32Array(4);
  776. nativeProto.setLocalData.call(this, this._local);
  777. };
  778. },{}],17:[function(require,module,exports){
  779. "use strict";
  780. /****************************************************************************
  781. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  782. http://www.cocos.com
  783. Permission is hereby granted, free of charge, to any person obtaining a copy
  784. of this software and associated engine source code (the "Software"), a limited,
  785. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  786. to use Cocos Creator solely to develop games on your target platforms. You shall
  787. not use Cocos Creator software for developing other software or tools that's
  788. used for developing games. You are not granted to publish, distribute,
  789. sublicense, and/or sell copies of Cocos Creator.
  790. The software or tools in this License Agreement are licensed, not sold.
  791. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  792. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  793. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  794. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  795. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  796. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  797. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  798. THE SOFTWARE.
  799. ****************************************************************************/
  800. var proto = cc.Sprite.__assembler__.Sliced.prototype;
  801. var nativeProto = renderer.SlicedSprite2D.prototype;
  802. proto.updateWorldVerts = function (comp) {
  803. this._dirtyPtr[0] |= cc.Assembler.FLAG_VERTICES_DIRTY;
  804. };
  805. proto._extendNative = function () {
  806. nativeProto.ctor.call(this);
  807. };
  808. proto.initLocal = function () {
  809. this._local = new Float32Array(8);
  810. nativeProto.setLocalData.call(this, this._local);
  811. };
  812. },{}],18:[function(require,module,exports){
  813. "use strict";
  814. /****************************************************************************
  815. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  816. http://www.cocos.com
  817. Permission is hereby granted, free of charge, to any person obtaining a copy
  818. of this software and associated engine source code (the "Software"), a limited,
  819. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  820. to use Cocos Creator solely to develop games on your target platforms. You shall
  821. not use Cocos Creator software for developing other software or tools that's
  822. used for developing games. You are not granted to publish, distribute,
  823. sublicense, and/or sell copies of Cocos Creator.
  824. The software or tools in this License Agreement are licensed, not sold.
  825. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  826. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  827. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  828. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  829. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  830. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  831. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  832. THE SOFTWARE.
  833. ****************************************************************************/
  834. Object.assign(cc.Sprite.__assembler__.Tiled.prototype, {
  835. updateWorldVerts: function updateWorldVerts(sprite) {
  836. var renderData = this._renderData;
  837. var local = this._local;
  838. var localX = local.x,
  839. localY = local.y;
  840. var world = renderData.vDatas[0];
  841. var row = this.row,
  842. col = this.col;
  843. var x, x1, y, y1;
  844. var floatsPerVert = this.floatsPerVert;
  845. var vertexOffset = 0;
  846. for (var yindex = 0, ylength = row; yindex < ylength; ++yindex) {
  847. y = localY[yindex];
  848. y1 = localY[yindex + 1];
  849. for (var xindex = 0, xlength = col; xindex < xlength; ++xindex) {
  850. x = localX[xindex];
  851. x1 = localX[xindex + 1]; // lb
  852. world[vertexOffset] = x;
  853. world[vertexOffset + 1] = y;
  854. vertexOffset += floatsPerVert; // rb
  855. world[vertexOffset] = x1;
  856. world[vertexOffset + 1] = y;
  857. vertexOffset += floatsPerVert; // lt
  858. world[vertexOffset] = x;
  859. world[vertexOffset + 1] = y1;
  860. vertexOffset += floatsPerVert; // rt
  861. world[vertexOffset] = x1;
  862. world[vertexOffset + 1] = y1;
  863. vertexOffset += floatsPerVert;
  864. }
  865. }
  866. }
  867. });
  868. },{}],19:[function(require,module,exports){
  869. "use strict";
  870. (function () {
  871. if (!cc.Sprite.__assembler__.BarFilled3D) return;
  872. var proto = cc.Sprite.__assembler__.BarFilled3D.prototype;
  873. Object.assign(proto, {
  874. updateWorldVerts: cc.Assembler3D.updateWorldVerts
  875. });
  876. })();
  877. },{}],20:[function(require,module,exports){
  878. "use strict";
  879. (function () {
  880. if (!cc.Sprite.__assembler__.Mesh3D) return;
  881. var proto = cc.Sprite.__assembler__.Mesh3D.prototype;
  882. Object.assign(proto, {
  883. updateWorldVerts: function updateWorldVerts(sprite) {
  884. var local = this._local;
  885. var world = this._renderData.vDatas[0];
  886. var floatsPerVert = this.floatsPerVert,
  887. offset = 0;
  888. for (var i = 0, j = 0, l = local.length / 2; i < l; i++, offset += floatsPerVert) {
  889. j = i * 2;
  890. world[offset] = local[j];
  891. world[offset + 1] = local[j++];
  892. world[offset + 2] = 0;
  893. }
  894. }
  895. });
  896. })();
  897. },{}],21:[function(require,module,exports){
  898. "use strict";
  899. (function () {
  900. if (!cc.Sprite.__assembler__.RadialFilled3D) return;
  901. var proto = cc.Sprite.__assembler__.RadialFilled3D.prototype;
  902. Object.assign(proto, {
  903. updateWorldVerts: function updateWorldVerts(sprite) {
  904. var local = this._local;
  905. var world = this._renderData.vDatas[0];
  906. var floatsPerVert = this.floatsPerVert;
  907. for (var offset = 0, l = world.length; offset < l; offset += floatsPerVert) {
  908. world[offset] = local[offset];
  909. world[offset + 1] = local[offset + 1];
  910. world[offset + 2] = 0;
  911. }
  912. }
  913. });
  914. })();
  915. },{}],22:[function(require,module,exports){
  916. "use strict";
  917. (function () {
  918. if (!cc.Sprite.__assembler__.Simple3D) return;
  919. var proto = cc.Sprite.__assembler__.Simple3D.prototype;
  920. var nativeProto = renderer.SimpleSprite3D.prototype;
  921. Object.assign(proto, {
  922. _extendNative: nativeProto.ctor
  923. });
  924. })();
  925. },{}],23:[function(require,module,exports){
  926. "use strict";
  927. (function () {
  928. if (!cc.Sprite.__assembler__.Sliced3D) return;
  929. var proto = cc.Sprite.__assembler__.Sliced3D.prototype;
  930. var nativeProto = renderer.SlicedSprite3D.prototype;
  931. Object.assign(proto, {
  932. _extendNative: nativeProto.ctor
  933. });
  934. })();
  935. },{}],24:[function(require,module,exports){
  936. "use strict";
  937. (function () {
  938. if (!cc.Sprite.__assembler__.Tiled3D) return;
  939. var proto = cc.Sprite.__assembler__.Tiled3D.prototype;
  940. Object.assign(proto, {
  941. updateWorldVerts: function updateWorldVerts(sprite) {
  942. var local = this._local;
  943. var localX = local.x,
  944. localY = local.y;
  945. var world = this._renderData.vDatas[0];
  946. var row = this.row,
  947. col = this.col;
  948. var x, x1, y, y1;
  949. var vertexOffset = 0;
  950. for (var yindex = 0, ylength = row; yindex < ylength; ++yindex) {
  951. y = localY[yindex];
  952. y1 = localY[yindex + 1];
  953. for (var xindex = 0, xlength = col; xindex < xlength; ++xindex) {
  954. x = localX[xindex];
  955. x1 = localX[xindex + 1]; // left bottom
  956. var padding = 6;
  957. world[vertexOffset] = x;
  958. world[vertexOffset + 1] = y;
  959. world[vertexOffset + 2] = 0;
  960. vertexOffset += padding; // right bottom
  961. world[vertexOffset] = x1;
  962. world[vertexOffset + 1] = y;
  963. world[vertexOffset + 2] = 0;
  964. vertexOffset += padding; // left top
  965. world[vertexOffset] = x;
  966. world[vertexOffset + 1] = y1;
  967. world[vertexOffset + 2] = 0;
  968. vertexOffset += padding; // right top
  969. world[vertexOffset] = x1;
  970. world[vertexOffset + 1] = y1;
  971. world[vertexOffset + 2] = 0;
  972. vertexOffset += padding;
  973. }
  974. }
  975. }
  976. });
  977. })();
  978. },{}],25:[function(require,module,exports){
  979. "use strict";
  980. /****************************************************************************
  981. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  982. http://www.cocos.com
  983. Permission is hereby granted, free of charge, to any person obtaining a copy
  984. of this software and associated engine source code (the "Software"), a limited,
  985. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  986. to use Cocos Creator solely to develop games on your target platforms. You shall
  987. not use Cocos Creator software for developing other software or tools that's
  988. used for developing games. You are not granted to publish, distribute,
  989. sublicense, and/or sell copies of Cocos Creator.
  990. The software or tools in this License Agreement are licensed, not sold.
  991. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  992. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  993. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  994. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  995. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  996. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  997. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  998. THE SOFTWARE.
  999. ****************************************************************************/
  1000. require('./2d/sliced.js');
  1001. require('./2d/tiled.js');
  1002. require('./2d/radial-filled.js');
  1003. require('./2d/simple.js');
  1004. require('./2d/mesh.js');
  1005. require('./3d/sliced.js');
  1006. require('./3d/simple.js');
  1007. require('./3d/tiled.js');
  1008. require('./3d/mesh.js');
  1009. require('./3d/bar-filled.js');
  1010. require('./3d/radial-filled.js');
  1011. },{"./2d/mesh.js":14,"./2d/radial-filled.js":15,"./2d/simple.js":16,"./2d/sliced.js":17,"./2d/tiled.js":18,"./3d/bar-filled.js":19,"./3d/mesh.js":20,"./3d/radial-filled.js":21,"./3d/simple.js":22,"./3d/sliced.js":23,"./3d/tiled.js":24}],26:[function(require,module,exports){
  1012. "use strict";
  1013. /****************************************************************************
  1014. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  1015. http://www.cocos.com
  1016. Permission is hereby granted, free of charge, to any person obtaining a copy
  1017. of this software and associated engine source code (the "Software"), a limited,
  1018. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  1019. to use Cocos Creator solely to develop games on your target platforms. You shall
  1020. not use Cocos Creator software for developing other software or tools that's
  1021. used for developing games. You are not granted to publish, distribute,
  1022. sublicense, and/or sell copies of Cocos Creator.
  1023. The software or tools in this License Agreement are licensed, not sold.
  1024. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  1025. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1026. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1027. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1028. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1029. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1030. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1031. THE SOFTWARE.
  1032. ****************************************************************************/
  1033. require('./jsb-sys.js');
  1034. require('./jsb-game.js');
  1035. require('./jsb-videoplayer.js');
  1036. require('./jsb-webview.js');
  1037. require('./jsb-audio.js');
  1038. require('./jsb-loader.js');
  1039. require('./jsb-editbox.js');
  1040. require('./jsb-reflection.js');
  1041. require('./jsb-assets-manager.js');
  1042. if (CC_NATIVERENDERER) {
  1043. require('./jsb-effect.js');
  1044. require('./jsb-effect-variant.js');
  1045. require('./scene/camera.js');
  1046. require('./scene/light.js');
  1047. require('./scene/node-proxy.js');
  1048. require('./scene/render-flow.js'); // must be required after render flow
  1049. require('./scene/node.js');
  1050. cc.game.on(cc.game.EVENT_ENGINE_INITED, function () {
  1051. require('./scene/mesh-buffer.js');
  1052. require('./scene/quad-buffer.js');
  1053. require('./scene/render-data.js');
  1054. require('./assemblers/assembler.js');
  1055. require('./assemblers/assembler-2d.js');
  1056. require('./assemblers/assembler-3d.js');
  1057. require('./assemblers/sprite/index.js');
  1058. require('./assemblers/label/index.js');
  1059. require('./assemblers/mask-assembler.js');
  1060. require('./assemblers/graphics-assembler.js');
  1061. require('./assemblers/motion-streak.js');
  1062. require('./assemblers/mesh-renderer.js');
  1063. require('./assemblers/particle-3d-assembler.js');
  1064. require('./jsb-dragonbones.js');
  1065. require('./jsb-spine-skeleton.js');
  1066. require('./jsb-particle.js');
  1067. require('./jsb-tiledmap.js');
  1068. require('./jsb-skin-mesh.js');
  1069. });
  1070. }
  1071. },{"./assemblers/assembler-2d.js":2,"./assemblers/assembler-3d.js":3,"./assemblers/assembler.js":4,"./assemblers/graphics-assembler.js":5,"./assemblers/label/index.js":9,"./assemblers/mask-assembler.js":10,"./assemblers/mesh-renderer.js":11,"./assemblers/motion-streak.js":12,"./assemblers/particle-3d-assembler.js":13,"./assemblers/sprite/index.js":25,"./jsb-assets-manager.js":27,"./jsb-audio.js":28,"./jsb-dragonbones.js":29,"./jsb-editbox.js":30,"./jsb-effect-variant.js":31,"./jsb-effect.js":32,"./jsb-game.js":33,"./jsb-loader.js":34,"./jsb-particle.js":35,"./jsb-reflection.js":36,"./jsb-skin-mesh.js":37,"./jsb-spine-skeleton.js":38,"./jsb-sys.js":39,"./jsb-tiledmap.js":40,"./jsb-videoplayer.js":42,"./jsb-webview.js":43,"./scene/camera.js":44,"./scene/light.js":45,"./scene/mesh-buffer.js":46,"./scene/node-proxy.js":47,"./scene/node.js":48,"./scene/quad-buffer.js":49,"./scene/render-data.js":50,"./scene/render-flow.js":51}],27:[function(require,module,exports){
  1072. "use strict";
  1073. /*
  1074. * Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  1075. *
  1076. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1077. * of this software and associated documentation files (the "Software"), to deal
  1078. * in the Software without restriction, including without limitation the rights
  1079. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1080. * copies of the Software, and to permit persons to whom the Software is
  1081. * furnished to do so, subject to the following conditions:
  1082. *
  1083. * The above copyright notice and this permission notice shall be included in
  1084. * all copies or substantial portions of the Software.
  1085. *
  1086. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1087. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1088. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1089. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1090. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1091. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1092. * THE SOFTWARE.
  1093. */
  1094. if (jsb.AssetsManager) {
  1095. jsb.AssetsManager.State = {
  1096. UNINITED: 0,
  1097. UNCHECKED: 1,
  1098. PREDOWNLOAD_VERSION: 2,
  1099. DOWNLOADING_VERSION: 3,
  1100. VERSION_LOADED: 4,
  1101. PREDOWNLOAD_MANIFEST: 5,
  1102. DOWNLOADING_MANIFEST: 6,
  1103. MANIFEST_LOADED: 7,
  1104. NEED_UPDATE: 8,
  1105. READY_TO_UPDATE: 9,
  1106. UPDATING: 10,
  1107. UNZIPPING: 11,
  1108. UP_TO_DATE: 12,
  1109. FAIL_TO_UPDATE: 13
  1110. };
  1111. jsb.Manifest.DownloadState = {
  1112. UNSTARTED: 0,
  1113. DOWNLOADING: 1,
  1114. SUCCESSED: 2,
  1115. UNMARKED: 3
  1116. };
  1117. jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
  1118. jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
  1119. jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
  1120. jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
  1121. jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
  1122. jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
  1123. jsb.EventAssetsManager.ASSET_UPDATED = 6;
  1124. jsb.EventAssetsManager.ERROR_UPDATING = 7;
  1125. jsb.EventAssetsManager.UPDATE_FINISHED = 8;
  1126. jsb.EventAssetsManager.UPDATE_FAILED = 9;
  1127. jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;
  1128. }
  1129. },{}],28:[function(require,module,exports){
  1130. "use strict";
  1131. /****************************************************************************
  1132. Copyright (c) 2013-2016 Chukong Technologies Inc.
  1133. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  1134. http://www.cocos.com
  1135. Permission is hereby granted, free of charge, to any person obtaining a copy
  1136. of this software and associated engine source code (the "Software"), a limited,
  1137. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  1138. to use Cocos Creator solely to develop games on your target platforms. You shall
  1139. not use Cocos Creator software for developing other software or tools that's
  1140. used for developing games. You are not granted to publish, distribute,
  1141. sublicense, and/or sell copies of Cocos Creator.
  1142. The software or tools in this License Agreement are licensed, not sold.
  1143. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  1144. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1145. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1146. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1147. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1148. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1149. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1150. THE SOFTWARE.
  1151. ****************************************************************************/
  1152. cc.Audio = function (src) {
  1153. this.src = src;
  1154. this.volume = 1;
  1155. this.loop = false;
  1156. this.id = -1;
  1157. };
  1158. var handleVolume = function handleVolume(volume) {
  1159. if (volume === undefined) {
  1160. // set default volume as 1
  1161. volume = 1;
  1162. } else if (typeof volume === 'string') {
  1163. volume = Number.parseFloat(volume);
  1164. }
  1165. return volume;
  1166. };
  1167. (function (proto, audioEngine) {
  1168. if (!audioEngine) return; // Using the new audioEngine
  1169. cc.audioEngine = audioEngine;
  1170. audioEngine.setMaxWebAudioSize = function () {};
  1171. cc.Audio.State = audioEngine.AudioState;
  1172. proto.play = function () {
  1173. audioEngine.stop(this.id);
  1174. var clip = this.src;
  1175. this.id = audioEngine.play(clip, this.loop, this.volume);
  1176. };
  1177. proto.pause = function () {
  1178. audioEngine.pause(this.id);
  1179. };
  1180. proto.resume = function () {
  1181. audioEngine.resume(this.id);
  1182. };
  1183. proto.stop = function () {
  1184. audioEngine.stop(this.id);
  1185. };
  1186. proto.destroy = function () {};
  1187. proto.setLoop = function (loop) {
  1188. this.loop = loop;
  1189. audioEngine.setLoop(this.id, loop);
  1190. };
  1191. proto.getLoop = function () {
  1192. return this.loop;
  1193. };
  1194. proto.setVolume = function (volume) {
  1195. volume = handleVolume(volume);
  1196. this.volume = volume;
  1197. return audioEngine.setVolume(this.id, volume);
  1198. };
  1199. proto.getVolume = function () {
  1200. return this.volume;
  1201. };
  1202. proto.setCurrentTime = function (time) {
  1203. audioEngine.setCurrentTime(this.id, time);
  1204. };
  1205. proto.getCurrentTime = function () {
  1206. return audioEngine.getCurrentTime(this.id);
  1207. };
  1208. proto.getDuration = function () {
  1209. return audioEngine.getDuration(this.id);
  1210. };
  1211. proto.getState = function () {
  1212. return audioEngine.getState(this.id);
  1213. }; // polyfill audioEngine
  1214. var _music = {
  1215. id: -1,
  1216. clip: '',
  1217. loop: false,
  1218. volume: 1
  1219. };
  1220. var _effect = {
  1221. volume: 1
  1222. };
  1223. audioEngine.play = function (clip, loop, volume) {
  1224. if (typeof volume !== 'number') {
  1225. volume = 1;
  1226. }
  1227. var audioFilePath;
  1228. var md5Pipe = cc.loader.md5Pipe;
  1229. if (typeof clip === 'string') {
  1230. // backward compatibility since 1.10
  1231. cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
  1232. audioFilePath = clip;
  1233. if (md5Pipe) {
  1234. audioFilePath = md5Pipe.transformURL(audioFilePath);
  1235. }
  1236. } else {
  1237. if (clip.loaded) {
  1238. audioFilePath = clip._nativeAsset;
  1239. } else {
  1240. // audio delay loading
  1241. clip._nativeAsset = audioFilePath = md5Pipe ? md5Pipe.transformURL(clip.nativeUrl) : clip.nativeUrl;
  1242. clip.loaded = true;
  1243. }
  1244. }
  1245. return audioEngine.play2d(audioFilePath, loop, volume);
  1246. };
  1247. audioEngine.playMusic = function (clip, loop) {
  1248. audioEngine.stop(_music.id);
  1249. _music.id = audioEngine.play(clip, loop, _music.volume);
  1250. _music.loop = loop;
  1251. _music.clip = clip;
  1252. return _music.id;
  1253. };
  1254. audioEngine.stopMusic = function () {
  1255. audioEngine.stop(_music.id);
  1256. };
  1257. audioEngine.pauseMusic = function () {
  1258. audioEngine.pause(_music.id);
  1259. return _music.id;
  1260. };
  1261. audioEngine.resumeMusic = function () {
  1262. audioEngine.resume(_music.id);
  1263. return _music.id;
  1264. };
  1265. audioEngine.getMusicVolume = function () {
  1266. return _music.volume;
  1267. };
  1268. audioEngine.setMusicVolume = function (volume) {
  1269. _music.volume = handleVolume(volume);
  1270. audioEngine.setVolume(_music.id, _music.volume);
  1271. return volume;
  1272. };
  1273. audioEngine.isMusicPlaying = function () {
  1274. return audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
  1275. };
  1276. audioEngine.playEffect = function (filePath, loop) {
  1277. return audioEngine.play(filePath, loop || false, _effect.volume);
  1278. };
  1279. audioEngine.setEffectsVolume = function (volume) {
  1280. _effect.volume = handleVolume(volume);
  1281. };
  1282. audioEngine.getEffectsVolume = function () {
  1283. return _effect.volume;
  1284. };
  1285. audioEngine.pauseEffect = function (audioID) {
  1286. return audioEngine.pause(audioID);
  1287. };
  1288. audioEngine.pauseAllEffects = function () {
  1289. var musicPlay = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
  1290. audioEngine.pauseAll();
  1291. if (musicPlay) {
  1292. audioEngine.resume(_music.id);
  1293. }
  1294. };
  1295. audioEngine.resumeEffect = function (id) {
  1296. audioEngine.resume(id);
  1297. };
  1298. audioEngine.resumeAllEffects = function () {
  1299. var musicPaused = audioEngine.getState(_music.id) === audioEngine.AudioState.PAUSED;
  1300. audioEngine.resumeAll();
  1301. if (musicPaused && audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING) {
  1302. audioEngine.pause(_music.id);
  1303. }
  1304. };
  1305. audioEngine.stopEffect = function (id) {
  1306. return audioEngine.stop(id);
  1307. };
  1308. audioEngine.stopAllEffects = function () {
  1309. var musicPlaying = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
  1310. var currentTime = audioEngine.getCurrentTime(_music.id);
  1311. audioEngine.stopAll();
  1312. if (musicPlaying) {
  1313. _music.id = audioEngine.play(_music.clip, _music.loop);
  1314. audioEngine.setCurrentTime(_music.id, currentTime);
  1315. }
  1316. }; // Unnecessary on native platform
  1317. audioEngine._break = function () {};
  1318. audioEngine._restore = function () {}; // deprecated
  1319. audioEngine._uncache = audioEngine.uncache;
  1320. audioEngine.uncache = function (clip) {
  1321. var path;
  1322. if (typeof clip === 'string') {
  1323. // backward compatibility since 1.10
  1324. cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
  1325. path = clip;
  1326. } else {
  1327. if (!clip) {
  1328. return;
  1329. }
  1330. path = clip._nativeAsset;
  1331. }
  1332. audioEngine._uncache(path);
  1333. };
  1334. audioEngine._preload = audioEngine.preload;
  1335. audioEngine.preload = function (filePath, callback) {
  1336. cc.warn('`cc.audioEngine.preload` is deprecated, use `cc.loader.loadRes(url, cc.AudioClip)` instead please.');
  1337. audioEngine._preload(filePath, callback);
  1338. };
  1339. })(cc.Audio.prototype, jsb.AudioEngine);
  1340. },{}],29:[function(require,module,exports){
  1341. "use strict";
  1342. var _constants = require("constants");
  1343. /****************************************************************************
  1344. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  1345. http://www.cocos.com
  1346. Permission is hereby granted, free of charge, to any person obtaining a copy
  1347. of this software and associated engine source code (the "Software"), a limited,
  1348. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  1349. to use Cocos Creator solely to develop games on your target platforms. You shall
  1350. not use Cocos Creator software for developing other software or tools that's
  1351. used for developing games. You are not granted to publish, distribute,
  1352. sublicense, and/or sell copies of Cocos Creator.
  1353. The software or tools in this License Agreement are licensed, not sold.
  1354. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  1355. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1356. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1357. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1358. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1359. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1360. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1361. THE SOFTWARE.
  1362. ****************************************************************************/
  1363. (function () {
  1364. if (window.dragonBones === undefined || window.middleware === undefined) return;
  1365. if (dragonBones.DragonBonesAtlasAsset === undefined) return; // dragonbones global time scale.
  1366. Object.defineProperty(dragonBones, 'timeScale', {
  1367. get: function get() {
  1368. return this._timeScale;
  1369. },
  1370. set: function set(value) {
  1371. this._timeScale = value;
  1372. var factory = this.CCFactory.getInstance();
  1373. factory.setTimeScale(value);
  1374. },
  1375. configurable: true
  1376. });
  1377. jsb.generateGetSet(dragonBones);
  1378. var _slotColor = cc.color(0, 0, 255, 255);
  1379. var _boneColor = cc.color(255, 0, 0, 255);
  1380. var _originColor = cc.color(0, 255, 0, 255); ////////////////////////////////////////////////////////////
  1381. // override dragonBones library by native dragonBones
  1382. ////////////////////////////////////////////////////////////
  1383. //--------------------
  1384. // adapt event name
  1385. //--------------------
  1386. dragonBones.EventObject.START = "start";
  1387. dragonBones.EventObject.LOOP_COMPLETE = "loopComplete";
  1388. dragonBones.EventObject.COMPLETE = "complete";
  1389. dragonBones.EventObject.FADE_IN = "fadeIn";
  1390. dragonBones.EventObject.FADE_IN_COMPLETE = "fadeInComplete";
  1391. dragonBones.EventObject.FADE_OUT = "fadeOut";
  1392. dragonBones.EventObject.FADE_OUT_COMPLETE = "fadeOutComplete";
  1393. dragonBones.EventObject.FRAME_EVENT = "frameEvent";
  1394. dragonBones.EventObject.SOUND_EVENT = "soundEvent";
  1395. dragonBones.DragonBones = {
  1396. ANGLE_TO_RADIAN: Math.PI / 180,
  1397. RADIAN_TO_ANGLE: 180 / Math.PI
  1398. }; //-------------------
  1399. // native factory
  1400. //-------------------
  1401. var factoryProto = dragonBones.CCFactory.prototype;
  1402. factoryProto.createArmatureNode = function (comp, armatureName, node) {
  1403. node = node || new cc.Node();
  1404. var display = node.getComponent(dragonBones.ArmatureDisplay);
  1405. if (!display) {
  1406. display = node.addComponent(dragonBones.ArmatureDisplay);
  1407. }
  1408. node.name = armatureName;
  1409. display._armatureName = armatureName;
  1410. display._N$dragonAsset = comp.dragonAsset;
  1411. display._N$dragonAtlasAsset = comp.dragonAtlasAsset;
  1412. display._init();
  1413. return display;
  1414. };
  1415. var _replaceSkin = factoryProto.replaceSkin;
  1416. factoryProto.replaceSkin = function (armatrue, skinData, isOverride, exclude) {
  1417. if (isOverride == undefined) isOverride = false;
  1418. exclude = exclude || [];
  1419. _replaceSkin.call(this, armatrue, skinData, isOverride, exclude);
  1420. };
  1421. var _changeSkin = factoryProto.changeSkin;
  1422. factoryProto.changeSkin = function (armatrue, skinData, exclude) {
  1423. _changeSkin.call(this, armatrue, skinData, exclude);
  1424. }; //-------------------
  1425. // native animation state
  1426. //-------------------
  1427. var animationStateProto = dragonBones.AnimationState.prototype;
  1428. var _isPlaying = animationStateProto.isPlaying;
  1429. Object.defineProperty(animationStateProto, 'isPlaying', {
  1430. get: function get() {
  1431. return _isPlaying.call(this);
  1432. }
  1433. }); //-------------------
  1434. // native armature
  1435. //-------------------
  1436. var armatureProto = dragonBones.Armature.prototype;
  1437. armatureProto.addEventListener = function (eventType, listener, target) {
  1438. if (!this.__persistentDisplay__) {
  1439. this.__persistentDisplay__ = this.getDisplay();
  1440. }
  1441. this.__persistentDisplay__.on(eventType, listener, target);
  1442. };
  1443. armatureProto.removeEventListener = function (eventType, listener, target) {
  1444. if (!this.__persistentDisplay__) {
  1445. this.__persistentDisplay__ = this.getDisplay();
  1446. }
  1447. this.__persistentDisplay__.off(eventType, listener, target);
  1448. }; //--------------------------
  1449. // native CCArmatureDisplay
  1450. //--------------------------
  1451. var nativeArmatureDisplayProto = dragonBones.CCArmatureDisplay.prototype;
  1452. Object.defineProperty(nativeArmatureDisplayProto, "node", {
  1453. get: function get() {
  1454. return this;
  1455. }
  1456. });
  1457. nativeArmatureDisplayProto.getRootNode = function () {
  1458. var rootDisplay = this.getRootDisplay();
  1459. return rootDisplay && rootDisplay._ccNode;
  1460. };
  1461. nativeArmatureDisplayProto.convertToWorldSpace = function (point) {
  1462. var newPos = this.convertToRootSpace(point);
  1463. newPos = cc.v2(newPos.x, newPos.y);
  1464. var ccNode = this.getRootNode();
  1465. if (!ccNode) return newPos;
  1466. var finalPos = ccNode.convertToWorldSpaceAR(newPos);
  1467. return finalPos;
  1468. };
  1469. nativeArmatureDisplayProto.initEvent = function () {
  1470. if (this._eventTarget) {
  1471. return;
  1472. }
  1473. this._eventTarget = new cc.EventTarget();
  1474. this.setDBEventCallback(function (eventObject) {
  1475. this._eventTarget.emit(eventObject.type, eventObject);
  1476. });
  1477. };
  1478. nativeArmatureDisplayProto.on = function (type, listener, target) {
  1479. this.initEvent();
  1480. this._eventTarget.on(type, listener, target);
  1481. this.addDBEventListener(type, listener);
  1482. };
  1483. nativeArmatureDisplayProto.off = function (type, listener, target) {
  1484. this.initEvent();
  1485. this._eventTarget.off(type, listener, target);
  1486. this.removeDBEventListener(type, listener);
  1487. };
  1488. nativeArmatureDisplayProto.once = function (type, listener, target) {
  1489. this.initEvent();
  1490. this._eventTarget.once(type, listener, target);
  1491. this.addDBEventListener(type, listener);
  1492. }; ////////////////////////////////////////////////////////////
  1493. // override DragonBonesAtlasAsset
  1494. ////////////////////////////////////////////////////////////
  1495. var dbAtlas = dragonBones.DragonBonesAtlasAsset.prototype;
  1496. var _gTextureIdx = 1;
  1497. var _textureKeyMap = {};
  1498. var _textureMap = new WeakMap();
  1499. var _textureIdx2Name = {};
  1500. dbAtlas.removeRecordTexture = function (texture) {
  1501. if (!texture) return;
  1502. delete _textureIdx2Name[texture.url];
  1503. var index = texture.__textureIndex__;
  1504. if (index) {
  1505. var texKey = _textureKeyMap[index];
  1506. if (texKey && _textureMap.has(texKey)) {
  1507. _textureMap["delete"](texKey);
  1508. delete _textureKeyMap[index];
  1509. }
  1510. }
  1511. };
  1512. dbAtlas.recordTexture = function () {
  1513. if (this._texture && this._oldTexture !== this._texture) {
  1514. this.removeRecordTexture(this._oldTexture);
  1515. var texKey = _textureKeyMap[_gTextureIdx] = {
  1516. key: _gTextureIdx
  1517. };
  1518. _textureMap.set(texKey, this._texture);
  1519. this._oldTexture = this._texture;
  1520. this._texture.__textureIndex__ = _gTextureIdx;
  1521. _gTextureIdx++;
  1522. }
  1523. };
  1524. dbAtlas.getTextureByIndex = function (textureIdx) {
  1525. var texKey = _textureKeyMap[textureIdx];
  1526. if (!texKey) return;
  1527. return _textureMap.get(texKey);
  1528. };
  1529. dbAtlas.updateTextureAtlasData = function (factory) {
  1530. var url = this._texture.url;
  1531. var preAtlasInfo = _textureIdx2Name[url];
  1532. var index; // If the texture has store the atlas info before,then get native atlas object,and
  1533. // update script texture map.
  1534. if (preAtlasInfo) {
  1535. index = preAtlasInfo.index;
  1536. this._textureAtlasData = factory.getTextureAtlasDataByIndex(preAtlasInfo.name, index);
  1537. var texKey = _textureKeyMap[preAtlasInfo.index];
  1538. _textureMap.set(texKey, this._texture);
  1539. this._texture.__textureIndex__ = index; // If script has store the atlas info,but native has no atlas object,then
  1540. // still new native texture2d object,but no call recordTexture to increase
  1541. // textureIndex.
  1542. if (this._textureAtlasData) {
  1543. return;
  1544. }
  1545. } else {
  1546. this.recordTexture();
  1547. }
  1548. index = this._texture.__textureIndex__;
  1549. this.jsbTexture = new middleware.Texture2D();
  1550. this.jsbTexture.setRealTextureIndex(index);
  1551. this.jsbTexture.setPixelsWide(this._texture.width);
  1552. this.jsbTexture.setPixelsHigh(this._texture.height);
  1553. this._textureAtlasData = factory.parseTextureAtlasData(this.atlasJson, this.jsbTexture, this._uuid);
  1554. this.jsbTexture.setNativeTexture(this._texture.getImpl());
  1555. _textureIdx2Name[url] = {
  1556. name: this._textureAtlasData.name,
  1557. index: index
  1558. };
  1559. };
  1560. dbAtlas.init = function (factory) {
  1561. this._factory = factory; // If create by manual, uuid is empty.
  1562. if (!this._uuid) {
  1563. var atlasJsonObj = JSON.parse(this.atlasJson);
  1564. this._uuid = atlasJsonObj.name;
  1565. }
  1566. if (this._textureAtlasData) {
  1567. factory.addTextureAtlasData(this._textureAtlasData, this._uuid);
  1568. } else {
  1569. this.updateTextureAtlasData(factory);
  1570. }
  1571. };
  1572. dbAtlas._clear = function (dontRecordTexture) {
  1573. if (this._factory) {
  1574. this._factory.removeTextureAtlasData(this._uuid, true);
  1575. this._factory.removeDragonBonesDataByUUID(this._uuid, true);
  1576. }
  1577. this._textureAtlasData = null;
  1578. if (!dontRecordTexture) {
  1579. this.recordTexture();
  1580. }
  1581. };
  1582. dbAtlas.destroy = function () {
  1583. this.removeRecordTexture(this._texture);
  1584. this._clear(true);
  1585. cc.Asset.prototype.destroy.call(this);
  1586. }; ////////////////////////////////////////////////////////////
  1587. // override DragonBonesAsset
  1588. ////////////////////////////////////////////////////////////
  1589. var dbAsset = dragonBones.DragonBonesAsset.prototype;
  1590. dbAsset.init = function (factory, atlasUUID) {
  1591. this._factory = factory; // If create by manual, uuid is empty.
  1592. // Only support json format, if remote load dbbin, must set uuid by manual.
  1593. if (!this._uuid && this.dragonBonesJson) {
  1594. var rawData = JSON.parse(this.dragonBonesJson);
  1595. this._uuid = rawData.name;
  1596. }
  1597. var armatureKey = this._uuid + "#" + atlasUUID;
  1598. var dragonBonesData = this._factory.getDragonBonesData(armatureKey);
  1599. if (dragonBonesData) return armatureKey;
  1600. var filePath = null;
  1601. if (this.dragonBonesJson) {
  1602. filePath = this.dragonBonesJson;
  1603. } else {
  1604. filePath = cc.loader.md5Pipe ? cc.loader.md5Pipe.transformURL(this.nativeUrl) : this.nativeUrl;
  1605. }
  1606. this._factory.parseDragonBonesDataByPath(filePath, armatureKey);
  1607. return armatureKey;
  1608. };
  1609. var armatureCacheMgr = dragonBones.ArmatureCacheMgr.getInstance();
  1610. dragonBones.armatureCacheMgr = armatureCacheMgr;
  1611. dbAsset._clear = function () {
  1612. if (this._factory) {
  1613. this._factory.removeDragonBonesDataByUUID(this._uuid, true);
  1614. }
  1615. armatureCacheMgr.removeArmatureCache(this._uuid);
  1616. }; ////////////////////////////////////////////////////////////
  1617. // adapt attach util
  1618. ////////////////////////////////////////////////////////////
  1619. var attachUtilProto = dragonBones.AttachUtil.prototype;
  1620. var _attachUtilInit = attachUtilProto.init;
  1621. attachUtilProto.init = function (armatureDisplay) {
  1622. _attachUtilInit.call(this, armatureDisplay);
  1623. this._nativeDisplay = armatureDisplay._nativeDisplay;
  1624. this._attachUtilNative = null;
  1625. };
  1626. var _generateAllAttachedNodes = attachUtilProto.generateAllAttachedNodes;
  1627. attachUtilProto.generateAllAttachedNodes = function () {
  1628. var res = _generateAllAttachedNodes.call(this);
  1629. this._associateAttachedNode();
  1630. return res;
  1631. };
  1632. var _generateAttachedNodes = attachUtilProto.generateAttachedNodes;
  1633. attachUtilProto.generateAttachedNodes = function (boneName) {
  1634. var res = _generateAttachedNodes.call(this, boneName);
  1635. this._associateAttachedNode();
  1636. return res;
  1637. };
  1638. var _associateAttachedNode = attachUtilProto._associateAttachedNode;
  1639. attachUtilProto._associateAttachedNode = function () {
  1640. if (!this._inited) return;
  1641. var rootNode = this._armatureNode.getChildByName('ATTACHED_NODE_TREE');
  1642. if (!rootNode || !rootNode.isValid) return; // associate js
  1643. _associateAttachedNode.call(this); // associate native
  1644. if (!this._attachUtilNative) {
  1645. if (this._armatureDisplay.isAnimationCached()) {
  1646. this._attachUtilNative = new dragonBones.CacheModeAttachUtil();
  1647. } else {
  1648. this._attachUtilNative = new dragonBones.RealTimeAttachUtil();
  1649. }
  1650. this._nativeDisplay.setAttachUtil(this._attachUtilNative);
  1651. }
  1652. this._attachUtilNative.associateAttachedNode(this._armature, this._armatureNode._proxy);
  1653. }; ////////////////////////////////////////////////////////////
  1654. // override ArmatureDisplay
  1655. ////////////////////////////////////////////////////////////
  1656. dragonBones.ArmatureDisplay._assembler = null;
  1657. var armatureDisplayProto = dragonBones.ArmatureDisplay.prototype;
  1658. var renderCompProto = cc.RenderComponent.prototype;
  1659. var AnimationCacheMode = dragonBones.ArmatureDisplay.AnimationCacheMode;
  1660. Object.defineProperty(armatureDisplayProto, 'armatureName', {
  1661. get: function get() {
  1662. return this._armatureName;
  1663. },
  1664. set: function set(value) {
  1665. this._armatureName = value;
  1666. var animNames = this.getAnimationNames(this._armatureName);
  1667. if (!this.animationName || animNames.indexOf(this.animationName) < 0) {
  1668. this.animationName = '';
  1669. }
  1670. if (this._armature) {
  1671. if (!this.isAnimationCached()) {
  1672. this._factory.remove(this._armature);
  1673. }
  1674. this._armature.dispose();
  1675. this._armature = null;
  1676. }
  1677. this._nativeDisplay = null;
  1678. this._refresh();
  1679. if (this._armature && !this.isAnimationCached()) {
  1680. this._factory.add(this._armature);
  1681. }
  1682. },
  1683. visible: false
  1684. });
  1685. Object.defineProperty(armatureDisplayProto, "premultipliedAlpha", {
  1686. get: function get() {
  1687. if (this._premultipliedAlpha === undefined) {
  1688. return false;
  1689. }
  1690. return this._premultipliedAlpha;
  1691. },
  1692. set: function set(value) {
  1693. this._premultipliedAlpha = value;
  1694. if (this._nativeDisplay) {
  1695. this._nativeDisplay.setOpacityModifyRGB(this._premultipliedAlpha);
  1696. }
  1697. }
  1698. });
  1699. var _initDebugDraw = armatureDisplayProto._initDebugDraw;
  1700. armatureDisplayProto._initDebugDraw = function () {
  1701. _initDebugDraw.call(this);
  1702. if (this._armature && !this.isAnimationCached()) {
  1703. this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
  1704. }
  1705. };
  1706. var _updateBatch = armatureDisplayProto._updateBatch;
  1707. armatureDisplayProto._updateBatch = function () {
  1708. _updateBatch.call(this);
  1709. if (this._nativeDisplay) {
  1710. this._nativeDisplay.setBatchEnabled(this.enableBatch);
  1711. }
  1712. this._assembler && this._assembler.clearEffect();
  1713. };
  1714. armatureDisplayProto._clearRenderData = function () {
  1715. this._nativeDisplay = null;
  1716. };
  1717. armatureDisplayProto._resetAssembler = function () {
  1718. this._assembler = new renderer.CustomAssembler();
  1719. this.node._proxy.setAssembler(this._assembler);
  1720. };
  1721. var _updateMaterial = armatureDisplayProto._updateMaterial;
  1722. var _materialHash2IDMap = {};
  1723. var _materialId = 1;
  1724. armatureDisplayProto._updateMaterial = function () {
  1725. _updateMaterial.call(this);
  1726. this._assembler && this._assembler.clearEffect();
  1727. var baseMaterial = this.getMaterial(0);
  1728. if (this._nativeDisplay && baseMaterial) {
  1729. var originHash = baseMaterial.effect.getHash();
  1730. var id = _materialHash2IDMap[originHash] || _materialId++;
  1731. _materialHash2IDMap[originHash] = id;
  1732. baseMaterial.effect.updateHash(id);
  1733. var nativeEffect = baseMaterial.effect._nativeObj;
  1734. this._nativeDisplay.setEffect(nativeEffect);
  1735. }
  1736. };
  1737. armatureDisplayProto._buildArmature = function () {
  1738. if (!this.dragonAsset || !this.dragonAtlasAsset || !this.armatureName) {
  1739. this._clearRenderData();
  1740. return;
  1741. }
  1742. if (this._nativeDisplay) {
  1743. this._nativeDisplay.dispose();
  1744. this._nativeDisplay._comp = null;
  1745. this._nativeDisplay = null;
  1746. }
  1747. var atlasUUID = this.dragonAtlasAsset._uuid;
  1748. this._armatureKey = this.dragonAsset.init(this._factory, atlasUUID);
  1749. if (this.isAnimationCached()) {
  1750. this._nativeDisplay = new dragonBones.CCArmatureCacheDisplay(this.armatureName, this._armatureKey, atlasUUID, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
  1751. this._armature = this._nativeDisplay.armature();
  1752. } else {
  1753. this._nativeDisplay = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", atlasUUID);
  1754. if (!this._nativeDisplay) {
  1755. this._clearRenderData();
  1756. return;
  1757. }
  1758. this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
  1759. this._armature = this._nativeDisplay.armature();
  1760. this._armature.animation.timeScale = this.timeScale;
  1761. this._factory.add(this._armature);
  1762. } // add all event into native display
  1763. var callbackTable = this._eventTarget._callbackTable; // just use to adapt to native api
  1764. var emptyHandle = function emptyHandle() {};
  1765. for (var key in callbackTable) {
  1766. var list = callbackTable[key];
  1767. if (!list || !list.callbackInfos || !list.callbackInfos.length) continue;
  1768. if (this.isAnimationCached()) {
  1769. this._nativeDisplay.addDBEventListener(key);
  1770. } else {
  1771. this._nativeDisplay.addDBEventListener(key, emptyHandle);
  1772. }
  1773. }
  1774. this._preCacheMode = this._cacheMode;
  1775. this._nativeDisplay._ccNode = this.node;
  1776. this._nativeDisplay._comp = this;
  1777. this._nativeDisplay._eventTarget = this._eventTarget;
  1778. this._nativeDisplay.bindNodeProxy(this.node._proxy);
  1779. this._nativeDisplay.setOpacityModifyRGB(this.premultipliedAlpha);
  1780. this._nativeDisplay.setBatchEnabled(this.enableBatch);
  1781. this._nativeDisplay.setColor(this.node.color);
  1782. this._nativeDisplay.setDBEventCallback(function (eventObject) {
  1783. this._eventTarget.emit(eventObject.type, eventObject);
  1784. });
  1785. this.attachUtil.init(this);
  1786. this.attachUtil._associateAttachedNode();
  1787. if (this.animationName) {
  1788. this.playAnimation(this.animationName, this.playTimes);
  1789. }
  1790. this._updateMaterial();
  1791. this.markForRender(true);
  1792. };
  1793. armatureDisplayProto._updateColor = function () {
  1794. if (this._nativeDisplay) {
  1795. this._nativeDisplay.setColor(this.node.color);
  1796. }
  1797. };
  1798. armatureDisplayProto.playAnimation = function (animName, playTimes) {
  1799. this.playTimes = playTimes === undefined ? -1 : playTimes;
  1800. this.animationName = animName;
  1801. if (this._nativeDisplay) {
  1802. if (this.isAnimationCached()) {
  1803. return this._nativeDisplay.playAnimation(animName, this.playTimes);
  1804. } else {
  1805. if (this._armature) {
  1806. return this._armature.animation.play(animName, this.playTimes);
  1807. }
  1808. }
  1809. }
  1810. return null;
  1811. };
  1812. armatureDisplayProto.updateAnimationCache = function (animName) {
  1813. if (!this.isAnimationCached()) return;
  1814. if (this._nativeDisplay) {
  1815. if (animName) {
  1816. this._nativeDisplay.updateAnimationCache(animName);
  1817. } else {
  1818. this._nativeDisplay.updateAllAnimationCache();
  1819. }
  1820. }
  1821. };
  1822. armatureDisplayProto.invalidAnimationCache = function () {
  1823. if (!this.isAnimationCached()) return;
  1824. if (this._nativeDisplay) {
  1825. this._nativeDisplay.updateAllAnimationCache();
  1826. }
  1827. };
  1828. armatureDisplayProto.onEnable = function () {
  1829. renderCompProto.onEnable.call(this);
  1830. if (this._armature && !this.isAnimationCached()) {
  1831. this._factory.add(this._armature);
  1832. }
  1833. };
  1834. armatureDisplayProto.onDisable = function () {
  1835. renderCompProto.onDisable.call(this);
  1836. if (this._armature && !this.isAnimationCached()) {
  1837. this._factory.remove(this._armature);
  1838. }
  1839. };
  1840. var _onLoad = armatureDisplayProto.onLoad;
  1841. armatureDisplayProto.onLoad = function () {
  1842. if (_onLoad) {
  1843. _onLoad.call(this);
  1844. }
  1845. };
  1846. armatureDisplayProto.once = function (eventType, listener, target) {
  1847. if (this._nativeDisplay) {
  1848. if (this.isAnimationCached()) {
  1849. this._nativeDisplay.addDBEventListener(eventType);
  1850. } else {
  1851. this._nativeDisplay.addDBEventListener(eventType, listener);
  1852. }
  1853. }
  1854. this._eventTarget.once(eventType, listener, target);
  1855. };
  1856. armatureDisplayProto.addEventListener = function (eventType, listener, target) {
  1857. if (this._nativeDisplay) {
  1858. if (this.isAnimationCached()) {
  1859. this._nativeDisplay.addDBEventListener(eventType);
  1860. } else {
  1861. this._nativeDisplay.addDBEventListener(eventType, listener);
  1862. }
  1863. }
  1864. this._eventTarget.on(eventType, listener, target);
  1865. };
  1866. armatureDisplayProto.removeEventListener = function (eventType, listener, target) {
  1867. if (this._nativeDisplay) {
  1868. if (this.isAnimationCached()) {
  1869. this._nativeDisplay.removeDBEventListener(eventType);
  1870. } else {
  1871. this._nativeDisplay.removeDBEventListener(eventType, listener);
  1872. }
  1873. }
  1874. this._eventTarget.off(eventType, listener, target);
  1875. };
  1876. var _onDestroy = armatureDisplayProto.onDestroy;
  1877. armatureDisplayProto.onDestroy = function () {
  1878. _onDestroy.call(this);
  1879. if (this._nativeDisplay) {
  1880. this._nativeDisplay.dispose();
  1881. this._nativeDisplay._comp = null;
  1882. this._nativeDisplay = null;
  1883. }
  1884. this._materialCache = null;
  1885. };
  1886. armatureDisplayProto.update = function () {
  1887. var nativeDisplay = this._nativeDisplay;
  1888. if (!nativeDisplay) return;
  1889. var node = this.node;
  1890. if (!node) return;
  1891. if (!this.isAnimationCached() && this._debugDraw && this.debugBones) {
  1892. var _nativeDisplay = this._nativeDisplay;
  1893. this._debugData = this._debugData || _nativeDisplay.getDebugData();
  1894. if (!this._debugData) return;
  1895. var graphics = this._debugDraw;
  1896. graphics.clear();
  1897. var debugData = this._debugData;
  1898. var debugIdx = 0;
  1899. graphics.lineWidth = 5;
  1900. graphics.strokeColor = _boneColor;
  1901. graphics.fillColor = _slotColor; // Root bone color is same as slot color.
  1902. var debugBonesLen = debugData[debugIdx++];
  1903. for (var i = 0; i < debugBonesLen; i += 4) {
  1904. var bx = debugData[debugIdx++];
  1905. var by = debugData[debugIdx++];
  1906. var x = debugData[debugIdx++];
  1907. var y = debugData[debugIdx++]; // Bone lengths.
  1908. graphics.moveTo(bx, by);
  1909. graphics.lineTo(x, y);
  1910. graphics.stroke(); // Bone origins.
  1911. graphics.circle(bx, by, Math.PI * 2);
  1912. graphics.fill();
  1913. if (i === 0) {
  1914. graphics.fillColor = _originColor;
  1915. }
  1916. }
  1917. }
  1918. };
  1919. })();
  1920. },{"constants":1}],30:[function(require,module,exports){
  1921. "use strict";
  1922. /****************************************************************************
  1923. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  1924. http://www.cocos.com
  1925. Permission is hereby granted, free of charge, to any person obtaining a copy
  1926. of this software and associated engine source code (the "Software"), a limited,
  1927. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  1928. to use Cocos Creator solely to develop games on your target platforms. You shall
  1929. not use Cocos Creator software for developing other software or tools that's
  1930. used for developing games. You are not granted to publish, distribute,
  1931. sublicense, and/or sell copies of Cocos Creator.
  1932. The software or tools in this License Agreement are licensed, not sold.
  1933. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  1934. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1935. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1936. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1937. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1938. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1939. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1940. THE SOFTWARE.
  1941. ****************************************************************************/
  1942. (function () {
  1943. if (!(cc && cc.EditBox)) {
  1944. return;
  1945. }
  1946. var EditBox = cc.EditBox;
  1947. var js = cc.js;
  1948. var KeyboardReturnType = EditBox.KeyboardReturnType;
  1949. var InputMode = EditBox.InputMode;
  1950. var InputFlag = EditBox.InputFlag;
  1951. var MAX_VALUE = 65535;
  1952. var worldMat = new cc.Mat4(),
  1953. cameraMat = new cc.Mat4();
  1954. function getInputType(type) {
  1955. switch (type) {
  1956. case InputMode.EMAIL_ADDR:
  1957. return 'email';
  1958. case InputMode.NUMERIC:
  1959. case InputMode.DECIMAL:
  1960. return 'number';
  1961. case InputMode.PHONE_NUMBER:
  1962. return 'phone';
  1963. case InputMode.URL:
  1964. return 'url';
  1965. case InputMode.SINGLE_LINE:
  1966. case InputMode.ANY:
  1967. default:
  1968. return 'text';
  1969. }
  1970. }
  1971. function getKeyboardReturnType(type) {
  1972. switch (type) {
  1973. case KeyboardReturnType.DEFAULT:
  1974. case KeyboardReturnType.DONE:
  1975. return 'done';
  1976. case KeyboardReturnType.SEND:
  1977. return 'send';
  1978. case KeyboardReturnType.SEARCH:
  1979. return 'search';
  1980. case KeyboardReturnType.GO:
  1981. return 'go';
  1982. case KeyboardReturnType.NEXT:
  1983. return 'next';
  1984. }
  1985. return 'done';
  1986. }
  1987. var BaseClass = EditBox._ImplClass;
  1988. function JsbEditBoxImpl() {
  1989. BaseClass.call(this);
  1990. }
  1991. js.extend(JsbEditBoxImpl, BaseClass);
  1992. EditBox._ImplClass = JsbEditBoxImpl;
  1993. Object.assign(JsbEditBoxImpl.prototype, {
  1994. init: function init(delegate) {
  1995. if (!delegate) {
  1996. cc.error('EditBox init failed');
  1997. return;
  1998. }
  1999. this._delegate = delegate;
  2000. },
  2001. beginEditing: function beginEditing() {
  2002. var self = this;
  2003. var delegate = this._delegate;
  2004. var multiline = delegate.inputMode === InputMode.ANY;
  2005. var rect = this._getRect();
  2006. var maxLength = delegate.maxLength < 0 ? MAX_VALUE : delegate.maxLength;
  2007. var inputTypeString = getInputType(delegate.inputMode);
  2008. if (delegate.inputFlag === InputFlag.PASSWORD) {
  2009. inputTypeString = 'password';
  2010. }
  2011. function onConfirm(res) {
  2012. delegate.editBoxEditingReturn();
  2013. }
  2014. function onInput(res) {
  2015. if (delegate._string !== res.value) {
  2016. delegate.editBoxTextChanged(res.value);
  2017. }
  2018. }
  2019. function onComplete(res) {
  2020. self.endEditing();
  2021. }
  2022. jsb.inputBox.onInput(onInput);
  2023. jsb.inputBox.onConfirm(onConfirm);
  2024. jsb.inputBox.onComplete(onComplete);
  2025. if (!cc.sys.isMobile) {
  2026. this._delegate._hideLabels();
  2027. }
  2028. jsb.inputBox.show({
  2029. defaultValue: delegate._string,
  2030. maxLength: maxLength,
  2031. multiple: multiline,
  2032. confirmHold: false,
  2033. confirmType: getKeyboardReturnType(delegate.returnType),
  2034. inputType: inputTypeString,
  2035. originX: rect.x,
  2036. originY: rect.y,
  2037. width: rect.width,
  2038. height: rect.height
  2039. });
  2040. this._editing = true;
  2041. delegate.editBoxEditingDidBegan();
  2042. },
  2043. endEditing: function endEditing() {
  2044. jsb.inputBox.offConfirm();
  2045. jsb.inputBox.offInput();
  2046. jsb.inputBox.offComplete();
  2047. this._editing = false;
  2048. if (!cc.sys.isMobile) {
  2049. this._delegate._showLabels();
  2050. }
  2051. jsb.inputBox.hide();
  2052. this._delegate.editBoxEditingDidEnded();
  2053. },
  2054. _getRect: function _getRect() {
  2055. var node = this._delegate.node,
  2056. viewScaleX = cc.view._scaleX,
  2057. viewScaleY = cc.view._scaleY;
  2058. var dpr = cc.view._devicePixelRatio;
  2059. node.getWorldMatrix(worldMat);
  2060. var camera = cc.Camera.findCamera(node);
  2061. camera.getWorldToScreenMatrix2D(cameraMat);
  2062. cc.Mat4.multiply(cameraMat, cameraMat, worldMat);
  2063. var contentSize = node._contentSize;
  2064. var vec3 = cc.v3();
  2065. vec3.x = -node._anchorPoint.x * contentSize.width;
  2066. vec3.y = -node._anchorPoint.y * contentSize.height;
  2067. cc.Mat4.translate(cameraMat, cameraMat, vec3);
  2068. viewScaleX /= dpr;
  2069. viewScaleY /= dpr;
  2070. var finalScaleX = cameraMat.m[0] * viewScaleX;
  2071. var finaleScaleY = cameraMat.m[5] * viewScaleY;
  2072. var viewportRect = cc.view._viewportRect;
  2073. var offsetX = viewportRect.x / dpr,
  2074. offsetY = viewportRect.y / dpr;
  2075. return {
  2076. x: cameraMat.m[12] * viewScaleX + offsetX,
  2077. y: cameraMat.m[13] * viewScaleY + offsetY,
  2078. width: contentSize.width * finalScaleX,
  2079. height: contentSize.height * finaleScaleY
  2080. };
  2081. }
  2082. });
  2083. })();
  2084. },{}],31:[function(require,module,exports){
  2085. "use strict";
  2086. // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  2087. (function () {
  2088. if (!cc.EffectVariant) return;
  2089. var EffectVariant = cc.EffectVariant;
  2090. var _init = EffectVariant.prototype.init;
  2091. Object.assign(EffectVariant.prototype, {
  2092. init: function init(effect) {
  2093. _init.call(this, effect);
  2094. this._nativeObj = new renderer.EffectVariant(effect._nativeObj);
  2095. },
  2096. _onEffectChanged: function _onEffectChanged() {
  2097. var nativeEffect = this._effect ? this._effect._nativeObj : null;
  2098. this._nativeObj.setEffect(nativeEffect);
  2099. },
  2100. updateHash: function updateHash(hash) {
  2101. this._nativeObj.updateHash(hash);
  2102. }
  2103. });
  2104. })();
  2105. },{}],32:[function(require,module,exports){
  2106. "use strict";
  2107. // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  2108. var gfx = window.gfx; // Effect
  2109. var Effect = cc.Effect;
  2110. var _init = Effect.prototype.init;
  2111. var _clone = Effect.prototype.clone;
  2112. var _switchTechnique = Effect.prototype.switchTechnique;
  2113. Object.assign(Effect.prototype, {
  2114. init: function init(name, techniques, techniqueIndex, asset, createNative) {
  2115. _init.call(this, name, techniques, techniqueIndex, asset);
  2116. if (createNative) {
  2117. this._nativeObj = new renderer.EffectNative();
  2118. this._nativeObj.init(techniques);
  2119. this._nativePtr = this._nativeObj.self();
  2120. }
  2121. },
  2122. clone: function clone() {
  2123. var effect = _clone.call(this);
  2124. effect._nativeObj = new renderer.EffectNative();
  2125. effect._nativeObj.copy(this._nativeObj);
  2126. effect._nativePtr = effect._nativeObj.self();
  2127. return effect;
  2128. },
  2129. switchTechnique: function switchTechnique(techniqueIndex) {
  2130. _switchTechnique.call(this, techniqueIndex);
  2131. this._nativeObj.switchTechnique(techniqueIndex);
  2132. }
  2133. }); // EffectBase
  2134. var EffectBase = cc.EffectBase;
  2135. var _setCullMode = EffectBase.prototype.setCullMode;
  2136. var _setBlend = EffectBase.prototype.setBlend;
  2137. var _setStencilEnabled = EffectBase.prototype.setStencilEnabled;
  2138. var _setStencil = EffectBase.prototype.setStencil;
  2139. var _setDepth = EffectBase.prototype.setDepth;
  2140. var _define = EffectBase.prototype.define;
  2141. var _setProperty = EffectBase.prototype.setProperty;
  2142. Object.assign(EffectBase.prototype, {
  2143. setCullMode: function setCullMode() {
  2144. var cullMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gfx.CULL_BACK;
  2145. var passIdx = arguments.length > 1 ? arguments[1] : undefined;
  2146. _setCullMode.call(this, cullMode, passIdx);
  2147. this._nativeObj.setCullMode(cullMode, passIdx === undefined ? -1 : passIdx);
  2148. },
  2149. setBlend: function setBlend() {
  2150. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2151. var blendEq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gfx.BLEND_FUNC_ADD;
  2152. var blendSrc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : gfx.BLEND_SRC_ALPHA;
  2153. var blendDst = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : gfx.BLEND_ONE_MINUS_SRC_ALPHA;
  2154. var blendAlphaEq = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : gfx.BLEND_FUNC_ADD;
  2155. var blendSrcAlpha = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : gfx.BLEND_SRC_ALPHA;
  2156. var blendDstAlpha = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : gfx.BLEND_ONE_MINUS_SRC_ALPHA;
  2157. var blendColor = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0xffffffff;
  2158. var passIdx = arguments.length > 8 ? arguments[8] : undefined;
  2159. _setBlend.call(this, enabled, blendEq, blendSrc, blendDst, blendAlphaEq, blendSrcAlpha, blendDstAlpha, blendColor, passIdx);
  2160. this._nativeObj.setBlend(enabled, blendEq, blendSrc, blendDst, blendAlphaEq, blendSrcAlpha, blendDstAlpha, blendColor, passIdx === undefined ? -1 : passIdx);
  2161. },
  2162. setDepth: function setDepth(depthTest, depthWrite, depthFunc, passIdx) {
  2163. _setDepth.call(this, depthTest, depthWrite, depthFunc, passIdx);
  2164. this._nativeObj.setDepth(depthTest, depthWrite, depthFunc, passIdx === undefined ? -1 : passIdx);
  2165. },
  2166. setStencilEnabled: function setStencilEnabled(enabled, passIdx) {
  2167. _setStencilEnabled.call(this, enabled, passIdx);
  2168. this._nativeObj.setStencilTest(enabled, passIdx === undefined ? -1 : passIdx);
  2169. },
  2170. setStencil: function setStencil() {
  2171. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gfx.STENCIL_INHERIT;
  2172. var stencilFunc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gfx.DS_FUNC_ALWAYS;
  2173. var stencilRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  2174. var stencilMask = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0xff;
  2175. var stencilFailOp = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : gfx.STENCIL_OP_KEEP;
  2176. var stencilZFailOp = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : gfx.STENCIL_OP_KEEP;
  2177. var stencilZPassOp = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : gfx.STENCIL_OP_KEEP;
  2178. var stencilWriteMask = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0xff;
  2179. var passIdx = arguments.length > 8 ? arguments[8] : undefined;
  2180. _setStencil.call(this, enabled, stencilFunc, stencilRef, stencilMask, stencilFailOp, stencilZFailOp, stencilZPassOp, stencilWriteMask, passIdx);
  2181. this._nativeObj.setStencil(stencilFunc, stencilRef, stencilMask, stencilFailOp, stencilZFailOp, stencilZPassOp, stencilWriteMask, passIdx === undefined ? -1 : passIdx);
  2182. },
  2183. define: function define(name, value, passIdx, force) {
  2184. _define.call(this, name, value, passIdx, force);
  2185. this._nativeObj.define(name, value, passIdx === undefined ? -1 : passIdx);
  2186. },
  2187. updateHash: function updateHash(hash) {
  2188. this._nativeObj.updateHash(hash);
  2189. },
  2190. setProperty: function setProperty(name, val, passIdx, directly) {
  2191. _setProperty.call(this, name, val, passIdx);
  2192. var prop = this.getProperty(name);
  2193. if (prop !== undefined) {
  2194. this._nativeObj.setProperty(name, prop, passIdx === undefined ? -1 : passIdx, directly);
  2195. }
  2196. }
  2197. });
  2198. },{}],33:[function(require,module,exports){
  2199. "use strict";
  2200. /****************************************************************************
  2201. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  2202. http://www.cocos.com
  2203. Permission is hereby granted, free of charge, to any person obtaining a copy
  2204. of this software and associated engine source code (the "Software"), a limited,
  2205. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  2206. to use Cocos Creator solely to develop games on your target platforms. You shall
  2207. not use Cocos Creator software for developing other software or tools that's
  2208. used for developing games. You are not granted to publish, distribute,
  2209. sublicense, and/or sell copies of Cocos Creator.
  2210. The software or tools in this License Agreement are licensed, not sold.
  2211. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  2212. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2213. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2214. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2215. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2216. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2217. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2218. THE SOFTWARE.
  2219. ****************************************************************************/
  2220. cc.game.restart = function () {
  2221. // Need to clear scene, or native object destructor won't be invoke.
  2222. cc.director.getScene().destroy();
  2223. cc.Object._deferredDestroy();
  2224. __restartVM();
  2225. };
  2226. jsb.onPause = function () {
  2227. cc.game.emit(cc.game.EVENT_HIDE);
  2228. };
  2229. jsb.onResume = function () {
  2230. cc.game.emit(cc.game.EVENT_SHOW);
  2231. };
  2232. function resize(size) {
  2233. // size should be the css style
  2234. size.width /= cc.view._devicePixelRatio;
  2235. size.height /= cc.view._devicePixelRatio;
  2236. window.resize(size.width, size.height);
  2237. }
  2238. jsb.onResize = function (size) {
  2239. if (size.width === 0 || size.height === 0) return; // getSafeAreaEdge is asynchronous on iOS, so callback later is required
  2240. if (CC_JSB && cc.sys.os === cc.sys.OS_IOS) {
  2241. var edges = jsb.Device.getSafeAreaEdge();
  2242. var hasSafeArea = edges.x > 0 || edges.y > 0 || edges.z > 0 || edges.w > 0;
  2243. if (hasSafeArea) {
  2244. setTimeout(function () {
  2245. if (cc.Vec4.strictEquals(edges, jsb.Device.getSafeAreaEdge())) {
  2246. setTimeout(resize, 200, size);
  2247. } else {
  2248. resize(size);
  2249. }
  2250. }, 0);
  2251. return;
  2252. }
  2253. }
  2254. resize(size);
  2255. };
  2256. },{}],34:[function(require,module,exports){
  2257. /****************************************************************************
  2258. Copyright (c) 2013-2016 Chukong Technologies Inc.
  2259. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  2260. http://www.cocos.com
  2261. Permission is hereby granted, free of charge, to any person obtaining a copy
  2262. of this software and associated engine source code (the "Software"), a limited,
  2263. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  2264. to use Cocos Creator solely to develop games on your target platforms. You shall
  2265. not use Cocos Creator software for developing other software or tools that's
  2266. used for developing games. You are not granted to publish, distribute,
  2267. sublicense, and/or sell copies of Cocos Creator.
  2268. The software or tools in this License Agreement are licensed, not sold.
  2269. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  2270. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2271. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2272. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2273. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2274. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2275. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2276. THE SOFTWARE.
  2277. ****************************************************************************/
  2278. 'use strict';
  2279. var jsbUtils = require('./jsb-utils');
  2280. function downloadScript(item, callback) {
  2281. require(item.url);
  2282. return null;
  2283. }
  2284. var mediaDownloader = new jsb.Downloader();
  2285. var mediaUrlMap = {}; // key: url, value: { loadingItem, callback }
  2286. mediaDownloader.setOnFileTaskSuccess(function (task) {
  2287. var _mediaUrlMap$task$req = mediaUrlMap[task.requestURL],
  2288. item = _mediaUrlMap$task$req.item,
  2289. callback = _mediaUrlMap$task$req.callback;
  2290. if (!(item && callback)) {
  2291. return;
  2292. }
  2293. item.url = task.storagePath;
  2294. item.rawUrl = task.storagePath;
  2295. callback(null, item);
  2296. delete mediaUrlMap[task.requestURL];
  2297. });
  2298. mediaDownloader.setOnTaskError(function (task, errorCode, errorCodeInternal, errorStr) {
  2299. var callback = mediaUrlMap[task.requestURL].callback;
  2300. callback && callback(errorStr, null);
  2301. delete mediaUrlMap[task.requestURL];
  2302. });
  2303. function downloadMedia(item, callback) {
  2304. if (/^http/.test(item.url)) {
  2305. var fileName = jsbUtils.murmurhash2_32_gc(item.url) + cc.path.extname(item.url);
  2306. var storagePath = jsb.fileUtils.getWritablePath() + fileName; // load from local cache
  2307. if (jsb.fileUtils.isFileExist(storagePath)) {
  2308. item.url = storagePath;
  2309. item.rawUrl = storagePath;
  2310. callback && callback(null, item);
  2311. } // download remote media file
  2312. else {
  2313. mediaUrlMap[item.url] = {
  2314. item: item,
  2315. callback: callback
  2316. };
  2317. mediaDownloader.createDownloadFileTask(item.url, storagePath);
  2318. } // Don't return anything to use async loading.
  2319. } else {
  2320. return item.url;
  2321. }
  2322. }
  2323. function loadAudio(item, callback) {
  2324. var loadByDeserializedAsset = item._owner instanceof cc.AudioClip;
  2325. if (loadByDeserializedAsset) {
  2326. return item.url;
  2327. } else {
  2328. var audioClip = new cc.AudioClip(); // obtain user url through nativeUrl
  2329. audioClip._setRawAsset(item.rawUrl, false); // obtain download url through _nativeAsset
  2330. audioClip._nativeAsset = item.url;
  2331. return audioClip;
  2332. }
  2333. }
  2334. function downloadImage(item, callback) {
  2335. var img = new Image();
  2336. img.src = item.url;
  2337. img.onload = function (info) {
  2338. callback(null, img);
  2339. };
  2340. img.onerror = function (event) {
  2341. callback(new Error('load image fail:' + img.src), null);
  2342. }; // Don't return anything to use async loading.
  2343. }
  2344. function _getFontFamily(fontHandle) {
  2345. var ttfIndex = fontHandle.lastIndexOf(".ttf");
  2346. if (ttfIndex === -1) return fontHandle;
  2347. var slashPos = fontHandle.lastIndexOf("/");
  2348. var fontFamilyName;
  2349. if (slashPos === -1) {
  2350. fontFamilyName = fontHandle.substring(0, ttfIndex) + "_LABEL";
  2351. } else {
  2352. fontFamilyName = fontHandle.substring(slashPos + 1, ttfIndex) + "_LABEL";
  2353. }
  2354. if (fontFamilyName.indexOf(' ') !== -1) {
  2355. fontFamilyName = '"' + fontFamilyName + '"';
  2356. }
  2357. return fontFamilyName;
  2358. }
  2359. function downloadText(item) {
  2360. var url = item.url;
  2361. var result = jsb.fileUtils.getStringFromFile(url);
  2362. if (typeof result === 'string' && result) {
  2363. return result;
  2364. } else {
  2365. return new Error('Download text failed: ' + url);
  2366. }
  2367. }
  2368. function downloadBinary(item) {
  2369. var url = item.url;
  2370. var result = jsb.fileUtils.getDataFromFile(url);
  2371. if (result) {
  2372. return result;
  2373. } else {
  2374. return new Error('Download binary file failed: ' + url);
  2375. }
  2376. }
  2377. function loadFont(item, callback) {
  2378. var url = item.url;
  2379. var fontFamilyName = _getFontFamily(url);
  2380. var fontFace = new FontFace(fontFamilyName, "url('" + url + "')");
  2381. document.fonts.add(fontFace);
  2382. fontFace.load();
  2383. fontFace.loaded.then(function () {
  2384. callback(null, fontFamilyName);
  2385. }, function () {
  2386. cc.warnID(4933, fontFamilyName);
  2387. callback(null, fontFamilyName);
  2388. });
  2389. }
  2390. function loadCompressedTex(item) {
  2391. return item.content;
  2392. }
  2393. cc.loader.addDownloadHandlers({
  2394. // JS
  2395. 'js': downloadScript,
  2396. 'jsc': downloadScript,
  2397. // Images
  2398. 'png': downloadImage,
  2399. 'jpg': downloadImage,
  2400. 'bmp': downloadImage,
  2401. 'jpeg': downloadImage,
  2402. 'gif': downloadImage,
  2403. 'ico': downloadImage,
  2404. 'tiff': downloadImage,
  2405. 'webp': downloadImage,
  2406. 'image': downloadImage,
  2407. 'pvr': downloadImage,
  2408. 'pkm': downloadImage,
  2409. // Audio
  2410. 'mp3': downloadMedia,
  2411. 'ogg': downloadMedia,
  2412. 'wav': downloadMedia,
  2413. 'm4a': downloadMedia,
  2414. // Video
  2415. 'mp4': downloadMedia,
  2416. 'avi': downloadMedia,
  2417. 'mov': downloadMedia,
  2418. 'mpg': downloadMedia,
  2419. 'mpeg': downloadMedia,
  2420. 'rm': downloadMedia,
  2421. 'rmvb': downloadMedia,
  2422. // Text
  2423. 'txt': downloadText,
  2424. 'xml': downloadText,
  2425. 'vsh': downloadText,
  2426. 'fsh': downloadText,
  2427. 'atlas': downloadText,
  2428. 'tmx': downloadText,
  2429. 'tsx': downloadText,
  2430. 'json': downloadText,
  2431. 'ExportJson': downloadText,
  2432. 'plist': downloadText,
  2433. 'fnt': downloadText,
  2434. 'binary': downloadBinary,
  2435. 'bin': downloadBinary,
  2436. 'dbbin': downloadBinary,
  2437. 'skel': downloadBinary,
  2438. 'default': downloadText
  2439. });
  2440. cc.loader.addLoadHandlers({
  2441. // Font
  2442. 'font': loadFont,
  2443. 'eot': loadFont,
  2444. 'ttf': loadFont,
  2445. 'woff': loadFont,
  2446. 'svg': loadFont,
  2447. 'ttc': loadFont,
  2448. // Audio
  2449. 'mp3': loadAudio,
  2450. 'ogg': loadAudio,
  2451. 'wav': loadAudio,
  2452. 'm4a': loadAudio,
  2453. // compressed texture
  2454. 'pvr': loadCompressedTex,
  2455. 'pkm': loadCompressedTex
  2456. });
  2457. },{"./jsb-utils":41}],35:[function(require,module,exports){
  2458. "use strict";
  2459. /****************************************************************************
  2460. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  2461. http://www.cocos.com
  2462. Permission is hereby granted, free of charge, to any person obtaining a copy
  2463. of this software and associated engine source code (the "Software"), a limited,
  2464. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  2465. to use Cocos Creator solely to develop games on your target platforms. You shall
  2466. not use Cocos Creator software for developing other software or tools that's
  2467. used for developing games. You are not granted to publish, distribute,
  2468. sublicense, and/or sell copies of Cocos Creator.
  2469. The software or tools in this License Agreement are licensed, not sold.
  2470. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  2471. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2472. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2473. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2474. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2475. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2476. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2477. THE SOFTWARE.
  2478. ****************************************************************************/
  2479. (function () {
  2480. if (window.middleware === undefined) return;
  2481. var ParticleSystem = cc.ParticleSystem;
  2482. if (ParticleSystem === undefined) return;
  2483. var PSProto = ParticleSystem.prototype;
  2484. PSProto.initProperties = function () {
  2485. this._simulator = new middleware.ParticleSimulator();
  2486. this._previewTimer = null;
  2487. this._focused = false;
  2488. this._texture = null;
  2489. this._renderData = null;
  2490. this._simulator.__particleSystem__ = this;
  2491. this._simulator.setFinishedCallback(function () {
  2492. var self = this.__particleSystem__;
  2493. self._finishedSimulation();
  2494. });
  2495. this._simulator.setStopCallback(function () {
  2496. var self = this.__particleSystem__;
  2497. self.stopSystem();
  2498. });
  2499. this._initProperties();
  2500. }; // value type properties
  2501. 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"];
  2502. propertiesList.forEach(function (getSetName) {
  2503. var varName = "_" + getSetName;
  2504. Object.defineProperty(PSProto, getSetName, {
  2505. get: function get() {
  2506. this[varName] === undefined && (this[varName] = 0);
  2507. return this[varName];
  2508. },
  2509. set: function set(val) {
  2510. this[varName] = val;
  2511. this._simulator && (this._simulator[getSetName] = val);
  2512. }
  2513. });
  2514. }); // object type properties
  2515. var objPropList = ['gravity', 'sourcePos', 'posVar', 'startColor', 'startColorVar', 'endColor', 'endColorVar'];
  2516. PSProto._initProperties = function () {
  2517. // init properties
  2518. for (var key in propertiesList) {
  2519. var propName = propertiesList[key];
  2520. this[propName] = this[propName];
  2521. }
  2522. for (var _key in objPropList) {
  2523. var _propName = objPropList[_key];
  2524. this[_propName] = this[_propName];
  2525. }
  2526. }, Object.defineProperty(PSProto, 'gravity', {
  2527. get: function get() {
  2528. !this._gravity && (this._gravity = cc.v2(0, 0));
  2529. return this._gravity;
  2530. },
  2531. set: function set(val) {
  2532. if (!val) return;
  2533. !this._gravity && (this._gravity = cc.v2(0, 0));
  2534. this.gravity.x = val.x;
  2535. this.gravity.y = val.y;
  2536. this._simulator && this._simulator.setGravity(val.x, val.y, 0);
  2537. }
  2538. });
  2539. Object.defineProperty(PSProto, 'sourcePos', {
  2540. get: function get() {
  2541. !this._sourcePos && (this._sourcePos = cc.v2(0, 0));
  2542. return this._sourcePos;
  2543. },
  2544. set: function set(val) {
  2545. if (!val) return;
  2546. !this._sourcePos && (this._sourcePos = cc.v2(0, 0));
  2547. this._sourcePos.x = val.x;
  2548. this._sourcePos.y = val.y;
  2549. this._simulator && this._simulator.setSourcePos(val.x, val.y, 0);
  2550. }
  2551. });
  2552. Object.defineProperty(PSProto, 'posVar', {
  2553. get: function get() {
  2554. !this._posVar && (this._posVar = cc.v2(0, 0));
  2555. return this._posVar;
  2556. },
  2557. set: function set(val) {
  2558. if (!val) return;
  2559. !this._posVar && (this._posVar = cc.v2(0, 0));
  2560. this._posVar.x = val.x;
  2561. this._posVar.y = val.y;
  2562. this._simulator && this._simulator.setPosVar(val.x, val.y, 0);
  2563. }
  2564. });
  2565. Object.defineProperty(PSProto, 'startColor', {
  2566. get: function get() {
  2567. !this._startColor && (this._startColor = cc.color(255, 255, 255, 255));
  2568. return this._startColor;
  2569. },
  2570. set: function set(val) {
  2571. if (!val) return;
  2572. !this._startColor && (this._startColor = cc.color(255, 255, 255, 255));
  2573. this._startColor.r = val.r;
  2574. this._startColor.g = val.g;
  2575. this._startColor.b = val.b;
  2576. this._startColor.a = val.a;
  2577. this._simulator && this._simulator.setStartColor(val.r, val.g, val.b, val.a);
  2578. }
  2579. });
  2580. Object.defineProperty(PSProto, 'startColorVar', {
  2581. get: function get() {
  2582. !this._startColorVar && (this._startColorVar = cc.color(0, 0, 0, 0));
  2583. return this._startColorVar;
  2584. },
  2585. set: function set(val) {
  2586. if (!val) return;
  2587. !this._startColorVar && (this._startColorVar = cc.color(0, 0, 0, 0));
  2588. this._startColorVar.r = val.r;
  2589. this._startColorVar.g = val.g;
  2590. this._startColorVar.b = val.b;
  2591. this._startColorVar.a = val.a;
  2592. this._simulator && this._simulator.setStartColorVar(val.r, val.g, val.b, val.a);
  2593. }
  2594. });
  2595. Object.defineProperty(PSProto, 'endColor', {
  2596. get: function get() {
  2597. !this._endColor && (this._endColor = cc.color(255, 255, 255, 0));
  2598. return this._endColor;
  2599. },
  2600. set: function set(val) {
  2601. if (!val) return;
  2602. !this._endColor && (this._endColor = cc.color(255, 255, 255, 0));
  2603. this._endColor.r = val.r;
  2604. this._endColor.g = val.g;
  2605. this._endColor.b = val.b;
  2606. this._endColor.a = val.a;
  2607. this._simulator && this._simulator.setEndColor(val.r, val.g, val.b, val.a);
  2608. }
  2609. });
  2610. Object.defineProperty(PSProto, 'endColorVar', {
  2611. get: function get() {
  2612. !this._endColorVar && (this._endColorVar = cc.color(0, 0, 0, 0));
  2613. return this._endColorVar;
  2614. },
  2615. set: function set(val) {
  2616. if (!val) return;
  2617. !this._endColorVar && (this._endColorVar = cc.color(0, 0, 0, 0));
  2618. this._endColorVar.r = val.r;
  2619. this._endColorVar.g = val.g;
  2620. this._endColorVar.b = val.b;
  2621. this._endColorVar.a = val.a;
  2622. this._simulator && this._simulator.setEndColorVar(val.r, val.g, val.b, val.a);
  2623. }
  2624. });
  2625. Object.defineProperty(PSProto, 'particleCount', {
  2626. get: function get() {
  2627. if (!this._simulator) {
  2628. return 0;
  2629. }
  2630. return this._simulator.getParticleCount();
  2631. }
  2632. });
  2633. Object.defineProperty(PSProto, 'active', {
  2634. get: function get() {
  2635. if (!this._simulator) {
  2636. return false;
  2637. }
  2638. return this._simulator.active();
  2639. }
  2640. });
  2641. PSProto.onLoad = function () {
  2642. this._simulator.bindNodeProxy(this.node._proxy);
  2643. }; // shield in native
  2644. PSProto.update = null;
  2645. PSProto.lateUpdate = null;
  2646. PSProto._resetAssembler = function () {
  2647. this._assembler = new renderer.CustomAssembler();
  2648. this._assembler.setUseModel(true);
  2649. this.node._proxy.setAssembler(this._assembler);
  2650. };
  2651. var _onEnable = PSProto.onEnable;
  2652. PSProto.onEnable = function () {
  2653. _onEnable.call(this);
  2654. if (this._simulator) {
  2655. this._simulator.onEnable();
  2656. }
  2657. };
  2658. var _onDisable = PSProto.onDisable;
  2659. PSProto.onDisable = function () {
  2660. _onDisable.call(this);
  2661. if (this._simulator) {
  2662. this._simulator.onDisable();
  2663. }
  2664. };
  2665. PSProto._onTextureLoaded = function () {
  2666. this._simulator.updateUVs(this._renderSpriteFrame.uv);
  2667. this._syncAspect();
  2668. this._simulator.aspectRatio = this._aspectRatio || 1.0;
  2669. this._updateMaterial();
  2670. this.markForRender(true);
  2671. };
  2672. var _updateMaterial = PSProto._updateMaterial;
  2673. PSProto._updateMaterial = function () {
  2674. _updateMaterial.call(this);
  2675. var material = this._materials[0];
  2676. material && this._simulator.setEffect(material.effect._nativeObj);
  2677. };
  2678. var _initWithDictionary = PSProto._initWithDictionary;
  2679. PSProto._initWithDictionary = function (content) {
  2680. _initWithDictionary.call(this, content);
  2681. this._initProperties();
  2682. };
  2683. var __preload = PSProto.__preload;
  2684. PSProto.__preload = function () {
  2685. __preload.call(this);
  2686. this._initProperties();
  2687. };
  2688. })();
  2689. },{}],36:[function(require,module,exports){
  2690. "use strict";
  2691. /****************************************************************************
  2692. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  2693. http://www.cocos.com
  2694. Permission is hereby granted, free of charge, to any person obtaining a copy
  2695. of this software and associated engine source code (the "Software"), a limited,
  2696. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  2697. to use Cocos Creator solely to develop games on your target platforms. You shall
  2698. not use Cocos Creator software for developing other software or tools that's
  2699. used for developing games. You are not granted to publish, distribute,
  2700. sublicense, and/or sell copies of Cocos Creator.
  2701. The software or tools in this License Agreement are licensed, not sold.
  2702. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  2703. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2704. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2705. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2706. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2707. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2708. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2709. THE SOFTWARE.
  2710. ****************************************************************************/
  2711. // JS to Native bridges
  2712. if (window.JavascriptJavaBridge && cc.sys.os == cc.sys.OS_ANDROID) {
  2713. jsb.reflection = new JavascriptJavaBridge();
  2714. cc.sys.capabilities["keyboard"] = true;
  2715. } else if (window.JavaScriptObjCBridge && (cc.sys.os == cc.sys.OS_IOS || cc.sys.os == cc.sys.OS_OSX)) {
  2716. jsb.reflection = new JavaScriptObjCBridge();
  2717. }
  2718. },{}],37:[function(require,module,exports){
  2719. "use strict";
  2720. (function () {
  2721. if (!cc.SkinnedMeshRenderer) return;
  2722. var SkinnedMeshAssembler = cc.SkinnedMeshRenderer.__assembler__.prototype;
  2723. cc.js.mixin(SkinnedMeshAssembler, {
  2724. updateRenderData: function updateRenderData(comp) {
  2725. comp.calcJointMatrix();
  2726. comp.node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
  2727. }
  2728. });
  2729. })();
  2730. },{}],38:[function(require,module,exports){
  2731. "use strict";
  2732. /****************************************************************************
  2733. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  2734. http://www.cocos.com
  2735. Permission is hereby granted, free of charge, to any person obtaining a copy
  2736. of this software and associated engine source code (the "Software"), a limited,
  2737. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  2738. to use Cocos Creator solely to develop games on your target platforms. You shall
  2739. not use Cocos Creator software for developing other software or tools that's
  2740. used for developing games. You are not granted to publish, distribute,
  2741. sublicense, and/or sell copies of Cocos Creator.
  2742. The software or tools in this License Agreement are licensed, not sold.
  2743. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  2744. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2745. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2746. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2747. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2748. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2749. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2750. THE SOFTWARE.
  2751. ****************************************************************************/
  2752. (function () {
  2753. if (window.sp === undefined || window.spine === undefined || window.middleware === undefined) return;
  2754. sp.VertexEffectDelegate = spine.VertexEffectDelegate;
  2755. jsb.generateGetSet(spine); // spine global time scale
  2756. Object.defineProperty(sp, 'timeScale', {
  2757. get: function get() {
  2758. return this._timeScale;
  2759. },
  2760. set: function set(value) {
  2761. this._timeScale = value;
  2762. spine.SkeletonAnimation.setGlobalTimeScale(value);
  2763. },
  2764. configurable: true
  2765. });
  2766. var _slotColor = cc.color(0, 0, 255, 255);
  2767. var _boneColor = cc.color(255, 0, 0, 255);
  2768. var _meshColor = cc.color(255, 255, 0, 255);
  2769. var _originColor = cc.color(0, 255, 0, 255);
  2770. var skeletonDataProto = sp.SkeletonData.prototype;
  2771. var _gTextureIdx = 1;
  2772. var _textureKeyMap = {};
  2773. var _textureMap = new WeakMap();
  2774. var skeletonDataMgr = spine.SkeletonDataMgr.getInstance();
  2775. spine.skeletonDataMgr = skeletonDataMgr;
  2776. skeletonDataMgr.setDestroyCallback(function (textureIndex) {
  2777. if (!textureIndex) return;
  2778. var texKey = _textureKeyMap[textureIndex];
  2779. if (texKey && _textureMap.has(texKey)) {
  2780. _textureMap["delete"](texKey);
  2781. delete _textureKeyMap[textureIndex];
  2782. }
  2783. });
  2784. var skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance();
  2785. spine.skeletonCacheMgr = skeletonCacheMgr;
  2786. skeletonDataProto.destroy = function () {
  2787. this.reset();
  2788. skeletonCacheMgr.removeSkeletonCache(this._uuid);
  2789. cc.Asset.prototype.destroy.call(this);
  2790. };
  2791. skeletonDataProto.reset = function () {
  2792. if (this._skeletonCache) {
  2793. spine.disposeSkeletonData(this._uuid);
  2794. this._jsbTextures = null;
  2795. this._skeletonCache = null;
  2796. }
  2797. this._atlasCache = null;
  2798. };
  2799. skeletonDataProto.getRuntimeData = function () {
  2800. if (!this._skeletonCache) {
  2801. this.init();
  2802. }
  2803. return this._skeletonCache;
  2804. };
  2805. skeletonDataProto.init = function () {
  2806. if (this._skeletonCache) return;
  2807. var uuid = this._uuid;
  2808. if (!uuid) {
  2809. cc.errorID(7504);
  2810. return;
  2811. }
  2812. var skeletonCache = spine.retainSkeletonData(uuid);
  2813. if (skeletonCache) {
  2814. this._skeletonCache = skeletonCache;
  2815. return;
  2816. }
  2817. var atlasText = this.atlasText;
  2818. if (!atlasText) {
  2819. cc.errorID(7508, this.name);
  2820. return;
  2821. }
  2822. var textures = this.textures;
  2823. var textureNames = this.textureNames;
  2824. if (!(textures && textures.length > 0 && textureNames && textureNames.length > 0)) {
  2825. cc.errorID(7507, this.name);
  2826. return;
  2827. }
  2828. var jsbTextures = {};
  2829. for (var i = 0; i < textures.length; ++i) {
  2830. var texture = textures[i];
  2831. var textureIdx = this.recordTexture(texture);
  2832. var spTex = new middleware.Texture2D();
  2833. spTex.setRealTextureIndex(textureIdx);
  2834. spTex.setPixelsWide(texture.width);
  2835. spTex.setPixelsHigh(texture.height);
  2836. spTex.setTexParamCallback(function (texIdx, minFilter, magFilter, wrapS, warpT) {
  2837. var tex = this.getTextureByIndex(texIdx);
  2838. tex.setFilters(minFilter, magFilter);
  2839. tex.setWrapMode(wrapS, warpT);
  2840. }.bind(this));
  2841. spTex.setNativeTexture(texture.getImpl());
  2842. jsbTextures[textureNames[i]] = spTex;
  2843. }
  2844. this._jsbTextures = jsbTextures;
  2845. var filePath = null;
  2846. if (this.skeletonJsonStr) {
  2847. filePath = this.skeletonJsonStr;
  2848. } else {
  2849. filePath = cc.loader.md5Pipe ? cc.loader.md5Pipe.transformURL(this.nativeUrl) : this.nativeUrl;
  2850. }
  2851. this._skeletonCache = spine.initSkeletonData(uuid, filePath, atlasText, jsbTextures, this.scale);
  2852. };
  2853. skeletonDataProto.recordTexture = function (texture) {
  2854. var index = _gTextureIdx;
  2855. var texKey = _textureKeyMap[index] = {
  2856. key: index
  2857. };
  2858. _textureMap.set(texKey, texture);
  2859. _gTextureIdx++;
  2860. return index;
  2861. };
  2862. skeletonDataProto.getTextureByIndex = function (textureIdx) {
  2863. var texKey = _textureKeyMap[textureIdx];
  2864. if (!texKey) return;
  2865. return _textureMap.get(texKey);
  2866. };
  2867. var renderCompProto = cc.RenderComponent.prototype;
  2868. var animation = spine.SkeletonAnimation.prototype; // The methods are added to be compatibility with old versions.
  2869. animation.setCompleteListener = function (listener) {
  2870. this._compeleteListener = listener;
  2871. this.setCompleteListenerNative(function (trackEntry) {
  2872. var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
  2873. this._compeleteListener && this._compeleteListener(trackEntry, loopCount);
  2874. });
  2875. }; // The methods are added to be compatibility with old versions.
  2876. animation.setTrackCompleteListener = function (trackEntry, listener) {
  2877. this._trackCompeleteListener = listener;
  2878. this.setTrackCompleteListenerNative(trackEntry, function (trackEntryNative) {
  2879. var loopCount = Math.floor(trackEntryNative.trackTime / trackEntryNative.animationEnd);
  2880. this._trackCompeleteListener && this._trackCompeleteListener(trackEntryNative, loopCount);
  2881. });
  2882. }; // Temporary solution before upgrade the Spine API
  2883. animation.setAnimationListener = function (target, callback) {
  2884. this._target = target;
  2885. this._callback = callback;
  2886. this.setStartListener(function (trackEntry) {
  2887. if (this._target && this._callback) {
  2888. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.START, null, 0);
  2889. }
  2890. });
  2891. this.setInterruptListener(function (trackEntry) {
  2892. if (this._target && this._callback) {
  2893. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.INTERRUPT, null, 0);
  2894. }
  2895. });
  2896. this.setEndListener(function (trackEntry) {
  2897. if (this._target && this._callback) {
  2898. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.END, null, 0);
  2899. }
  2900. });
  2901. this.setDisposeListener(function (trackEntry) {
  2902. if (this._target && this._callback) {
  2903. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.DISPOSE, null, 0);
  2904. }
  2905. });
  2906. this.setCompleteListener(function (trackEntry, loopCount) {
  2907. if (this._target && this._callback) {
  2908. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.COMPLETE, null, loopCount);
  2909. }
  2910. });
  2911. this.setEventListener(function (trackEntry, event) {
  2912. if (this._target && this._callback) {
  2913. this._callback.call(this._target, this, trackEntry, sp.AnimationEventType.EVENT, event, 0);
  2914. }
  2915. });
  2916. };
  2917. sp.Skeleton._assembler = null;
  2918. var skeleton = sp.Skeleton.prototype;
  2919. var AnimationCacheMode = sp.Skeleton.AnimationCacheMode;
  2920. Object.defineProperty(skeleton, 'paused', {
  2921. get: function get() {
  2922. return this._paused || false;
  2923. },
  2924. set: function set(value) {
  2925. this._paused = value;
  2926. if (this._nativeSkeleton) {
  2927. this._nativeSkeleton.paused(value);
  2928. }
  2929. }
  2930. });
  2931. Object.defineProperty(skeleton, "premultipliedAlpha", {
  2932. get: function get() {
  2933. if (this._premultipliedAlpha === undefined) {
  2934. return true;
  2935. }
  2936. return this._premultipliedAlpha;
  2937. },
  2938. set: function set(value) {
  2939. this._premultipliedAlpha = value;
  2940. if (this._nativeSkeleton) {
  2941. this._nativeSkeleton.setOpacityModifyRGB(this._premultipliedAlpha);
  2942. }
  2943. }
  2944. });
  2945. Object.defineProperty(skeleton, "timeScale", {
  2946. get: function get() {
  2947. if (this._timeScale === undefined) return 1.0;
  2948. return this._timeScale;
  2949. },
  2950. set: function set(value) {
  2951. this._timeScale = value;
  2952. if (this._nativeSkeleton) {
  2953. this._nativeSkeleton.setTimeScale(this._timeScale);
  2954. }
  2955. }
  2956. });
  2957. var _updateDebugDraw = skeleton._updateDebugDraw;
  2958. skeleton._updateDebugDraw = function () {
  2959. _updateDebugDraw.call(this);
  2960. if (this._nativeSkeleton && !this.isAnimationCached()) {
  2961. this._nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
  2962. this._nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
  2963. this._nativeSkeleton.setDebugBonesEnabled(this.debugBones);
  2964. }
  2965. };
  2966. var _updateUseTint = skeleton._updateUseTint;
  2967. skeleton._updateUseTint = function () {
  2968. _updateUseTint.call(this);
  2969. if (this._nativeSkeleton) {
  2970. this._nativeSkeleton.setUseTint(this.useTint);
  2971. }
  2972. this._assembler && this._assembler.clearEffect();
  2973. };
  2974. var _updateBatch = skeleton._updateBatch;
  2975. skeleton._updateBatch = function () {
  2976. _updateBatch.call(this);
  2977. if (this._nativeSkeleton) {
  2978. this._nativeSkeleton.setBatchEnabled(this.enableBatch);
  2979. }
  2980. this._assembler && this._assembler.clearEffect();
  2981. };
  2982. var _onLoad = skeleton.onLoad;
  2983. skeleton.onLoad = function () {
  2984. if (_onLoad) {
  2985. _onLoad.call(this);
  2986. }
  2987. };
  2988. skeleton._resetAssembler = function () {
  2989. this._assembler = new renderer.CustomAssembler();
  2990. this.node._proxy.setAssembler(this._assembler);
  2991. };
  2992. var _updateMaterial = skeleton._updateMaterial;
  2993. var _materialHashMap = {};
  2994. var _materialId = 1;
  2995. skeleton._updateMaterial = function () {
  2996. _updateMaterial.call(this);
  2997. this._assembler && this._assembler.clearEffect();
  2998. var baseMaterial = this.getMaterial(0);
  2999. if (this._nativeSkeleton && baseMaterial) {
  3000. var originHash = baseMaterial.effect.getHash();
  3001. var id = _materialHashMap[originHash] || _materialId++;
  3002. _materialHashMap[originHash] = id;
  3003. baseMaterial.effect.updateHash(id);
  3004. var nativeEffect = baseMaterial.effect._nativeObj;
  3005. this._nativeSkeleton.setEffect(nativeEffect);
  3006. }
  3007. };
  3008. skeleton.setSkeletonData = function (skeletonData) {
  3009. null != skeletonData.width && null != skeletonData.height && this.node.setContentSize(skeletonData.width, skeletonData.height);
  3010. var uuid = skeletonData._uuid;
  3011. if (!uuid) {
  3012. cc.errorID(7504);
  3013. return;
  3014. }
  3015. var texValues = skeletonData.textures;
  3016. var texKeys = skeletonData.textureNames;
  3017. if (!(texValues && texValues.length > 0 && texKeys && texKeys.length > 0)) {
  3018. cc.errorID(7507, skeletonData.name);
  3019. return;
  3020. }
  3021. if (this._nativeSkeleton) {
  3022. this._nativeSkeleton.stopSchedule();
  3023. this._nativeSkeleton._comp = null;
  3024. this._nativeSkeleton = null;
  3025. }
  3026. var nativeSkeleton = null;
  3027. if (this.isAnimationCached()) {
  3028. nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
  3029. } else {
  3030. nativeSkeleton = new spine.SkeletonAnimation();
  3031. try {
  3032. spine.initSkeletonRenderer(nativeSkeleton, uuid);
  3033. } catch (e) {
  3034. cc._throw(e);
  3035. return;
  3036. }
  3037. nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
  3038. nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
  3039. nativeSkeleton.setDebugBonesEnabled(this.debugBones);
  3040. }
  3041. this._nativeSkeleton = nativeSkeleton;
  3042. nativeSkeleton._comp = this;
  3043. nativeSkeleton.setUseTint(this.useTint);
  3044. nativeSkeleton.setOpacityModifyRGB(this.premultipliedAlpha);
  3045. nativeSkeleton.setTimeScale(this.timeScale);
  3046. nativeSkeleton.setBatchEnabled(this.enableBatch);
  3047. nativeSkeleton.bindNodeProxy(this.node._proxy);
  3048. nativeSkeleton.setColor(this.node.color);
  3049. this._skeleton = nativeSkeleton.getSkeleton(); // init skeleton listener
  3050. this._startListener && this.setStartListener(this._startListener);
  3051. this._endListener && this.setEndListener(this._endListener);
  3052. this._completeListener && this.setCompleteListener(this._completeListener);
  3053. this._eventListener && this.setEventListener(this._eventListener);
  3054. this._interruptListener && this.setInterruptListener(this._interruptListener);
  3055. this._disposeListener && this.setDisposeListener(this._disposeListener);
  3056. this._updateMaterial();
  3057. this.markForRender(true);
  3058. };
  3059. skeleton._updateColor = function () {
  3060. if (this._nativeSkeleton) {
  3061. this._nativeSkeleton.setColor(this.node.color);
  3062. }
  3063. };
  3064. skeleton.setAnimationStateData = function (stateData) {
  3065. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3066. this._stateData = stateData;
  3067. return this._nativeSkeleton.setAnimationStateData(stateData);
  3068. }
  3069. };
  3070. skeleton.onEnable = function () {
  3071. renderCompProto.onEnable.call(this);
  3072. if (this._nativeSkeleton) {
  3073. this._nativeSkeleton.onEnable();
  3074. }
  3075. };
  3076. skeleton.onDisable = function () {
  3077. renderCompProto.onDisable.call(this);
  3078. if (this._nativeSkeleton) {
  3079. this._nativeSkeleton.onDisable();
  3080. }
  3081. };
  3082. skeleton.setVertexEffectDelegate = function (effectDelegate) {
  3083. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3084. this._nativeSkeleton.setVertexEffectDelegate(effectDelegate);
  3085. }
  3086. };
  3087. skeleton.update = function () {
  3088. var nativeSkeleton = this._nativeSkeleton;
  3089. if (!nativeSkeleton) return;
  3090. var node = this.node;
  3091. if (!node) return;
  3092. if (!this.isAnimationCached() && (this.debugBones || this.debugSlots || this.debugMesh) && this._debugRenderer) {
  3093. var graphics = this._debugRenderer;
  3094. graphics.clear();
  3095. graphics.lineWidth = 2;
  3096. var debugData = this._debugData || nativeSkeleton.getDebugData();
  3097. if (!debugData) return;
  3098. var debugIdx = 0,
  3099. debugType = 0,
  3100. debugLen = 0;
  3101. while (true) {
  3102. debugType = debugData[debugIdx++];
  3103. if (debugType == 0) break;
  3104. debugLen = debugData[debugIdx++];
  3105. switch (debugType) {
  3106. case 1:
  3107. // slots
  3108. graphics.strokeColor = _slotColor;
  3109. for (var i = 0; i < debugLen; i += 8) {
  3110. graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
  3111. graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
  3112. graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
  3113. graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
  3114. graphics.close();
  3115. graphics.stroke();
  3116. }
  3117. break;
  3118. case 2:
  3119. // mesh
  3120. graphics.strokeColor = _meshColor;
  3121. for (var _i = 0; _i < debugLen; _i += 6) {
  3122. graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
  3123. graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
  3124. graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
  3125. graphics.close();
  3126. graphics.stroke();
  3127. }
  3128. break;
  3129. case 3:
  3130. // bones
  3131. graphics.strokeColor = _boneColor;
  3132. graphics.fillColor = _slotColor; // Root bone color is same as slot color.
  3133. for (var _i2 = 0; _i2 < debugLen; _i2 += 4) {
  3134. var bx = debugData[debugIdx++];
  3135. var by = debugData[debugIdx++];
  3136. var x = debugData[debugIdx++];
  3137. var y = debugData[debugIdx++]; // Bone lengths.
  3138. graphics.moveTo(bx, by);
  3139. graphics.lineTo(x, y);
  3140. graphics.stroke(); // Bone origins.
  3141. graphics.circle(bx, by, Math.PI * 1.5);
  3142. graphics.fill();
  3143. if (_i2 === 0) {
  3144. graphics.fillColor = _originColor;
  3145. }
  3146. }
  3147. break;
  3148. default:
  3149. return;
  3150. }
  3151. }
  3152. }
  3153. };
  3154. skeleton.updateWorldTransform = function () {
  3155. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3156. this._nativeSkeleton.updateWorldTransform();
  3157. }
  3158. };
  3159. skeleton.setToSetupPose = function () {
  3160. if (this._nativeSkeleton) {
  3161. this._nativeSkeleton.setToSetupPose();
  3162. }
  3163. };
  3164. skeleton.setBonesToSetupPose = function () {
  3165. if (this._nativeSkeleton) {
  3166. this._nativeSkeleton.setBonesToSetupPose();
  3167. }
  3168. };
  3169. skeleton.setSlotsToSetupPose = function () {
  3170. if (this._nativeSkeleton) {
  3171. this._nativeSkeleton.setSlotsToSetupPose();
  3172. }
  3173. };
  3174. skeleton.setSlotsRange = function (startSlotIndex, endSlotIndex) {
  3175. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3176. this._nativeSkeleton.setSlotsRange(startSlotIndex, endSlotIndex);
  3177. }
  3178. };
  3179. skeleton.updateAnimationCache = function (animName) {
  3180. if (!this.isAnimationCached()) return;
  3181. if (this._nativeSkeleton) {
  3182. if (animName) {
  3183. this._nativeSkeleton.updateAnimationCache(animName);
  3184. } else {
  3185. this._nativeSkeleton.updateAllAnimationCache();
  3186. }
  3187. }
  3188. };
  3189. skeleton.invalidAnimationCache = function () {
  3190. if (!this.isAnimationCached()) return;
  3191. if (this._nativeSkeleton) {
  3192. this._nativeSkeleton.updateAllAnimationCache();
  3193. }
  3194. };
  3195. skeleton.findBone = function (boneName) {
  3196. if (this._nativeSkeleton) return this._nativeSkeleton.findBone(boneName);
  3197. return null;
  3198. };
  3199. skeleton.findSlot = function (slotName) {
  3200. if (this._nativeSkeleton) return this._nativeSkeleton.findSlot(slotName);
  3201. return null;
  3202. };
  3203. skeleton.setSkin = function (skinName) {
  3204. if (this._nativeSkeleton) return this._nativeSkeleton.setSkin(skinName);
  3205. return null;
  3206. };
  3207. skeleton.getAttachment = function (slotName, attachmentName) {
  3208. if (this._nativeSkeleton) return this._nativeSkeleton.getAttachment(slotName, attachmentName);
  3209. return null;
  3210. };
  3211. skeleton.setAttachment = function (slotName, attachmentName) {
  3212. this._nativeSkeleton && this._nativeSkeleton.setAttachment(slotName, attachmentName);
  3213. };
  3214. skeleton.getTextureAtlas = function (regionAttachment) {
  3215. cc.warn("sp.Skeleton getTextureAtlas not support in native");
  3216. return null;
  3217. };
  3218. skeleton.setMix = function (fromAnimation, toAnimation, duration) {
  3219. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3220. this._nativeSkeleton.setMix(fromAnimation, toAnimation, duration);
  3221. }
  3222. };
  3223. skeleton.setAnimation = function (trackIndex, name, loop) {
  3224. if (this._nativeSkeleton) {
  3225. if (this.isAnimationCached()) {
  3226. return this._nativeSkeleton.setAnimation(name, loop);
  3227. } else {
  3228. return this._nativeSkeleton.setAnimation(trackIndex, name, loop);
  3229. }
  3230. }
  3231. return null;
  3232. };
  3233. skeleton.addAnimation = function (trackIndex, name, loop, delay) {
  3234. if (this._nativeSkeleton) {
  3235. delay = delay || 0;
  3236. if (this.isAnimationCached()) {
  3237. return this._nativeSkeleton.addAnimation(name, loop, delay);
  3238. } else {
  3239. return this._nativeSkeleton.addAnimation(trackIndex, name, loop, delay);
  3240. }
  3241. }
  3242. return null;
  3243. };
  3244. skeleton.findAnimation = function (name) {
  3245. if (this._nativeSkeleton) return this._nativeSkeleton.findAnimation(name);
  3246. return null;
  3247. };
  3248. skeleton.getCurrent = function (trackIndex) {
  3249. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3250. return this._nativeSkeleton.getCurrent(trackIndex);
  3251. }
  3252. return null;
  3253. };
  3254. skeleton.clearTracks = function () {
  3255. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3256. this._nativeSkeleton.clearTracks();
  3257. }
  3258. };
  3259. skeleton.clearTrack = function (trackIndex) {
  3260. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3261. this._nativeSkeleton.clearTrack(trackIndex);
  3262. }
  3263. };
  3264. skeleton.setStartListener = function (listener) {
  3265. this._startListener = listener;
  3266. if (this._nativeSkeleton) {
  3267. if (this.isAnimationCached()) {
  3268. this._nativeSkeleton.setStartListener(function (animationName) {
  3269. var self = this._comp;
  3270. self._startEntry.animation.name = animationName;
  3271. self._startListener && self._startListener(self._startEntry);
  3272. });
  3273. } else {
  3274. this._nativeSkeleton.setStartListener(listener);
  3275. }
  3276. }
  3277. };
  3278. skeleton.setInterruptListener = function (listener) {
  3279. this._interruptListener = listener;
  3280. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3281. this._nativeSkeleton.setInterruptListener(listener);
  3282. }
  3283. };
  3284. skeleton.setEndListener = function (listener) {
  3285. this._endListener = listener;
  3286. if (this._nativeSkeleton) {
  3287. if (this.isAnimationCached()) {
  3288. this._nativeSkeleton.setEndListener(function (animationName) {
  3289. var self = this._comp;
  3290. self._endEntry.animation.name = animationName;
  3291. self._endListener && self._endListener(self._endEntry);
  3292. });
  3293. } else {
  3294. this._nativeSkeleton.setEndListener(listener);
  3295. }
  3296. }
  3297. };
  3298. skeleton.setDisposeListener = function (listener) {
  3299. this._disposeListener = listener;
  3300. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3301. this._nativeSkeleton.setDisposeListener(listener);
  3302. }
  3303. };
  3304. skeleton.setCompleteListener = function (listener) {
  3305. this._completeListener = listener;
  3306. if (this._nativeSkeleton) {
  3307. if (this.isAnimationCached()) {
  3308. this._nativeSkeleton.setCompleteListener(function (animationName) {
  3309. var self = this._comp;
  3310. self._endEntry.animation.name = animationName;
  3311. self._completeListener && self._completeListener(self._endEntry);
  3312. });
  3313. } else {
  3314. this._nativeSkeleton.setCompleteListener(listener);
  3315. }
  3316. }
  3317. };
  3318. skeleton.setEventListener = function (listener) {
  3319. this._eventListener = listener;
  3320. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3321. this._nativeSkeleton.setEventListener(listener);
  3322. }
  3323. };
  3324. skeleton.setTrackStartListener = function (entry, listener) {
  3325. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3326. this._nativeSkeleton.setTrackStartListener(entry, listener);
  3327. }
  3328. };
  3329. skeleton.setTrackInterruptListener = function (entry, listener) {
  3330. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3331. this._nativeSkeleton.setTrackInterruptListener(entry, listener);
  3332. }
  3333. };
  3334. skeleton.setTrackEndListener = function (entry, listener) {
  3335. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3336. this._nativeSkeleton.setTrackEndListener(entry, listener);
  3337. }
  3338. };
  3339. skeleton.setTrackDisposeListener = function (entry, listener) {
  3340. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3341. this._nativeSkeleton.setTrackDisposeListener(entry, listener);
  3342. }
  3343. };
  3344. skeleton.setTrackCompleteListener = function (entry, listener) {
  3345. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3346. this._nativeSkeleton.setTrackCompleteListener(entry, listener);
  3347. }
  3348. };
  3349. skeleton.setTrackEventListener = function (entry, listener) {
  3350. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3351. this._nativeSkeleton.setTrackEventListener(entry, listener);
  3352. }
  3353. };
  3354. skeleton.getState = function () {
  3355. if (this._nativeSkeleton && !this.isAnimationCached()) {
  3356. return this._nativeSkeleton.getState();
  3357. }
  3358. };
  3359. skeleton._ensureListener = function () {
  3360. cc.warn("sp.Skeleton _ensureListener not need in native");
  3361. };
  3362. skeleton._updateSkeletonData = function () {
  3363. if (this.skeletonData) {
  3364. this.skeletonData.init();
  3365. this.setSkeletonData(this.skeletonData);
  3366. this.attachUtil.init(this);
  3367. this.attachUtil._associateAttachedNode();
  3368. this._preCacheMode = this._cacheMode;
  3369. this.defaultSkin && this._nativeSkeleton.setSkin(this.defaultSkin);
  3370. this.animation = this.defaultAnimation;
  3371. } else {
  3372. if (this._nativeSkeleton) {
  3373. this._nativeSkeleton.stopSchedule();
  3374. this._nativeSkeleton._comp = null;
  3375. this._nativeSkeleton = null;
  3376. }
  3377. }
  3378. };
  3379. var _onDestroy = skeleton.onDestroy;
  3380. skeleton.onDestroy = function () {
  3381. _onDestroy.call(this);
  3382. if (this._nativeSkeleton) {
  3383. this._nativeSkeleton.stopSchedule();
  3384. this._nativeSkeleton._comp = null;
  3385. this._nativeSkeleton = null;
  3386. }
  3387. this._stateData = null;
  3388. this._materialCache = null;
  3389. }; ////////////////////////////////////////////////////////////
  3390. // adapt attach util
  3391. ////////////////////////////////////////////////////////////
  3392. var attachUtilProto = sp.AttachUtil.prototype;
  3393. var _attachUtilInit = attachUtilProto.init;
  3394. attachUtilProto.init = function (skeletonComp) {
  3395. _attachUtilInit.call(this, skeletonComp);
  3396. this._nativeSkeleton = skeletonComp._nativeSkeleton;
  3397. this._attachUtilNative = null;
  3398. };
  3399. var _generateAllAttachedNodes = attachUtilProto.generateAllAttachedNodes;
  3400. attachUtilProto.generateAllAttachedNodes = function () {
  3401. var res = _generateAllAttachedNodes.call(this);
  3402. this._associateAttachedNode();
  3403. return res;
  3404. };
  3405. var _generateAttachedNodes = attachUtilProto.generateAttachedNodes;
  3406. attachUtilProto.generateAttachedNodes = function (boneName) {
  3407. var res = _generateAttachedNodes.call(this, boneName);
  3408. this._associateAttachedNode();
  3409. return res;
  3410. };
  3411. var _associateAttachedNode = attachUtilProto._associateAttachedNode;
  3412. attachUtilProto._associateAttachedNode = function () {
  3413. if (!this._inited) return;
  3414. var rootNode = this._skeletonNode.getChildByName('ATTACHED_NODE_TREE');
  3415. if (!rootNode || !rootNode.isValid) return; // associate js
  3416. _associateAttachedNode.call(this); // associate native
  3417. if (!this._attachUtilNative) {
  3418. if (this._skeletonComp.isAnimationCached()) {
  3419. this._attachUtilNative = new spine.CacheModeAttachUtil();
  3420. } else {
  3421. this._attachUtilNative = new spine.RealTimeAttachUtil();
  3422. }
  3423. this._nativeSkeleton.setAttachUtil(this._attachUtilNative);
  3424. }
  3425. this._attachUtilNative.associateAttachedNode(this._skeleton, this._skeletonNode._proxy);
  3426. };
  3427. })();
  3428. },{}],39:[function(require,module,exports){
  3429. /****************************************************************************
  3430. Copyright (c) 2013-2016 Chukong Technologies Inc.
  3431. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  3432. http://www.cocos.com
  3433. Permission is hereby granted, free of charge, to any person obtaining a copy
  3434. of this software and associated engine source code (the "Software"), a limited,
  3435. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  3436. to use Cocos Creator solely to develop games on your target platforms. You shall
  3437. not use Cocos Creator software for developing other software or tools that's
  3438. used for developing games. You are not granted to publish, distribute,
  3439. sublicense, and/or sell copies of Cocos Creator.
  3440. The software or tools in this License Agreement are licensed, not sold.
  3441. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  3442. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3443. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3444. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3445. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3446. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3447. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3448. THE SOFTWARE.
  3449. ****************************************************************************/
  3450. 'use strict';
  3451. var sys = cc.sys;
  3452. sys.getNetworkType = jsb.Device.getNetworkType;
  3453. sys.getBatteryLevel = jsb.Device.getBatteryLevel;
  3454. sys.garbageCollect = jsb.garbageCollect;
  3455. sys.restartVM = __restartVM;
  3456. sys.isObjectValid = __isObjectValid;
  3457. sys.getSafeAreaRect = function () {
  3458. // x(top), y(left), z(bottom), w(right)
  3459. var edge = jsb.Device.getSafeAreaEdge();
  3460. var screenSize = cc.view.getFrameSize(); // Get leftBottom and rightTop point in UI coordinates
  3461. var leftBottom = new cc.Vec2(edge.y, screenSize.height - edge.z);
  3462. var rightTop = new cc.Vec2(screenSize.width - edge.w, edge.x); // Returns the real location in view.
  3463. var relatedPos = {
  3464. left: 0,
  3465. top: 0,
  3466. width: screenSize.width,
  3467. height: screenSize.height
  3468. };
  3469. cc.view.convertToLocationInView(leftBottom.x, leftBottom.y, relatedPos, leftBottom);
  3470. cc.view.convertToLocationInView(rightTop.x, rightTop.y, relatedPos, rightTop); // convert view point to design resolution size
  3471. cc.view._convertPointWithScale(leftBottom);
  3472. cc.view._convertPointWithScale(rightTop);
  3473. return cc.rect(leftBottom.x, leftBottom.y, rightTop.x - leftBottom.x, rightTop.y - leftBottom.y);
  3474. };
  3475. },{}],40:[function(require,module,exports){
  3476. "use strict";
  3477. /****************************************************************************
  3478. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  3479. https://www.cocos.com/
  3480. Permission is hereby granted, free of charge, to any person obtaining a copy
  3481. of this software and associated engine source code (the "Software"), a limited,
  3482. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  3483. to use Cocos Creator solely to develop games on your target platforms. You shall
  3484. not use Cocos Creator software for developing other software or tools that's
  3485. used for developing games. You are not granted to publish, distribute,
  3486. sublicense, and/or sell copies of Cocos Creator.
  3487. The software or tools in this License Agreement are licensed, not sold.
  3488. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  3489. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3490. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3491. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3492. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3493. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3494. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3495. THE SOFTWARE.
  3496. ****************************************************************************/
  3497. (function () {
  3498. if (!cc.TiledMap) return;
  3499. var RenderFlow = cc.RenderFlow; // tiled layer
  3500. var TiledLayer = cc.TiledLayer.prototype;
  3501. var _addUserNode = TiledLayer.addUserNode;
  3502. TiledLayer.addUserNode = function (node) {
  3503. var result = _addUserNode.call(this, node);
  3504. if (result) {
  3505. var proxy = node._proxy;
  3506. proxy && proxy.enableVisit(false);
  3507. }
  3508. };
  3509. var _removeUserNode = TiledLayer.removeUserNode;
  3510. TiledLayer.removeUserNode = function (node) {
  3511. var result = _removeUserNode.call(this, node);
  3512. if (result) {
  3513. var proxy = node._proxy;
  3514. proxy && proxy.enableVisit(true);
  3515. }
  3516. }; // override _activateMaterial to upload hash value to native
  3517. var _activateMaterial = TiledLayer._activateMaterial;
  3518. TiledLayer._activateMaterial = function () {
  3519. _activateMaterial.call(this);
  3520. var materials = this._materials;
  3521. for (var i = 0; i < materials.length; i++) {
  3522. var m = materials[i];
  3523. if (m) m.getHash();
  3524. }
  3525. }; // tiledmap buffer
  3526. var TiledMapBuffer = cc.TiledMapBuffer.prototype;
  3527. TiledMapBuffer._updateOffset = function () {
  3528. var offsetInfo = this._offsetInfo;
  3529. offsetInfo.vertexOffset = this.vertexOffset;
  3530. offsetInfo.indiceOffset = this.indiceOffset;
  3531. offsetInfo.byteOffset = this.byteOffset;
  3532. }; // tiledmap render data list
  3533. var TiledMapRenderDataList = cc.TiledMapRenderDataList.prototype;
  3534. TiledMapRenderDataList._pushRenderData = function () {
  3535. var renderData = {};
  3536. renderData.ia = {};
  3537. renderData.nodesRenderList = [];
  3538. this._dataList.push(renderData);
  3539. };
  3540. TiledMapRenderDataList.reset = function () {
  3541. this._offset = 0;
  3542. var assembler = this._nativeAssembler;
  3543. assembler._effect.length = 0;
  3544. assembler.reset();
  3545. };
  3546. TiledMapRenderDataList.setNativeAssembler = function (assembler) {
  3547. this._nativeAssembler = assembler;
  3548. };
  3549. TiledMapRenderDataList.popRenderData = function (buffer) {
  3550. if (this._offset >= this._dataList.length) {
  3551. this._pushRenderData();
  3552. }
  3553. var renderData = this._dataList[this._offset];
  3554. renderData.nodesRenderList.length = 0;
  3555. this._nativeAssembler.clearNodes(this._offset);
  3556. var ia = renderData.ia;
  3557. ia._meshIndex = buffer.getCurMeshIndex();
  3558. ia._start = buffer.indiceOffset;
  3559. ia._count = 0;
  3560. ia._verticesStart = buffer.vertexOffset;
  3561. ia._index = this._offset;
  3562. this._offset++;
  3563. return renderData;
  3564. };
  3565. TiledMapRenderDataList.pushNodesList = function (renderData, nodesList) {
  3566. var nodesRenderList = renderData.nodesRenderList;
  3567. nodesRenderList.push(nodesList);
  3568. var nativeNodes = [];
  3569. for (var j = 0; j < nodesRenderList.length; j++) {
  3570. var _nodesList = nodesRenderList[j];
  3571. if (!_nodesList) continue;
  3572. for (var idx = 0; idx < _nodesList.length; idx++) {
  3573. var dataComp = _nodesList[idx];
  3574. if (!dataComp) continue;
  3575. nativeNodes.push(dataComp.node._id);
  3576. }
  3577. }
  3578. this._nativeAssembler.updateNodes(renderData.ia._index, nativeNodes);
  3579. };
  3580. var ModelBatcherDelegate = cc.Class({
  3581. ctor: function ctor() {
  3582. this._nativeAssembler = null;
  3583. },
  3584. setNativeAssembler: function setNativeAssembler(assembler) {
  3585. this._nativeAssembler = assembler;
  3586. },
  3587. setBuffer: function setBuffer(buffer) {
  3588. this._buffer = buffer;
  3589. },
  3590. _flushIA: function _flushIA(ia) {
  3591. var iaIndex = ia._index;
  3592. var meshIndex = ia._meshIndex;
  3593. this._nativeAssembler.updateMeshIndex(iaIndex, meshIndex);
  3594. var verticesStart = ia._verticesStart;
  3595. var verticesOffset = this._buffer.vertexOffset;
  3596. var vertexCount = verticesOffset - verticesStart;
  3597. this._nativeAssembler.updateVerticesRange(iaIndex, verticesStart, vertexCount);
  3598. this._nativeAssembler.updateIndicesRange(iaIndex, ia._start, ia._count);
  3599. this._nativeAssembler.updateMaterial(iaIndex, this.material);
  3600. },
  3601. _flush: function _flush() {}
  3602. });
  3603. var TiledMapAssembler = cc.TiledLayer.__assembler__.prototype;
  3604. var _fillBuffers = TiledMapAssembler.fillBuffers;
  3605. cc.js.mixin(TiledMapAssembler, {
  3606. _extendNative: function _extendNative() {
  3607. renderer.TiledMapAssembler.prototype.ctor.call(this);
  3608. },
  3609. // override _updateRenderData function avoid base class cover material
  3610. _updateRenderData: function _updateRenderData() {
  3611. if (!this._renderComp || !this._renderComp.isValid) return;
  3612. this.updateRenderData(this._renderComp);
  3613. },
  3614. updateRenderData: function updateRenderData(comp) {
  3615. if (!comp._modelBatcherDelegate) {
  3616. comp._buffer = new cc.TiledMapBuffer(null, cc.gfx.VertexFormat.XY_UV_Color);
  3617. comp._renderDataList = new cc.TiledMapRenderDataList();
  3618. comp._modelBatcherDelegate = new ModelBatcherDelegate();
  3619. comp._buffer.setNativeAssembler(this);
  3620. comp._renderDataList.setNativeAssembler(this);
  3621. comp._modelBatcherDelegate.setBuffer(comp._buffer);
  3622. comp._modelBatcherDelegate.setNativeAssembler(this);
  3623. }
  3624. _fillBuffers.call(this, comp, comp._modelBatcherDelegate);
  3625. comp.node._renderFlag |= RenderFlow.FLAG_UPDATE_RENDER_DATA;
  3626. }
  3627. }, renderer.TiledMapAssembler.prototype);
  3628. })();
  3629. },{}],41:[function(require,module,exports){
  3630. "use strict";
  3631. var jsbUtils = {
  3632. /****************************************************************************
  3633. Copyright (c) 2011 Gary Court
  3634. http://github.com/garycourt/murmurhash-js
  3635. Permission is hereby granted, free of charge, to any person obtaining a copy
  3636. of this software and associated documentation files (the "Software"), to deal
  3637. in the Software without restriction, including without limitation the rights
  3638. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3639. copies of the Software, and to permit persons to whom the Software is furnished
  3640. to do so, subject to the following conditions:
  3641. The above copyright notice and this permission notice shall be included in all
  3642. copies or substantial portions of the Software.
  3643. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3644. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3645. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3646. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3647. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3648. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3649. ****************************************************************************/
  3650. murmurhash2_32_gc: function murmurhash2_32_gc(str, seed) {
  3651. var l = str.length,
  3652. h = seed ^ l,
  3653. i = 0,
  3654. k;
  3655. while (l >= 4) {
  3656. k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
  3657. k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
  3658. k ^= k >>> 24;
  3659. k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
  3660. h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
  3661. l -= 4;
  3662. ++i;
  3663. }
  3664. switch (l) {
  3665. case 3:
  3666. h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
  3667. case 2:
  3668. h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
  3669. case 1:
  3670. h ^= str.charCodeAt(i) & 0xff;
  3671. h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
  3672. }
  3673. h ^= h >>> 13;
  3674. h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
  3675. h ^= h >>> 15;
  3676. return h >>> 0;
  3677. }
  3678. };
  3679. module.exports = jsbUtils;
  3680. },{}],42:[function(require,module,exports){
  3681. "use strict";
  3682. /****************************************************************************
  3683. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  3684. https://www.cocos.com/
  3685. Permission is hereby granted, free of charge, to any person obtaining a copy
  3686. of this software and associated engine source code (the "Software"), a limited,
  3687. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  3688. to use Cocos Creator solely to develop games on your target platforms. You shall
  3689. not use Cocos Creator software for developing other software or tools that's
  3690. used for developing games. You are not granted to publish, distribute,
  3691. sublicense, and/or sell copies of Cocos Creator.
  3692. The software or tools in this License Agreement are licensed, not sold.
  3693. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  3694. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3695. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3696. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3697. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3698. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3699. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3700. THE SOFTWARE.
  3701. ****************************************************************************/
  3702. (function () {
  3703. if (!(cc && cc.VideoPlayer && cc.VideoPlayer.Impl)) {
  3704. return;
  3705. }
  3706. var vec3 = cc.Vec3;
  3707. var _worldMat = new cc.Mat4();
  3708. var _topLeft = new vec3();
  3709. var _bottomRight = new vec3();
  3710. var _impl = cc.VideoPlayer.Impl;
  3711. var _p = cc.VideoPlayer.Impl.prototype;
  3712. _p._bindEvent = function () {
  3713. var video = this._video,
  3714. self = this;
  3715. if (!video) {
  3716. return;
  3717. } //binding event
  3718. var cbs = this.__eventListeners;
  3719. cbs.loadedmetadata = function () {
  3720. self._loadedmeta = true;
  3721. self._dispatchEvent(_impl.EventType.META_LOADED);
  3722. };
  3723. cbs.ended = function () {
  3724. if (self._video !== video) return;
  3725. self._playing = false;
  3726. self._dispatchEvent(_impl.EventType.COMPLETED);
  3727. };
  3728. cbs.play = function () {
  3729. if (self._video !== video) return;
  3730. self._playing = true;
  3731. self._dispatchEvent(_impl.EventType.PLAYING);
  3732. };
  3733. cbs.pause = function () {
  3734. if (self._ignorePause || self._video !== video) return;
  3735. self._playing = false;
  3736. self._dispatchEvent(_impl.EventType.PAUSED);
  3737. };
  3738. cbs.click = function () {
  3739. self._dispatchEvent(_impl.EventType.CLICKED);
  3740. };
  3741. cbs.stoped = function () {
  3742. self._dispatchEvent(_impl.EventType.STOPPED);
  3743. self._ignorePause = false;
  3744. };
  3745. video.addEventListener("loadedmetadata", cbs.loadedmetadata);
  3746. video.addEventListener("ended", cbs.ended);
  3747. video.addEventListener("play", cbs.play);
  3748. video.addEventListener("pause", cbs.pause);
  3749. video.addEventListener("click", cbs.click);
  3750. video.addEventListener("stoped", cbs.stoped);
  3751. function onCanPlay() {
  3752. if (this._loaded) return;
  3753. this._loaded = true;
  3754. this._dispatchEvent(_impl.EventType.READY_TO_PLAY);
  3755. this._updateVisibility();
  3756. }
  3757. cbs.onCanPlay = onCanPlay.bind(this);
  3758. video.addEventListener('canplay', cbs.onCanPlay);
  3759. video.addEventListener('canplaythrough', cbs.onCanPlay);
  3760. video.addEventListener('suspend', cbs.onCanPlay);
  3761. };
  3762. _p._updateVisibility = function () {
  3763. if (!this._video) return;
  3764. var video = this._video;
  3765. if (this._visible) {
  3766. this._video.setVisible(true);
  3767. } else {
  3768. this._video.setVisible(false);
  3769. video.pause();
  3770. this._playing = false;
  3771. }
  3772. };
  3773. _p._updateSize = function (width, height) {};
  3774. _p.createDomElementIfNeeded = function () {
  3775. if (!jsb.VideoPlayer) {
  3776. cc.warn('VideoPlayer is not supported.');
  3777. return null;
  3778. }
  3779. if (!this._video) {
  3780. this._video = new jsb.VideoPlayer();
  3781. }
  3782. };
  3783. _p.removeDom = function () {
  3784. var video = this._video;
  3785. if (video) {
  3786. video.stop();
  3787. video.setVisible(false);
  3788. var cbs = this.__eventListeners;
  3789. cbs.loadedmetadata = null;
  3790. cbs.ended = null;
  3791. cbs.play = null;
  3792. cbs.pause = null;
  3793. cbs.click = null;
  3794. cbs.onCanPlay = null;
  3795. video.destroy();
  3796. }
  3797. this._video = null;
  3798. this._url = "";
  3799. };
  3800. _p.setURL = function (path) {
  3801. var source, extname;
  3802. if (this._url === path) {
  3803. return;
  3804. }
  3805. this.removeDom();
  3806. this._url = path;
  3807. this.createDomElementIfNeeded();
  3808. this._bindEvent();
  3809. var video = this._video;
  3810. if (!video) {
  3811. return;
  3812. }
  3813. video.setVisible(this._visible);
  3814. this._loaded = false;
  3815. this._played = false;
  3816. this._playing = false;
  3817. this._loadedmeta = false;
  3818. video.setURL(this._url);
  3819. this._forceUpdate = true;
  3820. };
  3821. _p.getURL = function () {
  3822. return this._url;
  3823. };
  3824. _p.play = function () {
  3825. var video = this._video;
  3826. if (!video || !this._visible || this._playing) return;
  3827. video.play();
  3828. this._playing = true;
  3829. };
  3830. _p.setStayOnBottom = function (enabled) {};
  3831. _p.pause = function () {
  3832. var video = this._video;
  3833. if (!this._playing || !video) return;
  3834. video.pause();
  3835. this._playing = false;
  3836. };
  3837. _p.resume = function () {
  3838. var video = this._video;
  3839. if (this._playing || !video) return;
  3840. video.resume();
  3841. this._playing = true;
  3842. };
  3843. _p.stop = function () {
  3844. var video = this._video;
  3845. if (!video || !this._visible) return;
  3846. this._ignorePause = true;
  3847. video.stop();
  3848. this._playing = false;
  3849. };
  3850. _p.setVolume = function (volume) {};
  3851. _p.seekTo = function (time) {
  3852. var video = this._video;
  3853. if (!video) return;
  3854. if (this._loaded) {
  3855. video.seekTo(time);
  3856. } else {
  3857. var cb = function cb() {
  3858. video.seekTo(time);
  3859. };
  3860. video.addEventListener(_impl._polyfill.event, cb);
  3861. }
  3862. if (_impl._polyfill.autoplayAfterOperation && this.isPlaying()) {
  3863. setTimeout(function () {
  3864. video.play();
  3865. }, 20);
  3866. }
  3867. };
  3868. _p.isPlaying = function () {
  3869. return this._playing;
  3870. };
  3871. _p.duration = function () {
  3872. var video = this._video;
  3873. var duration = -1;
  3874. if (!video) return duration;
  3875. duration = video.duration();
  3876. if (duration <= 0) {
  3877. cc.logID(7702);
  3878. }
  3879. return duration;
  3880. };
  3881. _p.currentTime = function () {
  3882. var video = this._video;
  3883. if (!video) return -1;
  3884. return video.currentTime();
  3885. };
  3886. _p.setKeepAspectRatioEnabled = function (isEnabled) {
  3887. if (!this._video) {
  3888. return false;
  3889. }
  3890. return this._video.setKeepAspectRatioEnabled(isEnabled);
  3891. };
  3892. _p.isKeepAspectRatioEnabled = function () {
  3893. if (!this._video) {
  3894. return false;
  3895. }
  3896. return this._video.isKeepAspectRatioEnabled();
  3897. };
  3898. _p.isFullScreenEnabled = function () {
  3899. return this._fullScreenEnabled;
  3900. };
  3901. _p.setEventListener = function (event, callback) {
  3902. this._EventList[event] = callback;
  3903. };
  3904. _p.removeEventListener = function (event) {
  3905. this._EventList[event] = null;
  3906. };
  3907. _p._dispatchEvent = function (event) {
  3908. var callback = this._EventList[event];
  3909. if (callback) callback.call(this, this, this._video.src);
  3910. };
  3911. _p.onPlayEvent = function () {
  3912. var callback = this._EventList[_impl.EventType.PLAYING];
  3913. callback.call(this, this, this._video.src);
  3914. };
  3915. _p.enable = function () {
  3916. var list = _impl.elements;
  3917. if (list.indexOf(this) === -1) list.push(this);
  3918. this.setVisible(true);
  3919. };
  3920. _p.disable = function () {
  3921. var list = _impl.elements;
  3922. var index = list.indexOf(this);
  3923. if (index !== -1) list.splice(index, 1);
  3924. this.setVisible(false);
  3925. };
  3926. _p.destroy = function () {
  3927. this.disable();
  3928. this.removeDom();
  3929. };
  3930. _p.setVisible = function (visible) {
  3931. if (this._visible !== visible) {
  3932. this._visible = !!visible;
  3933. this._updateVisibility();
  3934. }
  3935. };
  3936. _p.setFullScreenEnabled = function (enable) {
  3937. var video = this._video;
  3938. if (!video) {
  3939. return;
  3940. }
  3941. this._fullScreenEnabled = enable;
  3942. video.setFullScreenEnabled(enable);
  3943. };
  3944. _p.updateMatrix = function (node) {
  3945. if (!this._video || !this._visible) return;
  3946. node.getWorldMatrix(_worldMat);
  3947. 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) {
  3948. return;
  3949. } // update matrix cache
  3950. this._m00 = _worldMat.m[0];
  3951. this._m01 = _worldMat.m[1];
  3952. this._m04 = _worldMat.m[4];
  3953. this._m05 = _worldMat.m[5];
  3954. this._m12 = _worldMat.m[12];
  3955. this._m13 = _worldMat.m[13];
  3956. this._w = node._contentSize.width;
  3957. this._h = node._contentSize.height;
  3958. var camera = cc.Camera.findCamera(node)._camera;
  3959. var canvas_width = cc.game.canvas.width;
  3960. var canvas_height = cc.game.canvas.height;
  3961. var ap = node._anchorPoint; // Vectors in node space
  3962. vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0);
  3963. vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); // Convert to world space
  3964. vec3.transformMat4(_topLeft, _topLeft, _worldMat);
  3965. vec3.transformMat4(_bottomRight, _bottomRight, _worldMat); // Convert to Screen space
  3966. camera.worldToScreen(_topLeft, _topLeft, canvas_width, canvas_height);
  3967. camera.worldToScreen(_bottomRight, _bottomRight, canvas_width, canvas_height);
  3968. var finalWidth = _bottomRight.x - _topLeft.x;
  3969. var finalHeight = _topLeft.y - _bottomRight.y;
  3970. this._video.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight);
  3971. };
  3972. _impl.EventType = {
  3973. PLAYING: 0,
  3974. PAUSED: 1,
  3975. STOPPED: 2,
  3976. COMPLETED: 3,
  3977. META_LOADED: 4,
  3978. CLICKED: 5,
  3979. READY_TO_PLAY: 6
  3980. }; // video 队列,所有 vidoe 在 onEnter 的时候都会插入这个队列
  3981. _impl.elements = []; // video 在 game_hide 事件中被自动暂停的队列,用于回复的时候重新开始播放
  3982. _impl.pauseElements = [];
  3983. cc.game.on(cc.game.EVENT_HIDE, function () {
  3984. var list = _impl.elements;
  3985. for (var element, i = 0; i < list.length; i++) {
  3986. element = list[i];
  3987. if (element.isPlaying()) {
  3988. element.pause();
  3989. _impl.pauseElements.push(element);
  3990. }
  3991. }
  3992. });
  3993. cc.game.on(cc.game.EVENT_SHOW, function () {
  3994. var list = _impl.pauseElements;
  3995. var element = list.pop();
  3996. while (element) {
  3997. element.play();
  3998. element = list.pop();
  3999. }
  4000. });
  4001. })();
  4002. },{}],43:[function(require,module,exports){
  4003. "use strict";
  4004. /****************************************************************************
  4005. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  4006. https://www.cocos.com/
  4007. Permission is hereby granted, free of charge, to any person obtaining a copy
  4008. of this software and associated engine source code (the "Software"), a limited,
  4009. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4010. to use Cocos Creator solely to develop games on your target platforms. You shall
  4011. not use Cocos Creator software for developing other software or tools that's
  4012. used for developing games. You are not granted to publish, distribute,
  4013. sublicense, and/or sell copies of Cocos Creator.
  4014. The software or tools in this License Agreement are licensed, not sold.
  4015. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4016. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4017. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4018. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4019. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4020. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4021. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4022. THE SOFTWARE.
  4023. ****************************************************************************/
  4024. (function () {
  4025. if (!(cc && cc.WebView && cc.WebView.Impl)) {
  4026. return;
  4027. }
  4028. var vec3 = cc.Vec3;
  4029. var _worldMat = new cc.Mat4();
  4030. var _topLeft = new vec3();
  4031. var _bottomRight = new vec3();
  4032. cc.WebView.Impl = cc.Class({
  4033. "extends": cc.WebView.Impl,
  4034. ctor: function ctor() {
  4035. // keep webview data
  4036. this.jsCallback = null;
  4037. this.interfaceSchema = null;
  4038. }
  4039. });
  4040. var _impl = cc.WebView.Impl;
  4041. var _p = cc.WebView.Impl.prototype;
  4042. _p._updateVisibility = function () {
  4043. if (!this._iframe) return;
  4044. this._iframe.setVisible(this._visible);
  4045. };
  4046. _p._updateSize = function (w, h) {};
  4047. _p._initEvent = function () {
  4048. var iframe = this._iframe;
  4049. if (iframe) {
  4050. var cbs = this.__eventListeners,
  4051. self = this;
  4052. cbs.load = function () {
  4053. self._dispatchEvent(_impl.EventType.LOADED);
  4054. };
  4055. cbs.error = function () {
  4056. self._dispatchEvent(_impl.EventType.ERROR);
  4057. }; // native event callback
  4058. this._iframe.setOnDidFinishLoading(cbs.load);
  4059. this._iframe.setOnDidFailLoading(cbs.error);
  4060. }
  4061. };
  4062. _p._initExtraSetting = function () {
  4063. this.jsCallback && this.setOnJSCallback(this.jsCallback);
  4064. this.interfaceSchema && this.setJavascriptInterfaceScheme(this.interfaceSchema); // remove obj
  4065. this.jsCallback = null;
  4066. this.interfaceSchema = null;
  4067. };
  4068. _p._setOpacity = function (opacity) {
  4069. var iframe = this._iframe;
  4070. if (iframe && iframe.style) {
  4071. iframe.style.opacity = opacity / 255; // TODO, add impl to Native
  4072. }
  4073. };
  4074. _p.createDomElementIfNeeded = function (w, h) {
  4075. if (!jsb.WebView) {
  4076. cc.warn('WebView only supports mobile platform.');
  4077. return;
  4078. }
  4079. if (!this._iframe) {
  4080. this._iframe = jsb.WebView.create();
  4081. this._initEvent();
  4082. this._initExtraSetting();
  4083. }
  4084. };
  4085. _p.removeDom = function () {
  4086. var iframe = this._iframe;
  4087. if (iframe) {
  4088. var cbs = this.__eventListeners;
  4089. cbs.load = null;
  4090. cbs.error = null;
  4091. iframe.destroy();
  4092. this._iframe = null;
  4093. }
  4094. };
  4095. _p.setOnJSCallback = function (callback) {
  4096. var iframe = this._iframe;
  4097. if (iframe) {
  4098. iframe.setOnJSCallback(callback);
  4099. } else {
  4100. this.jsCallback = callback;
  4101. }
  4102. };
  4103. _p.setJavascriptInterfaceScheme = function (scheme) {
  4104. var iframe = this._iframe;
  4105. if (iframe) {
  4106. iframe.setJavascriptInterfaceScheme(scheme);
  4107. } else {
  4108. this.interfaceSchema = scheme;
  4109. }
  4110. };
  4111. _p.loadData = function (data, MIMEType, encoding, baseURL) {
  4112. var iframe = this._iframe;
  4113. if (iframe) {
  4114. iframe.loadData(data, MIMEType, encoding, baseURL);
  4115. }
  4116. };
  4117. _p.loadHTMLString = function (string, baseURL) {
  4118. var iframe = this._iframe;
  4119. if (iframe) {
  4120. iframe.loadHTMLString(string, baseURL);
  4121. }
  4122. };
  4123. /**
  4124. * Load an URL
  4125. * @param {String} url
  4126. */
  4127. _p.loadURL = function (url) {
  4128. var iframe = this._iframe;
  4129. if (iframe) {
  4130. iframe.src = url;
  4131. iframe.loadURL(url);
  4132. this._dispatchEvent(_impl.EventType.LOADING);
  4133. }
  4134. };
  4135. /**
  4136. * Stop loading
  4137. */
  4138. _p.stopLoading = function () {
  4139. cc.logID(7800);
  4140. };
  4141. /**
  4142. * Reload the WebView
  4143. */
  4144. _p.reload = function () {
  4145. var iframe = this._iframe;
  4146. if (iframe) {
  4147. iframe.reload();
  4148. }
  4149. };
  4150. /**
  4151. * Determine whether to go back
  4152. */
  4153. _p.canGoBack = function () {
  4154. var iframe = this._iframe;
  4155. if (iframe) {
  4156. return iframe.canGoBack();
  4157. }
  4158. };
  4159. /**
  4160. * Determine whether to go forward
  4161. */
  4162. _p.canGoForward = function () {
  4163. var iframe = this._iframe;
  4164. if (iframe) {
  4165. return iframe.canGoForward();
  4166. }
  4167. };
  4168. /**
  4169. * go back
  4170. */
  4171. _p.goBack = function () {
  4172. var iframe = this._iframe;
  4173. if (iframe) {
  4174. return iframe.goBack();
  4175. }
  4176. };
  4177. /**
  4178. * go forward
  4179. */
  4180. _p.goForward = function () {
  4181. var iframe = this._iframe;
  4182. if (iframe) {
  4183. return iframe.goForward();
  4184. }
  4185. };
  4186. /**
  4187. * In the webview execution within a period of js string
  4188. * @param {String} str
  4189. */
  4190. _p.evaluateJS = function (str) {
  4191. var iframe = this._iframe;
  4192. if (iframe) {
  4193. return iframe.evaluateJS(str);
  4194. }
  4195. };
  4196. /**
  4197. * Limited scale
  4198. */
  4199. _p.setScalesPageToFit = function () {
  4200. var iframe = this._iframe;
  4201. if (iframe) {
  4202. return iframe.setScalesPageToFit();
  4203. }
  4204. };
  4205. /**
  4206. * The binding event
  4207. * @param {_impl.EventType} event
  4208. * @param {Function} callback
  4209. */
  4210. _p.setEventListener = function (event, callback) {
  4211. this._EventList[event] = callback;
  4212. };
  4213. /**
  4214. * Delete events
  4215. * @param {_impl.EventType} event
  4216. */
  4217. _p.removeEventListener = function (event) {
  4218. this._EventList[event] = null;
  4219. };
  4220. _p._dispatchEvent = function (event) {
  4221. var callback = this._EventList[event];
  4222. if (callback) callback.call(this, this, this._iframe.src);
  4223. };
  4224. _p._createRenderCmd = function () {
  4225. return new _impl.RenderCmd(this);
  4226. };
  4227. _p.destroy = function () {
  4228. this.removeDom();
  4229. };
  4230. _p.setVisible = function (visible) {
  4231. if (this._visible !== visible) {
  4232. this._visible = !!visible;
  4233. this._updateVisibility();
  4234. }
  4235. };
  4236. _p.updateMatrix = function (node) {
  4237. if (!this._iframe || !this._visible) return;
  4238. node.getWorldMatrix(_worldMat);
  4239. 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) {
  4240. return;
  4241. } // update matrix cache
  4242. this._m00 = _worldMat.m[0];
  4243. this._m01 = _worldMat.m[1];
  4244. this._m04 = _worldMat.m[4];
  4245. this._m05 = _worldMat.m[5];
  4246. this._m12 = _worldMat.m[12];
  4247. this._m13 = _worldMat.m[13];
  4248. this._w = node._contentSize.width;
  4249. this._h = node._contentSize.height;
  4250. var camera = cc.Camera.findCamera(node)._camera;
  4251. var canvas_width = cc.game.canvas.width;
  4252. var canvas_height = cc.game.canvas.height;
  4253. var ap = node._anchorPoint; // Vectors in node space
  4254. vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0);
  4255. vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); // Convert to world space
  4256. vec3.transformMat4(_topLeft, _topLeft, _worldMat);
  4257. vec3.transformMat4(_bottomRight, _bottomRight, _worldMat); // Convert to screen space
  4258. camera.worldToScreen(_topLeft, _topLeft, canvas_width, canvas_height);
  4259. camera.worldToScreen(_bottomRight, _bottomRight, canvas_width, canvas_height);
  4260. var finalWidth = _bottomRight.x - _topLeft.x;
  4261. var finalHeight = _topLeft.y - _bottomRight.y;
  4262. this._iframe.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight);
  4263. };
  4264. })();
  4265. },{}],44:[function(require,module,exports){
  4266. "use strict";
  4267. /****************************************************************************
  4268. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  4269. http://www.cocos.com
  4270. Permission is hereby granted, free of charge, to any person obtaining a copy
  4271. of this software and associated engine source code (the "Software"), a limited,
  4272. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4273. to use Cocos Creator solely to develop games on your target platforms. You shall
  4274. not use Cocos Creator software for developing other software or tools that's
  4275. used for developing games. You are not granted to publish, distribute,
  4276. sublicense, and/or sell copies of Cocos Creator.
  4277. The software or tools in this License Agreement are licensed, not sold.
  4278. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4279. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4280. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4281. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4282. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4283. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4284. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4285. THE SOFTWARE.
  4286. ****************************************************************************/
  4287. var nativeCameraProto = renderer.Camera.prototype;
  4288. var _setNode = nativeCameraProto.setNode;
  4289. cc.js.mixin(nativeCameraProto, {
  4290. setNode: function setNode(node) {
  4291. this._persistentNode = node;
  4292. _setNode.call(this, node);
  4293. }
  4294. });
  4295. },{}],45:[function(require,module,exports){
  4296. "use strict";
  4297. /****************************************************************************
  4298. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  4299. http://www.cocos.com
  4300. Permission is hereby granted, free of charge, to any person obtaining a copy
  4301. of this software and associated engine source code (the "Software"), a limited,
  4302. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4303. to use Cocos Creator solely to develop games on your target platforms. You shall
  4304. not use Cocos Creator software for developing other software or tools that's
  4305. used for developing games. You are not granted to publish, distribute,
  4306. sublicense, and/or sell copies of Cocos Creator.
  4307. The software or tools in this License Agreement are licensed, not sold.
  4308. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4309. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4310. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4311. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4312. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4313. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4314. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4315. THE SOFTWARE.
  4316. ****************************************************************************/
  4317. var nativeLightProto = renderer.Light.prototype;
  4318. var _setNode = nativeLightProto.setNode;
  4319. cc.js.mixin(nativeLightProto, {
  4320. setNode: function setNode(node) {
  4321. this._node = node;
  4322. _setNode.call(this, node);
  4323. }
  4324. });
  4325. },{}],46:[function(require,module,exports){
  4326. "use strict";
  4327. /****************************************************************************
  4328. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  4329. https://www.cocos.com/
  4330. Permission is hereby granted, free of charge, to any person obtaining a copy
  4331. of this software and associated engine source code (the "Software"), a limited,
  4332. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4333. to use Cocos Creator solely to develop games on your target platforms. You shall
  4334. not use Cocos Creator software for developing other software or tools that's
  4335. used for developing games. You are not granted to publish, distribute,
  4336. sublicense, and/or sell copies of Cocos Creator.
  4337. The software or tools in this License Agreement are licensed, not sold.
  4338. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4339. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4340. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4341. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4342. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4343. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4344. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4345. THE SOFTWARE.
  4346. ****************************************************************************/
  4347. (function () {
  4348. if (!cc.MeshBuffer) return;
  4349. var MeshBuffer = cc.MeshBuffer.prototype;
  4350. MeshBuffer.init = function (batcher, vertexFormat) {
  4351. this.byteOffset = 0;
  4352. this.indiceOffset = 0;
  4353. this.vertexOffset = 0;
  4354. this._vertexFormat = vertexFormat;
  4355. this._vertexBytes = this._vertexFormat._bytes;
  4356. this._vDatas = [];
  4357. this._uintVDatas = [];
  4358. this._iDatas = [];
  4359. this._arrOffset = 0;
  4360. this._vData = null;
  4361. this._uintVData = null;
  4362. this._iData = null;
  4363. this._initVDataCount = 256 * vertexFormat._bytes; // actually 256 * 4 * (vertexFormat._bytes / 4)
  4364. this._initIDataCount = 256 * 6;
  4365. this._offsetInfo = {
  4366. byteOffset: 0,
  4367. vertexOffset: 0,
  4368. indiceOffset: 0
  4369. };
  4370. this._renderDataList = new renderer.RenderDataList();
  4371. this._reallocBuffer();
  4372. };
  4373. MeshBuffer.setNativeAssembler = function (assembler) {
  4374. if (assembler !== this._nativeAssembler) {
  4375. this._nativeAssembler = assembler;
  4376. assembler.setRenderDataList(this._renderDataList);
  4377. }
  4378. };
  4379. MeshBuffer._updateVIDatas = function () {
  4380. var offset = this._arrOffset;
  4381. this._vDatas[offset] = this._vData;
  4382. this._uintVDatas[offset] = this._uintVData;
  4383. this._iDatas[offset] = this._iData;
  4384. this._renderDataList.updateMesh(offset, this._vData, this._iData);
  4385. };
  4386. MeshBuffer.getNativeAssembler = function () {
  4387. return this._nativeAssembler;
  4388. };
  4389. MeshBuffer.getCurMeshIndex = function () {
  4390. return this._arrOffset;
  4391. };
  4392. MeshBuffer.uploadData = function () {};
  4393. MeshBuffer.switchBuffer = function () {
  4394. var offset = ++this._arrOffset;
  4395. this.byteOffset = 0;
  4396. this.vertexOffset = 0;
  4397. this.indiceOffset = 0;
  4398. if (offset < this._vDatas.length) {
  4399. this._vData = this._vDatas[offset];
  4400. this._uintVData = this._uintVDatas[offset];
  4401. this._iData = this._iDatas[offset];
  4402. } else {
  4403. this._reallocBuffer();
  4404. }
  4405. };
  4406. MeshBuffer.checkAndSwitchBuffer = function (vertexCount) {
  4407. if (this.vertexOffset + vertexCount > 65535) {
  4408. this.switchBuffer();
  4409. if (!this._nativeAssembler) return;
  4410. this._nativeAssembler.updateIADatas && this._nativeAssembler.updateIADatas(this._arrOffset, this._arrOffset);
  4411. }
  4412. };
  4413. MeshBuffer.used = function (vertexCount, indiceCount) {
  4414. if (!this._nativeAssembler) return;
  4415. this._nativeAssembler.updateVerticesRange(this._arrOffset, 0, vertexCount);
  4416. this._nativeAssembler.updateIndicesRange(this._arrOffset, 0, indiceCount);
  4417. };
  4418. MeshBuffer.request = function (vertexCount, indiceCount) {
  4419. this.requestStatic(vertexCount, indiceCount);
  4420. return this._offsetInfo;
  4421. };
  4422. MeshBuffer._reallocBuffer = function () {
  4423. this._reallocVData(true);
  4424. this._reallocIData(true);
  4425. this._updateVIDatas();
  4426. };
  4427. MeshBuffer._reallocVData = function (copyOldData) {
  4428. var oldVData;
  4429. if (this._vData) {
  4430. oldVData = new Uint8Array(this._vData.buffer);
  4431. }
  4432. this._vData = new Float32Array(this._initVDataCount);
  4433. this._uintVData = new Uint32Array(this._vData.buffer);
  4434. var newData = new Uint8Array(this._uintVData.buffer);
  4435. if (oldVData && copyOldData) {
  4436. for (var i = 0, l = oldVData.length; i < l; i++) {
  4437. newData[i] = oldVData[i];
  4438. }
  4439. }
  4440. };
  4441. MeshBuffer._reallocIData = function (copyOldData) {
  4442. var oldIData = this._iData;
  4443. this._iData = new Uint16Array(this._initIDataCount);
  4444. if (oldIData && copyOldData) {
  4445. var iData = this._iData;
  4446. for (var i = 0, l = oldIData.length; i < l; i++) {
  4447. iData[i] = oldIData[i];
  4448. }
  4449. }
  4450. };
  4451. MeshBuffer.reset = function () {
  4452. this._arrOffset = 0;
  4453. this._vData = this._vDatas[0];
  4454. this._uintVData = this._uintVDatas[0];
  4455. this._iData = this._iDatas[0];
  4456. this.byteOffset = 0;
  4457. this.indiceOffset = 0;
  4458. this.vertexOffset = 0;
  4459. if (!this._nativeAssembler) return;
  4460. for (var i = 0, len = this._vDatas.length; i < len; i++) {
  4461. this._nativeAssembler.updateVerticesRange(i, 0, 0);
  4462. this._nativeAssembler.updateIndicesRange(i, 0, 0);
  4463. }
  4464. };
  4465. MeshBuffer.destroy = function () {
  4466. this.reset();
  4467. };
  4468. })();
  4469. },{}],47:[function(require,module,exports){
  4470. "use strict";
  4471. /****************************************************************************
  4472. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  4473. http://www.cocos.com
  4474. Permission is hereby granted, free of charge, to any person obtaining a copy
  4475. of this software and associated engine source code (the "Software"), a limited,
  4476. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4477. to use Cocos Creator solely to develop games on your target platforms. You shall
  4478. not use Cocos Creator software for developing other software or tools that's
  4479. used for developing games. You are not granted to publish, distribute,
  4480. sublicense, and/or sell copies of Cocos Creator.
  4481. The software or tools in this License Agreement are licensed, not sold.
  4482. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4483. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4484. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4485. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4486. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4487. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4488. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4489. THE SOFTWARE.
  4490. ****************************************************************************/
  4491. var RenderFlow = cc.RenderFlow;
  4492. cc.js.mixin(renderer.NodeProxy.prototype, {
  4493. _ctor: function _ctor() {
  4494. this._owner = null;
  4495. },
  4496. init: function init(owner) {
  4497. this._owner = owner;
  4498. var spaceInfo = owner._spaceInfo;
  4499. this._owner._dirtyPtr = spaceInfo.dirty;
  4500. this._dirtyPtr = spaceInfo.dirty;
  4501. this._parentPtr = spaceInfo.parent;
  4502. this._zOrderPtr = spaceInfo.zOrder;
  4503. this._cullingMaskPtr = spaceInfo.cullingMask;
  4504. this._opacityPtr = spaceInfo.opacity;
  4505. this._is3DPtr = spaceInfo.is3D;
  4506. this._skewPtr = spaceInfo.skew;
  4507. this._isVisitingTraversal = false;
  4508. owner._proxy = this;
  4509. this.updateOpacity();
  4510. this.update3DNode();
  4511. this.updateZOrder();
  4512. this.updateCullingMask();
  4513. this.updateSkew();
  4514. owner.on(cc.Node.EventType.SIBLING_ORDER_CHANGED, this.updateZOrder, this);
  4515. },
  4516. initNative: function initNative() {
  4517. this.setName(this._owner._name);
  4518. this.updateParent();
  4519. this.updateOpacity();
  4520. this.update3DNode();
  4521. this.updateZOrder();
  4522. this.updateSkew();
  4523. this.updateCullingMask();
  4524. },
  4525. destroy: function destroy() {
  4526. this.destroyImmediately();
  4527. this._owner.off(cc.Node.EventType.SIBLING_ORDER_CHANGED, this.updateZOrder, this);
  4528. this._owner._proxy = null;
  4529. this._owner = null;
  4530. },
  4531. updateParent: function updateParent() {
  4532. var parent = this._owner._parent;
  4533. if (parent) {
  4534. var parentSpaceInfo = parent._spaceInfo;
  4535. this._parentPtr[0] = parentSpaceInfo.unitID;
  4536. this._parentPtr[1] = parentSpaceInfo.index;
  4537. var parentDirtyPtr = parentSpaceInfo.dirty;
  4538. parentDirtyPtr[0] |= RenderFlow.FLAG_REORDER_CHILDREN;
  4539. this._dirtyPtr[0] |= RenderFlow.FLAG_OPACITY;
  4540. } else {
  4541. this._parentPtr[0] = 0xffffffff;
  4542. this._parentPtr[1] = 0xffffffff;
  4543. }
  4544. this.notifyUpdateParent();
  4545. },
  4546. updateZOrder: function updateZOrder() {
  4547. this._zOrderPtr[0] = this._owner._localZOrder;
  4548. var parent = this._owner._parent;
  4549. if (parent && parent._proxy) {
  4550. parent._proxy._dirtyPtr[0] |= RenderFlow.FLAG_REORDER_CHILDREN;
  4551. }
  4552. },
  4553. updateCullingMask: function updateCullingMask() {
  4554. this._cullingMaskPtr[0] = this._owner._cullingMask;
  4555. },
  4556. updateOpacity: function updateOpacity() {
  4557. this._opacityPtr[0] = this._owner.opacity;
  4558. this._dirtyPtr[0] |= RenderFlow.FLAG_OPACITY;
  4559. },
  4560. update3DNode: function update3DNode() {
  4561. this._is3DPtr[0] = this._owner.is3DNode ? 0x1 : 0x0;
  4562. this._dirtyPtr[0] |= RenderFlow.FLAG_LOCAL_TRANSFORM;
  4563. },
  4564. updateSkew: function updateSkew() {
  4565. var skewPtr = this._skewPtr;
  4566. var owner = this._owner;
  4567. var skx = owner._skewX;
  4568. var sky = owner._skewY;
  4569. skewPtr[0] = skx;
  4570. skewPtr[1] = sky;
  4571. if (!this._isVisitingTraversal && (skx !== 0 || sky !== 0)) {
  4572. this.switchTraverseToVisit();
  4573. this._isVisitingTraversal = true;
  4574. }
  4575. }
  4576. });
  4577. },{}],48:[function(require,module,exports){
  4578. /****************************************************************************
  4579. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  4580. http://www.cocos.com
  4581. Permission is hereby granted, free of charge, to any person obtaining a copy
  4582. of this software and associated engine source code (the "Software"), a limited,
  4583. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4584. to use Cocos Creator solely to develop games on your target platforms. You shall
  4585. not use Cocos Creator software for developing other software or tools that's
  4586. used for developing games. You are not granted to publish, distribute,
  4587. sublicense, and/or sell copies of Cocos Creator.
  4588. The software or tools in this License Agreement are licensed, not sold.
  4589. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4590. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4591. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4592. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4593. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4594. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4595. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4596. THE SOFTWARE.
  4597. ****************************************************************************/
  4598. 'use strict';
  4599. var RenderFlow = cc.RenderFlow;
  4600. var LOCAL_TRANSFORM = RenderFlow.FLAG_LOCAL_TRANSFORM;
  4601. var COLOR = RenderFlow.FLAG_COLOR;
  4602. var UPDATE_RENDER_DATA = RenderFlow.FLAG_UPDATE_RENDER_DATA;
  4603. var POSITION_ON = 1 << 0;
  4604. cc.Node.prototype.setLocalDirty = function (flag) {
  4605. this._localMatDirty |= flag;
  4606. this._worldMatDirty = true;
  4607. this._dirtyPtr[0] |= RenderFlow.FLAG_TRANSFORM;
  4608. };
  4609. cc.js.getset(cc.Node.prototype, "_renderFlag", function () {
  4610. return this._dirtyPtr[0];
  4611. }, function (flag) {
  4612. this._dirtyPtr[0] = flag;
  4613. if (flag & UPDATE_RENDER_DATA || flag & COLOR) {
  4614. cc.RenderFlow.register(this);
  4615. }
  4616. });
  4617. cc.PrivateNode.prototype._posDirty = function (sendEvent) {
  4618. var parent = this.parent;
  4619. if (parent) {
  4620. // Position correction for transform calculation
  4621. this._trs[0] = this._originPos.x - (parent._anchorPoint.x - 0.5) * parent._contentSize.width;
  4622. this._trs[1] = this._originPos.y - (parent._anchorPoint.y - 0.5) * parent._contentSize.height;
  4623. }
  4624. this.setLocalDirty(cc.Node._LocalDirtyFlag.POSITION);
  4625. if (sendEvent === true && this._eventMask & POSITION_ON) {
  4626. this.emit(cc.Node.EventType.POSITION_CHANGED);
  4627. }
  4628. };
  4629. },{}],49:[function(require,module,exports){
  4630. "use strict";
  4631. /****************************************************************************
  4632. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  4633. https://www.cocos.com/
  4634. Permission is hereby granted, free of charge, to any person obtaining a copy
  4635. of this software and associated engine source code (the "Software"), a limited,
  4636. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4637. to use Cocos Creator solely to develop games on your target platforms. You shall
  4638. not use Cocos Creator software for developing other software or tools that's
  4639. used for developing games. You are not granted to publish, distribute,
  4640. sublicense, and/or sell copies of Cocos Creator.
  4641. The software or tools in this License Agreement are licensed, not sold.
  4642. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4643. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4644. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4645. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4646. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4647. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4648. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4649. THE SOFTWARE.
  4650. ****************************************************************************/
  4651. (function () {
  4652. if (!cc.QuadBuffer) return;
  4653. var QuadBuffer = cc.QuadBuffer.prototype;
  4654. QuadBuffer._fillQuadBuffer = function () {
  4655. var count = this._initIDataCount / 6;
  4656. var buffer = this._iData;
  4657. for (var i = 0, idx = 0; i < count; i++) {
  4658. var vertextID = i * 4;
  4659. buffer[idx++] = vertextID;
  4660. buffer[idx++] = vertextID + 1;
  4661. buffer[idx++] = vertextID + 2;
  4662. buffer[idx++] = vertextID + 1;
  4663. buffer[idx++] = vertextID + 3;
  4664. buffer[idx++] = vertextID + 2;
  4665. }
  4666. };
  4667. QuadBuffer._reallocBuffer = function () {
  4668. this._reallocVData(true);
  4669. this._reallocIData();
  4670. this._fillQuadBuffer();
  4671. this._updateVIDatas();
  4672. };
  4673. QuadBuffer.uploadData = function () {};
  4674. QuadBuffer.switchBuffer = function () {
  4675. cc.MeshBuffer.prototype.switchBuffer.call(this);
  4676. };
  4677. })();
  4678. },{}],50:[function(require,module,exports){
  4679. "use strict";
  4680. var proto = cc.RenderData.prototype;
  4681. cc.RenderData.prototype.init = function (assembler) {
  4682. this._renderDataList = new renderer.RenderDataList();
  4683. assembler.setRenderDataList(this._renderDataList);
  4684. this._nativeAssembler = assembler;
  4685. };
  4686. var originClear = proto.clear;
  4687. proto.clear = function () {
  4688. originClear.call(this);
  4689. this._renderDataList.clear();
  4690. };
  4691. var originUpdateMesh = proto.updateMesh;
  4692. proto.updateMesh = function (meshIndex, vertices, indices) {
  4693. originUpdateMesh.call(this, meshIndex, vertices, indices);
  4694. if (vertices && indices) {
  4695. this._renderDataList.updateMesh(meshIndex, vertices, indices);
  4696. }
  4697. };
  4698. proto.updateMeshRange = function (verticesCount, indicesCount) {
  4699. this._nativeAssembler.updateVerticesRange(0, 0, verticesCount);
  4700. this._nativeAssembler.updateIndicesRange(0, 0, indicesCount);
  4701. };
  4702. },{}],51:[function(require,module,exports){
  4703. "use strict";
  4704. /****************************************************************************
  4705. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  4706. http://www.cocos.com
  4707. Permission is hereby granted, free of charge, to any person obtaining a copy
  4708. of this software and associated engine source code (the "Software"), a limited,
  4709. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  4710. to use Cocos Creator solely to develop games on your target platforms. You shall
  4711. not use Cocos Creator software for developing other software or tools that's
  4712. used for developing games. You are not granted to publish, distribute,
  4713. sublicense, and/or sell copies of Cocos Creator.
  4714. The software or tools in this License Agreement are licensed, not sold.
  4715. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  4716. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4717. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4718. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4719. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4720. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4721. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4722. THE SOFTWARE.
  4723. ****************************************************************************/
  4724. var RenderFlow = cc.RenderFlow;
  4725. RenderFlow.FLAG_REORDER_CHILDREN = 1 << 29;
  4726. RenderFlow.FLAG_WORLD_TRANSFORM_CHANGED = 1 << 30;
  4727. RenderFlow.FLAG_OPACITY_CHANGED = 1 << 31;
  4728. var _dirtyTargets = [];
  4729. var _dirtyWaiting = [];
  4730. var _rendering = false;
  4731. var director = cc.director;
  4732. RenderFlow.render = function (scene) {
  4733. _rendering = true;
  4734. RenderFlow.validateRenderers();
  4735. for (var i = 0, l = _dirtyTargets.length; i < l; i++) {
  4736. var node = _dirtyTargets[i];
  4737. node._inJsbDirtyList = false;
  4738. var comp = node._renderComponent;
  4739. if (!comp) continue;
  4740. var assembler = comp._assembler;
  4741. if (!assembler) continue;
  4742. var flag = node._dirtyPtr[0];
  4743. if (flag & RenderFlow.FLAG_UPDATE_RENDER_DATA) {
  4744. node._dirtyPtr[0] &= ~RenderFlow.FLAG_UPDATE_RENDER_DATA;
  4745. assembler._updateRenderData && assembler._updateRenderData();
  4746. }
  4747. if (flag & RenderFlow.FLAG_COLOR) {
  4748. node._dirtyPtr[0] &= ~RenderFlow.FLAG_COLOR;
  4749. comp._updateColor && comp._updateColor();
  4750. }
  4751. }
  4752. _dirtyTargets.length = 0;
  4753. this._nativeFlow.render(scene._proxy, director._deltaTime);
  4754. _dirtyTargets = _dirtyWaiting.slice(0);
  4755. _dirtyWaiting.length = 0;
  4756. _rendering = false;
  4757. };
  4758. RenderFlow.init = function (nativeFlow) {
  4759. cc.EventTarget.call(this);
  4760. this._nativeFlow = nativeFlow;
  4761. };
  4762. RenderFlow.register = function (target) {
  4763. if (target._inJsbDirtyList) return;
  4764. if (_rendering) {
  4765. _dirtyWaiting.push(target);
  4766. } else {
  4767. _dirtyTargets.push(target);
  4768. }
  4769. target._inJsbDirtyList = true;
  4770. };
  4771. },{}]},{},[26]);