creator.d.ts 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725
  1. /** !#en
  2. The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.
  3. !#zh
  4. Cocos 引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。 */
  5. declare namespace cc {
  6. /** The current version of Cocos2d being used.<br/>
  7. Please DO NOT remove this String, it is an important flag for bug tracking.<br/>
  8. If you post a bug to forum, please attach this flag. */
  9. export var ENGINE_VERSION: string;
  10. /** !#en This is a Easing instance.
  11. !#zh 这是一个 Easing 类实例。 */
  12. export var easing: Easing;
  13. /**
  14. !#en
  15. Creates the speed action which changes the speed of an action, making it take longer (speed > 1)
  16. or less (speed < 1) time. <br/>
  17. Useful to simulate 'slow motion' or 'fast forward' effect.
  18. !#zh 修改目标动作的速率。
  19. @param action action
  20. @param speed speed
  21. @example
  22. ```js
  23. // change the target action speed;
  24. var action = cc.scaleTo(0.2, 1, 0.6);
  25. var newAction = cc.speed(action, 0.5);
  26. ```
  27. */
  28. export function speed(action: ActionInterval, speed: number): Action;
  29. /**
  30. !#en Create a follow action which makes its target follows another node.
  31. !#zh 追踪目标节点的位置。
  32. @param followedNode followedNode
  33. @param rect rect
  34. @example
  35. ```js
  36. // example
  37. // creates the action with a set boundary
  38. var followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight));
  39. node.runAction(followAction);
  40. // creates the action with no boundary set
  41. var followAction = cc.follow(targetNode);
  42. node.runAction(followAction);
  43. ```
  44. */
  45. export function follow(followedNode: Node, rect: Rect): Action;
  46. /**
  47. Points setter
  48. @param points points
  49. */
  50. export function setPoints(points: any[]): void;
  51. /**
  52. !#en Creates an action with a Cardinal Spline array of points and tension.
  53. !#zh 按基数样条曲线轨迹移动到目标位置。
  54. @param duration duration
  55. @param points array of control points
  56. @param tension tension
  57. @example
  58. ```js
  59. //create a cc.CardinalSplineTo
  60. var action1 = cc.cardinalSplineTo(3, array, 0);
  61. ```
  62. */
  63. export function cardinalSplineTo(duration: number, points: any[], tension: number): ActionInterval;
  64. /**
  65. update position of target
  66. @param newPos newPos
  67. */
  68. export function updatePosition(newPos: Vec2): void;
  69. /**
  70. !#en Creates an action with a Cardinal Spline array of points and tension.
  71. !#zh 按基数样条曲线轨迹移动指定的距离。
  72. @param duration duration
  73. @param points points
  74. @param tension tension
  75. */
  76. export function cardinalSplineBy(duration: number, points: any[], tension: number): ActionInterval;
  77. /**
  78. !#en Creates an action with a Cardinal Spline array of points and tension.
  79. !#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。
  80. @param dt dt
  81. @param points points
  82. @example
  83. ```js
  84. var action1 = cc.catmullRomTo(3, array);
  85. ```
  86. */
  87. export function catmullRomTo(dt: number, points: any[]): ActionInterval;
  88. /**
  89. !#en Creates an action with a Cardinal Spline array of points and tension.
  90. !#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。
  91. @param dt dt
  92. @param points points
  93. @example
  94. ```js
  95. var action1 = cc.catmullRomBy(3, array);
  96. ```
  97. */
  98. export function catmullRomBy(dt: number, points: any[]): ActionInterval;
  99. /**
  100. !#en
  101. Creates the action easing object with the rate parameter. <br />
  102. From slow to fast.
  103. !#zh 创建 easeIn 缓动对象,由慢到快。
  104. @param rate rate
  105. @example
  106. ```js
  107. action.easing(cc.easeIn(3.0));
  108. ```
  109. */
  110. export function easeIn(rate: number): any;
  111. /**
  112. !#en
  113. Creates the action easing object with the rate parameter. <br />
  114. From fast to slow.
  115. !#zh 创建 easeOut 缓动对象,由快到慢。
  116. @param rate rate
  117. @example
  118. ```js
  119. action.easing(cc.easeOut(3.0));
  120. ```
  121. */
  122. export function easeOut(rate: number): any;
  123. /**
  124. !#en
  125. Creates the action easing object with the rate parameter. <br />
  126. Slow to fast then to slow.
  127. !#zh 创建 easeInOut 缓动对象,慢到快,然后慢。
  128. @param rate rate
  129. @example
  130. ```js
  131. action.easing(cc.easeInOut(3.0));
  132. ```
  133. */
  134. export function easeInOut(rate: number): any;
  135. /**
  136. !#en
  137. Creates the action easing object with the rate parameter. <br />
  138. Reference easeInExpo: <br />
  139. http://www.zhihu.com/question/21981571/answer/19925418
  140. !#zh
  141. 创建 easeExponentialIn 缓动对象。<br />
  142. EaseExponentialIn 是按指数函数缓动进入的动作。<br />
  143. 参考 easeInExpo:http://www.zhihu.com/question/21981571/answer/19925418
  144. @example
  145. ```js
  146. action.easing(cc.easeExponentialIn());
  147. ```
  148. */
  149. export function easeExponentialIn(): any;
  150. /**
  151. !#en
  152. Creates the action easing object. <br />
  153. Reference easeOutExpo: <br />
  154. http://www.zhihu.com/question/21981571/answer/19925418
  155. !#zh
  156. 创建 easeExponentialOut 缓动对象。<br />
  157. EaseExponentialOut 是按指数函数缓动退出的动作。<br />
  158. 参考 easeOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  159. @example
  160. ```js
  161. action.easing(cc.easeExponentialOut());
  162. ```
  163. */
  164. export function easeExponentialOut(): any;
  165. /**
  166. !#en
  167. Creates an EaseExponentialInOut action easing object. <br />
  168. Reference easeInOutExpo: <br />
  169. http://www.zhihu.com/question/21981571/answer/19925418
  170. !#zh
  171. 创建 easeExponentialInOut 缓动对象。<br />
  172. EaseExponentialInOut 是按指数函数缓动进入并退出的动作。<br />
  173. 参考 easeInOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  174. @example
  175. ```js
  176. action.easing(cc.easeExponentialInOut());
  177. ```
  178. */
  179. export function easeExponentialInOut(): any;
  180. /**
  181. !#en
  182. Creates an EaseSineIn action. <br />
  183. Reference easeInSine: <br />
  184. http://www.zhihu.com/question/21981571/answer/19925418
  185. !#zh
  186. 创建 EaseSineIn 缓动对象。<br />
  187. EaseSineIn 是按正弦函数缓动进入的动作。<br />
  188. 参考 easeInSine:http://www.zhihu.com/question/21981571/answer/19925418
  189. @example
  190. ```js
  191. action.easing(cc.easeSineIn());
  192. ```
  193. */
  194. export function easeSineIn(): any;
  195. /**
  196. !#en
  197. Creates an EaseSineOut action easing object. <br />
  198. Reference easeOutSine: <br />
  199. http://www.zhihu.com/question/21981571/answer/19925418
  200. !#zh
  201. 创建 EaseSineOut 缓动对象。<br />
  202. EaseSineIn 是按正弦函数缓动退出的动作。<br />
  203. 参考 easeOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  204. @example
  205. ```js
  206. action.easing(cc.easeSineOut());
  207. ```
  208. */
  209. export function easeSineOut(): any;
  210. /**
  211. !#en
  212. Creates the action easing object. <br />
  213. Reference easeInOutSine: <br />
  214. http://www.zhihu.com/question/21981571/answer/19925418
  215. !#zh
  216. 创建 easeSineInOut 缓动对象。<br />
  217. EaseSineIn 是按正弦函数缓动进入并退出的动作。<br />
  218. 参考 easeInOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  219. @example
  220. ```js
  221. action.easing(cc.easeSineInOut());
  222. ```
  223. */
  224. export function easeSineInOut(): any;
  225. /**
  226. !#en
  227. Creates the action easing object with the period in radians (default is 0.3). <br />
  228. Reference easeInElastic: <br />
  229. http://www.zhihu.com/question/21981571/answer/19925418
  230. !#zh
  231. 创建 easeElasticIn 缓动对象。<br />
  232. EaseElasticIn 是按弹性曲线缓动进入的动作。<br />
  233. 参数 easeInElastic:http://www.zhihu.com/question/21981571/answer/19925418
  234. @param period period
  235. @example
  236. ```js
  237. // example
  238. action.easing(cc.easeElasticIn(3.0));
  239. ```
  240. */
  241. export function easeElasticIn(period: number): any;
  242. /**
  243. !#en
  244. Creates the action easing object with the period in radians (default is 0.3). <br />
  245. Reference easeOutElastic: <br />
  246. http://www.zhihu.com/question/21981571/answer/19925418
  247. !#zh
  248. 创建 easeElasticOut 缓动对象。<br />
  249. EaseElasticOut 是按弹性曲线缓动退出的动作。<br />
  250. 参考 easeOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  251. @param period period
  252. @example
  253. ```js
  254. // example
  255. action.easing(cc.easeElasticOut(3.0));
  256. ```
  257. */
  258. export function easeElasticOut(period: number): any;
  259. /**
  260. !#en
  261. Creates the action easing object with the period in radians (default is 0.3). <br />
  262. Reference easeInOutElastic: <br />
  263. http://www.zhihu.com/question/21981571/answer/19925418
  264. !#zh
  265. 创建 easeElasticInOut 缓动对象。<br />
  266. EaseElasticInOut 是按弹性曲线缓动进入并退出的动作。<br />
  267. 参考 easeInOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  268. @param period period
  269. @example
  270. ```js
  271. // example
  272. action.easing(cc.easeElasticInOut(3.0));
  273. ```
  274. */
  275. export function easeElasticInOut(period: number): any;
  276. /**
  277. !#en
  278. Creates the action easing object. <br />
  279. Eased bounce effect at the beginning.
  280. !#zh
  281. 创建 easeBounceIn 缓动对象。<br />
  282. EaseBounceIn 是按弹跳动作缓动进入的动作。
  283. @example
  284. ```js
  285. // example
  286. action.easing(cc.easeBounceIn());
  287. ```
  288. */
  289. export function easeBounceIn(): any;
  290. /**
  291. !#en
  292. Creates the action easing object. <br />
  293. Eased bounce effect at the ending.
  294. !#zh
  295. 创建 easeBounceOut 缓动对象。<br />
  296. EaseBounceOut 是按弹跳动作缓动退出的动作。
  297. @example
  298. ```js
  299. // example
  300. action.easing(cc.easeBounceOut());
  301. ```
  302. */
  303. export function easeBounceOut(): any;
  304. /**
  305. !#en
  306. Creates the action easing object. <br />
  307. Eased bounce effect at the begining and ending.
  308. !#zh
  309. 创建 easeBounceInOut 缓动对象。<br />
  310. EaseBounceInOut 是按弹跳动作缓动进入并退出的动作。
  311. @example
  312. ```js
  313. // example
  314. action.easing(cc.easeBounceInOut());
  315. ```
  316. */
  317. export function easeBounceInOut(): any;
  318. /**
  319. !#en
  320. Creates the action easing object. <br />
  321. In the opposite direction to move slowly, and then accelerated to the right direction.
  322. !#zh
  323. 创建 easeBackIn 缓动对象。<br />
  324. easeBackIn 是在相反的方向缓慢移动,然后加速到正确的方向。<br />
  325. @example
  326. ```js
  327. // example
  328. action.easing(cc.easeBackIn());
  329. ```
  330. */
  331. export function easeBackIn(): any;
  332. /**
  333. !#en
  334. Creates the action easing object. <br />
  335. Fast moving more than the finish, and then slowly back to the finish.
  336. !#zh
  337. 创建 easeBackOut 缓动对象。<br />
  338. easeBackOut 快速移动超出目标,然后慢慢回到目标点。
  339. @example
  340. ```js
  341. // example
  342. action.easing(cc.easeBackOut());
  343. ```
  344. */
  345. export function easeBackOut(): any;
  346. /**
  347. !#en
  348. Creates the action easing object. <br />
  349. Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
  350. !#zh
  351. 创建 easeBackInOut 缓动对象。<br />
  352. @example
  353. ```js
  354. // example
  355. action.easing(cc.easeBackInOut());
  356. ```
  357. */
  358. export function easeBackInOut(): any;
  359. /**
  360. !#en
  361. Creates the action easing object. <br />
  362. Into the 4 reference point. <br />
  363. To calculate the motion curve.
  364. !#zh
  365. 创建 easeBezierAction 缓动对象。<br />
  366. EaseBezierAction 是按贝塞尔曲线缓动的动作。
  367. @param p0 The first bezier parameter
  368. @param p1 The second bezier parameter
  369. @param p2 The third bezier parameter
  370. @param p3 The fourth bezier parameter
  371. @example
  372. ```js
  373. // example
  374. action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
  375. ```
  376. */
  377. export function easeBezierAction(p0: number, p1: number, p2: number, p3: number): any;
  378. /**
  379. !#en
  380. Creates the action easing object. <br />
  381. Reference easeInQuad: <br />
  382. http://www.zhihu.com/question/21981571/answer/19925418
  383. !#zh
  384. 创建 easeQuadraticActionIn 缓动对象。<br />
  385. EaseQuadraticIn是按二次函数缓动进入的动作。<br />
  386. 参考 easeInQuad:http://www.zhihu.com/question/21981571/answer/19925418
  387. @example
  388. ```js
  389. //example
  390. action.easing(cc.easeQuadraticActionIn());
  391. ```
  392. */
  393. export function easeQuadraticActionIn(): any;
  394. /**
  395. !#en
  396. Creates the action easing object. <br />
  397. Reference easeOutQuad: <br />
  398. http://www.zhihu.com/question/21981571/answer/19925418
  399. !#zh
  400. 创建 easeQuadraticActionOut 缓动对象。<br />
  401. EaseQuadraticOut 是按二次函数缓动退出的动作。<br />
  402. 参考 easeOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  403. @example
  404. ```js
  405. //example
  406. action.easing(cc.easeQuadraticActionOut());
  407. ```
  408. */
  409. export function easeQuadraticActionOut(): any;
  410. /**
  411. !#en
  412. Creates the action easing object. <br />
  413. Reference easeInOutQuad: <br />
  414. http://www.zhihu.com/question/21981571/answer/19925418
  415. !#zh
  416. 创建 easeQuadraticActionInOut 缓动对象。<br />
  417. EaseQuadraticInOut 是按二次函数缓动进入并退出的动作。<br />
  418. 参考 easeInOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  419. @example
  420. ```js
  421. //example
  422. action.easing(cc.easeQuadraticActionInOut());
  423. ```
  424. */
  425. export function easeQuadraticActionInOut(): any;
  426. /**
  427. !#en
  428. Creates the action easing object. <br />
  429. Reference easeIntQuart: <br />
  430. http://www.zhihu.com/question/21981571/answer/19925418
  431. !#zh
  432. 创建 easeQuarticActionIn 缓动对象。<br />
  433. EaseQuarticIn 是按四次函数缓动进入的动作。<br />
  434. 参考 easeIntQuart:http://www.zhihu.com/question/21981571/answer/19925418
  435. @example
  436. ```js
  437. //example
  438. action.easing(cc.easeQuarticActionIn());
  439. ```
  440. */
  441. export function easeQuarticActionIn(): any;
  442. /**
  443. !#en
  444. Creates the action easing object. <br />
  445. Reference easeOutQuart: <br />
  446. http://www.zhihu.com/question/21981571/answer/19925418
  447. !#zh
  448. 创建 easeQuarticActionOut 缓动对象。<br />
  449. EaseQuarticOut 是按四次函数缓动退出的动作。<br />
  450. 参考 easeOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  451. @example
  452. ```js
  453. //example
  454. action.easing(cc.QuarticActionOut());
  455. ```
  456. */
  457. export function easeQuarticActionOut(): any;
  458. /**
  459. !#en
  460. Creates the action easing object. <br />
  461. Reference easeInOutQuart: <br />
  462. http://www.zhihu.com/question/21981571/answer/19925418
  463. !#zh
  464. 创建 easeQuarticActionInOut 缓动对象。<br />
  465. EaseQuarticInOut 是按四次函数缓动进入并退出的动作。<br />
  466. 参考 easeInOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  467. */
  468. export function easeQuarticActionInOut(): any;
  469. /**
  470. !#en
  471. Creates the action easing object. <br />
  472. Reference easeInQuint: <br />
  473. http://www.zhihu.com/question/21981571/answer/19925418
  474. !#zh
  475. 创建 easeQuinticActionIn 缓动对象。<br />
  476. EaseQuinticIn 是按五次函数缓动进的动作。<br />
  477. 参考 easeInQuint:http://www.zhihu.com/question/21981571/answer/19925418
  478. @example
  479. ```js
  480. //example
  481. action.easing(cc.easeQuinticActionIn());
  482. ```
  483. */
  484. export function easeQuinticActionIn(): any;
  485. /**
  486. !#en
  487. Creates the action easing object. <br />
  488. Reference easeOutQuint: <br />
  489. http://www.zhihu.com/question/21981571/answer/19925418
  490. !#zh
  491. 创建 easeQuinticActionOut 缓动对象。<br />
  492. EaseQuinticOut 是按五次函数缓动退出的动作
  493. 参考 easeOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  494. @example
  495. ```js
  496. //example
  497. action.easing(cc.easeQuadraticActionOut());
  498. ```
  499. */
  500. export function easeQuinticActionOut(): any;
  501. /**
  502. !#en
  503. Creates the action easing object. <br />
  504. Reference easeInOutQuint: <br />
  505. http://www.zhihu.com/question/21981571/answer/19925418
  506. !#zh
  507. 创建 easeQuinticActionInOut 缓动对象。<br />
  508. EaseQuinticInOut是按五次函数缓动进入并退出的动作。<br />
  509. 参考 easeInOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  510. @example
  511. ```js
  512. //example
  513. action.easing(cc.easeQuinticActionInOut());
  514. ```
  515. */
  516. export function easeQuinticActionInOut(): any;
  517. /**
  518. !#en
  519. Creates the action easing object. <br />
  520. Reference easeInCirc: <br />
  521. http://www.zhihu.com/question/21981571/answer/19925418
  522. !#zh
  523. 创建 easeCircleActionIn 缓动对象。<br />
  524. EaseCircleIn是按圆形曲线缓动进入的动作。<br />
  525. 参考 easeInCirc:http://www.zhihu.com/question/21981571/answer/19925418
  526. @example
  527. ```js
  528. //example
  529. action.easing(cc.easeCircleActionIn());
  530. ```
  531. */
  532. export function easeCircleActionIn(): any;
  533. /**
  534. !#en
  535. Creates the action easing object. <br />
  536. Reference easeOutCirc: <br />
  537. http://www.zhihu.com/question/21981571/answer/19925418
  538. !#zh
  539. 创建 easeCircleActionOut 缓动对象。<br />
  540. EaseCircleOut是按圆形曲线缓动退出的动作。<br />
  541. 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  542. @example
  543. ```js
  544. //example
  545. actioneasing(cc.easeCircleActionOut());
  546. ```
  547. */
  548. export function easeCircleActionOut(): any;
  549. /**
  550. !#en
  551. Creates the action easing object. <br />
  552. Reference easeInOutCirc: <br />
  553. http://www.zhihu.com/question/21981571/answer/19925418
  554. !#zh
  555. 创建 easeCircleActionInOut 缓动对象。<br />
  556. EaseCircleInOut 是按圆形曲线缓动进入并退出的动作。<br />
  557. 参考 easeInOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  558. @example
  559. ```js
  560. //example
  561. action.easing(cc.easeCircleActionInOut());
  562. ```
  563. */
  564. export function easeCircleActionInOut(): any;
  565. /**
  566. !#en
  567. Creates the action easing object. <br />
  568. Reference easeInCubic: <br />
  569. http://www.zhihu.com/question/21981571/answer/19925418
  570. !#zh
  571. 创建 easeCubicActionIn 缓动对象。<br />
  572. EaseCubicIn 是按三次函数缓动进入的动作。<br />
  573. 参考 easeInCubic:http://www.zhihu.com/question/21981571/answer/19925418
  574. @example
  575. ```js
  576. //example
  577. action.easing(cc.easeCubicActionIn());
  578. ```
  579. */
  580. export function easeCubicActionIn(): any;
  581. /**
  582. !#en
  583. Creates the action easing object. <br />
  584. Reference easeOutCubic: <br />
  585. http://www.zhihu.com/question/21981571/answer/19925418
  586. !#zh
  587. 创建 easeCubicActionOut 缓动对象。<br />
  588. EaseCubicOut 是按三次函数缓动退出的动作。<br />
  589. 参考 easeOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  590. @example
  591. ```js
  592. //example
  593. action.easing(cc.easeCubicActionOut());
  594. ```
  595. */
  596. export function easeCubicActionOut(): any;
  597. /**
  598. !#en
  599. Creates the action easing object. <br />
  600. Reference easeInOutCubic: <br />
  601. http://www.zhihu.com/question/21981571/answer/19925418
  602. !#zh
  603. 创建 easeCubicActionInOut 缓动对象。<br />
  604. EaseCubicInOut是按三次函数缓动进入并退出的动作。<br />
  605. 参考 easeInOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  606. */
  607. export function easeCubicActionInOut(): any;
  608. /**
  609. !#en Show the Node.
  610. !#zh 立即显示。
  611. @example
  612. ```js
  613. // example
  614. var showAction = cc.show();
  615. ```
  616. */
  617. export function show(): ActionInstant;
  618. /**
  619. !#en Hide the node.
  620. !#zh 立即隐藏。
  621. @example
  622. ```js
  623. // example
  624. var hideAction = cc.hide();
  625. ```
  626. */
  627. export function hide(): ActionInstant;
  628. /**
  629. !#en Toggles the visibility of a node.
  630. !#zh 显隐状态切换。
  631. @example
  632. ```js
  633. // example
  634. var toggleVisibilityAction = cc.toggleVisibility();
  635. ```
  636. */
  637. export function toggleVisibility(): ActionInstant;
  638. /**
  639. !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
  640. !#zh 从父节点移除自身。
  641. @param isNeedCleanUp isNeedCleanUp
  642. @example
  643. ```js
  644. // example
  645. var removeSelfAction = cc.removeSelf();
  646. ```
  647. */
  648. export function removeSelf(isNeedCleanUp ?: boolean): ActionInstant;
  649. /**
  650. !#en Destroy self
  651. !#zh 创建一个销毁自身的动作。
  652. @example
  653. ```js
  654. var destroySelfAction = cc.destroySelf();
  655. ```
  656. */
  657. export function destroySelf(): ActionInstant;
  658. /**
  659. !#en Create a FlipX action to flip or unflip the target.
  660. !#zh X轴翻转。
  661. @param flip Indicate whether the target should be flipped or not
  662. @example
  663. ```js
  664. var flipXAction = cc.flipX(true);
  665. ```
  666. */
  667. export function flipX(flip: boolean): ActionInstant;
  668. /**
  669. !#en Create a FlipY action to flip or unflip the target.
  670. !#zh Y轴翻转。
  671. @param flip flip
  672. @example
  673. ```js
  674. var flipYAction = cc.flipY(true);
  675. ```
  676. */
  677. export function flipY(flip: boolean): ActionInstant;
  678. /**
  679. !#en Creates a Place action with a position.
  680. !#zh 放置在目标位置。
  681. @param pos pos
  682. @param y y
  683. @example
  684. ```js
  685. // example
  686. var placeAction = cc.place(cc.v2(200, 200));
  687. var placeAction = cc.place(200, 200);
  688. ```
  689. */
  690. export function place(pos: Vec2|number, y?: number): ActionInstant;
  691. /**
  692. !#en Creates the action with the callback.
  693. !#zh 执行回调函数。
  694. @param selector selector
  695. @param selectorTarget selectorTarget
  696. @param data data for function, it accepts all data types.
  697. @example
  698. ```js
  699. // example
  700. // CallFunc without data
  701. var finish = cc.callFunc(this.removeSprite, this);
  702. // CallFunc with data
  703. var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini, true);
  704. ```
  705. */
  706. export function callFunc(selector: Function, selectorTarget?: any, data?: any): ActionInstant;
  707. /**
  708. !#en
  709. Helper constructor to create an array of sequenceable actions
  710. The created action will run actions sequentially, one after another.
  711. !#zh 顺序执行动作,创建的动作将按顺序依次运行。
  712. @param actionOrActionArray actionOrActionArray
  713. @param tempArray tempArray
  714. @example
  715. ```js
  716. // example
  717. // create sequence with actions
  718. var seq = cc.sequence(act1, act2);
  719. // create sequence with array
  720. var seq = cc.sequence(actArray);
  721. ```
  722. */
  723. export function sequence(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): ActionInterval;
  724. /**
  725. !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
  726. !#zh 重复动作,可以按一定次数重复一个动,如果想永远重复一个动作请使用 repeatForever 动作来完成。
  727. @param action action
  728. @param times times
  729. @example
  730. ```js
  731. // example
  732. var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
  733. ```
  734. */
  735. export function repeat(action: FiniteTimeAction, times: number): ActionInterval;
  736. /**
  737. !#en Create a acton which repeat forever, as it runs forever, it can't be added into cc.sequence and cc.spawn.
  738. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 repeat 动作,由于这个动作不会停止,所以不能被添加到 cc.sequence 或 cc.spawn 中。
  739. @param action action
  740. @example
  741. ```js
  742. // example
  743. var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
  744. ```
  745. */
  746. export function repeatForever(action: FiniteTimeAction): ActionInterval;
  747. /**
  748. !#en Create a spawn action which runs several actions in parallel.
  749. !#zh 同步执行动作,同步执行一组动作。
  750. @param actionOrActionArray actionOrActionArray
  751. @param tempArray tempArray
  752. @example
  753. ```js
  754. // example
  755. var action = cc.spawn(cc.jumpBy(2, cc.v2(300, 0), 50, 4), cc.rotateBy(2, 720));
  756. todo:It should be the direct use new
  757. ```
  758. */
  759. export function spawn(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): FiniteTimeAction;
  760. /**
  761. !#en
  762. Rotates a Node object to a certain angle by modifying its angle property. <br/>
  763. The direction will be decided by the shortest angle.
  764. !#zh 旋转到目标角度,通过逐帧修改它的 angle 属性,旋转方向将由最短的角度决定。
  765. @param duration duration in seconds
  766. @param dstAngle dstAngle in degrees.
  767. @example
  768. ```js
  769. // example
  770. var rotateTo = cc.rotateTo(2, 61.0);
  771. ```
  772. */
  773. export function rotateTo(duration: number, dstAngle: number): ActionInterval;
  774. /**
  775. !#en
  776. Rotates a Node object clockwise a number of degrees by modifying its angle property.
  777. Relative to its properties to modify.
  778. !#zh 旋转指定的角度。
  779. @param duration duration in seconds
  780. @param deltaAngle deltaAngle in degrees
  781. @example
  782. ```js
  783. // example
  784. var actionBy = cc.rotateBy(2, 360);
  785. ```
  786. */
  787. export function rotateBy(duration: number, deltaAngle: number): ActionInterval;
  788. /**
  789. !#en
  790. Moves a Node object x,y pixels by modifying its position property. <br/>
  791. x and y are relative to the position of the object. <br/>
  792. Several MoveBy actions can be concurrently called, and the resulting <br/>
  793. movement will be the sum of individual movements.
  794. !#zh 移动指定的距离。
  795. @param duration duration in seconds
  796. @param deltaPos deltaPos
  797. @param deltaY deltaY
  798. @example
  799. ```js
  800. // example
  801. var actionTo = cc.moveBy(2, cc.v2(windowSize.width - 40, windowSize.height - 40));
  802. ```
  803. */
  804. export function moveBy(duration: number, deltaPos: Vec2|number, deltaY?: number): ActionInterval;
  805. /**
  806. !#en
  807. Moves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property. <br/>
  808. Several MoveTo actions can be concurrently called, and the resulting <br/>
  809. movement will be the sum of individual movements.
  810. !#zh 移动到目标位置。
  811. @param duration duration in seconds
  812. @param position position
  813. @param y y
  814. @example
  815. ```js
  816. // example
  817. var actionBy = cc.moveTo(2, cc.v2(80, 80));
  818. ```
  819. */
  820. export function moveTo(duration: number, position: Vec2|number, y?: number): ActionInterval;
  821. /**
  822. !#en
  823. Create a action which skews a Node object to given angles by modifying its skewX and skewY properties.
  824. Changes to the specified value.
  825. !#zh 偏斜到目标角度。
  826. @param t time in seconds
  827. @param sx sx
  828. @param sy sy
  829. @example
  830. ```js
  831. // example
  832. var actionTo = cc.skewTo(2, 37.2, -37.2);
  833. ```
  834. */
  835. export function skewTo(t: number, sx: number, sy: number): ActionInterval;
  836. /**
  837. !#en
  838. Skews a Node object by skewX and skewY degrees. <br />
  839. Relative to its property modification.
  840. !#zh 偏斜指定的角度。
  841. @param t time in seconds
  842. @param sx sx skew in degrees for X axis
  843. @param sy sy skew in degrees for Y axis
  844. @example
  845. ```js
  846. // example
  847. var actionBy = cc.skewBy(2, 0, -90);
  848. ```
  849. */
  850. export function skewBy(t: number, sx: number, sy: number): ActionInterval;
  851. /**
  852. !#en
  853. Moves a Node object simulating a parabolic jump movement by modifying it's position property.
  854. Relative to its movement.
  855. !#zh 用跳跃的方式移动指定的距离。
  856. @param duration duration
  857. @param position position
  858. @param y y
  859. @param height height
  860. @param jumps jumps
  861. @example
  862. ```js
  863. // example
  864. var actionBy = cc.jumpBy(2, cc.v2(300, 0), 50, 4);
  865. var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
  866. ```
  867. */
  868. export function jumpBy(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  869. /**
  870. !#en
  871. Moves a Node object to a parabolic position simulating a jump movement by modifying its position property. <br />
  872. Jump to the specified location.
  873. !#zh 用跳跃的方式移动到目标位置。
  874. @param duration duration
  875. @param position position
  876. @param y y
  877. @param height height
  878. @param jumps jumps
  879. @example
  880. ```js
  881. // example
  882. var actionTo = cc.jumpTo(2, cc.v2(300, 300), 50, 4);
  883. var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
  884. ```
  885. */
  886. export function jumpTo(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  887. /**
  888. !#en
  889. An action that moves the target with a cubic Bezier curve by a certain distance.
  890. Relative to its movement.
  891. !#zh 按贝赛尔曲线轨迹移动指定的距离。
  892. @param t time in seconds
  893. @param c Array of points
  894. @example
  895. ```js
  896. // example
  897. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  898. var bezierForward = cc.bezierBy(3, bezier);
  899. ```
  900. */
  901. export function bezierBy(t: number, c: Vec2[]): ActionInterval;
  902. /**
  903. !#en An action that moves the target with a cubic Bezier curve to a destination point.
  904. !#zh 按贝赛尔曲线轨迹移动到目标位置。
  905. @param t t
  906. @param c Array of points
  907. @example
  908. ```js
  909. // example
  910. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  911. var bezierTo = cc.bezierTo(2, bezier);
  912. ```
  913. */
  914. export function bezierTo(t: number, c: Vec2[]): ActionInterval;
  915. /**
  916. !#en Scales a Node object to a zoom factor by modifying it's scale property.
  917. !#zh 将节点大小缩放到指定的倍数。
  918. @param duration duration
  919. @param sx scale parameter in X
  920. @param sy scale parameter in Y, if Null equal to sx
  921. @example
  922. ```js
  923. // example
  924. // It scales to 0.5 in both X and Y.
  925. var actionTo = cc.scaleTo(2, 0.5);
  926. // It scales to 0.5 in x and 2 in Y
  927. var actionTo = cc.scaleTo(2, 0.5, 2);
  928. ```
  929. */
  930. export function scaleTo(duration: number, sx: number, sy?: number): ActionInterval;
  931. /**
  932. !#en
  933. Scales a Node object a zoom factor by modifying it's scale property.
  934. Relative to its changes.
  935. !#zh 按指定的倍数缩放节点大小。
  936. @param duration duration in seconds
  937. @param sx sx scale parameter in X
  938. @param sy sy scale parameter in Y, if Null equal to sx
  939. @example
  940. ```js
  941. // example without sy, it scales by 2 both in X and Y
  942. var actionBy = cc.scaleBy(2, 2);
  943. //example with sy, it scales by 0.25 in X and 4.5 in Y
  944. var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
  945. ```
  946. */
  947. export function scaleBy(duration: number, sx: number, sy?: number|void): ActionInterval;
  948. /**
  949. !#en Blinks a Node object by modifying it's visible property.
  950. !#zh 闪烁(基于透明度)。
  951. @param duration duration in seconds
  952. @param blinks blinks in times
  953. @example
  954. ```js
  955. // example
  956. var action = cc.blink(2, 10);
  957. ```
  958. */
  959. export function blink(duration: number, blinks: number): ActionInterval;
  960. /**
  961. !#en
  962. Fades an object that implements the cc.RGBAProtocol protocol.
  963. It modifies the opacity from the current value to a custom one.
  964. !#zh 修改透明度到指定值。
  965. @param duration duration
  966. @param opacity 0-255, 0 is transparent
  967. @example
  968. ```js
  969. // example
  970. var action = cc.fadeTo(1.0, 0);
  971. ```
  972. */
  973. export function fadeTo(duration: number, opacity: number): ActionInterval;
  974. /**
  975. !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
  976. !#zh 渐显效果。
  977. @param duration duration in seconds
  978. @example
  979. ```js
  980. //example
  981. var action = cc.fadeIn(1.0);
  982. ```
  983. */
  984. export function fadeIn(duration: number): ActionInterval;
  985. /**
  986. !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
  987. !#zh 渐隐效果。
  988. @param d duration in seconds
  989. @example
  990. ```js
  991. // example
  992. var action = cc.fadeOut(1.0);
  993. ```
  994. */
  995. export function fadeOut(d: number): ActionInterval;
  996. /**
  997. !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  998. !#zh 修改颜色到指定值。
  999. @param duration duration
  1000. @param red 0-255
  1001. @param green 0-255
  1002. @param blue 0-255
  1003. @example
  1004. ```js
  1005. // example
  1006. var action = cc.tintTo(2, 255, 0, 255);
  1007. ```
  1008. */
  1009. export function tintTo(duration: number, red: number, green: number, blue: number): ActionInterval;
  1010. /**
  1011. !#en
  1012. Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  1013. Relative to their own color change.
  1014. !#zh 按照指定的增量修改颜色。
  1015. @param duration duration in seconds
  1016. @param deltaRed deltaRed
  1017. @param deltaGreen deltaGreen
  1018. @param deltaBlue deltaBlue
  1019. @example
  1020. ```js
  1021. // example
  1022. var action = cc.tintBy(2, -127, -255, -127);
  1023. ```
  1024. */
  1025. export function tintBy(duration: number, deltaRed: number, deltaGreen: number, deltaBlue: number): ActionInterval;
  1026. /**
  1027. !#en Delays the action a certain amount of seconds.
  1028. !#zh 延迟指定的时间量。
  1029. @param d duration in seconds
  1030. @example
  1031. ```js
  1032. // example
  1033. var delay = cc.delayTime(1);
  1034. ```
  1035. */
  1036. export function delayTime(d: number): ActionInterval;
  1037. /**
  1038. !#en Executes an action in reverse order, from time=duration to time=0.
  1039. !#zh 反转目标动作的时间轴。
  1040. @param action action
  1041. @example
  1042. ```js
  1043. // example
  1044. var reverse = cc.reverseTime(this);
  1045. ```
  1046. */
  1047. export function reverseTime(action: FiniteTimeAction): ActionInterval;
  1048. /**
  1049. !#en Create an action with the specified action and forced target.
  1050. !#zh 用已有动作和一个新的目标节点创建动作。
  1051. @param target target
  1052. @param action action
  1053. */
  1054. export function targetedAction(target: Node, action: FiniteTimeAction): ActionInterval;
  1055. /**
  1056. @param target the target to animate
  1057. */
  1058. export function tween<T> (target?: T) : Tween<T>;
  1059. /**
  1060. !#en
  1061. Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
  1062. - In Cocos Creator, error is red.<br/>
  1063. - In Chrome, error have a red icon along with red message text.<br/>
  1064. !#zh
  1065. 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
  1066. - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
  1067. - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
  1068. @param msg A JavaScript string containing zero or more substitution strings.
  1069. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1070. */
  1071. export function error(msg: any, ...subst: any[]): void;
  1072. /**
  1073. !#en
  1074. Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).
  1075. - In Cocos Creator, warning is yellow.
  1076. - In Chrome, warning have a yellow warning icon with the message text.
  1077. !#zh
  1078. 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>
  1079. - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
  1080. - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
  1081. @param msg A JavaScript string containing zero or more substitution strings.
  1082. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1083. */
  1084. export function warn(msg: any, ...subst: any[]): void;
  1085. /**
  1086. !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
  1087. !#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
  1088. @param msg A JavaScript string containing zero or more substitution strings.
  1089. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1090. */
  1091. export function log(msg: string|any, ...subst: any[]): void;
  1092. /** !#en Director
  1093. !#zh 导演类。 */
  1094. export var director: Director;
  1095. /** !#en This is a Game instance.
  1096. !#zh 这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。。 */
  1097. export var game: Game;
  1098. /**
  1099. !#en
  1100. Rotates a Node object to a certain angle by modifying its quternion property. <br/>
  1101. The direction will be decided by the shortest angle.
  1102. !#zh 旋转到目标角度,通过逐帧修改它的 quternion 属性,旋转方向将由最短的角度决定。
  1103. @param duration duration in seconds
  1104. @param dstAngleX dstAngleX in degrees.
  1105. @param dstAngleY dstAngleY in degrees.
  1106. @param dstAngleZ dstAngleZ in degrees.
  1107. @example
  1108. ```js
  1109. // example
  1110. var rotate3DTo = cc.rotate3DTo(2, cc.v3(0, 180, 0));
  1111. ```
  1112. */
  1113. export function rotate3DTo(duration: number, dstAngleX: number|Vec3|Quat, dstAngleY?: number, dstAngleZ?: number): ActionInterval;
  1114. /**
  1115. !#en
  1116. Rotates a Node object counter clockwise a number of degrees by modifying its quaternion property.
  1117. Relative to its properties to modify.
  1118. !#zh 旋转指定的 3D 角度。
  1119. @param duration duration in seconds
  1120. @param deltaAngleX deltaAngleX in degrees
  1121. @param deltaAngleY deltaAngleY in degrees
  1122. @param deltaAngleZ deltaAngleZ in degrees
  1123. @example
  1124. ```js
  1125. // example
  1126. var actionBy = cc.rotate3DBy(2, cc.v3(0, 360, 0));
  1127. ```
  1128. */
  1129. export function rotate3DBy(duration: number, deltaAngleX: number|Vec3, deltaAngleY?: number, deltaAngleZ?: number): ActionInterval;
  1130. export var assetManager: AssetManager;
  1131. export var resources: AssetManager.Bundle;
  1132. /** !#en The System event singleton for global usage
  1133. !#zh 系统事件单例,方便全局使用 */
  1134. export var systemEvent: SystemEvent;
  1135. /** The offset of the range. */
  1136. export var offset: number;
  1137. /** The length of the range. */
  1138. export var length: number;
  1139. /** The data range of this bundle.
  1140. This range of data is essentially mapped to a GPU vertex buffer. */
  1141. export var data: BufferRange;
  1142. /** The attribute formats. */
  1143. export var formats: VertexFormat;
  1144. /** The vertex bundle that the primitive use. */
  1145. export var vertexBundleIndices: number[];
  1146. /** The data range of the primitive.
  1147. This range of data is essentially mapped to a GPU indices buffer. */
  1148. export var data: BufferRange;
  1149. /** The type of this primitive's indices. */
  1150. export var indexUnit: number;
  1151. /** The primitive's topology. */
  1152. export var topology: number;
  1153. /**
  1154. Finds a node by hierarchy path, the path is case-sensitive.
  1155. It will traverse the hierarchy by splitting the path using '/' character.
  1156. This function will still returns the node even if it is inactive.
  1157. It is recommended to not use this function every frame instead cache the result at startup.
  1158. @param path path
  1159. @param referenceNode referenceNode
  1160. */
  1161. export function find(path: string, referenceNode?: Node): Node;
  1162. /**
  1163. !#en Defines a CCClass using the given specification, please see [Class](/docs/editors_and_tools/creator-chapters/scripting/class.html) for details.
  1164. !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/docs/creator/scripting/class.html)。
  1165. @param options options
  1166. @example
  1167. ```js
  1168. // define base class
  1169. var Node = cc.Class();
  1170. // define sub class
  1171. var Sprite = cc.Class({
  1172. name: 'Sprite',
  1173. extends: Node,
  1174. ctor: function () {
  1175. this.url = "";
  1176. this.id = 0;
  1177. },
  1178. statics: {
  1179. // define static members
  1180. count: 0,
  1181. getBounds: function (spriteList) {
  1182. // compute bounds...
  1183. }
  1184. },
  1185. properties {
  1186. width: {
  1187. default: 128,
  1188. type: cc.Integer,
  1189. tooltip: 'The width of sprite'
  1190. },
  1191. height: 128,
  1192. size: {
  1193. get: function () {
  1194. return cc.v2(this.width, this.height);
  1195. }
  1196. }
  1197. },
  1198. load: function () {
  1199. // load this.url...
  1200. };
  1201. });
  1202. // instantiate
  1203. var obj = new Sprite();
  1204. obj.url = 'sprite.png';
  1205. obj.load();
  1206. ```
  1207. */
  1208. export function Class(options?: {name?: string; extends?: Function; ctor?: Function; __ctor__?: Function; properties?: any; statics?: any; mixins?: Function[]; editor?: {executeInEditMode?: boolean; requireComponent?: Function; menu?: string; executionOrder?: number; disallowMultiple?: boolean; playOnFocus?: boolean; inspector?: string; icon?: string; help?: string; }; update?: Function; lateUpdate?: Function; onLoad?: Function; start?: Function; onEnable?: Function; onDisable?: Function; onDestroy?: Function; onFocusInEditor?: Function; onLostFocusInEditor?: Function; resetInEditor?: Function; onRestore?: Function; _getLocalBounds?: Function; }): Function;
  1209. /**
  1210. !#en
  1211. Define an enum type. <br/>
  1212. If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
  1213. Otherwise it will use the value specified by user who writes the enum definition.
  1214. !#zh
  1215. 定义一个枚举类型。<br/>
  1216. 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  1217. @param obj a JavaScript literal object containing enum names and values, or a TypeScript enum type
  1218. @example
  1219. ```js
  1220. // JavaScript:
  1221. var WrapMode = cc.Enum({
  1222. Repeat: -1,
  1223. Clamp: -1
  1224. });
  1225. // Texture.WrapMode.Repeat == 0
  1226. // Texture.WrapMode.Clamp == 1
  1227. // Texture.WrapMode[0] == "Repeat"
  1228. // Texture.WrapMode[1] == "Clamp"
  1229. var FlagType = cc.Enum({
  1230. Flag1: 1,
  1231. Flag2: 2,
  1232. Flag3: 4,
  1233. Flag4: 8,
  1234. });
  1235. var AtlasSizeList = cc.Enum({
  1236. 128: 128,
  1237. 256: 256,
  1238. 512: 512,
  1239. 1024: 1024,
  1240. });
  1241. // TypeScript:
  1242. // If used in TypeScript, just define a TypeScript enum:
  1243. enum Direction {
  1244. Up,
  1245. Down,
  1246. Left,
  1247. Right
  1248. }
  1249. // If you need to inspect the enum in Properties panel, you can call cc.Enum:
  1250. const {ccclass, property} = cc._decorator;
  1251. @ccclass
  1252. class NewScript extends cc.Component {
  1253. @property({
  1254. type: cc.Enum(Direction) // call cc.Enum
  1255. })
  1256. direction: Direction = Direction.Up;
  1257. }
  1258. ```
  1259. */
  1260. export function Enum<T>(obj: T): T;
  1261. /**
  1262. @param touches touches
  1263. */
  1264. export function handleTouchesBegin(touches: any[]): void;
  1265. /**
  1266. @param touches touches
  1267. */
  1268. export function handleTouchesMove(touches: any[]): void;
  1269. /**
  1270. @param touches touches
  1271. */
  1272. export function handleTouchesEnd(touches: any[]): void;
  1273. /**
  1274. @param touches touches
  1275. */
  1276. export function handleTouchesCancel(touches: any[]): void;
  1277. /**
  1278. @param touches touches
  1279. */
  1280. export function getSetOfTouchesEndOrCancel(touches: any[]): any[];
  1281. /**
  1282. @param touch touch
  1283. */
  1284. export function getPreTouch(touch: Touch): Touch;
  1285. /**
  1286. @param touch touch
  1287. */
  1288. export function setPreTouch(touch: Touch): void;
  1289. /**
  1290. @param tx tx
  1291. @param ty ty
  1292. @param pos pos
  1293. */
  1294. export function getTouchByXY(tx: number, ty: number, pos: Vec2): Touch;
  1295. /**
  1296. @param location location
  1297. @param pos pos
  1298. @param eventType eventType
  1299. */
  1300. export function getMouseEvent(location: Vec2, pos: Vec2, eventType: number): Event.EventMouse;
  1301. /**
  1302. @param event event
  1303. @param pos pos
  1304. */
  1305. export function getPointByEvent(event: Touch, pos: Vec2): Vec2;
  1306. /**
  1307. @param event event
  1308. @param pos pos
  1309. */
  1310. export function getTouchesByEvent(event: Touch, pos: Vec2): any[];
  1311. /**
  1312. @param element element
  1313. */
  1314. export function registerSystemEvent(element: HTMLElement): void;
  1315. /**
  1316. @param dt dt
  1317. */
  1318. export function update(dt: number): void;
  1319. /**
  1320. !#en
  1321. Checks whether the object is non-nil and not yet destroyed.<br>
  1322. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  1323. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  1324. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  1325. but this is often caused by a particular logical requirements, which is not normally required.
  1326. !#zh
  1327. 检查该对象是否不为 null 并且尚未销毁。<br>
  1328. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
  1329. @param value value
  1330. @param strictMode If true, Object called destroy() in this frame will also treated as invalid.
  1331. @example
  1332. ```js
  1333. var node = new cc.Node();
  1334. cc.log(cc.isValid(node)); // true
  1335. node.destroy();
  1336. cc.log(cc.isValid(node)); // true, still valid in this frame
  1337. // after a frame...
  1338. cc.log(cc.isValid(node)); // false, destroyed in the end of last frame
  1339. ```
  1340. */
  1341. export function isValid(value: any, strictMode?: boolean): boolean;
  1342. /** !#en cc.view is the shared view object.
  1343. !#zh cc.view 是全局的视图对象。 */
  1344. export var view: View;
  1345. /** !#en cc.winSize is the alias object for the size of the current game window.
  1346. !#zh cc.winSize 为当前的游戏窗口的大小。 */
  1347. export var winSize: Size;
  1348. /** Specify that the input value must be integer in Inspector.
  1349. Also used to indicates that the elements in array should be type integer. */
  1350. export var Integer: string;
  1351. /** Indicates that the elements in array should be type double. */
  1352. export var Float: string;
  1353. /** Indicates that the elements in array should be type boolean. */
  1354. export var Boolean: string;
  1355. /** Indicates that the elements in array should be type string. */
  1356. export var String: string;
  1357. /**
  1358. !#en Deserialize json to cc.Asset
  1359. !#zh 将 JSON 反序列化为对象实例。
  1360. @param data the serialized cc.Asset json string or json object.
  1361. @param details additional loading result
  1362. @param options options
  1363. */
  1364. export function deserialize(data: string|any, details?: Details, options?: any): any;
  1365. /**
  1366. !#en Clones the object `original` and returns the clone, or instantiate a node from the Prefab.
  1367. !#zh 克隆指定的任意类型的对象,或者从 Prefab 实例化出新节点。
  1368. (Instantiate 时,function 和 dom 等非可序列化对象会直接保留原有引用,Asset 会直接进行浅拷贝,可序列化类型会进行深拷贝。)
  1369. @param original An existing object that you want to make a copy of.
  1370. @example
  1371. ```js
  1372. // instantiate node from prefab
  1373. var scene = cc.director.getScene();
  1374. var node = cc.instantiate(prefabAsset);
  1375. node.parent = scene;
  1376. // clone node
  1377. var scene = cc.director.getScene();
  1378. var node = cc.instantiate(targetNode);
  1379. node.parent = scene;
  1380. ```
  1381. */
  1382. export function instantiate(original: Prefab): Node;
  1383. export function instantiate<T>(original: T): T;
  1384. /**
  1385. !#en
  1386. The convenience method to create a new {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}}
  1387. Alpha channel is optional. Default value is 255.
  1388. !#zh
  1389. 通过该方法来创建一个新的 {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}} 对象。
  1390. Alpha 通道是可选的。默认值是 255。
  1391. @param r r
  1392. @param g g
  1393. @param b b
  1394. @param a a
  1395. @example
  1396. ```js
  1397. -----------------------
  1398. // 1. All channels seperately as parameters
  1399. var color1 = new cc.Color(255, 255, 255, 255);
  1400. // 2. Convert a hex string to a color
  1401. var color2 = new cc.Color("#000000");
  1402. // 3. An color object as parameter
  1403. var color3 = new cc.Color({r: 255, g: 255, b: 255, a: 255});
  1404. ```
  1405. */
  1406. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  1407. /** Identity of Mat3 */
  1408. export var IDENTITY: Mat3;
  1409. /**
  1410. !#zh 矩阵转数组
  1411. !#en Matrix transpose array
  1412. @param ofs 数组内的起始偏移量
  1413. */
  1414. export function toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat3Like, ofs = 0);
  1415. /**
  1416. !#zh 数组转矩阵
  1417. !#en Transfer matrix array
  1418. @param ofs 数组起始偏移量
  1419. */
  1420. export function fromArray <Out extends IMat3Like> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  1421. /** !#en Matrix Data
  1422. !#zh 矩阵数据 */
  1423. export var m: Float64Array|Float32Array;
  1424. export function constructor (m00: number | Float32Array = 1, m01 = 0, m02 = 0, m03 = 0, m04 = 1, m05 = 0, m06 = 0, m07 = 0, m08 = 1);
  1425. /**
  1426. !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
  1427. !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
  1428. @param m00 Component in column 0, row 0 position (index 0)
  1429. @param m01 Component in column 0, row 1 position (index 1)
  1430. @param m02 Component in column 0, row 2 position (index 2)
  1431. @param m03 Component in column 0, row 3 position (index 3)
  1432. @param m10 Component in column 1, row 0 position (index 4)
  1433. @param m11 Component in column 1, row 1 position (index 5)
  1434. @param m12 Component in column 1, row 2 position (index 6)
  1435. @param m13 Component in column 1, row 3 position (index 7)
  1436. @param m20 Component in column 2, row 0 position (index 8)
  1437. @param m21 Component in column 2, row 1 position (index 9)
  1438. @param m22 Component in column 2, row 2 position (index 10)
  1439. @param m23 Component in column 2, row 3 position (index 11)
  1440. @param m30 Component in column 3, row 0 position (index 12)
  1441. @param m31 Component in column 3, row 1 position (index 13)
  1442. @param m32 Component in column 3, row 2 position (index 14)
  1443. @param m33 Component in column 3, row 3 position (index 15)
  1444. */
  1445. export function mat4(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number): Mat4;
  1446. /**
  1447. !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
  1448. !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
  1449. @param x x
  1450. @param y y
  1451. @param z z
  1452. @param w w
  1453. */
  1454. export function quat(x?: number|any, y?: number, z?: number, w?: number): Quat;
  1455. /**
  1456. !#en
  1457. The convenience method to create a new Rect.
  1458. see {{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1459. !#zh
  1460. 该方法用来快速创建一个新的矩形。{{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1461. @param x x
  1462. @param y y
  1463. @param w w
  1464. @param h h
  1465. @example
  1466. ```js
  1467. var a = new cc.Rect(0 , 0, 10, 0);
  1468. ```
  1469. */
  1470. export function rect(x?: number, y?: number, w?: number, h?: number): Rect;
  1471. /**
  1472. !#en
  1473. Helper function that creates a cc.Size.<br/>
  1474. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.
  1475. !#zh
  1476. 创建一个 cc.Size 对象的帮助函数。<br/>
  1477. 注意:可以使用 cc.p 或者是 cc.v2 代替,它们将很快取代 cc.Size。
  1478. @param w width or a size object
  1479. @param h height
  1480. @example
  1481. ```js
  1482. var size1 = cc.size();
  1483. var size2 = cc.size(100,100);
  1484. var size3 = cc.size(size2);
  1485. var size4 = cc.size({width: 100, height: 100});
  1486. ```
  1487. */
  1488. export function size(w: number|Size, h?: number): Size;
  1489. export var EPSILON: number;
  1490. /**
  1491. Clamps a value between a minimum float and maximum float value.
  1492. @param val val
  1493. @param min min
  1494. @param max max
  1495. */
  1496. export function clamp(val: number, min: number, max: number): number;
  1497. /**
  1498. Clamps a value between 0 and 1.
  1499. @param val val
  1500. */
  1501. export function clamp01(val: number): number;
  1502. /**
  1503. @param from from
  1504. @param to to
  1505. @param ratio the interpolation coefficient
  1506. */
  1507. export function lerp(from: number, to: number, ratio: number): number;
  1508. export function random(): void;
  1509. /**
  1510. Returns a floating-point random number between min (inclusive) and max (exclusive).
  1511. @param min min
  1512. @param max max
  1513. */
  1514. export function randomRange(min: number, max: number): number;
  1515. /**
  1516. Returns a random integer between min (inclusive) and max (exclusive).
  1517. @param min min
  1518. @param max max
  1519. */
  1520. export function randomRangeInt(min: number, max: number): number;
  1521. /**
  1522. Linear congruential generator using Hull-Dobell Theorem.
  1523. @param seed the random seed
  1524. */
  1525. export function pseudoRandom(seed: number): number;
  1526. /**
  1527. Returns a floating-point pseudo-random number between min (inclusive) and max (exclusive).
  1528. @param seed seed
  1529. @param min min
  1530. @param max max
  1531. */
  1532. export function pseudoRandomRange(seed: number, min: number, max: number): number;
  1533. /**
  1534. Returns a pseudo-random integer between min (inclusive) and max (exclusive).
  1535. @param seed seed
  1536. @param min min
  1537. @param max max
  1538. */
  1539. export function pseudoRandomRangeInt(seed: number, min: number, max: number): number;
  1540. /**
  1541. Returns the next power of two for the value
  1542. @param val val
  1543. */
  1544. export function nextPow2(val: number): number;
  1545. /**
  1546. Returns float remainder for t / length
  1547. @param t time start at 0
  1548. @param length time of one cycle
  1549. */
  1550. export function repeat(t: number, length: number): number;
  1551. /**
  1552. Returns time wrapped in ping-pong mode
  1553. @param t time start at 0
  1554. @param length time of one cycle
  1555. */
  1556. export function repeat(t: number, length: number): number;
  1557. /**
  1558. Returns ratio of a value within a given range
  1559. @param from start value
  1560. @param to end value
  1561. @param value given value
  1562. */
  1563. export function repeat(from: number, to: number, value: number): number;
  1564. /**
  1565. Returns -1, 0, +1 depending on sign of x.
  1566. @param v v
  1567. */
  1568. export function sign(v: number): void;
  1569. /**
  1570. !#en The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
  1571. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}} 对象。
  1572. @param x x
  1573. @param y y
  1574. @example
  1575. ```js
  1576. var v1 = cc.v2();
  1577. var v2 = cc.v2(0, 0);
  1578. var v3 = cc.v2(v2);
  1579. var v4 = cc.v2({x: 100, y: 100});
  1580. ```
  1581. */
  1582. export function v2(x?: number|any, y?: number): Vec2;
  1583. /**
  1584. !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
  1585. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
  1586. @param x x
  1587. @param y y
  1588. @param z z
  1589. @example
  1590. ```js
  1591. var v1 = cc.v3();
  1592. var v2 = cc.v3(0, 0, 0);
  1593. var v3 = cc.v3(v2);
  1594. var v4 = cc.v3({x: 100, y: 100, z: 0});
  1595. ```
  1596. */
  1597. export function v3(x?: number|any, y?: number, z?: number): Vec3;
  1598. export var dynamicAtlasManager: DynamicAtlasManager;
  1599. /** !#en The matrix storage */
  1600. export var matrix: any[];
  1601. /**
  1602. !#en Get an element
  1603. @param i i
  1604. @param j j
  1605. */
  1606. export function get(i: number, j: number): number;
  1607. /**
  1608. !#en Set an element
  1609. @param i i
  1610. @param j j
  1611. @param value value
  1612. */
  1613. export function set(i: number, j: number, value: boolean): void;
  1614. /**
  1615. !#en Sets all elements to zero
  1616. */
  1617. export function reset(): void;
  1618. /** !#en
  1619. cc.NodePool is the cache pool designed for node type.<br/>
  1620. It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  1621. It's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,
  1622. for example, a prefab is a specific node type. <br/>
  1623. When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  1624. Some common use case is :<br/>
  1625. 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  1626. 2. Blocks in candy crash (massive creation and recreation)<br/>
  1627. etc...
  1628. !#zh
  1629. cc.NodePool 是用于管理节点对象的对象缓存池。<br/>
  1630. 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  1631. 以前 cocos2d-x 中的 cc.pool 和新的节点事件注册系统不兼容,因此请使用 cc.NodePool 来代替。
  1632. 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  1633. 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  1634. 一些常见的用例是:<br/>
  1635. 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  1636. 2.糖果粉碎传奇中的木块(频繁创建)。
  1637. 等等.... */
  1638. export class NodePool {
  1639. /**
  1640. !#en
  1641. Constructor for creating a pool for a specific node template (usually a prefab). You can pass a component (type or name) argument for handling event for reusing and recycling node.
  1642. !#zh
  1643. 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  1644. @param poolHandlerComp !#en The constructor or the class name of the component to control the unuse/reuse logic. !#zh 处理节点回收和复用事件逻辑的组件类型或名称。
  1645. @example
  1646. ```js
  1647. properties: {
  1648. template: cc.Prefab
  1649. },
  1650. onLoad () {
  1651. // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  1652. this.myPool = new cc.NodePool('MyTemplateHandler');
  1653. }
  1654. ```
  1655. */
  1656. constructor(poolHandlerComp?: {prototype: Component}|string);
  1657. /** !#en The pool handler component, it could be the class name or the constructor.
  1658. !#zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。 */
  1659. poolHandlerComp: Function|string;
  1660. /**
  1661. !#en The current available size in the pool
  1662. !#zh 获取当前缓冲池的可用对象数量
  1663. */
  1664. size(): number;
  1665. /**
  1666. !#en Destroy all cached nodes in the pool
  1667. !#zh 销毁对象池中缓存的所有节点
  1668. */
  1669. clear(): void;
  1670. /**
  1671. !#en Put a new Node into the pool.
  1672. It will automatically remove the node from its parent without cleanup.
  1673. It will also invoke unuse method of the poolHandlerComp if exist.
  1674. !#zh 向缓冲池中存入一个不再需要的节点对象。
  1675. 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  1676. 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  1677. @param obj obj
  1678. @example
  1679. ```js
  1680. let myNode = cc.instantiate(this.template);
  1681. this.myPool.put(myNode);
  1682. ```
  1683. */
  1684. put(obj: Node): void;
  1685. /**
  1686. !#en Get a obj from pool, if no available object in pool, null will be returned.
  1687. This function will invoke the reuse function of poolHandlerComp if exist.
  1688. !#zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  1689. 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  1690. @param params !#en Params to pass to 'reuse' method in poolHandlerComp !#zh 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  1691. @example
  1692. ```js
  1693. let newNode = this.myPool.get();
  1694. ```
  1695. */
  1696. get(...params: any[]): Node;
  1697. }
  1698. /** !#en cc.audioEngine is the singleton object, it provide simple audio APIs.
  1699. !#zh
  1700. cc.audioengine是单例对象。<br/>
  1701. 主要用来播放音频,播放的时候会返回一个 audioID,之后都可以通过这个 audioID 来操作这个音频对象。<br/>
  1702. 不使用的时候,请使用 cc.audioEngine.uncache(filePath); 进行资源释放 <br/>
  1703. 注意:<br/>
  1704. 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。<br/>
  1705. 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,<br/>
  1706. 有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。 */
  1707. export class audioEngine {
  1708. /**
  1709. !#en Play audio.
  1710. !#zh 播放音频
  1711. @param clip The audio clip to play.
  1712. @param loop Whether the music loop or not.
  1713. @param volume Volume size.
  1714. @example
  1715. ```js
  1716. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  1717. var audioID = cc.audioEngine.play(clip, false, 0.5);
  1718. });
  1719. ```
  1720. */
  1721. static play(clip: AudioClip, loop: boolean, volume: number): number;
  1722. /**
  1723. !#en Set audio loop.
  1724. !#zh 设置音频是否循环。
  1725. @param audioID audio id.
  1726. @param loop Whether cycle.
  1727. @example
  1728. ```js
  1729. cc.audioEngine.setLoop(id, true);
  1730. ```
  1731. */
  1732. static setLoop(audioID: number, loop: boolean): void;
  1733. /**
  1734. !#en Get audio cycle state.
  1735. !#zh 获取音频的循环状态。
  1736. @param audioID audio id.
  1737. @example
  1738. ```js
  1739. cc.audioEngine.isLoop(id);
  1740. ```
  1741. */
  1742. static isLoop(audioID: number): boolean;
  1743. /**
  1744. !#en Set the volume of audio.
  1745. !#zh 设置音量(0.0 ~ 1.0)。
  1746. @param audioID audio id.
  1747. @param volume Volume must be in 0.0~1.0 .
  1748. @example
  1749. ```js
  1750. cc.audioEngine.setVolume(id, 0.5);
  1751. ```
  1752. */
  1753. static setVolume(audioID: number, volume: number): void;
  1754. /**
  1755. !#en The volume of the music max value is 1.0,the min value is 0.0 .
  1756. !#zh 获取音量(0.0 ~ 1.0)。
  1757. @param audioID audio id.
  1758. @example
  1759. ```js
  1760. var volume = cc.audioEngine.getVolume(id);
  1761. ```
  1762. */
  1763. static getVolume(audioID: number): number;
  1764. /**
  1765. !#en Set current time
  1766. !#zh 设置当前的音频时间。
  1767. @param audioID audio id.
  1768. @param sec current time.
  1769. @example
  1770. ```js
  1771. cc.audioEngine.setCurrentTime(id, 2);
  1772. ```
  1773. */
  1774. static setCurrentTime(audioID: number, sec: number): boolean;
  1775. /**
  1776. !#en Get current time
  1777. !#zh 获取当前的音频播放时间。
  1778. @param audioID audio id.
  1779. @example
  1780. ```js
  1781. var time = cc.audioEngine.getCurrentTime(id);
  1782. ```
  1783. */
  1784. static getCurrentTime(audioID: number): number;
  1785. /**
  1786. !#en Get audio duration
  1787. !#zh 获取音频总时长。
  1788. @param audioID audio id.
  1789. @example
  1790. ```js
  1791. var time = cc.audioEngine.getDuration(id);
  1792. ```
  1793. */
  1794. static getDuration(audioID: number): number;
  1795. /**
  1796. !#en Get audio state
  1797. !#zh 获取音频状态。
  1798. @param audioID audio id.
  1799. @example
  1800. ```js
  1801. var state = cc.audioEngine.getState(id);
  1802. ```
  1803. */
  1804. static getState(audioID: number): audioEngine.AudioState;
  1805. /**
  1806. !#en Set Audio finish callback
  1807. !#zh 设置一个音频结束后的回调
  1808. @param audioID audio id.
  1809. @param callback loaded callback.
  1810. @example
  1811. ```js
  1812. cc.audioEngine.setFinishCallback(id, function () {});
  1813. ```
  1814. */
  1815. static setFinishCallback(audioID: number, callback: Function): void;
  1816. /**
  1817. !#en Pause playing audio.
  1818. !#zh 暂停正在播放音频。
  1819. @param audioID The return value of function play.
  1820. @example
  1821. ```js
  1822. cc.audioEngine.pause(audioID);
  1823. ```
  1824. */
  1825. static pause(audioID: number): void;
  1826. /**
  1827. !#en Pause all playing audio
  1828. !#zh 暂停现在正在播放的所有音频。
  1829. @example
  1830. ```js
  1831. cc.audioEngine.pauseAll();
  1832. ```
  1833. */
  1834. static pauseAll(): void;
  1835. /**
  1836. !#en Resume playing audio.
  1837. !#zh 恢复播放指定的音频。
  1838. @param audioID The return value of function play.
  1839. @example
  1840. ```js
  1841. cc.audioEngine.resume(audioID);
  1842. ```
  1843. */
  1844. static resume(audioID: number): void;
  1845. /**
  1846. !#en Resume all playing audio.
  1847. !#zh 恢复播放所有之前暂停的所有音频。
  1848. @example
  1849. ```js
  1850. cc.audioEngine.resumeAll();
  1851. ```
  1852. */
  1853. static resumeAll(): void;
  1854. /**
  1855. !#en Stop playing audio.
  1856. !#zh 停止播放指定音频。
  1857. @param audioID The return value of function play.
  1858. @example
  1859. ```js
  1860. cc.audioEngine.stop(audioID);
  1861. ```
  1862. */
  1863. static stop(audioID: number): void;
  1864. /**
  1865. !#en Stop all playing audio.
  1866. !#zh 停止正在播放的所有音频。
  1867. @example
  1868. ```js
  1869. cc.audioEngine.stopAll();
  1870. ```
  1871. */
  1872. static stopAll(): void;
  1873. /**
  1874. !#en Set up an audio can generate a few examples.
  1875. !#zh 设置一个音频可以设置几个实例
  1876. @param num a number of instances to be created from within an audio
  1877. @example
  1878. ```js
  1879. cc.audioEngine.setMaxAudioInstance(20);
  1880. ```
  1881. */
  1882. static setMaxAudioInstance(num: number): void;
  1883. /**
  1884. !#en Getting audio can produce several examples.
  1885. !#zh 获取一个音频可以设置几个实例
  1886. @example
  1887. ```js
  1888. cc.audioEngine.getMaxAudioInstance();
  1889. ```
  1890. */
  1891. static getMaxAudioInstance(): number;
  1892. /**
  1893. !#en Unload the preloaded audio from internal buffer.
  1894. !#zh 卸载预加载的音频。
  1895. @param clip clip
  1896. @example
  1897. ```js
  1898. cc.audioEngine.uncache(filePath);
  1899. ```
  1900. */
  1901. static uncache(clip: AudioClip): void;
  1902. /**
  1903. !#en Unload all audio from internal buffer.
  1904. !#zh 卸载所有音频。
  1905. @example
  1906. ```js
  1907. cc.audioEngine.uncacheAll();
  1908. ```
  1909. */
  1910. static uncacheAll(): void;
  1911. /**
  1912. !#en Preload audio file.
  1913. !#zh 预加载一个音频
  1914. @param filePath The file path of an audio.
  1915. @param callback The callback of an audio.
  1916. @example
  1917. ```js
  1918. cc.audioEngine.preload(path);
  1919. ```
  1920. */
  1921. static preload(filePath: string, callback?: Function): void;
  1922. /**
  1923. !#en Set a size, the unit is KB. Over this size is directly resolved into DOM nodes.
  1924. !#zh 设置一个以 KB 为单位的尺寸,大于这个尺寸的音频在加载的时候会强制使用 dom 方式加载
  1925. @param kb The file path of an audio.
  1926. @example
  1927. ```js
  1928. cc.audioEngine.setMaxWebAudioSize(300);
  1929. ```
  1930. */
  1931. static setMaxWebAudioSize(kb: number): void;
  1932. /**
  1933. !#en Play background music
  1934. !#zh 播放背景音乐
  1935. @param clip The audio clip to play.
  1936. @param loop Whether the music loop or not.
  1937. @example
  1938. ```js
  1939. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  1940. var audioID = cc.audioEngine.playMusic(clip, false);
  1941. });
  1942. ```
  1943. */
  1944. static playMusic(clip: AudioClip, loop: boolean): number;
  1945. /**
  1946. !#en Stop background music.
  1947. !#zh 停止播放背景音乐。
  1948. @example
  1949. ```js
  1950. cc.audioEngine.stopMusic();
  1951. ```
  1952. */
  1953. static stopMusic(): void;
  1954. /**
  1955. !#en Pause the background music.
  1956. !#zh 暂停播放背景音乐。
  1957. @example
  1958. ```js
  1959. cc.audioEngine.pauseMusic();
  1960. ```
  1961. */
  1962. static pauseMusic(): void;
  1963. /**
  1964. !#en Resume playing background music.
  1965. !#zh 恢复播放背景音乐。
  1966. @example
  1967. ```js
  1968. cc.audioEngine.resumeMusic();
  1969. ```
  1970. */
  1971. static resumeMusic(): void;
  1972. /**
  1973. !#en Get the volume(0.0 ~ 1.0).
  1974. !#zh 获取音量(0.0 ~ 1.0)。
  1975. @example
  1976. ```js
  1977. var volume = cc.audioEngine.getMusicVolume();
  1978. ```
  1979. */
  1980. static getMusicVolume(): number;
  1981. /**
  1982. !#en Set the background music volume.
  1983. !#zh 设置背景音乐音量(0.0 ~ 1.0)。
  1984. @param volume Volume must be in 0.0~1.0.
  1985. @example
  1986. ```js
  1987. cc.audioEngine.setMusicVolume(0.5);
  1988. ```
  1989. */
  1990. static setMusicVolume(volume: number): void;
  1991. /**
  1992. !#en Background music playing state
  1993. !#zh 背景音乐是否正在播放
  1994. @example
  1995. ```js
  1996. cc.audioEngine.isMusicPlaying();
  1997. ```
  1998. */
  1999. static isMusicPlaying(): boolean;
  2000. /**
  2001. !#en Play effect audio.
  2002. !#zh 播放音效
  2003. @param clip The audio clip to play.
  2004. @param loop Whether the music loop or not.
  2005. @example
  2006. ```js
  2007. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2008. var audioID = cc.audioEngine.playEffect(clip, false);
  2009. });
  2010. ```
  2011. */
  2012. static playEffect(clip: AudioClip, loop: boolean): number;
  2013. /**
  2014. !#en Set the volume of effect audio.
  2015. !#zh 设置音效音量(0.0 ~ 1.0)。
  2016. @param volume Volume must be in 0.0~1.0.
  2017. @example
  2018. ```js
  2019. cc.audioEngine.setEffectsVolume(0.5);
  2020. ```
  2021. */
  2022. static setEffectsVolume(volume: number): void;
  2023. /**
  2024. !#en The volume of the effect audio max value is 1.0,the min value is 0.0 .
  2025. !#zh 获取音效音量(0.0 ~ 1.0)。
  2026. @example
  2027. ```js
  2028. var volume = cc.audioEngine.getEffectsVolume();
  2029. ```
  2030. */
  2031. static getEffectsVolume(): number;
  2032. /**
  2033. !#en Pause effect audio.
  2034. !#zh 暂停播放音效。
  2035. @param audioID audio id.
  2036. @example
  2037. ```js
  2038. cc.audioEngine.pauseEffect(audioID);
  2039. ```
  2040. */
  2041. static pauseEffect(audioID: number): void;
  2042. /**
  2043. !#en Stop playing all the sound effects.
  2044. !#zh 暂停播放所有音效。
  2045. @example
  2046. ```js
  2047. cc.audioEngine.pauseAllEffects();
  2048. ```
  2049. */
  2050. static pauseAllEffects(): void;
  2051. /**
  2052. !#en Resume effect audio.
  2053. !#zh 恢复播放音效音频。
  2054. @param audioID The return value of function play.
  2055. @example
  2056. ```js
  2057. cc.audioEngine.resumeEffect(audioID);
  2058. ```
  2059. */
  2060. static resumeEffect(audioID: number): void;
  2061. /**
  2062. !#en Resume all effect audio.
  2063. !#zh 恢复播放所有之前暂停的音效。
  2064. @example
  2065. ```js
  2066. cc.audioEngine.resumeAllEffects();
  2067. ```
  2068. */
  2069. static resumeAllEffects(): void;
  2070. /**
  2071. !#en Stop playing the effect audio.
  2072. !#zh 停止播放音效。
  2073. @param audioID audio id.
  2074. @example
  2075. ```js
  2076. cc.audioEngine.stopEffect(id);
  2077. ```
  2078. */
  2079. static stopEffect(audioID: number): void;
  2080. /**
  2081. !#en Stop playing all the effects.
  2082. !#zh 停止播放所有音效。
  2083. @example
  2084. ```js
  2085. cc.audioEngine.stopAllEffects();
  2086. ```
  2087. */
  2088. static stopAllEffects(): void;
  2089. }
  2090. /** !#en Class for animation data handling.
  2091. !#zh 动画剪辑,用于存储动画数据。 */
  2092. export class AnimationClip extends Asset {
  2093. /** !#en Duration of this animation.
  2094. !#zh 动画的持续时间。 */
  2095. duration: number;
  2096. /** !#en FrameRate of this animation.
  2097. !#zh 动画的帧速率。 */
  2098. sample: number;
  2099. /** !#en Speed of this animation.
  2100. !#zh 动画的播放速度。 */
  2101. speed: number;
  2102. /** !#en WrapMode of this animation.
  2103. !#zh 动画的循环模式。 */
  2104. wrapMode: WrapMode;
  2105. /** !#en Curve data.
  2106. !#zh 曲线数据。 */
  2107. curveData: any;
  2108. /** !#en Event data.
  2109. !#zh 事件数据。 */
  2110. events: {frame: number, func: string, params: string[]}[];
  2111. /**
  2112. !#en Crate clip with a set of sprite frames
  2113. !#zh 使用一组序列帧图片来创建动画剪辑
  2114. @param spriteFrames spriteFrames
  2115. @param sample sample
  2116. @example
  2117. ```js
  2118. var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  2119. ```
  2120. */
  2121. static createWithSpriteFrames(spriteFrames: SpriteFrame[], sample: number): AnimationClip;
  2122. }
  2123. /** !#en
  2124. The AnimationState gives full control over animation playback process.
  2125. In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  2126. !#zh
  2127. AnimationState 完全控制动画播放过程。<br/>
  2128. 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 */
  2129. export class AnimationState extends Playable {
  2130. /**
  2131. @param clip clip
  2132. @param name name
  2133. */
  2134. constructor(clip: AnimationClip, name?: string);
  2135. /** !#en The curves list.
  2136. !#zh 曲线列表。 */
  2137. curves: any[];
  2138. /** !#en The start delay which represents the number of seconds from an animation's start time to the start of
  2139. the active interval.
  2140. !#zh 延迟多少秒播放。 */
  2141. delay: number;
  2142. /** !#en The animation's iteration count property.
  2143. A real number greater than or equal to zero (including positive infinity) representing the number of times
  2144. to repeat the animation node.
  2145. Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  2146. calculations.
  2147. !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) */
  2148. repeatCount: number;
  2149. /** !#en The iteration duration of this animation in seconds. (length)
  2150. !#zh 单次动画的持续时间,秒。 */
  2151. duration: number;
  2152. /** !#en The animation's playback speed. 1 is normal playback speed.
  2153. !#zh 播放速率。 */
  2154. speed: number;
  2155. /** !#en
  2156. Wrapping mode of the playing animation.
  2157. Notice : dynamic change wrapMode will reset time and repeatCount property
  2158. !#zh
  2159. 动画循环方式。
  2160. 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount */
  2161. wrapMode: WrapMode;
  2162. /** !#en The current time of this animation in seconds.
  2163. !#zh 动画当前的时间,秒。 */
  2164. time: number;
  2165. /** !#en The clip that is being played by this animation state.
  2166. !#zh 此动画状态正在播放的剪辑。 */
  2167. clip: AnimationClip;
  2168. /** !#en The name of the playing animation.
  2169. !#zh 动画的名字 */
  2170. name: string;
  2171. }
  2172. /** !#en
  2173. This class provide easing methods for {{#crossLink "tween"}}{{/crossLink}} class.<br>
  2174. Demonstratio: https://easings.net/
  2175. !#zh
  2176. 缓动函数类,为 {{#crossLink "Tween"}}{{/crossLink}} 提供缓动效果函数。<br>
  2177. 函数效果演示: https://easings.net/ */
  2178. export class Easing {
  2179. /**
  2180. !#en Easing in with quadratic formula. From slow to fast.
  2181. !#zh 平方曲线缓入函数。运动由慢到快。
  2182. @param t The current time as a percentage of the total time.
  2183. */
  2184. quadIn(t: number): number;
  2185. /**
  2186. !#en Easing out with quadratic formula. From fast to slow.
  2187. !#zh 平方曲线缓出函数。运动由快到慢。
  2188. @param t The current time as a percentage of the total time.
  2189. */
  2190. quadOut(t: number): number;
  2191. /**
  2192. !#en Easing in and out with quadratic formula. From slow to fast, then back to slow.
  2193. !#zh 平方曲线缓入缓出函数。运动由慢到快再到慢。
  2194. @param t The current time as a percentage of the total time.
  2195. */
  2196. quadInOut(t: number): number;
  2197. /**
  2198. !#en Easing in with cubic formula. From slow to fast.
  2199. !#zh 立方曲线缓入函数。运动由慢到快。
  2200. @param t The current time as a percentage of the total time.
  2201. */
  2202. cubicIn(t: number): number;
  2203. /**
  2204. !#en Easing out with cubic formula. From slow to fast.
  2205. !#zh 立方曲线缓出函数。运动由快到慢。
  2206. @param t The current time as a percentage of the total time.
  2207. */
  2208. cubicOut(t: number): number;
  2209. /**
  2210. !#en Easing in and out with cubic formula. From slow to fast, then back to slow.
  2211. !#zh 立方曲线缓入缓出函数。运动由慢到快再到慢。
  2212. @param t The current time as a percentage of the total time.
  2213. */
  2214. cubicInOut(t: number): number;
  2215. /**
  2216. !#en Easing in with quartic formula. From slow to fast.
  2217. !#zh 四次方曲线缓入函数。运动由慢到快。
  2218. @param t The current time as a percentage of the total time.
  2219. */
  2220. quartIn(t: number): number;
  2221. /**
  2222. !#en Easing out with quartic formula. From fast to slow.
  2223. !#zh 四次方曲线缓出函数。运动由快到慢。
  2224. @param t The current time as a percentage of the total time.
  2225. */
  2226. quartOut(t: number): number;
  2227. /**
  2228. !#en Easing in and out with quartic formula. From slow to fast, then back to slow.
  2229. !#zh 四次方曲线缓入缓出函数。运动由慢到快再到慢。
  2230. @param t The current time as a percentage of the total time.
  2231. */
  2232. quartInOut(t: number): number;
  2233. /**
  2234. !#en Easing in with quintic formula. From slow to fast.
  2235. !#zh 五次方曲线缓入函数。运动由慢到快。
  2236. @param t The current time as a percentage of the total time.
  2237. */
  2238. quintIn(t: number): number;
  2239. /**
  2240. !#en Easing out with quintic formula. From fast to slow.
  2241. !#zh 五次方曲线缓出函数。运动由快到慢。
  2242. @param t The current time as a percentage of the total time.
  2243. */
  2244. quintOut(t: number): number;
  2245. /**
  2246. !#en Easing in and out with quintic formula. From slow to fast, then back to slow.
  2247. !#zh 五次方曲线缓入缓出函数。运动由慢到快再到慢。
  2248. @param t The current time as a percentage of the total time.
  2249. */
  2250. quintInOut(t: number): number;
  2251. /**
  2252. !#en Easing in and out with sine formula. From slow to fast.
  2253. !#zh 正弦曲线缓入函数。运动由慢到快。
  2254. @param t The current time as a percentage of the total time.
  2255. */
  2256. sineIn(t: number): number;
  2257. /**
  2258. !#en Easing in and out with sine formula. From fast to slow.
  2259. !#zh 正弦曲线缓出函数。运动由快到慢。
  2260. @param t The current time as a percentage of the total time.
  2261. */
  2262. sineOut(t: number): number;
  2263. /**
  2264. !#en Easing in and out with sine formula. From slow to fast, then back to slow.
  2265. !#zh 正弦曲线缓入缓出函数。运动由慢到快再到慢。
  2266. @param t The current time as a percentage of the total time.
  2267. */
  2268. sineInOut(t: number): number;
  2269. /**
  2270. !#en Easing in and out with exponential formula. From slow to fast.
  2271. !#zh 指数曲线缓入函数。运动由慢到快。
  2272. @param t The current time as a percentage of the total time.
  2273. */
  2274. expoIn(t: number): number;
  2275. /**
  2276. !#en Easing in and out with exponential formula. From fast to slow.
  2277. !#zh 指数曲线缓出函数。运动由快到慢。
  2278. @param t The current time as a percentage of the total time.
  2279. */
  2280. expoOut(t: number): number;
  2281. /**
  2282. !#en Easing in and out with exponential formula. From slow to fast.
  2283. !#zh 指数曲线缓入和缓出函数。运动由慢到很快再到慢。
  2284. @param t The current time as a percentage of the total time, then back to slow.
  2285. */
  2286. expoInOut(t: number): number;
  2287. /**
  2288. !#en Easing in and out with circular formula. From slow to fast.
  2289. !#zh 循环公式缓入函数。运动由慢到快。
  2290. @param t The current time as a percentage of the total time.
  2291. */
  2292. circIn(t: number): number;
  2293. /**
  2294. !#en Easing in and out with circular formula. From fast to slow.
  2295. !#zh 循环公式缓出函数。运动由快到慢。
  2296. @param t The current time as a percentage of the total time.
  2297. */
  2298. circOut(t: number): number;
  2299. /**
  2300. !#en Easing in and out with circular formula. From slow to fast.
  2301. !#zh 指数曲线缓入缓出函数。运动由慢到很快再到慢。
  2302. @param t The current time as a percentage of the total time, then back to slow.
  2303. */
  2304. circInOut(t: number): number;
  2305. /**
  2306. !#en Easing in action with a spring oscillating effect.
  2307. !#zh 弹簧回震效果的缓入函数。
  2308. @param t The current time as a percentage of the total time.
  2309. */
  2310. elasticIn(t: number): number;
  2311. /**
  2312. !#en Easing out action with a spring oscillating effect.
  2313. !#zh 弹簧回震效果的缓出函数。
  2314. @param t The current time as a percentage of the total time.
  2315. */
  2316. elasticOut(t: number): number;
  2317. /**
  2318. !#en Easing in and out action with a spring oscillating effect.
  2319. !#zh 弹簧回震效果的缓入缓出函数。
  2320. @param t The current time as a percentage of the total time.
  2321. */
  2322. elasticInOut(t: number): number;
  2323. /**
  2324. !#en Easing in action with "back up" behavior.
  2325. !#zh 回退效果的缓入函数。
  2326. @param t The current time as a percentage of the total time.
  2327. */
  2328. backIn(t: number): number;
  2329. /**
  2330. !#en Easing out action with "back up" behavior.
  2331. !#zh 回退效果的缓出函数。
  2332. @param t The current time as a percentage of the total time.
  2333. */
  2334. backOut(t: number): number;
  2335. /**
  2336. !#en Easing in and out action with "back up" behavior.
  2337. !#zh 回退效果的缓入缓出函数。
  2338. @param t The current time as a percentage of the total time.
  2339. */
  2340. backInOut(t: number): number;
  2341. /**
  2342. !#en Easing in action with bouncing effect.
  2343. !#zh 弹跳效果的缓入函数。
  2344. @param t The current time as a percentage of the total time.
  2345. */
  2346. bounceIn(t: number): number;
  2347. /**
  2348. !#en Easing out action with bouncing effect.
  2349. !#zh 弹跳效果的缓出函数。
  2350. @param t The current time as a percentage of the total time.
  2351. */
  2352. bounceOut(t: number): number;
  2353. /**
  2354. !#en Easing in and out action with bouncing effect.
  2355. !#zh 弹跳效果的缓入缓出函数。
  2356. @param t The current time as a percentage of the total time.
  2357. */
  2358. bounceInOut(t: number): number;
  2359. /**
  2360. !#en Target will run action with smooth effect.
  2361. !#zh 平滑效果函数。
  2362. @param t The current time as a percentage of the total time.
  2363. */
  2364. smooth(t: number): number;
  2365. /**
  2366. !#en Target will run action with fade effect.
  2367. !#zh 渐褪效果函数。
  2368. @param t The current time as a percentage of the total time.
  2369. */
  2370. fade(t: number): number;
  2371. }
  2372. /** undefined */
  2373. export class Playable {
  2374. /** !#en Is playing or paused in play mode?
  2375. !#zh 当前是否正在播放。 */
  2376. isPlaying: boolean;
  2377. /** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).
  2378. !#zh 当前是否正在暂停 */
  2379. isPaused: boolean;
  2380. /**
  2381. !#en Play this animation.
  2382. !#zh 播放动画。
  2383. */
  2384. play(): void;
  2385. /**
  2386. !#en Stop this animation.
  2387. !#zh 停止动画播放。
  2388. */
  2389. stop(): void;
  2390. /**
  2391. !#en Pause this animation.
  2392. !#zh 暂停动画。
  2393. */
  2394. pause(): void;
  2395. /**
  2396. !#en Resume this animation.
  2397. !#zh 重新播放动画。
  2398. */
  2399. resume(): void;
  2400. /**
  2401. !#en Perform a single frame step.
  2402. !#zh 执行一帧动画。
  2403. */
  2404. step(): void;
  2405. }
  2406. /** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.
  2407. !#zh 动画使用的循环模式。 */
  2408. export enum WrapMode {
  2409. Default = 0,
  2410. Normal = 0,
  2411. Reverse = 0,
  2412. Loop = 0,
  2413. LoopReverse = 0,
  2414. PingPong = 0,
  2415. PingPongReverse = 0,
  2416. }
  2417. /** !#en Base class cc.Action for action classes.
  2418. !#zh Action 类是所有动作类型的基类。 */
  2419. export class Action {
  2420. /**
  2421. !#en
  2422. to copy object with deep copy.
  2423. returns a clone of action.
  2424. !#zh 返回一个克隆的动作。
  2425. */
  2426. clone(): Action;
  2427. /**
  2428. !#en
  2429. return true if the action has finished.
  2430. !#zh 如果动作已完成就返回 true。
  2431. */
  2432. isDone(): boolean;
  2433. /**
  2434. !#en get the target.
  2435. !#zh 获取当前目标节点。
  2436. */
  2437. getTarget(): Node;
  2438. /**
  2439. !#en The action will modify the target properties.
  2440. !#zh 设置目标节点。
  2441. @param target target
  2442. */
  2443. setTarget(target: Node): void;
  2444. /**
  2445. !#en get the original target.
  2446. !#zh 获取原始目标节点。
  2447. */
  2448. getOriginalTarget(): Node;
  2449. /**
  2450. !#en get tag number.
  2451. !#zh 获取用于识别动作的标签。
  2452. */
  2453. getTag(): number;
  2454. /**
  2455. !#en set tag number.
  2456. !#zh 设置标签,用于识别动作。
  2457. @param tag tag
  2458. */
  2459. setTag(tag: number): void;
  2460. /** !#en Default Action tag.
  2461. !#zh 默认动作标签。 */
  2462. static TAG_INVALID: number;
  2463. }
  2464. /** !#en
  2465. Base class actions that do have a finite time duration. <br/>
  2466. Possible actions: <br/>
  2467. - An action with a duration of 0 seconds. <br/>
  2468. - An action with a duration of 35.5 seconds.
  2469. Infinite time actions are valid
  2470. !#zh 有限时间动作,这种动作拥有时长 duration 属性。 */
  2471. export class FiniteTimeAction extends Action {
  2472. /**
  2473. !#en get duration of the action. (seconds).
  2474. !#zh 获取动作以秒为单位的持续时间。
  2475. */
  2476. getDuration(): number;
  2477. /**
  2478. !#en set duration of the action. (seconds).
  2479. !#zh 设置动作以秒为单位的持续时间。
  2480. @param duration duration
  2481. */
  2482. setDuration(duration: number): void;
  2483. /**
  2484. !#en
  2485. Returns a reversed action. <br />
  2486. For example: <br />
  2487. - The action will be x coordinates of 0 move to 100. <br />
  2488. - The reversed action will be x of 100 move to 0.
  2489. - Will be rewritten
  2490. !#zh 返回一个新的动作,执行与原动作完全相反的动作。
  2491. */
  2492. reverse(): void;
  2493. /**
  2494. !#en
  2495. to copy object with deep copy.
  2496. returns a clone of action.
  2497. !#zh 返回一个克隆的动作。
  2498. */
  2499. clone(): FiniteTimeAction;
  2500. }
  2501. /** !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions.
  2502. !#zh 即时动作,这种动作立即就会执行,继承自 FiniteTimeAction。 */
  2503. export class ActionInstant extends FiniteTimeAction {
  2504. }
  2505. /** !#en
  2506. <p> An interval action is an action that takes place within a certain period of time. <br/>
  2507. It has an start time, and a finish time. The finish time is the parameter<br/>
  2508. duration plus the start time.</p>
  2509. <p>These CCActionInterval actions have some interesting properties, like:<br/>
  2510. - They can run normally (default) <br/>
  2511. - They can run reversed with the reverse method <br/>
  2512. - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>
  2513. <p>For example, you can simulate a Ping Pong effect running the action normally and<br/>
  2514. then running it again in Reverse mode. </p>
  2515. !#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。 */
  2516. export class ActionInterval extends FiniteTimeAction {
  2517. /**
  2518. !#en Implementation of ease motion.
  2519. !#zh 缓动运动。
  2520. @param easeObj easeObj
  2521. @example
  2522. ```js
  2523. action.easing(cc.easeIn(3.0));
  2524. ```
  2525. */
  2526. easing(easeObj: any): ActionInterval;
  2527. /**
  2528. !#en
  2529. Repeats an action a number of times.
  2530. To repeat an action forever use the CCRepeatForever action.
  2531. !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。
  2532. @param times times
  2533. */
  2534. repeat(times: number): ActionInterval;
  2535. /**
  2536. !#en
  2537. Repeats an action for ever. <br/>
  2538. To repeat the an action for a limited number of times use the Repeat action. <br/>
  2539. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。
  2540. */
  2541. repeatForever(): ActionInterval;
  2542. }
  2543. /** !#en
  2544. cc.ActionManager is a class that can manage actions.<br/>
  2545. Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
  2546. which uses this class's singleton object.
  2547. But there are some cases where you might need to use this class. <br/>
  2548. Examples:<br/>
  2549. - When you want to run an action where the target is different from a CCNode.<br/>
  2550. - When you want to pause / resume the actions<br/>
  2551. !#zh
  2552. cc.ActionManager 是可以管理动作的单例类。<br/>
  2553. 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
  2554. 但也有一些情况下,您可能需要使用这个类。 <br/>
  2555. 例如:
  2556. - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
  2557. - 当你想要暂停/恢复动作时。 <br/> */
  2558. export class ActionManager {
  2559. /**
  2560. !#en
  2561. Adds an action with a target.<br/>
  2562. If the target is already present, then the action will be added to the existing target.
  2563. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
  2564. When the target is paused, the queued actions won't be 'ticked'.
  2565. !#zh
  2566. 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
  2567. 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
  2568. 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
  2569. 当目标状态的 paused 为 true,动作将不会被执行
  2570. @param action action
  2571. @param target target
  2572. @param paused paused
  2573. */
  2574. addAction(action: Action, target: Node, paused: boolean): void;
  2575. /**
  2576. !#en Removes all actions from all the targets.
  2577. !#zh 移除所有对象的所有动作。
  2578. */
  2579. removeAllActions(): void;
  2580. /**
  2581. !#en
  2582. Removes all actions from a certain target. <br/>
  2583. All the actions that belongs to the target will be removed.
  2584. !#zh
  2585. 移除指定对象上的所有动作。<br/>
  2586. 属于该目标的所有的动作将被删除。
  2587. @param target target
  2588. @param forceDelete forceDelete
  2589. */
  2590. removeAllActionsFromTarget(target: Node, forceDelete: boolean): void;
  2591. /**
  2592. !#en Removes an action given an action reference.
  2593. !#zh 移除指定的动作。
  2594. @param action action
  2595. */
  2596. removeAction(action: Action): void;
  2597. /**
  2598. !#en Removes an action given its tag and the target.
  2599. !#zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
  2600. @param tag tag
  2601. @param target target
  2602. */
  2603. removeActionByTag(tag: number, target?: Node): void;
  2604. /**
  2605. !#en Gets an action given its tag an a target.
  2606. !#zh 通过目标对象和标签获取一个动作。
  2607. @param tag tag
  2608. @param target target
  2609. */
  2610. getActionByTag(tag: number, target: Node): Action;
  2611. /**
  2612. !#en
  2613. Returns the numbers of actions that are running in a certain target. <br/>
  2614. Composable actions are counted as 1 action. <br/>
  2615. Example: <br/>
  2616. - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  2617. - If you are running 7 Sequences of 2 actions, it will return 7.
  2618. !#zh
  2619. 返回指定对象下所有正在运行的动作数量。 <br/>
  2620. 组合动作被算作一个动作。<br/>
  2621. 例如:<br/>
  2622. - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
  2623. - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
  2624. @param target target
  2625. */
  2626. getNumberOfRunningActionsInTarget(target: Node): number;
  2627. /**
  2628. !#en Pauses the target: all running actions and newly added actions will be paused.
  2629. !#zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
  2630. @param target target
  2631. */
  2632. pauseTarget(target: Node): void;
  2633. /**
  2634. !#en Resumes the target. All queued actions will be resumed.
  2635. !#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
  2636. @param target target
  2637. */
  2638. resumeTarget(target: Node): void;
  2639. /**
  2640. !#en Pauses all running actions, returning a list of targets whose actions were paused.
  2641. !#zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
  2642. */
  2643. pauseAllRunningActions(): any[];
  2644. /**
  2645. !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
  2646. !#zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
  2647. @param targetsToResume targetsToResume
  2648. */
  2649. resumeTargets(targetsToResume: any[]): void;
  2650. /**
  2651. !#en Pause a set of targets.
  2652. !#zh 暂停一组指定对象。
  2653. @param targetsToPause targetsToPause
  2654. */
  2655. pauseTargets(targetsToPause: any[]): void;
  2656. /**
  2657. !#en
  2658. purges the shared action manager. It releases the retained instance. <br/>
  2659. because it uses this, so it can not be static.
  2660. !#zh
  2661. 清除共用的动作管理器。它释放了持有的实例。 <br/>
  2662. 因为它使用 this,因此它不能是静态的。
  2663. */
  2664. purgeSharedManager(): void;
  2665. /**
  2666. !#en The ActionManager update。
  2667. !#zh ActionManager 主循环。
  2668. @param dt delta time in seconds
  2669. */
  2670. update(dt: number): void;
  2671. }
  2672. /** !#en
  2673. Tween provide a simple and flexible way to create action.
  2674. Tween's api is more flexible than cc.Action:
  2675. - Support creating an action sequence in chained api,
  2676. - Support animate any objects' any properties, not limited to node's properties.
  2677. By contrast, cc.Action needs to create a new action class to support new node property.
  2678. - Support working with cc.Action,
  2679. - Support easing and progress function.
  2680. !#zh
  2681. Tween 提供了一个简单灵活的方法来创建 action。
  2682. 相对于 Cocos 传统的 cc.Action,cc.Tween 在创建动画上要灵活非常多:
  2683. - 支持以链式结构的方式创建一个动画序列。
  2684. - 支持对任意对象的任意属性进行缓动,不再局限于节点上的属性,而 cc.Action 添加一个属性的支持时还需要添加一个新的 action 类型。
  2685. - 支持与 cc.Action 混用
  2686. - 支持设置 {{#crossLink "Easing"}}{{/crossLink}} 或者 progress 函数 */
  2687. export class Tween<T = any> {
  2688. /**
  2689. @param target target
  2690. */
  2691. constructor(target?: any);
  2692. /**
  2693. !#en Stop all tweens
  2694. !#zh 停止所有缓动
  2695. */
  2696. static stopAll(): void;
  2697. /**
  2698. !#en Stop all tweens by tag
  2699. !#zh 停止所有指定标签的缓动
  2700. @param tag tag
  2701. */
  2702. static stopAllByTag(tag: number): void;
  2703. /**
  2704. !#en Stop all tweens by target
  2705. !#zh 停止所有指定对象的缓动
  2706. @param target target
  2707. */
  2708. static stopAllByTarget(target: any): void;
  2709. /**
  2710. !#en
  2711. Insert an action or tween to this sequence
  2712. !#zh
  2713. 插入一个 action 或者 tween 到队列中
  2714. @param other other
  2715. */
  2716. then(other: Action|Tween): Tween;
  2717. /**
  2718. !#en
  2719. Set tween target
  2720. !#zh
  2721. 设置 tween 的 target
  2722. @param target target
  2723. */
  2724. target(target: any): Tween;
  2725. /**
  2726. !#en
  2727. Start this tween
  2728. !#zh
  2729. 运行当前 tween
  2730. */
  2731. start(): Tween;
  2732. /**
  2733. !#en
  2734. Stop this tween
  2735. !#zh
  2736. 停止当前 tween
  2737. */
  2738. stop(): Tween;
  2739. /**
  2740. !#en Sets tween tag
  2741. !#zh 设置缓动的标签
  2742. @param tag tag
  2743. */
  2744. tag(tag: number): Tween;
  2745. /**
  2746. !#en
  2747. Clone a tween
  2748. !#zh
  2749. 克隆当前 tween
  2750. @param target target
  2751. */
  2752. clone(target?: any): Tween;
  2753. /**
  2754. !#en
  2755. Integrate all previous actions to an action.
  2756. !#zh
  2757. 将之前所有的 action 整合为一个 action。
  2758. */
  2759. union(): Tween;
  2760. /**
  2761. !#en Sets target's position property according to the bezier curve.
  2762. !#zh 按照贝塞尔路径设置目标的 position 属性。
  2763. @param duration duration
  2764. @param c1 c1
  2765. @param c2 c2
  2766. @param to to
  2767. */
  2768. bezierTo(duration: number, c1: Vec2, c2: Vec2, to: Vec2): Tween;
  2769. /**
  2770. !#en Sets target's position property according to the bezier curve.
  2771. !#zh 按照贝塞尔路径设置目标的 position 属性。
  2772. @param duration duration
  2773. @param c1 c1
  2774. @param c2 c2
  2775. @param to to
  2776. */
  2777. bezierBy(duration: number, c1: Vec2, c2: Vec2, to: Vec2): Tween;
  2778. /**
  2779. !#en Flips target's scaleX
  2780. !#zh 翻转目标的 scaleX 属性
  2781. */
  2782. flipX(): Tween;
  2783. /**
  2784. !#en Flips target's scaleY
  2785. !#zh 翻转目标的 scaleY 属性
  2786. */
  2787. flipY(): Tween;
  2788. /**
  2789. !#en Blinks target by set target's opacity property
  2790. !#zh 通过设置目标的 opacity 属性达到闪烁效果
  2791. @param duration duration
  2792. @param times times
  2793. @param opts opts
  2794. */
  2795. blink(duration: number, times: number, opts?: {progress?: Function; easing?: Function|string; }): Tween;
  2796. /**
  2797. !#en
  2798. Add an action which calculate with absolute value
  2799. !#zh
  2800. 添加一个对属性进行绝对值计算的 action
  2801. @param duration duration
  2802. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  2803. @param opts opts
  2804. */
  2805. to <OPTS extends Partial<{progress: Function, easing: Function|String}>> (duration: number, props: ConstructorType<T>, opts?: OPTS) : Tween;
  2806. /**
  2807. !#en
  2808. Add an action which calculate with relative value
  2809. !#zh
  2810. 添加一个对属性进行相对值计算的 action
  2811. @param duration duration
  2812. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  2813. @param opts opts
  2814. */
  2815. by <OPTS extends Partial<{progress: Function, easing: Function|String}>> (duration: number, props: ConstructorType<T>, opts?: OPTS) : Tween;
  2816. /**
  2817. !#en
  2818. Directly set target properties
  2819. !#zh
  2820. 直接设置 target 的属性
  2821. @param props props
  2822. */
  2823. set (props: ConstructorType<T>) : Tween;
  2824. /**
  2825. !#en
  2826. Add an delay action
  2827. !#zh
  2828. 添加一个延时 action
  2829. @param duration duration
  2830. */
  2831. delay(duration: number): Tween;
  2832. /**
  2833. !#en
  2834. Add an callback action
  2835. !#zh
  2836. 添加一个回调 action
  2837. @param callback callback
  2838. */
  2839. call(callback: Function): Tween;
  2840. /**
  2841. !#en
  2842. Add an hide action
  2843. !#zh
  2844. 添加一个隐藏 action
  2845. */
  2846. hide(): Tween;
  2847. /**
  2848. !#en
  2849. Add an show action
  2850. !#zh
  2851. 添加一个显示 action
  2852. */
  2853. show(): Tween;
  2854. /**
  2855. !#en
  2856. Add an removeSelf action
  2857. !#zh
  2858. 添加一个移除自己 action
  2859. */
  2860. removeSelf(): Tween;
  2861. /**
  2862. !#en
  2863. Add an sequence action
  2864. !#zh
  2865. 添加一个队列 action
  2866. @param action action
  2867. @param actions actions
  2868. */
  2869. sequence(action: Action|Tween, ...actions: (Action|Tween)[]): Tween;
  2870. /**
  2871. !#en
  2872. Add an parallel action
  2873. !#zh
  2874. 添加一个并行 action
  2875. @param action action
  2876. @param actions actions
  2877. */
  2878. parallel(action: Action|Tween, ...actions: (Action|Tween)[]): Tween;
  2879. /**
  2880. !#en
  2881. Add an repeat action.
  2882. This action will integrate before actions to a sequence action as their parameters.
  2883. !#zh
  2884. 添加一个重复 action,这个 action 会将前一个动作作为他的参数。
  2885. @param repeatTimes repeatTimes
  2886. @param action action
  2887. */
  2888. repeat(repeatTimes: number, action?: Action|Tween): Tween;
  2889. /**
  2890. !#en
  2891. Add an repeat forever action
  2892. This action will integrate before actions to a sequence action as their parameters.
  2893. !#zh
  2894. 添加一个永久重复 action,这个 action 会将前一个动作作为他的参数。
  2895. @param action action
  2896. */
  2897. repeatForever(action?: Action|Tween): Tween;
  2898. /**
  2899. !#en
  2900. Add an reverse time action.
  2901. This action will integrate before actions to a sequence action as their parameters.
  2902. !#zh
  2903. 添加一个倒置时间 action,这个 action 会将前一个动作作为他的参数。
  2904. @param action action
  2905. */
  2906. reverseTime(action?: Action|Tween): Tween;
  2907. }
  2908. /** !#en An object to boot the game.
  2909. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2910. export class debug {
  2911. /**
  2912. !#en Gets error message with the error id and possible parameters.
  2913. !#zh 通过 error id 和必要的参数来获取错误信息。
  2914. @param errorId errorId
  2915. @param param param
  2916. */
  2917. static getError(errorId: string, param?: any): string;
  2918. /**
  2919. !#en Returns whether or not to display the FPS informations.
  2920. !#zh 是否显示 FPS 信息。
  2921. */
  2922. static isDisplayStats(): boolean;
  2923. /**
  2924. !#en Sets whether display the FPS on the bottom-left corner.
  2925. !#zh 设置是否在左下角显示 FPS。
  2926. @param displayStats displayStats
  2927. */
  2928. static setDisplayStats(displayStats: boolean): void;
  2929. }
  2930. /** !#en
  2931. <p>
  2932. ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
  2933. cc.director is a singleton object which manage your game's logic flow.<br/>
  2934. Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>
  2935. the standard way to use it is by calling:<br/>
  2936. - cc.director.methodName(); <br/>
  2937. It creates and handle the main Window and manages how and when to execute the Scenes.<br/>
  2938. <br/>
  2939. The cc.director is also responsible for:<br/>
  2940. - initializing the OpenGL context<br/>
  2941. - setting the OpenGL pixel format (default on is RGB565)<br/>
  2942. - setting the OpenGL buffer depth (default on is 0-bit)<br/>
  2943. - setting the color for clear screen (default one is BLACK)<br/>
  2944. - setting the projection (default one is 3D)<br/>
  2945. - setting the orientation (default one is Portrait)<br/>
  2946. <br/>
  2947. <br/>
  2948. The cc.director also sets the default OpenGL context:<br/>
  2949. - GL_TEXTURE_2D is enabled<br/>
  2950. - GL_VERTEX_ARRAY is enabled<br/>
  2951. - GL_COLOR_ARRAY is enabled<br/>
  2952. - GL_TEXTURE_COORD_ARRAY is enabled<br/>
  2953. </p>
  2954. <p>
  2955. cc.director also synchronizes timers with the refresh rate of the display.<br/>
  2956. Features and Limitations:<br/>
  2957. - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
  2958. - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
  2959. </p>
  2960. !#zh
  2961. <p>
  2962. 注意:用 cc.director 代替 cc.Director。<br/>
  2963. cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>
  2964. 由于 cc.director 是一个单例,你不需要调用任何构造函数或创建函数,<br/>
  2965. 使用它的标准方法是通过调用:<br/>
  2966. - cc.director.methodName();
  2967. <br/>
  2968. 它创建和处理主窗口并且管理什么时候执行场景。<br/>
  2969. <br/>
  2970. cc.director 还负责:<br/>
  2971. - 初始化 OpenGL 环境。<br/>
  2972. - 设置OpenGL像素格式。(默认是 RGB565)<br/>
  2973. - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>
  2974. - 设置空白场景的颜色 (默认是 黑色)<br/>
  2975. - 设置投影 (默认是 3D)<br/>
  2976. - 设置方向 (默认是 Portrait)<br/>
  2977. <br/>
  2978. cc.director 设置了 OpenGL 默认环境 <br/>
  2979. - GL_TEXTURE_2D 启用。<br/>
  2980. - GL_VERTEX_ARRAY 启用。<br/>
  2981. - GL_COLOR_ARRAY 启用。<br/>
  2982. - GL_TEXTURE_COORD_ARRAY 启用。<br/>
  2983. </p>
  2984. <p>
  2985. cc.director 也同步定时器与显示器的刷新速率。
  2986. <br/>
  2987. 特点和局限性: <br/>
  2988. - 将计时器 & 渲染与显示器的刷新频率同步。<br/>
  2989. - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>
  2990. </p> */
  2991. export class Director extends EventTarget {
  2992. /**
  2993. !#en
  2994. Converts a view coordinate to an WebGL coordinate<br/>
  2995. Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)<br/>
  2996. Implementation can be found in CCDirectorWebGL.
  2997. !#zh 将触摸点的屏幕坐标转换为 WebGL View 下的坐标。
  2998. @param uiPoint uiPoint
  2999. */
  3000. convertToGL(uiPoint: Vec2): Vec2;
  3001. /**
  3002. !#en
  3003. Converts an OpenGL coordinate to a view coordinate<br/>
  3004. Useful to convert node points to window points for calls such as glScissor<br/>
  3005. Implementation can be found in CCDirectorWebGL.
  3006. !#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。
  3007. @param glPoint glPoint
  3008. */
  3009. convertToUI(glPoint: Vec2): Vec2;
  3010. /**
  3011. End the life of director in the next frame
  3012. */
  3013. end(): void;
  3014. /**
  3015. !#en
  3016. Returns the size of the WebGL view in points.<br/>
  3017. It takes into account any possible rotation (device orientation) of the window.
  3018. !#zh 获取视图的大小,以点为单位。
  3019. */
  3020. getWinSize(): Size;
  3021. /**
  3022. !#en
  3023. Returns the size of the OpenGL view in pixels.<br/>
  3024. It takes into account any possible rotation (device orientation) of the window.<br/>
  3025. On Mac winSize and winSizeInPixels return the same value.
  3026. (The pixel here refers to the resource resolution. If you want to get the physics resolution of device, you need to use cc.view.getFrameSize())
  3027. !#zh
  3028. 获取视图大小,以像素为单位(这里的像素指的是资源分辨率。
  3029. 如果要获取屏幕物理分辨率,需要用 cc.view.getFrameSize())
  3030. */
  3031. getWinSizeInPixels(): Size;
  3032. /**
  3033. !#en Pause the director's ticker, only involve the game logic execution.
  3034. It won't pause the rendering process nor the event manager.
  3035. If you want to pause the entier game including rendering, audio and event,
  3036. please use {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}
  3037. !#zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。
  3038. 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}。
  3039. */
  3040. pause(): void;
  3041. /**
  3042. !#en
  3043. Run a scene. Replaces the running scene with a new one or enter the first scene.<br/>
  3044. The new scene will be launched immediately.
  3045. !#zh 立刻切换指定场景。
  3046. @param scene The need run scene.
  3047. @param onBeforeLoadScene The function invoked at the scene before loading.
  3048. @param onLaunched The function invoked at the scene after launch.
  3049. */
  3050. runSceneImmediate(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  3051. /**
  3052. !#en
  3053. Run a scene. Replaces the running scene with a new one or enter the first scene.
  3054. The new scene will be launched at the end of the current frame.
  3055. !#zh 运行指定场景。
  3056. @param scene The need run scene.
  3057. @param onBeforeLoadScene The function invoked at the scene before loading.
  3058. @param onLaunched The function invoked at the scene after launch.
  3059. */
  3060. runScene(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  3061. /**
  3062. !#en Loads the scene by its name.
  3063. !#zh 通过场景名称进行加载场景。
  3064. @param sceneName The name of the scene to load.
  3065. @param onLaunched callback, will be called after scene launched.
  3066. */
  3067. loadScene(sceneName: string, onLaunched?: Function): boolean;
  3068. /**
  3069. !#en
  3070. Preloads the scene to reduces loading time. You can call this method at any time you want.
  3071. After calling this method, you still need to launch the scene by `cc.director.loadScene`.
  3072. It will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not
  3073. yet finished, the scene will be launched after loaded automatically.
  3074. !#zh 预加载场景,你可以在任何时候调用这个方法。
  3075. 调用完后,你仍然需要通过 `cc.director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。
  3076. 就算预加载还没完成,你也可以直接调用 `cc.director.loadScene`,加载完成后场景就会启动。
  3077. @param sceneName The name of the scene to preload.
  3078. @param onProgress callback, will be called when the load progression change.
  3079. @param onLoaded callback, will be called after scene loaded.
  3080. */
  3081. preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error) => void): void;
  3082. /**
  3083. !#en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  3084. !#zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  3085. */
  3086. resume(): void;
  3087. /**
  3088. !#en
  3089. Enables or disables WebGL depth test.<br/>
  3090. Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
  3091. !#zh 启用/禁用深度测试(在 Canvas 渲染模式下不会生效)。
  3092. @param on on
  3093. */
  3094. setDepthTest(on: boolean): void;
  3095. /**
  3096. !#en
  3097. Set color for clear screen.<br/>
  3098. (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
  3099. !#zh
  3100. 设置场景的默认擦除颜色。<br/>
  3101. 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
  3102. @param clearColor clearColor
  3103. */
  3104. setClearColor(clearColor: Color): void;
  3105. /**
  3106. !#en Returns current logic Scene.
  3107. !#zh 获取当前逻辑场景。
  3108. @example
  3109. ```js
  3110. // This will help you to get the Canvas node in scene
  3111. cc.director.getScene().getChildByName('Canvas');
  3112. ```
  3113. */
  3114. getScene(): Scene;
  3115. /**
  3116. !#en Returns the FPS value. Please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} to control animation interval.
  3117. !#zh 获取单位帧执行时间。请使用 {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} 来控制游戏帧率。
  3118. */
  3119. getAnimationInterval(): number;
  3120. /**
  3121. Sets animation interval, this doesn't control the main loop.
  3122. To control the game's frame rate overall, please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}}
  3123. @param value The animation interval desired.
  3124. */
  3125. setAnimationInterval(value: number): void;
  3126. /**
  3127. !#en Returns the delta time since last frame.
  3128. !#zh 获取上一帧的增量时间。
  3129. */
  3130. getDeltaTime(): number;
  3131. /**
  3132. !#en Returns the total passed time since game start, unit: ms
  3133. !#zh 获取从游戏开始到现在总共经过的时间,单位为 ms
  3134. */
  3135. getTotalTime(): number;
  3136. /**
  3137. !#en Returns how many frames were called since the director started.
  3138. !#zh 获取 director 启动以来游戏运行的总帧数。
  3139. */
  3140. getTotalFrames(): number;
  3141. /**
  3142. !#en Returns whether or not the Director is paused.
  3143. !#zh 是否处于暂停状态。
  3144. */
  3145. isPaused(): boolean;
  3146. /**
  3147. !#en Returns the cc.Scheduler associated with this director.
  3148. !#zh 获取和 director 相关联的 cc.Scheduler。
  3149. */
  3150. getScheduler(): Scheduler;
  3151. /**
  3152. !#en Sets the cc.Scheduler associated with this director.
  3153. !#zh 设置和 director 相关联的 cc.Scheduler。
  3154. @param scheduler scheduler
  3155. */
  3156. setScheduler(scheduler: Scheduler): void;
  3157. /**
  3158. !#en Returns the cc.ActionManager associated with this director.
  3159. !#zh 获取和 director 相关联的 cc.ActionManager(动作管理器)。
  3160. */
  3161. getActionManager(): ActionManager;
  3162. /**
  3163. !#en Sets the cc.ActionManager associated with this director.
  3164. !#zh 设置和 director 相关联的 cc.ActionManager(动作管理器)。
  3165. @param actionManager actionManager
  3166. */
  3167. setActionManager(actionManager: ActionManager): void;
  3168. /**
  3169. !#en Returns the cc.CollisionManager associated with this director.
  3170. !#zh 获取和 director 相关联的 cc.CollisionManager (碰撞管理器)。
  3171. */
  3172. getCollisionManager(): CollisionManager;
  3173. /**
  3174. !#en Returns the cc.PhysicsManager associated with this director.
  3175. !#zh 返回与 director 相关联的 cc.PhysicsManager (物理管理器)。
  3176. */
  3177. getPhysicsManager(): PhysicsManager;
  3178. /**
  3179. !#en Returns the cc.Physics3DManager associated with this director.
  3180. !#zh 返回与 director 相关联的 cc.Physics3DManager (物理管理器)。
  3181. */
  3182. getPhysics3DManager(): Physics3DManager;
  3183. /** !#en The event projection changed of cc.Director. This event will not get triggered since v2.0
  3184. !#zh cc.Director 投影变化的事件。从 v2.0 开始这个事件不会再被触发 */
  3185. static EVENT_PROJECTION_CHANGED: string;
  3186. /** !#en The event which will be triggered before loading a new scene.
  3187. !#zh 加载新场景之前所触发的事件。 */
  3188. static EVENT_BEFORE_SCENE_LOADING: string;
  3189. /** !#en The event which will be triggered before launching a new scene.
  3190. !#zh 运行新场景之前所触发的事件。 */
  3191. static EVENT_BEFORE_SCENE_LAUNCH: string;
  3192. /** !#en The event which will be triggered after launching a new scene.
  3193. !#zh 运行新场景之后所触发的事件。 */
  3194. static EVENT_AFTER_SCENE_LAUNCH: string;
  3195. /** !#en The event which will be triggered at the beginning of every frame.
  3196. !#zh 每个帧的开始时所触发的事件。 */
  3197. static EVENT_BEFORE_UPDATE: string;
  3198. /** !#en The event which will be triggered after engine and components update logic.
  3199. !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 */
  3200. static EVENT_AFTER_UPDATE: string;
  3201. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3202. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3203. static EVENT_BEFORE_VISIT: string;
  3204. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3205. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3206. static EVENT_AFTER_VISIT: string;
  3207. /** !#en The event which will be triggered before the rendering process.
  3208. !#zh 渲染过程之前所触发的事件。 */
  3209. static EVENT_BEFORE_DRAW: string;
  3210. /** !#en The event which will be triggered after the rendering process.
  3211. !#zh 渲染过程之后所触发的事件。 */
  3212. static EVENT_AFTER_DRAW: string;
  3213. /** Constant for 2D projection (orthogonal projection) */
  3214. static PROJECTION_2D: number;
  3215. /** Constant for 3D projection with a fovy=60, znear=0.5f and zfar=1500. */
  3216. static PROJECTION_3D: number;
  3217. /** Constant for custom projection, if cc.Director's projection set to it, it calls "updateProjection" on the projection delegate. */
  3218. static PROJECTION_CUSTOM: number;
  3219. /** Constant for default projection of cc.Director, default projection is 2D projection */
  3220. static PROJECTION_DEFAULT: number;
  3221. }
  3222. /** !#en An object to boot the game.
  3223. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  3224. export class Game extends EventTarget {
  3225. /** !#en Event triggered when game hide to background.
  3226. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3227. on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  3228. !#zh 游戏进入后台时触发的事件。
  3229. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3230. 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。 */
  3231. EVENT_HIDE: string;
  3232. /** !#en Event triggered when game back to foreground
  3233. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3234. on native platforms, it corresponds to enter foreground event.
  3235. !#zh 游戏进入前台运行时触发的事件。
  3236. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3237. 在原生平台,它对应的是应用被切换到前台事件。 */
  3238. EVENT_SHOW: string;
  3239. /** !#en Event triggered when game restart
  3240. !#zh 调用restart后,触发事件。 */
  3241. EVENT_RESTART: string;
  3242. /** Event triggered after game inited, at this point all engine objects and game scripts are loaded */
  3243. EVENT_GAME_INITED: string;
  3244. /** Event triggered after engine inited, at this point you will be able to use all engine classes.
  3245. It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0 */
  3246. EVENT_ENGINE_INITED: string;
  3247. /** Web Canvas 2d API as renderer backend */
  3248. RENDER_TYPE_CANVAS: number;
  3249. /** WebGL API as renderer backend */
  3250. RENDER_TYPE_WEBGL: number;
  3251. /** OpenGL API as renderer backend */
  3252. RENDER_TYPE_OPENGL: number;
  3253. /** !#en The outer frame of the game canvas, parent of game container.
  3254. !#zh 游戏画布的外框,container 的父容器。 */
  3255. frame: any;
  3256. /** !#en The container of game canvas.
  3257. !#zh 游戏画布的容器。 */
  3258. container: HTMLDivElement;
  3259. /** !#en The canvas of the game.
  3260. !#zh 游戏的画布。 */
  3261. canvas: HTMLCanvasElement;
  3262. /** !#en The renderer backend of the game.
  3263. !#zh 游戏的渲染器类型。 */
  3264. renderType: number;
  3265. /** !#en
  3266. The current game configuration, including:<br/>
  3267. 1. debugMode<br/>
  3268. "debugMode" possible values :<br/>
  3269. 0 - No message will be printed. <br/>
  3270. 1 - cc.error, cc.assert, cc.warn, cc.log will print in console. <br/>
  3271. 2 - cc.error, cc.assert, cc.warn will print in console. <br/>
  3272. 3 - cc.error, cc.assert will print in console. <br/>
  3273. 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>
  3274. 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web. <br/>
  3275. 6 - cc.error, cc.assert will print on canvas, available only on web. <br/>
  3276. 2. showFPS<br/>
  3277. Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.<br/>
  3278. 3. exposeClassName<br/>
  3279. Expose class name to chrome debug tools, the class intantiate performance is a little bit slower when exposed.<br/>
  3280. 4. frameRate<br/>
  3281. "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>
  3282. 5. id<br/>
  3283. "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.<br/>
  3284. 6. renderMode<br/>
  3285. "renderMode" sets the renderer type, only useful on web :<br/>
  3286. 0 - Automatically chosen by engine<br/>
  3287. 1 - Forced to use canvas renderer<br/>
  3288. 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>
  3289. <br/>
  3290. Please DO NOT modify this object directly, it won't have any effect.<br/>
  3291. !#zh
  3292. 当前的游戏配置,包括: <br/>
  3293. 1. debugMode(debug 模式,但是在浏览器中这个选项会被忽略) <br/>
  3294. "debugMode" 各种设置选项的意义。 <br/>
  3295. 0 - 没有消息被打印出来。 <br/>
  3296. 1 - cc.error,cc.assert,cc.warn,cc.log 将打印在 console 中。 <br/>
  3297. 2 - cc.error,cc.assert,cc.warn 将打印在 console 中。 <br/>
  3298. 3 - cc.error,cc.assert 将打印在 console 中。 <br/>
  3299. 4 - cc.error,cc.assert,cc.warn,cc.log 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3300. 5 - cc.error,cc.assert,cc.warn 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3301. 6 - cc.error,cc.assert 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3302. 2. showFPS(显示 FPS) <br/>
  3303. 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。 <br/>
  3304. 3. exposeClassName <br/>
  3305. 暴露类名让 Chrome DevTools 可以识别,如果开启会稍稍降低类的创建过程的性能,但对对象构造没有影响。 <br/>
  3306. 4. frameRate (帧率) <br/>
  3307. “frameRate” 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。 <br/>
  3308. 5. id <br/>
  3309. "gameCanvas" Web 页面上的 Canvas Element ID,仅适用于 web 端。 <br/>
  3310. 6. renderMode(渲染模式) <br/>
  3311. “renderMode” 设置渲染器类型,仅适用于 web 端: <br/>
  3312. 0 - 通过引擎自动选择。 <br/>
  3313. 1 - 强制使用 canvas 渲染。
  3314. 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。 <br/>
  3315. <br/>
  3316. 注意:请不要直接修改这个对象,它不会有任何效果。 */
  3317. config: any;
  3318. /**
  3319. !#en Callback when the scripts of engine have been load.
  3320. !#zh 当引擎完成启动后的回调函数。
  3321. */
  3322. onStart(): void;
  3323. /**
  3324. !#en Set frame rate of game.
  3325. !#zh 设置游戏帧率。
  3326. @param frameRate frameRate
  3327. */
  3328. setFrameRate(frameRate: number): void;
  3329. /**
  3330. !#en Get frame rate set for the game, it doesn't represent the real frame rate.
  3331. !#zh 获取设置的游戏帧率(不等同于实际帧率)。
  3332. */
  3333. getFrameRate(): number;
  3334. /**
  3335. !#en Run the game frame by frame.
  3336. !#zh 执行一帧游戏循环。
  3337. */
  3338. step(): void;
  3339. /**
  3340. !#en Pause the game main loop. This will pause:
  3341. game logic execution, rendering process, event manager, background music and all audio effects.
  3342. This is different with cc.director.pause which only pause the game logic execution.
  3343. !#zh 暂停游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。这点和只暂停游戏逻辑的 cc.director.pause 不同。
  3344. */
  3345. pause(): void;
  3346. /**
  3347. !#en Resume the game from pause. This will resume:
  3348. game logic execution, rendering process, event manager, background music and all audio effects.
  3349. !#zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  3350. */
  3351. resume(): void;
  3352. /**
  3353. !#en Check whether the game is paused.
  3354. !#zh 判断游戏是否暂停。
  3355. */
  3356. isPaused(): boolean;
  3357. /**
  3358. !#en Restart game.
  3359. !#zh 重新开始游戏
  3360. */
  3361. restart(): void;
  3362. /**
  3363. !#en End game, it will close the game window
  3364. !#zh 退出游戏
  3365. */
  3366. end(): void;
  3367. /**
  3368. !#en
  3369. Register an callback of a specific event type on the game object.
  3370. This type of event should be triggered via `emit`.
  3371. !#zh
  3372. 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  3373. @param type A string representing the event type to listen for.
  3374. @param callback The callback that will be invoked when the event is dispatched.
  3375. The callback is ignored if it is a duplicate (the callbacks are unique).
  3376. @param target The target (this object) to invoke the callback, can be null
  3377. */
  3378. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3379. /**
  3380. !#en
  3381. Register an callback of a specific event type on the game object,
  3382. the callback will remove itself after the first time it is triggered.
  3383. !#zh
  3384. 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3385. @param type A string representing the event type to listen for.
  3386. @param callback The callback that will be invoked when the event is dispatched.
  3387. The callback is ignored if it is a duplicate (the callbacks are unique).
  3388. @param target The target (this object) to invoke the callback, can be null
  3389. */
  3390. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  3391. /**
  3392. !#en Prepare game.
  3393. !#zh 准备引擎,请不要直接调用这个函数。
  3394. @param cb cb
  3395. */
  3396. prepare(cb: Function): void;
  3397. /**
  3398. !#en Run game with configuration object and onStart function.
  3399. !#zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  3400. @param config Pass configuration object or onStart function
  3401. @param onStart function to be executed after game initialized
  3402. */
  3403. run(config: any, onStart: Function): void;
  3404. /**
  3405. !#en
  3406. Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>
  3407. The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  3408. !#zh
  3409. 声明常驻根节点,该节点不会被在场景切换中被销毁。<br/>
  3410. 目标节点必须位于为层级的根节点,否则无效。
  3411. @param node The node to be made persistent
  3412. */
  3413. addPersistRootNode(node: Node): void;
  3414. /**
  3415. !#en Remove a persistent root node.
  3416. !#zh 取消常驻根节点。
  3417. @param node The node to be removed from persistent node list
  3418. */
  3419. removePersistRootNode(node: Node): void;
  3420. /**
  3421. !#en Check whether the node is a persistent root node.
  3422. !#zh 检查节点是否是常驻根节点。
  3423. @param node The node to be checked
  3424. */
  3425. isPersistRootNode(node: Node): boolean;
  3426. }
  3427. /** !#en
  3428. Class of all entities in Cocos Creator scenes.<br/>
  3429. For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
  3430. !#zh
  3431. Cocos Creator 场景中的所有节点类。<br/>
  3432. 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。 */
  3433. export class Node extends _BaseNode {
  3434. /** !#en
  3435. Group index of node.<br/>
  3436. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3437. !#zh
  3438. 节点的分组索引。<br/>
  3439. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3440. groupIndex: number;
  3441. /** !#en
  3442. Group of node.<br/>
  3443. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3444. !#zh
  3445. 节点的分组。<br/>
  3446. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3447. group: string;
  3448. /** !#en The position (x, y) of the node in its parent's coordinates.
  3449. !#zh 节点在父节点坐标系中的位置(x, y)。 */
  3450. position: Vec3;
  3451. /** !#en x axis position of node.
  3452. !#zh 节点 X 轴坐标。 */
  3453. x: number;
  3454. /** !#en y axis position of node.
  3455. !#zh 节点 Y 轴坐标。 */
  3456. y: number;
  3457. /** !#en z axis position of node.
  3458. !#zh 节点 Z 轴坐标。 */
  3459. z: number;
  3460. /** !#en Rotation of node.
  3461. !#zh 该节点旋转角度。 */
  3462. rotation: number;
  3463. /** !#en
  3464. Angle of node, the positive value is anti-clockwise direction.
  3465. !#zh
  3466. 该节点的旋转角度,正值为逆时针方向。 */
  3467. angle: number;
  3468. /** !#en The rotation as Euler angles in degrees, used in 3D node.
  3469. !#zh 该节点的欧拉角度,用于 3D 节点。 */
  3470. eulerAngles: Vec3;
  3471. /** !#en Rotation on x axis.
  3472. !#zh 该节点 X 轴旋转角度。 */
  3473. rotationX: number;
  3474. /** !#en Rotation on y axis.
  3475. !#zh 该节点 Y 轴旋转角度。 */
  3476. rotationY: number;
  3477. /** !#en The local scale relative to the parent.
  3478. !#zh 节点相对父节点的缩放。 */
  3479. scale: number;
  3480. /** !#en Scale on x axis.
  3481. !#zh 节点 X 轴缩放。 */
  3482. scaleX: number;
  3483. /** !#en Scale on y axis.
  3484. !#zh 节点 Y 轴缩放。 */
  3485. scaleY: number;
  3486. /** !#en Scale on z axis.
  3487. !#zh 节点 Z 轴缩放。 */
  3488. scaleZ: number;
  3489. /** !#en Skew x
  3490. !#zh 该节点 X 轴倾斜角度。 */
  3491. skewX: number;
  3492. /** !#en Skew y
  3493. !#zh 该节点 Y 轴倾斜角度。 */
  3494. skewY: number;
  3495. /** !#en Opacity of node, default value is 255.
  3496. !#zh 节点透明度,默认值为 255。 */
  3497. opacity: number;
  3498. /** !#en Color of node, default value is white: (255, 255, 255).
  3499. !#zh 节点颜色。默认为白色,数值为:(255,255,255)。 */
  3500. color: Color;
  3501. /** !#en Anchor point's position on x axis.
  3502. !#zh 节点 X 轴锚点位置。 */
  3503. anchorX: number;
  3504. /** !#en Anchor point's position on y axis.
  3505. !#zh 节点 Y 轴锚点位置。 */
  3506. anchorY: number;
  3507. /** !#en Width of node.
  3508. !#zh 节点宽度。 */
  3509. width: number;
  3510. /** !#en Height of node.
  3511. !#zh 节点高度。 */
  3512. height: number;
  3513. /** !#en zIndex is the 'key' used to sort the node relative to its siblings.<br/>
  3514. The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.<br/>
  3515. The Node's parent will sort all its children based on the zIndex value and the arrival order.<br/>
  3516. Nodes with greater zIndex will be sorted after nodes with smaller zIndex.<br/>
  3517. If two nodes have the same zIndex, then the node that was added first to the children's array will be in front of the other node in the array.<br/>
  3518. Node's order in children list will affect its rendering order. Parent is always rendering before all children.
  3519. !#zh zIndex 是用来对节点进行排序的关键属性,它决定一个节点在兄弟节点之间的位置。<br/>
  3520. zIndex 的取值应该介于 cc.macro.MIN_ZINDEX 和 cc.macro.MAX_ZINDEX 之间
  3521. 父节点主要根据节点的 zIndex 和添加次序来排序,拥有更高 zIndex 的节点将被排在后面,如果两个节点的 zIndex 一致,先添加的节点会稳定排在另一个节点之前。<br/>
  3522. 节点在 children 中的顺序决定了其渲染顺序。父节点永远在所有子节点之前被渲染 */
  3523. zIndex: number;
  3524. /** !#en
  3525. Switch 2D/3D node. The 2D nodes will run faster.
  3526. !#zh
  3527. 切换 2D/3D 节点,2D 节点会有更高的运行效率 */
  3528. is3DNode: boolean;
  3529. /** !#en Returns a normalized vector representing the up direction (Y axis) of the node in world space.
  3530. !#zh 获取节点正上方(y 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3531. up: Vec3;
  3532. /** !#en Returns a normalized vector representing the right direction (X axis) of the node in world space.
  3533. !#zh 获取节点正右方(x 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3534. right: Vec3;
  3535. /** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
  3536. !#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3537. forward: Vec3;
  3538. /**
  3539. @param name name
  3540. */
  3541. constructor(name?: string);
  3542. /**
  3543. !#en
  3544. Register a callback of a specific event type on Node.<br/>
  3545. Use this method to register touch or mouse event permit propagation based on scene graph,<br/>
  3546. These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:<br/>
  3547. 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target<br/>
  3548. 2. At target phase: dispatch to the listeners of the real target<br/>
  3549. 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root<br/>
  3550. In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.<br/>
  3551. It's the recommended way to register touch/mouse event for Node,<br/>
  3552. please do not use cc.eventManager directly for Node.<br/>
  3553. You can also register custom event and use `emit` to trigger custom event on Node.<br/>
  3554. For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node.<br/>
  3555. You can also pass event callback parameters with `emit` by passing parameters after `type`.
  3556. !#zh
  3557. 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。<br/>
  3558. 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:<br/>
  3559. 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。<br/>
  3560. 2. 目标阶段:派发给目标节点的监听器。<br/>
  3561. 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发直到根节点。<br/>
  3562. 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
  3563. 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。<br/>
  3564. 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器<br/>
  3565. 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  3566. @param type A string representing the event type to listen for.<br>See {{#crossLink "Node/EventTyupe/POSITION_CHANGED"}}Node Events{{/crossLink}} for all builtin events.
  3567. @param callback The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).
  3568. @param target The target (this object) to invoke the callback, can be null
  3569. @param useCapture When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
  3570. @example
  3571. ```js
  3572. this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  3573. node.on(cc.Node.EventType.TOUCH_START, callback, this);
  3574. node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
  3575. node.on(cc.Node.EventType.TOUCH_END, callback, this);
  3576. node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
  3577. node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3578. node.on(cc.Node.EventType.COLOR_CHANGED, callback);
  3579. ```
  3580. */
  3581. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3582. /**
  3583. !#en
  3584. Register an callback of a specific event type on the Node,
  3585. the callback will remove itself after the first time it is triggered.
  3586. !#zh
  3587. 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3588. @param type A string representing the event type to listen for.
  3589. @param callback The callback that will be invoked when the event is dispatched.
  3590. The callback is ignored if it is a duplicate (the callbacks are unique).
  3591. @param target The target (this object) to invoke the callback, can be null
  3592. @example
  3593. ```js
  3594. node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3595. ```
  3596. */
  3597. once<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3598. /**
  3599. !#en
  3600. Removes the callback previously registered with the same type, callback, target and or useCapture.
  3601. This method is merely an alias to removeEventListener.
  3602. !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  3603. @param type A string representing the event type being removed.
  3604. @param callback The callback to remove.
  3605. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  3606. @param useCapture When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
  3607. @example
  3608. ```js
  3609. this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
  3610. node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
  3611. node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
  3612. ```
  3613. */
  3614. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  3615. /**
  3616. !#en Removes all callbacks previously registered with the same target.
  3617. !#zh 移除目标上的所有注册事件。
  3618. @param target The target to be searched for all related callbacks
  3619. @example
  3620. ```js
  3621. node.targetOff(target);
  3622. ```
  3623. */
  3624. targetOff(target: any): void;
  3625. /**
  3626. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  3627. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  3628. @param type The type of event.
  3629. */
  3630. hasEventListener(type: string): boolean;
  3631. /**
  3632. !#en
  3633. Trigger an event directly with the event name and necessary arguments.
  3634. !#zh
  3635. 通过事件名发送自定义事件
  3636. @param type event type
  3637. @param arg1 First argument in callback
  3638. @param arg2 Second argument in callback
  3639. @param arg3 Third argument in callback
  3640. @param arg4 Fourth argument in callback
  3641. @param arg5 Fifth argument in callback
  3642. @example
  3643. ```js
  3644. eventTarget.emit('fire', event);
  3645. eventTarget.emit('fire', message, emitter);
  3646. ```
  3647. */
  3648. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  3649. /**
  3650. !#en
  3651. Dispatches an event into the event flow.
  3652. The event target is the EventTarget object upon which the dispatchEvent() method is called.
  3653. !#zh 分发事件到事件流中。
  3654. @param event The Event object that is dispatched into the event flow
  3655. */
  3656. dispatchEvent(event: Event): void;
  3657. /**
  3658. !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
  3659. If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree.
  3660. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3661. !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3662. 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  3663. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3664. @param recursive Whether to pause node system events on the sub node tree.
  3665. @example
  3666. ```js
  3667. node.pauseSystemEvents(true);
  3668. ```
  3669. */
  3670. pauseSystemEvents(recursive: boolean): void;
  3671. /**
  3672. !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
  3673. If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree.
  3674. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3675. !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3676. 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  3677. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3678. @param recursive Whether to resume node system events on the sub node tree.
  3679. @example
  3680. ```js
  3681. node.resumeSystemEvents(true);
  3682. ```
  3683. */
  3684. resumeSystemEvents(recursive: boolean): void;
  3685. /**
  3686. !#en
  3687. Executes an action, and returns the action that is executed.<br/>
  3688. The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
  3689. Calling runAction while the node is not active won't have any effect. <br/>
  3690. Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
  3691. if you want to modify, when you define action plus.
  3692. !#zh
  3693. 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
  3694. 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
  3695. 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
  3696. @param action action
  3697. @example
  3698. ```js
  3699. var action = cc.scaleTo(0.2, 1, 0.6);
  3700. node.runAction(action);
  3701. node.runAction(action).repeatForever(); // fail
  3702. node.runAction(action.repeatForever()); // right
  3703. ```
  3704. */
  3705. runAction(action: Action): Action;
  3706. /**
  3707. !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
  3708. !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
  3709. @example
  3710. ```js
  3711. node.pauseAllActions();
  3712. ```
  3713. */
  3714. pauseAllActions(): void;
  3715. /**
  3716. !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
  3717. !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
  3718. @example
  3719. ```js
  3720. node.resumeAllActions();
  3721. ```
  3722. */
  3723. resumeAllActions(): void;
  3724. /**
  3725. !#en Stops and removes all actions from the running action list .
  3726. !#zh 停止并且移除所有正在运行的动作列表。
  3727. @example
  3728. ```js
  3729. node.stopAllActions();
  3730. ```
  3731. */
  3732. stopAllActions(): void;
  3733. /**
  3734. !#en Stops and removes an action from the running action list.
  3735. !#zh 停止并移除指定的动作。
  3736. @param action An action object to be removed.
  3737. @example
  3738. ```js
  3739. var action = cc.scaleTo(0.2, 1, 0.6);
  3740. node.stopAction(action);
  3741. ```
  3742. */
  3743. stopAction(action: Action): void;
  3744. /**
  3745. !#en Removes an action from the running action list by its tag.
  3746. !#zh 停止并且移除指定标签的动作。
  3747. @param tag A tag that indicates the action to be removed.
  3748. @example
  3749. ```js
  3750. node.stopActionByTag(1);
  3751. ```
  3752. */
  3753. stopActionByTag(tag: number): void;
  3754. /**
  3755. !#en Returns an action from the running action list by its tag.
  3756. !#zh 通过标签获取指定动作。
  3757. @param tag tag
  3758. @example
  3759. ```js
  3760. var action = node.getActionByTag(1);
  3761. ```
  3762. */
  3763. getActionByTag(tag: number): Action;
  3764. /**
  3765. !#en
  3766. Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
  3767. Composable actions are counted as 1 action. Example:<br/>
  3768. If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  3769. If you are running 7 Sequences of 2 actions, it will return 7.</p>
  3770. !#zh
  3771. 获取运行着的动作加上正在调度运行的动作的总数。<br/>
  3772. 例如:<br/>
  3773. - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。<br/>
  3774. - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。<br/>
  3775. @example
  3776. ```js
  3777. var count = node.getNumberOfRunningActions();
  3778. cc.log("Running Action Count: " + count);
  3779. ```
  3780. */
  3781. getNumberOfRunningActions(): number;
  3782. /**
  3783. !#en
  3784. Returns a copy of the position (x, y, z) of the node in its parent's coordinates.
  3785. You can pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3786. !#zh
  3787. 获取节点在父节点坐标系中的位置(x, y, z)。
  3788. 你可以传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3789. @param out The return value to receive position
  3790. @example
  3791. ```js
  3792. cc.log("Node Position: " + node.getPosition());
  3793. ```
  3794. */
  3795. getPosition(out?: Vec2|Vec3): Vec2;
  3796. /**
  3797. !#en
  3798. Sets the position (x, y, z) of the node in its parent's coordinates.<br/>
  3799. Usually we use cc.v2(x, y) to compose cc.Vec2 object,<br/>
  3800. and passing two numbers (x, y) is more efficient than passing cc.Vec2 object.
  3801. For 3D node we can use cc.v3(x, y, z) to compose cc.Vec3 object,<br/>
  3802. and passing three numbers (x, y, z) is more efficient than passing cc.Vec3 object.
  3803. !#zh
  3804. 设置节点在父节点坐标系中的位置。<br/>
  3805. 可以通过下面的方式设置坐标点:<br/>
  3806. 1. 传入 2 个数值 x, y。<br/>
  3807. 2. 传入 cc.v2(x, y) 类型为 cc.Vec2 的对象。
  3808. 3. 对于 3D 节点可以传入 3 个数值 x, y, z。<br/>
  3809. 4. 对于 3D 节点可以传入 cc.v3(x, y, z) 类型为 cc.Vec3 的对象。
  3810. @param newPosOrX X coordinate for position or the position (x, y, z) of the node in coordinates
  3811. @param y Y coordinate for position
  3812. @param z Z coordinate for position
  3813. */
  3814. setPosition(newPosOrX: Vec2|Vec3|number, y?: number, z?: number): void;
  3815. /**
  3816. !#en
  3817. Returns the scale factor of the node.
  3818. Need pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3819. !#zh 获取节点的缩放,需要传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3820. @param out out
  3821. @example
  3822. ```js
  3823. cc.log("Node Scale: " + node.getScale(cc.v3()));
  3824. ```
  3825. */
  3826. getScale(out: Vec2|Vec3): Vec2;
  3827. /**
  3828. !#en
  3829. Sets the scale of axis in local coordinates of the node.
  3830. You can operate 2 axis in 2D node, and 3 axis in 3D node.
  3831. !#zh
  3832. 设置节点在本地坐标系中坐标轴上的缩放比例。
  3833. 2D 节点可以操作两个坐标轴,而 3D 节点可以操作三个坐标轴。
  3834. @param x scaleX or scale object
  3835. @param y y
  3836. @param z z
  3837. @example
  3838. ```js
  3839. node.setScale(cc.v2(2, 2));
  3840. node.setScale(cc.v3(2, 2, 2)); // for 3D node
  3841. node.setScale(2);
  3842. ```
  3843. */
  3844. setScale(x: number|Vec2|Vec3, y?: number, z?: number): void;
  3845. /**
  3846. !#en
  3847. Get rotation of node (in quaternion).
  3848. Need pass a cc.Quat as the argument to receive the return values.
  3849. !#zh
  3850. 获取该节点的 quaternion 旋转角度,需要传一个 cc.Quat 作为参数来接收返回值。
  3851. @param out out
  3852. */
  3853. getRotation(out: Quat): Quat;
  3854. /**
  3855. !#en Set rotation of node (in quaternion).
  3856. !#zh 设置该节点的 quaternion 旋转角度。
  3857. @param quat Quaternion object represents the rotation or the x value of quaternion
  3858. @param y y value of quternion
  3859. @param z z value of quternion
  3860. @param w w value of quternion
  3861. */
  3862. setRotation(quat: Quat|number, y?: number, z?: number, w?: number): void;
  3863. /**
  3864. !#en
  3865. Returns a copy the untransformed size of the node. <br/>
  3866. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3867. All nodes has a size. Layer and Scene has the same size of the screen by default. <br/>
  3868. !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
  3869. @example
  3870. ```js
  3871. cc.log("Content Size: " + node.getContentSize());
  3872. ```
  3873. */
  3874. getContentSize(): Size;
  3875. /**
  3876. !#en
  3877. Sets the untransformed size of the node.<br/>
  3878. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3879. All nodes has a size. Layer and Scene has the same size of the screen.
  3880. !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
  3881. @param size The untransformed size of the node or The untransformed size's width of the node.
  3882. @param height The untransformed size's height of the node.
  3883. @example
  3884. ```js
  3885. node.setContentSize(cc.size(100, 100));
  3886. node.setContentSize(100, 100);
  3887. ```
  3888. */
  3889. setContentSize(size: Size|number, height?: number): void;
  3890. /**
  3891. !#en
  3892. Returns a copy of the anchor point.<br/>
  3893. Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
  3894. It's like a pin in the node where it is "attached" to its parent. <br/>
  3895. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
  3896. But you can use values higher than (1,1) and lower than (0,0) too. <br/>
  3897. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3898. !#zh
  3899. 获取节点锚点,用百分比表示。<br/>
  3900. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3901. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3902. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3903. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3904. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3905. @example
  3906. ```js
  3907. cc.log("Node AnchorPoint: " + node.getAnchorPoint());
  3908. ```
  3909. */
  3910. getAnchorPoint(): Vec2;
  3911. /**
  3912. !#en
  3913. Sets the anchor point in percent. <br/>
  3914. anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  3915. It's like a pin in the node where it is "attached" to its parent. <br/>
  3916. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  3917. But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  3918. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3919. !#zh
  3920. 设置锚点的百分比。<br/>
  3921. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3922. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3923. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3924. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3925. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3926. @param point The anchor point of node or The x axis anchor of node.
  3927. @param y The y axis anchor of node.
  3928. @example
  3929. ```js
  3930. node.setAnchorPoint(cc.v2(1, 1));
  3931. node.setAnchorPoint(1, 1);
  3932. ```
  3933. */
  3934. setAnchorPoint(point: Vec2|number, y?: number): void;
  3935. /**
  3936. !#en Set rotation by lookAt target point, normally used by Camera Node
  3937. !#zh 通过观察目标来设置 rotation,一般用于 Camera Node 上
  3938. @param pos pos
  3939. @param up default is (0,1,0)
  3940. */
  3941. lookAt(pos: Vec3, up?: Vec3): void;
  3942. /**
  3943. !#en
  3944. Get the local transform matrix (4x4), based on parent node coordinates
  3945. !#zh 返回局部空间坐标系的矩阵,基于父节点坐标系。
  3946. @param out The matrix object to be filled with data
  3947. @example
  3948. ```js
  3949. let mat4 = cc.mat4();
  3950. node.getLocalMatrix(mat4);
  3951. ```
  3952. */
  3953. getLocalMatrix(out: Mat4): Mat4;
  3954. /**
  3955. !#en
  3956. Get the world transform matrix (4x4)
  3957. !#zh 返回世界空间坐标系的矩阵。
  3958. @param out The matrix object to be filled with data
  3959. @example
  3960. ```js
  3961. let mat4 = cc.mat4();
  3962. node.getWorldMatrix(mat4);
  3963. ```
  3964. */
  3965. getWorldMatrix(out: Mat4): Mat4;
  3966. /**
  3967. !#en
  3968. Converts a Point to node (local) space coordinates.
  3969. !#zh
  3970. 将一个点转换到节点 (局部) 空间坐标系。
  3971. @param worldPoint worldPoint
  3972. @param out out
  3973. @example
  3974. ```js
  3975. var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
  3976. var newVec3 = node.convertToNodeSpaceAR(cc.v3(100, 100, 100));
  3977. ```
  3978. */
  3979. convertToNodeSpaceAR<T extends cc.Vec2 | cc.Vec3>(worldPoint: T, out?: T): T;
  3980. /**
  3981. !#en
  3982. Converts a Point in node coordinates to world space coordinates.
  3983. !#zh
  3984. 将节点坐标系下的一个点转换到世界空间坐标系。
  3985. @param nodePoint nodePoint
  3986. @param out out
  3987. @example
  3988. ```js
  3989. var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
  3990. var newVec3 = node.convertToWorldSpaceAR(cc.v3(100, 100, 100));
  3991. ```
  3992. */
  3993. convertToWorldSpaceAR<T extends cc.Vec2 | cc.Vec3>(nodePoint: T, out?: T): T;
  3994. /**
  3995. !#en Converts a Point to node (local) space coordinates then add the anchor point position.
  3996. So the return position will be related to the left bottom corner of the node's bounding box.
  3997. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
  3998. !#zh 将一个点转换到节点 (局部) 坐标系,并加上锚点的坐标。<br/>
  3999. 也就是说返回的坐标是相对于节点包围盒左下角的坐标。<br/>
  4000. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToNodeSpaceAR。
  4001. @param worldPoint worldPoint
  4002. @example
  4003. ```js
  4004. var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
  4005. ```
  4006. */
  4007. convertToNodeSpace(worldPoint: Vec2): Vec2;
  4008. /**
  4009. !#en Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.
  4010. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
  4011. !#zh 将一个相对于节点左下角的坐标位置转换到世界空间坐标系。
  4012. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToWorldSpaceAR
  4013. @param nodePoint nodePoint
  4014. @example
  4015. ```js
  4016. var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
  4017. ```
  4018. */
  4019. convertToWorldSpace(nodePoint: Vec2): Vec2;
  4020. /**
  4021. !#en
  4022. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  4023. The matrix is in Pixels.
  4024. !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
  4025. @param out The affine transform object to be filled with data
  4026. @example
  4027. ```js
  4028. let affineTransform = cc.AffineTransform.create();
  4029. node.getNodeToParentTransform(affineTransform);
  4030. ```
  4031. */
  4032. getNodeToParentTransform(out?: AffineTransform): AffineTransform;
  4033. /**
  4034. !#en
  4035. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  4036. The matrix is in Pixels.<br/>
  4037. This method is AR (Anchor Relative).
  4038. !#zh
  4039. 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>
  4040. 这个矩阵以像素为单位。<br/>
  4041. 该方法基于节点坐标。
  4042. @param out The affine transform object to be filled with data
  4043. @example
  4044. ```js
  4045. let affineTransform = cc.AffineTransform.create();
  4046. node.getNodeToParentTransformAR(affineTransform);
  4047. ```
  4048. */
  4049. getNodeToParentTransformAR(out?: AffineTransform): AffineTransform;
  4050. /**
  4051. !#en Returns the world affine transform matrix. The matrix is in Pixels.
  4052. !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
  4053. @param out The affine transform object to be filled with data
  4054. @example
  4055. ```js
  4056. let affineTransform = cc.AffineTransform.create();
  4057. node.getNodeToWorldTransform(affineTransform);
  4058. ```
  4059. */
  4060. getNodeToWorldTransform(out?: AffineTransform): AffineTransform;
  4061. /**
  4062. !#en
  4063. Returns the world affine transform matrix. The matrix is in Pixels.<br/>
  4064. This method is AR (Anchor Relative).
  4065. !#zh
  4066. 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>
  4067. 该方法基于节点坐标。
  4068. @param out The affine transform object to be filled with data
  4069. @example
  4070. ```js
  4071. let affineTransform = cc.AffineTransform.create();
  4072. node.getNodeToWorldTransformAR(affineTransform);
  4073. ```
  4074. */
  4075. getNodeToWorldTransformAR(out?: AffineTransform): AffineTransform;
  4076. /**
  4077. !#en
  4078. Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
  4079. The matrix is in Pixels. The returned transform is readonly and cannot be changed.
  4080. !#zh
  4081. 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。<br/>
  4082. 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
  4083. @param out The affine transform object to be filled with data
  4084. @example
  4085. ```js
  4086. let affineTransform = cc.AffineTransform.create();
  4087. node.getParentToNodeTransform(affineTransform);
  4088. ```
  4089. */
  4090. getParentToNodeTransform(out?: AffineTransform): AffineTransform;
  4091. /**
  4092. !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
  4093. !#en 返回世界坐标系到节点坐标系的逆矩阵。
  4094. @param out The affine transform object to be filled with data
  4095. @example
  4096. ```js
  4097. let affineTransform = cc.AffineTransform.create();
  4098. node.getWorldToNodeTransform(affineTransform);
  4099. ```
  4100. */
  4101. getWorldToNodeTransform(out?: AffineTransform): AffineTransform;
  4102. /**
  4103. !#en convenience methods which take a cc.Touch instead of cc.Vec2.
  4104. !#zh 将触摸点转换成本地坐标系中位置。
  4105. @param touch The touch object
  4106. @example
  4107. ```js
  4108. var newVec2 = node.convertTouchToNodeSpace(touch);
  4109. ```
  4110. */
  4111. convertTouchToNodeSpace(touch: Touch): Vec2;
  4112. /**
  4113. !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
  4114. !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
  4115. @param touch The touch object
  4116. @example
  4117. ```js
  4118. var newVec2 = node.convertTouchToNodeSpaceAR(touch);
  4119. ```
  4120. */
  4121. convertTouchToNodeSpaceAR(touch: Touch): Vec2;
  4122. /**
  4123. !#en
  4124. Returns a "local" axis aligned bounding box of the node. <br/>
  4125. The returned box is relative only to its parent.
  4126. !#zh 返回父节坐标系下的轴向对齐的包围盒。
  4127. @example
  4128. ```js
  4129. var boundingBox = node.getBoundingBox();
  4130. ```
  4131. */
  4132. getBoundingBox(): Rect;
  4133. /**
  4134. !#en
  4135. Returns a "world" axis aligned bounding box of the node.<br/>
  4136. The bounding box contains self and active children's world bounding box.
  4137. !#zh
  4138. 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。<br/>
  4139. 该边框包含自身和已激活的子节点的世界边框。
  4140. @example
  4141. ```js
  4142. var newRect = node.getBoundingBoxToWorld();
  4143. ```
  4144. */
  4145. getBoundingBoxToWorld(): Rect;
  4146. /**
  4147. !#en
  4148. Adds a child to the node with z order and name.
  4149. !#zh
  4150. 添加子节点,并且可以修改该节点的 局部 Z 顺序和名字。
  4151. @param child A child node
  4152. @param zIndex Z order for drawing priority. Please refer to zIndex property
  4153. @param name A name to identify the node easily. Please refer to name property
  4154. @example
  4155. ```js
  4156. node.addChild(newNode, 1, "node");
  4157. ```
  4158. */
  4159. addChild(child: Node, zIndex?: number, name?: string): void;
  4160. /**
  4161. !#en Stops all running actions and schedulers.
  4162. !#zh 停止所有正在播放的动作和计时器。
  4163. @example
  4164. ```js
  4165. node.cleanup();
  4166. ```
  4167. */
  4168. cleanup(): void;
  4169. /**
  4170. !#en Sorts the children array depends on children's zIndex and arrivalOrder,
  4171. normally you won't need to invoke this function.
  4172. !#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序,正常情况下开发者不需要手动调用这个函数。
  4173. */
  4174. sortAllChildren(): void;
  4175. /**
  4176. !#en
  4177. Returns the displayed opacity of Node,
  4178. the difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.
  4179. !#zh
  4180. 获取节点显示透明度,
  4181. 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
  4182. 显示透明度是基于自身透明度和父节点透明度计算的。
  4183. */
  4184. getDisplayedOpacity(): number;
  4185. /**
  4186. !#en
  4187. Returns the displayed color of Node,
  4188. the difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.
  4189. !#zh
  4190. 获取节点的显示颜色,
  4191. 显示颜色和颜色之间的不同之处在于当启用级连颜色时,
  4192. 显示颜色是基于自身颜色和父节点颜色计算的。
  4193. */
  4194. getDisplayedColor(): Color;
  4195. /** !#en Cascade opacity is removed from v2.0
  4196. Indicate whether node's opacity value affect its child nodes, default value is true.
  4197. !#zh 透明度级联功能从 v2.0 开始已移除
  4198. 节点的不透明度值是否影响其子节点,默认值为 true。 */
  4199. cascadeOpacity: boolean;
  4200. /**
  4201. !#en Cascade opacity is removed from v2.0
  4202. Returns whether node's opacity value affect its child nodes.
  4203. !#zh 透明度级联功能从 v2.0 开始已移除
  4204. 返回节点的不透明度值是否影响其子节点。
  4205. */
  4206. isCascadeOpacityEnabled(): boolean;
  4207. /**
  4208. !#en Cascade opacity is removed from v2.0
  4209. Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
  4210. !#zh 透明度级联功能从 v2.0 开始已移除
  4211. 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
  4212. @param cascadeOpacityEnabled cascadeOpacityEnabled
  4213. */
  4214. setCascadeOpacityEnabled(cascadeOpacityEnabled: boolean): void;
  4215. /**
  4216. !#en Opacity modify RGB have been removed since v2.0
  4217. Set whether color should be changed with the opacity value,
  4218. useless in ccsg.Node, but this function is override in some class to have such behavior.
  4219. !#zh 透明度影响颜色配置已经被废弃
  4220. 设置更改透明度时是否修改RGB值,
  4221. @param opacityValue opacityValue
  4222. */
  4223. setOpacityModifyRGB(opacityValue: boolean): void;
  4224. /**
  4225. !#en Opacity modify RGB have been removed since v2.0
  4226. Get whether color should be changed with the opacity value.
  4227. !#zh 透明度影响颜色配置已经被废弃
  4228. 获取更改透明度时是否修改RGB值。
  4229. */
  4230. isOpacityModifyRGB(): boolean;
  4231. }
  4232. /** !#en
  4233. Class of private entities in Cocos Creator scenes.<br/>
  4234. The PrivateNode is hidden in editor, and completely transparent to users.<br/>
  4235. It's normally used as Node's private content created by components in parent node.<br/>
  4236. So in theory private nodes are not children, they are part of the parent node.<br/>
  4237. Private node have two important characteristics:<br/>
  4238. 1. It has the minimum z index and cannot be modified, because they can't be displayed over real children.<br/>
  4239. 2. The positioning of private nodes is also special, they will consider the left bottom corner of the parent node's bounding box as the origin of local coordinates.<br/>
  4240. In this way, they can be easily kept inside the bounding box.<br/>
  4241. Currently, it's used by RichText component and TileMap component.
  4242. !#zh
  4243. Cocos Creator 场景中的私有节点类。<br/>
  4244. 私有节点在编辑器中不可见,对用户透明。<br/>
  4245. 通常私有节点是被一些特殊的组件创建出来作为父节点的一部分而存在的,理论上来说,它们不是子节点,而是父节点的组成部分。<br/>
  4246. 私有节点有两个非常重要的特性:<br/>
  4247. 1. 它有着最小的渲染排序的 Z 轴深度,并且无法被更改,因为它们不能被显示在其他正常子节点之上。<br/>
  4248. 2. 它的定位也是特殊的,对于私有节点来说,父节点包围盒的左下角是它的局部坐标系原点,这个原点相当于父节点的位置减去它锚点的偏移。这样私有节点可以比较容易被控制在包围盒之中。<br/>
  4249. 目前在引擎中,RichText 和 TileMap 都有可能生成私有节点。 */
  4250. export class PrivateNode extends Node {
  4251. /**
  4252. @param name name
  4253. */
  4254. constructor(name?: string);
  4255. }
  4256. /** !#en
  4257. cc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>
  4258. cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.
  4259. !#zh
  4260. cc.Scene 是 cc.Node 的子类,仅作为一个抽象的概念。<br/>
  4261. cc.Scene 和 cc.Node 有点不同,用户不应直接修改 cc.Scene。 */
  4262. export class Scene extends Node {
  4263. /** !#en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  4264. !#zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。 */
  4265. autoReleaseAssets: boolean;
  4266. }
  4267. /** !#en
  4268. Scheduler is responsible of triggering the scheduled callbacks.<br/>
  4269. You should not use NSTimer. Instead use this class.<br/>
  4270. <br/>
  4271. There are 2 different types of callbacks (selectors):<br/>
  4272. - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>
  4273. - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>
  4274. <br/>
  4275. The 'custom selectors' should be avoided when possible. It is faster,
  4276. and consumes less memory to use the 'update callback'. *
  4277. !#zh
  4278. Scheduler 是负责触发回调函数的类。<br/>
  4279. 通常情况下,建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>
  4280. 有两种不同类型的定时器:<br/>
  4281. - update 定时器:每一帧都会触发。您可以自定义优先级。<br/>
  4282. - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>
  4283. 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。 */
  4284. export class Scheduler {
  4285. /**
  4286. !#en This method should be called for any target which needs to schedule tasks, and this method should be called before any scheduler API usage.
  4287. This method will add a `_id` property if it doesn't exist.
  4288. !#zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  4289. 这个方法会给对象添加一个 `_id` 属性,如果这个属性不存在的话。
  4290. @param target target
  4291. */
  4292. enableForTarget(target: any): void;
  4293. /**
  4294. !#en
  4295. Modifies the time of all scheduled callbacks.<br/>
  4296. You can use this property to create a 'slow motion' or 'fast forward' effect.<br/>
  4297. Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>
  4298. To create a 'fast forward' effect, use values higher than 1.0.<br/>
  4299. Note:It will affect EVERY scheduled selector / action.
  4300. !#zh
  4301. 设置时间间隔的缩放比例。<br/>
  4302. 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br/>
  4303. 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br/>
  4304. 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br/>
  4305. 注意:它影响该 Scheduler 下管理的所有定时器。
  4306. @param timeScale timeScale
  4307. */
  4308. setTimeScale(timeScale: number): void;
  4309. /**
  4310. !#en Returns time scale of scheduler.
  4311. !#zh 获取时间间隔的缩放比例。
  4312. */
  4313. getTimeScale(): number;
  4314. /**
  4315. !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  4316. !#zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  4317. @param dt delta time
  4318. */
  4319. update(dt: number): void;
  4320. /**
  4321. !#en
  4322. <p>
  4323. The scheduled method will be called every 'interval' seconds.<br/>
  4324. If paused is YES, then it won't be called until it is resumed.<br/>
  4325. If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
  4326. If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
  4327. repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
  4328. delay is the amount of time the action will wait before it'll start<br/>
  4329. </p>
  4330. !#zh
  4331. 指定回调函数,调用对象等信息来添加一个新的定时器。<br/>
  4332. 如果 paused 值为 true,那么直到 resume 被调用才开始计时。<br/>
  4333. 当时间间隔达到指定值时,设置的回调函数将会被调用。<br/>
  4334. 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
  4335. 建议使用 scheduleUpdateForTarget 代替。<br/>
  4336. 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
  4337. repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
  4338. 可以让定时器一直循环触发。<br/>
  4339. delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
  4340. @param callback callback
  4341. @param target target
  4342. @param interval interval
  4343. @param repeat repeat
  4344. @param delay delay
  4345. @param paused paused
  4346. @example
  4347. ```js
  4348. //register a schedule to scheduler
  4349. cc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);
  4350. ```
  4351. */
  4352. schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void;
  4353. schedule(callback: Function, target: any, interval: number, paused?: boolean): void;
  4354. /**
  4355. !#en
  4356. Schedules the update callback for a given target,
  4357. During every frame after schedule started, the "update" function of target will be invoked.
  4358. !#zh
  4359. 使用指定的优先级为指定的对象设置 update 定时器。
  4360. update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。
  4361. 优先级的值越低,定时器被触发的越早。
  4362. @param target target
  4363. @param priority priority
  4364. @param paused paused
  4365. */
  4366. scheduleUpdate(target: any, priority: number, paused: boolean): void;
  4367. /**
  4368. !#en
  4369. Unschedules a callback for a callback and a given target.
  4370. If you want to unschedule the "update", use `unscheduleUpdate()`
  4371. !#zh
  4372. 取消指定对象定时器。
  4373. 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  4374. @param callback The callback to be unscheduled
  4375. @param target The target bound to the callback.
  4376. */
  4377. unschedule(callback: Function, target: any): void;
  4378. /**
  4379. !#en Unschedules the update callback for a given target.
  4380. !#zh 取消指定对象的 update 定时器。
  4381. @param target The target to be unscheduled.
  4382. */
  4383. unscheduleUpdate(target: any): void;
  4384. /**
  4385. !#en
  4386. Unschedules all scheduled callbacks for a given target.
  4387. This also includes the "update" callback.
  4388. !#zh 取消指定对象的所有定时器,包括 update 定时器。
  4389. @param target The target to be unscheduled.
  4390. */
  4391. unscheduleAllForTarget(target: any): void;
  4392. /**
  4393. !#en
  4394. Unschedules all scheduled callbacks from all targets including the system callbacks.<br/>
  4395. You should NEVER call this method, unless you know what you are doing.
  4396. !#zh
  4397. 取消所有对象的所有定时器,包括系统定时器。<br/>
  4398. 不要调用此函数,除非你确定你在做什么。
  4399. */
  4400. unscheduleAll(): void;
  4401. /**
  4402. !#en
  4403. Unschedules all callbacks from all targets with a minimum priority.<br/>
  4404. You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  4405. !#zh
  4406. 取消所有优先级的值大于指定优先级的定时器。<br/>
  4407. 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4408. @param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
  4409. priority is higher than minPriority will be unscheduled.
  4410. */
  4411. unscheduleAllWithMinPriority(minPriority: number): void;
  4412. /**
  4413. !#en Checks whether a callback for a given target is scheduled.
  4414. !#zh 检查指定的回调函数和回调对象组合是否存在定时器。
  4415. @param callback The callback to check.
  4416. @param target The target of the callback.
  4417. */
  4418. isScheduled(callback: Function, target: any): boolean;
  4419. /**
  4420. !#en
  4421. Pause all selectors from all targets.<br/>
  4422. You should NEVER call this method, unless you know what you are doing.
  4423. !#zh
  4424. 暂停所有对象的所有定时器。<br/>
  4425. 不要调用这个方法,除非你知道你正在做什么。
  4426. */
  4427. pauseAllTargets(): void;
  4428. /**
  4429. !#en
  4430. Pause all selectors from all targets with a minimum priority. <br/>
  4431. You should only call this with kCCPriorityNonSystemMin or higher.
  4432. !#zh
  4433. 暂停所有优先级的值大于指定优先级的定时器。<br/>
  4434. 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4435. @param minPriority minPriority
  4436. */
  4437. pauseAllTargetsWithMinPriority(minPriority: number): void;
  4438. /**
  4439. !#en
  4440. Resume selectors on a set of targets.<br/>
  4441. This can be useful for undoing a call to pauseAllCallbacks.
  4442. !#zh
  4443. 恢复指定数组中所有对象的定时器。<br/>
  4444. 这个函数是 pauseAllCallbacks 的逆操作。
  4445. @param targetsToResume targetsToResume
  4446. */
  4447. resumeTargets(targetsToResume: any[]): void;
  4448. /**
  4449. !#en
  4450. Pauses the target.<br/>
  4451. All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  4452. If the target is not present, nothing happens.
  4453. !#zh
  4454. 暂停指定对象的定时器。<br/>
  4455. 指定对象的所有定时器都会被暂停。<br/>
  4456. 如果指定的对象没有定时器,什么也不会发生。
  4457. @param target target
  4458. */
  4459. pauseTarget(target: any): void;
  4460. /**
  4461. !#en
  4462. Resumes the target.<br/>
  4463. The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  4464. If the target is not present, nothing happens.
  4465. !#zh
  4466. 恢复指定对象的所有定时器。<br/>
  4467. 指定对象的所有定时器将继续工作。<br/>
  4468. 如果指定的对象没有定时器,什么也不会发生。
  4469. @param target target
  4470. */
  4471. resumeTarget(target: any): void;
  4472. /**
  4473. !#en Returns whether or not the target is paused.
  4474. !#zh 返回指定对象的定时器是否暂停了。
  4475. @param target target
  4476. */
  4477. isTargetPaused(target: any): boolean;
  4478. /** !#en Priority level reserved for system services.
  4479. !#zh 系统服务的优先级。 */
  4480. static PRIORITY_SYSTEM: number;
  4481. /** !#en Minimum priority level for user scheduling.
  4482. !#zh 用户调度最低优先级。 */
  4483. static PRIORITY_NON_SYSTEM: number;
  4484. }
  4485. /** Class for particle asset handling. */
  4486. export class ParticleAsset extends Asset {
  4487. }
  4488. /** Particle System base class. <br/>
  4489. Attributes of a Particle System:<br/>
  4490. - emmision rate of the particles<br/>
  4491. - Gravity Mode (Mode A): <br/>
  4492. - gravity <br/>
  4493. - direction <br/>
  4494. - speed +- variance <br/>
  4495. - tangential acceleration +- variance<br/>
  4496. - radial acceleration +- variance<br/>
  4497. - Radius Mode (Mode B): <br/>
  4498. - startRadius +- variance <br/>
  4499. - endRadius +- variance <br/>
  4500. - rotate +- variance <br/>
  4501. - Properties common to all modes: <br/>
  4502. - life +- life variance <br/>
  4503. - start spin +- variance <br/>
  4504. - end spin +- variance <br/>
  4505. - start size +- variance <br/>
  4506. - end size +- variance <br/>
  4507. - start color +- variance <br/>
  4508. - end color +- variance <br/>
  4509. - life +- variance <br/>
  4510. - blending function <br/>
  4511. - texture <br/>
  4512. <br/>
  4513. cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
  4514. 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
  4515. cocos2d uses a another approach, but the results are almost identical.<br/>
  4516. cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
  4517. - spinning particles (supported when using ParticleSystem) <br/>
  4518. - tangential acceleration (Gravity mode) <br/>
  4519. - radial acceleration (Gravity mode) <br/>
  4520. - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
  4521. It is possible to customize any of the above mentioned properties in runtime. Example: <br/> */
  4522. export class ParticleSystem extends RenderComponent implements BlendFunc {
  4523. /** !#en Play particle in edit mode.
  4524. !#zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。 */
  4525. preview: boolean;
  4526. /** !#en
  4527. If set custom to true, then use custom properties insteadof read particle file.
  4528. !#zh 是否自定义粒子属性。 */
  4529. custom: boolean;
  4530. /** !#en The plist file.
  4531. !#zh plist 格式的粒子配置文件。 */
  4532. file: ParticleAsset;
  4533. /** !#en SpriteFrame used for particles display
  4534. !#zh 用于粒子呈现的 SpriteFrame */
  4535. spriteFrame: SpriteFrame;
  4536. /** !#en Texture of Particle System, readonly, please use spriteFrame to setup new texture。
  4537. !#zh 粒子贴图,只读属性,请使用 spriteFrame 属性来替换贴图。 */
  4538. texture: string;
  4539. /** !#en Current quantity of particles that are being simulated.
  4540. !#zh 当前播放的粒子数量。 */
  4541. particleCount: number;
  4542. /** !#en Indicate whether the system simulation have stopped.
  4543. !#zh 指示粒子播放是否完毕。 */
  4544. stopped: boolean;
  4545. /** !#en If set to true, the particle system will automatically start playing on onLoad.
  4546. !#zh 如果设置为 true 运行时会自动发射粒子。 */
  4547. playOnLoad: boolean;
  4548. /** !#en Indicate whether the owner node will be auto-removed when it has no particles left.
  4549. !#zh 粒子播放完毕后自动销毁所在的节点。 */
  4550. autoRemoveOnFinish: boolean;
  4551. /** !#en Indicate whether the particle system is activated.
  4552. !#zh 是否激活粒子。 */
  4553. active: boolean;
  4554. /** !#en Maximum particles of the system.
  4555. !#zh 粒子最大数量。 */
  4556. totalParticles: number;
  4557. /** !#en How many seconds the emitter wil run. -1 means 'forever'.
  4558. !#zh 发射器生存时间,单位秒,-1表示持续发射。 */
  4559. duration: number;
  4560. /** !#en Emission rate of the particles.
  4561. !#zh 每秒发射的粒子数目。 */
  4562. emissionRate: number;
  4563. /** !#en Life of each particle setter.
  4564. !#zh 粒子的运行时间。 */
  4565. life: number;
  4566. /** !#en Variation of life.
  4567. !#zh 粒子的运行时间变化范围。 */
  4568. lifeVar: number;
  4569. /** !#en Start color of each particle.
  4570. !#zh 粒子初始颜色。 */
  4571. startColor: Color;
  4572. /** !#en Variation of the start color.
  4573. !#zh 粒子初始颜色变化范围。 */
  4574. startColorVar: Color;
  4575. /** !#en Ending color of each particle.
  4576. !#zh 粒子结束颜色。 */
  4577. endColor: Color;
  4578. /** !#en Variation of the end color.
  4579. !#zh 粒子结束颜色变化范围。 */
  4580. endColorVar: Color;
  4581. /** !#en Angle of each particle setter.
  4582. !#zh 粒子角度。 */
  4583. angle: number;
  4584. /** !#en Variation of angle of each particle setter.
  4585. !#zh 粒子角度变化范围。 */
  4586. angleVar: number;
  4587. /** !#en Start size in pixels of each particle.
  4588. !#zh 粒子的初始大小。 */
  4589. startSize: number;
  4590. /** !#en Variation of start size in pixels.
  4591. !#zh 粒子初始大小的变化范围。 */
  4592. startSizeVar: number;
  4593. /** !#en End size in pixels of each particle.
  4594. !#zh 粒子结束时的大小。 */
  4595. endSize: number;
  4596. /** !#en Variation of end size in pixels.
  4597. !#zh 粒子结束大小的变化范围。 */
  4598. endSizeVar: number;
  4599. /** !#en Start angle of each particle.
  4600. !#zh 粒子开始自旋角度。 */
  4601. startSpin: number;
  4602. /** !#en Variation of start angle.
  4603. !#zh 粒子开始自旋角度变化范围。 */
  4604. startSpinVar: number;
  4605. /** !#en End angle of each particle.
  4606. !#zh 粒子结束自旋角度。 */
  4607. endSpin: number;
  4608. /** !#en Variation of end angle.
  4609. !#zh 粒子结束自旋角度变化范围。 */
  4610. endSpinVar: number;
  4611. /** !#en Source position of the emitter.
  4612. !#zh 发射器位置。 */
  4613. sourcePos: Vec2;
  4614. /** !#en Variation of source position.
  4615. !#zh 发射器位置的变化范围。(横向和纵向) */
  4616. posVar: Vec2;
  4617. /** !#en Particles movement type.
  4618. !#zh 粒子位置类型。 */
  4619. positionType: ParticleSystem.PositionType;
  4620. /** !#en Particles emitter modes.
  4621. !#zh 发射器类型。 */
  4622. emitterMode: ParticleSystem.EmitterMode;
  4623. /** !#en Gravity of the emitter.
  4624. !#zh 重力。 */
  4625. gravity: Vec2;
  4626. /** !#en Speed of the emitter.
  4627. !#zh 速度。 */
  4628. speed: number;
  4629. /** !#en Variation of the speed.
  4630. !#zh 速度变化范围。 */
  4631. speedVar: number;
  4632. /** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  4633. !#zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。 */
  4634. tangentialAccel: number;
  4635. /** !#en Variation of the tangential acceleration.
  4636. !#zh 每个粒子的切向加速度变化范围。 */
  4637. tangentialAccelVar: number;
  4638. /** !#en Acceleration of each particle. Only available in 'Gravity' mode.
  4639. !#zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。 */
  4640. radialAccel: number;
  4641. /** !#en Variation of the radial acceleration.
  4642. !#zh 粒子径向加速度变化范围。 */
  4643. radialAccelVar: number;
  4644. /** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  4645. !#zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。 */
  4646. rotationIsDir: boolean;
  4647. /** !#en Starting radius of the particles. Only available in 'Radius' mode.
  4648. !#zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。 */
  4649. startRadius: number;
  4650. /** !#en Variation of the starting radius.
  4651. !#zh 初始半径变化范围。 */
  4652. startRadiusVar: number;
  4653. /** !#en Ending radius of the particles. Only available in 'Radius' mode.
  4654. !#zh 结束半径,只有在半径模式下可用。 */
  4655. endRadius: number;
  4656. /** !#en Variation of the ending radius.
  4657. !#zh 结束半径变化范围。 */
  4658. endRadiusVar: number;
  4659. /** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  4660. !#zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。 */
  4661. rotatePerS: number;
  4662. /** !#en Variation of the degress to rotate a particle around the source pos per second.
  4663. !#zh 粒子每秒围绕起始点的旋转角度变化范围。 */
  4664. rotatePerSVar: number;
  4665. /** !#en The Particle emitter lives forever.
  4666. !#zh 表示发射器永久存在 */
  4667. static DURATION_INFINITY: number;
  4668. /** !#en The starting size of the particle is equal to the ending size.
  4669. !#zh 表示粒子的起始大小等于结束大小。 */
  4670. static START_SIZE_EQUAL_TO_END_SIZE: number;
  4671. /** !#en The starting radius of the particle is equal to the ending radius.
  4672. !#zh 表示粒子的起始半径等于结束半径。 */
  4673. static START_RADIUS_EQUAL_TO_END_RADIUS: number;
  4674. /**
  4675. !#en Stop emitting particles. Running particles will continue to run until they die.
  4676. !#zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  4677. @example
  4678. ```js
  4679. // stop particle system.
  4680. myParticleSystem.stopSystem();
  4681. ```
  4682. */
  4683. stopSystem(): void;
  4684. /**
  4685. !#en Kill all living particles.
  4686. !#zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  4687. @example
  4688. ```js
  4689. // play particle system.
  4690. myParticleSystem.resetSystem();
  4691. ```
  4692. */
  4693. resetSystem(): void;
  4694. /**
  4695. !#en Whether or not the system is full.
  4696. !#zh 发射器中粒子是否大于等于设置的总粒子数量。
  4697. */
  4698. isFull(): boolean;
  4699. /**
  4700. !#en Sets a new texture with a rect. The rect is in texture position and size.
  4701. Please use spriteFrame property instead, this function is deprecated since v1.9
  4702. !#zh 设置一张新贴图和关联的矩形。
  4703. 请直接设置 spriteFrame 属性,这个函数从 v1.9 版本开始已经被废弃
  4704. @param texture texture
  4705. @param rect rect
  4706. */
  4707. setTextureWithRect(texture: Texture2D, rect: Rect): void;
  4708. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  4709. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  4710. srcBlendFactor: macro.BlendFactor;
  4711. /** !#en specify the destination Blend Factor.
  4712. !#zh 指定目标的混合模式 */
  4713. dstBlendFactor: macro.BlendFactor;
  4714. }
  4715. /** cc.TMXLayerInfo contains the information about the layers like:
  4716. - Layer name
  4717. - Layer size
  4718. - Layer opacity at creation time (it can be modified at runtime)
  4719. - Whether the layer is visible (if it's not visible, then the CocosNode won't be created)
  4720. This information is obtained from the TMX file. */
  4721. export class TMXLayerInfo {
  4722. /** Properties of the layer info. */
  4723. properties: any;
  4724. }
  4725. /** cc.TMXImageLayerInfo contains the information about the image layers.
  4726. This information is obtained from the TMX file. */
  4727. export class TMXImageLayerInfo {
  4728. }
  4729. /** <p>cc.TMXObjectGroupInfo contains the information about the object group like:
  4730. - group name
  4731. - group size
  4732. - group opacity at creation time (it can be modified at runtime)
  4733. - Whether the group is visible
  4734. This information is obtained from the TMX file.</p> */
  4735. export class TMXObjectGroupInfo {
  4736. /** Properties of the ObjectGroup info. */
  4737. properties: any[];
  4738. }
  4739. /** <p>cc.TMXTilesetInfo contains the information about the tilesets like: <br />
  4740. - Tileset name<br />
  4741. - Tileset spacing<br />
  4742. - Tileset margin<br />
  4743. - size of the tiles<br />
  4744. - Image used for the tiles<br />
  4745. - Image size<br />
  4746. This information is obtained from the TMX file. </p> */
  4747. export class TMXTilesetInfo {
  4748. /** Tileset name */
  4749. name: string;
  4750. /** First grid */
  4751. firstGid: number;
  4752. /** Spacing */
  4753. spacing: number;
  4754. /** Margin */
  4755. margin: number;
  4756. /** Texture containing the tiles (should be sprite sheet / texture atlas) */
  4757. sourceImage: any;
  4758. /** Size in pixels of the image */
  4759. imageSize: Size;
  4760. }
  4761. /** <p>cc.TMXMapInfo contains the information about the map like: <br/>
  4762. - Map orientation (hexagonal, isometric or orthogonal)<br/>
  4763. - Tile size<br/>
  4764. - Map size</p>
  4765. <p>And it also contains: <br/>
  4766. - Layers (an array of TMXLayerInfo objects)<br/>
  4767. - Tilesets (an array of TMXTilesetInfo objects) <br/>
  4768. - ObjectGroups (an array of TMXObjectGroupInfo objects) </p>
  4769. <p>This information is obtained from the TMX file. </p> */
  4770. export class TMXMapInfo {
  4771. /** Properties of the map info. */
  4772. properties: any[];
  4773. /** Map orientation. */
  4774. orientation: number;
  4775. /** Parent element. */
  4776. parentElement: any;
  4777. /** Parent GID. */
  4778. parentGID: number;
  4779. /** Layer attributes. */
  4780. layerAttrs: any;
  4781. /** Is reading storing characters stream. */
  4782. storingCharacters: boolean;
  4783. /** Current string stored from characters stream. */
  4784. currentString: string;
  4785. /** Width of the map */
  4786. mapWidth: number;
  4787. /** Height of the map */
  4788. mapHeight: number;
  4789. /** Width of a tile */
  4790. tileWidth: number;
  4791. /** Height of a tile */
  4792. tileHeight: number;
  4793. static ATTRIB_NONE: number;
  4794. static ATTRIB_BASE64: number;
  4795. static ATTRIB_GZIP: number;
  4796. static ATTRIB_ZLIB: number;
  4797. }
  4798. /** !#en Render the TMX layer.
  4799. !#zh 渲染 TMX layer。 */
  4800. export class TiledLayer extends Component {
  4801. /**
  4802. !#en enable or disable culling
  4803. !#zh 开启或关闭裁剪。
  4804. @param value value
  4805. */
  4806. enableCulling(value: any): void;
  4807. /**
  4808. !#en Adds user's node into layer.
  4809. !#zh 添加用户节点。
  4810. @param node node
  4811. */
  4812. addUserNode(node: Node): boolean;
  4813. /**
  4814. !#en Removes user's node.
  4815. !#zh 移除用户节点。
  4816. @param node node
  4817. */
  4818. removeUserNode(node: Node): boolean;
  4819. /**
  4820. !#en Destroy user's node.
  4821. !#zh 销毁用户节点。
  4822. @param node node
  4823. */
  4824. destroyUserNode(node: Node): void;
  4825. /**
  4826. !#en Gets the layer name.
  4827. !#zh 获取层的名称。
  4828. @example
  4829. ```js
  4830. let layerName = tiledLayer.getLayerName();
  4831. cc.log(layerName);
  4832. ```
  4833. */
  4834. getLayerName(): string;
  4835. /**
  4836. !#en Set the layer name.
  4837. !#zh 设置层的名称
  4838. @param layerName layerName
  4839. @example
  4840. ```js
  4841. tiledLayer.setLayerName("New Layer");
  4842. ```
  4843. */
  4844. SetLayerName(layerName: string): void;
  4845. /**
  4846. !#en Return the value for the specific property name.
  4847. !#zh 获取指定属性名的值。
  4848. @param propertyName propertyName
  4849. @example
  4850. ```js
  4851. let property = tiledLayer.getProperty("info");
  4852. cc.log(property);
  4853. ```
  4854. */
  4855. getProperty(propertyName: string): any;
  4856. /**
  4857. !#en Returns the position in pixels of a given tile coordinate.
  4858. !#zh 获取指定 tile 的像素坐标。
  4859. @param pos position or x
  4860. @param y y
  4861. @example
  4862. ```js
  4863. let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  4864. cc.log("Pos: " + pos);
  4865. let pos = tiledLayer.getPositionAt(0, 0);
  4866. cc.log("Pos: " + pos);
  4867. ```
  4868. */
  4869. getPositionAt(pos: Vec2|number, y?: number): Vec2;
  4870. /**
  4871. !#en
  4872. Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  4873. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  4874. If a tile is already placed at that position, then it will be removed.
  4875. !#zh
  4876. 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  4877. tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  4878. 如果一个 tile 已经放在那个位置,那么它将被删除。
  4879. @param gid gid
  4880. @param posOrX position or x
  4881. @param flagsOrY flags or y
  4882. @param flags flags
  4883. @example
  4884. ```js
  4885. tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  4886. ```
  4887. */
  4888. setTileGIDAt(gid: number, posOrX: Vec2|number, flagsOrY: number, flags?: number): void;
  4889. /**
  4890. !#en
  4891. Returns the tile gid at a given tile coordinate. <br />
  4892. if it returns 0, it means that the tile is empty. <br />
  4893. !#zh
  4894. 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  4895. 如果它返回 0,则表示该 tile 为空。<br />
  4896. @param pos or x
  4897. @param y y
  4898. @example
  4899. ```js
  4900. let tileGid = tiledLayer.getTileGIDAt(0, 0);
  4901. ```
  4902. */
  4903. getTileGIDAt(pos: Vec2|number, y?: number): number;
  4904. /**
  4905. !#en Layer orientation, which is the same as the map orientation.
  4906. !#zh 获取 Layer 方向(同地图方向)。
  4907. @example
  4908. ```js
  4909. let orientation = tiledLayer.getLayerOrientation();
  4910. cc.log("Layer Orientation: " + orientation);
  4911. ```
  4912. */
  4913. getLayerOrientation(): number;
  4914. /**
  4915. !#en properties from the layer. They can be added using Tiled.
  4916. !#zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  4917. @example
  4918. ```js
  4919. let properties = tiledLayer.getProperties();
  4920. cc.log("Properties: " + properties);
  4921. ```
  4922. */
  4923. getProperties(): any;
  4924. /**
  4925. !#en
  4926. Get the TiledTile with the tile coordinate.<br/>
  4927. If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  4928. then will create a new TiledTile at the coordinate.
  4929. The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  4930. !#zh
  4931. 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  4932. 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  4933. 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  4934. @param x x
  4935. @param y y
  4936. @param forceCreate forceCreate
  4937. @example
  4938. ```js
  4939. let tile = tiledLayer.getTiledTileAt(100, 100, true);
  4940. cc.log(tile);
  4941. ```
  4942. */
  4943. getTiledTileAt(x: number, y: number, forceCreate: boolean): TiledTile;
  4944. /**
  4945. !#en
  4946. Change tile to TiledTile at the specified coordinate.
  4947. !#zh
  4948. 将指定的 tile 坐标替换为指定的 TiledTile。
  4949. @param x x
  4950. @param y y
  4951. @param tiledTile tiledTile
  4952. */
  4953. setTiledTileAt(x: number, y: number, tiledTile: TiledTile): TiledTile;
  4954. /**
  4955. !#en Return texture.
  4956. !#zh 获取纹理。
  4957. @param index The index of textures
  4958. */
  4959. getTexture(index: any): Texture2D;
  4960. /**
  4961. !#en Return texture.
  4962. !#zh 获取纹理。
  4963. */
  4964. getTextures(): Texture2D;
  4965. /**
  4966. !#en Set the texture.
  4967. !#zh 设置纹理。
  4968. @param texture texture
  4969. */
  4970. setTexture(texture: Texture2D): void;
  4971. /**
  4972. !#en Set the texture.
  4973. !#zh 设置纹理。
  4974. @param textures textures
  4975. */
  4976. setTexture(textures: Texture2D): void;
  4977. /**
  4978. !#en Gets layer size.
  4979. !#zh 获得层大小。
  4980. @example
  4981. ```js
  4982. let size = tiledLayer.getLayerSize();
  4983. cc.log("layer size: " + size);
  4984. ```
  4985. */
  4986. getLayerSize(): Size;
  4987. /**
  4988. !#en Size of the map's tile (could be different from the tile's size).
  4989. !#zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  4990. @example
  4991. ```js
  4992. let mapTileSize = tiledLayer.getMapTileSize();
  4993. cc.log("MapTile size: " + mapTileSize);
  4994. ```
  4995. */
  4996. getMapTileSize(): Size;
  4997. /**
  4998. !#en Gets Tile set first information for the layer.
  4999. !#zh 获取 layer 索引位置为0的 Tileset 信息。
  5000. @param index The index of tilesets
  5001. */
  5002. getTileSet(index: any): TMXTilesetInfo;
  5003. /**
  5004. !#en Gets tile set all information for the layer.
  5005. !#zh 获取 layer 所有的 Tileset 信息。
  5006. */
  5007. getTileSet(): TMXTilesetInfo;
  5008. /**
  5009. !#en Sets tile set information for the layer.
  5010. !#zh 设置 layer 的 tileset 信息。
  5011. @param tileset tileset
  5012. */
  5013. setTileSet(tileset: TMXTilesetInfo): void;
  5014. /**
  5015. !#en Sets Tile set information for the layer.
  5016. !#zh 设置 layer 的 Tileset 信息。
  5017. @param tilesets tilesets
  5018. */
  5019. setTileSets(tilesets: TMXTilesetInfo): void;
  5020. }
  5021. /** !#en Renders a TMX Tile Map in the scene.
  5022. !#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */
  5023. export class TiledMap extends Component {
  5024. /** !#en The TiledMap Asset.
  5025. !#zh TiledMap 资源。 */
  5026. tmxAsset: TiledMapAsset;
  5027. /**
  5028. !#en Gets the map size.
  5029. !#zh 获取地图大小。
  5030. @example
  5031. ```js
  5032. let mapSize = tiledMap.getMapSize();
  5033. cc.log("Map Size: " + mapSize);
  5034. ```
  5035. */
  5036. getMapSize(): Size;
  5037. /**
  5038. !#en Gets the tile size.
  5039. !#zh 获取地图背景中 tile 元素的大小。
  5040. @example
  5041. ```js
  5042. let tileSize = tiledMap.getTileSize();
  5043. cc.log("Tile Size: " + tileSize);
  5044. ```
  5045. */
  5046. getTileSize(): Size;
  5047. /**
  5048. !#en map orientation.
  5049. !#zh 获取地图方向。
  5050. @example
  5051. ```js
  5052. let mapOrientation = tiledMap.getMapOrientation();
  5053. cc.log("Map Orientation: " + mapOrientation);
  5054. ```
  5055. */
  5056. getMapOrientation(): number;
  5057. /**
  5058. !#en object groups.
  5059. !#zh 获取所有的对象层。
  5060. @example
  5061. ```js
  5062. let objGroups = titledMap.getObjectGroups();
  5063. for (let i = 0; i < objGroups.length; ++i) {
  5064. cc.log("obj: " + objGroups[i]);
  5065. }
  5066. ```
  5067. */
  5068. getObjectGroups(): TiledObjectGroup[];
  5069. /**
  5070. !#en Return the TMXObjectGroup for the specific group.
  5071. !#zh 获取指定的 TMXObjectGroup。
  5072. @param groupName groupName
  5073. @example
  5074. ```js
  5075. let group = titledMap.getObjectGroup("Players");
  5076. cc.log("ObjectGroup: " + group);
  5077. ```
  5078. */
  5079. getObjectGroup(groupName: string): TiledObjectGroup;
  5080. /**
  5081. !#en enable or disable culling
  5082. !#zh 开启或关闭裁剪。
  5083. @param value value
  5084. */
  5085. enableCulling(value: any): void;
  5086. /**
  5087. !#en Gets the map properties.
  5088. !#zh 获取地图的属性。
  5089. @example
  5090. ```js
  5091. let properties = titledMap.getProperties();
  5092. for (let i = 0; i < properties.length; ++i) {
  5093. cc.log("Properties: " + properties[i]);
  5094. }
  5095. ```
  5096. */
  5097. getProperties(): any[];
  5098. /**
  5099. !#en Return All layers array.
  5100. !#zh 返回包含所有 layer 的数组。
  5101. @example
  5102. ```js
  5103. let layers = titledMap.getLayers();
  5104. for (let i = 0; i < layers.length; ++i) {
  5105. cc.log("Layers: " + layers[i]);
  5106. }
  5107. ```
  5108. */
  5109. getLayers(): TiledLayer[];
  5110. /**
  5111. !#en return the cc.TiledLayer for the specific layer.
  5112. !#zh 获取指定名称的 layer。
  5113. @param layerName layerName
  5114. @example
  5115. ```js
  5116. let layer = titledMap.getLayer("Player");
  5117. cc.log(layer);
  5118. ```
  5119. */
  5120. getLayer(layerName: string): TiledLayer;
  5121. /**
  5122. !#en Return the value for the specific property name.
  5123. !#zh 通过属性名称,获取指定的属性。
  5124. @param propertyName propertyName
  5125. @example
  5126. ```js
  5127. let property = titledMap.getProperty("info");
  5128. cc.log("Property: " + property);
  5129. ```
  5130. */
  5131. getProperty(propertyName: string): string;
  5132. /**
  5133. !#en Return properties dictionary for tile GID.
  5134. !#zh 通过 GID ,获取指定的属性。
  5135. @param GID GID
  5136. @example
  5137. ```js
  5138. let properties = titledMap.getPropertiesForGID(GID);
  5139. cc.log("Properties: " + properties);
  5140. ```
  5141. */
  5142. getPropertiesForGID(GID: number): any;
  5143. }
  5144. /** Class for tiled map asset handling. */
  5145. export class TiledMapAsset extends Asset {
  5146. textures: Texture2D[];
  5147. textureNames: string[];
  5148. textureSizes: Size[];
  5149. imageLayerTextures: Texture2D[];
  5150. imageLayerTextureNames: string[];
  5151. }
  5152. /** !#en Renders the TMX object group.
  5153. !#zh 渲染 tmx object group。 */
  5154. export class TiledObjectGroup extends Component {
  5155. /**
  5156. !#en Offset position of child objects.
  5157. !#zh 获取子对象的偏移位置。
  5158. @example
  5159. ```js
  5160. let offset = tMXObjectGroup.getPositionOffset();
  5161. ```
  5162. */
  5163. getPositionOffset(): Vec2;
  5164. /**
  5165. !#en List of properties stored in a dictionary.
  5166. !#zh 以映射的形式获取属性列表。
  5167. @example
  5168. ```js
  5169. let offset = tMXObjectGroup.getProperties();
  5170. ```
  5171. */
  5172. getProperties(): any;
  5173. /**
  5174. !#en Gets the Group name.
  5175. !#zh 获取组名称。
  5176. @example
  5177. ```js
  5178. let groupName = tMXObjectGroup.getGroupName;
  5179. ```
  5180. */
  5181. getGroupName(): string;
  5182. /**
  5183. !#en
  5184. Return the object for the specific object name. <br />
  5185. It will return the 1st object found on the array for the given name.
  5186. !#zh 获取指定的对象。
  5187. @param objectName objectName
  5188. @example
  5189. ```js
  5190. let object = tMXObjectGroup.getObject("Group");
  5191. ```
  5192. */
  5193. getObject(objectName: string): any;
  5194. /**
  5195. !#en Gets the objects.
  5196. !#zh 获取对象数组。
  5197. @example
  5198. ```js
  5199. let objects = tMXObjectGroup.getObjects();
  5200. ```
  5201. */
  5202. getObjects(): any[];
  5203. }
  5204. /** !#en TiledTile can control the specified map tile.
  5205. It will apply the node rotation, scale, translate to the map tile.
  5206. You can change the TiledTile's gid to change the map tile's style.
  5207. !#zh TiledTile 可以单独对某一个地图块进行操作。
  5208. 他会将节点的旋转,缩放,平移操作应用在这个地图块上,并可以通过更换当前地图块的 gid 来更换地图块的显示样式。 */
  5209. export class TiledTile extends Component {
  5210. /** !#en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  5211. !#zh 指定 TiledTile 的横向坐标,以地图块为单位 */
  5212. x: number;
  5213. /** !#en Specify the TiledTile vertical coordinate,use map tile as the unit.
  5214. !#zh 指定 TiledTile 的纵向坐标,以地图块为单位 */
  5215. y: number;
  5216. /** !#en Specify the TiledTile gid.
  5217. !#zh 指定 TiledTile 的 gid 值 */
  5218. gid: number;
  5219. }
  5220. /** !#en cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game. Because different platforms have different authorization, API and control methods for VideoPlayer component. And have not yet formed a unified standard, only Web, iOS, and Android platforms are currently supported.
  5221. !#zh Video 组件,用于在游戏中播放视频。由于不同平台对于 VideoPlayer 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  5222. export class VideoPlayer extends Component {
  5223. /** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.
  5224. !#zh 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。 */
  5225. resourceType: VideoPlayer.ResourceType;
  5226. /** !#en The remote URL of video.
  5227. !#zh 远程视频的 URL */
  5228. remoteURL: string;
  5229. /** !#en The local video full path.
  5230. !#zh 本地视频的 URL */
  5231. clip: string;
  5232. /** !#en The current playback time of the now playing item in seconds, you could also change the start playback time.
  5233. !#zh 指定视频从什么时间点开始播放,单位是秒,也可以用来获取当前视频播放的时间进度。 */
  5234. currentTime: number;
  5235. /** !#en The volume of the video.
  5236. !#zh 视频的音量(0.0 ~ 1.0) */
  5237. volume: number;
  5238. /** !#en Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume.
  5239. !#zh 是否静音视频。静音时设置音量为 0,取消静音是恢复原来的音量。 */
  5240. mute: boolean;
  5241. /** !#en Whether keep the aspect ration of the original video.
  5242. !#zh 是否保持视频原来的宽高比 */
  5243. keepAspectRatio: boolean;
  5244. /** !#en Whether play video in fullscreen mode.
  5245. !#zh 是否全屏播放视频 */
  5246. isFullscreen: boolean;
  5247. /** !#en Always below the game view (only useful on Web. Note: The specific effects are not guaranteed to be consistent, depending on whether each browser supports or restricts).
  5248. !#zh 永远在游戏视图最底层(这个属性只有在 Web 平台上有效果。注意:具体效果无法保证一致,跟各个浏览器是否支持与限制有关) */
  5249. stayOnBottom: boolean;
  5250. /** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.
  5251. !#zh 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。 */
  5252. videoPlayerEvent: Component.EventHandler[];
  5253. /**
  5254. !#en If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.
  5255. !#zh 如果视频被暂停播放了,调用这个接口可以继续播放。如果视频被停止播放了,调用这个接口可以从头开始播放。
  5256. */
  5257. play(): void;
  5258. /**
  5259. !#en If a video is paused, call this method to resume playing.
  5260. !#zh 如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  5261. */
  5262. resume(): void;
  5263. /**
  5264. !#en If a video is playing, call this method to pause playing.
  5265. !#zh 如果一个视频正在播放,调用这个接口可以暂停播放。
  5266. */
  5267. pause(): void;
  5268. /**
  5269. !#en If a video is playing, call this method to stop playing immediately.
  5270. !#zh 如果一个视频正在播放,调用这个接口可以立马停止播放。
  5271. */
  5272. stop(): void;
  5273. /**
  5274. !#en Gets the duration of the video
  5275. !#zh 获取视频文件的播放总时长
  5276. */
  5277. getDuration(): number;
  5278. /**
  5279. !#en Determine whether video is playing or not.
  5280. !#zh 判断当前视频是否处于播放状态
  5281. */
  5282. isPlaying(): boolean;
  5283. /**
  5284. !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should
  5285. call the destroy method on this component or the associated node explicitly.
  5286. Otherwise, the created DOM element won't be removed from web page.
  5287. !#zh
  5288. 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  5289. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  5290. @example
  5291. ```js
  5292. videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false);
  5293. // when you don't need videoplayer anymore
  5294. videoplayer.node.destroy();
  5295. ```
  5296. */
  5297. destroy(): boolean;
  5298. }
  5299. /** !#en cc.WebView is a component for display web pages in the game. Because different platforms have different authorization, API and control methods for WebView component. And have not yet formed a unified standard, only Web, iOS, and Android platforms are currently supported.
  5300. !#zh WebView 组件,用于在游戏中显示网页。由于不同平台对于 WebView 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  5301. export class WebView extends Component {
  5302. /** !#en A given URL to be loaded by the WebView, it should have a http or https prefix.
  5303. !#zh 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串 */
  5304. url: string;
  5305. /** !#en The webview's event callback , it will be triggered when certain webview event occurs.
  5306. !#zh WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数 */
  5307. webviewLoadedEvents: Component.EventHandler[];
  5308. /**
  5309. !#en
  5310. Set javascript interface scheme (see also setOnJSCallback). <br/>
  5311. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  5312. Please refer to the official documentation for more details.
  5313. !#zh
  5314. 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。<br/>
  5315. 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。<br/>
  5316. 详情请参阅官方文档
  5317. @param scheme scheme
  5318. */
  5319. setJavascriptInterfaceScheme(scheme: string): void;
  5320. /**
  5321. !#en
  5322. This callback called when load URL that start with javascript
  5323. interface scheme (see also setJavascriptInterfaceScheme). <br/>
  5324. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  5325. Please refer to the official documentation for more details.
  5326. !#zh
  5327. 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。<br/>
  5328. 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  5329. 详情请参阅官方文档
  5330. @param callback callback
  5331. */
  5332. setOnJSCallback(callback: Function): void;
  5333. /**
  5334. !#en
  5335. Evaluates JavaScript in the context of the currently displayed page. <br/>
  5336. Please refer to the official document for more details <br/>
  5337. Note: Cross domain issues need to be resolved by yourself <br/>
  5338. !#zh
  5339. 执行 WebView 内部页面脚本(详情请参阅官方文档) <br/>
  5340. 注意:需要自行解决跨域问题
  5341. @param str str
  5342. */
  5343. evaluateJS(str: string): void;
  5344. /**
  5345. !#en if you don't need the WebView and it isn't in any running Scene, you should
  5346. call the destroy method on this component or the associated node explicitly.
  5347. Otherwise, the created DOM element won't be removed from web page.
  5348. !#zh
  5349. 如果你不再使用 WebView,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  5350. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  5351. @example
  5352. ```js
  5353. webview.node.parent = null; // or webview.node.removeFromParent(false);
  5354. // when you don't need webview anymore
  5355. webview.node.destroy();
  5356. ```
  5357. */
  5358. destroy(): boolean;
  5359. }
  5360. /** !#en
  5361. Camera is usefull when making reel game or other games which need scroll screen.
  5362. Using camera will be more efficient than moving node to scroll screen.
  5363. Camera
  5364. !#zh
  5365. 摄像机在制作卷轴或是其他需要移动屏幕的游戏时比较有用,使用摄像机将会比移动节点来移动屏幕更加高效。 */
  5366. export class Camera extends Component {
  5367. /** !#en
  5368. The camera zoom ratio, only support 2D camera.
  5369. !#zh
  5370. 摄像机缩放比率, 只支持 2D camera。 */
  5371. zoomRatio: number;
  5372. /** !#en
  5373. Field of view. The width of the Camera’s view angle, measured in degrees along the local Y axis.
  5374. !#zh
  5375. 决定摄像机视角的宽度,当摄像机处于透视投影模式下这个属性才会生效。 */
  5376. fov: number;
  5377. /** !#en
  5378. The viewport size of the Camera when set to orthographic projection.
  5379. !#zh
  5380. 摄像机在正交投影模式下的视窗大小。 */
  5381. orthoSize: number;
  5382. /** !#en
  5383. The near clipping plane.
  5384. !#zh
  5385. 摄像机的近剪裁面。 */
  5386. nearClip: number;
  5387. /** !#en
  5388. The far clipping plane.
  5389. !#zh
  5390. 摄像机的远剪裁面。 */
  5391. farClip: number;
  5392. /** !#en
  5393. Is the camera orthographic (true) or perspective (false)?
  5394. !#zh
  5395. 设置摄像机的投影模式是正交还是透视模式。 */
  5396. ortho: boolean;
  5397. /** !#en
  5398. Four values (0 ~ 1) that indicate where on the screen this camera view will be drawn.
  5399. !#zh
  5400. 决定摄像机绘制在屏幕上哪个位置,值为(0 ~ 1)。 */
  5401. rect: Rect;
  5402. /** !#en
  5403. This is used to render parts of the scene selectively.
  5404. !#zh
  5405. 决定摄像机会渲染场景的哪一部分。 */
  5406. cullingMask: number;
  5407. /** !#en
  5408. Determining what to clear when camera rendering.
  5409. !#zh
  5410. 决定摄像机渲染时会清除哪些状态。 */
  5411. clearFlags: Camera.ClearFlags;
  5412. /** !#en
  5413. The color with which the screen will be cleared.
  5414. !#zh
  5415. 摄像机用于清除屏幕的背景色。 */
  5416. backgroundColor: Color;
  5417. /** !#en
  5418. Camera's depth in the camera rendering order. Cameras with higher depth are rendered after cameras with lower depth.
  5419. !#zh
  5420. 摄像机深度。用于决定摄像机的渲染顺序,值越大渲染在越上层。 */
  5421. depth: number;
  5422. /** !#en
  5423. Destination render texture.
  5424. Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture.
  5425. !#zh
  5426. 摄像机渲染的目标 RenderTexture。
  5427. 一般摄像机会直接渲染到屏幕上,但是有一些效果可以使用摄像机渲染到 RenderTexture 上再对 RenderTexture 进行处理来实现。 */
  5428. targetTexture: RenderTexture;
  5429. /** !#en
  5430. Sets the camera's render stages.
  5431. !#zh
  5432. 设置摄像机渲染的阶段 */
  5433. renderStages: number;
  5434. /** !#en Whether auto align camera viewport to screen
  5435. !#zh 是否自动将摄像机的视口对准屏幕 */
  5436. alignWithScreen: boolean;
  5437. /** !#en
  5438. The primary camera in the scene. Returns the rear most rendered camera, which is the camera with the lowest depth.
  5439. !#zh
  5440. 当前场景中激活的主摄像机。将会返回渲染在屏幕最底层,也就是 depth 最小的摄像机。 */
  5441. static main: Camera;
  5442. /** !#en
  5443. All enabled cameras.
  5444. !#zh
  5445. 当前激活的所有摄像机。 */
  5446. static cameras: Camera[];
  5447. /**
  5448. !#en
  5449. Get the first camera which the node belong to.
  5450. !#zh
  5451. 获取节点所在的第一个摄像机。
  5452. @param node node
  5453. */
  5454. static findCamera(node: Node): Camera;
  5455. /**
  5456. !#en
  5457. Get the screen to world matrix, only support 2D camera which alignWithScreen is true.
  5458. !#zh
  5459. 获取屏幕坐标系到世界坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  5460. @param out the matrix to receive the result
  5461. */
  5462. getScreenToWorldMatrix2D(out: Mat4): Mat4;
  5463. /**
  5464. !#en
  5465. Get the world to camera matrix, only support 2D camera which alignWithScreen is true.
  5466. !#zh
  5467. 获取世界坐标系到摄像机坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  5468. @param out the matrix to receive the result
  5469. */
  5470. getWorldToScreenMatrix2D(out: Mat4): Mat4;
  5471. /**
  5472. !#en
  5473. Convert point from screen to world.
  5474. !#zh
  5475. 将坐标从屏幕坐标系转换到世界坐标系。
  5476. @param screenPosition screenPosition
  5477. @param out out
  5478. */
  5479. getScreenToWorldPoint(screenPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  5480. /**
  5481. !#en
  5482. Convert point from world to screen.
  5483. !#zh
  5484. 将坐标从世界坐标系转化到屏幕坐标系。
  5485. @param worldPosition worldPosition
  5486. @param out out
  5487. */
  5488. getWorldToScreenPoint(worldPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  5489. /**
  5490. !#en
  5491. Get a ray from screen position
  5492. !#zh
  5493. 从屏幕坐标获取一条射线
  5494. @param screenPos screenPos
  5495. */
  5496. getRay(screenPos: Vec2): geomUtils.Ray;
  5497. /**
  5498. !#en
  5499. Check whether the node is in the camera.
  5500. !#zh
  5501. 检测节点是否被此摄像机影响
  5502. @param node the node which need to check
  5503. */
  5504. containsNode(node: Node): boolean;
  5505. /**
  5506. !#en
  5507. Render the camera manually.
  5508. !#zh
  5509. 手动渲染摄像机。
  5510. @param root root
  5511. */
  5512. render(root: Node): void;
  5513. /**
  5514. !#en
  5515. Returns the matrix that transform the node's (local) space coordinates into the camera's space coordinates.
  5516. !#zh
  5517. 返回一个将节点坐标系转换到摄像机坐标系下的矩阵
  5518. @param node the node which should transform
  5519. */
  5520. getNodeToCameraTransform(node: Node): AffineTransform;
  5521. /**
  5522. !#en
  5523. Conver a camera coordinates point to world coordinates.
  5524. !#zh
  5525. 将一个摄像机坐标系下的点转换到世界坐标系下。
  5526. @param point the point which should transform
  5527. @param out the point to receive the result
  5528. */
  5529. getCameraToWorldPoint(point: Vec2, out?: Vec2): Vec2;
  5530. /**
  5531. !#en
  5532. Conver a world coordinates point to camera coordinates.
  5533. !#zh
  5534. 将一个世界坐标系下的点转换到摄像机坐标系下。
  5535. @param point point
  5536. @param out the point to receive the result
  5537. */
  5538. getWorldToCameraPoint(point: Vec2, out?: Vec2): Vec2;
  5539. /**
  5540. !#en
  5541. Get the camera to world matrix
  5542. !#zh
  5543. 获取摄像机坐标系到世界坐标系的矩阵
  5544. @param out the matrix to receive the result
  5545. */
  5546. getCameraToWorldMatrix(out: Mat4): Mat4;
  5547. /**
  5548. !#en
  5549. Get the world to camera matrix
  5550. !#zh
  5551. 获取世界坐标系到摄像机坐标系的矩阵
  5552. @param out the matrix to receive the result
  5553. */
  5554. getWorldToCameraMatrix(out: Mat4): Mat4;
  5555. }
  5556. /** !#en The Light Component
  5557. !#zh 光源组件 */
  5558. export class Light extends Component {
  5559. }
  5560. /** !#en
  5561. Base class for handling assets used in Creator.<br/>
  5562. You may want to override:<br/>
  5563. - createNode<br/>
  5564. - getset functions of _nativeAsset<br/>
  5565. - cc.Object._serialize<br/>
  5566. - cc.Object._deserialize<br/>
  5567. !#zh
  5568. Creator 中的资源基类。<br/>
  5569. 您可能需要重写:<br/>
  5570. - createNode <br/>
  5571. - _nativeAsset 的 getset 方法<br/>
  5572. - cc.Object._serialize<br/>
  5573. - cc.Object._deserialize<br/> */
  5574. export class Asset extends Object {
  5575. /** !#en
  5576. Whether the asset is loaded or not.
  5577. !#zh
  5578. 该资源是否已经成功加载。 */
  5579. loaded: boolean;
  5580. /** !#en
  5581. Returns the url of this asset's native object, if none it will returns an empty string.
  5582. !#zh
  5583. 返回该资源对应的目标平台资源的 URL,如果没有将返回一个空字符串。 */
  5584. nativeUrl: string;
  5585. /** !#en
  5586. The number of reference
  5587. !#zh
  5588. 引用的数量 */
  5589. refCount: number;
  5590. /** !#en Indicates whether its dependent raw assets can support deferred load if the owner scene (or prefab) is marked as `asyncLoadAssets`.
  5591. !#zh 当场景或 Prefab 被标记为 `asyncLoadAssets`,禁止延迟加载该资源所依赖的其它原始资源。 */
  5592. static preventDeferredLoadDependents: boolean;
  5593. /** !#en Indicates whether its native object should be preloaded from native url.
  5594. !#zh 禁止预加载原生对象。 */
  5595. static preventPreloadNativeObject: boolean;
  5596. /**
  5597. !#en
  5598. Returns the asset's url.
  5599. The `Asset` object overrides the `toString()` method of the `Object` object.
  5600. For `Asset` objects, the `toString()` method returns a string representation of the object.
  5601. JavaScript calls the `toString()` method automatically when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.
  5602. !#zh
  5603. 返回资源的 URL。
  5604. Asset 对象将会重写 Object 对象的 `toString()` 方法。
  5605. 对于 Asset 对象,`toString()` 方法返回该对象的字符串表示形式。
  5606. 当资源要表示为文本值时或在字符串连接时引用时,JavaScript 会自动调用 `toString()` 方法。
  5607. */
  5608. toString(): string;
  5609. /**
  5610. !#en
  5611. Create a new node using this asset in the scene.<br/>
  5612. If this type of asset dont have its corresponding node type, this method should be null.
  5613. !#zh
  5614. 使用该资源在场景中创建一个新节点。<br/>
  5615. 如果这类资源没有相应的节点类型,该方法应该是空的。
  5616. @param callback callback
  5617. */
  5618. createNode(callback: (error: string, node: any) => void): void;
  5619. /**
  5620. !#en
  5621. Add references of asset
  5622. !#zh
  5623. 增加资源的引用
  5624. */
  5625. addRef(): cc.Asset;
  5626. /**
  5627. !#en
  5628. Reduce references of asset and it will be auto released when refCount equals 0.
  5629. !#zh
  5630. 减少资源的引用并尝试进行自动释放。
  5631. */
  5632. decRef(): cc.Asset;
  5633. /** `cc.Asset.url` is deprecated, please use {{#crossLink "Asset/nativeUrl:property"}}{{/crossLink}} instead */
  5634. url: string;
  5635. }
  5636. /** !#en Class for audio data handling.
  5637. !#zh 音频资源类。 */
  5638. export class AudioClip extends Asset implements EventTarget {
  5639. /**
  5640. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5641. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5642. @param type The type of event.
  5643. */
  5644. hasEventListener(type: string): boolean;
  5645. /**
  5646. !#en
  5647. Register an callback of a specific event type on the EventTarget.
  5648. This type of event should be triggered via `emit`.
  5649. !#zh
  5650. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5651. @param type A string representing the event type to listen for.
  5652. @param callback The callback that will be invoked when the event is dispatched.
  5653. The callback is ignored if it is a duplicate (the callbacks are unique).
  5654. @param target The target (this object) to invoke the callback, can be null
  5655. @example
  5656. ```js
  5657. eventTarget.on('fire', function () {
  5658. cc.log("fire in the hole");
  5659. }, node);
  5660. ```
  5661. */
  5662. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5663. /**
  5664. !#en
  5665. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5666. if only type is passed as parameter, all listeners registered with that type will be removed.
  5667. !#zh
  5668. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5669. @param type A string representing the event type being removed.
  5670. @param callback The callback to remove.
  5671. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5672. @example
  5673. ```js
  5674. // register fire eventListener
  5675. var callback = eventTarget.on('fire', function () {
  5676. cc.log("fire in the hole");
  5677. }, target);
  5678. // remove fire event listener
  5679. eventTarget.off('fire', callback, target);
  5680. // remove all fire event listeners
  5681. eventTarget.off('fire');
  5682. ```
  5683. */
  5684. off(type: string, callback?: Function, target?: any): void;
  5685. /**
  5686. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5687. This is not for removing all listeners in the current event target,
  5688. and this is not for removing all listeners the target parameter have registered.
  5689. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5690. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5691. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5692. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5693. @param target The target to be searched for all related listeners
  5694. */
  5695. targetOff(target: any): void;
  5696. /**
  5697. !#en
  5698. Register an callback of a specific event type on the EventTarget,
  5699. the callback will remove itself after the first time it is triggered.
  5700. !#zh
  5701. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5702. @param type A string representing the event type to listen for.
  5703. @param callback The callback that will be invoked when the event is dispatched.
  5704. The callback is ignored if it is a duplicate (the callbacks are unique).
  5705. @param target The target (this object) to invoke the callback, can be null
  5706. @example
  5707. ```js
  5708. eventTarget.once('fire', function () {
  5709. cc.log("this is the callback and will be invoked only once");
  5710. }, node);
  5711. ```
  5712. */
  5713. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5714. /**
  5715. !#en
  5716. Send an event with the event object.
  5717. !#zh
  5718. 通过事件对象派发事件
  5719. @param event event
  5720. */
  5721. dispatchEvent(event: Event): void;
  5722. }
  5723. /** !#en Class for BitmapFont handling.
  5724. !#zh 位图字体资源类。 */
  5725. export class BitmapFont extends Font {
  5726. }
  5727. /** undefined */
  5728. export class BufferAsset extends Asset {
  5729. }
  5730. /** !#en Class for Font handling.
  5731. !#zh 字体资源类。 */
  5732. export class Font extends Asset {
  5733. }
  5734. /** !#en
  5735. Class for JSON file. When the JSON file is loaded, this object is returned.
  5736. The parsed JSON object can be accessed through the `json` attribute in it.<br>
  5737. If you want to get the original JSON text, you should modify the extname to `.txt`
  5738. so that it is loaded as a `TextAsset` instead of a `JsonAsset`.
  5739. !#zh
  5740. JSON 资源类。JSON 文件加载后,将会返回该对象。可以通过其中的 `json` 属性访问解析后的 JSON 对象。<br>
  5741. 如果你想要获得 JSON 的原始文本,那么应该修改源文件的后缀为 `.txt`,这样就会加载为一个 `TextAsset` 而不是 `JsonAsset`。 */
  5742. export class JsonAsset extends Asset {
  5743. /** The loaded JSON object. */
  5744. json: any;
  5745. }
  5746. /** !#en Class for LabelAtlas handling.
  5747. !#zh 艺术数字字体资源类。 */
  5748. export class LabelAtlas extends BitmapFont {
  5749. }
  5750. /** !#en Class for prefab handling.
  5751. !#zh 预制资源类。 */
  5752. export class Prefab extends Asset {
  5753. /** the main cc.Node in the prefab */
  5754. data: Node;
  5755. /** !#zh
  5756. 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。
  5757. !#en
  5758. Indicates the optimization policy for instantiating this prefab.
  5759. Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab. */
  5760. optimizationPolicy: Prefab.OptimizationPolicy;
  5761. /** !#en Indicates the raw assets of this prefab can be load after prefab loaded.
  5762. !#zh 指示该 Prefab 依赖的资源可否在 Prefab 加载后再延迟加载。 */
  5763. asyncLoadAssets: boolean;
  5764. readonly: boolean;
  5765. /**
  5766. Dynamically translation prefab data into minimized code.<br/>
  5767. This method will be called automatically before the first time the prefab being instantiated,
  5768. but you can re-call to refresh the create function once you modified the original prefab data in script.
  5769. */
  5770. compileCreateFunction(): void;
  5771. }
  5772. /** Render textures are textures that can be rendered to. */
  5773. export class RenderTexture extends Texture2D {
  5774. /**
  5775. !#en
  5776. Init the render texture with size.
  5777. !#zh
  5778. 初始化 render texture
  5779. @param width width
  5780. @param height height
  5781. @param depthStencilFormat depthStencilFormat
  5782. */
  5783. initWithSize(width?: number, height?: number, depthStencilFormat?: number): void;
  5784. /**
  5785. !#en
  5786. Get pixels from render texture, the pixels data stores in a RGBA Uint8Array.
  5787. It will return a new (width * height * 4) length Uint8Array by default。
  5788. You can specify a data to store the pixels to reuse the data,
  5789. you and can specify other params to specify the texture region to read.
  5790. !#zh
  5791. 从 render texture 读取像素数据,数据类型为 RGBA 格式的 Uint8Array 数组。
  5792. 默认每次调用此函数会生成一个大小为 (长 x 高 x 4) 的 Uint8Array。
  5793. 你可以通过传入 data 来接收像素数据,也可以通过传参来指定需要读取的区域的像素。
  5794. @param data data
  5795. @param x x
  5796. @param y y
  5797. @param w w
  5798. @param h h
  5799. */
  5800. readPixels(data?: Uint8Array, x?: number, y?: number, w?: number, h?: number): Uint8Array;
  5801. }
  5802. /** !#en Class for scene handling.
  5803. !#zh 场景资源类。 */
  5804. export class SceneAsset extends Asset {
  5805. scene: Scene;
  5806. /** !#en Indicates the raw assets of this scene can be load after scene launched.
  5807. !#zh 指示该场景依赖的资源可否在场景切换后再延迟加载。 */
  5808. asyncLoadAssets: boolean;
  5809. }
  5810. /** !#en Class for script handling.
  5811. !#zh Script 资源类。 */
  5812. export class _Script extends Asset {
  5813. }
  5814. /** !#en Class for JavaScript handling.
  5815. !#zh JavaScript 资源类。 */
  5816. export class _JavaScript extends Asset {
  5817. }
  5818. /** !#en Class for TypeScript handling.
  5819. !#zh TypeScript 资源类。 */
  5820. export class TypeScript extends Asset {
  5821. }
  5822. /** !#en Class for sprite atlas handling.
  5823. !#zh 精灵图集资源类。 */
  5824. export class SpriteAtlas extends Asset {
  5825. /**
  5826. Returns the texture of the sprite atlas
  5827. */
  5828. getTexture(): Texture2D;
  5829. /**
  5830. Returns the sprite frame correspond to the given key in sprite atlas.
  5831. @param key key
  5832. */
  5833. getSpriteFrame(key: string): SpriteFrame;
  5834. /**
  5835. Returns the sprite frames in sprite atlas.
  5836. */
  5837. getSpriteFrames(): SpriteFrame[];
  5838. }
  5839. /** !#en
  5840. A cc.SpriteFrame has:<br/>
  5841. - texture: A cc.Texture2D that will be used by render components<br/>
  5842. - rectangle: A rectangle of the texture
  5843. !#zh
  5844. 一个 SpriteFrame 包含:<br/>
  5845. - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
  5846. - 矩形:在纹理中的矩形区域。 */
  5847. export class SpriteFrame extends Asset implements EventTarget {
  5848. /** !#en Top border of the sprite
  5849. !#zh sprite 的顶部边框 */
  5850. insetTop: number;
  5851. /** !#en Bottom border of the sprite
  5852. !#zh sprite 的底部边框 */
  5853. insetBottom: number;
  5854. /** !#en Left border of the sprite
  5855. !#zh sprite 的左边边框 */
  5856. insetLeft: number;
  5857. /** !#en Right border of the sprite
  5858. !#zh sprite 的左边边框 */
  5859. insetRight: number;
  5860. /**
  5861. !#en
  5862. Constructor of SpriteFrame class.
  5863. !#zh
  5864. SpriteFrame 类的构造函数。
  5865. @param filename filename
  5866. @param rect rect
  5867. @param rotated Whether the frame is rotated in the texture
  5868. @param offset The offset of the frame in the texture
  5869. @param originalSize The size of the frame in the texture
  5870. */
  5871. constructor(filename?: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size);
  5872. /**
  5873. !#en Returns whether the texture have been loaded
  5874. !#zh 返回是否已加载纹理
  5875. */
  5876. textureLoaded(): boolean;
  5877. /**
  5878. !#en Returns whether the sprite frame is rotated in the texture.
  5879. !#zh 获取 SpriteFrame 是否旋转
  5880. */
  5881. isRotated(): boolean;
  5882. /**
  5883. !#en Set whether the sprite frame is rotated in the texture.
  5884. !#zh 设置 SpriteFrame 是否旋转
  5885. @param bRotated bRotated
  5886. */
  5887. setRotated(bRotated: boolean): void;
  5888. /**
  5889. !#en Returns whether the sprite frame is flip x axis in the texture.
  5890. !#zh 获取 SpriteFrame 是否反转 x 轴
  5891. */
  5892. isFlipX(): boolean;
  5893. /**
  5894. !#en Returns whether the sprite frame is flip y axis in the texture.
  5895. !#zh 获取 SpriteFrame 是否反转 y 轴
  5896. */
  5897. isFlipY(): boolean;
  5898. /**
  5899. !#en Set whether the sprite frame is flip x axis in the texture.
  5900. !#zh 设置 SpriteFrame 是否翻转 x 轴
  5901. @param flipX flipX
  5902. */
  5903. setFlipX(flipX: boolean): void;
  5904. /**
  5905. !#en Set whether the sprite frame is flip y axis in the texture.
  5906. !#zh 设置 SpriteFrame 是否翻转 y 轴
  5907. @param flipY flipY
  5908. */
  5909. setFlipY(flipY: boolean): void;
  5910. /**
  5911. !#en Returns the rect of the sprite frame in the texture.
  5912. !#zh 获取 SpriteFrame 的纹理矩形区域
  5913. */
  5914. getRect(): Rect;
  5915. /**
  5916. !#en Sets the rect of the sprite frame in the texture.
  5917. !#zh 设置 SpriteFrame 的纹理矩形区域
  5918. @param rect rect
  5919. */
  5920. setRect(rect: Rect): void;
  5921. /**
  5922. !#en Returns the original size of the trimmed image.
  5923. !#zh 获取修剪前的原始大小
  5924. */
  5925. getOriginalSize(): Size;
  5926. /**
  5927. !#en Sets the original size of the trimmed image.
  5928. !#zh 设置修剪前的原始大小
  5929. @param size size
  5930. */
  5931. setOriginalSize(size: Size): void;
  5932. /**
  5933. !#en Returns the texture of the frame.
  5934. !#zh 获取使用的纹理实例
  5935. */
  5936. getTexture(): Texture2D;
  5937. /**
  5938. !#en Returns the offset of the frame in the texture.
  5939. !#zh 获取偏移量
  5940. */
  5941. getOffset(): Vec2;
  5942. /**
  5943. !#en Sets the offset of the frame in the texture.
  5944. !#zh 设置偏移量
  5945. @param offsets offsets
  5946. */
  5947. setOffset(offsets: Vec2): void;
  5948. /**
  5949. !#en Clone the sprite frame.
  5950. !#zh 克隆 SpriteFrame
  5951. */
  5952. clone(): SpriteFrame;
  5953. /**
  5954. !#en Set SpriteFrame with Texture, rect, rotated, offset and originalSize.<br/>
  5955. !#zh 通过 Texture,rect,rotated,offset 和 originalSize 设置 SpriteFrame。
  5956. @param texture texture
  5957. @param rect rect
  5958. @param rotated rotated
  5959. @param offset offset
  5960. @param originalSize originalSize
  5961. */
  5962. setTexture(texture: Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size): boolean;
  5963. /**
  5964. !#en If a loading scene (or prefab) is marked as `asyncLoadAssets`, all the textures of the SpriteFrame which
  5965. associated by user's custom Components in the scene, will not preload automatically.
  5966. These textures will be load when Sprite component is going to render the SpriteFrames.
  5967. You can call this method if you want to load the texture early.
  5968. !#zh 当加载中的场景或 Prefab 被标记为 `asyncLoadAssets` 时,用户在场景中由自定义组件关联到的所有 SpriteFrame 的贴图都不会被提前加载。
  5969. 只有当 Sprite 组件要渲染这些 SpriteFrame 时,才会检查贴图是否加载。如果你希望加载过程提前,你可以手工调用这个方法。
  5970. @example
  5971. ```js
  5972. if (spriteFrame.textureLoaded()) {
  5973. this._onSpriteFrameLoaded();
  5974. }
  5975. else {
  5976. spriteFrame.once('load', this._onSpriteFrameLoaded, this);
  5977. spriteFrame.ensureLoadTexture();
  5978. }
  5979. ```
  5980. */
  5981. ensureLoadTexture(): void;
  5982. /**
  5983. !#en
  5984. If you do not need to use the SpriteFrame temporarily, you can call this method so that its texture could be garbage collected. Then when you need to render the SpriteFrame, you should call `ensureLoadTexture` manually to reload texture.
  5985. !#zh
  5986. 当你暂时不再使用这个 SpriteFrame 时,可以调用这个方法来保证引用的贴图对象能被 GC。然后当你要渲染 SpriteFrame 时,你需要手动调用 `ensureLoadTexture` 来重新加载贴图。
  5987. */
  5988. clearTexture(): void;
  5989. /**
  5990. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5991. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5992. @param type The type of event.
  5993. */
  5994. hasEventListener(type: string): boolean;
  5995. /**
  5996. !#en
  5997. Register an callback of a specific event type on the EventTarget.
  5998. This type of event should be triggered via `emit`.
  5999. !#zh
  6000. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6001. @param type A string representing the event type to listen for.
  6002. @param callback The callback that will be invoked when the event is dispatched.
  6003. The callback is ignored if it is a duplicate (the callbacks are unique).
  6004. @param target The target (this object) to invoke the callback, can be null
  6005. @example
  6006. ```js
  6007. eventTarget.on('fire', function () {
  6008. cc.log("fire in the hole");
  6009. }, node);
  6010. ```
  6011. */
  6012. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6013. /**
  6014. !#en
  6015. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6016. if only type is passed as parameter, all listeners registered with that type will be removed.
  6017. !#zh
  6018. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6019. @param type A string representing the event type being removed.
  6020. @param callback The callback to remove.
  6021. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6022. @example
  6023. ```js
  6024. // register fire eventListener
  6025. var callback = eventTarget.on('fire', function () {
  6026. cc.log("fire in the hole");
  6027. }, target);
  6028. // remove fire event listener
  6029. eventTarget.off('fire', callback, target);
  6030. // remove all fire event listeners
  6031. eventTarget.off('fire');
  6032. ```
  6033. */
  6034. off(type: string, callback?: Function, target?: any): void;
  6035. /**
  6036. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6037. This is not for removing all listeners in the current event target,
  6038. and this is not for removing all listeners the target parameter have registered.
  6039. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6040. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6041. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6042. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6043. @param target The target to be searched for all related listeners
  6044. */
  6045. targetOff(target: any): void;
  6046. /**
  6047. !#en
  6048. Register an callback of a specific event type on the EventTarget,
  6049. the callback will remove itself after the first time it is triggered.
  6050. !#zh
  6051. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6052. @param type A string representing the event type to listen for.
  6053. @param callback The callback that will be invoked when the event is dispatched.
  6054. The callback is ignored if it is a duplicate (the callbacks are unique).
  6055. @param target The target (this object) to invoke the callback, can be null
  6056. @example
  6057. ```js
  6058. eventTarget.once('fire', function () {
  6059. cc.log("this is the callback and will be invoked only once");
  6060. }, node);
  6061. ```
  6062. */
  6063. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6064. /**
  6065. !#en
  6066. Send an event with the event object.
  6067. !#zh
  6068. 通过事件对象派发事件
  6069. @param event event
  6070. */
  6071. dispatchEvent(event: Event): void;
  6072. }
  6073. /** !#en Class for TTFFont handling.
  6074. !#zh TTF 字体资源类。 */
  6075. export class TTFFont extends Font {
  6076. }
  6077. /** !#en Class for text file.
  6078. !#zh 文本资源类。 */
  6079. export class TextAsset extends Asset {
  6080. /** The text contents of the resource. */
  6081. text: string;
  6082. }
  6083. /** This class allows to easily create OpenGL or Canvas 2D textures from images or raw data. */
  6084. export class Texture2D extends Asset implements EventTarget {
  6085. /** !#en Sets whether generate mipmaps for the texture
  6086. !#zh 是否为纹理设置生成 mipmaps。 */
  6087. genMipmaps: boolean;
  6088. /** !#en
  6089. Sets whether texture can be packed into texture atlas.
  6090. If need use texture uv in custom Effect, please sets packable to false.
  6091. !#zh
  6092. 设置纹理是否允许参与合图。
  6093. 如果需要在自定义 Effect 中使用纹理 UV,需要禁止该选项。 */
  6094. packable: boolean;
  6095. /** !#en
  6096. Whether the texture is loaded or not
  6097. !#zh
  6098. 贴图是否已经成功加载 */
  6099. loaded: boolean;
  6100. /** !#en
  6101. Texture width in pixel
  6102. !#zh
  6103. 贴图像素宽度 */
  6104. width: number;
  6105. /** !#en
  6106. Texture height in pixel
  6107. !#zh
  6108. 贴图像素高度 */
  6109. height: number;
  6110. /**
  6111. !#en
  6112. Get renderer texture implementation object
  6113. extended from render.Texture2D
  6114. !#zh 返回渲染器内部贴图对象
  6115. */
  6116. getImpl(): void;
  6117. /**
  6118. Update texture options, not available in Canvas render mode.
  6119. image, format, premultiplyAlpha can not be updated in native.
  6120. @param options options
  6121. */
  6122. update(options: {image: DOMImageElement; genMipmaps: boolean; format: Texture2D.PixelFormat; minFilter: Texture2D.Filter; magFilter: Texture2D.Filter; wrapS: WrapMode; wrapT: WrapMode; premultiplyAlpha: boolean; }): void;
  6123. /**
  6124. !#en
  6125. Init with HTML element.
  6126. !#zh 用 HTML Image 或 Canvas 对象初始化贴图。
  6127. @param element element
  6128. @example
  6129. ```js
  6130. var img = new Image();
  6131. img.src = dataURL;
  6132. texture.initWithElement(img);
  6133. ```
  6134. */
  6135. initWithElement(element: HTMLImageElement|HTMLCanvasElement): void;
  6136. /**
  6137. !#en
  6138. Intializes with a texture2d with data in Uint8Array.
  6139. !#zh 使用一个存储在 Unit8Array 中的图像数据(raw data)初始化数据。
  6140. @param data data
  6141. @param pixelFormat pixelFormat
  6142. @param pixelsWidth pixelsWidth
  6143. @param pixelsHeight pixelsHeight
  6144. */
  6145. initWithData(data: DataView, pixelFormat: number, pixelsWidth: number, pixelsHeight: number): boolean;
  6146. /**
  6147. !#en
  6148. HTMLElement Object getter, available only on web.<br/>
  6149. Note: texture is packed into texture atlas by default<br/>
  6150. you should set texture.packable as false before getting Html element object.
  6151. !#zh 获取当前贴图对应的 HTML Image 或 Canvas 对象,只在 Web 平台下有效。<br/>
  6152. 注意:<br/>
  6153. texture 默认参与动态合图,如果需要获取到正确的 Html 元素对象,需要先设置 texture.packable 为 false
  6154. */
  6155. getHtmlElementObj(): HTMLImageElement;
  6156. /**
  6157. !#en
  6158. Destory this texture and immediately release its video memory. (Inherit from cc.Object.destroy)<br>
  6159. After destroy, this object is not usable anymore.
  6160. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  6161. !#zh
  6162. 销毁该贴图,并立即释放它对应的显存。(继承自 cc.Object.destroy)<br/>
  6163. 销毁后,该对象不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  6164. */
  6165. destroy(): boolean;
  6166. /**
  6167. !#en
  6168. Pixel format of the texture.
  6169. !#zh 获取纹理的像素格式。
  6170. */
  6171. getPixelFormat(): number;
  6172. /**
  6173. !#en
  6174. Whether or not the texture has their Alpha premultiplied.
  6175. !#zh 检查纹理在上传 GPU 时预乘选项是否开启。
  6176. */
  6177. hasPremultipliedAlpha(): boolean;
  6178. /**
  6179. !#en
  6180. Handler of texture loaded event.
  6181. Since v2.0, you don't need to invoke this function, it will be invoked automatically after texture loaded.
  6182. !#zh 贴图加载事件处理器。v2.0 之后你将不在需要手动执行这个函数,它会在贴图加载成功之后自动执行。
  6183. @param premultiplied premultiplied
  6184. */
  6185. handleLoadedTexture(premultiplied?: boolean): void;
  6186. /**
  6187. !#en
  6188. Description of cc.Texture2D.
  6189. !#zh cc.Texture2D 描述。
  6190. */
  6191. description(): string;
  6192. /**
  6193. !#en
  6194. Release texture, please use destroy instead.
  6195. !#zh 释放纹理,请使用 destroy 替代。
  6196. */
  6197. releaseTexture(): void;
  6198. /**
  6199. !#en Sets the wrap s and wrap t options. <br/>
  6200. If the texture size is NPOT (non power of 2), then in can only use gl.CLAMP_TO_EDGE in gl.TEXTURE_WRAP_{S,T}.
  6201. !#zh 设置纹理包装模式。
  6202. 若纹理贴图尺寸是 NPOT(non power of 2),则只能使用 Texture2D.WrapMode.CLAMP_TO_EDGE。
  6203. @param wrapS wrapS
  6204. @param wrapT wrapT
  6205. */
  6206. setTexParameters(wrapS: Texture2D.WrapMode, wrapT: Texture2D.WrapMode): void;
  6207. /**
  6208. !#en Sets the minFilter and magFilter options
  6209. !#zh 设置纹理贴图缩小和放大过滤器算法选项。
  6210. @param minFilter minFilter
  6211. @param magFilter magFilter
  6212. */
  6213. setFilters(minFilter: Texture2D.Filter, magFilter: Texture2D.Filter): void;
  6214. /**
  6215. !#en
  6216. Sets the flipY options
  6217. !#zh 设置贴图的纵向翻转选项。
  6218. @param flipY flipY
  6219. */
  6220. setFlipY(flipY: boolean): void;
  6221. /**
  6222. !#en
  6223. Sets the premultiply alpha options
  6224. !#zh 设置贴图的预乘选项。
  6225. @param premultiply premultiply
  6226. */
  6227. setPremultiplyAlpha(premultiply: boolean): void;
  6228. /**
  6229. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6230. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6231. @param type The type of event.
  6232. */
  6233. hasEventListener(type: string): boolean;
  6234. /**
  6235. !#en
  6236. Register an callback of a specific event type on the EventTarget.
  6237. This type of event should be triggered via `emit`.
  6238. !#zh
  6239. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6240. @param type A string representing the event type to listen for.
  6241. @param callback The callback that will be invoked when the event is dispatched.
  6242. The callback is ignored if it is a duplicate (the callbacks are unique).
  6243. @param target The target (this object) to invoke the callback, can be null
  6244. @example
  6245. ```js
  6246. eventTarget.on('fire', function () {
  6247. cc.log("fire in the hole");
  6248. }, node);
  6249. ```
  6250. */
  6251. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6252. /**
  6253. !#en
  6254. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6255. if only type is passed as parameter, all listeners registered with that type will be removed.
  6256. !#zh
  6257. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6258. @param type A string representing the event type being removed.
  6259. @param callback The callback to remove.
  6260. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6261. @example
  6262. ```js
  6263. // register fire eventListener
  6264. var callback = eventTarget.on('fire', function () {
  6265. cc.log("fire in the hole");
  6266. }, target);
  6267. // remove fire event listener
  6268. eventTarget.off('fire', callback, target);
  6269. // remove all fire event listeners
  6270. eventTarget.off('fire');
  6271. ```
  6272. */
  6273. off(type: string, callback?: Function, target?: any): void;
  6274. /**
  6275. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6276. This is not for removing all listeners in the current event target,
  6277. and this is not for removing all listeners the target parameter have registered.
  6278. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6279. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6280. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6281. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6282. @param target The target to be searched for all related listeners
  6283. */
  6284. targetOff(target: any): void;
  6285. /**
  6286. !#en
  6287. Register an callback of a specific event type on the EventTarget,
  6288. the callback will remove itself after the first time it is triggered.
  6289. !#zh
  6290. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6291. @param type A string representing the event type to listen for.
  6292. @param callback The callback that will be invoked when the event is dispatched.
  6293. The callback is ignored if it is a duplicate (the callbacks are unique).
  6294. @param target The target (this object) to invoke the callback, can be null
  6295. @example
  6296. ```js
  6297. eventTarget.once('fire', function () {
  6298. cc.log("this is the callback and will be invoked only once");
  6299. }, node);
  6300. ```
  6301. */
  6302. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6303. /**
  6304. !#en
  6305. Send an event with the event object.
  6306. !#zh
  6307. 通过事件对象派发事件
  6308. @param event event
  6309. */
  6310. dispatchEvent(event: Event): void;
  6311. }
  6312. /** !#en Box Collider.
  6313. !#zh 包围盒碰撞组件 */
  6314. export class BoxCollider extends Collider implements Collider.Box {
  6315. /** !#en Position offset
  6316. !#zh 位置偏移量 */
  6317. offset: Vec2;
  6318. /** !#en Box size
  6319. !#zh 包围盒大小 */
  6320. size: Size;
  6321. }
  6322. /** !#en Circle Collider.
  6323. !#zh 圆形碰撞组件 */
  6324. export class CircleCollider extends Collider implements Collider.Circle {
  6325. /** !#en Position offset
  6326. !#zh 位置偏移量 */
  6327. offset: Vec2;
  6328. /** !#en Circle radius
  6329. !#zh 圆形半径 */
  6330. radius: number;
  6331. }
  6332. /** !#en Collider component base class.
  6333. !#zh 碰撞组件基类 */
  6334. export class Collider extends Component {
  6335. /** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  6336. !#zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */
  6337. tag: number;
  6338. }
  6339. /** !#en
  6340. A simple collision manager class.
  6341. It will calculate whether the collider collides other colliders, if collides then call the callbacks.
  6342. !#zh
  6343. 一个简单的碰撞组件管理类,用于处理节点之间的碰撞组件是否产生了碰撞,并调用相应回调函数。 */
  6344. export class CollisionManager implements EventTarget {
  6345. /** !#en
  6346. !#zh
  6347. 是否开启碰撞管理,默认为不开启 */
  6348. enabled: boolean;
  6349. /** !#en
  6350. !#zh
  6351. 是否绘制碰撞组件的包围盒,默认为不绘制 */
  6352. enabledDrawBoundingBox: boolean;
  6353. /** !#en
  6354. !#zh
  6355. 是否绘制碰撞组件的形状,默认为不绘制 */
  6356. enabledDebugDraw: boolean;
  6357. /**
  6358. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6359. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6360. @param type The type of event.
  6361. */
  6362. hasEventListener(type: string): boolean;
  6363. /**
  6364. !#en
  6365. Register an callback of a specific event type on the EventTarget.
  6366. This type of event should be triggered via `emit`.
  6367. !#zh
  6368. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6369. @param type A string representing the event type to listen for.
  6370. @param callback The callback that will be invoked when the event is dispatched.
  6371. The callback is ignored if it is a duplicate (the callbacks are unique).
  6372. @param target The target (this object) to invoke the callback, can be null
  6373. @example
  6374. ```js
  6375. eventTarget.on('fire', function () {
  6376. cc.log("fire in the hole");
  6377. }, node);
  6378. ```
  6379. */
  6380. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6381. /**
  6382. !#en
  6383. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6384. if only type is passed as parameter, all listeners registered with that type will be removed.
  6385. !#zh
  6386. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6387. @param type A string representing the event type being removed.
  6388. @param callback The callback to remove.
  6389. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6390. @example
  6391. ```js
  6392. // register fire eventListener
  6393. var callback = eventTarget.on('fire', function () {
  6394. cc.log("fire in the hole");
  6395. }, target);
  6396. // remove fire event listener
  6397. eventTarget.off('fire', callback, target);
  6398. // remove all fire event listeners
  6399. eventTarget.off('fire');
  6400. ```
  6401. */
  6402. off(type: string, callback?: Function, target?: any): void;
  6403. /**
  6404. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6405. This is not for removing all listeners in the current event target,
  6406. and this is not for removing all listeners the target parameter have registered.
  6407. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6408. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6409. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6410. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6411. @param target The target to be searched for all related listeners
  6412. */
  6413. targetOff(target: any): void;
  6414. /**
  6415. !#en
  6416. Register an callback of a specific event type on the EventTarget,
  6417. the callback will remove itself after the first time it is triggered.
  6418. !#zh
  6419. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6420. @param type A string representing the event type to listen for.
  6421. @param callback The callback that will be invoked when the event is dispatched.
  6422. The callback is ignored if it is a duplicate (the callbacks are unique).
  6423. @param target The target (this object) to invoke the callback, can be null
  6424. @example
  6425. ```js
  6426. eventTarget.once('fire', function () {
  6427. cc.log("this is the callback and will be invoked only once");
  6428. }, node);
  6429. ```
  6430. */
  6431. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6432. /**
  6433. !#en
  6434. Send an event with the event object.
  6435. !#zh
  6436. 通过事件对象派发事件
  6437. @param event event
  6438. */
  6439. dispatchEvent(event: Event): void;
  6440. }
  6441. /** !#en Intersection helper class
  6442. !#zh 辅助类,用于测试形状与形状是否相交 */
  6443. export class Intersection {
  6444. /**
  6445. !#en Test line and line
  6446. !#zh 测试线段与线段是否相交
  6447. @param a1 The start point of the first line
  6448. @param a2 The end point of the first line
  6449. @param b1 The start point of the second line
  6450. @param b2 The end point of the second line
  6451. */
  6452. static lineLine(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): boolean;
  6453. /**
  6454. !#en Test line and rect
  6455. !#zh 测试线段与矩形是否相交
  6456. @param a1 The start point of the line
  6457. @param a2 The end point of the line
  6458. @param b The rect
  6459. */
  6460. static lineRect(a1: Vec2, a2: Vec2, b: Rect): boolean;
  6461. /**
  6462. !#en Test line and polygon
  6463. !#zh 测试线段与多边形是否相交
  6464. @param a1 The start point of the line
  6465. @param a2 The end point of the line
  6466. @param b The polygon, a set of points
  6467. */
  6468. static linePolygon(a1: Vec2, a2: Vec2, b: Vec2[]): boolean;
  6469. /**
  6470. !#en Test rect and rect
  6471. !#zh 测试矩形与矩形是否相交
  6472. @param a The first rect
  6473. @param b The second rect
  6474. */
  6475. static rectRect(a: Rect, b: Rect): boolean;
  6476. /**
  6477. !#en Test rect and polygon
  6478. !#zh 测试矩形与多边形是否相交
  6479. @param a The rect
  6480. @param b The polygon, a set of points
  6481. */
  6482. static rectPolygon(a: Rect, b: Vec2[]): boolean;
  6483. /**
  6484. !#en Test polygon and polygon
  6485. !#zh 测试多边形与多边形是否相交
  6486. @param a The first polygon, a set of points
  6487. @param b The second polygon, a set of points
  6488. */
  6489. static polygonPolygon(a: Vec2[], b: Vec2[]): boolean;
  6490. /**
  6491. !#en Test circle and circle
  6492. !#zh 测试圆形与圆形是否相交
  6493. @param a Object contains position and radius
  6494. @param b Object contains position and radius
  6495. */
  6496. static circleCircle(a: {position: Vec2, radius: number}, b: {position: Vec2, radius: number}): boolean;
  6497. /**
  6498. !#en Test polygon and circle
  6499. !#zh 测试矩形与圆形是否相交
  6500. @param polygon The Polygon, a set of points
  6501. @param circle Object contains position and radius
  6502. */
  6503. static polygonCircle(polygon: Vec2[], circle: {position: Vec2, radius: number}): boolean;
  6504. /**
  6505. !#en Test whether the point is in the polygon
  6506. !#zh 测试一个点是否在一个多边形中
  6507. @param point The point
  6508. @param polygon The polygon, a set of points
  6509. */
  6510. static pointInPolygon(point: Vec2, polygon: Vec2[]): boolean;
  6511. /**
  6512. !#en Calculate the distance of point to line.
  6513. !#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  6514. @param point The point
  6515. @param start The start point of line
  6516. @param end The end point of line
  6517. @param isSegment whether this line is a segment
  6518. */
  6519. static pointLineDistance(point: Vec2, start: Vec2, end: Vec2, isSegment: boolean): number;
  6520. }
  6521. /** !#en Polygon Collider.
  6522. !#zh 多边形碰撞组件 */
  6523. export class PolygonCollider extends Collider implements Collider.Polygon {
  6524. /** !#en Position offset
  6525. !#zh 位置偏移量 */
  6526. offset: Vec2;
  6527. /** !#en Polygon points
  6528. !#zh 多边形顶点数组 */
  6529. points: Vec2[];
  6530. }
  6531. /** !#en
  6532. This module controls asset's behaviors and information, include loading, releasing etc. it is a singleton
  6533. All member can be accessed with `cc.assetManager`.
  6534. !#zh
  6535. 此模块管理资源的行为和信息,包括加载,释放等,这是一个单例,所有成员能够通过 `cc.assetManager` 调用 */
  6536. export class AssetManager {
  6537. /** !#en
  6538. Normal loading pipeline
  6539. !#zh
  6540. 正常加载管线 */
  6541. pipeline: cc.AssetManager.Pipeline;
  6542. /** !#en
  6543. Fetching pipeline
  6544. !#zh
  6545. 下载管线 */
  6546. fetchPipeline: cc.AssetManager.Pipeline;
  6547. /** !#en
  6548. Url transformer
  6549. !#zh
  6550. Url 转换器 */
  6551. transformPipeline: cc.AssetManager.Pipeline;
  6552. /** !#en
  6553. The collection of bundle which is already loaded, you can remove cache with {{#crossLink "Bundle/destroy:method"}}{{/crossLink}}
  6554. !#zh
  6555. 已加载 bundle 的集合, 你能通过 {{#crossLink "Bundle/destroy:method"}}{{/crossLink}} 来移除缓存 */
  6556. bundles: AssetManager.Cache<AssetManager.Bundle>;
  6557. /** !#en
  6558. The collection of asset which is already loaded, you can remove cache with {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  6559. !#zh
  6560. 已加载资源的集合, 你能通过 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} 来移除缓存 */
  6561. assets: AssetManager.Cache<cc.Asset>;
  6562. /** !#en
  6563. Manage relationship between asset and its dependencies
  6564. !#zh
  6565. 管理资源依赖关系 */
  6566. dependUtil: cc.AssetManager.DependUtil;
  6567. /** !#en
  6568. Whether or not cache the loaded asset
  6569. !#zh
  6570. 是否缓存已加载的资源 */
  6571. cacheAsset: boolean;
  6572. /** !#en
  6573. Whether or not load asset forcely, if it is true, asset will be loaded regardless of error
  6574. !#zh
  6575. 是否强制加载资源, 如果为 true ,加载资源将会忽略报错 */
  6576. force: boolean;
  6577. /** !#en
  6578. Some useful function
  6579. !#zh
  6580. 一些有用的方法 */
  6581. utils: cc.AssetManager.Helper;
  6582. /** !#en
  6583. Manage all downloading task
  6584. !#zh
  6585. 管理所有下载任务 */
  6586. downloader: cc.AssetManager.Downloader;
  6587. /** !#en
  6588. Manage all parsing task
  6589. !#zh
  6590. 管理所有解析任务 */
  6591. parser: cc.AssetManager.Parser;
  6592. /** !#en
  6593. Manage internal asset
  6594. !#zh
  6595. 管理内置资源 */
  6596. builtins: cc.AssetManager.Builtins;
  6597. /** !#en
  6598. Manage all packed asset
  6599. !#zh
  6600. 管理所有合并后的资源 */
  6601. packManager: cc.AssetManager.PackManager;
  6602. /** !#en
  6603. The preset of options
  6604. !#zh
  6605. 可选参数的预设集 */
  6606. presets: Record<string, Record<string, any>>;
  6607. /** !#en
  6608. The builtin 'main' bundle
  6609. !#zh
  6610. 内置 main 包 */
  6611. main: cc.AssetManager.Bundle;
  6612. /** !#en
  6613. The builtin 'resources' bundle
  6614. !#zh
  6615. 内置 resources 包 */
  6616. resources: cc.AssetManager.Bundle;
  6617. /** !#en
  6618. The builtin 'internal' bundle
  6619. !#zh
  6620. 内置 internal 包 */
  6621. internal: cc.AssetManager.Bundle;
  6622. /**
  6623. !#en
  6624. Initialize assetManager with options
  6625. !#zh
  6626. 初始化资源管理器
  6627. @param options options
  6628. */
  6629. init(options: Record<string, any>): void;
  6630. /**
  6631. !#en
  6632. Get the bundle which has been loaded
  6633. !#zh
  6634. 获取已加载的分包
  6635. @param name The name of bundle
  6636. @example
  6637. ```js
  6638. // ${project}/assets/test1
  6639. cc.assetManager.getBundle('test1');
  6640. cc.assetManager.getBundle('resources');
  6641. ```
  6642. */
  6643. getBundle (name: string): cc.AssetManager.Bundle;
  6644. /**
  6645. !#en
  6646. Remove this bundle. NOTE: The asset whthin this bundle will not be released automatically, you can call {{#crossLink "Bundle/releaseAll:method"}}{{/crossLink}} manually before remove it if you need
  6647. !#zh
  6648. 移除此包, 注意:这个包内的资源不会自动释放, 如果需要的话你可以在摧毁之前手动调用 {{#crossLink "Bundle/releaseAll:method"}}{{/crossLink}} 进行释放
  6649. @param bundle The bundle to be removed
  6650. */
  6651. removeBundle(bundle: cc.AssetManager.Bundle): void;
  6652. /**
  6653. !#en
  6654. General interface used to load assets with a progression callback and a complete callback. You can achieve almost all effect you want with combination of `requests` and `options`.
  6655. It is highly recommended that you use more simple API, such as `loadRes`, `loadResDir` etc. Every custom parameter in `options` will be distribute to each of `requests`.
  6656. if request already has same one, the parameter in request will be given priority. Besides, if request has dependencies, `options` will distribute to dependencies too.
  6657. Every custom parameter in `requests` will be tranfered to handler of `downloader` and `parser` as `options`.
  6658. You can register you own handler downloader or parser to collect these custom parameters for some effect.
  6659. Reserved Keyword: [`uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrent`, `maxRequestsPerFrame`
  6660. `maxRetryCount`, `version`, `isCrossOrigin`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`],
  6661. Please DO NOT use these words as custom options!
  6662. !#zh
  6663. 通用加载资源接口,可传入进度回调以及完成回调,通过组合 `request` 和 `options` 参数,几乎可以实现和扩展所有想要的加载效果。非常建议你使用更简单的API,例如 `loadRes`、`loadResDir` 等。
  6664. `options` 中的自定义参数将会分发到 `requests` 的每一项中,如果request中已存在同名的参数则以 `requests` 中为准,同时如果有其他
  6665. 依赖资源,则 `options` 中的参数会继续向依赖项中分发。request中的自定义参数都会以 `options` 形式传入加载流程中的 `downloader`, `parser` 的方法中, 你可以
  6666. 扩展 `downloader`, `parser` 收集参数完成想实现的效果。
  6667. 保留关键字: [`uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrent`, `maxRequestsPerFrame`
  6668. `maxRetryCount`, `version`, `isCrossOrigin`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`],
  6669. 请不要使用这些字段为自定义参数!
  6670. @param requests The request you want to load
  6671. @param options Optional parameters
  6672. @param onProgress Callback invoked when progression change
  6673. @param onComplete Callback invoked when finish loading
  6674. @example
  6675. ```js
  6676. cc.assetManager.loadAny({url: 'http://example.com/a.png', isCrossOrigin: true}, (err, img) => cc.log(img));
  6677. cc.assetManager.loadAny(['60sVXiTH1D/6Aft4MRt9VC'], (err, assets) => cc.log(assets));
  6678. cc.assetManager.loadAny([{ uuid: '0cbZa5Y71CTZAccaIFluuZ'}, {url: 'http://example.com/a.png'}], (err, assets) => cc.log(assets));
  6679. cc.assetManager.downloader.register('.asset', (url, options, onComplete) => {
  6680. url += '?userName=' + options.userName + "&password=" + options.password;
  6681. cc.assetManager.downloader.downloadFile(url, null, onComplete);
  6682. });
  6683. cc.assetManager.parser.register('.asset', (file, options, onComplete) => {
  6684. var json = JSON.parse(file);
  6685. var skin = json[options.skin];
  6686. var model = json[options.model];
  6687. onComplete(null, {skin, model});
  6688. });
  6689. cc.assetManager.loadAny({ url: 'http://example.com/my.asset', skin: 'xxx', model: 'xxx', userName: 'xxx', password: 'xxx' });
  6690. ```
  6691. */
  6692. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options?: Record<string, any>, onProgress?: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete?: (err: Error, data: any) => void): void;
  6693. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options?: Record<string, any>, onComplete?: (err: Error, data: any) => void): void;
  6694. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onProgress?: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete?: (err: Error, data: any) => void): void;
  6695. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete?: (err: Error, data: any) => void): void;
  6696. /**
  6697. !#en
  6698. General interface used to preload assets with a progression callback and a complete callback.It is highly recommended that you use more simple API, such as `preloadRes`, `preloadResDir` etc.
  6699. Everything about preload is just likes `cc.assetManager.loadAny`, the difference is `cc.assetManager.preloadAny` will only download asset but not parse asset. You need to invoke `cc.assetManager.loadAny(preloadTask)`
  6700. to finish loading asset
  6701. !#zh
  6702. 通用预加载资源接口,可传入进度回调以及完成回调,非常建议你使用更简单的 API ,例如 `preloadRes`, `preloadResDir` 等。`preloadAny` 和 `loadAny` 几乎一样,区别在于 `preloadAny` 只会下载资源,不会去解析资源,你需要调用 `cc.assetManager.loadAny(preloadTask)`
  6703. 来完成资源加载。
  6704. @param requests The request you want to preload
  6705. @param options Optional parameters
  6706. @param onProgress Callback invoked when progression change
  6707. @param onComplete Callback invoked when finish preloading
  6708. @example
  6709. ```js
  6710. cc.assetManager.preloadAny('0cbZa5Y71CTZAccaIFluuZ', (err) => cc.assetManager.loadAny('0cbZa5Y71CTZAccaIFluuZ'));
  6711. ```
  6712. */
  6713. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options?: Record<string, any>, onProgress?: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete?: (err: Error, items: cc.AssetManager.RequestItem[]) => void): cc.AssetManager.Task;
  6714. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options?: Record<string, any>, onComplete?: (err: Error, items: cc.AssetManager.RequestItem[]) => void): cc.AssetManager.Task;
  6715. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onProgress?: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete?: (err: Error, items: cc.AssetManager.RequestItem[]) => void): cc.AssetManager.Task;
  6716. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete?: (err: Error, items: cc.AssetManager.RequestItem[]) => void): cc.AssetManager.Task;
  6717. /**
  6718. !#en
  6719. Load native file of asset, if you check the option 'Async Load Assets', you may need to load native file with this before you use the asset
  6720. !#zh
  6721. 加载资源的原生文件,如果你勾选了'延迟加载资源'选项,你可能需要在使用资源之前调用此方法来加载原生文件
  6722. @param asset The asset
  6723. @param options Some optional parameters
  6724. @param onComplete Callback invoked when finish loading
  6725. @example
  6726. ```js
  6727. cc.assetManager.postLoadNative(texture, (err) => console.log(err));
  6728. ```
  6729. */
  6730. postLoadNative(asset: cc.Asset, options?: Record<string, any>, onComplete?: (err: Error) => void): void;
  6731. postLoadNative(asset: cc.Asset, onComplete?: (err: Error) => void): void;
  6732. /**
  6733. !#en
  6734. Load remote asset with url, such as audio, image, text and so on.
  6735. !#zh
  6736. 使用 url 加载远程资源,例如音频,图片,文本等等。
  6737. @param url The url of asset
  6738. @param options Some optional parameters
  6739. @param onComplete Callback invoked when finish loading
  6740. @example
  6741. ```js
  6742. cc.assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => console.log(err));
  6743. cc.assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => console.log(err));
  6744. ```
  6745. */
  6746. loadRemote<T extends cc.Asset>(url: string, options?: Record<string, any>, onComplete?: (err: Error, asset: T) => void): void;
  6747. loadRemote<T extends cc.Asset>(url: string, onComplete?: (err: Error, asset: T) => void): void;
  6748. /**
  6749. !#en
  6750. Load script
  6751. !#zh
  6752. 加载脚本
  6753. @param url Url of the script
  6754. @param options Some optional paramters
  6755. @param onComplete Callback when script loaded or failed
  6756. @example
  6757. ```js
  6758. loadScript('http://localhost:8080/index.js', null, (err) => console.log(err));
  6759. ```
  6760. */
  6761. loadScript(url: string|string[], options?: Record<string, any>, onComplete?: (err: Error) => void): void;;
  6762. loadScript(url: string|string[], onComplete?: (err: Error) => void): void;;
  6763. /**
  6764. !#en
  6765. load bundle
  6766. !#zh
  6767. 加载资源包
  6768. @param root The root path of bundle
  6769. @param options Some optional paramter, same like downloader.downloadFile
  6770. @param onComplete Callback when bundle loaded or failed
  6771. @example
  6772. ```js
  6773. loadBundle('http://localhost:8080/test', null, (err, bundle) => console.log(err));
  6774. ```
  6775. */
  6776. loadBundle(root: string, options?: Record<string, any>, onComplete?: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  6777. loadBundle(root: string, onComplete?: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  6778. /**
  6779. !#en
  6780. Release asset and it's dependencies.
  6781. This method will not only remove the cache of the asset in assetManager, but also clean up its content.
  6782. For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  6783. Notice, this method may cause the texture to be unusable, if there are still other nodes use the same texture, they may turn to black and report gl errors.
  6784. !#zh
  6785. 释放资源以及其依赖资源, 这个方法不仅会从 assetManager 中删除资源的缓存引用,还会清理它的资源内容。
  6786. 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  6787. 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  6788. @param asset The asset to be released
  6789. @example
  6790. ```js
  6791. // release a texture which is no longer need
  6792. cc.assetManager.releaseAsset(texture);
  6793. ```
  6794. */
  6795. releaseAsset(asset: cc.Asset): void;
  6796. /**
  6797. !#en
  6798. Release all assets. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  6799. !#zh
  6800. 释放所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  6801. */
  6802. releaseAll(): void;
  6803. }
  6804. /** `cc.loader` is deprecated, please backup your project and upgrade to {{#crossLink "AssetManager"}}{{/crossLink}} */
  6805. export class loader {
  6806. /** `cc.loader.onProgress` is deprecated, please transfer onProgress to API as a parameter */
  6807. static onProgress: any;
  6808. /**
  6809. `cc.loader.load` is deprecated, please use {{#crossLink "AssetManager/load:method"}}{{/crossLink}} instead
  6810. @param resources Url list in an array
  6811. @param progressCallback Callback invoked when progression change
  6812. @param completeCallback Callback invoked when all resources loaded
  6813. */
  6814. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, completeCallback?: Function): void;
  6815. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: Function|null): void;
  6816. /**
  6817. `cc.loader.getXMLHttpRequest` is deprecated, please use `XMLHttpRequest` directly
  6818. */
  6819. static getXMLHttpRequest(): XMLHttpRequest;
  6820. /**
  6821. `cc.loader.getItem` is deprecated, please use `cc.assetManager._asset.get` instead
  6822. @param id The id of the item
  6823. */
  6824. static getItem(id: any): any;
  6825. /**
  6826. `cc.loader.loadRes` is deprecated, please use {{#crossLink "AssetManager/loadRes:method"}}{{/crossLink}} instead
  6827. @param url Url of the target resource.
  6828. The url is relative to the "resources" folder, extensions must be omitted.
  6829. @param type Only asset of type will be loaded if this argument is supplied.
  6830. @param progressCallback Callback invoked when progression change.
  6831. @param completeCallback Callback invoked when the resource loaded.
  6832. */
  6833. static loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  6834. static loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void;
  6835. static loadRes(url: string, type: typeof cc.Asset): void;
  6836. static loadRes(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  6837. static loadRes(url: string, completeCallback: (error: Error, resource: any) => void): void;
  6838. static loadRes(url: string): void;
  6839. /**
  6840. `cc.loader.loadResArray` is deprecated, please use {{#crossLink "AssetManager/loadRes:method"}}{{/crossLink}} instead
  6841. @param urls Array of URLs of the target resource.
  6842. The url is relative to the "resources" folder, extensions must be omitted.
  6843. @param type Only asset of type will be loaded if this argument is supplied.
  6844. @param progressCallback Callback invoked when progression change.
  6845. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  6846. */
  6847. static loadResArray(url: string[], type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  6848. static loadResArray(url: string[], type: typeof cc.Asset, completeCallback: (error: Error, resource: any[]) => void): void;
  6849. static loadResArray(url: string[], type: typeof cc.Asset): void;
  6850. static loadResArray(url: string[], progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  6851. static loadResArray(url: string[], completeCallback: (error: Error, resource: any[]) => void): void;
  6852. static loadResArray(url: string[]): void;
  6853. static loadResArray(url: string[], type: typeof cc.Asset[]): void;
  6854. /**
  6855. `cc.loader.loadResDir` is deprecated, please use {{#crossLink "AssetManager/loadResDir:method"}}{{/crossLink}} instead
  6856. @param url Url of the target folder.
  6857. The url is relative to the "resources" folder, extensions must be omitted.
  6858. @param type Only asset of type will be loaded if this argument is supplied.
  6859. @param progressCallback Callback invoked when progression change.
  6860. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  6861. */
  6862. static loadResDir(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  6863. static loadResDir(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  6864. static loadResDir(url: string, type: typeof cc.Asset): void;
  6865. static loadResDir(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  6866. static loadResDir(url: string, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  6867. static loadResDir(url: string): void;
  6868. /**
  6869. `cc.loader.getRes` is deprecated, please use {{#crossLink "Bundle/get:method"}}{{/crossLink}} instead
  6870. @param url url
  6871. @param type Only asset of type will be returned if this argument is supplied.
  6872. */
  6873. static getRes(url: string, type?: Function): any;
  6874. /**
  6875. `cc.loader.getDependsRecursively` is deprecated, please use use {{#crossLink "DependUtil/getDepsRecursively:method"}}{{/crossLink}} instead
  6876. @param owner The owner asset or the resource url or the asset's uuid
  6877. */
  6878. static getDependsRecursively(owner: Asset|string): any[];
  6879. /** `cc.loader.assetLoader` was removed, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  6880. static assetLoader: any;
  6881. /** `cc.loader.md5Pipe` is deprecated, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  6882. static md5Pipe: any;
  6883. /** `cc.loader.downloader` is deprecated, please use {{#crossLink "AssetManager/downloader:property"}}{{/crossLink}} instead */
  6884. static downloader: any;
  6885. /** `cc.loader.loader` is deprecated, please use {{#crossLink "AssetManager/parser:property"}}{{/crossLink}} instead */
  6886. static loader: any;
  6887. /**
  6888. `cc.loader.addDownloadHandlers` is deprecated, please use `cc.assetManager.downloader.register` instead
  6889. @param extMap Custom supported types with corresponded handler
  6890. */
  6891. static addDownloadHandlers(extMap: any): void;
  6892. /**
  6893. `cc.loader.addLoadHandlers` is deprecated, please use `cc.assetManager.parser.register` instead
  6894. @param extMap Custom supported types with corresponded handler
  6895. */
  6896. static addLoadHandlers(extMap: any): void;
  6897. /**
  6898. `cc.loader.release` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  6899. @param asset asset
  6900. */
  6901. static release(asset: Asset|string|any[]): void;
  6902. /**
  6903. `cc.loader.releaseAsset` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  6904. @param asset asset
  6905. */
  6906. static releaseAsset(asset: Asset): void;
  6907. /**
  6908. `cc.loader.releaseRes` is deprecated, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  6909. @param url url
  6910. @param type Only asset of type will be released if this argument is supplied.
  6911. */
  6912. static releaseRes(url: string, type?: Function): void;
  6913. /**
  6914. `cc.loader.releaseResDir` was removed, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  6915. */
  6916. static releaseResDir(): void;
  6917. /**
  6918. `cc.loader.releaseAll` is deprecated, please use {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} instead
  6919. */
  6920. static releaseAll(): void;
  6921. /**
  6922. `cc.loader.removeItem` is deprecated, please use `cc.assetManager.assets.remove` instead
  6923. @param id The id of the item
  6924. */
  6925. static removeItem(id: any): boolean;
  6926. /**
  6927. `cc.loader.setAutoRelease` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  6928. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  6929. @param autoRelease indicates whether should release automatically
  6930. */
  6931. static setAutoRelease(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  6932. /**
  6933. `cc.loader.setAutoReleaseRecursively` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  6934. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  6935. @param autoRelease indicates whether should release automatically
  6936. */
  6937. static setAutoReleaseRecursively(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  6938. /**
  6939. `cc.loader.isAutoRelease` is deprecated
  6940. @param assetOrUrl asset object or the raw asset's url
  6941. */
  6942. static isAutoRelease(assetOrUrl: Asset|string): boolean;
  6943. }
  6944. /** `cc.url` is deprecated */
  6945. export class url {
  6946. /**
  6947. `cc.url.raw` is deprecated, please use `cc.resources.load` directly, or use `Asset.nativeUrl` instead.
  6948. @param url url
  6949. */
  6950. static raw(url: string): string;
  6951. }
  6952. /** `cc.LoadingItems` was removed, please use {{#crossLink "Task"}}{{/crossLink}} instead */
  6953. export class LoadingItems {
  6954. }
  6955. /** Predefined constants */
  6956. export class macro {
  6957. /** `cc.macro.DOWNLOAD_MAX_CONCURRENT` is deprecated now, please use {{#crossLink "Downloader/maxConcurrent:property"}}{{/crossLink}} instead */
  6958. static DOWNLOAD_MAX_CONCURRENT: number;
  6959. /** PI / 180 */
  6960. static RAD: number;
  6961. /** One degree */
  6962. static DEG: number;
  6963. static REPEAT_FOREVER: number;
  6964. static FLT_EPSILON: number;
  6965. /** Minimum z index value for node */
  6966. static MIN_ZINDEX: number;
  6967. /** Maximum z index value for node */
  6968. static MAX_ZINDEX: number;
  6969. static ONE: number;
  6970. static ZERO: number;
  6971. static SRC_ALPHA: number;
  6972. static SRC_ALPHA_SATURATE: number;
  6973. static SRC_COLOR: number;
  6974. static DST_ALPHA: number;
  6975. static DST_COLOR: number;
  6976. static ONE_MINUS_SRC_ALPHA: number;
  6977. static ONE_MINUS_SRC_COLOR: number;
  6978. static ONE_MINUS_DST_ALPHA: number;
  6979. static ONE_MINUS_DST_COLOR: number;
  6980. static ONE_MINUS_CONSTANT_ALPHA: number;
  6981. static ONE_MINUS_CONSTANT_COLOR: number;
  6982. /** Oriented vertically */
  6983. static ORIENTATION_PORTRAIT: number;
  6984. /** Oriented horizontally */
  6985. static ORIENTATION_LANDSCAPE: number;
  6986. /** Oriented automatically */
  6987. static ORIENTATION_AUTO: number;
  6988. /** <p>
  6989. If enabled, the texture coordinates will be calculated by using this formula: <br/>
  6990. - texCoord.left = (rect.x*2+1) / (texture.wide*2); <br/>
  6991. - texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2); <br/>
  6992. <br/>
  6993. The same for bottom and top. <br/>
  6994. <br/>
  6995. This formula prevents artifacts by using 99% of the texture. <br/>
  6996. The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel<br/>
  6997. <br/>
  6998. Affected component: <br/>
  6999. - cc.TMXLayer <br/>
  7000. <br/>
  7001. Enabled by default. To disabled set it to 0. <br/>
  7002. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
  7003. </p> */
  7004. static FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: number;
  7005. /** Position of the FPS (Default: 0,0 (bottom-left corner))<br/>
  7006. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h */
  7007. static DIRECTOR_STATS_POSITION: Vec2;
  7008. /** <p>
  7009. If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked. <br/>
  7010. If you run 2 or more 'position' actions at the same time on a node, then end position will be the sum of all the positions. <br/>
  7011. If disabled, only the last run action will take effect.
  7012. </p> */
  7013. static ENABLE_STACKABLE_ACTIONS: number;
  7014. /** !#en
  7015. The timeout to determine whether a touch is no longer active and should be removed.
  7016. The reason to add this timeout is due to an issue in X5 browser core,
  7017. when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  7018. no touch cancel event is triggered, and the touch will be considered active forever.
  7019. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  7020. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  7021. Though it might remove a real touch if it's just not moving for the last 5 seconds which is not easy with the sensibility of mobile touch screen.
  7022. You can modify this value to have a better behavior if you find it's not enough.
  7023. !#zh
  7024. 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  7025. 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  7026. 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  7027. 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  7028. 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  7029. 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  7030. 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。 */
  7031. static TOUCH_TIMEOUT: number;
  7032. /** !#en
  7033. The maximum vertex count for a single batched draw call.
  7034. !#zh
  7035. 最大可以被单次批处理渲染的顶点数量。 */
  7036. static BATCH_VERTEX_COUNT: number;
  7037. /** !#en
  7038. Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation, then need to manually disable this, otherwise, the rendering will be wrong.
  7039. !#zh
  7040. 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 或者采用了摄像机的话,需要手动关闭,否则渲染会出错。 */
  7041. static ENABLE_TILEDMAP_CULLING: boolean;
  7042. /** !#en
  7043. Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  7044. Though if you want to make your canvas background transparent and show other dom elements at the background,
  7045. you can set it to true before `cc.game.run`.
  7046. Web only.
  7047. !#zh
  7048. 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  7049. 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 `cc.game.run` 之前将这个值设为 true。
  7050. 仅支持 Web */
  7051. static ENABLE_TRANSPARENT_CANVAS: boolean;
  7052. /** !#en
  7053. Boolean that indicates if the WebGL context is created with `antialias` option turned on, default value is false.
  7054. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  7055. Whether to use this really depend on your game design and targeted platform,
  7056. device with retina display usually have good detail on graphics with or without this option,
  7057. you probably don't want antialias if your game style is pixel art based.
  7058. Also, it could have great performance impact with some browser / device using software MSAA.
  7059. You can set it to true before `cc.game.run`.
  7060. Web only.
  7061. !#zh
  7062. 用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。
  7063. 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  7064. 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  7065. 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  7066. 你可以在 `cc.game.run` 之前设置这个值,否则它不会生效。
  7067. 仅支持 Web */
  7068. static ENABLE_WEBGL_ANTIALIAS: boolean;
  7069. /** !#en
  7070. Whether or not enable auto culling.
  7071. This feature have been removed in v2.0 new renderer due to overall performance consumption.
  7072. We have no plan currently to re-enable auto culling.
  7073. If your game have more dynamic objects, we suggest to disable auto culling.
  7074. If your game have more static objects, we suggest to enable auto culling.
  7075. !#zh
  7076. 是否开启自动裁减功能,开启裁减功能将会把在屏幕外的物体从渲染队列中去除掉。
  7077. 这个功能在 v2.0 的新渲染器中被移除了,因为它在大多数游戏中所带来的损耗要高于性能的提升,目前我们没有计划重新支持自动裁剪。
  7078. 如果游戏中的动态物体比较多的话,建议将此选项关闭。
  7079. 如果游戏中的静态物体比较多的话,建议将此选项打开。 */
  7080. static ENABLE_CULLING: boolean;
  7081. /** !#en
  7082. Whether to clear the original image cache after uploaded a texture to GPU. If cleared, [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) will not be supported.
  7083. Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory.
  7084. But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  7085. So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
  7086. !#zh
  7087. 是否在将贴图上传至 GPU 之后删除原始图片缓存,删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
  7088. 在 Web 平台,你通常不需要开启这个选项,因为在 Web 平台 Image 对象所占用的内存很小。
  7089. 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  7090. 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 */
  7091. static CLEANUP_IMAGE_CACHE: boolean;
  7092. /** !#en
  7093. Whether or not show mesh wire frame.
  7094. !#zh
  7095. 是否显示网格的线框。 */
  7096. static SHOW_MESH_WIREFRAME: boolean;
  7097. /** !#en
  7098. Whether or not show mesh normal.
  7099. !#zh
  7100. 是否显示网格的法线。 */
  7101. static SHOW_MESH_NORMAL: boolean;
  7102. /** !#en
  7103. Whether to enable multi-touch.
  7104. !#zh
  7105. 是否开启多点触摸 */
  7106. static ENABLE_MULTI_TOUCH: boolean;
  7107. /** !#en
  7108. The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
  7109. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
  7110. !#zh
  7111. 引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
  7112. 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。 */
  7113. static SUPPORT_TEXTURE_FORMATS: string[];
  7114. }
  7115. /** !#en The touch event class
  7116. !#zh 封装了触摸相关的信息。 */
  7117. export class Touch {
  7118. /**
  7119. !#en Returns the current touch location in OpenGL coordinates.、
  7120. !#zh 获取当前触点位置。
  7121. */
  7122. getLocation(): Vec2;
  7123. /**
  7124. !#en Returns X axis location value.
  7125. !#zh 获取当前触点 X 轴位置。
  7126. */
  7127. getLocationX(): number;
  7128. /**
  7129. !#en Returns Y axis location value.
  7130. !#zh 获取当前触点 Y 轴位置。
  7131. */
  7132. getLocationY(): number;
  7133. /**
  7134. !#en Returns the previous touch location in OpenGL coordinates.
  7135. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  7136. */
  7137. getPreviousLocation(): Vec2;
  7138. /**
  7139. !#en Returns the start touch location in OpenGL coordinates.
  7140. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  7141. */
  7142. getStartLocation(): Vec2;
  7143. /**
  7144. !#en Returns the delta distance from the previous touche to the current one in screen coordinates.
  7145. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  7146. */
  7147. getDelta(): Vec2;
  7148. /**
  7149. !#en Returns the current touch location in screen coordinates.
  7150. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  7151. */
  7152. getLocationInView(): Vec2;
  7153. /**
  7154. !#en Returns the previous touch location in screen coordinates.
  7155. !#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  7156. */
  7157. getPreviousLocationInView(): Vec2;
  7158. /**
  7159. !#en Returns the start touch location in screen coordinates.
  7160. !#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  7161. */
  7162. getStartLocationInView(): Vec2;
  7163. /**
  7164. !#en Returns the id of cc.Touch.
  7165. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  7166. */
  7167. getID(): number;
  7168. /**
  7169. !#en Sets information to touch.
  7170. !#zh 设置触摸相关的信息。用于监控触摸事件。
  7171. @param id id
  7172. @param x x
  7173. @param y y
  7174. */
  7175. setTouchInfo(id: number, x: number, y: number): void;
  7176. }
  7177. /** !#en
  7178. EventTarget is an object to which an event is dispatched when something has occurred.
  7179. Entity are the most common event targets, but other objects can be event targets too.
  7180. Event targets are an important part of the Fireball event model.
  7181. The event target serves as the focal point for how events flow through the scene graph.
  7182. When an event such as a mouse click or a keypress occurs, Fireball dispatches an event object
  7183. into the event flow from the root of the hierarchy. The event object then makes its way through
  7184. the scene graph until it reaches the event target, at which point it begins its return trip through
  7185. the scene graph. This round-trip journey to the event target is conceptually divided into three phases:
  7186. - The capture phase comprises the journey from the root to the last node before the event target's node
  7187. - The target phase comprises only the event target node
  7188. - The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree
  7189. See also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7190. Event targets can implement the following methods:
  7191. - _getCapturingTargets
  7192. - _getBubblingTargets
  7193. !#zh
  7194. 事件目标是事件触发时,分派的事件对象,Node 是最常见的事件目标,
  7195. 但是其他对象也可以是事件目标。<br/> */
  7196. export class EventTarget extends CallbacksInvoker {
  7197. /**
  7198. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7199. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7200. @param type The type of event.
  7201. */
  7202. hasEventListener(type: string): boolean;
  7203. /**
  7204. !#en
  7205. Register an callback of a specific event type on the EventTarget.
  7206. This type of event should be triggered via `emit`.
  7207. !#zh
  7208. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  7209. @param type A string representing the event type to listen for.
  7210. @param callback The callback that will be invoked when the event is dispatched.
  7211. The callback is ignored if it is a duplicate (the callbacks are unique).
  7212. @param target The target (this object) to invoke the callback, can be null
  7213. @example
  7214. ```js
  7215. eventTarget.on('fire', function () {
  7216. cc.log("fire in the hole");
  7217. }, node);
  7218. ```
  7219. */
  7220. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  7221. /**
  7222. !#en
  7223. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  7224. if only type is passed as parameter, all listeners registered with that type will be removed.
  7225. !#zh
  7226. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  7227. @param type A string representing the event type being removed.
  7228. @param callback The callback to remove.
  7229. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7230. @example
  7231. ```js
  7232. // register fire eventListener
  7233. var callback = eventTarget.on('fire', function () {
  7234. cc.log("fire in the hole");
  7235. }, target);
  7236. // remove fire event listener
  7237. eventTarget.off('fire', callback, target);
  7238. // remove all fire event listeners
  7239. eventTarget.off('fire');
  7240. ```
  7241. */
  7242. off(type: string, callback?: Function, target?: any): void;
  7243. /**
  7244. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7245. This is not for removing all listeners in the current event target,
  7246. and this is not for removing all listeners the target parameter have registered.
  7247. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7248. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7249. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7250. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7251. @param target The target to be searched for all related listeners
  7252. */
  7253. targetOff(target: any): void;
  7254. /**
  7255. !#en
  7256. Register an callback of a specific event type on the EventTarget,
  7257. the callback will remove itself after the first time it is triggered.
  7258. !#zh
  7259. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7260. @param type A string representing the event type to listen for.
  7261. @param callback The callback that will be invoked when the event is dispatched.
  7262. The callback is ignored if it is a duplicate (the callbacks are unique).
  7263. @param target The target (this object) to invoke the callback, can be null
  7264. @example
  7265. ```js
  7266. eventTarget.once('fire', function () {
  7267. cc.log("this is the callback and will be invoked only once");
  7268. }, node);
  7269. ```
  7270. */
  7271. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7272. /**
  7273. !#en
  7274. Send an event with the event object.
  7275. !#zh
  7276. 通过事件对象派发事件
  7277. @param event event
  7278. */
  7279. dispatchEvent(event: Event): void;
  7280. }
  7281. /** !#en Base class of all kinds of events.
  7282. !#zh 包含事件相关信息的对象。 */
  7283. export class Event {
  7284. /**
  7285. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  7286. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  7287. */
  7288. constructor(type: string, bubbles: boolean);
  7289. /** !#en The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  7290. !#zh 事件类型。 */
  7291. type: string;
  7292. /** !#en Indicate whether the event bubbles up through the tree or not.
  7293. !#zh 表示该事件是否进行冒泡。 */
  7294. bubbles: boolean;
  7295. /** !#en A reference to the target to which the event was originally dispatched.
  7296. !#zh 最初事件触发的目标 */
  7297. target: any;
  7298. /** !#en A reference to the currently registered target for the event.
  7299. !#zh 当前目标 */
  7300. currentTarget: any;
  7301. /** !#en
  7302. Indicates which phase of the event flow is currently being evaluated.
  7303. Returns an integer value represented by 4 constants:
  7304. - Event.NONE = 0
  7305. - Event.CAPTURING_PHASE = 1
  7306. - Event.AT_TARGET = 2
  7307. - Event.BUBBLING_PHASE = 3
  7308. The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  7309. (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  7310. !#zh 事件阶段 */
  7311. eventPhase: number;
  7312. /**
  7313. !#en Reset the event for being stored in the object pool.
  7314. !#zh 重置对象池中存储的事件。
  7315. */
  7316. unuse(): string;
  7317. /**
  7318. !#en Reuse the event for being used again by the object pool.
  7319. !#zh 用于对象池再次使用的事件。
  7320. */
  7321. reuse(): string;
  7322. /**
  7323. !#en Stops propagation for current event.
  7324. !#zh 停止传递当前事件。
  7325. */
  7326. stopPropagation(): void;
  7327. /**
  7328. !#en Stops propagation for current event immediately,
  7329. the event won't even be dispatched to the listeners attached in the current target.
  7330. !#zh 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  7331. */
  7332. stopPropagationImmediate(): void;
  7333. /**
  7334. !#en Checks whether the event has been stopped.
  7335. !#zh 检查该事件是否已经停止传递.
  7336. */
  7337. isStopped(): boolean;
  7338. /**
  7339. !#en
  7340. <p>
  7341. Gets current target of the event <br/>
  7342. note: It only be available when the event listener is associated with node. <br/>
  7343. It returns 0 when the listener is associated with fixed priority.
  7344. </p>
  7345. !#zh 获取当前目标节点
  7346. */
  7347. getCurrentTarget(): Node;
  7348. /**
  7349. !#en Gets the event type.
  7350. !#zh 获取事件类型
  7351. */
  7352. getType(): string;
  7353. /** !#en Code for event without type.
  7354. !#zh 没有类型的事件 */
  7355. static NO_TYPE: string;
  7356. /** !#en The type code of Touch event.
  7357. !#zh 触摸事件类型 */
  7358. static TOUCH: string;
  7359. /** !#en The type code of Mouse event.
  7360. !#zh 鼠标事件类型 */
  7361. static MOUSE: string;
  7362. /** !#en The type code of Keyboard event.
  7363. !#zh 键盘事件类型 */
  7364. static KEYBOARD: string;
  7365. /** !#en The type code of Acceleration event.
  7366. !#zh 加速器事件类型 */
  7367. static ACCELERATION: string;
  7368. /** !#en Events not currently dispatched are in this phase
  7369. !#zh 尚未派发事件阶段 */
  7370. static NONE: number;
  7371. /** !#en
  7372. The capturing phase comprises the journey from the root to the last node before the event target's node
  7373. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7374. !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 */
  7375. static CAPTURING_PHASE: number;
  7376. /** !#en
  7377. The target phase comprises only the event target node
  7378. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7379. !#zh 目标阶段仅包括事件目标节点。 */
  7380. static AT_TARGET: number;
  7381. /** !#en
  7382. The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  7383. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7384. !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 */
  7385. static BUBBLING_PHASE: number;
  7386. }
  7387. /** !#en
  7388. The System event, it currently supports keyboard events and accelerometer events.<br>
  7389. You can get the SystemEvent instance with cc.systemEvent.<br>
  7390. !#zh
  7391. 系统事件,它目前支持按键事件和重力感应事件。<br>
  7392. 你可以通过 cc.systemEvent 获取到 SystemEvent 的实例。<br> */
  7393. export class SystemEvent extends EventTarget {
  7394. /**
  7395. !#en whether enable accelerometer event
  7396. !#zh 是否启用加速度计事件
  7397. @param isEnable isEnable
  7398. */
  7399. setAccelerometerEnabled(isEnable: boolean): void;
  7400. /**
  7401. !#en set accelerometer interval value
  7402. !#zh 设置加速度计间隔值
  7403. @param interval interval
  7404. */
  7405. setAccelerometerInterval(interval: number): void;
  7406. }
  7407. /** undefined */
  7408. export class Graphics extends RenderComponent {
  7409. /** !#en
  7410. Current line width.
  7411. !#zh
  7412. 当前线条宽度 */
  7413. lineWidth: number;
  7414. /** !#en
  7415. lineJoin determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  7416. !#zh
  7417. lineJoin 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。 */
  7418. lineJoin: Graphics.LineJoin;
  7419. /** !#en
  7420. lineCap determines how the end points of every line are drawn.
  7421. !#zh
  7422. lineCap 指定如何绘制每一条线段末端。 */
  7423. lineCap: Graphics.LineCap;
  7424. /** !#en
  7425. stroke color
  7426. !#zh
  7427. 线段颜色 */
  7428. strokeColor: Color;
  7429. /** !#en
  7430. fill color
  7431. !#zh
  7432. 填充颜色 */
  7433. fillColor: Color;
  7434. /** !#en
  7435. Sets the miter limit ratio
  7436. !#zh
  7437. 设置斜接面限制比例 */
  7438. miterLimit: number;
  7439. /**
  7440. !#en Move path start point to (x,y).
  7441. !#zh 移动路径起点到坐标(x, y)
  7442. @param x The x axis of the coordinate for the end point.
  7443. @param y The y axis of the coordinate for the end point.
  7444. */
  7445. moveTo(x?: number, y?: number): void;
  7446. /**
  7447. !#en Adds a straight line to the path
  7448. !#zh 绘制直线路径
  7449. @param x The x axis of the coordinate for the end point.
  7450. @param y The y axis of the coordinate for the end point.
  7451. */
  7452. lineTo(x?: number, y?: number): void;
  7453. /**
  7454. !#en Adds a cubic Bézier curve to the path
  7455. !#zh 绘制三次贝赛尔曲线路径
  7456. @param c1x The x axis of the coordinate for the first control point.
  7457. @param c1y The y axis of the coordinate for first control point.
  7458. @param c2x The x axis of the coordinate for the second control point.
  7459. @param c2y The y axis of the coordinate for the second control point.
  7460. @param x The x axis of the coordinate for the end point.
  7461. @param y The y axis of the coordinate for the end point.
  7462. */
  7463. bezierCurveTo(c1x?: number, c1y?: number, c2x?: number, c2y?: number, x?: number, y?: number): void;
  7464. /**
  7465. !#en Adds a quadratic Bézier curve to the path
  7466. !#zh 绘制二次贝赛尔曲线路径
  7467. @param cx The x axis of the coordinate for the control point.
  7468. @param cy The y axis of the coordinate for the control point.
  7469. @param x The x axis of the coordinate for the end point.
  7470. @param y The y axis of the coordinate for the end point.
  7471. */
  7472. quadraticCurveTo(cx?: number, cy?: number, x?: number, y?: number): void;
  7473. /**
  7474. !#en Adds an arc to the path which is centered at (cx, cy) position with radius r starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to false).
  7475. !#zh 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  7476. @param cx The x axis of the coordinate for the center point.
  7477. @param cy The y axis of the coordinate for the center point.
  7478. @param r The arc's radius.
  7479. @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  7480. @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  7481. @param counterclockwise An optional Boolean which, if true, causes the arc to be drawn counter-clockwise between the two angles. By default it is drawn clockwise.
  7482. */
  7483. arc(cx?: number, cy?: number, r?: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
  7484. /**
  7485. !#en Adds an ellipse to the path.
  7486. !#zh 绘制椭圆路径。
  7487. @param cx The x axis of the coordinate for the center point.
  7488. @param cy The y axis of the coordinate for the center point.
  7489. @param rx The ellipse's x-axis radius.
  7490. @param ry The ellipse's y-axis radius.
  7491. */
  7492. ellipse(cx?: number, cy?: number, rx?: number, ry?: number): void;
  7493. /**
  7494. !#en Adds an circle to the path.
  7495. !#zh 绘制圆形路径。
  7496. @param cx The x axis of the coordinate for the center point.
  7497. @param cy The y axis of the coordinate for the center point.
  7498. @param r The circle's radius.
  7499. */
  7500. circle(cx?: number, cy?: number, r?: number): void;
  7501. /**
  7502. !#en Adds an rectangle to the path.
  7503. !#zh 绘制矩形路径。
  7504. @param x The x axis of the coordinate for the rectangle starting point.
  7505. @param y The y axis of the coordinate for the rectangle starting point.
  7506. @param w The rectangle's width.
  7507. @param h The rectangle's height.
  7508. */
  7509. rect(x?: number, y?: number, w?: number, h?: number): void;
  7510. /**
  7511. !#en Adds an round corner rectangle to the path.
  7512. !#zh 绘制圆角矩形路径。
  7513. @param x The x axis of the coordinate for the rectangle starting point.
  7514. @param y The y axis of the coordinate for the rectangle starting point.
  7515. @param w The rectangles width.
  7516. @param h The rectangle's height.
  7517. @param r The radius of the rectangle.
  7518. */
  7519. roundRect(x?: number, y?: number, w?: number, h?: number, r?: number): void;
  7520. /**
  7521. !#en Draws a filled rectangle.
  7522. !#zh 绘制填充矩形。
  7523. @param x The x axis of the coordinate for the rectangle starting point.
  7524. @param y The y axis of the coordinate for the rectangle starting point.
  7525. @param w The rectangle's width.
  7526. @param h The rectangle's height.
  7527. */
  7528. fillRect(x?: number, y?: number, w?: number, h?: number): void;
  7529. /**
  7530. !#en Erasing any previously drawn content.
  7531. !#zh 擦除之前绘制的所有内容的方法。
  7532. @param clean Whether to clean the graphics inner cache.
  7533. */
  7534. clear(clean?: boolean): void;
  7535. /**
  7536. !#en Causes the point of the pen to move back to the start of the current path. It tries to add a straight line from the current point to the start.
  7537. !#zh 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  7538. */
  7539. close(): void;
  7540. /**
  7541. !#en Strokes the current or given path with the current stroke style.
  7542. !#zh 根据当前的画线样式,绘制当前或已经存在的路径。
  7543. */
  7544. stroke(): void;
  7545. /**
  7546. !#en Fills the current or given path with the current fill style.
  7547. !#zh 根据当前的画线样式,填充当前或已经存在的路径。
  7548. */
  7549. fill(): void;
  7550. }
  7551. /** !#en The animation component is used to play back animations.
  7552. Animation provide several events to register:
  7553. - play : Emit when begin playing animation
  7554. - stop : Emit when stop playing animation
  7555. - pause : Emit when pause animation
  7556. - resume : Emit when resume animation
  7557. - lastframe : If animation repeat count is larger than 1, emit when animation play to the last frame
  7558. - finished : Emit when finish playing animation
  7559. !#zh Animation 组件用于播放动画。
  7560. Animation 提供了一系列可注册的事件:
  7561. - play : 开始播放时
  7562. - stop : 停止播放时
  7563. - pause : 暂停播放时
  7564. - resume : 恢复播放时
  7565. - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
  7566. - finished : 动画播放完成时 */
  7567. export class Animation extends Component implements EventTarget {
  7568. /** !#en Animation will play the default clip when start game.
  7569. !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */
  7570. defaultClip: AnimationClip;
  7571. /** !#en Current played clip.
  7572. !#zh 当前播放的动画剪辑。 */
  7573. currentClip: AnimationClip;
  7574. /** !#en Whether the animation should auto play the default clip when start game.
  7575. !#zh 是否在运行游戏后自动播放默认动画剪辑。 */
  7576. playOnLoad: boolean;
  7577. /**
  7578. !#en Get all the clips used in this animation.
  7579. !#zh 获取动画组件上的所有动画剪辑。
  7580. */
  7581. getClips(): AnimationClip[];
  7582. /**
  7583. !#en Plays an animation and stop other animations.
  7584. !#zh 播放指定的动画,并且停止当前正在播放动画。如果没有指定动画,则播放默认动画。
  7585. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7586. @param startTime play an animation from startTime
  7587. @example
  7588. ```js
  7589. var animCtrl = this.node.getComponent(cc.Animation);
  7590. animCtrl.play("linear");
  7591. ```
  7592. */
  7593. play(name?: string, startTime?: number): AnimationState;
  7594. /**
  7595. !#en
  7596. Plays an additive animation, it will not stop other animations.
  7597. If there are other animations playing, then will play several animations at the same time.
  7598. !#zh 播放指定的动画(将不会停止当前播放的动画)。如果没有指定动画,则播放默认动画。
  7599. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7600. @param startTime play an animation from startTime
  7601. @example
  7602. ```js
  7603. // linear_1 and linear_2 at the same time playing.
  7604. var animCtrl = this.node.getComponent(cc.Animation);
  7605. animCtrl.playAdditive("linear_1");
  7606. animCtrl.playAdditive("linear_2");
  7607. ```
  7608. */
  7609. playAdditive(name?: string, startTime?: number): AnimationState;
  7610. /**
  7611. !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>
  7612. Stopping an animation also Rewinds it to the Start.
  7613. !#zh 停止指定的动画。如果没有指定名字,则停止当前正在播放的动画。
  7614. @param name The animation to stop, if not supplied then stops all playing animations.
  7615. */
  7616. stop(name?: string): void;
  7617. /**
  7618. !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
  7619. !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
  7620. @param name The animation to pauses, if not supplied then pauses all playing animations.
  7621. */
  7622. pause(name?: string): void;
  7623. /**
  7624. !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
  7625. !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
  7626. @param name The animation to resumes, if not supplied then resumes all paused animations.
  7627. */
  7628. resume(name?: string): void;
  7629. /**
  7630. !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time.
  7631. !#zh 设置指定动画的播放时间。如果没有指定名字,则设置当前播放动画的播放时间。
  7632. @param time The time to go to
  7633. @param name Specified animation name, if not supplied then make all animations go to the time.
  7634. */
  7635. setCurrentTime(time?: number, name?: string): void;
  7636. /**
  7637. !#en Returns the animation state named name. If no animation with the specified name, the function will return null.
  7638. !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。
  7639. @param name name
  7640. */
  7641. getAnimationState(name: string): AnimationState;
  7642. /**
  7643. !#en Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip.
  7644. !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
  7645. @param clip the clip to add
  7646. @param newName newName
  7647. */
  7648. addClip(clip: AnimationClip, newName?: string): AnimationState;
  7649. /**
  7650. !#en
  7651. Remove clip from the animation list. This will remove the clip and any animation states based on it.
  7652. If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
  7653. But if force is true, then will always remove the clip and any animation states based on it. If clip is defaultClip, defaultClip will be reset to null
  7654. !#zh
  7655. 从动画列表中移除指定的动画剪辑,<br/>
  7656. 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。
  7657. 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。
  7658. @param clip clip
  7659. @param force If force is true, then will always remove the clip and any animation states based on it.
  7660. */
  7661. removeClip(clip: AnimationClip, force?: boolean): void;
  7662. /**
  7663. !#en
  7664. Samples animations at the current state.<br/>
  7665. This is useful when you explicitly want to set up some animation state, and sample it once.
  7666. !#zh 对指定或当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
  7667. @param name name
  7668. */
  7669. sample(name: string): void;
  7670. /**
  7671. !#en
  7672. Register animation event callback.
  7673. The event arguments will provide the AnimationState which emit the event.
  7674. When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
  7675. !#zh
  7676. 注册动画事件回调。
  7677. 回调的事件里将会附上发送事件的 AnimationState。
  7678. 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  7679. @param type A string representing the event type to listen for.
  7680. @param callback The callback that will be invoked when the event is dispatched.
  7681. The callback is ignored if it is a duplicate (the callbacks are unique).
  7682. @param state state
  7683. @param target The target (this object) to invoke the callback, can be null
  7684. @param useCapture When set to true, the capture argument prevents callback
  7685. from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
  7686. When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
  7687. Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
  7688. @example
  7689. ```js
  7690. onPlay: function (type, state) {
  7691. // callback
  7692. }
  7693. // register event to all animation
  7694. animation.on('play', this.onPlay, this);
  7695. ```
  7696. */
  7697. on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void;
  7698. on<T>(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void;
  7699. /**
  7700. !#en
  7701. Unregister animation event callback.
  7702. !#zh
  7703. 取消注册动画事件回调。
  7704. @param type A string representing the event type being removed.
  7705. @param callback The callback to remove.
  7706. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7707. @param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.
  7708. If not specified, useCapture defaults to false. If a callback was registered twice,
  7709. one with capture and one without, each must be removed separately. Removal of a capturing callback
  7710. does not affect a non-capturing version of the same listener, and vice versa.
  7711. @example
  7712. ```js
  7713. // unregister event to all animation
  7714. animation.off('play', this.onPlay, this);
  7715. ```
  7716. */
  7717. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  7718. /**
  7719. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7720. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7721. @param type The type of event.
  7722. */
  7723. hasEventListener(type: string): boolean;
  7724. /**
  7725. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7726. This is not for removing all listeners in the current event target,
  7727. and this is not for removing all listeners the target parameter have registered.
  7728. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7729. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7730. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7731. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7732. @param target The target to be searched for all related listeners
  7733. */
  7734. targetOff(target: any): void;
  7735. /**
  7736. !#en
  7737. Register an callback of a specific event type on the EventTarget,
  7738. the callback will remove itself after the first time it is triggered.
  7739. !#zh
  7740. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7741. @param type A string representing the event type to listen for.
  7742. @param callback The callback that will be invoked when the event is dispatched.
  7743. The callback is ignored if it is a duplicate (the callbacks are unique).
  7744. @param target The target (this object) to invoke the callback, can be null
  7745. @example
  7746. ```js
  7747. eventTarget.once('fire', function () {
  7748. cc.log("this is the callback and will be invoked only once");
  7749. }, node);
  7750. ```
  7751. */
  7752. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7753. /**
  7754. !#en
  7755. Send an event with the event object.
  7756. !#zh
  7757. 通过事件对象派发事件
  7758. @param event event
  7759. */
  7760. dispatchEvent(event: Event): void;
  7761. }
  7762. /** !#en Audio Source.
  7763. !#zh 音频源组件,能对音频剪辑。 */
  7764. export class AudioSource extends Component {
  7765. /** !#en
  7766. Is the audio source playing (Read Only). <br/>
  7767. Note: isPlaying is not supported for Native platforms.
  7768. !#zh
  7769. 该音频剪辑是否正播放(只读)。<br/>
  7770. 注意:Native 平台暂时不支持 isPlaying。 */
  7771. isPlaying: boolean;
  7772. /** !#en The clip of the audio source to play.
  7773. !#zh 要播放的音频剪辑。 */
  7774. clip: AudioClip;
  7775. /** !#en The volume of the audio source.
  7776. !#zh 音频源的音量(0.0 ~ 1.0)。 */
  7777. volume: number;
  7778. /** !#en Is the audio source mute?
  7779. !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。 */
  7780. mute: boolean;
  7781. /** !#en Is the audio source looping?
  7782. !#zh 音频源是否循环播放? */
  7783. loop: boolean;
  7784. /** !#en If set to true, the audio source will automatically start playing on onEnable.
  7785. !#zh 如果设置为 true,音频源将在 onEnable 时自动播放。 */
  7786. playOnLoad: boolean;
  7787. /**
  7788. !#en Plays the clip.
  7789. !#zh 播放音频剪辑。
  7790. */
  7791. play(): void;
  7792. /**
  7793. !#en Stops the clip.
  7794. !#zh 停止当前音频剪辑。
  7795. */
  7796. stop(): void;
  7797. /**
  7798. !#en Pause the clip.
  7799. !#zh 暂停当前音频剪辑。
  7800. */
  7801. pause(): void;
  7802. /**
  7803. !#en Resume the clip.
  7804. !#zh 恢复播放。
  7805. */
  7806. resume(): void;
  7807. /**
  7808. !#en Rewind playing music.
  7809. !#zh 从头开始播放。
  7810. */
  7811. rewind(): void;
  7812. /**
  7813. !#en Get current time
  7814. !#zh 获取当前的播放时间
  7815. */
  7816. getCurrentTime(): number;
  7817. /**
  7818. !#en Set current time
  7819. !#zh 设置当前的播放时间
  7820. @param time time
  7821. */
  7822. setCurrentTime(time: number): number;
  7823. /**
  7824. !#en Get audio duration
  7825. !#zh 获取当前音频的长度
  7826. */
  7827. getDuration(): number;
  7828. }
  7829. /** !#en
  7830. This component will block all input events (mouse and touch) within the bounding box of the node, preventing the input from penetrating into the underlying node, typically for the background of the top UI.<br>
  7831. This component does not have any API interface and can be added directly to the scene to take effect.
  7832. !#zh
  7833. 该组件将拦截所属节点 bounding box 内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  7834. 该组件没有任何 API 接口,直接添加到场景即可生效。 */
  7835. export class BlockInputEvents extends Component {
  7836. }
  7837. /** !#en
  7838. Button has 4 Transition types<br/>
  7839. When Button state changed:<br/>
  7840. If Transition type is Button.Transition.NONE, Button will do nothing<br/>
  7841. If Transition type is Button.Transition.COLOR, Button will change target's color<br/>
  7842. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite<br/>
  7843. If Transition type is Button.Transition.SCALE, Button will change target node's scale<br/>
  7844. Button will trigger 5 events:<br/>
  7845. Button.EVENT_TOUCH_DOWN<br/>
  7846. Button.EVENT_TOUCH_UP<br/>
  7847. Button.EVENT_HOVER_IN<br/>
  7848. Button.EVENT_HOVER_MOVE<br/>
  7849. Button.EVENT_HOVER_OUT<br/>
  7850. User can get the current clicked node with 'event.target' from event object which is passed as parameter in the callback function of click event.
  7851. !#zh
  7852. 按钮组件。可以被按下,或者点击。
  7853. 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
  7854. - Button.Transition.NONE // 不做任何过渡
  7855. - Button.Transition.COLOR // 进行颜色之间过渡
  7856. - Button.Transition.SPRITE // 进行精灵之间过渡
  7857. - Button.Transition.SCALE // 进行缩放过渡
  7858. 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):<br/>
  7859. 以下事件可以在全平台上都触发:
  7860. - cc.Node.EventType.TOUCH_START // 按下时事件
  7861. - cc.Node.EventType.TOUCH_Move // 按住移动后事件
  7862. - cc.Node.EventType.TOUCH_END // 按下后松开后事件
  7863. - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
  7864. 以下事件只在 PC 平台上触发:
  7865. - cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
  7866. - cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
  7867. - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
  7868. - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
  7869. - cc.Node.EventType.MOUSE_UP // 鼠标松开事件
  7870. - cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
  7871. 用户可以通过获取 __点击事件__ 回调函数的参数 event 的 target 属性获取当前点击对象。 */
  7872. export class Button extends Component implements GraySpriteState {
  7873. /** !#en
  7874. Whether the Button is disabled.
  7875. If true, the Button will trigger event and do transition.
  7876. !#zh
  7877. 按钮事件是否被响应,如果为 false,则按钮将被禁用。 */
  7878. interactable: boolean;
  7879. /** !#en When this flag is true, Button target sprite will turn gray when interactable is false.
  7880. !#zh 如果这个标记为 true,当 button 的 interactable 属性为 false 的时候,会使用内置 shader 让 button 的 target 节点的 sprite 组件变灰 */
  7881. enableAutoGrayEffect: boolean;
  7882. /** !#en Transition type
  7883. !#zh 按钮状态改变时过渡方式。 */
  7884. transition: Button.Transition;
  7885. /** !#en Normal state color.
  7886. !#zh 普通状态下按钮所显示的颜色。 */
  7887. normalColor: Color;
  7888. /** !#en Pressed state color
  7889. !#zh 按下状态时按钮所显示的颜色。 */
  7890. pressedColor: Color;
  7891. /** !#en Hover state color
  7892. !#zh 悬停状态下按钮所显示的颜色。 */
  7893. hoverColor: Color;
  7894. /** !#en Disabled state color
  7895. !#zh 禁用状态下按钮所显示的颜色。 */
  7896. disabledColor: Color;
  7897. /** !#en Color and Scale transition duration
  7898. !#zh 颜色过渡和缩放过渡时所需时间 */
  7899. duration: number;
  7900. /** !#en When user press the button, the button will zoom to a scale.
  7901. The final scale of the button equals (button original scale * zoomScale)
  7902. !#zh 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale */
  7903. zoomScale: number;
  7904. /** !#en Normal state sprite
  7905. !#zh 普通状态下按钮所显示的 Sprite 。 */
  7906. normalSprite: SpriteFrame;
  7907. /** !#en Pressed state sprite
  7908. !#zh 按下状态时按钮所显示的 Sprite 。 */
  7909. pressedSprite: SpriteFrame;
  7910. /** !#en Hover state sprite
  7911. !#zh 悬停状态下按钮所显示的 Sprite 。 */
  7912. hoverSprite: SpriteFrame;
  7913. /** !#en Disabled state sprite
  7914. !#zh 禁用状态下按钮所显示的 Sprite 。 */
  7915. disabledSprite: SpriteFrame;
  7916. /** !#en
  7917. Transition target.
  7918. When Button state changed:
  7919. If Transition type is Button.Transition.NONE, Button will do nothing
  7920. If Transition type is Button.Transition.COLOR, Button will change target's color
  7921. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
  7922. !#zh
  7923. 需要过渡的目标。
  7924. 当前按钮状态改变规则:
  7925. -如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
  7926. -如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
  7927. -如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */
  7928. target: Node;
  7929. /** !#en If Button is clicked, it will trigger event's handler
  7930. !#zh 按钮的点击事件列表。 */
  7931. clickEvents: Component.EventHandler[];
  7932. /** !#en The normal material.
  7933. !#zh 正常状态的材质。 */
  7934. normalMaterial: Material;
  7935. /** !#en The gray material.
  7936. !#zh 置灰状态的材质。 */
  7937. grayMaterial: Material;
  7938. }
  7939. /** !#zh: 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。
  7940. 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 */
  7941. export class Canvas extends Component {
  7942. /** !#en Current active canvas, the scene should only have one active canvas at the same time.
  7943. !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。 */
  7944. static instance: Canvas;
  7945. /** !#en The desigin resolution for current scene.
  7946. !#zh 当前场景设计分辨率。 */
  7947. designResolution: Size;
  7948. /** !#en TODO
  7949. !#zh: 是否优先将设计分辨率高度撑满视图高度。 */
  7950. fitHeight: boolean;
  7951. /** !#en TODO
  7952. !#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */
  7953. fitWidth: boolean;
  7954. }
  7955. /** !#en
  7956. Base class for everything attached to Node(Entity).<br/>
  7957. <br/>
  7958. NOTE: Not allowed to use construction parameters for Component's subclasses,
  7959. because Component is created by the engine.
  7960. !#zh
  7961. 所有附加到节点的基类。<br/>
  7962. <br/>
  7963. 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。 */
  7964. export class Component extends Object {
  7965. /** !#en The node this component is attached to. A component is always attached to a node.
  7966. !#zh 该组件被附加到的节点。组件总会附加到一个节点。 */
  7967. node: Node;
  7968. /** !#en The uuid for editor.
  7969. !#zh 组件的 uuid,用于编辑器。 */
  7970. uuid: string;
  7971. /** !#en indicates whether this component is enabled or not.
  7972. !#zh 表示该组件自身是否启用。 */
  7973. enabled: boolean;
  7974. /** !#en indicates whether this component is enabled and its node is also active in the hierarchy.
  7975. !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。 */
  7976. enabledInHierarchy: boolean;
  7977. /** !#en Returns a value which used to indicate the onLoad get called or not.
  7978. !#zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。 */
  7979. _isOnLoadCalled: number;
  7980. /**
  7981. !#en Update is called every frame, if the Component is enabled.<br/>
  7982. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7983. !#zh 如果该组件启用,则每帧调用 update。<br/>
  7984. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7985. @param dt the delta time in seconds it took to complete the last frame
  7986. */
  7987. protected update(dt: number): void;
  7988. /**
  7989. !#en LateUpdate is called every frame, if the Component is enabled.<br/>
  7990. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7991. !#zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  7992. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7993. @param dt the delta time in seconds it took to complete the last frame
  7994. */
  7995. protected lateUpdate(dt: number): void;
  7996. /**
  7997. !#en
  7998. When attaching to an active node or its node first activated.
  7999. onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  8000. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  8001. !#zh
  8002. 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  8003. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  8004. */
  8005. protected onLoad(): void;
  8006. /**
  8007. !#en
  8008. Called before all scripts' update if the Component is enabled the first time.
  8009. Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  8010. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  8011. !#zh
  8012. 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  8013. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  8014. */
  8015. protected start(): void;
  8016. /**
  8017. !#en Called when this component becomes enabled and its node is active.<br/>
  8018. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  8019. !#zh 当该组件被启用,并且它的节点也激活时。<br/>
  8020. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  8021. */
  8022. protected onEnable(): void;
  8023. /**
  8024. !#en Called when this component becomes disabled or its node becomes inactive.<br/>
  8025. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  8026. !#zh 当该组件被禁用或节点变为无效时调用。<br/>
  8027. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  8028. */
  8029. protected onDisable(): void;
  8030. /**
  8031. !#en Called when this component will be destroyed.<br/>
  8032. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  8033. !#zh 当该组件被销毁时调用<br/>
  8034. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  8035. */
  8036. protected onDestroy(): void;
  8037. protected onFocusInEditor(): void;
  8038. protected onLostFocusInEditor(): void;
  8039. /**
  8040. !#en Called to initialize the component or node’s properties when adding the component the first time or when the Reset command is used. This function is only called in editor.
  8041. !#zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  8042. */
  8043. protected resetInEditor(): void;
  8044. /**
  8045. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  8046. !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
  8047. @param typeOrClassName the constructor or the class name of the component to add
  8048. @example
  8049. ```js
  8050. var sprite = node.addComponent(cc.Sprite);
  8051. var test = node.addComponent("Test");
  8052. ```
  8053. */
  8054. addComponent<T extends Component>(type: {new(): T}): T;
  8055. addComponent(className: string): any;
  8056. /**
  8057. !#en
  8058. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  8059. You can also get component in the node by passing in the name of the script.
  8060. !#zh
  8061. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  8062. 传入参数也可以是脚本的名称。
  8063. @param typeOrClassName typeOrClassName
  8064. @example
  8065. ```js
  8066. // get sprite component.
  8067. var sprite = node.getComponent(cc.Sprite);
  8068. // get custom test calss.
  8069. var test = node.getComponent("Test");
  8070. ```
  8071. */
  8072. getComponent<T extends Component>(type: {prototype: T}): T;
  8073. getComponent(className: string): any;
  8074. /**
  8075. !#en Returns all components of supplied Type in the node.
  8076. !#zh 返回节点上指定类型的所有组件。
  8077. @param typeOrClassName typeOrClassName
  8078. @example
  8079. ```js
  8080. var sprites = node.getComponents(cc.Sprite);
  8081. var tests = node.getComponents("Test");
  8082. ```
  8083. */
  8084. getComponents<T extends Component>(type: {prototype: T}): T[];
  8085. getComponents(className: string): any[];
  8086. /**
  8087. !#en Returns the component of supplied type in any of its children using depth first search.
  8088. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  8089. @param typeOrClassName typeOrClassName
  8090. @example
  8091. ```js
  8092. var sprite = node.getComponentInChildren(cc.Sprite);
  8093. var Test = node.getComponentInChildren("Test");
  8094. ```
  8095. */
  8096. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  8097. getComponentInChildren(className: string): any;
  8098. /**
  8099. !#en Returns the components of supplied type in self or any of its children using depth first search.
  8100. !#zh 递归查找自身或所有子节点中指定类型的组件
  8101. @param typeOrClassName typeOrClassName
  8102. @example
  8103. ```js
  8104. var sprites = node.getComponentsInChildren(cc.Sprite);
  8105. var tests = node.getComponentsInChildren("Test");
  8106. ```
  8107. */
  8108. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  8109. getComponentsInChildren(className: string): any[];
  8110. /**
  8111. !#en
  8112. If the component's bounding box is different from the node's, you can implement this method to supply
  8113. a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  8114. !#zh
  8115. 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  8116. 以便编辑器的场景视图可以正确地执行点选测试。
  8117. @param out_rect the Rect to receive the bounding box
  8118. */
  8119. _getLocalBounds(out_rect: Rect): void;
  8120. /**
  8121. !#en
  8122. onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  8123. an undo operation on this component.<br/>
  8124. <br/>
  8125. If the component contains the "internal state", short for "temporary member variables which not included<br/>
  8126. in its CCClass properties", then you may need to implement this function.<br/>
  8127. <br/>
  8128. The editor will call the getset accessors of your component to record/restore the component's state<br/>
  8129. for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  8130. this function to manually synchronize your component's "internal states" with its public properties.<br/>
  8131. Once you implement this function, all the getset accessors of your component will not be called when<br/>
  8132. the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  8133. will be recorded or restored by editor.<br/>
  8134. <br/>
  8135. Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  8136. to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  8137. properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  8138. will not be called during reset operation. Which means that only the properties with default value<br/>
  8139. will be reset by editor.
  8140. This function is only called in editor mode.
  8141. !#zh
  8142. onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  8143. <br/>
  8144. 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  8145. <br/>
  8146. 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。然而,在极端的情况下,它可能无法良好运作。<br/>
  8147. 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  8148. <br/>
  8149. 同样的,编辑可能无法在极端情况下正确地重置您的组件。如果你需要支持组件重置菜单,则需要在该方法中手工同步组件属性到“内部状态”。一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。这意味着仅仅指定了默认值的属性将被编辑器重置。
  8150. <br/>
  8151. 此方法仅在编辑器下会被调用。
  8152. */
  8153. onRestore(): void;
  8154. /**
  8155. !#en
  8156. Schedules a custom selector.<br/>
  8157. If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
  8158. !#zh
  8159. 调度一个自定义的回调函数。<br/>
  8160. 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
  8161. @param callback The callback function
  8162. @param interval Tick interval in seconds. 0 means tick every frame.
  8163. @param repeat The selector will be executed (repeat + 1) times, you can use cc.macro.REPEAT_FOREVER for tick infinitely.
  8164. @param delay The amount of time that the first tick will wait before execution. Unit: s
  8165. @example
  8166. ```js
  8167. var timeCallback = function (dt) {
  8168. cc.log("time: " + dt);
  8169. }
  8170. this.schedule(timeCallback, 1);
  8171. ```
  8172. */
  8173. schedule(callback: Function, interval?: number, repeat?: number, delay?: number): void;
  8174. /**
  8175. !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
  8176. !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  8177. @param callback A function wrapped as a selector
  8178. @param delay The amount of time that the first tick will wait before execution. Unit: s
  8179. @example
  8180. ```js
  8181. var timeCallback = function (dt) {
  8182. cc.log("time: " + dt);
  8183. }
  8184. this.scheduleOnce(timeCallback, 2);
  8185. ```
  8186. */
  8187. scheduleOnce(callback: Function, delay?: number): void;
  8188. /**
  8189. !#en Unschedules a custom callback function.
  8190. !#zh 取消调度一个自定义的回调函数。
  8191. @param callback_fn A function wrapped as a selector
  8192. @example
  8193. ```js
  8194. this.unschedule(_callback);
  8195. ```
  8196. */
  8197. unschedule(callback_fn: Function): void;
  8198. /**
  8199. !#en
  8200. unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
  8201. Actions are not affected by this method.
  8202. !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 `update` 回调函数。动作不受此方法影响。
  8203. @example
  8204. ```js
  8205. this.unscheduleAllCallbacks();
  8206. ```
  8207. */
  8208. unscheduleAllCallbacks(): void;
  8209. }
  8210. /** !#en The Label Component.
  8211. !#zh 文字标签组件 */
  8212. export class Label extends RenderComponent {
  8213. /** !#en Content string of label.
  8214. !#zh 标签显示的文本内容。 */
  8215. string: string;
  8216. /** !#en Horizontal Alignment of label.
  8217. !#zh 文本内容的水平对齐方式。 */
  8218. horizontalAlign: Label.HorizontalAlign;
  8219. /** !#en Vertical Alignment of label.
  8220. !#zh 文本内容的垂直对齐方式。 */
  8221. verticalAlign: Label.VerticalAlign;
  8222. /** !#en The actual rendering font size in shrink mode
  8223. !#zh SHRINK 模式下面文本实际渲染的字体大小 */
  8224. actualFontSize: number;
  8225. /** !#en Font size of label.
  8226. !#zh 文本字体大小。 */
  8227. fontSize: number;
  8228. /** !#en Font family of label, only take effect when useSystemFont property is true.
  8229. !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 */
  8230. fontFamily: string;
  8231. /** !#en Line Height of label.
  8232. !#zh 文本行高。 */
  8233. lineHeight: number;
  8234. /** !#en Overflow of label.
  8235. !#zh 文字显示超出范围时的处理方式。 */
  8236. overflow: Label.Overflow;
  8237. /** !#en Whether auto wrap label when string width is large than label width.
  8238. !#zh 是否自动换行。 */
  8239. enableWrapText: boolean;
  8240. /** !#en The font of label.
  8241. !#zh 文本字体。 */
  8242. font: Font;
  8243. /** !#en Whether use system font name or not.
  8244. !#zh 是否使用系统字体。 */
  8245. useSystemFont: boolean;
  8246. /** !#en The spacing of the x axis between characters, only take Effect when using bitmap fonts.
  8247. !#zh 文字之间 x 轴的间距,仅在使用位图字体时生效。 */
  8248. spacingX: number;
  8249. /** !#en The cache mode of label. This mode only supports system fonts.
  8250. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  8251. cacheMode: Label.CacheMode;
  8252. /** !#en Whether enable bold.
  8253. !#zh 是否启用黑体。 */
  8254. enableBold: boolean;
  8255. /** !#en Whether enable italic.
  8256. !#zh 是否启用黑体。 */
  8257. enableItalic: boolean;
  8258. /** !#en Whether enable underline.
  8259. !#zh 是否启用下划线。 */
  8260. enableUnderline: boolean;
  8261. /** !#en The height of underline.
  8262. !#zh 下划线高度。 */
  8263. underlineHeight: number;
  8264. /**
  8265. !#zh 需要保证当前场景中没有使用CHAR缓存的Label才可以清除,否则已渲染的文字没有重新绘制会不显示
  8266. !#en It can be cleared that need to ensure there is not use the CHAR cache in the current scene. Otherwise, the rendered text will not be displayed without repainting.
  8267. */
  8268. static clearCharCache(): void;
  8269. }
  8270. /** !#en Outline effect used to change the display, only for system fonts or TTF fonts
  8271. !#zh 描边效果组件,用于字体描边,只能用于系统字体 */
  8272. export class LabelOutline extends Component {
  8273. /** !#en outline color
  8274. !#zh 改变描边的颜色 */
  8275. color: Color;
  8276. /** !#en Change the outline width
  8277. !#zh 改变描边的宽度 */
  8278. width: number;
  8279. }
  8280. /** !#en Shadow effect for Label component, only for system fonts or TTF fonts
  8281. !#zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体 */
  8282. export class LabelShadow extends Component {
  8283. /** !#en The shadow color
  8284. !#zh 阴影的颜色 */
  8285. color: Color;
  8286. /** !#en Offset between font and shadow
  8287. !#zh 字体与阴影的偏移 */
  8288. offset: Vec2;
  8289. /** !#en A non-negative float specifying the level of shadow blur
  8290. !#zh 阴影的模糊程度 */
  8291. blur: number;
  8292. }
  8293. /** !#en
  8294. The Layout is a container component, use it to arrange child elements easily.<br>
  8295. Note:<br>
  8296. 1.Scaling and rotation of child nodes are not considered.<br>
  8297. 2.After setting the Layout, the results need to be updated until the next frame,
  8298. unless you manually call {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。
  8299. !#zh
  8300. Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  8301. 注意:<br>
  8302. 1.不会考虑子节点的缩放和旋转。<br>
  8303. 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用 {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。 */
  8304. export class Layout extends Component {
  8305. /** !#en The layout type.
  8306. !#zh 布局类型 */
  8307. type: Layout.Type;
  8308. /** !#en
  8309. The are three resize modes for Layout.
  8310. None, resize Container and resize children.
  8311. !#zh 缩放模式 */
  8312. resizeMode: Layout.ResizeMode;
  8313. /** !#en The cell size for grid layout.
  8314. !#zh 每个格子的大小,只有布局类型为 GRID 的时候才有效。 */
  8315. cellSize: Size;
  8316. /** !#en
  8317. The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  8318. and then break line on demand. Choose vertical if you want to layout vertically at first .
  8319. !#zh 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。 */
  8320. startAxis: Layout.AxisDirection;
  8321. /** !#en The left padding of layout, it only effect the layout in one direction.
  8322. !#zh 容器内左边距,只会在一个布局方向上生效。 */
  8323. paddingLeft: number;
  8324. /** !#en The right padding of layout, it only effect the layout in one direction.
  8325. !#zh 容器内右边距,只会在一个布局方向上生效。 */
  8326. paddingRight: number;
  8327. /** !#en The top padding of layout, it only effect the layout in one direction.
  8328. !#zh 容器内上边距,只会在一个布局方向上生效。 */
  8329. paddingTop: number;
  8330. /** !#en The bottom padding of layout, it only effect the layout in one direction.
  8331. !#zh 容器内下边距,只会在一个布局方向上生效。 */
  8332. paddingBottom: number;
  8333. /** !#en The distance in x-axis between each element in layout.
  8334. !#zh 子节点之间的水平间距。 */
  8335. spacingX: number;
  8336. /** !#en The distance in y-axis between each element in layout.
  8337. !#zh 子节点之间的垂直间距。 */
  8338. spacingY: number;
  8339. /** !#en
  8340. Only take effect in Vertical layout mode.
  8341. This option changes the start element's positioning.
  8342. !#zh 垂直排列子节点的方向。 */
  8343. verticalDirection: Layout.VerticalDirection;
  8344. /** !#en
  8345. Only take effect in Horizontal layout mode.
  8346. This option changes the start element's positioning.
  8347. !#zh 水平排列子节点的方向。 */
  8348. horizontalDirection: Layout.HorizontalDirection;
  8349. /** !#en Adjust the layout if the children scaled.
  8350. !#zh 子节点缩放比例是否影响布局。 */
  8351. affectedByScale: boolean;
  8352. /**
  8353. !#en Perform the layout update
  8354. !#zh 立即执行更新布局
  8355. @example
  8356. ```js
  8357. layout.type = cc.Layout.HORIZONTAL;
  8358. layout.node.addChild(childNode);
  8359. cc.log(childNode.x); // not yet changed
  8360. layout.updateLayout();
  8361. cc.log(childNode.x); // changed
  8362. ```
  8363. */
  8364. updateLayout(): void;
  8365. }
  8366. /** !#en The Mask Component
  8367. !#zh 遮罩组件 */
  8368. export class Mask extends RenderComponent {
  8369. /** !#en The mask type.
  8370. !#zh 遮罩类型 */
  8371. type: Mask.Type;
  8372. /** !#en The mask image
  8373. !#zh 遮罩所需要的贴图 */
  8374. spriteFrame: SpriteFrame;
  8375. /** !#en
  8376. The alpha threshold.(Not supported Canvas Mode) <br/>
  8377. The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  8378. Should be a float between 0 and 1. <br/>
  8379. This default to 0.1.
  8380. When it's set to 1, the stencil will discard all pixels, nothing will be shown.
  8381. !#zh
  8382. Alpha 阈值(不支持 Canvas 模式)<br/>
  8383. 只有当模板的像素的 alpha 大于等于 alphaThreshold 时,才会绘制内容。<br/>
  8384. 该数值 0 ~ 1 之间的浮点数,默认值为 0.1
  8385. 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容 */
  8386. alphaThreshold: number;
  8387. /** !#en Reverse mask (Not supported Canvas Mode)
  8388. !#zh 反向遮罩(不支持 Canvas 模式) */
  8389. inverted: boolean;
  8390. /** TODO: remove segments, not supported by graphics
  8391. !#en The segements for ellipse mask.
  8392. !#zh 椭圆遮罩的曲线细分数 */
  8393. segements: number;
  8394. }
  8395. /** !#en
  8396. cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  8397. You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  8398. length and color. The fadeTime controls how long it takes each vertex in <br/>
  8399. the streak to fade out, the minimum segment size it how many pixels the <br/>
  8400. streak will move before adding a new ribbon segment, and the texture <br/>
  8401. length is the how many pixels the texture is stretched across. The texture <br/>
  8402. is vertically aligned along the streak segment.
  8403. !#zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */
  8404. export class MotionStreak extends Component implements BlendFunc {
  8405. /** !#en
  8406. !#zh 在编辑器模式下预览拖尾效果。 */
  8407. preview: boolean;
  8408. /** !#en The fade time to fade.
  8409. !#zh 拖尾的渐隐时间,以秒为单位。 */
  8410. fadeTime: number;
  8411. /** !#en The minimum segment size.
  8412. !#zh 拖尾之间最小距离。 */
  8413. minSeg: number;
  8414. /** !#en The stroke's width.
  8415. !#zh 拖尾的宽度。 */
  8416. stroke: number;
  8417. /** !#en The texture of the MotionStreak.
  8418. !#zh 拖尾的贴图。 */
  8419. texture: Texture2D;
  8420. /** !#en The color of the MotionStreak.
  8421. !#zh 拖尾的颜色 */
  8422. color: Color;
  8423. /** !#en The fast Mode.
  8424. !#zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。 */
  8425. fastMode: boolean;
  8426. /**
  8427. !#en Remove all living segments of the ribbon.
  8428. !#zh 删除当前所有的拖尾片段。
  8429. @example
  8430. ```js
  8431. // Remove all living segments of the ribbon.
  8432. myMotionStreak.reset();
  8433. ```
  8434. */
  8435. reset(): void;
  8436. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8437. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8438. srcBlendFactor: macro.BlendFactor;
  8439. /** !#en specify the destination Blend Factor.
  8440. !#zh 指定目标的混合模式 */
  8441. dstBlendFactor: macro.BlendFactor;
  8442. }
  8443. /** !#en The PageView control
  8444. !#zh 页面视图组件 */
  8445. export class PageView extends ScrollView {
  8446. /** !#en Specify the size type of each page in PageView.
  8447. !#zh 页面视图中每个页面大小类型 */
  8448. sizeMode: PageView.SizeMode;
  8449. /** !#en The page view direction
  8450. !#zh 页面视图滚动类型 */
  8451. direction: PageView.Direction;
  8452. /** !#en
  8453. The scroll threshold value, when drag exceeds this value,
  8454. release the next page will automatically scroll, less than the restore
  8455. !#zh 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。 */
  8456. scrollThreshold: number;
  8457. /** !#en
  8458. Auto page turning velocity threshold. When users swipe the PageView quickly,
  8459. it will calculate a velocity based on the scroll distance and time,
  8460. if the calculated velocity is larger than the threshold, then it will trigger page turning.
  8461. !#zh
  8462. 快速滑动翻页临界值。
  8463. 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  8464. 该值与此临界值相比较,如果大于临界值,则进行自动翻页。 */
  8465. autoPageTurningThreshold: number;
  8466. /** !#en Change the PageTurning event timing of PageView.
  8467. !#zh 设置 PageView PageTurning 事件的发送时机。 */
  8468. pageTurningEventTiming: number;
  8469. /** !#en The Page View Indicator
  8470. !#zh 页面视图指示器组件 */
  8471. indicator: PageViewIndicator;
  8472. /** !#en The time required to turn over a page. unit: second
  8473. !#zh 每个页面翻页时所需时间。单位:秒 */
  8474. pageTurningSpeed: number;
  8475. /** !#en PageView events callback
  8476. !#zh 滚动视图的事件回调函数 */
  8477. pageEvents: Component.EventHandler[];
  8478. /**
  8479. !#en Returns current page index
  8480. !#zh 返回当前页面索引
  8481. */
  8482. getCurrentPageIndex(): number;
  8483. /**
  8484. !#en Set current page index
  8485. !#zh 设置当前页面索引
  8486. @param index index
  8487. */
  8488. setCurrentPageIndex(index: number): void;
  8489. /**
  8490. !#en Returns all pages of pageview
  8491. !#zh 返回视图中的所有页面
  8492. */
  8493. getPages(): Node[];
  8494. /**
  8495. !#en At the end of the current page view to insert a new view
  8496. !#zh 在当前页面视图的尾部插入一个新视图
  8497. @param page page
  8498. */
  8499. addPage(page: Node): void;
  8500. /**
  8501. !#en Inserts a page in the specified location
  8502. !#zh 将页面插入指定位置中
  8503. @param page page
  8504. @param index index
  8505. */
  8506. insertPage(page: Node, index: number): void;
  8507. /**
  8508. !#en Removes a page from PageView.
  8509. !#zh 移除指定页面
  8510. @param page page
  8511. */
  8512. removePage(page: Node): void;
  8513. /**
  8514. !#en Removes a page at index of PageView.
  8515. !#zh 移除指定下标的页面
  8516. @param index index
  8517. */
  8518. removePageAtIndex(index: number): void;
  8519. /**
  8520. !#en Removes all pages from PageView
  8521. !#zh 移除所有页面
  8522. */
  8523. removeAllPages(): void;
  8524. /**
  8525. !#en Scroll PageView to index.
  8526. !#zh 滚动到指定页面
  8527. @param idx index of page.
  8528. @param timeInSecond scrolling time
  8529. */
  8530. scrollToPage(idx: number, timeInSecond: number): void;
  8531. }
  8532. /** !#en The Page View Indicator Component
  8533. !#zh 页面视图每页标记组件 */
  8534. export class PageViewIndicator extends Component {
  8535. /** !#en The spriteFrame for each element.
  8536. !#zh 每个页面标记显示的图片 */
  8537. spriteFrame: SpriteFrame;
  8538. /** !#en The location direction of PageViewIndicator.
  8539. !#zh 页面标记摆放方向 */
  8540. direction: PageViewIndicator.Direction;
  8541. /** !#en The cellSize for each element.
  8542. !#zh 每个页面标记的大小 */
  8543. cellSize: Size;
  8544. /** !#en The distance between each element.
  8545. !#zh 每个页面标记之间的边距 */
  8546. spacing: number;
  8547. /**
  8548. !#en Set Page View
  8549. !#zh 设置页面视图
  8550. @param target target
  8551. */
  8552. setPageView(target: PageView): void;
  8553. }
  8554. /** !#en
  8555. Visual indicator of progress in some operation.
  8556. Displays a bar to the user representing how far the operation has progressed.
  8557. !#zh
  8558. 进度条组件,可用于显示加载资源时的进度。 */
  8559. export class ProgressBar extends Component {
  8560. /** !#en The targeted Sprite which will be changed progressively.
  8561. !#zh 用来显示进度条比例的 Sprite 对象。 */
  8562. barSprite: Sprite;
  8563. /** !#en The progress mode, there are two modes supported now: horizontal and vertical.
  8564. !#zh 进度条的模式 */
  8565. mode: ProgressBar.Mode;
  8566. /** !#en The total width or height of the bar sprite.
  8567. !#zh 进度条实际的总长度 */
  8568. totalLength: number;
  8569. /** !#en The current progress of the bar sprite. The valid value is between 0-1.
  8570. !#zh 当前进度值,该数值的区间是 0-1 之间。 */
  8571. progress: number;
  8572. /** !#en Whether reverse the progress direction of the bar sprite.
  8573. !#zh 进度条是否进行反方向变化。 */
  8574. reverse: boolean;
  8575. }
  8576. /** !#en
  8577. Base class for components which supports rendering features.
  8578. !#zh
  8579. 所有支持渲染的组件的基类 */
  8580. export class RenderComponent extends Component {
  8581. /** !#en The materials used by this render component.
  8582. !#zh 渲染组件使用的材质。 */
  8583. sharedMaterials: Material[];
  8584. /**
  8585. !#en Get the material by index.
  8586. !#zh 根据指定索引获取材质
  8587. @param index index
  8588. */
  8589. getMaterial(index: number): MaterialVariant;
  8590. /**
  8591. !#en Gets all the materials.
  8592. !#zh 获取所有材质。
  8593. */
  8594. getMaterials(): MaterialVariant[];
  8595. /**
  8596. !#en Set the material by index.
  8597. !#zh 根据指定索引设置材质
  8598. @param index index
  8599. @param material material
  8600. */
  8601. setMaterial(index: number, material: Material): Material;
  8602. }
  8603. /** !#en The RichText Component.
  8604. !#zh 富文本组件 */
  8605. export class RichText extends Component {
  8606. /** !#en Content string of RichText.
  8607. !#zh 富文本显示的文本内容。 */
  8608. string: string;
  8609. /** !#en Horizontal Alignment of each line in RichText.
  8610. !#zh 文本内容的水平对齐方式。 */
  8611. horizontalAlign: macro.TextAlignment;
  8612. /** !#en Font size of RichText.
  8613. !#zh 富文本字体大小。 */
  8614. fontSize: number;
  8615. /** !#en Custom System font of RichText
  8616. !#zh 富文本定制系统字体 */
  8617. fontFamily: string;
  8618. /** !#en Custom TTF font of RichText
  8619. !#zh 富文本定制字体 */
  8620. font: TTFFont;
  8621. /** !#en Whether use system font name or not.
  8622. !#zh 是否使用系统字体。 */
  8623. useSystemFont: boolean;
  8624. /** !#en The cache mode of label. This mode only supports system fonts.
  8625. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  8626. cacheMode: Label.CacheMode;
  8627. /** !#en The maximize width of the RichText
  8628. !#zh 富文本的最大宽度 */
  8629. maxWidth: number;
  8630. /** !#en Line Height of RichText.
  8631. !#zh 富文本行高。 */
  8632. lineHeight: number;
  8633. /** !#en The image atlas for the img tag. For each src value in the img tag, there should be a valid spriteFrame in the image atlas.
  8634. !#zh 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。 */
  8635. imageAtlas: SpriteAtlas;
  8636. /** !#en
  8637. Once checked, the RichText will block all input events (mouse and touch) within
  8638. the bounding box of the node, preventing the input from penetrating into the underlying node.
  8639. !#zh
  8640. 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。 */
  8641. handleTouchEvent: boolean;
  8642. }
  8643. /** !#en
  8644. This component is used to adjust the layout of current node to respect the safe area of a notched mobile device such as the iPhone X.
  8645. It is typically used for the top node of the UI interaction area. For specific usage, refer to the official [example-cases/02_ui/16_safeArea/SafeArea.fire](https://github.com/cocos-creator/example-cases).
  8646. The concept of safe area is to give you a fixed inner rectangle in which you can safely display content that will be drawn on screen.
  8647. You are strongly discouraged from providing controls outside of this area. But your screen background could embellish edges.
  8648. This component internally uses the API `cc.sys.getSafeAreaRect();` to obtain the safe area of the current iOS or Android device,
  8649. and implements the adaptation by using the Widget component and set anchor.
  8650. !#zh
  8651. 该组件会将所在节点的布局适配到 iPhone X 等异形屏手机的安全区域内,通常用于 UI 交互区域的顶层节点,具体用法可参考官方范例 [example-cases/02_ui/16_safeArea/SafeArea.fire](https://github.com/cocos-creator/example-cases)。
  8652. 该组件内部通过 API `cc.sys.getSafeAreaRect();` 获取到当前 iOS 或 Android 设备的安全区域,并通过 Widget 组件实现适配。 */
  8653. export class SafeArea extends Component {
  8654. /**
  8655. !#en Adapt to safe area
  8656. !#zh 立即适配安全区域
  8657. @example
  8658. ```js
  8659. let safeArea = this.node.addComponent(cc.SafeArea);
  8660. safeArea.updateArea();
  8661. ```
  8662. */
  8663. updateArea(): void;
  8664. }
  8665. /** !#en
  8666. The Scrollbar control allows the user to scroll an image or other view that is too large to see completely
  8667. !#zh 滚动条组件 */
  8668. export class Scrollbar extends Component {
  8669. /** !#en The "handle" part of the scrollbar.
  8670. !#zh 作为当前滚动区域位置显示的滑块 Sprite。 */
  8671. handle: Sprite;
  8672. /** !#en The direction of scrollbar.
  8673. !#zh ScrollBar 的滚动方向。 */
  8674. direction: Scrollbar.Direction;
  8675. /** !#en Whether enable auto hide or not.
  8676. !#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */
  8677. enableAutoHide: boolean;
  8678. /** !#en
  8679. The time to hide scrollbar when scroll finished.
  8680. Note: This value is only useful when enableAutoHide is true.
  8681. !#zh
  8682. 没有滚动动作后经过多久会自动隐藏。
  8683. 注意:只要当 “enableAutoHide” 为 true 时,才有效。 */
  8684. autoHideTime: number;
  8685. }
  8686. /** !#en
  8687. Layout container for a view hierarchy that can be scrolled by the user,
  8688. allowing it to be larger than the physical display.
  8689. !#zh
  8690. 滚动视图组件 */
  8691. export class ScrollView extends Component {
  8692. /** !#en This is a reference to the UI element to be scrolled.
  8693. !#zh 可滚动展示内容的节点。 */
  8694. content: Node;
  8695. /** !#en Enable horizontal scroll.
  8696. !#zh 是否开启水平滚动。 */
  8697. horizontal: boolean;
  8698. /** !#en Enable vertical scroll.
  8699. !#zh 是否开启垂直滚动。 */
  8700. vertical: boolean;
  8701. /** !#en When inertia is set, the content will continue to move when touch ended.
  8702. !#zh 是否开启滚动惯性。 */
  8703. inertia: boolean;
  8704. /** !#en
  8705. It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  8706. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  8707. !#zh
  8708. 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。 */
  8709. brake: number;
  8710. /** !#en When elastic is set, the content will be bounce back when move out of boundary.
  8711. !#zh 是否允许滚动内容超过边界,并在停止触摸后回弹。 */
  8712. elastic: boolean;
  8713. /** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.
  8714. !#zh 回弹持续的时间,0 表示将立即反弹。 */
  8715. bounceDuration: number;
  8716. /** !#en The horizontal scrollbar reference.
  8717. !#zh 水平滚动的 ScrollBar。 */
  8718. horizontalScrollBar: Scrollbar;
  8719. /** !#en The vertical scrollbar reference.
  8720. !#zh 垂直滚动的 ScrollBar。 */
  8721. verticalScrollBar: Scrollbar;
  8722. /** !#en Scrollview events callback
  8723. !#zh 滚动视图的事件回调函数 */
  8724. scrollEvents: Component.EventHandler[];
  8725. /** !#en If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  8726. It's set to true by default.
  8727. !#zh 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。
  8728. 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 */
  8729. cancelInnerEvents: boolean;
  8730. /**
  8731. !#en Scroll the content to the bottom boundary of ScrollView.
  8732. !#zh 视图内容将在规定时间内滚动到视图底部。
  8733. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8734. the content will jump to the bottom boundary immediately.
  8735. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8736. @example
  8737. ```js
  8738. // Scroll to the bottom of the view.
  8739. scrollView.scrollToBottom(0.1);
  8740. ```
  8741. */
  8742. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  8743. /**
  8744. !#en Scroll the content to the top boundary of ScrollView.
  8745. !#zh 视图内容将在规定时间内滚动到视图顶部。
  8746. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8747. the content will jump to the top boundary immediately.
  8748. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8749. @example
  8750. ```js
  8751. // Scroll to the top of the view.
  8752. scrollView.scrollToTop(0.1);
  8753. ```
  8754. */
  8755. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  8756. /**
  8757. !#en Scroll the content to the left boundary of ScrollView.
  8758. !#zh 视图内容将在规定时间内滚动到视图左边。
  8759. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8760. the content will jump to the left boundary immediately.
  8761. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8762. @example
  8763. ```js
  8764. // Scroll to the left of the view.
  8765. scrollView.scrollToLeft(0.1);
  8766. ```
  8767. */
  8768. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  8769. /**
  8770. !#en Scroll the content to the right boundary of ScrollView.
  8771. !#zh 视图内容将在规定时间内滚动到视图右边。
  8772. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8773. the content will jump to the right boundary immediately.
  8774. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8775. @example
  8776. ```js
  8777. // Scroll to the right of the view.
  8778. scrollView.scrollToRight(0.1);
  8779. ```
  8780. */
  8781. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  8782. /**
  8783. !#en Scroll the content to the top left boundary of ScrollView.
  8784. !#zh 视图内容将在规定时间内滚动到视图左上角。
  8785. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8786. the content will jump to the top left boundary immediately.
  8787. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8788. @example
  8789. ```js
  8790. // Scroll to the upper left corner of the view.
  8791. scrollView.scrollToTopLeft(0.1);
  8792. ```
  8793. */
  8794. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  8795. /**
  8796. !#en Scroll the content to the top right boundary of ScrollView.
  8797. !#zh 视图内容将在规定时间内滚动到视图右上角。
  8798. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8799. the content will jump to the top right boundary immediately.
  8800. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8801. @example
  8802. ```js
  8803. // Scroll to the top right corner of the view.
  8804. scrollView.scrollToTopRight(0.1);
  8805. ```
  8806. */
  8807. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  8808. /**
  8809. !#en Scroll the content to the bottom left boundary of ScrollView.
  8810. !#zh 视图内容将在规定时间内滚动到视图左下角。
  8811. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8812. the content will jump to the bottom left boundary immediately.
  8813. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8814. @example
  8815. ```js
  8816. // Scroll to the lower left corner of the view.
  8817. scrollView.scrollToBottomLeft(0.1);
  8818. ```
  8819. */
  8820. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  8821. /**
  8822. !#en Scroll the content to the bottom right boundary of ScrollView.
  8823. !#zh 视图内容将在规定时间内滚动到视图右下角。
  8824. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8825. the content will jump to the bottom right boundary immediately.
  8826. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8827. @example
  8828. ```js
  8829. // Scroll to the lower right corner of the view.
  8830. scrollView.scrollToBottomRight(0.1);
  8831. ```
  8832. */
  8833. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  8834. /**
  8835. !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the
  8836. specific offset immediately.
  8837. !#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传,则立即滚动到指定偏移位置。
  8838. @param offset A Vec2, the value of which each axis between 0 and maxScrollOffset
  8839. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8840. the content will jump to the specific offset of ScrollView immediately.
  8841. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8842. @example
  8843. ```js
  8844. // Scroll to middle position in 0.1 second in x-axis
  8845. let maxScrollOffset = this.getMaxScrollOffset();
  8846. scrollView.scrollToOffset(cc.v2(maxScrollOffset.x / 2, 0), 0.1);
  8847. ```
  8848. */
  8849. scrollToOffset(offset: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8850. /**
  8851. !#en Get the positive offset value corresponds to the content's top left boundary.
  8852. !#zh 获取滚动视图相对于左上角原点的当前滚动偏移
  8853. */
  8854. getScrollOffset(): Vec2;
  8855. /**
  8856. !#en Get the maximize available scroll offset
  8857. !#zh 获取滚动视图最大可以滚动的偏移量
  8858. */
  8859. getMaxScrollOffset(): Vec2;
  8860. /**
  8861. !#en Scroll the content to the horizontal percent position of ScrollView.
  8862. !#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  8863. @param percent A value between 0 and 1.
  8864. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8865. the content will jump to the horizontal percent position of ScrollView immediately.
  8866. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8867. @example
  8868. ```js
  8869. // Scroll to middle position.
  8870. scrollView.scrollToBottomRight(0.5, 0.1);
  8871. ```
  8872. */
  8873. scrollToPercentHorizontal(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8874. /**
  8875. !#en Scroll the content to the percent position of ScrollView in any direction.
  8876. !#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  8877. @param anchor A point which will be clamp between cc.v2(0,0) and cc.v2(1,1).
  8878. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8879. the content will jump to the percent position of ScrollView immediately.
  8880. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8881. @example
  8882. ```js
  8883. // Vertical scroll to the bottom of the view.
  8884. scrollView.scrollTo(cc.v2(0, 1), 0.1);
  8885. // Horizontal scroll to view right.
  8886. scrollView.scrollTo(cc.v2(1, 0), 0.1);
  8887. ```
  8888. */
  8889. scrollTo(anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8890. /**
  8891. !#en Scroll the content to the vertical percent position of ScrollView.
  8892. !#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  8893. @param percent A value between 0 and 1.
  8894. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8895. the content will jump to the vertical percent position of ScrollView immediately.
  8896. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8897. // Scroll to middle position.
  8898. scrollView.scrollToPercentVertical(0.5, 0.1);
  8899. */
  8900. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8901. /**
  8902. !#en Stop auto scroll immediately
  8903. !#zh 停止自动滚动, 调用此 API 可以让 Scrollview 立即停止滚动
  8904. */
  8905. stopAutoScroll(): void;
  8906. /**
  8907. !#en Modify the content position.
  8908. !#zh 设置当前视图内容的坐标点。
  8909. @param position The position in content's parent space.
  8910. */
  8911. setContentPosition(position: Vec2): void;
  8912. /**
  8913. !#en Query the content's position in its parent space.
  8914. !#zh 获取当前视图内容的坐标点。
  8915. */
  8916. getContentPosition(): Vec2;
  8917. /**
  8918. !#en Query whether the user is currently dragging the ScrollView to scroll it
  8919. !#zh 用户是否在拖拽当前滚动视图
  8920. */
  8921. isScrolling(): boolean;
  8922. /**
  8923. !#en Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  8924. !#zh 当前滚动视图是否在惯性滚动
  8925. */
  8926. isAutoScrolling(): boolean;
  8927. }
  8928. /** !#en The Slider Control
  8929. !#zh 滑动器组件 */
  8930. export class Slider extends Component {
  8931. /** !#en The "handle" part of the slider
  8932. !#zh 滑动器滑块按钮部件 */
  8933. handle: Button;
  8934. /** !#en The slider direction
  8935. !#zh 滑动器方向 */
  8936. direction: Slider.Direction;
  8937. /** !#en The current progress of the slider. The valid value is between 0-1
  8938. !#zh 当前进度值,该数值的区间是 0-1 之间 */
  8939. progress: number;
  8940. /** !#en The slider slide events' callback array
  8941. !#zh 滑动器组件滑动事件回调函数数组 */
  8942. slideEvents: Component.EventHandler[];
  8943. }
  8944. /** !#en Renders a sprite in the scene.
  8945. !#zh 该组件用于在场景中渲染精灵。 */
  8946. export class Sprite extends RenderComponent implements BlendFunc {
  8947. /** !#en The sprite frame of the sprite.
  8948. !#zh 精灵的精灵帧 */
  8949. spriteFrame: SpriteFrame;
  8950. /** !#en The sprite render type.
  8951. !#zh 精灵渲染类型 */
  8952. type: Sprite.Type;
  8953. /** !#en
  8954. The fill type, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8955. !#zh
  8956. 精灵填充类型,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8957. fillType: Sprite.FillType;
  8958. /** !#en
  8959. The fill Center, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8960. !#zh
  8961. 填充中心点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8962. fillCenter: Vec2;
  8963. /** !#en
  8964. The fill Start, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8965. !#zh
  8966. 填充起始点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8967. fillStart: number;
  8968. /** !#en
  8969. The fill Range, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8970. !#zh
  8971. 填充范围,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8972. fillRange: number;
  8973. /** !#en specify the frame is trimmed or not.
  8974. !#zh 是否使用裁剪模式 */
  8975. trim: boolean;
  8976. /** !#en specify the size tracing mode.
  8977. !#zh 精灵尺寸调整模式 */
  8978. sizeMode: Sprite.SizeMode;
  8979. /**
  8980. Change the state of sprite.
  8981. @param state NORMAL or GRAY State.
  8982. */
  8983. setState(state: Sprite.State): void;
  8984. /**
  8985. Gets the current state.
  8986. */
  8987. getState(): Sprite.State;
  8988. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8989. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8990. srcBlendFactor: macro.BlendFactor;
  8991. /** !#en specify the destination Blend Factor.
  8992. !#zh 指定目标的混合模式 */
  8993. dstBlendFactor: macro.BlendFactor;
  8994. }
  8995. /** !#en The toggle component is a CheckBox, when it used together with a ToggleGroup, it
  8996. could be treated as a RadioButton.
  8997. !#zh Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。 */
  8998. export class Toggle extends Button implements GraySpriteState {
  8999. /** !#en When this value is true, the check mark component will be enabled, otherwise
  9000. the check mark component will be disabled.
  9001. !#zh 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。 */
  9002. isChecked: boolean;
  9003. /** !#en The toggle group which the toggle belongs to, when it is null, the toggle is a CheckBox.
  9004. Otherwise, the toggle is a RadioButton.
  9005. !#zh Toggle 所属的 ToggleGroup,这个属性是可选的。如果这个属性为 null,则 Toggle 是一个 CheckBox,
  9006. 否则,Toggle 是一个 RadioButton。 */
  9007. toggleGroup: ToggleGroup;
  9008. /** !#en The image used for the checkmark.
  9009. !#zh Toggle 处于选中状态时显示的图片 */
  9010. checkMark: Sprite;
  9011. /** !#en If Toggle is clicked, it will trigger event's handler
  9012. !#zh Toggle 按钮的点击事件列表。 */
  9013. checkEvents: Component.EventHandler[];
  9014. /**
  9015. !#en Make the toggle button checked.
  9016. !#zh 使 toggle 按钮处于选中状态
  9017. */
  9018. check(): void;
  9019. /**
  9020. !#en Make the toggle button unchecked.
  9021. !#zh 使 toggle 按钮处于未选中状态
  9022. */
  9023. uncheck(): void;
  9024. /** !#en The normal material.
  9025. !#zh 正常状态的材质。 */
  9026. normalMaterial: Material;
  9027. /** !#en The gray material.
  9028. !#zh 置灰状态的材质。 */
  9029. grayMaterial: Material;
  9030. }
  9031. /** !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. <br/>
  9032. Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  9033. Note: All the first layer child node containing the toggle component will auto be added to the container
  9034. !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。<br/>
  9035. 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。<br/>
  9036. 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 */
  9037. export class ToggleContainer extends Component {
  9038. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  9039. If it is false, it will make sure there is always only one toggle could be switched on
  9040. and the already switched on toggle can't be switched off.
  9041. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  9042. allowSwitchOff: boolean;
  9043. /** !#en If Toggle is clicked, it will trigger event's handler
  9044. !#zh Toggle 按钮的点击事件列表。 */
  9045. checkEvents: Component.EventHandler[];
  9046. /** !#en Read only property, return the toggle items array reference managed by ToggleContainer.
  9047. !#zh 只读属性,返回 ToggleContainer 管理的 toggle 数组引用 */
  9048. toggleItems: Toggle[];
  9049. }
  9050. /** !#en ToggleGroup is not a visiable UI component but a way to modify the behavior of a set of Toggles.
  9051. Toggles that belong to the same group could only have one of them to be switched on at a time.
  9052. !#zh ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,
  9053. 任何时候只能有一个 Toggle 处于选中状态。 */
  9054. export class ToggleGroup extends Component {
  9055. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  9056. If it is false, it will make sure there is always only one toggle could be switched on
  9057. and the already switched on toggle can't be switched off.
  9058. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  9059. allowSwitchOff: boolean;
  9060. /** !#en Read only property, return the toggle items array reference managed by toggleGroup.
  9061. !#zh 只读属性,返回 toggleGroup 管理的 toggle 数组引用 */
  9062. toggleItems: any[];
  9063. }
  9064. /** !#en
  9065. Handling touch events in a ViewGroup takes special care,
  9066. because it's common for a ViewGroup to have children that are targets for different touch events than the ViewGroup itself.
  9067. To make sure that each view correctly receives the touch events intended for it,
  9068. ViewGroup should register capture phase event and handle the event propagation properly.
  9069. Please refer to Scrollview for more information.
  9070. !#zh
  9071. ViewGroup的事件处理比较特殊,因为 ViewGroup 里面的子节点关心的事件跟 ViewGroup 本身可能不一样。
  9072. 为了让子节点能够正确地处理事件,ViewGroup 需要注册 capture 阶段的事件,并且合理地处理 ViewGroup 之间的事件传递。
  9073. 请参考 ScrollView 的实现来获取更多信息。 */
  9074. export class ViewGroup extends Component {
  9075. }
  9076. /** !#en
  9077. Stores and manipulate the anchoring based on its parent.
  9078. Widget are used for GUI but can also be used for other things.
  9079. Widget will adjust current node's position and size automatically, but the results after adjustment can not be obtained until the next frame unless you call {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}} manually.
  9080. !#zh
  9081. Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。
  9082. Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}}。 */
  9083. export class Widget extends Component {
  9084. /** !#en Specifies an alignment target that can only be one of the parent nodes of the current node.
  9085. The default value is null, and when null, indicates the current parent.
  9086. !#zh 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。 */
  9087. target: Node;
  9088. /** !#en Whether to align the top.
  9089. !#zh 是否对齐上边。 */
  9090. isAlignTop: boolean;
  9091. /** !#en
  9092. Vertically aligns the midpoint, This will open the other vertical alignment options cancel.
  9093. !#zh
  9094. 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。 */
  9095. isAlignVerticalCenter: boolean;
  9096. /** !#en Whether to align the bottom.
  9097. !#zh 是否对齐下边。 */
  9098. isAlignBottom: boolean;
  9099. /** !#en Whether to align the left.
  9100. !#zh 是否对齐左边 */
  9101. isAlignLeft: boolean;
  9102. /** !#en
  9103. Horizontal aligns the midpoint. This will open the other horizontal alignment options canceled.
  9104. !#zh
  9105. 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。 */
  9106. isAlignHorizontalCenter: boolean;
  9107. /** !#en Whether to align the right.
  9108. !#zh 是否对齐右边。 */
  9109. isAlignRight: boolean;
  9110. /** !#en
  9111. Whether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,
  9112. the width setting is invalid (read only).
  9113. !#zh
  9114. 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸,此时节点的宽度只读。 */
  9115. isStretchWidth: boolean;
  9116. /** !#en
  9117. Whether the stretched vertically, when enable the left and right alignment will be stretched vertically,
  9118. then height setting is invalid (read only)
  9119. !#zh
  9120. 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度只读。 */
  9121. isStretchHeight: boolean;
  9122. /** !#en
  9123. The margins between the top of this node and the top of parent node,
  9124. the value can be negative, Only available in 'isAlignTop' open.
  9125. !#zh
  9126. 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。 */
  9127. top: number;
  9128. /** !#en
  9129. The margins between the bottom of this node and the bottom of parent node,
  9130. the value can be negative, Only available in 'isAlignBottom' open.
  9131. !#zh
  9132. 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。 */
  9133. bottom: number;
  9134. /** !#en
  9135. The margins between the left of this node and the left of parent node,
  9136. the value can be negative, Only available in 'isAlignLeft' open.
  9137. !#zh
  9138. 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。 */
  9139. left: number;
  9140. /** !#en
  9141. The margins between the right of this node and the right of parent node,
  9142. the value can be negative, Only available in 'isAlignRight' open.
  9143. !#zh
  9144. 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。 */
  9145. right: number;
  9146. /** !#en
  9147. Horizontal aligns the midpoint offset value,
  9148. the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  9149. !#zh 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。 */
  9150. horizontalCenter: number;
  9151. /** !#en
  9152. Vertical aligns the midpoint offset value,
  9153. the value can be negative, Only available in 'isAlignVerticalCenter' open.
  9154. !#zh 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。 */
  9155. verticalCenter: number;
  9156. /** !#en If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  9157. !#zh 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  9158. isAbsoluteHorizontalCenter: boolean;
  9159. /** !#en If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  9160. !#zh 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  9161. isAbsoluteVerticalCenter: boolean;
  9162. /** !#en
  9163. If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  9164. !#zh
  9165. 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  9166. isAbsoluteTop: boolean;
  9167. /** !#en
  9168. If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  9169. !#zh
  9170. 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  9171. isAbsoluteBottom: boolean;
  9172. /** !#en
  9173. If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  9174. !#zh
  9175. 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  9176. isAbsoluteLeft: boolean;
  9177. /** !#en
  9178. If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  9179. !#zh
  9180. 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  9181. isAbsoluteRight: boolean;
  9182. /** !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  9183. !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 */
  9184. alignMode: Widget.AlignMode;
  9185. /**
  9186. !#en
  9187. Immediately perform the widget alignment. You need to manually call this method only if
  9188. you need to get the latest results after the alignment before the end of current frame.
  9189. !#zh
  9190. 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  9191. 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  9192. @example
  9193. ```js
  9194. widget.top = 10; // change top margin
  9195. cc.log(widget.node.y); // not yet changed
  9196. widget.updateAlignment();
  9197. cc.log(widget.node.y); // changed
  9198. ```
  9199. */
  9200. updateAlignment(): void;
  9201. /** !#en
  9202. When turned on, it will only be aligned once at the end of the onEnable frame,
  9203. then immediately disables the current component.
  9204. This will allow the script or animation to continue controlling the current node.
  9205. Note: It will still be aligned at the frame when onEnable is called.
  9206. !#zh
  9207. 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。
  9208. 这样便于脚本或动画继续控制当前节点。
  9209. 注意:onEnable 时所在的那一帧仍然会进行对齐。 */
  9210. isAlignOnce: boolean;
  9211. }
  9212. /** !#en SwanSubContextView is a view component which controls open data context viewport in WeChat game platform.<br/>
  9213. The component's node size decide the viewport of the sub context content in main context,
  9214. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  9215. This component provides multiple important features:<br/>
  9216. 1. Sub context could use its own resolution size and policy.<br/>
  9217. 2. Sub context could be minized to smallest size it needed.<br/>
  9218. 3. Resolution of sub context content could be increased.<br/>
  9219. 4. User touch input is transformed to the correct viewport.<br/>
  9220. 5. Texture update is handled by this component. User don't need to worry.<br/>
  9221. One important thing to be noted, whenever the node's bounding box change,
  9222. you need to manually reset the viewport of sub context using updateSubContextViewport.
  9223. !#zh SwanSubContextView 可以用来控制百度小游戏平台开放数据域在主域中的视窗的位置。<br/>
  9224. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  9225. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  9226. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  9227. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  9228. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  9229. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  9230. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  9231. 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。 */
  9232. export class SwanSubContextView extends Component {
  9233. /**
  9234. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  9235. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  9236. */
  9237. updateSubContextViewport(): void;
  9238. }
  9239. /** !#en WXSubContextView is a view component which controls open data context viewport in WeChat game platform.<br/>
  9240. The component's node size decide the viewport of the sub context content in main context,
  9241. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  9242. This component provides multiple important features:<br/>
  9243. 1. Sub context could use its own resolution size and policy.<br/>
  9244. 2. Sub context could be minized to smallest size it needed.<br/>
  9245. 3. Resolution of sub context content could be increased.<br/>
  9246. 4. User touch input is transformed to the correct viewport.<br/>
  9247. 5. Texture update is handled by this component. User don't need to worry.<br/>
  9248. One important thing to be noted, whenever the node's bounding box change,
  9249. you need to manually reset the viewport of sub context using updateSubContextViewport.
  9250. !#zh WXSubContextView 可以用来控制微信小游戏平台开放数据域在主域中的视窗的位置。<br/>
  9251. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  9252. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  9253. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  9254. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  9255. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  9256. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  9257. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  9258. 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。 */
  9259. export class WXSubContextView extends Component {
  9260. /**
  9261. !#en Reset open data context size and viewport
  9262. !#zh 重置开放数据域的尺寸和视窗
  9263. */
  9264. reset(): void;
  9265. /**
  9266. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  9267. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  9268. */
  9269. updateSubContextViewport(): void;
  9270. }
  9271. /** undefined */
  9272. export class WorldManifold {
  9273. /** !#en
  9274. world contact point (point of intersection)
  9275. !#zh
  9276. 碰撞点集合 */
  9277. points: Vec2[];
  9278. /** !#en
  9279. world vector pointing from A to B
  9280. !#zh
  9281. 世界坐标系下由 A 指向 B 的向量 */
  9282. normal: Vec2;
  9283. }
  9284. /** !#en
  9285. A manifold point is a contact point belonging to a contact manifold.
  9286. It holds details related to the geometry and dynamics of the contact points.
  9287. Note: the impulses are used for internal caching and may not
  9288. provide reliable contact forces, especially for high speed collisions.
  9289. !#zh
  9290. ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  9291. 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。 */
  9292. export class ManifoldPoint {
  9293. /** !#en
  9294. The local point usage depends on the manifold type:
  9295. -e_circles: the local center of circleB
  9296. -e_faceA: the local center of circleB or the clip point of polygonB
  9297. -e_faceB: the clip point of polygonA
  9298. !#zh
  9299. 本地坐标点的用途取决于 manifold 的类型
  9300. - e_circles: circleB 的本地中心点
  9301. - e_faceA: circleB 的本地中心点 或者是 polygonB 的截取点
  9302. - e_faceB: polygonB 的截取点 */
  9303. localPoint: Vec2;
  9304. /** !#en
  9305. Normal impulse.
  9306. !#zh
  9307. 法线冲量。 */
  9308. normalImpulse: number;
  9309. /** !#en
  9310. Tangent impulse.
  9311. !#zh
  9312. 切线冲量。 */
  9313. tangentImpulse: number;
  9314. }
  9315. /** undefined */
  9316. export class Manifold {
  9317. /** !#en
  9318. Manifold type : 0: e_circles, 1: e_faceA, 2: e_faceB
  9319. !#zh
  9320. Manifold 类型 : 0: e_circles, 1: e_faceA, 2: e_faceB */
  9321. type: number;
  9322. /** !#en
  9323. The local point usage depends on the manifold type:
  9324. -e_circles: the local center of circleA
  9325. -e_faceA: the center of faceA
  9326. -e_faceB: the center of faceB
  9327. !#zh
  9328. 用途取决于 manifold 类型
  9329. -e_circles: circleA 的本地中心点
  9330. -e_faceA: faceA 的本地中心点
  9331. -e_faceB: faceB 的本地中心点 */
  9332. localPoint: Vec2;
  9333. /** !#en
  9334. -e_circles: not used
  9335. -e_faceA: the normal on polygonA
  9336. -e_faceB: the normal on polygonB
  9337. !#zh
  9338. -e_circles: 没被使用到
  9339. -e_faceA: polygonA 的法向量
  9340. -e_faceB: polygonB 的法向量 */
  9341. localNormal: Vec2;
  9342. /** !#en
  9343. the points of contact.
  9344. !#zh
  9345. 接触点信息。 */
  9346. points: ManifoldPoint[];
  9347. }
  9348. /** !#en
  9349. Contact impulses for reporting.
  9350. !#zh
  9351. 用于返回给回调的接触冲量。 */
  9352. export class PhysicsImpulse {
  9353. /** !#en
  9354. Normal impulses.
  9355. !#zh
  9356. 法线方向的冲量 */
  9357. normalImpulses: any;
  9358. /** !#en
  9359. Tangent impulses
  9360. !#zh
  9361. 切线方向的冲量 */
  9362. tangentImpulses: any;
  9363. }
  9364. /** !#en
  9365. PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  9366. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  9367. !#zh
  9368. 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  9369. 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。 */
  9370. export class PhysicsContact {
  9371. /**
  9372. !#en
  9373. Get the world manifold.
  9374. !#zh
  9375. 获取世界坐标系下的碰撞信息。
  9376. */
  9377. getWorldManifold(): WorldManifold;
  9378. /**
  9379. !#en
  9380. Get the manifold.
  9381. !#zh
  9382. 获取本地(局部)坐标系下的碰撞信息。
  9383. */
  9384. getManifold(): Manifold;
  9385. /**
  9386. !#en
  9387. Get the impulses.
  9388. Note: PhysicsImpulse can only used in onPostSolve callback.
  9389. !#zh
  9390. 获取冲量信息
  9391. 注意:这个信息只有在 onPostSolve 回调中才能获取到
  9392. */
  9393. getImpulse(): PhysicsImpulse;
  9394. colliderA: Collider;
  9395. colliderB: Collider;
  9396. /** !#en
  9397. If set disabled to true, the contact will be ignored until contact end.
  9398. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  9399. !#zh
  9400. 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  9401. 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。 */
  9402. disabled: boolean;
  9403. /** !#en
  9404. Disabled contact for current time step or sub-step.
  9405. !#zh
  9406. 在当前时间步或子步中忽略此接触。 */
  9407. disabledOnce: boolean;
  9408. /**
  9409. !#en
  9410. Is this contact touching?
  9411. !#zh
  9412. 返回碰撞体是否已经接触到。
  9413. */
  9414. isTouching(): boolean;
  9415. /**
  9416. !#en
  9417. Set the desired tangent speed for a conveyor belt behavior.
  9418. !#zh
  9419. 为传送带设置期望的切线速度
  9420. @param tangentSpeed tangentSpeed
  9421. */
  9422. setTangentSpeed(tangentSpeed: number): void;
  9423. /**
  9424. !#en
  9425. Get the desired tangent speed.
  9426. !#zh
  9427. 获取切线速度
  9428. */
  9429. getTangentSpeed(): number;
  9430. /**
  9431. !#en
  9432. Override the default friction mixture. You can call this in onPreSolve callback.
  9433. !#zh
  9434. 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  9435. @param friction friction
  9436. */
  9437. setFriction(friction: number): void;
  9438. /**
  9439. !#en
  9440. Get the friction.
  9441. !#zh
  9442. 获取当前摩擦力系数
  9443. */
  9444. getFriction(): number;
  9445. /**
  9446. !#en
  9447. Reset the friction mixture to the default value.
  9448. !#zh
  9449. 重置摩擦力系数到默认值
  9450. */
  9451. resetFriction(): void;
  9452. /**
  9453. !#en
  9454. Override the default restitution mixture. You can call this in onPreSolve callback.
  9455. !#zh
  9456. 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  9457. @param restitution restitution
  9458. */
  9459. setRestitution(restitution: number): void;
  9460. /**
  9461. !#en
  9462. Get the restitution.
  9463. !#zh
  9464. 获取当前恢复系数
  9465. */
  9466. getRestitution(): number;
  9467. /**
  9468. !#en
  9469. Reset the restitution mixture to the default value.
  9470. !#zh
  9471. 重置恢复系数到默认值
  9472. */
  9473. resetRestitution(): void;
  9474. }
  9475. /** !#en
  9476. Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node).
  9477. You can visit some common box2d function through physics manager(hit testing, raycast, debug info).
  9478. Physics manager distributes the collision information to each collision callback when collision is produced.
  9479. Note: You need first enable the collision listener in the rigidbody.
  9480. !#zh
  9481. 物理系统将 box2d 作为内部物理系统,并且隐藏了大部分 box2d 实现细节(比如创建刚体,同步刚体信息到节点中等)。
  9482. 你可以通过物理系统访问一些 box2d 常用的功能,比如点击测试,射线测试,设置测试信息等。
  9483. 物理系统还管理碰撞信息的分发,她会在产生碰撞时,将碰撞信息分发到各个碰撞回调中。
  9484. 注意:你需要先在刚体中开启碰撞接听才会产生相应的碰撞回调。<br>
  9485. 支持的物理系统指定绘制信息事件,请参阅 {{#crossLink "PhysicsManager.DrawBits"}}{{/crossLink}} */
  9486. export class PhysicsManager implements EventTarget {
  9487. /** !#en
  9488. The ratio transform between physics unit and pixel unit, generally is 32.
  9489. !#zh
  9490. 物理单位与像素单位互相转换的比率,一般是 32。 */
  9491. static PTM_RATIO: number;
  9492. /** !#en
  9493. The velocity iterations for the velocity constraint solver.
  9494. !#zh
  9495. 速度更新迭代数 */
  9496. static VELOCITY_ITERATIONS: number;
  9497. /** !#en
  9498. The position Iterations for the position constraint solver.
  9499. !#zh
  9500. 位置迭代更新数 */
  9501. static POSITION_ITERATIONS: number;
  9502. /** !#en
  9503. Specify the fixed time step.
  9504. Need enabledAccumulator to make it work.
  9505. !#zh
  9506. 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 */
  9507. static FIXED_TIME_STEP: number;
  9508. /** !#en
  9509. Specify the max accumulator time.
  9510. Need enabledAccumulator to make it work.
  9511. !#zh
  9512. 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 */
  9513. static MAX_ACCUMULATOR: number;
  9514. /** !#en
  9515. If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP.
  9516. And if the update dt is bigger than the time step, then will call step function several times.
  9517. If disabled accumulator, then will call step function with a time step calculated with the frame rate.
  9518. !#zh
  9519. 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。
  9520. 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 */
  9521. enabledAccumulator: boolean;
  9522. /**
  9523. !#en
  9524. Test which collider contains the given world point
  9525. !#zh
  9526. 获取包含给定世界坐标系点的碰撞体
  9527. @param point the world point
  9528. */
  9529. testPoint(point: Vec2): PhysicsCollider;
  9530. /**
  9531. !#en
  9532. Test which colliders intersect the given world rect
  9533. !#zh
  9534. 获取与给定世界坐标系矩形相交的碰撞体
  9535. @param rect the world rect
  9536. */
  9537. testAABB(rect: Rect): PhysicsCollider[];
  9538. /**
  9539. !#en
  9540. Raycast the world for all colliders in the path of the ray.
  9541. The raycast ignores colliders that contain the starting point.
  9542. !#zh
  9543. 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  9544. @param p1 start point of the raycast
  9545. @param p2 end point of the raycast
  9546. @param type optional, default is RayCastType.Closest
  9547. */
  9548. rayCast(p1: Vec2, p2: Vec2, type: RayCastType): PhysicsRayCastResult[];
  9549. /** !#en
  9550. Enabled the physics manager?
  9551. !#zh
  9552. 指定是否启用物理系统? */
  9553. enabled: boolean;
  9554. /** !#en
  9555. Debug draw flags.
  9556. !#zh
  9557. 设置调试绘制标志 */
  9558. debugDrawFlags: number;
  9559. /** !#en
  9560. The physics world gravity.
  9561. !#zh
  9562. 物理世界重力值 */
  9563. gravity: Vec2;
  9564. /**
  9565. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  9566. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  9567. @param type The type of event.
  9568. */
  9569. hasEventListener(type: string): boolean;
  9570. /**
  9571. !#en
  9572. Register an callback of a specific event type on the EventTarget.
  9573. This type of event should be triggered via `emit`.
  9574. !#zh
  9575. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  9576. @param type A string representing the event type to listen for.
  9577. @param callback The callback that will be invoked when the event is dispatched.
  9578. The callback is ignored if it is a duplicate (the callbacks are unique).
  9579. @param target The target (this object) to invoke the callback, can be null
  9580. @example
  9581. ```js
  9582. eventTarget.on('fire', function () {
  9583. cc.log("fire in the hole");
  9584. }, node);
  9585. ```
  9586. */
  9587. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  9588. /**
  9589. !#en
  9590. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  9591. if only type is passed as parameter, all listeners registered with that type will be removed.
  9592. !#zh
  9593. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  9594. @param type A string representing the event type being removed.
  9595. @param callback The callback to remove.
  9596. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  9597. @example
  9598. ```js
  9599. // register fire eventListener
  9600. var callback = eventTarget.on('fire', function () {
  9601. cc.log("fire in the hole");
  9602. }, target);
  9603. // remove fire event listener
  9604. eventTarget.off('fire', callback, target);
  9605. // remove all fire event listeners
  9606. eventTarget.off('fire');
  9607. ```
  9608. */
  9609. off(type: string, callback?: Function, target?: any): void;
  9610. /**
  9611. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  9612. This is not for removing all listeners in the current event target,
  9613. and this is not for removing all listeners the target parameter have registered.
  9614. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  9615. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  9616. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  9617. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  9618. @param target The target to be searched for all related listeners
  9619. */
  9620. targetOff(target: any): void;
  9621. /**
  9622. !#en
  9623. Register an callback of a specific event type on the EventTarget,
  9624. the callback will remove itself after the first time it is triggered.
  9625. !#zh
  9626. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  9627. @param type A string representing the event type to listen for.
  9628. @param callback The callback that will be invoked when the event is dispatched.
  9629. The callback is ignored if it is a duplicate (the callbacks are unique).
  9630. @param target The target (this object) to invoke the callback, can be null
  9631. @example
  9632. ```js
  9633. eventTarget.once('fire', function () {
  9634. cc.log("this is the callback and will be invoked only once");
  9635. }, node);
  9636. ```
  9637. */
  9638. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  9639. /**
  9640. !#en
  9641. Send an event with the event object.
  9642. !#zh
  9643. 通过事件对象派发事件
  9644. @param event event
  9645. */
  9646. dispatchEvent(event: Event): void;
  9647. }
  9648. /** undefined */
  9649. export class PhysicsRayCastResult {
  9650. /** !#en
  9651. The PhysicsCollider which intersects with the raycast
  9652. !#zh
  9653. 与射线相交的碰撞体 */
  9654. collider: PhysicsCollider;
  9655. /** !#en
  9656. The intersection point
  9657. !#zh
  9658. 射线与碰撞体相交的点 */
  9659. point: Vec2;
  9660. /** !#en
  9661. The normal vector at the point of intersection
  9662. !#zh
  9663. 射线与碰撞体相交的点的法向量 */
  9664. normal: Vec2;
  9665. /** !#en
  9666. The fraction of the raycast path at the point of intersection
  9667. !#zh
  9668. 射线与碰撞体相交的点占射线长度的分数 */
  9669. fraction: number;
  9670. }
  9671. /** !#en Enum for RigidBodyType.
  9672. !#zh 刚体类型 */
  9673. export enum RigidBodyType {
  9674. Static = 0,
  9675. Kinematic = 0,
  9676. Dynamic = 0,
  9677. Animated = 0,
  9678. }
  9679. /** !#en Enum for RayCastType.
  9680. !#zh 射线检测类型 */
  9681. export enum RayCastType {
  9682. Closest = 0,
  9683. Any = 0,
  9684. AllClosest = 0,
  9685. All = 0,
  9686. }
  9687. /** undefined */
  9688. export class RigidBody extends Component {
  9689. /** !#en
  9690. Should enabled contact listener?
  9691. When a collision is trigger, the collision callback will only be called when enabled contact listener.
  9692. !#zh
  9693. 是否启用接触接听器。
  9694. 当 collider 产生碰撞时,只有开启了接触接听器才会调用相应的回调函数 */
  9695. enabledContactListener: boolean;
  9696. /**
  9697. !#en
  9698. Collision callback.
  9699. Called when two collider begin to touch.
  9700. !#zh
  9701. 碰撞回调。
  9702. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体开始接触时被调用。
  9703. @param contact contact information
  9704. @param selfCollider the collider belong to this rigidbody
  9705. @param otherCollider the collider belong to another rigidbody
  9706. */
  9707. onBeginContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9708. /**
  9709. !#en
  9710. Collision callback.
  9711. Called when two collider cease to touch.
  9712. !#zh
  9713. 碰撞回调。
  9714. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体停止接触时被调用。
  9715. @param contact contact information
  9716. @param selfCollider the collider belong to this rigidbody
  9717. @param otherCollider the collider belong to another rigidbody
  9718. */
  9719. onEndContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9720. /**
  9721. !#en
  9722. Collision callback.
  9723. This is called when a contact is updated.
  9724. This allows you to inspect a contact before it goes to the solver(e.g. disable contact).
  9725. Note: this is called only for awake bodies.
  9726. Note: this is called even when the number of contact points is zero.
  9727. Note: this is not called for sensors.
  9728. !#zh
  9729. 碰撞回调。
  9730. 如果你的脚本中实现了这个函数,那么它将会在接触更新时被调用。
  9731. 你可以在接触被处理前根据他包含的信息作出相应的处理,比如将这个接触禁用掉。
  9732. 注意:回调只会为醒着的刚体调用。
  9733. 注意:接触点为零的时候也有可能被调用。
  9734. 注意:感知体(sensor)的回调不会被调用。
  9735. @param contact contact information
  9736. @param selfCollider the collider belong to this rigidbody
  9737. @param otherCollider the collider belong to another rigidbody
  9738. */
  9739. onPreSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9740. /**
  9741. !#en
  9742. Collision callback.
  9743. This is called after a contact is updated.
  9744. You can get the impulses from the contact in this callback.
  9745. !#zh
  9746. 碰撞回调。
  9747. 如果你的脚本中实现了这个函数,那么它将会在接触更新完后被调用。
  9748. 你可以在这个回调中从接触信息中获取到冲量信息。
  9749. @param contact contact information
  9750. @param selfCollider the collider belong to this rigidbody
  9751. @param otherCollider the collider belong to another rigidbody
  9752. */
  9753. onPostSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9754. /** !#en
  9755. Is this a fast moving body that should be prevented from tunneling through
  9756. other moving bodies?
  9757. Note :
  9758. - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  9759. - You should use this flag sparingly since it increases processing time.
  9760. !#zh
  9761. 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  9762. 需要注意的是 :
  9763. - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  9764. - 应该尽量少的使用此选项,因为它会增加程序处理时间。 */
  9765. bullet: boolean;
  9766. /** !#en
  9767. Rigidbody type : Static, Kinematic, Dynamic or Animated.
  9768. !#zh
  9769. 刚体类型: Static, Kinematic, Dynamic or Animated. */
  9770. type: RigidBodyType;
  9771. /** !#en
  9772. Set this flag to false if this body should never fall asleep.
  9773. Note that this increases CPU usage.
  9774. !#zh
  9775. 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  9776. 需要注意这将使 CPU 占用率提高。 */
  9777. allowSleep: boolean;
  9778. /** !#en
  9779. Scale the gravity applied to this body.
  9780. !#zh
  9781. 缩放应用在此刚体上的重力值 */
  9782. gravityScale: number;
  9783. /** !#en
  9784. Linear damping is use to reduce the linear velocity.
  9785. The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  9786. time step when the damping parameter is large.
  9787. !#zh
  9788. Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9789. linearDamping: number;
  9790. /** !#en
  9791. Angular damping is use to reduce the angular velocity. The damping parameter
  9792. can be larger than 1 but the damping effect becomes sensitive to the
  9793. time step when the damping parameter is large.
  9794. !#zh
  9795. Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9796. angularDamping: number;
  9797. /** !#en
  9798. The linear velocity of the body's origin in world co-ordinates.
  9799. !#zh
  9800. 刚体在世界坐标下的线性速度 */
  9801. linearVelocity: Vec2;
  9802. /** !#en
  9803. The angular velocity of the body.
  9804. !#zh
  9805. 刚体的角速度 */
  9806. angularVelocity: number;
  9807. /** !#en
  9808. Should this body be prevented from rotating?
  9809. !#zh
  9810. 是否禁止此刚体进行旋转 */
  9811. fixedRotation: boolean;
  9812. /** !#en
  9813. Set the sleep state of the body. A sleeping body has very low CPU cost.(When the rigid body is hit, if the rigid body is in sleep state, it will be immediately awakened.)
  9814. !#zh
  9815. 设置刚体的睡眠状态。 睡眠的刚体具有非常低的 CPU 成本。(当刚体被碰撞到时,如果刚体处于睡眠状态,它会立即被唤醒) */
  9816. awake: boolean;
  9817. /** !#en
  9818. Whether to wake up this rigid body during initialization
  9819. !#zh
  9820. 是否在初始化时唤醒此刚体 */
  9821. awakeOnLoad: boolean;
  9822. /** !#en
  9823. Set the active state of the body. An inactive body is not
  9824. simulated and cannot be collided with or woken up.
  9825. If body is active, all fixtures will be added to the
  9826. broad-phase.
  9827. If body is inactive, all fixtures will be removed from
  9828. the broad-phase and all contacts will be destroyed.
  9829. Fixtures on an inactive body are implicitly inactive and will
  9830. not participate in collisions, ray-casts, or queries.
  9831. Joints connected to an inactive body are implicitly inactive.
  9832. !#zh
  9833. 设置刚体的激活状态。一个非激活状态下的刚体是不会被模拟和碰撞的,不管它是否处于睡眠状态下。
  9834. 如果刚体处于激活状态下,所有夹具会被添加到 粗测阶段(broad-phase)。
  9835. 如果刚体处于非激活状态下,所有夹具会被从 粗测阶段(broad-phase)中移除。
  9836. 在非激活状态下的夹具不会参与到碰撞,射线,或者查找中
  9837. 链接到非激活状态下刚体的关节也是非激活的。 */
  9838. active: boolean;
  9839. /**
  9840. !#en
  9841. Gets a local point relative to the body's origin given a world point.
  9842. !#zh
  9843. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  9844. @param worldPoint a point in world coordinates.
  9845. @param out optional, the receiving point
  9846. */
  9847. getLocalPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9848. /**
  9849. !#en
  9850. Get the world coordinates of a point given the local coordinates.
  9851. !#zh
  9852. 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点
  9853. @param localPoint a point in local coordinates.
  9854. @param out optional, the receiving point
  9855. */
  9856. getWorldPoint(localPoint: Vec2, out: Vec2): Vec2;
  9857. /**
  9858. !#en
  9859. Get the world coordinates of a vector given the local coordinates.
  9860. !#zh
  9861. 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量
  9862. @param localVector a vector in world coordinates.
  9863. @param out optional, the receiving vector
  9864. */
  9865. getWorldVector(localVector: Vec2, out: Vec2): Vec2;
  9866. /**
  9867. !#en
  9868. Gets a local vector relative to the body's origin given a world vector.
  9869. !#zh
  9870. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  9871. @param worldVector a vector in world coordinates.
  9872. @param out optional, the receiving vector
  9873. */
  9874. getLocalVector(worldVector: Vec2, out: Vec2): Vec2;
  9875. /**
  9876. !#en
  9877. Get the world body origin position.
  9878. !#zh
  9879. 获取刚体世界坐标系下的原点值
  9880. @param out optional, the receiving point
  9881. */
  9882. getWorldPosition(out: Vec2): Vec2;
  9883. /**
  9884. !#en
  9885. Get the world body rotation angle.
  9886. !#zh
  9887. 获取刚体世界坐标系下的旋转值。
  9888. */
  9889. getWorldRotation(): number;
  9890. /**
  9891. !#en
  9892. Get the local position of the center of mass.
  9893. !#zh
  9894. 获取刚体本地坐标系下的质心
  9895. */
  9896. getLocalCenter(): Vec2;
  9897. /**
  9898. !#en
  9899. Get the world position of the center of mass.
  9900. !#zh
  9901. 获取刚体世界坐标系下的质心
  9902. */
  9903. getWorldCenter(): Vec2;
  9904. /**
  9905. !#en
  9906. Get the world linear velocity of a world point attached to this body.
  9907. !#zh
  9908. 获取刚体上指定点的线性速度
  9909. @param worldPoint a point in world coordinates.
  9910. @param out optional, the receiving point
  9911. */
  9912. getLinearVelocityFromWorldPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9913. /**
  9914. !#en
  9915. Get total mass of the body.
  9916. !#zh
  9917. 获取刚体的质量。
  9918. */
  9919. getMass(): number;
  9920. /**
  9921. !#en
  9922. Get the rotational inertia of the body about the local origin.
  9923. !#zh
  9924. 获取刚体本地坐标系下原点的旋转惯性
  9925. */
  9926. getInertia(): number;
  9927. /**
  9928. !#en
  9929. Get all the joints connect to the rigidbody.
  9930. !#zh
  9931. 获取链接到此刚体的所有关节
  9932. */
  9933. getJointList(): Joint[];
  9934. /**
  9935. !#en
  9936. Apply a force at a world point. If the force is not
  9937. applied at the center of mass, it will generate a torque and
  9938. affect the angular velocity.
  9939. !#zh
  9940. 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  9941. @param force the world force vector.
  9942. @param point the world position.
  9943. @param wake also wake up the body.
  9944. */
  9945. applyForce(force: Vec2, point: Vec2, wake: boolean): void;
  9946. /**
  9947. !#en
  9948. Apply a force to the center of mass.
  9949. !#zh
  9950. 施加一个力到刚体上的质心上。
  9951. @param force the world force vector.
  9952. @param wake also wake up the body.
  9953. */
  9954. applyForceToCenter(force: Vec2, wake: boolean): void;
  9955. /**
  9956. !#en
  9957. Apply a torque. This affects the angular velocity.
  9958. !#zh
  9959. 施加一个扭矩力,将影响刚体的角速度
  9960. @param torque about the z-axis (out of the screen), usually in N-m.
  9961. @param wake also wake up the body
  9962. */
  9963. applyTorque(torque: number, wake: boolean): void;
  9964. /**
  9965. !#en
  9966. Apply a impulse at a world point, This immediately modifies the velocity.
  9967. If the impulse is not applied at the center of mass, it will generate a torque and
  9968. affect the angular velocity.
  9969. !#zh
  9970. 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  9971. 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  9972. @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
  9973. @param point the world position
  9974. @param wake alse wake up the body
  9975. */
  9976. applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
  9977. /**
  9978. !#en
  9979. Apply an angular impulse.
  9980. !#zh
  9981. 施加一个角速度冲量。
  9982. @param impulse the angular impulse in units of kg*m*m/s
  9983. @param wake also wake up the body
  9984. */
  9985. applyAngularImpulse(impulse: number, wake: boolean): void;
  9986. /**
  9987. !#en
  9988. Synchronize node's world position to box2d rigidbody's position.
  9989. If enableAnimated is true and rigidbody's type is Animated type,
  9990. will set linear velocity instead of directly set rigidbody's position.
  9991. !#zh
  9992. 同步节点的世界坐标到 box2d 刚体的坐标上。
  9993. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的线性速度来代替直接设置刚体的位置。
  9994. @param enableAnimated enableAnimated
  9995. */
  9996. syncPosition(enableAnimated: boolean): void;
  9997. /**
  9998. !#en
  9999. Synchronize node's world angle to box2d rigidbody's angle.
  10000. If enableAnimated is true and rigidbody's type is Animated type,
  10001. will set angular velocity instead of directly set rigidbody's angle.
  10002. !#zh
  10003. 同步节点的世界旋转角度值到 box2d 刚体的旋转值上。
  10004. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的角速度来代替直接设置刚体的角度。
  10005. @param enableAnimated enableAnimated
  10006. */
  10007. syncRotation(enableAnimated: boolean): void;
  10008. }
  10009. /** !#en Mesh Asset.
  10010. !#zh 网格资源。 */
  10011. export class Mesh extends Asset implements EventTarget {
  10012. /** !#en Get ir set the sub meshes.
  10013. !#zh 设置或者获取子网格。 */
  10014. subMeshes: InputAssembler[];
  10015. /**
  10016. !#en
  10017. Init vertex buffer according to the vertex format.
  10018. !#zh
  10019. 根据顶点格式初始化顶点内存。
  10020. @param vertexFormat vertex format
  10021. @param vertexCount how much vertex should be create in this buffer.
  10022. @param dynamic whether or not to use dynamic buffer.
  10023. @param index index
  10024. */
  10025. init(vertexFormat: gfx.VertexFormat, vertexCount: number, dynamic?: boolean, index?: boolean): void;
  10026. /**
  10027. !#en
  10028. Set the vertex values.
  10029. !#zh
  10030. 设置顶点数据
  10031. @param name the attribute name, e.g. gfx.ATTR_POSITION
  10032. @param values the vertex values
  10033. */
  10034. setVertices(name: string, values: Vec2[]|Vec3[]|Color[]|number[]|Uint8Array|Float32Array): void;
  10035. /**
  10036. !#en
  10037. Set the sub mesh indices.
  10038. !#zh
  10039. 设置子网格索引。
  10040. @param indices the sub mesh indices.
  10041. @param index sub mesh index.
  10042. @param dynamic whether or not to use dynamic buffer.
  10043. */
  10044. setIndices(indices: number[]|Uint16Array|Uint8Array, index?: number, dynamic?: boolean): void;
  10045. /**
  10046. !#en
  10047. Set the sub mesh primitive type.
  10048. !#zh
  10049. 设置子网格绘制线条的方式。
  10050. @param type type
  10051. @param index index
  10052. */
  10053. setPrimitiveType(type: number, index: number): void;
  10054. /**
  10055. !#en
  10056. Clear the buffer data.
  10057. !#zh
  10058. 清除网格创建的内存数据。
  10059. */
  10060. clear(): void;
  10061. /**
  10062. !#en Set mesh bounding box
  10063. !#zh 设置网格的包围盒
  10064. @param min min
  10065. @param max max
  10066. */
  10067. setBoundingBox(min: Vec3, max: Vec3): void;
  10068. /**
  10069. !#en Read the specified attributes of the subgrid into the target buffer.
  10070. !#zh 读取子网格的指定属性到目标缓冲区中。
  10071. @param primitiveIndex The subgrid index.
  10072. @param attributeName attribute name.
  10073. @param buffer The target buffer.
  10074. @param stride The byte interval between adjacent attributes in the target buffer.
  10075. @param offset The offset of the first attribute in the target buffer.
  10076. */
  10077. copyAttribute(primitiveIndex: number, attributeName: string, buffer: ArrayBuffer, stride: number, offset: number): boolean;
  10078. /**
  10079. !#en Read the index data of the subgrid into the target array.
  10080. !#zh 读取子网格的索引数据到目标数组中。
  10081. @param primitiveIndex The subgrid index.
  10082. @param outputArray The target array.
  10083. */
  10084. copyIndices(primitiveIndex: number, outputArray: DataView): boolean;
  10085. /**
  10086. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  10087. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  10088. @param type The type of event.
  10089. */
  10090. hasEventListener(type: string): boolean;
  10091. /**
  10092. !#en
  10093. Register an callback of a specific event type on the EventTarget.
  10094. This type of event should be triggered via `emit`.
  10095. !#zh
  10096. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  10097. @param type A string representing the event type to listen for.
  10098. @param callback The callback that will be invoked when the event is dispatched.
  10099. The callback is ignored if it is a duplicate (the callbacks are unique).
  10100. @param target The target (this object) to invoke the callback, can be null
  10101. @example
  10102. ```js
  10103. eventTarget.on('fire', function () {
  10104. cc.log("fire in the hole");
  10105. }, node);
  10106. ```
  10107. */
  10108. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  10109. /**
  10110. !#en
  10111. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  10112. if only type is passed as parameter, all listeners registered with that type will be removed.
  10113. !#zh
  10114. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  10115. @param type A string representing the event type being removed.
  10116. @param callback The callback to remove.
  10117. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  10118. @example
  10119. ```js
  10120. // register fire eventListener
  10121. var callback = eventTarget.on('fire', function () {
  10122. cc.log("fire in the hole");
  10123. }, target);
  10124. // remove fire event listener
  10125. eventTarget.off('fire', callback, target);
  10126. // remove all fire event listeners
  10127. eventTarget.off('fire');
  10128. ```
  10129. */
  10130. off(type: string, callback?: Function, target?: any): void;
  10131. /**
  10132. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  10133. This is not for removing all listeners in the current event target,
  10134. and this is not for removing all listeners the target parameter have registered.
  10135. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  10136. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  10137. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  10138. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  10139. @param target The target to be searched for all related listeners
  10140. */
  10141. targetOff(target: any): void;
  10142. /**
  10143. !#en
  10144. Register an callback of a specific event type on the EventTarget,
  10145. the callback will remove itself after the first time it is triggered.
  10146. !#zh
  10147. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  10148. @param type A string representing the event type to listen for.
  10149. @param callback The callback that will be invoked when the event is dispatched.
  10150. The callback is ignored if it is a duplicate (the callbacks are unique).
  10151. @param target The target (this object) to invoke the callback, can be null
  10152. @example
  10153. ```js
  10154. eventTarget.once('fire', function () {
  10155. cc.log("this is the callback and will be invoked only once");
  10156. }, node);
  10157. ```
  10158. */
  10159. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  10160. /**
  10161. !#en
  10162. Send an event with the event object.
  10163. !#zh
  10164. 通过事件对象派发事件
  10165. @param event event
  10166. */
  10167. dispatchEvent(event: Event): void;
  10168. }
  10169. /** !#en
  10170. Mesh Renderer Component
  10171. !#zh
  10172. 网格渲染组件 */
  10173. export class MeshRenderer extends RenderComponent {
  10174. /** !#en
  10175. The mesh which the renderer uses.
  10176. !#zh
  10177. 设置使用的网格 */
  10178. mesh: Mesh;
  10179. /** !#en
  10180. Whether the mesh should receive shadows.
  10181. !#zh
  10182. 网格是否接受光源投射的阴影 */
  10183. receiveShadows: boolean;
  10184. /** !#en
  10185. Shadow Casting Mode
  10186. !#zh
  10187. 网格投射阴影的模式 */
  10188. shadowCastingMode: MeshRenderer.ShadowCastingMode;
  10189. /** !#en
  10190. Enable auto merge mesh, only support when mesh's VertexFormat, PrimitiveType, materials are all the same
  10191. !#zh
  10192. 开启自动合并 mesh 功能,只有在网格的 顶点格式,PrimitiveType, 使用的材质 都一致的情况下才会有效 */
  10193. enableAutoBatch: boolean;
  10194. }
  10195. /** !#en The module provides utilities for working with file and directory paths
  10196. !#zh 用于处理文件与目录的路径的模块 */
  10197. export class path {
  10198. /**
  10199. !#en Join strings to be a path.
  10200. !#zh 拼接字符串为 Path
  10201. @example
  10202. ```js
  10203. ------------------------------
  10204. cc.path.join("a", "b.png"); //-->"a/b.png"
  10205. cc.path.join("a", "b", "c.png"); //-->"a/b/c.png"
  10206. cc.path.join("a", "b"); //-->"a/b"
  10207. cc.path.join("a", "b", "/"); //-->"a/b/"
  10208. cc.path.join("a", "b/", "/"); //-->"a/b/"
  10209. ```
  10210. */
  10211. static join(): string;
  10212. /**
  10213. !#en Get the ext name of a path including '.', like '.png'.
  10214. !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  10215. @param pathStr pathStr
  10216. @example
  10217. ```js
  10218. ---------------------------
  10219. cc.path.extname("a/b.png"); //-->".png"
  10220. cc.path.extname("a/b.png?a=1&b=2"); //-->".png"
  10221. cc.path.extname("a/b"); //-->null
  10222. cc.path.extname("a/b?a=1&b=2"); //-->null
  10223. ```
  10224. */
  10225. static extname(pathStr: string): any;
  10226. /**
  10227. !#en Get the main name of a file name
  10228. !#zh 获取文件名的主名称
  10229. @param fileName fileName
  10230. */
  10231. static mainFileName(fileName: string): string;
  10232. /**
  10233. !#en Get the file name of a file path.
  10234. !#zh 获取文件路径的文件名。
  10235. @param pathStr pathStr
  10236. @param extname extname
  10237. @example
  10238. ```js
  10239. ---------------------------------
  10240. cc.path.basename("a/b.png"); //-->"b.png"
  10241. cc.path.basename("a/b.png?a=1&b=2"); //-->"b.png"
  10242. cc.path.basename("a/b.png", ".png"); //-->"b"
  10243. cc.path.basename("a/b.png?a=1&b=2", ".png"); //-->"b"
  10244. cc.path.basename("a/b.png", ".txt"); //-->"b.png"
  10245. ```
  10246. */
  10247. static basename(pathStr: string, extname?: string): any;
  10248. /**
  10249. !#en Get dirname of a file path.
  10250. !#zh 获取文件路径的目录名。
  10251. @param pathStr pathStr
  10252. @example
  10253. ```js
  10254. ---------------------------------
  10255. * unix
  10256. cc.path.driname("a/b/c.png"); //-->"a/b"
  10257. cc.path.driname("a/b/c.png?a=1&b=2"); //-->"a/b"
  10258. cc.path.dirname("a/b/"); //-->"a/b"
  10259. cc.path.dirname("c.png"); //-->""
  10260. * windows
  10261. cc.path.driname("a\\b\\c.png"); //-->"a\b"
  10262. cc.path.driname("a\\b\\c.png?a=1&b=2"); //-->"a\b"
  10263. ```
  10264. */
  10265. static dirname(pathStr: string): any;
  10266. /**
  10267. !#en Change extname of a file path.
  10268. !#zh 更改文件路径的扩展名。
  10269. @param pathStr pathStr
  10270. @param extname extname
  10271. @example
  10272. ```js
  10273. ---------------------------------
  10274. cc.path.changeExtname("a/b.png", ".plist"); //-->"a/b.plist"
  10275. cc.path.changeExtname("a/b.png?a=1&b=2", ".plist"); //-->"a/b.plist?a=1&b=2"
  10276. ```
  10277. */
  10278. static changeExtname(pathStr: string, extname?: string): string;
  10279. }
  10280. /** !#en
  10281. AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>
  10282. !#zh
  10283. AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转,缩放转变所组成。<br/> */
  10284. export class AffineTransform {
  10285. /**
  10286. !#en Create a AffineTransform object with all contents in the matrix.
  10287. !#zh 用在矩阵中的所有内容创建一个 AffineTransform 对象。
  10288. @param a a
  10289. @param b b
  10290. @param c c
  10291. @param d d
  10292. @param tx tx
  10293. @param ty ty
  10294. */
  10295. static create(a: number, b: number, c: number, d: number, tx: number, ty: number): AffineTransform;
  10296. /**
  10297. !#en
  10298. Create a identity transformation matrix: <br/>
  10299. [ 1, 0, 0, <br/>
  10300. 0, 1, 0 ]
  10301. !#zh
  10302. 单位矩阵:<br/>
  10303. [ 1, 0, 0, <br/>
  10304. 0, 1, 0 ]
  10305. */
  10306. static identity(): AffineTransform;
  10307. /**
  10308. !#en Clone a AffineTransform object from the specified transform.
  10309. !#zh 克隆指定的 AffineTransform 对象。
  10310. @param t t
  10311. */
  10312. static clone(t: AffineTransform): AffineTransform;
  10313. /**
  10314. !#en
  10315. Concatenate a transform matrix to another
  10316. The results are reflected in the out affine transform
  10317. out = t1 * t2
  10318. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10319. !#zh
  10320. 拼接两个矩阵,将结果保存到 out 矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10321. out = t1 * t2
  10322. @param out Out object to store the concat result
  10323. @param t1 The first transform object.
  10324. @param t2 The transform object to concatenate.
  10325. */
  10326. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): AffineTransform;
  10327. /**
  10328. !#en Get the invert transform of an AffineTransform object.
  10329. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10330. !#zh 求逆矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10331. @param out out
  10332. @param t t
  10333. */
  10334. static invert(out: AffineTransform, t: AffineTransform): AffineTransform;
  10335. /**
  10336. !#en Get an AffineTransform object from a given matrix 4x4.
  10337. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10338. !#zh 从一个 4x4 Matrix 获取 AffineTransform 对象。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10339. @param out out
  10340. @param mat mat
  10341. */
  10342. static invert(out: AffineTransform, mat: Mat4): AffineTransform;
  10343. /**
  10344. !#en Apply the affine transformation on a point.
  10345. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
  10346. !#zh 对一个点应用矩阵变换。这个函数不创建任何内存,你需要先创建一个 Vec2 对象用来存储结果,并作为第一个参数传入函数。
  10347. @param out The output point to store the result
  10348. @param point Point to apply transform or x.
  10349. @param transOrY transform matrix or y.
  10350. @param t transform matrix.
  10351. */
  10352. static transformVec2(out: Vec2, point: Vec2|number, transOrY: AffineTransform|number, t?: AffineTransform): Vec2;
  10353. /**
  10354. !#en Apply the affine transformation on a size.
  10355. This function is memory free, you should create the output Size by yourself and manage its memory.
  10356. !#zh 应用仿射变换矩阵到 Size 上。这个函数不创建任何内存,你需要先创建一个 Size 对象用来存储结果,并作为第一个参数传入函数。
  10357. @param out The output point to store the result
  10358. @param size size
  10359. @param t t
  10360. */
  10361. static transformSize(out: Size, size: Size, t: AffineTransform): Size;
  10362. /**
  10363. !#en Apply the affine transformation on a rect.
  10364. This function is memory free, you should create the output Rect by yourself and manage its memory.
  10365. !#zh 应用仿射变换矩阵到 Rect 上。这个函数不创建任何内存,你需要先创建一个 Rect 对象用来存储结果,并作为第一个参数传入函数。
  10366. @param out out
  10367. @param rect rect
  10368. @param anAffineTransform anAffineTransform
  10369. */
  10370. static transformRect(out: Rect, rect: Rect, anAffineTransform: AffineTransform): Rect;
  10371. /**
  10372. !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
  10373. This function is memory free, you should create the output vectors by yourself and manage their memory.
  10374. !#zh 应用仿射变换矩阵到 Rect 上, 并转换为有向包围盒。这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  10375. @param out_bl out_bl
  10376. @param out_tl out_tl
  10377. @param out_tr out_tr
  10378. @param out_br out_br
  10379. @param rect rect
  10380. @param anAffineTransform anAffineTransform
  10381. */
  10382. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform): void;
  10383. }
  10384. /** A base node for CCNode, it will:
  10385. - maintain scene hierarchy and active logic
  10386. - notifications if some properties changed
  10387. - define some interfaces shares between CCNode
  10388. - define machanisms for Enity Component Systems
  10389. - define prefab and serialize functions */
  10390. export class _BaseNode extends Object implements EventTarget {
  10391. /** !#en Name of node.
  10392. !#zh 该节点名称。 */
  10393. name: string;
  10394. /** !#en The uuid for editor, will be stripped before building project.
  10395. !#zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。 */
  10396. uuid: string;
  10397. /** !#en All children nodes.
  10398. !#zh 节点的所有子节点。 */
  10399. children: Node[];
  10400. /** !#en All children nodes.
  10401. !#zh 节点的子节点数量。 */
  10402. childrenCount: number;
  10403. /** !#en
  10404. The local active state of this node.<br/>
  10405. Note that a Node may be inactive because a parent is not active, even if this returns true.<br/>
  10406. Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
  10407. !#zh
  10408. 当前节点的自身激活状态。<br/>
  10409. 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。<br/>
  10410. 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。 */
  10411. active: boolean;
  10412. /** !#en Indicates whether this node is active in the scene.
  10413. !#zh 表示此节点是否在场景中激活。 */
  10414. activeInHierarchy: boolean;
  10415. /**
  10416. @param name name
  10417. */
  10418. constructor(name?: string);
  10419. /** !#en The parent of the node.
  10420. !#zh 该节点的父节点。 */
  10421. parent: Node;
  10422. /**
  10423. !#en Get parent of the node.
  10424. !#zh 获取该节点的父节点。
  10425. @example
  10426. ```js
  10427. var parent = this.node.getParent();
  10428. ```
  10429. */
  10430. getParent(): Node;
  10431. /**
  10432. !#en Set parent of the node.
  10433. !#zh 设置该节点的父节点。
  10434. @param value value
  10435. @example
  10436. ```js
  10437. node.setParent(newNode);
  10438. ```
  10439. */
  10440. setParent(value: Node): void;
  10441. /**
  10442. !#en
  10443. Properties configuration function <br/>
  10444. All properties in attrs will be set to the node, <br/>
  10445. when the setter of the node is available, <br/>
  10446. the property will be set via setter function.<br/>
  10447. !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  10448. @param attrs Properties to be set to node
  10449. @example
  10450. ```js
  10451. var attrs = { key: 0, num: 100 };
  10452. node.attr(attrs);
  10453. ```
  10454. */
  10455. attr(attrs: any): void;
  10456. /**
  10457. !#en Returns a child from the container given its uuid.
  10458. !#zh 通过 uuid 获取节点的子节点。
  10459. @param uuid The uuid to find the child node.
  10460. @example
  10461. ```js
  10462. var child = node.getChildByUuid(uuid);
  10463. ```
  10464. */
  10465. getChildByUuid(uuid: string): Node;
  10466. /**
  10467. !#en Returns a child from the container given its name.
  10468. !#zh 通过名称获取节点的子节点。
  10469. @param name A name to find the child node.
  10470. @example
  10471. ```js
  10472. var child = node.getChildByName("Test Node");
  10473. ```
  10474. */
  10475. getChildByName(name: string): Node;
  10476. /**
  10477. !#en
  10478. Inserts a child to the node at a specified index.
  10479. !#zh
  10480. 插入子节点到指定位置
  10481. @param child the child node to be inserted
  10482. @param siblingIndex the sibling index to place the child in
  10483. @example
  10484. ```js
  10485. node.insertChild(child, 2);
  10486. ```
  10487. */
  10488. insertChild(child: Node, siblingIndex: number): void;
  10489. /**
  10490. !#en Get the sibling index.
  10491. !#zh 获取同级索引。
  10492. @example
  10493. ```js
  10494. var index = node.getSiblingIndex();
  10495. ```
  10496. */
  10497. getSiblingIndex(): number;
  10498. /**
  10499. !#en Set the sibling index of this node.
  10500. !#zh 设置节点同级索引。
  10501. @param index index
  10502. @example
  10503. ```js
  10504. node.setSiblingIndex(1);
  10505. ```
  10506. */
  10507. setSiblingIndex(index: number): void;
  10508. /**
  10509. !#en Walk though the sub children tree of the current node.
  10510. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children.
  10511. This function call is not recursive, it's based on stack.
  10512. Please don't walk any other node inside the walk process.
  10513. !#zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  10514. 对子树中的所有节点,包含当前节点,会执行两次回调,prefunc 会在访问它的子节点之前调用,postfunc 会在访问所有子节点之后调用。
  10515. 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  10516. 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  10517. @param prefunc The callback to process node when reach the node for the first time
  10518. @param postfunc The callback to process node when re-visit the node after walked all children in its sub tree
  10519. @example
  10520. ```js
  10521. node.walk(function (target) {
  10522. console.log('Walked through node ' + target.name + ' for the first time');
  10523. }, function (target) {
  10524. console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  10525. });
  10526. ```
  10527. */
  10528. walk(prefunc: (target: _BaseNode) => void, postfunc: (target: _BaseNode) => void): void;
  10529. /**
  10530. !#en
  10531. Remove itself from its parent node. If cleanup is `true`, then also remove all events and actions. <br/>
  10532. If the cleanup parameter is not passed, it will force a cleanup, so it is recommended that you always pass in the `false` parameter when calling this API.<br/>
  10533. If the node orphan, then nothing happens.
  10534. !#zh
  10535. 从父节点中删除该节点。如果不传入 cleanup 参数或者传入 `true`,那么这个节点上所有绑定的事件、action 都会被删除。<br/>
  10536. 因此建议调用这个 API 时总是传入 `false` 参数。<br/>
  10537. 如果这个节点是一个孤节点,那么什么都不会发生。
  10538. @param cleanup true if all actions and callbacks on this node should be removed, false otherwise.
  10539. @example
  10540. ```js
  10541. node.removeFromParent();
  10542. node.removeFromParent(false);
  10543. ```
  10544. */
  10545. removeFromParent(cleanup?: boolean): void;
  10546. /**
  10547. !#en
  10548. Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
  10549. If the cleanup parameter is not passed, it will force a cleanup. <br/>
  10550. "remove" logic MUST only be on this method <br/>
  10551. If a class wants to extend the 'removeChild' behavior it only needs <br/>
  10552. to override this method.
  10553. !#zh
  10554. 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10555. 如果 cleanup 参数不传入,默认为 true 表示清理。<br/>
  10556. @param child The child node which will be removed.
  10557. @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
  10558. @example
  10559. ```js
  10560. node.removeChild(newNode);
  10561. node.removeChild(newNode, false);
  10562. ```
  10563. */
  10564. removeChild(child: Node, cleanup?: boolean): void;
  10565. /**
  10566. !#en
  10567. Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
  10568. If the cleanup parameter is not passed, it will force a cleanup.
  10569. !#zh
  10570. 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10571. 如果 cleanup 参数不传入,默认为 true 表示清理。
  10572. @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
  10573. @example
  10574. ```js
  10575. node.removeAllChildren();
  10576. node.removeAllChildren(false);
  10577. ```
  10578. */
  10579. removeAllChildren(cleanup?: boolean): void;
  10580. /**
  10581. !#en Is this node a child of the given node?
  10582. !#zh 是否是指定节点的子节点?
  10583. @param parent parent
  10584. @example
  10585. ```js
  10586. node.isChildOf(newNode);
  10587. ```
  10588. */
  10589. isChildOf(parent: Node): boolean;
  10590. /**
  10591. !#en
  10592. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  10593. You can also get component in the node by passing in the name of the script.
  10594. !#zh
  10595. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  10596. 传入参数也可以是脚本的名称。
  10597. @param typeOrClassName typeOrClassName
  10598. @example
  10599. ```js
  10600. // get sprite component
  10601. var sprite = node.getComponent(cc.Sprite);
  10602. // get custom test class
  10603. var test = node.getComponent("Test");
  10604. ```
  10605. */
  10606. getComponent<T extends Component>(type: {prototype: T}): T;
  10607. getComponent(className: string): any;
  10608. /**
  10609. !#en Returns all components of supplied type in the node.
  10610. !#zh 返回节点上指定类型的所有组件。
  10611. @param typeOrClassName typeOrClassName
  10612. @example
  10613. ```js
  10614. var sprites = node.getComponents(cc.Sprite);
  10615. var tests = node.getComponents("Test");
  10616. ```
  10617. */
  10618. getComponents<T extends Component>(type: {prototype: T}): T[];
  10619. getComponents(className: string): any[];
  10620. /**
  10621. !#en Returns the component of supplied type in any of its children using depth first search.
  10622. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  10623. @param typeOrClassName typeOrClassName
  10624. @example
  10625. ```js
  10626. var sprite = node.getComponentInChildren(cc.Sprite);
  10627. var Test = node.getComponentInChildren("Test");
  10628. ```
  10629. */
  10630. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  10631. getComponentInChildren(className: string): any;
  10632. /**
  10633. !#en Returns all components of supplied type in self or any of its children.
  10634. !#zh 递归查找自身或所有子节点中指定类型的组件
  10635. @param typeOrClassName typeOrClassName
  10636. @example
  10637. ```js
  10638. var sprites = node.getComponentsInChildren(cc.Sprite);
  10639. var tests = node.getComponentsInChildren("Test");
  10640. ```
  10641. */
  10642. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  10643. getComponentsInChildren(className: string): any[];
  10644. /**
  10645. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  10646. !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  10647. @param typeOrClassName The constructor or the class name of the component to add
  10648. @example
  10649. ```js
  10650. var sprite = node.addComponent(cc.Sprite);
  10651. var test = node.addComponent("Test");
  10652. ```
  10653. */
  10654. addComponent<T extends Component>(type: {new(): T}): T;
  10655. addComponent(className: string): any;
  10656. /**
  10657. !#en
  10658. Removes a component identified by the given name or removes the component object given.
  10659. You can also use component.destroy() if you already have the reference.
  10660. !#zh
  10661. 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  10662. 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  10663. @param component The need remove component.
  10664. @example
  10665. ```js
  10666. node.removeComponent(cc.Sprite);
  10667. var Test = require("Test");
  10668. node.removeComponent(Test);
  10669. ```
  10670. */
  10671. removeComponent(component: string|Function|Component): void;
  10672. /**
  10673. !#en
  10674. Destroy all children from the node, and release all their own references to other objects.<br/>
  10675. Actual destruct operation will delayed until before rendering.
  10676. !#zh
  10677. 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
  10678. 实际销毁操作会延迟到当前帧渲染前执行。
  10679. @example
  10680. ```js
  10681. node.destroyAllChildren();
  10682. ```
  10683. */
  10684. destroyAllChildren(): void;
  10685. /**
  10686. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  10687. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  10688. @param type The type of event.
  10689. */
  10690. hasEventListener(type: string): boolean;
  10691. /**
  10692. !#en
  10693. Register an callback of a specific event type on the EventTarget.
  10694. This type of event should be triggered via `emit`.
  10695. !#zh
  10696. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  10697. @param type A string representing the event type to listen for.
  10698. @param callback The callback that will be invoked when the event is dispatched.
  10699. The callback is ignored if it is a duplicate (the callbacks are unique).
  10700. @param target The target (this object) to invoke the callback, can be null
  10701. @example
  10702. ```js
  10703. eventTarget.on('fire', function () {
  10704. cc.log("fire in the hole");
  10705. }, node);
  10706. ```
  10707. */
  10708. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  10709. /**
  10710. !#en
  10711. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  10712. if only type is passed as parameter, all listeners registered with that type will be removed.
  10713. !#zh
  10714. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  10715. @param type A string representing the event type being removed.
  10716. @param callback The callback to remove.
  10717. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  10718. @example
  10719. ```js
  10720. // register fire eventListener
  10721. var callback = eventTarget.on('fire', function () {
  10722. cc.log("fire in the hole");
  10723. }, target);
  10724. // remove fire event listener
  10725. eventTarget.off('fire', callback, target);
  10726. // remove all fire event listeners
  10727. eventTarget.off('fire');
  10728. ```
  10729. */
  10730. off(type: string, callback?: Function, target?: any): void;
  10731. /**
  10732. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  10733. This is not for removing all listeners in the current event target,
  10734. and this is not for removing all listeners the target parameter have registered.
  10735. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  10736. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  10737. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  10738. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  10739. @param target The target to be searched for all related listeners
  10740. */
  10741. targetOff(target: any): void;
  10742. /**
  10743. !#en
  10744. Register an callback of a specific event type on the EventTarget,
  10745. the callback will remove itself after the first time it is triggered.
  10746. !#zh
  10747. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  10748. @param type A string representing the event type to listen for.
  10749. @param callback The callback that will be invoked when the event is dispatched.
  10750. The callback is ignored if it is a duplicate (the callbacks are unique).
  10751. @param target The target (this object) to invoke the callback, can be null
  10752. @example
  10753. ```js
  10754. eventTarget.once('fire', function () {
  10755. cc.log("this is the callback and will be invoked only once");
  10756. }, node);
  10757. ```
  10758. */
  10759. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  10760. /**
  10761. !#en
  10762. Send an event with the event object.
  10763. !#zh
  10764. 通过事件对象派发事件
  10765. @param event event
  10766. */
  10767. dispatchEvent(event: Event): void;
  10768. }
  10769. /** !#en
  10770. Helper class for setting material blend function.
  10771. !#zh
  10772. 设置材质混合模式的辅助类。 */
  10773. export class BlendFunc {
  10774. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  10775. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  10776. srcBlendFactor: macro.BlendFactor;
  10777. /** !#en specify the destination Blend Factor.
  10778. !#zh 指定目标的混合模式 */
  10779. dstBlendFactor: macro.BlendFactor;
  10780. }
  10781. /** An internal helper class for switching render component's material between normal sprite material and gray sprite material. */
  10782. export class GraySpriteState {
  10783. /** !#en The normal material.
  10784. !#zh 正常状态的材质。 */
  10785. normalMaterial: Material;
  10786. /** !#en The gray material.
  10787. !#zh 置灰状态的材质。 */
  10788. grayMaterial: Material;
  10789. }
  10790. /** misc utilities */
  10791. export class misc {
  10792. /**
  10793. !#en Clamp a value between from and to.
  10794. !#zh
  10795. 限定浮点数的最大最小值。<br/>
  10796. 数值大于 max_inclusive 则返回 max_inclusive。<br/>
  10797. 数值小于 min_inclusive 则返回 min_inclusive。<br/>
  10798. 否则返回自身。
  10799. @param value value
  10800. @param min_inclusive min_inclusive
  10801. @param max_inclusive max_inclusive
  10802. @example
  10803. ```js
  10804. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  10805. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  10806. var v3 = cc.misc.clampf(10, 0, 20); // 10;
  10807. ```
  10808. */
  10809. static clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  10810. /**
  10811. !#en Clamp a value between 0 and 1.
  10812. !#zh 限定浮点数的取值范围为 0 ~ 1 之间。
  10813. @param value value
  10814. @example
  10815. ```js
  10816. var v1 = cc.misc.clamp01(20); // 1;
  10817. var v2 = cc.misc.clamp01(-1); // 0;
  10818. var v3 = cc.misc.clamp01(0.5); // 0.5;
  10819. ```
  10820. */
  10821. static clamp01(value: number): number;
  10822. /**
  10823. Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  10824. @param a number A
  10825. @param b number B
  10826. @param r ratio between 0 and 1
  10827. @example
  10828. ```js
  10829. ----
  10830. lerp
  10831. cc.misc.lerp(2,10,0.5)//returns 6
  10832. cc.misc.lerp(2,10,0.2)//returns 3.6
  10833. ```
  10834. */
  10835. static lerp(a: number, b: number, r: number): number;
  10836. /**
  10837. converts degrees to radians
  10838. @param angle angle
  10839. */
  10840. static degreesToRadians(angle: number): number;
  10841. /**
  10842. converts radians to degrees
  10843. @param angle angle
  10844. */
  10845. static radiansToDegrees(angle: number): number;
  10846. }
  10847. /** !#en The renderer object which provide access to render system APIs,
  10848. detailed APIs will be available progressively.
  10849. !#zh 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户 */
  10850. export class renderer {
  10851. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  10852. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  10853. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  10854. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  10855. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  10856. static renderEngine: any;
  10857. /** !#en The total draw call count in last rendered frame.
  10858. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  10859. static drawCalls: number;
  10860. }
  10861. /** !#en the device accelerometer reports values for each axis in units of g-force.
  10862. !#zh 设备重力传感器传递的各个轴的数据。 */
  10863. export class constructor {
  10864. /**
  10865. whether enable accelerometer event
  10866. @param isEnable isEnable
  10867. */
  10868. setAccelerometerEnabled(isEnable: boolean): void;
  10869. /**
  10870. set accelerometer interval value
  10871. @param interval interval
  10872. */
  10873. setAccelerometerInterval(interval: number): void;
  10874. }
  10875. /** undefined */
  10876. export enum VerticalTextAlignment {
  10877. TOP = 0,
  10878. CENTER = 0,
  10879. BOTTOM = 0,
  10880. }
  10881. /** The base class of most of all the objects in Fireball. */
  10882. export class Object {
  10883. /** !#en The name of the object.
  10884. !#zh 该对象的名称。 */
  10885. name: string;
  10886. /** !#en
  10887. Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  10888. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  10889. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  10890. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  10891. but this is often caused by a particular logical requirements, which is not normally required.
  10892. !#zh
  10893. 表示该对象是否可用(被 destroy 后将不可用)。<br>
  10894. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。 */
  10895. isValid: boolean;
  10896. /**
  10897. !#en
  10898. Destroy this Object, and release all its own references to other objects.<br/>
  10899. Actual object destruction will delayed until before rendering.
  10900. From the next frame, this object is not usable anymore.
  10901. You can use `cc.isValid(obj)` to check whether the object is destroyed before accessing it.
  10902. !#zh
  10903. 销毁该对象,并释放所有它对其它对象的引用。<br/>
  10904. 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  10905. 您可以在访问对象之前使用 `cc.isValid(obj)` 来检查对象是否已被销毁。
  10906. @example
  10907. ```js
  10908. obj.destroy();
  10909. ```
  10910. */
  10911. destroy(): boolean;
  10912. }
  10913. /** Bit mask that controls object states. */
  10914. export enum Flags {
  10915. DontSave = 0,
  10916. EditorOnly = 0,
  10917. HideInHierarchy = 0,
  10918. }
  10919. /** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.
  10920. It's invalid on safari, QQbrowser and android browser */
  10921. export class screen {
  10922. /**
  10923. initialize
  10924. */
  10925. init(): void;
  10926. /**
  10927. return true if it's full now.
  10928. */
  10929. fullScreen(): boolean;
  10930. /**
  10931. change the screen to full mode.
  10932. @param element element
  10933. @param onFullScreenChange onFullScreenChange
  10934. @param onFullScreenError onFullScreenError
  10935. */
  10936. requestFullScreen(element: Element, onFullScreenChange: Function, onFullScreenError: Function): void;
  10937. /**
  10938. exit the full mode.
  10939. */
  10940. exitFullScreen(): boolean;
  10941. /**
  10942. Automatically request full screen with a touch/click event
  10943. @param element element
  10944. @param onFullScreenChange onFullScreenChange
  10945. */
  10946. autoFullScreen(element: Element, onFullScreenChange: Function): void;
  10947. }
  10948. /** System variables */
  10949. export class sys {
  10950. /** English language code */
  10951. static LANGUAGE_ENGLISH: string;
  10952. /** Chinese language code */
  10953. static LANGUAGE_CHINESE: string;
  10954. /** French language code */
  10955. static LANGUAGE_FRENCH: string;
  10956. /** Italian language code */
  10957. static LANGUAGE_ITALIAN: string;
  10958. /** German language code */
  10959. static LANGUAGE_GERMAN: string;
  10960. /** Spanish language code */
  10961. static LANGUAGE_SPANISH: string;
  10962. /** Spanish language code */
  10963. static LANGUAGE_DUTCH: string;
  10964. /** Russian language code */
  10965. static LANGUAGE_RUSSIAN: string;
  10966. /** Korean language code */
  10967. static LANGUAGE_KOREAN: string;
  10968. /** Japanese language code */
  10969. static LANGUAGE_JAPANESE: string;
  10970. /** Hungarian language code */
  10971. static LANGUAGE_HUNGARIAN: string;
  10972. /** Portuguese language code */
  10973. static LANGUAGE_PORTUGUESE: string;
  10974. /** Arabic language code */
  10975. static LANGUAGE_ARABIC: string;
  10976. /** Norwegian language code */
  10977. static LANGUAGE_NORWEGIAN: string;
  10978. /** Polish language code */
  10979. static LANGUAGE_POLISH: string;
  10980. /** Turkish language code */
  10981. static LANGUAGE_TURKISH: string;
  10982. /** Ukrainian language code */
  10983. static LANGUAGE_UKRAINIAN: string;
  10984. /** Romanian language code */
  10985. static LANGUAGE_ROMANIAN: string;
  10986. /** Bulgarian language code */
  10987. static LANGUAGE_BULGARIAN: string;
  10988. /** Unknown language code */
  10989. static LANGUAGE_UNKNOWN: string;
  10990. static OS_IOS: string;
  10991. static OS_ANDROID: string;
  10992. static OS_WINDOWS: string;
  10993. static OS_MARMALADE: string;
  10994. static OS_LINUX: string;
  10995. static OS_BADA: string;
  10996. static OS_BLACKBERRY: string;
  10997. static OS_OSX: string;
  10998. static OS_WP8: string;
  10999. static OS_WINRT: string;
  11000. static OS_UNKNOWN: string;
  11001. static UNKNOWN: number;
  11002. static WIN32: number;
  11003. static LINUX: number;
  11004. static MACOS: number;
  11005. static ANDROID: number;
  11006. static IPHONE: number;
  11007. static IPAD: number;
  11008. static BLACKBERRY: number;
  11009. static NACL: number;
  11010. static EMSCRIPTEN: number;
  11011. static TIZEN: number;
  11012. static WINRT: number;
  11013. static WP8: number;
  11014. static MOBILE_BROWSER: number;
  11015. static DESKTOP_BROWSER: number;
  11016. /** Indicates whether executes in editor's window process (Electron's renderer context) */
  11017. static EDITOR_PAGE: number;
  11018. /** Indicates whether executes in editor's main process (Electron's browser context) */
  11019. static EDITOR_CORE: number;
  11020. static WECHAT_GAME: number;
  11021. static QQ_PLAY: number;
  11022. static FB_PLAYABLE_ADS: number;
  11023. static BAIDU_GAME: number;
  11024. static VIVO_GAME: number;
  11025. static OPPO_GAME: number;
  11026. static HUAWEI_GAME: number;
  11027. static XIAOMI_GAME: number;
  11028. static JKW_GAME: number;
  11029. static ALIPAY_GAME: number;
  11030. static WECHAT_GAME_SUB: number;
  11031. static BAIDU_GAME_SUB: number;
  11032. static QTT_GAME: number;
  11033. /** BROWSER_TYPE_WECHAT */
  11034. static BROWSER_TYPE_WECHAT: string;
  11035. /** BROWSER_TYPE_WECHAT_GAME */
  11036. static BROWSER_TYPE_WECHAT_GAME: string;
  11037. /** BROWSER_TYPE_WECHAT_GAME_SUB */
  11038. static BROWSER_TYPE_WECHAT_GAME_SUB: string;
  11039. /** BROWSER_TYPE_BAIDU_GAME */
  11040. static BROWSER_TYPE_BAIDU_GAME: string;
  11041. /** BROWSER_TYPE_BAIDU_GAME_SUB */
  11042. static BROWSER_TYPE_BAIDU_GAME_SUB: string;
  11043. /** BROWSER_TYPE_XIAOMI_GAME */
  11044. static BROWSER_TYPE_XIAOMI_GAME: string;
  11045. /** BROWSER_TYPE_ALIPAY_GAME */
  11046. static BROWSER_TYPE_ALIPAY_GAME: string;
  11047. /** BROWSER_TYPE_QQ_PLAY */
  11048. static BROWSER_TYPE_QQ_PLAY: string;
  11049. static BROWSER_TYPE_ANDROID: string;
  11050. static BROWSER_TYPE_IE: string;
  11051. static BROWSER_TYPE_EDGE: string;
  11052. static BROWSER_TYPE_QQ: string;
  11053. static BROWSER_TYPE_MOBILE_QQ: string;
  11054. static BROWSER_TYPE_UC: string;
  11055. /** uc third party integration. */
  11056. static BROWSER_TYPE_UCBS: string;
  11057. static BROWSER_TYPE_360: string;
  11058. static BROWSER_TYPE_BAIDU_APP: string;
  11059. static BROWSER_TYPE_BAIDU: string;
  11060. static BROWSER_TYPE_MAXTHON: string;
  11061. static BROWSER_TYPE_OPERA: string;
  11062. static BROWSER_TYPE_OUPENG: string;
  11063. static BROWSER_TYPE_MIUI: string;
  11064. static BROWSER_TYPE_FIREFOX: string;
  11065. static BROWSER_TYPE_SAFARI: string;
  11066. static BROWSER_TYPE_CHROME: string;
  11067. static BROWSER_TYPE_LIEBAO: string;
  11068. static BROWSER_TYPE_QZONE: string;
  11069. static BROWSER_TYPE_SOUGOU: string;
  11070. static BROWSER_TYPE_UNKNOWN: string;
  11071. /** Is native ? This is set to be true in jsb auto. */
  11072. static isNative: boolean;
  11073. /** Is web browser ? */
  11074. static isBrowser: boolean;
  11075. /**
  11076. Is webgl extension support?
  11077. @param name name
  11078. */
  11079. static glExtension(name: any): void;
  11080. /**
  11081. Get max joint matrix size for skinned mesh renderer.
  11082. */
  11083. static getMaxJointMatrixSize(): void;
  11084. /** Indicate whether system is mobile system */
  11085. static isMobile: boolean;
  11086. /** Indicate the running platform */
  11087. static platform: number;
  11088. /** Get current language iso 639-1 code.
  11089. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc.
  11090. The actual value totally depends on results provided by destination platform. */
  11091. static languageCode: string;
  11092. /** Indicate the current language of the running system */
  11093. static language: string;
  11094. /** Indicate the running os name */
  11095. static os: string;
  11096. /** Indicate the running os version */
  11097. static osVersion: string;
  11098. /** Indicate the running os main version */
  11099. static osMainVersion: number;
  11100. /** Indicate the running browser type */
  11101. static browserType: string;
  11102. /** Indicate the running browser version */
  11103. static browserVersion: string;
  11104. /** Indicate the real pixel resolution of the whole game window */
  11105. static windowPixelResolution: Size;
  11106. /** cc.sys.localStorage is a local storage component. */
  11107. static localStorage: any;
  11108. /** The capabilities of the current platform */
  11109. static capabilities: any;
  11110. /**
  11111. !#en
  11112. Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
  11113. !#zh
  11114. 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  11115. */
  11116. static getNetworkType(): sys.NetworkType;
  11117. /**
  11118. !#en
  11119. Get the battery level of current device, return 1.0 if failure.
  11120. !#zh
  11121. 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  11122. */
  11123. static getBatteryLevel(): number;
  11124. /**
  11125. Forces the garbage collection, only available in JSB
  11126. */
  11127. static garbageCollect(): void;
  11128. /**
  11129. Restart the JS VM, only available in JSB
  11130. */
  11131. static restartVM(): void;
  11132. /**
  11133. !#en
  11134. Return the safe area rect. <br/>
  11135. only available on the iOS native platform, otherwise it will return a rect with design resolution size.
  11136. !#zh
  11137. 返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。其它平台将默认返回设计分辨率尺寸。
  11138. */
  11139. static getSafeAreaRect(): Rect;
  11140. /**
  11141. Check whether an object is valid,
  11142. In web engine, it will return true if the object exist
  11143. In native engine, it will return true if the JS object and the correspond native object are both valid
  11144. @param obj obj
  11145. */
  11146. static isObjectValid(obj: any): boolean;
  11147. /**
  11148. Dump system informations
  11149. */
  11150. static dump(): void;
  11151. /**
  11152. Open a url in browser
  11153. @param url url
  11154. */
  11155. static openURL(url: string): void;
  11156. /**
  11157. Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
  11158. */
  11159. static now(): number;
  11160. }
  11161. /** cc.view is the singleton object which represents the game window.<br/>
  11162. It's main task include: <br/>
  11163. - Apply the design resolution policy<br/>
  11164. - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>
  11165. - Manage the game view port which can be different with the window<br/>
  11166. - Manage the content scale and translation<br/>
  11167. <br/>
  11168. Since the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>
  11169. the standard way to use it is by calling:<br/>
  11170. - cc.view.methodName(); <br/> */
  11171. export class View extends EventTarget {
  11172. /**
  11173. !#en
  11174. Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
  11175. 1. cc.macro.DENSITYDPI_DEVICE, value is "device-dpi" <br/>
  11176. 2. cc.macro.DENSITYDPI_HIGH, value is "high-dpi" (default value) <br/>
  11177. 3. cc.macro.DENSITYDPI_MEDIUM, value is "medium-dpi" (browser's default value) <br/>
  11178. 4. cc.macro.DENSITYDPI_LOW, value is "low-dpi" <br/>
  11179. 5. Custom value, e.g: "480" <br/>
  11180. !#zh 设置目标内容的每英寸像素点密度。
  11181. @param densityDPI densityDPI
  11182. */
  11183. setTargetDensityDPI(densityDPI: string): void;
  11184. /**
  11185. !#en
  11186. Returns the current target-densitydpi value of cc.view.
  11187. !#zh 获取目标内容的每英寸像素点密度。
  11188. */
  11189. getTargetDensityDPI(): string;
  11190. /**
  11191. !#en
  11192. Sets whether resize canvas automatically when browser's size changed.<br/>
  11193. Useful only on web.
  11194. !#zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  11195. 仅在 Web 模式下有效。
  11196. @param enabled Whether enable automatic resize with browser's resize event
  11197. */
  11198. resizeWithBrowserSize(enabled: boolean): void;
  11199. /**
  11200. !#en
  11201. Sets the callback function for cc.view's resize action,<br/>
  11202. this callback will be invoked before applying resolution policy, <br/>
  11203. so you can do any additional modifications within the callback.<br/>
  11204. Useful only on web.
  11205. !#zh 设置 cc.view 调整视窗尺寸行为的回调函数,
  11206. 这个回调函数会在应用适配模式之前被调用,
  11207. 因此你可以在这个回调函数内添加任意附加改变,
  11208. 仅在 Web 平台下有效。
  11209. @param callback The callback function
  11210. */
  11211. setResizeCallback(callback: Function|void): void;
  11212. /**
  11213. !#en
  11214. Sets the orientation of the game, it can be landscape, portrait or auto.
  11215. When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  11216. cc.view will automatically rotate the game canvas using CSS.
  11217. Note that this function doesn't have any effect in native,
  11218. in native, you need to set the application orientation in native project settings
  11219. !#zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  11220. 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  11221. cc.view 会自动用 CSS 旋转游戏场景的 canvas,
  11222. 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  11223. @param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO
  11224. */
  11225. setOrientation(orientation: number): void;
  11226. /**
  11227. !#en
  11228. Sets whether the engine modify the "viewport" meta in your web page.<br/>
  11229. It's enabled by default, we strongly suggest you not to disable it.<br/>
  11230. And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  11231. Only useful on web
  11232. !#zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  11233. 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  11234. 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  11235. 仅在 Web 模式下有效
  11236. @param enabled Enable automatic modification to "viewport" meta
  11237. */
  11238. adjustViewportMeta(enabled: boolean): void;
  11239. /**
  11240. !#en
  11241. Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  11242. it takes effect only when you called setDesignResolutionPolicy<br/>
  11243. Only useful on web
  11244. !#zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  11245. 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  11246. 仅在 Web 模式下有效。
  11247. @param enabled Enable or disable retina display
  11248. */
  11249. enableRetina(enabled: boolean): void;
  11250. /**
  11251. !#en
  11252. Check whether retina display is enabled.<br/>
  11253. Only useful on web
  11254. !#zh 检查是否对 Retina 显示设备进行优化。
  11255. 仅在 Web 模式下有效。
  11256. */
  11257. isRetinaEnabled(): boolean;
  11258. /**
  11259. !#en Whether to Enable on anti-alias
  11260. !#zh 控制抗锯齿是否开启
  11261. @param enabled Enable or not anti-alias
  11262. */
  11263. enableAntiAlias(enabled: boolean): void;
  11264. /**
  11265. !#en Returns whether the current enable on anti-alias
  11266. !#zh 返回当前是否抗锯齿
  11267. */
  11268. isAntiAliasEnabled(): boolean;
  11269. /**
  11270. !#en
  11271. If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  11272. You can pass true as parameter to enable it and disable it by passing false.<br/>
  11273. Only useful on web
  11274. !#zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  11275. 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  11276. @param enabled Enable or disable auto full screen on mobile devices
  11277. */
  11278. enableAutoFullScreen(enabled: boolean): void;
  11279. /**
  11280. !#en
  11281. Check whether auto full screen is enabled.<br/>
  11282. Only useful on web
  11283. !#zh 检查自动进入全屏模式是否启动。
  11284. 仅在 Web 模式下有效。
  11285. */
  11286. isAutoFullScreenEnabled(): boolean;
  11287. /**
  11288. !#en
  11289. Returns the canvas size of the view.<br/>
  11290. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  11291. On web, it returns the size of the canvas element.
  11292. !#zh 返回视图中 canvas 的尺寸。
  11293. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  11294. 在 Web 平台下,它返回 canvas 元素尺寸。
  11295. */
  11296. getCanvasSize(): Size;
  11297. /**
  11298. !#en
  11299. Returns the frame size of the view.<br/>
  11300. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  11301. On web, it returns the size of the canvas's outer DOM element.
  11302. !#zh 返回视图中边框尺寸。
  11303. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  11304. 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  11305. */
  11306. getFrameSize(): Size;
  11307. /**
  11308. !#en
  11309. On native, it sets the frame size of view.<br/>
  11310. On web, it sets the size of the canvas's outer DOM element.
  11311. !#zh 在 native 平台下,设置视图框架尺寸。
  11312. 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  11313. @param width width
  11314. @param height height
  11315. */
  11316. setFrameSize(width: number, height: number): void;
  11317. /**
  11318. !#en
  11319. Returns the visible area size of the view port.
  11320. !#zh 返回视图窗口可见区域尺寸。
  11321. */
  11322. getVisibleSize(): Size;
  11323. /**
  11324. !#en
  11325. Returns the visible area size of the view port.
  11326. !#zh 返回视图窗口可见区域像素尺寸。
  11327. */
  11328. getVisibleSizeInPixel(): Size;
  11329. /**
  11330. !#en
  11331. Returns the visible origin of the view port.
  11332. !#zh 返回视图窗口可见区域原点。
  11333. */
  11334. getVisibleOrigin(): Vec2;
  11335. /**
  11336. !#en
  11337. Returns the visible origin of the view port.
  11338. !#zh 返回视图窗口可见区域像素原点。
  11339. */
  11340. getVisibleOriginInPixel(): Vec2;
  11341. /**
  11342. !#en
  11343. Returns the current resolution policy
  11344. !#zh 返回当前分辨率方案
  11345. */
  11346. getResolutionPolicy(): ResolutionPolicy;
  11347. /**
  11348. !#en
  11349. Sets the current resolution policy
  11350. !#zh 设置当前分辨率模式
  11351. @param resolutionPolicy resolutionPolicy
  11352. */
  11353. setResolutionPolicy(resolutionPolicy: ResolutionPolicy|number): void;
  11354. /**
  11355. !#en
  11356. Sets the resolution policy with designed view size in points.<br/>
  11357. The resolution policy include: <br/>
  11358. [1] ResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.<br/>
  11359. [2] ResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.<br/>
  11360. [3] ResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.<br/>
  11361. [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  11362. [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  11363. [cc.ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>
  11364. !#zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  11365. @param width Design resolution width.
  11366. @param height Design resolution height.
  11367. @param resolutionPolicy The resolution policy desired
  11368. */
  11369. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  11370. /**
  11371. !#en
  11372. Returns the designed size for the view.
  11373. Default resolution size is the same as 'getFrameSize'.
  11374. !#zh 返回视图的设计分辨率。
  11375. 默认下分辨率尺寸同 `getFrameSize` 方法相同
  11376. */
  11377. getDesignResolutionSize(): Size;
  11378. /**
  11379. !#en
  11380. Sets the container to desired pixel resolution and fit the game content to it.
  11381. This function is very useful for adaptation in mobile browsers.
  11382. In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  11383. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  11384. But this API can be helpful to set a desired pixel resolution which is in between.
  11385. This API will do the following:
  11386. 1. Set viewport's width to the desired width in pixel
  11387. 2. Set body width to the exact pixel resolution
  11388. 3. The resolution policy will be reset with designed view size in points.
  11389. !#zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  11390. @param width Design resolution width.
  11391. @param height Design resolution height.
  11392. @param resolutionPolicy The resolution policy desired
  11393. */
  11394. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  11395. /**
  11396. !#en
  11397. Sets view port rectangle with points.
  11398. !#zh 用设计分辨率下的点尺寸来设置视窗。
  11399. @param x x
  11400. @param y y
  11401. @param w width
  11402. @param h height
  11403. */
  11404. setViewportInPoints(x: number, y: number, w: number, h: number): void;
  11405. /**
  11406. !#en
  11407. Sets Scissor rectangle with points.
  11408. !#zh 用设计分辨率下的点的尺寸来设置 scissor 剪裁区域。
  11409. @param x x
  11410. @param y y
  11411. @param w w
  11412. @param h h
  11413. */
  11414. setScissorInPoints(x: number, y: number, w: number, h: number): void;
  11415. /**
  11416. !#en
  11417. Returns whether GL_SCISSOR_TEST is enable
  11418. !#zh 检查 scissor 是否生效。
  11419. */
  11420. isScissorEnabled(): boolean;
  11421. /**
  11422. !#en
  11423. Returns the current scissor rectangle
  11424. !#zh 返回当前的 scissor 剪裁区域。
  11425. */
  11426. getScissorRect(): Rect;
  11427. /**
  11428. !#en
  11429. Returns the view port rectangle.
  11430. !#zh 返回视窗剪裁区域。
  11431. */
  11432. getViewportRect(): Rect;
  11433. /**
  11434. !#en
  11435. Returns scale factor of the horizontal direction (X axis).
  11436. !#zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  11437. */
  11438. getScaleX(): number;
  11439. /**
  11440. !#en
  11441. Returns scale factor of the vertical direction (Y axis).
  11442. !#zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  11443. */
  11444. getScaleY(): number;
  11445. /**
  11446. !#en
  11447. Returns device pixel ratio for retina display.
  11448. !#zh 返回设备或浏览器像素比例。
  11449. */
  11450. getDevicePixelRatio(): number;
  11451. /**
  11452. !#en
  11453. Returns the real location in view for a translation based on a related position
  11454. !#zh 将屏幕坐标转换为游戏视图下的坐标。
  11455. @param tx The X axis translation
  11456. @param ty The Y axis translation
  11457. @param relatedPos The related position object including "left", "top", "width", "height" informations
  11458. */
  11459. convertToLocationInView(tx: number, ty: number, relatedPos: any): Vec2;
  11460. }
  11461. /** <p>cc.game.containerStrategy class is the root strategy class of container's scale strategy,
  11462. it controls the behavior of how to scale the cc.game.container and cc.game.canvas object</p> */
  11463. export class ContainerStrategy {
  11464. /**
  11465. !#en
  11466. Manipulation before appling the strategy
  11467. !#zh 在应用策略之前的操作
  11468. @param view The target view
  11469. */
  11470. preApply(view: View): void;
  11471. /**
  11472. !#en
  11473. Function to apply this strategy
  11474. !#zh 策略应用方法
  11475. @param view view
  11476. @param designedResolution designedResolution
  11477. */
  11478. apply(view: View, designedResolution: Size): void;
  11479. /**
  11480. !#en
  11481. Manipulation after applying the strategy
  11482. !#zh 策略调用之后的操作
  11483. @param view The target view
  11484. */
  11485. postApply(view: View): void;
  11486. }
  11487. /** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,
  11488. it controls the behavior of how to scale the scene and setup the viewport for the game</p> */
  11489. export class ContentStrategy {
  11490. /**
  11491. !#en
  11492. Manipulation before applying the strategy
  11493. !#zh 策略应用前的操作
  11494. @param view The target view
  11495. */
  11496. preApply(view: View): void;
  11497. /**
  11498. !#en Function to apply this strategy
  11499. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  11500. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  11501. !#zh 调用策略方法
  11502. @param view view
  11503. @param designedResolution designedResolution
  11504. */
  11505. apply(view: View, designedResolution: Size): any;
  11506. /**
  11507. !#en
  11508. Manipulation after applying the strategy
  11509. !#zh 策略调用之后的操作
  11510. @param view The target view
  11511. */
  11512. postApply(view: View): void;
  11513. }
  11514. /** undefined */
  11515. export class EqualToFrame extends ContainerStrategy {
  11516. }
  11517. /** undefined */
  11518. export class ProportionalToFrame extends ContainerStrategy {
  11519. }
  11520. /** undefined */
  11521. export class EqualToWindow extends EqualToFrame {
  11522. }
  11523. /** undefined */
  11524. export class ProportionalToWindow extends ProportionalToFrame {
  11525. }
  11526. /** undefined */
  11527. export class OriginalContainer extends ContainerStrategy {
  11528. }
  11529. /** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,
  11530. its main task is to maintain the compatibility with Cocos2d-x</p> */
  11531. export class ResolutionPolicy {
  11532. /**
  11533. @param containerStg The container strategy
  11534. @param contentStg The content strategy
  11535. */
  11536. constructor(containerStg: ContainerStrategy, contentStg: ContentStrategy);
  11537. /**
  11538. !#en Manipulation before applying the resolution policy
  11539. !#zh 策略应用前的操作
  11540. @param view The target view
  11541. */
  11542. preApply(view: View): void;
  11543. /**
  11544. !#en Function to apply this resolution policy
  11545. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  11546. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  11547. !#zh 调用策略方法
  11548. @param view The target view
  11549. @param designedResolution The user defined design resolution
  11550. */
  11551. apply(view: View, designedResolution: Size): any;
  11552. /**
  11553. !#en Manipulation after appyling the strategy
  11554. !#zh 策略应用之后的操作
  11555. @param view The target view
  11556. */
  11557. postApply(view: View): void;
  11558. /**
  11559. !#en
  11560. Setup the container's scale strategy
  11561. !#zh 设置容器的适配策略
  11562. @param containerStg containerStg
  11563. */
  11564. setContainerStrategy(containerStg: ContainerStrategy): void;
  11565. /**
  11566. !#en
  11567. Setup the content's scale strategy
  11568. !#zh 设置内容的适配策略
  11569. @param contentStg contentStg
  11570. */
  11571. setContentStrategy(contentStg: ContentStrategy): void;
  11572. /** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>
  11573. Distortion can occur, and the application may appear stretched or compressed. */
  11574. static EXACT_FIT: number;
  11575. /** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>
  11576. while maintaining the original aspect ratio of the application. */
  11577. static NO_BORDER: number;
  11578. /** The entire application is visible in the specified area without distortion while maintaining the original<br/>
  11579. aspect ratio of the application. Borders can appear on two sides of the application. */
  11580. static SHOW_ALL: number;
  11581. /** The application takes the height of the design resolution size and modifies the width of the internal<br/>
  11582. canvas so that it fits the aspect ratio of the device<br/>
  11583. no distortion will occur however you must make sure your application works on different<br/>
  11584. aspect ratios */
  11585. static FIXED_HEIGHT: number;
  11586. /** The application takes the width of the design resolution size and modifies the height of the internal<br/>
  11587. canvas so that it fits the aspect ratio of the device<br/>
  11588. no distortion will occur however you must make sure your application works on different<br/>
  11589. aspect ratios */
  11590. static FIXED_WIDTH: number;
  11591. /** Unknow policy */
  11592. static UNKNOWN: number;
  11593. }
  11594. /** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,
  11595. it should represent the same rect as cc.view.getViewportRect() */
  11596. export class visibleRect {
  11597. /**
  11598. initialize
  11599. @param visibleRect visibleRect
  11600. */
  11601. static init(visibleRect: Rect): void;
  11602. /** Top left coordinate of the screen related to the game scene. */
  11603. static topLeft: Vec2;
  11604. /** Top right coordinate of the screen related to the game scene. */
  11605. static topRight: Vec2;
  11606. /** Top center coordinate of the screen related to the game scene. */
  11607. static top: Vec2;
  11608. /** Bottom left coordinate of the screen related to the game scene. */
  11609. static bottomLeft: Vec2;
  11610. /** Bottom right coordinate of the screen related to the game scene. */
  11611. static bottomRight: Vec2;
  11612. /** Bottom center coordinate of the screen related to the game scene. */
  11613. static bottom: Vec2;
  11614. /** Center coordinate of the screen related to the game scene. */
  11615. static center: Vec2;
  11616. /** Left center coordinate of the screen related to the game scene. */
  11617. static left: Vec2;
  11618. /** Right center coordinate of the screen related to the game scene. */
  11619. static right: Vec2;
  11620. /** Width of the screen. */
  11621. static width: number;
  11622. /** Height of the screen. */
  11623. static height: number;
  11624. }
  11625. /** !#en The callbacks invoker to handle and invoke callbacks by key.
  11626. !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */
  11627. export class CallbacksInvoker {
  11628. /**
  11629. !#zh
  11630. 检查指定事件是否已注册回调。
  11631. !#en
  11632. Check if the specified key has any registered callback. If a callback is also specified,
  11633. it will only return true if the callback is registered.
  11634. @param key key
  11635. @param callback callback
  11636. @param target target
  11637. */
  11638. hasEventListener(key: string, callback?: Function, target?: any): boolean;
  11639. /**
  11640. !#zh
  11641. 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  11642. !#en
  11643. Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  11644. @param keyOrTarget The event key to be removed or the target to be removed
  11645. */
  11646. removeAll(keyOrTarget: string|any): void;
  11647. /**
  11648. !#zh
  11649. 删除之前与同类型,回调,目标注册的回调。
  11650. @param key key
  11651. @param callback callback
  11652. @param target target
  11653. */
  11654. off(key: string, callback: Function, target?: any): void;
  11655. /**
  11656. !#en
  11657. Trigger an event directly with the event name and necessary arguments.
  11658. !#zh
  11659. 通过事件名发送自定义事件
  11660. @param key event type
  11661. @param arg1 First argument
  11662. @param arg2 Second argument
  11663. @param arg3 Third argument
  11664. @param arg4 Fourth argument
  11665. @param arg5 Fifth argument
  11666. @example
  11667. ```js
  11668. eventTarget.emit('fire', event);
  11669. eventTarget.emit('fire', message, emitter);
  11670. ```
  11671. */
  11672. emit(key: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  11673. }
  11674. /** !#en Contains information collected during deserialization
  11675. !#zh 包含反序列化时的一些信息 */
  11676. export class Details {
  11677. /** list of the depends assets' uuid */
  11678. uuidList: string[];
  11679. /** the obj list whose field needs to load asset by uuid */
  11680. uuidObjList: any[];
  11681. /** the corresponding field name which referenced to the asset */
  11682. uuidPropList: string[];
  11683. reset(): void;
  11684. /**
  11685. @param obj obj
  11686. @param propName propName
  11687. @param uuid uuid
  11688. */
  11689. push(obj: any, propName: string, uuid: string): void;
  11690. }
  11691. /** !#en
  11692. Representation of RGBA colors.
  11693. Each color component is a floating point value with a range from 0 to 255.
  11694. You can also use the convenience method {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} to create a new Color.
  11695. !#zh
  11696. cc.Color 用于表示颜色。
  11697. 它包含 RGBA 四个以浮点数保存的颜色分量,每个的值都在 0 到 255 之间。
  11698. 您也可以通过使用 {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */
  11699. export class Color extends ValueType {
  11700. /** !#en Solid white, RGBA is [255, 255, 255, 255].
  11701. !#zh 纯白色,RGBA 是 [255, 255, 255, 255]。 */
  11702. static WHITE: Color;
  11703. /** !#en Solid black, RGBA is [0, 0, 0, 255].
  11704. !#zh 纯黑色,RGBA 是 [0, 0, 0, 255]。 */
  11705. static BLACK: Color;
  11706. /** !#en Transparent, RGBA is [0, 0, 0, 0].
  11707. !#zh 透明,RGBA 是 [0, 0, 0, 0]。 */
  11708. static TRANSPARENT: Color;
  11709. /** !#en Grey, RGBA is [127.5, 127.5, 127.5].
  11710. !#zh 灰色,RGBA 是 [127.5, 127.5, 127.5]。 */
  11711. static GRAY: Color;
  11712. /** !#en Solid red, RGBA is [255, 0, 0].
  11713. !#zh 纯红色,RGBA 是 [255, 0, 0]。 */
  11714. static RED: Color;
  11715. /** !#en Solid green, RGBA is [0, 255, 0].
  11716. !#zh 纯绿色,RGBA 是 [0, 255, 0]。 */
  11717. static GREEN: Color;
  11718. /** !#en Solid blue, RGBA is [0, 0, 255].
  11719. !#zh 纯蓝色,RGBA 是 [0, 0, 255]。 */
  11720. static BLUE: Color;
  11721. /** !#en Yellow, RGBA is [255, 235, 4].
  11722. !#zh 黄色,RGBA 是 [255, 235, 4]。 */
  11723. static YELLOW: Color;
  11724. /** !#en Orange, RGBA is [255, 127, 0].
  11725. !#zh 橙色,RGBA 是 [255, 127, 0]。 */
  11726. static ORANGE: Color;
  11727. /** !#en Cyan, RGBA is [0, 255, 255].
  11728. !#zh 青色,RGBA 是 [0, 255, 255]。 */
  11729. static CYAN: Color;
  11730. /** !#en Magenta, RGBA is [255, 0, 255].
  11731. !#zh 洋红色(品红色),RGBA 是 [255, 0, 255]。 */
  11732. static MAGENTA: Color;
  11733. /**
  11734. Copy content of a color into another.
  11735. */
  11736. static copy (out: Color, a: Color): Color;
  11737. /**
  11738. Clone a new color.
  11739. */
  11740. static clone (a: Color): Color;
  11741. /**
  11742. Set the components of a color to the given values.
  11743. */
  11744. static set (out: Color, r = 255, g = 255, b = 255, a = 255): Color;
  11745. /**
  11746. Converts the hexadecimal formal color into rgb formal.
  11747. */
  11748. static fromHex (out: Color, hex: number): Color;
  11749. /**
  11750. Add components of two colors, respectively.
  11751. */
  11752. static add (out: Color, a: Color, b: Color): Color;
  11753. /**
  11754. Subtract components of color b from components of color a, respectively.
  11755. */
  11756. static subtract (out: Color, a: Color, b: Color): Color;
  11757. /**
  11758. Multiply components of two colors, respectively.
  11759. */
  11760. static multiply (out: Color, a: Color, b: Color): Color;
  11761. /**
  11762. Divide components of color a by components of color b, respectively.
  11763. */
  11764. static divide (out: Color, a: Color, b: Color): Color;
  11765. /**
  11766. Scales a color by a number.
  11767. */
  11768. static scale (out: Color, a: Color, b: number): Color;
  11769. /**
  11770. Performs a linear interpolation between two colors.
  11771. */
  11772. static lerp (out: Color, a: Color, b: Color, t: number): Color;
  11773. /**
  11774. !#zh 颜色转数组
  11775. !#en Turn an array of colors
  11776. @param ofs 数组起始偏移量
  11777. */
  11778. static toArray <Out extends IWritableArrayLike<number>> (out: Out, a: IColorLike, ofs = 0);
  11779. /**
  11780. !#zh 数组转颜色
  11781. !#en An array of colors turn
  11782. @param ofs 数组起始偏移量
  11783. */
  11784. static fromArray <Out extends IColorLike> (arr: IWritableArrayLike<number>, out: Out, ofs = 0);
  11785. /**
  11786. @param r red component of the color, default value is 0.
  11787. @param g green component of the color, defualt value is 0.
  11788. @param b blue component of the color, default value is 0.
  11789. @param a alpha component of the color, default value is 255.
  11790. */
  11791. constructor(r?: number, g?: number, b?: number, a?: number);
  11792. /**
  11793. !#en Clone a new color from the current color.
  11794. !#zh 克隆当前颜色。
  11795. @example
  11796. ```js
  11797. var color = new cc.Color();
  11798. var newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}
  11799. ```
  11800. */
  11801. clone(): Color;
  11802. /**
  11803. !#en TODO
  11804. !#zh 判断两个颜色是否相等。
  11805. @param other other
  11806. @example
  11807. ```js
  11808. var color1 = cc.Color.WHITE;
  11809. var color2 = new cc.Color(255, 255, 255);
  11810. cc.log(color1.equals(color2)); // true;
  11811. color2 = cc.Color.RED;
  11812. cc.log(color2.equals(color1)); // false;
  11813. ```
  11814. */
  11815. equals(other: Color): boolean;
  11816. /**
  11817. !#en TODO
  11818. !#zh 线性插值
  11819. @param to to
  11820. @param ratio the interpolation coefficient.
  11821. @param out optional, the receiving vector.
  11822. @example
  11823. ```js
  11824. // Converts a white color to a black one trough time.
  11825. update: function (dt) {
  11826. var color = this.node.color;
  11827. if (color.equals(cc.Color.BLACK)) {
  11828. return;
  11829. }
  11830. this.ratio += dt * 0.1;
  11831. this.node.color = cc.Color.WHITE.lerp(cc.Color.BLACK, ratio);
  11832. }
  11833. ```
  11834. */
  11835. lerp(to: Color, ratio: number, out?: Color): Color;
  11836. /**
  11837. !#en TODO
  11838. !#zh 转换为方便阅读的字符串。
  11839. @example
  11840. ```js
  11841. var color = cc.Color.WHITE;
  11842. color.toString(); // "rgba(255, 255, 255, 255)"
  11843. ```
  11844. */
  11845. toString(): string;
  11846. /** !#en Get or set red channel value
  11847. !#zh 获取或者设置红色通道 */
  11848. r: number;
  11849. /** !#en Get or set green channel value
  11850. !#zh 获取或者设置绿色通道 */
  11851. g: number;
  11852. /** !#en Get or set blue channel value
  11853. !#zh 获取或者设置蓝色通道 */
  11854. b: number;
  11855. /** !#en Get or set alpha channel value
  11856. !#zh 获取或者设置透明通道 */
  11857. a: number;
  11858. /**
  11859. !#en Gets red channel value
  11860. !#zh 获取当前颜色的红色值。
  11861. */
  11862. getR(): number;
  11863. /**
  11864. !#en Sets red value and return the current color object
  11865. !#zh 设置当前的红色值,并返回当前对象。
  11866. @param red the new Red component.
  11867. @example
  11868. ```js
  11869. var color = new cc.Color();
  11870. color.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}
  11871. ```
  11872. */
  11873. setR(red: number): Color;
  11874. /**
  11875. !#en Gets green channel value
  11876. !#zh 获取当前颜色的绿色值。
  11877. */
  11878. getG(): number;
  11879. /**
  11880. !#en Sets green value and return the current color object
  11881. !#zh 设置当前的绿色值,并返回当前对象。
  11882. @param green the new Green component.
  11883. @example
  11884. ```js
  11885. var color = new cc.Color();
  11886. color.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}
  11887. ```
  11888. */
  11889. setG(green: number): Color;
  11890. /**
  11891. !#en Gets blue channel value
  11892. !#zh 获取当前颜色的蓝色值。
  11893. */
  11894. getB(): number;
  11895. /**
  11896. !#en Sets blue value and return the current color object
  11897. !#zh 设置当前的蓝色值,并返回当前对象。
  11898. @param blue the new Blue component.
  11899. @example
  11900. ```js
  11901. var color = new cc.Color();
  11902. color.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}
  11903. ```
  11904. */
  11905. setB(blue: number): Color;
  11906. /**
  11907. !#en Gets alpha channel value
  11908. !#zh 获取当前颜色的透明度值。
  11909. */
  11910. getA(): number;
  11911. /**
  11912. !#en Sets alpha value and return the current color object
  11913. !#zh 设置当前的透明度,并返回当前对象。
  11914. @param alpha the new Alpha component.
  11915. @example
  11916. ```js
  11917. var color = new cc.Color();
  11918. color.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}
  11919. ```
  11920. */
  11921. setA(alpha: number): Color;
  11922. /**
  11923. !#en Convert color to css format.
  11924. !#zh 转换为 CSS 格式。
  11925. @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  11926. @example
  11927. ```js
  11928. var color = cc.Color.BLACK;
  11929. color.toCSS(); // "rgba(0,0,0,1.00)";
  11930. color.toCSS("rgba"); // "rgba(0,0,0,1.00)";
  11931. color.toCSS("rgb"); // "rgba(0,0,0)";
  11932. color.toCSS("#rgb"); // "#000";
  11933. color.toCSS("#rrggbb"); // "#000000";
  11934. ```
  11935. */
  11936. toCSS(opt?: string): string;
  11937. /**
  11938. !#en Read hex string and store color data into the current color object, the hex string must be formated as rgba or rgb.
  11939. !#zh 读取 16 进制颜色。
  11940. @param hexString hexString
  11941. @example
  11942. ```js
  11943. var color = cc.Color.BLACK;
  11944. color.fromHEX("#FFFF33"); // Color {r: 255, g: 255, b: 51, a: 255};
  11945. ```
  11946. */
  11947. fromHEX(hexString: string): Color;
  11948. /**
  11949. !#en convert Color to HEX color string.
  11950. !#zh 转换为 16 进制。
  11951. @param fmt "#rgb", "#rrggbb" or "#rrggbbaa".
  11952. @example
  11953. ```js
  11954. var color = cc.Color.BLACK;
  11955. color.toHEX("#rgb"); // "000";
  11956. color.toHEX("#rrggbb"); // "000000";
  11957. ```
  11958. */
  11959. toHEX(fmt?: string): string;
  11960. /**
  11961. !#en Convert to 24bit rgb value.
  11962. !#zh 转换为 24bit 的 RGB 值。
  11963. @example
  11964. ```js
  11965. var color = cc.Color.YELLOW;
  11966. color.toRGBValue(); // 16771844;
  11967. ```
  11968. */
  11969. toRGBValue(): number;
  11970. /**
  11971. !#en Read HSV model color and convert to RGB color
  11972. !#zh 读取 HSV(色彩模型)格式。
  11973. @param h h
  11974. @param s s
  11975. @param v v
  11976. @example
  11977. ```js
  11978. var color = cc.Color.YELLOW;
  11979. color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  11980. ```
  11981. */
  11982. fromHSV(h: number, s: number, v: number): Color;
  11983. /**
  11984. !#en Transform to HSV model color
  11985. !#zh 转换为 HSV(色彩模型)格式。
  11986. @example
  11987. ```js
  11988. var color = cc.Color.YELLOW;
  11989. color.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};
  11990. ```
  11991. */
  11992. toHSV(): any;
  11993. /**
  11994. !#en Set the color
  11995. !#zh 设置颜色
  11996. @param color color
  11997. */
  11998. set (color: Color): Color;
  11999. /**
  12000. !#en Multiplies the current color by the specified color
  12001. !#zh 将当前颜色乘以与指定颜色
  12002. @param other other
  12003. */
  12004. multiply(other: Color): Color;
  12005. }
  12006. /** !#en Representation of 4*4 matrix.
  12007. !#zh 表示 4*4 矩阵 */
  12008. export class Mat4 extends ValueType {
  12009. /**
  12010. !#en Multiply the current matrix with another one
  12011. !#zh 将当前矩阵与指定矩阵相乘
  12012. @param other the second operand
  12013. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12014. */
  12015. mul(other: Mat4, out?: Mat4): Mat4;
  12016. /**
  12017. !#en Multiply each element of the matrix by a scalar.
  12018. !#zh 将矩阵的每一个元素都乘以指定的缩放值。
  12019. @param number amount to scale the matrix's elements by
  12020. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12021. */
  12022. mulScalar(number: number, out?: Mat4): Mat4;
  12023. /**
  12024. !#en Subtracts the current matrix with another one
  12025. !#zh 将当前矩阵与指定的矩阵相减
  12026. @param other the second operand
  12027. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12028. */
  12029. sub(other: Mat4, out?: Mat4): Mat4;
  12030. /** Identity of Mat4 */
  12031. static IDENTITY: Mat4;
  12032. /**
  12033. !#zh 获得指定矩阵的拷贝
  12034. !#en Copy of the specified matrix to obtain
  12035. */
  12036. static clone<Out extends IMat4Like> (a: Out);
  12037. /**
  12038. !#zh 复制目标矩阵
  12039. !#en Copy the target matrix
  12040. */
  12041. static copy<Out extends IMat4Like> (out: Out, a: Out);
  12042. /**
  12043. !#zh 将目标赋值为单位矩阵
  12044. !#en The target of an assignment is the identity matrix
  12045. */
  12046. static identity<Out extends IMat4Like> (out: Out);
  12047. /**
  12048. !#zh 转置矩阵
  12049. !#en Transposed matrix
  12050. */
  12051. static transpose<Out extends IMat4Like> (out: Out, a: Out);
  12052. /**
  12053. !#zh 矩阵求逆
  12054. !#en Matrix inversion
  12055. */
  12056. static invert<Out extends IMat4Like> (out: Out, a: Out);
  12057. /**
  12058. !#zh 矩阵行列式
  12059. !#en Matrix determinant
  12060. */
  12061. static determinant<Out extends IMat4Like> (a: Out): number;
  12062. /**
  12063. !#zh 矩阵乘法
  12064. !#en Matrix Multiplication
  12065. */
  12066. static multiply<Out extends IMat4Like> (out: Out, a: Out, b: Out);
  12067. /**
  12068. !#zh 在给定矩阵变换基础上加入变换
  12069. !#en Was added in a given transformation matrix transformation on the basis of
  12070. */
  12071. static transform<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike);
  12072. /**
  12073. !#zh 在给定矩阵变换基础上加入新位移变换
  12074. !#en Add new displacement transducer in a matrix transformation on the basis of a given
  12075. */
  12076. static translate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike);
  12077. /**
  12078. !#zh 在给定矩阵变换基础上加入新缩放变换
  12079. !#en Add new scaling transformation in a given matrix transformation on the basis of
  12080. */
  12081. static scale<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike);
  12082. /**
  12083. !#zh 在给定矩阵变换基础上加入新旋转变换
  12084. !#en Add a new rotational transform matrix transformation on the basis of a given
  12085. @param rad 旋转角度
  12086. @param axis 旋转轴
  12087. */
  12088. static rotate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, rad: number, axis: VecLike);
  12089. /**
  12090. !#zh 在给定矩阵变换基础上加入绕 X 轴的旋转变换
  12091. !#en Add rotational transformation around the X axis at a given matrix transformation on the basis of
  12092. @param rad 旋转角度
  12093. */
  12094. static rotateX<Out extends IMat4Like> (out: Out, a: Out, rad: number);
  12095. /**
  12096. !#zh 在给定矩阵变换基础上加入绕 Y 轴的旋转变换
  12097. !#en Add about the Y axis rotation transformation in a given matrix transformation on the basis of
  12098. @param rad 旋转角度
  12099. */
  12100. static rotateY<Out extends IMat4Like> (out: Out, a: Out, rad: number);
  12101. /**
  12102. !#zh 在给定矩阵变换基础上加入绕 Z 轴的旋转变换
  12103. !#en Added about the Z axis at a given rotational transformation matrix transformation on the basis of
  12104. @param rad 旋转角度
  12105. */
  12106. static rotateZ<Out extends IMat4Like> (out: Out, a: Out, rad: number);
  12107. /**
  12108. !#zh 计算位移矩阵
  12109. !#en Displacement matrix calculation
  12110. */
  12111. static fromTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike);
  12112. /**
  12113. !#zh 计算缩放矩阵
  12114. !#en Scaling matrix calculation
  12115. */
  12116. static fromScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike);
  12117. /**
  12118. !#zh 计算旋转矩阵
  12119. !#en Calculates the rotation matrix
  12120. */
  12121. static fromRotation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, rad: number, axis: VecLike);
  12122. /**
  12123. !#zh 计算绕 X 轴的旋转矩阵
  12124. !#en Calculating rotation matrix about the X axis
  12125. */
  12126. static fromXRotation<Out extends IMat4Like> (out: Out, rad: number);
  12127. /**
  12128. !#zh 计算绕 Y 轴的旋转矩阵
  12129. !#en Calculating rotation matrix about the Y axis
  12130. */
  12131. static fromYRotation<Out extends IMat4Like> (out: Out, rad: number);
  12132. /**
  12133. !#zh 计算绕 Z 轴的旋转矩阵
  12134. !#en Calculating rotation matrix about the Z axis
  12135. */
  12136. static fromZRotation<Out extends IMat4Like> (out: Out, rad: number);
  12137. /**
  12138. !#zh 根据旋转和位移信息计算矩阵
  12139. !#en The rotation and displacement information calculating matrix
  12140. */
  12141. static fromRT<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike);
  12142. /**
  12143. !#zh 提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12144. !#en Extracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T is
  12145. */
  12146. static getTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out);
  12147. /**
  12148. !#zh 提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12149. !#en Scaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T is
  12150. */
  12151. static getScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out);
  12152. /**
  12153. !#zh 提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用 `toRTS` 函数。
  12154. !#en Rotation information extraction matrix, the matrix containing no default input scaling information, such as the use of `toRTS` should consider the scaling function.
  12155. */
  12156. static getRotation<Out extends IMat4Like> (out: Quat, mat: Out);
  12157. /**
  12158. !#zh 提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12159. !#en Extracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applications
  12160. */
  12161. static toRTS<Out extends IMat4Like, VecLike extends IVec3Like> (mat: Out, q: Quat, v: VecLike, s: VecLike);
  12162. /**
  12163. !#zh 根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
  12164. !#en The rotary displacement, the scaling matrix calculation information, the order S-> R-> T applications
  12165. */
  12166. static fromRTS<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike);
  12167. /**
  12168. !#zh 根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用
  12169. !#en According to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applications
  12170. @param q 旋转值
  12171. @param v 位移值
  12172. @param s 缩放值
  12173. @param o 指定变换中心
  12174. */
  12175. static fromRTSOrigin<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike);
  12176. /**
  12177. !#zh 根据指定的旋转信息计算矩阵
  12178. !#en The rotation matrix calculation information specified
  12179. */
  12180. static fromQuat<Out extends IMat4Like> (out: Out, q: Quat);
  12181. /**
  12182. !#zh 根据指定的视锥体信息计算矩阵
  12183. !#en The matrix calculation information specified frustum
  12184. @param left 左平面距离
  12185. @param right 右平面距离
  12186. @param bottom 下平面距离
  12187. @param top 上平面距离
  12188. @param near 近平面距离
  12189. @param far 远平面距离
  12190. */
  12191. static frustum<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number);
  12192. /**
  12193. !#zh 计算透视投影矩阵
  12194. !#en Perspective projection matrix calculation
  12195. @param fovy 纵向视角高度
  12196. @param aspect 长宽比
  12197. @param near 近平面距离
  12198. @param far 远平面距离
  12199. */
  12200. static perspective<Out extends IMat4Like> (out: Out, fovy: number, aspect: number, near: number, far: number);
  12201. /**
  12202. !#zh 计算正交投影矩阵
  12203. !#en Computing orthogonal projection matrix
  12204. @param left 左平面距离
  12205. @param right 右平面距离
  12206. @param bottom 下平面距离
  12207. @param top 上平面距离
  12208. @param near 近平面距离
  12209. @param far 远平面距离
  12210. */
  12211. static ortho<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number);
  12212. /**
  12213. !#zh 根据视点计算矩阵,注意 `eye - center` 不能为零向量或与 `up` 向量平行
  12214. !#en `Up` parallel vector or vector center` not be zero - the matrix calculation according to the viewpoint, note` eye
  12215. @param eye 当前位置
  12216. @param center 目标视点
  12217. @param up 视口上方向
  12218. */
  12219. static lookAt<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, eye: VecLike, center: VecLike, up: VecLike);
  12220. /**
  12221. !#zh 计算逆转置矩阵
  12222. !#en Reversal matrix calculation
  12223. */
  12224. static inverseTranspose<Out extends IMat4Like> (out: Out, a: Out);
  12225. /**
  12226. !#zh 逐元素矩阵加法
  12227. !#en Element by element matrix addition
  12228. */
  12229. static add<Out extends IMat4Like> (out: Out, a: Out, b: Out);
  12230. /**
  12231. !#zh 逐元素矩阵减法
  12232. !#en Matrix element by element subtraction
  12233. */
  12234. static subtract<Out extends IMat4Like> (out: Out, a: Out, b: Out);
  12235. /**
  12236. !#zh 矩阵标量乘法
  12237. !#en Matrix scalar multiplication
  12238. */
  12239. static multiplyScalar<Out extends IMat4Like> (out: Out, a: Out, b: number);
  12240. /**
  12241. !#zh 逐元素矩阵标量乘加: A + B * scale
  12242. !#en Elements of the matrix by the scalar multiplication and addition: A + B * scale
  12243. */
  12244. static multiplyScalarAndAdd<Out extends IMat4Like> (out: Out, a: Out, b: Out, scale: number);
  12245. /**
  12246. !#zh 矩阵等价判断
  12247. !#en Analyzing the equivalent matrix
  12248. */
  12249. static strictEquals<Out extends IMat4Like> (a: Out, b: Out);
  12250. /**
  12251. !#zh 排除浮点数误差的矩阵近似等价判断
  12252. !#en Negative floating point error is approximately equivalent to determining a matrix
  12253. */
  12254. static equals<Out extends IMat4Like> (a: Out, b: Out, epsilon = EPSILON);
  12255. /**
  12256. !#zh 矩阵转数组
  12257. !#en Matrix transpose array
  12258. @param ofs 数组内的起始偏移量
  12259. */
  12260. static toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat4Like, ofs = 0);
  12261. /**
  12262. !#zh 数组转矩阵
  12263. !#en Transfer matrix array
  12264. @param ofs 数组起始偏移量
  12265. */
  12266. static fromArray <Out extends IMat4Like> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  12267. /** !#en Matrix Data
  12268. !#zh 矩阵数据 */
  12269. m: Float64Array|Float32Array;
  12270. /**
  12271. !#en
  12272. Constructor
  12273. see {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  12274. !#zh
  12275. 构造函数,可查看 {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  12276. */
  12277. constructor ( m00: number = 1, m01: number = 0, m02: number = 0, m03: number = 0, m10: number = 0, m11: number = 1, m12: number = 0, m13: number = 0, m20: number = 0, m21: number = 0, m22: number = 1, m23: number = 0, m30: number = 0, m31: number = 0, m32: number = 0, m33: number = 1);
  12278. /**
  12279. !#en clone a Mat4 object
  12280. !#zh 克隆一个 Mat4 对象
  12281. */
  12282. clone(): Mat4;
  12283. /**
  12284. !#en Sets the matrix with another one's value
  12285. !#zh 用另一个矩阵设置这个矩阵的值。
  12286. @param srcObj srcObj
  12287. */
  12288. set(srcObj: Mat4): Mat4;
  12289. /**
  12290. !#en Check whether two matrix equal
  12291. !#zh 当前的矩阵是否与指定的矩阵相等。
  12292. @param other other
  12293. */
  12294. equals(other: Mat4): boolean;
  12295. /**
  12296. !#en Check whether two matrix equal with default degree of variance.
  12297. !#zh
  12298. 近似判断两个矩阵是否相等。<br/>
  12299. 判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
  12300. @param other other
  12301. */
  12302. fuzzyEquals(other: Mat4): boolean;
  12303. /**
  12304. !#en Transform to string with matrix informations
  12305. !#zh 转换为方便阅读的字符串。
  12306. */
  12307. toString(): string;
  12308. /**
  12309. Set the matrix to the identity matrix
  12310. */
  12311. identity(): Mat4;
  12312. /**
  12313. Transpose the values of a mat4
  12314. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12315. */
  12316. transpose(out?: Mat4): Mat4;
  12317. /**
  12318. Inverts a mat4
  12319. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12320. */
  12321. invert(out?: Mat4): Mat4;
  12322. /**
  12323. Calculates the adjugate of a mat4
  12324. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12325. */
  12326. adjoint(out?: Mat4): Mat4;
  12327. /**
  12328. Calculates the determinant of a mat4
  12329. */
  12330. determinant(): number;
  12331. /**
  12332. Adds two Mat4
  12333. @param other the second operand
  12334. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12335. */
  12336. add(other: Mat4, out?: Mat4): Mat4;
  12337. /**
  12338. Subtracts the current matrix with another one
  12339. @param other the second operand
  12340. */
  12341. subtract(other: Mat4): Mat4;
  12342. /**
  12343. Subtracts the current matrix with another one
  12344. @param other the second operand
  12345. */
  12346. multiply(other: Mat4): Mat4;
  12347. /**
  12348. Multiply each element of the matrix by a scalar.
  12349. @param number amount to scale the matrix's elements by
  12350. */
  12351. multiplyScalar(number: number): Mat4;
  12352. /**
  12353. Translate a mat4 by the given vector
  12354. @param v vector to translate by
  12355. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12356. */
  12357. translate(v: Vec3, out?: Mat4): Mat4;
  12358. /**
  12359. Scales the mat4 by the dimensions in the given vec3
  12360. @param v vector to scale by
  12361. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12362. */
  12363. scale(v: Vec3, out?: Mat4): Mat4;
  12364. /**
  12365. Rotates a mat4 by the given angle around the given axis
  12366. @param rad the angle to rotate the matrix by
  12367. @param axis the axis to rotate around
  12368. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12369. */
  12370. rotate(rad: number, axis: Vec3, out?: Mat4): Mat4;
  12371. /**
  12372. Returns the translation vector component of a transformation matrix.
  12373. @param out Vector to receive translation component, if not provided, a new vec3 will be created
  12374. */
  12375. getTranslation(out: Vec3): Vec3;
  12376. /**
  12377. Returns the scale factor component of a transformation matrix
  12378. @param out Vector to receive scale component, if not provided, a new vec3 will be created
  12379. */
  12380. getScale(out: Vec3): Vec3;
  12381. /**
  12382. Returns the rotation factor component of a transformation matrix
  12383. @param out Vector to receive rotation component, if not provided, a new quaternion object will be created
  12384. */
  12385. getRotation(out: Quat): Quat;
  12386. /**
  12387. Restore the matrix values from a quaternion rotation, vector translation and vector scale
  12388. @param q Rotation quaternion
  12389. @param v Translation vector
  12390. @param s Scaling vector
  12391. */
  12392. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  12393. /**
  12394. Restore the matrix values from a quaternion rotation
  12395. @param q Rotation quaternion
  12396. */
  12397. fromQuat(q: Quat): Mat4;
  12398. }
  12399. /** !#en Representation of 2D vectors and points.
  12400. !#zh 表示 2D 向量和坐标 */
  12401. export class Quat extends ValueType {
  12402. /**
  12403. !#en
  12404. Constructor
  12405. see {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  12406. !#zh
  12407. 构造函数,可查看 {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  12408. @param x x
  12409. @param y y
  12410. @param z z
  12411. @param w w
  12412. */
  12413. constructor(x?: number, y?: number, z?: number, w?: number);
  12414. /**
  12415. !#en Calculate the multiply result between this quaternion and another one
  12416. !#zh 计算四元数乘积的结果
  12417. @param other other
  12418. @param out out
  12419. */
  12420. mul(other: Quat, out?: Quat): Quat;
  12421. /**
  12422. !#zh 获得指定四元数的拷贝
  12423. !#en Obtaining copy specified quaternion
  12424. */
  12425. static clone<Out extends IQuatLike> (a: Out);
  12426. /**
  12427. !#zh 复制目标四元数
  12428. !#en Copy quaternion target
  12429. */
  12430. static copy<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike);
  12431. /**
  12432. !#zh 设置四元数值
  12433. !#en Provided Quaternion Value
  12434. */
  12435. static set<Out extends IQuatLike> (out: Out, x: number, y: number, z: number, w: number);
  12436. /**
  12437. !#zh 将目标赋值为单位四元数
  12438. !#en The target of an assignment as a unit quaternion
  12439. */
  12440. static identity<Out extends IQuatLike> (out: Out);
  12441. /**
  12442. !#zh 设置四元数为两向量间的最短路径旋转,默认两向量都已归一化
  12443. !#en Set quaternion rotation is the shortest path between two vectors, the default two vectors are normalized
  12444. */
  12445. static rotationTo<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, a: VecLike, b: VecLike);
  12446. /**
  12447. !#zh 获取四元数的旋转轴和旋转弧度
  12448. !#en Get the rotary shaft and the arc of rotation quaternion
  12449. @param outAxis 旋转轴输出
  12450. @param q 源四元数
  12451. */
  12452. static getAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (outAxis: VecLike, q: Out);
  12453. /**
  12454. !#zh 四元数乘法
  12455. !#en Quaternion multiplication
  12456. */
  12457. static multiply<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike> (out: Out, a: QuatLike_1, b: QuatLike_2);
  12458. /**
  12459. !#zh 四元数标量乘法
  12460. !#en Quaternion scalar multiplication
  12461. */
  12462. static multiplyScalar<Out extends IQuatLike> (out: Out, a: Out, b: number);
  12463. /**
  12464. !#zh 四元数乘加:A + B * scale
  12465. !#en Quaternion multiplication and addition: A + B * scale
  12466. */
  12467. static scaleAndAdd<Out extends IQuatLike> (out: Out, a: Out, b: Out, scale: number);
  12468. /**
  12469. !#zh 绕 X 轴旋转指定四元数
  12470. !#en About the X axis specified quaternion
  12471. @param rad 旋转弧度
  12472. */
  12473. static rotateX<Out extends IQuatLike> (out: Out, a: Out, rad: number);
  12474. /**
  12475. !#zh 绕 Y 轴旋转指定四元数
  12476. !#en Rotation about the Y axis designated quaternion
  12477. @param rad 旋转弧度
  12478. */
  12479. static rotateY<Out extends IQuatLike> (out: Out, a: Out, rad: number);
  12480. /**
  12481. !#zh 绕 Z 轴旋转指定四元数
  12482. !#en Around the Z axis specified quaternion
  12483. @param rad 旋转弧度
  12484. */
  12485. static rotateZ<Out extends IQuatLike> (out: Out, a: Out, rad: number);
  12486. /**
  12487. !#zh 绕世界空间下指定轴旋转四元数
  12488. !#en Space around the world at a given axis of rotation quaternion
  12489. @param axis 旋转轴,默认已归一化
  12490. @param rad 旋转弧度
  12491. */
  12492. static rotateAround<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number);
  12493. /**
  12494. !#zh 绕本地空间下指定轴旋转四元数
  12495. !#en Local space around the specified axis rotation quaternion
  12496. @param axis 旋转轴
  12497. @param rad 旋转弧度
  12498. */
  12499. static rotateAroundLocal<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number);
  12500. /**
  12501. !#zh 根据 xyz 分量计算 w 分量,默认已归一化
  12502. !#en The component w xyz components calculated, normalized by default
  12503. */
  12504. static calculateW<Out extends IQuatLike> (out: Out, a: Out);
  12505. /**
  12506. !#zh 四元数点积(数量积)
  12507. !#en Quaternion dot product (scalar product)
  12508. */
  12509. static dot<Out extends IQuatLike> (a: Out, b: Out);
  12510. /**
  12511. !#zh 逐元素线性插值: A + t * (B - A)
  12512. !#en Element by element linear interpolation: A + t * (B - A)
  12513. */
  12514. static lerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, t: number);
  12515. /**
  12516. !#zh 带两个控制点的四元数球面插值
  12517. !#en Quaternion with two spherical interpolation control points
  12518. */
  12519. static sqlerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, c: Out, d: Out, t: number);
  12520. /**
  12521. !#zh 四元数求逆
  12522. !#en Quaternion inverse
  12523. */
  12524. static invert<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike);
  12525. /**
  12526. !#zh 求共轭四元数,对单位四元数与求逆等价,但更高效
  12527. !#en Conjugating a quaternion, and the unit quaternion equivalent to inversion, but more efficient
  12528. */
  12529. static conjugate<Out extends IQuatLike> (out: Out, a: Out);
  12530. /**
  12531. !#zh 求四元数长度
  12532. !#en Seek length quaternion
  12533. */
  12534. static len<Out extends IQuatLike> (a: Out);
  12535. /**
  12536. !#zh 求四元数长度平方
  12537. !#en Seeking quaternion square of the length
  12538. */
  12539. static lengthSqr<Out extends IQuatLike> (a: Out);
  12540. /**
  12541. !#zh 归一化四元数
  12542. !#en Normalized quaternions
  12543. */
  12544. static normalize<Out extends IQuatLike> (out: Out, a: Out);
  12545. /**
  12546. !#zh 根据本地坐标轴朝向计算四元数,默认三向量都已归一化且相互垂直
  12547. !#en Calculated according to the local orientation quaternion coordinate axis, the default three vectors are normalized and mutually perpendicular
  12548. */
  12549. static fromAxes<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, xAxis: VecLike, yAxis: VecLike, zAxis: VecLike);
  12550. /**
  12551. !#zh 根据视口的前方向和上方向计算四元数
  12552. !#en The forward direction and the direction of the viewport computing quaternion
  12553. @param view 视口面向的前方向,必须归一化
  12554. @param up 视口的上方向,必须归一化,默认为 (0, 1, 0)
  12555. */
  12556. static fromViewUp<Out extends IQuatLike> (out: Out, view: Vec3, up?: Vec3);
  12557. /**
  12558. !#zh 根据旋转轴和旋转弧度计算四元数
  12559. !#en The quaternion calculated and the arc of rotation of the rotary shaft
  12560. */
  12561. static fromAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, axis: VecLike, rad: number);
  12562. /**
  12563. !#zh 根据三维矩阵信息计算四元数,默认输入矩阵不含有缩放信息
  12564. !#en Calculating the three-dimensional quaternion matrix information, default zoom information input matrix does not contain
  12565. */
  12566. static fromMat3<Out extends IQuatLike> (out: Out, mat: Mat3);
  12567. /**
  12568. !#zh 根据欧拉角信息计算四元数,旋转顺序为 YZX
  12569. !#en The quaternion calculated Euler angle information, rotation order YZX
  12570. */
  12571. static fromEuler<Out extends IQuatLike> (out: Out, x: number, y: number, z: number);
  12572. /**
  12573. !#zh 返回定义此四元数的坐标系 X 轴向量
  12574. !#en This returns the result of the quaternion coordinate system X-axis vector
  12575. */
  12576. static toAxisX<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out);
  12577. /**
  12578. !#zh 返回定义此四元数的坐标系 Y 轴向量
  12579. !#en This returns the result of the quaternion coordinate system Y axis vector
  12580. */
  12581. static toAxisY<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out);
  12582. /**
  12583. !#zh 返回定义此四元数的坐标系 Z 轴向量
  12584. !#en This returns the result of the quaternion coordinate system the Z-axis vector
  12585. */
  12586. static toAxisZ<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out);
  12587. /**
  12588. !#zh 根据四元数计算欧拉角,返回角度 x, y 在 [-180, 180] 区间内, z 默认在 [-90, 90] 区间内,旋转顺序为 YZX
  12589. !#en The quaternion calculated Euler angles, return angle x, y in the [-180, 180] interval, z default the range [-90, 90] interval, the rotation order YZX
  12590. @param outerZ z 取值范围区间改为 [-180, -90] U [90, 180]
  12591. */
  12592. static toEuler<Out extends IVec3Like> (out: Out, q: IQuatLike, outerZ?: boolean);
  12593. /**
  12594. !#zh 四元数等价判断
  12595. !#en Analyzing quaternion equivalent
  12596. */
  12597. static strictEquals<Out extends IQuatLike> (a: Out, b: Out);
  12598. /**
  12599. !#zh 排除浮点数误差的四元数近似等价判断
  12600. !#en Negative floating point error quaternion approximately equivalent Analyzing
  12601. */
  12602. static equals<Out extends IQuatLike> (a: Out, b: Out, epsilon = EPSILON);
  12603. /**
  12604. !#zh 四元数转数组
  12605. !#en Quaternion rotation array
  12606. @param ofs 数组内的起始偏移量
  12607. */
  12608. static toArray <Out extends IWritableArrayLike<number>> (out: Out, q: IQuatLike, ofs = 0);
  12609. /**
  12610. !#zh 数组转四元数
  12611. !#en Array to a quaternion
  12612. @param ofs 数组起始偏移量
  12613. */
  12614. static fromArray <Out extends IQuatLike> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  12615. x: number;
  12616. y: number;
  12617. z: number;
  12618. w: number;
  12619. /**
  12620. !#en clone a Quat object and return the new object
  12621. !#zh 克隆一个四元数并返回
  12622. */
  12623. clone(): Quat;
  12624. /**
  12625. !#en Set values with another quaternion
  12626. !#zh 用另一个四元数的值设置到当前对象上。
  12627. @param newValue !#en new value to set. !#zh 要设置的新值
  12628. */
  12629. set(newValue: Quat): Quat;
  12630. /**
  12631. !#en Check whether current quaternion equals another
  12632. !#zh 当前的四元数是否与指定的四元数相等。
  12633. @param other other
  12634. */
  12635. equals(other: Quat): boolean;
  12636. /**
  12637. !#en Convert quaternion to euler
  12638. !#zh 转换四元数到欧拉角
  12639. @param out out
  12640. */
  12641. toEuler(out: Vec3): Vec3;
  12642. /**
  12643. !#en Convert euler to quaternion
  12644. !#zh 转换欧拉角到四元数
  12645. @param euler euler
  12646. */
  12647. fromEuler(euler: Vec3): Quat;
  12648. /**
  12649. !#en Calculate the interpolation result between this quaternion and another one with given ratio
  12650. !#zh 计算四元数的插值结果
  12651. @param to to
  12652. @param ratio ratio
  12653. @param out out
  12654. */
  12655. lerp(to: Quat, ratio: number, out?: Quat): Quat;
  12656. /**
  12657. !#en Calculate the multiply result between this quaternion and another one
  12658. !#zh 计算四元数乘积的结果
  12659. @param other other
  12660. */
  12661. multiply(other: Quat): Quat;
  12662. /**
  12663. !#en Rotates a quaternion by the given angle (in radians) about a world space axis.
  12664. !#zh 围绕世界空间轴按给定弧度旋转四元数
  12665. @param rot Quaternion to rotate
  12666. @param axis The axis around which to rotate in world space
  12667. @param rad Angle (in radians) to rotate
  12668. @param out Quaternion to store result
  12669. */
  12670. rotateAround(rot: Quat, axis: Vec3, rad: number, out?: Quat): Quat;
  12671. }
  12672. /** !#en A 2D rectangle defined by x, y position and width, height.
  12673. !#zh 通过位置和宽高定义的 2D 矩形。 */
  12674. export class Rect extends ValueType {
  12675. /**
  12676. !#en
  12677. Constructor of Rect class.
  12678. see {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} for convenience method.
  12679. !#zh
  12680. Rect类的构造函数。可以通过 {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} 简便方法进行创建。
  12681. @param x x
  12682. @param y y
  12683. @param w w
  12684. @param h h
  12685. */
  12686. constructor(x?: number, y?: number, w?: number, h?: number);
  12687. /**
  12688. !#en Creates a rectangle from two coordinate values.
  12689. !#zh 根据指定 2 个坐标创建出一个矩形区域。
  12690. @param v1 v1
  12691. @param v2 v2
  12692. @example
  12693. ```js
  12694. cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
  12695. ```
  12696. */
  12697. static fromMinMax(v1: Vec2, v2: Vec2): Rect;
  12698. x: number;
  12699. y: number;
  12700. width: number;
  12701. height: number;
  12702. /**
  12703. !#en TODO
  12704. !#zh 克隆一个新的 Rect。
  12705. @example
  12706. ```js
  12707. var a = new cc.Rect(0, 0, 10, 10);
  12708. a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
  12709. ```
  12710. */
  12711. clone(): Rect;
  12712. /**
  12713. !#en TODO
  12714. !#zh 是否等于指定的矩形。
  12715. @param other other
  12716. @example
  12717. ```js
  12718. var a = new cc.Rect(0, 0, 10, 10);
  12719. var b = new cc.Rect(0, 0, 10, 10);
  12720. a.equals(b);// true;
  12721. ```
  12722. */
  12723. equals(other: Rect): boolean;
  12724. /**
  12725. !#en TODO
  12726. !#zh 线性插值
  12727. @param to to
  12728. @param ratio the interpolation coefficient.
  12729. @param out optional, the receiving vector.
  12730. @example
  12731. ```js
  12732. var a = new cc.Rect(0, 0, 10, 10);
  12733. var b = new cc.Rect(50, 50, 100, 100);
  12734. update (dt) {
  12735. // method 1;
  12736. var c = a.lerp(b, dt * 0.1);
  12737. // method 2;
  12738. a.lerp(b, dt * 0.1, c);
  12739. }
  12740. ```
  12741. */
  12742. lerp(to: Rect, ratio: number, out?: Rect): Rect;
  12743. /**
  12744. !#en Check whether the current rectangle intersects with the given one
  12745. !#zh 当前矩形与指定矩形是否相交。
  12746. @param rect rect
  12747. @example
  12748. ```js
  12749. var a = new cc.Rect(0, 0, 10, 10);
  12750. var b = new cc.Rect(0, 0, 20, 20);
  12751. a.intersects(b);// true
  12752. ```
  12753. */
  12754. intersects(rect: Rect): boolean;
  12755. /**
  12756. !#en Returns the overlapping portion of 2 rectangles.
  12757. !#zh 返回 2 个矩形重叠的部分。
  12758. @param out Stores the result
  12759. @param rectB rectB
  12760. @example
  12761. ```js
  12762. var a = new cc.Rect(0, 10, 20, 20);
  12763. var b = new cc.Rect(0, 10, 10, 10);
  12764. var intersection = new cc.Rect();
  12765. a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
  12766. ```
  12767. */
  12768. intersection(out: Rect, rectB: Rect): Rect;
  12769. /**
  12770. !#en Check whether the current rect contains the given point
  12771. !#zh 当前矩形是否包含指定坐标点。
  12772. Returns true if the point inside this rectangle.
  12773. @param point point
  12774. @example
  12775. ```js
  12776. var a = new cc.Rect(0, 0, 10, 10);
  12777. var b = new cc.Vec2(0, 5);
  12778. a.contains(b);// true
  12779. ```
  12780. */
  12781. contains(point: Vec2): boolean;
  12782. /**
  12783. !#en Returns true if the other rect totally inside this rectangle.
  12784. !#zh 当前矩形是否包含指定矩形。
  12785. @param rect rect
  12786. @example
  12787. ```js
  12788. var a = new cc.Rect(0, 0, 20, 20);
  12789. var b = new cc.Rect(0, 0, 10, 10);
  12790. a.containsRect(b);// true
  12791. ```
  12792. */
  12793. containsRect(rect: Rect): boolean;
  12794. /**
  12795. !#en Returns the smallest rectangle that contains the current rect and the given rect.
  12796. !#zh 返回一个包含当前矩形和指定矩形的最小矩形。
  12797. @param out Stores the result
  12798. @param rectB rectB
  12799. @example
  12800. ```js
  12801. var a = new cc.Rect(0, 10, 20, 20);
  12802. var b = new cc.Rect(0, 10, 10, 10);
  12803. var union = new cc.Rect();
  12804. a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
  12805. ```
  12806. */
  12807. union(out: Rect, rectB: Rect): Rect;
  12808. /**
  12809. !#en Apply matrix4 to the rect.
  12810. !#zh 使用 mat4 对矩形进行矩阵转换。
  12811. @param out The output rect
  12812. @param mat The matrix4
  12813. */
  12814. transformMat4(out: Rect, mat: Mat4): void;
  12815. /**
  12816. !#en Output rect informations to string
  12817. !#zh 转换为方便阅读的字符串
  12818. @example
  12819. ```js
  12820. var a = new cc.Rect(0, 0, 10, 10);
  12821. a.toString();// "(0.00, 0.00, 10.00, 10.00)";
  12822. ```
  12823. */
  12824. toString(): string;
  12825. /** !#en The minimum x value, equals to rect.x
  12826. !#zh 矩形 x 轴上的最小值,等价于 rect.x。 */
  12827. xMin: number;
  12828. /** !#en The minimum y value, equals to rect.y
  12829. !#zh 矩形 y 轴上的最小值。 */
  12830. yMin: number;
  12831. /** !#en The maximum x value.
  12832. !#zh 矩形 x 轴上的最大值。 */
  12833. xMax: number;
  12834. /** !#en The maximum y value.
  12835. !#zh 矩形 y 轴上的最大值。 */
  12836. yMax: number;
  12837. /** !#en The position of the center of the rectangle.
  12838. !#zh 矩形的中心点。 */
  12839. center: Vec2;
  12840. /** !#en The X and Y position of the rectangle.
  12841. !#zh 矩形的 x 和 y 坐标。 */
  12842. origin: Vec2;
  12843. /** !#en Width and height of the rectangle.
  12844. !#zh 矩形的大小。 */
  12845. size: Size;
  12846. }
  12847. /** !#en
  12848. cc.Size is the class for size object,<br/>
  12849. please do not use its constructor to create sizes,<br/>
  12850. use {{#crossLink "cc/size:method"}}{{/crossLink}} alias function instead.<br/>
  12851. It will be deprecated soon, please use cc.Vec2 instead.
  12852. !#zh
  12853. cc.Size 是 size 对象的类。<br/>
  12854. 请不要使用它的构造函数创建的 size,<br/>
  12855. 使用 {{#crossLink "cc/size:method"}}{{/crossLink}} 别名函数。<br/>
  12856. 它不久将被取消,请使用cc.Vec2代替。 */
  12857. export class Size {
  12858. /**
  12859. @param width width
  12860. @param height height
  12861. */
  12862. constructor(width: number|Size, height?: number);
  12863. /** !#en return a Size object with width = 0 and height = 0.
  12864. !#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */
  12865. static ZERO: Size;
  12866. width: number;
  12867. height: number;
  12868. /**
  12869. !#en TODO
  12870. !#zh 克隆 size 对象。
  12871. @example
  12872. ```js
  12873. var a = new cc.size(10, 10);
  12874. a.clone();// return Size {width: 0, height: 0};
  12875. ```
  12876. */
  12877. clone(): Size;
  12878. /**
  12879. !#en TODO
  12880. !#zh 当前 Size 对象是否等于指定 Size 对象。
  12881. @param other other
  12882. @example
  12883. ```js
  12884. var a = new cc.size(10, 10);
  12885. a.equals(new cc.size(10, 10));// return true;
  12886. ```
  12887. */
  12888. equals(other: Size): boolean;
  12889. /**
  12890. !#en TODO
  12891. !#zh 线性插值。
  12892. @param to to
  12893. @param ratio the interpolation coefficient.
  12894. @param out optional, the receiving vector.
  12895. @example
  12896. ```js
  12897. var a = new cc.size(10, 10);
  12898. var b = new cc.rect(50, 50, 100, 100);
  12899. update (dt) {
  12900. // method 1;
  12901. var c = a.lerp(b, dt * 0.1);
  12902. // method 2;
  12903. a.lerp(b, dt * 0.1, c);
  12904. }
  12905. ```
  12906. */
  12907. lerp(to: Rect, ratio: number, out?: Size): Size;
  12908. /**
  12909. !#en TODO
  12910. !#zh 转换为方便阅读的字符串。
  12911. @example
  12912. ```js
  12913. var a = new cc.size(10, 10);
  12914. a.toString();// return "(10.00, 10.00)";
  12915. ```
  12916. */
  12917. toString(): string;
  12918. }
  12919. /** !#en The base class of all value types.
  12920. !#zh 所有值类型的基类。 */
  12921. export class ValueType {
  12922. /**
  12923. !#en This method returns an exact copy of current value.
  12924. !#zh 克隆当前值,该方法返回一个新对象,新对象的值和原对象相等。
  12925. */
  12926. clone(): ValueType;
  12927. /**
  12928. !#en Compares this object with the other one.
  12929. !#zh 当前对象是否等于指定对象。
  12930. @param other other
  12931. */
  12932. equals(other: ValueType): boolean;
  12933. /**
  12934. !#en
  12935. Linearly interpolates between this value to to value by ratio which is in the range [0, 1].
  12936. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
  12937. !#zh
  12938. 线性插值。<br/>
  12939. 当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
  12940. @param to the to value
  12941. @param ratio the interpolation coefficient
  12942. */
  12943. lerp(to: ValueType, ratio: number): ValueType;
  12944. /**
  12945. !#en
  12946. Copys all the properties from another given object to this value.
  12947. !#zh
  12948. 从其它对象把所有属性复制到当前对象。
  12949. @param source the source to copy
  12950. */
  12951. set(source: ValueType): void;
  12952. /**
  12953. !#en Convert to a readable string.
  12954. !#zh 转换为方便阅读的字符串。
  12955. */
  12956. toString(): string;
  12957. }
  12958. /** !#en Representation of 2D vectors and points.
  12959. !#zh 表示 2D 向量和坐标 */
  12960. export class Vec2 extends ValueType {
  12961. /**
  12962. !#en Returns the length of this vector.
  12963. !#zh 返回该向量的长度。
  12964. @example
  12965. ```js
  12966. var v = cc.v2(10, 10);
  12967. v.mag(); // return 14.142135623730951;
  12968. ```
  12969. */
  12970. mag(): number;
  12971. /**
  12972. !#en Returns the squared length of this vector.
  12973. !#zh 返回该向量的长度平方。
  12974. @example
  12975. ```js
  12976. var v = cc.v2(10, 10);
  12977. v.magSqr(); // return 200;
  12978. ```
  12979. */
  12980. magSqr(): number;
  12981. /**
  12982. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  12983. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  12984. @param vector vector
  12985. @example
  12986. ```js
  12987. var v = cc.v2(10, 10);
  12988. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  12989. ```
  12990. */
  12991. subSelf(vector: Vec2): Vec2;
  12992. /**
  12993. !#en Subtracts one vector from this, and returns the new result.
  12994. !#zh 向量减法,并返回新结果。
  12995. @param vector vector
  12996. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  12997. @example
  12998. ```js
  12999. var v = cc.v2(10, 10);
  13000. v.sub(cc.v2(5, 5)); // return Vec2 {x: 5, y: 5};
  13001. var v1;
  13002. v.sub(cc.v2(5, 5), v1); // return Vec2 {x: 5, y: 5};
  13003. ```
  13004. */
  13005. sub(vector: Vec2, out?: Vec2): Vec2;
  13006. /**
  13007. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13008. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13009. @param num num
  13010. @example
  13011. ```js
  13012. var v = cc.v2(10, 10);
  13013. v.mulSelf(5);// return Vec2 {x: 50, y: 50};
  13014. ```
  13015. */
  13016. mulSelf(num: number): Vec2;
  13017. /**
  13018. !#en Multiplies by a number, and returns the new result.
  13019. !#zh 缩放向量,并返回新结果。
  13020. @param num num
  13021. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13022. @example
  13023. ```js
  13024. var v = cc.v2(10, 10);
  13025. v.mul(5); // return Vec2 {x: 50, y: 50};
  13026. var v1;
  13027. v.mul(5, v1); // return Vec2 {x: 50, y: 50};
  13028. ```
  13029. */
  13030. mul(num: number, out?: Vec2): Vec2;
  13031. /**
  13032. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13033. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13034. @param num num
  13035. @example
  13036. ```js
  13037. var v = cc.v2(10, 10);
  13038. v.divSelf(5); // return Vec2 {x: 2, y: 2};
  13039. ```
  13040. */
  13041. divSelf(num: number): Vec2;
  13042. /**
  13043. !#en Divides by a number, and returns the new result.
  13044. !#zh 向量除法,并返回新的结果。
  13045. @param num num
  13046. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13047. @example
  13048. ```js
  13049. var v = cc.v2(10, 10);
  13050. v.div(5); // return Vec2 {x: 2, y: 2};
  13051. var v1;
  13052. v.div(5, v1); // return Vec2 {x: 2, y: 2};
  13053. ```
  13054. */
  13055. div(num: number, out?: Vec2): Vec2;
  13056. /**
  13057. !#en Multiplies two vectors.
  13058. !#zh 分量相乘。
  13059. @param vector vector
  13060. @example
  13061. ```js
  13062. var v = cc.v2(10, 10);
  13063. v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  13064. ```
  13065. */
  13066. scaleSelf(vector: Vec2): Vec2;
  13067. /**
  13068. !#en Multiplies two vectors, and returns the new result.
  13069. !#zh 分量相乘,并返回新的结果。
  13070. @param vector vector
  13071. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13072. @example
  13073. ```js
  13074. var v = cc.v2(10, 10);
  13075. v.scale(cc.v2(5, 5)); // return Vec2 {x: 50, y: 50};
  13076. var v1;
  13077. v.scale(cc.v2(5, 5), v1); // return Vec2 {x: 50, y: 50};
  13078. ```
  13079. */
  13080. scale(vector: Vec2, out?: Vec2): Vec2;
  13081. /**
  13082. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13083. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13084. @example
  13085. ```js
  13086. var v = cc.v2(10, 10);
  13087. v.negSelf(); // return Vec2 {x: -10, y: -10};
  13088. ```
  13089. */
  13090. negSelf(): Vec2;
  13091. /**
  13092. !#en Negates the components, and returns the new result.
  13093. !#zh 返回取反后的新向量。
  13094. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13095. @example
  13096. ```js
  13097. var v = cc.v2(10, 10);
  13098. var v1;
  13099. v.neg(v1); // return Vec2 {x: -10, y: -10};
  13100. ```
  13101. */
  13102. neg(out?: Vec2): Vec2;
  13103. /** !#en return a Vec2 object with x = 1 and y = 1.
  13104. !#zh 新 Vec2 对象。 */
  13105. static ONE: Vec2;
  13106. /** !#en return a Vec2 object with x = 0 and y = 0.
  13107. !#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */
  13108. static ZERO: Vec2;
  13109. /** !#en return a readonly Vec2 object with x = 0 and y = 0.
  13110. !#zh 返回一个 x = 0 和 y = 0 的 Vec2 只读对象。 */
  13111. static ZERO_R: Vec2;
  13112. /** !#en return a Vec2 object with x = 0 and y = 1.
  13113. !#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */
  13114. static UP: Vec2;
  13115. /** !#en return a readonly Vec2 object with x = 0 and y = 1.
  13116. !#zh 返回 x = 0 和 y = 1 的 Vec2 只读对象。 */
  13117. static UP_R: Vec2;
  13118. /** !#en return a readonly Vec2 object with x = 1 and y = 0.
  13119. !#zh 返回 x = 1 和 y = 0 的 Vec2 只读对象。 */
  13120. static RIGHT: Vec2;
  13121. /** !#en return a Vec2 object with x = 1 and y = 0.
  13122. !#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */
  13123. static RIGHT_R: Vec2;
  13124. /**
  13125. !#zh 获得指定向量的拷贝
  13126. */
  13127. static clone <Out extends IVec2Like> (a: Out);
  13128. /**
  13129. !#zh 复制指定向量的值
  13130. */
  13131. static copy <Out extends IVec2Like> (out: Out, a: Out);
  13132. /**
  13133. !#zh 设置向量值
  13134. */
  13135. static set <Out extends IVec2Like> (out: Out, x: number, y: number);
  13136. /**
  13137. !#zh 逐元素向量加法
  13138. */
  13139. static add <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13140. /**
  13141. !#zh 逐元素向量减法
  13142. */
  13143. static subtract <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13144. /**
  13145. !#zh 逐元素向量乘法
  13146. */
  13147. static multiply <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13148. /**
  13149. !#zh 逐元素向量除法
  13150. */
  13151. static divide <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13152. /**
  13153. !#zh 逐元素向量向上取整
  13154. */
  13155. static ceil <Out extends IVec2Like> (out: Out, a: Out);
  13156. /**
  13157. !#zh 逐元素向量向下取整
  13158. */
  13159. static floor <Out extends IVec2Like> (out: Out, a: Out);
  13160. /**
  13161. !#zh 逐元素向量最小值
  13162. */
  13163. static min <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13164. /**
  13165. !#zh 逐元素向量最大值
  13166. */
  13167. static max <Out extends IVec2Like> (out: Out, a: Out, b: Out);
  13168. /**
  13169. !#zh 逐元素向量四舍五入取整
  13170. */
  13171. static round <Out extends IVec2Like> (out: Out, a: Out);
  13172. /**
  13173. !#zh 向量标量乘法
  13174. */
  13175. static multiplyScalar <Out extends IVec2Like> (out: Out, a: Out, b: number);
  13176. /**
  13177. !#zh 逐元素向量乘加: A + B * scale
  13178. */
  13179. static scaleAndAdd <Out extends IVec2Like> (out: Out, a: Out, b: Out, scale: number);
  13180. /**
  13181. !#zh 求两向量的欧氏距离
  13182. */
  13183. static distance <Out extends IVec2Like> (a: Out, b: Out);
  13184. /**
  13185. !#zh 求两向量的欧氏距离平方
  13186. */
  13187. static squaredDistance <Out extends IVec2Like> (a: Out, b: Out);
  13188. /**
  13189. !#zh 求向量长度
  13190. */
  13191. static len <Out extends IVec2Like> (a: Out);
  13192. /**
  13193. !#zh 求向量长度平方
  13194. */
  13195. static lengthSqr <Out extends IVec2Like> (a: Out);
  13196. /**
  13197. !#zh 逐元素向量取负
  13198. */
  13199. static negate <Out extends IVec2Like> (out: Out, a: Out);
  13200. /**
  13201. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13202. */
  13203. static inverse <Out extends IVec2Like> (out: Out, a: Out);
  13204. /**
  13205. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13206. */
  13207. static inverseSafe <Out extends IVec2Like> (out: Out, a: Out);
  13208. /**
  13209. !#zh 归一化向量
  13210. */
  13211. static normalize <Out extends IVec2Like, Vec2Like extends IVec2Like> (out: Out, a: Vec2Like);
  13212. /**
  13213. !#zh 向量点积(数量积)
  13214. */
  13215. static dot <Out extends IVec2Like> (a: Out, b: Out);
  13216. /**
  13217. !#zh 向量叉积(向量积),注意二维向量的叉积为与 Z 轴平行的三维向量
  13218. */
  13219. static cross <Out extends IVec2Like> (out: Vec2, a: Out, b: Out);
  13220. /**
  13221. !#zh 逐元素向量线性插值: A + t * (B - A)
  13222. */
  13223. static lerp <Out extends IVec2Like> (out: Out, a: Out, b: Out, t: number);
  13224. /**
  13225. !#zh 生成一个在单位圆上均匀分布的随机向量
  13226. */
  13227. static random <Out extends IVec2Like> (out: Out, scale?: number);
  13228. /**
  13229. !#zh 向量与三维矩阵乘法,默认向量第三位为 1。
  13230. */
  13231. static transformMat3 <Out extends IVec2Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: IMat3Like);
  13232. /**
  13233. !#zh 向量与四维矩阵乘法,默认向量第三位为 0,第四位为 1。
  13234. */
  13235. static transformMat4 <Out extends IVec2Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike);
  13236. /**
  13237. !#zh 向量等价判断
  13238. */
  13239. static strictEquals <Out extends IVec2Like> (a: Out, b: Out);
  13240. /**
  13241. !#zh 排除浮点数误差的向量近似等价判断
  13242. */
  13243. static equals <Out extends IVec2Like> (a: Out, b: Out, epsilon = EPSILON);
  13244. /**
  13245. !#zh 排除浮点数误差的向量近似等价判断
  13246. */
  13247. static angle <Out extends IVec2Like> (a: Out, b: Out);
  13248. /**
  13249. !#zh 向量转数组
  13250. */
  13251. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec2Like, ofs = 0);
  13252. /**
  13253. !#zh 数组转向量
  13254. */
  13255. static fromArray <Out extends IVec2Like> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  13256. x: number;
  13257. y: number;
  13258. /**
  13259. !#en
  13260. Constructor
  13261. see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  13262. !#zh
  13263. 构造函数,可查看 {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} 或者 {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  13264. @param x x
  13265. @param y y
  13266. */
  13267. constructor(x?: number, y?: number);
  13268. /**
  13269. !#en clone a Vec2 object
  13270. !#zh 克隆一个 Vec2 对象
  13271. */
  13272. clone(): Vec2;
  13273. /**
  13274. !#en Sets vector with another's value
  13275. !#zh 设置向量值。
  13276. @param newValue !#en new value to set. !#zh 要设置的新值
  13277. */
  13278. set(newValue: Vec2): Vec2;
  13279. /**
  13280. !#en Check whether two vector equal
  13281. !#zh 当前的向量是否与指定的向量相等。
  13282. @param other other
  13283. */
  13284. equals(other: Vec2): boolean;
  13285. /**
  13286. !#en Check whether two vector equal with some degree of variance.
  13287. !#zh
  13288. 近似判断两个点是否相等。<br/>
  13289. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  13290. @param other other
  13291. @param variance variance
  13292. */
  13293. fuzzyEquals(other: Vec2, variance: number): boolean;
  13294. /**
  13295. !#en Transform to string with vector informations
  13296. !#zh 转换为方便阅读的字符串。
  13297. */
  13298. toString(): string;
  13299. /**
  13300. !#en Calculate linear interpolation result between this vector and another one with given ratio
  13301. !#zh 线性插值。
  13302. @param to to
  13303. @param ratio the interpolation coefficient
  13304. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13305. */
  13306. lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;
  13307. /**
  13308. !#en Clamp the vector between from float and to float.
  13309. !#zh
  13310. 返回指定限制区域后的向量。<br/>
  13311. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  13312. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  13313. 否则返回自身。
  13314. @param min_inclusive min_inclusive
  13315. @param max_inclusive max_inclusive
  13316. @example
  13317. ```js
  13318. var min_inclusive = cc.v2(0, 0);
  13319. var max_inclusive = cc.v2(20, 20);
  13320. var v1 = cc.v2(20, 20).clampf(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
  13321. var v2 = cc.v2(0, 0).clampf(min_inclusive, max_inclusive); // Vec2 {x: 0, y: 0};
  13322. var v3 = cc.v2(10, 10).clampf(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
  13323. ```
  13324. */
  13325. clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;
  13326. /**
  13327. !#en Adds this vector.
  13328. !#zh 向量加法。
  13329. @param vector vector
  13330. @param out out
  13331. @example
  13332. ```js
  13333. var v = cc.v2(10, 10);
  13334. v.add(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
  13335. ```
  13336. */
  13337. add(vector: Vec2, out?: Vec2): Vec2;
  13338. /**
  13339. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  13340. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  13341. @param vector vector
  13342. */
  13343. addSelf(vector: Vec2): Vec2;
  13344. /**
  13345. !#en Subtracts one vector from this.
  13346. !#zh 向量减法。
  13347. @param vector vector
  13348. @example
  13349. ```js
  13350. var v = cc.v2(10, 10);
  13351. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  13352. ```
  13353. */
  13354. subtract(vector: Vec2): Vec2;
  13355. /**
  13356. !#en Multiplies this by a number.
  13357. !#zh 缩放当前向量。
  13358. @param num num
  13359. @example
  13360. ```js
  13361. var v = cc.v2(10, 10);
  13362. v.multiply(5);// return Vec2 {x: 50, y: 50};
  13363. ```
  13364. */
  13365. multiplyScalar(num: number): Vec2;
  13366. /**
  13367. !#en Multiplies two vectors.
  13368. !#zh 分量相乘。
  13369. @param vector vector
  13370. @example
  13371. ```js
  13372. var v = cc.v2(10, 10);
  13373. v.multiply(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  13374. ```
  13375. */
  13376. multiply(vector: Vec2): Vec2;
  13377. /**
  13378. !#en Divides by a number.
  13379. !#zh 向量除法。
  13380. @param num num
  13381. @example
  13382. ```js
  13383. var v = cc.v2(10, 10);
  13384. v.divide(5); // return Vec2 {x: 2, y: 2};
  13385. ```
  13386. */
  13387. divide(num: number): Vec2;
  13388. /**
  13389. !#en Negates the components.
  13390. !#zh 向量取反。
  13391. @example
  13392. ```js
  13393. var v = cc.v2(10, 10);
  13394. v.negate(); // return Vec2 {x: -10, y: -10};
  13395. ```
  13396. */
  13397. negate(): Vec2;
  13398. /**
  13399. !#en Dot product
  13400. !#zh 当前向量与指定向量进行点乘。
  13401. @param vector vector
  13402. @example
  13403. ```js
  13404. var v = cc.v2(10, 10);
  13405. v.dot(cc.v2(5, 5)); // return 100;
  13406. ```
  13407. */
  13408. dot(vector?: Vec2): number;
  13409. /**
  13410. !#en Cross product
  13411. !#zh 当前向量与指定向量进行叉乘。
  13412. @param vector vector
  13413. @example
  13414. ```js
  13415. var v = cc.v2(10, 10);
  13416. v.cross(cc.v2(5, 5)); // return 0;
  13417. ```
  13418. */
  13419. cross(vector?: Vec2): number;
  13420. /**
  13421. !#en Returns the length of this vector.
  13422. !#zh 返回该向量的长度。
  13423. @example
  13424. ```js
  13425. var v = cc.v2(10, 10);
  13426. v.len(); // return 14.142135623730951;
  13427. ```
  13428. */
  13429. len(): number;
  13430. /**
  13431. !#en Returns the squared length of this vector.
  13432. !#zh 返回该向量的长度平方。
  13433. @example
  13434. ```js
  13435. var v = cc.v2(10, 10);
  13436. v.lengthSqr(); // return 200;
  13437. ```
  13438. */
  13439. lengthSqr(): number;
  13440. /**
  13441. !#en Make the length of this vector to 1.
  13442. !#zh 向量归一化,让这个向量的长度为 1。
  13443. @example
  13444. ```js
  13445. var v = cc.v2(10, 10);
  13446. v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
  13447. ```
  13448. */
  13449. normalizeSelf(): Vec2;
  13450. /**
  13451. !#en
  13452. Returns this vector with a magnitude of 1.<br/>
  13453. <br/>
  13454. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  13455. !#zh
  13456. 返回归一化后的向量。<br/>
  13457. <br/>
  13458. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  13459. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13460. */
  13461. normalize(out?: Vec2): Vec2;
  13462. /**
  13463. !#en Get angle in radian between this and vector.
  13464. !#zh 夹角的弧度。
  13465. @param vector vector
  13466. */
  13467. angle(vector: Vec2): number;
  13468. /**
  13469. !#en Get angle in radian between this and vector with direction.
  13470. !#zh 带方向的夹角的弧度。
  13471. @param vector vector
  13472. */
  13473. signAngle(vector: Vec2): number;
  13474. /**
  13475. !#en rotate
  13476. !#zh 返回旋转给定弧度后的新向量。
  13477. @param radians radians
  13478. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13479. */
  13480. rotate(radians: number, out?: Vec2): Vec2;
  13481. /**
  13482. !#en rotate self
  13483. !#zh 按指定弧度旋转向量。
  13484. @param radians radians
  13485. */
  13486. rotateSelf(radians: number): Vec2;
  13487. /**
  13488. !#en Calculates the projection of the current vector over the given vector.
  13489. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  13490. @param vector vector
  13491. @example
  13492. ```js
  13493. var v1 = cc.v2(20, 20);
  13494. var v2 = cc.v2(5, 5);
  13495. v1.project(v2); // Vec2 {x: 20, y: 20};
  13496. ```
  13497. */
  13498. project(vector: Vec2): Vec2;
  13499. /**
  13500. Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  13501. @param m matrix to transform with
  13502. @param out the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13503. */
  13504. transformMat4(m: Mat4, out?: Vec2): Vec2;
  13505. /**
  13506. Returns the maximum value in x, y.
  13507. */
  13508. maxAxis(): number;
  13509. }
  13510. /** !#en Representation of 3D vectors and points.
  13511. !#zh 表示 3D 向量和坐标 */
  13512. export class Vec3 extends ValueType {
  13513. /**
  13514. !#en Returns the length of this vector.
  13515. !#zh 返回该向量的长度。
  13516. @example
  13517. ```js
  13518. var v = cc.v3(10, 10, 10);
  13519. v.mag(); // return 17.320508075688775;
  13520. ```
  13521. */
  13522. mag(): number;
  13523. /**
  13524. !#en Returns the squared length of this vector.
  13525. !#zh 返回该向量的长度平方。
  13526. */
  13527. magSqr(): number;
  13528. /**
  13529. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  13530. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  13531. @param vector vector
  13532. */
  13533. subSelf(vector: Vec3): Vec3;
  13534. /**
  13535. !#en Subtracts one vector from this, and returns the new result.
  13536. !#zh 向量减法,并返回新结果。
  13537. @param vector vector
  13538. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13539. */
  13540. sub(vector: Vec3, out?: Vec3): Vec3;
  13541. /**
  13542. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13543. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13544. @param num num
  13545. */
  13546. mulSelf(num: number): Vec3;
  13547. /**
  13548. !#en Multiplies by a number, and returns the new result.
  13549. !#zh 缩放向量,并返回新结果。
  13550. @param num num
  13551. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13552. */
  13553. mul(num: number, out?: Vec3): Vec3;
  13554. /**
  13555. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13556. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13557. @param num num
  13558. */
  13559. divSelf(num: number): Vec3;
  13560. /**
  13561. !#en Divides by a number, and returns the new result.
  13562. !#zh 向量除法,并返回新的结果。
  13563. @param num num
  13564. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13565. */
  13566. div(num: number, out?: Vec3): Vec3;
  13567. /**
  13568. !#en Multiplies two vectors.
  13569. !#zh 分量相乘。
  13570. @param vector vector
  13571. */
  13572. scaleSelf(vector: Vec3): Vec3;
  13573. /**
  13574. !#en Multiplies two vectors, and returns the new result.
  13575. !#zh 分量相乘,并返回新的结果。
  13576. @param vector vector
  13577. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13578. */
  13579. scale(vector: Vec3, out?: Vec3): Vec3;
  13580. /**
  13581. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13582. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13583. */
  13584. negSelf(): Vec3;
  13585. /**
  13586. !#en Negates the components, and returns the new result.
  13587. !#zh 返回取反后的新向量。
  13588. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13589. */
  13590. neg(out?: Vec3): Vec3;
  13591. /** !#en return a Vec3 object with x = 1, y = 1, z = 1.
  13592. !#zh 新 Vec3 对象。 */
  13593. static ONE: Vec3;
  13594. /** !#en return a Vec3 object with x = 0, y = 0, z = 0.
  13595. !#zh 返回 x = 0,y = 0,z = 0 的 Vec3 对象。 */
  13596. static ZERO: Vec3;
  13597. /** !#en return a Vec3 object with x = 0, y = 1, z = 0.
  13598. !#zh 返回 x = 0, y = 1, z = 0 的 Vec3 对象。 */
  13599. static UP: Vec3;
  13600. /** !#en return a Vec3 object with x = 1, y = 0, z = 0.
  13601. !#zh 返回 x = 1,y = 0,z = 0 的 Vec3 对象。 */
  13602. static RIGHT: Vec3;
  13603. /** !#en return a Vec3 object with x = 0, y = 0, z = 1.
  13604. !#zh 返回 x = 0,y = 0,z = 1 的 Vec3 对象。 */
  13605. static FORWARD: Vec3;
  13606. /**
  13607. !#zh 将目标赋值为零向量
  13608. !#en The target of an assignment zero vector
  13609. */
  13610. static zero<Out extends IVec3Like> (out: Out);
  13611. /**
  13612. !#zh 获得指定向量的拷贝
  13613. !#en Obtaining copy vectors designated
  13614. */
  13615. static clone<Out extends IVec3Like> (a: Out);
  13616. /**
  13617. !#zh 复制目标向量
  13618. !#en Copy the target vector
  13619. */
  13620. static copy<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like);
  13621. /**
  13622. !#zh 设置向量值
  13623. !#en Set to value
  13624. */
  13625. static set<Out extends IVec3Like> (out: Out, x: number, y: number, z: number);
  13626. /**
  13627. !#zh 逐元素向量加法
  13628. !#en Element-wise vector addition
  13629. */
  13630. static add<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13631. /**
  13632. !#zh 逐元素向量减法
  13633. !#en Element-wise vector subtraction
  13634. */
  13635. static subtract<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13636. /**
  13637. !#zh 逐元素向量乘法 (分量积)
  13638. !#en Element-wise vector multiplication (product component)
  13639. */
  13640. static multiply<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2);
  13641. /**
  13642. !#zh 逐元素向量除法
  13643. !#en Element-wise vector division
  13644. */
  13645. static divide<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13646. /**
  13647. !#zh 逐元素向量向上取整
  13648. !#en Rounding up by elements of the vector
  13649. */
  13650. static ceil<Out extends IVec3Like> (out: Out, a: Out);
  13651. /**
  13652. !#zh 逐元素向量向下取整
  13653. !#en Element vector by rounding down
  13654. */
  13655. static floor<Out extends IVec3Like> (out: Out, a: Out);
  13656. /**
  13657. !#zh 逐元素向量最小值
  13658. !#en The minimum by-element vector
  13659. */
  13660. static min<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13661. /**
  13662. !#zh 逐元素向量最大值
  13663. !#en The maximum value of the element-wise vector
  13664. */
  13665. static max<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13666. /**
  13667. !#zh 逐元素向量四舍五入取整
  13668. !#en Element-wise vector of rounding to whole
  13669. */
  13670. static round<Out extends IVec3Like> (out: Out, a: Out);
  13671. /**
  13672. !#zh 向量标量乘法
  13673. !#en Vector scalar multiplication
  13674. */
  13675. static multiplyScalar<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like, b: number);
  13676. /**
  13677. !#zh 逐元素向量乘加: A + B * scale
  13678. !#en Element-wise vector multiply add: A + B * scale
  13679. */
  13680. static scaleAndAdd<Out extends IVec3Like> (out: Out, a: Out, b: Out, scale: number);
  13681. /**
  13682. !#zh 求两向量的欧氏距离
  13683. !#en Seeking two vectors Euclidean distance
  13684. */
  13685. static distance<Out extends IVec3Like> (a: Out, b: Out);
  13686. /**
  13687. !#zh 求两向量的欧氏距离平方
  13688. !#en Euclidean distance squared seeking two vectors
  13689. */
  13690. static squaredDistance<Out extends IVec3Like> (a: Out, b: Out);
  13691. /**
  13692. !#zh 求向量长度
  13693. !#en Seeking vector length
  13694. */
  13695. static len<Out extends IVec3Like> (a: Out);
  13696. /**
  13697. !#zh 求向量长度平方
  13698. !#en Seeking squared vector length
  13699. */
  13700. static lengthSqr<Out extends IVec3Like> (a: Out);
  13701. /**
  13702. !#zh 逐元素向量取负
  13703. !#en By taking the negative elements of the vector
  13704. */
  13705. static negate<Out extends IVec3Like> (out: Out, a: Out);
  13706. /**
  13707. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13708. !#en Element vector by taking the inverse, return near 0 Infinity
  13709. */
  13710. static inverse<Out extends IVec3Like> (out: Out, a: Out);
  13711. /**
  13712. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13713. !#en Element vector by taking the inverse, return near 0 0
  13714. */
  13715. static inverseSafe<Out extends IVec3Like> (out: Out, a: Out);
  13716. /**
  13717. !#zh 归一化向量
  13718. !#en Normalized vector
  13719. */
  13720. static normalize<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like);
  13721. /**
  13722. !#zh 向量点积(数量积)
  13723. !#en Vector dot product (scalar product)
  13724. */
  13725. static dot<Out extends IVec3Like> (a: Out, b: Out);
  13726. /**
  13727. !#zh 向量叉积(向量积)
  13728. !#en Vector cross product (vector product)
  13729. */
  13730. static cross<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2);
  13731. /**
  13732. !#zh 逐元素向量线性插值: A + t * (B - A)
  13733. !#en Vector element by element linear interpolation: A + t * (B - A)
  13734. */
  13735. static lerp<Out extends IVec3Like> (out: Out, a: Out, b: Out, t: number);
  13736. /**
  13737. !#zh 生成一个在单位球体上均匀分布的随机向量
  13738. !#en Generates a uniformly distributed random vectors on the unit sphere
  13739. @param scale 生成的向量长度
  13740. */
  13741. static random<Out extends IVec3Like> (out: Out, scale?: number);
  13742. /**
  13743. !#zh 向量与四维矩阵乘法,默认向量第四位为 1。
  13744. !#en Four-dimensional vector and matrix multiplication, the default vectors fourth one.
  13745. */
  13746. static transformMat4<Out extends IVec3Like, Vec3Like extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Vec3Like, mat: MatLike);
  13747. /**
  13748. !#zh 向量与四维矩阵乘法,默认向量第四位为 0。
  13749. !#en Four-dimensional vector and matrix multiplication, vector fourth default is 0.
  13750. */
  13751. static transformMat4Normal<Out extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike);
  13752. /**
  13753. !#zh 向量与三维矩阵乘法
  13754. !#en Dimensional vector matrix multiplication
  13755. */
  13756. static transformMat3<Out extends IVec3Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: MatLike);
  13757. /**
  13758. !#zh 向量四元数乘法
  13759. !#en Vector quaternion multiplication
  13760. */
  13761. static transformQuat<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike> (out: Out, a: VecLike, q: QuatLike);
  13762. /**
  13763. !#zh 绕 X 轴旋转向量指定弧度
  13764. !#en Rotation vector specified angle about the X axis
  13765. @param v 待旋转向量
  13766. @param o 旋转中心
  13767. @param a 旋转弧度
  13768. */
  13769. static rotateX<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number);
  13770. /**
  13771. !#zh 绕 Y 轴旋转向量指定弧度
  13772. !#en Rotation vector specified angle around the Y axis
  13773. @param v 待旋转向量
  13774. @param o 旋转中心
  13775. @param a 旋转弧度
  13776. */
  13777. static rotateY<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number);
  13778. /**
  13779. !#zh 绕 Z 轴旋转向量指定弧度
  13780. !#en Around the Z axis specified angle vector
  13781. @param v 待旋转向量
  13782. @param o 旋转中心
  13783. @param a 旋转弧度
  13784. */
  13785. static rotateZ<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number);
  13786. /**
  13787. !#zh 向量等价判断
  13788. !#en Equivalent vectors Analyzing
  13789. */
  13790. static strictEquals<Out extends IVec3Like> (a: Out, b: Out);
  13791. /**
  13792. !#zh 排除浮点数误差的向量近似等价判断
  13793. !#en Negative error vector floating point approximately equivalent Analyzing
  13794. */
  13795. static equals<Out extends IVec3Like> (a: Out, b: Out, epsilon = EPSILON);
  13796. /**
  13797. !#zh 求两向量夹角弧度
  13798. !#en Radian angle between two vectors seek
  13799. */
  13800. static angle<Out extends IVec3Like> (a: Out, b: Out);
  13801. /**
  13802. !#zh 计算向量在指定平面上的投影
  13803. !#en Calculating a projection vector in the specified plane
  13804. @param a 待投影向量
  13805. @param n 指定平面的法线
  13806. */
  13807. static projectOnPlane<Out extends IVec3Like> (out: Out, a: Out, n: Out);
  13808. /**
  13809. !#zh 计算向量在指定向量上的投影
  13810. !#en Projection vector calculated in the vector designated
  13811. @param a 待投影向量
  13812. @param n 目标向量
  13813. */
  13814. static project<Out extends IVec3Like> (out: Out, a: Out, b: Out);
  13815. /**
  13816. !#zh 向量转数组
  13817. !#en Vector transfer array
  13818. @param ofs 数组起始偏移量
  13819. */
  13820. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec3Like, ofs = 0);
  13821. /**
  13822. !#zh 数组转向量
  13823. !#en Array steering amount
  13824. @param ofs 数组起始偏移量
  13825. */
  13826. static fromArray <Out extends IVec3Like> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  13827. x: number;
  13828. y: number;
  13829. z: number;
  13830. /**
  13831. !#en
  13832. Constructor
  13833. see {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  13834. !#zh
  13835. 构造函数,可查看 {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  13836. @param x x
  13837. @param y y
  13838. @param z z
  13839. */
  13840. constructor(x?: Vec3|number, y?: number, z?: number);
  13841. /**
  13842. !#en clone a Vec3 value
  13843. !#zh 克隆一个 Vec3 值
  13844. */
  13845. clone(): Vec3;
  13846. /**
  13847. !#en Set the current vector value with the given vector.
  13848. !#zh 用另一个向量设置当前的向量对象值。
  13849. @param newValue !#en new value to set. !#zh 要设置的新值
  13850. */
  13851. set(newValue: Vec3): Vec3;
  13852. /**
  13853. !#en Check whether the vector equals another one
  13854. !#zh 当前的向量是否与指定的向量相等。
  13855. @param other other
  13856. */
  13857. equals(other: Vec3): boolean;
  13858. /**
  13859. !#en Check whether two vector equal with some degree of variance.
  13860. !#zh
  13861. 近似判断两个点是否相等。<br/>
  13862. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  13863. @param other other
  13864. @param variance variance
  13865. */
  13866. fuzzyEquals(other: Vec3, variance: number): boolean;
  13867. /**
  13868. !#en Transform to string with vector informations
  13869. !#zh 转换为方便阅读的字符串。
  13870. */
  13871. toString(): string;
  13872. /**
  13873. !#en Calculate linear interpolation result between this vector and another one with given ratio
  13874. !#zh 线性插值。
  13875. @param to to
  13876. @param ratio the interpolation coefficient
  13877. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13878. */
  13879. lerp(to: Vec3, ratio: number, out?: Vec3): Vec3;
  13880. /**
  13881. !#en Clamp the vector between from float and to float.
  13882. !#zh
  13883. 返回指定限制区域后的向量。<br/>
  13884. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  13885. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  13886. 否则返回自身。
  13887. @param min_inclusive min_inclusive
  13888. @param max_inclusive max_inclusive
  13889. */
  13890. clampf(min_inclusive: Vec3, max_inclusive: Vec3): Vec3;
  13891. /**
  13892. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  13893. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  13894. @param vector vector
  13895. */
  13896. addSelf(vector: Vec3): Vec3;
  13897. /**
  13898. !#en Adds two vectors, and returns the new result.
  13899. !#zh 向量加法,并返回新结果。
  13900. @param vector vector
  13901. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13902. */
  13903. add(vector: Vec3, out?: Vec3): Vec3;
  13904. /**
  13905. !#en Subtracts one vector from this.
  13906. !#zh 向量减法。
  13907. @param vector vector
  13908. */
  13909. subtract(vector: Vec3): Vec3;
  13910. /**
  13911. !#en Multiplies this by a number.
  13912. !#zh 缩放当前向量。
  13913. @param num num
  13914. */
  13915. multiplyScalar(num: number): Vec3;
  13916. /**
  13917. !#en Multiplies two vectors.
  13918. !#zh 分量相乘。
  13919. @param vector vector
  13920. */
  13921. multiply(vector: Vec3): Vec3;
  13922. /**
  13923. !#en Divides by a number.
  13924. !#zh 向量除法。
  13925. @param num num
  13926. */
  13927. divide(num: number): Vec3;
  13928. /**
  13929. !#en Negates the components.
  13930. !#zh 向量取反。
  13931. */
  13932. negate(): Vec3;
  13933. /**
  13934. !#en Dot product
  13935. !#zh 当前向量与指定向量进行点乘。
  13936. @param vector vector
  13937. */
  13938. dot(vector?: Vec3): number;
  13939. /**
  13940. !#en Cross product
  13941. !#zh 当前向量与指定向量进行叉乘。
  13942. @param vector vector
  13943. @param out out
  13944. */
  13945. cross(vector: Vec3, out?: Vec3): Vec3;
  13946. /**
  13947. !#en Returns the length of this vector.
  13948. !#zh 返回该向量的长度。
  13949. @example
  13950. ```js
  13951. var v = cc.v3(10, 10, 10);
  13952. v.len(); // return 17.320508075688775;
  13953. ```
  13954. */
  13955. len(): number;
  13956. /**
  13957. !#en Returns the squared length of this vector.
  13958. !#zh 返回该向量的长度平方。
  13959. */
  13960. lengthSqr(): number;
  13961. /**
  13962. !#en Make the length of this vector to 1.
  13963. !#zh 向量归一化,让这个向量的长度为 1。
  13964. */
  13965. normalizeSelf(): Vec3;
  13966. /**
  13967. !#en
  13968. Returns this vector with a magnitude of 1.<br/>
  13969. <br/>
  13970. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  13971. !#zh
  13972. 返回归一化后的向量。<br/>
  13973. <br/>
  13974. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  13975. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13976. */
  13977. normalize(out?: Vec3): Vec3;
  13978. /**
  13979. Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  13980. @param m matrix to transform with
  13981. @param out the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13982. */
  13983. transformMat4(m: Mat4, out?: Vec3): Vec3;
  13984. /**
  13985. Returns the maximum value in x, y, and z
  13986. */
  13987. maxAxis(): number;
  13988. /**
  13989. !#en Get angle in radian between this and vector.
  13990. !#zh 夹角的弧度。
  13991. @param vector vector
  13992. */
  13993. angle(vector: Vec3): number;
  13994. /**
  13995. !#en Calculates the projection of the current vector over the given vector.
  13996. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  13997. @param vector vector
  13998. @example
  13999. ```js
  14000. var v1 = cc.v3(20, 20, 20);
  14001. var v2 = cc.v3(5, 5, 5);
  14002. v1.project(v2); // Vec3 {x: 20, y: 20, z: 20};
  14003. ```
  14004. */
  14005. project(vector: Vec3): Vec3;
  14006. /**
  14007. !#en Get angle in radian between this and vector with direction. <br/>
  14008. In order to compatible with the vec2 API.
  14009. !#zh 带方向的夹角的弧度。该方法仅用做兼容 2D 计算。
  14010. @param vector vector
  14011. */
  14012. signAngle(vector: Vec3|Vec2): number;
  14013. /**
  14014. !#en rotate. In order to compatible with the vec2 API.
  14015. !#zh 返回旋转给定弧度后的新向量。该方法仅用做兼容 2D 计算。
  14016. @param radians radians
  14017. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  14018. */
  14019. rotate(radians: number, out?: Vec3): Vec2;
  14020. /**
  14021. !#en rotate self. In order to compatible with the vec2 API.
  14022. !#zh 按指定弧度旋转向量。该方法仅用做兼容 2D 计算。
  14023. @param radians radians
  14024. */
  14025. rotateSelf(radians: number): Vec3;
  14026. }
  14027. /** !#en Representation of 3D vectors and points.
  14028. !#zh 表示 3D 向量和坐标 */
  14029. export class Vec4 extends ValueType {
  14030. /**
  14031. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  14032. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  14033. @param vector vector
  14034. */
  14035. subSelf(vector: Vec4): Vec4;
  14036. /**
  14037. !#en Subtracts one vector from this, and returns the new result.
  14038. !#zh 向量减法,并返回新结果。
  14039. @param vector vector
  14040. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14041. */
  14042. sub(vector: Vec4, out?: Vec4): Vec4;
  14043. /**
  14044. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  14045. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  14046. @param num num
  14047. */
  14048. mulSelf(num: number): Vec4;
  14049. /**
  14050. !#en Multiplies by a number, and returns the new result.
  14051. !#zh 缩放向量,并返回新结果。
  14052. @param num num
  14053. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14054. */
  14055. mul(num: number, out?: Vec4): Vec4;
  14056. /**
  14057. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  14058. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  14059. @param num num
  14060. */
  14061. divSelf(num: number): Vec4;
  14062. /**
  14063. !#en Divides by a number, and returns the new result.
  14064. !#zh 向量除法,并返回新的结果。
  14065. @param num num
  14066. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14067. */
  14068. div(num: number, out?: Vec4): Vec4;
  14069. /**
  14070. !#en Multiplies two vectors.
  14071. !#zh 分量相乘。
  14072. @param vector vector
  14073. */
  14074. scaleSelf(vector: Vec4): Vec4;
  14075. /**
  14076. !#en Multiplies two vectors, and returns the new result.
  14077. !#zh 分量相乘,并返回新的结果。
  14078. @param vector vector
  14079. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14080. */
  14081. scale(vector: Vec4, out?: Vec4): Vec4;
  14082. /**
  14083. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  14084. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  14085. */
  14086. negSelf(): Vec4;
  14087. /**
  14088. !#en Negates the components, and returns the new result.
  14089. !#zh 返回取反后的新向量。
  14090. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14091. */
  14092. neg(out?: Vec4): Vec4;
  14093. /**
  14094. !#zh 获得指定向量的拷贝
  14095. !#en Obtaining copy vectors designated
  14096. */
  14097. static clone <Out extends IVec4Like> (a: Out);
  14098. /**
  14099. !#zh 复制目标向量
  14100. !#en Copy the target vector
  14101. */
  14102. static copy <Out extends IVec4Like> (out: Out, a: Out);
  14103. /**
  14104. !#zh 设置向量值
  14105. !#en Set to value
  14106. */
  14107. static set <Out extends IVec4Like> (out: Out, x: number, y: number, z: number, w: number);
  14108. /**
  14109. !#zh 逐元素向量加法
  14110. !#en Element-wise vector addition
  14111. */
  14112. static add <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14113. /**
  14114. !#zh 逐元素向量减法
  14115. !#en Element-wise vector subtraction
  14116. */
  14117. static subtract <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14118. /**
  14119. !#zh 逐元素向量乘法
  14120. !#en Element-wise vector multiplication
  14121. */
  14122. static multiply <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14123. /**
  14124. !#zh 逐元素向量除法
  14125. !#en Element-wise vector division
  14126. */
  14127. static divide <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14128. /**
  14129. !#zh 逐元素向量向上取整
  14130. !#en Rounding up by elements of the vector
  14131. */
  14132. static ceil <Out extends IVec4Like> (out: Out, a: Out);
  14133. /**
  14134. !#zh 逐元素向量向下取整
  14135. !#en Element vector by rounding down
  14136. */
  14137. static floor <Out extends IVec4Like> (out: Out, a: Out);
  14138. /**
  14139. !#zh 逐元素向量最小值
  14140. !#en The minimum by-element vector
  14141. */
  14142. static min <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14143. /**
  14144. !#zh 逐元素向量最大值
  14145. !#en The maximum value of the element-wise vector
  14146. */
  14147. static max <Out extends IVec4Like> (out: Out, a: Out, b: Out);
  14148. /**
  14149. !#zh 逐元素向量四舍五入取整
  14150. !#en Element-wise vector of rounding to whole
  14151. */
  14152. static round <Out extends IVec4Like> (out: Out, a: Out);
  14153. /**
  14154. !#zh 向量标量乘法
  14155. !#en Vector scalar multiplication
  14156. */
  14157. static multiplyScalar <Out extends IVec4Like> (out: Out, a: Out, b: number);
  14158. /**
  14159. !#zh 逐元素向量乘加: A + B * scale
  14160. !#en Element-wise vector multiply add: A + B * scale
  14161. */
  14162. static scaleAndAdd <Out extends IVec4Like> (out: Out, a: Out, b: Out, scale: number);
  14163. /**
  14164. !#zh 求两向量的欧氏距离
  14165. !#en Seeking two vectors Euclidean distance
  14166. */
  14167. static distance <Out extends IVec4Like> (a: Out, b: Out);
  14168. /**
  14169. !#zh 求两向量的欧氏距离平方
  14170. !#en Euclidean distance squared seeking two vectors
  14171. */
  14172. static squaredDistance <Out extends IVec4Like> (a: Out, b: Out);
  14173. /**
  14174. !#zh 求向量长度
  14175. !#en Seeking vector length
  14176. */
  14177. static len <Out extends IVec4Like> (a: Out);
  14178. /**
  14179. !#zh 求向量长度平方
  14180. !#en Seeking squared vector length
  14181. */
  14182. static lengthSqr <Out extends IVec4Like> (a: Out);
  14183. /**
  14184. !#zh 逐元素向量取负
  14185. !#en By taking the negative elements of the vector
  14186. */
  14187. static negate <Out extends IVec4Like> (out: Out, a: Out);
  14188. /**
  14189. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  14190. !#en Element vector by taking the inverse, return near 0 Infinity
  14191. */
  14192. static inverse <Out extends IVec4Like> (out: Out, a: Out);
  14193. /**
  14194. !#zh 逐元素向量取倒数,接近 0 时返回 0
  14195. !#en Element vector by taking the inverse, return near 0 0
  14196. */
  14197. static inverseSafe <Out extends IVec4Like> (out: Out, a: Out);
  14198. /**
  14199. !#zh 归一化向量
  14200. !#en Normalized vector
  14201. */
  14202. static normalize <Out extends IVec4Like> (out: Out, a: Out);
  14203. /**
  14204. !#zh 向量点积(数量积)
  14205. !#en Vector dot product (scalar product)
  14206. */
  14207. static dot <Out extends IVec4Like> (a: Out, b: Out);
  14208. /**
  14209. !#zh 逐元素向量线性插值: A + t * (B - A)
  14210. !#en Vector element by element linear interpolation: A + t * (B - A)
  14211. */
  14212. static lerp <Out extends IVec4Like> (out: Out, a: Out, b: Out, t: number);
  14213. /**
  14214. !#zh 生成一个在单位球体上均匀分布的随机向量
  14215. !#en Generates a uniformly distributed random vectors on the unit sphere
  14216. @param scale 生成的向量长度
  14217. */
  14218. static random <Out extends IVec4Like> (out: Out, scale?: number);
  14219. /**
  14220. !#zh 向量矩阵乘法
  14221. !#en Vector matrix multiplication
  14222. */
  14223. static transformMat4 <Out extends IVec4Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike);
  14224. /**
  14225. !#zh 向量四元数乘法
  14226. !#en Vector quaternion multiplication
  14227. */
  14228. static transformQuat <Out extends IVec4Like, QuatLike extends IQuatLike> (out: Out, a: Out, q: QuatLike);
  14229. /**
  14230. !#zh 向量等价判断
  14231. !#en Equivalent vectors Analyzing
  14232. */
  14233. static strictEquals <Out extends IVec4Like> (a: Out, b: Out);
  14234. /**
  14235. !#zh 排除浮点数误差的向量近似等价判断
  14236. !#en Negative error vector floating point approximately equivalent Analyzing
  14237. */
  14238. static equals <Out extends IVec4Like> (a: Out, b: Out, epsilon = EPSILON);
  14239. /**
  14240. !#zh 向量转数组
  14241. !#en Vector transfer array
  14242. @param ofs 数组起始偏移量
  14243. */
  14244. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec4Like, ofs = 0);
  14245. /**
  14246. !#zh 数组转向量
  14247. !#en Array steering amount
  14248. @param ofs 数组起始偏移量
  14249. */
  14250. static fromArray <Out extends IVec4Like> (out: Out, arr: IWritableArrayLike<number>, ofs = 0);
  14251. x: number;
  14252. y: number;
  14253. z: number;
  14254. w: number;
  14255. /**
  14256. !#en
  14257. Constructor
  14258. see {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  14259. !#zh
  14260. 构造函数,可查看 {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  14261. @param x x
  14262. @param y y
  14263. @param z z
  14264. @param w w
  14265. */
  14266. constructor(x?: number, y?: number, z?: number, w?: number);
  14267. /**
  14268. !#en clone a Vec4 value
  14269. !#zh 克隆一个 Vec4 值
  14270. */
  14271. clone(): Vec4;
  14272. /**
  14273. !#en Set the current vector value with the given vector.
  14274. !#zh 用另一个向量设置当前的向量对象值。
  14275. @param newValue !#en new value to set. !#zh 要设置的新值
  14276. */
  14277. set(newValue: Vec4): Vec4;
  14278. /**
  14279. !#en Check whether the vector equals another one
  14280. !#zh 当前的向量是否与指定的向量相等。
  14281. @param other other
  14282. @param epsilon epsilon
  14283. */
  14284. equals(other: Vec4, epsilon?: number): boolean;
  14285. /**
  14286. !#en Check whether the vector equals another one
  14287. !#zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  14288. @param x 相比较的向量的 x 分量。
  14289. @param y 相比较的向量的 y 分量。
  14290. @param z 相比较的向量的 z 分量。
  14291. @param w 相比较的向量的 w 分量。
  14292. @param epsilon 允许的误差,应为非负数。
  14293. */
  14294. equals4f(x: number, y: number, z: number, w: number, epsilon?: number): boolean;
  14295. /**
  14296. !#en Check whether strict equals other Vec4
  14297. !#zh 判断当前向量是否与指定向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  14298. @param other 相比较的向量。
  14299. */
  14300. strictEquals(other: Vec4): boolean;
  14301. /**
  14302. !#en Check whether strict equals other Vec4
  14303. !#zh 判断当前向量是否与指定分量的向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  14304. @param x 指定向量的 x 分量。
  14305. @param y 指定向量的 y 分量。
  14306. @param z 指定向量的 z 分量。
  14307. @param w 指定向量的 w 分量。
  14308. */
  14309. strictEquals4f(x: number, y: number, z: number, w: number): boolean;
  14310. /**
  14311. !#en Calculate linear interpolation result between this vector and another one with given ratio
  14312. !#zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  14313. @param to 目标向量。
  14314. @param ratio 插值比率,范围为 [0,1]。
  14315. */
  14316. lerp(to: Vec4, ratio: number): Vec4;
  14317. /**
  14318. !#en Transform to string with vector informations
  14319. !#zh 返回当前向量的字符串表示。
  14320. */
  14321. toString(): string;
  14322. /**
  14323. !#en Clamp the vector between minInclusive and maxInclusive.
  14324. !#zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  14325. @param minInclusive 每个分量都代表了对应分量允许的最小值。
  14326. @param maxInclusive 每个分量都代表了对应分量允许的最大值。
  14327. */
  14328. clampf(minInclusive: Vec4, maxInclusive: Vec4): Vec4;
  14329. /**
  14330. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  14331. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  14332. @param vector vector
  14333. */
  14334. addSelf(vector: Vec4): Vec4;
  14335. /**
  14336. !#en Adds two vectors, and returns the new result.
  14337. !#zh 向量加法,并返回新结果。
  14338. @param vector vector
  14339. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14340. */
  14341. add(vector: Vec4, out?: Vec4): Vec4;
  14342. /**
  14343. !#en Subtracts one vector from this, and returns the new result.
  14344. !#zh 向量减法,并返回新结果。
  14345. @param vector vector
  14346. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14347. */
  14348. subtract(vector: Vec4, out?: Vec4): Vec4;
  14349. /**
  14350. !#en Multiplies this by a number.
  14351. !#zh 缩放当前向量。
  14352. @param num num
  14353. */
  14354. multiplyScalar(num: number): Vec4;
  14355. /**
  14356. !#en Multiplies two vectors.
  14357. !#zh 分量相乘。
  14358. @param vector vector
  14359. */
  14360. multiply(vector: Vec4): Vec4;
  14361. /**
  14362. !#en Divides by a number.
  14363. !#zh 向量除法。
  14364. @param num num
  14365. */
  14366. divide(num: number): Vec4;
  14367. /**
  14368. !#en Negates the components.
  14369. !#zh 向量取反
  14370. */
  14371. negate(): Vec4;
  14372. /**
  14373. !#en Dot product
  14374. !#zh 当前向量与指定向量进行点乘。
  14375. @param vector vector
  14376. */
  14377. dot(vector?: Vec4): number;
  14378. /**
  14379. !#en Cross product
  14380. !#zh 当前向量与指定向量进行叉乘。
  14381. @param vector vector
  14382. @param out out
  14383. */
  14384. cross(vector: Vec4, out?: Vec4): Vec4;
  14385. /**
  14386. !#en Returns the length of this vector.
  14387. !#zh 返回该向量的长度。
  14388. @example
  14389. ```js
  14390. var v = cc.v4(10, 10);
  14391. v.len(); // return 14.142135623730951;
  14392. ```
  14393. */
  14394. len(): number;
  14395. /**
  14396. !#en Returns the squared length of this vector.
  14397. !#zh 返回该向量的长度平方。
  14398. */
  14399. lengthSqr(): number;
  14400. /**
  14401. !#en Make the length of this vector to 1.
  14402. !#zh 向量归一化,让这个向量的长度为 1。
  14403. */
  14404. normalizeSelf(): Vec4;
  14405. /**
  14406. !#en
  14407. Returns this vector with a magnitude of 1.<br/>
  14408. <br/>
  14409. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  14410. !#zh
  14411. 返回归一化后的向量。<br/>
  14412. <br/>
  14413. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  14414. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14415. */
  14416. normalize(out?: Vec4): Vec4;
  14417. /**
  14418. Transforms the vec4 with a mat4. 4th vector component is implicitly '1'
  14419. @param m matrix to transform with
  14420. @param out the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14421. */
  14422. transformMat4(m: Mat4, out?: Vec4): Vec4;
  14423. /**
  14424. Returns the maximum value in x, y, z, w.
  14425. */
  14426. maxAxis(): number;
  14427. }
  14428. /** !#en The burst of 3d particle.
  14429. !#zh 3D 粒子发射时的爆发个数 */
  14430. export class Burst {
  14431. /** !#en Time between the start of the particle system and the trigger of this Brust
  14432. !#zh 粒子系统开始运行到触发此次 Brust 的时间 */
  14433. time: number;
  14434. /** !#en Minimum number of emitted particles
  14435. !#zh 发射粒子的最小数量 */
  14436. minCount: number;
  14437. /** !#en Maximum number of emitted particles
  14438. !#zh 发射粒子的最大数量 */
  14439. maxCount: number;
  14440. /** !#en The number of times Burst was triggered.
  14441. !#zh Burst 的触发次数 */
  14442. repeatCount: number;
  14443. /** !#en Interval of each trigger
  14444. !#zh 每次触发的间隔时间 */
  14445. repeatInterval: number;
  14446. /** !#en Number of particles emitted
  14447. !#zh 发射的粒子的数量 */
  14448. count: CurveRange;
  14449. }
  14450. /** !#en The animation curve of 3d particle.
  14451. !#zh 3D 粒子动画曲线 */
  14452. export class AnimationCurve {
  14453. }
  14454. /** !#en The ParticleSystem3D Component.
  14455. !#zh 3D 粒子组件 */
  14456. export class ParticleSystem3D extends RenderComponent {
  14457. /** !#en The run time of particle.
  14458. !#zh 粒子系统运行时间 */
  14459. duration: number;
  14460. /** !#en The maximum number of particles that a particle system can generate.
  14461. !#zh 粒子系统能生成的最大粒子数量 */
  14462. capacity: number;
  14463. /** !#en Whether the particle system loops.
  14464. !#zh 粒子系统是否循环播放 */
  14465. loop: boolean;
  14466. /** !#en Whether the particles start playing automatically after loaded.
  14467. !#zh 粒子系统加载后是否自动开始播放 */
  14468. playOnAwake: boolean;
  14469. /** !#en When selected, the particle system will start playing after one round has been played (only effective when loop is enabled).
  14470. !#zh 选中之后,粒子系统会以已播放完一轮之后的状态开始播放(仅当循环播放启用时有效) */
  14471. prewarm: boolean;
  14472. /** !#en The coordinate system in which the particle system is located.<br>
  14473. World coordinates (does not change when the position of other objects changes)<br>
  14474. Local coordinates (moving as the position of the parent node changes)<br>
  14475. Custom coordinates (moving with the position of a custom node)
  14476. !#zh 选择粒子系统所在的坐标系<br>
  14477. 世界坐标(不随其他物体位置改变而变换)<br>
  14478. 局部坐标(跟随父节点位置改变而移动)<br>
  14479. 自定坐标(跟随自定义节点的位置改变而移动) */
  14480. simulationSpace: Space;
  14481. /** !#en Controlling the update speed of the entire particle system.
  14482. !#zh 控制整个粒子系统的更新速度。 */
  14483. simulationSpeed: number;
  14484. /** !#en Delay particle emission time after particle system starts running.
  14485. !#zh 粒子系统开始运行后,延迟粒子发射的时间。 */
  14486. startDelay: CurveRange;
  14487. /** !#en Particle life cycle。
  14488. !#zh 粒子生命周期。 */
  14489. startLifetime: CurveRange;
  14490. /** !#en Particle initial color
  14491. !#zh 粒子初始颜色 */
  14492. startColor: GradientRange;
  14493. /** !#en Particle scale space
  14494. !#zh 缩放空间 */
  14495. scaleSpace: Space;
  14496. /** !#en Initial particle size
  14497. !#zh 粒子初始大小 */
  14498. startSize: CurveRange;
  14499. /** !#en Initial particle speed
  14500. !#zh 粒子初始速度 */
  14501. startSpeed: CurveRange;
  14502. /** !#en Particle initial rotation angle
  14503. !#zh 粒子初始旋转角度 */
  14504. startRotation: CurveRange;
  14505. /** !#en Gravity coefficient of particles affected by gravity
  14506. !#zh 粒子受重力影响的重力系数 */
  14507. gravityModifier: CurveRange;
  14508. /** !#en Particles emitted per second
  14509. !#zh 每秒发射的粒子数 */
  14510. rateOverTime: CurveRange;
  14511. /** !#en Number of particles emitted per unit distance moved
  14512. !#zh 每移动单位距离发射的粒子数 */
  14513. rateOverDistance: CurveRange;
  14514. /** !#en The number of Brusts that emit a specified number of particles at a specified time
  14515. !#zh 设定在指定时间发射指定数量的粒子的 Brust 的数量 */
  14516. bursts: Burst[];
  14517. /** !#en Particle emitter module
  14518. !#zh 粒子发射器模块 */
  14519. shapeModule: ShapeModule;
  14520. /** !#en Color control module
  14521. !#zh 颜色控制模块 */
  14522. colorOverLifetimeModule: ColorOverLifetimeModule;
  14523. /** !#en Particle size module
  14524. !#zh 粒子大小模块 */
  14525. sizeOvertimeModule: SizeOvertimeModule;
  14526. /** !#en Particle speed module
  14527. !#zh 粒子速度模块 */
  14528. velocityOvertimeModule: VelocityOvertimeModule;
  14529. /** !#en Particle acceleration module
  14530. !#zh 粒子加速度模块 */
  14531. forceOvertimeModule: ForceOvertimeModule;
  14532. /** !#en Particle limit speed module (only CPU particles are supported)
  14533. !#zh 粒子限制速度模块(只支持 CPU 粒子) */
  14534. limitVelocityOvertimeModule: LimitVelocityOvertimeModule;
  14535. /** !#en Particle rotation module
  14536. !#zh 粒子旋转模块 */
  14537. rotationOvertimeModule: RotationOvertimeModule;
  14538. /** !#en Texture Animation Module
  14539. !#zh 贴图动画模块 */
  14540. textureAnimationModule: TextureAnimationModule;
  14541. /** !#en Particle Trajectory Module
  14542. !#zh 粒子轨迹模块 */
  14543. trailModule: TrailModule;
  14544. /** !#en Particle generation mode
  14545. !#zh 设定粒子生成模式 */
  14546. renderMode: ParticleSystem3DAssembler.RenderMode;
  14547. /** !#en When the particle generation mode is StrecthedBillboard, in the direction of movement of the particles is stretched by velocity magnitude
  14548. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按速度大小进行拉伸 */
  14549. velocityScale: number;
  14550. /** !#en When the particle generation method is StrecthedBillboard, the particles are stretched according to the particle size in the direction of motion
  14551. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按粒子大小进行拉伸 */
  14552. lengthScale: number;
  14553. /** !#en Particle model
  14554. !#zh 粒子模型 */
  14555. mesh: Mesh;
  14556. /** !#en Particle material
  14557. !#zh 粒子材质 */
  14558. particleMaterial: Material;
  14559. /** !#en Particle trail material
  14560. !#zh 粒子轨迹材质 */
  14561. trailMaterial: Material;
  14562. /**
  14563. !#en Playing particle effects
  14564. !#zh 播放粒子效果
  14565. */
  14566. play(): void;
  14567. /**
  14568. !#en Pause particle effect
  14569. !#zh 暂停播放粒子效果
  14570. */
  14571. pause(): void;
  14572. /**
  14573. !#en Stop particle effect
  14574. !#zh 停止播放粒子效果
  14575. */
  14576. stop(): void;
  14577. /**
  14578. !#en Remove all particle effect
  14579. !#zh 将所有粒子从粒子系统中清除
  14580. */
  14581. clear(): void;
  14582. }
  14583. /** !#en
  14584. Helper class for ES5 Map.
  14585. !#zh
  14586. ES5 Map 辅助类。 */
  14587. export class MapUtils {
  14588. }
  14589. /** !#en .
  14590. !#zh 。 */
  14591. export class SkeletonAnimation extends Animation {
  14592. }
  14593. /** !#en SkeletonAnimationClip Asset.
  14594. !#zh 骨骼动画剪辑。 */
  14595. export class SkeletonAnimationClip extends AnimationClip {
  14596. }
  14597. /** !#en
  14598. Skinned Mesh Renderer
  14599. !#zh
  14600. 蒙皮渲染组件 */
  14601. export class SkinnedMeshRenderer {
  14602. /** !#en
  14603. Skeleton Asset
  14604. !#zh
  14605. 骨骼资源 */
  14606. skeleton: sp.Skeleton;
  14607. /** !#en
  14608. Root Bone
  14609. !#zh
  14610. 骨骼根节点 */
  14611. rootBone: Node;
  14612. }
  14613. /** !#en Effect Asset.
  14614. !#zh Effect 资源类型。 */
  14615. export class EffectAsset extends Asset {
  14616. }
  14617. /** !#en Material Asset.
  14618. !#zh 材质资源类。 */
  14619. export class Material extends Asset {
  14620. /**
  14621. !#en Creates a Material with builtin Effect.
  14622. !#zh 使用内建 Effect 创建一个材质。
  14623. @param effectName effectName
  14624. @param techniqueIndex techniqueIndex
  14625. */
  14626. static createWithBuiltin(effectName: string, techniqueIndex?: number): Material;
  14627. /**
  14628. !#en Creates a Material.
  14629. !#zh 创建一个材质。
  14630. @param effectAsset effectAsset
  14631. @param techniqueIndex techniqueIndex
  14632. */
  14633. static create(effectAsset: EffectAsset, techniqueIndex?: number): Material;
  14634. /**
  14635. !#en Sets the Material property
  14636. !#zh 是指材质的属性
  14637. @param name name
  14638. @param val val
  14639. @param passIdx passIdx
  14640. @param directly directly
  14641. */
  14642. setProperty(name: string, val: any, passIdx?: number, directly?: boolean): void;
  14643. /**
  14644. !#en Gets the Material property.
  14645. !#zh 获取材质的属性。
  14646. @param name name
  14647. @param passIdx passIdx
  14648. */
  14649. getProperty(name: string, passIdx: number): void;
  14650. /**
  14651. !#en Sets the Material define.
  14652. !#zh 设置材质的宏定义。
  14653. @param name name
  14654. @param val val
  14655. @param passIdx passIdx
  14656. @param force force
  14657. */
  14658. define(name: string, val: boolean|number, passIdx?: number, force?: boolean): void;
  14659. /**
  14660. !#en Gets the Material define.
  14661. !#zh 获取材质的宏定义。
  14662. @param name name
  14663. @param passIdx passIdx
  14664. */
  14665. getDefine(name: string, passIdx?: number): boolean;
  14666. /**
  14667. !#en Sets the Material cull mode.
  14668. !#zh 设置材质的裁减模式。
  14669. @param cullMode cullMode
  14670. @param passIdx passIdx
  14671. */
  14672. setCullMode(cullMode: number, passIdx: number): void;
  14673. /**
  14674. !#en Sets the Material depth states.
  14675. !#zh 设置材质的深度渲染状态。
  14676. @param depthTest depthTest
  14677. @param depthWrite depthWrite
  14678. @param depthFunc depthFunc
  14679. @param passIdx passIdx
  14680. */
  14681. setDepth(depthTest: boolean, depthWrite: boolean, depthFunc: number, passIdx: number): void;
  14682. /**
  14683. !#en Sets the Material blend states.
  14684. !#zh 设置材质的混合渲染状态。
  14685. @param enabled enabled
  14686. @param blendEq blendEq
  14687. @param blendSrc blendSrc
  14688. @param blendDst blendDst
  14689. @param blendAlphaEq blendAlphaEq
  14690. @param blendSrcAlpha blendSrcAlpha
  14691. @param blendDstAlpha blendDstAlpha
  14692. @param blendColor blendColor
  14693. @param passIdx passIdx
  14694. */
  14695. setBlend(enabled: number, blendEq: number, blendSrc: number, blendDst: number, blendAlphaEq: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: number, passIdx: number): void;
  14696. /**
  14697. !#en Sets whether enable the stencil test.
  14698. !#zh 设置是否开启模板测试。
  14699. @param stencilTest stencilTest
  14700. @param passIdx passIdx
  14701. */
  14702. setStencilEnabled(stencilTest: number, passIdx: number): void;
  14703. /**
  14704. !#en Sets the Material stencil render states.
  14705. !#zh 设置材质的模板测试渲染参数。
  14706. @param stencilTest stencilTest
  14707. @param stencilFunc stencilFunc
  14708. @param stencilRef stencilRef
  14709. @param stencilMask stencilMask
  14710. @param stencilFailOp stencilFailOp
  14711. @param stencilZFailOp stencilZFailOp
  14712. @param stencilZPassOp stencilZPassOp
  14713. @param stencilWriteMask stencilWriteMask
  14714. @param passIdx passIdx
  14715. */
  14716. setStencil(stencilTest: number, stencilFunc: number, stencilRef: number, stencilMask: number, stencilFailOp: number, stencilZFailOp: number, stencilZPassOp: number, stencilWriteMask: number, passIdx: number): void;
  14717. }
  14718. /** !#en
  14719. Material Variant is an extension of the Material Asset.
  14720. Changes to Material Variant do not affect other Material Variant or Material Asset,
  14721. and changes to Material Asset are synchronized to the Material Variant.
  14722. However, when a Material Variant had already modifies a state, the Material Asset state is not synchronized to the Material Variant.
  14723. !#zh
  14724. 材质变体是材质资源的一个延伸。
  14725. 材质变体的修改不会影响到其他的材质变体或者材质资源,而材质资源的修改会同步体现到材质变体上,
  14726. 但是当材质变体对一个状态修改后,材质资源再对这个状态修改是不会同步到材质变体上的。 */
  14727. export class MaterialVariant extends Material {
  14728. /**
  14729. @param materialName materialName
  14730. @param owner owner
  14731. */
  14732. static createWithBuiltin (materialName, owner: cc.RenderComponent): MaterialVariant | null;
  14733. /**
  14734. @param material material
  14735. @param owner owner
  14736. */
  14737. static create (material: Material, owner: cc.RenderComponent): MaterialVariant | null;
  14738. }
  14739. /** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.
  14740. !#zh EditBox 组件,用于获取用户的输入文本。 */
  14741. export class EditBox extends Component {
  14742. /** !#en Input string of EditBox.
  14743. !#zh 输入框的初始输入内容,如果为空则会显示占位符的文本。 */
  14744. string: string;
  14745. /** !#en The Label component attached to the node for EditBox's input text label
  14746. !#zh 输入框输入文本节点上挂载的 Label 组件对象 */
  14747. textLabel: Label;
  14748. /** !#en The Label component attached to the node for EditBox's placeholder text label
  14749. !#zh 输入框占位符节点上挂载的 Label 组件对象 */
  14750. placeholderLabel: Label;
  14751. /** !#en The Sprite component attached to the node for EditBox's background
  14752. !#zh 输入框背景节点上挂载的 Sprite 组件对象 */
  14753. background: Sprite;
  14754. /** !#en The background image of EditBox. This property will be removed in the future, use editBox.background instead please.
  14755. !#zh 输入框的背景图片。 该属性会在将来的版本中移除,请用 editBox.background */
  14756. backgroundImage: SpriteFrame;
  14757. /** !#en
  14758. The return key type of EditBox.
  14759. Note: it is meaningless for web platforms and desktop platforms.
  14760. !#zh
  14761. 指定移动设备上面回车按钮的样式。
  14762. 注意:这个选项对 web 平台与 desktop 平台无效。 */
  14763. returnType: EditBox.KeyboardReturnType;
  14764. /** !#en Set the input flags that are to be applied to the EditBox.
  14765. !#zh 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。 */
  14766. inputFlag: EditBox.InputFlag;
  14767. /** !#en
  14768. Set the input mode of the edit box.
  14769. If you pass ANY, it will create a multiline EditBox.
  14770. !#zh
  14771. 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。 */
  14772. inputMode: EditBox.InputMode;
  14773. /** !#en Font size of the input text. This property will be removed in the future, use editBox.textLabel.fontSize instead please.
  14774. !#zh 输入框文本的字体大小。 该属性会在将来的版本中移除,请使用 editBox.textLabel.fontSize。 */
  14775. fontSize: number;
  14776. /** !#en Change the lineHeight of displayed text. This property will be removed in the future, use editBox.textLabel.lineHeight instead.
  14777. !#zh 输入框文本的行高。该属性会在将来的版本中移除,请使用 editBox.textLabel.lineHeight */
  14778. lineHeight: number;
  14779. /** !#en Font color of the input text. This property will be removed in the future, use editBox.textLabel.node.color instead.
  14780. !#zh 输入框文本的颜色。该属性会在将来的版本中移除,请使用 editBox.textLabel.node.color */
  14781. fontColor: Color;
  14782. /** !#en The display text of placeholder.
  14783. !#zh 输入框占位符的文本内容。 */
  14784. placeholder: string;
  14785. /** !#en The font size of placeholder. This property will be removed in the future, use editBox.placeholderLabel.fontSize instead.
  14786. !#zh 输入框占位符的字体大小。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.fontSize */
  14787. placeholderFontSize: number;
  14788. /** !#en The font color of placeholder. This property will be removed in the future, use editBox.placeholderLabel.node.color instead.
  14789. !#zh 输入框占位符的字体颜色。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.node.color */
  14790. placeholderFontColor: Color;
  14791. /** !#en The maximize input length of EditBox.
  14792. - If pass a value less than 0, it won't limit the input number of characters.
  14793. - If pass 0, it doesn't allow input any characters.
  14794. !#zh 输入框最大允许输入的字符个数。
  14795. - 如果值为小于 0 的值,则不会限制输入字符个数。
  14796. - 如果值为 0,则不允许用户进行任何输入。 */
  14797. maxLength: number;
  14798. /** !#en The input is always visible and be on top of the game view (only useful on Web), this property will be removed on v2.1
  14799. !zh 输入框总是可见,并且永远在游戏视图的上面(这个属性只有在 Web 上面修改有意义),该属性会在 v2.1 中移除
  14800. Note: only available on Web at the moment. */
  14801. stayOnTop: boolean;
  14802. /** !#en Set the tabIndex of the DOM input element (only useful on Web).
  14803. !#zh 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。 */
  14804. tabIndex: number;
  14805. /** !#en The event handler to be called when EditBox began to edit text.
  14806. !#zh 开始编辑文本输入框触发的事件回调。 */
  14807. editingDidBegan: Component.EventHandler[];
  14808. /** !#en The event handler to be called when EditBox text changes.
  14809. !#zh 编辑文本输入框时触发的事件回调。 */
  14810. textChanged: Component.EventHandler[];
  14811. /** !#en The event handler to be called when EditBox edit ends.
  14812. !#zh 结束编辑文本输入框时触发的事件回调。 */
  14813. editingDidEnded: Component.EventHandler[];
  14814. /** !#en The event handler to be called when return key is pressed. Windows is not supported.
  14815. !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 */
  14816. editingReturn: Component.EventHandler[];
  14817. /**
  14818. !#en Let the EditBox get focus, this method will be removed on v2.1
  14819. !#zh 让当前 EditBox 获得焦点, 这个方法会在 v2.1 中移除
  14820. */
  14821. setFocus(): void;
  14822. /**
  14823. !#en Let the EditBox get focus
  14824. !#zh 让当前 EditBox 获得焦点
  14825. */
  14826. focus(): void;
  14827. /**
  14828. !#en Let the EditBox lose focus
  14829. !#zh 让当前 EditBox 失去焦点
  14830. */
  14831. blur(): void;
  14832. /**
  14833. !#en Determine whether EditBox is getting focus or not.
  14834. !#zh 判断 EditBox 是否获得了焦点
  14835. */
  14836. isFocused(): void;
  14837. /**
  14838. !#en if you don't need the EditBox and it isn't in any running Scene, you should
  14839. call the destroy method on this component or the associated node explicitly.
  14840. Otherwise, the created DOM element won't be removed from web page.
  14841. !#zh
  14842. 如果你不再使用 EditBox,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  14843. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  14844. @example
  14845. ```js
  14846. editbox.node.parent = null; // or editbox.node.removeFromParent(false);
  14847. // when you don't need editbox anymore
  14848. editbox.node.destroy();
  14849. ```
  14850. */
  14851. destroy(): boolean;
  14852. }
  14853. /** !#en
  14854. A distance joint constrains two points on two bodies
  14855. to remain at a fixed distance from each other. You can view
  14856. this as a massless, rigid rod.
  14857. !#zh
  14858. 距离关节通过一个固定的长度来约束关节链接的两个刚体。你可以将它想象成一个无质量,坚固的木棍。 */
  14859. export class DistanceJoint extends Joint {
  14860. /** !#en
  14861. The distance separating the two ends of the joint.
  14862. !#zh
  14863. 关节两端的距离 */
  14864. distance: number;
  14865. /** !#en
  14866. The spring frequency.
  14867. !#zh
  14868. 弹性系数。 */
  14869. frequency: number;
  14870. /** !#en
  14871. The damping ratio.
  14872. !#zh
  14873. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  14874. dampingRatio: number;
  14875. }
  14876. /** !#en
  14877. Base class for joints to connect rigidbody.
  14878. !#zh
  14879. 关节类的基类 */
  14880. export class Joint extends Component {
  14881. /** !#en
  14882. The anchor of the rigidbody.
  14883. !#zh
  14884. 刚体的锚点。 */
  14885. anchor: Vec2;
  14886. /** !#en
  14887. The anchor of the connected rigidbody.
  14888. !#zh
  14889. 关节另一端刚体的锚点。 */
  14890. connectedAnchor: Vec2;
  14891. /** !#en
  14892. The rigidbody to which the other end of the joint is attached.
  14893. !#zh
  14894. 关节另一端链接的刚体 */
  14895. connectedBody: RigidBody;
  14896. /** !#en
  14897. Should the two rigid bodies connected with this joint collide with each other?
  14898. !#zh
  14899. 链接到关节上的两个刚体是否应该相互碰撞? */
  14900. collideConnected: boolean;
  14901. /**
  14902. !#en
  14903. Apply current changes to joint, this will regenerate inner box2d joint.
  14904. !#zh
  14905. 应用当前关节中的修改,调用此函数会重新生成内部 box2d 的关节。
  14906. */
  14907. apply(): void;
  14908. /**
  14909. !#en
  14910. Get the anchor point on rigidbody in world coordinates.
  14911. !#zh
  14912. 获取刚体世界坐标系下的锚点。
  14913. */
  14914. getWorldAnchor(): Vec2;
  14915. /**
  14916. !#en
  14917. Get the anchor point on connected rigidbody in world coordinates.
  14918. !#zh
  14919. 获取链接刚体世界坐标系下的锚点。
  14920. */
  14921. getWorldConnectedAnchor(): Vec2;
  14922. /**
  14923. !#en
  14924. Gets the reaction force of the joint.
  14925. !#zh
  14926. 获取关节的反作用力。
  14927. @param timeStep The time to calculate the reaction force for.
  14928. */
  14929. getReactionForce(timeStep: number): Vec2;
  14930. /**
  14931. !#en
  14932. Gets the reaction torque of the joint.
  14933. !#zh
  14934. 获取关节的反扭矩。
  14935. @param timeStep The time to calculate the reaction torque for.
  14936. */
  14937. getReactionTorque(timeStep: number): number;
  14938. }
  14939. /** !#en
  14940. A motor joint is used to control the relative motion
  14941. between two bodies. A typical usage is to control the movement
  14942. of a dynamic body with respect to the ground.
  14943. !#zh
  14944. 马达关节被用来控制两个刚体间的相对运动。
  14945. 一个典型的例子是用来控制一个动态刚体相对于地面的运动。 */
  14946. export class MotorJoint extends Joint {
  14947. /** !#en
  14948. The anchor of the rigidbody.
  14949. !#zh
  14950. 刚体的锚点。 */
  14951. anchor: Vec2;
  14952. /** !#en
  14953. The anchor of the connected rigidbody.
  14954. !#zh
  14955. 关节另一端刚体的锚点。 */
  14956. connectedAnchor: Vec2;
  14957. /** !#en
  14958. The linear offset from connected rigidbody to rigidbody.
  14959. !#zh
  14960. 关节另一端的刚体相对于起始端刚体的位置偏移量 */
  14961. linearOffset: Vec2;
  14962. /** !#en
  14963. The angular offset from connected rigidbody to rigidbody.
  14964. !#zh
  14965. 关节另一端的刚体相对于起始端刚体的角度偏移量 */
  14966. angularOffset: number;
  14967. /** !#en
  14968. The maximum force can be applied to rigidbody.
  14969. !#zh
  14970. 可以应用于刚体的最大的力值 */
  14971. maxForce: number;
  14972. /** !#en
  14973. The maximum torque can be applied to rigidbody.
  14974. !#zh
  14975. 可以应用于刚体的最大扭矩值 */
  14976. maxTorque: number;
  14977. /** !#en
  14978. The position correction factor in the range [0,1].
  14979. !#zh
  14980. 位置矫正系数,范围为 [0, 1] */
  14981. correctionFactor: number;
  14982. }
  14983. /** !#en
  14984. A mouse joint is used to make a point on a body track a
  14985. specified world point. This a soft constraint with a maximum
  14986. force. This allows the constraint to stretch and without
  14987. applying huge forces.
  14988. Mouse Joint will auto register the touch event with the mouse region node,
  14989. and move the choosed rigidbody in touch move event.
  14990. Note : generally mouse joint only used in test bed.
  14991. !#zh
  14992. 鼠标关节用于使刚体上的一个点追踪一个指定的世界坐标系下的位置。
  14993. 鼠标关节可以指定一个最大的里来施加一个柔和的约束。
  14994. 鼠标关节会自动使用 mouse region 节点来注册鼠标事件,并且在触摸移动事件中移动选中的刚体。
  14995. 注意:一般鼠标关节只在测试环境中使用。 */
  14996. export class MouseJoint extends Joint {
  14997. /** !#en
  14998. The anchor of the rigidbody.
  14999. !#zh
  15000. 刚体的锚点。 */
  15001. anchor: Vec2;
  15002. /** !#en
  15003. The anchor of the connected rigidbody.
  15004. !#zh
  15005. 关节另一端刚体的锚点。 */
  15006. connectedAnchor: Vec2;
  15007. /** !#en
  15008. The node used to register touch evnet.
  15009. If this is null, it will be the joint's node.
  15010. !#zh
  15011. 用于注册触摸事件的节点。
  15012. 如果没有设置这个值,那么将会使用关节的节点来注册事件。 */
  15013. mouseRegion: Node;
  15014. /** !#en
  15015. The target point.
  15016. The mouse joint will move choosed rigidbody to target point.
  15017. !#zh
  15018. 目标点,鼠标关节将会移动选中的刚体到指定的目标点 */
  15019. target: Vec2;
  15020. /** !#en
  15021. The spring frequency.
  15022. !#zh
  15023. 弹簧系数。 */
  15024. frequency: number;
  15025. /** !#en
  15026. The damping ratio.
  15027. !#zh
  15028. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15029. 0: number;
  15030. /** !#en
  15031. The maximum force
  15032. !#zh
  15033. 最大阻力值 */
  15034. maxForce: number;
  15035. }
  15036. /** !#en
  15037. A prismatic joint. This joint provides one degree of freedom: translation
  15038. along an axis fixed in rigidbody. Relative rotation is prevented. You can
  15039. use a joint limit to restrict the range of motion and a joint motor to
  15040. drive the motion or to model joint friction.
  15041. !#zh
  15042. 移动关节指定了只能在一个方向上移动刚体。
  15043. 你可以开启关节限制来设置刚体运行移动的间距,也可以开启马达来使用关节马达驱动刚体的运行。 */
  15044. export class PrismaticJoint extends Joint {
  15045. /** !#en
  15046. The local joint axis relative to rigidbody.
  15047. !#zh
  15048. 指定刚体可以移动的方向。 */
  15049. localAxisA: Vec2;
  15050. /** !#en
  15051. The reference angle.
  15052. !#zh
  15053. 相对角度 */
  15054. referenceAngle: number;
  15055. /** !#en
  15056. Enable joint distance limit?
  15057. !#zh
  15058. 是否开启关节的距离限制? */
  15059. enableLimit: boolean;
  15060. /** !#en
  15061. Enable joint motor?
  15062. !#zh
  15063. 是否开启关节马达? */
  15064. enableMotor: boolean;
  15065. /** !#en
  15066. The lower joint limit.
  15067. !#zh
  15068. 刚体能够移动的最小值 */
  15069. lowerLimit: number;
  15070. /** !#en
  15071. The upper joint limit.
  15072. !#zh
  15073. 刚体能够移动的最大值 */
  15074. upperLimit: number;
  15075. /** !#en
  15076. The maxium force can be applied to rigidbody to rearch the target motor speed.
  15077. !#zh
  15078. 可以施加到刚体的最大力。 */
  15079. maxMotorForce: number;
  15080. /** !#en
  15081. The expected motor speed.
  15082. !#zh
  15083. 期望的马达速度。 */
  15084. motorSpeed: number;
  15085. }
  15086. /** !#en
  15087. A revolute joint constrains two bodies to share a common point while they
  15088. are free to rotate about the point. The relative rotation about the shared
  15089. point is the joint angle. You can limit the relative rotation with
  15090. a joint limit that specifies a lower and upper angle. You can use a motor
  15091. to drive the relative rotation about the shared point. A maximum motor torque
  15092. is provided so that infinite forces are not generated.
  15093. !#zh
  15094. 旋转关节可以约束两个刚体围绕一个点来进行旋转。
  15095. 你可以通过开启关节限制来限制旋转的最大角度和最小角度。
  15096. 你可以通过开启马达来施加一个扭矩力来驱动这两个刚体在这一点上的相对速度。 */
  15097. export class RevoluteJoint extends Joint {
  15098. /** !#en
  15099. The reference angle.
  15100. An angle between bodies considered to be zero for the joint angle.
  15101. !#zh
  15102. 相对角度。
  15103. 两个物体之间角度为零时可以看作相等于关节角度 */
  15104. referenceAngle: number;
  15105. /** !#en
  15106. The lower angle.
  15107. !#zh
  15108. 角度的最低限制。 */
  15109. lowerAngle: number;
  15110. /** !#en
  15111. The upper angle.
  15112. !#zh
  15113. 角度的最高限制。 */
  15114. upperAngle: number;
  15115. /** !#en
  15116. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15117. !#zh
  15118. 可以施加到刚体的最大扭矩。 */
  15119. maxMotorTorque: number;
  15120. /** !#en
  15121. The expected motor speed.
  15122. !#zh
  15123. 期望的马达速度。 */
  15124. motorSpeed: number;
  15125. /** !#en
  15126. Enable joint limit?
  15127. !#zh
  15128. 是否开启关节的限制? */
  15129. enableLimit: boolean;
  15130. /** !#en
  15131. Enable joint motor?
  15132. !#zh
  15133. 是否开启关节马达? */
  15134. enableMotor: boolean;
  15135. /**
  15136. !#en
  15137. Get the joint angle.
  15138. !#zh
  15139. 获取关节角度。
  15140. */
  15141. getJointAngle(): number;
  15142. }
  15143. /** !#en
  15144. A rope joint enforces a maximum distance between two points
  15145. on two bodies. It has no other effect.
  15146. Warning: if you attempt to change the maximum length during
  15147. the simulation you will get some non-physical behavior.
  15148. !#zh
  15149. 绳子关节只指定两个刚体间的最大距离,没有其他的效果。
  15150. 注意:如果你试图动态修改关节的长度,这有可能会得到一些意外的效果。 */
  15151. export class RopeJoint extends Joint {
  15152. /** !#en
  15153. The max length.
  15154. !#zh
  15155. 最大长度。 */
  15156. maxLength: number;
  15157. }
  15158. /** !#en
  15159. A weld joint essentially glues two bodies together. A weld joint may
  15160. distort somewhat because the island constraint solver is approximate.
  15161. !#zh
  15162. 熔接关节相当于将两个刚体粘在了一起。
  15163. 熔接关节可能会使某些东西失真,因为约束求解器算出的都是近似值。 */
  15164. export class WeldJoint extends Joint {
  15165. /** !#en
  15166. The reference angle.
  15167. !#zh
  15168. 相对角度。 */
  15169. referenceAngle: number;
  15170. /** !#en
  15171. The frequency.
  15172. !#zh
  15173. 弹性系数。 */
  15174. frequency: number;
  15175. /** !#en
  15176. The damping ratio.
  15177. !#zh
  15178. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15179. 0: number;
  15180. }
  15181. /** !#en
  15182. A wheel joint. This joint provides two degrees of freedom: translation
  15183. along an axis fixed in bodyA and rotation in the plane. You can use a joint motor to drive
  15184. the rotation or to model rotational friction.
  15185. This joint is designed for vehicle suspensions.
  15186. !#zh
  15187. 轮子关节提供两个维度的自由度:旋转和沿着指定方向上位置的移动。
  15188. 你可以通过开启关节马达来使用马达驱动刚体的旋转。
  15189. 轮组关节是专门为机动车类型设计的。 */
  15190. export class WheelJoint extends Joint {
  15191. /** !#en
  15192. The local joint axis relative to rigidbody.
  15193. !#zh
  15194. 指定刚体可以移动的方向。 */
  15195. localAxisA: Vec2;
  15196. /** !#en
  15197. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15198. !#zh
  15199. 可以施加到刚体的最大扭矩。 */
  15200. maxMotorTorque: number;
  15201. /** !#en
  15202. The expected motor speed.
  15203. !#zh
  15204. 期望的马达速度。 */
  15205. motorSpeed: number;
  15206. /** !#en
  15207. Enable joint motor?
  15208. !#zh
  15209. 是否开启关节马达? */
  15210. enableMotor: boolean;
  15211. /** !#en
  15212. The spring frequency.
  15213. !#zh
  15214. 弹性系数。 */
  15215. frequency: number;
  15216. /** !#en
  15217. The damping ratio.
  15218. !#zh
  15219. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15220. dampingRatio: number;
  15221. }
  15222. /** undefined */
  15223. export class PhysicsBoxCollider extends PhysicsCollider implements Collider.Box {
  15224. /** !#en Position offset
  15225. !#zh 位置偏移量 */
  15226. offset: Vec2;
  15227. /** !#en Box size
  15228. !#zh 包围盒大小 */
  15229. size: Size;
  15230. }
  15231. /** undefined */
  15232. export class PhysicsChainCollider extends PolygonCollider {
  15233. /** !#en Whether the chain is loop
  15234. !#zh 链条是否首尾相连 */
  15235. loop: boolean;
  15236. /** !#en Chain points
  15237. !#zh 链条顶点数组 */
  15238. points: Vec2[];
  15239. }
  15240. /** undefined */
  15241. export class PhysicsCircleCollider extends PhysicsCollider implements Collider.Circle {
  15242. /** !#en Position offset
  15243. !#zh 位置偏移量 */
  15244. offset: Vec2;
  15245. /** !#en Circle radius
  15246. !#zh 圆形半径 */
  15247. radius: number;
  15248. }
  15249. /** undefined */
  15250. export class PhysicsCollider extends Collider {
  15251. /** !#en
  15252. The density.
  15253. !#zh
  15254. 密度 */
  15255. density: number;
  15256. /** !#en
  15257. A sensor collider collects contact information but never generates a collision response
  15258. !#zh
  15259. 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。 */
  15260. sensor: boolean;
  15261. /** !#en
  15262. The friction coefficient, usually in the range [0,1].
  15263. !#zh
  15264. 摩擦系数,取值一般在 [0, 1] 之间 */
  15265. friction: number;
  15266. /** !#en
  15267. The restitution (elasticity) usually in the range [0,1].
  15268. !#zh
  15269. 弹性系数,取值一般在 [0, 1]之间 */
  15270. restitution: number;
  15271. /** !#en
  15272. Physics collider will find the rigidbody component on the node and set to this property.
  15273. !#zh
  15274. 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。 */
  15275. body: RigidBody;
  15276. /**
  15277. !#en
  15278. Apply current changes to collider, this will regenerate inner box2d fixtures.
  15279. !#zh
  15280. 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
  15281. */
  15282. apply(): void;
  15283. /**
  15284. !#en
  15285. Get the world aabb of the collider
  15286. !#zh
  15287. 获取碰撞体的世界坐标系下的包围盒
  15288. */
  15289. getAABB(): void;
  15290. }
  15291. /** undefined */
  15292. export class PhysicsPolygonCollider extends PhysicsCollider implements Collider.Polygon {
  15293. /** !#en Position offset
  15294. !#zh 位置偏移量 */
  15295. offset: Vec2;
  15296. /** !#en Polygon points
  15297. !#zh 多边形顶点数组 */
  15298. points: Vec2[];
  15299. }
  15300. /** Rigid body interface */
  15301. export class IRigidBody {
  15302. rigidBody: RigidBody3D;
  15303. mass: number;
  15304. linearDamping: number;
  15305. angularDamping: number;
  15306. isKinematic: boolean;
  15307. useGravity: boolean;
  15308. fixedRotation: boolean;
  15309. linearFactor: IVec3Like;
  15310. angularFactor: IVec3Like;
  15311. allowSleep: boolean;
  15312. isAwake: boolean;
  15313. isSleepy: boolean;
  15314. isSleeping: boolean;
  15315. wakeUp(): void;
  15316. sleep(): void;
  15317. /**
  15318. @param out out
  15319. */
  15320. getLinearVelocity(out: IVec3Like): void;
  15321. /**
  15322. @param out out
  15323. */
  15324. setLinearVelocity(out: IVec3Like): void;
  15325. /**
  15326. @param out out
  15327. */
  15328. getAngularVelocity(out: IVec3Like): void;
  15329. /**
  15330. @param out out
  15331. */
  15332. setAngularVelocity(out: IVec3Like): void;
  15333. /**
  15334. @param force force
  15335. @param relativePoint relativePoint
  15336. */
  15337. applyForce(force: IVec3Like, relativePoint: IVec3Like): void;
  15338. /**
  15339. @param force force
  15340. @param relativePoint relativePoint
  15341. */
  15342. applyLocalForce(force: IVec3Like, relativePoint: IVec3Like): void;
  15343. /**
  15344. @param force force
  15345. @param relativePoint relativePoint
  15346. */
  15347. applyImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  15348. /**
  15349. @param force force
  15350. @param relativePoint relativePoint
  15351. */
  15352. applyLocalImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  15353. /**
  15354. @param torque torque
  15355. */
  15356. applyTorque(torque: IVec3Like): void;
  15357. /**
  15358. @param torque torque
  15359. */
  15360. applyLocalTorque(torque: IVec3Like): void;
  15361. }
  15362. /** Class has x y z properties */
  15363. export class IVec3Like {
  15364. x: number;
  15365. y: number;
  15366. z: number;
  15367. }
  15368. /** Class has x y z w properties */
  15369. export class IQuatLike {
  15370. x: number;
  15371. y: number;
  15372. z: number;
  15373. w: number;
  15374. }
  15375. /** !#en Base shape interface. */
  15376. export class IBaseShape {
  15377. collider: Collider3D;
  15378. attachedRigidBody: RigidBody3D|void;
  15379. material: any;
  15380. isTrigger: boolean;
  15381. center: IVec3Like;
  15382. }
  15383. /** !#en box shape interface */
  15384. export class IBoxShape {
  15385. size: IVec3Like;
  15386. }
  15387. /** !#en Sphere shape interface */
  15388. export class ISphereShape {
  15389. radius: number;
  15390. }
  15391. /** Ray cast options */
  15392. export class IRaycastOptions {
  15393. groupIndex: number;
  15394. queryTrigger: boolean;
  15395. maxDistance: number;
  15396. }
  15397. /** Collision detect */
  15398. export class ICollisionDetect {
  15399. /**
  15400. Ray cast, and return information of the closest hit.
  15401. @param worldRay worldRay
  15402. @param options options
  15403. @param out out
  15404. */
  15405. raycastClosest(worldRay: geomUtils.Ray, options: IRaycastOptions, out: PhysicsRayResult): boolean;
  15406. /**
  15407. Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.
  15408. @param worldRay worldRay
  15409. @param options options
  15410. @param pool pool
  15411. @param resultes resultes
  15412. */
  15413. raycast(worldRay: geomUtils.Ray, options: IRaycastOptions, pool: RecyclePool, resultes: PhysicsRayResult[]): boolean;
  15414. }
  15415. /** Physics world interface */
  15416. export class IPhysicsWorld {
  15417. }
  15418. /** !#en The rigid body type
  15419. !#zh 刚体类型 */
  15420. export enum ERigidBodyType {
  15421. DYNAMIC = 0,
  15422. STATIC = 0,
  15423. KINEMATIC = 0,
  15424. }
  15425. /** !#en
  15426. Trigger event
  15427. !#zh
  15428. 触发事件。 */
  15429. export class ITriggerEvent {
  15430. /** !#en
  15431. The type of event fired
  15432. !#zh
  15433. 触发的事件类型 */
  15434. type: string;
  15435. /** !#en
  15436. Triggers its own collider in the event
  15437. !#zh
  15438. 触发事件中的自己的碰撞器 */
  15439. selfCollider: Collider3D;
  15440. /** !#en
  15441. Triggers another collider in the event
  15442. !#zh
  15443. 触发事件中的另一个碰撞器 */
  15444. otherCollider: Collider3D;
  15445. }
  15446. /** !#en
  15447. Collision information for collision events.
  15448. !#zh
  15449. 碰撞事件的碰撞信息。 */
  15450. export class IContactEquation {
  15451. /** !#en
  15452. The collision point A in the collision information.
  15453. !#zh
  15454. 碰撞信息中的碰撞点 A。 */
  15455. contactA: Vec3;
  15456. /** !#en
  15457. Collision point B in collision information.
  15458. !#zh
  15459. 碰撞信息中的碰撞点 B。 */
  15460. contactB: Vec3;
  15461. /** !#en
  15462. Normals in collision information.
  15463. !#zh
  15464. 碰撞信息中的法线。 */
  15465. normal: Vec3;
  15466. }
  15467. /** !#en
  15468. Collision events.
  15469. !#zh
  15470. 碰撞事件。 */
  15471. export class ICollisionEvent {
  15472. /** !#en
  15473. Event type of collision.
  15474. !#zh
  15475. 碰撞的事件类型。 */
  15476. type: string;
  15477. /** !#en
  15478. Collider of its own in collision.
  15479. !#zh
  15480. 碰撞中的自己的碰撞器。 */
  15481. selfCollider: Collider3D;
  15482. /** !#en
  15483. Another collider in the collision.
  15484. !#zh
  15485. 碰撞中的另一个碰撞器。 */
  15486. otherCollider: Collider3D;
  15487. /** !#en
  15488. Information about all the points of impact in the collision.
  15489. !#zh
  15490. 碰撞中的所有碰撞点的信息。 */
  15491. contacts: IContactEquation[];
  15492. }
  15493. /** !#en
  15494. Physical systems manager.
  15495. !#zh
  15496. 物理系统管理器。 */
  15497. export class Physics3DManager {
  15498. /** !#en
  15499. Whether to enable the physics system, default is false.
  15500. !#zh
  15501. 是否启用物理系统,默认不启用。 */
  15502. enabled: boolean;
  15503. /** !#en
  15504. Whether to allow the physics system to automatically hibernate, default is true.
  15505. !#zh
  15506. 物理系统是否允许自动休眠,默认为 true。 */
  15507. allowSleep: boolean;
  15508. /** !#en
  15509. The maximum number of sub-steps a full step is permitted to be broken into, default is 2.
  15510. !#zh
  15511. 物理每帧模拟的最大子步数,默认为 2。 */
  15512. maxSubStep: number;
  15513. /** !#en
  15514. Time spent in each simulation of physics, default is 1/60s.
  15515. !#zh
  15516. 物理每步模拟消耗的固定时间,默认为 1/60 秒。 */
  15517. deltaTime: number;
  15518. /** !#en
  15519. Whether to use a fixed time step.
  15520. !#zh
  15521. 是否使用固定的时间步长。 */
  15522. useFixedTime: boolean;
  15523. /** !#en
  15524. Gravity value of the physics simulation, default is (0, -10, 0).
  15525. !#zh
  15526. 物理世界的重力数值,默认为 (0, -10, 0)。 */
  15527. gravity: Vec3;
  15528. /** !#en
  15529. Gets the global default physical material. Note that builtin is null.
  15530. !#zh
  15531. 获取全局的默认物理材质,注意:builtin 时为 null。 */
  15532. defaultMaterial: PhysicsMaterial|void;
  15533. /**
  15534. !#en
  15535. A physical system simulation is performed once and will now be performed automatically once per frame.
  15536. !#zh
  15537. 执行一次物理系统的模拟,目前将在每帧自动执行一次。
  15538. @param deltaTime The time difference from the last execution is currently elapsed per frame
  15539. */
  15540. update(deltaTime: number): void;
  15541. /**
  15542. !#en Detect all collision boxes and return all detected results, or null if none is detected. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.
  15543. !#zh 检测所有的碰撞盒,并返回所有被检测到的结果,若没有检测到,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  15544. @param worldRay A ray in world space
  15545. @param groupIndexOrName Collision group index or group name
  15546. @param maxDistance Maximum detection distance
  15547. @param queryTrigger Detect trigger or not
  15548. */
  15549. raycast(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult[];
  15550. /**
  15551. !#en Detect all collision boxes and return the detection result with the shortest ray distance. If not, return null value. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.
  15552. !#zh 检测所有的碰撞盒,并返回射线距离最短的检测结果,若没有,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  15553. @param worldRay A ray in world space
  15554. @param groupIndexOrName Collision group index or group name
  15555. @param maxDistance Maximum detection distance
  15556. @param queryTrigger Detect trigger or not
  15557. */
  15558. raycastClosest(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult;
  15559. }
  15560. /** !#en
  15561. Used to store physical ray detection results
  15562. !#zh
  15563. 用于保存物理射线检测结果 */
  15564. export class PhysicsRayResult {
  15565. /** !#en
  15566. Hit the point
  15567. !#zh
  15568. 击中点 */
  15569. hitPoint: Vec3;
  15570. /** !#en
  15571. Distance
  15572. !#zh
  15573. 距离 */
  15574. distance: number;
  15575. /** !#en
  15576. Hit the collision box
  15577. !#zh
  15578. 击中的碰撞盒 */
  15579. collider: Collider3D;
  15580. /**
  15581. !#en
  15582. Set up ray. This method is used internally by the engine. Do not call it from an external script
  15583. !#zh
  15584. 设置射线,此方法由引擎内部使用,请勿在外部脚本调用
  15585. @param hitPoint hitPoint
  15586. @param distance distance
  15587. @param collider collider
  15588. */
  15589. _assign(hitPoint: Vec3, distance: number, collider: Collider3D): void;
  15590. /**
  15591. !#en
  15592. Clone
  15593. !#zh
  15594. 克隆
  15595. */
  15596. clone(): void;
  15597. }
  15598. /** !#en The shape module of 3d particle.
  15599. !#zh 3D 粒子的发射形状模块 */
  15600. export class ShapeModule {
  15601. /** !#en The enable of shapeModule.
  15602. !#zh 是否启用 */
  15603. enable: boolean;
  15604. /** !#en Particle emitter type.
  15605. !#zh 粒子发射器类型。 */
  15606. shapeType: shapeModule.ShapeType;
  15607. /** !#en The emission site of the particle.
  15608. !#zh 粒子从发射器哪个部位发射。 */
  15609. emitFrom: shapeModule.EmitLocation;
  15610. /** !#en Particle emitter radius.
  15611. !#zh 粒子发射器半径。 */
  15612. radius: number;
  15613. /** !#en Particle emitter emission position (not valid for Box type emitters):<bg>
  15614. - 0 means emitted from the surface;
  15615. - 1 means launch from the center;
  15616. - 0 ~ 1 indicates emission from the center to the surface.
  15617. !#zh 粒子发射器发射位置(对 Box 类型的发射器无效):<bg>
  15618. - 0 表示从表面发射;
  15619. - 1 表示从中心发射;
  15620. - 0 ~ 1 之间表示在中心到表面之间发射。 */
  15621. radiusThickness: number;
  15622. /** !#en The angle between the axis of the cone and the generatrix<bg>
  15623. Determines the opening and closing of the cone launcher
  15624. !#zh 圆锥的轴与母线的夹角<bg>。
  15625. 决定圆锥发射器的开合程度。 */
  15626. angle: number;
  15627. /** !#en Particle emitters emit in a fan-shaped range.
  15628. !#zh 粒子发射器在一个扇形范围内发射。 */
  15629. arc: number;
  15630. /** !#en How particles are emitted in the sector range.
  15631. !#zh 粒子在扇形范围内的发射方式。 */
  15632. arcMode: shapeModule.ArcMode;
  15633. /** !#en Controls the discrete intervals around the arcs where particles might be generated.
  15634. !#zh 控制可能产生粒子的弧周围的离散间隔。 */
  15635. arcSpread: number;
  15636. /** !#en The speed at which particles are emitted around the circumference.
  15637. !#zh 粒子沿圆周发射的速度。 */
  15638. arcSpeed: CurveRange;
  15639. /** !#en Axis length from top of cone to bottom of cone <bg>.
  15640. Determines the height of the cone emitter.
  15641. !#zh 圆锥顶部截面距离底部的轴长<bg>。
  15642. 决定圆锥发射器的高度。 */
  15643. length: number;
  15644. /** !#en Particle emitter emission location (for box-type particle emitters).
  15645. !#zh 粒子发射器发射位置(针对 Box 类型的粒子发射器。 */
  15646. boxThickness: Vec3;
  15647. /** !#en Particle Emitter Position
  15648. !#zh 粒子发射器位置。 */
  15649. position: Vec3;
  15650. /** !#en Particle emitter rotation angle.
  15651. !#zh 粒子发射器旋转角度。 */
  15652. rotation: Vec3;
  15653. /** !#en Particle emitter scaling
  15654. !#zh 粒子发射器缩放比例。 */
  15655. scale: Vec3;
  15656. /** !#en The direction of particle movement is determined based on the initial direction of the particles.
  15657. !#zh 根据粒子的初始方向决定粒子的移动方向。 */
  15658. alignToDirection: boolean;
  15659. /** !#en Set particle generation direction randomly.
  15660. !#zh 粒子生成方向随机设定。 */
  15661. randomDirectionAmount: number;
  15662. /** !#en Interpolation between the current emission direction and the direction from the current position to the center of the node.
  15663. !#zh 表示当前发射方向与当前位置到结点中心连线方向的插值。 */
  15664. sphericalDirectionAmount: number;
  15665. }
  15666. /** !#en The color over time module of 3d particle.
  15667. !#zh 3D 粒子颜色变化模块 */
  15668. export class ColorOvertimeModule {
  15669. /** !#en The enable of ColorOvertimeModule.
  15670. !#zh 是否启用 */
  15671. enable: boolean;
  15672. }
  15673. /** !#en The curve range of target value.
  15674. !#zh 目标值的曲线范围 */
  15675. export class CurveRange {
  15676. /** !#en Curve type.
  15677. !#zh 曲线类型。 */
  15678. mode: debug.DebugMode;
  15679. /** !#en The curve to use when mode is Curve.
  15680. !#zh 当 mode 为 Curve 时,使用的曲线。 */
  15681. curve: AnimationCurve;
  15682. /** !#en The lower limit of the curve to use when mode is TwoCurves
  15683. !#zh 当 mode 为 TwoCurves 时,使用的曲线下限。 */
  15684. curveMin: AnimationCurve;
  15685. /** !#en The upper limit of the curve to use when mode is TwoCurves
  15686. !#zh 当 mode 为 TwoCurves 时,使用的曲线上限。 */
  15687. curveMax: AnimationCurve;
  15688. /** !#en When mode is Constant, the value of the curve.
  15689. !#zh 当 mode 为 Constant 时,曲线的值。 */
  15690. constant: number;
  15691. /** !#en The lower limit of the curve to use when mode is TwoConstants
  15692. !#zh 当 mode 为 TwoConstants 时,曲线的下限。 */
  15693. constantMin: number;
  15694. /** !#en The upper limit of the curve to use when mode is TwoConstants
  15695. !#zh 当 mode 为 TwoConstants 时,曲线的上限。 */
  15696. constantMax: number;
  15697. /** !#en Coefficients applied to curve interpolation.
  15698. !#zh 应用于曲线插值的系数。 */
  15699. multiplier: number;
  15700. }
  15701. /** !#en The force over time module of 3d particle.
  15702. !#zh 3D 粒子的加速度模块 */
  15703. export class ForceOvertimeModule {
  15704. /** !#en The enable of ColorOvertimeModule.
  15705. !#zh 是否启用 */
  15706. enable: boolean;
  15707. /** !#en Coordinate system used in acceleration calculation.
  15708. !#zh 加速度计算时采用的坐标系。 */
  15709. space: Space;
  15710. /** !#en X-axis acceleration component.
  15711. !#zh X 轴方向上的加速度分量。 */
  15712. x: CurveRange;
  15713. /** !#en Y-axis acceleration component.
  15714. !#zh Y 轴方向上的加速度分量。 */
  15715. y: CurveRange;
  15716. /** !#en Z-axis acceleration component.
  15717. !#zh Z 轴方向上的加速度分量。 */
  15718. z: CurveRange;
  15719. }
  15720. /** !#en The gradient range of color.
  15721. !#zh 颜色值的渐变范围 */
  15722. export class GradientRange {
  15723. /** !#en Gradient type.
  15724. !#zh 渐变色类型。 */
  15725. mode: debug.DebugMode;
  15726. /** !#en The color when mode is Color.
  15727. !#zh 当 mode 为 Color 时的颜色。 */
  15728. color: Color;
  15729. /** !#en Lower color limit when mode is TwoColors.
  15730. !#zh 当 mode 为 TwoColors 时的颜色下限。 */
  15731. colorMin: Color;
  15732. /** !#en Upper color limit when mode is TwoColors.
  15733. !#zh 当 mode 为 TwoColors 时的颜色上限。 */
  15734. colorMax: Color;
  15735. /** !#en Color gradient when mode is Gradient
  15736. !#zh 当 mode 为 Gradient 时的颜色渐变。 */
  15737. gradient: Gradient;
  15738. /** !#en Lower color gradient limit when mode is TwoGradients.
  15739. !#zh 当 mode 为 TwoGradients 时的颜色渐变下限。 */
  15740. gradientMin: Gradient;
  15741. /** !#en Upper color gradient limit when mode is TwoGradients.
  15742. !#zh 当 mode 为 TwoGradients 时的颜色渐变上限。 */
  15743. gradientMax: Gradient;
  15744. }
  15745. /** !#en The color key of gradient.
  15746. !#zh color 关键帧 */
  15747. export class ColorKey {
  15748. }
  15749. /** !#en The alpha key of gradient.
  15750. !#zh alpha 关键帧 */
  15751. export class AlphaKey {
  15752. }
  15753. /** !#en The gradient data of color.
  15754. !#zh 颜色渐变数据 */
  15755. export class Gradient {
  15756. }
  15757. /** !#en The limit velocity module of 3d particle.
  15758. !#zh 3D 粒子的限速模块 */
  15759. export class LimitVelocityOvertimeModule {
  15760. /** !#en The enable of LimitVelocityOvertimeModule.
  15761. !#zh 是否启用 */
  15762. enable: boolean;
  15763. /** !#en The coordinate system used when calculating the lower speed limit.
  15764. !#zh 计算速度下限时采用的坐标系。 */
  15765. space: Space;
  15766. /** !#en Whether to limit the three axes separately.
  15767. !#zh 是否三个轴分开限制。 */
  15768. separateAxes: boolean;
  15769. /** !#en Lower speed limit
  15770. !#zh 速度下限。 */
  15771. limit: CurveRange;
  15772. /** !#en Lower speed limit in X direction.
  15773. !#zh X 轴方向上的速度下限。 */
  15774. limitX: CurveRange;
  15775. /** !#en Lower speed limit in Y direction.
  15776. !#zh Y 轴方向上的速度下限。 */
  15777. limitY: CurveRange;
  15778. /** !#en Lower speed limit in Z direction.
  15779. !#zh Z 轴方向上的速度下限。 */
  15780. limitZ: CurveRange;
  15781. /** !#en Interpolation of current speed and lower speed limit.
  15782. !#zh 当前速度与速度下限的插值。 */
  15783. dampen: number;
  15784. }
  15785. /** !#en The optimized curve.
  15786. !#zh 优化曲线 */
  15787. export class OptimizedCurve {
  15788. }
  15789. /** !#en The rotation module of 3d particle.
  15790. !#zh 3D 粒子的旋转模块 */
  15791. export class RotationOvertimeModule {
  15792. /** !#en The enable of RotationOvertimeModule.
  15793. !#zh 是否启用 */
  15794. enable: boolean;
  15795. /** !#en Whether to set the rotation of three axes separately (not currently supported)
  15796. !#zh 是否三个轴分开设定旋转(暂不支持)。 */
  15797. separateAxes: boolean;
  15798. /** !#en Set rotation around X axis.
  15799. !#zh 绕 X 轴设定旋转。 */
  15800. x: CurveRange;
  15801. /** !#en Set rotation around Y axis.
  15802. !#zh 绕 Y 轴设定旋转。 */
  15803. y: CurveRange;
  15804. /** !#en Set rotation around Z axis.
  15805. !#zh 绕 Z 轴设定旋转。 */
  15806. z: CurveRange;
  15807. }
  15808. /** !#en The size module of 3d particle.
  15809. !#zh 3D 粒子的大小模块 */
  15810. export class SizeOvertimeModule {
  15811. /** !#en The enable of SizeOvertimeModule.
  15812. !#zh 是否启用 */
  15813. enable: boolean;
  15814. /** !#en Decide whether to control particle size independently on each axis.
  15815. !#zh 决定是否在每个轴上独立控制粒子大小。 */
  15816. separateAxes: boolean;
  15817. /** !#en Define a curve to determine the size change of particles during their life cycle.
  15818. !#zh 定义一条曲线来决定粒子在其生命周期中的大小变化。 */
  15819. size: CurveRange;
  15820. /** !#en Defines a curve to determine the size change of particles in the X-axis direction during their life cycle.
  15821. !#zh 定义一条曲线来决定粒子在其生命周期中 X 轴方向上的大小变化。 */
  15822. x: CurveRange;
  15823. /** !#en Defines a curve to determine the size change of particles in the Y-axis direction during their life cycle.
  15824. !#zh 定义一条曲线来决定粒子在其生命周期中 Y 轴方向上的大小变化。 */
  15825. y: CurveRange;
  15826. /** !#en Defines a curve to determine the size change of particles in the Z-axis direction during their life cycle.
  15827. !#zh 定义一条曲线来决定粒子在其生命周期中 Z 轴方向上的大小变化。 */
  15828. z: CurveRange;
  15829. }
  15830. /** !#en The texture animation module of 3d particle.
  15831. !#zh 3D 粒子的贴图动画模块 */
  15832. export class TextureAnimationModule {
  15833. /** !#en The enable of TextureAnimationModule.
  15834. !#zh 是否启用 */
  15835. enable: boolean;
  15836. /** !#en Set the type of particle map animation (only supports Grid mode for the time being)
  15837. !#zh 设定粒子贴图动画的类型(暂只支持 Grid 模式。 */
  15838. mode: debug.DebugMode;
  15839. /** !#en Animation frames in X direction.
  15840. !#zh X 方向动画帧数。 */
  15841. numTilesX: number;
  15842. /** !#en Animation frames in Y direction.
  15843. !#zh Y 方向动画帧数。 */
  15844. numTilesY: number;
  15845. /** !#en The way of the animation plays.
  15846. !#zh 动画播放方式。 */
  15847. animation: Animation;
  15848. /** !#en Randomly select a line from the animated map to generate the animation. <br>
  15849. This option only takes effect when the animation playback mode is SingleRow.
  15850. !#zh 随机从动画贴图中选择一行以生成动画。<br>
  15851. 此选项仅在动画播放方式为 SingleRow 时生效。 */
  15852. randomRow: boolean;
  15853. /** !#en Select specific lines from the animation map to generate the animation. <br>
  15854. This option is only available when the animation playback mode is SingleRow and randomRow is disabled.
  15855. !#zh 从动画贴图中选择特定行以生成动画。<br>
  15856. 此选项仅在动画播放方式为 SingleRow 时且禁用 randomRow 时可用。 */
  15857. rowIndex: number;
  15858. /** !#en Frame and time curve of animation playback in one cycle.
  15859. !#zh 一个周期内动画播放的帧与时间变化曲线。 */
  15860. frameOverTime: CurveRange;
  15861. /** !#en Play from which frames, the time is the life cycle of the entire particle system.
  15862. !#zh 从第几帧开始播放,时间为整个粒子系统的生命周期。 */
  15863. startFrame: CurveRange;
  15864. /** !#en Number of playback loops in a life cycle.
  15865. !#zh 一个生命周期内播放循环的次数。 */
  15866. cycleCount: number;
  15867. }
  15868. /** !#en The velocity module of 3d particle.
  15869. !#zh 3D 粒子的速度模块 */
  15870. export class VelocityOvertimeModule {
  15871. /** !#en The enable of VelocityOvertimeModule.
  15872. !#zh 是否启用 */
  15873. enable: boolean;
  15874. /** !#en Coordinate system used in speed calculation.
  15875. !#zh 速度计算时采用的坐标系。 */
  15876. space: Space;
  15877. /** !#en Velocity component in X axis direction
  15878. !#zh X 轴方向上的速度分量。 */
  15879. x: CurveRange;
  15880. /** !#en Velocity component in Y axis direction
  15881. !#zh Y 轴方向上的速度分量。 */
  15882. y: CurveRange;
  15883. /** !#en Velocity component in Z axis direction
  15884. !#zh Z 轴方向上的速度分量。 */
  15885. z: CurveRange;
  15886. /** !#en Speed correction factor (only supports CPU particles).
  15887. !#zh 速度修正系数(只支持 CPU 粒子)。 */
  15888. speedModifier: CurveRange;
  15889. }
  15890. /** !#en The trail module of 3d particle.
  15891. !#zh 3D 粒子拖尾模块 */
  15892. export class TrailModule {
  15893. /** !#en The enable of trailModule.
  15894. !#zh 是否启用 */
  15895. enable: boolean;
  15896. /** !#en Sets how particles generate trajectories.
  15897. !#zh 设定粒子生成轨迹的方式。 */
  15898. mode: trailModule.TrailMode;
  15899. /** !#en Life cycle of trajectory.
  15900. !#zh 轨迹存在的生命周期。 */
  15901. lifeTime: CurveRange;
  15902. /** !#en Minimum spacing between each track particle
  15903. !#zh 每个轨迹粒子之间的最小间距。 */
  15904. minParticleDistance: number;
  15905. /** !#en The coordinate system of trajectories.
  15906. !#zh 轨迹设定时的坐标系。 */
  15907. space: Space;
  15908. /** !#en Whether the particle itself exists.
  15909. !#zh 粒子本身是否存在。 */
  15910. existWithParticles: boolean;
  15911. /** !#en Set the texture fill method
  15912. !#zh 设定纹理填充方式。 */
  15913. textureMode: trailModule.TextureMode;
  15914. /** !#en Whether to use particle width
  15915. !#zh 是否使用粒子的宽度。 */
  15916. widthFromParticle: boolean;
  15917. /** !#en Curves that control track length
  15918. !#zh 控制轨迹长度的曲线。 */
  15919. widthRatio: CurveRange;
  15920. /** !#en Whether to use particle color
  15921. !#zh 是否使用粒子的颜色。 */
  15922. colorFromParticle: boolean;
  15923. /** !#en The color of trajectories.
  15924. !#zh 轨迹的颜色。 */
  15925. colorOverTrail: GradientRange;
  15926. /** !#en Trajectories color over time.
  15927. !#zh 轨迹随时间变化的颜色。 */
  15928. colorOvertime: GradientRange;
  15929. }
  15930. /** !#en Manage Dynamic Atlas Manager. Dynamic Atlas Manager is used for merging textures at runtime, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details.
  15931. !#zh 管理动态图集。动态图集用于在运行时对贴图进行合并,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  15932. export class DynamicAtlasManager {
  15933. /** !#en Enable or disable the dynamic atlas, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details.
  15934. !#zh 开启或者关闭动态图集,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  15935. enabled: boolean;
  15936. /** !#en The maximum number of atlas that can be created.
  15937. !#zh 可以创建的最大图集数量。 */
  15938. maxAtlasCount: number;
  15939. /** !#en Is enable textureBleeding.
  15940. !#zh 是否开启 textureBleeding */
  15941. textureBleeding: boolean;
  15942. /** !#en The size of the atlas that was created
  15943. !#zh 创建的图集的宽高 */
  15944. textureSize: number;
  15945. /** !#en The maximum size of the picture that can be added to the atlas.
  15946. !#zh 可以添加进图集的图片的最大尺寸。 */
  15947. maxFrameSize: number;
  15948. /** !#en The minimum size of the picture that can be added to the atlas.
  15949. !#zh 可以添加进图集的图片的最小尺寸。 */
  15950. minFrameSize: number;
  15951. /**
  15952. !#en Append a sprite frame into the dynamic atlas.
  15953. !#zh 添加碎图进入动态图集。
  15954. @param spriteFrame spriteFrame
  15955. */
  15956. insertSpriteFrame(spriteFrame: SpriteFrame): void;
  15957. /**
  15958. !#en Resets all dynamic atlas, and the existing ones will be destroyed.
  15959. !#zh 重置所有动态图集,已有的动态图集会被销毁。
  15960. */
  15961. reset(): void;
  15962. /**
  15963. !#en Displays all the dynamic atlas in the current scene, which you can use to view the current atlas state.
  15964. !#zh 在当前场景中显示所有动态图集,可以用来查看当前的合图状态。
  15965. @param show show
  15966. */
  15967. showDebug(show: boolean): void;
  15968. }
  15969. /** !#en
  15970. Physics material.
  15971. !#zh
  15972. 物理材质。 */
  15973. export class PhysicsMaterial extends Asset {
  15974. /** !#en
  15975. Friction for this material.
  15976. !#zh
  15977. 物理材质的摩擦力。 */
  15978. friction: number;
  15979. /** !#en
  15980. Restitution for this material.
  15981. !#zh
  15982. 物理材质的弹力。 */
  15983. restitution: number;
  15984. }
  15985. /** !#en
  15986. Each frame applies a constant force to a rigid body, depending on the RigidBody3D
  15987. !#zh
  15988. 在每帧对一个刚体施加持续的力,依赖 RigidBody3D 组件 */
  15989. export class ConstantForce extends Component {
  15990. /** !#en
  15991. Set the force used in the world coordinate system, use `this.force = otherVec3`.
  15992. !#zh
  15993. 设置世界坐标系中使用的力,设置时请用 `this.force = otherVec3` 的方式。 */
  15994. force: Vec3;
  15995. /** !#en
  15996. Set the force used in the local coordinate system, using `this.localforce = otherVec3`.
  15997. !#zh
  15998. 获取和设置本地坐标系中使用的力,设置时请用 `this.localForce = otherVec3` 的方式。 */
  15999. localForce: Vec3;
  16000. /** !#en
  16001. Torque applied to the world orientation
  16002. !#zh
  16003. 对世界朝向施加的扭矩 */
  16004. torque: Vec3;
  16005. /** !#en
  16006. Torque applied to local orientation, using `this.localtorque = otherVec3`.
  16007. !#zh
  16008. 对本地朝向施加的扭矩,设置时请用 `this.localTorque = otherVec3` 的方式。 */
  16009. localTorque: Vec3;
  16010. }
  16011. /** !#en
  16012. RigidBody is the basic object that make up the physical world, and it can make a node physically affected and react.
  16013. !#zh
  16014. 刚体是组成物理世界的基本对象,可以让一个节点受到物理影响并产生反应。该组件在使用 Builtin 物理引擎时无效。 */
  16015. export class RigidBody3D extends Component {
  16016. /** !#en
  16017. Whether sleep is allowed.
  16018. !#zh
  16019. 是否允许休眠。 */
  16020. allowSleep: boolean;
  16021. /** !#en
  16022. The mass of the rigidbody.
  16023. !#zh
  16024. 刚体的质量。 */
  16025. mass: number;
  16026. /** !#en
  16027. Used to reduce the linear rate of rigidbody. The larger the value, the slower the rigidbody moves.
  16028. !#zh
  16029. 线性阻尼,用于减小刚体的线性速率,值越大物体移动越慢。 */
  16030. linearDamping: number;
  16031. /** !#en
  16032. Used to reduce the rotation rate of rigidbody. The larger the value, the slower the rigidbody rotates.
  16033. !#zh
  16034. 角阻尼,用于减小刚体的旋转速率,值越大刚体旋转越慢。 */
  16035. angularDamping: number;
  16036. /** !#en
  16037. If enabled, the developer controls the displacement and rotation of the rigidbody, not the physics engine.
  16038. !#zh
  16039. 是否由开发者来控制刚体的位移和旋转,而不是受物理引擎的影响。 */
  16040. isKinematic: boolean;
  16041. /** !#en
  16042. If enabled, the rigidbody is affected by gravity.
  16043. !#zh
  16044. 如果开启,刚体会受到重力影响。 */
  16045. useGravity: boolean;
  16046. /** !#en
  16047. If enabled, the rigidbody will be fixed without rotation during a collision.
  16048. !#zh
  16049. 如果开启,发生碰撞时会固定刚体不产生旋转。 */
  16050. fixedRotation: boolean;
  16051. /** !#en
  16052. It can affect the linear velocity change of the rigidbody in each axis. The larger the value, the faster the rigidbody moves.
  16053. !#zh
  16054. 线性因子,可影响刚体在每个轴向的线性速度变化,值越大刚体移动越快。 */
  16055. linearFactor: Vec3;
  16056. /** !#en
  16057. It can affect the rotation speed change of the rigidbody in each axis. The larger the value, the faster the rigidbody rotates.
  16058. !#zh
  16059. 旋转因子,可影响刚体在每个轴向的旋转速度变化,值越大刚体旋转越快。 */
  16060. angularFactor: Vec3;
  16061. /** !#en
  16062. The rigidbody is awake.
  16063. !#zh
  16064. 刚体是否为唤醒的状态。 */
  16065. isAwake: boolean;
  16066. /** !#en
  16067. The rigidbody can enter hibernation.
  16068. !#zh
  16069. 刚体是否为可进入休眠的状态。 */
  16070. isSleepy: boolean;
  16071. /** !#en
  16072. The rigidbody is sleeping.
  16073. !#zh
  16074. 刚体是否为正在休眠的状态。 */
  16075. isSleeping: boolean;
  16076. /** !#en
  16077. Get the rigidbody object inside the physics engine.
  16078. !#zh
  16079. 获得物理引擎内部刚体对象。 */
  16080. rigidBody: IRigidBody;
  16081. /**
  16082. !#en
  16083. A force is applied to a rigid body at a point in world space.
  16084. !#zh
  16085. 在世界空间中的某点上对刚体施加一个作用力。
  16086. @param force force
  16087. @param relativePoint The point of action, relative to the center of the rigid body.
  16088. */
  16089. applyForce(force: Vec3, relativePoint: Vec3): void;
  16090. /**
  16091. !#en
  16092. Apply a force on the rigid body at a point in local space.
  16093. !#zh
  16094. 在本地空间中的某点上对刚体施加一个作用力。
  16095. @param force force
  16096. @param localPoint Point of application
  16097. */
  16098. applyLocalForce(force: Vec3, localPoint: Vec3): void;
  16099. /**
  16100. !#en
  16101. Apply an impulse to a rigid body at a point in world space.
  16102. !#zh
  16103. 在世界空间的某点上对刚体施加一个冲量。
  16104. @param impulse impulse
  16105. @param relativePoint The point of action, relative to the center of the rigid body.
  16106. */
  16107. applyImpulse(impulse: Vec3, relativePoint: Vec3): void;
  16108. /**
  16109. !#en
  16110. Apply an impulse to the rigid body at a point in local space.
  16111. !#zh
  16112. 在本地空间的某点上对刚体施加一个冲量。
  16113. @param impulse impulse
  16114. @param localPoint Point of application
  16115. */
  16116. applyLocalImpulse(impulse: Vec3, localPoint: Vec3): void;
  16117. /**
  16118. !#en
  16119. Apply a torque to the rigid body.
  16120. !#zh
  16121. 对刚体施加扭转力。
  16122. @param torque torque
  16123. */
  16124. applyTorque(torque: Vec3): void;
  16125. /**
  16126. !#en
  16127. Apply a local torque to the rigid body.
  16128. !#zh
  16129. 对刚体施加本地扭转力。
  16130. @param torque torque
  16131. */
  16132. applyLocalTorque(torque: Vec3): void;
  16133. /**
  16134. !#en
  16135. Awaken the rigid body.
  16136. !#zh
  16137. 唤醒刚体。
  16138. */
  16139. wakeUp(): void;
  16140. /**
  16141. !#en
  16142. Dormant rigid body.
  16143. !#zh
  16144. 休眠刚体。
  16145. */
  16146. sleep(): void;
  16147. /**
  16148. !#en
  16149. Get linear velocity.
  16150. !#zh
  16151. 获取线性速度。
  16152. @param out out
  16153. */
  16154. getLinearVelocity(out: Vec3): void;
  16155. /**
  16156. !#en
  16157. Set linear speed.
  16158. !#zh
  16159. 设置线性速度。
  16160. @param value value
  16161. */
  16162. setLinearVelocity(value: Vec3): void;
  16163. /**
  16164. !#en
  16165. Gets the rotation speed.
  16166. !#zh
  16167. 获取旋转速度。
  16168. @param out out
  16169. */
  16170. getAngularVelocity(out: Vec3): void;
  16171. /**
  16172. !#en
  16173. Set rotation speed.
  16174. !#zh
  16175. 设置旋转速度。
  16176. @param value value
  16177. */
  16178. setAngularVelocity(value: Vec3): void;
  16179. }
  16180. /** !#en
  16181. Physics box collider
  16182. !#zh
  16183. 物理盒子碰撞器 */
  16184. export class BoxCollider3D extends Collider3D {
  16185. /** !#en
  16186. Get or set the size of the box, in local space.
  16187. !#zh
  16188. 获取或设置盒的大小。 */
  16189. size: Vec3;
  16190. boxShape: IBoxShape;
  16191. }
  16192. /** !#en
  16193. The base class of the collider.
  16194. !#zh
  16195. 碰撞器的基类。 */
  16196. export class Collider3D extends Component implements EventTarget {
  16197. sharedMaterial: PhysicsMaterial;
  16198. /** !#en
  16199. get or set the collider is trigger, this will be always trigger if using builtin.
  16200. !#zh
  16201. 获取或设置碰撞器是否为触发器。 */
  16202. isTrigger: boolean;
  16203. /** !#en
  16204. get or set the center of the collider, in local space.
  16205. !#zh
  16206. 获取或设置碰撞器的中心点。 */
  16207. center: Vec3;
  16208. /** !#en
  16209. get the collider attached rigidbody, this may be null.
  16210. !#zh
  16211. 获取碰撞器所绑定的刚体组件,可能为 null。 */
  16212. attachedRigidbody: RigidBody3D|void;
  16213. /** !#en
  16214. get collider shape.
  16215. !#zh
  16216. 获取碰撞器形状。 */
  16217. shape: IBaseShape;
  16218. /**
  16219. !#en
  16220. Register an callback of a specific event type on the EventTarget.
  16221. This type of event should be triggered via `emit`.
  16222. !#zh
  16223. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  16224. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16225. @param callback The callback that will be invoked when the event is dispatched.
  16226. The callback is ignored if it is a duplicate (the callbacks are unique).
  16227. @param target The target (this object) to invoke the callback, can be null.
  16228. @example
  16229. ```js
  16230. eventTarget.on('fire', function (event) {
  16231. // event is ITriggerEvent or ICollisionEvent
  16232. }, node);
  16233. ```
  16234. */
  16235. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  16236. /**
  16237. !#en
  16238. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  16239. if only type is passed as parameter, all listeners registered with that type will be removed.
  16240. !#zh
  16241. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  16242. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16243. @param callback The callback to remove.
  16244. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed.
  16245. @example
  16246. ```js
  16247. // register fire eventListener
  16248. var callback = eventTarget.on('fire', function () {
  16249. cc.log("fire in the hole");
  16250. }, target);
  16251. // remove fire event listener
  16252. eventTarget.off('fire', callback, target);
  16253. // remove all fire event listeners
  16254. eventTarget.off('fire');
  16255. ```
  16256. */
  16257. off(type: string, callback?: Function, target?: any): void;
  16258. /**
  16259. !#en
  16260. Register an callback of a specific event type on the EventTarget,
  16261. the callback will remove itself after the first time it is triggered.
  16262. !#zh
  16263. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  16264. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16265. @param callback The callback that will be invoked when the event is dispatched.
  16266. The callback is ignored if it is a duplicate (the callbacks are unique).
  16267. @param target The target (this object) to invoke the callback, can be null.
  16268. @example
  16269. ```js
  16270. eventTarget.once('fire', function (event) {
  16271. // event is ITriggerEvent or ICollisionEvent
  16272. }, node);
  16273. ```
  16274. */
  16275. once(type: string, callback: (event: ITriggerEvent|ICollisionEvent) => void, target?: any): void;
  16276. /**
  16277. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  16278. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  16279. @param type The type of event.
  16280. */
  16281. hasEventListener(type: string): boolean;
  16282. /**
  16283. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  16284. This is not for removing all listeners in the current event target,
  16285. and this is not for removing all listeners the target parameter have registered.
  16286. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  16287. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  16288. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  16289. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  16290. @param target The target to be searched for all related listeners
  16291. */
  16292. targetOff(target: any): void;
  16293. /**
  16294. !#en
  16295. Send an event with the event object.
  16296. !#zh
  16297. 通过事件对象派发事件
  16298. @param event event
  16299. */
  16300. dispatchEvent(event: Event): void;
  16301. }
  16302. /** !#en
  16303. Physics sphere collider
  16304. !#zh
  16305. 物理球碰撞器 */
  16306. export class SphereCollider3D extends Collider3D {
  16307. /** !#en
  16308. Get or set the radius of the sphere.
  16309. !#zh
  16310. 获取或设置球的半径。 */
  16311. radius: number;
  16312. sphereShape: ISphereShape;
  16313. }
  16314. /****************************************************
  16315. * audioEngine
  16316. *****************************************************/
  16317. export namespace audioEngine {
  16318. /** !#en Audio state.
  16319. !#zh 声音播放状态 */
  16320. export enum AudioState {
  16321. ERROR = 0,
  16322. INITIALZING = 0,
  16323. PLAYING = 0,
  16324. PAUSED = 0,
  16325. STOPPED = 0,
  16326. }
  16327. }
  16328. /****************************************************
  16329. * debug
  16330. *****************************************************/
  16331. export namespace debug {
  16332. /** !#en Enum for debug modes.
  16333. !#zh 调试模式 */
  16334. export enum DebugMode {
  16335. NONE = 0,
  16336. INFO = 0,
  16337. WARN = 0,
  16338. ERROR = 0,
  16339. INFO_FOR_WEB_PAGE = 0,
  16340. WARN_FOR_WEB_PAGE = 0,
  16341. ERROR_FOR_WEB_PAGE = 0,
  16342. }
  16343. }
  16344. /****************************************************
  16345. * Node
  16346. *****************************************************/
  16347. export namespace Node {
  16348. /** !#en Node's local dirty properties flag
  16349. !#zh Node 的本地属性 dirty 状态位 */
  16350. export enum _LocalDirtyFlag {
  16351. POSITION = 0,
  16352. SCALE = 0,
  16353. ROTATION = 0,
  16354. SKEW = 0,
  16355. TRS = 0,
  16356. RS = 0,
  16357. TRS = 0,
  16358. PHYSICS_POSITION = 0,
  16359. PHYSICS_SCALE = 0,
  16360. PHYSICS_ROTATION = 0,
  16361. PHYSICS_TRS = 0,
  16362. PHYSICS_RS = 0,
  16363. ALL_POSITION = 0,
  16364. ALL_SCALE = 0,
  16365. ALL_ROTATION = 0,
  16366. ALL_TRS = 0,
  16367. ALL = 0,
  16368. }
  16369. }
  16370. /****************************************************
  16371. * Node
  16372. *****************************************************/
  16373. export namespace Node {
  16374. /** !#en The event type supported by Node
  16375. !#zh Node 支持的事件类型 */
  16376. export class EventType {
  16377. /** !#en The event type for touch start event, you can use its value directly: 'touchstart'
  16378. !#zh 当手指触摸到屏幕时。 */
  16379. static TOUCH_START: string;
  16380. /** !#en The event type for touch move event, you can use its value directly: 'touchmove'
  16381. !#zh 当手指在屏幕上移动时。 */
  16382. static TOUCH_MOVE: string;
  16383. /** !#en The event type for touch end event, you can use its value directly: 'touchend'
  16384. !#zh 当手指在目标节点区域内离开屏幕时。 */
  16385. static TOUCH_END: string;
  16386. /** !#en The event type for touch end event, you can use its value directly: 'touchcancel'
  16387. !#zh 当手指在目标节点区域外离开屏幕时。 */
  16388. static TOUCH_CANCEL: string;
  16389. /** !#en The event type for mouse down events, you can use its value directly: 'mousedown'
  16390. !#zh 当鼠标按下时触发一次。 */
  16391. static MOUSE_DOWN: string;
  16392. /** !#en The event type for mouse move events, you can use its value directly: 'mousemove'
  16393. !#zh 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。 */
  16394. static MOUSE_MOVE: string;
  16395. /** !#en The event type for mouse enter target events, you can use its value directly: 'mouseenter'
  16396. !#zh 当鼠标移入目标节点区域时,不论是否按下。 */
  16397. static MOUSE_ENTER: string;
  16398. /** !#en The event type for mouse leave target events, you can use its value directly: 'mouseleave'
  16399. !#zh 当鼠标移出目标节点区域时,不论是否按下。 */
  16400. static MOUSE_LEAVE: string;
  16401. /** !#en The event type for mouse up events, you can use its value directly: 'mouseup'
  16402. !#zh 当鼠标从按下状态松开时触发一次。 */
  16403. static MOUSE_UP: string;
  16404. /** !#en The event type for mouse wheel events, you can use its value directly: 'mousewheel'
  16405. !#zh 当鼠标滚轮滚动时。 */
  16406. static MOUSE_WHEEL: string;
  16407. /** !#en The event type for position change events.
  16408. Performance note, this event will be triggered every time corresponding properties being changed,
  16409. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16410. !#zh 当节点位置改变时触发的事件。
  16411. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16412. static POSITION_CHANGED: string;
  16413. /** !#en The event type for rotation change events.
  16414. Performance note, this event will be triggered every time corresponding properties being changed,
  16415. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16416. !#zh 当节点旋转改变时触发的事件。
  16417. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16418. static ROTATION_CHANGED: string;
  16419. /** !#en The event type for scale change events.
  16420. Performance note, this event will be triggered every time corresponding properties being changed,
  16421. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16422. !#zh 当节点缩放改变时触发的事件。
  16423. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16424. static SCALE_CHANGED: string;
  16425. /** !#en The event type for size change events.
  16426. Performance note, this event will be triggered every time corresponding properties being changed,
  16427. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16428. !#zh 当节点尺寸改变时触发的事件。
  16429. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16430. static SIZE_CHANGED: string;
  16431. /** !#en The event type for anchor point change events.
  16432. Performance note, this event will be triggered every time corresponding properties being changed,
  16433. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16434. !#zh 当节点锚点改变时触发的事件。
  16435. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16436. static ANCHOR_CHANGED: string;
  16437. /** !#en The event type for color change events.
  16438. Performance note, this event will be triggered every time corresponding properties being changed,
  16439. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16440. !#zh 当节点颜色改变时触发的事件。
  16441. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16442. static COLOR_CHANGED: string;
  16443. /** !#en The event type for new child added events.
  16444. !#zh 当新的子节点被添加时触发的事件。 */
  16445. static CHILD_ADDED: string;
  16446. /** !#en The event type for child removed events.
  16447. !#zh 当子节点被移除时触发的事件。 */
  16448. static CHILD_REMOVED: string;
  16449. /** !#en The event type for children reorder events.
  16450. !#zh 当子节点顺序改变时触发的事件。 */
  16451. static CHILD_REORDER: string;
  16452. /** !#en The event type for node group changed events.
  16453. !#zh 当节点归属群组发生变化时触发的事件。 */
  16454. static GROUP_CHANGED: string;
  16455. /** !#en The event type for node's sibling order changed.
  16456. !#zh 当节点在兄弟节点中的顺序发生变化时触发的事件。 */
  16457. static SIBLING_ORDER_CHANGED: string;
  16458. }
  16459. }
  16460. /****************************************************
  16461. * ParticleSystem
  16462. *****************************************************/
  16463. export namespace ParticleSystem {
  16464. /** !#en Enum for emitter modes
  16465. !#zh 发射模式 */
  16466. export enum EmitterMode {
  16467. GRAVITY = 0,
  16468. RADIUS = 0,
  16469. }
  16470. }
  16471. /****************************************************
  16472. * ParticleSystem
  16473. *****************************************************/
  16474. export namespace ParticleSystem {
  16475. /** !#en Enum for particles movement type.
  16476. !#zh 粒子位置类型 */
  16477. export enum PositionType {
  16478. FREE = 0,
  16479. RELATIVE = 0,
  16480. GROUPED = 0,
  16481. }
  16482. }
  16483. /****************************************************
  16484. * TiledMap
  16485. *****************************************************/
  16486. export namespace TiledMap {
  16487. /** !#en The orientation of tiled map.
  16488. !#zh Tiled Map 地图方向。 */
  16489. export enum Orientation {
  16490. ORTHO = 0,
  16491. HEX = 0,
  16492. ISO = 0,
  16493. }
  16494. }
  16495. /****************************************************
  16496. * TiledMap
  16497. *****************************************************/
  16498. export namespace TiledMap {
  16499. /** The property type of tiled map. */
  16500. export enum Property {
  16501. NONE = 0,
  16502. MAP = 0,
  16503. LAYER = 0,
  16504. OBJECTGROUP = 0,
  16505. OBJECT = 0,
  16506. TILE = 0,
  16507. }
  16508. }
  16509. /****************************************************
  16510. * TiledMap
  16511. *****************************************************/
  16512. export namespace TiledMap {
  16513. /** The tile flags of tiled map. */
  16514. export enum TileFlag {
  16515. HORIZONTAL = 0,
  16516. VERTICAL = 0,
  16517. DIAGONAL = 0,
  16518. FLIPPED_ALL = 0,
  16519. FLIPPED_MASK = 0,
  16520. }
  16521. }
  16522. /****************************************************
  16523. * TiledMap
  16524. *****************************************************/
  16525. export namespace TiledMap {
  16526. /** !#en The stagger axis of Hex tiled map.
  16527. !#zh 六边形地图的 stagger axis 值 */
  16528. export enum StaggerAxis {
  16529. STAGGERAXIS_X = 0,
  16530. STAGGERAXIS_Y = 0,
  16531. }
  16532. }
  16533. /****************************************************
  16534. * TiledMap
  16535. *****************************************************/
  16536. export namespace TiledMap {
  16537. /** !#en The render order of tiled map.
  16538. !#zh 地图的渲染顺序 */
  16539. export enum RenderOrder {
  16540. STAGGERINDEX_ODD = 0,
  16541. STAGGERINDEX_EVEN = 0,
  16542. RightDown = 0,
  16543. RightUp = 0,
  16544. LeftDown = 0,
  16545. LeftUp = 0,
  16546. }
  16547. }
  16548. /****************************************************
  16549. * TiledMap
  16550. *****************************************************/
  16551. export namespace TiledMap {
  16552. /** !#en TiledMap Object Type
  16553. !#zh 地图物体类型 */
  16554. export enum TMXObjectType {
  16555. RECT = 0,
  16556. ELLIPSE = 0,
  16557. POLYGON = 0,
  16558. POLYLINE = 0,
  16559. IMAGE = 0,
  16560. TEXT = 0,
  16561. }
  16562. }
  16563. /****************************************************
  16564. * VideoPlayer
  16565. *****************************************************/
  16566. export namespace VideoPlayer {
  16567. /** !#en Video event type
  16568. !#zh 视频事件类型 */
  16569. export enum EventType {
  16570. PLAYING = 0,
  16571. PAUSED = 0,
  16572. STOPPED = 0,
  16573. COMPLETED = 0,
  16574. META_LOADED = 0,
  16575. CLICKED = 0,
  16576. READY_TO_PLAY = 0,
  16577. }
  16578. }
  16579. /****************************************************
  16580. * VideoPlayer
  16581. *****************************************************/
  16582. export namespace VideoPlayer {
  16583. /** !#en Enum for video resouce type type.
  16584. !#zh 视频来源 */
  16585. export enum ResourceType {
  16586. REMOTE = 0,
  16587. LOCAL = 0,
  16588. }
  16589. }
  16590. /****************************************************
  16591. * WebView
  16592. *****************************************************/
  16593. export namespace WebView {
  16594. /** !#en WebView event type
  16595. !#zh 网页视图事件类型 */
  16596. export enum EventType {
  16597. LOADED = 0,
  16598. LOADING = 0,
  16599. ERROR = 0,
  16600. }
  16601. }
  16602. /****************************************************
  16603. * Camera
  16604. *****************************************************/
  16605. export namespace Camera {
  16606. /** !#en Values for Camera.clearFlags, determining what to clear when rendering a Camera.
  16607. !#zh 摄像机清除标记位,决定摄像机渲染时会清除哪些状态 */
  16608. export enum ClearFlags {
  16609. COLOR = 0,
  16610. DEPTH = 0,
  16611. STENCIL = 0,
  16612. }
  16613. }
  16614. /****************************************************
  16615. * Light
  16616. *****************************************************/
  16617. export namespace Light {
  16618. /** !#en The light source type
  16619. !#zh 光源类型 */
  16620. export enum Type {
  16621. DIRECTIONAL = 0,
  16622. POINT = 0,
  16623. SPOT = 0,
  16624. AMBIENT = 0,
  16625. }
  16626. }
  16627. /****************************************************
  16628. * Light
  16629. *****************************************************/
  16630. export namespace Light {
  16631. /** !#en The shadow type
  16632. !#zh 阴影类型 */
  16633. export enum ShadowType {
  16634. NONE = 0,
  16635. HARD = 0,
  16636. SOFT_PCF3X3 = 0,
  16637. SOFT_PCF5X5 = 0,
  16638. }
  16639. }
  16640. /****************************************************
  16641. * Prefab
  16642. *****************************************************/
  16643. export namespace Prefab {
  16644. /** !#zh
  16645. Prefab 创建实例所用的优化策略,配合 {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}} 使用。
  16646. !#en
  16647. An enumeration used with the {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}}
  16648. to specify how to optimize the instantiate operation. */
  16649. export enum OptimizationPolicy {
  16650. AUTO = 0,
  16651. SINGLE_INSTANCE = 0,
  16652. MULTI_INSTANCE = 0,
  16653. }
  16654. }
  16655. /****************************************************
  16656. * RenderTexture
  16657. *****************************************************/
  16658. export namespace RenderTexture {
  16659. /** !#en The depth buffer and stencil buffer format for RenderTexture.
  16660. !#zh RenderTexture 的深度缓冲以及模板缓冲格式。 */
  16661. export enum DepthStencilFormat {
  16662. RB_FMT_D24S8 = 0,
  16663. RB_FMT_S8 = 0,
  16664. RB_FMT_D16 = 0,
  16665. }
  16666. }
  16667. /****************************************************
  16668. * Texture2D
  16669. *****************************************************/
  16670. export namespace Texture2D {
  16671. /** The texture pixel format, default value is RGBA8888,
  16672. you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,
  16673. other formats are supported by compressed file types or raw data. */
  16674. export enum PixelFormat {
  16675. RGB565 = 0,
  16676. RGB5A1 = 0,
  16677. RGBA4444 = 0,
  16678. RGB888 = 0,
  16679. RGBA8888 = 0,
  16680. RGBA32F = 0,
  16681. A8 = 0,
  16682. I8 = 0,
  16683. AI88 = 0,
  16684. RGB_PVRTC_2BPPV1 = 0,
  16685. RGBA_PVRTC_2BPPV1 = 0,
  16686. RGB_A_PVRTC_2BPPV1 = 0,
  16687. RGB_PVRTC_4BPPV1 = 0,
  16688. RGBA_PVRTC_4BPPV1 = 0,
  16689. RGB_A_PVRTC_4BPPV1 = 0,
  16690. RGB_ETC1 = 0,
  16691. RGBA_ETC1 = 0,
  16692. RGB_ETC2 = 0,
  16693. RGBA_ETC2 = 0,
  16694. }
  16695. }
  16696. /****************************************************
  16697. * Texture2D
  16698. *****************************************************/
  16699. export namespace Texture2D {
  16700. /** The texture wrap mode */
  16701. export enum WrapMode {
  16702. REPEAT = 0,
  16703. CLAMP_TO_EDGE = 0,
  16704. MIRRORED_REPEAT = 0,
  16705. }
  16706. }
  16707. /****************************************************
  16708. * Texture2D
  16709. *****************************************************/
  16710. export namespace Texture2D {
  16711. /** The texture filter mode */
  16712. export enum Filter {
  16713. LINEAR = 0,
  16714. NEAREST = 0,
  16715. }
  16716. }
  16717. /****************************************************
  16718. * Collider
  16719. *****************************************************/
  16720. export namespace Collider {
  16721. /** !#en Defines a Box Collider .
  16722. !#zh 用来定义包围盒碰撞体 */
  16723. export class Box {
  16724. /** !#en Position offset
  16725. !#zh 位置偏移量 */
  16726. offset: Vec2;
  16727. /** !#en Box size
  16728. !#zh 包围盒大小 */
  16729. size: Size;
  16730. }
  16731. }
  16732. /****************************************************
  16733. * Collider
  16734. *****************************************************/
  16735. export namespace Collider {
  16736. /** !#en Defines a Circle Collider .
  16737. !#zh 用来定义圆形碰撞体 */
  16738. export class Circle {
  16739. /** !#en Position offset
  16740. !#zh 位置偏移量 */
  16741. offset: Vec2;
  16742. /** !#en Circle radius
  16743. !#zh 圆形半径 */
  16744. radius: number;
  16745. }
  16746. }
  16747. /****************************************************
  16748. * Collider
  16749. *****************************************************/
  16750. export namespace Collider {
  16751. /** !#en Defines a Polygon Collider .
  16752. !#zh 用来定义多边形碰撞体 */
  16753. export class Polygon {
  16754. /** !#en Position offset
  16755. !#zh 位置偏移量 */
  16756. offset: Vec2;
  16757. /** !#en Polygon points
  16758. !#zh 多边形顶点数组 */
  16759. points: Vec2[];
  16760. }
  16761. }
  16762. /****************************************************
  16763. * Event
  16764. *****************************************************/
  16765. export namespace Event {
  16766. /** !#en The mouse event
  16767. !#zh 鼠标事件类型 */
  16768. export class EventMouse extends Event {
  16769. /**
  16770. !#en Sets scroll data.
  16771. !#zh 设置鼠标的滚动数据。
  16772. @param scrollX scrollX
  16773. @param scrollY scrollY
  16774. */
  16775. setScrollData(scrollX: number, scrollY: number): void;
  16776. /**
  16777. !#en Returns the x axis scroll value.
  16778. !#zh 获取鼠标滚动的X轴距离,只有滚动时才有效。
  16779. */
  16780. getScrollX(): number;
  16781. /**
  16782. !#en Returns the y axis scroll value.
  16783. !#zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  16784. */
  16785. getScrollY(): number;
  16786. /**
  16787. !#en Sets cursor location.
  16788. !#zh 设置当前鼠标位置。
  16789. @param x x
  16790. @param y y
  16791. */
  16792. setLocation(x: number, y: number): void;
  16793. /**
  16794. !#en Returns cursor location.
  16795. !#zh 获取鼠标位置对象,对象包含 x 和 y 属性。
  16796. */
  16797. getLocation(): Vec2;
  16798. /**
  16799. !#en Returns the current cursor location in screen coordinates.
  16800. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  16801. */
  16802. getLocationInView(): Vec2;
  16803. /**
  16804. !#en Returns the previous touch location.
  16805. !#zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  16806. */
  16807. getPreviousLocation(): Vec2;
  16808. /**
  16809. !#en Returns the delta distance from the previous location to current location.
  16810. !#zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  16811. */
  16812. getDelta(): Vec2;
  16813. /**
  16814. !#en Returns the X axis delta distance from the previous location to current location.
  16815. !#zh 获取鼠标距离上一次事件移动的 X 轴距离。
  16816. */
  16817. getDeltaX(): number;
  16818. /**
  16819. !#en Returns the Y axis delta distance from the previous location to current location.
  16820. !#zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  16821. */
  16822. getDeltaY(): number;
  16823. /**
  16824. !#en Sets mouse button.
  16825. !#zh 设置鼠标按键。
  16826. @param button button
  16827. */
  16828. setButton(button: number): void;
  16829. /**
  16830. !#en Returns mouse button.
  16831. !#zh 获取鼠标按键。
  16832. */
  16833. getButton(): number;
  16834. /**
  16835. !#en Returns location X axis data.
  16836. !#zh 获取鼠标当前位置 X 轴。
  16837. */
  16838. getLocationX(): number;
  16839. /**
  16840. !#en Returns location Y axis data.
  16841. !#zh 获取鼠标当前位置 Y 轴。
  16842. */
  16843. getLocationY(): number;
  16844. /** !#en The none event code of mouse event.
  16845. !#zh 无。 */
  16846. static NONE: number;
  16847. /** !#en The event type code of mouse down event.
  16848. !#zh 鼠标按下事件。 */
  16849. static DOWN: number;
  16850. /** !#en The event type code of mouse up event.
  16851. !#zh 鼠标按下后释放事件。 */
  16852. static UP: number;
  16853. /** !#en The event type code of mouse move event.
  16854. !#zh 鼠标移动事件。 */
  16855. static MOVE: number;
  16856. /** !#en The event type code of mouse scroll event.
  16857. !#zh 鼠标滚轮事件。 */
  16858. static SCROLL: number;
  16859. /** !#en The tag of Mouse left button.
  16860. !#zh 鼠标左键的标签。 */
  16861. static BUTTON_LEFT: number;
  16862. /** !#en The tag of Mouse right button (The right button number is 2 on browser).
  16863. !#zh 鼠标右键的标签。 */
  16864. static BUTTON_RIGHT: number;
  16865. /** !#en The tag of Mouse middle button (The right button number is 1 on browser).
  16866. !#zh 鼠标中键的标签。 */
  16867. static BUTTON_MIDDLE: number;
  16868. /** !#en The tag of Mouse button 4.
  16869. !#zh 鼠标按键 4 的标签。 */
  16870. static BUTTON_4: number;
  16871. /** !#en The tag of Mouse button 5.
  16872. !#zh 鼠标按键 5 的标签。 */
  16873. static BUTTON_5: number;
  16874. /** !#en The tag of Mouse button 6.
  16875. !#zh 鼠标按键 6 的标签。 */
  16876. static BUTTON_6: number;
  16877. /** !#en The tag of Mouse button 7.
  16878. !#zh 鼠标按键 7 的标签。 */
  16879. static BUTTON_7: number;
  16880. /** !#en The tag of Mouse button 8.
  16881. !#zh 鼠标按键 8 的标签。 */
  16882. static BUTTON_8: number;
  16883. }
  16884. }
  16885. /****************************************************
  16886. * Event
  16887. *****************************************************/
  16888. export namespace Event {
  16889. /** !#en The touch event
  16890. !#zh 触摸事件 */
  16891. export class EventTouch extends Event {
  16892. /**
  16893. @param touchArr The array of the touches
  16894. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  16895. */
  16896. constructor(touchArr: any[], bubbles: boolean);
  16897. /** !#en The current touch object
  16898. !#zh 当前触点对象 */
  16899. touch: Touch;
  16900. /**
  16901. !#en Returns event code.
  16902. !#zh 获取事件类型。
  16903. */
  16904. getEventCode(): number;
  16905. /**
  16906. !#en Returns touches of event.
  16907. !#zh 获取触摸点的列表。
  16908. */
  16909. getTouches(): any[];
  16910. /**
  16911. !#en Sets touch location.
  16912. !#zh 设置当前触点位置
  16913. @param x x
  16914. @param y y
  16915. */
  16916. setLocation(x: number, y: number): void;
  16917. /**
  16918. !#en Returns touch location.
  16919. !#zh 获取触点位置。
  16920. */
  16921. getLocation(): Vec2;
  16922. /**
  16923. !#en Returns the current touch location in screen coordinates.
  16924. !#zh 获取当前触点在游戏窗口中的位置。
  16925. */
  16926. getLocationInView(): Vec2;
  16927. /**
  16928. !#en Returns the previous touch location.
  16929. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  16930. */
  16931. getPreviousLocation(): Vec2;
  16932. /**
  16933. !#en Returns the start touch location.
  16934. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  16935. */
  16936. getStartLocation(): Vec2;
  16937. /**
  16938. !#en Returns the id of cc.Touch.
  16939. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  16940. */
  16941. getID(): number;
  16942. /**
  16943. !#en Returns the delta distance from the previous location to current location.
  16944. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  16945. */
  16946. getDelta(): Vec2;
  16947. /**
  16948. !#en Returns the X axis delta distance from the previous location to current location.
  16949. !#zh 获取触点距离上一次事件移动的 x 轴距离。
  16950. */
  16951. getDeltaX(): number;
  16952. /**
  16953. !#en Returns the Y axis delta distance from the previous location to current location.
  16954. !#zh 获取触点距离上一次事件移动的 y 轴距离。
  16955. */
  16956. getDeltaY(): number;
  16957. /**
  16958. !#en Returns location X axis data.
  16959. !#zh 获取当前触点 X 轴位置。
  16960. */
  16961. getLocationX(): number;
  16962. /**
  16963. !#en Returns location Y axis data.
  16964. !#zh 获取当前触点 Y 轴位置。
  16965. */
  16966. getLocationY(): number;
  16967. }
  16968. }
  16969. /****************************************************
  16970. * Event
  16971. *****************************************************/
  16972. export namespace Event {
  16973. /** !#en The acceleration event
  16974. !#zh 加速度事件 */
  16975. export class EventAcceleration extends Event {
  16976. }
  16977. }
  16978. /****************************************************
  16979. * Event
  16980. *****************************************************/
  16981. export namespace Event {
  16982. /** !#en The keyboard event
  16983. !#zh 键盘事件 */
  16984. export class EventKeyboard extends Event {
  16985. /** !#en
  16986. The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
  16987. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.
  16988. If the key can't be identified, this value is 0.
  16989. !#zh
  16990. keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
  16991. 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。
  16992. 如果无法识别该键,则该值为 0。 */
  16993. keyCode: number;
  16994. }
  16995. }
  16996. /****************************************************
  16997. * Event
  16998. *****************************************************/
  16999. export namespace Event {
  17000. /** !#en The Custom event
  17001. !#zh 自定义事件 */
  17002. export class EventCustom extends Event {
  17003. /**
  17004. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  17005. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  17006. */
  17007. constructor(type: string, bubbles: boolean);
  17008. /** !#en A reference to the detailed data of the event
  17009. !#zh 事件的详细数据 */
  17010. detail: any;
  17011. /**
  17012. !#en Sets user data
  17013. !#zh 设置用户数据
  17014. @param data data
  17015. */
  17016. setUserData(data: any): void;
  17017. /**
  17018. !#en Gets user data
  17019. !#zh 获取用户数据
  17020. */
  17021. getUserData(): any;
  17022. /**
  17023. !#en Gets event name
  17024. !#zh 获取事件名称
  17025. */
  17026. getEventName(): string;
  17027. }
  17028. }
  17029. /****************************************************
  17030. * SystemEvent
  17031. *****************************************************/
  17032. export namespace SystemEvent {
  17033. /** !#en The event type supported by SystemEvent
  17034. !#zh SystemEvent 支持的事件类型 */
  17035. export class EventType {
  17036. /** !#en The event type for press the key down event, you can use its value directly: 'keydown'
  17037. !#zh 当按下按键时触发的事件 */
  17038. static KEY_DOWN: string;
  17039. /** !#en The event type for press the key up event, you can use its value directly: 'keyup'
  17040. !#zh 当松开按键时触发的事件 */
  17041. static KEY_UP: string;
  17042. /** !#en The event type for press the devicemotion event, you can use its value directly: 'devicemotion'
  17043. !#zh 重力感应 */
  17044. static DEVICEMOTION: string;
  17045. }
  17046. }
  17047. /****************************************************
  17048. * Graphics
  17049. *****************************************************/
  17050. export namespace Graphics {
  17051. /** !#en Enum for LineCap.
  17052. !#zh 线段末端属性 */
  17053. export enum LineCap {
  17054. BUTT = 0,
  17055. ROUND = 0,
  17056. SQUARE = 0,
  17057. }
  17058. }
  17059. /****************************************************
  17060. * Graphics
  17061. *****************************************************/
  17062. export namespace Graphics {
  17063. /** !#en Enum for LineJoin.
  17064. !#zh 线段拐角属性 */
  17065. export enum LineJoin {
  17066. BEVEL = 0,
  17067. ROUND = 0,
  17068. MITER = 0,
  17069. }
  17070. }
  17071. /****************************************************
  17072. * Animation
  17073. *****************************************************/
  17074. export namespace Animation {
  17075. /** !#en The event type supported by Animation
  17076. !#zh Animation 支持的事件类型 */
  17077. export class EventType {
  17078. /** !#en Emit when begin playing animation
  17079. !#zh 开始播放时触发 */
  17080. static PLAY: string;
  17081. /** !#en Emit when stop playing animation
  17082. !#zh 停止播放时触发 */
  17083. static STOP: string;
  17084. /** !#en Emit when pause animation
  17085. !#zh 暂停播放时触发 */
  17086. static PAUSE: string;
  17087. /** !#en Emit when resume animation
  17088. !#zh 恢复播放时触发 */
  17089. static RESUME: string;
  17090. /** !#en If animation repeat count is larger than 1, emit when animation play to the last frame
  17091. !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发 */
  17092. static LASTFRAME: string;
  17093. /** !#en Emit when finish playing animation
  17094. !#zh 动画播放完成时触发 */
  17095. static FINISHED: string;
  17096. }
  17097. }
  17098. /****************************************************
  17099. * Button
  17100. *****************************************************/
  17101. export namespace Button {
  17102. /** !#en Enum for transition type.
  17103. !#zh 过渡类型 */
  17104. export enum Transition {
  17105. NONE = 0,
  17106. COLOR = 0,
  17107. SPRITE = 0,
  17108. SCALE = 0,
  17109. }
  17110. }
  17111. /****************************************************
  17112. * Component
  17113. *****************************************************/
  17114. export namespace Component {
  17115. /** !#en
  17116. Component will register a event to target component's handler.
  17117. And it will trigger the handler when a certain event occurs.
  17118. !@zh
  17119. “EventHandler” 类用来设置场景中的事件回调,
  17120. 该类允许用户设置回调目标节点,目标组件名,组件方法名,
  17121. 并可通过 emit 方法调用目标函数。 */
  17122. export class EventHandler {
  17123. /** !#en the node that contains target callback, such as the node example script belongs to
  17124. !#zh 事件响应函数所在节点 ,比如例子中脚本归属的节点本身 */
  17125. target: Node;
  17126. /** !#en name of the component(script) that contains target callback, such as the name 'MainMenu' of script in example
  17127. !#zh 事件响应函数所在组件名(脚本名), 比如例子中的脚本名 'MainMenu' */
  17128. component: string;
  17129. /** !#en Event handler, such as function's name 'onClick' in example
  17130. !#zh 响应事件函数名,比如例子中的 'onClick' */
  17131. handler: string;
  17132. /** !#en Custom Event Data, such as 'eventType' in example
  17133. !#zh 自定义事件数据,比如例子中的 eventType */
  17134. customEventData: string;
  17135. /**
  17136. @param events events
  17137. @param params params
  17138. */
  17139. static emitEvents(events: EventHandler[], ...params: any[]): void;
  17140. /**
  17141. !#en Emit event with params
  17142. !#zh 触发目标组件上的指定 handler 函数,该参数是回调函数的参数值(可不填)。
  17143. @param params params
  17144. @example
  17145. ```js
  17146. // Call Function
  17147. var eventHandler = new cc.Component.EventHandler();
  17148. eventHandler.target = newTarget;
  17149. eventHandler.component = "MainMenu";
  17150. eventHandler.handler = "OnClick"
  17151. eventHandler.emit(["param1", "param2", ....]);
  17152. ```
  17153. */
  17154. emit(params: any[]): void;
  17155. }
  17156. }
  17157. /****************************************************
  17158. * Label
  17159. *****************************************************/
  17160. export namespace Label {
  17161. /** !#en Enum for text alignment.
  17162. !#zh 文本横向对齐类型 */
  17163. export enum HorizontalAlign {
  17164. LEFT = 0,
  17165. CENTER = 0,
  17166. RIGHT = 0,
  17167. }
  17168. }
  17169. /****************************************************
  17170. * Label
  17171. *****************************************************/
  17172. export namespace Label {
  17173. /** !#en Enum for vertical text alignment.
  17174. !#zh 文本垂直对齐类型 */
  17175. export enum VerticalAlign {
  17176. TOP = 0,
  17177. CENTER = 0,
  17178. BOTTOM = 0,
  17179. }
  17180. }
  17181. /****************************************************
  17182. * Label
  17183. *****************************************************/
  17184. export namespace Label {
  17185. /** !#en Enum for Overflow.
  17186. !#zh Overflow 类型 */
  17187. export enum Overflow {
  17188. NONE = 0,
  17189. CLAMP = 0,
  17190. SHRINK = 0,
  17191. RESIZE_HEIGHT = 0,
  17192. }
  17193. }
  17194. /****************************************************
  17195. * Label
  17196. *****************************************************/
  17197. export namespace Label {
  17198. /** !#en Enum for font type.
  17199. !#zh Type 类型 */
  17200. export enum Type {
  17201. TTF = 0,
  17202. BMFont = 0,
  17203. SystemFont = 0,
  17204. }
  17205. }
  17206. /****************************************************
  17207. * Label
  17208. *****************************************************/
  17209. export namespace Label {
  17210. /** !#en Enum for cache mode.
  17211. !#zh CacheMode 类型 */
  17212. export enum CacheMode {
  17213. NONE = 0,
  17214. BITMAP = 0,
  17215. CHAR = 0,
  17216. }
  17217. }
  17218. /****************************************************
  17219. * Layout
  17220. *****************************************************/
  17221. export namespace Layout {
  17222. /** !#en Enum for Layout type
  17223. !#zh 布局类型 */
  17224. export enum Type {
  17225. NONE = 0,
  17226. HORIZONTAL = 0,
  17227. VERTICAL = 0,
  17228. GRID = 0,
  17229. }
  17230. }
  17231. /****************************************************
  17232. * Layout
  17233. *****************************************************/
  17234. export namespace Layout {
  17235. /** !#en Enum for Layout Resize Mode
  17236. !#zh 缩放模式 */
  17237. export enum ResizeMode {
  17238. NONE = 0,
  17239. CONTAINER = 0,
  17240. CHILDREN = 0,
  17241. }
  17242. }
  17243. /****************************************************
  17244. * Layout
  17245. *****************************************************/
  17246. export namespace Layout {
  17247. /** !#en Enum for Grid Layout start axis direction.
  17248. The items in grid layout will be arranged in each axis at first.;
  17249. !#zh 布局轴向,只用于 GRID 布局。 */
  17250. export enum AxisDirection {
  17251. HORIZONTAL = 0,
  17252. VERTICAL = 0,
  17253. }
  17254. }
  17255. /****************************************************
  17256. * Layout
  17257. *****************************************************/
  17258. export namespace Layout {
  17259. /** !#en Enum for vertical layout direction.
  17260. Used in Grid Layout together with AxisDirection is VERTICAL
  17261. !#zh 垂直方向布局方式 */
  17262. export enum VerticalDirection {
  17263. BOTTOM_TO_TOP = 0,
  17264. TOP_TO_BOTTOM = 0,
  17265. }
  17266. }
  17267. /****************************************************
  17268. * Layout
  17269. *****************************************************/
  17270. export namespace Layout {
  17271. /** !#en Enum for horizontal layout direction.
  17272. Used in Grid Layout together with AxisDirection is HORIZONTAL
  17273. !#zh 水平方向布局方式 */
  17274. export enum HorizontalDirection {
  17275. LEFT_TO_RIGHT = 0,
  17276. RIGHT_TO_LEFT = 0,
  17277. }
  17278. }
  17279. /****************************************************
  17280. * Mask
  17281. *****************************************************/
  17282. export namespace Mask {
  17283. /** !#en the type for mask.
  17284. !#zh 遮罩组件类型 */
  17285. export enum Type {
  17286. RECT = 0,
  17287. ELLIPSE = 0,
  17288. IMAGE_STENCIL = 0,
  17289. }
  17290. }
  17291. /****************************************************
  17292. * PageView
  17293. *****************************************************/
  17294. export namespace PageView {
  17295. /** !#en The Page View Size Mode
  17296. !#zh 页面视图每个页面统一的大小类型 */
  17297. export enum SizeMode {
  17298. Unified = 0,
  17299. Free = 0,
  17300. }
  17301. }
  17302. /****************************************************
  17303. * PageView
  17304. *****************************************************/
  17305. export namespace PageView {
  17306. /** !#en The Page View Direction
  17307. !#zh 页面视图滚动类型 */
  17308. export enum Direction {
  17309. Horizontal = 0,
  17310. Vertical = 0,
  17311. }
  17312. }
  17313. /****************************************************
  17314. * PageView
  17315. *****************************************************/
  17316. export namespace PageView {
  17317. /** !#en Enum for ScrollView event type.
  17318. !#zh 滚动视图事件类型 */
  17319. export enum EventType {
  17320. PAGE_TURNING = 0,
  17321. }
  17322. }
  17323. /****************************************************
  17324. * PageViewIndicator
  17325. *****************************************************/
  17326. export namespace PageViewIndicator {
  17327. /** !#en Enum for PageView Indicator direction
  17328. !#zh 页面视图指示器的摆放方向 */
  17329. export enum Direction {
  17330. HORIZONTAL = 0,
  17331. VERTICAL = 0,
  17332. }
  17333. }
  17334. /****************************************************
  17335. * ProgressBar
  17336. *****************************************************/
  17337. export namespace ProgressBar {
  17338. /** !#en Enum for ProgressBar mode
  17339. !#zh 进度条模式 */
  17340. export enum Mode {
  17341. HORIZONTAL = 0,
  17342. VERTICAL = 0,
  17343. FILLED = 0,
  17344. }
  17345. }
  17346. /****************************************************
  17347. * Scrollbar
  17348. *****************************************************/
  17349. export namespace Scrollbar {
  17350. /** Enum for Scrollbar direction */
  17351. export enum Direction {
  17352. HORIZONTAL = 0,
  17353. VERTICAL = 0,
  17354. }
  17355. }
  17356. /****************************************************
  17357. * ScrollView
  17358. *****************************************************/
  17359. export namespace ScrollView {
  17360. /** !#en Enum for ScrollView event type.
  17361. !#zh 滚动视图事件类型 */
  17362. export enum EventType {
  17363. SCROLL_TO_TOP = 0,
  17364. SCROLL_TO_BOTTOM = 0,
  17365. SCROLL_TO_LEFT = 0,
  17366. SCROLL_TO_RIGHT = 0,
  17367. SCROLLING = 0,
  17368. BOUNCE_TOP = 0,
  17369. BOUNCE_BOTTOM = 0,
  17370. BOUNCE_LEFT = 0,
  17371. BOUNCE_RIGHT = 0,
  17372. SCROLL_ENDED = 0,
  17373. TOUCH_UP = 0,
  17374. AUTOSCROLL_ENDED_WITH_THRESHOLD = 0,
  17375. SCROLL_BEGAN = 0,
  17376. }
  17377. }
  17378. /****************************************************
  17379. * Slider
  17380. *****************************************************/
  17381. export namespace Slider {
  17382. /** !#en The Slider Direction
  17383. !#zh 滑动器方向 */
  17384. export enum Direction {
  17385. Horizontal = 0,
  17386. Vertical = 0,
  17387. }
  17388. }
  17389. /****************************************************
  17390. * Sprite
  17391. *****************************************************/
  17392. export namespace Sprite {
  17393. /** !#en Enum for sprite type.
  17394. !#zh Sprite 类型 */
  17395. export enum Type {
  17396. SIMPLE = 0,
  17397. SLICED = 0,
  17398. TILED = 0,
  17399. FILLED = 0,
  17400. MESH = 0,
  17401. }
  17402. }
  17403. /****************************************************
  17404. * Sprite
  17405. *****************************************************/
  17406. export namespace Sprite {
  17407. /** !#en Enum for fill type.
  17408. !#zh 填充类型 */
  17409. export enum FillType {
  17410. HORIZONTAL = 0,
  17411. VERTICAL = 0,
  17412. RADIAL = 0,
  17413. }
  17414. }
  17415. /****************************************************
  17416. * Sprite
  17417. *****************************************************/
  17418. export namespace Sprite {
  17419. /** !#en Sprite Size can track trimmed size, raw size or none.
  17420. !#zh 精灵尺寸调整模式 */
  17421. export enum SizeMode {
  17422. CUSTOM = 0,
  17423. TRIMMED = 0,
  17424. RAW = 0,
  17425. }
  17426. }
  17427. /****************************************************
  17428. * Sprite
  17429. *****************************************************/
  17430. export namespace Sprite {
  17431. /** !#en Sprite state can choice the normal or grayscale.
  17432. !#zh 精灵颜色通道模式。 */
  17433. export enum State {
  17434. NORMAL = 0,
  17435. GRAY = 0,
  17436. }
  17437. }
  17438. /****************************************************
  17439. * Widget
  17440. *****************************************************/
  17441. export namespace Widget {
  17442. /** !#en Enum for Widget's alignment mode, indicating when the widget should refresh.
  17443. !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 */
  17444. export enum AlignMode {
  17445. ONCE = 0,
  17446. ON_WINDOW_RESIZE = 0,
  17447. ALWAYS = 0,
  17448. }
  17449. }
  17450. /****************************************************
  17451. * geomUtils
  17452. *****************************************************/
  17453. export namespace geomUtils {
  17454. /** Aabb */
  17455. export class Aabb {
  17456. /**
  17457. create a new aabb
  17458. @param px X coordinates for aabb's original point
  17459. @param py Y coordinates for aabb's original point
  17460. @param pz Z coordinates for aabb's original point
  17461. @param w the half of aabb width
  17462. @param h the half of aabb height
  17463. @param l the half of aabb length
  17464. */
  17465. create(px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17466. /**
  17467. clone a new aabb
  17468. @param a the source aabb
  17469. */
  17470. clone(a: Aabb): Aabb;
  17471. /**
  17472. copy the values from one aabb to another
  17473. @param out the receiving aabb
  17474. @param a the source aabb
  17475. */
  17476. copy(out: Aabb, a: Aabb): Aabb;
  17477. /**
  17478. create a new aabb from two corner points
  17479. @param out the receiving aabb
  17480. @param minPos lower corner position of the aabb
  17481. @param maxPos upper corner position of the aabb
  17482. */
  17483. fromPoints(out: Aabb, minPos: Vec3, maxPos: Vec3): Aabb;
  17484. /**
  17485. Set the components of a aabb to the given values
  17486. @param out the receiving aabb
  17487. @param px X coordinates for aabb's original point
  17488. @param py Y coordinates for aabb's original point
  17489. @param pz Z coordinates for aabb's original point
  17490. @param w the half of aabb width
  17491. @param h the half of aabb height
  17492. @param l the half of aabb length
  17493. */
  17494. set(out: Aabb, px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17495. center: Vec3;
  17496. halfExtents: Vec3;
  17497. _type: number;
  17498. /**
  17499. Get the bounding points of this shape
  17500. @param minPos minPos
  17501. @param maxPos maxPos
  17502. */
  17503. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  17504. /**
  17505. Transform this shape
  17506. @param m the transform matrix
  17507. @param pos the position part of the transform
  17508. @param rot the rotation part of the transform
  17509. @param scale the scale part of the transform
  17510. @param out the target shape
  17511. */
  17512. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out?: Aabb): void;
  17513. }
  17514. }
  17515. /****************************************************
  17516. * geomUtils
  17517. *****************************************************/
  17518. export namespace geomUtils {
  17519. /** !#en Shape type. */
  17520. export enum enums {
  17521. SHAPE_RAY = 0,
  17522. SHAPE_LINE = 0,
  17523. SHAPE_SPHERE = 0,
  17524. SHAPE_AABB = 0,
  17525. SHAPE_OBB = 0,
  17526. SHAPE_PLANE = 0,
  17527. SHAPE_TRIANGLE = 0,
  17528. SHAPE_FRUSTUM = 0,
  17529. SHAPE_FRUSTUM_ACCURATE = 0,
  17530. }
  17531. }
  17532. /****************************************************
  17533. * geomUtils
  17534. *****************************************************/
  17535. export namespace geomUtils {
  17536. /** !#en frustum
  17537. !#zh 平截头体 */
  17538. export class Frustum {
  17539. /** Set whether to use accurate intersection testing function on this frustum */
  17540. accurate: boolean;
  17541. /**
  17542. create a new frustum
  17543. */
  17544. static create(): Frustum;
  17545. /**
  17546. Clone a frustum
  17547. @param f f
  17548. */
  17549. static clone(f: Frustum): Frustum;
  17550. /**
  17551. Copy the values from one frustum to another
  17552. @param out out
  17553. @param f f
  17554. */
  17555. copy(out: Frustum, f: Frustum): Frustum;
  17556. planes: geomUtils.Plane[];
  17557. planes: Vec3[];
  17558. /**
  17559. !#en Update the frustum information according to the given transform matrix.
  17560. Note that the resulting planes are not normalized under normal mode.
  17561. @param m the view-projection matrix
  17562. @param inv the inverse view-projection matrix
  17563. */
  17564. update(m: Mat4, inv: Mat4): void;
  17565. /**
  17566. !#en transform by matrix
  17567. @param mat mat
  17568. */
  17569. transform(mat: Mat4): void;
  17570. }
  17571. }
  17572. /****************************************************
  17573. * geomUtils
  17574. *****************************************************/
  17575. export namespace geomUtils {
  17576. /** undefined */
  17577. export class intersect {
  17578. /**
  17579. !#en
  17580. Check whether ray intersect with nodes
  17581. !#zh
  17582. 检测射线是否与物体有交集
  17583. @param root If root is null, then traversal nodes from scene node
  17584. @param worldRay worldRay
  17585. @param handler handler
  17586. @param filter filter
  17587. */
  17588. static ray_cast(root: Node, worldRay: geomUtils.Ray, handler: Function, filter: Function): any[];
  17589. /**
  17590. !#en ray-plane intersect<br/>
  17591. !#zh 射线与平面的相交性检测。
  17592. @param ray ray
  17593. @param plane plane
  17594. */
  17595. static ray_plane(ray: geomUtils.Ray, plane: geomUtils.Plane): number;
  17596. /**
  17597. !#en line-plane intersect<br/>
  17598. !#zh 线段与平面的相交性检测。
  17599. @param line line
  17600. @param plane plane
  17601. */
  17602. static line_plane(line: geomUtils.Line, plane: geomUtils.Plane): number;
  17603. /**
  17604. !#en ray-triangle intersect<br/>
  17605. !#zh 射线与三角形的相交性检测。
  17606. @param ray ray
  17607. @param triangle triangle
  17608. @param doubleSided doubleSided
  17609. */
  17610. static ray_triangle(ray: geomUtils.Ray, triangle: geomUtils.Triangle, doubleSided: boolean): number;
  17611. /**
  17612. !#en line-triangle intersect<br/>
  17613. !#zh 线段与三角形的相交性检测。
  17614. @param line line
  17615. @param triangle triangle
  17616. @param outPt optional, The intersection point
  17617. */
  17618. static line_triangle(line: geomUtils.Line, triangle: geomUtils.Triangle, outPt: Vec3): number;
  17619. /**
  17620. !#en line-quad intersect<br/>
  17621. !#zh 线段与四边形的相交性检测。
  17622. @param p A point on a line segment
  17623. @param q Another point on the line segment
  17624. @param a Quadrilateral point a
  17625. @param b Quadrilateral point b
  17626. @param c Quadrilateral point c
  17627. @param d Quadrilateral point d
  17628. @param outPt optional, The intersection point
  17629. */
  17630. static line_quad(p: Vec3, q: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, outPt: Vec3): number;
  17631. /**
  17632. !#en ray-sphere intersect<br/>
  17633. !#zh 射线和球的相交性检测。
  17634. @param ray ray
  17635. @param sphere sphere
  17636. */
  17637. static ray_sphere(ray: geomUtils.Ray, sphere: geomUtils.Sphere): number;
  17638. /**
  17639. !#en ray-aabb intersect<br/>
  17640. !#zh 射线和轴对齐包围盒的相交性检测。
  17641. @param ray ray
  17642. @param aabb Align the axis around the box
  17643. */
  17644. static ray_aabb(ray: geomUtils.Ray, aabb: Aabb): number;
  17645. /**
  17646. !#en ray-obb intersect<br/>
  17647. !#zh 射线和方向包围盒的相交性检测。
  17648. @param ray ray
  17649. @param obb Direction box
  17650. */
  17651. static ray_obb(ray: geomUtils.Ray, obb: geomUtils.Obb): number;
  17652. /**
  17653. !#en aabb-aabb intersect<br/>
  17654. !#zh 轴对齐包围盒和轴对齐包围盒的相交性检测。
  17655. @param aabb1 Axis alignment surrounds box 1
  17656. @param aabb2 Axis alignment surrounds box 2
  17657. */
  17658. static aabb_aabb(aabb1: Aabb, aabb2: Aabb): number;
  17659. /**
  17660. !#en aabb-obb intersect<br/>
  17661. !#zh 轴对齐包围盒和方向包围盒的相交性检测。
  17662. @param aabb Align the axis around the box
  17663. @param obb Direction box
  17664. */
  17665. static aabb_obb(aabb: Aabb, obb: geomUtils.Obb): number;
  17666. /**
  17667. !#en aabb-plane intersect<br/>
  17668. !#zh 轴对齐包围盒和平面的相交性检测。
  17669. @param aabb Align the axis around the box
  17670. @param plane plane
  17671. */
  17672. static aabb_plane(aabb: Aabb, plane: geomUtils.Plane): number;
  17673. /**
  17674. !#en aabb-frustum intersect, faster but has false positive corner cases<br/>
  17675. !#zh 轴对齐包围盒和锥台相交性检测,速度快,但有错误情况。
  17676. @param aabb Align the axis around the box
  17677. @param frustum frustum
  17678. */
  17679. static aabb_frustum(aabb: Aabb, frustum: Frustum): number;
  17680. /**
  17681. !#en aabb-frustum intersect, handles most of the false positives correctly<br/>
  17682. !#zh 轴对齐包围盒和锥台相交性检测,正确处理大多数错误情况。
  17683. @param aabb Align the axis around the box
  17684. @param frustum frustum
  17685. */
  17686. static aabb_frustum_accurate(aabb: Aabb, frustum: Frustum): number;
  17687. /**
  17688. !#en obb-point intersect<br/>
  17689. !#zh 方向包围盒和点的相交性检测。
  17690. @param obb Direction box
  17691. @param point point
  17692. */
  17693. static obb_point(obb: geomUtils.Obb, point: geomUtils.Vec3): boolean;
  17694. /**
  17695. !#en obb-plane intersect<br/>
  17696. !#zh 方向包围盒和平面的相交性检测。
  17697. @param obb Direction box
  17698. @param plane plane
  17699. */
  17700. static obb_plane(obb: geomUtils.Obb, plane: geomUtils.Plane): number;
  17701. /**
  17702. !#en obb-frustum intersect, faster but has false positive corner cases<br/>
  17703. !#zh 方向包围盒和锥台相交性检测,速度快,但有错误情况。
  17704. @param obb Direction box
  17705. @param frustum frustum
  17706. */
  17707. static obb_frustum(obb: geomUtils.Obb, frustum: Frustum): number;
  17708. /**
  17709. !#en obb-frustum intersect, handles most of the false positives correctly<br/>
  17710. !#zh 方向包围盒和锥台相交性检测,正确处理大多数错误情况。
  17711. @param obb Direction box
  17712. @param frustum frustum
  17713. */
  17714. static obb_frustum_accurate(obb: geomUtils.Obb, frustum: Frustum): number;
  17715. /**
  17716. !#en obb-obb intersect<br/>
  17717. !#zh 方向包围盒和方向包围盒的相交性检测。
  17718. @param obb1 Direction box1
  17719. @param obb2 Direction box2
  17720. */
  17721. static obb_obb(obb1: geomUtils.Obb, obb2: geomUtils.Obb): number;
  17722. /**
  17723. !#en phere-plane intersect, not necessarily faster than obb-plane<br/>
  17724. due to the length calculation of the plane normal to factor out<br/>
  17725. the unnomalized plane distance<br/>
  17726. !#zh 球与平面的相交性检测。
  17727. @param sphere sphere
  17728. @param plane plane
  17729. */
  17730. static sphere_plane(sphere: geomUtils.Sphere, plane: geomUtils.Plane): number;
  17731. /**
  17732. !#en sphere-frustum intersect, faster but has false positive corner cases<br/>
  17733. !#zh 球和锥台的相交性检测,速度快,但有错误情况。
  17734. @param sphere sphere
  17735. @param frustum frustum
  17736. */
  17737. static sphere_frustum(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17738. /**
  17739. !#en sphere-frustum intersect, handles the false positives correctly<br/>
  17740. !#zh 球和锥台的相交性检测,正确处理大多数错误情况。
  17741. @param sphere sphere
  17742. @param frustum frustum
  17743. */
  17744. static sphere_frustum_accurate(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17745. /**
  17746. !#en sphere-sphere intersect<br/>
  17747. !#zh 球和球的相交性检测。
  17748. @param sphere0 sphere0
  17749. @param sphere1 sphere1
  17750. */
  17751. static sphere_sphere(sphere0: geomUtils.Sphere, sphere1: geomUtils.Sphere): boolean;
  17752. /**
  17753. !#en sphere-aabb intersect<br/>
  17754. !#zh 球和轴对齐包围盒的相交性检测。
  17755. @param sphere sphere
  17756. @param aabb aabb
  17757. */
  17758. static sphere_aabb(sphere: geomUtils.Sphere, aabb: Aabb): boolean;
  17759. /**
  17760. !#en sphere-obb intersect<br/>
  17761. !#zh 球和方向包围盒的相交性检测。
  17762. @param sphere sphere
  17763. @param obb obb
  17764. */
  17765. static sphere_obb(sphere: geomUtils.Sphere, obb: geomUtils.Obb): boolean;
  17766. /**
  17767. !#en
  17768. The intersection detection of g1 and g2 can fill in the shape in the basic geometry.
  17769. !#zh
  17770. g1 和 g2 的相交性检测,可填入基础几何中的形状。
  17771. @param g1 Geometry 1
  17772. @param g2 Geometry 2
  17773. @param outPt optional, Intersection point. (note: only partial shape detection with this return value)
  17774. */
  17775. static resolve(g1: any, g2: any, outPt: any): void;
  17776. }
  17777. }
  17778. /****************************************************
  17779. * geomUtils
  17780. *****************************************************/
  17781. export namespace geomUtils {
  17782. /** !#en
  17783. line
  17784. !#zh
  17785. 直线 */
  17786. export class Line {
  17787. /**
  17788. !#en
  17789. create a new line
  17790. !#zh
  17791. 创建一个新的 line。
  17792. @param sx The x part of the starting point.
  17793. @param sy The y part of the starting point.
  17794. @param sz The z part of the starting point.
  17795. @param ex The x part of the end point.
  17796. @param ey The y part of the end point.
  17797. @param ez The z part of the end point.
  17798. */
  17799. create(sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  17800. /**
  17801. !#en
  17802. Creates a new line initialized with values from an existing line
  17803. !#zh
  17804. 克隆一个新的 line。
  17805. @param a The source of cloning.
  17806. */
  17807. clone(a: Line): Line;
  17808. /**
  17809. !#en
  17810. Copy the values from one line to another
  17811. !#zh
  17812. 复制一个线的值到另一个。
  17813. @param out The object that accepts the action.
  17814. @param a The source of the copy.
  17815. */
  17816. copy(out: Line, a: Line): Line;
  17817. /**
  17818. !#en
  17819. create a line from two points
  17820. !#zh
  17821. 用两个点创建一个线。
  17822. @param out The object that accepts the action.
  17823. @param start The starting point.
  17824. @param end At the end.
  17825. */
  17826. fromPoints(out: Line, start: Vec3, end: Vec3): Line;
  17827. /**
  17828. !#en
  17829. Set the components of a Vec3 to the given values
  17830. !#zh
  17831. 将给定线的属性设置为给定值。
  17832. @param out The object that accepts the action.
  17833. @param sx The x part of the starting point.
  17834. @param sy The y part of the starting point.
  17835. @param sz The z part of the starting point.
  17836. @param ex The x part of the end point.
  17837. @param ey The y part of the end point.
  17838. @param ez The z part of the end point.
  17839. */
  17840. set(out: Line, sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  17841. /**
  17842. !#en
  17843. Calculate the length of the line.
  17844. !#zh
  17845. 计算线的长度。
  17846. @param a The line to calculate.
  17847. */
  17848. len(a: Line): number;
  17849. /** !#en
  17850. Start points.
  17851. !#zh
  17852. 起点。 */
  17853. s: Vec3;
  17854. /** !#en
  17855. End points.
  17856. !#zh
  17857. 终点。 */
  17858. e: Vec3;
  17859. /**
  17860. !#en
  17861. Calculate the length of the line.
  17862. !#zh
  17863. 计算线的长度。
  17864. */
  17865. length(): number;
  17866. }
  17867. }
  17868. /****************************************************
  17869. * geomUtils
  17870. *****************************************************/
  17871. export namespace geomUtils {
  17872. /** !#en obb
  17873. !#zh
  17874. 基础几何 方向包围盒。 */
  17875. export class Obb {
  17876. /** !#zh
  17877. 获取形状的类型。 */
  17878. type: number;
  17879. /**
  17880. !#en
  17881. create a new obb
  17882. !#zh
  17883. 创建一个新的 obb 实例。
  17884. @param cx X coordinates of the shape relative to the origin.
  17885. @param cy Y coordinates of the shape relative to the origin.
  17886. @param cz Z coordinates of the shape relative to the origin.
  17887. @param hw Obb is half the width.
  17888. @param hh Obb is half the height.
  17889. @param hl Obb is half the Length.
  17890. @param ox_1 Direction matrix parameter.
  17891. @param ox_2 Direction matrix parameter.
  17892. @param ox_3 Direction matrix parameter.
  17893. @param oy_1 Direction matrix parameter.
  17894. @param oy_2 Direction matrix parameter.
  17895. @param oy_3 Direction matrix parameter.
  17896. @param oz_1 Direction matrix parameter.
  17897. @param oz_2 Direction matrix parameter.
  17898. @param oz_3 Direction matrix parameter.
  17899. */
  17900. create(cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): Obb;
  17901. /**
  17902. !#en
  17903. clone a new obb
  17904. !#zh
  17905. 克隆一个 obb。
  17906. @param a The target of cloning.
  17907. */
  17908. clone(a: Obb): Obb;
  17909. /**
  17910. !#en
  17911. copy the values from one obb to another
  17912. !#zh
  17913. 将从一个 obb 的值复制到另一个 obb。
  17914. @param out Obb that accepts the operation.
  17915. @param a Obb being copied.
  17916. */
  17917. copy(out: Obb, a: Obb): Obb;
  17918. /**
  17919. !#en
  17920. create a new obb from two corner points
  17921. !#zh
  17922. 用两个点创建一个新的 obb。
  17923. @param out Obb that accepts the operation.
  17924. @param minPos The smallest point of obb.
  17925. @param maxPos Obb's maximum point.
  17926. */
  17927. fromPoints(out: Obb, minPos: Vec3, maxPos: Vec3): Obb;
  17928. /**
  17929. !#en
  17930. Set the components of a obb to the given values
  17931. !#zh
  17932. 将给定 obb 的属性设置为给定的值。
  17933. @param cx X coordinates of the shape relative to the origin.
  17934. @param cy Y coordinates of the shape relative to the origin.
  17935. @param cz Z coordinates of the shape relative to the origin.
  17936. @param hw Obb is half the width.
  17937. @param hh Obb is half the height.
  17938. @param hl Obb is half the Length.
  17939. @param ox_1 Direction matrix parameter.
  17940. @param ox_2 Direction matrix parameter.
  17941. @param ox_3 Direction matrix parameter.
  17942. @param oy_1 Direction matrix parameter.
  17943. @param oy_2 Direction matrix parameter.
  17944. @param oy_3 Direction matrix parameter.
  17945. @param oz_1 Direction matrix parameter.
  17946. @param oz_2 Direction matrix parameter.
  17947. @param oz_3 Direction matrix parameter.
  17948. */
  17949. set(cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): Obb;
  17950. /** !#en
  17951. The center of the local coordinate.
  17952. !#zh
  17953. 本地坐标的中心点。 */
  17954. center: Vec3;
  17955. /** !#en
  17956. Half the length, width, and height.
  17957. !#zh
  17958. 长宽高的一半。 */
  17959. halfExtents: Vec3;
  17960. /** !#en
  17961. Direction matrix.
  17962. !#zh
  17963. 方向矩阵。 */
  17964. orientation: Mat3;
  17965. /**
  17966. !#en
  17967. Get the bounding points of this shape
  17968. !#zh
  17969. 获取 obb 的最小点和最大点。
  17970. @param minPos minPos
  17971. @param maxPos maxPos
  17972. */
  17973. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  17974. /**
  17975. !#en Transform this shape
  17976. !#zh
  17977. 将 out 根据这个 obb 的数据进行变换。
  17978. @param m The transformation matrix.
  17979. @param pos The position part of the transformation.
  17980. @param rot The rotating part of the transformation.
  17981. @param scale The scaling part of the transformation.
  17982. @param out Target of transformation.
  17983. */
  17984. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out: Obb): void;
  17985. /**
  17986. !#en
  17987. Transform out based on this obb data.
  17988. !#zh
  17989. 将 out 根据这个 obb 的数据进行变换。
  17990. @param m The transformation matrix.
  17991. @param rot The rotating part of the transformation.
  17992. @param out Target of transformation.
  17993. */
  17994. translateAndRotate(m: Mat4, rot: Quat, out: Obb): void;
  17995. /**
  17996. !#en
  17997. Scale out based on this obb data.
  17998. !#zh
  17999. 将 out 根据这个 obb 的数据进行缩放。
  18000. @param scale Scale value.
  18001. @param out Scaled target.
  18002. */
  18003. setScale(scale: Vec3, out: Obb): void;
  18004. }
  18005. }
  18006. /****************************************************
  18007. * geomUtils
  18008. *****************************************************/
  18009. export namespace geomUtils {
  18010. /** !#en
  18011. plane。
  18012. !#zh
  18013. 平面。 */
  18014. export class Plane {
  18015. /**
  18016. !#en
  18017. create a new plane
  18018. !#zh
  18019. 创建一个新的 plane。
  18020. @param nx The x part of the normal component.
  18021. @param ny The y part of the normal component.
  18022. @param nz The z part of the normal component.
  18023. @param d Distance from the origin.
  18024. */
  18025. create(nx: number, ny: number, nz: number, d: number): Plane;
  18026. /**
  18027. !#en
  18028. clone a new plane
  18029. !#zh
  18030. 克隆一个新的 plane。
  18031. @param p The source of cloning.
  18032. */
  18033. clone(p: Plane): Plane;
  18034. /**
  18035. !#en
  18036. copy the values from one plane to another
  18037. !#zh
  18038. 复制一个平面的值到另一个。
  18039. @param out The object that accepts the action.
  18040. @param p The source of the copy.
  18041. */
  18042. copy(out: Plane, p: Plane): Plane;
  18043. /**
  18044. !#en
  18045. create a plane from three points
  18046. !#zh
  18047. 用三个点创建一个平面。
  18048. @param out The object that accepts the action.
  18049. @param a Point a。
  18050. @param b Point b。
  18051. @param c Point c。
  18052. */
  18053. fromPoints(out: Plane, a: Vec3, b: Vec3, c: Vec3): Plane;
  18054. /**
  18055. !#en
  18056. Set the components of a plane to the given values
  18057. !#zh
  18058. 将给定平面的属性设置为给定值。
  18059. @param out The object that accepts the action.
  18060. @param nx The x part of the normal component.
  18061. @param ny The y part of the normal component.
  18062. @param nz The z part of the normal component.
  18063. @param d Distance from the origin.
  18064. */
  18065. set(out: Plane, nx: number, ny: number, nz: number, d: number): Plane;
  18066. /**
  18067. !#en
  18068. create plane from normal and point
  18069. !#zh
  18070. 用一条法线和一个点创建平面。
  18071. @param out The object that accepts the action.
  18072. @param normal The normal of a plane.
  18073. @param point A point on the plane.
  18074. */
  18075. fromNormalAndPoint(out: Plane, normal: Vec3, point: Vec3): Plane;
  18076. /**
  18077. !#en
  18078. normalize a plane
  18079. !#zh
  18080. 归一化一个平面。
  18081. @param out The object that accepts the action.
  18082. @param a Source data for operations.
  18083. */
  18084. normalize(out: Plane, a: Plane): Plane;
  18085. /** !#en
  18086. A normal vector.
  18087. !#zh
  18088. 法线向量。 */
  18089. n: Vec3;
  18090. /** !#en
  18091. The distance from the origin to the plane.
  18092. !#zh
  18093. 原点到平面的距离。 */
  18094. d: number;
  18095. /**
  18096. !#en
  18097. Transform a plane.
  18098. !#zh
  18099. 变换一个平面。
  18100. @param mat mat
  18101. */
  18102. transform(mat: Mat4): void;
  18103. }
  18104. }
  18105. /****************************************************
  18106. * geomUtils
  18107. *****************************************************/
  18108. export namespace geomUtils {
  18109. /** !#en
  18110. ray
  18111. !#zh
  18112. 射线。 */
  18113. export class Ray {
  18114. /**
  18115. !#en
  18116. create a new ray
  18117. !#zh
  18118. 创建一条射线。
  18119. @param ox The x part of the starting point.
  18120. @param oy The y part of the starting point.
  18121. @param oz The z part of the starting point.
  18122. @param dx X in the direction.
  18123. @param dy Y in the direction.
  18124. @param dz Z in the direction.
  18125. */
  18126. create(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18127. /**
  18128. !#en
  18129. Creates a new ray initialized with values from an existing ray
  18130. !#zh
  18131. 从一条射线克隆出一条新的射线。
  18132. @param a Clone target
  18133. */
  18134. clone(a: Ray): Ray;
  18135. /**
  18136. !#en
  18137. Copy the values from one ray to another
  18138. !#zh
  18139. 将从一个 ray 的值复制到另一个 ray。
  18140. @param out Accept the ray of the operation.
  18141. @param a Copied ray.
  18142. */
  18143. copy(out: Ray, a: Ray): Ray;
  18144. /**
  18145. !#en
  18146. create a ray from two points
  18147. !#zh
  18148. 用两个点创建一条射线。
  18149. @param out Receive the operating ray.
  18150. @param origin Origin of ray
  18151. @param target A point on a ray.
  18152. */
  18153. fromPoints(out: Ray, origin: Vec3, target: Vec3): Ray;
  18154. /**
  18155. !#en
  18156. Set the components of a ray to the given values
  18157. !#zh
  18158. 将给定射线的属性设置为给定的值。
  18159. @param out Receive the operating ray.
  18160. @param ox The x part of the starting point.
  18161. @param oy The y part of the starting point.
  18162. @param oz The z part of the starting point.
  18163. @param dx X in the direction.
  18164. @param dy Y in the direction.
  18165. @param dz Z in the direction.
  18166. */
  18167. set(out: Ray, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18168. /** !#en
  18169. Start point.
  18170. !#zh
  18171. 起点。 */
  18172. o: Vec3;
  18173. /** !#e
  18174. Direction
  18175. !#zh
  18176. 方向。 */
  18177. d: Vec3;
  18178. /**
  18179. !#en Compute hit.
  18180. @param out out
  18181. @param distance distance
  18182. */
  18183. computeHit(out: IVec3Like, distance: number): void;
  18184. }
  18185. }
  18186. /****************************************************
  18187. * geomUtils
  18188. *****************************************************/
  18189. export namespace geomUtils {
  18190. /** !#en
  18191. Sphere.
  18192. !#zh
  18193. 轴对齐球。 */
  18194. export class Sphere {
  18195. /**
  18196. !#en
  18197. create a new sphere
  18198. !#zh
  18199. 创建一个新的 sphere 实例。
  18200. @param cx X coordinates of the shape relative to the origin.
  18201. @param cy Y coordinates of the shape relative to the origin.
  18202. @param cz Z coordinates of the shape relative to the origin.
  18203. @param r Radius of sphere
  18204. */
  18205. create(cx: any, cy: any, cz: any, r: any): Sphere;
  18206. /**
  18207. !#en
  18208. clone a new sphere
  18209. !#zh
  18210. 克隆一个新的 sphere 实例。
  18211. @param p The target of cloning.
  18212. */
  18213. clone(p: Sphere): Sphere;
  18214. /**
  18215. !#en
  18216. copy the values from one sphere to another
  18217. !#zh
  18218. 将从一个 sphere 的值复制到另一个 sphere。
  18219. @param out Accept the sphere of operations.
  18220. @param a Sphere being copied.
  18221. */
  18222. copy(out: Sphere, a: Sphere): Sphere;
  18223. /**
  18224. !#en
  18225. create a new bounding sphere from two corner points
  18226. !#zh
  18227. 从两个点创建一个新的 sphere。
  18228. @param out Accept the sphere of operations.
  18229. @param minPos The smallest point of sphere.
  18230. @param maxPos The maximum point of sphere.
  18231. */
  18232. fromPoints(out: any, minPos: any, maxPos: any): Sphere;
  18233. /**
  18234. !#en Set the components of a sphere to the given values
  18235. !#zh 将球体的属性设置为给定的值。
  18236. @param out Accept the sphere of operations.
  18237. @param cx X coordinates of the shape relative to the origin.
  18238. @param cy Y coordinates of the shape relative to the origin.
  18239. @param cz Z coordinates of the shape relative to the origin.
  18240. @param r Radius.
  18241. */
  18242. set(out: Sphere, cx: any, cy: any, cz: any, r: number): Sphere;
  18243. /** !#en
  18244. The center of the local coordinate.
  18245. !#zh
  18246. 本地坐标的中心点。 */
  18247. center: Vec3;
  18248. /** !#zh
  18249. 半径。 */
  18250. radius: number;
  18251. /**
  18252. !#en
  18253. Clone.
  18254. !#zh
  18255. 获得克隆。
  18256. */
  18257. clone(): void;
  18258. /**
  18259. !#en
  18260. Copy sphere
  18261. !#zh
  18262. 拷贝对象。
  18263. @param a Copy target.
  18264. */
  18265. copy(a: any): void;
  18266. /**
  18267. !#en
  18268. Get the bounding points of this shape
  18269. !#zh
  18270. 获取此形状的边界点。
  18271. @param minPos minPos
  18272. @param maxPos maxPos
  18273. */
  18274. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  18275. /**
  18276. !#en
  18277. Transform this shape
  18278. !#zh
  18279. 将 out 根据这个 sphere 的数据进行变换。
  18280. @param m The transformation matrix.
  18281. @param pos The position part of the transformation.
  18282. @param rot The rotating part of the transformation.
  18283. @param scale The scaling part of the transformation.
  18284. @param out The target of the transformation.
  18285. */
  18286. transform(m: any, pos: any, rot: any, scale: any, out: any): void;
  18287. /**
  18288. !#en
  18289. Scale out based on the sphere data.
  18290. !#zh
  18291. 将 out 根据这个 sphere 的数据进行缩放。
  18292. @param scale Scale value
  18293. @param out Scale target
  18294. */
  18295. setScale(scale: any, out: any): void;
  18296. }
  18297. }
  18298. /****************************************************
  18299. * geomUtils
  18300. *****************************************************/
  18301. export namespace geomUtils {
  18302. /** Triangle */
  18303. export class Triangle {
  18304. /**
  18305. create a new triangle
  18306. @param ax ax
  18307. @param ay ay
  18308. @param az az
  18309. @param bx bx
  18310. @param by by
  18311. @param bz bz
  18312. @param cx cx
  18313. @param cy cy
  18314. @param cz cz
  18315. */
  18316. create(ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Triangle;
  18317. /**
  18318. clone a new triangle
  18319. @param t the source plane
  18320. */
  18321. clone(t: Triangle): Triangle;
  18322. /**
  18323. copy the values from one triangle to another
  18324. @param out the receiving triangle
  18325. @param t the source triangle
  18326. */
  18327. copy(out: Triangle, t: Triangle): Triangle;
  18328. /**
  18329. Create a triangle from three points
  18330. @param out the receiving triangle
  18331. @param a a
  18332. @param b b
  18333. @param c c
  18334. */
  18335. fromPoints(out: Triangle, a: Vec3, b: Vec3, c: Vec3): Triangle;
  18336. /**
  18337. Set the components of a triangle to the given values
  18338. @param out the receiving plane
  18339. @param ax X component of a
  18340. @param ay Y component of a
  18341. @param az Z component of a
  18342. @param bx X component of b
  18343. @param by Y component of b
  18344. @param bz Z component of b
  18345. @param cx X component of c
  18346. @param cy Y component of c
  18347. @param cz Z component of c
  18348. */
  18349. set(out: Triangle, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Plane;
  18350. a: Vec3;
  18351. b: Vec3;
  18352. c: Vec3;
  18353. }
  18354. }
  18355. /****************************************************
  18356. * PhysicsManager
  18357. *****************************************************/
  18358. export namespace PhysicsManager {
  18359. /** !#en
  18360. The draw bits for drawing physics debug information.<br>
  18361. example:<br>
  18362. ```js
  18363. cc.director.getPhysicsManager().debugDrawFlags =
  18364. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18365. // cc.PhysicsManager.DrawBits.e_pairBit |
  18366. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18367. cc.PhysicsManager.DrawBits.e_jointBit |
  18368. cc.PhysicsManager.DrawBits.e_shapeBit;
  18369. ```
  18370. !#zh
  18371. 指定物理系统需要绘制哪些调试信息。<br>
  18372. example:<br>
  18373. ```js
  18374. cc.director.getPhysicsManager().debugDrawFlags =
  18375. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18376. // cc.PhysicsManager.DrawBits.e_pairBit |
  18377. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18378. cc.PhysicsManager.DrawBits.e_jointBit |
  18379. cc.PhysicsManager.DrawBits.e_shapeBit;
  18380. ``` */
  18381. export enum DrawBits {
  18382. e_aabbBit = 0,
  18383. e_jointBit = 0,
  18384. e_shapeBit = 0,
  18385. }
  18386. }
  18387. /****************************************************
  18388. * MeshRenderer
  18389. *****************************************************/
  18390. export namespace MeshRenderer {
  18391. /** !#en Shadow projection mode
  18392. !#ch 阴影投射方式 */
  18393. export enum ShadowCastingMode {
  18394. OFF = 0,
  18395. ON = 0,
  18396. }
  18397. }
  18398. /****************************************************
  18399. * macro
  18400. *****************************************************/
  18401. export namespace macro {
  18402. /** !#en Key map for keyboard event
  18403. !#zh 键盘事件的按键值 */
  18404. export enum KEY {
  18405. none = 0,
  18406. back = 0,
  18407. menu = 0,
  18408. backspace = 0,
  18409. tab = 0,
  18410. enter = 0,
  18411. shift = 0,
  18412. ctrl = 0,
  18413. alt = 0,
  18414. pause = 0,
  18415. capslock = 0,
  18416. escape = 0,
  18417. space = 0,
  18418. pageup = 0,
  18419. pagedown = 0,
  18420. end = 0,
  18421. home = 0,
  18422. left = 0,
  18423. up = 0,
  18424. right = 0,
  18425. down = 0,
  18426. select = 0,
  18427. insert = 0,
  18428. Delete = 0,
  18429. a = 0,
  18430. b = 0,
  18431. c = 0,
  18432. d = 0,
  18433. e = 0,
  18434. f = 0,
  18435. g = 0,
  18436. h = 0,
  18437. i = 0,
  18438. j = 0,
  18439. k = 0,
  18440. l = 0,
  18441. m = 0,
  18442. n = 0,
  18443. o = 0,
  18444. p = 0,
  18445. q = 0,
  18446. r = 0,
  18447. s = 0,
  18448. t = 0,
  18449. u = 0,
  18450. v = 0,
  18451. w = 0,
  18452. x = 0,
  18453. y = 0,
  18454. z = 0,
  18455. num0 = 0,
  18456. num1 = 0,
  18457. num2 = 0,
  18458. num3 = 0,
  18459. num4 = 0,
  18460. num5 = 0,
  18461. num6 = 0,
  18462. num7 = 0,
  18463. num8 = 0,
  18464. num9 = 0,
  18465. '*' = 0,
  18466. '+' = 0,
  18467. '-' = 0,
  18468. numdel = 0,
  18469. '/' = 0,
  18470. f1 = 0,
  18471. f2 = 0,
  18472. f3 = 0,
  18473. f4 = 0,
  18474. f5 = 0,
  18475. f6 = 0,
  18476. f7 = 0,
  18477. f8 = 0,
  18478. f9 = 0,
  18479. f10 = 0,
  18480. f11 = 0,
  18481. f12 = 0,
  18482. numlock = 0,
  18483. scrolllock = 0,
  18484. ';' = 0,
  18485. semicolon = 0,
  18486. equal = 0,
  18487. '=' = 0,
  18488. ',' = 0,
  18489. comma = 0,
  18490. dash = 0,
  18491. '.' = 0,
  18492. period = 0,
  18493. forwardslash = 0,
  18494. grave = 0,
  18495. '[' = 0,
  18496. openbracket = 0,
  18497. backslash = 0,
  18498. ']' = 0,
  18499. closebracket = 0,
  18500. quote = 0,
  18501. dpadLeft = 0,
  18502. dpadRight = 0,
  18503. dpadUp = 0,
  18504. dpadDown = 0,
  18505. dpadCenter = 0,
  18506. }
  18507. }
  18508. /****************************************************
  18509. * macro
  18510. *****************************************************/
  18511. export namespace macro {
  18512. /** Image formats */
  18513. export enum ImageFormat {
  18514. JPG = 0,
  18515. PNG = 0,
  18516. TIFF = 0,
  18517. WEBP = 0,
  18518. PVR = 0,
  18519. ETC = 0,
  18520. S3TC = 0,
  18521. ATITC = 0,
  18522. TGA = 0,
  18523. RAWDATA = 0,
  18524. UNKNOWN = 0,
  18525. }
  18526. }
  18527. /****************************************************
  18528. * macro
  18529. *****************************************************/
  18530. export namespace macro {
  18531. /** !#en
  18532. Enum for blend factor
  18533. Refer to: http://www.andersriggelsen.dk/glblendfunc.php
  18534. !#zh
  18535. 混合因子
  18536. 可参考: http://www.andersriggelsen.dk/glblendfunc.php */
  18537. export enum BlendFactor {
  18538. ONE = 0,
  18539. ZERO = 0,
  18540. SRC_ALPHA = 0,
  18541. SRC_COLOR = 0,
  18542. DST_ALPHA = 0,
  18543. DST_COLOR = 0,
  18544. ONE_MINUS_SRC_ALPHA = 0,
  18545. ONE_MINUS_SRC_COLOR = 0,
  18546. ONE_MINUS_DST_ALPHA = 0,
  18547. ONE_MINUS_DST_COLOR = 0,
  18548. }
  18549. }
  18550. /****************************************************
  18551. * macro
  18552. *****************************************************/
  18553. export namespace macro {
  18554. /** undefined */
  18555. export enum TextAlignment {
  18556. LEFT = 0,
  18557. CENTER = 0,
  18558. RIGHT = 0,
  18559. }
  18560. }
  18561. /****************************************************
  18562. * sys
  18563. *****************************************************/
  18564. export namespace sys {
  18565. /** !#en
  18566. Network type enumeration
  18567. !#zh
  18568. 网络类型枚举 */
  18569. export enum NetworkType {
  18570. NONE = 0,
  18571. LAN = 0,
  18572. WWAN = 0,
  18573. }
  18574. }
  18575. /****************************************************
  18576. * ParticleSystem3DAssembler
  18577. *****************************************************/
  18578. export namespace ParticleSystem3DAssembler {
  18579. /** 粒子的生成模式 */
  18580. export enum RenderMode {
  18581. }
  18582. }
  18583. /****************************************************
  18584. * shapeModule
  18585. *****************************************************/
  18586. export namespace shapeModule {
  18587. /** 粒子发射器类型 */
  18588. export enum ShapeType {
  18589. Box = 0,
  18590. Circle = 0,
  18591. Cone = 0,
  18592. Sphere = 0,
  18593. Hemisphere = 0,
  18594. }
  18595. }
  18596. /****************************************************
  18597. * shapeModule
  18598. *****************************************************/
  18599. export namespace shapeModule {
  18600. /** 粒子从发射器的哪个部位发射 */
  18601. export enum EmitLocation {
  18602. Base = 0,
  18603. Edge = 0,
  18604. Shell = 0,
  18605. Volume = 0,
  18606. }
  18607. }
  18608. /****************************************************
  18609. * shapeModule
  18610. *****************************************************/
  18611. export namespace shapeModule {
  18612. /** 粒子在扇形区域的发射方式 */
  18613. export enum ArcMode {
  18614. Random = 0,
  18615. Loop = 0,
  18616. PingPong = 0,
  18617. }
  18618. }
  18619. /****************************************************
  18620. * trailModule
  18621. *****************************************************/
  18622. export namespace trailModule {
  18623. /** 选择如何为粒子系统生成轨迹 */
  18624. export enum TrailMode {
  18625. }
  18626. }
  18627. /****************************************************
  18628. * trailModule
  18629. *****************************************************/
  18630. export namespace trailModule {
  18631. /** 纹理填充模式 */
  18632. export enum TextureMode {
  18633. }
  18634. }
  18635. /****************************************************
  18636. * primitive
  18637. *****************************************************/
  18638. export namespace primitive {
  18639. /** undefined */
  18640. export enum PolyhedronType {
  18641. Tetrahedron = 0,
  18642. Octahedron = 0,
  18643. Dodecahedron = 0,
  18644. Icosahedron = 0,
  18645. Rhombicuboctahedron = 0,
  18646. TriangularPrism = 0,
  18647. PentagonalPrism = 0,
  18648. HexagonalPrism = 0,
  18649. SquarePyramid = 0,
  18650. PentagonalPyramid = 0,
  18651. TriangularDipyramid = 0,
  18652. PentagonalDipyramid = 0,
  18653. ElongatedSquareDipyramid = 0,
  18654. ElongatedPentagonalDipyramid = 0,
  18655. ElongatedPentagonalCupola = 0,
  18656. }
  18657. }
  18658. /****************************************************
  18659. * primitive
  18660. *****************************************************/
  18661. export namespace primitive {
  18662. /** undefined */
  18663. export class VertexData {
  18664. positions: number[];
  18665. normals: number[];
  18666. uvs: number[];
  18667. indices: number[];
  18668. minPos: Vec3;
  18669. maxPos: Vec3;
  18670. boundingRadius: number;
  18671. }
  18672. }
  18673. /****************************************************
  18674. * Material
  18675. *****************************************************/
  18676. export namespace Material {
  18677. /** !#en Material builtin name
  18678. !#zh 内置材质名字 */
  18679. export enum BUILTIN_NAME {
  18680. SPRITE = 0,
  18681. GRAY_SPRITE = 0,
  18682. UNLIT = 0,
  18683. }
  18684. }
  18685. /****************************************************
  18686. * EditBox
  18687. *****************************************************/
  18688. export namespace EditBox {
  18689. /** !#en Enum for keyboard return types
  18690. !#zh 键盘的返回键类型 */
  18691. export enum KeyboardReturnType {
  18692. DEFAULT = 0,
  18693. DONE = 0,
  18694. SEND = 0,
  18695. SEARCH = 0,
  18696. GO = 0,
  18697. NEXT = 0,
  18698. }
  18699. }
  18700. /****************************************************
  18701. * EditBox
  18702. *****************************************************/
  18703. export namespace EditBox {
  18704. /** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.
  18705. !#zh 输入模式 */
  18706. export enum InputMode {
  18707. ANY = 0,
  18708. EMAIL_ADDR = 0,
  18709. NUMERIC = 0,
  18710. PHONE_NUMBER = 0,
  18711. URL = 0,
  18712. DECIMAL = 0,
  18713. SINGLE_LINE = 0,
  18714. }
  18715. }
  18716. /****************************************************
  18717. * EditBox
  18718. *****************************************************/
  18719. export namespace EditBox {
  18720. /** !#en Enum for the EditBox's input flags
  18721. !#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */
  18722. export enum InputFlag {
  18723. PASSWORD = 0,
  18724. SENSITIVE = 0,
  18725. INITIAL_CAPS_WORD = 0,
  18726. INITIAL_CAPS_SENTENCE = 0,
  18727. INITIAL_CAPS_ALL_CHARACTERS = 0,
  18728. DEFAULT = 0,
  18729. }
  18730. }
  18731. /****************************************************
  18732. * textureAnimationModule
  18733. *****************************************************/
  18734. export namespace textureAnimationModule {
  18735. /** 粒子贴图动画类型 */
  18736. export enum Mode {
  18737. }
  18738. }
  18739. /****************************************************
  18740. * textureAnimationModule
  18741. *****************************************************/
  18742. export namespace textureAnimationModule {
  18743. /** 贴图动画的播放方式 */
  18744. export enum Animation {
  18745. }
  18746. }
  18747. }
  18748. /** !#en
  18749. The global main namespace of Spine, all classes, functions,
  18750. properties and constants of Spine are defined in this namespace
  18751. !#zh
  18752. Spine 的全局的命名空间,
  18753. 与 Spine 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  18754. declare namespace sp {
  18755. /** !#en
  18756. The skeleton of Spine <br/>
  18757. <br/>
  18758. (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  18759. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  18760. Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  18761. !#zh
  18762. Spine 骨骼动画 <br/>
  18763. <br/>
  18764. (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  18765. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  18766. 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。 */
  18767. export class Skeleton extends cc.RenderComponent {
  18768. /** !#en The skeletal animation is paused?
  18769. !#zh 该骨骼动画是否暂停。 */
  18770. paused: boolean;
  18771. /** !#en
  18772. The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  18773. attachments, skins, etc) and animations but does not hold any state.<br/>
  18774. Multiple skeletons can share the same skeleton data.
  18775. !#zh
  18776. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  18777. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  18778. 多个 Skeleton 可以共用相同的骨骼数据。 */
  18779. skeletonData: SkeletonData;
  18780. /** !#en The name of default skin.
  18781. !#zh 默认的皮肤名称。 */
  18782. defaultSkin: string;
  18783. /** !#en The name of default animation.
  18784. !#zh 默认的动画名称。 */
  18785. defaultAnimation: string;
  18786. /** !#en The name of current playing animation.
  18787. !#zh 当前播放的动画名称。 */
  18788. animation: string;
  18789. _defaultSkinIndex: number;
  18790. /** !#en TODO
  18791. !#zh 是否循环播放当前骨骼动画。 */
  18792. loop: boolean;
  18793. /** !#en Indicates whether to enable premultiplied alpha.
  18794. You should disable this option when image's transparent area appears to have opaque pixels,
  18795. or enable this option when image's half transparent area appears to be darken.
  18796. !#zh 是否启用贴图预乘。
  18797. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  18798. premultipliedAlpha: boolean;
  18799. /** !#en The time scale of this skeleton.
  18800. !#zh 当前骨骼中所有动画的时间缩放率。 */
  18801. timeScale: number;
  18802. /** !#en Indicates whether open debug slots.
  18803. !#zh 是否显示 slot 的 debug 信息。 */
  18804. debugSlots: boolean;
  18805. /** !#en Indicates whether open debug bones.
  18806. !#zh 是否显示 bone 的 debug 信息。 */
  18807. debugBones: boolean;
  18808. /** !#en Indicates whether open debug mesh.
  18809. !#zh 是否显示 mesh 的 debug 信息。 */
  18810. debugMesh: boolean;
  18811. /** !#en Enabled two color tint.
  18812. !#zh 是否启用染色效果。 */
  18813. useTint: boolean;
  18814. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  18815. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  18816. enableBatch: boolean;
  18817. /**
  18818. !#en
  18819. Sets runtime skeleton data to sp.Skeleton.<br>
  18820. This method is different from the `skeletonData` property. This method is passed in the raw data provided by the Spine runtime, and the skeletonData type is the asset type provided by Creator.
  18821. !#zh
  18822. 设置底层运行时用到的 SkeletonData。<br>
  18823. 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  18824. @param skeletonData skeletonData
  18825. */
  18826. setSkeletonData(skeletonData: sp.spine.SkeletonData): void;
  18827. /**
  18828. !#en Sets slots visible range.
  18829. !#zh 设置骨骼插槽可视范围。
  18830. @param startSlotIndex startSlotIndex
  18831. @param endSlotIndex endSlotIndex
  18832. */
  18833. setSlotsRange(startSlotIndex: number, endSlotIndex: number): void;
  18834. /**
  18835. !#en Sets animation state data.<br>
  18836. The parameter type is {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData.
  18837. !#zh 设置动画状态数据。<br>
  18838. 参数是 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData。
  18839. @param stateData stateData
  18840. */
  18841. setAnimationStateData(stateData: sp.spine.AnimationStateData): void;
  18842. /**
  18843. !#en
  18844. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  18845. If set the mode in editor, then no need to worry about order problem.
  18846. !#zh
  18847. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  18848. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  18849. @param cacheMode cacheMode
  18850. @example
  18851. ```js
  18852. skeleton.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
  18853. ```
  18854. */
  18855. setAnimationCacheMode(cacheMode: Skeleton.AnimationCacheMode): void;
  18856. /**
  18857. !#en Whether in cached mode.
  18858. !#zh 当前是否处于缓存模式。
  18859. */
  18860. isAnimationCached(): boolean;
  18861. /**
  18862. !#en Sets vertex effect delegate.
  18863. !#zh 设置顶点动画代理
  18864. @param effectDelegate effectDelegate
  18865. */
  18866. setVertexEffectDelegate(effectDelegate: VertexEffectDelegate): void;
  18867. /**
  18868. !#en Computes the world SRT from the local SRT for each bone.
  18869. !#zh 重新更新所有骨骼的世界 Transform,
  18870. 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  18871. @example
  18872. ```js
  18873. var bone = spine.findBone('head');
  18874. cc.log(bone.worldX); // return 0;
  18875. spine.updateWorldTransform();
  18876. bone = spine.findBone('head');
  18877. cc.log(bone.worldX); // return -23.12;
  18878. ```
  18879. */
  18880. updateWorldTransform(): void;
  18881. /**
  18882. !#en Sets the bones and slots to the setup pose.
  18883. !#zh 还原到起始动作
  18884. */
  18885. setToSetupPose(): void;
  18886. /**
  18887. !#en
  18888. Sets the bones to the setup pose,
  18889. using the values from the `BoneData` list in the `SkeletonData`.
  18890. !#zh
  18891. 设置 bone 到起始动作
  18892. 使用 SkeletonData 中的 BoneData 列表中的值。
  18893. */
  18894. setBonesToSetupPose(): void;
  18895. /**
  18896. !#en
  18897. Sets the slots to the setup pose,
  18898. using the values from the `SlotData` list in the `SkeletonData`.
  18899. !#zh
  18900. 设置 slot 到起始动作。
  18901. 使用 SkeletonData 中的 SlotData 列表中的值。
  18902. */
  18903. setSlotsToSetupPose(): void;
  18904. /**
  18905. !#en
  18906. Updating an animation cache to calculate all frame data in the animation is a cost in
  18907. performance due to calculating all data in a single frame.
  18908. To update the cache, use the invalidAnimationCache method with high performance.
  18909. !#zh
  18910. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  18911. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  18912. @param animName animName
  18913. */
  18914. updateAnimationCache(animName: string): void;
  18915. /**
  18916. !#en
  18917. Invalidates the animation cache, which is then recomputed on each frame..
  18918. !#zh
  18919. 使动画缓存失效,之后会在每帧重新计算。
  18920. */
  18921. invalidAnimationCache(): void;
  18922. /**
  18923. !#en
  18924. Finds a bone by name.
  18925. This does a string comparison for every bone.<br>
  18926. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  18927. !#zh
  18928. 通过名称查找 bone。
  18929. 这里对每个 bone 的名称进行了对比。<br>
  18930. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  18931. @param boneName boneName
  18932. */
  18933. findBone(boneName: string): sp.spine.Bone;
  18934. /**
  18935. !#en
  18936. Finds a slot by name. This does a string comparison for every slot.<br>
  18937. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  18938. !#zh
  18939. 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  18940. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  18941. @param slotName slotName
  18942. */
  18943. findSlot(slotName: string): sp.spine.Slot;
  18944. /**
  18945. !#en
  18946. Finds a skin by name and makes it the active skin.
  18947. This does a string comparison for every skin.<br>
  18948. Note that setting the skin does not change which attachments are visible.<br>
  18949. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  18950. !#zh
  18951. 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  18952. 注意:设置皮肤不会改变 attachment 的可见性。<br>
  18953. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  18954. @param skinName skinName
  18955. */
  18956. setSkin(skinName: string): void;
  18957. /**
  18958. !#en
  18959. Returns the attachment for the slot and attachment name.
  18960. The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  18961. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  18962. !#zh
  18963. 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  18964. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  18965. @param slotName slotName
  18966. @param attachmentName attachmentName
  18967. */
  18968. getAttachment(slotName: string, attachmentName: string): sp.spine.Attachment;
  18969. /**
  18970. !#en
  18971. Sets the attachment for the slot and attachment name.
  18972. The skeleton looks first in its skin, then in the skeleton data’s default skin.
  18973. !#zh
  18974. 通过 slot 和 attachment 的名字来设置 attachment。
  18975. Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  18976. @param slotName slotName
  18977. @param attachmentName attachmentName
  18978. */
  18979. setAttachment(slotName: string, attachmentName: string): void;
  18980. /**
  18981. Return the renderer of attachment.
  18982. @param regionAttachment regionAttachment
  18983. */
  18984. getTextureAtlas(regionAttachment: sp.spine.RegionAttachment|spine.BoundingBoxAttachment): sp.spine.TextureAtlasRegion;
  18985. /**
  18986. !#en
  18987. Mix applies all keyframe values,
  18988. interpolated for the specified time and mixed with the current values.
  18989. !#zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  18990. @param fromAnimation fromAnimation
  18991. @param toAnimation toAnimation
  18992. @param duration duration
  18993. */
  18994. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  18995. /**
  18996. !#en Set the current animation. Any queued animations are cleared.<br>
  18997. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  18998. !#zh 设置当前动画。队列中的任何的动画将被清除。<br>
  18999. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19000. @param trackIndex trackIndex
  19001. @param name name
  19002. @param loop loop
  19003. */
  19004. setAnimation(trackIndex: number, name: string, loop: boolean): sp.spine.TrackEntry;
  19005. /**
  19006. !#en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  19007. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19008. !#zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  19009. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19010. @param trackIndex trackIndex
  19011. @param name name
  19012. @param loop loop
  19013. @param delay delay
  19014. */
  19015. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): sp.spine.TrackEntry;
  19016. /**
  19017. !#en Find animation with specified name.
  19018. !#zh 查找指定名称的动画
  19019. @param name name
  19020. */
  19021. findAnimation(name: string): sp.spine.Animation;
  19022. /**
  19023. !#en Returns track entry by trackIndex.<br>
  19024. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19025. !#zh 通过 track 索引获取 TrackEntry。<br>
  19026. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19027. @param trackIndex trackIndex
  19028. */
  19029. getCurrent(trackIndex: any): sp.spine.TrackEntry;
  19030. /**
  19031. !#en Clears all tracks of animation state.
  19032. !#zh 清除所有 track 的动画状态。
  19033. */
  19034. clearTracks(): void;
  19035. /**
  19036. !#en Clears track of animation state by trackIndex.
  19037. !#zh 清除出指定 track 的动画状态。
  19038. @param trackIndex trackIndex
  19039. */
  19040. clearTrack(trackIndex: number): void;
  19041. /**
  19042. !#en Set the start event listener.
  19043. !#zh 用来设置开始播放动画的事件监听。
  19044. @param listener listener
  19045. */
  19046. setStartListener(listener: Function): void;
  19047. /**
  19048. !#en Set the interrupt event listener.
  19049. !#zh 用来设置动画被打断的事件监听。
  19050. @param listener listener
  19051. */
  19052. setInterruptListener(listener: Function): void;
  19053. /**
  19054. !#en Set the end event listener.
  19055. !#zh 用来设置动画播放完后的事件监听。
  19056. @param listener listener
  19057. */
  19058. setEndListener(listener: Function): void;
  19059. /**
  19060. !#en Set the dispose event listener.
  19061. !#zh 用来设置动画将被销毁的事件监听。
  19062. @param listener listener
  19063. */
  19064. setDisposeListener(listener: Function): void;
  19065. /**
  19066. !#en Set the complete event listener.
  19067. !#zh 用来设置动画播放一次循环结束后的事件监听。
  19068. @param listener listener
  19069. */
  19070. setCompleteListener(listener: Function): void;
  19071. /**
  19072. !#en Set the animation event listener.
  19073. !#zh 用来设置动画播放过程中帧事件的监听。
  19074. @param listener listener
  19075. */
  19076. setEventListener(listener: Function): void;
  19077. /**
  19078. !#en Set the start event listener for specified TrackEntry.
  19079. !#zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  19080. @param entry entry
  19081. @param listener listener
  19082. */
  19083. setTrackStartListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19084. /**
  19085. !#en Set the interrupt event listener for specified TrackEntry.
  19086. !#zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  19087. @param entry entry
  19088. @param listener listener
  19089. */
  19090. setTrackInterruptListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19091. /**
  19092. !#en Set the end event listener for specified TrackEntry.
  19093. !#zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  19094. @param entry entry
  19095. @param listener listener
  19096. */
  19097. setTrackEndListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19098. /**
  19099. !#en Set the dispose event listener for specified TrackEntry.
  19100. !#zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  19101. @param entry entry
  19102. @param listener listener
  19103. */
  19104. setTrackDisposeListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19105. /**
  19106. !#en Set the complete event listener for specified TrackEntry.
  19107. !#zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  19108. @param entry entry
  19109. @param listener listener
  19110. */
  19111. setTrackCompleteListener(entry: sp.spine.TrackEntry, listener: (entry: sp.spine.TrackEntry, loopCount: number) => void): void;
  19112. /**
  19113. !#en Set the event listener for specified TrackEntry.
  19114. !#zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  19115. @param entry entry
  19116. @param listener listener
  19117. */
  19118. setTrackEventListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19119. /**
  19120. !#en Get the animation state object
  19121. !#zh 获取动画状态
  19122. */
  19123. getState(): sp.spine.AnimationState;
  19124. }
  19125. /** !#en The event type of spine skeleton animation.
  19126. !#zh 骨骼动画事件类型。 */
  19127. export enum AnimationEventType {
  19128. START = 0,
  19129. END = 0,
  19130. COMPLETE = 0,
  19131. EVENT = 0,
  19132. }
  19133. /** !#en The skeleton data of spine.
  19134. !#zh Spine 的 骨骼数据。 */
  19135. export class SkeletonData extends cc.Asset {
  19136. /** !#en See http://en.esotericsoftware.com/spine-json-format
  19137. !#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */
  19138. skeletonJson: any;
  19139. atlasText: string;
  19140. textures: cc.Texture2D[];
  19141. /** !#en
  19142. A scale can be specified on the JSON or binary loader which will scale the bone positions,
  19143. image sizes, and animation translations.
  19144. This can be useful when using different sized images than were used when designing the skeleton
  19145. in Spine. For example, if using images that are half the size than were used in Spine,
  19146. a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  19147. resolution texture atlases.
  19148. see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  19149. !#zh 可查看 Spine 官方文档: http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */
  19150. scale: number;
  19151. /**
  19152. !#en Get the included SkeletonData used in spine runtime.<br>
  19153. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData object.
  19154. !#zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  19155. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData 对象。
  19156. @param quiet quiet
  19157. */
  19158. getRuntimeData(quiet?: boolean): sp.spine.SkeletonData;
  19159. }
  19160. /** !#en
  19161. The delegate of spine vertex effect
  19162. !#zh
  19163. Spine 顶点动画代理 */
  19164. export class VertexEffectDelegate {
  19165. /**
  19166. !#en Clears vertex effect.
  19167. !#zh 清空顶点效果
  19168. */
  19169. clear(): void;
  19170. /**
  19171. !#en Inits delegate with jitter effect
  19172. !#zh 设置顶点抖动效果
  19173. @param jitterX jitterX
  19174. @param jitterY jitterY
  19175. */
  19176. initJitter(jitterX: number, jitterY: number): void;
  19177. /**
  19178. !#en Inits delegate with swirl effect
  19179. !#zh 设置顶点漩涡效果
  19180. @param radius radius
  19181. @param power power
  19182. */
  19183. initSwirlWithPow(radius: number, power: number): sp.spine.JitterEffect;
  19184. /**
  19185. !#en Inits delegate with swirl effect
  19186. !#zh 设置顶点漩涡效果
  19187. @param radius radius
  19188. @param power power
  19189. */
  19190. initSwirlWithPowOut(radius: number, power: number): sp.spine.SwirlEffect;
  19191. /**
  19192. !#en Gets jitter vertex effect
  19193. !#zh 获取顶点抖动效果
  19194. */
  19195. getJitterVertexEffect(): sp.spine.JitterEffect;
  19196. /**
  19197. !#en Gets swirl vertex effect
  19198. !#zh 获取顶点漩涡效果
  19199. */
  19200. getSwirlVertexEffect(): sp.spine.SwirlEffect;
  19201. /**
  19202. !#en Gets vertex effect
  19203. !#zh 获取顶点效果
  19204. */
  19205. getVertexEffect(): sp.spine.JitterEffect;
  19206. /**
  19207. !#en Gets effect type
  19208. !#zh 获取效果类型
  19209. */
  19210. getEffectType(): string;
  19211. }
  19212. /****************************************************
  19213. * sp
  19214. *****************************************************/
  19215. export namespace sp {
  19216. /** !#en Attach node tool
  19217. !#zh 挂点工具类 */
  19218. export class AttachUtil {
  19219. /**
  19220. !#en Gets attached root node.
  19221. !#zh 获取挂接节点树的根节点
  19222. */
  19223. getAttachedRootNode(): cc.Node;
  19224. /**
  19225. !#en Gets attached node which you want.
  19226. !#zh 获得对应的挂点
  19227. @param boneName boneName
  19228. */
  19229. getAttachedNodes(boneName: string): cc.Node[];
  19230. /**
  19231. !#en Destroy attached node which you want.
  19232. !#zh 销毁对应的挂点
  19233. @param boneName boneName
  19234. */
  19235. destroyAttachedNodes(boneName: string): void;
  19236. /**
  19237. !#en Traverse all bones to generate the minimum node tree containing the given bone names, NOTE that make sure the skeleton has initialized before calling this interface.
  19238. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19239. @param boneName boneName
  19240. */
  19241. generateAttachedNodes(boneName: string): cc.Node[];
  19242. /**
  19243. !#en Destroy all attached node.
  19244. !#zh 销毁所有挂点
  19245. */
  19246. destroyAllAttachedNodes(): void;
  19247. /**
  19248. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19249. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19250. */
  19251. generateAllAttachedNodes(): cc.Node;
  19252. }
  19253. }
  19254. /****************************************************
  19255. * Skeleton
  19256. *****************************************************/
  19257. export namespace Skeleton {
  19258. /** !#en Enum for animation cache mode type.
  19259. !#zh Spine动画缓存类型 */
  19260. export enum AnimationCacheMode {
  19261. REALTIME = 0,
  19262. SHARED_CACHE = 0,
  19263. PRIVATE_CACHE = 0,
  19264. }
  19265. }
  19266. }
  19267. /** !#en
  19268. `sp.spine` is the namespace for official Spine Runtime, which officially implemented and maintained by Spine.<br>
  19269. Please refer to the official documentation for its detailed usage: [http://en.esotericsoftware.com/spine-using-runtimes](http://en.esotericsoftware.com/spine-using-runtimes)
  19270. !#zh
  19271. sp.spine 模块是 Spine 官方运行库的 API 入口,由 Spine 官方统一实现和维护,具体用法请参考:[http://zh.esotericsoftware.com/spine-using-runtimes](http://zh.esotericsoftware.com/spine-using-runtimes) */
  19272. declare namespace sp.spine {
  19273. }
  19274. /** !#en
  19275. The global main namespace of DragonBones, all classes, functions,
  19276. properties and constants of DragonBones are defined in this namespace
  19277. !#zh
  19278. DragonBones 的全局的命名空间,
  19279. 与 DragonBones 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  19280. declare namespace dragonBones {
  19281. /** !#en
  19282. The Armature Display of DragonBones <br/>
  19283. <br/>
  19284. (Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  19285. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  19286. Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments.) <br/>
  19287. !#zh
  19288. DragonBones 骨骼动画 <br/>
  19289. <br/>
  19290. (Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  19291. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  19292. 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。)<br/> */
  19293. export class ArmatureDisplay extends cc.RenderComponent {
  19294. /** !#en
  19295. The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  19296. attachments, skins, etc) and animations but does not hold any state.<br/>
  19297. Multiple ArmatureDisplay can share the same DragonBones data.
  19298. !#zh
  19299. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  19300. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  19301. 多个 ArmatureDisplay 可以共用相同的骨骼数据。 */
  19302. dragonAsset: DragonBonesAsset;
  19303. /** !#en
  19304. The atlas asset for the DragonBones.
  19305. !#zh
  19306. 骨骼数据所需的 Atlas Texture 数据。 */
  19307. dragonAtlasAsset: DragonBonesAtlasAsset;
  19308. /** !#en The name of current armature.
  19309. !#zh 当前的 Armature 名称。 */
  19310. armatureName: string;
  19311. /** !#en The name of current playing animation.
  19312. !#zh 当前播放的动画名称。 */
  19313. animationName: string;
  19314. _defaultArmatureIndex: number;
  19315. /** !#en The time scale of this armature.
  19316. !#zh 当前骨骼中所有动画的时间缩放率。 */
  19317. timeScale: number;
  19318. /** !#en The play times of the default animation.
  19319. -1 means using the value of config file;
  19320. 0 means repeat for ever
  19321. >0 means repeat times
  19322. !#zh 播放默认动画的循环次数
  19323. -1 表示使用配置文件中的默认值;
  19324. 0 表示无限循环
  19325. >0 表示循环次数 */
  19326. playTimes: number;
  19327. /** !#en Indicates whether to enable premultiplied alpha.
  19328. You should disable this option when image's transparent area appears to have opaque pixels,
  19329. or enable this option when image's half transparent area appears to be darken.
  19330. !#zh 是否启用贴图预乘。
  19331. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  19332. premultipliedAlpha: boolean;
  19333. /** !#en Indicates whether open debug bones.
  19334. !#zh 是否显示 bone 的 debug 信息。 */
  19335. debugBones: boolean;
  19336. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  19337. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  19338. enableBatch: boolean;
  19339. /**
  19340. !#en
  19341. The key of dragonbones cache data, which is regard as 'dragonbonesName', when you want to change dragonbones cloth.
  19342. !#zh
  19343. 缓存龙骨数据的key值,换装的时会使用到该值,作为dragonbonesName使用
  19344. @example
  19345. ```js
  19346. let factory = dragonBones.CCFactory.getInstance();
  19347. let needChangeSlot = needChangeArmature.armature().getSlot("changeSlotName");
  19348. factory.replaceSlotDisplay(toChangeArmature.getArmatureKey(), "armatureName", "slotName", "displayName", needChangeSlot);
  19349. ```
  19350. */
  19351. getArmatureKey(): string;
  19352. /**
  19353. !#en
  19354. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  19355. If set the mode in editor, then no need to worry about order problem.
  19356. !#zh
  19357. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  19358. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  19359. @param cacheMode cacheMode
  19360. @example
  19361. ```js
  19362. armatureDisplay.setAnimationCacheMode(dragonBones.ArmatureDisplay.AnimationCacheMode.SHARED_CACHE);
  19363. ```
  19364. */
  19365. setAnimationCacheMode(cacheMode: ArmatureDisplay.AnimationCacheMode): void;
  19366. /**
  19367. !#en Whether in cached mode.
  19368. !#zh 当前是否处于缓存模式。
  19369. */
  19370. isAnimationCached(): boolean;
  19371. /**
  19372. !#en
  19373. Play the specified animation.
  19374. Parameter animName specify the animation name.
  19375. Parameter playTimes specify the repeat times of the animation.
  19376. -1 means use the value of the config file.
  19377. 0 means play the animation for ever.
  19378. >0 means repeat times.
  19379. !#zh
  19380. 播放指定的动画.
  19381. animName 指定播放动画的名称。
  19382. playTimes 指定播放动画的次数。
  19383. -1 为使用配置文件中的次数。
  19384. 0 为无限循环播放。
  19385. >0 为动画的重复次数。
  19386. @param animName animName
  19387. @param playTimes playTimes
  19388. */
  19389. playAnimation(animName: string, playTimes: number): dragonBones.AnimationState;
  19390. /**
  19391. !#en
  19392. Updating an animation cache to calculate all frame data in the animation is a cost in
  19393. performance due to calculating all data in a single frame.
  19394. To update the cache, use the invalidAnimationCache method with high performance.
  19395. !#zh
  19396. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  19397. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  19398. @param animName animName
  19399. */
  19400. updateAnimationCache(animName: string): void;
  19401. /**
  19402. !#en
  19403. Invalidates the animation cache, which is then recomputed on each frame..
  19404. !#zh
  19405. 使动画缓存失效,之后会在每帧重新计算。
  19406. */
  19407. invalidAnimationCache(): void;
  19408. /**
  19409. !#en
  19410. Get the all armature names in the DragonBones Data.
  19411. !#zh
  19412. 获取 DragonBones 数据中所有的 armature 名称
  19413. */
  19414. getArmatureNames(): any[];
  19415. /**
  19416. !#en
  19417. Get the all animation names of specified armature.
  19418. !#zh
  19419. 获取指定的 armature 的所有动画名称。
  19420. @param armatureName armatureName
  19421. */
  19422. getAnimationNames(armatureName: string): any[];
  19423. /**
  19424. !#en
  19425. Add event listener for the DragonBones Event, the same to addEventListener.
  19426. !#zh
  19427. 添加 DragonBones 事件监听器,与 addEventListener 作用相同。
  19428. @param type A string representing the event type to listen for.
  19429. @param listener The callback that will be invoked when the event is dispatched.
  19430. @param target The target (this object) to invoke the callback, can be null
  19431. */
  19432. on(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19433. /**
  19434. !#en
  19435. Remove the event listener for the DragonBones Event, the same to removeEventListener.
  19436. !#zh
  19437. 移除 DragonBones 事件监听器,与 removeEventListener 作用相同。
  19438. @param type A string representing the event type to listen for.
  19439. @param listener listener
  19440. @param target target
  19441. */
  19442. off(type: string, listener?: Function, target?: any): void;
  19443. /**
  19444. !#en
  19445. Add DragonBones one-time event listener, the callback will remove itself after the first time it is triggered.
  19446. !#zh
  19447. 添加 DragonBones 一次性事件监听器,回调会在第一时间被触发后删除自身。
  19448. @param type A string representing the event type to listen for.
  19449. @param listener The callback that will be invoked when the event is dispatched.
  19450. @param target The target (this object) to invoke the callback, can be null
  19451. */
  19452. once(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19453. /**
  19454. !#en
  19455. Add event listener for the DragonBones Event.
  19456. !#zh
  19457. 添加 DragonBones 事件监听器。
  19458. @param type A string representing the event type to listen for.
  19459. @param listener The callback that will be invoked when the event is dispatched.
  19460. @param target The target (this object) to invoke the callback, can be null
  19461. */
  19462. addEventListener(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19463. /**
  19464. !#en
  19465. Remove the event listener for the DragonBones Event.
  19466. !#zh
  19467. 移除 DragonBones 事件监听器。
  19468. @param type A string representing the event type to listen for.
  19469. @param listener listener
  19470. @param target target
  19471. */
  19472. removeEventListener(type: string, listener?: Function, target?: any): void;
  19473. /**
  19474. !#en
  19475. Build the armature for specified name.
  19476. !#zh
  19477. 构建指定名称的 armature 对象
  19478. @param armatureName armatureName
  19479. @param node node
  19480. */
  19481. buildArmature(armatureName: string, node: cc.Node): ArmatureDisplay;
  19482. /**
  19483. !#en
  19484. Get the current armature object of the ArmatureDisplay.
  19485. !#zh
  19486. 获取 ArmatureDisplay 当前使用的 Armature 对象
  19487. */
  19488. armature(): any;
  19489. }
  19490. /** DragonBones factory */
  19491. export class CCFactory extends BaseFactory {
  19492. /**
  19493. @example
  19494. ```js
  19495. let factory = dragonBones.CCFactory.getInstance();
  19496. ```
  19497. */
  19498. static getInstance(): CCFactory;
  19499. }
  19500. /** !#en The skeleton data of dragonBones.
  19501. !#zh dragonBones 的 骨骼数据。 */
  19502. export class DragonBonesAsset extends cc.Asset {
  19503. /** !#en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  19504. !#zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html */
  19505. dragonBonesJson: string;
  19506. }
  19507. /** !#en The skeleton atlas data of dragonBones.
  19508. !#zh dragonBones 的骨骼纹理数据。 */
  19509. export class DragonBonesAtlasAsset extends cc.Asset {
  19510. atlasJson: string;
  19511. texture: cc.Texture2D;
  19512. }
  19513. /****************************************************
  19514. * ArmatureDisplay
  19515. *****************************************************/
  19516. export namespace ArmatureDisplay {
  19517. /** !#en Enum for cache mode type.
  19518. !#zh Dragonbones渲染类型 */
  19519. export enum AnimationCacheMode {
  19520. REALTIME = 0,
  19521. SHARED_CACHE = 0,
  19522. PRIVATE_CACHE = 0,
  19523. }
  19524. }
  19525. /****************************************************
  19526. * dragonBones
  19527. *****************************************************/
  19528. export namespace dragonBones {
  19529. /** !#en Attach node tool
  19530. !#zh 挂点工具类 */
  19531. export class AttachUtil {
  19532. /**
  19533. !#en Gets attached root node.
  19534. !#zh 获取挂接节点树的根节点
  19535. */
  19536. getAttachedRootNode(): cc.Node;
  19537. /**
  19538. !#en Gets attached node which you want.
  19539. !#zh 获得对应的挂点
  19540. @param boneName boneName
  19541. */
  19542. getAttachedNodes(boneName: string): cc.Node[];
  19543. /**
  19544. !#en Destroy attached node which you want.
  19545. !#zh 销毁对应的挂点
  19546. @param boneName boneName
  19547. */
  19548. destroyAttachedNodes(boneName: string): void;
  19549. /**
  19550. !#en Traverse all bones to generate the minimum node tree containing the given bone names, NOTE that make sure the skeleton has initialized before calling this interface.
  19551. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19552. @param boneName boneName
  19553. */
  19554. generateAttachedNodes(boneName: string): cc.Node[];
  19555. /**
  19556. !#en Destroy all attached node.
  19557. !#zh 销毁所有挂点
  19558. */
  19559. destroyAllAttachedNodes(): void;
  19560. /**
  19561. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19562. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19563. */
  19564. generateAllAttachedNodes(): cc.Node;
  19565. }
  19566. }
  19567. }
  19568. /** !#en
  19569. This module controls asset's behaviors and information, include loading, releasing etc.
  19570. All member can be accessed with `cc.assetManager`. All class or enum can be accessed with `cc.AssetManager`
  19571. !#zh
  19572. 此模块管理资源的行为和信息,包括加载,释放等,所有成员能够通过 `cc.assetManager` 调用. 所有类型或枚举能通过 `cc.AssetManager` 访问 */
  19573. declare namespace cc.AssetManager {
  19574. /** !#en
  19575. This module contains the builtin asset, it's a singleton, all member can be accessed with `cc.assetManager.builtins`
  19576. !#zh
  19577. 此模块包含内建资源,这是一个单例,所有成员能通过 `cc.assetManager.builtins` 访问 */
  19578. export class Builtins {
  19579. /**
  19580. !#en
  19581. Initialize
  19582. !#zh
  19583. 初始化
  19584. @param cb Callback when finish loading built-in assets
  19585. */
  19586. init (cb: () => void): void;
  19587. /**
  19588. !#en
  19589. Get the built-in asset using specific type and name.
  19590. !#zh
  19591. 通过特定的类型和名称获取内建资源
  19592. @param type The type of asset, such as `effect`
  19593. @param name The name of asset, such as `phong`
  19594. @example
  19595. ```js
  19596. cc.assetManaer.builtins.getBuiltin('effect', 'phone');
  19597. ```
  19598. */
  19599. getBuiltin(type?: string, name?: string): cc.Asset | Cache<cc.Asset>;
  19600. /**
  19601. !#en
  19602. Clear all builtin assets
  19603. !#zh
  19604. 清空所有内置资源
  19605. */
  19606. clear(): void;
  19607. }
  19608. /** !#en
  19609. A bundle contains an amount of assets(includes scene), you can load, preload, release asset which is in this bundle
  19610. !#zh
  19611. 一个包含一定数量资源(包括场景)的包,你可以加载,预加载,释放此包内的资源 */
  19612. export class Bundle {
  19613. /**
  19614. !#en
  19615. Create a bundle
  19616. !#zh
  19617. 创建一个 bundle
  19618. */
  19619. constructor();
  19620. /** !#en
  19621. The name of this bundle
  19622. !#zh
  19623. 此 bundle 的名称 */
  19624. name: string;
  19625. /** !#en
  19626. The dependency of this bundle
  19627. !#zh
  19628. 此 bundle 的依赖 */
  19629. deps: string[];
  19630. /** !#en
  19631. The root path of this bundle, such like 'http://example.com/bundle1'
  19632. !#zh
  19633. 此 bundle 的根路径, 例如 'http://example.com/bundle1' */
  19634. base: string;
  19635. /**
  19636. !#en
  19637. Get asset's info using path, only valid when asset is in bundle folder.
  19638. !#zh
  19639. 使用 path 获取资源的配置信息
  19640. @param path The relative path of asset, such as 'images/a'
  19641. @param type The constructor of asset, such as `cc.Texture2D`
  19642. @example
  19643. ```js
  19644. var info = bundle.getInfoWithPath('image/a', cc.Texture2D);
  19645. ```
  19646. */
  19647. getInfoWithPath (path: string, type?: typeof cc.Asset): Record<string, any>;
  19648. /**
  19649. !#en
  19650. Get all asset's info within specific folder
  19651. !#zh
  19652. 获取在某个指定文件夹下的所有资源信息
  19653. @param path The relative path of folder, such as 'images'
  19654. @param type The constructor should be used to filter paths
  19655. @param out The output array
  19656. @example
  19657. ```js
  19658. var infos = [];
  19659. bundle.getDirWithPath('images', cc.Texture2D, infos);
  19660. ```
  19661. */
  19662. getDirWithPath (path: string, type?: typeof cc.Asset, out?: Array<Record<string, any>>): Array<Record<string, any>>;
  19663. /**
  19664. !#en
  19665. Get asset's info with uuid
  19666. !#zh
  19667. 通过 uuid 获取资源信息
  19668. @param uuid The asset's uuid
  19669. @example
  19670. ```js
  19671. var info = bundle.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  19672. ```
  19673. */
  19674. getAssetInfo (uuid: string): Record<string, any>;
  19675. /**
  19676. !#en
  19677. Get scene'info with name
  19678. !#zh
  19679. 通过场景名获取场景信息
  19680. @param name The name of scene
  19681. @example
  19682. ```js
  19683. var info = bundle.getSceneInfo('first.fire');
  19684. ```
  19685. */
  19686. getSceneInfo(name: string): Record<string, any>;
  19687. /**
  19688. !#en
  19689. Initialize this bundle with options
  19690. !#zh
  19691. 初始化此 bundle
  19692. @param options options
  19693. */
  19694. init(options: Record<string, any>): void;
  19695. /**
  19696. !#en
  19697. Load the asset within this bundle by the path which is relative to bundle's path
  19698. !#zh
  19699. 通过相对路径加载分包中的资源。路径是相对分包文件夹路径的相对路径
  19700. @param paths Paths of the target assets.The path is relative to the bundle's folder, extensions must be omitted.
  19701. @param type Only asset of type will be loaded if this argument is supplied.
  19702. @param onProgress Callback invoked when progression change.
  19703. @param onComplete Callback invoked when all assets loaded.
  19704. @example
  19705. ```js
  19706. // load the texture (${project}/assets/resources/textures/background.jpg) from resources
  19707. cc.resources.load('textures/background', cc.Texture2D, (err, texture) => console.log(err));
  19708. // load the audio (${project}/assets/resources/music/hit.mp3) from resources
  19709. cc.resources.load('music/hit', cc.AudioClip, (err, audio) => console.log(err));
  19710. // load the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  19711. bundle1.load('misc/character/cocos', cc.Prefab, (err, prefab) => console.log(err));
  19712. // load the sprite frame (${project}/assets/some/xxx/bundle2/imgs/cocos.png) from bundle2 folder
  19713. bundle2.load('imgs/cocos', cc.SpriteFrame, null, (err, spriteFrame) => console.log(err));
  19714. ```
  19715. */
  19716. load<T extends cc.Asset>(paths: string|string[], type?: typeof cc.Asset, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, assets: T|Array<T>) => void): void;
  19717. load<T extends cc.Asset>(paths: string|string[], onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, assets: T|Array<T>) => void): void;
  19718. load<T extends cc.Asset>(paths: string|string[], type?: typeof cc.Asset, onComplete?: (error: Error, assets: T|Array<T>) => void): void;
  19719. load<T extends cc.Asset>(paths: string|string[], onComplete?: (error: Error, assets: T|Array<T>) => void): void;
  19720. /**
  19721. !#en
  19722. Preload the asset within this bundle by the path which is relative to bundle's path.
  19723. After calling this method, you still need to finish loading by calling `Bundle.load`.
  19724. It will be totally fine to call `Bundle.load` at any time even if the preloading is not
  19725. yet finished
  19726. !#zh
  19727. 通过相对路径预加载分包中的资源。路径是相对分包文件夹路径的相对路径。调用完后,你仍然需要通过 `Bundle.load` 来完成加载。
  19728. 就算预加载还没完成,你也可以直接调用 `Bundle.load`。
  19729. @param paths Paths of the target asset.The path is relative to bundle folder, extensions must be omitted.
  19730. @param type Only asset of type will be loaded if this argument is supplied.
  19731. @param onProgress Callback invoked when progression change.
  19732. @param onComplete Callback invoked when the resource loaded.
  19733. @example
  19734. ```js
  19735. // preload the texture (${project}/assets/resources/textures/background.jpg) from resources
  19736. cc.resources.preload('textures/background', cc.Texture2D);
  19737. // preload the audio (${project}/assets/resources/music/hit.mp3) from resources
  19738. cc.resources.preload('music/hit', cc.AudioClip);
  19739. // wait for while
  19740. cc.resources.load('music/hit', cc.AudioClip, (err, audioClip) => {});
  19741. * // preload the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  19742. bundle1.preload('misc/character/cocos', cc.Prefab);
  19743. // load the sprite frame of (${project}/assets/bundle2/imgs/cocos.png) from bundle2 folder
  19744. bundle2.preload('imgs/cocos', cc.SpriteFrame);
  19745. // wait for while
  19746. bundle2.load('imgs/cocos', cc.SpriteFrame, (err, spriteFrame) => {});
  19747. ```
  19748. */
  19749. preload(paths: string|string[], type?: typeof cc.Asset, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19750. preload(paths: string|string[], onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19751. preload(paths: string|string[], type?: typeof cc.Asset, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19752. preload(paths: string|string[], onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19753. /**
  19754. !#en
  19755. Load all assets under a folder inside the bundle folder.<br>
  19756. <br>
  19757. Note: All asset paths in Creator use forward slashes, paths using backslashes will not work.
  19758. !#zh
  19759. 加载目标文件夹中的所有资源, 注意:路径中只能使用斜杠,反斜杠将停止工作
  19760. @param dir path of the target folder.
  19761. The path is relative to the bundle folder, extensions must be omitted.
  19762. @param type Only asset of type will be loaded if this argument is supplied.
  19763. @param onProgress Callback invoked when progression change.
  19764. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  19765. @example
  19766. ```js
  19767. // load all audios (resources/audios/)
  19768. cc.resources.loadDir('audios', cc.AudioClip, (err, audios) => {});
  19769. // load all textures in "resources/imgs/"
  19770. cc.resources.loadDir('imgs', cc.Texture2D, null, function (err, textures) {
  19771. var texture1 = textures[0];
  19772. var texture2 = textures[1];
  19773. });
  19774. // load all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  19775. bundle1.loadDir('misc/characters', cc.Prefab, (err, prefabs) => console.log(err));
  19776. // load all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  19777. bundle2.loadDir('skills', cc.SpriteFrame, null, (err, spriteFrames) => console.log(err));
  19778. ```
  19779. */
  19780. loadDir<T extends cc.Asset>(dir: string, type?: typeof cc.Asset, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, assets: Array<T>) => void): void;
  19781. loadDir<T extends cc.Asset>(dir: string, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, assets: Array<T>) => void): void;
  19782. loadDir<T extends cc.Asset>(dir: string, type?: typeof cc.Asset, onComplete?: (error: Error, assets: Array<T>) => void): void;
  19783. loadDir<T extends cc.Asset>(dir: string, onComplete?: (error: Error, assets: Array<T>) => void): void;
  19784. /**
  19785. !#en
  19786. Preload all assets under a folder inside the bundle folder.<br> After calling this method, you still need to finish loading by calling `Bundle.loadDir`.
  19787. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  19788. !#zh
  19789. 预加载目标文件夹中的所有资源。调用完后,你仍然需要通过 `Bundle.loadDir` 来完成加载。
  19790. 就算预加载还没完成,你也可以直接调用 `Bundle.loadDir`。
  19791. @param dir path of the target folder.
  19792. The path is relative to the bundle folder, extensions must be omitted.
  19793. @param type Only asset of type will be preloaded if this argument is supplied.
  19794. @param onProgress Callback invoked when progression change.
  19795. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  19796. @example
  19797. ```js
  19798. // preload all audios (resources/audios/)
  19799. cc.resources.preloadDir('audios', cc.AudioClip);
  19800. // preload all textures in "resources/imgs/"
  19801. cc.resources.preloadDir('imgs', cc.Texture2D);
  19802. // wait for while
  19803. cc.resources.loadDir('imgs', cc.Texture2D, (err, textures) => {});
  19804. // preload all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  19805. bundle1.preloadDir('misc/characters', cc.Prefab);
  19806. // preload all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  19807. bundle2.preloadDir('skills', cc.SpriteFrame);
  19808. // wait for while
  19809. bundle2.loadDir('skills', cc.SpriteFrame, (err, spriteFrames) => {});
  19810. ```
  19811. */
  19812. preloadDir(dir: string, type?: typeof cc.Asset, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19813. preloadDir(dir: string, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19814. preloadDir(dir: string, type?: typeof cc.Asset, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19815. preloadDir(dir: string, onComplete?: (error: Error, items: RequestItem[]) => void): void;
  19816. /**
  19817. !#en
  19818. Loads the scene within this bundle by its name.
  19819. !#zh
  19820. 通过场景名称加载分包中的场景。
  19821. @param sceneName The name of the scene to load.
  19822. @param options Some optional parameters
  19823. @param onProgress Callback invoked when progression change.
  19824. @param onComplete callback, will be called after scene launched.
  19825. @example
  19826. ```js
  19827. bundle1.loadScene('first', (err, sceneAsset) => cc.director.runScene(sceneAsset));
  19828. ```
  19829. */
  19830. loadScene(sceneName: string, options?: Record<string, any>, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  19831. loadScene(sceneName: string, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  19832. loadScene(sceneName: string, options?: Record<string, any>, onComplete?: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  19833. loadScene(sceneName: string, onComplete?: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  19834. /**
  19835. !#en
  19836. Preloads the scene within this bundle by its name. After calling this method, you still need to finish loading by calling `Bundle.loadScene` or `cc.director.loadScene`.
  19837. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  19838. !#zh
  19839. 通过场景名称预加载分包中的场景.调用完后,你仍然需要通过 `Bundle.loadScene` 或 `cc.director.loadScene` 来完成加载。
  19840. 就算预加载还没完成,你也可以直接调用 `Bundle.loadScene` 或 `cc.director.loadScene`。
  19841. @param sceneName The name of the scene to preload.
  19842. @param options Some optional parameters
  19843. @param onProgress callback, will be called when the load progression change.
  19844. @param onComplete callback, will be called after scene loaded.
  19845. @example
  19846. ```js
  19847. bundle1.preloadScene('first');
  19848. // wait for a while
  19849. bundle1.loadScene('first', (err, scene) => cc.director.runScene(scene));
  19850. ```
  19851. */
  19852. preloadScene(sceneName: string, options?: Record<string, any>, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error) => void): void;
  19853. preloadScene(sceneName: string, onProgress?: (finish: number, total: number, item: RequestItem) => void, onComplete?: (error: Error) => void): void;
  19854. preloadScene(sceneName: string, options?: Record<string, any>, onComplete?: (error: Error) => void): void;
  19855. preloadScene(sceneName: string, onComplete?: (error: Error) => void): void;
  19856. /**
  19857. !#en
  19858. Get asset within this bundle by path and type. <br>
  19859. After you load asset with {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}},
  19860. you can acquire them by passing the path to this API.
  19861. !#zh
  19862. 通过路径与类型获取资源。在你使用 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 之后,
  19863. 你能通过传路径通过这个 API 获取到这些资源。
  19864. @param path The path of asset
  19865. @param type Only asset of type will be returned if this argument is supplied.
  19866. @example
  19867. ```js
  19868. bundle1.get('music/hit', cc.AudioClip);
  19869. ```
  19870. */
  19871. get (path: string, type?: typeof cc.Asset): cc.Asset;
  19872. /**
  19873. !#en
  19874. Release the asset loaded by {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} and it's dependencies.
  19875. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  19876. !#zh
  19877. 释放通过 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  19878. @param path The path of asset
  19879. @param type Only asset of type will be released if this argument is supplied.
  19880. @example
  19881. ```js
  19882. // release a texture which is no longer need
  19883. bundle1.release('misc/character/cocos');
  19884. ```
  19885. */
  19886. release(path: string, type: typeof cc.Asset): void;
  19887. release(path: string): void;
  19888. /**
  19889. !#en
  19890. Release all assets within this bundle. Refer to {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} for detailed informations.
  19891. !#zh
  19892. 释放此包中的所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}}
  19893. @example
  19894. ```js
  19895. // release all asset within bundle1
  19896. bundle1.releaseAll();
  19897. ```
  19898. */
  19899. releaseAll(): void;
  19900. }
  19901. /** !#en
  19902. use to cache something
  19903. !#zh
  19904. 用于缓存某些内容 */
  19905. export class Cache<T = any> {
  19906. /**
  19907. !#en
  19908. Create a cache
  19909. !#zh
  19910. 创建一个 cache
  19911. @param map An object used to initialize
  19912. */
  19913. constructor(map?: Record<string, T>);
  19914. /**
  19915. !#en
  19916. Add Key-Value to cache
  19917. !#zh
  19918. 增加键值对到缓存中
  19919. @param key The key
  19920. @param val The value
  19921. @example
  19922. ```js
  19923. var cache = new Cache();
  19924. cache.add('test', null);
  19925. ```
  19926. */
  19927. add(key: string, val: T): T;
  19928. /**
  19929. !#en
  19930. Get the cached content by key
  19931. !#zh
  19932. 通过 key 获取对应的 value
  19933. @param key The key
  19934. @example
  19935. ```js
  19936. var cache = new Cache();
  19937. var test = cache.get('test');
  19938. ```
  19939. */
  19940. get(key: string): T;
  19941. /**
  19942. !#en
  19943. Check whether or not content exists by key
  19944. !#zh
  19945. 通过 Key 判断是否存在对应的内容
  19946. @param key The key
  19947. @example
  19948. ```js
  19949. var cache = new Cache();
  19950. var exist = cache.has('test');
  19951. ```
  19952. */
  19953. has(key: string): boolean;
  19954. /**
  19955. !#en
  19956. Remove the cached content by key
  19957. !#zh
  19958. 通过 Key 移除对应的内容
  19959. @param key The key
  19960. @example
  19961. ```js
  19962. var cache = new Cache();
  19963. var content = cache.remove('test');
  19964. ```
  19965. */
  19966. remove(key: string): T;
  19967. /**
  19968. !#en
  19969. Clear all content
  19970. !#zh
  19971. 清除所有内容
  19972. @example
  19973. ```js
  19974. var cache = new Cache();
  19975. cache.clear();
  19976. ```
  19977. */
  19978. clear():void;
  19979. /**
  19980. !#en
  19981. Enumerate all content and invoke function
  19982. !#zh
  19983. 枚举所有内容并执行方法
  19984. @param func Function to be invoked
  19985. @example
  19986. ```js
  19987. var cache = new Cache();
  19988. cache.forEach((val, key) => console.log(key));
  19989. ```
  19990. */
  19991. forEach(func: (val: T, key: string) => void): void;
  19992. /**
  19993. !#en
  19994. Enumerate all content to find one element which can fulfill condition
  19995. !#zh
  19996. 枚举所有内容,找到一个可以满足条件的元素
  19997. @param predicate The condition
  19998. @example
  19999. ```js
  20000. var cache = new Cache();
  20001. var val = cache.find((val, key) => key === 'test');
  20002. ```
  20003. */
  20004. find(predicate: (val: T, key: string) => boolean): T;
  20005. /** !#en
  20006. The count of cached content
  20007. !#zh
  20008. 缓存数量 */
  20009. count: number;
  20010. /**
  20011. !#en
  20012. Destroy this cache
  20013. !#zh
  20014. 销毁这个 cache
  20015. */
  20016. destroy(): void;
  20017. }
  20018. /** !#en
  20019. Control asset's dependency list, it is a singleton. All member can be accessed with `cc.assetManager.dependUtil`
  20020. !#zh
  20021. 控制资源的依赖列表,这是一个单例, 所有成员能通过 `cc.assetManager.dependUtil` 访问 */
  20022. export class DependUtil {
  20023. /**
  20024. !#en
  20025. Get asset's native dependency. For example, Texture's native dependency is image.
  20026. !#zh
  20027. 获取资源的原生依赖,例如 Texture 的原生依赖是图片
  20028. @param uuid asset's uuid
  20029. @example
  20030. ```js
  20031. var dep = dependUtil.getNativeDep('fcmR3XADNLgJ1ByKhqcC5Z');
  20032. ```
  20033. */
  20034. getNativeDep(uuid: string): Record<string, any>;
  20035. /**
  20036. !#en
  20037. Get asset's direct referencing non-native dependency list. For example, Material's non-native dependencies are Texture.
  20038. !#zh
  20039. 获取资源直接引用的非原生依赖列表,例如,材质的非原生依赖是 Texture
  20040. @param uuid asset's uuid
  20041. @example
  20042. ```js
  20043. var deps = dependUtil.getDeps('fcmR3XADNLgJ1ByKhqcC5Z');
  20044. ```
  20045. */
  20046. getDeps(uuid: string): string[];
  20047. /**
  20048. !#en
  20049. Get non-native dependency list of the loaded asset, include indirect reference.
  20050. The returned array stores the dependencies with their uuid, after retrieve dependencies,
  20051. !#zh
  20052. 获取某个已经加载好的资源的所有非原生依赖资源列表,包括间接引用的资源,并保存在数组中返回。
  20053. 返回的数组将仅保存依赖资源的 uuid。
  20054. @param uuid The asset's uuid
  20055. @example
  20056. ```js
  20057. var deps = dependUtil.getDepsRecursively('fcmR3XADNLgJ1ByKhqcC5Z');
  20058. ```
  20059. */
  20060. getDepsRecursively(uuid: string): string[];
  20061. }
  20062. /** !#en
  20063. Control all download process, it is a singleton. All member can be accessed with `cc.assetManager.downloader` , it can download several types of files:
  20064. 1. Text
  20065. 2. Image
  20066. 3. Audio
  20067. 4. Assets
  20068. 5. Scripts
  20069. !#zh
  20070. 管理所有下载过程,downloader 是个单例,所有成员能通过 `cc.assetManager.downloader` 访问,它能下载以下几种类型的文件:
  20071. 1. 文本
  20072. 2. 图片
  20073. 3. 音频
  20074. 4. 资源
  20075. 5. 脚本 */
  20076. export class Downloader {
  20077. /** !#en
  20078. The maximum number of concurrent when downloading
  20079. !#zh
  20080. 下载时的最大并发数 */
  20081. maxConcurrent: number;
  20082. /** !#en
  20083. The maximum number of request can be launched per frame when downloading
  20084. !#zh
  20085. 下载时每帧可以启动的最大请求数 */
  20086. maxRequestsPerFrame: number;
  20087. /** !#en
  20088. The max number of retries when fail
  20089. !#zh
  20090. 失败重试次数 */
  20091. maxRetryCount: number;
  20092. /** !#en
  20093. Wait for while before another retry, unit: ms
  20094. !#zh
  20095. 重试的间隔时间 */
  20096. retryInterval: number;
  20097. /**
  20098. !#en
  20099. Use Image element to download image
  20100. !#zh
  20101. 使用 Image 元素来下载图片
  20102. @param url Url of the image
  20103. @param options Some optional paramters
  20104. @param onComplete Callback when image loaded or failed
  20105. @example
  20106. ```js
  20107. downloadDomImage('http://example.com/test.jpg', null, (err, img) => console.log(err));
  20108. ```
  20109. */
  20110. downloadDomImage(url: string, options?: Record<string, any> , onComplete?: (err: Error, img: HTMLImageElement) => void): HTMLImageElement;
  20111. downloadDomImage(url: string, onComplete?: (err: Error, img: HTMLImageElement) => void): HTMLImageElement;
  20112. /**
  20113. !#en
  20114. Use audio element to download audio
  20115. !#zh
  20116. 使用 Audio 元素来下载音频
  20117. @param url Url of the audio
  20118. @param options Some optional paramters
  20119. @param onComplete Callback invoked when audio loaded or failed
  20120. @example
  20121. ```js
  20122. downloadDomAudio('http://example.com/test.mp3', null, (err, audio) => console.log(err));
  20123. ```
  20124. */
  20125. downloadDomAudio(url: string, options?: Record<string, any>, onComplete?: (err: Error, audio: HTMLAudioElement) => void): HTMLAudioElement;
  20126. downloadDomAudio(url: string, onComplete?: (err: Error, audio: HTMLAudioElement) => void): HTMLAudioElement;
  20127. /**
  20128. !#en
  20129. Use XMLHttpRequest to download file
  20130. !#zh
  20131. 使用 XMLHttpRequest 来下载文件
  20132. @param url Url of the file
  20133. @param options Some optional paramters
  20134. @param onFileProgress Callback continuously during download is processing
  20135. @param onComplete Callback when file loaded or failed
  20136. @example
  20137. ```js
  20138. downloadFile('http://example.com/test.bin', {responseType: 'arraybuffer'}, null, (err, arrayBuffer) => console.log(err));
  20139. ```
  20140. */
  20141. downloadFile(url: string, options?: Record<string, any>, onFileProgress?: (loaded: Number, total: Number) => void, onComplete?: (err: Error, response: any) => void): XMLHttpRequest;
  20142. downloadFile(url: string, onFileProgress?: (loaded: Number, total: Number) => void, onComplete?: (err: Error, response: any) => void): XMLHttpRequest;
  20143. downloadFile(url: string, options?: Record<string, any>, onComplete?: (err: Error, response: any) => void): XMLHttpRequest;
  20144. downloadFile(url: string, onComplete?: (err: Error, response: any) => void): XMLHttpRequest;
  20145. /**
  20146. !#en
  20147. Load script
  20148. !#zh
  20149. 加载脚本
  20150. @param url Url of the script
  20151. @param options Some optional paramters
  20152. @param onComplete Callback when script loaded or failed
  20153. @example
  20154. ```js
  20155. downloadScript('http://localhost:8080/index.js', null, (err) => console.log(err));
  20156. ```
  20157. */
  20158. downloadScript(url: string, options?: Record<string, any>, onComplete?: (err: Error) => void): void;;
  20159. downloadScript(url: string, onComplete?: (err: Error) => void): void;;
  20160. /**
  20161. !#en
  20162. Register custom handler if you want to change default behavior or extend downloader to download other format file
  20163. !#zh
  20164. 当你想修改默认行为或者拓展 downloader 来下载其他格式文件时可以注册自定义的 handler
  20165. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20166. @param handler handler
  20167. @example
  20168. ```js
  20169. downloader.register('.tga', (url, options, onComplete) => onComplete(null, null));
  20170. downloader.register({'.tga': (url, options, onComplete) => onComplete(null, null), '.ext': (url, options, onComplete) => onComplete(null, null)});
  20171. ```
  20172. */
  20173. register(type: string, handler: (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20174. register(map: Record<string, (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20175. /**
  20176. !#en
  20177. Use corresponding handler to download file under limitation
  20178. !#zh
  20179. 在限制下使用对应的 handler 来下载文件
  20180. @param url The url should be downloaded
  20181. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20182. @param options some optional paramters will be transferred to the corresponding handler.
  20183. @param onComplete callback when finishing downloading
  20184. @example
  20185. ```js
  20186. download('http://example.com/test.tga', '.tga', {onFileProgress: (loaded, total) => console.lgo(loaded/total)}, onComplete: (err) => console.log(err));
  20187. ```
  20188. */
  20189. download(id: string, url: string, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20190. }
  20191. /** !#en
  20192. Provide some helpful function, it is a singleton. All member can be accessed with `cc.assetManager.utils`
  20193. !#zh
  20194. 提供一些辅助方法,helper 是一个单例, 所有成员能通过 `cc.assetManager.utils` 访问 */
  20195. export class Helper {
  20196. /**
  20197. !#en
  20198. Decode uuid, returns the original uuid
  20199. !#zh
  20200. 解码 uuid,返回原始 uuid
  20201. @param base64 the encoded uuid
  20202. @example
  20203. ```js
  20204. var uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20205. var originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20206. ```
  20207. */
  20208. decodeUuid(base64: string): string;
  20209. /**
  20210. !#en
  20211. Extract uuid from url
  20212. !#zh
  20213. 从 url 中提取 uuid
  20214. @param url url
  20215. @example
  20216. ```js
  20217. var url = 'res/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  20218. var uuid = getUuidFromURL(url); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20219. ```
  20220. */
  20221. getUuidFromURL(url: string): string;
  20222. /**
  20223. !#en
  20224. Transform uuid to url
  20225. !#zh
  20226. 转换 uuid 为 url
  20227. @param uuid The uuid of asset
  20228. @param options Some optional parameters
  20229. @example
  20230. ```js
  20231. var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: false});
  20232. ```
  20233. */
  20234. getUrlWithUuid(uuid: string, options?: Record<string, any>): string;
  20235. /**
  20236. !#en
  20237. Check if the type of data is cc.Scene or cc.Prefab
  20238. !#zh
  20239. 检测数据的类型是否是 Scene 或者 Prefab
  20240. @param json serialized data
  20241. */
  20242. isSceneObj(json: any): boolean;
  20243. /**
  20244. !#en
  20245. Check if the type of asset is scene
  20246. !#zh
  20247. 检查资源类型是否是场景
  20248. @param asset asset
  20249. */
  20250. isScene(asset: any): boolean;
  20251. /**
  20252. !#en
  20253. Normalize url, strip './' and '/'
  20254. !#zh
  20255. 标准化 url ,去除 './' 和 '/'
  20256. @param url url
  20257. */
  20258. normalize(url: string): string;
  20259. }
  20260. /** !#en
  20261. Handle the packed asset, include unpacking, loading, cache and so on. It is a singleton. All member can be accessed with `cc.assetManager.packManager`
  20262. !#zh
  20263. 处理打包资源,包括拆包,加载,缓存等等,这是一个单例, 所有成员能通过 `cc.assetManager.packManager` 访问 */
  20264. export class PackManager {
  20265. /**
  20266. !#en
  20267. Unpack the json, revert to what it was before packing
  20268. !#zh
  20269. 拆解 json 包,恢复为打包之前的内容
  20270. @param pack The pack
  20271. @param json The content of pack
  20272. @param options Some optional parameters
  20273. @param onComplete Callback when finish unpacking
  20274. @example
  20275. ```js
  20276. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20277. packManager.unpackJson(['a', 'b'], file, null, (err, data) => console.log(err));
  20278. });
  20279. ```
  20280. */
  20281. unpackJson(pack: string[], json: any, options: Record<string, any>, onComplete?: (err: Error, content: any) => void): void;
  20282. /**
  20283. !#en
  20284. Register custom handler if you want to change default behavior or extend packManager to unpack other format pack
  20285. !#zh
  20286. 当你想修改默认行为或者拓展 packManager 来拆分其他格式的包时可以注册自定义的 handler
  20287. @param type Extension likes '.bin' or map likes {'.bin': binHandler, '.ab': abHandler}
  20288. @param handler handler
  20289. @example
  20290. ```js
  20291. packManager.register('.bin', (packUuid, file, options, onComplete) => onComplete(null, null));
  20292. packManager.register({'.bin': (packUuid, file, options, onComplete) => onComplete(null, null), '.ab': (packUuid, file, options, onComplete) => onComplete(null, null)});
  20293. ```
  20294. */
  20295. register(type: string, handler: (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20296. register(map: Record<string, (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20297. /**
  20298. !#en
  20299. Use corresponding handler to unpack package
  20300. !#zh
  20301. 用对应的 handler 来进行解包
  20302. @param pack The uuid of packed assets
  20303. @param data The packed data
  20304. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20305. @param options Some optional parameter
  20306. @param onComplete callback when finishing unpacking
  20307. @example
  20308. ```js
  20309. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20310. packManager.unpack(['2fawq123d', '1zsweq23f'], file, '.json', null, (err, data) => console.log(err));
  20311. });
  20312. ```
  20313. */
  20314. unpack(pack: string[], data: any, type: string, options: Record<string, any>, onComplete?: (err: Error, data: any) => void): void;
  20315. /**
  20316. !#en
  20317. Download request item, If item is not in any package, download as usual. Otherwise, download the corresponding package and unpack it.
  20318. And then retrieve the corresponding content form it.
  20319. !#zh
  20320. 下载请求对象,如果请求对象不在任何包内,则正常下载,否则下载对应的 package 并进行拆解,并取回包内对应的内容
  20321. @param item Some item you want to download
  20322. @param options Some optional parameters
  20323. @param onComplete Callback when finished
  20324. @example
  20325. ```js
  20326. var requestItem = cc.AssetManager.RequestItem.create();
  20327. requestItem.uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20328. requestItem.info = config.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  20329. packManager.load(requestItem, null, (err, data) => console.log(err));
  20330. ```
  20331. */
  20332. load(item: RequestItem, options: Record<string, any>, onComplete: (err: Error, data: any) => void): void;
  20333. }
  20334. /** !#en
  20335. Parse the downloaded file, it's a singleton, all member can be accessed with `cc.assetManager.parser`
  20336. !#zh
  20337. 解析已下载的文件,parser 是一个单例, 所有成员能通过 `cc.assetManaager.parser` 访问 */
  20338. export class Parser {
  20339. /**
  20340. !#en
  20341. Parse image file
  20342. !#zh
  20343. 解析图片文件
  20344. @param file The downloaded file
  20345. @param options Some optional paramters
  20346. @param onComplete callback when finish parsing.
  20347. @example
  20348. ```js
  20349. downloader.downloadFile('test.jpg', {responseType: 'blob'}, null, (err, file) => {
  20350. parser.parseImage(file, null, (err, img) => console.log(err));
  20351. });
  20352. ```
  20353. */
  20354. parseImage(file: Blob, options: Record<string, any>, onComplete?: (err: Error, img: ImageBitmap|HTMLImageElement) => void): void;
  20355. /**
  20356. !#en
  20357. Parse audio file
  20358. !#zh
  20359. 解析音频文件
  20360. @param file The downloaded file
  20361. @param options Some optional paramters
  20362. @param onComplete Callback when finish parsing.
  20363. @example
  20364. ```js
  20365. downloader.downloadFile('test.mp3', {responseType: 'arraybuffer'}, null, (err, file) => {
  20366. parser.parseAudio(file, null, (err, audio) => console.log(err));
  20367. });
  20368. ```
  20369. */
  20370. parseAudio(file: ArrayBuffer|HTMLAudioElement, options: Record<string, any>, onComplete?: (err: Error, audio: AudioBuffer|HTMLAudioElement) => void): void;
  20371. /**
  20372. !#en
  20373. Parse pvr file
  20374. !#zh
  20375. 解析压缩纹理格式 pvr 文件
  20376. @param file The downloaded file
  20377. @param options Some optional paramters
  20378. @param onComplete Callback when finish parsing.
  20379. @example
  20380. ```js
  20381. downloader.downloadFile('test.pvr', {responseType: 'arraybuffer'}, null, (err, file) => {
  20382. parser.parsePVRTex(file, null, (err, pvrAsset) => console.log(err));
  20383. });
  20384. ```
  20385. */
  20386. parsePVRTex(file: ArrayBuffer|ArrayBufferView, options: Record<string, any>, onComplete: (err: Error, pvrAsset: {_data: Uint8Array, _compressed: boolean, width: number, height: number}) => void): void;
  20387. /**
  20388. !#en
  20389. Parse pkm file
  20390. !#zh
  20391. 解析压缩纹理格式 pkm 文件
  20392. @param file The downloaded file
  20393. @param options Some optional paramters
  20394. @param onComplete Callback when finish parsing.
  20395. @example
  20396. ```js
  20397. downloader.downloadFile('test.pkm', {responseType: 'arraybuffer'}, null, (err, file) => {
  20398. parser.parsePKMTex(file, null, (err, etcAsset) => console.log(err));
  20399. });
  20400. ```
  20401. */
  20402. parsePKMTex(file: ArrayBuffer|ArrayBufferView, options: Record<string, any>, onComplete: (err: Error, etcAsset: {_data: Uint8Array, _compressed: boolean, width: number, height: number}) => void): void;
  20403. /**
  20404. !#en
  20405. Parse plist file
  20406. !#zh
  20407. 解析 plist 文件
  20408. @param file The downloaded file
  20409. @param options Some optional paramters
  20410. @param onComplete Callback when finish parsing
  20411. @example
  20412. ```js
  20413. downloader.downloadFile('test.plist', {responseType: 'text'}, null, (err, file) => {
  20414. parser.parsePlist(file, null, (err, data) => console.log(err));
  20415. });
  20416. ```
  20417. */
  20418. parsePlist(file: string, options: Record<string, any>, onComplete?: (err: Error, data: any) => void): void;
  20419. /**
  20420. !#en
  20421. Deserialize asset file
  20422. !#zh
  20423. 反序列化资源文件
  20424. @param file The serialized json
  20425. @param options Some optional paramters
  20426. @param onComplete Callback when finish parsing
  20427. @example
  20428. ```js
  20429. downloader.downloadFile('test.json', {responseType: 'json'}, null, (err, file) => {
  20430. parser.parseImport(file, null, (err, data) => console.log(err));
  20431. });
  20432. ```
  20433. */
  20434. parseImport (file: any, options: Record<string, any>, onComplete?: (err: Error, asset: cc.Asset) => void): void;
  20435. /**
  20436. !#en
  20437. Register custom handler if you want to change default behavior or extend parser to parse other format file
  20438. !#zh
  20439. 当你想修改默认行为或者拓展 parser 来解析其他格式文件时可以注册自定义的handler
  20440. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20441. @param handler The corresponding handler
  20442. @example
  20443. ```js
  20444. parser.register('.tga', (file, options, onComplete) => onComplete(null, null));
  20445. parser.register({'.tga': (file, options, onComplete) => onComplete(null, null), '.ext': (file, options, onComplete) => onComplete(null, null)});
  20446. ```
  20447. */
  20448. register(type: string, handler: (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void): void;
  20449. register(map: Record<string, (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void>): void;
  20450. /**
  20451. !#en
  20452. Use corresponding handler to parse file
  20453. !#zh
  20454. 使用对应的handler来解析文件
  20455. @param id The id of file
  20456. @param file File
  20457. @param type The corresponding type of file, likes '.jpg'.
  20458. @param options Some optional paramters will be transferred to the corresponding handler.
  20459. @param onComplete callback when finishing downloading
  20460. @example
  20461. ```js
  20462. downloader.downloadFile('test.jpg', {responseType: 'blob'}, null, (err, file) => {
  20463. parser.parse('test.jpg', file, '.jpg', null, (err, img) => console.log(err));
  20464. });
  20465. ```
  20466. */
  20467. parse(id: string, file: any, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20468. }
  20469. /** !#en
  20470. Pipeline can execute the task for some effect.
  20471. !#zh
  20472. 管线能执行任务达到某个效果 */
  20473. export class Pipeline {
  20474. /** !#en
  20475. The id of pipeline
  20476. !#zh
  20477. 管线的 id */
  20478. id: number;
  20479. /** !#en
  20480. The name of pipeline
  20481. !#zh
  20482. 管线的名字 */
  20483. name: string;
  20484. /** !#en
  20485. All pipes of pipeline
  20486. !#zh
  20487. 所有的管道 */
  20488. pipes: Function[];
  20489. /**
  20490. !#en
  20491. Create a new pipeline
  20492. !#zh
  20493. 创建一个管线
  20494. @param name The name of pipeline
  20495. @param funcs The array of pipe, every pipe must be function which take two parameters, the first is a `Task` flowed in pipeline, the second is complete callback
  20496. @example
  20497. ```js
  20498. var pipeline = new Pipeline('download', [
  20499. (task, done) => {
  20500. var url = task.input;
  20501. cc.assetManager.downloader.downloadFile(url, null, null, (err, result) => {
  20502. task.output = result;
  20503. done(err);
  20504. });
  20505. },
  20506. (task, done) => {
  20507. var text = task.input;
  20508. var json = JSON.stringify(text);
  20509. task.output = json;
  20510. done();
  20511. }
  20512. ]);
  20513. ```
  20514. */
  20515. constructor(name: string, funcs: Array<(task: Task, done?: (err: Error) => void) => void>);
  20516. /**
  20517. !#en
  20518. At specific point insert a new pipe to pipeline
  20519. !#zh
  20520. 在某个特定的点为管线插入一个新的 pipe
  20521. @param func The new pipe
  20522. @param index The specific point you want to insert at.
  20523. @example
  20524. ```js
  20525. var pipeline = new Pipeline('test', []);
  20526. pipeline.insert((task, done) => {
  20527. // do something
  20528. done();
  20529. }, 0);
  20530. ```
  20531. */
  20532. insert(func: (task: Task, callback?: (err: Error) => void) => void, index: number): Pipeline;
  20533. /**
  20534. !#en
  20535. Append a new pipe to the pipeline
  20536. !#zh
  20537. 添加一个管道到管线中
  20538. @param func The new pipe
  20539. @example
  20540. ```js
  20541. var pipeline = new Pipeline('test', []);
  20542. pipeline.append((task, done) => {
  20543. // do something
  20544. done();
  20545. });
  20546. ```
  20547. */
  20548. append(func: (task: Task, callback?: (err: Error) => void) => void): Pipeline;
  20549. /**
  20550. !#en
  20551. Remove pipe which at specific point
  20552. !#zh
  20553. 移除特定位置的管道
  20554. @param index The specific point
  20555. @example
  20556. ```js
  20557. var pipeline = new Pipeline('test', (task, done) => {
  20558. // do something
  20559. done();
  20560. });
  20561. pipeline.remove(0);
  20562. ```
  20563. */
  20564. remove(index: number): Pipeline;
  20565. /**
  20566. !#en
  20567. Execute task synchronously
  20568. !#zh
  20569. 同步执行任务
  20570. @param task The task will be executed
  20571. @example
  20572. ```js
  20573. var pipeline = new Pipeline('sync', [(task) => {
  20574. let input = task.input;
  20575. task.output = doSomething(task.input);
  20576. }]);
  20577. var task = new Task({input: 'test'});
  20578. console.log(pipeline.sync(task));
  20579. ```
  20580. */
  20581. sync(task: Task): any;
  20582. /**
  20583. !#en
  20584. Execute task asynchronously
  20585. !#zh
  20586. 异步执行任务
  20587. @param task The task will be executed
  20588. @example
  20589. ```js
  20590. var pipeline = new Pipeline('sync', [(task, done) => {
  20591. let input = task.input;
  20592. task.output = doSomething(task.input);
  20593. done();
  20594. }]);
  20595. var task = new Task({input: 'test', onComplete: (err, result) => console.log(result)});
  20596. pipeline.async(task);
  20597. ```
  20598. */
  20599. async(task: Task): void;
  20600. }
  20601. /** !#en
  20602. A collection of information about a request
  20603. !#zh
  20604. 请求的相关信息集合 */
  20605. export class RequestItem {
  20606. /** !#en
  20607. The uuid of request
  20608. !#zh
  20609. 请求资源的uuid */
  20610. uuid: string;
  20611. /** !#en
  20612. The final url of request
  20613. !#zh
  20614. 请求的最终url */
  20615. url: string;
  20616. /** !#en
  20617. The extension name of asset
  20618. !#zh
  20619. 资源的扩展名 */
  20620. ext: string;
  20621. /** !#en
  20622. The content of asset
  20623. !#zh
  20624. 资源的内容 */
  20625. content: any;
  20626. /** !#en
  20627. The file of asset
  20628. !#zh
  20629. 资源的文件 */
  20630. file: any;
  20631. /** !#en
  20632. The information of asset
  20633. !#zh
  20634. 资源的相关信息 */
  20635. info: any;
  20636. /** !#en
  20637. Whether or not it is native asset
  20638. !#zh
  20639. 资源是否是原生资源 */
  20640. isNative: boolean;
  20641. /** !#en
  20642. Custom options
  20643. !#zh
  20644. 自定义参数 */
  20645. options: any;
  20646. /**
  20647. !#en
  20648. Create a request item
  20649. !#zh
  20650. 创建一个 request item
  20651. */
  20652. constructor();
  20653. /** !#en
  20654. The id of request, combined from uuid and isNative
  20655. !#zh
  20656. 请求的 id, 由 uuid 和 isNative 组合而成 */
  20657. id: string;
  20658. /**
  20659. !#en
  20660. Recycle this for reuse
  20661. !#zh
  20662. 回收 requestItem 用于复用
  20663. */
  20664. recycle(): void;
  20665. /**
  20666. !#en
  20667. Create a new request item from pool
  20668. !#zh
  20669. 从对象池中创建 requestItem
  20670. */
  20671. static create(): RequestItem;
  20672. }
  20673. /** !#en
  20674. The builtin bundles
  20675. !#zh
  20676. 内置 bundle */
  20677. export enum BuiltinBundleName {
  20678. RESOURCES = 0,
  20679. INTERNAL = 0,
  20680. MAIN = 0,
  20681. START_SCENE = 0,
  20682. }
  20683. /** !#en
  20684. Task is used to run in the pipeline for some effect
  20685. !#zh
  20686. 任务用于在管线中运行以达成某种效果 */
  20687. export class Task {
  20688. /** !#en
  20689. The id of task
  20690. !#zh
  20691. 任务id */
  20692. id: number;
  20693. /** !#en
  20694. The callback when task is completed
  20695. !#zh
  20696. 完成回调 */
  20697. onComplete: Function;
  20698. /** !#en
  20699. The callback of progression
  20700. !#zh
  20701. 进度回调 */
  20702. onProgress: Function;
  20703. /** !#en
  20704. The callback when something goes wrong
  20705. !#zh
  20706. 错误回调 */
  20707. onError: Function;
  20708. /** !#en
  20709. The source of task
  20710. !#zh
  20711. 任务的源 */
  20712. source: any;
  20713. /** !#en
  20714. The output of task
  20715. !#zh
  20716. 任务的输出 */
  20717. output: any;
  20718. /** !#en
  20719. The input of task
  20720. !#zh
  20721. 任务的输入 */
  20722. input: any;
  20723. /** !#en
  20724. The progression of task
  20725. !#zh
  20726. 任务的进度 */
  20727. progress: any;
  20728. /** !#en
  20729. Custom options
  20730. !#zh
  20731. 自定义参数 */
  20732. options: any;
  20733. /**
  20734. !#en
  20735. Create a new Task
  20736. !#zh
  20737. 创建一个任务
  20738. @param options Some optional paramters
  20739. */
  20740. constructor(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>});
  20741. /**
  20742. !#en
  20743. Set paramters of this task
  20744. !#zh
  20745. 设置任务的参数
  20746. @param options Some optional paramters
  20747. @example
  20748. ```js
  20749. var task = new Task();
  20750. task.set({input: ['test'], onComplete: (err, result) => console.log(err), onProgress: (finish, total) => console.log(finish / total)});
  20751. ```
  20752. */
  20753. set(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): void;
  20754. /**
  20755. !#en
  20756. Dispatch event
  20757. !#zh
  20758. 发布事件
  20759. @param event The event name
  20760. @param param1 Parameter 1
  20761. @param param2 Parameter 2
  20762. @param param3 Parameter 3
  20763. @param param4 Parameter 4
  20764. @example
  20765. ```js
  20766. var task = Task.create();
  20767. Task.onComplete = (msg) => console.log(msg);
  20768. Task.dispatch('complete', 'hello world');
  20769. ```
  20770. */
  20771. dispatch(event: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
  20772. /**
  20773. !#en
  20774. Recycle this for reuse
  20775. !#zh
  20776. 回收 task 用于复用
  20777. */
  20778. recycle(): void;
  20779. /** !#en
  20780. Whether or not this task is completed
  20781. !#zh
  20782. 此任务是否已经完成 */
  20783. isFinish: boolean;
  20784. /**
  20785. !#en
  20786. Create a new task from pool
  20787. !#zh
  20788. 从对象池中创建 task
  20789. @param options Some optional paramters
  20790. */
  20791. static create(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): Task;
  20792. }
  20793. }
  20794. /** Some helpful utilities */
  20795. declare namespace cc.geomUtils {
  20796. /**
  20797. !#en
  20798. the distance between a point and a plane
  20799. !#zh
  20800. 计算点和平面之间的距离。
  20801. @param point point
  20802. @param plane plane
  20803. */
  20804. export function point_plane(point: cc.Vec3, plane: cc.Plane): number;
  20805. /**
  20806. !#en
  20807. the closest point on plane to a given point
  20808. !#zh
  20809. 计算平面上最接近给定点的点。
  20810. @param out Closest point
  20811. @param point Given point
  20812. @param plane plane
  20813. */
  20814. export function pt_point_plane(out: cc.Vec3, point: cc.Vec3, plane: cc.Plane): cc.Vec3;
  20815. /**
  20816. !#en
  20817. the closest point on aabb to a given point
  20818. !#zh
  20819. 计算 aabb 上最接近给定点的点。
  20820. @param out Closest point.
  20821. @param point Given point.
  20822. @param aabb Align the axis around the box.
  20823. */
  20824. export function pt_point_aabb(out: cc.Vec3, point: cc.Vec3, aabb: cc.Aabb): cc.Vec3;
  20825. /**
  20826. !#en
  20827. the closest point on obb to a given point
  20828. !#zh
  20829. 计算 obb 上最接近给定点的点。
  20830. @param out Closest point
  20831. @param point Given point
  20832. @param obb Direction box
  20833. */
  20834. export function pt_point_obb(out: cc.Vec3, point: cc.Vec3, obb: cc.Obb): cc.Vec3;
  20835. }
  20836. /** !#en Some JavaScript decorators which can be accessed with "cc._decorator".
  20837. !#zh 一些 JavaScript 装饰器,目前可以通过 "cc._decorator" 来访问。
  20838. (这些 API 仍不完全稳定,有可能随着 JavaScript 装饰器的标准实现而调整) */
  20839. declare namespace cc._decorator {
  20840. /**
  20841. !#en
  20842. Declare the standard [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
  20843. as CCClass, please see [Class](../../../manual/en/scripting/class.html) for details.
  20844. !#zh
  20845. 将标准写法的 [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 声明为 CCClass,具体用法请参阅[类型定义](../../../manual/zh/scripting/class.html)。
  20846. @param name The class name used for serialization.
  20847. @example
  20848. ```js
  20849. const {ccclass} = cc._decorator;
  20850. // define a CCClass, omit the name
  20851. &#64;ccclass
  20852. class NewScript extends cc.Component {
  20853. // ...
  20854. }
  20855. // define a CCClass with a name
  20856. &#64;ccclass('LoginData')
  20857. class LoginData {
  20858. // ...
  20859. }
  20860. ```
  20861. */
  20862. export function ccclass(name?: string): Function;
  20863. export function ccclass(_class?: Function): void;
  20864. /**
  20865. !#en
  20866. Declare property for [CCClass](../../../manual/en/scripting/reference/attributes.html).
  20867. !#zh
  20868. 定义 [CCClass](../../../manual/zh/scripting/reference/attributes.html) 所用的属性。
  20869. @param options an object with some property attributes
  20870. @example
  20871. ```js
  20872. const {ccclass, property} = cc._decorator;
  20873. &#64;ccclass
  20874. class NewScript extends cc.Component {
  20875. &#64;property({
  20876. type: cc.Node
  20877. })
  20878. targetNode1 = null;
  20879. &#64;property(cc.Node)
  20880. targetNode2 = null;
  20881. &#64;property(cc.Button)
  20882. targetButton = null;
  20883. &#64;property
  20884. _width = 100;
  20885. &#64;property
  20886. get width () {
  20887. return this._width;
  20888. }
  20889. &#64;property
  20890. set width (value) {
  20891. this._width = value;
  20892. }
  20893. &#64;property
  20894. offset = new cc.Vec2(100, 100);
  20895. &#64;property(cc.Vec2)
  20896. offsets = [];
  20897. &#64;property(cc.SpriteFrame)
  20898. frame = null;
  20899. }
  20900. // above is equivalent to (上面的代码相当于):
  20901. var NewScript = cc.Class({
  20902. properties: {
  20903. targetNode1: {
  20904. default: null,
  20905. type: cc.Node
  20906. },
  20907. targetNode2: {
  20908. default: null,
  20909. type: cc.Node
  20910. },
  20911. targetButton: {
  20912. default: null,
  20913. type: cc.Button
  20914. },
  20915. _width: 100,
  20916. width: {
  20917. get () {
  20918. return this._width;
  20919. },
  20920. set (value) {
  20921. this._width = value;
  20922. }
  20923. },
  20924. offset: new cc.Vec2(100, 100)
  20925. offsets: {
  20926. default: [],
  20927. type: cc.Vec2
  20928. }
  20929. frame: {
  20930. default: null,
  20931. type: cc.SpriteFrame
  20932. },
  20933. }
  20934. });
  20935. ```
  20936. */
  20937. export function property(options?: {type?: any; visible?: boolean|(() => boolean); displayName?: string; tooltip?: string; multiline?: boolean; readonly?: boolean; min?: number; max?: number; step?: number; range?: number[]; slide?: boolean; serializable?: boolean; formerlySerializedAs?: string; editorOnly?: boolean; override?: boolean; animatable?: boolean} | any[]|Function|cc.ValueType|number|string|boolean): Function;
  20938. export function property(_target: Object, _key: any, _desc?: any): void;
  20939. /**
  20940. !#en
  20941. Makes a CCClass that inherit from component execute in edit mode.<br>
  20942. By default, all components are only executed in play mode,
  20943. which means they will not have their callback functions executed while the Editor is in edit mode.
  20944. !#zh
  20945. 允许继承自 Component 的 CCClass 在编辑器里执行。<br>
  20946. 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  20947. @example
  20948. ```js
  20949. const {ccclass, executeInEditMode} = cc._decorator;
  20950. &#64;ccclass
  20951. &#64;executeInEditMode
  20952. class NewScript extends cc.Component {
  20953. // ...
  20954. }
  20955. ```
  20956. */
  20957. export function executeInEditMode(): Function;
  20958. export function executeInEditMode(_class: Function): void;
  20959. /**
  20960. !#en
  20961. Automatically add required component as a dependency for the CCClass that inherit from component.
  20962. !#zh
  20963. 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  20964. @param requiredComponent requiredComponent
  20965. @example
  20966. ```js
  20967. const {ccclass, requireComponent} = cc._decorator;
  20968. &#64;ccclass
  20969. &#64;requireComponent(cc.Sprite)
  20970. class SpriteCtrl extends cc.Component {
  20971. // ...
  20972. }
  20973. ```
  20974. */
  20975. export function requireComponent(requiredComponent: typeof cc.Component): Function;
  20976. /**
  20977. !#en
  20978. The menu path to register a component to the editors "Component" menu. Eg. "Rendering/CameraCtrl".
  20979. !#zh
  20980. 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  20981. @param path The path is the menu represented like a pathname.
  20982. For example the menu could be "Rendering/CameraCtrl".
  20983. @example
  20984. ```js
  20985. const {ccclass, menu} = cc._decorator;
  20986. &#64;ccclass
  20987. &#64;menu("Rendering/CameraCtrl")
  20988. class NewScript extends cc.Component {
  20989. // ...
  20990. }
  20991. ```
  20992. */
  20993. export function menu(path: string): Function;
  20994. /**
  20995. !#en
  20996. The execution order of lifecycle methods for Component.
  20997. Those less than 0 will execute before while those greater than 0 will execute after.
  20998. The order will only affect onLoad, onEnable, start, update and lateUpdate while onDisable and onDestroy will not be affected.
  20999. !#zh
  21000. 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  21001. @param order The execution order of lifecycle methods for Component. Those less than 0 will execute before while those greater than 0 will execute after.
  21002. @example
  21003. ```js
  21004. const {ccclass, executionOrder} = cc._decorator;
  21005. &#64;ccclass
  21006. &#64;executionOrder(1)
  21007. class CameraCtrl extends cc.Component {
  21008. // ...
  21009. }
  21010. ```
  21011. */
  21012. export function executionOrder(order: number): Function;
  21013. /**
  21014. !#en
  21015. Prevents Component of the same type (or subtype) to be added more than once to a Node.
  21016. !#zh
  21017. 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  21018. @example
  21019. ```js
  21020. const {ccclass, disallowMultiple} = cc._decorator;
  21021. &#64;ccclass
  21022. &#64;disallowMultiple
  21023. class CameraCtrl extends cc.Component {
  21024. // ...
  21025. }
  21026. ```
  21027. */
  21028. export function disallowMultiple(): Function;
  21029. export function disallowMultiple(_class: Function): void;
  21030. /**
  21031. !#en
  21032. If specified, the editor's scene view will keep updating this node in 60 fps when it is selected, otherwise, it will update only if necessary.<br>
  21033. This property is only available if executeInEditMode is true.
  21034. !#zh
  21035. 当指定了 "executeInEditMode" 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  21036. @example
  21037. ```js
  21038. const {ccclass, playOnFocus, executeInEditMode} = cc._decorator;
  21039. &#64;ccclass
  21040. &#64;executeInEditMode
  21041. &#64;playOnFocus
  21042. class CameraCtrl extends cc.Component {
  21043. // ...
  21044. }
  21045. ```
  21046. */
  21047. export function playOnFocus(): Function;
  21048. export function playOnFocus(_class: Function): void;
  21049. /**
  21050. !#en
  21051. Specifying the url of the custom html to draw the component in **Properties**.
  21052. !#zh
  21053. 自定义当前组件在 **属性检查器** 中渲染时所用的网页 url。
  21054. @param url url
  21055. @example
  21056. ```js
  21057. const {ccclass, inspector} = cc._decorator;
  21058. &#64;ccclass
  21059. &#64;inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  21060. class NewScript extends cc.Component {
  21061. // ...
  21062. }
  21063. ```
  21064. */
  21065. export function inspector(path: string): Function;
  21066. /**
  21067. !#en
  21068. The custom documentation URL.
  21069. !#zh
  21070. 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  21071. @param url url
  21072. @example
  21073. ```js
  21074. const {ccclass, help} = cc._decorator;
  21075. &#64;ccclass
  21076. &#64;help("app://docs/html/components/spine.html")
  21077. class NewScript extends cc.Component {
  21078. // ...
  21079. }
  21080. ```
  21081. */
  21082. export function help(path: string): Function;
  21083. /**
  21084. NOTE:<br>
  21085. The old mixins implemented in cc.Class(ES5) behaves exact the same as multiple inheritance.
  21086. But since ES6, class constructor can't be function-called and class methods become non-enumerable,
  21087. so we can not mix in ES6 Classes.<br>
  21088. See:<br>
  21089. [https://esdiscuss.org/topic/traits-are-now-impossible-in-es6-until-es7-since-rev32](https://esdiscuss.org/topic/traits-are-now-impossible-in-es6-until-es7-since-rev32)<br>
  21090. One possible solution (but IDE unfriendly):<br>
  21091. [http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/)<br>
  21092. <br>
  21093. NOTE:<br>
  21094. You must manually call mixins constructor, this is different from cc.Class(ES5).
  21095. @param ctor constructors to mix, only support ES5 constructors or classes defined by using `cc.Class`,
  21096. not support ES6 Classes.
  21097. @example
  21098. ```js
  21099. const {ccclass, mixins} = cc._decorator;
  21100. class Animal { ... }
  21101. const Fly = cc.Class({
  21102. constructor () { ... }
  21103. });
  21104. &#64;ccclass
  21105. &#64;mixins(cc.EventTarget, Fly)
  21106. class Bird extends Animal {
  21107. constructor () {
  21108. super();
  21109. // You must manually call mixins constructor, this is different from cc.Class(ES5)
  21110. cc.EventTarget.call(this);
  21111. Fly.call(this);
  21112. }
  21113. // ...
  21114. }
  21115. ```
  21116. */
  21117. export function mixins(ctor: Function, ...rest: Function[]): Function;
  21118. }
  21119. /** !#en This module provides some JavaScript utilities. All members can be accessed with `cc.js`.
  21120. !#zh 这个模块封装了 JavaScript 相关的一些实用函数,你可以通过 `cc.js` 来访问这个模块。 */
  21121. declare namespace cc.js {
  21122. /**
  21123. Check the obj whether is number or not
  21124. If a number is created by using 'new Number(10086)', the typeof it will be "object"...
  21125. Then you can use this function if you care about this case.
  21126. @param obj obj
  21127. */
  21128. export function isNumber(obj: any): boolean;
  21129. /**
  21130. Check the obj whether is string or not.
  21131. If a string is created by using 'new String("blabla")', the typeof it will be "object"...
  21132. Then you can use this function if you care about this case.
  21133. @param obj obj
  21134. */
  21135. export function isString(obj: any): boolean;
  21136. /**
  21137. Copy all properties not defined in obj from arguments[1...n]
  21138. @param obj object to extend its properties
  21139. @param sourceObj source object to copy properties from
  21140. */
  21141. export function addon(obj: any, ...sourceObj: any[]): any;
  21142. /**
  21143. copy all properties from arguments[1...n] to obj
  21144. @param obj obj
  21145. @param sourceObj sourceObj
  21146. */
  21147. export function mixin(obj: any, ...sourceObj: any[]): any;
  21148. /**
  21149. Derive the class from the supplied base class.
  21150. Both classes are just native javascript constructors, not created by cc.Class, so
  21151. usually you will want to inherit using {{#crossLink "cc/Class:method"}}cc.Class {{/crossLink}} instead.
  21152. @param cls cls
  21153. @param base the baseclass to inherit
  21154. */
  21155. export function extend(cls: Function, base: Function): Function;
  21156. /**
  21157. Get super class
  21158. @param ctor the constructor of subclass
  21159. */
  21160. export function getSuper(ctor: Function): Function;
  21161. /**
  21162. Checks whether subclass is child of superclass or equals to superclass
  21163. @param subclass subclass
  21164. @param superclass superclass
  21165. */
  21166. export function isChildClassOf(subclass: Function, superclass: Function): boolean;
  21167. /**
  21168. Removes all enumerable properties from object
  21169. @param obj obj
  21170. */
  21171. export function clear(obj: any): void;
  21172. /**
  21173. Checks whether obj is an empty object
  21174. @param obj obj
  21175. */
  21176. export function isEmptyObject(obj: any): boolean;
  21177. /**
  21178. Get property descriptor in object and all its ancestors
  21179. @param obj obj
  21180. @param name name
  21181. */
  21182. export function getPropertyDescriptor(obj: any, name: string): any;
  21183. /**
  21184. Define value, just help to call Object.defineProperty.<br>
  21185. The configurable will be true.
  21186. @param obj obj
  21187. @param prop prop
  21188. @param value value
  21189. @param writable writable
  21190. @param enumerable enumerable
  21191. */
  21192. export function value(obj: any, prop: string, value: any, writable?: boolean, enumerable?: boolean): void;
  21193. /**
  21194. Define get set accessor, just help to call Object.defineProperty(...)
  21195. @param obj obj
  21196. @param prop prop
  21197. @param getter getter
  21198. @param setter setter
  21199. @param enumerable enumerable
  21200. @param configurable configurable
  21201. */
  21202. export function getset(obj: any, prop: string, getter: Function, setter?: Function, enumerable?: boolean, configurable?: boolean): void;
  21203. /**
  21204. Define get accessor, just help to call Object.defineProperty(...)
  21205. @param obj obj
  21206. @param prop prop
  21207. @param getter getter
  21208. @param enumerable enumerable
  21209. @param configurable configurable
  21210. */
  21211. export function get(obj: any, prop: string, getter: Function, enumerable?: boolean, configurable?: boolean): void;
  21212. /**
  21213. Define set accessor, just help to call Object.defineProperty(...)
  21214. @param obj obj
  21215. @param prop prop
  21216. @param setter setter
  21217. @param enumerable enumerable
  21218. @param configurable configurable
  21219. */
  21220. export function set(obj: any, prop: string, setter: Function, enumerable?: boolean, configurable?: boolean): void;
  21221. /**
  21222. Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  21223. (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code from this stackoverflow post</a>)
  21224. @param objOrCtor instance or constructor
  21225. */
  21226. export function getClassName(objOrCtor: any|Function): string;
  21227. /** !#en All classes registered in the engine, indexed by ID.
  21228. !#zh 引擎中已注册的所有类型,通过 ID 进行索引。 */
  21229. export var _registeredClassIds: any;
  21230. /** !#en All classes registered in the engine, indexed by name.
  21231. !#zh 引擎中已注册的所有类型,通过名称进行索引。 */
  21232. export var _registeredClassNames: any;
  21233. /**
  21234. Register the class by specified name manually
  21235. @param className className
  21236. @param constructor constructor
  21237. */
  21238. export function setClassName(className: string, constructor: Function): void;
  21239. /**
  21240. Unregister a class from fireball.
  21241. If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
  21242. Please note that its still your responsibility to free other references to the class.
  21243. @param constructor the class you will want to unregister, any number of classes can be added
  21244. */
  21245. export function unregisterClass(...constructor: Function[]): void;
  21246. /**
  21247. Get the registered class by name
  21248. @param classname classname
  21249. */
  21250. export function getClassByName(classname: string): Function;
  21251. /**
  21252. Defines a polyfill field for deprecated codes.
  21253. @param obj YourObject or YourClass.prototype
  21254. @param obsoleted "OldParam" or "YourClass.OldParam"
  21255. @param newExpr "NewParam" or "YourClass.NewParam"
  21256. @param writable writable
  21257. */
  21258. export function obsolete(obj: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  21259. /**
  21260. Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
  21261. @param obj YourObject or YourClass.prototype
  21262. @param objName "YourObject" or "YourClass"
  21263. @param props props
  21264. @param writable writable
  21265. */
  21266. export function obsoletes(obj: any, objName: any, props: any, writable?: boolean): void;
  21267. /**
  21268. A string tool to construct a string with format string.
  21269. @param msg A JavaScript string containing zero or more substitution strings (%s).
  21270. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  21271. @example
  21272. ```js
  21273. cc.js.formatStr("a: %s, b: %s", a, b);
  21274. cc.js.formatStr(a, b, c);
  21275. ```
  21276. */
  21277. export function formatStr(msg: string|any, ...subst: any[]): string;
  21278. /**
  21279. !#en
  21280. A simple wrapper of `Object.create(null)` which ensures the return object have no prototype (and thus no inherited members). So we can skip `hasOwnProperty` calls on property lookups. It is a worthwhile optimization than the `{}` literal when `hasOwnProperty` calls are necessary.
  21281. !#zh
  21282. 该方法是对 `Object.create(null)` 的简单封装。`Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断。在需要频繁判断 `hasOwnProperty` 时,使用这个方法性能会比 `{}` 更高。
  21283. @param forceDictMode Apply the delete operator to newly created map object. This causes V8 to put the object in "dictionary mode" and disables creation of hidden classes which are very expensive for objects that are constantly changing shape.
  21284. */
  21285. export function createMap(forceDictMode?: boolean): any;
  21286. /** undefined */
  21287. export class array {
  21288. /**
  21289. Removes the array item at the specified index.
  21290. @param array array
  21291. @param index index
  21292. */
  21293. static removeAt(array: any[], index: number): void;
  21294. /**
  21295. Removes the array item at the specified index.
  21296. It's faster but the order of the array will be changed.
  21297. @param array array
  21298. @param index index
  21299. */
  21300. static fastRemoveAt(array: any[], index: number): void;
  21301. /**
  21302. Removes the first occurrence of a specific object from the array.
  21303. @param array array
  21304. @param value value
  21305. */
  21306. static remove(array: any[], value: any): boolean;
  21307. /**
  21308. Removes the first occurrence of a specific object from the array.
  21309. It's faster but the order of the array will be changed.
  21310. @param array array
  21311. @param value value
  21312. */
  21313. static fastRemove(array: any[], value: number): void;
  21314. /**
  21315. Verify array's Type
  21316. @param array array
  21317. @param type type
  21318. */
  21319. static verifyType(array: any[], type: Function): boolean;
  21320. /**
  21321. Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.
  21322. @param array Source Array
  21323. @param minusArr minus Array
  21324. */
  21325. static removeArray(array: any[], minusArr: any[]): void;
  21326. /**
  21327. Inserts some objects at index
  21328. @param array array
  21329. @param addObjs addObjs
  21330. @param index index
  21331. */
  21332. static appendObjectsAt(array: any[], addObjs: any[], index: number): any[];
  21333. /**
  21334. Determines whether the array contains a specific value.
  21335. @param array array
  21336. @param value value
  21337. */
  21338. static contains(array: any[], value: any): boolean;
  21339. /**
  21340. Copy an array's item to a new array (its performance is better than Array.slice)
  21341. @param array array
  21342. */
  21343. static copy(array: any[]): any[];
  21344. }
  21345. /** !#en
  21346. A fixed-length object pool designed for general type.<br>
  21347. The implementation of this object pool is very simple,
  21348. it can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  21349. !#zh
  21350. 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  21351. 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。 */
  21352. export class Pool {
  21353. /**
  21354. !#en
  21355. Constructor for creating an object pool for the specific object type.
  21356. You can pass a callback argument for process the cleanup logic when the object is recycled.
  21357. !#zh
  21358. 使用构造函数来创建一个指定对象类型的对象池,您可以传递一个回调函数,用于处理对象回收时的清理逻辑。
  21359. @param cleanupFunc the callback method used to process the cleanup logic when the object is recycled.
  21360. @param size initializes the length of the array
  21361. */
  21362. constructor(cleanupFunc: (obj: any) => void, size: number);
  21363. constructor(size: number);
  21364. /**
  21365. !#en
  21366. Get and initialize an object from pool. This method defaults to null and requires the user to implement it.
  21367. !#zh
  21368. 获取并初始化对象池中的对象。这个方法默认为空,需要用户自己实现。
  21369. @param params parameters to used to initialize the object
  21370. */
  21371. get(...params: any[]): any;
  21372. /** !#en
  21373. The current number of available objects, the default is 0, it will gradually increase with the recycle of the object,
  21374. the maximum will not exceed the size specified when the constructor is called.
  21375. !#zh
  21376. 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。 */
  21377. count: number;
  21378. /**
  21379. !#en
  21380. Get an object from pool, if no available object in the pool, null will be returned.
  21381. !#zh
  21382. 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  21383. */
  21384. _get(): any;
  21385. /**
  21386. !#en Put an object into the pool.
  21387. !#zh 向对象池返还一个不再需要的对象。
  21388. */
  21389. put(): void;
  21390. /**
  21391. !#en Resize the pool.
  21392. !#zh 设置对象池容量。
  21393. */
  21394. resize(): void;
  21395. }
  21396. }
  21397. /** !#en A basic module for creating vertex data for 3D objects. You can access this module by `cc.primitive`.
  21398. !#zh 一个创建 3D 物体顶点数据的基础模块,你可以通过 `cc.primitive` 来访问这个模块。 */
  21399. declare namespace cc.primitive {
  21400. /**
  21401. !#en Create box vertex data
  21402. !#zh 创建长方体顶点数据
  21403. @param width width
  21404. @param height height
  21405. @param length length
  21406. @param opts opts
  21407. */
  21408. export function box(width: number, height: number, length: number, opts: {widthSegments: number; heightSegments: number; lengthSegments: number; }): cc.VertexData;
  21409. /**
  21410. !#en Create cone vertex data
  21411. !#zh 创建圆锥体顶点数据
  21412. @param radius radius
  21413. @param height height
  21414. @param opts opts
  21415. */
  21416. export function cone(radius: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21417. /**
  21418. !#en Create cylinder vertex data
  21419. !#zh 创建圆柱体顶点数据
  21420. @param radiusTop radiusTop
  21421. @param radiusBottom radiusBottom
  21422. @param height height
  21423. @param opts opts
  21424. */
  21425. export function cylinder(radiusTop: number, radiusBottom: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21426. /**
  21427. !#en Create plane vertex data
  21428. !#zh 创建平台顶点数据
  21429. @param width width
  21430. @param length length
  21431. @param opts opts
  21432. */
  21433. export function plane(width: number, length: number, opts: {widthSegments: number; lengthSegments: number; }): cc.VertexData;
  21434. /**
  21435. !#en Create quad vertex data
  21436. !#zh 创建面片顶点数据
  21437. */
  21438. export function quad(): cc.VertexData;
  21439. /**
  21440. !#en Create sphere vertex data
  21441. !#zh 创建球体顶点数据
  21442. @param radius radius
  21443. @param opts opts
  21444. */
  21445. export function sphere(radius: number, opts: {segments: number; }): cc.VertexData;
  21446. /**
  21447. !#en Create torus vertex data
  21448. !#zh 创建圆环顶点数据
  21449. @param radius radius
  21450. @param tube tube
  21451. @param opts opts
  21452. */
  21453. export function torus(radius: number, tube: number, opts: {radialSegments: number; tubularSegments: number; arc: number; }): cc.VertexData;
  21454. /**
  21455. !#en Create capsule vertex data
  21456. !#zh 创建胶囊体顶点数据
  21457. @param radiusTop radiusTop
  21458. @param radiusBottom radiusBottom
  21459. @param height height
  21460. @param opts opts
  21461. */
  21462. export function capsule(radiusTop: number, radiusBottom: number, height: number, opts: {sides: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21463. /**
  21464. !#en Create polyhedron vertex data
  21465. !#zh 创建多面体顶点数据
  21466. @param type type
  21467. @param Size Size
  21468. @param opts opts
  21469. */
  21470. export function polyhedron(type: cc.primitive.PolyhedronType, Size: number, opts: {sizeX: number; sizeY: number; sizeZ: number; }): cc.VertexData;
  21471. }
  21472. declare let CC_JSB: boolean
  21473. declare let CC_NATIVERENDERER: boolean
  21474. declare let CC_EDITOR: boolean
  21475. declare let cc: {
  21476. // polyfills: {
  21477. // destroyObject? (object: any): void;
  21478. // };
  21479. [x: string]: any;
  21480. }
  21481. // https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c
  21482. type FlagExcludedType<Base, Type> = { [Key in keyof Base]: Base[Key] extends Type ? never : Key };
  21483. type AllowedNames<Base, Type> = FlagExcludedType<Base, Type>[keyof Base];
  21484. type KeyPartial<T, K extends keyof T> = { [P in K]?: T[P] };
  21485. type OmitType<Base, Type> = KeyPartial<Base, AllowedNames<Base, Type>>;
  21486. type ConstructorType<T> = OmitType<T, Function>;
  21487. declare interface IWritableArrayLike<T> {
  21488. readonly length: number;
  21489. [index: number]: T;
  21490. }
  21491. declare let module: {
  21492. exports: object
  21493. }
  21494. type FloatArray = Float64Array | Float32Array;
  21495. interface IColorLike {
  21496. r: number;
  21497. g: number;
  21498. b: number;
  21499. a: number;
  21500. _val: number;
  21501. }
  21502. interface IMat3Like {
  21503. m: FloatArray
  21504. }
  21505. interface IMat4Like {
  21506. m: FloatArray
  21507. }
  21508. interface IQuatLike {
  21509. x: number;
  21510. y: number;
  21511. z: number;
  21512. w: number;
  21513. }
  21514. interface IRectLike {
  21515. x: number;
  21516. y: number;
  21517. width: number;
  21518. height: number;
  21519. }
  21520. interface ISizeLike {
  21521. width: number;
  21522. height: number;
  21523. }
  21524. interface IVec2Like {
  21525. x: number;
  21526. y: number;
  21527. }
  21528. interface IVec3Like {
  21529. x: number;
  21530. y: number;
  21531. z: number;
  21532. }
  21533. interface IVec4Like {
  21534. x: number;
  21535. y: number;
  21536. z: number;
  21537. w: number;
  21538. }
  21539. declare namespace dragonBones {
  21540. /**
  21541. * @internal
  21542. * @private
  21543. */
  21544. const webAssemblyModule: {
  21545. HEAP16: Int16Array;
  21546. _malloc(byteSize: number): number;
  21547. _free(pointer: number): void;
  21548. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  21549. };
  21550. }
  21551. /**
  21552. * The MIT License (MIT)
  21553. *
  21554. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21555. *
  21556. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21557. * this software and associated documentation files (the "Software"), to deal in
  21558. * the Software without restriction, including without limitation the rights to
  21559. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21560. * the Software, and to permit persons to whom the Software is furnished to do so,
  21561. * subject to the following conditions:
  21562. *
  21563. * The above copyright notice and this permission notice shall be included in all
  21564. * copies or substantial portions of the Software.
  21565. *
  21566. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21567. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21568. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21569. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21570. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21571. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21572. */
  21573. declare namespace dragonBones {
  21574. /**
  21575. * @internal
  21576. * @private
  21577. */
  21578. const enum BinaryOffset {
  21579. WeigthBoneCount = 0,
  21580. WeigthFloatOffset = 1,
  21581. WeigthBoneIndices = 2,
  21582. MeshVertexCount = 0,
  21583. MeshTriangleCount = 1,
  21584. MeshFloatOffset = 2,
  21585. MeshWeightOffset = 3,
  21586. MeshVertexIndices = 4,
  21587. TimelineScale = 0,
  21588. TimelineOffset = 1,
  21589. TimelineKeyFrameCount = 2,
  21590. TimelineFrameValueCount = 3,
  21591. TimelineFrameValueOffset = 4,
  21592. TimelineFrameOffset = 5,
  21593. FramePosition = 0,
  21594. FrameTweenType = 1,
  21595. FrameTweenEasingOrCurveSampleCount = 2,
  21596. FrameCurveSamples = 3,
  21597. DeformMeshOffset = 0,
  21598. DeformCount = 1,
  21599. DeformValueCount = 2,
  21600. DeformValueOffset = 3,
  21601. DeformFloatOffset = 4,
  21602. }
  21603. /**
  21604. * @internal
  21605. * @private
  21606. */
  21607. const enum ArmatureType {
  21608. Armature = 0,
  21609. MovieClip = 1,
  21610. Stage = 2,
  21611. }
  21612. /**
  21613. * @internal
  21614. * @private
  21615. */
  21616. const enum BoneType {
  21617. Bone = 0,
  21618. Surface = 1,
  21619. }
  21620. /**
  21621. * @private
  21622. */
  21623. const enum DisplayType {
  21624. Image = 0,
  21625. Armature = 1,
  21626. Mesh = 2,
  21627. BoundingBox = 3,
  21628. }
  21629. /**
  21630. * - Bounding box type.
  21631. * @version DragonBones 5.0
  21632. * @language en_US
  21633. */
  21634. /**
  21635. * - 边界框类型。
  21636. * @version DragonBones 5.0
  21637. * @language zh_CN
  21638. */
  21639. const enum BoundingBoxType {
  21640. Rectangle = 0,
  21641. Ellipse = 1,
  21642. Polygon = 2,
  21643. }
  21644. /**
  21645. * @internal
  21646. * @private
  21647. */
  21648. const enum ActionType {
  21649. Play = 0,
  21650. Frame = 10,
  21651. Sound = 11,
  21652. }
  21653. /**
  21654. * @internal
  21655. * @private
  21656. */
  21657. const enum BlendMode {
  21658. Normal = 0,
  21659. Add = 1,
  21660. Alpha = 2,
  21661. Darken = 3,
  21662. Difference = 4,
  21663. Erase = 5,
  21664. HardLight = 6,
  21665. Invert = 7,
  21666. Layer = 8,
  21667. Lighten = 9,
  21668. Multiply = 10,
  21669. Overlay = 11,
  21670. Screen = 12,
  21671. Subtract = 13,
  21672. }
  21673. /**
  21674. * @internal
  21675. * @private
  21676. */
  21677. const enum TweenType {
  21678. None = 0,
  21679. Line = 1,
  21680. Curve = 2,
  21681. QuadIn = 3,
  21682. QuadOut = 4,
  21683. QuadInOut = 5,
  21684. }
  21685. /**
  21686. * @internal
  21687. * @private
  21688. */
  21689. const enum TimelineType {
  21690. Action = 0,
  21691. ZOrder = 1,
  21692. BoneAll = 10,
  21693. BoneTranslate = 11,
  21694. BoneRotate = 12,
  21695. BoneScale = 13,
  21696. Surface = 50,
  21697. SlotDisplay = 20,
  21698. SlotColor = 21,
  21699. SlotFFD = 22,
  21700. IKConstraint = 30,
  21701. AnimationTime = 40,
  21702. AnimationWeight = 41,
  21703. }
  21704. /**
  21705. * - Offset mode.
  21706. * @version DragonBones 5.5
  21707. * @language en_US
  21708. */
  21709. /**
  21710. * - 偏移模式。
  21711. * @version DragonBones 5.5
  21712. * @language zh_CN
  21713. */
  21714. const enum OffsetMode {
  21715. None = 0,
  21716. Additive = 1,
  21717. Override = 2,
  21718. }
  21719. /**
  21720. * - Animation fade out mode.
  21721. * @version DragonBones 4.5
  21722. * @language en_US
  21723. */
  21724. /**
  21725. * - 动画淡出模式。
  21726. * @version DragonBones 4.5
  21727. * @language zh_CN
  21728. */
  21729. const enum AnimationFadeOutMode {
  21730. /**
  21731. * - Do not fade out of any animation states.
  21732. * @language en_US
  21733. */
  21734. /**
  21735. * - 不淡出任何的动画状态。
  21736. * @language zh_CN
  21737. */
  21738. None = 0,
  21739. /**
  21740. * - Fade out the animation states of the same layer.
  21741. * @language en_US
  21742. */
  21743. /**
  21744. * - 淡出同层的动画状态。
  21745. * @language zh_CN
  21746. */
  21747. SameLayer = 1,
  21748. /**
  21749. * - Fade out the animation states of the same group.
  21750. * @language en_US
  21751. */
  21752. /**
  21753. * - 淡出同组的动画状态。
  21754. * @language zh_CN
  21755. */
  21756. SameGroup = 2,
  21757. /**
  21758. * - Fade out the animation states of the same layer and group.
  21759. * @language en_US
  21760. */
  21761. /**
  21762. * - 淡出同层并且同组的动画状态。
  21763. * @language zh_CN
  21764. */
  21765. SameLayerAndGroup = 3,
  21766. /**
  21767. * - Fade out of all animation states.
  21768. * @language en_US
  21769. */
  21770. /**
  21771. * - 淡出所有的动画状态。
  21772. * @language zh_CN
  21773. */
  21774. All = 4,
  21775. /**
  21776. * - Does not replace the animation state with the same name.
  21777. * @language en_US
  21778. */
  21779. /**
  21780. * - 不替换同名的动画状态。
  21781. * @language zh_CN
  21782. */
  21783. Single = 5,
  21784. }
  21785. /**
  21786. * @private
  21787. */
  21788. interface Map<T> {
  21789. [key: string]: T;
  21790. }
  21791. /**
  21792. * @private
  21793. */
  21794. class DragonBones {
  21795. static readonly VERSION: string;
  21796. static yDown: boolean;
  21797. static debug: boolean;
  21798. static debugDraw: boolean;
  21799. static webAssembly: boolean;
  21800. private readonly _clock;
  21801. private readonly _events;
  21802. private readonly _objects;
  21803. private _eventManager;
  21804. constructor(eventManager: IEventDispatcher);
  21805. advanceTime(passedTime: number): void;
  21806. bufferEvent(value: EventObject): void;
  21807. bufferObject(object: BaseObject): void;
  21808. readonly clock: WorldClock;
  21809. readonly eventManager: IEventDispatcher;
  21810. }
  21811. }
  21812. /**
  21813. * The MIT License (MIT)
  21814. *
  21815. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21816. *
  21817. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21818. * this software and associated documentation files (the "Software"), to deal in
  21819. * the Software without restriction, including without limitation the rights to
  21820. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21821. * the Software, and to permit persons to whom the Software is furnished to do so,
  21822. * subject to the following conditions:
  21823. *
  21824. * The above copyright notice and this permission notice shall be included in all
  21825. * copies or substantial portions of the Software.
  21826. *
  21827. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21828. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21829. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21830. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21831. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21832. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21833. */
  21834. declare namespace dragonBones {
  21835. /**
  21836. * - The BaseObject is the base class for all objects in the DragonBones framework.
  21837. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  21838. * @version DragonBones 4.5
  21839. * @language en_US
  21840. */
  21841. /**
  21842. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  21843. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  21844. * @version DragonBones 4.5
  21845. * @language zh_CN
  21846. */
  21847. abstract class BaseObject {
  21848. private static _hashCode;
  21849. private static _defaultMaxCount;
  21850. private static readonly _maxCountMap;
  21851. private static readonly _poolsMap;
  21852. private static _returnObject(object);
  21853. static toString(): string;
  21854. /**
  21855. * - Set the maximum cache count of the specify object pool.
  21856. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  21857. * @param maxCount - Max count.
  21858. * @version DragonBones 4.5
  21859. * @language en_US
  21860. */
  21861. /**
  21862. * - 设置特定对象池的最大缓存数量。
  21863. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  21864. * @param maxCount - 最大缓存数量。
  21865. * @version DragonBones 4.5
  21866. * @language zh_CN
  21867. */
  21868. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  21869. /**
  21870. * - Clear the cached instances of a specify object pool.
  21871. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  21872. * @version DragonBones 4.5
  21873. * @language en_US
  21874. */
  21875. /**
  21876. * - 清除特定对象池的缓存实例。
  21877. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  21878. * @version DragonBones 4.5
  21879. * @language zh_CN
  21880. */
  21881. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  21882. /**
  21883. * - Get an instance of the specify class from object pool.
  21884. * @param objectConstructor - The specify class.
  21885. * @version DragonBones 4.5
  21886. * @language en_US
  21887. */
  21888. /**
  21889. * - 从对象池中获取特定类的实例。
  21890. * @param objectConstructor - 特定的类。
  21891. * @version DragonBones 4.5
  21892. * @language zh_CN
  21893. */
  21894. static borrowObject<T extends BaseObject>(objectConstructor: {
  21895. new (): T;
  21896. }): T;
  21897. /**
  21898. * - A unique identification number assigned to the object.
  21899. * @version DragonBones 4.5
  21900. * @language en_US
  21901. */
  21902. /**
  21903. * - 分配给此实例的唯一标识号。
  21904. * @version DragonBones 4.5
  21905. * @language zh_CN
  21906. */
  21907. readonly hashCode: number;
  21908. private _isInPool;
  21909. /**
  21910. * @private
  21911. */
  21912. protected abstract _onClear(): void;
  21913. /**
  21914. * - Clear the object and return it back to object pool。
  21915. * @version DragonBones 4.5
  21916. * @language en_US
  21917. */
  21918. /**
  21919. * - 清除该实例的所有数据并将其返还对象池。
  21920. * @version DragonBones 4.5
  21921. * @language zh_CN
  21922. */
  21923. returnToPool(): void;
  21924. }
  21925. }
  21926. /**
  21927. * The MIT License (MIT)
  21928. *
  21929. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21930. *
  21931. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21932. * this software and associated documentation files (the "Software"), to deal in
  21933. * the Software without restriction, including without limitation the rights to
  21934. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21935. * the Software, and to permit persons to whom the Software is furnished to do so,
  21936. * subject to the following conditions:
  21937. *
  21938. * The above copyright notice and this permission notice shall be included in all
  21939. * copies or substantial portions of the Software.
  21940. *
  21941. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21942. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21943. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21944. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21945. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21946. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21947. */
  21948. declare namespace dragonBones {
  21949. /**
  21950. * - 2D Transform matrix.
  21951. * @version DragonBones 3.0
  21952. * @language en_US
  21953. */
  21954. /**
  21955. * - 2D 转换矩阵。
  21956. * @version DragonBones 3.0
  21957. * @language zh_CN
  21958. */
  21959. class Matrix {
  21960. /**
  21961. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  21962. * @default 1.0
  21963. * @version DragonBones 3.0
  21964. * @language en_US
  21965. */
  21966. /**
  21967. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  21968. * @default 1.0
  21969. * @version DragonBones 3.0
  21970. * @language zh_CN
  21971. */
  21972. a: number;
  21973. /**
  21974. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  21975. * @default 0.0
  21976. * @version DragonBones 3.0
  21977. * @language en_US
  21978. */
  21979. /**
  21980. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  21981. * @default 0.0
  21982. * @version DragonBones 3.0
  21983. * @language zh_CN
  21984. */
  21985. b: number;
  21986. /**
  21987. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  21988. * @default 0.0
  21989. * @version DragonBones 3.0
  21990. * @language en_US
  21991. */
  21992. /**
  21993. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  21994. * @default 0.0
  21995. * @version DragonBones 3.0
  21996. * @language zh_CN
  21997. */
  21998. c: number;
  21999. /**
  22000. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  22001. * @default 1.0
  22002. * @version DragonBones 3.0
  22003. * @language en_US
  22004. */
  22005. /**
  22006. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  22007. * @default 1.0
  22008. * @version DragonBones 3.0
  22009. * @language zh_CN
  22010. */
  22011. d: number;
  22012. /**
  22013. * - The distance by which to translate each point along the x axis.
  22014. * @default 0.0
  22015. * @version DragonBones 3.0
  22016. * @language en_US
  22017. */
  22018. /**
  22019. * - 沿 x 轴平移每个点的距离。
  22020. * @default 0.0
  22021. * @version DragonBones 3.0
  22022. * @language zh_CN
  22023. */
  22024. tx: number;
  22025. /**
  22026. * - The distance by which to translate each point along the y axis.
  22027. * @default 0.0
  22028. * @version DragonBones 3.0
  22029. * @language en_US
  22030. */
  22031. /**
  22032. * - 沿 y 轴平移每个点的距离。
  22033. * @default 0.0
  22034. * @version DragonBones 3.0
  22035. * @language zh_CN
  22036. */
  22037. ty: number;
  22038. /**
  22039. * @private
  22040. */
  22041. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  22042. toString(): string;
  22043. /**
  22044. * @private
  22045. */
  22046. copyFrom(value: Matrix): Matrix;
  22047. /**
  22048. * @private
  22049. */
  22050. copyFromArray(value: Array<number>, offset?: number): Matrix;
  22051. /**
  22052. * - Convert to unit matrix.
  22053. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  22054. * @version DragonBones 3.0
  22055. * @language en_US
  22056. */
  22057. /**
  22058. * - 转换为单位矩阵。
  22059. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  22060. * @version DragonBones 3.0
  22061. * @language zh_CN
  22062. */
  22063. identity(): Matrix;
  22064. /**
  22065. * - Multiplies the current matrix with another matrix.
  22066. * @param value - The matrix that needs to be multiplied.
  22067. * @version DragonBones 3.0
  22068. * @language en_US
  22069. */
  22070. /**
  22071. * - 将当前矩阵与另一个矩阵相乘。
  22072. * @param value - 需要相乘的矩阵。
  22073. * @version DragonBones 3.0
  22074. * @language zh_CN
  22075. */
  22076. concat(value: Matrix): Matrix;
  22077. /**
  22078. * - Convert to inverse matrix.
  22079. * @version DragonBones 3.0
  22080. * @language en_US
  22081. */
  22082. /**
  22083. * - 转换为逆矩阵。
  22084. * @version DragonBones 3.0
  22085. * @language zh_CN
  22086. */
  22087. invert(): Matrix;
  22088. /**
  22089. * - Apply a matrix transformation to a specific point.
  22090. * @param x - X coordinate.
  22091. * @param y - Y coordinate.
  22092. * @param result - The point after the transformation is applied.
  22093. * @param delta - Whether to ignore tx, ty's conversion to point.
  22094. * @version DragonBones 3.0
  22095. * @language en_US
  22096. */
  22097. /**
  22098. * - 将矩阵转换应用于特定点。
  22099. * @param x - 横坐标。
  22100. * @param y - 纵坐标。
  22101. * @param result - 应用转换之后的点。
  22102. * @param delta - 是否忽略 tx,ty 对点的转换。
  22103. * @version DragonBones 3.0
  22104. * @language zh_CN
  22105. */
  22106. transformPoint(x: number, y: number, result: {
  22107. x: number;
  22108. y: number;
  22109. }, delta?: boolean): void;
  22110. /**
  22111. * @private
  22112. */
  22113. transformRectangle(rectangle: {
  22114. x: number;
  22115. y: number;
  22116. width: number;
  22117. height: number;
  22118. }, delta?: boolean): void;
  22119. }
  22120. }
  22121. /**
  22122. * The MIT License (MIT)
  22123. *
  22124. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22125. *
  22126. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22127. * this software and associated documentation files (the "Software"), to deal in
  22128. * the Software without restriction, including without limitation the rights to
  22129. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22130. * the Software, and to permit persons to whom the Software is furnished to do so,
  22131. * subject to the following conditions:
  22132. *
  22133. * The above copyright notice and this permission notice shall be included in all
  22134. * copies or substantial portions of the Software.
  22135. *
  22136. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22137. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22138. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22139. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22140. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22141. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22142. */
  22143. declare namespace dragonBones {
  22144. /**
  22145. * - 2D Transform.
  22146. * @version DragonBones 3.0
  22147. * @language en_US
  22148. */
  22149. /**
  22150. * - 2D 变换。
  22151. * @version DragonBones 3.0
  22152. * @language zh_CN
  22153. */
  22154. class Transform {
  22155. /**
  22156. * @private
  22157. */
  22158. static readonly PI: number;
  22159. /**
  22160. * @private
  22161. */
  22162. static readonly PI_D: number;
  22163. /**
  22164. * @private
  22165. */
  22166. static readonly PI_H: number;
  22167. /**
  22168. * @private
  22169. */
  22170. static readonly PI_Q: number;
  22171. /**
  22172. * @private
  22173. */
  22174. static readonly RAD_DEG: number;
  22175. /**
  22176. * @private
  22177. */
  22178. static readonly DEG_RAD: number;
  22179. /**
  22180. * @private
  22181. */
  22182. static normalizeRadian(value: number): number;
  22183. /**
  22184. * - Horizontal translate.
  22185. * @version DragonBones 3.0
  22186. * @language en_US
  22187. */
  22188. /**
  22189. * - 水平位移。
  22190. * @version DragonBones 3.0
  22191. * @language zh_CN
  22192. */
  22193. x: number;
  22194. /**
  22195. * - Vertical translate.
  22196. * @version DragonBones 3.0
  22197. * @language en_US
  22198. */
  22199. /**
  22200. * - 垂直位移。
  22201. * @version DragonBones 3.0
  22202. * @language zh_CN
  22203. */
  22204. y: number;
  22205. /**
  22206. * - Skew. (In radians)
  22207. * @version DragonBones 3.0
  22208. * @language en_US
  22209. */
  22210. /**
  22211. * - 倾斜。 (以弧度为单位)
  22212. * @version DragonBones 3.0
  22213. * @language zh_CN
  22214. */
  22215. skew: number;
  22216. /**
  22217. * - rotation. (In radians)
  22218. * @version DragonBones 3.0
  22219. * @language en_US
  22220. */
  22221. /**
  22222. * - 旋转。 (以弧度为单位)
  22223. * @version DragonBones 3.0
  22224. * @language zh_CN
  22225. */
  22226. rotation: number;
  22227. /**
  22228. * - Horizontal Scaling.
  22229. * @version DragonBones 3.0
  22230. * @language en_US
  22231. */
  22232. /**
  22233. * - 水平缩放。
  22234. * @version DragonBones 3.0
  22235. * @language zh_CN
  22236. */
  22237. scaleX: number;
  22238. /**
  22239. * - Vertical scaling.
  22240. * @version DragonBones 3.0
  22241. * @language en_US
  22242. */
  22243. /**
  22244. * - 垂直缩放。
  22245. * @version DragonBones 3.0
  22246. * @language zh_CN
  22247. */
  22248. scaleY: number;
  22249. /**
  22250. * @private
  22251. */
  22252. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  22253. toString(): string;
  22254. /**
  22255. * @private
  22256. */
  22257. copyFrom(value: Transform): Transform;
  22258. /**
  22259. * @private
  22260. */
  22261. identity(): Transform;
  22262. /**
  22263. * @private
  22264. */
  22265. add(value: Transform): Transform;
  22266. /**
  22267. * @private
  22268. */
  22269. minus(value: Transform): Transform;
  22270. /**
  22271. * @private
  22272. */
  22273. fromMatrix(matrix: Matrix): Transform;
  22274. /**
  22275. * @private
  22276. */
  22277. toMatrix(matrix: Matrix): Transform;
  22278. }
  22279. }
  22280. /**
  22281. * The MIT License (MIT)
  22282. *
  22283. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22284. *
  22285. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22286. * this software and associated documentation files (the "Software"), to deal in
  22287. * the Software without restriction, including without limitation the rights to
  22288. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22289. * the Software, and to permit persons to whom the Software is furnished to do so,
  22290. * subject to the following conditions:
  22291. *
  22292. * The above copyright notice and this permission notice shall be included in all
  22293. * copies or substantial portions of the Software.
  22294. *
  22295. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22296. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22297. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22298. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22299. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22300. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22301. */
  22302. declare namespace dragonBones {
  22303. /**
  22304. * @internal
  22305. * @private
  22306. */
  22307. class ColorTransform {
  22308. alphaMultiplier: number;
  22309. redMultiplier: number;
  22310. greenMultiplier: number;
  22311. blueMultiplier: number;
  22312. alphaOffset: number;
  22313. redOffset: number;
  22314. greenOffset: number;
  22315. blueOffset: number;
  22316. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  22317. copyFrom(value: ColorTransform): void;
  22318. identity(): void;
  22319. }
  22320. }
  22321. /**
  22322. * The MIT License (MIT)
  22323. *
  22324. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22325. *
  22326. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22327. * this software and associated documentation files (the "Software"), to deal in
  22328. * the Software without restriction, including without limitation the rights to
  22329. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22330. * the Software, and to permit persons to whom the Software is furnished to do so,
  22331. * subject to the following conditions:
  22332. *
  22333. * The above copyright notice and this permission notice shall be included in all
  22334. * copies or substantial portions of the Software.
  22335. *
  22336. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22337. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22338. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22339. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22340. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22341. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22342. */
  22343. declare namespace dragonBones {
  22344. /**
  22345. * - The Point object represents a location in a two-dimensional coordinate system.
  22346. * @version DragonBones 3.0
  22347. * @language en_US
  22348. */
  22349. /**
  22350. * - Point 对象表示二维坐标系统中的某个位置。
  22351. * @version DragonBones 3.0
  22352. * @language zh_CN
  22353. */
  22354. class Point {
  22355. /**
  22356. * - The horizontal coordinate.
  22357. * @default 0.0
  22358. * @version DragonBones 3.0
  22359. * @language en_US
  22360. */
  22361. /**
  22362. * - 该点的水平坐标。
  22363. * @default 0.0
  22364. * @version DragonBones 3.0
  22365. * @language zh_CN
  22366. */
  22367. x: number;
  22368. /**
  22369. * - The vertical coordinate.
  22370. * @default 0.0
  22371. * @version DragonBones 3.0
  22372. * @language en_US
  22373. */
  22374. /**
  22375. * - 该点的垂直坐标。
  22376. * @default 0.0
  22377. * @version DragonBones 3.0
  22378. * @language zh_CN
  22379. */
  22380. y: number;
  22381. /**
  22382. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  22383. * @param x - The horizontal coordinate.
  22384. * @param y - The vertical coordinate.
  22385. * @version DragonBones 3.0
  22386. * @language en_US
  22387. */
  22388. /**
  22389. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  22390. * @param x - 该对象的x属性值,默认为 0.0。
  22391. * @param y - 该对象的y属性值,默认为 0.0。
  22392. * @version DragonBones 3.0
  22393. * @language zh_CN
  22394. */
  22395. constructor(x?: number, y?: number);
  22396. /**
  22397. * @private
  22398. */
  22399. copyFrom(value: Point): void;
  22400. /**
  22401. * @private
  22402. */
  22403. clear(): void;
  22404. }
  22405. }
  22406. /**
  22407. * The MIT License (MIT)
  22408. *
  22409. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22410. *
  22411. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22412. * this software and associated documentation files (the "Software"), to deal in
  22413. * the Software without restriction, including without limitation the rights to
  22414. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22415. * the Software, and to permit persons to whom the Software is furnished to do so,
  22416. * subject to the following conditions:
  22417. *
  22418. * The above copyright notice and this permission notice shall be included in all
  22419. * copies or substantial portions of the Software.
  22420. *
  22421. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22422. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22423. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22424. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22425. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22426. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22427. */
  22428. declare namespace dragonBones {
  22429. /**
  22430. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  22431. * width and its height.<br/>
  22432. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  22433. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  22434. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  22435. * if you change the bottom property, the value of the height property changes.
  22436. * @version DragonBones 3.0
  22437. * @language en_US
  22438. */
  22439. /**
  22440. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  22441. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  22442. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  22443. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  22444. * @version DragonBones 3.0
  22445. * @language zh_CN
  22446. */
  22447. class Rectangle {
  22448. /**
  22449. * - The x coordinate of the top-left corner of the rectangle.
  22450. * @default 0.0
  22451. * @version DragonBones 3.0
  22452. * @language en_US
  22453. */
  22454. /**
  22455. * - 矩形左上角的 x 坐标。
  22456. * @default 0.0
  22457. * @version DragonBones 3.0
  22458. * @language zh_CN
  22459. */
  22460. x: number;
  22461. /**
  22462. * - The y coordinate of the top-left corner of the rectangle.
  22463. * @default 0.0
  22464. * @version DragonBones 3.0
  22465. * @language en_US
  22466. */
  22467. /**
  22468. * - 矩形左上角的 y 坐标。
  22469. * @default 0.0
  22470. * @version DragonBones 3.0
  22471. * @language zh_CN
  22472. */
  22473. y: number;
  22474. /**
  22475. * - The width of the rectangle, in pixels.
  22476. * @default 0.0
  22477. * @version DragonBones 3.0
  22478. * @language en_US
  22479. */
  22480. /**
  22481. * - 矩形的宽度(以像素为单位)。
  22482. * @default 0.0
  22483. * @version DragonBones 3.0
  22484. * @language zh_CN
  22485. */
  22486. width: number;
  22487. /**
  22488. * - 矩形的高度(以像素为单位)。
  22489. * @default 0.0
  22490. * @version DragonBones 3.0
  22491. * @language en_US
  22492. */
  22493. /**
  22494. * - The height of the rectangle, in pixels.
  22495. * @default 0.0
  22496. * @version DragonBones 3.0
  22497. * @language zh_CN
  22498. */
  22499. height: number;
  22500. /**
  22501. * @private
  22502. */
  22503. constructor(x?: number, y?: number, width?: number, height?: number);
  22504. /**
  22505. * @private
  22506. */
  22507. copyFrom(value: Rectangle): void;
  22508. /**
  22509. * @private
  22510. */
  22511. clear(): void;
  22512. }
  22513. }
  22514. /**
  22515. * The MIT License (MIT)
  22516. *
  22517. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22518. *
  22519. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22520. * this software and associated documentation files (the "Software"), to deal in
  22521. * the Software without restriction, including without limitation the rights to
  22522. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22523. * the Software, and to permit persons to whom the Software is furnished to do so,
  22524. * subject to the following conditions:
  22525. *
  22526. * The above copyright notice and this permission notice shall be included in all
  22527. * copies or substantial portions of the Software.
  22528. *
  22529. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22530. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22531. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22532. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22533. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22534. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22535. */
  22536. declare namespace dragonBones {
  22537. /**
  22538. * - The user custom data.
  22539. * @version DragonBones 5.0
  22540. * @language en_US
  22541. */
  22542. /**
  22543. * - 用户自定义数据。
  22544. * @version DragonBones 5.0
  22545. * @language zh_CN
  22546. */
  22547. class UserData extends BaseObject {
  22548. static toString(): string;
  22549. /**
  22550. * - The custom int numbers.
  22551. * @version DragonBones 5.0
  22552. * @language en_US
  22553. */
  22554. /**
  22555. * - 自定义整数。
  22556. * @version DragonBones 5.0
  22557. * @language zh_CN
  22558. */
  22559. readonly ints: Array<number>;
  22560. /**
  22561. * - The custom float numbers.
  22562. * @version DragonBones 5.0
  22563. * @language en_US
  22564. */
  22565. /**
  22566. * - 自定义浮点数。
  22567. * @version DragonBones 5.0
  22568. * @language zh_CN
  22569. */
  22570. readonly floats: Array<number>;
  22571. /**
  22572. * - The custom strings.
  22573. * @version DragonBones 5.0
  22574. * @language en_US
  22575. */
  22576. /**
  22577. * - 自定义字符串。
  22578. * @version DragonBones 5.0
  22579. * @language zh_CN
  22580. */
  22581. readonly strings: Array<string>;
  22582. /**
  22583. * @inheritDoc
  22584. */
  22585. protected _onClear(): void;
  22586. /**
  22587. * @internal
  22588. * @private
  22589. */
  22590. addInt(value: number): void;
  22591. /**
  22592. * @internal
  22593. * @private
  22594. */
  22595. addFloat(value: number): void;
  22596. /**
  22597. * @internal
  22598. * @private
  22599. */
  22600. addString(value: string): void;
  22601. /**
  22602. * - Get the custom int number.
  22603. * @version DragonBones 5.0
  22604. * @language en_US
  22605. */
  22606. /**
  22607. * - 获取自定义整数。
  22608. * @version DragonBones 5.0
  22609. * @language zh_CN
  22610. */
  22611. getInt(index?: number): number;
  22612. /**
  22613. * - Get the custom float number.
  22614. * @version DragonBones 5.0
  22615. * @language en_US
  22616. */
  22617. /**
  22618. * - 获取自定义浮点数。
  22619. * @version DragonBones 5.0
  22620. * @language zh_CN
  22621. */
  22622. getFloat(index?: number): number;
  22623. /**
  22624. * - Get the custom string.
  22625. * @version DragonBones 5.0
  22626. * @language en_US
  22627. */
  22628. /**
  22629. * - 获取自定义字符串。
  22630. * @version DragonBones 5.0
  22631. * @language zh_CN
  22632. */
  22633. getString(index?: number): string;
  22634. }
  22635. /**
  22636. * @internal
  22637. * @private
  22638. */
  22639. class ActionData extends BaseObject {
  22640. static toString(): string;
  22641. type: ActionType;
  22642. name: string;
  22643. bone: BoneData | null;
  22644. slot: SlotData | null;
  22645. data: UserData | null;
  22646. protected _onClear(): void;
  22647. }
  22648. }
  22649. /**
  22650. * The MIT License (MIT)
  22651. *
  22652. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22653. *
  22654. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22655. * this software and associated documentation files (the "Software"), to deal in
  22656. * the Software without restriction, including without limitation the rights to
  22657. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22658. * the Software, and to permit persons to whom the Software is furnished to do so,
  22659. * subject to the following conditions:
  22660. *
  22661. * The above copyright notice and this permission notice shall be included in all
  22662. * copies or substantial portions of the Software.
  22663. *
  22664. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22665. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22666. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22667. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22668. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22669. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22670. */
  22671. declare namespace dragonBones {
  22672. /**
  22673. * - The DragonBones data.
  22674. * A DragonBones data contains multiple armature data.
  22675. * @see dragonBones.ArmatureData
  22676. * @version DragonBones 3.0
  22677. * @language en_US
  22678. */
  22679. /**
  22680. * - 龙骨数据。
  22681. * 一个龙骨数据包含多个骨架数据。
  22682. * @see dragonBones.ArmatureData
  22683. * @version DragonBones 3.0
  22684. * @language zh_CN
  22685. */
  22686. class DragonBonesData extends BaseObject {
  22687. static toString(): string;
  22688. /**
  22689. * @private
  22690. */
  22691. autoSearch: boolean;
  22692. /**
  22693. * - The animation frame rate.
  22694. * @version DragonBones 3.0
  22695. * @language en_US
  22696. */
  22697. /**
  22698. * - 动画帧频。
  22699. * @version DragonBones 3.0
  22700. * @language zh_CN
  22701. */
  22702. frameRate: number;
  22703. /**
  22704. * - The data version.
  22705. * @version DragonBones 3.0
  22706. * @language en_US
  22707. */
  22708. /**
  22709. * - 数据版本。
  22710. * @version DragonBones 3.0
  22711. * @language zh_CN
  22712. */
  22713. version: string;
  22714. /**
  22715. * - The DragonBones data name.
  22716. * The name is consistent with the DragonBones project name.
  22717. * @version DragonBones 3.0
  22718. * @language en_US
  22719. */
  22720. /**
  22721. * - 龙骨数据名称。
  22722. * 该名称与龙骨项目名保持一致。
  22723. * @version DragonBones 3.0
  22724. * @language zh_CN
  22725. */
  22726. name: string;
  22727. /**
  22728. * @private
  22729. */
  22730. stage: ArmatureData | null;
  22731. /**
  22732. * @internal
  22733. * @private
  22734. */
  22735. readonly frameIndices: Array<number>;
  22736. /**
  22737. * @internal
  22738. * @private
  22739. */
  22740. readonly cachedFrames: Array<number>;
  22741. /**
  22742. * - All armature data names.
  22743. * @version DragonBones 3.0
  22744. * @language en_US
  22745. */
  22746. /**
  22747. * - 所有的骨架数据名称。
  22748. * @version DragonBones 3.0
  22749. * @language zh_CN
  22750. */
  22751. readonly armatureNames: Array<string>;
  22752. /**
  22753. * @private
  22754. */
  22755. readonly armatures: Map<ArmatureData>;
  22756. /**
  22757. * @internal
  22758. * @private
  22759. */
  22760. binary: ArrayBuffer;
  22761. /**
  22762. * @internal
  22763. * @private
  22764. */
  22765. intArray: Int16Array;
  22766. /**
  22767. * @internal
  22768. * @private
  22769. */
  22770. floatArray: Float32Array;
  22771. /**
  22772. * @internal
  22773. * @private
  22774. */
  22775. frameIntArray: Int16Array;
  22776. /**
  22777. * @internal
  22778. * @private
  22779. */
  22780. frameFloatArray: Float32Array;
  22781. /**
  22782. * @internal
  22783. * @private
  22784. */
  22785. frameArray: Int16Array;
  22786. /**
  22787. * @internal
  22788. * @private
  22789. */
  22790. timelineArray: Uint16Array;
  22791. /**
  22792. * @private
  22793. */
  22794. userData: UserData | null;
  22795. /**
  22796. * @inheritDoc
  22797. */
  22798. protected _onClear(): void;
  22799. /**
  22800. * @internal
  22801. * @private
  22802. */
  22803. addArmature(value: ArmatureData): void;
  22804. /**
  22805. * - Get a specific armature data.
  22806. * @param name - The armature data name.
  22807. * @version DragonBones 3.0
  22808. * @language en_US
  22809. */
  22810. /**
  22811. * - 获取特定的骨架数据。
  22812. * @param name - 骨架数据名称。
  22813. * @version DragonBones 3.0
  22814. * @language zh_CN
  22815. */
  22816. getArmature(name: string): ArmatureData | null;
  22817. /**
  22818. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  22819. * @deprecated
  22820. * @language en_US
  22821. */
  22822. /**
  22823. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  22824. * @deprecated
  22825. * @language zh_CN
  22826. */
  22827. dispose(): void;
  22828. }
  22829. }
  22830. /**
  22831. * The MIT License (MIT)
  22832. *
  22833. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22834. *
  22835. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22836. * this software and associated documentation files (the "Software"), to deal in
  22837. * the Software without restriction, including without limitation the rights to
  22838. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22839. * the Software, and to permit persons to whom the Software is furnished to do so,
  22840. * subject to the following conditions:
  22841. *
  22842. * The above copyright notice and this permission notice shall be included in all
  22843. * copies or substantial portions of the Software.
  22844. *
  22845. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22846. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22847. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22848. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22849. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22850. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22851. */
  22852. declare namespace dragonBones {
  22853. /**
  22854. * - The armature data.
  22855. * @version DragonBones 3.0
  22856. * @language en_US
  22857. */
  22858. /**
  22859. * - 骨架数据。
  22860. * @version DragonBones 3.0
  22861. * @language zh_CN
  22862. */
  22863. class ArmatureData extends BaseObject {
  22864. static toString(): string;
  22865. /**
  22866. * @private
  22867. */
  22868. type: ArmatureType;
  22869. /**
  22870. * - The animation frame rate.
  22871. * @version DragonBones 3.0
  22872. * @language en_US
  22873. */
  22874. /**
  22875. * - 动画帧率。
  22876. * @version DragonBones 3.0
  22877. * @language zh_CN
  22878. */
  22879. frameRate: number;
  22880. /**
  22881. * @private
  22882. */
  22883. cacheFrameRate: number;
  22884. /**
  22885. * @private
  22886. */
  22887. scale: number;
  22888. /**
  22889. * - The armature name.
  22890. * @version DragonBones 3.0
  22891. * @language en_US
  22892. */
  22893. /**
  22894. * - 骨架名称。
  22895. * @version DragonBones 3.0
  22896. * @language zh_CN
  22897. */
  22898. name: string;
  22899. /**
  22900. * @private
  22901. */
  22902. readonly aabb: Rectangle;
  22903. /**
  22904. * - The names of all the animation data.
  22905. * @version DragonBones 3.0
  22906. * @language en_US
  22907. */
  22908. /**
  22909. * - 所有的动画数据名称。
  22910. * @version DragonBones 3.0
  22911. * @language zh_CN
  22912. */
  22913. readonly animationNames: Array<string>;
  22914. /**
  22915. * @private
  22916. */
  22917. readonly sortedBones: Array<BoneData>;
  22918. /**
  22919. * @private
  22920. */
  22921. readonly sortedSlots: Array<SlotData>;
  22922. /**
  22923. * @private
  22924. */
  22925. readonly defaultActions: Array<ActionData>;
  22926. /**
  22927. * @private
  22928. */
  22929. readonly actions: Array<ActionData>;
  22930. /**
  22931. * @private
  22932. */
  22933. readonly bones: Map<BoneData>;
  22934. /**
  22935. * @private
  22936. */
  22937. readonly slots: Map<SlotData>;
  22938. /**
  22939. * @private
  22940. */
  22941. readonly constraints: Map<ConstraintData>;
  22942. /**
  22943. * @private
  22944. */
  22945. readonly skins: Map<SkinData>;
  22946. /**
  22947. * @private
  22948. */
  22949. readonly animations: Map<AnimationData>;
  22950. /**
  22951. * - The default skin data.
  22952. * @version DragonBones 4.5
  22953. * @language en_US
  22954. */
  22955. /**
  22956. * - 默认插槽数据。
  22957. * @version DragonBones 4.5
  22958. * @language zh_CN
  22959. */
  22960. defaultSkin: SkinData | null;
  22961. /**
  22962. * - The default animation data.
  22963. * @version DragonBones 4.5
  22964. * @language en_US
  22965. */
  22966. /**
  22967. * - 默认动画数据。
  22968. * @version DragonBones 4.5
  22969. * @language zh_CN
  22970. */
  22971. defaultAnimation: AnimationData | null;
  22972. /**
  22973. * @private
  22974. */
  22975. canvas: CanvasData | null;
  22976. /**
  22977. * @private
  22978. */
  22979. userData: UserData | null;
  22980. /**
  22981. * @private
  22982. */
  22983. parent: DragonBonesData;
  22984. /**
  22985. * @inheritDoc
  22986. */
  22987. protected _onClear(): void;
  22988. /**
  22989. * @internal
  22990. * @private
  22991. */
  22992. sortBones(): void;
  22993. /**
  22994. * @internal
  22995. * @private
  22996. */
  22997. cacheFrames(frameRate: number): void;
  22998. /**
  22999. * @internal
  23000. * @private
  23001. */
  23002. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  23003. /**
  23004. * @internal
  23005. * @private
  23006. */
  23007. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  23008. /**
  23009. * @internal
  23010. * @private
  23011. */
  23012. addBone(value: BoneData): void;
  23013. /**
  23014. * @internal
  23015. * @private
  23016. */
  23017. addSlot(value: SlotData): void;
  23018. /**
  23019. * @internal
  23020. * @private
  23021. */
  23022. addConstraint(value: ConstraintData): void;
  23023. /**
  23024. * @internal
  23025. * @private
  23026. */
  23027. addSkin(value: SkinData): void;
  23028. /**
  23029. * @internal
  23030. * @private
  23031. */
  23032. addAnimation(value: AnimationData): void;
  23033. /**
  23034. * @internal
  23035. * @private
  23036. */
  23037. addAction(value: ActionData, isDefault: boolean): void;
  23038. /**
  23039. * - Get a specific done data.
  23040. * @param name - The bone name.
  23041. * @version DragonBones 3.0
  23042. * @language en_US
  23043. */
  23044. /**
  23045. * - 获取特定的骨骼数据。
  23046. * @param name - 骨骼名称。
  23047. * @version DragonBones 3.0
  23048. * @language zh_CN
  23049. */
  23050. getBone(name: string): BoneData | null;
  23051. /**
  23052. * - Get a specific slot data.
  23053. * @param name - The slot name.
  23054. * @version DragonBones 3.0
  23055. * @language en_US
  23056. */
  23057. /**
  23058. * - 获取特定的插槽数据。
  23059. * @param name - 插槽名称。
  23060. * @version DragonBones 3.0
  23061. * @language zh_CN
  23062. */
  23063. getSlot(name: string): SlotData | null;
  23064. /**
  23065. * @private
  23066. */
  23067. getConstraint(name: string): ConstraintData | null;
  23068. /**
  23069. * - Get a specific skin data.
  23070. * @param name - The skin name.
  23071. * @version DragonBones 3.0
  23072. * @language en_US
  23073. */
  23074. /**
  23075. * - 获取特定皮肤数据。
  23076. * @param name - 皮肤名称。
  23077. * @version DragonBones 3.0
  23078. * @language zh_CN
  23079. */
  23080. getSkin(name: string): SkinData | null;
  23081. /**
  23082. * @internal
  23083. * @private
  23084. */
  23085. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  23086. /**
  23087. * - Get a specific animation data.
  23088. * @param name - The animation name.
  23089. * @version DragonBones 3.0
  23090. * @language en_US
  23091. */
  23092. /**
  23093. * - 获取特定的动画数据。
  23094. * @param name - 动画名称。
  23095. * @version DragonBones 3.0
  23096. * @language zh_CN
  23097. */
  23098. getAnimation(name: string): AnimationData | null;
  23099. }
  23100. /**
  23101. * - The bone data.
  23102. * @version DragonBones 3.0
  23103. * @language en_US
  23104. */
  23105. /**
  23106. * - 骨骼数据。
  23107. * @version DragonBones 3.0
  23108. * @language zh_CN
  23109. */
  23110. class BoneData extends BaseObject {
  23111. static toString(): string;
  23112. /**
  23113. * @private
  23114. */
  23115. inheritTranslation: boolean;
  23116. /**
  23117. * @private
  23118. */
  23119. inheritRotation: boolean;
  23120. /**
  23121. * @private
  23122. */
  23123. inheritScale: boolean;
  23124. /**
  23125. * @private
  23126. */
  23127. inheritReflection: boolean;
  23128. /**
  23129. * @private
  23130. */
  23131. type: BoneType;
  23132. /**
  23133. * - The bone length.
  23134. * @version DragonBones 3.0
  23135. * @language en_US
  23136. */
  23137. /**
  23138. * - 骨骼长度。
  23139. * @version DragonBones 3.0
  23140. * @language zh_CN
  23141. */
  23142. length: number;
  23143. /**
  23144. * - The bone name.
  23145. * @version DragonBones 3.0
  23146. * @language en_US
  23147. */
  23148. /**
  23149. * - 骨骼名称。
  23150. * @version DragonBones 3.0
  23151. * @language zh_CN
  23152. */
  23153. name: string;
  23154. /**
  23155. * @private
  23156. */
  23157. readonly transform: Transform;
  23158. /**
  23159. * @private
  23160. */
  23161. userData: UserData | null;
  23162. /**
  23163. * - The parent bone data.
  23164. * @version DragonBones 3.0
  23165. * @language en_US
  23166. */
  23167. /**
  23168. * - 父骨骼数据。
  23169. * @version DragonBones 3.0
  23170. * @language zh_CN
  23171. */
  23172. parent: BoneData | null;
  23173. /**
  23174. * @inheritDoc
  23175. */
  23176. protected _onClear(): void;
  23177. }
  23178. /**
  23179. * @internal
  23180. * @private
  23181. */
  23182. class SurfaceData extends BoneData {
  23183. static toString(): string;
  23184. segmentX: number;
  23185. segmentY: number;
  23186. readonly vertices: Array<number>;
  23187. /**
  23188. * @inheritDoc
  23189. */
  23190. protected _onClear(): void;
  23191. }
  23192. /**
  23193. * - The slot data.
  23194. * @version DragonBones 3.0
  23195. * @language en_US
  23196. */
  23197. /**
  23198. * - 插槽数据。
  23199. * @version DragonBones 3.0
  23200. * @language zh_CN
  23201. */
  23202. class SlotData extends BaseObject {
  23203. /**
  23204. * @internal
  23205. * @private
  23206. */
  23207. static readonly DEFAULT_COLOR: ColorTransform;
  23208. /**
  23209. * @internal
  23210. * @private
  23211. */
  23212. static createColor(): ColorTransform;
  23213. static toString(): string;
  23214. /**
  23215. * @private
  23216. */
  23217. blendMode: BlendMode;
  23218. /**
  23219. * @private
  23220. */
  23221. displayIndex: number;
  23222. /**
  23223. * @private
  23224. */
  23225. zOrder: number;
  23226. /**
  23227. * - The slot name.
  23228. * @version DragonBones 3.0
  23229. * @language en_US
  23230. */
  23231. /**
  23232. * - 插槽名称。
  23233. * @version DragonBones 3.0
  23234. * @language zh_CN
  23235. */
  23236. name: string;
  23237. /**
  23238. * @private
  23239. */
  23240. color: ColorTransform;
  23241. /**
  23242. * @private
  23243. */
  23244. userData: UserData | null;
  23245. /**
  23246. * - The parent bone data.
  23247. * @version DragonBones 3.0
  23248. * @language en_US
  23249. */
  23250. /**
  23251. * - 父骨骼数据。
  23252. * @version DragonBones 3.0
  23253. * @language zh_CN
  23254. */
  23255. parent: BoneData;
  23256. /**
  23257. * @inheritDoc
  23258. */
  23259. protected _onClear(): void;
  23260. }
  23261. }
  23262. /**
  23263. * The MIT License (MIT)
  23264. *
  23265. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23266. *
  23267. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23268. * this software and associated documentation files (the "Software"), to deal in
  23269. * the Software without restriction, including without limitation the rights to
  23270. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23271. * the Software, and to permit persons to whom the Software is furnished to do so,
  23272. * subject to the following conditions:
  23273. *
  23274. * The above copyright notice and this permission notice shall be included in all
  23275. * copies or substantial portions of the Software.
  23276. *
  23277. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23278. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23279. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23280. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23281. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23282. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23283. */
  23284. declare namespace dragonBones {
  23285. /**
  23286. * @internal
  23287. * @private
  23288. */
  23289. abstract class ConstraintData extends BaseObject {
  23290. order: number;
  23291. name: string;
  23292. target: BoneData;
  23293. root: BoneData;
  23294. bone: BoneData | null;
  23295. protected _onClear(): void;
  23296. }
  23297. /**
  23298. * @internal
  23299. * @private
  23300. */
  23301. class IKConstraintData extends ConstraintData {
  23302. static toString(): string;
  23303. scaleEnabled: boolean;
  23304. bendPositive: boolean;
  23305. weight: number;
  23306. protected _onClear(): void;
  23307. }
  23308. }
  23309. /**
  23310. * The MIT License (MIT)
  23311. *
  23312. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23313. *
  23314. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23315. * this software and associated documentation files (the "Software"), to deal in
  23316. * the Software without restriction, including without limitation the rights to
  23317. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23318. * the Software, and to permit persons to whom the Software is furnished to do so,
  23319. * subject to the following conditions:
  23320. *
  23321. * The above copyright notice and this permission notice shall be included in all
  23322. * copies or substantial portions of the Software.
  23323. *
  23324. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23325. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23326. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23327. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23328. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23329. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23330. */
  23331. declare namespace dragonBones {
  23332. /**
  23333. * @internal
  23334. * @private
  23335. */
  23336. class CanvasData extends BaseObject {
  23337. static toString(): string;
  23338. hasBackground: boolean;
  23339. color: number;
  23340. x: number;
  23341. y: number;
  23342. width: number;
  23343. height: number;
  23344. protected _onClear(): void;
  23345. }
  23346. }
  23347. /**
  23348. * The MIT License (MIT)
  23349. *
  23350. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23351. *
  23352. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23353. * this software and associated documentation files (the "Software"), to deal in
  23354. * the Software without restriction, including without limitation the rights to
  23355. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23356. * the Software, and to permit persons to whom the Software is furnished to do so,
  23357. * subject to the following conditions:
  23358. *
  23359. * The above copyright notice and this permission notice shall be included in all
  23360. * copies or substantial portions of the Software.
  23361. *
  23362. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23363. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23364. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23365. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23366. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23367. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23368. */
  23369. declare namespace dragonBones {
  23370. /**
  23371. * - The skin data, typically a armature data instance contains at least one skinData.
  23372. * @version DragonBones 3.0
  23373. * @language en_US
  23374. */
  23375. /**
  23376. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  23377. * @version DragonBones 3.0
  23378. * @language zh_CN
  23379. */
  23380. class SkinData extends BaseObject {
  23381. static toString(): string;
  23382. /**
  23383. * - The skin name.
  23384. * @version DragonBones 3.0
  23385. * @language en_US
  23386. */
  23387. /**
  23388. * - 皮肤名称。
  23389. * @version DragonBones 3.0
  23390. * @language zh_CN
  23391. */
  23392. name: string;
  23393. /**
  23394. * @private
  23395. */
  23396. readonly displays: Map<Array<DisplayData | null>>;
  23397. /**
  23398. * @private
  23399. */
  23400. parent: ArmatureData;
  23401. /**
  23402. * @inheritDoc
  23403. */
  23404. protected _onClear(): void;
  23405. /**
  23406. * @internal
  23407. * @private
  23408. */
  23409. addDisplay(slotName: string, value: DisplayData | null): void;
  23410. /**
  23411. * @private
  23412. */
  23413. getDisplay(slotName: string, displayName: string): DisplayData | null;
  23414. /**
  23415. * @private
  23416. */
  23417. getDisplays(slotName: string): Array<DisplayData | null> | null;
  23418. }
  23419. }
  23420. /**
  23421. * The MIT License (MIT)
  23422. *
  23423. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23424. *
  23425. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23426. * this software and associated documentation files (the "Software"), to deal in
  23427. * the Software without restriction, including without limitation the rights to
  23428. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23429. * the Software, and to permit persons to whom the Software is furnished to do so,
  23430. * subject to the following conditions:
  23431. *
  23432. * The above copyright notice and this permission notice shall be included in all
  23433. * copies or substantial portions of the Software.
  23434. *
  23435. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23436. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23437. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23438. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23439. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23440. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23441. */
  23442. declare namespace dragonBones {
  23443. /**
  23444. * @internal
  23445. * @private
  23446. */
  23447. abstract class DisplayData extends BaseObject {
  23448. type: DisplayType;
  23449. name: string;
  23450. path: string;
  23451. parent: SkinData;
  23452. readonly transform: Transform;
  23453. protected _onClear(): void;
  23454. }
  23455. /**
  23456. * @internal
  23457. * @private
  23458. */
  23459. class ImageDisplayData extends DisplayData {
  23460. static toString(): string;
  23461. readonly pivot: Point;
  23462. texture: TextureData | null;
  23463. protected _onClear(): void;
  23464. }
  23465. /**
  23466. * @internal
  23467. * @private
  23468. */
  23469. class ArmatureDisplayData extends DisplayData {
  23470. static toString(): string;
  23471. inheritAnimation: boolean;
  23472. readonly actions: Array<ActionData>;
  23473. armature: ArmatureData | null;
  23474. protected _onClear(): void;
  23475. /**
  23476. * @private
  23477. */
  23478. addAction(value: ActionData): void;
  23479. }
  23480. /**
  23481. * @internal
  23482. * @private
  23483. */
  23484. class MeshDisplayData extends DisplayData {
  23485. static toString(): string;
  23486. inheritDeform: boolean;
  23487. offset: number;
  23488. weight: WeightData | null;
  23489. glue: GlueData | null;
  23490. texture: TextureData | null;
  23491. protected _onClear(): void;
  23492. }
  23493. /**
  23494. * @internal
  23495. * @private
  23496. */
  23497. class BoundingBoxDisplayData extends DisplayData {
  23498. static toString(): string;
  23499. boundingBox: BoundingBoxData | null;
  23500. protected _onClear(): void;
  23501. }
  23502. /**
  23503. * @internal
  23504. * @private
  23505. */
  23506. class WeightData extends BaseObject {
  23507. static toString(): string;
  23508. count: number;
  23509. offset: number;
  23510. readonly bones: Array<BoneData>;
  23511. protected _onClear(): void;
  23512. addBone(value: BoneData): void;
  23513. }
  23514. /**
  23515. * @internal
  23516. * @private
  23517. */
  23518. class GlueData extends BaseObject {
  23519. static toString(): string;
  23520. readonly weights: Array<number>;
  23521. readonly meshes: Array<MeshDisplayData | null>;
  23522. protected _onClear(): void;
  23523. addMesh(value: MeshDisplayData | null): void;
  23524. }
  23525. }
  23526. /**
  23527. * The MIT License (MIT)
  23528. *
  23529. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23530. *
  23531. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23532. * this software and associated documentation files (the "Software"), to deal in
  23533. * the Software without restriction, including without limitation the rights to
  23534. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23535. * the Software, and to permit persons to whom the Software is furnished to do so,
  23536. * subject to the following conditions:
  23537. *
  23538. * The above copyright notice and this permission notice shall be included in all
  23539. * copies or substantial portions of the Software.
  23540. *
  23541. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23542. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23543. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23544. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23545. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23546. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23547. */
  23548. declare namespace dragonBones {
  23549. /**
  23550. * - The base class of bounding box data.
  23551. * @see dragonBones.RectangleData
  23552. * @see dragonBones.EllipseData
  23553. * @see dragonBones.PolygonData
  23554. * @version DragonBones 5.0
  23555. * @language en_US
  23556. */
  23557. /**
  23558. * - 边界框数据基类。
  23559. * @see dragonBones.RectangleData
  23560. * @see dragonBones.EllipseData
  23561. * @see dragonBones.PolygonData
  23562. * @version DragonBones 5.0
  23563. * @language zh_CN
  23564. */
  23565. abstract class BoundingBoxData extends BaseObject {
  23566. /**
  23567. * - The bounding box type.
  23568. * @version DragonBones 5.0
  23569. * @language en_US
  23570. */
  23571. /**
  23572. * - 边界框类型。
  23573. * @version DragonBones 5.0
  23574. * @language zh_CN
  23575. */
  23576. type: BoundingBoxType;
  23577. /**
  23578. * @private
  23579. */
  23580. color: number;
  23581. /**
  23582. * @private
  23583. */
  23584. width: number;
  23585. /**
  23586. * @private
  23587. */
  23588. height: number;
  23589. /**
  23590. * @private
  23591. */
  23592. protected _onClear(): void;
  23593. /**
  23594. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  23595. * @version DragonBones 5.0
  23596. * @language en_US
  23597. */
  23598. /**
  23599. * - 检查边界框是否包含特定点。(本地坐标系)
  23600. * @version DragonBones 5.0
  23601. * @language zh_CN
  23602. */
  23603. abstract containsPoint(pX: number, pY: number): boolean;
  23604. /**
  23605. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  23606. * @version DragonBones 5.0
  23607. * @language en_US
  23608. */
  23609. /**
  23610. * - 检查边界框是否与特定线段相交。(本地坐标系)
  23611. * @version DragonBones 5.0
  23612. * @language zh_CN
  23613. */
  23614. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  23615. x: number;
  23616. y: number;
  23617. } | null, intersectionPointB: {
  23618. x: number;
  23619. y: number;
  23620. } | null, normalRadians: {
  23621. x: number;
  23622. y: number;
  23623. } | null): number;
  23624. }
  23625. /**
  23626. * - The rectangle bounding box data.
  23627. * @version DragonBones 5.1
  23628. * @language en_US
  23629. */
  23630. /**
  23631. * - 矩形边界框数据。
  23632. * @version DragonBones 5.1
  23633. * @language zh_CN
  23634. */
  23635. class RectangleBoundingBoxData extends BoundingBoxData {
  23636. static toString(): string;
  23637. /**
  23638. * - Compute the bit code for a point (x, y) using the clip rectangle
  23639. */
  23640. private static _computeOutCode(x, y, xMin, yMin, xMax, yMax);
  23641. /**
  23642. * @private
  23643. */
  23644. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  23645. x: number;
  23646. y: number;
  23647. } | null, intersectionPointB?: {
  23648. x: number;
  23649. y: number;
  23650. } | null, normalRadians?: {
  23651. x: number;
  23652. y: number;
  23653. } | null): number;
  23654. /**
  23655. * @inheritDoc
  23656. * @private
  23657. */
  23658. protected _onClear(): void;
  23659. /**
  23660. * @inheritDoc
  23661. */
  23662. containsPoint(pX: number, pY: number): boolean;
  23663. /**
  23664. * @inheritDoc
  23665. */
  23666. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23667. x: number;
  23668. y: number;
  23669. } | null, intersectionPointB?: {
  23670. x: number;
  23671. y: number;
  23672. } | null, normalRadians?: {
  23673. x: number;
  23674. y: number;
  23675. } | null): number;
  23676. }
  23677. /**
  23678. * - The ellipse bounding box data.
  23679. * @version DragonBones 5.1
  23680. * @language en_US
  23681. */
  23682. /**
  23683. * - 椭圆边界框数据。
  23684. * @version DragonBones 5.1
  23685. * @language zh_CN
  23686. */
  23687. class EllipseBoundingBoxData extends BoundingBoxData {
  23688. static toString(): string;
  23689. /**
  23690. * @private
  23691. */
  23692. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  23693. x: number;
  23694. y: number;
  23695. } | null, intersectionPointB?: {
  23696. x: number;
  23697. y: number;
  23698. } | null, normalRadians?: {
  23699. x: number;
  23700. y: number;
  23701. } | null): number;
  23702. /**
  23703. * @inheritDoc
  23704. * @private
  23705. */
  23706. protected _onClear(): void;
  23707. /**
  23708. * @inheritDoc
  23709. */
  23710. containsPoint(pX: number, pY: number): boolean;
  23711. /**
  23712. * @inheritDoc
  23713. */
  23714. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23715. x: number;
  23716. y: number;
  23717. } | null, intersectionPointB?: {
  23718. x: number;
  23719. y: number;
  23720. } | null, normalRadians?: {
  23721. x: number;
  23722. y: number;
  23723. } | null): number;
  23724. }
  23725. /**
  23726. * - The polygon bounding box data.
  23727. * @version DragonBones 5.1
  23728. * @language en_US
  23729. */
  23730. /**
  23731. * - 多边形边界框数据。
  23732. * @version DragonBones 5.1
  23733. * @language zh_CN
  23734. */
  23735. class PolygonBoundingBoxData extends BoundingBoxData {
  23736. static toString(): string;
  23737. /**
  23738. * @private
  23739. */
  23740. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  23741. x: number;
  23742. y: number;
  23743. } | null, intersectionPointB?: {
  23744. x: number;
  23745. y: number;
  23746. } | null, normalRadians?: {
  23747. x: number;
  23748. y: number;
  23749. } | null): number;
  23750. /**
  23751. * @private
  23752. */
  23753. x: number;
  23754. /**
  23755. * @private
  23756. */
  23757. y: number;
  23758. /**
  23759. * - The polygon vertices.
  23760. * @version DragonBones 5.1
  23761. * @language en_US
  23762. */
  23763. /**
  23764. * - 多边形顶点。
  23765. * @version DragonBones 5.1
  23766. * @language zh_CN
  23767. */
  23768. readonly vertices: Array<number>;
  23769. /**
  23770. * @private
  23771. */
  23772. weight: WeightData | null;
  23773. /**
  23774. * @inheritDoc
  23775. * @private
  23776. */
  23777. protected _onClear(): void;
  23778. /**
  23779. * @inheritDoc
  23780. */
  23781. containsPoint(pX: number, pY: number): boolean;
  23782. /**
  23783. * @inheritDoc
  23784. */
  23785. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23786. x: number;
  23787. y: number;
  23788. } | null, intersectionPointB?: {
  23789. x: number;
  23790. y: number;
  23791. } | null, normalRadians?: {
  23792. x: number;
  23793. y: number;
  23794. } | null): number;
  23795. }
  23796. }
  23797. /**
  23798. * The MIT License (MIT)
  23799. *
  23800. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23801. *
  23802. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23803. * this software and associated documentation files (the "Software"), to deal in
  23804. * the Software without restriction, including without limitation the rights to
  23805. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23806. * the Software, and to permit persons to whom the Software is furnished to do so,
  23807. * subject to the following conditions:
  23808. *
  23809. * The above copyright notice and this permission notice shall be included in all
  23810. * copies or substantial portions of the Software.
  23811. *
  23812. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23813. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23814. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23815. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23816. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23817. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23818. */
  23819. declare namespace dragonBones {
  23820. /**
  23821. * - The animation data.
  23822. * @version DragonBones 3.0
  23823. * @language en_US
  23824. */
  23825. /**
  23826. * - 动画数据。
  23827. * @version DragonBones 3.0
  23828. * @language zh_CN
  23829. */
  23830. class AnimationData extends BaseObject {
  23831. static toString(): string;
  23832. /**
  23833. * - FrameIntArray.
  23834. * @internal
  23835. * @private
  23836. */
  23837. frameIntOffset: number;
  23838. /**
  23839. * - FrameFloatArray.
  23840. * @internal
  23841. * @private
  23842. */
  23843. frameFloatOffset: number;
  23844. /**
  23845. * - FrameArray.
  23846. * @internal
  23847. * @private
  23848. */
  23849. frameOffset: number;
  23850. /**
  23851. * - The frame count of the animation.
  23852. * @version DragonBones 3.0
  23853. * @language en_US
  23854. */
  23855. /**
  23856. * - 动画的帧数。
  23857. * @version DragonBones 3.0
  23858. * @language zh_CN
  23859. */
  23860. frameCount: number;
  23861. /**
  23862. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  23863. * @version DragonBones 3.0
  23864. * @language en_US
  23865. */
  23866. /**
  23867. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  23868. * @version DragonBones 3.0
  23869. * @language zh_CN
  23870. */
  23871. playTimes: number;
  23872. /**
  23873. * - The duration of the animation. (In seconds)
  23874. * @version DragonBones 3.0
  23875. * @language en_US
  23876. */
  23877. /**
  23878. * - 动画的持续时间。 (以秒为单位)
  23879. * @version DragonBones 3.0
  23880. * @language zh_CN
  23881. */
  23882. duration: number;
  23883. /**
  23884. * @private
  23885. */
  23886. scale: number;
  23887. /**
  23888. * - The fade in time of the animation. (In seconds)
  23889. * @version DragonBones 3.0
  23890. * @language en_US
  23891. */
  23892. /**
  23893. * - 动画的淡入时间。 (以秒为单位)
  23894. * @version DragonBones 3.0
  23895. * @language zh_CN
  23896. */
  23897. fadeInTime: number;
  23898. /**
  23899. * @private
  23900. */
  23901. cacheFrameRate: number;
  23902. /**
  23903. * - The animation name.
  23904. * @version DragonBones 3.0
  23905. * @language en_US
  23906. */
  23907. /**
  23908. * - 动画名称。
  23909. * @version DragonBones 3.0
  23910. * @language zh_CN
  23911. */
  23912. name: string;
  23913. /**
  23914. * @private
  23915. */
  23916. readonly cachedFrames: Array<boolean>;
  23917. /**
  23918. * @private
  23919. */
  23920. readonly boneTimelines: Map<Array<TimelineData>>;
  23921. /**
  23922. * @private
  23923. */
  23924. readonly surfaceTimelines: Map<Array<TimelineData>>;
  23925. /**
  23926. * @private
  23927. */
  23928. readonly slotTimelines: Map<Array<TimelineData>>;
  23929. /**
  23930. * @private
  23931. */
  23932. readonly constraintTimelines: Map<Array<TimelineData>>;
  23933. /**
  23934. * @private
  23935. */
  23936. readonly animationTimelines: Map<Array<TimelineData>>;
  23937. /**
  23938. * @private
  23939. */
  23940. readonly boneCachedFrameIndices: Map<Array<number>>;
  23941. /**
  23942. * @private
  23943. */
  23944. readonly slotCachedFrameIndices: Map<Array<number>>;
  23945. /**
  23946. * @private
  23947. */
  23948. actionTimeline: TimelineData | null;
  23949. /**
  23950. * @private
  23951. */
  23952. zOrderTimeline: TimelineData | null;
  23953. /**
  23954. * @private
  23955. */
  23956. parent: ArmatureData;
  23957. /**
  23958. * @inheritDoc
  23959. */
  23960. protected _onClear(): void;
  23961. /**
  23962. * @internal
  23963. * @private
  23964. */
  23965. cacheFrames(frameRate: number): void;
  23966. /**
  23967. * @private
  23968. */
  23969. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  23970. /**
  23971. * @private
  23972. */
  23973. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  23974. /**
  23975. * @private
  23976. */
  23977. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  23978. /**
  23979. * @private
  23980. */
  23981. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  23982. /**
  23983. * @private
  23984. */
  23985. addAnimationTimeline(name: string, timeline: TimelineData): void;
  23986. /**
  23987. * @private
  23988. */
  23989. getBoneTimelines(name: string): Array<TimelineData> | null;
  23990. /**
  23991. * @private
  23992. */
  23993. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  23994. /**
  23995. * @private
  23996. */
  23997. getSlotTimelines(name: string): Array<TimelineData> | null;
  23998. /**
  23999. * @private
  24000. */
  24001. getConstraintTimelines(name: string): Array<TimelineData> | null;
  24002. /**
  24003. * @private
  24004. */
  24005. getAnimationTimelines(name: string): Array<TimelineData> | null;
  24006. /**
  24007. * @private
  24008. */
  24009. getBoneCachedFrameIndices(name: string): Array<number> | null;
  24010. /**
  24011. * @private
  24012. */
  24013. getSlotCachedFrameIndices(name: string): Array<number> | null;
  24014. }
  24015. /**
  24016. * @internal
  24017. * @private
  24018. */
  24019. class TimelineData extends BaseObject {
  24020. static toString(): string;
  24021. type: TimelineType;
  24022. offset: number;
  24023. frameIndicesOffset: number;
  24024. protected _onClear(): void;
  24025. }
  24026. }
  24027. /**
  24028. * The MIT License (MIT)
  24029. *
  24030. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24031. *
  24032. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24033. * this software and associated documentation files (the "Software"), to deal in
  24034. * the Software without restriction, including without limitation the rights to
  24035. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24036. * the Software, and to permit persons to whom the Software is furnished to do so,
  24037. * subject to the following conditions:
  24038. *
  24039. * The above copyright notice and this permission notice shall be included in all
  24040. * copies or substantial portions of the Software.
  24041. *
  24042. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24043. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24044. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24045. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24046. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24047. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24048. */
  24049. declare namespace dragonBones {
  24050. /**
  24051. * - The animation config is used to describe all the information needed to play an animation state.
  24052. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  24053. * @see dragonBones.AnimationState
  24054. * @beta
  24055. * @version DragonBones 5.0
  24056. * @language en_US
  24057. */
  24058. /**
  24059. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  24060. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  24061. * @see dragonBones.AnimationState
  24062. * @beta
  24063. * @version DragonBones 5.0
  24064. * @language zh_CN
  24065. */
  24066. class AnimationConfig extends BaseObject {
  24067. static toString(): string;
  24068. /**
  24069. * @private
  24070. */
  24071. pauseFadeOut: boolean;
  24072. /**
  24073. * - Fade out the pattern of other animation states when the animation state is fade in.
  24074. * This property is typically used to specify the substitution of multiple animation states blend.
  24075. * @default dragonBones.AnimationFadeOutMode.All
  24076. * @version DragonBones 5.0
  24077. * @language en_US
  24078. */
  24079. /**
  24080. * - 淡入动画状态时淡出其他动画状态的模式。
  24081. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24082. * @default dragonBones.AnimationFadeOutMode.All
  24083. * @version DragonBones 5.0
  24084. * @language zh_CN
  24085. */
  24086. fadeOutMode: AnimationFadeOutMode;
  24087. /**
  24088. * @private
  24089. */
  24090. fadeOutTweenType: TweenType;
  24091. /**
  24092. * @private
  24093. */
  24094. fadeOutTime: number;
  24095. /**
  24096. * @private
  24097. */
  24098. pauseFadeIn: boolean;
  24099. /**
  24100. * @private
  24101. */
  24102. actionEnabled: boolean;
  24103. /**
  24104. * @private
  24105. */
  24106. additiveBlending: boolean;
  24107. /**
  24108. * - Whether the animation state has control over the display property of the slots.
  24109. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  24110. * especially if other animation state are controlling the display properties of the slots.
  24111. * @default true
  24112. * @version DragonBones 5.0
  24113. * @language en_US
  24114. */
  24115. /**
  24116. * - 动画状态是否对插槽的显示对象属性有控制权。
  24117. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  24118. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  24119. * @default true
  24120. * @version DragonBones 5.0
  24121. * @language zh_CN
  24122. */
  24123. displayControl: boolean;
  24124. /**
  24125. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  24126. * This property should usually be set to false when blend multiple animation states.
  24127. * @default true
  24128. * @version DragonBones 5.1
  24129. * @language en_US
  24130. */
  24131. /**
  24132. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  24133. * 通常在混合多个动画状态时应该将该属性设置为 false。
  24134. * @default true
  24135. * @version DragonBones 5.1
  24136. * @language zh_CN
  24137. */
  24138. resetToPose: boolean;
  24139. /**
  24140. * @private
  24141. */
  24142. fadeInTweenType: TweenType;
  24143. /**
  24144. * - The play times. [0: Loop play, [1~N]: Play N times]
  24145. * @version DragonBones 3.0
  24146. * @language en_US
  24147. */
  24148. /**
  24149. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  24150. * @version DragonBones 3.0
  24151. * @language zh_CN
  24152. */
  24153. playTimes: number;
  24154. /**
  24155. * - The blend layer.
  24156. * High layer animation state will get the blend weight first.
  24157. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  24158. * @readonly
  24159. * @version DragonBones 5.0
  24160. * @language en_US
  24161. */
  24162. /**
  24163. * - 混合图层。
  24164. * 图层高的动画状态会优先获取混合权重。
  24165. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  24166. * @readonly
  24167. * @version DragonBones 5.0
  24168. * @language zh_CN
  24169. */
  24170. layer: number;
  24171. /**
  24172. * - The start time of play. (In seconds)
  24173. * @default 0.0
  24174. * @version DragonBones 5.0
  24175. * @language en_US
  24176. */
  24177. /**
  24178. * - 播放的开始时间。 (以秒为单位)
  24179. * @default 0.0
  24180. * @version DragonBones 5.0
  24181. * @language zh_CN
  24182. */
  24183. position: number;
  24184. /**
  24185. * - The duration of play.
  24186. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  24187. * @default -1.0
  24188. * @version DragonBones 5.0
  24189. * @language en_US
  24190. */
  24191. /**
  24192. * - 播放的持续时间。
  24193. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  24194. * @default -1.0
  24195. * @version DragonBones 5.0
  24196. * @language zh_CN
  24197. */
  24198. duration: number;
  24199. /**
  24200. * - The play speed.
  24201. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  24202. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  24203. * @default 1.0
  24204. * @version DragonBones 3.0
  24205. * @language en_US
  24206. */
  24207. /**
  24208. * - 播放速度。
  24209. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  24210. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  24211. * @default 1.0
  24212. * @version DragonBones 3.0
  24213. * @language zh_CN
  24214. */
  24215. timeScale: number;
  24216. /**
  24217. * - The blend weight.
  24218. * @default 1.0
  24219. * @version DragonBones 5.0
  24220. * @language en_US
  24221. */
  24222. /**
  24223. * - 混合权重。
  24224. * @default 1.0
  24225. * @version DragonBones 5.0
  24226. * @language zh_CN
  24227. */
  24228. weight: number;
  24229. /**
  24230. * - The fade in time.
  24231. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  24232. * @default -1.0
  24233. * @version DragonBones 5.0
  24234. * @language en_US
  24235. */
  24236. /**
  24237. * - 淡入时间。
  24238. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  24239. * @default -1.0
  24240. * @version DragonBones 5.0
  24241. * @language zh_CN
  24242. */
  24243. fadeInTime: number;
  24244. /**
  24245. * - The auto fade out time when the animation state play completed.
  24246. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  24247. * @default -1.0
  24248. * @version DragonBones 5.0
  24249. * @language en_US
  24250. */
  24251. /**
  24252. * - 动画状态播放完成后的自动淡出时间。
  24253. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  24254. * @default -1.0
  24255. * @version DragonBones 5.0
  24256. * @language zh_CN
  24257. */
  24258. autoFadeOutTime: number;
  24259. /**
  24260. * - The name of the animation state. (Can be different from the name of the animation data)
  24261. * @version DragonBones 5.0
  24262. * @language en_US
  24263. */
  24264. /**
  24265. * - 动画状态名称。 (可以不同于动画数据)
  24266. * @version DragonBones 5.0
  24267. * @language zh_CN
  24268. */
  24269. name: string;
  24270. /**
  24271. * - The animation data name.
  24272. * @version DragonBones 5.0
  24273. * @language en_US
  24274. */
  24275. /**
  24276. * - 动画数据名称。
  24277. * @version DragonBones 5.0
  24278. * @language zh_CN
  24279. */
  24280. animation: string;
  24281. /**
  24282. * - The blend group name of the animation state.
  24283. * This property is typically used to specify the substitution of multiple animation states blend.
  24284. * @readonly
  24285. * @version DragonBones 5.0
  24286. * @language en_US
  24287. */
  24288. /**
  24289. * - 混合组名称。
  24290. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24291. * @readonly
  24292. * @version DragonBones 5.0
  24293. * @language zh_CN
  24294. */
  24295. group: string;
  24296. /**
  24297. * @private
  24298. */
  24299. readonly boneMask: Array<string>;
  24300. /**
  24301. * @private
  24302. */
  24303. protected _onClear(): void;
  24304. /**
  24305. * @private
  24306. */
  24307. clear(): void;
  24308. /**
  24309. * @private
  24310. */
  24311. copyFrom(value: AnimationConfig): void;
  24312. /**
  24313. * @private
  24314. */
  24315. containsBoneMask(name: string): boolean;
  24316. /**
  24317. * @private
  24318. */
  24319. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24320. /**
  24321. * @private
  24322. */
  24323. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24324. }
  24325. }
  24326. /**
  24327. * The MIT License (MIT)
  24328. *
  24329. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24330. *
  24331. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24332. * this software and associated documentation files (the "Software"), to deal in
  24333. * the Software without restriction, including without limitation the rights to
  24334. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24335. * the Software, and to permit persons to whom the Software is furnished to do so,
  24336. * subject to the following conditions:
  24337. *
  24338. * The above copyright notice and this permission notice shall be included in all
  24339. * copies or substantial portions of the Software.
  24340. *
  24341. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24342. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24343. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24344. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24345. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24346. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24347. */
  24348. declare namespace dragonBones {
  24349. /**
  24350. * - The texture atlas data.
  24351. * @version DragonBones 3.0
  24352. * @language en_US
  24353. */
  24354. /**
  24355. * - 贴图集数据。
  24356. * @version DragonBones 3.0
  24357. * @language zh_CN
  24358. */
  24359. abstract class TextureAtlasData extends BaseObject {
  24360. /**
  24361. * @private
  24362. */
  24363. autoSearch: boolean;
  24364. /**
  24365. * @private
  24366. */
  24367. width: number;
  24368. /**
  24369. * @private
  24370. */
  24371. height: number;
  24372. /**
  24373. * @private
  24374. */
  24375. scale: number;
  24376. /**
  24377. * - The texture atlas name.
  24378. * @version DragonBones 3.0
  24379. * @language en_US
  24380. */
  24381. /**
  24382. * - 贴图集名称。
  24383. * @version DragonBones 3.0
  24384. * @language zh_CN
  24385. */
  24386. name: string;
  24387. /**
  24388. * - The image path of the texture atlas.
  24389. * @version DragonBones 3.0
  24390. * @language en_US
  24391. */
  24392. /**
  24393. * - 贴图集图片路径。
  24394. * @version DragonBones 3.0
  24395. * @language zh_CN
  24396. */
  24397. imagePath: string;
  24398. /**
  24399. * @private
  24400. */
  24401. readonly textures: Map<TextureData>;
  24402. /**
  24403. * @inheritDoc
  24404. */
  24405. protected _onClear(): void;
  24406. /**
  24407. * @private
  24408. */
  24409. copyFrom(value: TextureAtlasData): void;
  24410. /**
  24411. * @internal
  24412. * @private
  24413. */
  24414. abstract createTexture(): TextureData;
  24415. /**
  24416. * @internal
  24417. * @private
  24418. */
  24419. addTexture(value: TextureData): void;
  24420. /**
  24421. * @private
  24422. */
  24423. getTexture(name: string): TextureData | null;
  24424. }
  24425. /**
  24426. * @internal
  24427. * @private
  24428. */
  24429. abstract class TextureData extends BaseObject {
  24430. static createRectangle(): Rectangle;
  24431. rotated: boolean;
  24432. name: string;
  24433. readonly region: Rectangle;
  24434. parent: TextureAtlasData;
  24435. frame: Rectangle | null;
  24436. protected _onClear(): void;
  24437. copyFrom(value: TextureData): void;
  24438. }
  24439. }
  24440. /**
  24441. * The MIT License (MIT)
  24442. *
  24443. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24444. *
  24445. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24446. * this software and associated documentation files (the "Software"), to deal in
  24447. * the Software without restriction, including without limitation the rights to
  24448. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24449. * the Software, and to permit persons to whom the Software is furnished to do so,
  24450. * subject to the following conditions:
  24451. *
  24452. * The above copyright notice and this permission notice shall be included in all
  24453. * copies or substantial portions of the Software.
  24454. *
  24455. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24456. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24457. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24458. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24459. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24460. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24461. */
  24462. declare namespace dragonBones {
  24463. /**
  24464. * - The armature proxy interface, the docking engine needs to implement it concretely.
  24465. * @see dragonBones.Armature
  24466. * @version DragonBones 5.0
  24467. * @language en_US
  24468. */
  24469. /**
  24470. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  24471. * @see dragonBones.Armature
  24472. * @version DragonBones 5.0
  24473. * @language zh_CN
  24474. */
  24475. interface IArmatureProxy extends IEventDispatcher {
  24476. /**
  24477. * @internal
  24478. * @private
  24479. */
  24480. dbInit(armature: Armature): void;
  24481. /**
  24482. * @internal
  24483. * @private
  24484. */
  24485. dbClear(): void;
  24486. /**
  24487. * @internal
  24488. * @private
  24489. */
  24490. dbUpdate(): void;
  24491. /**
  24492. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  24493. * @example
  24494. * <pre>
  24495. * removeChild(armatureDisplay);
  24496. * armatureDisplay.dispose();
  24497. * </pre>
  24498. * @version DragonBones 4.5
  24499. * @language en_US
  24500. */
  24501. /**
  24502. * - 释放该实例和骨架。 (骨架会回收到对象池)
  24503. * @example
  24504. * <pre>
  24505. * removeChild(armatureDisplay);
  24506. * armatureDisplay.dispose();
  24507. * </pre>
  24508. * @version DragonBones 4.5
  24509. * @language zh_CN
  24510. */
  24511. dispose(disposeProxy: boolean): void;
  24512. /**
  24513. * - The armature.
  24514. * @version DragonBones 4.5
  24515. * @language en_US
  24516. */
  24517. /**
  24518. * - 骨架。
  24519. * @version DragonBones 4.5
  24520. * @language zh_CN
  24521. */
  24522. readonly armature: Armature;
  24523. /**
  24524. * - The animation player.
  24525. * @version DragonBones 3.0
  24526. * @language en_US
  24527. */
  24528. /**
  24529. * - 动画播放器。
  24530. * @version DragonBones 3.0
  24531. * @language zh_CN
  24532. */
  24533. readonly animation: Animation;
  24534. }
  24535. }
  24536. /**
  24537. * The MIT License (MIT)
  24538. *
  24539. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24540. *
  24541. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24542. * this software and associated documentation files (the "Software"), to deal in
  24543. * the Software without restriction, including without limitation the rights to
  24544. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24545. * the Software, and to permit persons to whom the Software is furnished to do so,
  24546. * subject to the following conditions:
  24547. *
  24548. * The above copyright notice and this permission notice shall be included in all
  24549. * copies or substantial portions of the Software.
  24550. *
  24551. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24552. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24553. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24554. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24555. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24556. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24557. */
  24558. declare namespace dragonBones {
  24559. /**
  24560. * - Armature is the core of the skeleton animation system.
  24561. * @see dragonBones.ArmatureData
  24562. * @see dragonBones.Bone
  24563. * @see dragonBones.Slot
  24564. * @see dragonBones.Animation
  24565. * @version DragonBones 3.0
  24566. * @language en_US
  24567. */
  24568. /**
  24569. * - 骨架是骨骼动画系统的核心。
  24570. * @see dragonBones.ArmatureData
  24571. * @see dragonBones.Bone
  24572. * @see dragonBones.Slot
  24573. * @see dragonBones.Animation
  24574. * @version DragonBones 3.0
  24575. * @language zh_CN
  24576. */
  24577. class Armature extends BaseObject implements IAnimatable {
  24578. static toString(): string;
  24579. private static _onSortSlots(a, b);
  24580. /**
  24581. * - Whether to inherit the animation control of the parent armature.
  24582. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  24583. * @default true
  24584. * @version DragonBones 4.5
  24585. * @language en_US
  24586. */
  24587. /**
  24588. * - 是否继承父骨架的动画控制。
  24589. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  24590. * @default true
  24591. * @version DragonBones 4.5
  24592. * @language zh_CN
  24593. */
  24594. inheritAnimation: boolean;
  24595. /**
  24596. * @private
  24597. */
  24598. userData: any;
  24599. private _lockUpdate;
  24600. private _bonesDirty;
  24601. private _slotsDirty;
  24602. private _zOrderDirty;
  24603. private _flipX;
  24604. private _flipY;
  24605. /**
  24606. * @internal
  24607. * @private
  24608. */
  24609. _cacheFrameIndex: number;
  24610. private readonly _bones;
  24611. private readonly _slots;
  24612. /**
  24613. * @internal
  24614. * @private
  24615. */
  24616. readonly _glueSlots: Array<Slot>;
  24617. /**
  24618. * @internal
  24619. * @private
  24620. */
  24621. readonly _constraints: Array<Constraint>;
  24622. private readonly _actions;
  24623. /**
  24624. * @internal
  24625. * @private
  24626. */
  24627. _armatureData: ArmatureData;
  24628. private _animation;
  24629. private _proxy;
  24630. private _display;
  24631. /**
  24632. * @internal
  24633. * @private
  24634. */
  24635. _replaceTextureAtlasData: TextureAtlasData | null;
  24636. private _replacedTexture;
  24637. /**
  24638. * @internal
  24639. * @private
  24640. */
  24641. _dragonBones: DragonBones;
  24642. private _clock;
  24643. /**
  24644. * @internal
  24645. * @private
  24646. */
  24647. _parent: Slot | null;
  24648. /**
  24649. * @private
  24650. */
  24651. protected _onClear(): void;
  24652. private _sortBones();
  24653. private _sortSlots();
  24654. /**
  24655. * @internal
  24656. * @private
  24657. */
  24658. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  24659. /**
  24660. * @internal
  24661. * @private
  24662. */
  24663. _addBoneToBoneList(value: Bone): void;
  24664. /**
  24665. * @internal
  24666. * @private
  24667. */
  24668. _removeBoneFromBoneList(value: Bone): void;
  24669. /**
  24670. * @internal
  24671. * @private
  24672. */
  24673. _addSlotToSlotList(value: Slot): void;
  24674. /**
  24675. * @internal
  24676. * @private
  24677. */
  24678. _removeSlotFromSlotList(value: Slot): void;
  24679. /**
  24680. * @internal
  24681. * @private
  24682. */
  24683. _bufferAction(action: ActionData, append: boolean): void;
  24684. /**
  24685. * - Dispose the armature. (Return to the object pool)
  24686. * @example
  24687. * <pre>
  24688. * removeChild(armature.display);
  24689. * armature.dispose();
  24690. * </pre>
  24691. * @version DragonBones 3.0
  24692. * @language en_US
  24693. */
  24694. /**
  24695. * - 释放骨架。 (回收到对象池)
  24696. * @example
  24697. * <pre>
  24698. * removeChild(armature.display);
  24699. * armature.dispose();
  24700. * </pre>
  24701. * @version DragonBones 3.0
  24702. * @language zh_CN
  24703. */
  24704. dispose(): void;
  24705. /**
  24706. * @internal
  24707. * @private
  24708. */
  24709. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  24710. /**
  24711. * @inheritDoc
  24712. */
  24713. advanceTime(passedTime: number): void;
  24714. /**
  24715. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  24716. * @param boneName - The bone name. (If not set, all bones will be update)
  24717. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  24718. * @see dragonBones.Bone#invalidUpdate()
  24719. * @see dragonBones.Slot#invalidUpdate()
  24720. * @version DragonBones 3.0
  24721. * @language en_US
  24722. */
  24723. /**
  24724. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  24725. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  24726. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  24727. * @see dragonBones.Bone#invalidUpdate()
  24728. * @see dragonBones.Slot#invalidUpdate()
  24729. * @version DragonBones 3.0
  24730. * @language zh_CN
  24731. */
  24732. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  24733. /**
  24734. * - Check whether a specific point is inside a custom bounding box in a slot.
  24735. * The coordinate system of the point is the inner coordinate system of the armature.
  24736. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24737. * @param x - The horizontal coordinate of the point.
  24738. * @param y - The vertical coordinate of the point.
  24739. * @version DragonBones 5.0
  24740. * @language en_US
  24741. */
  24742. /**
  24743. * - 检查特定点是否在某个插槽的自定义边界框内。
  24744. * 点的坐标系为骨架内坐标系。
  24745. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24746. * @param x - 点的水平坐标。
  24747. * @param y - 点的垂直坐标。
  24748. * @version DragonBones 5.0
  24749. * @language zh_CN
  24750. */
  24751. containsPoint(x: number, y: number): Slot | null;
  24752. /**
  24753. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  24754. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  24755. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24756. * @param xA - The horizontal coordinate of the beginning of the segment.
  24757. * @param yA - The vertical coordinate of the beginning of the segment.
  24758. * @param xB - The horizontal coordinate of the end point of the segment.
  24759. * @param yB - The vertical coordinate of the end point of the segment.
  24760. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  24761. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  24762. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  24763. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  24764. * @version DragonBones 5.0
  24765. * @language en_US
  24766. */
  24767. /**
  24768. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  24769. * 线段和交点的坐标系均为骨架内坐标系。
  24770. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24771. * @param xA - 线段起点的水平坐标。
  24772. * @param yA - 线段起点的垂直坐标。
  24773. * @param xB - 线段终点的水平坐标。
  24774. * @param yB - 线段终点的垂直坐标。
  24775. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24776. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24777. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  24778. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  24779. * @version DragonBones 5.0
  24780. * @language zh_CN
  24781. */
  24782. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  24783. x: number;
  24784. y: number;
  24785. } | null, intersectionPointB?: {
  24786. x: number;
  24787. y: number;
  24788. } | null, normalRadians?: {
  24789. x: number;
  24790. y: number;
  24791. } | null): Slot | null;
  24792. /**
  24793. * - Get a specific bone.
  24794. * @param name - The bone name.
  24795. * @see dragonBones.Bone
  24796. * @version DragonBones 3.0
  24797. * @language en_US
  24798. */
  24799. /**
  24800. * - 获取特定的骨骼。
  24801. * @param name - 骨骼名称。
  24802. * @see dragonBones.Bone
  24803. * @version DragonBones 3.0
  24804. * @language zh_CN
  24805. */
  24806. getBone(name: string): Bone | null;
  24807. /**
  24808. * - Get a specific bone by the display.
  24809. * @param display - The display object.
  24810. * @see dragonBones.Bone
  24811. * @version DragonBones 3.0
  24812. * @language en_US
  24813. */
  24814. /**
  24815. * - 通过显示对象获取特定的骨骼。
  24816. * @param display - 显示对象。
  24817. * @see dragonBones.Bone
  24818. * @version DragonBones 3.0
  24819. * @language zh_CN
  24820. */
  24821. getBoneByDisplay(display: any): Bone | null;
  24822. /**
  24823. * - Get a specific slot.
  24824. * @param name - The slot name.
  24825. * @see dragonBones.Slot
  24826. * @version DragonBones 3.0
  24827. * @language en_US
  24828. */
  24829. /**
  24830. * - 获取特定的插槽。
  24831. * @param name - 插槽名称。
  24832. * @see dragonBones.Slot
  24833. * @version DragonBones 3.0
  24834. * @language zh_CN
  24835. */
  24836. getSlot(name: string): Slot | null;
  24837. /**
  24838. * - Get a specific slot by the display.
  24839. * @param display - The display object.
  24840. * @see dragonBones.Slot
  24841. * @version DragonBones 3.0
  24842. * @language en_US
  24843. */
  24844. /**
  24845. * - 通过显示对象获取特定的插槽。
  24846. * @param display - 显示对象。
  24847. * @see dragonBones.Slot
  24848. * @version DragonBones 3.0
  24849. * @language zh_CN
  24850. */
  24851. getSlotByDisplay(display: any): Slot | null;
  24852. /**
  24853. * @deprecated
  24854. */
  24855. addBone(value: Bone, parentName: string): void;
  24856. /**
  24857. * @deprecated
  24858. */
  24859. addSlot(value: Slot, parentName: string): void;
  24860. /**
  24861. * @private
  24862. */
  24863. addConstraint(value: Constraint): void;
  24864. /**
  24865. * @deprecated
  24866. */
  24867. removeBone(value: Bone): void;
  24868. /**
  24869. * @deprecated
  24870. */
  24871. removeSlot(value: Slot): void;
  24872. /**
  24873. * - Get all bones.
  24874. * @see dragonBones.Bone
  24875. * @version DragonBones 3.0
  24876. * @language en_US
  24877. */
  24878. /**
  24879. * - 获取所有的骨骼。
  24880. * @see dragonBones.Bone
  24881. * @version DragonBones 3.0
  24882. * @language zh_CN
  24883. */
  24884. getBones(): Array<Bone>;
  24885. /**
  24886. * - Get all slots.
  24887. * @see dragonBones.Slot
  24888. * @version DragonBones 3.0
  24889. * @language en_US
  24890. */
  24891. /**
  24892. * - 获取所有的插槽。
  24893. * @see dragonBones.Slot
  24894. * @version DragonBones 3.0
  24895. * @language zh_CN
  24896. */
  24897. getSlots(): Array<Slot>;
  24898. /**
  24899. * - Whether to flip the armature horizontally.
  24900. * @version DragonBones 5.5
  24901. * @language en_US
  24902. */
  24903. /**
  24904. * - 是否将骨架水平翻转。
  24905. * @version DragonBones 5.5
  24906. * @language zh_CN
  24907. */
  24908. flipX: boolean;
  24909. /**
  24910. * - Whether to flip the armature vertically.
  24911. * @version DragonBones 5.5
  24912. * @language en_US
  24913. */
  24914. /**
  24915. * - 是否将骨架垂直翻转。
  24916. * @version DragonBones 5.5
  24917. * @language zh_CN
  24918. */
  24919. flipY: boolean;
  24920. /**
  24921. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  24922. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  24923. * The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate.
  24924. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  24925. * @example
  24926. * <pre>
  24927. * armature.cacheFrameRate = 24;
  24928. * </pre>
  24929. * @see dragonBones.DragonBonesData#frameRate
  24930. * @see dragonBones.ArmatureData#frameRate
  24931. * @version DragonBones 4.5
  24932. * @language en_US
  24933. */
  24934. /**
  24935. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  24936. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  24937. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  24938. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  24939. * @example
  24940. * <pre>
  24941. * armature.cacheFrameRate = 24;
  24942. * </pre>
  24943. * @see dragonBones.DragonBonesData#frameRate
  24944. * @see dragonBones.ArmatureData#frameRate
  24945. * @version DragonBones 4.5
  24946. * @language zh_CN
  24947. */
  24948. cacheFrameRate: number;
  24949. /**
  24950. * - The armature name.
  24951. * @version DragonBones 3.0
  24952. * @language en_US
  24953. */
  24954. /**
  24955. * - 骨架名称。
  24956. * @version DragonBones 3.0
  24957. * @language zh_CN
  24958. */
  24959. readonly name: string;
  24960. /**
  24961. * - The armature data.
  24962. * @see dragonBones.ArmatureData
  24963. * @version DragonBones 4.5
  24964. * @language en_US
  24965. */
  24966. /**
  24967. * - 骨架数据。
  24968. * @see dragonBones.ArmatureData
  24969. * @version DragonBones 4.5
  24970. * @language zh_CN
  24971. */
  24972. readonly armatureData: ArmatureData;
  24973. /**
  24974. * - The animation player.
  24975. * @see dragonBones.Animation
  24976. * @version DragonBones 3.0
  24977. * @language en_US
  24978. */
  24979. /**
  24980. * - 动画播放器。
  24981. * @see dragonBones.Animation
  24982. * @version DragonBones 3.0
  24983. * @language zh_CN
  24984. */
  24985. readonly animation: Animation;
  24986. /**
  24987. * @pivate
  24988. */
  24989. readonly proxy: IArmatureProxy;
  24990. /**
  24991. * - The EventDispatcher instance of the armature.
  24992. * @version DragonBones 4.5
  24993. * @language en_US
  24994. */
  24995. /**
  24996. * - 该骨架的 EventDispatcher 实例。
  24997. * @version DragonBones 4.5
  24998. * @language zh_CN
  24999. */
  25000. readonly eventDispatcher: IEventDispatcher;
  25001. /**
  25002. * - The display container.
  25003. * The display of the slot is displayed as the parent.
  25004. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  25005. * @version DragonBones 3.0
  25006. * @language en_US
  25007. */
  25008. /**
  25009. * - 显示容器实例。
  25010. * 插槽的显示对象都会以此显示容器为父级。
  25011. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  25012. * @version DragonBones 3.0
  25013. * @language zh_CN
  25014. */
  25015. readonly display: any;
  25016. /**
  25017. * @private
  25018. */
  25019. replacedTexture: any;
  25020. /**
  25021. * @inheritDoc
  25022. */
  25023. clock: WorldClock | null;
  25024. /**
  25025. * - Get the parent slot which the armature belongs to.
  25026. * @see dragonBones.Slot
  25027. * @version DragonBones 4.5
  25028. * @language en_US
  25029. */
  25030. /**
  25031. * - 该骨架所属的父插槽。
  25032. * @see dragonBones.Slot
  25033. * @version DragonBones 4.5
  25034. * @language zh_CN
  25035. */
  25036. readonly parent: Slot | null;
  25037. /**
  25038. * @deprecated
  25039. * @private
  25040. */
  25041. replaceTexture(texture: any): void;
  25042. /**
  25043. * - Deprecated, please refer to {@link #eventDispatcher}.
  25044. * @deprecated
  25045. * @language en_US
  25046. */
  25047. /**
  25048. * - 已废弃,请参考 {@link #eventDispatcher}。
  25049. * @deprecated
  25050. * @language zh_CN
  25051. */
  25052. hasEventListener(type: EventStringType): boolean;
  25053. /**
  25054. * - Deprecated, please refer to {@link #eventDispatcher}.
  25055. * @deprecated
  25056. * @language en_US
  25057. */
  25058. /**
  25059. * - 已废弃,请参考 {@link #eventDispatcher}。
  25060. * @deprecated
  25061. * @language zh_CN
  25062. */
  25063. addEventListener(type: EventStringType, listener: Function, target: any): void;
  25064. /**
  25065. * - Deprecated, please refer to {@link #eventDispatcher}.
  25066. * @deprecated
  25067. * @language en_US
  25068. */
  25069. /**
  25070. * - 已废弃,请参考 {@link #eventDispatcher}。
  25071. * @deprecated
  25072. * @language zh_CN
  25073. */
  25074. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  25075. /**
  25076. * - Deprecated, please refer to {@link #cacheFrameRate}.
  25077. * @deprecated
  25078. * @language en_US
  25079. */
  25080. /**
  25081. * - 已废弃,请参考 {@link #cacheFrameRate}。
  25082. * @deprecated
  25083. * @language zh_CN
  25084. */
  25085. enableAnimationCache(frameRate: number): void;
  25086. /**
  25087. * - Deprecated, please refer to {@link #display}.
  25088. * @deprecated
  25089. * @language en_US
  25090. */
  25091. /**
  25092. * - 已废弃,请参考 {@link #display}。
  25093. * @deprecated
  25094. * @language zh_CN
  25095. */
  25096. getDisplay(): any;
  25097. }
  25098. }
  25099. /**
  25100. * The MIT License (MIT)
  25101. *
  25102. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25103. *
  25104. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25105. * this software and associated documentation files (the "Software"), to deal in
  25106. * the Software without restriction, including without limitation the rights to
  25107. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25108. * the Software, and to permit persons to whom the Software is furnished to do so,
  25109. * subject to the following conditions:
  25110. *
  25111. * The above copyright notice and this permission notice shall be included in all
  25112. * copies or substantial portions of the Software.
  25113. *
  25114. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25115. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25116. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25117. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25118. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25119. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25120. */
  25121. declare namespace dragonBones {
  25122. /**
  25123. * - The base class of the transform object.
  25124. * @see dragonBones.Transform
  25125. * @version DragonBones 4.5
  25126. * @language en_US
  25127. */
  25128. /**
  25129. * - 变换对象的基类。
  25130. * @see dragonBones.Transform
  25131. * @version DragonBones 4.5
  25132. * @language zh_CN
  25133. */
  25134. abstract class TransformObject extends BaseObject {
  25135. /**
  25136. * @private
  25137. */
  25138. protected static readonly _helpMatrix: Matrix;
  25139. /**
  25140. * @private
  25141. */
  25142. protected static readonly _helpTransform: Transform;
  25143. /**
  25144. * @private
  25145. */
  25146. protected static readonly _helpPoint: Point;
  25147. /**
  25148. * - A matrix relative to the armature coordinate system.
  25149. * @version DragonBones 3.0
  25150. * @language en_US
  25151. */
  25152. /**
  25153. * - 相对于骨架坐标系的矩阵。
  25154. * @version DragonBones 3.0
  25155. * @language zh_CN
  25156. */
  25157. readonly globalTransformMatrix: Matrix;
  25158. /**
  25159. * - A transform relative to the armature coordinate system.
  25160. * @see #updateGlobalTransform()
  25161. * @version DragonBones 3.0
  25162. * @language en_US
  25163. */
  25164. /**
  25165. * - 相对于骨架坐标系的变换。
  25166. * @see #updateGlobalTransform()
  25167. * @version DragonBones 3.0
  25168. * @language zh_CN
  25169. */
  25170. readonly global: Transform;
  25171. /**
  25172. * - The offset transform relative to the armature or the parent bone coordinate system.
  25173. * @see #dragonBones.Bone#invalidUpdate()
  25174. * @version DragonBones 3.0
  25175. * @language en_US
  25176. */
  25177. /**
  25178. * - 相对于骨架或父骨骼坐标系的偏移变换。
  25179. * @see #dragonBones.Bone#invalidUpdate()
  25180. * @version DragonBones 3.0
  25181. * @language zh_CN
  25182. */
  25183. readonly offset: Transform;
  25184. /**
  25185. * @private
  25186. */
  25187. origin: Transform | null;
  25188. /**
  25189. * @private
  25190. */
  25191. userData: any;
  25192. /**
  25193. * @private
  25194. */
  25195. protected _globalDirty: boolean;
  25196. /**
  25197. * @internal
  25198. * @private
  25199. */
  25200. _armature: Armature;
  25201. /**
  25202. * @internal
  25203. * @private
  25204. */
  25205. _parent: Bone;
  25206. /**
  25207. * @private
  25208. */
  25209. protected _onClear(): void;
  25210. /**
  25211. * @internal
  25212. * @private
  25213. */
  25214. _setArmature(value: Armature | null): void;
  25215. /**
  25216. * @internal
  25217. * @private
  25218. */
  25219. _setParent(value: Bone | null): void;
  25220. /**
  25221. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  25222. * some engines do not rely on these attributes to update rendering, such as Egret.
  25223. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  25224. * @example
  25225. * <pre>
  25226. * bone.updateGlobalTransform();
  25227. * let rotation = bone.global.rotation;
  25228. * </pre>
  25229. * @version DragonBones 3.0
  25230. * @language en_US
  25231. */
  25232. /**
  25233. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  25234. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  25235. * @example
  25236. * <pre>
  25237. * bone.updateGlobalTransform();
  25238. * let rotation = bone.global.rotation;
  25239. * </pre>
  25240. * @version DragonBones 3.0
  25241. * @language zh_CN
  25242. */
  25243. updateGlobalTransform(): void;
  25244. /**
  25245. * - The armature to which it belongs.
  25246. * @version DragonBones 3.0
  25247. * @language en_US
  25248. */
  25249. /**
  25250. * - 所属的骨架。
  25251. * @version DragonBones 3.0
  25252. * @language zh_CN
  25253. */
  25254. readonly armature: Armature;
  25255. /**
  25256. * - The parent bone to which it belongs.
  25257. * @version DragonBones 3.0
  25258. * @language en_US
  25259. */
  25260. /**
  25261. * - 所属的父骨骼。
  25262. * @version DragonBones 3.0
  25263. * @language zh_CN
  25264. */
  25265. readonly parent: Bone;
  25266. }
  25267. }
  25268. /**
  25269. * The MIT License (MIT)
  25270. *
  25271. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25272. *
  25273. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25274. * this software and associated documentation files (the "Software"), to deal in
  25275. * the Software without restriction, including without limitation the rights to
  25276. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25277. * the Software, and to permit persons to whom the Software is furnished to do so,
  25278. * subject to the following conditions:
  25279. *
  25280. * The above copyright notice and this permission notice shall be included in all
  25281. * copies or substantial portions of the Software.
  25282. *
  25283. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25284. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25285. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25286. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25287. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25288. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25289. */
  25290. declare namespace dragonBones {
  25291. /**
  25292. * - Bone is one of the most important logical units in the armature animation system,
  25293. * and is responsible for the realization of translate, rotation, scaling in the animations.
  25294. * A armature can contain multiple bones.
  25295. * @see dragonBones.BoneData
  25296. * @see dragonBones.Armature
  25297. * @see dragonBones.Slot
  25298. * @version DragonBones 3.0
  25299. * @language en_US
  25300. */
  25301. /**
  25302. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  25303. * 一个骨架中可以包含多个骨骼。
  25304. * @see dragonBones.BoneData
  25305. * @see dragonBones.Armature
  25306. * @see dragonBones.Slot
  25307. * @version DragonBones 3.0
  25308. * @language zh_CN
  25309. */
  25310. class Bone extends TransformObject {
  25311. static toString(): string;
  25312. /**
  25313. * - The offset mode.
  25314. * @see #offset
  25315. * @version DragonBones 5.5
  25316. * @language en_US
  25317. */
  25318. /**
  25319. * - 偏移模式。
  25320. * @see #offset
  25321. * @version DragonBones 5.5
  25322. * @language zh_CN
  25323. */
  25324. offsetMode: OffsetMode;
  25325. /**
  25326. * @internal
  25327. * @private
  25328. */
  25329. readonly animationPose: Transform;
  25330. /**
  25331. * @internal
  25332. * @private
  25333. */
  25334. _transformDirty: boolean;
  25335. /**
  25336. * @internal
  25337. * @private
  25338. */
  25339. _childrenTransformDirty: boolean;
  25340. protected _localDirty: boolean;
  25341. /**
  25342. * @internal
  25343. * @private
  25344. */
  25345. _hasConstraint: boolean;
  25346. private _visible;
  25347. protected _cachedFrameIndex: number;
  25348. /**
  25349. * @internal
  25350. * @private
  25351. */
  25352. readonly _blendState: BlendState;
  25353. /**
  25354. * @internal
  25355. * @private
  25356. */
  25357. _boneData: BoneData;
  25358. /**
  25359. * @internal
  25360. * @private
  25361. */
  25362. _cachedFrameIndices: Array<number> | null;
  25363. /**
  25364. * @inheritDoc
  25365. */
  25366. protected _onClear(): void;
  25367. /**
  25368. * @private
  25369. */
  25370. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25371. /**
  25372. * @inheritDoc
  25373. */
  25374. _setArmature(value: Armature | null): void;
  25375. /**
  25376. * @internal
  25377. * @private
  25378. */
  25379. init(boneData: BoneData): void;
  25380. /**
  25381. * @internal
  25382. * @private
  25383. */
  25384. update(cacheFrameIndex: number): void;
  25385. /**
  25386. * @internal
  25387. * @private
  25388. */
  25389. updateByConstraint(): void;
  25390. /**
  25391. * - Forces the bone to update the transform in the next frame.
  25392. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  25393. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  25394. * @example
  25395. * <pre>
  25396. * let bone = armature.getBone("arm");
  25397. * bone.offset.scaleX = 2.0;
  25398. * bone.invalidUpdate();
  25399. * </pre>
  25400. * @version DragonBones 3.0
  25401. * @language en_US
  25402. */
  25403. /**
  25404. * - 强制骨骼在下一帧更新变换。
  25405. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  25406. * @example
  25407. * <pre>
  25408. * let bone = armature.getBone("arm");
  25409. * bone.offset.scaleX = 2.0;
  25410. * bone.invalidUpdate();
  25411. * </pre>
  25412. * @version DragonBones 3.0
  25413. * @language zh_CN
  25414. */
  25415. invalidUpdate(): void;
  25416. /**
  25417. * - Check whether the bone contains a specific bone or slot.
  25418. * @see dragonBones.Bone
  25419. * @see dragonBones.Slot
  25420. * @version DragonBones 3.0
  25421. * @language en_US
  25422. */
  25423. /**
  25424. * - 检查该骨骼是否包含特定的骨骼或插槽。
  25425. * @see dragonBones.Bone
  25426. * @see dragonBones.Slot
  25427. * @version DragonBones 3.0
  25428. * @language zh_CN
  25429. */
  25430. contains(value: TransformObject): boolean;
  25431. /**
  25432. * - The bone data.
  25433. * @version DragonBones 4.5
  25434. * @language en_US
  25435. */
  25436. /**
  25437. * - 骨骼数据。
  25438. * @version DragonBones 4.5
  25439. * @language zh_CN
  25440. */
  25441. readonly boneData: BoneData;
  25442. /**
  25443. * - The visible of all slots in the bone.
  25444. * @default true
  25445. * @see dragonBones.Slot#visible
  25446. * @version DragonBones 3.0
  25447. * @language en_US
  25448. */
  25449. /**
  25450. * - 此骨骼所有插槽的可见。
  25451. * @default true
  25452. * @see dragonBones.Slot#visible
  25453. * @version DragonBones 3.0
  25454. * @language zh_CN
  25455. */
  25456. visible: boolean;
  25457. /**
  25458. * - The bone name.
  25459. * @version DragonBones 3.0
  25460. * @language en_US
  25461. */
  25462. /**
  25463. * - 骨骼名称。
  25464. * @version DragonBones 3.0
  25465. * @language zh_CN
  25466. */
  25467. readonly name: string;
  25468. /**
  25469. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  25470. * @deprecated
  25471. * @language en_US
  25472. */
  25473. /**
  25474. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  25475. * @deprecated
  25476. * @language zh_CN
  25477. */
  25478. getBones(): Array<Bone>;
  25479. /**
  25480. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  25481. * @deprecated
  25482. * @language en_US
  25483. */
  25484. /**
  25485. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  25486. * @deprecated
  25487. * @language zh_CN
  25488. */
  25489. getSlots(): Array<Slot>;
  25490. /**
  25491. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  25492. * @deprecated
  25493. * @language en_US
  25494. */
  25495. /**
  25496. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  25497. * @deprecated
  25498. * @language zh_CN
  25499. */
  25500. readonly slot: Slot | null;
  25501. }
  25502. }
  25503. /**
  25504. * The MIT License (MIT)
  25505. *
  25506. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25507. *
  25508. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25509. * this software and associated documentation files (the "Software"), to deal in
  25510. * the Software without restriction, including without limitation the rights to
  25511. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25512. * the Software, and to permit persons to whom the Software is furnished to do so,
  25513. * subject to the following conditions:
  25514. *
  25515. * The above copyright notice and this permission notice shall be included in all
  25516. * copies or substantial portions of the Software.
  25517. *
  25518. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25519. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25520. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25521. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25522. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25523. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25524. */
  25525. declare namespace dragonBones {
  25526. /**
  25527. * @internal
  25528. * @private
  25529. */
  25530. class Surface extends Bone {
  25531. static toString(): string;
  25532. private _dX;
  25533. private _dY;
  25534. private _k;
  25535. private _kX;
  25536. private _kY;
  25537. /**
  25538. * For debug draw.
  25539. * @internal
  25540. * @private
  25541. */
  25542. readonly _vertices: Array<number>;
  25543. /**
  25544. * For timeline state.
  25545. * @internal
  25546. * @private
  25547. */
  25548. readonly _deformVertices: Array<number>;
  25549. /**
  25550. * x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y
  25551. */
  25552. private readonly _hullCache;
  25553. /**
  25554. * Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty]
  25555. */
  25556. private readonly _matrixCahce;
  25557. /**
  25558. * @inheritDoc
  25559. */
  25560. protected _onClear(): void;
  25561. private _getAffineTransform(x, y, lX, lY, aX, aY, bX, bY, cX, cY, transform, matrix, isDown);
  25562. private _updateVertices();
  25563. /**
  25564. * @private
  25565. */
  25566. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25567. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  25568. init(surfaceData: SurfaceData): void;
  25569. /**
  25570. * @internal
  25571. * @private
  25572. */
  25573. update(cacheFrameIndex: number): void;
  25574. }
  25575. }
  25576. /**
  25577. * The MIT License (MIT)
  25578. *
  25579. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25580. *
  25581. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25582. * this software and associated documentation files (the "Software"), to deal in
  25583. * the Software without restriction, including without limitation the rights to
  25584. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25585. * the Software, and to permit persons to whom the Software is furnished to do so,
  25586. * subject to the following conditions:
  25587. *
  25588. * The above copyright notice and this permission notice shall be included in all
  25589. * copies or substantial portions of the Software.
  25590. *
  25591. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25592. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25593. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25594. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25595. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25596. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25597. */
  25598. declare namespace dragonBones {
  25599. /**
  25600. * - The slot attached to the armature, controls the display status and properties of the display object.
  25601. * A bone can contain multiple slots.
  25602. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  25603. * but you can toggle the display object into frame animation while the animation is playing.
  25604. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  25605. * and a custom other display object.
  25606. * @see dragonBones.Armature
  25607. * @see dragonBones.Bone
  25608. * @see dragonBones.SlotData
  25609. * @version DragonBones 3.0
  25610. * @language en_US
  25611. */
  25612. /**
  25613. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  25614. * 一个骨骼上可以包含多个插槽。
  25615. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  25616. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  25617. * @see dragonBones.Armature
  25618. * @see dragonBones.Bone
  25619. * @see dragonBones.SlotData
  25620. * @version DragonBones 3.0
  25621. * @language zh_CN
  25622. */
  25623. abstract class Slot extends TransformObject {
  25624. /**
  25625. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  25626. * @default null
  25627. * @see dragonBones.AnimationState#displayControl
  25628. * @see dragonBones.AnimationState#name
  25629. * @see dragonBones.AnimationState#group
  25630. * @version DragonBones 4.5
  25631. * @language en_US
  25632. */
  25633. /**
  25634. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  25635. * @default null
  25636. * @see dragonBones.AnimationState#displayControl
  25637. * @see dragonBones.AnimationState#name
  25638. * @see dragonBones.AnimationState#group
  25639. * @version DragonBones 4.5
  25640. * @language zh_CN
  25641. */
  25642. displayController: string | null;
  25643. /**
  25644. * @private
  25645. */
  25646. protected _displayDirty: boolean;
  25647. /**
  25648. * @private
  25649. */
  25650. protected _zOrderDirty: boolean;
  25651. /**
  25652. * @private
  25653. */
  25654. protected _visibleDirty: boolean;
  25655. /**
  25656. * @private
  25657. */
  25658. protected _blendModeDirty: boolean;
  25659. /**
  25660. * @internal
  25661. * @private
  25662. */
  25663. _colorDirty: boolean;
  25664. /**
  25665. * @internal
  25666. * @private
  25667. */
  25668. _meshDirty: boolean;
  25669. /**
  25670. * @private
  25671. */
  25672. protected _transformDirty: boolean;
  25673. /**
  25674. * @private
  25675. */
  25676. protected _visible: boolean;
  25677. /**
  25678. * @private
  25679. */
  25680. protected _blendMode: BlendMode;
  25681. /**
  25682. * @private
  25683. */
  25684. protected _displayIndex: number;
  25685. /**
  25686. * @private
  25687. */
  25688. protected _animationDisplayIndex: number;
  25689. /**
  25690. * @internal
  25691. * @private
  25692. */
  25693. _zOrder: number;
  25694. /**
  25695. * @private
  25696. */
  25697. protected _cachedFrameIndex: number;
  25698. /**
  25699. * @internal
  25700. * @private
  25701. */
  25702. _pivotX: number;
  25703. /**
  25704. * @internal
  25705. * @private
  25706. */
  25707. _pivotY: number;
  25708. /**
  25709. * @private
  25710. */
  25711. protected readonly _localMatrix: Matrix;
  25712. /**
  25713. * @internal
  25714. * @private
  25715. */
  25716. readonly _colorTransform: ColorTransform;
  25717. /**
  25718. * @internal
  25719. * @private
  25720. */
  25721. readonly _deformVertices: Array<number>;
  25722. /**
  25723. * @private
  25724. */
  25725. readonly _displayDatas: Array<DisplayData | null>;
  25726. /**
  25727. * @private
  25728. */
  25729. protected readonly _displayList: Array<any | Armature>;
  25730. /**
  25731. * @private
  25732. */
  25733. protected readonly _meshBones: Array<Bone | null>;
  25734. /**
  25735. * @private
  25736. */
  25737. protected readonly _meshSlots: Array<Slot | null>;
  25738. /**
  25739. * @internal
  25740. * @private
  25741. */
  25742. _slotData: SlotData;
  25743. /**
  25744. * @private
  25745. */
  25746. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  25747. /**
  25748. * @private
  25749. */
  25750. protected _displayData: DisplayData | null;
  25751. /**
  25752. * @private
  25753. */
  25754. protected _textureData: TextureData | null;
  25755. /**
  25756. * @internal
  25757. * @private
  25758. */
  25759. _meshData: MeshDisplayData | null;
  25760. /**
  25761. * @private
  25762. */
  25763. protected _boundingBoxData: BoundingBoxData | null;
  25764. /**
  25765. * @private
  25766. */
  25767. protected _rawDisplay: any;
  25768. /**
  25769. * @private
  25770. */
  25771. protected _meshDisplay: any;
  25772. /**
  25773. * @private
  25774. */
  25775. protected _display: any;
  25776. /**
  25777. * @private
  25778. */
  25779. protected _childArmature: Armature | null;
  25780. /**
  25781. * @internal
  25782. * @private
  25783. */
  25784. _cachedFrameIndices: Array<number> | null;
  25785. /**
  25786. * @inheritDoc
  25787. */
  25788. protected _onClear(): void;
  25789. /**
  25790. * @private
  25791. */
  25792. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  25793. /**
  25794. * @private
  25795. */
  25796. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  25797. /**
  25798. * @private
  25799. */
  25800. protected abstract _onUpdateDisplay(): void;
  25801. /**
  25802. * @private
  25803. */
  25804. protected abstract _addDisplay(): void;
  25805. /**
  25806. * @private
  25807. */
  25808. protected abstract _replaceDisplay(value: any): void;
  25809. /**
  25810. * @private
  25811. */
  25812. protected abstract _removeDisplay(): void;
  25813. /**
  25814. * @private
  25815. */
  25816. protected abstract _updateZOrder(): void;
  25817. /**
  25818. * @private
  25819. */
  25820. abstract _updateVisible(): void;
  25821. /**
  25822. * @private
  25823. */
  25824. protected abstract _updateBlendMode(): void;
  25825. /**
  25826. * @private
  25827. */
  25828. protected abstract _updateColor(): void;
  25829. /**
  25830. * @private
  25831. */
  25832. protected abstract _updateFrame(): void;
  25833. /**
  25834. * @private
  25835. */
  25836. protected abstract _updateMesh(): void;
  25837. /**
  25838. * @internal
  25839. * @private
  25840. */
  25841. abstract _updateGlueMesh(): void;
  25842. /**
  25843. * @private
  25844. */
  25845. protected abstract _updateTransform(): void;
  25846. /**
  25847. * @private
  25848. */
  25849. protected abstract _identityTransform(): void;
  25850. /**
  25851. * @private
  25852. */
  25853. protected _getDefaultRawDisplayData(): DisplayData | null;
  25854. /**
  25855. * @private
  25856. */
  25857. protected _updateDisplayData(): void;
  25858. /**
  25859. * @private
  25860. */
  25861. protected _updateDisplay(): void;
  25862. /**
  25863. * @private
  25864. */
  25865. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25866. /**
  25867. * @private
  25868. */
  25869. protected _isMeshBonesUpdate(): boolean;
  25870. /**
  25871. * @inheritDoc
  25872. */
  25873. _setArmature(value: Armature | null): void;
  25874. /**
  25875. * @internal
  25876. * @private
  25877. */
  25878. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  25879. /**
  25880. * @internal
  25881. * @private
  25882. */
  25883. _setZorder(value: number): boolean;
  25884. /**
  25885. * @internal
  25886. * @private
  25887. */
  25888. _setColor(value: ColorTransform): boolean;
  25889. /**
  25890. * @internal
  25891. * @private
  25892. */
  25893. _setDisplayList(value: Array<any> | null): boolean;
  25894. /**
  25895. * @internal
  25896. * @private
  25897. */
  25898. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  25899. /**
  25900. * @internal
  25901. * @private
  25902. */
  25903. update(cacheFrameIndex: number): void;
  25904. /**
  25905. * @private
  25906. */
  25907. updateTransformAndMatrix(): void;
  25908. /**
  25909. * @private
  25910. */
  25911. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  25912. /**
  25913. * - Check whether a specific point is inside a custom bounding box in the slot.
  25914. * The coordinate system of the point is the inner coordinate system of the armature.
  25915. * Custom bounding boxes need to be customized in Dragonbones Pro.
  25916. * @param x - The horizontal coordinate of the point.
  25917. * @param y - The vertical coordinate of the point.
  25918. * @version DragonBones 5.0
  25919. * @language en_US
  25920. */
  25921. /**
  25922. * - 检查特定点是否在插槽的自定义边界框内。
  25923. * 点的坐标系为骨架内坐标系。
  25924. * 自定义边界框需要在 DragonBones Pro 中自定义。
  25925. * @param x - 点的水平坐标。
  25926. * @param y - 点的垂直坐标。
  25927. * @version DragonBones 5.0
  25928. * @language zh_CN
  25929. */
  25930. containsPoint(x: number, y: number): boolean;
  25931. /**
  25932. * - Check whether a specific segment intersects a custom bounding box for the slot.
  25933. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  25934. * Custom bounding boxes need to be customized in Dragonbones Pro.
  25935. * @param xA - The horizontal coordinate of the beginning of the segment.
  25936. * @param yA - The vertical coordinate of the beginning of the segment.
  25937. * @param xB - The horizontal coordinate of the end point of the segment.
  25938. * @param yB - The vertical coordinate of the end point of the segment.
  25939. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  25940. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  25941. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  25942. * @returns Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections]
  25943. * @version DragonBones 5.0
  25944. * @language en_US
  25945. */
  25946. /**
  25947. * - 检查特定线段是否与插槽的自定义边界框相交。
  25948. * 线段和交点的坐标系均为骨架内坐标系。
  25949. * 自定义边界框需要在 DragonBones Pro 中自定义。
  25950. * @param xA - 线段起点的水平坐标。
  25951. * @param yA - 线段起点的垂直坐标。
  25952. * @param xB - 线段终点的水平坐标。
  25953. * @param yB - 线段终点的垂直坐标。
  25954. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  25955. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  25956. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  25957. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  25958. * @version DragonBones 5.0
  25959. * @language zh_CN
  25960. */
  25961. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  25962. x: number;
  25963. y: number;
  25964. } | null, intersectionPointB?: {
  25965. x: number;
  25966. y: number;
  25967. } | null, normalRadians?: {
  25968. x: number;
  25969. y: number;
  25970. } | null): number;
  25971. /**
  25972. * - Forces the slot to update the state of the display object in the next frame.
  25973. * @version DragonBones 4.5
  25974. * @language en_US
  25975. */
  25976. /**
  25977. * - 强制插槽在下一帧更新显示对象的状态。
  25978. * @version DragonBones 4.5
  25979. * @language zh_CN
  25980. */
  25981. invalidUpdate(): void;
  25982. /**
  25983. * - The visible of slot's display object.
  25984. * @default true
  25985. * @version DragonBones 5.6
  25986. * @language en_US
  25987. */
  25988. /**
  25989. * - 插槽的显示对象的可见。
  25990. * @default true
  25991. * @version DragonBones 5.6
  25992. * @language zh_CN
  25993. */
  25994. visible: boolean;
  25995. /**
  25996. * - The index of the display object displayed in the display list.
  25997. * @example
  25998. * <pre>
  25999. * let slot = armature.getSlot("weapon");
  26000. * slot.displayIndex = 3;
  26001. * slot.displayController = "none";
  26002. * </pre>
  26003. * @version DragonBones 4.5
  26004. * @language en_US
  26005. */
  26006. /**
  26007. * - 此时显示的显示对象在显示列表中的索引。
  26008. * @example
  26009. * <pre>
  26010. * let slot = armature.getSlot("weapon");
  26011. * slot.displayIndex = 3;
  26012. * slot.displayController = "none";
  26013. * </pre>
  26014. * @version DragonBones 4.5
  26015. * @language zh_CN
  26016. */
  26017. displayIndex: number;
  26018. /**
  26019. * - The slot name.
  26020. * @see dragonBones.SlotData#name
  26021. * @version DragonBones 3.0
  26022. * @language en_US
  26023. */
  26024. /**
  26025. * - 插槽名称。
  26026. * @see dragonBones.SlotData#name
  26027. * @version DragonBones 3.0
  26028. * @language zh_CN
  26029. */
  26030. readonly name: string;
  26031. /**
  26032. * - Contains a display list of display objects or child armatures.
  26033. * @version DragonBones 3.0
  26034. * @language en_US
  26035. */
  26036. /**
  26037. * - 包含显示对象或子骨架的显示列表。
  26038. * @version DragonBones 3.0
  26039. * @language zh_CN
  26040. */
  26041. displayList: Array<any>;
  26042. /**
  26043. * - The slot data.
  26044. * @see dragonBones.SlotData
  26045. * @version DragonBones 4.5
  26046. * @language en_US
  26047. */
  26048. /**
  26049. * - 插槽数据。
  26050. * @see dragonBones.SlotData
  26051. * @version DragonBones 4.5
  26052. * @language zh_CN
  26053. */
  26054. readonly slotData: SlotData;
  26055. /**
  26056. * @private
  26057. */
  26058. rawDisplayDatas: Array<DisplayData | null> | null;
  26059. /**
  26060. * - The custom bounding box data for the slot at current time.
  26061. * @version DragonBones 5.0
  26062. * @language en_US
  26063. */
  26064. /**
  26065. * - 插槽此时的自定义包围盒数据。
  26066. * @version DragonBones 5.0
  26067. * @language zh_CN
  26068. */
  26069. readonly boundingBoxData: BoundingBoxData | null;
  26070. /**
  26071. * @private
  26072. */
  26073. readonly rawDisplay: any;
  26074. /**
  26075. * @private
  26076. */
  26077. readonly meshDisplay: any;
  26078. /**
  26079. * - The display object that the slot displays at this time.
  26080. * @example
  26081. * <pre>
  26082. * let slot = armature.getSlot("text");
  26083. * slot.display = new yourEngine.TextField();
  26084. * </pre>
  26085. * @version DragonBones 3.0
  26086. * @language en_US
  26087. */
  26088. /**
  26089. * - 插槽此时显示的显示对象。
  26090. * @example
  26091. * <pre>
  26092. * let slot = armature.getSlot("text");
  26093. * slot.display = new yourEngine.TextField();
  26094. * </pre>
  26095. * @version DragonBones 3.0
  26096. * @language zh_CN
  26097. */
  26098. display: any;
  26099. /**
  26100. * - The child armature that the slot displayed at current time.
  26101. * @example
  26102. * <pre>
  26103. * let slot = armature.getSlot("weapon");
  26104. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26105. * </pre>
  26106. * @version DragonBones 3.0
  26107. * @language en_US
  26108. */
  26109. /**
  26110. * - 插槽此时显示的子骨架。
  26111. * @example
  26112. * <pre>
  26113. * let slot = armature.getSlot("weapon");
  26114. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26115. * </pre>
  26116. * @version DragonBones 3.0
  26117. * @language zh_CN
  26118. */
  26119. childArmature: Armature | null;
  26120. /**
  26121. * - Deprecated, please refer to {@link #display}.
  26122. * @deprecated
  26123. * @language en_US
  26124. */
  26125. /**
  26126. * - 已废弃,请参考 {@link #display}。
  26127. * @deprecated
  26128. * @language zh_CN
  26129. */
  26130. getDisplay(): any;
  26131. /**
  26132. * - Deprecated, please refer to {@link #display}.
  26133. * @deprecated
  26134. * @language en_US
  26135. */
  26136. /**
  26137. * - 已废弃,请参考 {@link #display}。
  26138. * @deprecated
  26139. * @language zh_CN
  26140. */
  26141. setDisplay(value: any): void;
  26142. }
  26143. }
  26144. /**
  26145. * The MIT License (MIT)
  26146. *
  26147. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26148. *
  26149. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26150. * this software and associated documentation files (the "Software"), to deal in
  26151. * the Software without restriction, including without limitation the rights to
  26152. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26153. * the Software, and to permit persons to whom the Software is furnished to do so,
  26154. * subject to the following conditions:
  26155. *
  26156. * The above copyright notice and this permission notice shall be included in all
  26157. * copies or substantial portions of the Software.
  26158. *
  26159. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26160. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26161. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26162. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26163. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26164. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26165. */
  26166. declare namespace dragonBones {
  26167. /**
  26168. * @internal
  26169. * @private
  26170. */
  26171. abstract class Constraint extends BaseObject {
  26172. protected static readonly _helpMatrix: Matrix;
  26173. protected static readonly _helpTransform: Transform;
  26174. protected static readonly _helpPoint: Point;
  26175. /**
  26176. * - For timeline state.
  26177. * @internal
  26178. */
  26179. _constraintData: ConstraintData;
  26180. protected _armature: Armature;
  26181. /**
  26182. * - For sort bones.
  26183. * @internal
  26184. */
  26185. _target: Bone;
  26186. /**
  26187. * - For sort bones.
  26188. * @internal
  26189. */
  26190. _root: Bone;
  26191. protected _bone: Bone | null;
  26192. protected _onClear(): void;
  26193. abstract init(constraintData: ConstraintData, armature: Armature): void;
  26194. abstract update(): void;
  26195. abstract invalidUpdate(): void;
  26196. readonly name: string;
  26197. }
  26198. /**
  26199. * @internal
  26200. * @private
  26201. */
  26202. class IKConstraint extends Constraint {
  26203. static toString(): string;
  26204. private _scaleEnabled;
  26205. /**
  26206. * - For timeline state.
  26207. * @internal
  26208. */
  26209. _bendPositive: boolean;
  26210. /**
  26211. * - For timeline state.
  26212. * @internal
  26213. */
  26214. _weight: number;
  26215. protected _onClear(): void;
  26216. private _computeA();
  26217. private _computeB();
  26218. init(constraintData: ConstraintData, armature: Armature): void;
  26219. update(): void;
  26220. invalidUpdate(): void;
  26221. }
  26222. }
  26223. /**
  26224. * The MIT License (MIT)
  26225. *
  26226. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26227. *
  26228. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26229. * this software and associated documentation files (the "Software"), to deal in
  26230. * the Software without restriction, including without limitation the rights to
  26231. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26232. * the Software, and to permit persons to whom the Software is furnished to do so,
  26233. * subject to the following conditions:
  26234. *
  26235. * The above copyright notice and this permission notice shall be included in all
  26236. * copies or substantial portions of the Software.
  26237. *
  26238. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26239. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26240. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26241. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26242. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26243. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26244. */
  26245. declare namespace dragonBones {
  26246. /**
  26247. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  26248. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  26249. * @see dragonBones.WorldClock
  26250. * @see dragonBones.Armature
  26251. * @version DragonBones 3.0
  26252. * @language en_US
  26253. */
  26254. /**
  26255. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  26256. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  26257. * @see dragonBones.WorldClock
  26258. * @see dragonBones.Armature
  26259. * @version DragonBones 3.0
  26260. * @language zh_CN
  26261. */
  26262. interface IAnimatable {
  26263. /**
  26264. * - Advance time.
  26265. * @param passedTime - Passed time. (In seconds)
  26266. * @version DragonBones 3.0
  26267. * @language en_US
  26268. */
  26269. /**
  26270. * - 更新时间。
  26271. * @param passedTime - 前进的时间。 (以秒为单位)
  26272. * @version DragonBones 3.0
  26273. * @language zh_CN
  26274. */
  26275. advanceTime(passedTime: number): void;
  26276. /**
  26277. * - The Wordclock instance to which the current belongs.
  26278. * @example
  26279. * <pre>
  26280. * armature.clock = factory.clock; // Add armature to clock.
  26281. * armature.clock = null; // Remove armature from clock.
  26282. * </pre>
  26283. * @version DragonBones 5.0
  26284. * @language en_US
  26285. */
  26286. /**
  26287. * - 当前所属的 WordClock 实例。
  26288. * @example
  26289. * <pre>
  26290. * armature.clock = factory.clock; // 将骨架添加到时钟。
  26291. * armature.clock = null; // 将骨架从时钟移除。
  26292. * </pre>
  26293. * @version DragonBones 5.0
  26294. * @language zh_CN
  26295. */
  26296. clock: WorldClock | null;
  26297. }
  26298. }
  26299. /**
  26300. * The MIT License (MIT)
  26301. *
  26302. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26303. *
  26304. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26305. * this software and associated documentation files (the "Software"), to deal in
  26306. * the Software without restriction, including without limitation the rights to
  26307. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26308. * the Software, and to permit persons to whom the Software is furnished to do so,
  26309. * subject to the following conditions:
  26310. *
  26311. * The above copyright notice and this permission notice shall be included in all
  26312. * copies or substantial portions of the Software.
  26313. *
  26314. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26315. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26316. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26317. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26318. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26319. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26320. */
  26321. declare namespace dragonBones {
  26322. /**
  26323. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  26324. * @see dragonBones.IAnimateble
  26325. * @see dragonBones.Armature
  26326. * @version DragonBones 3.0
  26327. * @language en_US
  26328. */
  26329. /**
  26330. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  26331. * @see dragonBones.IAnimateble
  26332. * @see dragonBones.Armature
  26333. * @version DragonBones 3.0
  26334. * @language zh_CN
  26335. */
  26336. class WorldClock implements IAnimatable {
  26337. /**
  26338. * - Current time. (In seconds)
  26339. * @version DragonBones 3.0
  26340. * @language en_US
  26341. */
  26342. /**
  26343. * - 当前的时间。 (以秒为单位)
  26344. * @version DragonBones 3.0
  26345. * @language zh_CN
  26346. */
  26347. time: number;
  26348. /**
  26349. * - The play speed, used to control animation speed-shift play.
  26350. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  26351. * @default 1.0
  26352. * @version DragonBones 3.0
  26353. * @language en_US
  26354. */
  26355. /**
  26356. * - 播放速度,用于控制动画变速播放。
  26357. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26358. * @default 1.0
  26359. * @version DragonBones 3.0
  26360. * @language zh_CN
  26361. */
  26362. timeScale: number;
  26363. private readonly _animatebles;
  26364. private _clock;
  26365. /**
  26366. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  26367. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  26368. * @version DragonBones 3.0
  26369. * @language en_US
  26370. */
  26371. /**
  26372. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  26373. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  26374. * @version DragonBones 3.0
  26375. * @language zh_CN
  26376. */
  26377. constructor(time?: number);
  26378. /**
  26379. * - Advance time for all IAnimatable instances.
  26380. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  26381. * @version DragonBones 3.0
  26382. * @language en_US
  26383. */
  26384. /**
  26385. * - 为所有的 IAnimatable 实例更新时间。
  26386. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  26387. * @version DragonBones 3.0
  26388. * @language zh_CN
  26389. */
  26390. advanceTime(passedTime: number): void;
  26391. /**
  26392. * - Check whether contains a specific instance of IAnimatable.
  26393. * @param value - The IAnimatable instance.
  26394. * @version DragonBones 3.0
  26395. * @language en_US
  26396. */
  26397. /**
  26398. * - 检查是否包含特定的 IAnimatable 实例。
  26399. * @param value - IAnimatable 实例。
  26400. * @version DragonBones 3.0
  26401. * @language zh_CN
  26402. */
  26403. contains(value: IAnimatable): boolean;
  26404. /**
  26405. * - Add IAnimatable instance.
  26406. * @param value - The IAnimatable instance.
  26407. * @version DragonBones 3.0
  26408. * @language en_US
  26409. */
  26410. /**
  26411. * - 添加 IAnimatable 实例。
  26412. * @param value - IAnimatable 实例。
  26413. * @version DragonBones 3.0
  26414. * @language zh_CN
  26415. */
  26416. add(value: IAnimatable): void;
  26417. /**
  26418. * - Removes a specified IAnimatable instance.
  26419. * @param value - The IAnimatable instance.
  26420. * @version DragonBones 3.0
  26421. * @language en_US
  26422. */
  26423. /**
  26424. * - 移除特定的 IAnimatable 实例。
  26425. * @param value - IAnimatable 实例。
  26426. * @version DragonBones 3.0
  26427. * @language zh_CN
  26428. */
  26429. remove(value: IAnimatable): void;
  26430. /**
  26431. * - Clear all IAnimatable instances.
  26432. * @version DragonBones 3.0
  26433. * @language en_US
  26434. */
  26435. /**
  26436. * - 清除所有的 IAnimatable 实例。
  26437. * @version DragonBones 3.0
  26438. * @language zh_CN
  26439. */
  26440. clear(): void;
  26441. /**
  26442. * @inheritDoc
  26443. */
  26444. clock: WorldClock | null;
  26445. /**
  26446. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  26447. * @deprecated
  26448. * @language en_US
  26449. */
  26450. /**
  26451. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  26452. * @deprecated
  26453. * @language zh_CN
  26454. */
  26455. static readonly clock: WorldClock;
  26456. }
  26457. }
  26458. /**
  26459. * The MIT License (MIT)
  26460. *
  26461. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26462. *
  26463. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26464. * this software and associated documentation files (the "Software"), to deal in
  26465. * the Software without restriction, including without limitation the rights to
  26466. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26467. * the Software, and to permit persons to whom the Software is furnished to do so,
  26468. * subject to the following conditions:
  26469. *
  26470. * The above copyright notice and this permission notice shall be included in all
  26471. * copies or substantial portions of the Software.
  26472. *
  26473. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26474. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26475. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26476. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26477. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26478. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26479. */
  26480. declare namespace dragonBones {
  26481. /**
  26482. * - The animation player is used to play the animation data and manage the animation states.
  26483. * @see dragonBones.AnimationData
  26484. * @see dragonBones.AnimationState
  26485. * @version DragonBones 3.0
  26486. * @language en_US
  26487. */
  26488. /**
  26489. * - 动画播放器用来播放动画数据和管理动画状态。
  26490. * @see dragonBones.AnimationData
  26491. * @see dragonBones.AnimationState
  26492. * @version DragonBones 3.0
  26493. * @language zh_CN
  26494. */
  26495. class Animation extends BaseObject {
  26496. static toString(): string;
  26497. /**
  26498. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  26499. * @default 1.0
  26500. * @version DragonBones 3.0
  26501. * @language en_US
  26502. */
  26503. /**
  26504. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26505. * @default 1.0
  26506. * @version DragonBones 3.0
  26507. * @language zh_CN
  26508. */
  26509. timeScale: number;
  26510. private _lockUpdate;
  26511. private _animationDirty;
  26512. private _inheritTimeScale;
  26513. private readonly _animationNames;
  26514. private readonly _animationStates;
  26515. private readonly _animations;
  26516. private _armature;
  26517. private _animationConfig;
  26518. private _lastAnimationState;
  26519. /**
  26520. * @private
  26521. */
  26522. protected _onClear(): void;
  26523. private _fadeOut(animationConfig);
  26524. /**
  26525. * @internal
  26526. * @private
  26527. */
  26528. init(armature: Armature): void;
  26529. /**
  26530. * @internal
  26531. * @private
  26532. */
  26533. advanceTime(passedTime: number): void;
  26534. /**
  26535. * - Clear all animations states.
  26536. * @see dragonBones.AnimationState
  26537. * @version DragonBones 4.5
  26538. * @language en_US
  26539. */
  26540. /**
  26541. * - 清除所有的动画状态。
  26542. * @see dragonBones.AnimationState
  26543. * @version DragonBones 4.5
  26544. * @language zh_CN
  26545. */
  26546. reset(): void;
  26547. /**
  26548. * - Pause a specific animation state.
  26549. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  26550. * @see dragonBones.AnimationState
  26551. * @version DragonBones 3.0
  26552. * @language en_US
  26553. */
  26554. /**
  26555. * - 暂停指定动画状态的播放。
  26556. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  26557. * @see dragonBones.AnimationState
  26558. * @version DragonBones 3.0
  26559. * @language zh_CN
  26560. */
  26561. stop(animationName?: string | null): void;
  26562. /**
  26563. * - Play animation with a specific animation config.
  26564. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  26565. * @param animationConfig - The animation config.
  26566. * @returns The playing animation state.
  26567. * @see dragonBones.AnimationConfig
  26568. * @beta
  26569. * @version DragonBones 5.0
  26570. * @language en_US
  26571. */
  26572. /**
  26573. * - 通过指定的动画配置来播放动画。
  26574. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  26575. * @param animationConfig - 动画配置。
  26576. * @returns 播放的动画状态。
  26577. * @see dragonBones.AnimationConfig
  26578. * @beta
  26579. * @version DragonBones 5.0
  26580. * @language zh_CN
  26581. */
  26582. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  26583. /**
  26584. * - Play a specific animation.
  26585. * @param animationName - The name of animation data. (If not set, The default animation will be played, or resume the animation playing from pause status, or replay the last playing animation)
  26586. * @param playTimes - Playing repeat times. [-1: Use default value of the animation data, 0: No end loop playing, [1~N]: Repeat N times] (default: -1)
  26587. * @returns The playing animation state.
  26588. * @example
  26589. * <pre>
  26590. * armature.animation.play("walk");
  26591. * </pre>
  26592. * @version DragonBones 3.0
  26593. * @language en_US
  26594. */
  26595. /**
  26596. * - 播放指定动画。
  26597. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  26598. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26599. * @returns 播放的动画状态。
  26600. * @example
  26601. * <pre>
  26602. * armature.animation.play("walk");
  26603. * </pre>
  26604. * @version DragonBones 3.0
  26605. * @language zh_CN
  26606. */
  26607. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  26608. /**
  26609. * - Fade in a specific animation.
  26610. * @param animationName - The name of animation data.
  26611. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  26612. * @param playTimes - playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26613. * @param layer - The blending layer, the animation states in high level layer will get the blending weights with high priority, when the total blending weights are more than 1.0, there will be no more weights can be allocated to the other animation states. (Default: 0)
  26614. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  26615. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  26616. * @returns The playing animation state.
  26617. * @example
  26618. * <pre>
  26619. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26620. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26621. * </pre>
  26622. * @version DragonBones 4.5
  26623. * @language en_US
  26624. */
  26625. /**
  26626. * - 淡入播放指定的动画。
  26627. * @param animationName - 动画数据名称。
  26628. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  26629. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26630. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  26631. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  26632. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  26633. * @returns 播放的动画状态。
  26634. * @example
  26635. * <pre>
  26636. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26637. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26638. * </pre>
  26639. * @version DragonBones 4.5
  26640. * @language zh_CN
  26641. */
  26642. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
  26643. /**
  26644. * - Play a specific animation from the specific time.
  26645. * @param animationName - The name of animation data.
  26646. * @param time - The start time point of playing. (In seconds)
  26647. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26648. * @returns The played animation state.
  26649. * @version DragonBones 4.5
  26650. * @language en_US
  26651. */
  26652. /**
  26653. * - 从指定时间开始播放指定的动画。
  26654. * @param animationName - 动画数据名称。
  26655. * @param time - 播放开始的时间。 (以秒为单位)
  26656. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26657. * @returns 播放的动画状态。
  26658. * @version DragonBones 4.5
  26659. * @language zh_CN
  26660. */
  26661. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  26662. /**
  26663. * - Play a specific animation from the specific frame.
  26664. * @param animationName - The name of animation data.
  26665. * @param frame - The start frame of playing.
  26666. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26667. * @returns The played animation state.
  26668. * @version DragonBones 4.5
  26669. * @language en_US
  26670. */
  26671. /**
  26672. * - 从指定帧开始播放指定的动画。
  26673. * @param animationName - 动画数据名称。
  26674. * @param frame - 播放开始的帧数。
  26675. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26676. * @returns 播放的动画状态。
  26677. * @version DragonBones 4.5
  26678. * @language zh_CN
  26679. */
  26680. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  26681. /**
  26682. * - Play a specific animation from the specific progress.
  26683. * @param animationName - The name of animation data.
  26684. * @param progress - The start progress value of playing.
  26685. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26686. * @returns The played animation state.
  26687. * @version DragonBones 4.5
  26688. * @language en_US
  26689. */
  26690. /**
  26691. * - 从指定进度开始播放指定的动画。
  26692. * @param animationName - 动画数据名称。
  26693. * @param progress - 开始播放的进度。
  26694. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26695. * @returns 播放的动画状态。
  26696. * @version DragonBones 4.5
  26697. * @language zh_CN
  26698. */
  26699. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  26700. /**
  26701. * - Stop a specific animation at the specific time.
  26702. * @param animationName - The name of animation data.
  26703. * @param time - The stop time. (In seconds)
  26704. * @returns The played animation state.
  26705. * @version DragonBones 4.5
  26706. * @language en_US
  26707. */
  26708. /**
  26709. * - 在指定时间停止指定动画播放
  26710. * @param animationName - 动画数据名称。
  26711. * @param time - 停止的时间。 (以秒为单位)
  26712. * @returns 播放的动画状态。
  26713. * @version DragonBones 4.5
  26714. * @language zh_CN
  26715. */
  26716. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  26717. /**
  26718. * - Stop a specific animation at the specific frame.
  26719. * @param animationName - The name of animation data.
  26720. * @param frame - The stop frame.
  26721. * @returns The played animation state.
  26722. * @version DragonBones 4.5
  26723. * @language en_US
  26724. */
  26725. /**
  26726. * - 在指定帧停止指定动画的播放
  26727. * @param animationName - 动画数据名称。
  26728. * @param frame - 停止的帧数。
  26729. * @returns 播放的动画状态。
  26730. * @version DragonBones 4.5
  26731. * @language zh_CN
  26732. */
  26733. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  26734. /**
  26735. * - Stop a specific animation at the specific progress.
  26736. * @param animationName - The name of animation data.
  26737. * @param progress - The stop progress value.
  26738. * @returns The played animation state.
  26739. * @version DragonBones 4.5
  26740. * @language en_US
  26741. */
  26742. /**
  26743. * - 在指定的进度停止指定的动画播放。
  26744. * @param animationName - 动画数据名称。
  26745. * @param progress - 停止进度。
  26746. * @returns 播放的动画状态。
  26747. * @version DragonBones 4.5
  26748. * @language zh_CN
  26749. */
  26750. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  26751. /**
  26752. * - Get a specific animation state.
  26753. * @param animationName - The name of animation state.
  26754. * @example
  26755. * <pre>
  26756. * armature.animation.play("walk");
  26757. * let walkState = armature.animation.getState("walk");
  26758. * walkState.timeScale = 0.5;
  26759. * </pre>
  26760. * @version DragonBones 3.0
  26761. * @language en_US
  26762. */
  26763. /**
  26764. * - 获取指定的动画状态
  26765. * @param animationName - 动画状态名称。
  26766. * @example
  26767. * <pre>
  26768. * armature.animation.play("walk");
  26769. * let walkState = armature.animation.getState("walk");
  26770. * walkState.timeScale = 0.5;
  26771. * </pre>
  26772. * @version DragonBones 3.0
  26773. * @language zh_CN
  26774. */
  26775. getState(animationName: string): AnimationState | null;
  26776. /**
  26777. * - Check whether a specific animation data is included.
  26778. * @param animationName - The name of animation data.
  26779. * @see dragonBones.AnimationData
  26780. * @version DragonBones 3.0
  26781. * @language en_US
  26782. */
  26783. /**
  26784. * - 检查是否包含指定的动画数据
  26785. * @param animationName - 动画数据名称。
  26786. * @see dragonBones.AnimationData
  26787. * @version DragonBones 3.0
  26788. * @language zh_CN
  26789. */
  26790. hasAnimation(animationName: string): boolean;
  26791. /**
  26792. * - Get all the animation states.
  26793. * @version DragonBones 5.1
  26794. * @language en_US
  26795. */
  26796. /**
  26797. * - 获取所有的动画状态
  26798. * @version DragonBones 5.1
  26799. * @language zh_CN
  26800. */
  26801. getStates(): Array<AnimationState>;
  26802. /**
  26803. * - Check whether there is an animation state is playing
  26804. * @see dragonBones.AnimationState
  26805. * @version DragonBones 3.0
  26806. * @language en_US
  26807. */
  26808. /**
  26809. * - 检查是否有动画状态正在播放
  26810. * @see dragonBones.AnimationState
  26811. * @version DragonBones 3.0
  26812. * @language zh_CN
  26813. */
  26814. readonly isPlaying: boolean;
  26815. /**
  26816. * - Check whether all the animation states' playing were finished.
  26817. * @see dragonBones.AnimationState
  26818. * @version DragonBones 3.0
  26819. * @language en_US
  26820. */
  26821. /**
  26822. * - 检查是否所有的动画状态均已播放完毕。
  26823. * @see dragonBones.AnimationState
  26824. * @version DragonBones 3.0
  26825. * @language zh_CN
  26826. */
  26827. readonly isCompleted: boolean;
  26828. /**
  26829. * - The name of the last playing animation state.
  26830. * @see #lastAnimationState
  26831. * @version DragonBones 3.0
  26832. * @language en_US
  26833. */
  26834. /**
  26835. * - 上一个播放的动画状态名称
  26836. * @see #lastAnimationState
  26837. * @version DragonBones 3.0
  26838. * @language zh_CN
  26839. */
  26840. readonly lastAnimationName: string;
  26841. /**
  26842. * - The name of all animation data
  26843. * @version DragonBones 4.5
  26844. * @language en_US
  26845. */
  26846. /**
  26847. * - 所有动画数据的名称
  26848. * @version DragonBones 4.5
  26849. * @language zh_CN
  26850. */
  26851. readonly animationNames: Array<string>;
  26852. /**
  26853. * - All animation data.
  26854. * @version DragonBones 4.5
  26855. * @language en_US
  26856. */
  26857. /**
  26858. * - 所有的动画数据。
  26859. * @version DragonBones 4.5
  26860. * @language zh_CN
  26861. */
  26862. animations: Map<AnimationData>;
  26863. /**
  26864. * - An AnimationConfig instance that can be used quickly.
  26865. * @see dragonBones.AnimationConfig
  26866. * @version DragonBones 5.0
  26867. * @language en_US
  26868. */
  26869. /**
  26870. * - 一个可以快速使用的动画配置实例。
  26871. * @see dragonBones.AnimationConfig
  26872. * @version DragonBones 5.0
  26873. * @language zh_CN
  26874. */
  26875. readonly animationConfig: AnimationConfig;
  26876. /**
  26877. * - The last playing animation state
  26878. * @see dragonBones.AnimationState
  26879. * @version DragonBones 3.0
  26880. * @language en_US
  26881. */
  26882. /**
  26883. * - 上一个播放的动画状态
  26884. * @see dragonBones.AnimationState
  26885. * @version DragonBones 3.0
  26886. * @language zh_CN
  26887. */
  26888. readonly lastAnimationState: AnimationState | null;
  26889. /**
  26890. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  26891. * @deprecated
  26892. * @language en_US
  26893. */
  26894. /**
  26895. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  26896. * @deprecated
  26897. * @language zh_CN
  26898. */
  26899. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  26900. /**
  26901. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  26902. * @deprecated
  26903. * @language en_US
  26904. */
  26905. /**
  26906. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  26907. * @deprecated
  26908. * @language zh_CN
  26909. */
  26910. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  26911. /**
  26912. * - Deprecated, please refer to {@link #animationNames}.
  26913. * @deprecated
  26914. * @language en_US
  26915. */
  26916. /**
  26917. * - 已废弃,请参考 {@link #animationNames}。
  26918. * @deprecated
  26919. * @language zh_CN
  26920. */
  26921. readonly animationList: Array<string>;
  26922. /**
  26923. * - Deprecated, please refer to {@link #animationNames}.
  26924. * @deprecated
  26925. * @language en_US
  26926. */
  26927. /**
  26928. * - 已废弃,请参考 {@link #animationNames}。
  26929. * @deprecated
  26930. * @language zh_CN
  26931. */
  26932. readonly animationDataList: Array<AnimationData>;
  26933. }
  26934. }
  26935. /**
  26936. * The MIT License (MIT)
  26937. *
  26938. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26939. *
  26940. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26941. * this software and associated documentation files (the "Software"), to deal in
  26942. * the Software without restriction, including without limitation the rights to
  26943. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26944. * the Software, and to permit persons to whom the Software is furnished to do so,
  26945. * subject to the following conditions:
  26946. *
  26947. * The above copyright notice and this permission notice shall be included in all
  26948. * copies or substantial portions of the Software.
  26949. *
  26950. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26951. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26952. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26953. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26954. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26955. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26956. */
  26957. declare namespace dragonBones {
  26958. /**
  26959. * - The animation state is generated when the animation data is played.
  26960. * @see dragonBones.Animation
  26961. * @see dragonBones.AnimationData
  26962. * @version DragonBones 3.0
  26963. * @language en_US
  26964. */
  26965. /**
  26966. * - 动画状态由播放动画数据时产生。
  26967. * @see dragonBones.Animation
  26968. * @see dragonBones.AnimationData
  26969. * @version DragonBones 3.0
  26970. * @language zh_CN
  26971. */
  26972. class AnimationState extends BaseObject {
  26973. static toString(): string;
  26974. /**
  26975. * @private
  26976. */
  26977. actionEnabled: boolean;
  26978. /**
  26979. * @private
  26980. */
  26981. additiveBlending: boolean;
  26982. /**
  26983. * - Whether the animation state has control over the display object properties of the slots.
  26984. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  26985. * especially if other animation state are controlling the display object properties of the slots.
  26986. * @default true
  26987. * @version DragonBones 5.0
  26988. * @language en_US
  26989. */
  26990. /**
  26991. * - 动画状态是否对插槽的显示对象属性有控制权。
  26992. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  26993. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  26994. * @default true
  26995. * @version DragonBones 5.0
  26996. * @language zh_CN
  26997. */
  26998. displayControl: boolean;
  26999. /**
  27000. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  27001. * This property should usually be set to false when blend multiple animation states.
  27002. * @default true
  27003. * @version DragonBones 5.1
  27004. * @language en_US
  27005. */
  27006. /**
  27007. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  27008. * 通常在混合多个动画状态时应该将该属性设置为 false。
  27009. * @default true
  27010. * @version DragonBones 5.1
  27011. * @language zh_CN
  27012. */
  27013. resetToPose: boolean;
  27014. /**
  27015. * - The play times. [0: Loop play, [1~N]: Play N times]
  27016. * @version DragonBones 3.0
  27017. * @language en_US
  27018. */
  27019. /**
  27020. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  27021. * @version DragonBones 3.0
  27022. * @language zh_CN
  27023. */
  27024. playTimes: number;
  27025. /**
  27026. * - The blend layer.
  27027. * High layer animation state will get the blend weight first.
  27028. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  27029. * @readonly
  27030. * @version DragonBones 5.0
  27031. * @language en_US
  27032. */
  27033. /**
  27034. * - 混合图层。
  27035. * 图层高的动画状态会优先获取混合权重。
  27036. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  27037. * @readonly
  27038. * @version DragonBones 5.0
  27039. * @language zh_CN
  27040. */
  27041. layer: number;
  27042. /**
  27043. * - The play speed.
  27044. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  27045. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  27046. * @default 1.0
  27047. * @version DragonBones 3.0
  27048. * @language en_US
  27049. */
  27050. /**
  27051. * - 播放速度。
  27052. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  27053. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  27054. * @default 1.0
  27055. * @version DragonBones 3.0
  27056. * @language zh_CN
  27057. */
  27058. timeScale: number;
  27059. /**
  27060. * - The blend weight.
  27061. * @default 1.0
  27062. * @version DragonBones 5.0
  27063. * @language en_US
  27064. */
  27065. /**
  27066. * - 混合权重。
  27067. * @default 1.0
  27068. * @version DragonBones 5.0
  27069. * @language zh_CN
  27070. */
  27071. weight: number;
  27072. /**
  27073. * - The auto fade out time when the animation state play completed.
  27074. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  27075. * @default -1.0
  27076. * @version DragonBones 5.0
  27077. * @language en_US
  27078. */
  27079. /**
  27080. * - 动画状态播放完成后的自动淡出时间。
  27081. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  27082. * @default -1.0
  27083. * @version DragonBones 5.0
  27084. * @language zh_CN
  27085. */
  27086. autoFadeOutTime: number;
  27087. /**
  27088. * @private
  27089. */
  27090. fadeTotalTime: number;
  27091. /**
  27092. * - The name of the animation state. (Can be different from the name of the animation data)
  27093. * @readonly
  27094. * @version DragonBones 5.0
  27095. * @language en_US
  27096. */
  27097. /**
  27098. * - 动画状态名称。 (可以不同于动画数据)
  27099. * @readonly
  27100. * @version DragonBones 5.0
  27101. * @language zh_CN
  27102. */
  27103. name: string;
  27104. /**
  27105. * - The blend group name of the animation state.
  27106. * This property is typically used to specify the substitution of multiple animation states blend.
  27107. * @readonly
  27108. * @version DragonBones 5.0
  27109. * @language en_US
  27110. */
  27111. /**
  27112. * - 混合组名称。
  27113. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  27114. * @readonly
  27115. * @version DragonBones 5.0
  27116. * @language zh_CN
  27117. */
  27118. group: string;
  27119. private _timelineDirty;
  27120. /**
  27121. * - xx: Play Enabled, Fade Play Enabled
  27122. * @internal
  27123. * @private
  27124. */
  27125. _playheadState: number;
  27126. /**
  27127. * -1: Fade in, 0: Fade complete, 1: Fade out;
  27128. * @internal
  27129. * @private
  27130. */
  27131. _fadeState: number;
  27132. /**
  27133. * -1: Fade start, 0: Fading, 1: Fade complete;
  27134. * @internal
  27135. * @private
  27136. */
  27137. _subFadeState: number;
  27138. /**
  27139. * @internal
  27140. * @private
  27141. */
  27142. _position: number;
  27143. /**
  27144. * @internal
  27145. * @private
  27146. */
  27147. _duration: number;
  27148. private _fadeTime;
  27149. private _time;
  27150. /**
  27151. * @internal
  27152. * @private
  27153. */
  27154. _fadeProgress: number;
  27155. /**
  27156. * @internal
  27157. * @private
  27158. */
  27159. _weightResult: number;
  27160. /**
  27161. * @internal
  27162. * @private
  27163. */
  27164. readonly _blendState: BlendState;
  27165. private readonly _boneMask;
  27166. private readonly _boneTimelines;
  27167. private readonly _surfaceTimelines;
  27168. private readonly _slotTimelines;
  27169. private readonly _constraintTimelines;
  27170. private readonly _animationTimelines;
  27171. private readonly _poseTimelines;
  27172. private readonly _bonePoses;
  27173. /**
  27174. * @internal
  27175. * @private
  27176. */
  27177. _animationData: AnimationData;
  27178. private _armature;
  27179. /**
  27180. * @internal
  27181. * @private
  27182. */
  27183. _actionTimeline: ActionTimelineState;
  27184. private _zOrderTimeline;
  27185. /**
  27186. * @internal
  27187. * @private
  27188. */
  27189. _parent: AnimationState;
  27190. /**
  27191. * @private
  27192. */
  27193. protected _onClear(): void;
  27194. private _updateTimelines();
  27195. private _updateBoneAndSlotTimelines();
  27196. private _advanceFadeTime(passedTime);
  27197. /**
  27198. * @internal
  27199. * @private
  27200. */
  27201. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  27202. /**
  27203. * @internal
  27204. * @private
  27205. */
  27206. advanceTime(passedTime: number, cacheFrameRate: number): void;
  27207. /**
  27208. * - Continue play.
  27209. * @version DragonBones 3.0
  27210. * @language en_US
  27211. */
  27212. /**
  27213. * - 继续播放。
  27214. * @version DragonBones 3.0
  27215. * @language zh_CN
  27216. */
  27217. play(): void;
  27218. /**
  27219. * - Stop play.
  27220. * @version DragonBones 3.0
  27221. * @language en_US
  27222. */
  27223. /**
  27224. * - 暂停播放。
  27225. * @version DragonBones 3.0
  27226. * @language zh_CN
  27227. */
  27228. stop(): void;
  27229. /**
  27230. * - Fade out the animation state.
  27231. * @param fadeOutTime - The fade out time. (In seconds)
  27232. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  27233. * @version DragonBones 3.0
  27234. * @language en_US
  27235. */
  27236. /**
  27237. * - 淡出动画状态。
  27238. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  27239. * @param pausePlayhead - 淡出时是否暂停播放。
  27240. * @version DragonBones 3.0
  27241. * @language zh_CN
  27242. */
  27243. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  27244. /**
  27245. * - Check if a specific bone mask is included.
  27246. * @param name - The bone name.
  27247. * @version DragonBones 3.0
  27248. * @language en_US
  27249. */
  27250. /**
  27251. * - 检查是否包含特定骨骼遮罩。
  27252. * @param name - 骨骼名称。
  27253. * @version DragonBones 3.0
  27254. * @language zh_CN
  27255. */
  27256. containsBoneMask(name: string): boolean;
  27257. /**
  27258. * - Add a specific bone mask.
  27259. * @param name - The bone name.
  27260. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  27261. * @version DragonBones 3.0
  27262. * @language en_US
  27263. */
  27264. /**
  27265. * - 添加特定的骨骼遮罩。
  27266. * @param name - 骨骼名称。
  27267. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  27268. * @version DragonBones 3.0
  27269. * @language zh_CN
  27270. */
  27271. addBoneMask(name: string, recursive?: boolean): void;
  27272. /**
  27273. * - Remove the mask of a specific bone.
  27274. * @param name - The bone name.
  27275. * @param recursive - Whether to remove the bone's sub-bone mask.
  27276. * @version DragonBones 3.0
  27277. * @language en_US
  27278. */
  27279. /**
  27280. * - 删除特定骨骼的遮罩。
  27281. * @param name - 骨骼名称。
  27282. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  27283. * @version DragonBones 3.0
  27284. * @language zh_CN
  27285. */
  27286. removeBoneMask(name: string, recursive?: boolean): void;
  27287. /**
  27288. * - Remove all bone masks.
  27289. * @version DragonBones 3.0
  27290. * @language en_US
  27291. */
  27292. /**
  27293. * - 删除所有骨骼遮罩。
  27294. * @version DragonBones 3.0
  27295. * @language zh_CN
  27296. */
  27297. removeAllBoneMask(): void;
  27298. /**
  27299. * - Whether the animation state is fading in.
  27300. * @version DragonBones 5.1
  27301. * @language en_US
  27302. */
  27303. /**
  27304. * - 是否正在淡入。
  27305. * @version DragonBones 5.1
  27306. * @language zh_CN
  27307. */
  27308. readonly isFadeIn: boolean;
  27309. /**
  27310. * - Whether the animation state is fading out.
  27311. * @version DragonBones 5.1
  27312. * @language en_US
  27313. */
  27314. /**
  27315. * - 是否正在淡出。
  27316. * @version DragonBones 5.1
  27317. * @language zh_CN
  27318. */
  27319. readonly isFadeOut: boolean;
  27320. /**
  27321. * - Whether the animation state is fade completed.
  27322. * @version DragonBones 5.1
  27323. * @language en_US
  27324. */
  27325. /**
  27326. * - 是否淡入或淡出完毕。
  27327. * @version DragonBones 5.1
  27328. * @language zh_CN
  27329. */
  27330. readonly isFadeComplete: boolean;
  27331. /**
  27332. * - Whether the animation state is playing.
  27333. * @version DragonBones 3.0
  27334. * @language en_US
  27335. */
  27336. /**
  27337. * - 是否正在播放。
  27338. * @version DragonBones 3.0
  27339. * @language zh_CN
  27340. */
  27341. readonly isPlaying: boolean;
  27342. /**
  27343. * - Whether the animation state is play completed.
  27344. * @version DragonBones 3.0
  27345. * @language en_US
  27346. */
  27347. /**
  27348. * - 是否播放完毕。
  27349. * @version DragonBones 3.0
  27350. * @language zh_CN
  27351. */
  27352. readonly isCompleted: boolean;
  27353. /**
  27354. * - The times has been played.
  27355. * @version DragonBones 3.0
  27356. * @language en_US
  27357. */
  27358. /**
  27359. * - 已经循环播放的次数。
  27360. * @version DragonBones 3.0
  27361. * @language zh_CN
  27362. */
  27363. readonly currentPlayTimes: number;
  27364. /**
  27365. * - The total time. (In seconds)
  27366. * @version DragonBones 3.0
  27367. * @language en_US
  27368. */
  27369. /**
  27370. * - 总播放时间。 (以秒为单位)
  27371. * @version DragonBones 3.0
  27372. * @language zh_CN
  27373. */
  27374. readonly totalTime: number;
  27375. /**
  27376. * - The time is currently playing. (In seconds)
  27377. * @version DragonBones 3.0
  27378. * @language en_US
  27379. */
  27380. /**
  27381. * - 当前播放的时间。 (以秒为单位)
  27382. * @version DragonBones 3.0
  27383. * @language zh_CN
  27384. */
  27385. currentTime: number;
  27386. /**
  27387. * - The animation data.
  27388. * @see dragonBones.AnimationData
  27389. * @version DragonBones 3.0
  27390. * @language en_US
  27391. */
  27392. /**
  27393. * - 动画数据。
  27394. * @see dragonBones.AnimationData
  27395. * @version DragonBones 3.0
  27396. * @language zh_CN
  27397. */
  27398. readonly animationData: AnimationData;
  27399. }
  27400. /**
  27401. * @internal
  27402. * @private
  27403. */
  27404. class BonePose extends BaseObject {
  27405. static toString(): string;
  27406. readonly current: Transform;
  27407. readonly delta: Transform;
  27408. readonly result: Transform;
  27409. protected _onClear(): void;
  27410. }
  27411. /**
  27412. * @internal
  27413. * @private
  27414. */
  27415. class BlendState {
  27416. dirty: boolean;
  27417. layer: number;
  27418. leftWeight: number;
  27419. layerWeight: number;
  27420. blendWeight: number;
  27421. update(weight: number, layer: number): number;
  27422. clear(): void;
  27423. }
  27424. }
  27425. /**
  27426. * The MIT License (MIT)
  27427. *
  27428. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27429. *
  27430. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27431. * this software and associated documentation files (the "Software"), to deal in
  27432. * the Software without restriction, including without limitation the rights to
  27433. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27434. * the Software, and to permit persons to whom the Software is furnished to do so,
  27435. * subject to the following conditions:
  27436. *
  27437. * The above copyright notice and this permission notice shall be included in all
  27438. * copies or substantial portions of the Software.
  27439. *
  27440. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27441. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27442. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27443. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27444. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27445. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27446. */
  27447. declare namespace dragonBones {
  27448. /**
  27449. * @internal
  27450. * @private
  27451. */
  27452. const enum TweenState {
  27453. None = 0,
  27454. Once = 1,
  27455. Always = 2,
  27456. }
  27457. /**
  27458. * @internal
  27459. * @private
  27460. */
  27461. abstract class TimelineState extends BaseObject {
  27462. playState: number;
  27463. currentPlayTimes: number;
  27464. currentTime: number;
  27465. protected _tweenState: TweenState;
  27466. protected _frameRate: number;
  27467. protected _frameValueOffset: number;
  27468. protected _frameCount: number;
  27469. protected _frameOffset: number;
  27470. protected _frameIndex: number;
  27471. protected _frameRateR: number;
  27472. protected _position: number;
  27473. protected _duration: number;
  27474. protected _timeScale: number;
  27475. protected _timeOffset: number;
  27476. protected _dragonBonesData: DragonBonesData;
  27477. protected _animationData: AnimationData;
  27478. protected _timelineData: TimelineData | null;
  27479. protected _armature: Armature;
  27480. protected _animationState: AnimationState;
  27481. protected _actionTimeline: TimelineState;
  27482. protected _frameArray: Array<number> | Int16Array;
  27483. protected _frameIntArray: Array<number> | Int16Array;
  27484. protected _frameFloatArray: Array<number> | Int16Array;
  27485. protected _timelineArray: Array<number> | Uint16Array;
  27486. protected _frameIndices: Array<number>;
  27487. protected _onClear(): void;
  27488. protected abstract _onArriveAtFrame(): void;
  27489. protected abstract _onUpdateFrame(): void;
  27490. protected _setCurrentTime(passedTime: number): boolean;
  27491. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27492. fadeOut(): void;
  27493. update(passedTime: number): void;
  27494. }
  27495. /**
  27496. * @internal
  27497. * @private
  27498. */
  27499. abstract class TweenTimelineState extends TimelineState {
  27500. private static _getEasingValue(tweenType, progress, easing);
  27501. private static _getEasingCurveValue(progress, samples, count, offset);
  27502. protected _tweenType: TweenType;
  27503. protected _curveCount: number;
  27504. protected _framePosition: number;
  27505. protected _frameDurationR: number;
  27506. protected _tweenProgress: number;
  27507. protected _tweenEasing: number;
  27508. protected _onClear(): void;
  27509. protected _onArriveAtFrame(): void;
  27510. protected _onUpdateFrame(): void;
  27511. }
  27512. /**
  27513. * @internal
  27514. * @private
  27515. */
  27516. abstract class BoneTimelineState extends TweenTimelineState {
  27517. bone: Bone;
  27518. bonePose: BonePose;
  27519. protected _onClear(): void;
  27520. blend(state: number): void;
  27521. }
  27522. /**
  27523. * @internal
  27524. * @private
  27525. */
  27526. abstract class SlotTimelineState extends TweenTimelineState {
  27527. slot: Slot;
  27528. protected _onClear(): void;
  27529. }
  27530. /**
  27531. * @internal
  27532. * @private
  27533. */
  27534. abstract class ConstraintTimelineState extends TweenTimelineState {
  27535. constraint: Constraint;
  27536. protected _onClear(): void;
  27537. }
  27538. }
  27539. /**
  27540. * The MIT License (MIT)
  27541. *
  27542. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27543. *
  27544. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27545. * this software and associated documentation files (the "Software"), to deal in
  27546. * the Software without restriction, including without limitation the rights to
  27547. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27548. * the Software, and to permit persons to whom the Software is furnished to do so,
  27549. * subject to the following conditions:
  27550. *
  27551. * The above copyright notice and this permission notice shall be included in all
  27552. * copies or substantial portions of the Software.
  27553. *
  27554. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27555. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27556. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27557. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27558. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27559. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27560. */
  27561. declare namespace dragonBones {
  27562. /**
  27563. * @internal
  27564. * @private
  27565. */
  27566. class ActionTimelineState extends TimelineState {
  27567. static toString(): string;
  27568. private _onCrossFrame(frameIndex);
  27569. protected _onArriveAtFrame(): void;
  27570. protected _onUpdateFrame(): void;
  27571. update(passedTime: number): void;
  27572. setCurrentTime(value: number): void;
  27573. }
  27574. /**
  27575. * @internal
  27576. * @private
  27577. */
  27578. class ZOrderTimelineState extends TimelineState {
  27579. static toString(): string;
  27580. protected _onArriveAtFrame(): void;
  27581. protected _onUpdateFrame(): void;
  27582. }
  27583. /**
  27584. * @internal
  27585. * @private
  27586. */
  27587. class BoneAllTimelineState extends BoneTimelineState {
  27588. static toString(): string;
  27589. protected _onArriveAtFrame(): void;
  27590. protected _onUpdateFrame(): void;
  27591. fadeOut(): void;
  27592. }
  27593. /**
  27594. * @internal
  27595. * @private
  27596. */
  27597. class BoneTranslateTimelineState extends BoneTimelineState {
  27598. static toString(): string;
  27599. protected _onArriveAtFrame(): void;
  27600. protected _onUpdateFrame(): void;
  27601. }
  27602. /**
  27603. * @internal
  27604. * @private
  27605. */
  27606. class BoneRotateTimelineState extends BoneTimelineState {
  27607. static toString(): string;
  27608. protected _onArriveAtFrame(): void;
  27609. protected _onUpdateFrame(): void;
  27610. fadeOut(): void;
  27611. }
  27612. /**
  27613. * @internal
  27614. * @private
  27615. */
  27616. class BoneScaleTimelineState extends BoneTimelineState {
  27617. static toString(): string;
  27618. protected _onArriveAtFrame(): void;
  27619. protected _onUpdateFrame(): void;
  27620. }
  27621. /**
  27622. * @internal
  27623. * @private
  27624. */
  27625. class SurfaceTimelineState extends TweenTimelineState {
  27626. static toString(): string;
  27627. surface: Surface;
  27628. private _frameFloatOffset;
  27629. private _valueCount;
  27630. private _deformCount;
  27631. private _valueOffset;
  27632. private readonly _current;
  27633. private readonly _delta;
  27634. private readonly _result;
  27635. protected _onClear(): void;
  27636. protected _onArriveAtFrame(): void;
  27637. protected _onUpdateFrame(): void;
  27638. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27639. blend(state: number): void;
  27640. }
  27641. /**
  27642. * @internal
  27643. * @private
  27644. */
  27645. class SlotDislayTimelineState extends SlotTimelineState {
  27646. static toString(): string;
  27647. protected _onArriveAtFrame(): void;
  27648. }
  27649. /**
  27650. * @internal
  27651. * @private
  27652. */
  27653. class SlotColorTimelineState extends SlotTimelineState {
  27654. static toString(): string;
  27655. private _dirty;
  27656. private readonly _current;
  27657. private readonly _delta;
  27658. private readonly _result;
  27659. protected _onClear(): void;
  27660. protected _onArriveAtFrame(): void;
  27661. protected _onUpdateFrame(): void;
  27662. fadeOut(): void;
  27663. update(passedTime: number): void;
  27664. }
  27665. /**
  27666. * @internal
  27667. * @private
  27668. */
  27669. class SlotFFDTimelineState extends SlotTimelineState {
  27670. static toString(): string;
  27671. meshOffset: number;
  27672. private _dirty;
  27673. private _frameFloatOffset;
  27674. private _valueCount;
  27675. private _deformCount;
  27676. private _valueOffset;
  27677. private readonly _current;
  27678. private readonly _delta;
  27679. private readonly _result;
  27680. protected _onClear(): void;
  27681. protected _onArriveAtFrame(): void;
  27682. protected _onUpdateFrame(): void;
  27683. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27684. fadeOut(): void;
  27685. update(passedTime: number): void;
  27686. }
  27687. /**
  27688. * @internal
  27689. * @private
  27690. */
  27691. class IKConstraintTimelineState extends ConstraintTimelineState {
  27692. static toString(): string;
  27693. private _current;
  27694. private _delta;
  27695. protected _onClear(): void;
  27696. protected _onArriveAtFrame(): void;
  27697. protected _onUpdateFrame(): void;
  27698. }
  27699. /**
  27700. * @internal
  27701. * @private
  27702. */
  27703. class AnimationTimelineState extends TweenTimelineState {
  27704. static toString(): string;
  27705. animationState: AnimationState;
  27706. private readonly _floats;
  27707. protected _onClear(): void;
  27708. protected _onArriveAtFrame(): void;
  27709. protected _onUpdateFrame(): void;
  27710. blend(state: number): void;
  27711. }
  27712. }
  27713. /**
  27714. * The MIT License (MIT)
  27715. *
  27716. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27717. *
  27718. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27719. * this software and associated documentation files (the "Software"), to deal in
  27720. * the Software without restriction, including without limitation the rights to
  27721. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27722. * the Software, and to permit persons to whom the Software is furnished to do so,
  27723. * subject to the following conditions:
  27724. *
  27725. * The above copyright notice and this permission notice shall be included in all
  27726. * copies or substantial portions of the Software.
  27727. *
  27728. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27729. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27730. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27731. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27732. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27733. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27734. */
  27735. declare namespace dragonBones {
  27736. /**
  27737. * - The properties of the object carry basic information about an event,
  27738. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  27739. * @version DragonBones 4.5
  27740. * @language en_US
  27741. */
  27742. /**
  27743. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  27744. * @version DragonBones 4.5
  27745. * @language zh_CN
  27746. */
  27747. class EventObject extends BaseObject {
  27748. /**
  27749. * - Animation start play.
  27750. * @version DragonBones 4.5
  27751. * @language en_US
  27752. */
  27753. /**
  27754. * - 动画开始播放。
  27755. * @version DragonBones 4.5
  27756. * @language zh_CN
  27757. */
  27758. static readonly START: string;
  27759. /**
  27760. * - Animation loop play complete once.
  27761. * @version DragonBones 4.5
  27762. * @language en_US
  27763. */
  27764. /**
  27765. * - 动画循环播放完成一次。
  27766. * @version DragonBones 4.5
  27767. * @language zh_CN
  27768. */
  27769. static readonly LOOP_COMPLETE: string;
  27770. /**
  27771. * - Animation play complete.
  27772. * @version DragonBones 4.5
  27773. * @language en_US
  27774. */
  27775. /**
  27776. * - 动画播放完成。
  27777. * @version DragonBones 4.5
  27778. * @language zh_CN
  27779. */
  27780. static readonly COMPLETE: string;
  27781. /**
  27782. * - Animation fade in start.
  27783. * @version DragonBones 4.5
  27784. * @language en_US
  27785. */
  27786. /**
  27787. * - 动画淡入开始。
  27788. * @version DragonBones 4.5
  27789. * @language zh_CN
  27790. */
  27791. static readonly FADE_IN: string;
  27792. /**
  27793. * - Animation fade in complete.
  27794. * @version DragonBones 4.5
  27795. * @language en_US
  27796. */
  27797. /**
  27798. * - 动画淡入完成。
  27799. * @version DragonBones 4.5
  27800. * @language zh_CN
  27801. */
  27802. static readonly FADE_IN_COMPLETE: string;
  27803. /**
  27804. * - Animation fade out start.
  27805. * @version DragonBones 4.5
  27806. * @language en_US
  27807. */
  27808. /**
  27809. * - 动画淡出开始。
  27810. * @version DragonBones 4.5
  27811. * @language zh_CN
  27812. */
  27813. static readonly FADE_OUT: string;
  27814. /**
  27815. * - Animation fade out complete.
  27816. * @version DragonBones 4.5
  27817. * @language en_US
  27818. */
  27819. /**
  27820. * - 动画淡出完成。
  27821. * @version DragonBones 4.5
  27822. * @language zh_CN
  27823. */
  27824. static readonly FADE_OUT_COMPLETE: string;
  27825. /**
  27826. * - Animation frame event.
  27827. * @version DragonBones 4.5
  27828. * @language en_US
  27829. */
  27830. /**
  27831. * - 动画帧事件。
  27832. * @version DragonBones 4.5
  27833. * @language zh_CN
  27834. */
  27835. static readonly FRAME_EVENT: string;
  27836. /**
  27837. * - Animation frame sound event.
  27838. * @version DragonBones 4.5
  27839. * @language en_US
  27840. */
  27841. /**
  27842. * - 动画帧声音事件。
  27843. * @version DragonBones 4.5
  27844. * @language zh_CN
  27845. */
  27846. static readonly SOUND_EVENT: string;
  27847. static toString(): string;
  27848. /**
  27849. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  27850. * @version DragonBones 4.5
  27851. * @language en_US
  27852. */
  27853. /**
  27854. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  27855. * @version DragonBones 4.5
  27856. * @language zh_CN
  27857. */
  27858. time: number;
  27859. /**
  27860. * - The event type。
  27861. * @version DragonBones 4.5
  27862. * @language en_US
  27863. */
  27864. /**
  27865. * - 事件类型。
  27866. * @version DragonBones 4.5
  27867. * @language zh_CN
  27868. */
  27869. type: EventStringType;
  27870. /**
  27871. * - The event name. (The frame event name or the frame sound name)
  27872. * @version DragonBones 4.5
  27873. * @language en_US
  27874. */
  27875. /**
  27876. * - 事件名称。 (帧事件的名称或帧声音的名称)
  27877. * @version DragonBones 4.5
  27878. * @language zh_CN
  27879. */
  27880. name: string;
  27881. /**
  27882. * - The armature that dispatch the event.
  27883. * @see dragonBones.Armature
  27884. * @version DragonBones 4.5
  27885. * @language en_US
  27886. */
  27887. /**
  27888. * - 发出该事件的骨架。
  27889. * @see dragonBones.Armature
  27890. * @version DragonBones 4.5
  27891. * @language zh_CN
  27892. */
  27893. armature: Armature;
  27894. /**
  27895. * - The bone that dispatch the event.
  27896. * @see dragonBones.Bone
  27897. * @version DragonBones 4.5
  27898. * @language en_US
  27899. */
  27900. /**
  27901. * - 发出该事件的骨骼。
  27902. * @see dragonBones.Bone
  27903. * @version DragonBones 4.5
  27904. * @language zh_CN
  27905. */
  27906. bone: Bone | null;
  27907. /**
  27908. * - The slot that dispatch the event.
  27909. * @see dragonBones.Slot
  27910. * @version DragonBones 4.5
  27911. * @language en_US
  27912. */
  27913. /**
  27914. * - 发出该事件的插槽。
  27915. * @see dragonBones.Slot
  27916. * @version DragonBones 4.5
  27917. * @language zh_CN
  27918. */
  27919. slot: Slot | null;
  27920. /**
  27921. * - The animation state that dispatch the event.
  27922. * @see dragonBones.AnimationState
  27923. * @version DragonBones 4.5
  27924. * @language en_US
  27925. */
  27926. /**
  27927. * - 发出该事件的动画状态。
  27928. * @see dragonBones.AnimationState
  27929. * @version DragonBones 4.5
  27930. * @language zh_CN
  27931. */
  27932. animationState: AnimationState;
  27933. /**
  27934. * - The custom data.
  27935. * @see dragonBones.CustomData
  27936. * @version DragonBones 5.0
  27937. * @language en_US
  27938. */
  27939. /**
  27940. * - 自定义数据。
  27941. * @see dragonBones.CustomData
  27942. * @version DragonBones 5.0
  27943. * @language zh_CN
  27944. */
  27945. data: UserData | null;
  27946. /**
  27947. * @private
  27948. */
  27949. protected _onClear(): void;
  27950. }
  27951. }
  27952. /**
  27953. * The MIT License (MIT)
  27954. *
  27955. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27956. *
  27957. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27958. * this software and associated documentation files (the "Software"), to deal in
  27959. * the Software without restriction, including without limitation the rights to
  27960. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27961. * the Software, and to permit persons to whom the Software is furnished to do so,
  27962. * subject to the following conditions:
  27963. *
  27964. * The above copyright notice and this permission notice shall be included in all
  27965. * copies or substantial portions of the Software.
  27966. *
  27967. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27968. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27969. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27970. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27971. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27972. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27973. */
  27974. declare namespace dragonBones {
  27975. /**
  27976. * @private
  27977. */
  27978. type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  27979. /**
  27980. * - The event dispatcher interface.
  27981. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  27982. * @version DragonBones 4.5
  27983. * @language en_US
  27984. */
  27985. /**
  27986. * - 事件派发接口。
  27987. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  27988. * @version DragonBones 4.5
  27989. * @language zh_CN
  27990. */
  27991. interface IEventDispatcher {
  27992. /**
  27993. * - Checks whether the object has any listeners registered for a specific type of event。
  27994. * @param type - Event type.
  27995. * @version DragonBones 4.5
  27996. * @language en_US
  27997. */
  27998. /**
  27999. * - 检查是否为特定的事件类型注册了任何侦听器。
  28000. * @param type - 事件类型。
  28001. * @version DragonBones 4.5
  28002. * @language zh_CN
  28003. */
  28004. hasDBEventListener(type: EventStringType): boolean;
  28005. /**
  28006. * - Dispatches an event into the event flow.
  28007. * @param type - Event type.
  28008. * @param eventObject - Event object.
  28009. * @see dragonBones.EventObject
  28010. * @version DragonBones 4.5
  28011. * @language en_US
  28012. */
  28013. /**
  28014. * - 分派特定的事件到事件流中。
  28015. * @param type - 事件类型。
  28016. * @param eventObject - 事件数据。
  28017. * @see dragonBones.EventObject
  28018. * @version DragonBones 4.5
  28019. * @language zh_CN
  28020. */
  28021. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  28022. /**
  28023. * - Add an event listener object so that the listener receives notification of an event.
  28024. * @param type - Event type.
  28025. * @param listener - Event listener.
  28026. * @param thisObject - The listener function's "this".
  28027. * @version DragonBones 4.5
  28028. * @language en_US
  28029. */
  28030. /**
  28031. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  28032. * @param type - 事件类型。
  28033. * @param listener - 事件侦听器。
  28034. * @param thisObject - 侦听函数绑定的 this 对象。
  28035. * @version DragonBones 4.5
  28036. * @language zh_CN
  28037. */
  28038. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28039. /**
  28040. * - Removes a listener from the object.
  28041. * @param type - Event type.
  28042. * @param listener - Event listener.
  28043. * @param thisObject - The listener function's "this".
  28044. * @version DragonBones 4.5
  28045. * @language en_US
  28046. */
  28047. /**
  28048. * - 删除特定事件类型的侦听器。
  28049. * @param type - 事件类型。
  28050. * @param listener - 事件侦听器。
  28051. * @param thisObject - 侦听函数绑定的 this 对象。
  28052. * @version DragonBones 4.5
  28053. * @language zh_CN
  28054. */
  28055. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28056. /**
  28057. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  28058. * @deprecated
  28059. * @language en_US
  28060. */
  28061. /**
  28062. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  28063. * @deprecated
  28064. * @language zh_CN
  28065. */
  28066. hasEvent(type: EventStringType): boolean;
  28067. /**
  28068. * - Deprecated, please refer to {@link #addDBEventListener()}.
  28069. * @deprecated
  28070. * @language en_US
  28071. */
  28072. /**
  28073. * - 已废弃,请参考 {@link #addDBEventListener()}。
  28074. * @deprecated
  28075. * @language zh_CN
  28076. */
  28077. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28078. /**
  28079. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  28080. * @deprecated
  28081. * @language en_US
  28082. */
  28083. /**
  28084. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  28085. * @deprecated
  28086. * @language zh_CN
  28087. */
  28088. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28089. }
  28090. }
  28091. /**
  28092. * The MIT License (MIT)
  28093. *
  28094. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28095. *
  28096. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28097. * this software and associated documentation files (the "Software"), to deal in
  28098. * the Software without restriction, including without limitation the rights to
  28099. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28100. * the Software, and to permit persons to whom the Software is furnished to do so,
  28101. * subject to the following conditions:
  28102. *
  28103. * The above copyright notice and this permission notice shall be included in all
  28104. * copies or substantial portions of the Software.
  28105. *
  28106. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28107. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28108. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28109. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28110. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28111. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28112. */
  28113. declare namespace dragonBones {
  28114. /**
  28115. * @internal
  28116. * @private
  28117. */
  28118. abstract class DataParser {
  28119. protected static readonly DATA_VERSION_2_3: string;
  28120. protected static readonly DATA_VERSION_3_0: string;
  28121. protected static readonly DATA_VERSION_4_0: string;
  28122. protected static readonly DATA_VERSION_4_5: string;
  28123. protected static readonly DATA_VERSION_5_0: string;
  28124. protected static readonly DATA_VERSION_5_5: string;
  28125. protected static readonly DATA_VERSION: string;
  28126. protected static readonly DATA_VERSIONS: Array<string>;
  28127. protected static readonly TEXTURE_ATLAS: string;
  28128. protected static readonly SUB_TEXTURE: string;
  28129. protected static readonly FORMAT: string;
  28130. protected static readonly IMAGE_PATH: string;
  28131. protected static readonly WIDTH: string;
  28132. protected static readonly HEIGHT: string;
  28133. protected static readonly ROTATED: string;
  28134. protected static readonly FRAME_X: string;
  28135. protected static readonly FRAME_Y: string;
  28136. protected static readonly FRAME_WIDTH: string;
  28137. protected static readonly FRAME_HEIGHT: string;
  28138. protected static readonly DRADON_BONES: string;
  28139. protected static readonly USER_DATA: string;
  28140. protected static readonly ARMATURE: string;
  28141. protected static readonly BONE: string;
  28142. protected static readonly SURFACE: string;
  28143. protected static readonly SLOT: string;
  28144. protected static readonly CONSTRAINT: string;
  28145. protected static readonly IK: string;
  28146. protected static readonly SKIN: string;
  28147. protected static readonly DISPLAY: string;
  28148. protected static readonly ANIMATION: string;
  28149. protected static readonly Z_ORDER: string;
  28150. protected static readonly FFD: string;
  28151. protected static readonly FRAME: string;
  28152. protected static readonly TRANSLATE_FRAME: string;
  28153. protected static readonly ROTATE_FRAME: string;
  28154. protected static readonly SCALE_FRAME: string;
  28155. protected static readonly DISPLAY_FRAME: string;
  28156. protected static readonly COLOR_FRAME: string;
  28157. protected static readonly DEFAULT_ACTIONS: string;
  28158. protected static readonly ACTIONS: string;
  28159. protected static readonly EVENTS: string;
  28160. protected static readonly INTS: string;
  28161. protected static readonly FLOATS: string;
  28162. protected static readonly STRINGS: string;
  28163. protected static readonly CANVAS: string;
  28164. protected static readonly TRANSFORM: string;
  28165. protected static readonly PIVOT: string;
  28166. protected static readonly AABB: string;
  28167. protected static readonly COLOR: string;
  28168. protected static readonly VERSION: string;
  28169. protected static readonly COMPATIBLE_VERSION: string;
  28170. protected static readonly FRAME_RATE: string;
  28171. protected static readonly TYPE: string;
  28172. protected static readonly SUB_TYPE: string;
  28173. protected static readonly NAME: string;
  28174. protected static readonly PARENT: string;
  28175. protected static readonly TARGET: string;
  28176. protected static readonly STAGE: string;
  28177. protected static readonly SHARE: string;
  28178. protected static readonly PATH: string;
  28179. protected static readonly LENGTH: string;
  28180. protected static readonly DISPLAY_INDEX: string;
  28181. protected static readonly BLEND_MODE: string;
  28182. protected static readonly INHERIT_TRANSLATION: string;
  28183. protected static readonly INHERIT_ROTATION: string;
  28184. protected static readonly INHERIT_SCALE: string;
  28185. protected static readonly INHERIT_REFLECTION: string;
  28186. protected static readonly INHERIT_ANIMATION: string;
  28187. protected static readonly INHERIT_DEFORM: string;
  28188. protected static readonly SEGMENT_X: string;
  28189. protected static readonly SEGMENT_Y: string;
  28190. protected static readonly BEND_POSITIVE: string;
  28191. protected static readonly CHAIN: string;
  28192. protected static readonly WEIGHT: string;
  28193. protected static readonly FADE_IN_TIME: string;
  28194. protected static readonly PLAY_TIMES: string;
  28195. protected static readonly SCALE: string;
  28196. protected static readonly OFFSET: string;
  28197. protected static readonly POSITION: string;
  28198. protected static readonly DURATION: string;
  28199. protected static readonly TWEEN_EASING: string;
  28200. protected static readonly TWEEN_ROTATE: string;
  28201. protected static readonly TWEEN_SCALE: string;
  28202. protected static readonly CLOCK_WISE: string;
  28203. protected static readonly CURVE: string;
  28204. protected static readonly SOUND: string;
  28205. protected static readonly EVENT: string;
  28206. protected static readonly ACTION: string;
  28207. protected static readonly X: string;
  28208. protected static readonly Y: string;
  28209. protected static readonly SKEW_X: string;
  28210. protected static readonly SKEW_Y: string;
  28211. protected static readonly SCALE_X: string;
  28212. protected static readonly SCALE_Y: string;
  28213. protected static readonly VALUE: string;
  28214. protected static readonly ROTATE: string;
  28215. protected static readonly SKEW: string;
  28216. protected static readonly ALPHA_OFFSET: string;
  28217. protected static readonly RED_OFFSET: string;
  28218. protected static readonly GREEN_OFFSET: string;
  28219. protected static readonly BLUE_OFFSET: string;
  28220. protected static readonly ALPHA_MULTIPLIER: string;
  28221. protected static readonly RED_MULTIPLIER: string;
  28222. protected static readonly GREEN_MULTIPLIER: string;
  28223. protected static readonly BLUE_MULTIPLIER: string;
  28224. protected static readonly UVS: string;
  28225. protected static readonly VERTICES: string;
  28226. protected static readonly TRIANGLES: string;
  28227. protected static readonly WEIGHTS: string;
  28228. protected static readonly SLOT_POSE: string;
  28229. protected static readonly BONE_POSE: string;
  28230. protected static readonly GLUE_WEIGHTS: string;
  28231. protected static readonly GLUE_MESHES: string;
  28232. protected static readonly GOTO_AND_PLAY: string;
  28233. protected static readonly DEFAULT_NAME: string;
  28234. protected static _getArmatureType(value: string): ArmatureType;
  28235. protected static _getBoneType(value: string): BoneType;
  28236. protected static _getDisplayType(value: string): DisplayType;
  28237. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  28238. protected static _getActionType(value: string): ActionType;
  28239. protected static _getBlendMode(value: string): BlendMode;
  28240. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  28241. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  28242. /**
  28243. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28244. * @deprecated
  28245. * @language en_US
  28246. */
  28247. /**
  28248. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28249. * @deprecated
  28250. * @language zh_CN
  28251. */
  28252. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  28253. /**
  28254. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28255. * @deprecated
  28256. * @language en_US
  28257. */
  28258. /**
  28259. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28260. * @deprecated
  28261. * @language zh_CN
  28262. */
  28263. static parseTextureAtlasData(rawData: any, scale?: number): any;
  28264. }
  28265. }
  28266. /**
  28267. * The MIT License (MIT)
  28268. *
  28269. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28270. *
  28271. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28272. * this software and associated documentation files (the "Software"), to deal in
  28273. * the Software without restriction, including without limitation the rights to
  28274. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28275. * the Software, and to permit persons to whom the Software is furnished to do so,
  28276. * subject to the following conditions:
  28277. *
  28278. * The above copyright notice and this permission notice shall be included in all
  28279. * copies or substantial portions of the Software.
  28280. *
  28281. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28282. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28283. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28284. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28285. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28286. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28287. */
  28288. declare namespace dragonBones {
  28289. /**
  28290. * @internal
  28291. * @private
  28292. */
  28293. class ObjectDataParser extends DataParser {
  28294. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  28295. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  28296. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  28297. protected _rawTextureAtlasIndex: number;
  28298. protected readonly _rawBones: Array<BoneData>;
  28299. protected _data: DragonBonesData;
  28300. protected _armature: ArmatureData;
  28301. protected _bone: BoneData;
  28302. protected _surface: SurfaceData;
  28303. protected _slot: SlotData;
  28304. protected _skin: SkinData;
  28305. protected _mesh: MeshDisplayData;
  28306. protected _animation: AnimationData;
  28307. protected _timeline: TimelineData;
  28308. protected _rawTextureAtlases: Array<any> | null;
  28309. private _defaultColorOffset;
  28310. private _prevClockwise;
  28311. private _prevRotation;
  28312. private readonly _helpMatrixA;
  28313. private readonly _helpMatrixB;
  28314. private readonly _helpTransform;
  28315. private readonly _helpColorTransform;
  28316. private readonly _helpPoint;
  28317. private readonly _helpArray;
  28318. private readonly _intArray;
  28319. private readonly _floatArray;
  28320. private readonly _frameIntArray;
  28321. private readonly _frameFloatArray;
  28322. private readonly _frameArray;
  28323. private readonly _timelineArray;
  28324. private readonly _cacheRawMeshes;
  28325. private readonly _cacheMeshes;
  28326. private readonly _actionFrames;
  28327. private readonly _weightSlotPose;
  28328. private readonly _weightBonePoses;
  28329. private readonly _cacheBones;
  28330. private readonly _slotChildActions;
  28331. private _getCurvePoint(x1, y1, x2, y2, x3, y3, x4, y4, t, result);
  28332. private _samplingEasingCurve(curve, samples);
  28333. private _parseActionDataInFrame(rawData, frameStart, bone, slot);
  28334. private _mergeActionFrame(rawData, frameStart, type, bone, slot);
  28335. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  28336. protected _parseBone(rawData: any): BoneData;
  28337. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  28338. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  28339. protected _parseSkin(rawData: any): SkinData;
  28340. protected _parseDisplay(rawData: any): DisplayData | null;
  28341. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  28342. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28343. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  28344. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  28345. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  28346. protected _parseAnimation(rawData: any): AnimationData;
  28347. protected _parseTimeline(rawData: any, rawFrames: Array<any> | null, framesKey: string, type: TimelineType, addIntOffset: boolean, addFloatOffset: boolean, frameValueCount: number, frameParser: (rawData: any, frameStart: number, frameCount: number) => number): TimelineData | null;
  28348. protected _parseBoneTimeline(rawData: any): void;
  28349. protected _parseSlotTimeline(rawData: any): void;
  28350. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  28351. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  28352. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  28353. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  28354. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  28355. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28356. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28357. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  28358. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  28359. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  28360. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  28361. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  28362. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  28363. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  28364. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  28365. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  28366. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  28367. protected _parseArray(rawData: any): void;
  28368. protected _modifyArray(): void;
  28369. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28370. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  28371. private static _objectDataParserInstance;
  28372. /**
  28373. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28374. * @deprecated
  28375. * @language en_US
  28376. */
  28377. /**
  28378. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28379. * @deprecated
  28380. * @language zh_CN
  28381. */
  28382. static getInstance(): ObjectDataParser;
  28383. }
  28384. /**
  28385. * @internal
  28386. * @private
  28387. */
  28388. class ActionFrame {
  28389. frameStart: number;
  28390. readonly actions: Array<number>;
  28391. }
  28392. }
  28393. /**
  28394. * The MIT License (MIT)
  28395. *
  28396. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28397. *
  28398. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28399. * this software and associated documentation files (the "Software"), to deal in
  28400. * the Software without restriction, including without limitation the rights to
  28401. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28402. * the Software, and to permit persons to whom the Software is furnished to do so,
  28403. * subject to the following conditions:
  28404. *
  28405. * The above copyright notice and this permission notice shall be included in all
  28406. * copies or substantial portions of the Software.
  28407. *
  28408. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28409. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28410. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28411. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28412. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28413. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28414. */
  28415. declare namespace dragonBones {
  28416. /**
  28417. * @internal
  28418. * @private
  28419. */
  28420. class BinaryDataParser extends ObjectDataParser {
  28421. private _binaryOffset;
  28422. private _binary;
  28423. private _intArrayBuffer;
  28424. private _floatArrayBuffer;
  28425. private _frameIntArrayBuffer;
  28426. private _frameFloatArrayBuffer;
  28427. private _frameArrayBuffer;
  28428. private _timelineArrayBuffer;
  28429. private _inRange(a, min, max);
  28430. private _decodeUTF8(data);
  28431. private _getUTF16Key(value);
  28432. private _parseBinaryTimeline(type, offset, timelineData?);
  28433. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28434. protected _parseAnimation(rawData: any): AnimationData;
  28435. protected _parseArray(rawData: any): void;
  28436. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28437. private static _binaryDataParserInstance;
  28438. /**
  28439. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28440. * @deprecated
  28441. * @language en_US
  28442. */
  28443. /**
  28444. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28445. * @deprecated
  28446. * @language zh_CN
  28447. */
  28448. static getInstance(): BinaryDataParser;
  28449. }
  28450. }
  28451. /**
  28452. * The MIT License (MIT)
  28453. *
  28454. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28455. *
  28456. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28457. * this software and associated documentation files (the "Software"), to deal in
  28458. * the Software without restriction, including without limitation the rights to
  28459. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28460. * the Software, and to permit persons to whom the Software is furnished to do so,
  28461. * subject to the following conditions:
  28462. *
  28463. * The above copyright notice and this permission notice shall be included in all
  28464. * copies or substantial portions of the Software.
  28465. *
  28466. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28467. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28468. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28469. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28470. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28471. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28472. */
  28473. declare namespace dragonBones {
  28474. /**
  28475. * - Base class for the factory that create the armatures. (Typically only one global factory instance is required)
  28476. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  28477. * Once the data has been parsed, it has been cached in the factory instance and does not need to be parsed again until it is cleared by the factory instance.
  28478. * @see dragonBones.DragonBonesData
  28479. * @see dragonBones.TextureAtlasData
  28480. * @see dragonBones.ArmatureData
  28481. * @see dragonBones.Armature
  28482. * @version DragonBones 3.0
  28483. * @language en_US
  28484. */
  28485. /**
  28486. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  28487. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  28488. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  28489. * @see dragonBones.DragonBonesData
  28490. * @see dragonBones.TextureAtlasData
  28491. * @see dragonBones.ArmatureData
  28492. * @see dragonBones.Armature
  28493. * @version DragonBones 3.0
  28494. * @language zh_CN
  28495. */
  28496. abstract class BaseFactory {
  28497. /**
  28498. * @private
  28499. */
  28500. protected static _objectParser: ObjectDataParser;
  28501. /**
  28502. * @private
  28503. */
  28504. protected static _binaryParser: BinaryDataParser;
  28505. /**
  28506. * @private
  28507. */
  28508. autoSearch: boolean;
  28509. /**
  28510. * @private
  28511. */
  28512. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  28513. /**
  28514. * @private
  28515. */
  28516. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  28517. /**
  28518. * @private
  28519. */
  28520. protected _dragonBones: DragonBones;
  28521. /**
  28522. * @private
  28523. */
  28524. protected _dataParser: DataParser;
  28525. /**
  28526. * - Create a factory instance. (typically only one global factory instance is required)
  28527. * @version DragonBones 3.0
  28528. * @language en_US
  28529. */
  28530. /**
  28531. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  28532. * @version DragonBones 3.0
  28533. * @language zh_CN
  28534. */
  28535. constructor(dataParser?: DataParser | null);
  28536. /**
  28537. * @private
  28538. */
  28539. protected _isSupportMesh(): boolean;
  28540. /**
  28541. * @private
  28542. */
  28543. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  28544. /**
  28545. * @private
  28546. */
  28547. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  28548. /**
  28549. * @private
  28550. */
  28551. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28552. /**
  28553. * @private
  28554. */
  28555. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28556. /**
  28557. * @private
  28558. */
  28559. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  28560. /**
  28561. * @private
  28562. */
  28563. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  28564. /**
  28565. * @private
  28566. */
  28567. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  28568. /**
  28569. * @private
  28570. */
  28571. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  28572. /**
  28573. * @private
  28574. */
  28575. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  28576. /**
  28577. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  28578. * @param rawData - The raw data.
  28579. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  28580. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  28581. * @returns DragonBonesData instance
  28582. * @see #getDragonBonesData()
  28583. * @see #addDragonBonesData()
  28584. * @see #removeDragonBonesData()
  28585. * @see dragonBones.DragonBonesData
  28586. * @version DragonBones 4.5
  28587. * @language en_US
  28588. */
  28589. /**
  28590. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  28591. * @param rawData - 原始数据。
  28592. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28593. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  28594. * @returns DragonBonesData 实例
  28595. * @see #getDragonBonesData()
  28596. * @see #addDragonBonesData()
  28597. * @see #removeDragonBonesData()
  28598. * @see dragonBones.DragonBonesData
  28599. * @version DragonBones 4.5
  28600. * @language zh_CN
  28601. */
  28602. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  28603. /**
  28604. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  28605. * @param rawData - The raw texture atlas data.
  28606. * @param textureAtlas - The texture atlas object.
  28607. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  28608. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  28609. * @returns TextureAtlasData instance
  28610. * @see #getTextureAtlasData()
  28611. * @see #addTextureAtlasData()
  28612. * @see #removeTextureAtlasData()
  28613. * @see dragonBones.TextureAtlasData
  28614. * @version DragonBones 4.5
  28615. * @language en_US
  28616. */
  28617. /**
  28618. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  28619. * @param rawData - 原始贴图集数据。
  28620. * @param textureAtlas - 贴图集对象。
  28621. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28622. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  28623. * @returns TextureAtlasData 实例
  28624. * @see #getTextureAtlasData()
  28625. * @see #addTextureAtlasData()
  28626. * @see #removeTextureAtlasData()
  28627. * @see dragonBones.TextureAtlasData
  28628. * @version DragonBones 4.5
  28629. * @language zh_CN
  28630. */
  28631. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  28632. /**
  28633. * @private
  28634. */
  28635. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  28636. /**
  28637. * - Get a specific DragonBonesData instance.
  28638. * @param name - The DragonBonesData instance cache name.
  28639. * @returns DragonBonesData instance
  28640. * @see #parseDragonBonesData()
  28641. * @see #addDragonBonesData()
  28642. * @see #removeDragonBonesData()
  28643. * @see dragonBones.DragonBonesData
  28644. * @version DragonBones 3.0
  28645. * @language en_US
  28646. */
  28647. /**
  28648. * - 获取特定的 DragonBonesData 实例。
  28649. * @param name - DragonBonesData 实例的缓存名称。
  28650. * @returns DragonBonesData 实例
  28651. * @see #parseDragonBonesData()
  28652. * @see #addDragonBonesData()
  28653. * @see #removeDragonBonesData()
  28654. * @see dragonBones.DragonBonesData
  28655. * @version DragonBones 3.0
  28656. * @language zh_CN
  28657. */
  28658. getDragonBonesData(name: string): DragonBonesData | null;
  28659. /**
  28660. * - Cache a DragonBonesData instance to the factory.
  28661. * @param data - The DragonBonesData instance.
  28662. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  28663. * @see #parseDragonBonesData()
  28664. * @see #getDragonBonesData()
  28665. * @see #removeDragonBonesData()
  28666. * @see dragonBones.DragonBonesData
  28667. * @version DragonBones 3.0
  28668. * @language en_US
  28669. */
  28670. /**
  28671. * - 将 DragonBonesData 实例缓存到工厂中。
  28672. * @param data - DragonBonesData 实例。
  28673. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28674. * @see #parseDragonBonesData()
  28675. * @see #getDragonBonesData()
  28676. * @see #removeDragonBonesData()
  28677. * @see dragonBones.DragonBonesData
  28678. * @version DragonBones 3.0
  28679. * @language zh_CN
  28680. */
  28681. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  28682. /**
  28683. * - Remove a DragonBonesData instance.
  28684. * @param name - The DragonBonesData instance cache name.
  28685. * @param disposeData - Whether to dispose data. (Default: true)
  28686. * @see #parseDragonBonesData()
  28687. * @see #getDragonBonesData()
  28688. * @see #addDragonBonesData()
  28689. * @see dragonBones.DragonBonesData
  28690. * @version DragonBones 3.0
  28691. * @language en_US
  28692. */
  28693. /**
  28694. * - 移除 DragonBonesData 实例。
  28695. * @param name - DragonBonesData 实例缓存名称。
  28696. * @param disposeData - 是否释放数据。 (默认: true)
  28697. * @see #parseDragonBonesData()
  28698. * @see #getDragonBonesData()
  28699. * @see #addDragonBonesData()
  28700. * @see dragonBones.DragonBonesData
  28701. * @version DragonBones 3.0
  28702. * @language zh_CN
  28703. */
  28704. removeDragonBonesData(name: string, disposeData?: boolean): void;
  28705. /**
  28706. * - Get a list of specific TextureAtlasData instances.
  28707. * @param name - The TextureAtlasData cahce name.
  28708. * @see #parseTextureAtlasData()
  28709. * @see #addTextureAtlasData()
  28710. * @see #removeTextureAtlasData()
  28711. * @see dragonBones.TextureAtlasData
  28712. * @version DragonBones 3.0
  28713. * @language en_US
  28714. */
  28715. /**
  28716. * - 获取特定的 TextureAtlasData 实例列表。
  28717. * @param name - TextureAtlasData 实例缓存名称。
  28718. * @see #parseTextureAtlasData()
  28719. * @see #addTextureAtlasData()
  28720. * @see #removeTextureAtlasData()
  28721. * @see dragonBones.TextureAtlasData
  28722. * @version DragonBones 3.0
  28723. * @language zh_CN
  28724. */
  28725. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  28726. /**
  28727. * - Cache a TextureAtlasData instance to the factory.
  28728. * @param data - The TextureAtlasData instance.
  28729. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  28730. * @see #parseTextureAtlasData()
  28731. * @see #getTextureAtlasData()
  28732. * @see #removeTextureAtlasData()
  28733. * @see dragonBones.TextureAtlasData
  28734. * @version DragonBones 3.0
  28735. * @language en_US
  28736. */
  28737. /**
  28738. * - 将 TextureAtlasData 实例缓存到工厂中。
  28739. * @param data - TextureAtlasData 实例。
  28740. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28741. * @see #parseTextureAtlasData()
  28742. * @see #getTextureAtlasData()
  28743. * @see #removeTextureAtlasData()
  28744. * @see dragonBones.TextureAtlasData
  28745. * @version DragonBones 3.0
  28746. * @language zh_CN
  28747. */
  28748. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  28749. /**
  28750. * - Remove a TextureAtlasData instance.
  28751. * @param name - The TextureAtlasData instance cache name.
  28752. * @param disposeData - Whether to dispose data.
  28753. * @see #parseTextureAtlasData()
  28754. * @see #getTextureAtlasData()
  28755. * @see #addTextureAtlasData()
  28756. * @see dragonBones.TextureAtlasData
  28757. * @version DragonBones 3.0
  28758. * @language en_US
  28759. */
  28760. /**
  28761. * - 移除 TextureAtlasData 实例。
  28762. * @param name - TextureAtlasData 实例的缓存名称。
  28763. * @param disposeData - 是否释放数据。
  28764. * @see #parseTextureAtlasData()
  28765. * @see #getTextureAtlasData()
  28766. * @see #addTextureAtlasData()
  28767. * @see dragonBones.TextureAtlasData
  28768. * @version DragonBones 3.0
  28769. * @language zh_CN
  28770. */
  28771. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  28772. /**
  28773. * - Get a specific armature data.
  28774. * @param name - The armature data name.
  28775. * @param dragonBonesName - The cached name for DragonbonesData instance.
  28776. * @see dragonBones.ArmatureData
  28777. * @version DragonBones 5.1
  28778. * @language en_US
  28779. */
  28780. /**
  28781. * - 获取特定的骨架数据。
  28782. * @param name - 骨架数据名称。
  28783. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  28784. * @see dragonBones.ArmatureData
  28785. * @version DragonBones 5.1
  28786. * @language zh_CN
  28787. */
  28788. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  28789. /**
  28790. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  28791. * @param disposeData - Whether to dispose data.
  28792. * @version DragonBones 4.5
  28793. * @language en_US
  28794. */
  28795. /**
  28796. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  28797. * @param disposeData - 是否释放数据。
  28798. * @version DragonBones 4.5
  28799. * @language zh_CN
  28800. */
  28801. clear(disposeData?: boolean): void;
  28802. /**
  28803. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  28804. * @param armatureName - The armature data name.
  28805. * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature)
  28806. * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data)
  28807. * @returns The armature.
  28808. * @example
  28809. * <pre>
  28810. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  28811. * armature.clock = factory.clock;
  28812. * </pre>
  28813. * @see dragonBones.DragonBonesData
  28814. * @see dragonBones.ArmatureData
  28815. * @see dragonBones.Armature
  28816. * @version DragonBones 3.0
  28817. * @language en_US
  28818. */
  28819. /**
  28820. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  28821. * @param armatureName - 骨架数据名称。
  28822. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  28823. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  28824. * @returns 骨架。
  28825. * @example
  28826. * <pre>
  28827. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  28828. * armature.clock = factory.clock;
  28829. * </pre>
  28830. * @see dragonBones.DragonBonesData
  28831. * @see dragonBones.ArmatureData
  28832. * @see dragonBones.Armature
  28833. * @version DragonBones 3.0
  28834. * @language zh_CN
  28835. */
  28836. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  28837. /**
  28838. * @private
  28839. */
  28840. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  28841. /**
  28842. * - Replaces the current display data for a particular slot with a specific display data.
  28843. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  28844. * @param dragonBonesName - The DragonBonesData instance cache name.
  28845. * @param armatureName - The armature data name.
  28846. * @param slotName - The slot data name.
  28847. * @param displayName - The display data name.
  28848. * @param slot - The slot.
  28849. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  28850. * @example
  28851. * <pre>
  28852. * let slot = armature.getSlot("weapon");
  28853. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  28854. * </pre>
  28855. * @version DragonBones 4.5
  28856. * @language en_US
  28857. */
  28858. /**
  28859. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  28860. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  28861. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  28862. * @param armatureName - 骨架数据名称。
  28863. * @param slotName - 插槽数据名称。
  28864. * @param displayName - 显示对象数据名称。
  28865. * @param slot - 插槽。
  28866. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  28867. * @example
  28868. * <pre>
  28869. * let slot = armature.getSlot("weapon");
  28870. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  28871. * </pre>
  28872. * @version DragonBones 4.5
  28873. * @language zh_CN
  28874. */
  28875. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  28876. /**
  28877. * @private
  28878. */
  28879. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  28880. /**
  28881. * - Share specific skin data with specific armature.
  28882. * @param armature - The armature.
  28883. * @param skin - The skin data.
  28884. * @param isOverride - Whether it completely override the original skin. (Default: false)
  28885. * @param exclude - A list of slot names that do not need to be replace.
  28886. * @example
  28887. * <pre>
  28888. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  28889. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  28890. * if (armatureDataB && armatureDataB.defaultSkin) {
  28891. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  28892. * }
  28893. * </pre>
  28894. * @see dragonBones.Armature
  28895. * @see dragonBones.SkinData
  28896. * @version DragonBones 5.6
  28897. * @language en_US
  28898. */
  28899. /**
  28900. * - 将特定的皮肤数据共享给特定的骨架使用。
  28901. * @param armature - 骨架。
  28902. * @param skin - 皮肤数据。
  28903. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  28904. * @param exclude - 不需要被替换的插槽名称列表。
  28905. * @example
  28906. * <pre>
  28907. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  28908. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  28909. * if (armatureDataB && armatureDataB.defaultSkin) {
  28910. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  28911. * }
  28912. * </pre>
  28913. * @see dragonBones.Armature
  28914. * @see dragonBones.SkinData
  28915. * @version DragonBones 5.6
  28916. * @language zh_CN
  28917. */
  28918. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  28919. /**
  28920. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  28921. * This enables you to make a armature template so that other armature without animations can share it's animations.
  28922. * @param armature - The armtaure.
  28923. * @param armatureData - The armature data.
  28924. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  28925. * @example
  28926. * <pre>
  28927. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  28928. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  28929. * if (armatureDataB) {
  28930. * factory.replaceAnimation(armatureA, armatureDataB);
  28931. * }
  28932. * </pre>
  28933. * @see dragonBones.Armature
  28934. * @see dragonBones.ArmatureData
  28935. * @version DragonBones 5.6
  28936. * @language en_US
  28937. */
  28938. /**
  28939. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  28940. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  28941. * @param armature - 骨架。
  28942. * @param armatureData - 骨架数据。
  28943. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  28944. * @example
  28945. * <pre>
  28946. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  28947. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  28948. * if (armatureDataB) {
  28949. * factory.replaceAnimation(armatureA, armatureDataB);
  28950. * }
  28951. * </pre>
  28952. * @see dragonBones.Armature
  28953. * @see dragonBones.ArmatureData
  28954. * @version DragonBones 5.6
  28955. * @language zh_CN
  28956. */
  28957. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  28958. /**
  28959. * @private
  28960. */
  28961. getAllDragonBonesData(): Map<DragonBonesData>;
  28962. /**
  28963. * @private
  28964. */
  28965. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  28966. /**
  28967. * - An Worldclock instance updated by engine.
  28968. * @version DragonBones 5.7
  28969. * @language en_US
  28970. */
  28971. /**
  28972. * - 由引擎驱动的 WorldClock 实例。
  28973. * @version DragonBones 5.7
  28974. * @language zh_CN
  28975. */
  28976. readonly clock: WorldClock;
  28977. /**
  28978. * @private
  28979. */
  28980. readonly dragonBones: DragonBones;
  28981. /**
  28982. * - Deprecated, please refer to {@link #replaceSkin}.
  28983. * @deprecated
  28984. * @language en_US
  28985. */
  28986. /**
  28987. * - 已废弃,请参考 {@link #replaceSkin}。
  28988. * @deprecated
  28989. * @language zh_CN
  28990. */
  28991. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  28992. /**
  28993. * - Deprecated, please refer to {@link #replaceAnimation}.
  28994. * @deprecated
  28995. * @language en_US
  28996. */
  28997. /**
  28998. * - 已废弃,请参考 {@link #replaceAnimation}。
  28999. * @deprecated
  29000. * @language zh_CN
  29001. */
  29002. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  29003. }
  29004. /**
  29005. * @internal
  29006. * @private
  29007. */
  29008. class BuildArmaturePackage {
  29009. dataName: string;
  29010. textureAtlasName: string;
  29011. data: DragonBonesData;
  29012. armature: ArmatureData;
  29013. skin: SkinData | null;
  29014. }
  29015. }
  29016. declare namespace sp.spine {
  29017. class Animation {
  29018. name: string;
  29019. timelines: Array<Timeline>;
  29020. timelineIds: Array<boolean>;
  29021. duration: number;
  29022. constructor(name: string, timelines: Array<Timeline>, duration: number);
  29023. hasTimeline(id: number): boolean;
  29024. apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29025. static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
  29026. static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
  29027. }
  29028. interface Timeline {
  29029. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29030. getPropertyId(): number;
  29031. }
  29032. enum MixBlend {
  29033. setup = 0,
  29034. first = 1,
  29035. replace = 2,
  29036. add = 3
  29037. }
  29038. enum MixDirection {
  29039. mixIn = 0,
  29040. mixOut = 1
  29041. }
  29042. enum TimelineType {
  29043. rotate = 0,
  29044. translate = 1,
  29045. scale = 2,
  29046. shear = 3,
  29047. attachment = 4,
  29048. color = 5,
  29049. deform = 6,
  29050. event = 7,
  29051. drawOrder = 8,
  29052. ikConstraint = 9,
  29053. transformConstraint = 10,
  29054. pathConstraintPosition = 11,
  29055. pathConstraintSpacing = 12,
  29056. pathConstraintMix = 13,
  29057. twoColor = 14
  29058. }
  29059. abstract class CurveTimeline implements Timeline {
  29060. static LINEAR: number;
  29061. static STEPPED: number;
  29062. static BEZIER: number;
  29063. static BEZIER_SIZE: number;
  29064. private curves;
  29065. abstract getPropertyId(): number;
  29066. constructor(frameCount: number);
  29067. getFrameCount(): number;
  29068. setLinear(frameIndex: number): void;
  29069. setStepped(frameIndex: number): void;
  29070. getCurveType(frameIndex: number): number;
  29071. setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29072. getCurvePercent(frameIndex: number, percent: number): number;
  29073. abstract apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29074. }
  29075. class RotateTimeline extends CurveTimeline {
  29076. static ENTRIES: number;
  29077. static PREV_TIME: number;
  29078. static PREV_ROTATION: number;
  29079. static ROTATION: number;
  29080. boneIndex: number;
  29081. frames: ArrayLike<number>;
  29082. constructor(frameCount: number);
  29083. getPropertyId(): number;
  29084. setFrame(frameIndex: number, time: number, degrees: number): void;
  29085. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29086. }
  29087. class TranslateTimeline extends CurveTimeline {
  29088. static ENTRIES: number;
  29089. static PREV_TIME: number;
  29090. static PREV_X: number;
  29091. static PREV_Y: number;
  29092. static X: number;
  29093. static Y: number;
  29094. boneIndex: number;
  29095. frames: ArrayLike<number>;
  29096. constructor(frameCount: number);
  29097. getPropertyId(): number;
  29098. setFrame(frameIndex: number, time: number, x: number, y: number): void;
  29099. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29100. }
  29101. class ScaleTimeline extends TranslateTimeline {
  29102. constructor(frameCount: number);
  29103. getPropertyId(): number;
  29104. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29105. }
  29106. class ShearTimeline extends TranslateTimeline {
  29107. constructor(frameCount: number);
  29108. getPropertyId(): number;
  29109. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29110. }
  29111. class ColorTimeline extends CurveTimeline {
  29112. static ENTRIES: number;
  29113. static PREV_TIME: number;
  29114. static PREV_R: number;
  29115. static PREV_G: number;
  29116. static PREV_B: number;
  29117. static PREV_A: number;
  29118. static R: number;
  29119. static G: number;
  29120. static B: number;
  29121. static A: number;
  29122. slotIndex: number;
  29123. frames: ArrayLike<number>;
  29124. constructor(frameCount: number);
  29125. getPropertyId(): number;
  29126. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
  29127. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29128. }
  29129. class TwoColorTimeline extends CurveTimeline {
  29130. static ENTRIES: number;
  29131. static PREV_TIME: number;
  29132. static PREV_R: number;
  29133. static PREV_G: number;
  29134. static PREV_B: number;
  29135. static PREV_A: number;
  29136. static PREV_R2: number;
  29137. static PREV_G2: number;
  29138. static PREV_B2: number;
  29139. static R: number;
  29140. static G: number;
  29141. static B: number;
  29142. static A: number;
  29143. static R2: number;
  29144. static G2: number;
  29145. static B2: number;
  29146. slotIndex: number;
  29147. frames: ArrayLike<number>;
  29148. constructor(frameCount: number);
  29149. getPropertyId(): number;
  29150. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
  29151. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29152. }
  29153. class AttachmentTimeline implements Timeline {
  29154. slotIndex: number;
  29155. frames: ArrayLike<number>;
  29156. attachmentNames: Array<string>;
  29157. constructor(frameCount: number);
  29158. getPropertyId(): number;
  29159. getFrameCount(): number;
  29160. setFrame(frameIndex: number, time: number, attachmentName: string): void;
  29161. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29162. }
  29163. class DeformTimeline extends CurveTimeline {
  29164. slotIndex: number;
  29165. attachment: VertexAttachment;
  29166. frames: ArrayLike<number>;
  29167. frameVertices: Array<ArrayLike<number>>;
  29168. constructor(frameCount: number);
  29169. getPropertyId(): number;
  29170. setFrame(frameIndex: number, time: number, vertices: ArrayLike<number>): void;
  29171. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29172. }
  29173. class EventTimeline implements Timeline {
  29174. frames: ArrayLike<number>;
  29175. events: Array<Event>;
  29176. constructor(frameCount: number);
  29177. getPropertyId(): number;
  29178. getFrameCount(): number;
  29179. setFrame(frameIndex: number, event: Event): void;
  29180. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29181. }
  29182. class DrawOrderTimeline implements Timeline {
  29183. frames: ArrayLike<number>;
  29184. drawOrders: Array<Array<number>>;
  29185. constructor(frameCount: number);
  29186. getPropertyId(): number;
  29187. getFrameCount(): number;
  29188. setFrame(frameIndex: number, time: number, drawOrder: Array<number>): void;
  29189. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29190. }
  29191. class IkConstraintTimeline extends CurveTimeline {
  29192. static ENTRIES: number;
  29193. static PREV_TIME: number;
  29194. static PREV_MIX: number;
  29195. static PREV_SOFTNESS: number;
  29196. static PREV_BEND_DIRECTION: number;
  29197. static PREV_COMPRESS: number;
  29198. static PREV_STRETCH: number;
  29199. static MIX: number;
  29200. static SOFTNESS: number;
  29201. static BEND_DIRECTION: number;
  29202. static COMPRESS: number;
  29203. static STRETCH: number;
  29204. ikConstraintIndex: number;
  29205. frames: ArrayLike<number>;
  29206. constructor(frameCount: number);
  29207. getPropertyId(): number;
  29208. setFrame(frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean): void;
  29209. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29210. }
  29211. class TransformConstraintTimeline extends CurveTimeline {
  29212. static ENTRIES: number;
  29213. static PREV_TIME: number;
  29214. static PREV_ROTATE: number;
  29215. static PREV_TRANSLATE: number;
  29216. static PREV_SCALE: number;
  29217. static PREV_SHEAR: number;
  29218. static ROTATE: number;
  29219. static TRANSLATE: number;
  29220. static SCALE: number;
  29221. static SHEAR: number;
  29222. transformConstraintIndex: number;
  29223. frames: ArrayLike<number>;
  29224. constructor(frameCount: number);
  29225. getPropertyId(): number;
  29226. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number): void;
  29227. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29228. }
  29229. class PathConstraintPositionTimeline extends CurveTimeline {
  29230. static ENTRIES: number;
  29231. static PREV_TIME: number;
  29232. static PREV_VALUE: number;
  29233. static VALUE: number;
  29234. pathConstraintIndex: number;
  29235. frames: ArrayLike<number>;
  29236. constructor(frameCount: number);
  29237. getPropertyId(): number;
  29238. setFrame(frameIndex: number, time: number, value: number): void;
  29239. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29240. }
  29241. class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {
  29242. constructor(frameCount: number);
  29243. getPropertyId(): number;
  29244. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29245. }
  29246. class PathConstraintMixTimeline extends CurveTimeline {
  29247. static ENTRIES: number;
  29248. static PREV_TIME: number;
  29249. static PREV_ROTATE: number;
  29250. static PREV_TRANSLATE: number;
  29251. static ROTATE: number;
  29252. static TRANSLATE: number;
  29253. pathConstraintIndex: number;
  29254. frames: ArrayLike<number>;
  29255. constructor(frameCount: number);
  29256. getPropertyId(): number;
  29257. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number): void;
  29258. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29259. }
  29260. }
  29261. declare namespace sp.spine {
  29262. class AnimationState {
  29263. static emptyAnimation: Animation;
  29264. static SUBSEQUENT: number;
  29265. static FIRST: number;
  29266. static HOLD: number;
  29267. static HOLD_MIX: number;
  29268. static NOT_LAST: number;
  29269. data: AnimationStateData;
  29270. tracks: TrackEntry[];
  29271. timeScale: number;
  29272. events: Event[];
  29273. listeners: AnimationStateListener[];
  29274. queue: EventQueue;
  29275. propertyIDs: IntSet;
  29276. animationsChanged: boolean;
  29277. trackEntryPool: Pool<TrackEntry>;
  29278. constructor(data: AnimationStateData);
  29279. update(delta: number): void;
  29280. updateMixingFrom(to: TrackEntry, delta: number): boolean;
  29281. apply(skeleton: Skeleton): boolean;
  29282. applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
  29283. applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
  29284. queueEvents(entry: TrackEntry, animationTime: number): void;
  29285. clearTracks(): void;
  29286. clearTrack(trackIndex: number): void;
  29287. setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
  29288. setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
  29289. setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
  29290. addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;
  29291. addAnimationWith(trackIndex: number, animation: Animation, loop: boolean, delay: number): TrackEntry;
  29292. setEmptyAnimation(trackIndex: number, mixDuration: number): TrackEntry;
  29293. addEmptyAnimation(trackIndex: number, mixDuration: number, delay: number): TrackEntry;
  29294. setEmptyAnimations(mixDuration: number): void;
  29295. expandToIndex(index: number): TrackEntry;
  29296. trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
  29297. disposeNext(entry: TrackEntry): void;
  29298. _animationsChanged(): void;
  29299. computeHold(entry: TrackEntry): void;
  29300. computeNotLast(entry: TrackEntry): void;
  29301. getCurrent(trackIndex: number): TrackEntry;
  29302. addListener(listener: AnimationStateListener): void;
  29303. removeListener(listener: AnimationStateListener): void;
  29304. clearListeners(): void;
  29305. clearListenerNotifications(): void;
  29306. }
  29307. class TrackEntry {
  29308. animation: Animation;
  29309. next: TrackEntry;
  29310. mixingFrom: TrackEntry;
  29311. mixingTo: TrackEntry;
  29312. listener: AnimationStateListener;
  29313. trackIndex: number;
  29314. loop: boolean;
  29315. holdPrevious: boolean;
  29316. eventThreshold: number;
  29317. attachmentThreshold: number;
  29318. drawOrderThreshold: number;
  29319. animationStart: number;
  29320. animationEnd: number;
  29321. animationLast: number;
  29322. nextAnimationLast: number;
  29323. delay: number;
  29324. trackTime: number;
  29325. trackLast: number;
  29326. nextTrackLast: number;
  29327. trackEnd: number;
  29328. timeScale: number;
  29329. alpha: number;
  29330. mixTime: number;
  29331. mixDuration: number;
  29332. interruptAlpha: number;
  29333. totalAlpha: number;
  29334. mixBlend: MixBlend;
  29335. timelineMode: number[];
  29336. timelineHoldMix: TrackEntry[];
  29337. timelinesRotation: number[];
  29338. reset(): void;
  29339. getAnimationTime(): number;
  29340. setAnimationLast(animationLast: number): void;
  29341. isComplete(): boolean;
  29342. resetRotationDirections(): void;
  29343. }
  29344. class EventQueue {
  29345. objects: Array<any>;
  29346. drainDisabled: boolean;
  29347. animState: AnimationState;
  29348. constructor(animState: AnimationState);
  29349. start(entry: TrackEntry): void;
  29350. interrupt(entry: TrackEntry): void;
  29351. end(entry: TrackEntry): void;
  29352. dispose(entry: TrackEntry): void;
  29353. complete(entry: TrackEntry): void;
  29354. event(entry: TrackEntry, event: Event): void;
  29355. drain(): void;
  29356. clear(): void;
  29357. }
  29358. enum EventType {
  29359. start = 0,
  29360. interrupt = 1,
  29361. end = 2,
  29362. dispose = 3,
  29363. complete = 4,
  29364. event = 5
  29365. }
  29366. interface AnimationStateListener {
  29367. start(entry: TrackEntry): void;
  29368. interrupt(entry: TrackEntry): void;
  29369. end(entry: TrackEntry): void;
  29370. dispose(entry: TrackEntry): void;
  29371. complete(entry: TrackEntry): void;
  29372. event(entry: TrackEntry, event: Event): void;
  29373. }
  29374. abstract class AnimationStateAdapter implements AnimationStateListener {
  29375. start(entry: TrackEntry): void;
  29376. interrupt(entry: TrackEntry): void;
  29377. end(entry: TrackEntry): void;
  29378. dispose(entry: TrackEntry): void;
  29379. complete(entry: TrackEntry): void;
  29380. event(entry: TrackEntry, event: Event): void;
  29381. }
  29382. }
  29383. declare namespace sp.spine {
  29384. class AnimationStateData {
  29385. skeletonData: SkeletonData;
  29386. animationToMixTime: Map<number>;
  29387. defaultMix: number;
  29388. constructor(skeletonData: SkeletonData);
  29389. setMix(fromName: string, toName: string, duration: number): void;
  29390. setMixWith(from: Animation, to: Animation, duration: number): void;
  29391. getMix(from: Animation, to: Animation): number;
  29392. }
  29393. }
  29394. declare namespace sp.spine {
  29395. class AssetManager implements Disposable {
  29396. private pathPrefix;
  29397. private textureLoader;
  29398. private assets;
  29399. private errors;
  29400. private toLoad;
  29401. private loaded;
  29402. constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
  29403. private static downloadText;
  29404. private static downloadBinary;
  29405. loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, error: string) => void): void;
  29406. loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
  29407. loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29408. loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29409. loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, error: string) => void): void;
  29410. get(path: string): any;
  29411. remove(path: string): void;
  29412. removeAll(): void;
  29413. isLoadingComplete(): boolean;
  29414. getToLoad(): number;
  29415. getLoaded(): number;
  29416. dispose(): void;
  29417. hasErrors(): boolean;
  29418. getErrors(): Map<string>;
  29419. }
  29420. }
  29421. declare namespace sp.spine {
  29422. class AtlasAttachmentLoader implements AttachmentLoader {
  29423. atlas: TextureAtlas;
  29424. constructor(atlas: TextureAtlas);
  29425. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  29426. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  29427. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  29428. newPathAttachment(skin: Skin, name: string): PathAttachment;
  29429. newPointAttachment(skin: Skin, name: string): PointAttachment;
  29430. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  29431. }
  29432. }
  29433. declare namespace sp.spine {
  29434. enum BlendMode {
  29435. Normal = 0,
  29436. Additive = 1,
  29437. Multiply = 2,
  29438. Screen = 3
  29439. }
  29440. }
  29441. declare namespace sp.spine {
  29442. class Bone implements Updatable {
  29443. data: BoneData;
  29444. skeleton: Skeleton;
  29445. parent: Bone;
  29446. children: Bone[];
  29447. x: number;
  29448. y: number;
  29449. rotation: number;
  29450. scaleX: number;
  29451. scaleY: number;
  29452. shearX: number;
  29453. shearY: number;
  29454. ax: number;
  29455. ay: number;
  29456. arotation: number;
  29457. ascaleX: number;
  29458. ascaleY: number;
  29459. ashearX: number;
  29460. ashearY: number;
  29461. appliedValid: boolean;
  29462. a: number;
  29463. b: number;
  29464. c: number;
  29465. d: number;
  29466. worldY: number;
  29467. worldX: number;
  29468. sorted: boolean;
  29469. active: boolean;
  29470. constructor(data: BoneData, skeleton: Skeleton, parent: Bone);
  29471. isActive(): boolean;
  29472. update(): void;
  29473. updateWorldTransform(): void;
  29474. updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
  29475. setToSetupPose(): void;
  29476. getWorldRotationX(): number;
  29477. getWorldRotationY(): number;
  29478. getWorldScaleX(): number;
  29479. getWorldScaleY(): number;
  29480. updateAppliedTransform(): void;
  29481. worldToLocal(world: Vector2): Vector2;
  29482. localToWorld(local: Vector2): Vector2;
  29483. worldToLocalRotation(worldRotation: number): number;
  29484. localToWorldRotation(localRotation: number): number;
  29485. rotateWorld(degrees: number): void;
  29486. }
  29487. }
  29488. declare namespace sp.spine {
  29489. class BoneData {
  29490. index: number;
  29491. name: string;
  29492. parent: BoneData;
  29493. length: number;
  29494. x: number;
  29495. y: number;
  29496. rotation: number;
  29497. scaleX: number;
  29498. scaleY: number;
  29499. shearX: number;
  29500. shearY: number;
  29501. transformMode: TransformMode;
  29502. skinRequired: boolean;
  29503. color: Color;
  29504. constructor(index: number, name: string, parent: BoneData);
  29505. }
  29506. enum TransformMode {
  29507. Normal = 0,
  29508. OnlyTranslation = 1,
  29509. NoRotationOrReflection = 2,
  29510. NoScale = 3,
  29511. NoScaleOrReflection = 4
  29512. }
  29513. }
  29514. declare namespace sp.spine {
  29515. abstract class ConstraintData {
  29516. name: string;
  29517. order: number;
  29518. skinRequired: boolean;
  29519. constructor(name: string, order: number, skinRequired: boolean);
  29520. }
  29521. }
  29522. declare namespace sp.spine {
  29523. class Event {
  29524. data: EventData;
  29525. intValue: number;
  29526. floatValue: number;
  29527. stringValue: string;
  29528. time: number;
  29529. volume: number;
  29530. balance: number;
  29531. constructor(time: number, data: EventData);
  29532. }
  29533. }
  29534. declare namespace sp.spine {
  29535. class EventData {
  29536. name: string;
  29537. intValue: number;
  29538. floatValue: number;
  29539. stringValue: string;
  29540. audioPath: string;
  29541. volume: number;
  29542. balance: number;
  29543. constructor(name: string);
  29544. }
  29545. }
  29546. declare namespace sp.spine {
  29547. class IkConstraint implements Updatable {
  29548. data: IkConstraintData;
  29549. bones: Array<Bone>;
  29550. target: Bone;
  29551. bendDirection: number;
  29552. compress: boolean;
  29553. stretch: boolean;
  29554. mix: number;
  29555. softness: number;
  29556. active: boolean;
  29557. constructor(data: IkConstraintData, skeleton: Skeleton);
  29558. isActive(): boolean;
  29559. apply(): void;
  29560. update(): void;
  29561. apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
  29562. apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
  29563. }
  29564. }
  29565. declare namespace sp.spine {
  29566. class IkConstraintData extends ConstraintData {
  29567. bones: BoneData[];
  29568. target: BoneData;
  29569. bendDirection: number;
  29570. compress: boolean;
  29571. stretch: boolean;
  29572. uniform: boolean;
  29573. mix: number;
  29574. softness: number;
  29575. constructor(name: string);
  29576. }
  29577. }
  29578. declare namespace sp.spine {
  29579. class PathConstraint implements Updatable {
  29580. static NONE: number;
  29581. static BEFORE: number;
  29582. static AFTER: number;
  29583. static epsilon: number;
  29584. data: PathConstraintData;
  29585. bones: Array<Bone>;
  29586. target: Slot;
  29587. position: number;
  29588. spacing: number;
  29589. rotateMix: number;
  29590. translateMix: number;
  29591. spaces: number[];
  29592. positions: number[];
  29593. world: number[];
  29594. curves: number[];
  29595. lengths: number[];
  29596. segments: number[];
  29597. active: boolean;
  29598. constructor(data: PathConstraintData, skeleton: Skeleton);
  29599. isActive(): boolean;
  29600. apply(): void;
  29601. update(): void;
  29602. computeWorldPositions(path: PathAttachment, spacesCount: number, tangents: boolean, percentPosition: boolean, percentSpacing: boolean): number[];
  29603. addBeforePosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29604. addAfterPosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29605. addCurvePosition(p: number, x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, out: Array<number>, o: number, tangents: boolean): void;
  29606. }
  29607. }
  29608. declare namespace sp.spine {
  29609. class PathConstraintData extends ConstraintData {
  29610. bones: BoneData[];
  29611. target: SlotData;
  29612. positionMode: PositionMode;
  29613. spacingMode: SpacingMode;
  29614. rotateMode: RotateMode;
  29615. offsetRotation: number;
  29616. position: number;
  29617. spacing: number;
  29618. rotateMix: number;
  29619. translateMix: number;
  29620. constructor(name: string);
  29621. }
  29622. enum PositionMode {
  29623. Fixed = 0,
  29624. Percent = 1
  29625. }
  29626. enum SpacingMode {
  29627. Length = 0,
  29628. Fixed = 1,
  29629. Percent = 2
  29630. }
  29631. enum RotateMode {
  29632. Tangent = 0,
  29633. Chain = 1,
  29634. ChainScale = 2
  29635. }
  29636. }
  29637. declare namespace sp.spine {
  29638. class SharedAssetManager implements Disposable {
  29639. private pathPrefix;
  29640. private clientAssets;
  29641. private queuedAssets;
  29642. private rawAssets;
  29643. private errors;
  29644. constructor(pathPrefix?: string);
  29645. private queueAsset;
  29646. loadText(clientId: string, path: string): void;
  29647. loadJson(clientId: string, path: string): void;
  29648. loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
  29649. get(clientId: string, path: string): any;
  29650. private updateClientAssets;
  29651. isLoadingComplete(clientId: string): boolean;
  29652. dispose(): void;
  29653. hasErrors(): boolean;
  29654. getErrors(): Map<string>;
  29655. }
  29656. }
  29657. declare namespace sp.spine {
  29658. class Skeleton {
  29659. data: SkeletonData;
  29660. bones: Array<Bone>;
  29661. slots: Array<Slot>;
  29662. drawOrder: Array<Slot>;
  29663. ikConstraints: Array<IkConstraint>;
  29664. transformConstraints: Array<TransformConstraint>;
  29665. pathConstraints: Array<PathConstraint>;
  29666. _updateCache: Updatable[];
  29667. updateCacheReset: Updatable[];
  29668. skin: Skin;
  29669. color: Color;
  29670. time: number;
  29671. scaleX: number;
  29672. scaleY: number;
  29673. x: number;
  29674. y: number;
  29675. constructor(data: SkeletonData);
  29676. updateCache(): void;
  29677. sortIkConstraint(constraint: IkConstraint): void;
  29678. sortPathConstraint(constraint: PathConstraint): void;
  29679. sortTransformConstraint(constraint: TransformConstraint): void;
  29680. sortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone): void;
  29681. sortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone): void;
  29682. sortBone(bone: Bone): void;
  29683. sortReset(bones: Array<Bone>): void;
  29684. updateWorldTransform(): void;
  29685. setToSetupPose(): void;
  29686. setBonesToSetupPose(): void;
  29687. setSlotsToSetupPose(): void;
  29688. getRootBone(): Bone;
  29689. findBone(boneName: string): Bone;
  29690. findBoneIndex(boneName: string): number;
  29691. findSlot(slotName: string): Slot;
  29692. findSlotIndex(slotName: string): number;
  29693. setSkinByName(skinName: string): void;
  29694. setSkin(newSkin: Skin): void;
  29695. getAttachmentByName(slotName: string, attachmentName: string): Attachment;
  29696. getAttachment(slotIndex: number, attachmentName: string): Attachment;
  29697. setAttachment(slotName: string, attachmentName: string): void;
  29698. findIkConstraint(constraintName: string): IkConstraint;
  29699. findTransformConstraint(constraintName: string): TransformConstraint;
  29700. findPathConstraint(constraintName: string): PathConstraint;
  29701. getBounds(offset: Vector2, size: Vector2, temp?: Array<number>): void;
  29702. update(delta: number): void;
  29703. }
  29704. }
  29705. declare namespace sp.spine {
  29706. class SkeletonBinary {
  29707. static AttachmentTypeValues: number[];
  29708. static TransformModeValues: TransformMode[];
  29709. static PositionModeValues: PositionMode[];
  29710. static SpacingModeValues: SpacingMode[];
  29711. static RotateModeValues: RotateMode[];
  29712. static BlendModeValues: BlendMode[];
  29713. static BONE_ROTATE: number;
  29714. static BONE_TRANSLATE: number;
  29715. static BONE_SCALE: number;
  29716. static BONE_SHEAR: number;
  29717. static SLOT_ATTACHMENT: number;
  29718. static SLOT_COLOR: number;
  29719. static SLOT_TWO_COLOR: number;
  29720. static PATH_POSITION: number;
  29721. static PATH_SPACING: number;
  29722. static PATH_MIX: number;
  29723. static CURVE_LINEAR: number;
  29724. static CURVE_STEPPED: number;
  29725. static CURVE_BEZIER: number;
  29726. scale: number;
  29727. attachmentLoader: AttachmentLoader;
  29728. private linkedMeshes;
  29729. constructor(attachmentLoader: AttachmentLoader);
  29730. readSkeletonData(binary: Uint8Array): SkeletonData;
  29731. private readSkin;
  29732. private readAttachment;
  29733. private readVertices;
  29734. private readFloatArray;
  29735. private readShortArray;
  29736. private readAnimation;
  29737. private readCurve;
  29738. setCurve(timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29739. }
  29740. }
  29741. declare namespace sp.spine {
  29742. class SkeletonBounds {
  29743. minX: number;
  29744. minY: number;
  29745. maxX: number;
  29746. maxY: number;
  29747. boundingBoxes: BoundingBoxAttachment[];
  29748. polygons: ArrayLike<number>[];
  29749. private polygonPool;
  29750. update(skeleton: Skeleton, updateAabb: boolean): void;
  29751. aabbCompute(): void;
  29752. aabbContainsPoint(x: number, y: number): boolean;
  29753. aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number): boolean;
  29754. aabbIntersectsSkeleton(bounds: SkeletonBounds): boolean;
  29755. containsPoint(x: number, y: number): BoundingBoxAttachment;
  29756. containsPointPolygon(polygon: ArrayLike<number>, x: number, y: number): boolean;
  29757. intersectsSegment(x1: number, y1: number, x2: number, y2: number): BoundingBoxAttachment;
  29758. intersectsSegmentPolygon(polygon: ArrayLike<number>, x1: number, y1: number, x2: number, y2: number): boolean;
  29759. getPolygon(boundingBox: BoundingBoxAttachment): ArrayLike<number>;
  29760. getWidth(): number;
  29761. getHeight(): number;
  29762. }
  29763. }
  29764. declare namespace sp.spine {
  29765. class SkeletonClipping {
  29766. private triangulator;
  29767. private clippingPolygon;
  29768. private clipOutput;
  29769. clippedVertices: number[];
  29770. clippedTriangles: number[];
  29771. private scratch;
  29772. private clipAttachment;
  29773. private clippingPolygons;
  29774. clipStart(slot: Slot, clip: ClippingAttachment): number;
  29775. clipEndWithSlot(slot: Slot): void;
  29776. clipEnd(): void;
  29777. isClipping(): boolean;
  29778. clipTriangles(vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>, light: Color, dark: Color, twoColor: boolean): void;
  29779. clip(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>): boolean;
  29780. static makeClockwise(polygon: ArrayLike<number>): void;
  29781. }
  29782. }
  29783. declare namespace sp.spine {
  29784. class SkeletonData {
  29785. name: string;
  29786. bones: BoneData[];
  29787. slots: SlotData[];
  29788. skins: Skin[];
  29789. defaultSkin: Skin;
  29790. events: EventData[];
  29791. animations: Animation[];
  29792. ikConstraints: IkConstraintData[];
  29793. transformConstraints: TransformConstraintData[];
  29794. pathConstraints: PathConstraintData[];
  29795. x: number;
  29796. y: number;
  29797. width: number;
  29798. height: number;
  29799. version: string;
  29800. hash: string;
  29801. fps: number;
  29802. imagesPath: string;
  29803. audioPath: string;
  29804. findBone(boneName: string): BoneData;
  29805. findBoneIndex(boneName: string): number;
  29806. findSlot(slotName: string): SlotData;
  29807. findSlotIndex(slotName: string): number;
  29808. findSkin(skinName: string): Skin;
  29809. findEvent(eventDataName: string): EventData;
  29810. findAnimation(animationName: string): Animation;
  29811. findIkConstraint(constraintName: string): IkConstraintData;
  29812. findTransformConstraint(constraintName: string): TransformConstraintData;
  29813. findPathConstraint(constraintName: string): PathConstraintData;
  29814. findPathConstraintIndex(pathConstraintName: string): number;
  29815. }
  29816. }
  29817. declare namespace sp.spine {
  29818. class SkeletonJson {
  29819. attachmentLoader: AttachmentLoader;
  29820. scale: number;
  29821. private linkedMeshes;
  29822. constructor(attachmentLoader: AttachmentLoader);
  29823. readSkeletonData(json: string | any): SkeletonData;
  29824. readAttachment(map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment;
  29825. readVertices(map: any, attachment: VertexAttachment, verticesLength: number): void;
  29826. readAnimation(map: any, name: string, skeletonData: SkeletonData): void;
  29827. readCurve(map: any, timeline: CurveTimeline, frameIndex: number): void;
  29828. getValue(map: any, prop: string, defaultValue: any): any;
  29829. static blendModeFromString(str: string): BlendMode;
  29830. static positionModeFromString(str: string): PositionMode;
  29831. static spacingModeFromString(str: string): SpacingMode;
  29832. static rotateModeFromString(str: string): RotateMode;
  29833. static transformModeFromString(str: string): TransformMode;
  29834. }
  29835. }
  29836. declare namespace sp.spine {
  29837. class SkinEntry {
  29838. slotIndex: number;
  29839. name: string;
  29840. attachment: Attachment;
  29841. constructor(slotIndex: number, name: string, attachment: Attachment);
  29842. }
  29843. class Skin {
  29844. name: string;
  29845. attachments: Map<Attachment>[];
  29846. bones: BoneData[];
  29847. constraints: ConstraintData[];
  29848. constructor(name: string);
  29849. setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
  29850. addSkin(skin: Skin): void;
  29851. copySkin(skin: Skin): void;
  29852. getAttachment(slotIndex: number, name: string): Attachment;
  29853. removeAttachment(slotIndex: number, name: string): void;
  29854. getAttachments(): Array<SkinEntry>;
  29855. getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
  29856. clear(): void;
  29857. attachAll(skeleton: Skeleton, oldSkin: Skin): void;
  29858. }
  29859. }
  29860. declare namespace sp.spine {
  29861. class Slot {
  29862. data: SlotData;
  29863. bone: Bone;
  29864. color: Color;
  29865. darkColor: Color;
  29866. private attachment;
  29867. private attachmentTime;
  29868. deform: number[];
  29869. constructor(data: SlotData, bone: Bone);
  29870. getSkeleton(): Skeleton;
  29871. getAttachment(): Attachment;
  29872. setAttachment(attachment: Attachment): void;
  29873. setAttachmentTime(time: number): void;
  29874. getAttachmentTime(): number;
  29875. setToSetupPose(): void;
  29876. }
  29877. }
  29878. declare namespace sp.spine {
  29879. class SlotData {
  29880. index: number;
  29881. name: string;
  29882. boneData: BoneData;
  29883. color: Color;
  29884. darkColor: Color;
  29885. attachmentName: string;
  29886. blendMode: BlendMode;
  29887. constructor(index: number, name: string, boneData: BoneData);
  29888. }
  29889. }
  29890. declare namespace sp.spine {
  29891. abstract class Texture {
  29892. protected _image: HTMLImageElement;
  29893. constructor(image: HTMLImageElement);
  29894. getImage(): HTMLImageElement;
  29895. abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  29896. abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  29897. abstract dispose(): void;
  29898. static filterFromString(text: string): TextureFilter;
  29899. static wrapFromString(text: string): TextureWrap;
  29900. }
  29901. enum TextureFilter {
  29902. Nearest = 9728,
  29903. Linear = 9729,
  29904. MipMap = 9987,
  29905. MipMapNearestNearest = 9984,
  29906. MipMapLinearNearest = 9985,
  29907. MipMapNearestLinear = 9986,
  29908. MipMapLinearLinear = 9987
  29909. }
  29910. enum TextureWrap {
  29911. MirroredRepeat = 33648,
  29912. ClampToEdge = 33071,
  29913. Repeat = 10497
  29914. }
  29915. class TextureRegion {
  29916. renderObject: any;
  29917. u: number;
  29918. v: number;
  29919. u2: number;
  29920. v2: number;
  29921. width: number;
  29922. height: number;
  29923. rotate: boolean;
  29924. offsetX: number;
  29925. offsetY: number;
  29926. originalWidth: number;
  29927. originalHeight: number;
  29928. }
  29929. class FakeTexture extends Texture {
  29930. setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  29931. setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  29932. dispose(): void;
  29933. }
  29934. }
  29935. declare namespace sp.spine {
  29936. class TextureAtlas implements Disposable {
  29937. pages: TextureAtlasPage[];
  29938. regions: TextureAtlasRegion[];
  29939. constructor(atlasText: string, textureLoader: (path: string) => any);
  29940. private load;
  29941. findRegion(name: string): TextureAtlasRegion;
  29942. dispose(): void;
  29943. }
  29944. class TextureAtlasPage {
  29945. name: string;
  29946. minFilter: TextureFilter;
  29947. magFilter: TextureFilter;
  29948. uWrap: TextureWrap;
  29949. vWrap: TextureWrap;
  29950. texture: Texture;
  29951. width: number;
  29952. height: number;
  29953. }
  29954. class TextureAtlasRegion extends TextureRegion {
  29955. page: TextureAtlasPage;
  29956. name: string;
  29957. x: number;
  29958. y: number;
  29959. index: number;
  29960. rotate: boolean;
  29961. degrees: number;
  29962. texture: Texture;
  29963. }
  29964. }
  29965. declare namespace sp.spine {
  29966. class TransformConstraint implements Updatable {
  29967. data: TransformConstraintData;
  29968. bones: Array<Bone>;
  29969. target: Bone;
  29970. rotateMix: number;
  29971. translateMix: number;
  29972. scaleMix: number;
  29973. shearMix: number;
  29974. temp: Vector2;
  29975. active: boolean;
  29976. constructor(data: TransformConstraintData, skeleton: Skeleton);
  29977. isActive(): boolean;
  29978. apply(): void;
  29979. update(): void;
  29980. applyAbsoluteWorld(): void;
  29981. applyRelativeWorld(): void;
  29982. applyAbsoluteLocal(): void;
  29983. applyRelativeLocal(): void;
  29984. }
  29985. }
  29986. declare namespace sp.spine {
  29987. class TransformConstraintData extends ConstraintData {
  29988. bones: BoneData[];
  29989. target: BoneData;
  29990. rotateMix: number;
  29991. translateMix: number;
  29992. scaleMix: number;
  29993. shearMix: number;
  29994. offsetRotation: number;
  29995. offsetX: number;
  29996. offsetY: number;
  29997. offsetScaleX: number;
  29998. offsetScaleY: number;
  29999. offsetShearY: number;
  30000. relative: boolean;
  30001. local: boolean;
  30002. constructor(name: string);
  30003. }
  30004. }
  30005. declare namespace sp.spine {
  30006. class Triangulator {
  30007. private convexPolygons;
  30008. private convexPolygonsIndices;
  30009. private indicesArray;
  30010. private isConcaveArray;
  30011. private triangles;
  30012. private polygonPool;
  30013. private polygonIndicesPool;
  30014. triangulate(verticesArray: ArrayLike<number>): Array<number>;
  30015. decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
  30016. private static isConcave;
  30017. private static positiveArea;
  30018. private static winding;
  30019. }
  30020. }
  30021. declare namespace sp.spine {
  30022. interface Updatable {
  30023. update(): void;
  30024. isActive(): boolean;
  30025. }
  30026. }
  30027. declare namespace sp.spine {
  30028. interface Map<T> {
  30029. [key: string]: T;
  30030. }
  30031. class IntSet {
  30032. array: number[];
  30033. add(value: number): boolean;
  30034. contains(value: number): boolean;
  30035. remove(value: number): void;
  30036. clear(): void;
  30037. }
  30038. interface Disposable {
  30039. dispose(): void;
  30040. }
  30041. interface Restorable {
  30042. restore(): void;
  30043. }
  30044. class Color {
  30045. r: number;
  30046. g: number;
  30047. b: number;
  30048. a: number;
  30049. static WHITE: Color;
  30050. static RED: Color;
  30051. static GREEN: Color;
  30052. static BLUE: Color;
  30053. static MAGENTA: Color;
  30054. constructor(r?: number, g?: number, b?: number, a?: number);
  30055. set(r: number, g: number, b: number, a: number): this;
  30056. setFromColor(c: Color): this;
  30057. setFromString(hex: string): this;
  30058. add(r: number, g: number, b: number, a: number): this;
  30059. clamp(): this;
  30060. static rgba8888ToColor(color: Color, value: number): void;
  30061. static rgb888ToColor(color: Color, value: number): void;
  30062. }
  30063. class MathUtils {
  30064. static PI: number;
  30065. static PI2: number;
  30066. static radiansToDegrees: number;
  30067. static radDeg: number;
  30068. static degreesToRadians: number;
  30069. static degRad: number;
  30070. static clamp(value: number, min: number, max: number): number;
  30071. static cosDeg(degrees: number): number;
  30072. static sinDeg(degrees: number): number;
  30073. static signum(value: number): number;
  30074. static toInt(x: number): number;
  30075. static cbrt(x: number): number;
  30076. static randomTriangular(min: number, max: number): number;
  30077. static randomTriangularWith(min: number, max: number, mode: number): number;
  30078. }
  30079. abstract class Interpolation {
  30080. protected abstract applyInternal(a: number): number;
  30081. apply(start: number, end: number, a: number): number;
  30082. }
  30083. class Pow extends Interpolation {
  30084. protected power: number;
  30085. constructor(power: number);
  30086. applyInternal(a: number): number;
  30087. }
  30088. class PowOut extends Pow {
  30089. constructor(power: number);
  30090. applyInternal(a: number): number;
  30091. }
  30092. class Utils {
  30093. static SUPPORTS_TYPED_ARRAYS: boolean;
  30094. static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number): void;
  30095. static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30096. static ensureArrayCapacity<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30097. static newArray<T>(size: number, defaultValue: T): Array<T>;
  30098. static newFloatArray(size: number): ArrayLike<number>;
  30099. static newShortArray(size: number): ArrayLike<number>;
  30100. static toFloatArray(array: Array<number>): number[] | Float32Array;
  30101. static toSinglePrecision(value: number): number;
  30102. static webkit602BugfixHelper(alpha: number, blend: MixBlend): void;
  30103. static contains<T>(array: Array<T>, element: T, identity?: boolean): boolean;
  30104. }
  30105. class DebugUtils {
  30106. static logBones(skeleton: Skeleton): void;
  30107. }
  30108. class Pool<T> {
  30109. private items;
  30110. private instantiator;
  30111. constructor(instantiator: () => T);
  30112. obtain(): T;
  30113. free(item: T): void;
  30114. freeAll(items: ArrayLike<T>): void;
  30115. clear(): void;
  30116. }
  30117. class Vector2 {
  30118. x: number;
  30119. y: number;
  30120. constructor(x?: number, y?: number);
  30121. set(x: number, y: number): Vector2;
  30122. length(): number;
  30123. normalize(): this;
  30124. }
  30125. class TimeKeeper {
  30126. maxDelta: number;
  30127. framesPerSecond: number;
  30128. delta: number;
  30129. totalTime: number;
  30130. private lastTime;
  30131. private frameCount;
  30132. private frameTime;
  30133. update(): void;
  30134. }
  30135. interface ArrayLike<T> {
  30136. length: number;
  30137. [n: number]: T;
  30138. }
  30139. class WindowedMean {
  30140. values: Array<number>;
  30141. addedValues: number;
  30142. lastValue: number;
  30143. mean: number;
  30144. dirty: boolean;
  30145. constructor(windowSize?: number);
  30146. hasEnoughData(): boolean;
  30147. addValue(value: number): void;
  30148. getMean(): number;
  30149. }
  30150. }
  30151. declare namespace sp.spine {
  30152. interface VertexEffect {
  30153. begin(skeleton: Skeleton): void;
  30154. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30155. end(): void;
  30156. }
  30157. }
  30158. interface Math {
  30159. fround(n: number): number;
  30160. }
  30161. declare namespace sp.spine {
  30162. abstract class Attachment {
  30163. name: string;
  30164. constructor(name: string);
  30165. abstract copy(): Attachment;
  30166. }
  30167. abstract class VertexAttachment extends Attachment {
  30168. private static nextID;
  30169. id: number;
  30170. bones: Array<number>;
  30171. vertices: ArrayLike<number>;
  30172. worldVerticesLength: number;
  30173. deformAttachment: VertexAttachment;
  30174. constructor(name: string);
  30175. computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30176. copyTo(attachment: VertexAttachment): void;
  30177. }
  30178. }
  30179. declare namespace sp.spine {
  30180. interface AttachmentLoader {
  30181. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  30182. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  30183. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  30184. newPathAttachment(skin: Skin, name: string): PathAttachment;
  30185. newPointAttachment(skin: Skin, name: string): PointAttachment;
  30186. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  30187. }
  30188. }
  30189. declare namespace sp.spine {
  30190. enum AttachmentType {
  30191. Region = 0,
  30192. BoundingBox = 1,
  30193. Mesh = 2,
  30194. LinkedMesh = 3,
  30195. Path = 4,
  30196. Point = 5,
  30197. Clipping = 6
  30198. }
  30199. }
  30200. declare namespace sp.spine {
  30201. class BoundingBoxAttachment extends VertexAttachment {
  30202. color: Color;
  30203. constructor(name: string);
  30204. copy(): Attachment;
  30205. }
  30206. }
  30207. declare namespace sp.spine {
  30208. class ClippingAttachment extends VertexAttachment {
  30209. endSlot: SlotData;
  30210. color: Color;
  30211. constructor(name: string);
  30212. copy(): Attachment;
  30213. }
  30214. }
  30215. declare namespace sp.spine {
  30216. class MeshAttachment extends VertexAttachment {
  30217. region: TextureRegion;
  30218. path: string;
  30219. regionUVs: ArrayLike<number>;
  30220. uvs: ArrayLike<number>;
  30221. triangles: Array<number>;
  30222. color: Color;
  30223. width: number;
  30224. height: number;
  30225. hullLength: number;
  30226. edges: Array<number>;
  30227. private parentMesh;
  30228. tempColor: Color;
  30229. constructor(name: string);
  30230. updateUVs(): void;
  30231. getParentMesh(): MeshAttachment;
  30232. setParentMesh(parentMesh: MeshAttachment): void;
  30233. copy(): Attachment;
  30234. newLinkedMesh(): MeshAttachment;
  30235. }
  30236. }
  30237. declare namespace sp.spine {
  30238. class PathAttachment extends VertexAttachment {
  30239. lengths: Array<number>;
  30240. closed: boolean;
  30241. constantSpeed: boolean;
  30242. color: Color;
  30243. constructor(name: string);
  30244. copy(): Attachment;
  30245. }
  30246. }
  30247. declare namespace sp.spine {
  30248. class PointAttachment extends VertexAttachment {
  30249. x: number;
  30250. y: number;
  30251. rotation: number;
  30252. color: Color;
  30253. constructor(name: string);
  30254. computeWorldPosition(bone: Bone, point: Vector2): Vector2;
  30255. computeWorldRotation(bone: Bone): number;
  30256. copy(): Attachment;
  30257. }
  30258. }
  30259. declare namespace sp.spine {
  30260. class RegionAttachment extends Attachment {
  30261. static OX1: number;
  30262. static OY1: number;
  30263. static OX2: number;
  30264. static OY2: number;
  30265. static OX3: number;
  30266. static OY3: number;
  30267. static OX4: number;
  30268. static OY4: number;
  30269. static X1: number;
  30270. static Y1: number;
  30271. static C1R: number;
  30272. static C1G: number;
  30273. static C1B: number;
  30274. static C1A: number;
  30275. static U1: number;
  30276. static V1: number;
  30277. static X2: number;
  30278. static Y2: number;
  30279. static C2R: number;
  30280. static C2G: number;
  30281. static C2B: number;
  30282. static C2A: number;
  30283. static U2: number;
  30284. static V2: number;
  30285. static X3: number;
  30286. static Y3: number;
  30287. static C3R: number;
  30288. static C3G: number;
  30289. static C3B: number;
  30290. static C3A: number;
  30291. static U3: number;
  30292. static V3: number;
  30293. static X4: number;
  30294. static Y4: number;
  30295. static C4R: number;
  30296. static C4G: number;
  30297. static C4B: number;
  30298. static C4A: number;
  30299. static U4: number;
  30300. static V4: number;
  30301. x: number;
  30302. y: number;
  30303. scaleX: number;
  30304. scaleY: number;
  30305. rotation: number;
  30306. width: number;
  30307. height: number;
  30308. color: Color;
  30309. path: string;
  30310. rendererObject: any;
  30311. region: TextureRegion;
  30312. offset: ArrayLike<number>;
  30313. uvs: ArrayLike<number>;
  30314. tempColor: Color;
  30315. constructor(name: string);
  30316. updateOffset(): void;
  30317. setRegion(region: TextureRegion): void;
  30318. computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30319. copy(): Attachment;
  30320. }
  30321. }
  30322. declare namespace sp.spine {
  30323. class JitterEffect implements VertexEffect {
  30324. jitterX: number;
  30325. jitterY: number;
  30326. constructor(jitterX: number, jitterY: number);
  30327. begin(skeleton: Skeleton): void;
  30328. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30329. end(): void;
  30330. }
  30331. }
  30332. declare namespace sp.spine {
  30333. class SwirlEffect implements VertexEffect {
  30334. static interpolation: PowOut;
  30335. centerX: number;
  30336. centerY: number;
  30337. radius: number;
  30338. angle: number;
  30339. private worldX;
  30340. private worldY;
  30341. constructor(radius: number);
  30342. begin(skeleton: Skeleton): void;
  30343. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30344. end(): void;
  30345. }
  30346. }
  30347. declare interface Math {
  30348. sign(v: number);
  30349. }
  30350. declare interface Object {
  30351. assign(target: {}, source: {});
  30352. }
  30353. /**
  30354. * API for jsb module
  30355. * Author: haroel
  30356. * Homepage: https://github.com/haroel/creatorexDTS
  30357. */
  30358. declare namespace jsb{
  30359. export module reflection{
  30360. /**
  30361. * https://docs.cocos.com/creator/manual/zh/advanced-topics/java-reflection.html
  30362. * call OBJC/Java static methods
  30363. *
  30364. * @param className
  30365. * @param methodName
  30366. * @param methodSignature
  30367. * @param parameters
  30368. */
  30369. export function callStaticMethod(className: string, methodName: string, methodSignature: string, ...parameters:any): any;
  30370. }
  30371. /**
  30372. * 下载任务对象
  30373. */
  30374. export type DownloaderTask = { requestURL: string, storagePath: string, identifier: string };
  30375. /**
  30376. * Http file downloader for jsb!
  30377. */
  30378. export class Downloader{
  30379. /**
  30380. * create a download task
  30381. * @param requestURL
  30382. * @param storagePath
  30383. * @param identifier
  30384. */
  30385. createDownloadFileTask(requestURL:string, storagePath:string, identifier?:string): DownloaderTask;
  30386. setOnFileTaskSuccess(onSucceed: (task: DownloaderTask) => void): void;
  30387. setOnTaskProgress(onProgress: (task: DownloaderTask, bytesReceived: number, totalBytesReceived: number, totalBytesExpected: number) => void): void;
  30388. setOnTaskError(onError: (task: DownloaderTask, errorCode: number, errorCodeInternal: number, errorStr: string) => void): void;
  30389. }
  30390. /**
  30391. * FileUtils Helper class to handle file operations.
  30392. */
  30393. export module fileUtils{
  30394. /**
  30395. * Checks whether the path is an absolute path.
  30396. *
  30397. * @note On Android, if the parameter passed in is relative to "@assets/", this method will treat it as an absolute path.
  30398. * Also on Blackberry, path starts with "app/native/Resources/" is treated as an absolute path.
  30399. *
  30400. * @param path The path that needs to be checked.
  30401. * @return True if it's an absolute path, false if not.
  30402. */
  30403. export function isAbsolutePath(path:string):boolean;
  30404. /** Returns the fullpath for a given filename.
  30405. First it will try to get a new filename from the "filenameLookup" dictionary.
  30406. If a new filename can't be found on the dictionary, it will use the original filename.
  30407. Then it will try to obtain the full path of the filename using the FileUtils search rules: resolutions, and search paths.
  30408. The file search is based on the array element order of search paths and resolution directories.
  30409. For instance:
  30410. We set two elements("/mnt/sdcard/", "internal_dir/") to search paths vector by setSearchPaths,
  30411. and set three elements("resources-ipadhd/", "resources-ipad/", "resources-iphonehd")
  30412. to resolutions vector by setSearchResolutionsOrder. The "internal_dir" is relative to "Resources/".
  30413. If we have a file named 'sprite.png', the mapping in fileLookup dictionary contains `key: sprite.png -> value: sprite.pvr.gz`.
  30414. Firstly, it will replace 'sprite.png' with 'sprite.pvr.gz', then searching the file sprite.pvr.gz as follows:
  30415. /mnt/sdcard/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30416. /mnt/sdcard/resources-ipad/sprite.pvr.gz (if not found, search next)
  30417. /mnt/sdcard/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30418. /mnt/sdcard/sprite.pvr.gz (if not found, search next)
  30419. internal_dir/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30420. internal_dir/resources-ipad/sprite.pvr.gz (if not found, search next)
  30421. internal_dir/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30422. internal_dir/sprite.pvr.gz (if not found, return "sprite.png")
  30423. If the filename contains relative path like "gamescene/uilayer/sprite.png",
  30424. and the mapping in fileLookup dictionary contains `key: gamescene/uilayer/sprite.png -> value: gamescene/uilayer/sprite.pvr.gz`.
  30425. The file search order will be:
  30426. /mnt/sdcard/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30427. /mnt/sdcard/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30428. /mnt/sdcard/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30429. /mnt/sdcard/gamescene/uilayer/sprite.pvr.gz (if not found, search next)
  30430. internal_dir/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30431. internal_dir/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30432. internal_dir/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30433. internal_dir/gamescene/uilayer/sprite.pvr.gz (if not found, return "gamescene/uilayer/sprite.png")
  30434. If the new file can't be found on the file system, it will return the parameter filename directly.
  30435. This method was added to simplify multiplatform support. Whether you are using cocos2d-js or any cross-compilation toolchain like StellaSDK or Apportable,
  30436. you might need to load different resources for a given file in the different platforms.
  30437. @since v2.1
  30438. */
  30439. export function fullPathForFilename(filename:string):string;
  30440. /**
  30441. * Gets string from a file.
  30442. */
  30443. export function getStringFromFile(filename:string):string;
  30444. /**
  30445. * Removes a file.
  30446. *
  30447. * @param filepath The full path of the file, it must be an absolute path.
  30448. * @return True if the file have been removed successfully, false if not.
  30449. */
  30450. export function removeFile(filepath:string):boolean;
  30451. /**
  30452. * Checks whether the path is a directory.
  30453. *
  30454. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30455. * @return True if the directory exists, false if not.
  30456. */
  30457. export function isDirectoryExist(dirPath:string):boolean;
  30458. /**
  30459. * Normalize: remove . and ..
  30460. * @param filepath
  30461. */
  30462. export function normalizePath(filepath:string):string;
  30463. /**
  30464. * Get default resource root path.
  30465. */
  30466. export function getDefaultResourceRootPath():string;
  30467. /**
  30468. * Loads the filenameLookup dictionary from the contents of a filename.
  30469. *
  30470. * @note The plist file name should follow the format below:
  30471. *
  30472. * @code
  30473. * <?xml version="1.0" encoding="UTF-8"?>
  30474. * <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  30475. * <plist version="1.0">
  30476. * <dict>
  30477. * <key>filenames</key>
  30478. * <dict>
  30479. * <key>sounds/click.wav</key>
  30480. * <string>sounds/click.caf</string>
  30481. * <key>sounds/endgame.wav</key>
  30482. * <string>sounds/endgame.caf</string>
  30483. * <key>sounds/gem-0.wav</key>
  30484. * <string>sounds/gem-0.caf</string>
  30485. * </dict>
  30486. * <key>metadata</key>
  30487. * <dict>
  30488. * <key>version</key>
  30489. * <integer>1</integer>
  30490. * </dict>
  30491. * </dict>
  30492. * </plist>
  30493. * @endcode
  30494. * @param filename The plist file name.
  30495. *
  30496. @since v2.1
  30497. * @js loadFilenameLookup
  30498. * @lua loadFilenameLookup
  30499. */
  30500. export function loadFilenameLookup(filepath:string):void;
  30501. /** Checks whether to pop up a message box when failed to load an image.
  30502. * @return True if pop up a message box when failed to load an image, false if not.
  30503. */
  30504. export function isPopupNotify():boolean;
  30505. /**
  30506. * Sets whether to pop-up a message box when failed to load an image.
  30507. */
  30508. export function setPopupNotify(notify:boolean):void;
  30509. // Converts the contents of a file to a ValueVector.
  30510. // This method is used internally.
  30511. export function getValueVectorFromFile(filepath:string):Array<any>;
  30512. /**
  30513. * Gets the array of search paths.
  30514. *
  30515. * @return The array of search paths which may contain the prefix of default resource root path.
  30516. * @note In best practise, getter function should return the value of setter function passes in.
  30517. * But since we should not break the compatibility, we keep using the old logic.
  30518. * Therefore, If you want to get the original search paths, please call 'getOriginalSearchPaths()' instead.
  30519. * @see fullPathForFilename(const char*).
  30520. * @lua NA
  30521. */
  30522. export function getSearchPaths(filepath:string):Array<string>;
  30523. /**
  30524. *
  30525. * @param filepath
  30526. */
  30527. export function getFileDir(filepath:string):string;
  30528. /**
  30529. * write a ValueMap into a plist file
  30530. *
  30531. *@param dict the ValueMap want to save (key,value)
  30532. *@param fullPath The full path to the file you want to save a string
  30533. *@return bool
  30534. */
  30535. export function writeToFile( valueMap:any ):boolean;
  30536. /**
  30537. * Gets the original search path array set by 'setSearchPaths' or 'addSearchPath'.
  30538. * @return The array of the original search paths
  30539. */
  30540. export function getOriginalSearchPaths():Array<string>;
  30541. /**
  30542. * List all files in a directory.
  30543. *
  30544. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30545. * @return File paths in a string vector
  30546. */
  30547. export function listFiles(filepath:string):Array<string>;
  30548. /**
  30549. * Converts the contents of a file to a ValueMap.
  30550. * @param filename The filename of the file to gets content.
  30551. * @return ValueMap of the file contents.
  30552. * @note This method is used internally.
  30553. */
  30554. export function getValueMapFromFile(filepath:string):any;
  30555. /**
  30556. * Retrieve the file size.
  30557. *
  30558. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30559. * @param filepath The path of the file, it could be a relative or absolute path.
  30560. * @return The file size.
  30561. */
  30562. export function getFileSize(filepath:string):number;
  30563. /** Converts the contents of a file to a ValueMap.
  30564. * This method is used internally.
  30565. */
  30566. export function getValueMapFromData(filedata:string,filesize:number):any;
  30567. /**
  30568. * Removes a directory.
  30569. *
  30570. * @param dirPath The full path of the directory, it must be an absolute path.
  30571. * @return True if the directory have been removed successfully, false if not.
  30572. */
  30573. export function removeDirectory(dirPath:string):boolean;
  30574. /**
  30575. * Sets the array of search paths.
  30576. *
  30577. * You can use this array to modify the search path of the resources.
  30578. * If you want to use "themes" or search resources in the "cache", you can do it easily by adding new entries in this array.
  30579. *
  30580. * @note This method could access relative path and absolute path.
  30581. * If the relative path was passed to the vector, FileUtils will add the default resource directory before the relative path.
  30582. * For instance:
  30583. * On Android, the default resource root path is "@assets/".
  30584. * If "/mnt/sdcard/" and "resources-large" were set to the search paths vector,
  30585. * "resources-large" will be converted to "@assets/resources-large" since it was a relative path.
  30586. *
  30587. * @param searchPaths The array contains search paths.
  30588. * @see fullPathForFilename(const char*)
  30589. * @since v2.1
  30590. * In js:var setSearchPaths(var jsval);
  30591. * @lua NA
  30592. */
  30593. export function setSearchPaths( searchPath:Array<string>):void;
  30594. /**
  30595. * write a string into a file
  30596. *
  30597. * @param dataStr the string want to save
  30598. * @param fullPath The full path to the file you want to save a string
  30599. * @return bool True if write success
  30600. */
  30601. export function writeStringToFile(dataStr:string,fullPath:string):boolean;
  30602. /**
  30603. * Sets the array that contains the search order of the resources.
  30604. *
  30605. * @param searchResolutionsOrder The source array that contains the search order of the resources.
  30606. * @see getSearchResolutionsOrder(), fullPathForFilename(const char*).
  30607. * @since v2.1
  30608. * In js:var setSearchResolutionsOrder(var jsval)
  30609. * @lua NA
  30610. */
  30611. export function setSearchResolutionsOrder(searchResolutionsOrder:Array<string>):void;
  30612. /**
  30613. * Append search order of the resources.
  30614. *
  30615. * @see setSearchResolutionsOrder(), fullPathForFilename().
  30616. * @since v2.1
  30617. */
  30618. export function addSearchResolutionsOrder(order:string,front:boolean):void;
  30619. /**
  30620. * Add search path.
  30621. *
  30622. * @since v2.1
  30623. */
  30624. export function addSearchPath(path:string,front:boolean):void;
  30625. /**
  30626. * write ValueVector into a plist file
  30627. *
  30628. *@param vecData the ValueVector want to save
  30629. *@param fullPath The full path to the file you want to save a string
  30630. *@return bool
  30631. */
  30632. export function writeValueVectorToFile(vecData:Array<any>,fullPath:string):boolean;
  30633. /**
  30634. * Checks whether a file exists.
  30635. *
  30636. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30637. * @param filename The path of the file, it could be a relative or absolute path.
  30638. * @return True if the file exists, false if not.
  30639. */
  30640. export function isFileExist(filename:string):boolean;
  30641. /**©∫
  30642. * Purges full path caches.
  30643. */
  30644. export function purgeCachedEntries():void;
  30645. /**
  30646. * Gets full path from a file name and the path of the relative file.
  30647. * @param filename The file name.
  30648. * @param relativeFile The path of the relative file.
  30649. * @return The full path.
  30650. * e.g. filename: hello.png, pszRelativeFile: /User/path1/path2/hello.plist
  30651. * Return: /User/path1/path2/hello.pvr (If there a a key(hello.png)-value(hello.pvr) in FilenameLookup dictionary. )
  30652. *
  30653. */
  30654. export function fullPathFromRelativeFile(filename:string,relativeFile:string):string;
  30655. /**
  30656. * Windows fopen can't support UTF-8 filename
  30657. * Need convert all parameters fopen and other 3rd-party libs
  30658. *
  30659. * @param filenameUtf8 std::string name file for conversion from utf-8
  30660. * @return std::string ansi filename in current locale
  30661. */
  30662. export function getSuitableFOpen(filenameUtf8:string):string;
  30663. /**
  30664. * write ValueMap into a plist file
  30665. *
  30666. *@param dict the ValueMap want to save
  30667. *@param fullPath The full path to the file you want to save a string
  30668. *@return bool
  30669. */
  30670. export function writeValueMapToFile(dict:any,fullPath:string):string;
  30671. /**
  30672. * Gets filename extension is a suffix (separated from the base filename by a dot) in lower case.
  30673. * Examples of filename extensions are .png, .jpeg, .exe, .dmg and .txt.
  30674. * @param filePath The path of the file, it could be a relative or absolute path.
  30675. * @return suffix for filename in lower case or empty if a dot not found.
  30676. */
  30677. export function getFileExtension(filePath:string):string;
  30678. /**
  30679. * Sets writable path.
  30680. */
  30681. export function setWritablePath(writablePath:string):void;
  30682. /**
  30683. * Set default resource root path.
  30684. */
  30685. export function setDefaultResourceRootPath(filepath:string):void;
  30686. /**
  30687. * Gets the array that contains the search order of the resources.
  30688. *
  30689. * @see setSearchResolutionsOrder(const std::vector<std::string>&), fullPathForFilename(const char*).
  30690. * @since v2.1
  30691. * @lua NA
  30692. */
  30693. export function getSearchResolutionsOrder():Array<string>;
  30694. /**
  30695. * Creates a directory.
  30696. *
  30697. * @param dirPath The path of the directory, it must be an absolute path.
  30698. * @return True if the directory have been created successfully, false if not.
  30699. */
  30700. export function createDirectory(dirPath:string):string;
  30701. /**
  30702. * List all files recursively in a directory.
  30703. *
  30704. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30705. * @return File paths in a string vector
  30706. */
  30707. export function listFilesRecursively(dirPath:string, files:Array<string>):void;
  30708. /**
  30709. * Gets the writable path.
  30710. * @return The path that can be write/read a file in
  30711. */
  30712. export function getWritablePath():string;
  30713. }
  30714. }
  30715. /** Running in the editor. */
  30716. declare const CC_EDITOR: boolean;
  30717. /** Preview in browser or simulator. */
  30718. declare const CC_PREVIEW: boolean;
  30719. /** Running in the editor or preview. */
  30720. declare const CC_DEV: boolean;
  30721. /** Running in the editor or preview, or build in debug mode. */
  30722. declare const CC_DEBUG: boolean;
  30723. /** Running in published project. */
  30724. declare const CC_BUILD: boolean;
  30725. /** Running in native platforms (mobile app, desktop app, or simulator). */
  30726. declare const CC_JSB: boolean;
  30727. /** Running in runtime environments. */
  30728. declare const CC_RUNTIME: boolean;
  30729. /** Running in the engine's unit test. */
  30730. declare const CC_TEST: boolean;
  30731. /** Running in the WeChat Mini Game. */
  30732. declare const CC_WECHATGAME: boolean;