creator.d.ts 867 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845
  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. /**
  11. !#en
  12. Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
  13. - In Cocos Creator, error is red.<br/>
  14. - In Chrome, error have a red icon along with red message text.<br/>
  15. !#zh
  16. 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
  17. - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
  18. - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
  19. @param msg A JavaScript string containing zero or more substitution strings.
  20. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  21. */
  22. export function error(msg: any, ...subst: any[]): void;
  23. /**
  24. !#en
  25. Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).
  26. - In Cocos Creator, warning is yellow.
  27. - In Chrome, warning have a yellow warning icon with the message text.
  28. !#zh
  29. 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>
  30. - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
  31. - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
  32. @param msg A JavaScript string containing zero or more substitution strings.
  33. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  34. */
  35. export function warn(msg: any, ...subst: any[]): void;
  36. /**
  37. !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
  38. !#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
  39. @param msg A JavaScript string containing zero or more substitution strings.
  40. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  41. */
  42. export function log(msg: string|any, ...subst: any[]): void;
  43. /** !#en Director
  44. !#zh 导演类。 */
  45. export var director: Director;
  46. /** !#en This is a Game instance.
  47. !#zh 这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。。 */
  48. export var game: Game;
  49. /**
  50. !#en
  51. Creates the speed action which changes the speed of an action, making it take longer (speed > 1)
  52. or less (speed < 1) time. <br/>
  53. Useful to simulate 'slow motion' or 'fast forward' effect.
  54. !#zh 修改目标动作的速率。
  55. @param action action
  56. @param speed speed
  57. @example
  58. ```js
  59. // change the target action speed;
  60. var action = cc.scaleTo(0.2, 1, 0.6);
  61. var newAction = cc.speed(action, 0.5);
  62. ```
  63. */
  64. export function speed(action: ActionInterval, speed: number): Action;
  65. /**
  66. !#en Create a follow action which makes its target follows another node.
  67. !#zh 追踪目标节点的位置。
  68. @param followedNode followedNode
  69. @param rect rect
  70. @example
  71. ```js
  72. // example
  73. // creates the action with a set boundary
  74. var followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight));
  75. node.runAction(followAction);
  76. // creates the action with no boundary set
  77. var followAction = cc.follow(targetNode);
  78. node.runAction(followAction);
  79. ```
  80. */
  81. export function follow(followedNode: Node, rect: Rect): Action;
  82. /**
  83. Points setter
  84. @param points points
  85. */
  86. export function setPoints(points: any[]): void;
  87. /**
  88. !#en Creates an action with a Cardinal Spline array of points and tension.
  89. !#zh 按基数样条曲线轨迹移动到目标位置。
  90. @param duration duration
  91. @param points array of control points
  92. @param tension tension
  93. @example
  94. ```js
  95. //create a cc.CardinalSplineTo
  96. var action1 = cc.cardinalSplineTo(3, array, 0);
  97. ```
  98. */
  99. export function cardinalSplineTo(duration: number, points: any[], tension: number): ActionInterval;
  100. /**
  101. update position of target
  102. @param newPos newPos
  103. */
  104. export function updatePosition(newPos: Vec2): void;
  105. /**
  106. !#en Creates an action with a Cardinal Spline array of points and tension.
  107. !#zh 按基数样条曲线轨迹移动指定的距离。
  108. @param duration duration
  109. @param points points
  110. @param tension tension
  111. */
  112. export function cardinalSplineBy(duration: number, points: any[], tension: number): ActionInterval;
  113. /**
  114. !#en Creates an action with a Cardinal Spline array of points and tension.
  115. !#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。
  116. @param dt dt
  117. @param points points
  118. @example
  119. ```js
  120. var action1 = cc.catmullRomTo(3, array);
  121. ```
  122. */
  123. export function catmullRomTo(dt: number, points: any[]): ActionInterval;
  124. /**
  125. !#en Creates an action with a Cardinal Spline array of points and tension.
  126. !#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。
  127. @param dt dt
  128. @param points points
  129. @example
  130. ```js
  131. var action1 = cc.catmullRomBy(3, array);
  132. ```
  133. */
  134. export function catmullRomBy(dt: number, points: any[]): ActionInterval;
  135. /**
  136. !#en
  137. Creates the action easing object with the rate parameter. <br />
  138. From slow to fast.
  139. !#zh 创建 easeIn 缓动对象,由慢到快。
  140. @param rate rate
  141. @example
  142. ```js
  143. action.easing(cc.easeIn(3.0));
  144. ```
  145. */
  146. export function easeIn(rate: number): any;
  147. /**
  148. !#en
  149. Creates the action easing object with the rate parameter. <br />
  150. From fast to slow.
  151. !#zh 创建 easeOut 缓动对象,由快到慢。
  152. @param rate rate
  153. @example
  154. ```js
  155. action.easing(cc.easeOut(3.0));
  156. ```
  157. */
  158. export function easeOut(rate: number): any;
  159. /**
  160. !#en
  161. Creates the action easing object with the rate parameter. <br />
  162. Slow to fast then to slow.
  163. !#zh 创建 easeInOut 缓动对象,慢到快,然后慢。
  164. @param rate rate
  165. @example
  166. ```js
  167. action.easing(cc.easeInOut(3.0));
  168. ```
  169. */
  170. export function easeInOut(rate: number): any;
  171. /**
  172. !#en
  173. Creates the action easing object with the rate parameter. <br />
  174. Reference easeInExpo: <br />
  175. http://www.zhihu.com/question/21981571/answer/19925418
  176. !#zh
  177. 创建 easeExponentialIn 缓动对象。<br />
  178. EaseExponentialIn 是按指数函数缓动进入的动作。<br />
  179. 参考 easeInExpo:http://www.zhihu.com/question/21981571/answer/19925418
  180. @example
  181. ```js
  182. action.easing(cc.easeExponentialIn());
  183. ```
  184. */
  185. export function easeExponentialIn(): any;
  186. /**
  187. !#en
  188. Creates the action easing object. <br />
  189. Reference easeOutExpo: <br />
  190. http://www.zhihu.com/question/21981571/answer/19925418
  191. !#zh
  192. 创建 easeExponentialOut 缓动对象。<br />
  193. EaseExponentialOut 是按指数函数缓动退出的动作。<br />
  194. 参考 easeOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  195. @example
  196. ```js
  197. action.easing(cc.easeExponentialOut());
  198. ```
  199. */
  200. export function easeExponentialOut(): any;
  201. /**
  202. !#en
  203. Creates an EaseExponentialInOut action easing object. <br />
  204. Reference easeInOutExpo: <br />
  205. http://www.zhihu.com/question/21981571/answer/19925418
  206. !#zh
  207. 创建 easeExponentialInOut 缓动对象。<br />
  208. EaseExponentialInOut 是按指数函数缓动进入并退出的动作。<br />
  209. 参考 easeInOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  210. @example
  211. ```js
  212. action.easing(cc.easeExponentialInOut());
  213. ```
  214. */
  215. export function easeExponentialInOut(): any;
  216. /**
  217. !#en
  218. Creates an EaseSineIn action. <br />
  219. Reference easeInSine: <br />
  220. http://www.zhihu.com/question/21981571/answer/19925418
  221. !#zh
  222. 创建 EaseSineIn 缓动对象。<br />
  223. EaseSineIn 是按正弦函数缓动进入的动作。<br />
  224. 参考 easeInSine:http://www.zhihu.com/question/21981571/answer/19925418
  225. @example
  226. ```js
  227. action.easing(cc.easeSineIn());
  228. ```
  229. */
  230. export function easeSineIn(): any;
  231. /**
  232. !#en
  233. Creates an EaseSineOut action easing object. <br />
  234. Reference easeOutSine: <br />
  235. http://www.zhihu.com/question/21981571/answer/19925418
  236. !#zh
  237. 创建 EaseSineOut 缓动对象。<br />
  238. EaseSineIn 是按正弦函数缓动退出的动作。<br />
  239. 参考 easeOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  240. @example
  241. ```js
  242. action.easing(cc.easeSineOut());
  243. ```
  244. */
  245. export function easeSineOut(): any;
  246. /**
  247. !#en
  248. Creates the action easing object. <br />
  249. Reference easeInOutSine: <br />
  250. http://www.zhihu.com/question/21981571/answer/19925418
  251. !#zh
  252. 创建 easeSineInOut 缓动对象。<br />
  253. EaseSineIn 是按正弦函数缓动进入并退出的动作。<br />
  254. 参考 easeInOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  255. @example
  256. ```js
  257. action.easing(cc.easeSineInOut());
  258. ```
  259. */
  260. export function easeSineInOut(): any;
  261. /**
  262. !#en
  263. Creates the action easing object with the period in radians (default is 0.3). <br />
  264. Reference easeInElastic: <br />
  265. http://www.zhihu.com/question/21981571/answer/19925418
  266. !#zh
  267. 创建 easeElasticIn 缓动对象。<br />
  268. EaseElasticIn 是按弹性曲线缓动进入的动作。<br />
  269. 参数 easeInElastic:http://www.zhihu.com/question/21981571/answer/19925418
  270. @param period period
  271. @example
  272. ```js
  273. // example
  274. action.easing(cc.easeElasticIn(3.0));
  275. ```
  276. */
  277. export function easeElasticIn(period: number): any;
  278. /**
  279. !#en
  280. Creates the action easing object with the period in radians (default is 0.3). <br />
  281. Reference easeOutElastic: <br />
  282. http://www.zhihu.com/question/21981571/answer/19925418
  283. !#zh
  284. 创建 easeElasticOut 缓动对象。<br />
  285. EaseElasticOut 是按弹性曲线缓动退出的动作。<br />
  286. 参考 easeOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  287. @param period period
  288. @example
  289. ```js
  290. // example
  291. action.easing(cc.easeElasticOut(3.0));
  292. ```
  293. */
  294. export function easeElasticOut(period: number): any;
  295. /**
  296. !#en
  297. Creates the action easing object with the period in radians (default is 0.3). <br />
  298. Reference easeInOutElastic: <br />
  299. http://www.zhihu.com/question/21981571/answer/19925418
  300. !#zh
  301. 创建 easeElasticInOut 缓动对象。<br />
  302. EaseElasticInOut 是按弹性曲线缓动进入并退出的动作。<br />
  303. 参考 easeInOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  304. @param period period
  305. @example
  306. ```js
  307. // example
  308. action.easing(cc.easeElasticInOut(3.0));
  309. ```
  310. */
  311. export function easeElasticInOut(period: number): any;
  312. /**
  313. !#en
  314. Creates the action easing object. <br />
  315. Eased bounce effect at the beginning.
  316. !#zh
  317. 创建 easeBounceIn 缓动对象。<br />
  318. EaseBounceIn 是按弹跳动作缓动进入的动作。
  319. @example
  320. ```js
  321. // example
  322. action.easing(cc.easeBounceIn());
  323. ```
  324. */
  325. export function easeBounceIn(): any;
  326. /**
  327. !#en
  328. Creates the action easing object. <br />
  329. Eased bounce effect at the ending.
  330. !#zh
  331. 创建 easeBounceOut 缓动对象。<br />
  332. EaseBounceOut 是按弹跳动作缓动退出的动作。
  333. @example
  334. ```js
  335. // example
  336. action.easing(cc.easeBounceOut());
  337. ```
  338. */
  339. export function easeBounceOut(): any;
  340. /**
  341. !#en
  342. Creates the action easing object. <br />
  343. Eased bounce effect at the begining and ending.
  344. !#zh
  345. 创建 easeBounceInOut 缓动对象。<br />
  346. EaseBounceInOut 是按弹跳动作缓动进入并退出的动作。
  347. @example
  348. ```js
  349. // example
  350. action.easing(cc.easeBounceInOut());
  351. ```
  352. */
  353. export function easeBounceInOut(): any;
  354. /**
  355. !#en
  356. Creates the action easing object. <br />
  357. In the opposite direction to move slowly, and then accelerated to the right direction.
  358. !#zh
  359. 创建 easeBackIn 缓动对象。<br />
  360. easeBackIn 是在相反的方向缓慢移动,然后加速到正确的方向。<br />
  361. @example
  362. ```js
  363. // example
  364. action.easing(cc.easeBackIn());
  365. ```
  366. */
  367. export function easeBackIn(): any;
  368. /**
  369. !#en
  370. Creates the action easing object. <br />
  371. Fast moving more than the finish, and then slowly back to the finish.
  372. !#zh
  373. 创建 easeBackOut 缓动对象。<br />
  374. easeBackOut 快速移动超出目标,然后慢慢回到目标点。
  375. @example
  376. ```js
  377. // example
  378. action.easing(cc.easeBackOut());
  379. ```
  380. */
  381. export function easeBackOut(): any;
  382. /**
  383. !#en
  384. Creates the action easing object. <br />
  385. Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
  386. !#zh
  387. 创建 easeBackInOut 缓动对象。<br />
  388. @example
  389. ```js
  390. // example
  391. action.easing(cc.easeBackInOut());
  392. ```
  393. */
  394. export function easeBackInOut(): any;
  395. /**
  396. !#en
  397. Creates the action easing object. <br />
  398. Into the 4 reference point. <br />
  399. To calculate the motion curve.
  400. !#zh
  401. 创建 easeBezierAction 缓动对象。<br />
  402. EaseBezierAction 是按贝塞尔曲线缓动的动作。
  403. @param p0 The first bezier parameter
  404. @param p1 The second bezier parameter
  405. @param p2 The third bezier parameter
  406. @param p3 The fourth bezier parameter
  407. @example
  408. ```js
  409. // example
  410. action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
  411. ```
  412. */
  413. export function easeBezierAction(p0: number, p1: number, p2: number, p3: number): any;
  414. /**
  415. !#en
  416. Creates the action easing object. <br />
  417. Reference easeInQuad: <br />
  418. http://www.zhihu.com/question/21981571/answer/19925418
  419. !#zh
  420. 创建 easeQuadraticActionIn 缓动对象。<br />
  421. EaseQuadraticIn是按二次函数缓动进入的动作。<br />
  422. 参考 easeInQuad:http://www.zhihu.com/question/21981571/answer/19925418
  423. @example
  424. ```js
  425. //example
  426. action.easing(cc.easeQuadraticActionIn());
  427. ```
  428. */
  429. export function easeQuadraticActionIn(): any;
  430. /**
  431. !#en
  432. Creates the action easing object. <br />
  433. Reference easeOutQuad: <br />
  434. http://www.zhihu.com/question/21981571/answer/19925418
  435. !#zh
  436. 创建 easeQuadraticActionOut 缓动对象。<br />
  437. EaseQuadraticOut 是按二次函数缓动退出的动作。<br />
  438. 参考 easeOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  439. @example
  440. ```js
  441. //example
  442. action.easing(cc.easeQuadraticActionOut());
  443. ```
  444. */
  445. export function easeQuadraticActionOut(): any;
  446. /**
  447. !#en
  448. Creates the action easing object. <br />
  449. Reference easeInOutQuad: <br />
  450. http://www.zhihu.com/question/21981571/answer/19925418
  451. !#zh
  452. 创建 easeQuadraticActionInOut 缓动对象。<br />
  453. EaseQuadraticInOut 是按二次函数缓动进入并退出的动作。<br />
  454. 参考 easeInOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  455. @example
  456. ```js
  457. //example
  458. action.easing(cc.easeQuadraticActionInOut());
  459. ```
  460. */
  461. export function easeQuadraticActionInOut(): any;
  462. /**
  463. !#en
  464. Creates the action easing object. <br />
  465. Reference easeIntQuart: <br />
  466. http://www.zhihu.com/question/21981571/answer/19925418
  467. !#zh
  468. 创建 easeQuarticActionIn 缓动对象。<br />
  469. EaseQuarticIn 是按四次函数缓动进入的动作。<br />
  470. 参考 easeIntQuart:http://www.zhihu.com/question/21981571/answer/19925418
  471. @example
  472. ```js
  473. //example
  474. action.easing(cc.easeQuarticActionIn());
  475. ```
  476. */
  477. export function easeQuarticActionIn(): any;
  478. /**
  479. !#en
  480. Creates the action easing object. <br />
  481. Reference easeOutQuart: <br />
  482. http://www.zhihu.com/question/21981571/answer/19925418
  483. !#zh
  484. 创建 easeQuarticActionOut 缓动对象。<br />
  485. EaseQuarticOut 是按四次函数缓动退出的动作。<br />
  486. 参考 easeOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  487. @example
  488. ```js
  489. //example
  490. action.easing(cc.QuarticActionOut());
  491. ```
  492. */
  493. export function easeQuarticActionOut(): any;
  494. /**
  495. !#en
  496. Creates the action easing object. <br />
  497. Reference easeInOutQuart: <br />
  498. http://www.zhihu.com/question/21981571/answer/19925418
  499. !#zh
  500. 创建 easeQuarticActionInOut 缓动对象。<br />
  501. EaseQuarticInOut 是按四次函数缓动进入并退出的动作。<br />
  502. 参考 easeInOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  503. */
  504. export function easeQuarticActionInOut(): any;
  505. /**
  506. !#en
  507. Creates the action easing object. <br />
  508. Reference easeInQuint: <br />
  509. http://www.zhihu.com/question/21981571/answer/19925418
  510. !#zh
  511. 创建 easeQuinticActionIn 缓动对象。<br />
  512. EaseQuinticIn 是按五次函数缓动进的动作。<br />
  513. 参考 easeInQuint:http://www.zhihu.com/question/21981571/answer/19925418
  514. @example
  515. ```js
  516. //example
  517. action.easing(cc.easeQuinticActionIn());
  518. ```
  519. */
  520. export function easeQuinticActionIn(): any;
  521. /**
  522. !#en
  523. Creates the action easing object. <br />
  524. Reference easeOutQuint: <br />
  525. http://www.zhihu.com/question/21981571/answer/19925418
  526. !#zh
  527. 创建 easeQuinticActionOut 缓动对象。<br />
  528. EaseQuinticOut 是按五次函数缓动退出的动作
  529. 参考 easeOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  530. @example
  531. ```js
  532. //example
  533. action.easing(cc.easeQuadraticActionOut());
  534. ```
  535. */
  536. export function easeQuinticActionOut(): any;
  537. /**
  538. !#en
  539. Creates the action easing object. <br />
  540. Reference easeInOutQuint: <br />
  541. http://www.zhihu.com/question/21981571/answer/19925418
  542. !#zh
  543. 创建 easeQuinticActionInOut 缓动对象。<br />
  544. EaseQuinticInOut是按五次函数缓动进入并退出的动作。<br />
  545. 参考 easeInOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  546. @example
  547. ```js
  548. //example
  549. action.easing(cc.easeQuinticActionInOut());
  550. ```
  551. */
  552. export function easeQuinticActionInOut(): any;
  553. /**
  554. !#en
  555. Creates the action easing object. <br />
  556. Reference easeInCirc: <br />
  557. http://www.zhihu.com/question/21981571/answer/19925418
  558. !#zh
  559. 创建 easeCircleActionIn 缓动对象。<br />
  560. EaseCircleIn是按圆形曲线缓动进入的动作。<br />
  561. 参考 easeInCirc:http://www.zhihu.com/question/21981571/answer/19925418
  562. @example
  563. ```js
  564. //example
  565. action.easing(cc.easeCircleActionIn());
  566. ```
  567. */
  568. export function easeCircleActionIn(): any;
  569. /**
  570. !#en
  571. Creates the action easing object. <br />
  572. Reference easeOutCirc: <br />
  573. http://www.zhihu.com/question/21981571/answer/19925418
  574. !#zh
  575. 创建 easeCircleActionOut 缓动对象。<br />
  576. EaseCircleOut是按圆形曲线缓动退出的动作。<br />
  577. 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  578. @example
  579. ```js
  580. //example
  581. actioneasing(cc.easeCircleActionOut());
  582. ```
  583. */
  584. export function easeCircleActionOut(): any;
  585. /**
  586. !#en
  587. Creates the action easing object. <br />
  588. Reference easeInOutCirc: <br />
  589. http://www.zhihu.com/question/21981571/answer/19925418
  590. !#zh
  591. 创建 easeCircleActionInOut 缓动对象。<br />
  592. EaseCircleInOut 是按圆形曲线缓动进入并退出的动作。<br />
  593. 参考 easeInOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  594. @example
  595. ```js
  596. //example
  597. action.easing(cc.easeCircleActionInOut());
  598. ```
  599. */
  600. export function easeCircleActionInOut(): any;
  601. /**
  602. !#en
  603. Creates the action easing object. <br />
  604. Reference easeInCubic: <br />
  605. http://www.zhihu.com/question/21981571/answer/19925418
  606. !#zh
  607. 创建 easeCubicActionIn 缓动对象。<br />
  608. EaseCubicIn 是按三次函数缓动进入的动作。<br />
  609. 参考 easeInCubic:http://www.zhihu.com/question/21981571/answer/19925418
  610. @example
  611. ```js
  612. //example
  613. action.easing(cc.easeCubicActionIn());
  614. ```
  615. */
  616. export function easeCubicActionIn(): any;
  617. /**
  618. !#en
  619. Creates the action easing object. <br />
  620. Reference easeOutCubic: <br />
  621. http://www.zhihu.com/question/21981571/answer/19925418
  622. !#zh
  623. 创建 easeCubicActionOut 缓动对象。<br />
  624. EaseCubicOut 是按三次函数缓动退出的动作。<br />
  625. 参考 easeOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  626. @example
  627. ```js
  628. //example
  629. action.easing(cc.easeCubicActionOut());
  630. ```
  631. */
  632. export function easeCubicActionOut(): any;
  633. /**
  634. !#en
  635. Creates the action easing object. <br />
  636. Reference easeInOutCubic: <br />
  637. http://www.zhihu.com/question/21981571/answer/19925418
  638. !#zh
  639. 创建 easeCubicActionInOut 缓动对象。<br />
  640. EaseCubicInOut是按三次函数缓动进入并退出的动作。<br />
  641. 参考 easeInOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  642. */
  643. export function easeCubicActionInOut(): any;
  644. /**
  645. !#en Show the Node.
  646. !#zh 立即显示。
  647. @example
  648. ```js
  649. // example
  650. var showAction = cc.show();
  651. ```
  652. */
  653. export function show(): ActionInstant;
  654. /**
  655. !#en Hide the node.
  656. !#zh 立即隐藏。
  657. @example
  658. ```js
  659. // example
  660. var hideAction = cc.hide();
  661. ```
  662. */
  663. export function hide(): ActionInstant;
  664. /**
  665. !#en Toggles the visibility of a node.
  666. !#zh 显隐状态切换。
  667. @example
  668. ```js
  669. // example
  670. var toggleVisibilityAction = cc.toggleVisibility();
  671. ```
  672. */
  673. export function toggleVisibility(): ActionInstant;
  674. /**
  675. !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
  676. !#zh 从父节点移除自身。
  677. @param isNeedCleanUp isNeedCleanUp
  678. @example
  679. ```js
  680. // example
  681. var removeSelfAction = cc.removeSelf();
  682. ```
  683. */
  684. export function removeSelf(isNeedCleanUp ?: boolean): ActionInstant;
  685. /**
  686. !#en Create a FlipX action to flip or unflip the target.
  687. !#zh X轴翻转。
  688. @param flip Indicate whether the target should be flipped or not
  689. @example
  690. ```js
  691. var flipXAction = cc.flipX(true);
  692. ```
  693. */
  694. export function flipX(flip: boolean): ActionInstant;
  695. /**
  696. !#en Create a FlipY action to flip or unflip the target.
  697. !#zh Y轴翻转。
  698. @param flip flip
  699. @example
  700. ```js
  701. var flipYAction = cc.flipY(true);
  702. ```
  703. */
  704. export function flipY(flip: boolean): ActionInstant;
  705. /**
  706. !#en Creates a Place action with a position.
  707. !#zh 放置在目标位置。
  708. @param pos pos
  709. @param y y
  710. @example
  711. ```js
  712. // example
  713. var placeAction = cc.place(cc.v2(200, 200));
  714. var placeAction = cc.place(200, 200);
  715. ```
  716. */
  717. export function place(pos: Vec2|number, y?: number): ActionInstant;
  718. /**
  719. !#en Creates the action with the callback.
  720. !#zh 执行回调函数。
  721. @param selector selector
  722. @param selectorTarget selectorTarget
  723. @param data data for function, it accepts all data types.
  724. @example
  725. ```js
  726. // example
  727. // CallFunc without data
  728. var finish = cc.callFunc(this.removeSprite, this);
  729. // CallFunc with data
  730. var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini, true);
  731. ```
  732. */
  733. export function callFunc(selector: Function, selectorTarget?: any, data?: any): ActionInstant;
  734. /**
  735. !#en
  736. Helper constructor to create an array of sequenceable actions
  737. The created action will run actions sequentially, one after another.
  738. !#zh 顺序执行动作,创建的动作将按顺序依次运行。
  739. @param actionOrActionArray actionOrActionArray
  740. @param tempArray tempArray
  741. @example
  742. ```js
  743. // example
  744. // create sequence with actions
  745. var seq = cc.sequence(act1, act2);
  746. // create sequence with array
  747. var seq = cc.sequence(actArray);
  748. ```
  749. */
  750. export function sequence(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): ActionInterval;
  751. /**
  752. !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
  753. !#zh 重复动作,可以按一定次数重复一个动,如果想永远重复一个动作请使用 repeatForever 动作来完成。
  754. @param action action
  755. @param times times
  756. @example
  757. ```js
  758. // example
  759. var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
  760. ```
  761. */
  762. export function repeat(action: FiniteTimeAction, times: number): ActionInterval;
  763. /**
  764. !#en Create a acton which repeat forever, as it runs forever, it can't be added into cc.sequence and cc.spawn.
  765. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 repeat 动作,由于这个动作不会停止,所以不能被添加到 cc.sequence 或 cc.spawn 中。
  766. @param action action
  767. @example
  768. ```js
  769. // example
  770. var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
  771. ```
  772. */
  773. export function repeatForever(action: FiniteTimeAction): ActionInterval;
  774. /**
  775. !#en Create a spawn action which runs several actions in parallel.
  776. !#zh 同步执行动作,同步执行一组动作。
  777. @param actionOrActionArray actionOrActionArray
  778. @param tempArray tempArray
  779. @example
  780. ```js
  781. // example
  782. var action = cc.spawn(cc.jumpBy(2, cc.v2(300, 0), 50, 4), cc.rotateBy(2, 720));
  783. todo:It should be the direct use new
  784. ```
  785. */
  786. export function spawn(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): FiniteTimeAction;
  787. /**
  788. !#en
  789. Rotates a Node object to a certain angle by modifying its rotation property. <br/>
  790. The direction will be decided by the shortest angle.
  791. !#zh 旋转到目标角度,通过逐帧修改它的 rotation 属性,旋转方向将由最短的角度决定。
  792. @param duration duration in seconds
  793. @param deltaAngleX deltaAngleX in degrees.
  794. @param deltaAngleY deltaAngleY in degrees.
  795. @example
  796. ```js
  797. // example
  798. var rotateTo = cc.rotateTo(2, 61.0);
  799. ```
  800. */
  801. export function rotateTo(duration: number, deltaAngleX: number, deltaAngleY?: number): ActionInterval;
  802. /**
  803. !#en
  804. Rotates a Node object clockwise a number of degrees by modifying its rotation property.
  805. Relative to its properties to modify.
  806. !#zh 旋转指定的角度。
  807. @param duration duration in seconds
  808. @param deltaAngleX deltaAngleX in degrees
  809. @param deltaAngleY deltaAngleY in degrees
  810. @example
  811. ```js
  812. // example
  813. var actionBy = cc.rotateBy(2, 360);
  814. ```
  815. */
  816. export function rotateBy(duration: number, deltaAngleX: number, deltaAngleY?: number): ActionInterval;
  817. /**
  818. !#en
  819. Moves a Node object x,y pixels by modifying its position property. <br/>
  820. x and y are relative to the position of the object. <br/>
  821. Several MoveBy actions can be concurrently called, and the resulting <br/>
  822. movement will be the sum of individual movements.
  823. !#zh 移动指定的距离。
  824. @param duration duration in seconds
  825. @param deltaPos deltaPos
  826. @param deltaY deltaY
  827. @example
  828. ```js
  829. // example
  830. var actionTo = cc.moveBy(2, cc.v2(windowSize.width - 40, windowSize.height - 40));
  831. ```
  832. */
  833. export function moveBy(duration: number, deltaPos: Vec2|number, deltaY?: number): ActionInterval;
  834. /**
  835. !#en
  836. Moves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property. <br/>
  837. Several MoveTo actions can be concurrently called, and the resulting <br/>
  838. movement will be the sum of individual movements.
  839. !#zh 移动到目标位置。
  840. @param duration duration in seconds
  841. @param position position
  842. @param y y
  843. @example
  844. ```js
  845. // example
  846. var actionBy = cc.moveTo(2, cc.v2(80, 80));
  847. ```
  848. */
  849. export function moveTo(duration: number, position: Vec2|number, y?: number): ActionInterval;
  850. /**
  851. !#en
  852. Create a action which skews a Node object to given angles by modifying its skewX and skewY properties.
  853. Changes to the specified value.
  854. !#zh 偏斜到目标角度。
  855. @param t time in seconds
  856. @param sx sx
  857. @param sy sy
  858. @example
  859. ```js
  860. // example
  861. var actionTo = cc.skewTo(2, 37.2, -37.2);
  862. ```
  863. */
  864. export function skewTo(t: number, sx: number, sy: number): ActionInterval;
  865. /**
  866. !#en
  867. Skews a Node object by skewX and skewY degrees. <br />
  868. Relative to its property modification.
  869. !#zh 偏斜指定的角度。
  870. @param t time in seconds
  871. @param sx sx skew in degrees for X axis
  872. @param sy sy skew in degrees for Y axis
  873. @example
  874. ```js
  875. // example
  876. var actionBy = cc.skewBy(2, 0, -90);
  877. ```
  878. */
  879. export function skewBy(t: number, sx: number, sy: number): ActionInterval;
  880. /**
  881. !#en
  882. Moves a Node object simulating a parabolic jump movement by modifying it's position property.
  883. Relative to its movement.
  884. !#zh 用跳跃的方式移动指定的距离。
  885. @param duration duration
  886. @param position position
  887. @param y y
  888. @param height height
  889. @param jumps jumps
  890. @example
  891. ```js
  892. // example
  893. var actionBy = cc.jumpBy(2, cc.v2(300, 0), 50, 4);
  894. var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
  895. ```
  896. */
  897. export function jumpBy(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  898. /**
  899. !#en
  900. Moves a Node object to a parabolic position simulating a jump movement by modifying its position property. <br />
  901. Jump to the specified location.
  902. !#zh 用跳跃的方式移动到目标位置。
  903. @param duration duration
  904. @param position position
  905. @param y y
  906. @param height height
  907. @param jumps jumps
  908. @example
  909. ```js
  910. // example
  911. var actionTo = cc.jumpTo(2, cc.v2(300, 300), 50, 4);
  912. var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
  913. ```
  914. */
  915. export function jumpTo(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  916. /**
  917. !#en
  918. An action that moves the target with a cubic Bezier curve by a certain distance.
  919. Relative to its movement.
  920. !#zh 按贝赛尔曲线轨迹移动指定的距离。
  921. @param t time in seconds
  922. @param c Array of points
  923. @example
  924. ```js
  925. // example
  926. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  927. var bezierForward = cc.bezierBy(3, bezier);
  928. ```
  929. */
  930. export function bezierBy(t: number, c: Vec2[]): ActionInterval;
  931. /**
  932. !#en An action that moves the target with a cubic Bezier curve to a destination point.
  933. !#zh 按贝赛尔曲线轨迹移动到目标位置。
  934. @param t t
  935. @param c Array of points
  936. @example
  937. ```js
  938. // example
  939. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  940. var bezierTo = cc.bezierTo(2, bezier);
  941. ```
  942. */
  943. export function bezierTo(t: number, c: Vec2[]): ActionInterval;
  944. /**
  945. !#en Scales a Node object to a zoom factor by modifying it's scale property.
  946. !#zh 将节点大小缩放到指定的倍数。
  947. @param duration duration
  948. @param sx scale parameter in X
  949. @param sy scale parameter in Y, if Null equal to sx
  950. @example
  951. ```js
  952. // example
  953. // It scales to 0.5 in both X and Y.
  954. var actionTo = cc.scaleTo(2, 0.5);
  955. // It scales to 0.5 in x and 2 in Y
  956. var actionTo = cc.scaleTo(2, 0.5, 2);
  957. ```
  958. */
  959. export function scaleTo(duration: number, sx: number, sy?: number): ActionInterval;
  960. /**
  961. !#en
  962. Scales a Node object a zoom factor by modifying it's scale property.
  963. Relative to its changes.
  964. !#zh 按指定的倍数缩放节点大小。
  965. @param duration duration in seconds
  966. @param sx sx scale parameter in X
  967. @param sy sy scale parameter in Y, if Null equal to sx
  968. @example
  969. ```js
  970. // example without sy, it scales by 2 both in X and Y
  971. var actionBy = cc.scaleBy(2, 2);
  972. //example with sy, it scales by 0.25 in X and 4.5 in Y
  973. var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
  974. ```
  975. */
  976. export function scaleBy(duration: number, sx: number, sy?: number|void): ActionInterval;
  977. /**
  978. !#en Blinks a Node object by modifying it's visible property.
  979. !#zh 闪烁(基于透明度)。
  980. @param duration duration in seconds
  981. @param blinks blinks in times
  982. @example
  983. ```js
  984. // example
  985. var action = cc.blink(2, 10);
  986. ```
  987. */
  988. export function blink(duration: number, blinks: number): ActionInterval;
  989. /**
  990. !#en
  991. Fades an object that implements the cc.RGBAProtocol protocol.
  992. It modifies the opacity from the current value to a custom one.
  993. !#zh 修改透明度到指定值。
  994. @param duration duration
  995. @param opacity 0-255, 0 is transparent
  996. @example
  997. ```js
  998. // example
  999. var action = cc.fadeTo(1.0, 0);
  1000. ```
  1001. */
  1002. export function fadeTo(duration: number, opacity: number): ActionInterval;
  1003. /**
  1004. !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
  1005. !#zh 渐显效果。
  1006. @param duration duration in seconds
  1007. @example
  1008. ```js
  1009. //example
  1010. var action = cc.fadeIn(1.0);
  1011. ```
  1012. */
  1013. export function fadeIn(duration: number): ActionInterval;
  1014. /**
  1015. !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
  1016. !#zh 渐隐效果。
  1017. @param d duration in seconds
  1018. @example
  1019. ```js
  1020. // example
  1021. var action = cc.fadeOut(1.0);
  1022. ```
  1023. */
  1024. export function fadeOut(d: number): ActionInterval;
  1025. /**
  1026. !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  1027. !#zh 修改颜色到指定值。
  1028. @param duration duration
  1029. @param red 0-255
  1030. @param green 0-255
  1031. @param blue 0-255
  1032. @example
  1033. ```js
  1034. // example
  1035. var action = cc.tintTo(2, 255, 0, 255);
  1036. ```
  1037. */
  1038. export function tintTo(duration: number, red: number, green: number, blue: number): ActionInterval;
  1039. /**
  1040. !#en
  1041. Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  1042. Relative to their own color change.
  1043. !#zh 按照指定的增量修改颜色。
  1044. @param duration duration in seconds
  1045. @param deltaRed deltaRed
  1046. @param deltaGreen deltaGreen
  1047. @param deltaBlue deltaBlue
  1048. @example
  1049. ```js
  1050. // example
  1051. var action = cc.tintBy(2, -127, -255, -127);
  1052. ```
  1053. */
  1054. export function tintBy(duration: number, deltaRed: number, deltaGreen: number, deltaBlue: number): ActionInterval;
  1055. /**
  1056. !#en Delays the action a certain amount of seconds.
  1057. !#zh 延迟指定的时间量。
  1058. @param d duration in seconds
  1059. @example
  1060. ```js
  1061. // example
  1062. var delay = cc.delayTime(1);
  1063. ```
  1064. */
  1065. export function delayTime(d: number): ActionInterval;
  1066. /**
  1067. !#en Executes an action in reverse order, from time=duration to time=0.
  1068. !#zh 反转目标动作的时间轴。
  1069. @param action action
  1070. @example
  1071. ```js
  1072. // example
  1073. var reverse = cc.reverseTime(this);
  1074. ```
  1075. */
  1076. export function reverseTime(action: FiniteTimeAction): ActionInterval;
  1077. /**
  1078. !#en Create an action with the specified action and forced target.
  1079. !#zh 用已有动作和一个新的目标节点创建动作。
  1080. @param target target
  1081. @param action action
  1082. */
  1083. export function targetedAction(target: Node, action: FiniteTimeAction): ActionInterval;
  1084. /** !#en The System event singleton for global usage
  1085. !#zh 系统事件单例,方便全局使用 */
  1086. export var systemEvent: SystemEvent;
  1087. /**
  1088. !#en Defines a CCClass using the given specification, please see [Class](/docs/editors_and_tools/creator-chapters/scripting/class.html) for details.
  1089. !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/docs/creator/scripting/class.html)。
  1090. @param options options
  1091. @example
  1092. ```js
  1093. // define base class
  1094. var Node = cc.Class();
  1095. // define sub class
  1096. var Sprite = cc.Class({
  1097. name: 'Sprite',
  1098. extends: Node,
  1099. ctor: function () {
  1100. this.url = "";
  1101. this.id = 0;
  1102. },
  1103. statics: {
  1104. // define static members
  1105. count: 0,
  1106. getBounds: function (spriteList) {
  1107. // compute bounds...
  1108. }
  1109. },
  1110. properties {
  1111. width: {
  1112. default: 128,
  1113. type: 'Integer',
  1114. tooltip: 'The width of sprite'
  1115. },
  1116. height: 128,
  1117. size: {
  1118. get: function () {
  1119. return cc.v2(this.width, this.height);
  1120. }
  1121. }
  1122. },
  1123. load: function () {
  1124. // load this.url...
  1125. };
  1126. });
  1127. // instantiate
  1128. var obj = new Sprite();
  1129. obj.url = 'sprite.png';
  1130. obj.load();
  1131. ```
  1132. */
  1133. 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;
  1134. /**
  1135. !#en
  1136. Define an enum type. <br/>
  1137. 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/>
  1138. Otherwise it will use the value specified by user who writes the enum definition.
  1139. !#zh
  1140. 定义一个枚举类型。<br/>
  1141. 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  1142. @param obj a JavaScript literal object containing enum names and values, or a TypeScript enum type
  1143. @example
  1144. ```js
  1145. // JavaScript:
  1146. var WrapMode = cc.Enum({
  1147. Repeat: -1,
  1148. Clamp: -1
  1149. });
  1150. // Texture.WrapMode.Repeat == 0
  1151. // Texture.WrapMode.Clamp == 1
  1152. // Texture.WrapMode[0] == "Repeat"
  1153. // Texture.WrapMode[1] == "Clamp"
  1154. var FlagType = cc.Enum({
  1155. Flag1: 1,
  1156. Flag2: 2,
  1157. Flag3: 4,
  1158. Flag4: 8,
  1159. });
  1160. var AtlasSizeList = cc.Enum({
  1161. 128: 128,
  1162. 256: 256,
  1163. 512: 512,
  1164. 1024: 1024,
  1165. });
  1166. // TypeScript:
  1167. // If used in TypeScript, just define a TypeScript enum:
  1168. enum Direction {
  1169. Up,
  1170. Down,
  1171. Left,
  1172. Right
  1173. }
  1174. // If you need to inspect the enum in Properties panel, you can call cc.Enum:
  1175. const {ccclass, property} = cc._decorator;
  1176. @ccclass
  1177. class NewScript extends cc.Component {
  1178. @property({
  1179. type: cc.Enum(Direction) // call cc.Enum
  1180. })
  1181. direction: Direction = Direction.Up;
  1182. }
  1183. ```
  1184. */
  1185. export function Enum<T>(obj: T): T;
  1186. /**
  1187. @param touches touches
  1188. */
  1189. export function handleTouchesBegin(touches: any[]): void;
  1190. /**
  1191. @param touches touches
  1192. */
  1193. export function handleTouchesMove(touches: any[]): void;
  1194. /**
  1195. @param touches touches
  1196. */
  1197. export function handleTouchesEnd(touches: any[]): void;
  1198. /**
  1199. @param touches touches
  1200. */
  1201. export function handleTouchesCancel(touches: any[]): void;
  1202. /**
  1203. @param touches touches
  1204. */
  1205. export function getSetOfTouchesEndOrCancel(touches: any[]): any[];
  1206. /**
  1207. @param element element
  1208. */
  1209. export function getHTMLElementPosition(element: HTMLElement): any;
  1210. /**
  1211. @param touch touch
  1212. */
  1213. export function getPreTouch(touch: Touch): Touch;
  1214. /**
  1215. @param touch touch
  1216. */
  1217. export function setPreTouch(touch: Touch): void;
  1218. /**
  1219. @param tx tx
  1220. @param ty ty
  1221. @param pos pos
  1222. */
  1223. export function getTouchByXY(tx: number, ty: number, pos: Vec2): Touch;
  1224. /**
  1225. @param location location
  1226. @param pos pos
  1227. @param eventType eventType
  1228. */
  1229. export function getMouseEvent(location: Vec2, pos: Vec2, eventType: number): Event.EventMouse;
  1230. /**
  1231. @param event event
  1232. @param pos pos
  1233. */
  1234. export function getPointByEvent(event: Touch, pos: Vec2): Vec2;
  1235. /**
  1236. @param event event
  1237. @param pos pos
  1238. */
  1239. export function getTouchesByEvent(event: Touch, pos: Vec2): any[];
  1240. /**
  1241. @param element element
  1242. */
  1243. export function registerSystemEvent(element: HTMLElement): void;
  1244. /**
  1245. @param dt dt
  1246. */
  1247. export function update(dt: number): void;
  1248. /**
  1249. !#en
  1250. Checks whether the object is non-nil and not yet destroyed.<br>
  1251. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  1252. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  1253. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  1254. but this is often caused by a particular logical requirements, which is not normally required.
  1255. !#zh
  1256. 检查该对象是否不为 null 并且尚未销毁。<br>
  1257. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
  1258. @param value value
  1259. @param strictMode If true, Object called destroy() in this frame will also treated as invalid.
  1260. @example
  1261. ```js
  1262. var node = new cc.Node();
  1263. cc.log(cc.isValid(node)); // true
  1264. node.destroy();
  1265. cc.log(cc.isValid(node)); // true, still valid in this frame
  1266. // after a frame...
  1267. cc.log(cc.isValid(node)); // false, destroyed in the end of last frame
  1268. ```
  1269. */
  1270. export function isValid(value: any, strictMode?: boolean): boolean;
  1271. /** !#en cc.view is the shared view object.
  1272. !#zh cc.view 是全局的视图对象。 */
  1273. export var view: View;
  1274. /** !#en cc.winSize is the alias object for the size of the current game window.
  1275. !#zh cc.winSize 为当前的游戏窗口的大小。 */
  1276. export var winSize: Size;
  1277. /** Specify that the input value must be integer in Inspector.
  1278. Also used to indicates that the elements in array should be type integer. */
  1279. export var Integer: string;
  1280. /** Indicates that the elements in array should be type double. */
  1281. export var Float: string;
  1282. /** Indicates that the elements in array should be type boolean. */
  1283. export var Boolean: string;
  1284. /** Indicates that the elements in array should be type string. */
  1285. export var String: string;
  1286. /**
  1287. !#en Deserialize json to cc.Asset
  1288. !#zh 将 JSON 反序列化为对象实例。
  1289. 当指定了 target 选项时,如果 target 引用的其它 asset 的 uuid 不变,则不会改变 target 对 asset 的引用,
  1290. 也不会将 uuid 保存到 result 对象中。
  1291. @param data the serialized cc.Asset json string or json object.
  1292. @param details additional loading result
  1293. @param options options
  1294. */
  1295. export function deserialize(data: string|any, details?: Details, options?: any): any;
  1296. /**
  1297. !#en Clones the object `original` and returns the clone, or instantiate a node from the Prefab.
  1298. !#zh 克隆指定的任意类型的对象,或者从 Prefab 实例化出新节点。
  1299. (Instantiate 时,function 和 dom 等非可序列化对象会直接保留原有引用,Asset 会直接进行浅拷贝,可序列化类型会进行深拷贝。)
  1300. @param original An existing object that you want to make a copy of.
  1301. @example
  1302. ```js
  1303. // instantiate node from prefab
  1304. var scene = cc.director.getScene();
  1305. var node = cc.instantiate(prefabAsset);
  1306. node.parent = scene;
  1307. // clone node
  1308. var scene = cc.director.getScene();
  1309. var node = cc.instantiate(targetNode);
  1310. node.parent = scene;
  1311. ```
  1312. */
  1313. export function instantiate(original: Prefab): Node;
  1314. export function instantiate<T>(original: T): T;
  1315. /**
  1316. Finds a node by hierarchy path, the path is case-sensitive.
  1317. It will traverse the hierarchy by splitting the path using '/' character.
  1318. This function will still returns the node even if it is inactive.
  1319. It is recommended to not use this function every frame instead cache the result at startup.
  1320. @param path path
  1321. @param referenceNode referenceNode
  1322. */
  1323. export function find(path: string, referenceNode?: Node): Node;
  1324. /**
  1325. !#en
  1326. The convenience method to create a new {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}}
  1327. Alpha channel is optional. Default value is 255.
  1328. !#zh
  1329. 通过该方法来创建一个新的 {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}} 对象。
  1330. Alpha 通道是可选的。默认值是 255。
  1331. @param r r
  1332. @param g g
  1333. @param b b
  1334. @param a a
  1335. @example
  1336. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/color.js
  1337. */
  1338. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  1339. /**
  1340. !#en
  1341. The convenience method to create a new Rect.
  1342. see {{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1343. !#zh
  1344. 该方法用来快速创建一个新的矩形。{{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1345. @param x x
  1346. @param y y
  1347. @param w w
  1348. @param h h
  1349. @example
  1350. ```js
  1351. var a = new cc.Rect(0 , 0, 10, 0);
  1352. ```
  1353. */
  1354. export function rect(x?: number, y?: number, w?: number, h?: number): Rect;
  1355. /**
  1356. !#en
  1357. Helper function that creates a cc.Size.<br/>
  1358. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.
  1359. !#zh
  1360. 创建一个 cc.Size 对象的帮助函数。<br/>
  1361. 注意:可以使用 cc.p 或者是 cc.v2 代替,它们将很快取代 cc.Size。
  1362. @param w width or a size object
  1363. @param h height
  1364. @example
  1365. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCSize/size.js
  1366. */
  1367. export function size(w: number|Size, h?: number): Size;
  1368. /**
  1369. !#en The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
  1370. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}} 对象。
  1371. @param x x
  1372. @param y y
  1373. @example
  1374. ```js
  1375. var v1 = cc.v2();
  1376. var v2 = cc.v2(0, 0);
  1377. var v3 = cc.v2(v2);
  1378. var v4 = cc.v2({x: 100, y: 100});
  1379. ```
  1380. */
  1381. export function v2(x?: number|any, y?: number): Vec2;
  1382. /**
  1383. !#en This function is deprecated since v2.0, please use {{#crossLink "v2"}}cc.v2{{/crossLink}}.
  1384. !#zh 这个函数从 v2.0 开始被废弃,请使用 {{#crossLink "v2"}}cc.v2{{/crossLink}}。
  1385. @param x a Number or a size object
  1386. @param y y
  1387. */
  1388. export function p(x?: number|any, y?: number): Vec2;
  1389. export var dynamicAtlasManager: DynamicAtlasManager;
  1390. /** !#en cc.audioEngine is the singleton object, it provide simple audio APIs.
  1391. !#zh
  1392. cc.audioengine是单例对象。<br/>
  1393. 主要用来播放音频,播放的时候会返回一个 audioID,之后都可以通过这个 audioID 来操作这个音频对象。<br/>
  1394. 不使用的时候,请使用 cc.audioEngine.uncache(filePath); 进行资源释放 <br/>
  1395. 注意:<br/>
  1396. 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。<br/>
  1397. 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,<br/>
  1398. 有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。 */
  1399. export class audioEngine {
  1400. /**
  1401. !#en Play audio.
  1402. !#zh 播放音频
  1403. @param clip The audio clip to play.
  1404. @param loop Whether the music loop or not.
  1405. @param volume Volume size.
  1406. @example
  1407. ```js
  1408. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  1409. var audioID = cc.audioEngine.play(clip, false, 0.5);
  1410. });
  1411. ```
  1412. */
  1413. static play(clip: AudioClip, loop: boolean, volume: number): number;
  1414. /**
  1415. !#en Set audio loop.
  1416. !#zh 设置音频是否循环。
  1417. @param audioID audio id.
  1418. @param loop Whether cycle.
  1419. @example
  1420. ```js
  1421. cc.audioEngine.setLoop(id, true);
  1422. ```
  1423. */
  1424. static setLoop(audioID: number, loop: boolean): void;
  1425. /**
  1426. !#en Get audio cycle state.
  1427. !#zh 获取音频的循环状态。
  1428. @param audioID audio id.
  1429. @example
  1430. ```js
  1431. cc.audioEngine.isLoop(id);
  1432. ```
  1433. */
  1434. static isLoop(audioID: number): boolean;
  1435. /**
  1436. !#en Set the volume of audio.
  1437. !#zh 设置音量(0.0 ~ 1.0)。
  1438. @param audioID audio id.
  1439. @param volume Volume must be in 0.0~1.0 .
  1440. @example
  1441. ```js
  1442. cc.audioEngine.setVolume(id, 0.5);
  1443. ```
  1444. */
  1445. static setVolume(audioID: number, volume: number): void;
  1446. /**
  1447. !#en The volume of the music max value is 1.0,the min value is 0.0 .
  1448. !#zh 获取音量(0.0 ~ 1.0)。
  1449. @param audioID audio id.
  1450. @example
  1451. ```js
  1452. var volume = cc.audioEngine.getVolume(id);
  1453. ```
  1454. */
  1455. static getVolume(audioID: number): number;
  1456. /**
  1457. !#en Set current time
  1458. !#zh 设置当前的音频时间。
  1459. @param audioID audio id.
  1460. @param sec current time.
  1461. @example
  1462. ```js
  1463. cc.audioEngine.setCurrentTime(id, 2);
  1464. ```
  1465. */
  1466. static setCurrentTime(audioID: number, sec: number): boolean;
  1467. /**
  1468. !#en Get current time
  1469. !#zh 获取当前的音频播放时间。
  1470. @param audioID audio id.
  1471. @example
  1472. ```js
  1473. var time = cc.audioEngine.getCurrentTime(id);
  1474. ```
  1475. */
  1476. static getCurrentTime(audioID: number): number;
  1477. /**
  1478. !#en Get audio duration
  1479. !#zh 获取音频总时长。
  1480. @param audioID audio id.
  1481. @example
  1482. ```js
  1483. var time = cc.audioEngine.getDuration(id);
  1484. ```
  1485. */
  1486. static getDuration(audioID: number): number;
  1487. /**
  1488. !#en Get audio state
  1489. !#zh 获取音频状态。
  1490. @param audioID audio id.
  1491. @example
  1492. ```js
  1493. var state = cc.audioEngine.getState(id);
  1494. ```
  1495. */
  1496. static getState(audioID: number): audioEngine.AudioState;
  1497. /**
  1498. !#en Set Audio finish callback
  1499. !#zh 设置一个音频结束后的回调
  1500. @param audioID audio id.
  1501. @param callback loaded callback.
  1502. @example
  1503. ```js
  1504. cc.audioEngine.setFinishCallback(id, function () {});
  1505. ```
  1506. */
  1507. static setFinishCallback(audioID: number, callback: Function): void;
  1508. /**
  1509. !#en Pause playing audio.
  1510. !#zh 暂停正在播放音频。
  1511. @param audioID The return value of function play.
  1512. @example
  1513. ```js
  1514. cc.audioEngine.pause(audioID);
  1515. ```
  1516. */
  1517. static pause(audioID: number): void;
  1518. /**
  1519. !#en Pause all playing audio
  1520. !#zh 暂停现在正在播放的所有音频。
  1521. @example
  1522. ```js
  1523. cc.audioEngine.pauseAll();
  1524. ```
  1525. */
  1526. static pauseAll(): void;
  1527. /**
  1528. !#en Resume playing audio.
  1529. !#zh 恢复播放指定的音频。
  1530. @param audioID The return value of function play.
  1531. @example
  1532. ```js
  1533. cc.audioEngine.resume(audioID);
  1534. ```
  1535. */
  1536. static resume(audioID: number): void;
  1537. /**
  1538. !#en Resume all playing audio.
  1539. !#zh 恢复播放所有之前暂停的所有音频。
  1540. @example
  1541. ```js
  1542. cc.audioEngine.resumeAll();
  1543. ```
  1544. */
  1545. static resumeAll(): void;
  1546. /**
  1547. !#en Stop playing audio.
  1548. !#zh 停止播放指定音频。
  1549. @param audioID The return value of function play.
  1550. @example
  1551. ```js
  1552. cc.audioEngine.stop(audioID);
  1553. ```
  1554. */
  1555. static stop(audioID: number): void;
  1556. /**
  1557. !#en Stop all playing audio.
  1558. !#zh 停止正在播放的所有音频。
  1559. @example
  1560. ```js
  1561. cc.audioEngine.stopAll();
  1562. ```
  1563. */
  1564. static stopAll(): void;
  1565. /**
  1566. !#en Set up an audio can generate a few examples.
  1567. !#zh 设置一个音频可以设置几个实例
  1568. @param num a number of instances to be created from within an audio
  1569. @example
  1570. ```js
  1571. cc.audioEngine.setMaxAudioInstance(20);
  1572. ```
  1573. */
  1574. static setMaxAudioInstance(num: number): void;
  1575. /**
  1576. !#en Getting audio can produce several examples.
  1577. !#zh 获取一个音频可以设置几个实例
  1578. @example
  1579. ```js
  1580. cc.audioEngine.getMaxAudioInstance();
  1581. ```
  1582. */
  1583. static getMaxAudioInstance(): number;
  1584. /**
  1585. !#en Unload the preloaded audio from internal buffer.
  1586. !#zh 卸载预加载的音频。
  1587. @param clip clip
  1588. @example
  1589. ```js
  1590. cc.audioEngine.uncache(filePath);
  1591. ```
  1592. */
  1593. static uncache(clip: AudioClip): void;
  1594. /**
  1595. !#en Unload all audio from internal buffer.
  1596. !#zh 卸载所有音频。
  1597. @example
  1598. ```js
  1599. cc.audioEngine.uncacheAll();
  1600. ```
  1601. */
  1602. static uncacheAll(): void;
  1603. /**
  1604. !#en Preload audio file.
  1605. !#zh 预加载一个音频
  1606. @param filePath The file path of an audio.
  1607. @param callback The callback of an audio.
  1608. @example
  1609. ```js
  1610. cc.audioEngine.preload(path);
  1611. ```
  1612. */
  1613. static preload(filePath: string, callback?: Function): void;
  1614. /**
  1615. !#en Set a size, the unit is KB. Over this size is directly resolved into DOM nodes.
  1616. !#zh 设置一个以 KB 为单位的尺寸,大于这个尺寸的音频在加载的时候会强制使用 dom 方式加载
  1617. @param kb The file path of an audio.
  1618. @example
  1619. ```js
  1620. cc.audioEngine.setMaxWebAudioSize(300);
  1621. ```
  1622. */
  1623. static setMaxWebAudioSize(kb: number): void;
  1624. /**
  1625. !#en Play background music
  1626. !#zh 播放背景音乐
  1627. @param clip The audio clip to play.
  1628. @param loop Whether the music loop or not.
  1629. @example
  1630. ```js
  1631. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  1632. var audioID = cc.audioEngine.playMusic(clip, false);
  1633. });
  1634. ```
  1635. */
  1636. static playMusic(clip: AudioClip, loop: boolean): number;
  1637. /**
  1638. !#en Stop background music.
  1639. !#zh 停止播放背景音乐。
  1640. @example
  1641. ```js
  1642. cc.audioEngine.stopMusic();
  1643. ```
  1644. */
  1645. static stopMusic(): void;
  1646. /**
  1647. !#en Pause the background music.
  1648. !#zh 暂停播放背景音乐。
  1649. @example
  1650. ```js
  1651. cc.audioEngine.pauseMusic();
  1652. ```
  1653. */
  1654. static pauseMusic(): void;
  1655. /**
  1656. !#en Resume playing background music.
  1657. !#zh 恢复播放背景音乐。
  1658. @example
  1659. ```js
  1660. cc.audioEngine.resumeMusic();
  1661. ```
  1662. */
  1663. static resumeMusic(): void;
  1664. /**
  1665. !#en Get the volume(0.0 ~ 1.0).
  1666. !#zh 获取音量(0.0 ~ 1.0)。
  1667. @example
  1668. ```js
  1669. var volume = cc.audioEngine.getMusicVolume();
  1670. ```
  1671. */
  1672. static getMusicVolume(): number;
  1673. /**
  1674. !#en Set the background music volume.
  1675. !#zh 设置背景音乐音量(0.0 ~ 1.0)。
  1676. @param volume Volume must be in 0.0~1.0.
  1677. @example
  1678. ```js
  1679. cc.audioEngine.setMusicVolume(0.5);
  1680. ```
  1681. */
  1682. static setMusicVolume(volume: number): void;
  1683. /**
  1684. !#en Background music playing state
  1685. !#zh 背景音乐是否正在播放
  1686. @example
  1687. ```js
  1688. cc.audioEngine.isMusicPlaying();
  1689. ```
  1690. */
  1691. static isMusicPlaying(): boolean;
  1692. /**
  1693. !#en Play effect audio.
  1694. !#zh 播放音效
  1695. @param clip The audio clip to play.
  1696. @param loop Whether the music loop or not.
  1697. @example
  1698. ```js
  1699. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  1700. var audioID = cc.audioEngine.playEffect(clip, false);
  1701. });
  1702. ```
  1703. */
  1704. static playEffect(clip: AudioClip, loop: boolean): number;
  1705. /**
  1706. !#en Set the volume of effect audio.
  1707. !#zh 设置音效音量(0.0 ~ 1.0)。
  1708. @param volume Volume must be in 0.0~1.0.
  1709. @example
  1710. ```js
  1711. cc.audioEngine.setEffectsVolume(0.5);
  1712. ```
  1713. */
  1714. static setEffectsVolume(volume: number): void;
  1715. /**
  1716. !#en The volume of the effect audio max value is 1.0,the min value is 0.0 .
  1717. !#zh 获取音效音量(0.0 ~ 1.0)。
  1718. @example
  1719. ```js
  1720. var volume = cc.audioEngine.getEffectsVolume();
  1721. ```
  1722. */
  1723. static getEffectsVolume(): number;
  1724. /**
  1725. !#en Pause effect audio.
  1726. !#zh 暂停播放音效。
  1727. @param audioID audio id.
  1728. @example
  1729. ```js
  1730. cc.audioEngine.pauseEffect(audioID);
  1731. ```
  1732. */
  1733. static pauseEffect(audioID: number): void;
  1734. /**
  1735. !#en Stop playing all the sound effects.
  1736. !#zh 暂停播放所有音效。
  1737. @example
  1738. ```js
  1739. cc.audioEngine.pauseAllEffects();
  1740. ```
  1741. */
  1742. static pauseAllEffects(): void;
  1743. /**
  1744. !#en Resume effect audio.
  1745. !#zh 恢复播放音效音频。
  1746. @param audioID The return value of function play.
  1747. @example
  1748. ```js
  1749. cc.audioEngine.resumeEffect(audioID);
  1750. ```
  1751. */
  1752. static resumeEffect(audioID: number): void;
  1753. /**
  1754. !#en Resume all effect audio.
  1755. !#zh 恢复播放所有之前暂停的音效。
  1756. @example
  1757. ```js
  1758. cc.audioEngine.resumeAllEffects();
  1759. ```
  1760. */
  1761. static resumeAllEffects(): void;
  1762. /**
  1763. !#en Stop playing the effect audio.
  1764. !#zh 停止播放音效。
  1765. @param audioID audio id.
  1766. @example
  1767. ```js
  1768. cc.audioEngine.stopEffect(id);
  1769. ```
  1770. */
  1771. static stopEffect(audioID: number): void;
  1772. /**
  1773. !#en Stop playing all the effects.
  1774. !#zh 停止播放所有音效。
  1775. @example
  1776. ```js
  1777. cc.audioEngine.stopAllEffects();
  1778. ```
  1779. */
  1780. static stopAllEffects(): void;
  1781. }
  1782. /** !#en Class for animation data handling.
  1783. !#zh 动画剪辑,用于存储动画数据。 */
  1784. export class AnimationClip extends Asset {
  1785. /** !#en Duration of this animation.
  1786. !#zh 动画的持续时间。 */
  1787. duration: number;
  1788. /** !#en FrameRate of this animation.
  1789. !#zh 动画的帧速率。 */
  1790. sample: number;
  1791. /** !#en Speed of this animation.
  1792. !#zh 动画的播放速度。 */
  1793. speed: number;
  1794. /** !#en WrapMode of this animation.
  1795. !#zh 动画的循环模式。 */
  1796. wrapMode: WrapMode;
  1797. /** !#en Curve data.
  1798. !#zh 曲线数据。 */
  1799. curveData: any;
  1800. /** !#en Event data.
  1801. !#zh 事件数据。 */
  1802. events: {frame: number, func: string, params: string[]}[];
  1803. /**
  1804. !#en Crate clip with a set of sprite frames
  1805. !#zh 使用一组序列帧图片来创建动画剪辑
  1806. @param spriteFrames spriteFrames
  1807. @param sample sample
  1808. @example
  1809. ```js
  1810. var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  1811. ```
  1812. */
  1813. static createWithSpriteFrames(spriteFrames: [SpriteFrame], sample: number): AnimationClip;
  1814. }
  1815. /** !#en
  1816. The AnimationState gives full control over animation playback process.
  1817. In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  1818. !#zh
  1819. AnimationState 完全控制动画播放过程。<br/>
  1820. 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 */
  1821. export class AnimationState extends Playable {
  1822. /**
  1823. @param clip clip
  1824. @param name name
  1825. */
  1826. constructor(clip: AnimationClip, name?: string);
  1827. animator: AnimationAnimator;
  1828. /** !#en The curves list.
  1829. !#zh 曲线列表。 */
  1830. curves: any[];
  1831. /** !#en The start delay which represents the number of seconds from an animation's start time to the start of
  1832. the active interval.
  1833. !#zh 延迟多少秒播放。 */
  1834. delay: number;
  1835. /** !#en The animation's iteration count property.
  1836. A real number greater than or equal to zero (including positive infinity) representing the number of times
  1837. to repeat the animation node.
  1838. Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  1839. calculations.
  1840. !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) */
  1841. repeatCount: number;
  1842. /** !#en The iteration duration of this animation in seconds. (length)
  1843. !#zh 单次动画的持续时间,秒。 */
  1844. duration: number;
  1845. /** !#en The animation's playback speed. 1 is normal playback speed.
  1846. !#zh 播放速率。 */
  1847. speed: number;
  1848. /** !#en
  1849. Wrapping mode of the playing animation.
  1850. Notice : dynamic change wrapMode will reset time and repeatCount property
  1851. !#zh
  1852. 动画循环方式。
  1853. 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount */
  1854. wrapMode: WrapMode;
  1855. /** !#en The current time of this animation in seconds.
  1856. !#zh 动画当前的时间,秒。 */
  1857. time: number;
  1858. /** !#en The clip that is being played by this animation state.
  1859. !#zh 此动画状态正在播放的剪辑。 */
  1860. clip: AnimationClip;
  1861. /** !#en The name of the playing animation.
  1862. !#zh 动画的名字 */
  1863. name: string;
  1864. }
  1865. /** undefined */
  1866. export class Playable {
  1867. /** !#en Is playing or paused in play mode?
  1868. !#zh 当前是否正在播放。 */
  1869. isPlaying: boolean;
  1870. /** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).
  1871. !#zh 当前是否正在暂停 */
  1872. isPaused: boolean;
  1873. /**
  1874. !#en Play this animation.
  1875. !#zh 播放动画。
  1876. */
  1877. play(): void;
  1878. /**
  1879. !#en Stop this animation.
  1880. !#zh 停止动画播放。
  1881. */
  1882. stop(): void;
  1883. /**
  1884. !#en Pause this animation.
  1885. !#zh 暂停动画。
  1886. */
  1887. pause(): void;
  1888. /**
  1889. !#en Resume this animation.
  1890. !#zh 重新播放动画。
  1891. */
  1892. resume(): void;
  1893. /**
  1894. !#en Perform a single frame step.
  1895. !#zh 执行一帧动画。
  1896. */
  1897. step(): void;
  1898. }
  1899. /** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.
  1900. !#zh 动画使用的循环模式。 */
  1901. export enum WrapMode {
  1902. Default = 0,
  1903. Normal = 0,
  1904. Reverse = 0,
  1905. Loop = 0,
  1906. LoopReverse = 0,
  1907. PingPong = 0,
  1908. PingPongReverse = 0,
  1909. }
  1910. /** !#en An object to boot the game.
  1911. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  1912. export class debug {
  1913. /**
  1914. !#en Gets error message with the error id and possible parameters.
  1915. !#zh 通过 error id 和必要的参数来获取错误信息。
  1916. @param errorId errorId
  1917. @param param param
  1918. */
  1919. static getError(errorId: id, param?: any): string;
  1920. /**
  1921. !#en Returns whether or not to display the FPS informations.
  1922. !#zh 是否显示 FPS 信息。
  1923. */
  1924. static isDisplayStats(): boolean;
  1925. /**
  1926. !#en Sets whether display the FPS on the bottom-left corner.
  1927. !#zh 设置是否在左下角显示 FPS。
  1928. @param displayStats displayStats
  1929. */
  1930. static setDisplayStats(displayStats: boolean): void;
  1931. }
  1932. /** !#en
  1933. <p>
  1934. ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
  1935. cc.director is a singleton object which manage your game's logic flow.<br/>
  1936. Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>
  1937. the standard way to use it is by calling:<br/>
  1938. - cc.director.methodName(); <br/>
  1939. It creates and handle the main Window and manages how and when to execute the Scenes.<br/>
  1940. <br/>
  1941. The cc.director is also responsible for:<br/>
  1942. - initializing the OpenGL context<br/>
  1943. - setting the OpenGL pixel format (default on is RGB565)<br/>
  1944. - setting the OpenGL buffer depth (default on is 0-bit)<br/>
  1945. - setting the color for clear screen (default one is BLACK)<br/>
  1946. - setting the projection (default one is 3D)<br/>
  1947. - setting the orientation (default one is Portrait)<br/>
  1948. <br/>
  1949. <br/>
  1950. The cc.director also sets the default OpenGL context:<br/>
  1951. - GL_TEXTURE_2D is enabled<br/>
  1952. - GL_VERTEX_ARRAY is enabled<br/>
  1953. - GL_COLOR_ARRAY is enabled<br/>
  1954. - GL_TEXTURE_COORD_ARRAY is enabled<br/>
  1955. </p>
  1956. <p>
  1957. cc.director also synchronizes timers with the refresh rate of the display.<br/>
  1958. Features and Limitations:<br/>
  1959. - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
  1960. - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
  1961. </p>
  1962. !#zh
  1963. <p>
  1964. 注意:用 cc.director 代替 cc.Director。<br/>
  1965. cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>
  1966. 由于 cc.director 是一个单例,你不需要调用任何构造函数或创建函数,<br/>
  1967. 使用它的标准方法是通过调用:<br/>
  1968. - cc.director.methodName();
  1969. <br/>
  1970. 它创建和处理主窗口并且管理什么时候执行场景。<br/>
  1971. <br/>
  1972. cc.director 还负责:<br/>
  1973. - 初始化 OpenGL 环境。<br/>
  1974. - 设置OpenGL像素格式。(默认是 RGB565)<br/>
  1975. - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>
  1976. - 设置空白场景的颜色 (默认是 黑色)<br/>
  1977. - 设置投影 (默认是 3D)<br/>
  1978. - 设置方向 (默认是 Portrait)<br/>
  1979. <br/>
  1980. cc.director 设置了 OpenGL 默认环境 <br/>
  1981. - GL_TEXTURE_2D 启用。<br/>
  1982. - GL_VERTEX_ARRAY 启用。<br/>
  1983. - GL_COLOR_ARRAY 启用。<br/>
  1984. - GL_TEXTURE_COORD_ARRAY 启用。<br/>
  1985. </p>
  1986. <p>
  1987. cc.director 也同步定时器与显示器的刷新速率。
  1988. <br/>
  1989. 特点和局限性: <br/>
  1990. - 将计时器 & 渲染与显示器的刷新频率同步。<br/>
  1991. - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>
  1992. </p> */
  1993. export class Director extends EventTarget {
  1994. /**
  1995. !#en
  1996. Converts a view coordinate to an WebGL coordinate<br/>
  1997. Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)<br/>
  1998. Implementation can be found in CCDirectorWebGL.
  1999. !#zh 将触摸点的屏幕坐标转换为 WebGL View 下的坐标。
  2000. @param uiPoint uiPoint
  2001. */
  2002. convertToGL(uiPoint: Vec2): Vec2;
  2003. /**
  2004. !#en
  2005. Converts an OpenGL coordinate to a view coordinate<br/>
  2006. Useful to convert node points to window points for calls such as glScissor<br/>
  2007. Implementation can be found in CCDirectorWebGL.
  2008. !#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。
  2009. @param glPoint glPoint
  2010. */
  2011. convertToUI(glPoint: Vec2): Vec2;
  2012. /**
  2013. End the life of director in the next frame
  2014. */
  2015. end(): void;
  2016. /**
  2017. !#en
  2018. Returns the size of the WebGL view in points.<br/>
  2019. It takes into account any possible rotation (device orientation) of the window.
  2020. !#zh 获取视图的大小,以点为单位。
  2021. */
  2022. getWinSize(): Size;
  2023. /**
  2024. !#en
  2025. Returns the size of the OpenGL view in pixels.<br/>
  2026. It takes into account any possible rotation (device orientation) of the window.<br/>
  2027. On Mac winSize and winSizeInPixels return the same value.
  2028. (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())
  2029. !#zh
  2030. 获取视图大小,以像素为单位(这里的像素指的是资源分辨率。
  2031. 如果要获取屏幕物理分辨率,需要用 cc.view.getFrameSize())
  2032. */
  2033. getWinSizeInPixels(): Size;
  2034. /**
  2035. !#en Pause the director's ticker, only involve the game logic execution.
  2036. It won't pause the rendering process nor the event manager.
  2037. If you want to pause the entier game including rendering, audio and event,
  2038. please use {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}
  2039. !#zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。
  2040. 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}。
  2041. */
  2042. pause(): void;
  2043. /**
  2044. !#en
  2045. Run a scene. Replaces the running scene with a new one or enter the first scene.<br/>
  2046. The new scene will be launched immediately.
  2047. !#zh 立刻切换指定场景。
  2048. @param scene The need run scene.
  2049. @param onBeforeLoadScene The function invoked at the scene before loading.
  2050. @param onLaunched The function invoked at the scene after launch.
  2051. */
  2052. runSceneImmediate(scene: Scene, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2053. /**
  2054. !#en Loads the scene by its name.
  2055. !#zh 通过场景名称进行加载场景。
  2056. @param sceneName The name of the scene to load.
  2057. @param onLaunched callback, will be called after scene launched.
  2058. */
  2059. loadScene(sceneName: string, onLaunched?: Function): boolean;
  2060. /**
  2061. !#en
  2062. Preloads the scene to reduces loading time. You can call this method at any time you want.
  2063. After calling this method, you still need to launch the scene by `cc.director.loadScene`.
  2064. It will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not
  2065. yet finished, the scene will be launched after loaded automatically.
  2066. !#zh 预加载场景,你可以在任何时候调用这个方法。
  2067. 调用完后,你仍然需要通过 `cc.director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。
  2068. 就算预加载还没完成,你也可以直接调用 `cc.director.loadScene`,加载完成后场景就会启动。
  2069. @param sceneName The name of the scene to preload.
  2070. @param onProgress callback, will be called when the load progression change.
  2071. @param onLoaded callback, will be called after scene loaded.
  2072. */
  2073. preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error, asset: cc.SceneAsset) => void): void;
  2074. /**
  2075. !#en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  2076. !#zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  2077. */
  2078. resume(): void;
  2079. /**
  2080. !#en
  2081. Enables or disables WebGL depth test.<br/>
  2082. Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
  2083. !#zh 启用/禁用深度测试(在 Canvas 渲染模式下不会生效)。
  2084. @param on on
  2085. */
  2086. setDepthTest(on: boolean): void;
  2087. /**
  2088. !#en
  2089. Set color for clear screen.<br/>
  2090. (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
  2091. !#zh
  2092. 设置场景的默认擦除颜色。<br/>
  2093. 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
  2094. @param clearColor clearColor
  2095. */
  2096. setClearColor(clearColor: Color): void;
  2097. /**
  2098. !#en Returns current logic Scene.
  2099. !#zh 获取当前逻辑场景。
  2100. @example
  2101. ```js
  2102. // This will help you to get the Canvas node in scene
  2103. cc.director.getScene().getChildByName('Canvas');
  2104. ```
  2105. */
  2106. getScene(): Scene;
  2107. /**
  2108. !#en Returns the FPS value. Please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} to control animation interval.
  2109. !#zh 获取单位帧执行时间。请使用 {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} 来控制游戏帧率。
  2110. */
  2111. getAnimationInterval(): number;
  2112. /**
  2113. Sets animation interval, this doesn't control the main loop.
  2114. To control the game's frame rate overall, please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}}
  2115. @param value The animation interval desired.
  2116. */
  2117. setAnimationInterval(value: number): void;
  2118. /**
  2119. !#en Returns the delta time since last frame.
  2120. !#zh 获取上一帧的增量时间。
  2121. */
  2122. getDeltaTime(): number;
  2123. /**
  2124. !#en Returns how many frames were called since the director started.
  2125. !#zh 获取 director 启动以来游戏运行的总帧数。
  2126. */
  2127. getTotalFrames(): number;
  2128. /**
  2129. !#en Returns whether or not the Director is paused.
  2130. !#zh 是否处于暂停状态。
  2131. */
  2132. isPaused(): boolean;
  2133. /**
  2134. !#en Returns the cc.Scheduler associated with this director.
  2135. !#zh 获取和 director 相关联的 cc.Scheduler。
  2136. */
  2137. getScheduler(): Scheduler;
  2138. /**
  2139. !#en Sets the cc.Scheduler associated with this director.
  2140. !#zh 设置和 director 相关联的 cc.Scheduler。
  2141. @param scheduler scheduler
  2142. */
  2143. setScheduler(scheduler: Scheduler): void;
  2144. /**
  2145. !#en Returns the cc.ActionManager associated with this director.
  2146. !#zh 获取和 director 相关联的 cc.ActionManager(动作管理器)。
  2147. */
  2148. getActionManager(): ActionManager;
  2149. /**
  2150. !#en Sets the cc.ActionManager associated with this director.
  2151. !#zh 设置和 director 相关联的 cc.ActionManager(动作管理器)。
  2152. @param actionManager actionManager
  2153. */
  2154. setActionManager(actionManager: ActionManager): void;
  2155. /**
  2156. !#en Returns the cc.CollisionManager associated with this director.
  2157. !#zh 获取和 director 相关联的 cc.CollisionManager (碰撞管理器)。
  2158. */
  2159. getCollisionManager(): CollisionManager;
  2160. /**
  2161. !#en Returns the cc.PhysicsManager associated with this director.
  2162. !#zh 返回与 director 相关联的 cc.PhysicsManager (物理管理器)。
  2163. */
  2164. getPhysicsManager(): PhysicsManager;
  2165. /** !#en The event projection changed of cc.Director. This event will not get triggered since v2.0
  2166. !#zh cc.Director 投影变化的事件。从 v2.0 开始这个事件不会再被触发 */
  2167. static EVENT_PROJECTION_CHANGED: string;
  2168. /** !#en The event which will be triggered before loading a new scene.
  2169. !#zh 加载新场景之前所触发的事件。 */
  2170. static EVENT_BEFORE_SCENE_LOADING: string;
  2171. /** !#en The event which will be triggered before launching a new scene.
  2172. !#zh 运行新场景之前所触发的事件。 */
  2173. static EVENT_BEFORE_SCENE_LAUNCH: string;
  2174. /** !#en The event which will be triggered after launching a new scene.
  2175. !#zh 运行新场景之后所触发的事件。 */
  2176. static EVENT_AFTER_SCENE_LAUNCH: string;
  2177. /** !#en The event which will be triggered at the beginning of every frame.
  2178. !#zh 每个帧的开始时所触发的事件。 */
  2179. static EVENT_BEFORE_UPDATE: string;
  2180. /** !#en The event which will be triggered after engine and components update logic.
  2181. !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 */
  2182. static EVENT_AFTER_UPDATE: string;
  2183. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  2184. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  2185. static EVENT_BEFORE_VISIT: string;
  2186. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  2187. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  2188. static EVENT_AFTER_VISIT: string;
  2189. /** !#en The event which will be triggered before the rendering process.
  2190. !#zh 渲染过程之前所触发的事件。 */
  2191. static EVENT_BEFORE_DRAW: string;
  2192. /** !#en The event which will be triggered after the rendering process.
  2193. !#zh 渲染过程之后所触发的事件。 */
  2194. static EVENT_AFTER_DRAW: string;
  2195. /** Constant for 2D projection (orthogonal projection) */
  2196. static PROJECTION_2D: number;
  2197. /** Constant for 3D projection with a fovy=60, znear=0.5f and zfar=1500. */
  2198. static PROJECTION_3D: number;
  2199. /** Constant for custom projection, if cc.Director's projection set to it, it calls "updateProjection" on the projection delegate. */
  2200. static PROJECTION_CUSTOM: number;
  2201. /** Constant for default projection of cc.Director, default projection is 2D projection */
  2202. static PROJECTION_DEFAULT: number;
  2203. }
  2204. /** !#en An object to boot the game.
  2205. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2206. export class Game extends EventTarget {
  2207. /** !#en Event triggered when game hide to background.
  2208. Please note that this event is not 100% guaranteed to be fired on Web platform,
  2209. on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  2210. !#zh 游戏进入后台时触发的事件。
  2211. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  2212. 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。 */
  2213. EVENT_HIDE: string;
  2214. /** !#en Event triggered when game back to foreground
  2215. Please note that this event is not 100% guaranteed to be fired on Web platform,
  2216. on native platforms, it corresponds to enter foreground event.
  2217. !#zh 游戏进入前台运行时触发的事件。
  2218. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  2219. 在原生平台,它对应的是应用被切换到前台事件。 */
  2220. EVENT_SHOW: string;
  2221. /** !#en Event triggered when game restart
  2222. !#zh 调用restart后,触发事件。 */
  2223. EVENT_RESTART: string;
  2224. /** Event triggered after game inited, at this point all engine objects and game scripts are loaded */
  2225. EVENT_GAME_INITED: string;
  2226. /** Event triggered after engine inited, at this point you will be able to use all engine classes.
  2227. It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0 */
  2228. EVENT_ENGINE_INITED: string;
  2229. /** Web Canvas 2d API as renderer backend */
  2230. RENDER_TYPE_CANVAS: number;
  2231. /** WebGL API as renderer backend */
  2232. RENDER_TYPE_WEBGL: number;
  2233. /** OpenGL API as renderer backend */
  2234. RENDER_TYPE_OPENGL: number;
  2235. /** !#en The outer frame of the game canvas, parent of game container.
  2236. !#zh 游戏画布的外框,container 的父容器。 */
  2237. frame: any;
  2238. /** !#en The container of game canvas.
  2239. !#zh 游戏画布的容器。 */
  2240. container: HTMLDivElement;
  2241. /** !#en The canvas of the game.
  2242. !#zh 游戏的画布。 */
  2243. canvas: HTMLCanvasElement;
  2244. /** !#en The renderer backend of the game.
  2245. !#zh 游戏的渲染器类型。 */
  2246. renderType: number;
  2247. /** !#en
  2248. The current game configuration, including:<br/>
  2249. 1. debugMode<br/>
  2250. "debugMode" possible values :<br/>
  2251. 0 - No message will be printed. <br/>
  2252. 1 - cc.error, cc.assert, cc.warn, cc.log will print in console. <br/>
  2253. 2 - cc.error, cc.assert, cc.warn will print in console. <br/>
  2254. 3 - cc.error, cc.assert will print in console. <br/>
  2255. 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>
  2256. 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web. <br/>
  2257. 6 - cc.error, cc.assert will print on canvas, available only on web. <br/>
  2258. 2. showFPS<br/>
  2259. Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.<br/>
  2260. 3. exposeClassName<br/>
  2261. Expose class name to chrome debug tools, the class intantiate performance is a little bit slower when exposed.<br/>
  2262. 4. frameRate<br/>
  2263. "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>
  2264. 5. id<br/>
  2265. "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.<br/>
  2266. 6. renderMode<br/>
  2267. "renderMode" sets the renderer type, only useful on web :<br/>
  2268. 0 - Automatically chosen by engine<br/>
  2269. 1 - Forced to use canvas renderer<br/>
  2270. 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>
  2271. 7. scenes<br/>
  2272. "scenes" include available scenes in the current bundle.<br/>
  2273. <br/>
  2274. Please DO NOT modify this object directly, it won't have any effect.<br/>
  2275. !#zh
  2276. 当前的游戏配置,包括: <br/>
  2277. 1. debugMode(debug 模式,但是在浏览器中这个选项会被忽略) <br/>
  2278. "debugMode" 各种设置选项的意义。 <br/>
  2279. 0 - 没有消息被打印出来。 <br/>
  2280. 1 - cc.error,cc.assert,cc.warn,cc.log 将打印在 console 中。 <br/>
  2281. 2 - cc.error,cc.assert,cc.warn 将打印在 console 中。 <br/>
  2282. 3 - cc.error,cc.assert 将打印在 console 中。 <br/>
  2283. 4 - cc.error,cc.assert,cc.warn,cc.log 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2284. 5 - cc.error,cc.assert,cc.warn 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2285. 6 - cc.error,cc.assert 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2286. 2. showFPS(显示 FPS) <br/>
  2287. 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。 <br/>
  2288. 3. exposeClassName <br/>
  2289. 暴露类名让 Chrome DevTools 可以识别,如果开启会稍稍降低类的创建过程的性能,但对对象构造没有影响。 <br/>
  2290. 4. frameRate (帧率) <br/>
  2291. “frameRate” 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。 <br/>
  2292. 5. id <br/>
  2293. "gameCanvas" Web 页面上的 Canvas Element ID,仅适用于 web 端。 <br/>
  2294. 6. renderMode(渲染模式) <br/>
  2295. “renderMode” 设置渲染器类型,仅适用于 web 端: <br/>
  2296. 0 - 通过引擎自动选择。 <br/>
  2297. 1 - 强制使用 canvas 渲染。
  2298. 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。 <br/>
  2299. 7. scenes <br/>
  2300. “scenes” 当前包中可用场景。 <br/>
  2301. <br/>
  2302. 注意:请不要直接修改这个对象,它不会有任何效果。 */
  2303. config: any;
  2304. /**
  2305. !#en Callback when the scripts of engine have been load.
  2306. !#zh 当引擎完成启动后的回调函数。
  2307. */
  2308. onStart(): void;
  2309. /**
  2310. !#en Set frame rate of game.
  2311. !#zh 设置游戏帧率。
  2312. @param frameRate frameRate
  2313. */
  2314. setFrameRate(frameRate: number): void;
  2315. /**
  2316. !#en Get frame rate set for the game, it doesn't represent the real frame rate.
  2317. !#zh 获取设置的游戏帧率(不等同于实际帧率)。
  2318. */
  2319. getFrameRate(): number;
  2320. /**
  2321. !#en Run the game frame by frame.
  2322. !#zh 执行一帧游戏循环。
  2323. */
  2324. step(): void;
  2325. /**
  2326. !#en Pause the game main loop. This will pause:
  2327. game logic execution, rendering process, event manager, background music and all audio effects.
  2328. This is different with cc.director.pause which only pause the game logic execution.
  2329. !#zh 暂停游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。这点和只暂停游戏逻辑的 cc.director.pause 不同。
  2330. */
  2331. pause(): void;
  2332. /**
  2333. !#en Resume the game from pause. This will resume:
  2334. game logic execution, rendering process, event manager, background music and all audio effects.
  2335. !#zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  2336. */
  2337. resume(): void;
  2338. /**
  2339. !#en Check whether the game is paused.
  2340. !#zh 判断游戏是否暂停。
  2341. */
  2342. isPaused(): boolean;
  2343. /**
  2344. !#en Restart game.
  2345. !#zh 重新开始游戏
  2346. */
  2347. restart(): void;
  2348. /**
  2349. !#en End game, it will close the game window
  2350. !#zh 退出游戏
  2351. */
  2352. end(): void;
  2353. /**
  2354. !#en
  2355. Register an callback of a specific event type on the game object.
  2356. This type of event should be triggered via `emit`.
  2357. !#zh
  2358. 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  2359. @param type A string representing the event type to listen for.
  2360. @param callback The callback that will be invoked when the event is dispatched.
  2361. The callback is ignored if it is a duplicate (the callbacks are unique).
  2362. @param target The target (this object) to invoke the callback, can be null
  2363. */
  2364. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  2365. /**
  2366. !#en
  2367. Register an callback of a specific event type on the game object,
  2368. the callback will remove itself after the first time it is triggered.
  2369. !#zh
  2370. 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  2371. @param type A string representing the event type to listen for.
  2372. @param callback The callback that will be invoked when the event is dispatched.
  2373. The callback is ignored if it is a duplicate (the callbacks are unique).
  2374. @param target The target (this object) to invoke the callback, can be null
  2375. */
  2376. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  2377. /**
  2378. !#en Prepare game.
  2379. !#zh 准备引擎,请不要直接调用这个函数。
  2380. @param cb cb
  2381. */
  2382. prepare(cb: Function): void;
  2383. /**
  2384. !#en Run game with configuration object and onStart function.
  2385. !#zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  2386. @param config Pass configuration object or onStart function
  2387. @param onStart function to be executed after game initialized
  2388. */
  2389. run(config: any, onStart: Function): void;
  2390. /**
  2391. !#en
  2392. Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>
  2393. The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  2394. !#zh
  2395. 声明常驻根节点,该节点不会被在场景切换中被销毁。<br/>
  2396. 目标节点必须位于为层级的根节点,否则无效。
  2397. @param node The node to be made persistent
  2398. */
  2399. addPersistRootNode(node: Node): void;
  2400. /**
  2401. !#en Remove a persistent root node.
  2402. !#zh 取消常驻根节点。
  2403. @param node The node to be removed from persistent node list
  2404. */
  2405. removePersistRootNode(node: Node): void;
  2406. /**
  2407. !#en Check whether the node is a persistent root node.
  2408. !#zh 检查节点是否是常驻根节点。
  2409. @param node The node to be checked
  2410. */
  2411. isPersistRootNode(node: Node): boolean;
  2412. }
  2413. /** !#en
  2414. Class of all entities in Cocos Creator scenes.<br/>
  2415. For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
  2416. !#zh
  2417. Cocos Creator 场景中的所有节点类。<br/>
  2418. 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。 */
  2419. export class Node extends _BaseNode {
  2420. /** !#en
  2421. Group index of node.<br/>
  2422. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  2423. !#zh
  2424. 节点的分组索引。<br/>
  2425. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  2426. groupIndex: number;
  2427. /** !#en
  2428. Group of node.<br/>
  2429. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  2430. !#zh
  2431. 节点的分组。<br/>
  2432. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  2433. group: string;
  2434. /** !#en The position (x, y) of the node in its parent's coordinates.
  2435. !#zh 节点在父节点坐标系中的位置(x, y)。 */
  2436. position: Vec2;
  2437. /** !#en x axis position of node.
  2438. !#zh 节点 X 轴坐标。 */
  2439. x: number;
  2440. /** !#en y axis position of node.
  2441. !#zh 节点 Y 轴坐标。 */
  2442. y: number;
  2443. /** !#en Rotation of node.
  2444. !#zh 该节点旋转角度。 */
  2445. rotation: number;
  2446. /** !#en Rotation on x axis.
  2447. !#zh 该节点 X 轴旋转角度。 */
  2448. rotationX: number;
  2449. /** !#en Rotation on y axis.
  2450. !#zh 该节点 Y 轴旋转角度。 */
  2451. rotationY: number;
  2452. /** !#en The local scale relative to the parent.
  2453. !#zh 节点相对父节点的缩放。 */
  2454. scale: number;
  2455. /** !#en Scale on x axis.
  2456. !#zh 节点 X 轴缩放。 */
  2457. scaleX: number;
  2458. /** !#en Scale on y axis.
  2459. !#zh 节点 Y 轴缩放。 */
  2460. scaleY: number;
  2461. /** !#en Skew x
  2462. !#zh 该节点 X 轴倾斜角度。 */
  2463. skewX: number;
  2464. /** !#en Skew y
  2465. !#zh 该节点 Y 轴倾斜角度。 */
  2466. skewY: number;
  2467. /** !#en Opacity of node, default value is 255.
  2468. !#zh 节点透明度,默认值为 255。 */
  2469. opacity: number;
  2470. /** !#en Color of node, default value is white: (255, 255, 255).
  2471. !#zh 节点颜色。默认为白色,数值为:(255,255,255)。 */
  2472. color: Color;
  2473. /** !#en Anchor point's position on x axis.
  2474. !#zh 节点 X 轴锚点位置。 */
  2475. anchorX: number;
  2476. /** !#en Anchor point's position on y axis.
  2477. !#zh 节点 Y 轴锚点位置。 */
  2478. anchorY: number;
  2479. /** !#en Width of node.
  2480. !#zh 节点宽度。 */
  2481. width: number;
  2482. /** !#en Height of node.
  2483. !#zh 节点高度。 */
  2484. height: number;
  2485. /** !#en zIndex is the 'key' used to sort the node relative to its siblings.<br/>
  2486. The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.<br/>
  2487. The Node's parent will sort all its children based on the zIndex value and the arrival order.<br/>
  2488. Nodes with greater zIndex will be sorted after nodes with smaller zIndex.<br/>
  2489. 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/>
  2490. Node's order in children list will affect its rendering order. Parent is always rendering before all children.
  2491. !#zh zIndex 是用来对节点进行排序的关键属性,它决定一个节点在兄弟节点之间的位置。<br/>
  2492. zIndex 的取值应该介于 cc.macro.MIN_ZINDEX 和 cc.macro.MAX_ZINDEX 之间
  2493. 父节点主要根据节点的 zIndex 和添加次序来排序,拥有更高 zIndex 的节点将被排在后面,如果两个节点的 zIndex 一致,先添加的节点会稳定排在另一个节点之前。<br/>
  2494. 节点在 children 中的顺序决定了其渲染顺序。父节点永远在所有子节点之前被渲染 */
  2495. zIndex: number;
  2496. /**
  2497. @param name name
  2498. */
  2499. constructor(name?: string);
  2500. /**
  2501. !#en
  2502. Register a callback of a specific event type on Node.<br/>
  2503. Use this method to register touch or mouse event permit propagation based on scene graph,<br/>
  2504. These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:<br/>
  2505. 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target<br/>
  2506. 2. At target phase: dispatch to the listeners of the real target<br/>
  2507. 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root<br/>
  2508. In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.<br/>
  2509. It's the recommended way to register touch/mouse event for Node,<br/>
  2510. please do not use cc.eventManager directly for Node.<br/>
  2511. You can also register custom event and use `emit` to trigger custom event on Node.<br/>
  2512. 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/>
  2513. You can also pass event callback parameters with `emit` by passing parameters after `type`.
  2514. !#zh
  2515. 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。<br/>
  2516. 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:<br/>
  2517. 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。<br/>
  2518. 2. 目标阶段:派发给目标节点的监听器。<br/>
  2519. 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发直到根节点。<br/>
  2520. 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
  2521. 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。<br/>
  2522. 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器<br/>
  2523. 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  2524. @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.
  2525. @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).
  2526. @param target The target (this object) to invoke the callback, can be null
  2527. @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.
  2528. @example
  2529. ```js
  2530. this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  2531. node.on(cc.Node.EventType.TOUCH_START, callback, this);
  2532. node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
  2533. node.on(cc.Node.EventType.TOUCH_END, callback, this);
  2534. node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
  2535. node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
  2536. node.on(cc.Node.EventType.COLOR_CHANGED, callback);
  2537. ```
  2538. */
  2539. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  2540. /**
  2541. !#en
  2542. Register an callback of a specific event type on the Node,
  2543. the callback will remove itself after the first time it is triggered.
  2544. !#zh
  2545. 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  2546. @param type A string representing the event type to listen for.
  2547. @param callback The callback that will be invoked when the event is dispatched.
  2548. The callback is ignored if it is a duplicate (the callbacks are unique).
  2549. @param target The target (this object) to invoke the callback, can be null
  2550. @example
  2551. ```js
  2552. node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
  2553. ```
  2554. */
  2555. once<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  2556. /**
  2557. !#en
  2558. Removes the callback previously registered with the same type, callback, target and or useCapture.
  2559. This method is merely an alias to removeEventListener.
  2560. !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  2561. @param type A string representing the event type being removed.
  2562. @param callback The callback to remove.
  2563. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  2564. @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.
  2565. @example
  2566. ```js
  2567. this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
  2568. node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
  2569. node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
  2570. ```
  2571. */
  2572. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  2573. /**
  2574. !#en Removes all callbacks previously registered with the same target.
  2575. !#zh 移除目标上的所有注册事件。
  2576. @param target The target to be searched for all related callbacks
  2577. @example
  2578. ```js
  2579. node.targetOff(target);
  2580. ```
  2581. */
  2582. targetOff(target: any): void;
  2583. /**
  2584. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  2585. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  2586. @param type The type of event.
  2587. */
  2588. hasEventListener(type: string): boolean;
  2589. /**
  2590. !#en
  2591. Trigger an event directly with the event name and necessary arguments.
  2592. !#zh
  2593. 通过事件名发送自定义事件
  2594. @param type event type
  2595. @param arg1 First argument in callback
  2596. @param arg2 Second argument in callback
  2597. @param arg3 Third argument in callback
  2598. @param arg4 Fourth argument in callback
  2599. @param arg5 Fifth argument in callback
  2600. @example
  2601. ```js
  2602. eventTarget.emit('fire', event);
  2603. eventTarget.emit('fire', message, emitter);
  2604. ```
  2605. */
  2606. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  2607. /**
  2608. !#en
  2609. Dispatches an event into the event flow.
  2610. The event target is the EventTarget object upon which the dispatchEvent() method is called.
  2611. !#zh 分发事件到事件流中。
  2612. @param event The Event object that is dispatched into the event flow
  2613. */
  2614. dispatchEvent(event: Event): void;
  2615. /**
  2616. !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
  2617. 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.
  2618. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  2619. !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  2620. 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  2621. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  2622. @param recursive Whether to pause node system events on the sub node tree.
  2623. @example
  2624. ```js
  2625. node.pauseSystemEvents(true);
  2626. ```
  2627. */
  2628. pauseSystemEvents(recursive: boolean): void;
  2629. /**
  2630. !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
  2631. 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.
  2632. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  2633. !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  2634. 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  2635. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  2636. @param recursive Whether to resume node system events on the sub node tree.
  2637. @example
  2638. ```js
  2639. node.resumeSystemEvents(true);
  2640. ```
  2641. */
  2642. resumeSystemEvents(recursive: boolean): void;
  2643. /**
  2644. !#en
  2645. Executes an action, and returns the action that is executed.<br/>
  2646. The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
  2647. Calling runAction while the node is not active won't have any effect. <br/>
  2648. Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
  2649. if you want to modify, when you define action plus.
  2650. !#zh
  2651. 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
  2652. 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
  2653. 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
  2654. @param action action
  2655. @example
  2656. ```js
  2657. var action = cc.scaleTo(0.2, 1, 0.6);
  2658. node.runAction(action);
  2659. node.runAction(action).repeatForever(); // fail
  2660. node.runAction(action.repeatForever()); // right
  2661. ```
  2662. */
  2663. runAction(action: Action): Action;
  2664. /**
  2665. !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
  2666. !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
  2667. @example
  2668. ```js
  2669. node.pauseAllActions();
  2670. ```
  2671. */
  2672. pauseAllActions(): void;
  2673. /**
  2674. !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
  2675. !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
  2676. @example
  2677. ```js
  2678. node.resumeAllActions();
  2679. ```
  2680. */
  2681. resumeAllActions(): void;
  2682. /**
  2683. !#en Stops and removes all actions from the running action list .
  2684. !#zh 停止并且移除所有正在运行的动作列表。
  2685. @example
  2686. ```js
  2687. node.stopAllActions();
  2688. ```
  2689. */
  2690. stopAllActions(): void;
  2691. /**
  2692. !#en Stops and removes an action from the running action list.
  2693. !#zh 停止并移除指定的动作。
  2694. @param action An action object to be removed.
  2695. @example
  2696. ```js
  2697. var action = cc.scaleTo(0.2, 1, 0.6);
  2698. node.stopAction(action);
  2699. ```
  2700. */
  2701. stopAction(action: Action): void;
  2702. /**
  2703. !#en Removes an action from the running action list by its tag.
  2704. !#zh 停止并且移除指定标签的动作。
  2705. @param tag A tag that indicates the action to be removed.
  2706. @example
  2707. ```js
  2708. node.stopAction(1);
  2709. ```
  2710. */
  2711. stopActionByTag(tag: number): void;
  2712. /**
  2713. !#en Returns an action from the running action list by its tag.
  2714. !#zh 通过标签获取指定动作。
  2715. @param tag tag
  2716. @example
  2717. ```js
  2718. var action = node.getActionByTag(1);
  2719. ```
  2720. */
  2721. getActionByTag(tag: number): Action;
  2722. /**
  2723. !#en
  2724. Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
  2725. Composable actions are counted as 1 action. Example:<br/>
  2726. If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  2727. If you are running 7 Sequences of 2 actions, it will return 7.</p>
  2728. !#zh
  2729. 获取运行着的动作加上正在调度运行的动作的总数。<br/>
  2730. 例如:<br/>
  2731. - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。<br/>
  2732. - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。<br/>
  2733. @example
  2734. ```js
  2735. var count = node.getNumberOfRunningActions();
  2736. cc.log("Running Action Count: " + count);
  2737. ```
  2738. */
  2739. getNumberOfRunningActions(): number;
  2740. /**
  2741. !#en Returns a copy of the position (x, y) of the node in its parent's coordinates.
  2742. !#zh 获取节点在父节点坐标系中的位置(x, y)。
  2743. @example
  2744. ```js
  2745. cc.log("Node Position: " + node.getPosition());
  2746. ```
  2747. */
  2748. getPosition(): Vec2;
  2749. /**
  2750. !#en
  2751. Sets the position (x, y) of the node in its parent's coordinates.<br/>
  2752. Usually we use cc.v2(x, y) to compose cc.Vec2 object.<br/>
  2753. and Passing two numbers (x, y) is more efficient than passing cc.Vec2 object.
  2754. !#zh
  2755. 设置节点在父节点坐标系中的位置。<br/>
  2756. 可以通过两种方式设置坐标点:<br/>
  2757. 1. 传入 2 个数值 x 和 y。<br/>
  2758. 2. 传入 cc.v2(x, y) 类型为 cc.Vec2 的对象。
  2759. @param newPosOrX X coordinate for position or the position (x, y) of the node in coordinates
  2760. @param y Y coordinate for position
  2761. @example
  2762. ```js
  2763. node.setPosition(cc.v2(0, 0));
  2764. node.setPosition(0, 0);
  2765. ```
  2766. */
  2767. setPosition(newPosOrX: Vec2|number, y?: number): void;
  2768. /**
  2769. !#en
  2770. Returns the scale factor of the node.
  2771. Assertion will fail when scale x != scale y.
  2772. !#zh 获取节点的缩放。当 X 轴和 Y 轴有相同的缩放数值时。
  2773. @example
  2774. ```js
  2775. cc.log("Node Scale: " + node.getScale());
  2776. ```
  2777. */
  2778. getScale(): number;
  2779. /**
  2780. !#en Sets the scale factor of the node. 1.0 is the default scale factor. This function can modify the X and Y scale at the same time.
  2781. !#zh 设置节点的缩放比例,默认值为 1.0。这个函数可以在同一时间修改 X 和 Y 缩放。
  2782. @param scaleX scaleX or scale
  2783. @param scaleY scaleY
  2784. @example
  2785. ```js
  2786. node.setScale(cc.v2(1, 1));
  2787. node.setScale(1);
  2788. ```
  2789. */
  2790. setScale(scaleX: number|Vec2, scaleY?: number): void;
  2791. /**
  2792. !#en Set rotation of node (along z axi).
  2793. !#zh 设置该节点以局部坐标系 Z 轴为轴进行旋转的角度。
  2794. @param rotation Degree rotation value
  2795. */
  2796. setRotation(rotation: number): void;
  2797. /**
  2798. !#en Get rotation of node (along z axi).
  2799. !#zh 获取该节点以局部坐标系 Z 轴为轴进行旋转的角度。
  2800. @param rotation Degree rotation value
  2801. */
  2802. getRotation(rotation: number): void;
  2803. /**
  2804. !#en
  2805. Returns a copy the untransformed size of the node. <br/>
  2806. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  2807. All nodes has a size. Layer and Scene has the same size of the screen by default. <br/>
  2808. !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
  2809. @example
  2810. ```js
  2811. cc.log("Content Size: " + node.getContentSize());
  2812. ```
  2813. */
  2814. getContentSize(): Size;
  2815. /**
  2816. !#en
  2817. Sets the untransformed size of the node.<br/>
  2818. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  2819. All nodes has a size. Layer and Scene has the same size of the screen.
  2820. !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
  2821. @param size The untransformed size of the node or The untransformed size's width of the node.
  2822. @param height The untransformed size's height of the node.
  2823. @example
  2824. ```js
  2825. node.setContentSize(cc.size(100, 100));
  2826. node.setContentSize(100, 100);
  2827. ```
  2828. */
  2829. setContentSize(size: Size|number, height?: number): void;
  2830. /**
  2831. !#en
  2832. Returns a copy of the anchor point.<br/>
  2833. Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
  2834. It's like a pin in the node where it is "attached" to its parent. <br/>
  2835. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
  2836. But you can use values higher than (1,1) and lower than (0,0) too. <br/>
  2837. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  2838. !#zh
  2839. 获取节点锚点,用百分比表示。<br/>
  2840. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  2841. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  2842. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  2843. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  2844. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  2845. @example
  2846. ```js
  2847. cc.log("Node AnchorPoint: " + node.getAnchorPoint());
  2848. ```
  2849. */
  2850. getAnchorPoint(): Vec2;
  2851. /**
  2852. !#en
  2853. Sets the anchor point in percent. <br/>
  2854. anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  2855. It's like a pin in the node where it is "attached" to its parent. <br/>
  2856. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  2857. But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  2858. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  2859. !#zh
  2860. 设置锚点的百分比。<br/>
  2861. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  2862. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  2863. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  2864. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  2865. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  2866. @param point The anchor point of node or The x axis anchor of node.
  2867. @param y The y axis anchor of node.
  2868. @example
  2869. ```js
  2870. node.setAnchorPoint(cc.v2(1, 1));
  2871. node.setAnchorPoint(1, 1);
  2872. ```
  2873. */
  2874. setAnchorPoint(point: Vec2|number, y?: number): void;
  2875. /**
  2876. !#en Set rotation by lookAt target point, normally used by Camera Node
  2877. !#zh 通过观察目标来设置 rotation,一般用于 Camera Node 上
  2878. @param pos pos
  2879. @param up default is (0,1,0)
  2880. */
  2881. lookAt(pos: Vec3, up?: Vec3): void;
  2882. /**
  2883. !#en
  2884. Get the local transform matrix (4x4), based on parent node coordinates
  2885. !#zh 返回局部空间坐标系的矩阵,基于父节点坐标系。
  2886. @param out The matrix object to be filled with data
  2887. @example
  2888. ```js
  2889. let mat4 = cc.mat4();
  2890. node.getLocalMatrix(mat4);
  2891. ```
  2892. */
  2893. getLocalMatrix(out: Mat4): Mat4;
  2894. /**
  2895. !#en
  2896. Get the world transform matrix (4x4)
  2897. !#zh 返回世界空间坐标系的矩阵。
  2898. @param out The matrix object to be filled with data
  2899. @example
  2900. ```js
  2901. let mat4 = cc.mat4();
  2902. node.getWorldMatrix(mat4);
  2903. ```
  2904. */
  2905. getWorldMatrix(out: Mat4): Mat4;
  2906. /**
  2907. !#en Converts a Point to node (local) space coordinates then add the anchor point position.
  2908. So the return position will be related to the left bottom corner of the node's bounding box.
  2909. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
  2910. !#zh 将一个点转换到节点 (局部) 坐标系,并加上锚点的坐标。<br/>
  2911. 也就是说返回的坐标是相对于节点包围盒左下角的坐标。<br/>
  2912. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToNodeSpaceAR。
  2913. @param worldPoint worldPoint
  2914. @example
  2915. ```js
  2916. var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
  2917. ```
  2918. */
  2919. convertToNodeSpace(worldPoint: Vec2): Vec2;
  2920. /**
  2921. !#en Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.
  2922. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
  2923. !#zh 将一个相对于节点左下角的坐标位置转换到世界空间坐标系。
  2924. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToWorldSpaceAR
  2925. @param nodePoint nodePoint
  2926. @example
  2927. ```js
  2928. var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
  2929. ```
  2930. */
  2931. convertToWorldSpace(nodePoint: Vec2): Vec2;
  2932. /**
  2933. !#en
  2934. Converts a Point to node (local) space coordinates in which the anchor point is the origin position.
  2935. !#zh
  2936. 将一个点转换到节点 (局部) 空间坐标系,这个坐标系以锚点为原点。
  2937. @param worldPoint worldPoint
  2938. @example
  2939. ```js
  2940. var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
  2941. ```
  2942. */
  2943. convertToNodeSpaceAR(worldPoint: Vec2): Vec2;
  2944. /**
  2945. !#en
  2946. Converts a Point in node coordinates to world space coordinates.
  2947. !#zh
  2948. 将节点坐标系下的一个点转换到世界空间坐标系。
  2949. @param nodePoint nodePoint
  2950. @example
  2951. ```js
  2952. var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
  2953. ```
  2954. */
  2955. convertToWorldSpaceAR(nodePoint: Vec2): Vec2;
  2956. /**
  2957. !#en
  2958. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  2959. The matrix is in Pixels.
  2960. !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
  2961. @param out The affine transform object to be filled with data
  2962. @example
  2963. ```js
  2964. let affineTransform = cc.AffineTransform.create();
  2965. node.getNodeToParentTransform(affineTransform);
  2966. ```
  2967. */
  2968. getNodeToParentTransform(out?: AffineTransform): AffineTransform;
  2969. /**
  2970. !#en
  2971. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  2972. The matrix is in Pixels.<br/>
  2973. This method is AR (Anchor Relative).
  2974. !#zh
  2975. 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>
  2976. 这个矩阵以像素为单位。<br/>
  2977. 该方法基于节点坐标。
  2978. @param out The affine transform object to be filled with data
  2979. @example
  2980. ```js
  2981. let affineTransform = cc.AffineTransform.create();
  2982. node.getNodeToParentTransformAR(affineTransform);
  2983. ```
  2984. */
  2985. getNodeToParentTransformAR(out?: AffineTransform): AffineTransform;
  2986. /**
  2987. !#en Returns the world affine transform matrix. The matrix is in Pixels.
  2988. !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
  2989. @param out The affine transform object to be filled with data
  2990. @example
  2991. ```js
  2992. let affineTransform = cc.AffineTransform.create();
  2993. node.getNodeToWorldTransform(affineTransform);
  2994. ```
  2995. */
  2996. getNodeToWorldTransform(out?: AffineTransform): AffineTransform;
  2997. /**
  2998. !#en
  2999. Returns the world affine transform matrix. The matrix is in Pixels.<br/>
  3000. This method is AR (Anchor Relative).
  3001. !#zh
  3002. 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>
  3003. 该方法基于节点坐标。
  3004. @param out The affine transform object to be filled with data
  3005. @example
  3006. ```js
  3007. let affineTransform = cc.AffineTransform.create();
  3008. node.getNodeToWorldTransformAR(affineTransform);
  3009. ```
  3010. */
  3011. getNodeToWorldTransformAR(out?: AffineTransform): AffineTransform;
  3012. /**
  3013. !#en
  3014. Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
  3015. The matrix is in Pixels. The returned transform is readonly and cannot be changed.
  3016. !#zh
  3017. 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。<br/>
  3018. 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
  3019. @param out The affine transform object to be filled with data
  3020. @example
  3021. ```js
  3022. let affineTransform = cc.AffineTransform.create();
  3023. node.getParentToNodeTransform(affineTransform);
  3024. ```
  3025. */
  3026. getParentToNodeTransform(out?: AffineTransform): AffineTransform;
  3027. /**
  3028. !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
  3029. !#en 返回世界坐标系到节点坐标系的逆矩阵。
  3030. @param out The affine transform object to be filled with data
  3031. @example
  3032. ```js
  3033. let affineTransform = cc.AffineTransform.create();
  3034. node.getWorldToNodeTransform(affineTransform);
  3035. ```
  3036. */
  3037. getWorldToNodeTransform(out?: AffineTransform): AffineTransform;
  3038. /**
  3039. !#en convenience methods which take a cc.Touch instead of cc.Vec2.
  3040. !#zh 将触摸点转换成本地坐标系中位置。
  3041. @param touch The touch object
  3042. @example
  3043. ```js
  3044. var newVec2 = node.convertTouchToNodeSpace(touch);
  3045. ```
  3046. */
  3047. convertTouchToNodeSpace(touch: Touch): Vec2;
  3048. /**
  3049. !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
  3050. !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
  3051. @param touch The touch object
  3052. @example
  3053. ```js
  3054. var newVec2 = node.convertTouchToNodeSpaceAR(touch);
  3055. ```
  3056. */
  3057. convertTouchToNodeSpaceAR(touch: Touch): Vec2;
  3058. /**
  3059. !#en
  3060. Returns a "local" axis aligned bounding box of the node. <br/>
  3061. The returned box is relative only to its parent.
  3062. !#zh 返回父节坐标系下的轴向对齐的包围盒。
  3063. @example
  3064. ```js
  3065. var boundingBox = node.getBoundingBox();
  3066. ```
  3067. */
  3068. getBoundingBox(): Rect;
  3069. /**
  3070. !#en
  3071. Returns a "world" axis aligned bounding box of the node.<br/>
  3072. The bounding box contains self and active children's world bounding box.
  3073. !#zh
  3074. 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。<br/>
  3075. 该边框包含自身和已激活的子节点的世界边框。
  3076. @example
  3077. ```js
  3078. var newRect = node.getBoundingBoxToWorld();
  3079. ```
  3080. */
  3081. getBoundingBoxToWorld(): Rect;
  3082. /**
  3083. !#en
  3084. Adds a child to the node with z order and name.
  3085. !#zh
  3086. 添加子节点,并且可以修改该节点的 局部 Z 顺序和名字。
  3087. @param child A child node
  3088. @param zIndex Z order for drawing priority. Please refer to zIndex property
  3089. @param name A name to identify the node easily. Please refer to name property
  3090. @example
  3091. ```js
  3092. node.addChild(newNode, 1, "node");
  3093. ```
  3094. */
  3095. addChild(child: Node, zIndex?: number, name?: string): void;
  3096. /**
  3097. !#en Stops all running actions and schedulers.
  3098. !#zh 停止所有正在播放的动作和计时器。
  3099. @example
  3100. ```js
  3101. node.cleanup();
  3102. ```
  3103. */
  3104. cleanup(): void;
  3105. /**
  3106. !#en Sorts the children array depends on children's zIndex and arrivalOrder,
  3107. normally you won't need to invoke this function.
  3108. !#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序,正常情况下开发者不需要手动调用这个函数。
  3109. */
  3110. sortAllChildren(): void;
  3111. /**
  3112. !#en
  3113. Returns the displayed opacity of Node,
  3114. 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.
  3115. !#zh
  3116. 获取节点显示透明度,
  3117. 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
  3118. 显示透明度是基于自身透明度和父节点透明度计算的。
  3119. */
  3120. getDisplayedOpacity(): number;
  3121. /**
  3122. !#en
  3123. Returns the displayed color of Node,
  3124. 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.
  3125. !#zh
  3126. 获取节点的显示颜色,
  3127. 显示颜色和颜色之间的不同之处在于当启用级连颜色时,
  3128. 显示颜色是基于自身颜色和父节点颜色计算的。
  3129. */
  3130. getDisplayedColor(): Color;
  3131. /** !#en Cascade opacity is removed from v2.0
  3132. Indicate whether node's opacity value affect its child nodes, default value is true.
  3133. !#zh 透明度级联功能从 v2.0 开始已移除
  3134. 节点的不透明度值是否影响其子节点,默认值为 true。 */
  3135. cascadeOpacity: boolean;
  3136. /**
  3137. !#en Cascade opacity is removed from v2.0
  3138. Returns whether node's opacity value affect its child nodes.
  3139. !#zh 透明度级联功能从 v2.0 开始已移除
  3140. 返回节点的不透明度值是否影响其子节点。
  3141. */
  3142. isCascadeOpacityEnabled(): boolean;
  3143. /**
  3144. !#en Cascade opacity is removed from v2.0
  3145. Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
  3146. !#zh 透明度级联功能从 v2.0 开始已移除
  3147. 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
  3148. @param cascadeOpacityEnabled cascadeOpacityEnabled
  3149. */
  3150. setCascadeOpacityEnabled(cascadeOpacityEnabled: boolean): void;
  3151. /**
  3152. !#en Opacity modify RGB have been removed since v2.0
  3153. Set whether color should be changed with the opacity value,
  3154. useless in ccsg.Node, but this function is override in some class to have such behavior.
  3155. !#zh 透明度影响颜色配置已经被废弃
  3156. 设置更改透明度时是否修改RGB值,
  3157. @param opacityValue opacityValue
  3158. */
  3159. setOpacityModifyRGB(opacityValue: boolean): void;
  3160. /**
  3161. !#en Opacity modify RGB have been removed since v2.0
  3162. Get whether color should be changed with the opacity value.
  3163. !#zh 透明度影响颜色配置已经被废弃
  3164. 获取更改透明度时是否修改RGB值。
  3165. */
  3166. isOpacityModifyRGB(): boolean;
  3167. }
  3168. /** !#en
  3169. Class of private entities in Cocos Creator scenes.<br/>
  3170. The PrivateNode is hidden in editor, and completely transparent to users.<br/>
  3171. It's normally used as Node's private content created by components in parent node.<br/>
  3172. So in theory private nodes are not children, they are part of the parent node.<br/>
  3173. Private node have two important characteristics:<br/>
  3174. 1. It has the minimum z index and cannot be modified, because they can't be displayed over real children.<br/>
  3175. 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/>
  3176. In this way, they can be easily kept inside the bounding box.<br/>
  3177. Currently, it's used by RichText component and TileMap component.
  3178. !#zh
  3179. Cocos Creator 场景中的私有节点类。<br/>
  3180. 私有节点在编辑器中不可见,对用户透明。<br/>
  3181. 通常私有节点是被一些特殊的组件创建出来作为父节点的一部分而存在的,理论上来说,它们不是子节点,而是父节点的组成部分。<br/>
  3182. 私有节点有两个非常重要的特性:<br/>
  3183. 1. 它有着最小的渲染排序的 Z 轴深度,并且无法被更改,因为它们不能被显示在其他正常子节点之上。<br/>
  3184. 2. 它的定位也是特殊的,对于私有节点来说,父节点包围盒的左下角是它的局部坐标系原点,这个原点相当于父节点的位置减去它锚点的偏移。这样私有节点可以比较容易被控制在包围盒之中。<br/>
  3185. 目前在引擎中,RichText 和 TileMap 都有可能生成私有节点。 */
  3186. export class PrivateNode extends Node {
  3187. /**
  3188. @param name name
  3189. */
  3190. constructor(name?: string);
  3191. }
  3192. /** !#en
  3193. cc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>
  3194. cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.
  3195. !#zh
  3196. cc.Scene 是 cc.Node 的子类,仅作为一个抽象的概念。<br/>
  3197. cc.Scene 和 cc.Node 有点不同,用户不应直接修改 cc.Scene。 */
  3198. export class Scene extends Node {
  3199. /** !#en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  3200. !#zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。 */
  3201. autoReleaseAssets: boolean;
  3202. }
  3203. /** !#en
  3204. Scheduler is responsible of triggering the scheduled callbacks.<br/>
  3205. You should not use NSTimer. Instead use this class.<br/>
  3206. <br/>
  3207. There are 2 different types of callbacks (selectors):<br/>
  3208. - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>
  3209. - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>
  3210. <br/>
  3211. The 'custom selectors' should be avoided when possible. It is faster,
  3212. and consumes less memory to use the 'update callback'. *
  3213. !#zh
  3214. Scheduler 是负责触发回调函数的类。<br/>
  3215. 通常情况下,建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>
  3216. 有两种不同类型的定时器:<br/>
  3217. - update 定时器:每一帧都会触发。您可以自定义优先级。<br/>
  3218. - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>
  3219. 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。 */
  3220. export class Scheduler {
  3221. /**
  3222. !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.
  3223. This method will add a `_id` property if it doesn't exist.
  3224. !zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  3225. 这个方法会给对象添加一个 `_id` 属性,如果这个属性不存在的话。
  3226. @param target target
  3227. */
  3228. enableForTarget(target: any): void;
  3229. /**
  3230. !#en
  3231. Modifies the time of all scheduled callbacks.<br/>
  3232. You can use this property to create a 'slow motion' or 'fast forward' effect.<br/>
  3233. Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>
  3234. To create a 'fast forward' effect, use values higher than 1.0.<br/>
  3235. Note:It will affect EVERY scheduled selector / action.
  3236. !#zh
  3237. 设置时间间隔的缩放比例。<br/>
  3238. 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br/>
  3239. 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br/>
  3240. 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br/>
  3241. 注意:它影响该 Scheduler 下管理的所有定时器。
  3242. @param timeScale timeScale
  3243. */
  3244. setTimeScale(timeScale: number): void;
  3245. /**
  3246. !#en Returns time scale of scheduler.
  3247. !#zh 获取时间间隔的缩放比例。
  3248. */
  3249. getTimeScale(): number;
  3250. /**
  3251. !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  3252. !#zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  3253. @param dt delta time
  3254. */
  3255. update(dt: number): void;
  3256. /**
  3257. !#en
  3258. <p>
  3259. The scheduled method will be called every 'interval' seconds.<br/>
  3260. If paused is YES, then it won't be called until it is resumed.<br/>
  3261. If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
  3262. If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
  3263. repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
  3264. delay is the amount of time the action will wait before it'll start<br/>
  3265. </p>
  3266. !#zh
  3267. 指定回调函数,调用对象等信息来添加一个新的定时器。<br/>
  3268. 如果 paused 值为 true,那么直到 resume 被调用才开始计时。<br/>
  3269. 当时间间隔达到指定值时,设置的回调函数将会被调用。<br/>
  3270. 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
  3271. 建议使用 scheduleUpdateForTarget 代替。<br/>
  3272. 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
  3273. repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
  3274. 可以让定时器一直循环触发。<br/>
  3275. delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
  3276. @param callback callback
  3277. @param target target
  3278. @param interval interval
  3279. @param repeat repeat
  3280. @param delay delay
  3281. @param paused paused
  3282. @example
  3283. ```js
  3284. //register a schedule to scheduler
  3285. cc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);
  3286. ```
  3287. */
  3288. schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void;
  3289. schedule(callback: Function, target: any, interval: number, paused?: boolean): void;
  3290. /**
  3291. !#en
  3292. Schedules the update callback for a given target,
  3293. During every frame after schedule started, the "update" function of target will be invoked.
  3294. !#zh
  3295. 使用指定的优先级为指定的对象设置 update 定时器。
  3296. update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。
  3297. 优先级的值越低,定时器被触发的越早。
  3298. @param target target
  3299. @param priority priority
  3300. @param paused paused
  3301. */
  3302. scheduleUpdate(target: any, priority: number, paused: boolean): void;
  3303. /**
  3304. !#en
  3305. Unschedules a callback for a callback and a given target.
  3306. If you want to unschedule the "update", use `unscheduleUpdate()`
  3307. !#zh
  3308. 取消指定对象定时器。
  3309. 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  3310. @param callback The callback to be unscheduled
  3311. @param target The target bound to the callback.
  3312. */
  3313. unschedule(callback: Function, target: any): void;
  3314. /**
  3315. !#en Unschedules the update callback for a given target.
  3316. !#zh 取消指定对象的 update 定时器。
  3317. @param target The target to be unscheduled.
  3318. */
  3319. unscheduleUpdate(target: any): void;
  3320. /**
  3321. !#en
  3322. Unschedules all scheduled callbacks for a given target.
  3323. This also includes the "update" callback.
  3324. !#zh 取消指定对象的所有定时器,包括 update 定时器。
  3325. @param target The target to be unscheduled.
  3326. */
  3327. unscheduleAllForTarget(target: any): void;
  3328. /**
  3329. !#en
  3330. Unschedules all scheduled callbacks from all targets including the system callbacks.<br/>
  3331. You should NEVER call this method, unless you know what you are doing.
  3332. !#zh
  3333. 取消所有对象的所有定时器,包括系统定时器。<br/>
  3334. 不用调用此函数,除非你确定你在做什么。
  3335. */
  3336. unscheduleAll(): void;
  3337. /**
  3338. !#en
  3339. Unschedules all callbacks from all targets with a minimum priority.<br/>
  3340. You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  3341. !#zh
  3342. 取消所有优先级的值大于指定优先级的定时器。<br/>
  3343. 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  3344. @param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
  3345. priority is higher than minPriority will be unscheduled.
  3346. */
  3347. unscheduleAllWithMinPriority(minPriority: number): void;
  3348. /**
  3349. !#en Checks whether a callback for a given target is scheduled.
  3350. !#zh 检查指定的回调函数和回调对象组合是否存在定时器。
  3351. @param callback The callback to check.
  3352. @param target The target of the callback.
  3353. */
  3354. isScheduled(callback: Function, target: any): boolean;
  3355. /**
  3356. !#en
  3357. Pause all selectors from all targets.<br/>
  3358. You should NEVER call this method, unless you know what you are doing.
  3359. !#zh
  3360. 暂停所有对象的所有定时器。<br/>
  3361. 不要调用这个方法,除非你知道你正在做什么。
  3362. */
  3363. pauseAllTargets(): void;
  3364. /**
  3365. !#en
  3366. Pause all selectors from all targets with a minimum priority. <br/>
  3367. You should only call this with kCCPriorityNonSystemMin or higher.
  3368. !#zh
  3369. 暂停所有优先级的值大于指定优先级的定时器。<br/>
  3370. 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  3371. @param minPriority minPriority
  3372. */
  3373. pauseAllTargetsWithMinPriority(minPriority: number): void;
  3374. /**
  3375. !#en
  3376. Resume selectors on a set of targets.<br/>
  3377. This can be useful for undoing a call to pauseAllCallbacks.
  3378. !#zh
  3379. 恢复指定数组中所有对象的定时器。<br/>
  3380. 这个函数是 pauseAllCallbacks 的逆操作。
  3381. @param targetsToResume targetsToResume
  3382. */
  3383. resumeTargets(targetsToResume: any[]): void;
  3384. /**
  3385. !#en
  3386. Pauses the target.<br/>
  3387. All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  3388. If the target is not present, nothing happens.
  3389. !#zh
  3390. 暂停指定对象的定时器。<br/>
  3391. 指定对象的所有定时器都会被暂停。<br/>
  3392. 如果指定的对象没有定时器,什么也不会发生。
  3393. @param target target
  3394. */
  3395. pauseTarget(target: any): void;
  3396. /**
  3397. !#en
  3398. Resumes the target.<br/>
  3399. The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  3400. If the target is not present, nothing happens.
  3401. !#zh
  3402. 恢复指定对象的所有定时器。<br/>
  3403. 指定对象的所有定时器将继续工作。<br/>
  3404. 如果指定的对象没有定时器,什么也不会发生。
  3405. @param target target
  3406. */
  3407. resumeTarget(target: any): void;
  3408. /**
  3409. !#en Returns whether or not the target is paused.
  3410. !#zh 返回指定对象的定时器是否暂停了。
  3411. @param target target
  3412. */
  3413. isTargetPaused(target: any): boolean;
  3414. /** !#en Priority level reserved for system services.
  3415. !#zh 系统服务的优先级。 */
  3416. static PRIORITY_SYSTEM: number;
  3417. /** !#en Minimum priority level for user scheduling.
  3418. !#zh 用户调度最低优先级。 */
  3419. static PRIORITY_NON_SYSTEM: number;
  3420. }
  3421. /** !#en Base class cc.Action for action classes.
  3422. !#zh Action 类是所有动作类型的基类。 */
  3423. export class Action {
  3424. /**
  3425. !#en
  3426. to copy object with deep copy.
  3427. returns a clone of action.
  3428. !#zh 返回一个克隆的动作。
  3429. */
  3430. clone(): Action;
  3431. /**
  3432. !#en
  3433. return true if the action has finished.
  3434. !#zh 如果动作已完成就返回 true。
  3435. */
  3436. isDone(): boolean;
  3437. /**
  3438. !#en get the target.
  3439. !#zh 获取当前目标节点。
  3440. */
  3441. getTarget(): Node;
  3442. /**
  3443. !#en The action will modify the target properties.
  3444. !#zh 设置目标节点。
  3445. @param target target
  3446. */
  3447. setTarget(target: Node): void;
  3448. /**
  3449. !#en get the original target.
  3450. !#zh 获取原始目标节点。
  3451. */
  3452. getOriginalTarget(): Node;
  3453. /**
  3454. !#en get tag number.
  3455. !#zh 获取用于识别动作的标签。
  3456. */
  3457. getTag(): number;
  3458. /**
  3459. !#en set tag number.
  3460. !#zh 设置标签,用于识别动作。
  3461. @param tag tag
  3462. */
  3463. setTag(tag: number): void;
  3464. /** !#en Default Action tag.
  3465. !#zh 默认动作标签。 */
  3466. static TAG_INVALID: number;
  3467. }
  3468. /** !#en
  3469. Base class actions that do have a finite time duration. <br/>
  3470. Possible actions: <br/>
  3471. - An action with a duration of 0 seconds. <br/>
  3472. - An action with a duration of 35.5 seconds.
  3473. Infinite time actions are valid
  3474. !#zh 有限时间动作,这种动作拥有时长 duration 属性。 */
  3475. export class FiniteTimeAction extends Action {
  3476. /**
  3477. !#en get duration of the action. (seconds).
  3478. !#zh 获取动作以秒为单位的持续时间。
  3479. */
  3480. getDuration(): number;
  3481. /**
  3482. !#en set duration of the action. (seconds).
  3483. !#zh 设置动作以秒为单位的持续时间。
  3484. @param duration duration
  3485. */
  3486. setDuration(duration: number): void;
  3487. /**
  3488. !#en
  3489. Returns a reversed action. <br />
  3490. For example: <br />
  3491. - The action will be x coordinates of 0 move to 100. <br />
  3492. - The reversed action will be x of 100 move to 0.
  3493. - Will be rewritten
  3494. !#zh 返回一个新的动作,执行与原动作完全相反的动作。
  3495. */
  3496. reverse(): void;
  3497. /**
  3498. !#en
  3499. to copy object with deep copy.
  3500. returns a clone of action.
  3501. !#zh 返回一个克隆的动作。
  3502. */
  3503. clone(): FiniteTimeAction;
  3504. }
  3505. /** !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions.
  3506. !#zh 即时动作,这种动作立即就会执行,继承自 FiniteTimeAction。 */
  3507. export class ActionInstant extends FiniteTimeAction {
  3508. }
  3509. /** !#en
  3510. <p> An interval action is an action that takes place within a certain period of time. <br/>
  3511. It has an start time, and a finish time. The finish time is the parameter<br/>
  3512. duration plus the start time.</p>
  3513. <p>These CCActionInterval actions have some interesting properties, like:<br/>
  3514. - They can run normally (default) <br/>
  3515. - They can run reversed with the reverse method <br/>
  3516. - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>
  3517. <p>For example, you can simulate a Ping Pong effect running the action normally and<br/>
  3518. then running it again in Reverse mode. </p>
  3519. !#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。 */
  3520. export class ActionInterval extends FiniteTimeAction {
  3521. /**
  3522. !#en Implementation of ease motion.
  3523. !#zh 缓动运动。
  3524. @param easeObj easeObj
  3525. @example
  3526. ```js
  3527. action.easing(cc.easeIn(3.0));
  3528. ```
  3529. */
  3530. easing(easeObj: any): ActionInterval;
  3531. /**
  3532. !#en
  3533. Repeats an action a number of times.
  3534. To repeat an action forever use the CCRepeatForever action.
  3535. !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。
  3536. @param times times
  3537. */
  3538. repeat(times: number): ActionInterval;
  3539. /**
  3540. !#en
  3541. Repeats an action for ever. <br/>
  3542. To repeat the an action for a limited number of times use the Repeat action. <br/>
  3543. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。
  3544. */
  3545. repeatForever(): ActionInterval;
  3546. }
  3547. /** !#en
  3548. cc.ActionManager is a class that can manage actions.<br/>
  3549. Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
  3550. which uses this class's singleton object.
  3551. But there are some cases where you might need to use this class. <br/>
  3552. Examples:<br/>
  3553. - When you want to run an action where the target is different from a CCNode.<br/>
  3554. - When you want to pause / resume the actions<br/>
  3555. !#zh
  3556. cc.ActionManager 是可以管理动作的单例类。<br/>
  3557. 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
  3558. 但也有一些情况下,您可能需要使用这个类。 <br/>
  3559. 例如:
  3560. - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
  3561. - 当你想要暂停/恢复动作时。 <br/> */
  3562. export class ActionManager {
  3563. /**
  3564. !#en
  3565. Adds an action with a target.<br/>
  3566. If the target is already present, then the action will be added to the existing target.
  3567. 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.
  3568. When the target is paused, the queued actions won't be 'ticked'.
  3569. !#zh
  3570. 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
  3571. 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
  3572. 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
  3573. 当目标状态的 paused 为 true,动作将不会被执行
  3574. @param action action
  3575. @param target target
  3576. @param paused paused
  3577. */
  3578. addAction(action: Action, target: Node, paused: boolean): void;
  3579. /**
  3580. !#en Removes all actions from all the targets.
  3581. !#zh 移除所有对象的所有动作。
  3582. */
  3583. removeAllActions(): void;
  3584. /**
  3585. !#en
  3586. Removes all actions from a certain target. <br/>
  3587. All the actions that belongs to the target will be removed.
  3588. !#zh
  3589. 移除指定对象上的所有动作。<br/>
  3590. 属于该目标的所有的动作将被删除。
  3591. @param target target
  3592. @param forceDelete forceDelete
  3593. */
  3594. removeAllActionsFromTarget(target: Node, forceDelete: boolean): void;
  3595. /**
  3596. !#en Removes an action given an action reference.
  3597. !#zh 移除指定的动作。
  3598. @param action action
  3599. */
  3600. removeAction(action: Action): void;
  3601. /**
  3602. !#en Removes an action given its tag and the target.
  3603. !#zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
  3604. @param tag tag
  3605. @param target target
  3606. */
  3607. removeActionByTag(tag: number, target: Node): void;
  3608. /**
  3609. !#en Gets an action given its tag an a target.
  3610. !#zh 通过目标对象和标签获取一个动作。
  3611. @param tag tag
  3612. @param target target
  3613. */
  3614. getActionByTag(tag: number, target: Node): Action;
  3615. /**
  3616. !#en
  3617. Returns the numbers of actions that are running in a certain target. <br/>
  3618. Composable actions are counted as 1 action. <br/>
  3619. Example: <br/>
  3620. - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  3621. - If you are running 7 Sequences of 2 actions, it will return 7.
  3622. !#zh
  3623. 返回指定对象下所有正在运行的动作数量。 <br/>
  3624. 组合动作被算作一个动作。<br/>
  3625. 例如:<br/>
  3626. - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
  3627. - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
  3628. @param target target
  3629. */
  3630. getNumberOfRunningActionsInTarget(target: Node): number;
  3631. /**
  3632. !#en Pauses the target: all running actions and newly added actions will be paused.
  3633. !#zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
  3634. @param target target
  3635. */
  3636. pauseTarget(target: Node): void;
  3637. /**
  3638. !#en Resumes the target. All queued actions will be resumed.
  3639. !#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
  3640. @param target target
  3641. */
  3642. resumeTarget(target: Node): void;
  3643. /**
  3644. !#en Pauses all running actions, returning a list of targets whose actions were paused.
  3645. !#zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
  3646. */
  3647. pauseAllRunningActions(): any[];
  3648. /**
  3649. !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
  3650. !#zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
  3651. @param targetsToResume targetsToResume
  3652. */
  3653. resumeTargets(targetsToResume: any[]): void;
  3654. /**
  3655. !#en Pause a set of targets.
  3656. !#zh 暂停一组指定对象。
  3657. @param targetsToPause targetsToPause
  3658. */
  3659. pauseTargets(targetsToPause: any[]): void;
  3660. /**
  3661. !#en
  3662. purges the shared action manager. It releases the retained instance. <br/>
  3663. because it uses this, so it can not be static.
  3664. !#zh
  3665. 清除共用的动作管理器。它释放了持有的实例。 <br/>
  3666. 因为它使用 this,因此它不能是静态的。
  3667. */
  3668. purgeSharedManager(): void;
  3669. /**
  3670. !#en The ActionManager update。
  3671. !#zh ActionManager 主循环。
  3672. @param dt delta time in seconds
  3673. */
  3674. update(dt: number): void;
  3675. }
  3676. /** !#en
  3677. Tween provide a simple and flexible way to create action.
  3678. Tween's api is more flexible than cc.Action:
  3679. - Support creating an action sequence in chained api,
  3680. - Support animate any objects' any properties, not limited to node's properties.
  3681. By contrast, cc.Action needs to create a new action class to support new node property.
  3682. - Support working with cc.Action,
  3683. - Support easing and progress function,
  3684. !#zh
  3685. Tween 提供了一个简单灵活的方法来创建 action。
  3686. 相对于 Cocos 传统的 cc.Action,cc.Tween 在创建动画上要灵活非常多:
  3687. - 支持以链式结构的方式创建一个动画序列。
  3688. - 支持对任意对象的任意属性进行缓动,不再局限于节点上的属性,而 cc.Action 添加一个属性的支持时还需要添加一个新的 action 类型。
  3689. - 支持与 cc.Action 混用
  3690. - 支持设置 easing 或者 progress 函数 */
  3691. export class Tween {
  3692. /**
  3693. !#en
  3694. Insert an action or tween to this sequence
  3695. !#zh
  3696. 插入一个 action 或者 tween 到队列中
  3697. @param other other
  3698. */
  3699. then(other: Action|Tween): void;
  3700. /**
  3701. !#en
  3702. Set tween target
  3703. !#zh
  3704. 设置 tween 的 target
  3705. */
  3706. target(): void;
  3707. /**
  3708. !#en
  3709. Start this tween
  3710. !#zh
  3711. 运行当前 tween
  3712. */
  3713. start(): void;
  3714. /**
  3715. !#en
  3716. Stop this tween
  3717. !#zh
  3718. 停止当前 tween
  3719. */
  3720. stop(): void;
  3721. /**
  3722. !#en
  3723. Clone a tween
  3724. !#zh
  3725. 克隆当前 tween
  3726. @param target target
  3727. */
  3728. clone(target?: any): void;
  3729. /**
  3730. !#en
  3731. Add an action which calculate with absolute value
  3732. !#zh
  3733. 添加一个对属性进行绝对值计算的 action
  3734. @param duration duration
  3735. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  3736. @param opts opts
  3737. */
  3738. to(duration: number, props: any, opts: {progress: Function; easing: Function|string; }): void;
  3739. /**
  3740. !#en
  3741. Add an action which calculate with relative value
  3742. !#zh
  3743. 添加一个对属性进行相对值计算的 action
  3744. @param duration duration
  3745. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  3746. @param opts opts
  3747. */
  3748. by(duration: number, props: any, opts: {progress: Function; easing: Function|string; }): void;
  3749. /**
  3750. !#en
  3751. Add an delay action
  3752. !#zh
  3753. 添加一个延时 action
  3754. @param duration duration
  3755. */
  3756. delay(duration: number): void;
  3757. /**
  3758. !#en
  3759. Add an callback action
  3760. !#zh
  3761. 添加一个回调 action
  3762. @param callback callback
  3763. */
  3764. call(callback: Function): void;
  3765. /**
  3766. !#en
  3767. Add an hide action
  3768. !#zh
  3769. 添加一个隐藏 action
  3770. */
  3771. hide(): void;
  3772. /**
  3773. !#en
  3774. Add an show action
  3775. !#zh
  3776. 添加一个显示 action
  3777. */
  3778. show(): void;
  3779. /**
  3780. !#en
  3781. Add an removeSelf action
  3782. !#zh
  3783. 添加一个移除自己 action
  3784. */
  3785. removeSelf(): void;
  3786. /**
  3787. !#en
  3788. Add an sequence action
  3789. !#zh
  3790. 添加一个队列 action
  3791. @param actions actions
  3792. */
  3793. sequence(actions: [Action]): void;
  3794. /**
  3795. !#en
  3796. Add an repeat action.
  3797. This action will integrate before actions to a sequence action as their parameters.
  3798. !#zh
  3799. 添加一个重复 action,这个 action 会将之前的 action 整合成一个 sequence action 作为他的参数。
  3800. @param repeatTimes repeatTimes
  3801. */
  3802. repeat(repeatTimes: number): void;
  3803. /**
  3804. !#en
  3805. Add an repeat forever action
  3806. This action will integrate before actions to a sequence action as their parameters.
  3807. !#zh
  3808. 添加一个永久重复 action,这个 action 会将之前的 action 整合成一个 sequence action 作为他的参数。
  3809. */
  3810. repeatForever(): void;
  3811. /**
  3812. !#en
  3813. Add an reverse time action.
  3814. This action will integrate before actions to a sequence action as their parameters.
  3815. !#zh
  3816. 添加一个倒置时间 action,这个 action 会将之前的 action 整合成一个 sequence action 作为他的参数。
  3817. */
  3818. reverseTime(): void;
  3819. /**
  3820. @param target the target to animate
  3821. */
  3822. tween(target?: any): Tween;
  3823. }
  3824. /** Class for particle asset handling. */
  3825. export class ParticleAsset extends Asset {
  3826. }
  3827. /** Particle System base class. <br/>
  3828. Attributes of a Particle System:<br/>
  3829. - emmision rate of the particles<br/>
  3830. - Gravity Mode (Mode A): <br/>
  3831. - gravity <br/>
  3832. - direction <br/>
  3833. - speed +- variance <br/>
  3834. - tangential acceleration +- variance<br/>
  3835. - radial acceleration +- variance<br/>
  3836. - Radius Mode (Mode B): <br/>
  3837. - startRadius +- variance <br/>
  3838. - endRadius +- variance <br/>
  3839. - rotate +- variance <br/>
  3840. - Properties common to all modes: <br/>
  3841. - life +- life variance <br/>
  3842. - start spin +- variance <br/>
  3843. - end spin +- variance <br/>
  3844. - start size +- variance <br/>
  3845. - end size +- variance <br/>
  3846. - start color +- variance <br/>
  3847. - end color +- variance <br/>
  3848. - life +- variance <br/>
  3849. - blending function <br/>
  3850. - texture <br/>
  3851. <br/>
  3852. cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
  3853. 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
  3854. cocos2d uses a another approach, but the results are almost identical.<br/>
  3855. cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
  3856. - spinning particles (supported when using ParticleSystem) <br/>
  3857. - tangential acceleration (Gravity mode) <br/>
  3858. - radial acceleration (Gravity mode) <br/>
  3859. - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
  3860. It is possible to customize any of the above mentioned properties in runtime. Example: <br/> */
  3861. export class ParticleSystem extends RenderComponent {
  3862. /** !#en Play particle in edit mode.
  3863. !#zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。 */
  3864. preview: boolean;
  3865. /** !#en
  3866. If set custom to true, then use custom properties insteadof read particle file.
  3867. !#zh 是否自定义粒子属性。 */
  3868. custom: boolean;
  3869. /** !#en The plist file.
  3870. !#zh plist 格式的粒子配置文件。 */
  3871. file: string;
  3872. /** !#en SpriteFrame used for particles display
  3873. !#zh 用于粒子呈现的 SpriteFrame */
  3874. spriteFrame: SpriteFrame;
  3875. /** !#en Texture of Particle System, readonly, please use spriteFrame to setup new texture。
  3876. !#zh 粒子贴图,只读属性,请使用 spriteFrame 属性来替换贴图。 */
  3877. texture: string;
  3878. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  3879. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  3880. srcBlendFactor: macro.BlendFactor;
  3881. /** !#en specify the destination Blend Factor.
  3882. !#zh 指定目标的混合模式 */
  3883. dstBlendFactor: macro.BlendFactor;
  3884. /** !#en Current quantity of particles that are being simulated.
  3885. !#zh 当前播放的粒子数量。 */
  3886. particleCount: number;
  3887. /** !#en Indicate whether the system simulation have stopped.
  3888. !#zh 指示粒子播放是否完毕。 */
  3889. stopped: boolean;
  3890. /** !#en If set to true, the particle system will automatically start playing on onLoad.
  3891. !#zh 如果设置为 true 运行时会自动发射粒子。 */
  3892. playOnLoad: boolean;
  3893. /** !#en Indicate whether the owner node will be auto-removed when it has no particles left.
  3894. !#zh 粒子播放完毕后自动销毁所在的节点。 */
  3895. autoRemoveOnFinish: boolean;
  3896. /** !#en Indicate whether the particle system is activated.
  3897. !#zh 是否激活粒子。 */
  3898. active: boolean;
  3899. /** !#en Maximum particles of the system.
  3900. !#zh 粒子最大数量。 */
  3901. totalParticles: number;
  3902. /** !#en How many seconds the emitter wil run. -1 means 'forever'.
  3903. !#zh 发射器生存时间,单位秒,-1表示持续发射。 */
  3904. duration: number;
  3905. /** !#en Emission rate of the particles.
  3906. !#zh 每秒发射的粒子数目。 */
  3907. emissionRate: number;
  3908. /** !#en Life of each particle setter.
  3909. !#zh 粒子的运行时间。 */
  3910. life: number;
  3911. /** !#en Variation of life.
  3912. !#zh 粒子的运行时间变化范围。 */
  3913. lifeVar: number;
  3914. /** !#en Start color of each particle.
  3915. !#zh 粒子初始颜色。 */
  3916. startColor: cc.Color;
  3917. /** !#en Variation of the start color.
  3918. !#zh 粒子初始颜色变化范围。 */
  3919. startColorVar: cc.Color;
  3920. /** !#en Ending color of each particle.
  3921. !#zh 粒子结束颜色。 */
  3922. endColor: cc.Color;
  3923. /** !#en Variation of the end color.
  3924. !#zh 粒子结束颜色变化范围。 */
  3925. endColorVar: cc.Color;
  3926. /** !#en Angle of each particle setter.
  3927. !#zh 粒子角度。 */
  3928. angle: number;
  3929. /** !#en Variation of angle of each particle setter.
  3930. !#zh 粒子角度变化范围。 */
  3931. angleVar: number;
  3932. /** !#en Start size in pixels of each particle.
  3933. !#zh 粒子的初始大小。 */
  3934. startSize: number;
  3935. /** !#en Variation of start size in pixels.
  3936. !#zh 粒子初始大小的变化范围。 */
  3937. startSizeVar: number;
  3938. /** !#en End size in pixels of each particle.
  3939. !#zh 粒子结束时的大小。 */
  3940. endSize: number;
  3941. /** !#en Variation of end size in pixels.
  3942. !#zh 粒子结束大小的变化范围。 */
  3943. endSizeVar: number;
  3944. /** !#en Start angle of each particle.
  3945. !#zh 粒子开始自旋角度。 */
  3946. startSpin: number;
  3947. /** !#en Variation of start angle.
  3948. !#zh 粒子开始自旋角度变化范围。 */
  3949. startSpinVar: number;
  3950. /** !#en End angle of each particle.
  3951. !#zh 粒子结束自旋角度。 */
  3952. endSpin: number;
  3953. /** !#en Variation of end angle.
  3954. !#zh 粒子结束自旋角度变化范围。 */
  3955. endSpinVar: number;
  3956. /** !#en Source position of the emitter.
  3957. !#zh 发射器位置。 */
  3958. sourcePos: Vec2;
  3959. /** !#en Variation of source position.
  3960. !#zh 发射器位置的变化范围。(横向和纵向) */
  3961. posVar: Vec2;
  3962. /** !#en Particles movement type.
  3963. !#zh 粒子位置类型。 */
  3964. positionType: ParticleSystem.PositionType;
  3965. /** !#en Particles emitter modes.
  3966. !#zh 发射器类型。 */
  3967. emitterMode: ParticleSystem.EmitterMode;
  3968. /** !#en Gravity of the emitter.
  3969. !#zh 重力。 */
  3970. gravity: Vec2;
  3971. /** !#en Speed of the emitter.
  3972. !#zh 速度。 */
  3973. speed: number;
  3974. /** !#en Variation of the speed.
  3975. !#zh 速度变化范围。 */
  3976. speedVar: number;
  3977. /** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  3978. !#zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。 */
  3979. tangentialAccel: number;
  3980. /** !#en Variation of the tangential acceleration.
  3981. !#zh 每个粒子的切向加速度变化范围。 */
  3982. tangentialAccelVar: number;
  3983. /** !#en Acceleration of each particle. Only available in 'Gravity' mode.
  3984. !#zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。 */
  3985. radialAccel: number;
  3986. /** !#en Variation of the radial acceleration.
  3987. !#zh 粒子径向加速度变化范围。 */
  3988. radialAccelVar: number;
  3989. /** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  3990. !#zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。 */
  3991. rotationIsDir: boolean;
  3992. /** !#en Starting radius of the particles. Only available in 'Radius' mode.
  3993. !#zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。 */
  3994. startRadius: number;
  3995. /** !#en Variation of the starting radius.
  3996. !#zh 初始半径变化范围。 */
  3997. startRadiusVar: number;
  3998. /** !#en Ending radius of the particles. Only available in 'Radius' mode.
  3999. !#zh 结束半径,只有在半径模式下可用。 */
  4000. endRadius: number;
  4001. /** !#en Variation of the ending radius.
  4002. !#zh 结束半径变化范围。 */
  4003. endRadiusVar: number;
  4004. /** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  4005. !#zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。 */
  4006. rotatePerS: number;
  4007. /** !#en Variation of the degress to rotate a particle around the source pos per second.
  4008. !#zh 粒子每秒围绕起始点的旋转角度变化范围。 */
  4009. rotatePerSVar: number;
  4010. /** !#en The Particle emitter lives forever.
  4011. !#zh 表示发射器永久存在 */
  4012. static DURATION_INFINITY: number;
  4013. /** !#en The starting size of the particle is equal to the ending size.
  4014. !#zh 表示粒子的起始大小等于结束大小。 */
  4015. static START_SIZE_EQUAL_TO_END_SIZE: number;
  4016. /** !#en The starting radius of the particle is equal to the ending radius.
  4017. !#zh 表示粒子的起始半径等于结束半径。 */
  4018. static START_RADIUS_EQUAL_TO_END_RADIUS: number;
  4019. /**
  4020. !#en Stop emitting particles. Running particles will continue to run until they die.
  4021. !#zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  4022. @example
  4023. ```js
  4024. // stop particle system.
  4025. myParticleSystem.stopSystem();
  4026. ```
  4027. */
  4028. stopSystem(): void;
  4029. /**
  4030. !#en Kill all living particles.
  4031. !#zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  4032. @example
  4033. ```js
  4034. // play particle system.
  4035. myParticleSystem.resetSystem();
  4036. ```
  4037. */
  4038. resetSystem(): void;
  4039. /**
  4040. !#en Whether or not the system is full.
  4041. !#zh 发射器中粒子是否大于等于设置的总粒子数量。
  4042. */
  4043. isFull(): boolean;
  4044. /**
  4045. !#en Sets a new texture with a rect. The rect is in texture position and size.
  4046. Please use spriteFrame property instead, this function is deprecated since v1.9
  4047. !#zh 设置一张新贴图和关联的矩形。
  4048. 请直接设置 spriteFrame 属性,这个函数从 v1.9 版本开始已经被废弃
  4049. @param texture texture
  4050. @param rect rect
  4051. */
  4052. setTextureWithRect(texture: Texture2D, rect: Rect): void;
  4053. }
  4054. /** !#en Render the TMX layer.
  4055. !#zh 渲染 TMX layer。 */
  4056. export class TiledLayer extends Component {
  4057. /**
  4058. !#en Gets the layer name.
  4059. !#zh 获取层的名称。
  4060. @example
  4061. ```js
  4062. let layerName = tiledLayer.getLayerName();
  4063. cc.log(layerName);
  4064. ```
  4065. */
  4066. getLayerName(): string;
  4067. /**
  4068. !#en Set the layer name.
  4069. !#zh 设置层的名称
  4070. @param layerName layerName
  4071. @example
  4072. ```js
  4073. tiledLayer.setLayerName("New Layer");
  4074. ```
  4075. */
  4076. SetLayerName(layerName: string): void;
  4077. /**
  4078. !#en Return the value for the specific property name.
  4079. !#zh 获取指定属性名的值。
  4080. @param propertyName propertyName
  4081. @example
  4082. ```js
  4083. let property = tiledLayer.getProperty("info");
  4084. cc.log(property);
  4085. ```
  4086. */
  4087. getProperty(propertyName: string): any;
  4088. /**
  4089. !#en Returns the position in pixels of a given tile coordinate.
  4090. !#zh 获取指定 tile 的像素坐标。
  4091. @param pos position or x
  4092. @param y y
  4093. @example
  4094. ```js
  4095. let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  4096. cc.log("Pos: " + pos);
  4097. let pos = tiledLayer.getPositionAt(0, 0);
  4098. cc.log("Pos: " + pos);
  4099. ```
  4100. */
  4101. getPositionAt(pos: Vec2|number, y?: number): Vec2;
  4102. /**
  4103. !#en
  4104. Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  4105. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  4106. If a tile is already placed at that position, then it will be removed.
  4107. !#zh
  4108. 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  4109. tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  4110. 如果一个 tile 已经放在那个位置,那么它将被删除。
  4111. @param gid gid
  4112. @param posOrX position or x
  4113. @param flagsOrY flags or y
  4114. @param flags flags
  4115. @example
  4116. ```js
  4117. tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  4118. ```
  4119. */
  4120. setTileGIDAt(gid: number, posOrX: Vec2|number, flagsOrY: number, flags?: number): void;
  4121. /**
  4122. !#en
  4123. Returns the tile gid at a given tile coordinate. <br />
  4124. if it returns 0, it means that the tile is empty. <br />
  4125. !#zh
  4126. 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  4127. 如果它返回 0,则表示该 tile 为空。<br />
  4128. @param pos or x
  4129. @param y y
  4130. @example
  4131. ```js
  4132. let tileGid = tiledLayer.getTileGIDAt(0, 0);
  4133. ```
  4134. */
  4135. getTileGIDAt(pos: Vec2|number, y?: number): number;
  4136. /**
  4137. !#en
  4138. Get the TiledTile with the tile coordinate.<br/>
  4139. If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  4140. then will create a new TiledTile at the coordinate.
  4141. The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  4142. !#zh
  4143. 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  4144. 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  4145. 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  4146. @param x x
  4147. @param y y
  4148. @param forceCreate forceCreate
  4149. @example
  4150. ```js
  4151. let tile = tiledLayer.getTiledTileAt(100, 100, true);
  4152. cc.log(tile);
  4153. ```
  4154. */
  4155. getTiledTileAt(x: number, y: number, forceCreate: boolean): cc.TiledTile;
  4156. /**
  4157. !#en
  4158. Change tile to TiledTile at the specified coordinate.
  4159. !#zh
  4160. 将指定的 tile 坐标替换为指定的 TiledTile。
  4161. @param x x
  4162. @param y y
  4163. @param tiledTile tiledTile
  4164. */
  4165. setTiledTileAt(x: number, y: number, tiledTile: cc.TiledTile): cc.TiledTile;
  4166. /**
  4167. !#en Return texture of cc.SpriteBatchNode.
  4168. !#zh 获取纹理。
  4169. @example
  4170. ```js
  4171. let texture = tiledLayer.getTexture();
  4172. cc.log("Texture: " + texture);
  4173. ```
  4174. */
  4175. getTexture(): Texture2D;
  4176. /**
  4177. !#en Set the texture of cc.SpriteBatchNode.
  4178. !#zh 设置纹理。
  4179. @param texture texture
  4180. @example
  4181. ```js
  4182. tiledLayer.setTexture(texture);
  4183. ```
  4184. */
  4185. setTexture(texture: Texture2D): void;
  4186. /**
  4187. !#en Gets layer size.
  4188. !#zh 获得层大小。
  4189. @example
  4190. ```js
  4191. let size = tiledLayer.getLayerSize();
  4192. cc.log("layer size: " + size);
  4193. ```
  4194. */
  4195. getLayerSize(): Size;
  4196. /**
  4197. !#en Size of the map's tile (could be different from the tile's size).
  4198. !#zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  4199. @example
  4200. ```js
  4201. let mapTileSize = tiledLayer.getMapTileSize();
  4202. cc.log("MapTile size: " + mapTileSize);
  4203. ```
  4204. */
  4205. getMapTileSize(): Size;
  4206. /**
  4207. !#en Tile set information for the layer.
  4208. !#zh 获取 layer 的 Tileset 信息。
  4209. @example
  4210. ```js
  4211. let tileset = tiledLayer.getTileSet();
  4212. ```
  4213. */
  4214. getTileSet(): TMXTilesetInfo;
  4215. /**
  4216. !#en Tile set information for the layer.
  4217. !#zh 设置 layer 的 Tileset 信息。
  4218. @param tileset tileset
  4219. @example
  4220. ```js
  4221. tiledLayer.setTileSet(tileset);
  4222. ```
  4223. */
  4224. setTileSet(tileset: TMXTilesetInfo): void;
  4225. /**
  4226. !#en Layer orientation, which is the same as the map orientation.
  4227. !#zh 获取 Layer 方向(同地图方向)。
  4228. @example
  4229. ```js
  4230. let orientation = tiledLayer.getLayerOrientation();
  4231. cc.log("Layer Orientation: " + orientation);
  4232. ```
  4233. */
  4234. getLayerOrientation(): number;
  4235. /**
  4236. !#en properties from the layer. They can be added using Tiled.
  4237. !#zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  4238. @example
  4239. ```js
  4240. let properties = tiledLayer.getProperties();
  4241. cc.log("Properties: " + properties);
  4242. ```
  4243. */
  4244. getProperties(): any[];
  4245. }
  4246. /** !#en Renders a TMX Tile Map in the scene.
  4247. !#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */
  4248. export class TiledMap extends Component {
  4249. /** !#en The TiledMap Asset.
  4250. !#zh TiledMap 资源。 */
  4251. tmxAsset: TiledMapAsset;
  4252. /**
  4253. !#en Gets the map size.
  4254. !#zh 获取地图大小。
  4255. @example
  4256. ```js
  4257. let mapSize = tiledMap.getMapSize();
  4258. cc.log("Map Size: " + mapSize);
  4259. ```
  4260. */
  4261. getMapSize(): Size;
  4262. /**
  4263. !#en Gets the tile size.
  4264. !#zh 获取地图背景中 tile 元素的大小。
  4265. @example
  4266. ```js
  4267. let tileSize = tiledMap.getTileSize();
  4268. cc.log("Tile Size: " + tileSize);
  4269. ```
  4270. */
  4271. getTileSize(): Size;
  4272. /**
  4273. !#en map orientation.
  4274. !#zh 获取地图方向。
  4275. @example
  4276. ```js
  4277. let mapOrientation = tiledMap.getMapOrientation();
  4278. cc.log("Map Orientation: " + mapOrientation);
  4279. ```
  4280. */
  4281. getMapOrientation(): number;
  4282. /**
  4283. !#en object groups.
  4284. !#zh 获取所有的对象层。
  4285. @example
  4286. ```js
  4287. let objGroups = titledMap.getObjectGroups();
  4288. for (let i = 0; i < objGroups.length; ++i) {
  4289. cc.log("obj: " + objGroups[i]);
  4290. }
  4291. ```
  4292. */
  4293. getObjectGroups(): TiledObjectGroup[];
  4294. /**
  4295. !#en Return the TMXObjectGroup for the specific group.
  4296. !#zh 获取指定的 TMXObjectGroup。
  4297. @param groupName groupName
  4298. @example
  4299. ```js
  4300. let group = titledMap.getObjectGroup("Players");
  4301. cc.log("ObjectGroup: " + group);
  4302. ```
  4303. */
  4304. getObjectGroup(groupName: string): TiledObjectGroup;
  4305. /**
  4306. !#en Gets the map properties.
  4307. !#zh 获取地图的属性。
  4308. @example
  4309. ```js
  4310. let properties = titledMap.getProperties();
  4311. for (let i = 0; i < properties.length; ++i) {
  4312. cc.log("Properties: " + properties[i]);
  4313. }
  4314. ```
  4315. */
  4316. getProperties(): any[];
  4317. /**
  4318. !#en Return All layers array.
  4319. !#zh 返回包含所有 layer 的数组。
  4320. @example
  4321. ```js
  4322. let layers = titledMap.allLayers();
  4323. for (let i = 0; i < layers.length; ++i) {
  4324. cc.log("Layers: " + layers[i]);
  4325. }
  4326. ```
  4327. */
  4328. getLayers(): TiledLayer[];
  4329. /**
  4330. !#en return the cc.TiledLayer for the specific layer.
  4331. !#zh 获取指定名称的 layer。
  4332. @param layerName layerName
  4333. @example
  4334. ```js
  4335. let layer = titledMap.getLayer("Player");
  4336. cc.log(layer);
  4337. ```
  4338. */
  4339. getLayer(layerName: string): TiledLayer;
  4340. /**
  4341. !#en Return the value for the specific property name.
  4342. !#zh 通过属性名称,获取指定的属性。
  4343. @param propertyName propertyName
  4344. @example
  4345. ```js
  4346. let property = titledMap.getProperty("info");
  4347. cc.log("Property: " + property);
  4348. ```
  4349. */
  4350. getProperty(propertyName: string): string;
  4351. /**
  4352. !#en Return properties dictionary for tile GID.
  4353. !#zh 通过 GID ,获取指定的属性。
  4354. @param GID GID
  4355. @example
  4356. ```js
  4357. let properties = titledMap.getPropertiesForGID(GID);
  4358. cc.log("Properties: " + properties);
  4359. ```
  4360. */
  4361. getPropertiesForGID(GID: number): any;
  4362. }
  4363. /** Class for tiled map asset handling. */
  4364. export class TiledMapAsset extends Asset {
  4365. textures: Texture2D[];
  4366. textureNames: string[];
  4367. }
  4368. /** !#en Renders the TMX object group.
  4369. !#zh 渲染 tmx object group。 */
  4370. export class TiledObjectGroup extends Component {
  4371. /**
  4372. !#en Offset position of child objects.
  4373. !#zh 获取子对象的偏移位置。
  4374. @example
  4375. ```js
  4376. let offset = tMXObjectGroup.getPositionOffset();
  4377. ```
  4378. */
  4379. getPositionOffset(): Vec2;
  4380. /**
  4381. !#en List of properties stored in a dictionary.
  4382. !#zh 以映射的形式获取属性列表。
  4383. @example
  4384. ```js
  4385. let offset = tMXObjectGroup.getProperties();
  4386. ```
  4387. */
  4388. getProperties(): any;
  4389. /**
  4390. !#en Gets the Group name.
  4391. !#zh 获取组名称。
  4392. @example
  4393. ```js
  4394. let groupName = tMXObjectGroup.getGroupName;
  4395. ```
  4396. */
  4397. getGroupName(): string;
  4398. /**
  4399. !#en
  4400. Return the object for the specific object name. <br />
  4401. It will return the 1st object found on the array for the given name.
  4402. !#zh 获取指定的对象。
  4403. @param objectName objectName
  4404. @example
  4405. ```js
  4406. let object = tMXObjectGroup.getObject("Group");
  4407. ```
  4408. */
  4409. getObject(objectName: string): any;
  4410. /**
  4411. !#en Gets the objects.
  4412. !#zh 获取对象数组。
  4413. @example
  4414. ```js
  4415. let objects = tMXObjectGroup.getObjects();
  4416. ```
  4417. */
  4418. getObjects(): any[];
  4419. }
  4420. /** !#en TiledTile can control the specified map tile.
  4421. It will apply the node rotation, scale, translate to the map tile.
  4422. You can change the TiledTile's gid to change the map tile's style.
  4423. !#zh TiledTile 可以单独对某一个地图块进行操作。
  4424. 他会将节点的旋转,缩放,平移操作应用在这个地图块上,并可以通过更换当前地图块的 gid 来更换地图块的显示样式。 */
  4425. export class TiledTile extends Component {
  4426. /** !#en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  4427. !#zh 指定 TiledTile 的横向坐标,以地图块为单位 */
  4428. x: number;
  4429. /** !#en Specify the TiledTile vertical coordinate,use map tile as the unit.
  4430. !#zh 指定 TiledTile 的纵向坐标,以地图块为单位 */
  4431. y: number;
  4432. /** !#en Specify the TiledTile gid.
  4433. !#zh 指定 TiledTile 的 gid 值 */
  4434. gid: number;
  4435. }
  4436. /** !#en cc.WebView is a component for display web pages in the game
  4437. !#zh WebView 组件,用于在游戏中显示网页 */
  4438. export class WebView extends Component {
  4439. /** !#en A given URL to be loaded by the WebView, it should have a http or https prefix.
  4440. !#zh 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串 */
  4441. url: string;
  4442. /** !#en The webview's event callback , it will be triggered when certain webview event occurs.
  4443. !#zh WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数 */
  4444. webviewLoadedEvents: Component.EventHandler[];
  4445. /**
  4446. !#en
  4447. Set javascript interface scheme (see also setOnJSCallback). <br/>
  4448. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4449. Please refer to the official documentation for more details.
  4450. !#zh
  4451. 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。<br/>
  4452. 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。<br/>
  4453. 详情请参阅官方文档
  4454. @param scheme scheme
  4455. */
  4456. setJavascriptInterfaceScheme(scheme: string): void;
  4457. /**
  4458. !#en
  4459. This callback called when load URL that start with javascript
  4460. interface scheme (see also setJavascriptInterfaceScheme). <br/>
  4461. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4462. Please refer to the official documentation for more details.
  4463. !#zh
  4464. 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。<br/>
  4465. 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  4466. 详情请参阅官方文档
  4467. @param callback callback
  4468. */
  4469. setOnJSCallback(callback: Function): void;
  4470. /**
  4471. !#en
  4472. Evaluates JavaScript in the context of the currently displayed page. <br/>
  4473. Please refer to the official document for more details <br/>
  4474. Note: Cross domain issues need to be resolved by yourself <br/>
  4475. !#zh
  4476. 执行 WebView 内部页面脚本(详情请参阅官方文档) <br/>
  4477. 注意:需要自行解决跨域问题
  4478. @param str str
  4479. */
  4480. evaluateJS(str: string): void;
  4481. /**
  4482. !#en if you don't need the WebView and it isn't in any running Scene, you should
  4483. call the destroy method on this component or the associated node explicitly.
  4484. Otherwise, the created DOM element won't be removed from web page.
  4485. !#zh
  4486. 如果你不再使用 WebView,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4487. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4488. @example
  4489. ```js
  4490. webview.node.parent = null; // or webview.node.removeFromParent(false);
  4491. // when you don't need webview anymore
  4492. webview.node.destroy();
  4493. ```
  4494. */
  4495. destroy(): boolean;
  4496. }
  4497. /** !#en cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game.
  4498. !#zh Video 组件,用于在游戏中播放视频 */
  4499. export class VideoPlayer extends Component {
  4500. /** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.
  4501. !#zh 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。 */
  4502. resourceType: VideoPlayer.ResourceType;
  4503. /** !#en The remote URL of video.
  4504. !#zh 远程视频的 URL */
  4505. remoteURL: string;
  4506. /** !#en The local video full path.
  4507. !#zh 本地视频的 URL */
  4508. clip: string;
  4509. /** !#en The current playback time of the now playing item in seconds, you could also change the start playback time.
  4510. !#zh 指定视频从什么时间点开始播放,单位是秒,也可以用来获取当前视频播放的时间进度。 */
  4511. currentTime: number;
  4512. /** !#en The volume of the video.
  4513. !#zh 视频的音量(0.0 ~ 1.0) */
  4514. volume: number;
  4515. /** !#en Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume.
  4516. !#zh 是否静音视频。静音时设置音量为 0,取消静音是恢复原来的音量。 */
  4517. mute: boolean;
  4518. /** !#en Whether keep the aspect ration of the original video.
  4519. !#zh 是否保持视频原来的宽高比 */
  4520. keepAspectRatio: boolean;
  4521. /** !#en Whether play video in fullscreen mode.
  4522. !#zh 是否全屏播放视频 */
  4523. isFullscreen: boolean;
  4524. /** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.
  4525. !#zh 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。 */
  4526. videoPlayerEvent: Component.EventHandler[];
  4527. /**
  4528. !#en If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.
  4529. !#zh 如果视频被暂停播放了,调用这个接口可以继续播放。如果视频被停止播放了,调用这个接口可以从头开始播放。
  4530. */
  4531. play(): void;
  4532. /**
  4533. !#en If a video is paused, call this method to resume playing.
  4534. !#zh 如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  4535. */
  4536. resume(): void;
  4537. /**
  4538. !#en If a video is playing, call this method to pause playing.
  4539. !#zh 如果一个视频正在播放,调用这个接口可以暂停播放。
  4540. */
  4541. pause(): void;
  4542. /**
  4543. !#en If a video is playing, call this method to stop playing immediately.
  4544. !#zh 如果一个视频正在播放,调用这个接口可以立马停止播放。
  4545. */
  4546. stop(): void;
  4547. /**
  4548. !#en Gets the duration of the video
  4549. !#zh 获取视频文件的播放总时长
  4550. */
  4551. getDuration(): number;
  4552. /**
  4553. !#en Determine whether video is playing or not.
  4554. !#zh 判断当前视频是否处于播放状态
  4555. */
  4556. isPlaying(): boolean;
  4557. /**
  4558. !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should
  4559. call the destroy method on this component or the associated node explicitly.
  4560. Otherwise, the created DOM element won't be removed from web page.
  4561. !#zh
  4562. 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4563. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4564. @example
  4565. ```js
  4566. videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false);
  4567. // when you don't need videoplayer anymore
  4568. videoplayer.node.destroy();
  4569. ```
  4570. */
  4571. destroy(): boolean;
  4572. }
  4573. /** !#en
  4574. cc.NodePool is the cache pool designed for node type.<br/>
  4575. It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  4576. It's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,
  4577. for example, a prefab is a specific node type. <br/>
  4578. When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  4579. Some common use case is :<br/>
  4580. 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  4581. 2. Blocks in candy crash (massive creation and recreation)<br/>
  4582. etc...
  4583. !#zh
  4584. cc.NodePool 是用于管理节点对象的对象缓存池。<br/>
  4585. 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  4586. 以前 cocos2d-x 中的 cc.pool 和新的节点事件注册系统不兼容,因此请使用 cc.NodePool 来代替。
  4587. 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  4588. 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  4589. 一些常见的用例是:<br/>
  4590. 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  4591. 2.糖果粉碎传奇中的木块(频繁创建)。
  4592. 等等.... */
  4593. export class NodePool {
  4594. /**
  4595. !#en
  4596. 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.
  4597. !#zh
  4598. 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  4599. @param poolHandlerComp !#en The constructor or the class name of the component to control the unuse/reuse logic. !#zh 处理节点回收和复用事件逻辑的组件类型或名称。
  4600. @example
  4601. ```js
  4602. properties: {
  4603. template: cc.Prefab
  4604. },
  4605. onLoad () {
  4606. // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  4607. this.myPool = new cc.NodePool('MyTemplateHandler');
  4608. }
  4609. ```
  4610. */
  4611. constructor(poolHandlerComp?: {prototype: Component}|string);
  4612. /** !#en The pool handler component, it could be the class name or the constructor.
  4613. !#zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。 */
  4614. poolHandlerComp: Function|string;
  4615. /**
  4616. !#en The current available size in the pool
  4617. !#zh 获取当前缓冲池的可用对象数量
  4618. */
  4619. size(): number;
  4620. /**
  4621. !#en Destroy all cached nodes in the pool
  4622. !#zh 销毁对象池中缓存的所有节点
  4623. */
  4624. clear(): void;
  4625. /**
  4626. !#en Put a new Node into the pool.
  4627. It will automatically remove the node from its parent without cleanup.
  4628. It will also invoke unuse method of the poolHandlerComp if exist.
  4629. !#zh 向缓冲池中存入一个不再需要的节点对象。
  4630. 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  4631. 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  4632. @param obj obj
  4633. @example
  4634. ```js
  4635. let myNode = cc.instantiate(this.template);
  4636. this.myPool.put(myNode);
  4637. ```
  4638. */
  4639. put(obj: Node): void;
  4640. /**
  4641. !#en Get a obj from pool, if no available object in pool, null will be returned.
  4642. This function will invoke the reuse function of poolHandlerComp if exist.
  4643. !#zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  4644. 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  4645. @param params !#en Params to pass to 'reuse' method in poolHandlerComp !#zh 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  4646. @example
  4647. ```js
  4648. let newNode = this.myPool.get();
  4649. ```
  4650. */
  4651. get(...params: any[]): Node;
  4652. }
  4653. /** !#en
  4654. Base class for handling assets used in Creator.<br/>
  4655. You may want to override:<br/>
  4656. - createNode<br/>
  4657. - getset functions of _nativeAsset<br/>
  4658. - cc.Object._serialize<br/>
  4659. - cc.Object._deserialize<br/>
  4660. !#zh
  4661. Creator 中的资源基类。<br/>
  4662. 您可能需要重写:<br/>
  4663. - createNode <br/>
  4664. - _nativeAsset 的 getset 方法<br/>
  4665. - cc.Object._serialize<br/>
  4666. - cc.Object._deserialize<br/> */
  4667. export class Asset extends RawAsset {
  4668. /** !#en
  4669. Whether the asset is loaded or not
  4670. !#zh
  4671. 该资源是否已经成功加载 */
  4672. loaded: boolean;
  4673. /** !#en
  4674. Returns the url of this asset's native object, if none it will returns an empty string.
  4675. !#zh
  4676. 返回该资源对应的目标平台资源的 URL,如果没有将返回一个空字符串。 */
  4677. nativeUrl: string;
  4678. /** !#en Indicates whether its dependent raw assets can support deferred load if the owner scene (or prefab) is marked as `asyncLoadAssets`.
  4679. !#zh 当场景或 Prefab 被标记为 `asyncLoadAssets`,禁止延迟加载该资源所依赖的其它 RawAsset。 */
  4680. static preventDeferredLoadDependents: boolean;
  4681. /** !#en Indicates whether its native object should be preloaded from native url.
  4682. !#zh 禁止预加载原生对象。 */
  4683. static preventPreloadNativeObject: boolean;
  4684. /**
  4685. Returns the asset's url.
  4686. The `Asset` object overrides the `toString()` method of the `Object` object.
  4687. For `Asset` objects, the toString() method returns a string representation of the object.
  4688. 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.
  4689. */
  4690. toString(): string;
  4691. /**
  4692. !#en
  4693. Create a new node using this asset in the scene.<br/>
  4694. If this type of asset dont have its corresponding node type, this method should be null.
  4695. !#zh
  4696. 使用该资源在场景中创建一个新节点。<br/>
  4697. 如果这类资源没有相应的节点类型,该方法应该是空的。
  4698. @param callback callback
  4699. */
  4700. createNode(callback: (error: string, node: any) => void): void;
  4701. }
  4702. /** !#en Class for audio data handling.
  4703. !#zh 音频资源类。 */
  4704. export class AudioClip extends Asset implements EventTarget {
  4705. /**
  4706. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  4707. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  4708. @param type The type of event.
  4709. */
  4710. hasEventListener(type: string): boolean;
  4711. /**
  4712. !#en
  4713. Register an callback of a specific event type on the EventTarget.
  4714. This type of event should be triggered via `emit`.
  4715. !#zh
  4716. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  4717. @param type A string representing the event type to listen for.
  4718. @param callback The callback that will be invoked when the event is dispatched.
  4719. The callback is ignored if it is a duplicate (the callbacks are unique).
  4720. @param target The target (this object) to invoke the callback, can be null
  4721. @example
  4722. ```js
  4723. eventTarget.on('fire', function () {
  4724. cc.log("fire in the hole");
  4725. }, node);
  4726. ```
  4727. */
  4728. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  4729. /**
  4730. !#en
  4731. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  4732. if only type is passed as parameter, all listeners registered with that type will be removed.
  4733. !#zh
  4734. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  4735. @param type A string representing the event type being removed.
  4736. @param callback The callback to remove.
  4737. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  4738. @example
  4739. ```js
  4740. // register fire eventListener
  4741. var callback = eventTarget.on('fire', function () {
  4742. cc.log("fire in the hole");
  4743. }, target);
  4744. // remove fire event listener
  4745. eventTarget.off('fire', callback, target);
  4746. // remove all fire event listeners
  4747. eventTarget.off('fire');
  4748. ```
  4749. */
  4750. off(type: string, callback?: Function, target?: any): void;
  4751. /**
  4752. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  4753. This is not for removing all listeners in the current event target,
  4754. and this is not for removing all listeners the target parameter have registered.
  4755. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  4756. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  4757. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  4758. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  4759. @param target The target to be searched for all related listeners
  4760. */
  4761. targetOff(target: any): void;
  4762. /**
  4763. !#en
  4764. Register an callback of a specific event type on the EventTarget,
  4765. the callback will remove itself after the first time it is triggered.
  4766. !#zh
  4767. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  4768. @param type A string representing the event type to listen for.
  4769. @param callback The callback that will be invoked when the event is dispatched.
  4770. The callback is ignored if it is a duplicate (the callbacks are unique).
  4771. @param target The target (this object) to invoke the callback, can be null
  4772. @example
  4773. ```js
  4774. eventTarget.once('fire', function () {
  4775. cc.log("this is the callback and will be invoked only once");
  4776. }, node);
  4777. ```
  4778. */
  4779. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  4780. /**
  4781. !#en
  4782. Trigger an event directly with the event name and necessary arguments.
  4783. !#zh
  4784. 通过事件名发送自定义事件
  4785. @param type event type
  4786. @param arg1 First argument
  4787. @param arg2 Second argument
  4788. @param arg3 Third argument
  4789. @param arg4 Fourth argument
  4790. @param arg5 Fifth argument
  4791. @example
  4792. ```js
  4793. eventTarget.emit('fire', event);
  4794. eventTarget.emit('fire', message, emitter);
  4795. ```
  4796. */
  4797. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  4798. /**
  4799. !#en
  4800. Send an event with the event object.
  4801. !#zh
  4802. 通过事件对象派发事件
  4803. @param event event
  4804. */
  4805. dispatchEvent(event: Event): void;
  4806. }
  4807. /** !#en Class for BitmapFont handling.
  4808. !#zh 位图字体资源类。 */
  4809. export class BitmapFont extends Font {
  4810. }
  4811. /** undefined */
  4812. export class BufferAsset extends Asset {
  4813. }
  4814. /** !#en Class for Font handling.
  4815. !#zh 字体资源类。 */
  4816. export class Font extends Asset {
  4817. }
  4818. /** !#en
  4819. Class for JSON file. When the JSON file is loaded, this object is returned.
  4820. The parsed JSON object can be accessed through the `json` attribute in it.<br>
  4821. If you want to get the original JSON text, you should modify the extname to `.txt`
  4822. so that it is loaded as a `TextAsset` instead of a `JsonAsset`.
  4823. !#zh
  4824. JSON 资源类。JSON 文件加载后,将会返回该对象。可以通过其中的 `json` 属性访问解析后的 JSON 对象。<br>
  4825. 如果你想要获得 JSON 的原始文本,那么应该修改源文件的后缀为 `.txt`,这样就会加载为一个 `TextAsset` 而不是 `JsonAsset`。 */
  4826. export class JsonAsset extends Asset {
  4827. /** The loaded JSON object. */
  4828. json: any;
  4829. }
  4830. /** !#en Class for LabelAtlas handling.
  4831. !#zh 艺术数字字体资源类。 */
  4832. export class LabelAtlas extends BitmapFont {
  4833. }
  4834. /** !#en Class for prefab handling.
  4835. !#zh 预制资源类。 */
  4836. export class Prefab extends Asset {
  4837. /** the main cc.Node in the prefab */
  4838. data: Node;
  4839. /** !#zh
  4840. 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。
  4841. !#en
  4842. Indicates the optimization policy for instantiating this prefab.
  4843. Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab. */
  4844. optimizationPolicy: Prefab.OptimizationPolicy;
  4845. /** !#en Indicates the raw assets of this prefab can be load after prefab loaded.
  4846. !#zh 指示该 Prefab 依赖的资源可否在 Prefab 加载后再延迟加载。 */
  4847. asyncLoadAssets: boolean;
  4848. /**
  4849. Dynamically translation prefab data into minimized code.<br/>
  4850. This method will be called automatically before the first time the prefab being instantiated,
  4851. but you can re-call to refresh the create function once you modified the original prefab data in script.
  4852. */
  4853. compileCreateFunction(): void;
  4854. }
  4855. /** !#en
  4856. The base class for registering asset types.
  4857. !#zh
  4858. 注册用的资源基类。 */
  4859. export class RawAsset extends Object {
  4860. }
  4861. /** Render textures are textures that can be rendered to. */
  4862. export class RenderTexture extends Texture2D {
  4863. /**
  4864. !#en
  4865. Init the render texture with size.
  4866. !#zh
  4867. 初始化 render texture
  4868. @param width width
  4869. @param height height
  4870. @param depthStencilFormat depthStencilFormat
  4871. */
  4872. initWithSize(width?: number, height?: number, depthStencilFormat?: number): void;
  4873. /**
  4874. !#en
  4875. Get pixels from render texture, the pixels data stores in a RGBA Uint8Array.
  4876. It will return a new (width * height * 4) length Uint8Array by default。
  4877. You can specify a data to store the pixels to reuse the data,
  4878. you and can specify other params to specify the texture region to read.
  4879. !#zh
  4880. 从 render texture 读取像素数据,数据类型为 RGBA 格式的 Uint8Array 数组。
  4881. 默认每次调用此函数会生成一个大小为 (长 x 高 x 4) 的 Uint8Array。
  4882. 你可以通过传入 data 来接收像素数据,也可以通过传参来指定需要读取的区域的像素。
  4883. @param data data
  4884. @param x x
  4885. @param y y
  4886. @param w w
  4887. @param h h
  4888. */
  4889. readPixels(data?: Uint8Array, x?: number, y?: number, w?: number, h?: number): Uint8Array;
  4890. }
  4891. /** !#en Class for scene handling.
  4892. !#zh 场景资源类。 */
  4893. export class SceneAsset extends Asset {
  4894. scene: Scene;
  4895. /** !#en Indicates the raw assets of this scene can be load after scene launched.
  4896. !#zh 指示该场景依赖的资源可否在场景切换后再延迟加载。 */
  4897. asyncLoadAssets: boolean;
  4898. }
  4899. /** !#en Class for script handling.
  4900. !#zh Script 资源类。 */
  4901. export class _Script extends Asset {
  4902. }
  4903. /** !#en Class for JavaScript handling.
  4904. !#zh JavaScript 资源类。 */
  4905. export class _JavaScript extends Asset {
  4906. }
  4907. /** !#en Class for coffeescript handling.
  4908. !#zh CoffeeScript 资源类。 */
  4909. export class CoffeeScript extends Asset {
  4910. }
  4911. /** !#en Class for TypeScript handling.
  4912. !#zh TypeScript 资源类。 */
  4913. export class TypeScript extends Asset {
  4914. }
  4915. /** !#en Class for sprite atlas handling.
  4916. !#zh 精灵图集资源类。 */
  4917. export class SpriteAtlas extends Asset {
  4918. /**
  4919. Returns the texture of the sprite atlas
  4920. */
  4921. getTexture(): Texture2D;
  4922. /**
  4923. Returns the sprite frame correspond to the given key in sprite atlas.
  4924. @param key key
  4925. */
  4926. getSpriteFrame(key: string): SpriteFrame;
  4927. /**
  4928. Returns the sprite frames in sprite atlas.
  4929. */
  4930. getSpriteFrames(): [SpriteFrame];
  4931. }
  4932. /** !#en
  4933. A cc.SpriteFrame has:<br/>
  4934. - texture: A cc.Texture2D that will be used by render components<br/>
  4935. - rectangle: A rectangle of the texture
  4936. !#zh
  4937. 一个 SpriteFrame 包含:<br/>
  4938. - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
  4939. - 矩形:在纹理中的矩形区域。 */
  4940. export class SpriteFrame extends Asset implements EventTarget {
  4941. /** !#en Top border of the sprite
  4942. !#zh sprite 的顶部边框 */
  4943. insetTop: number;
  4944. /** !#en Bottom border of the sprite
  4945. !#zh sprite 的底部边框 */
  4946. insetBottom: number;
  4947. /** !#en Left border of the sprite
  4948. !#zh sprite 的左边边框 */
  4949. insetLeft: number;
  4950. /** !#en Right border of the sprite
  4951. !#zh sprite 的左边边框 */
  4952. insetRight: number;
  4953. /**
  4954. !#en
  4955. Constructor of SpriteFrame class.
  4956. !#zh
  4957. SpriteFrame 类的构造函数。
  4958. @param filename filename
  4959. @param rect rect
  4960. @param rotated Whether the frame is rotated in the texture
  4961. @param offset The offset of the frame in the texture
  4962. @param originalSize The size of the frame in the texture
  4963. */
  4964. constructor(filename?: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size);
  4965. /**
  4966. !#en Returns whether the texture have been loaded
  4967. !#zh 返回是否已加载纹理
  4968. */
  4969. textureLoaded(): boolean;
  4970. /**
  4971. !#en Returns whether the sprite frame is rotated in the texture.
  4972. !#zh 获取 SpriteFrame 是否旋转
  4973. */
  4974. isRotated(): boolean;
  4975. /**
  4976. !#en Set whether the sprite frame is rotated in the texture.
  4977. !#zh 设置 SpriteFrame 是否旋转
  4978. @param bRotated bRotated
  4979. */
  4980. setRotated(bRotated: boolean): void;
  4981. /**
  4982. !#en Returns the rect of the sprite frame in the texture.
  4983. !#zh 获取 SpriteFrame 的纹理矩形区域
  4984. */
  4985. getRect(): Rect;
  4986. /**
  4987. !#en Sets the rect of the sprite frame in the texture.
  4988. !#zh 设置 SpriteFrame 的纹理矩形区域
  4989. @param rect rect
  4990. */
  4991. setRect(rect: Rect): void;
  4992. /**
  4993. !#en Returns the original size of the trimmed image.
  4994. !#zh 获取修剪前的原始大小
  4995. */
  4996. getOriginalSize(): Size;
  4997. /**
  4998. !#en Sets the original size of the trimmed image.
  4999. !#zh 设置修剪前的原始大小
  5000. @param size size
  5001. */
  5002. setOriginalSize(size: Size): void;
  5003. /**
  5004. !#en Returns the texture of the frame.
  5005. !#zh 获取使用的纹理实例
  5006. */
  5007. getTexture(): Texture2D;
  5008. /**
  5009. !#en Returns the offset of the frame in the texture.
  5010. !#zh 获取偏移量
  5011. */
  5012. getOffset(): Vec2;
  5013. /**
  5014. !#en Sets the offset of the frame in the texture.
  5015. !#zh 设置偏移量
  5016. @param offsets offsets
  5017. */
  5018. setOffset(offsets: Vec2): void;
  5019. /**
  5020. !#en Clone the sprite frame.
  5021. !#zh 克隆 SpriteFrame
  5022. */
  5023. clone(): SpriteFrame;
  5024. /**
  5025. !#en Set SpriteFrame with Texture, rect, rotated, offset and originalSize.<br/>
  5026. !#zh 通过 Texture,rect,rotated,offset 和 originalSize 设置 SpriteFrame。
  5027. @param textureOrTextureFile textureOrTextureFile
  5028. @param rect rect
  5029. @param rotated rotated
  5030. @param offset offset
  5031. @param originalSize originalSize
  5032. */
  5033. setTexture(textureOrTextureFile: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size): boolean;
  5034. /**
  5035. !#en If a loading scene (or prefab) is marked as `asyncLoadAssets`, all the textures of the SpriteFrame which
  5036. associated by user's custom Components in the scene, will not preload automatically.
  5037. These textures will be load when Sprite component is going to render the SpriteFrames.
  5038. You can call this method if you want to load the texture early.
  5039. !#zh 当加载中的场景或 Prefab 被标记为 `asyncLoadAssets` 时,用户在场景中由自定义组件关联到的所有 SpriteFrame 的贴图都不会被提前加载。
  5040. 只有当 Sprite 组件要渲染这些 SpriteFrame 时,才会检查贴图是否加载。如果你希望加载过程提前,你可以手工调用这个方法。
  5041. @example
  5042. ```js
  5043. if (spriteFrame.textureLoaded()) {
  5044. this._onSpriteFrameLoaded();
  5045. }
  5046. else {
  5047. spriteFrame.once('load', this._onSpriteFrameLoaded, this);
  5048. spriteFrame.ensureLoadTexture();
  5049. }
  5050. ```
  5051. */
  5052. ensureLoadTexture(): void;
  5053. /**
  5054. !#en
  5055. 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.
  5056. !#zh
  5057. 当你暂时不再使用这个 SpriteFrame 时,可以调用这个方法来保证引用的贴图对象能被 GC。然后当你要渲染 SpriteFrame 时,你需要手动调用 `ensureLoadTexture` 来重新加载贴图。
  5058. @example
  5059. ```js
  5060. spriteFrame.clearTexture();
  5061. // when you need the SpriteFrame again...
  5062. spriteFrame.once('load', onSpriteFrameLoaded);
  5063. spriteFrame.ensureLoadTexture();
  5064. ```
  5065. */
  5066. clearTexture(): void;
  5067. /**
  5068. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5069. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5070. @param type The type of event.
  5071. */
  5072. hasEventListener(type: string): boolean;
  5073. /**
  5074. !#en
  5075. Register an callback of a specific event type on the EventTarget.
  5076. This type of event should be triggered via `emit`.
  5077. !#zh
  5078. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5079. @param type A string representing the event type to listen for.
  5080. @param callback The callback that will be invoked when the event is dispatched.
  5081. The callback is ignored if it is a duplicate (the callbacks are unique).
  5082. @param target The target (this object) to invoke the callback, can be null
  5083. @example
  5084. ```js
  5085. eventTarget.on('fire', function () {
  5086. cc.log("fire in the hole");
  5087. }, node);
  5088. ```
  5089. */
  5090. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5091. /**
  5092. !#en
  5093. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5094. if only type is passed as parameter, all listeners registered with that type will be removed.
  5095. !#zh
  5096. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5097. @param type A string representing the event type being removed.
  5098. @param callback The callback to remove.
  5099. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5100. @example
  5101. ```js
  5102. // register fire eventListener
  5103. var callback = eventTarget.on('fire', function () {
  5104. cc.log("fire in the hole");
  5105. }, target);
  5106. // remove fire event listener
  5107. eventTarget.off('fire', callback, target);
  5108. // remove all fire event listeners
  5109. eventTarget.off('fire');
  5110. ```
  5111. */
  5112. off(type: string, callback?: Function, target?: any): void;
  5113. /**
  5114. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5115. This is not for removing all listeners in the current event target,
  5116. and this is not for removing all listeners the target parameter have registered.
  5117. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5118. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5119. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5120. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5121. @param target The target to be searched for all related listeners
  5122. */
  5123. targetOff(target: any): void;
  5124. /**
  5125. !#en
  5126. Register an callback of a specific event type on the EventTarget,
  5127. the callback will remove itself after the first time it is triggered.
  5128. !#zh
  5129. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5130. @param type A string representing the event type to listen for.
  5131. @param callback The callback that will be invoked when the event is dispatched.
  5132. The callback is ignored if it is a duplicate (the callbacks are unique).
  5133. @param target The target (this object) to invoke the callback, can be null
  5134. @example
  5135. ```js
  5136. eventTarget.once('fire', function () {
  5137. cc.log("this is the callback and will be invoked only once");
  5138. }, node);
  5139. ```
  5140. */
  5141. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5142. /**
  5143. !#en
  5144. Trigger an event directly with the event name and necessary arguments.
  5145. !#zh
  5146. 通过事件名发送自定义事件
  5147. @param type event type
  5148. @param arg1 First argument
  5149. @param arg2 Second argument
  5150. @param arg3 Third argument
  5151. @param arg4 Fourth argument
  5152. @param arg5 Fifth argument
  5153. @example
  5154. ```js
  5155. eventTarget.emit('fire', event);
  5156. eventTarget.emit('fire', message, emitter);
  5157. ```
  5158. */
  5159. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5160. /**
  5161. !#en
  5162. Send an event with the event object.
  5163. !#zh
  5164. 通过事件对象派发事件
  5165. @param event event
  5166. */
  5167. dispatchEvent(event: Event): void;
  5168. }
  5169. /** !#en Class for TTFFont handling.
  5170. !#zh TTF 字体资源类。 */
  5171. export class TTFFont extends Font {
  5172. }
  5173. /** !#en Class for text file.
  5174. !#zh 文本资源类。 */
  5175. export class TextAsset extends Asset {
  5176. /** The text contents of the resource. */
  5177. text: string;
  5178. }
  5179. /** This class allows to easily create OpenGL or Canvas 2D textures from images or raw data. */
  5180. export class Texture2D extends Asset implements EventTarget {
  5181. /** !#en
  5182. The url of the texture, this could be empty if the texture wasn't created via a file.
  5183. !#zh
  5184. 贴图文件的 url,当贴图不是由文件创建时值可能为空 */
  5185. url: string;
  5186. /** !#en
  5187. Whether the texture is loaded or not
  5188. !#zh
  5189. 贴图是否已经成功加载 */
  5190. loaded: boolean;
  5191. /** !#en
  5192. Texture width in pixel
  5193. !#zh
  5194. 贴图像素宽度 */
  5195. width: number;
  5196. /** !#en
  5197. Texture height in pixel
  5198. !#zh
  5199. 贴图像素高度 */
  5200. height: number;
  5201. /**
  5202. !#en
  5203. Get renderer texture implementation object
  5204. extended from renderEngine.TextureAsset
  5205. !#zh 返回渲染器内部贴图对象
  5206. */
  5207. getImpl(): void;
  5208. /**
  5209. Update texture options, not available in Canvas render mode.
  5210. image, format, premultiplyAlpha can not be updated in native.
  5211. @param options options
  5212. */
  5213. update(options: {image: DOMImageElement; mipmap: boolean; format: PixelFormat; minFilter: Filter; magFilter: Filter; wrapS: WrapMode; wrapT: WrapMode; premultiplyAlpha: boolean; }): void;
  5214. /**
  5215. !#en
  5216. Init with HTML element.
  5217. !#zh 用 HTML Image 或 Canvas 对象初始化贴图。
  5218. @param element element
  5219. @example
  5220. ```js
  5221. var img = new Image();
  5222. img.src = dataURL;
  5223. texture.initWithElement(img);
  5224. ```
  5225. */
  5226. initWithElement(element: HTMLImageElement|HTMLCanvasElement): void;
  5227. /**
  5228. !#en
  5229. Intializes with a texture2d with data in Uint8Array.
  5230. !#zh 使用一个存储在 Unit8Array 中的图像数据(raw data)初始化数据。
  5231. @param data data
  5232. @param pixelFormat pixelFormat
  5233. @param pixelsWidth pixelsWidth
  5234. @param pixelsHeight pixelsHeight
  5235. */
  5236. initWithData(data: TypedArray, pixelFormat: number, pixelsWidth: number, pixelsHeight: number): boolean;
  5237. /**
  5238. !#en
  5239. HTMLElement Object getter, available only on web.
  5240. !#zh 获取当前贴图对应的 HTML Image 或 Canvas 对象,只在 Web 平台下有效。
  5241. */
  5242. getHtmlElementObj(): HTMLImageElement;
  5243. /**
  5244. !#en
  5245. Destory this texture and immediately release its video memory. (Inherit from cc.Object.destroy)<br>
  5246. After destroy, this object is not usable any more.
  5247. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  5248. !#zh
  5249. 销毁该贴图,并立即释放它对应的显存。(继承自 cc.Object.destroy)<br/>
  5250. 销毁后,该对象不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  5251. */
  5252. destroy(): boolean;
  5253. /**
  5254. !#en
  5255. Pixel format of the texture.
  5256. !#zh 获取纹理的像素格式。
  5257. */
  5258. getPixelFormat(): number;
  5259. /**
  5260. !#en
  5261. Whether or not the texture has their Alpha premultiplied.
  5262. !#zh 检查纹理在上传 GPU 时预乘选项是否开启。
  5263. */
  5264. hasPremultipliedAlpha(): boolean;
  5265. /**
  5266. !#en
  5267. Whether or not use mipmap.
  5268. !#zh 检查问题在上传 GPU 时是否生成 mipmap。
  5269. */
  5270. hasMipmap(): boolean;
  5271. /**
  5272. !#en
  5273. Handler of texture loaded event.
  5274. Since v2.0, you don't need to invoke this function, it will be invoked automatically after texture loaded.
  5275. !#zh 贴图加载事件处理器。v2.0 之后你将不在需要手动执行这个函数,它会在贴图加载成功之后自动执行。
  5276. @param premultiplied premultiplied
  5277. */
  5278. handleLoadedTexture(premultiplied?: boolean): void;
  5279. /**
  5280. !#en
  5281. Description of cc.Texture2D.
  5282. !#zh cc.Texture2D 描述。
  5283. */
  5284. description(): string;
  5285. /**
  5286. !#en
  5287. Release texture, please use destroy instead.
  5288. !#zh 释放纹理,请使用 destroy 替代。
  5289. */
  5290. releaseTexture(): void;
  5291. /**
  5292. !#en Sets the wrap s and wrap t options. <br/>
  5293. 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}.
  5294. !#zh 设置纹理包装模式。
  5295. 若纹理贴图尺寸是 NPOT(non power of 2),则只能使用 Texture2D.WrapMode.CLAMP_TO_EDGE。
  5296. @param wrapS wrapS
  5297. @param wrapT wrapT
  5298. */
  5299. setTexParameters(wrapS: Texture2D.WrapMode, wrapT: Texture2D.WrapMode): void;
  5300. /**
  5301. !#en Sets the minFilter and magFilter options
  5302. !#zh 设置纹理贴图缩小和放大过滤器算法选项。
  5303. @param minFilter minFilter
  5304. @param magFilter magFilter
  5305. */
  5306. setFilters(minFilter: Texture2D.Filter, magFilter: Texture2D.Filter): void;
  5307. /**
  5308. !#en
  5309. Sets the flipY options
  5310. !#zh 设置贴图的纵向翻转选项。
  5311. @param flipY flipY
  5312. */
  5313. setFlipY(flipY: boolean): void;
  5314. /**
  5315. !#en
  5316. Sets the premultiply alpha options
  5317. !#zh 设置贴图的预乘选项。
  5318. @param premultiply premultiply
  5319. */
  5320. setPremultiplyAlpha(premultiply: boolean): void;
  5321. /**
  5322. !#en
  5323. Sets whether generate mipmaps for the texture
  5324. !#zh 是否为纹理设置生成 mipmaps。
  5325. @param mipmap mipmap
  5326. */
  5327. setMipmap(mipmap: boolean): void;
  5328. /**
  5329. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5330. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5331. @param type The type of event.
  5332. */
  5333. hasEventListener(type: string): boolean;
  5334. /**
  5335. !#en
  5336. Register an callback of a specific event type on the EventTarget.
  5337. This type of event should be triggered via `emit`.
  5338. !#zh
  5339. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5340. @param type A string representing the event type to listen for.
  5341. @param callback The callback that will be invoked when the event is dispatched.
  5342. The callback is ignored if it is a duplicate (the callbacks are unique).
  5343. @param target The target (this object) to invoke the callback, can be null
  5344. @example
  5345. ```js
  5346. eventTarget.on('fire', function () {
  5347. cc.log("fire in the hole");
  5348. }, node);
  5349. ```
  5350. */
  5351. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5352. /**
  5353. !#en
  5354. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5355. if only type is passed as parameter, all listeners registered with that type will be removed.
  5356. !#zh
  5357. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5358. @param type A string representing the event type being removed.
  5359. @param callback The callback to remove.
  5360. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5361. @example
  5362. ```js
  5363. // register fire eventListener
  5364. var callback = eventTarget.on('fire', function () {
  5365. cc.log("fire in the hole");
  5366. }, target);
  5367. // remove fire event listener
  5368. eventTarget.off('fire', callback, target);
  5369. // remove all fire event listeners
  5370. eventTarget.off('fire');
  5371. ```
  5372. */
  5373. off(type: string, callback?: Function, target?: any): void;
  5374. /**
  5375. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5376. This is not for removing all listeners in the current event target,
  5377. and this is not for removing all listeners the target parameter have registered.
  5378. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5379. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5380. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5381. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5382. @param target The target to be searched for all related listeners
  5383. */
  5384. targetOff(target: any): void;
  5385. /**
  5386. !#en
  5387. Register an callback of a specific event type on the EventTarget,
  5388. the callback will remove itself after the first time it is triggered.
  5389. !#zh
  5390. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5391. @param type A string representing the event type to listen for.
  5392. @param callback The callback that will be invoked when the event is dispatched.
  5393. The callback is ignored if it is a duplicate (the callbacks are unique).
  5394. @param target The target (this object) to invoke the callback, can be null
  5395. @example
  5396. ```js
  5397. eventTarget.once('fire', function () {
  5398. cc.log("this is the callback and will be invoked only once");
  5399. }, node);
  5400. ```
  5401. */
  5402. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5403. /**
  5404. !#en
  5405. Trigger an event directly with the event name and necessary arguments.
  5406. !#zh
  5407. 通过事件名发送自定义事件
  5408. @param type event type
  5409. @param arg1 First argument
  5410. @param arg2 Second argument
  5411. @param arg3 Third argument
  5412. @param arg4 Fourth argument
  5413. @param arg5 Fifth argument
  5414. @example
  5415. ```js
  5416. eventTarget.emit('fire', event);
  5417. eventTarget.emit('fire', message, emitter);
  5418. ```
  5419. */
  5420. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5421. /**
  5422. !#en
  5423. Send an event with the event object.
  5424. !#zh
  5425. 通过事件对象派发事件
  5426. @param event event
  5427. */
  5428. dispatchEvent(event: Event): void;
  5429. }
  5430. /** !#en Box Collider.
  5431. !#zh 包围盒碰撞组件 */
  5432. export class BoxCollider extends Collider implements Collider.Box {
  5433. /** !#en Position offset
  5434. !#zh 位置偏移量 */
  5435. offset: Vec2;
  5436. /** !#en Box size
  5437. !#zh 包围盒大小 */
  5438. size: Size;
  5439. }
  5440. /** !#en Circle Collider.
  5441. !#zh 圆形碰撞组件 */
  5442. export class CircleCollider extends Collider implements Collider.Circle {
  5443. /** !#en Position offset
  5444. !#zh 位置偏移量 */
  5445. offset: Vec2;
  5446. /** !#en Circle radius
  5447. !#zh 圆形半径 */
  5448. radius: number;
  5449. }
  5450. /** !#en Collider component base class.
  5451. !#zh 碰撞组件基类 */
  5452. export class Collider extends Component {
  5453. /** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  5454. !#zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */
  5455. tag: number;
  5456. }
  5457. /** !#en
  5458. A simple collision manager class.
  5459. It will calculate whether the collider collides other colliders, if collides then call the callbacks.
  5460. !#zh
  5461. 一个简单的碰撞组件管理类,用于处理节点之间的碰撞组件是否产生了碰撞,并调用相应回调函数。 */
  5462. export class CollisionManager implements EventTarget {
  5463. /** !#en
  5464. !#zh
  5465. 是否开启碰撞管理,默认为不开启 */
  5466. enabled: boolean;
  5467. /** !#en
  5468. !#zh
  5469. 是否绘制碰撞组件的包围盒,默认为不绘制 */
  5470. enabledDrawBoundingBox: boolean;
  5471. /** !#en
  5472. !#zh
  5473. 是否绘制碰撞组件的形状,默认为不绘制 */
  5474. enabledDebugDraw: boolean;
  5475. /**
  5476. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5477. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5478. @param type The type of event.
  5479. */
  5480. hasEventListener(type: string): boolean;
  5481. /**
  5482. !#en
  5483. Register an callback of a specific event type on the EventTarget.
  5484. This type of event should be triggered via `emit`.
  5485. !#zh
  5486. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5487. @param type A string representing the event type to listen for.
  5488. @param callback The callback that will be invoked when the event is dispatched.
  5489. The callback is ignored if it is a duplicate (the callbacks are unique).
  5490. @param target The target (this object) to invoke the callback, can be null
  5491. @example
  5492. ```js
  5493. eventTarget.on('fire', function () {
  5494. cc.log("fire in the hole");
  5495. }, node);
  5496. ```
  5497. */
  5498. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5499. /**
  5500. !#en
  5501. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5502. if only type is passed as parameter, all listeners registered with that type will be removed.
  5503. !#zh
  5504. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5505. @param type A string representing the event type being removed.
  5506. @param callback The callback to remove.
  5507. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5508. @example
  5509. ```js
  5510. // register fire eventListener
  5511. var callback = eventTarget.on('fire', function () {
  5512. cc.log("fire in the hole");
  5513. }, target);
  5514. // remove fire event listener
  5515. eventTarget.off('fire', callback, target);
  5516. // remove all fire event listeners
  5517. eventTarget.off('fire');
  5518. ```
  5519. */
  5520. off(type: string, callback?: Function, target?: any): void;
  5521. /**
  5522. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5523. This is not for removing all listeners in the current event target,
  5524. and this is not for removing all listeners the target parameter have registered.
  5525. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5526. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5527. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5528. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5529. @param target The target to be searched for all related listeners
  5530. */
  5531. targetOff(target: any): void;
  5532. /**
  5533. !#en
  5534. Register an callback of a specific event type on the EventTarget,
  5535. the callback will remove itself after the first time it is triggered.
  5536. !#zh
  5537. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5538. @param type A string representing the event type to listen for.
  5539. @param callback The callback that will be invoked when the event is dispatched.
  5540. The callback is ignored if it is a duplicate (the callbacks are unique).
  5541. @param target The target (this object) to invoke the callback, can be null
  5542. @example
  5543. ```js
  5544. eventTarget.once('fire', function () {
  5545. cc.log("this is the callback and will be invoked only once");
  5546. }, node);
  5547. ```
  5548. */
  5549. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5550. /**
  5551. !#en
  5552. Trigger an event directly with the event name and necessary arguments.
  5553. !#zh
  5554. 通过事件名发送自定义事件
  5555. @param type event type
  5556. @param arg1 First argument
  5557. @param arg2 Second argument
  5558. @param arg3 Third argument
  5559. @param arg4 Fourth argument
  5560. @param arg5 Fifth argument
  5561. @example
  5562. ```js
  5563. eventTarget.emit('fire', event);
  5564. eventTarget.emit('fire', message, emitter);
  5565. ```
  5566. */
  5567. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5568. /**
  5569. !#en
  5570. Send an event with the event object.
  5571. !#zh
  5572. 通过事件对象派发事件
  5573. @param event event
  5574. */
  5575. dispatchEvent(event: Event): void;
  5576. }
  5577. /** !#en Intersection helper class
  5578. !#zh 辅助类,用于测试形状与形状是否相交 */
  5579. export class Intersection {
  5580. /**
  5581. !#en Test line and line
  5582. !#zh 测试线段与线段是否相交
  5583. @param a1 The start point of the first line
  5584. @param a2 The end point of the first line
  5585. @param b1 The start point of the second line
  5586. @param b2 The end point of the second line
  5587. */
  5588. static lineLine(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): boolean;
  5589. /**
  5590. !#en Test line and rect
  5591. !#zh 测试线段与矩形是否相交
  5592. @param a1 The start point of the line
  5593. @param a2 The end point of the line
  5594. @param b The rect
  5595. */
  5596. static lineRect(a1: Vec2, a2: Vec2, b: Rect): boolean;
  5597. /**
  5598. !#en Test line and polygon
  5599. !#zh 测试线段与多边形是否相交
  5600. @param a1 The start point of the line
  5601. @param a2 The end point of the line
  5602. @param b The polygon, a set of points
  5603. */
  5604. static linePolygon(a1: Vec2, a2: Vec2, b: Vec2[]): boolean;
  5605. /**
  5606. !#en Test rect and rect
  5607. !#zh 测试矩形与矩形是否相交
  5608. @param a The first rect
  5609. @param b The second rect
  5610. */
  5611. static rectRect(a: Rect, b: Rect): boolean;
  5612. /**
  5613. !#en Test rect and polygon
  5614. !#zh 测试矩形与多边形是否相交
  5615. @param a The rect
  5616. @param b The polygon, a set of points
  5617. */
  5618. static rectPolygon(a: Rect, b: Vec2[]): boolean;
  5619. /**
  5620. !#en Test polygon and polygon
  5621. !#zh 测试多边形与多边形是否相交
  5622. @param a The first polygon, a set of points
  5623. @param b The second polygon, a set of points
  5624. */
  5625. static polygonPolygon(a: Vec2[], b: Vec2[]): boolean;
  5626. /**
  5627. !#en Test circle and circle
  5628. !#zh 测试圆形与圆形是否相交
  5629. @param a Object contains position and radius
  5630. @param b Object contains position and radius
  5631. */
  5632. static circleCircle(a: {position: Vec2, radius: number}, b: {position: Vec2, radius: number}): boolean;
  5633. /**
  5634. !#en Test polygon and circle
  5635. !#zh 测试矩形与圆形是否相交
  5636. @param polygon The Polygon, a set of points
  5637. @param circle Object contains position and radius
  5638. */
  5639. static polygonCircle(polygon: Vec2[], circle: {position: Vec2, radius: number}): boolean;
  5640. /**
  5641. !#en Test whether the point is in the polygon
  5642. !#zh 测试一个点是否在一个多边形中
  5643. @param point The point
  5644. @param polygon The polygon, a set of points
  5645. */
  5646. static pointInPolygon(point: Vec2, polygon: Vec2[]): boolean;
  5647. /**
  5648. !#en Calculate the distance of point to line.
  5649. !#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  5650. @param point The point
  5651. @param start The start point of line
  5652. @param end The end point of line
  5653. @param isSegment whether this line is a segment
  5654. */
  5655. static pointLineDistance(point: Vec2, start: Vec2, end: Vec2, isSegment: boolean): boolean;
  5656. }
  5657. /** !#en Polygon Collider.
  5658. !#zh 多边形碰撞组件 */
  5659. export class PolygonCollider extends Collider implements Collider.Polygon {
  5660. /** !#en Position offset
  5661. !#zh 位置偏移量 */
  5662. offset: Vec2;
  5663. /** !#en Polygon points
  5664. !#zh 多边形顶点数组 */
  5665. points: Vec2[];
  5666. }
  5667. /** !#en
  5668. Camera is usefull when making reel game or other games which need scroll screen.
  5669. Using camera will be more efficient than moving node to scroll screen.
  5670. Camera
  5671. !#zh
  5672. 摄像机在制作卷轴或是其他需要移动屏幕的游戏时比较有用,使用摄像机将会比移动节点来移动屏幕更加高效。 */
  5673. export class Camera extends Component {
  5674. /** !#en
  5675. The camera zoom ratio.
  5676. !#zh
  5677. 摄像机缩放比率 */
  5678. zoomRatio: number;
  5679. /** !#en
  5680. This is used to render parts of the scene selectively.
  5681. !#zh
  5682. 决定摄像机会渲染场景的哪一部分。 */
  5683. cullingMask: number;
  5684. /** !#en
  5685. Determining what to clear when camera rendering.
  5686. !#zh
  5687. 决定摄像机渲染时会清除哪些状态。 */
  5688. clearFlags: Camera.ClearFlags;
  5689. /** !#en
  5690. The color with which the screen will be cleared.
  5691. !#zh
  5692. 摄像机用于清除屏幕的背景色。 */
  5693. backgroundColor: Color;
  5694. /** !#en
  5695. Camera's depth in the camera rendering order.
  5696. !#zh
  5697. 摄像机深度,用于决定摄像机的渲染顺序。 */
  5698. depth: number;
  5699. /** !#en
  5700. Destination render texture.
  5701. Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture.
  5702. !#zh
  5703. 摄像机渲染的目标 RenderTexture。
  5704. 一般摄像机会直接渲染到屏幕上,但是有一些效果可以使用摄像机渲染到 RenderTexture 上再对 RenderTexture 进行处理来实现。 */
  5705. targetTexture: RenderTexture;
  5706. /** !#en
  5707. The first enabled camera.
  5708. !#zh
  5709. 第一个被激活的摄像机。 */
  5710. static main: Camera;
  5711. /** !#en
  5712. All enabled cameras.
  5713. !#zh
  5714. 激活的所有摄像机。 */
  5715. static cameras: [Camera];
  5716. /**
  5717. !#en
  5718. Get the first camera which the node belong to.
  5719. !#zh
  5720. 获取节点所在的第一个摄像机。
  5721. @param node node
  5722. */
  5723. static findCamera(node: Node): Camera;
  5724. /**
  5725. !#en
  5726. Returns the matrix that transform the node's (local) space coordinates into the camera's space coordinates.
  5727. !#zh
  5728. 返回一个将节点坐标系转换到摄像机坐标系下的矩阵
  5729. @param node the node which should transform
  5730. */
  5731. getNodeToCameraTransform(node: Node): AffineTransform;
  5732. /**
  5733. !#en
  5734. Conver a camera coordinates point to world coordinates.
  5735. !#zh
  5736. 将一个摄像机坐标系下的点转换到世界坐标系下。
  5737. @param point the point which should transform
  5738. @param out the point to receive the result
  5739. */
  5740. getCameraToWorldPoint(point: Vec2, out: Vec2): Vec2;
  5741. /**
  5742. !#en
  5743. Conver a world coordinates point to camera coordinates.
  5744. !#zh
  5745. 将一个世界坐标系下的点转换到摄像机坐标系下。
  5746. @param point point
  5747. @param out the point to receive the result
  5748. */
  5749. getWorldToCameraPoint(point: Vec2, out: Vec2): Vec2;
  5750. /**
  5751. !#en
  5752. Get the camera to world matrix
  5753. !#zh
  5754. 获取摄像机坐标系到世界坐标系的矩阵
  5755. @param out the matrix to receive the result
  5756. */
  5757. getCameraToWorldMatrix(out: Mat4): Mat4;
  5758. /**
  5759. !#en
  5760. Get the world to camera matrix
  5761. !#zh
  5762. 获取世界坐标系到摄像机坐标系的矩阵
  5763. @param out the matrix to receive the result
  5764. */
  5765. getWorldToCameraMatrix(out: Mat4): Mat4;
  5766. /**
  5767. !#en
  5768. Check whether the node is in the camera.
  5769. !#zh
  5770. 检测节点是否被此摄像机影响
  5771. @param node the node which need to check
  5772. */
  5773. containsNode(node: Node): boolean;
  5774. /**
  5775. !#en
  5776. Render the camera manually.
  5777. !#zh
  5778. 手动渲染摄像机。
  5779. @param root root
  5780. */
  5781. render(root: Node): void;
  5782. }
  5783. /** !#en
  5784. EventTarget is an object to which an event is dispatched when something has occurred.
  5785. Entity are the most common event targets, but other objects can be event targets too.
  5786. Event targets are an important part of the Fireball event model.
  5787. The event target serves as the focal point for how events flow through the scene graph.
  5788. When an event such as a mouse click or a keypress occurs, Fireball dispatches an event object
  5789. into the event flow from the root of the hierarchy. The event object then makes its way through
  5790. the scene graph until it reaches the event target, at which point it begins its return trip through
  5791. the scene graph. This round-trip journey to the event target is conceptually divided into three phases:
  5792. - The capture phase comprises the journey from the root to the last node before the event target's node
  5793. - The target phase comprises only the event target node
  5794. - The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree
  5795. See also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5796. Event targets can implement the following methods:
  5797. - _getCapturingTargets
  5798. - _getBubblingTargets
  5799. !#zh
  5800. 事件目标是事件触发时,分派的事件对象,Node 是最常见的事件目标,
  5801. 但是其他对象也可以是事件目标。<br/> */
  5802. export class EventTarget {
  5803. /**
  5804. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5805. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5806. @param type The type of event.
  5807. */
  5808. hasEventListener(type: string): boolean;
  5809. /**
  5810. !#en
  5811. Register an callback of a specific event type on the EventTarget.
  5812. This type of event should be triggered via `emit`.
  5813. !#zh
  5814. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5815. @param type A string representing the event type to listen for.
  5816. @param callback The callback that will be invoked when the event is dispatched.
  5817. The callback is ignored if it is a duplicate (the callbacks are unique).
  5818. @param target The target (this object) to invoke the callback, can be null
  5819. @example
  5820. ```js
  5821. eventTarget.on('fire', function () {
  5822. cc.log("fire in the hole");
  5823. }, node);
  5824. ```
  5825. */
  5826. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5827. /**
  5828. !#en
  5829. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5830. if only type is passed as parameter, all listeners registered with that type will be removed.
  5831. !#zh
  5832. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5833. @param type A string representing the event type being removed.
  5834. @param callback The callback to remove.
  5835. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5836. @example
  5837. ```js
  5838. // register fire eventListener
  5839. var callback = eventTarget.on('fire', function () {
  5840. cc.log("fire in the hole");
  5841. }, target);
  5842. // remove fire event listener
  5843. eventTarget.off('fire', callback, target);
  5844. // remove all fire event listeners
  5845. eventTarget.off('fire');
  5846. ```
  5847. */
  5848. off(type: string, callback?: Function, target?: any): void;
  5849. /**
  5850. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5851. This is not for removing all listeners in the current event target,
  5852. and this is not for removing all listeners the target parameter have registered.
  5853. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5854. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5855. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5856. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5857. @param target The target to be searched for all related listeners
  5858. */
  5859. targetOff(target: any): void;
  5860. /**
  5861. !#en
  5862. Register an callback of a specific event type on the EventTarget,
  5863. the callback will remove itself after the first time it is triggered.
  5864. !#zh
  5865. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5866. @param type A string representing the event type to listen for.
  5867. @param callback The callback that will be invoked when the event is dispatched.
  5868. The callback is ignored if it is a duplicate (the callbacks are unique).
  5869. @param target The target (this object) to invoke the callback, can be null
  5870. @example
  5871. ```js
  5872. eventTarget.once('fire', function () {
  5873. cc.log("this is the callback and will be invoked only once");
  5874. }, node);
  5875. ```
  5876. */
  5877. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5878. /**
  5879. !#en
  5880. Trigger an event directly with the event name and necessary arguments.
  5881. !#zh
  5882. 通过事件名发送自定义事件
  5883. @param type event type
  5884. @param arg1 First argument
  5885. @param arg2 Second argument
  5886. @param arg3 Third argument
  5887. @param arg4 Fourth argument
  5888. @param arg5 Fifth argument
  5889. @example
  5890. ```js
  5891. eventTarget.emit('fire', event);
  5892. eventTarget.emit('fire', message, emitter);
  5893. ```
  5894. */
  5895. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5896. /**
  5897. !#en
  5898. Send an event with the event object.
  5899. !#zh
  5900. 通过事件对象派发事件
  5901. @param event event
  5902. */
  5903. dispatchEvent(event: Event): void;
  5904. }
  5905. /** !#en Base class of all kinds of events.
  5906. !#zh 包含事件相关信息的对象。 */
  5907. export class Event {
  5908. /**
  5909. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  5910. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  5911. */
  5912. constructor(type: string, bubbles: boolean);
  5913. /** !#en The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  5914. !#zh 事件类型。 */
  5915. type: string;
  5916. /** !#en Indicate whether the event bubbles up through the tree or not.
  5917. !#zh 表示该事件是否进行冒泡。 */
  5918. bubbles: boolean;
  5919. /** !#en A reference to the target to which the event was originally dispatched.
  5920. !#zh 最初事件触发的目标 */
  5921. target: any;
  5922. /** !#en A reference to the currently registered target for the event.
  5923. !#zh 当前目标 */
  5924. currentTarget: any;
  5925. /** !#en
  5926. Indicates which phase of the event flow is currently being evaluated.
  5927. Returns an integer value represented by 4 constants:
  5928. - Event.NONE = 0
  5929. - Event.CAPTURING_PHASE = 1
  5930. - Event.AT_TARGET = 2
  5931. - Event.BUBBLING_PHASE = 3
  5932. The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  5933. (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  5934. !#zh 事件阶段 */
  5935. eventPhase: number;
  5936. /**
  5937. !#en Reset the event for being stored in the object pool.
  5938. !#zh 重置对象池中存储的事件。
  5939. */
  5940. unuse(): string;
  5941. /**
  5942. !#en Reuse the event for being used again by the object pool.
  5943. !#zh 用于对象池再次使用的事件。
  5944. */
  5945. reuse(): string;
  5946. /**
  5947. !#en Stops propagation for current event.
  5948. !#zh 停止传递当前事件。
  5949. */
  5950. stopPropagation(): void;
  5951. /**
  5952. !#en Stops propagation for current event immediately,
  5953. the event won't even be dispatched to the listeners attached in the current target.
  5954. !#zh 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  5955. */
  5956. stopPropagationImmediate(): void;
  5957. /**
  5958. !#en Checks whether the event has been stopped.
  5959. !#zh 检查该事件是否已经停止传递.
  5960. */
  5961. isStopped(): boolean;
  5962. /**
  5963. !#en
  5964. <p>
  5965. Gets current target of the event <br/>
  5966. note: It only be available when the event listener is associated with node. <br/>
  5967. It returns 0 when the listener is associated with fixed priority.
  5968. </p>
  5969. !#zh 获取当前目标节点
  5970. */
  5971. getCurrentTarget(): Node;
  5972. /**
  5973. !#en Gets the event type.
  5974. !#zh 获取事件类型
  5975. */
  5976. getType(): string;
  5977. /** !#en Code for event without type.
  5978. !#zh 没有类型的事件 */
  5979. static NO_TYPE: string;
  5980. /** !#en The type code of Touch event.
  5981. !#zh 触摸事件类型 */
  5982. static TOUCH: string;
  5983. /** !#en The type code of Mouse event.
  5984. !#zh 鼠标事件类型 */
  5985. static MOUSE: string;
  5986. /** !#en The type code of Keyboard event.
  5987. !#zh 键盘事件类型 */
  5988. static KEYBOARD: string;
  5989. /** !#en The type code of Acceleration event.
  5990. !#zh 加速器事件类型 */
  5991. static ACCELERATION: string;
  5992. /** !#en Events not currently dispatched are in this phase
  5993. !#zh 尚未派发事件阶段 */
  5994. static NONE: number;
  5995. /** !#en
  5996. The capturing phase comprises the journey from the root to the last node before the event target's node
  5997. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5998. !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 */
  5999. static CAPTURING_PHASE: number;
  6000. /** !#en
  6001. The target phase comprises only the event target node
  6002. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  6003. !#zh 目标阶段仅包括事件目标节点。 */
  6004. static AT_TARGET: number;
  6005. /** !#en
  6006. The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  6007. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  6008. !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 */
  6009. static BUBBLING_PHASE: number;
  6010. }
  6011. /** !#en
  6012. The System event, it currently supports keyboard events and accelerometer events.<br>
  6013. You can get the SystemEvent instance with cc.systemEvent.<br>
  6014. example:
  6015. ```
  6016. cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  6017. cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  6018. ```
  6019. !#zh
  6020. 系统事件,它目前支持按键事件和重力感应事件。<br>
  6021. 你可以通过 cc.systemEvent 获取到 SystemEvent 的实例。<br>
  6022. 参考示例:
  6023. ```
  6024. cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  6025. cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  6026. ``` */
  6027. export class SystemEvent extends EventTarget {
  6028. /**
  6029. !#en whether enable accelerometer event
  6030. !#zh 是否启用加速度计事件
  6031. @param isEnable isEnable
  6032. */
  6033. setAccelerometerEnabled(isEnable: boolean): void;
  6034. /**
  6035. !#en set accelerometer interval value
  6036. !#zh 设置加速度计间隔值
  6037. @param interval interval
  6038. */
  6039. setAccelerometerInterval(interval: number): void;
  6040. }
  6041. /** !#en The touch event class
  6042. !#zh 封装了触摸相关的信息。 */
  6043. export class Touch {
  6044. /**
  6045. !#en Returns the current touch location in OpenGL coordinates.、
  6046. !#zh 获取当前触点位置。
  6047. */
  6048. getLocation(): Vec2;
  6049. /**
  6050. !#en Returns X axis location value.
  6051. !#zh 获取当前触点 X 轴位置。
  6052. */
  6053. getLocationX(): number;
  6054. /**
  6055. !#en Returns Y axis location value.
  6056. !#zh 获取当前触点 Y 轴位置。
  6057. */
  6058. getLocationY(): number;
  6059. /**
  6060. !#en Returns the previous touch location in OpenGL coordinates.
  6061. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  6062. */
  6063. getPreviousLocation(): Vec2;
  6064. /**
  6065. !#en Returns the start touch location in OpenGL coordinates.
  6066. !#zh 获获取触点落下时的位置对象,对象包含 x 和 y 属性。
  6067. */
  6068. getStartLocation(): Vec2;
  6069. /**
  6070. !#en Returns the delta distance from the previous touche to the current one in screen coordinates.
  6071. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  6072. */
  6073. getDelta(): Vec2;
  6074. /**
  6075. !#en Returns the current touch location in screen coordinates.
  6076. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  6077. */
  6078. getLocationInView(): Vec2;
  6079. /**
  6080. !#en Returns the previous touch location in screen coordinates.
  6081. !#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  6082. */
  6083. getPreviousLocationInView(): Vec2;
  6084. /**
  6085. !#en Returns the start touch location in screen coordinates.
  6086. !#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  6087. */
  6088. getStartLocationInView(): Vec2;
  6089. /**
  6090. !#en Returns the id of cc.Touch.
  6091. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  6092. */
  6093. getID(): number;
  6094. /**
  6095. !#en Sets information to touch.
  6096. !#zh 设置触摸相关的信息。用于监控触摸事件。
  6097. @param id id
  6098. @param x x
  6099. @param y y
  6100. */
  6101. setTouchInfo(id: number, x: number, y: number): void;
  6102. }
  6103. /** undefined */
  6104. export class Graphics extends RenderComponent {
  6105. /** !#en
  6106. Current line width.
  6107. !#zh
  6108. 当前线条宽度 */
  6109. lineWidth: number;
  6110. /** !#en
  6111. lineJoin determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  6112. !#zh
  6113. lineJoin 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。 */
  6114. lineJoin: Graphics.LineJoin;
  6115. /** !#en
  6116. lineCap determines how the end points of every line are drawn.
  6117. !#zh
  6118. lineCap 指定如何绘制每一条线段末端。 */
  6119. lineCap: Graphics.LineCap;
  6120. /** !#en
  6121. stroke color
  6122. !#zh
  6123. 线段颜色 */
  6124. strokeColor: Color;
  6125. /** !#en
  6126. fill color
  6127. !#zh
  6128. 填充颜色 */
  6129. fillColor: Color;
  6130. /** !#en
  6131. Sets the miter limit ratio
  6132. !#zh
  6133. 设置斜接面限制比例 */
  6134. miterLimit: number;
  6135. /**
  6136. !#en Move path start point to (x,y).
  6137. !#zh 移动路径起点到坐标(x, y)
  6138. @param x The x axis of the coordinate for the end point.
  6139. @param y The y axis of the coordinate for the end point.
  6140. */
  6141. moveTo(x?: number, y?: number): void;
  6142. /**
  6143. !#en Adds a straight line to the path
  6144. !#zh 绘制直线路径
  6145. @param x The x axis of the coordinate for the end point.
  6146. @param y The y axis of the coordinate for the end point.
  6147. */
  6148. lineTo(x?: number, y?: number): void;
  6149. /**
  6150. !#en Adds a cubic Bézier curve to the path
  6151. !#zh 绘制三次贝赛尔曲线路径
  6152. @param c1x The x axis of the coordinate for the first control point.
  6153. @param c1y The y axis of the coordinate for first control point.
  6154. @param c2x The x axis of the coordinate for the second control point.
  6155. @param c2y The y axis of the coordinate for the second control point.
  6156. @param x The x axis of the coordinate for the end point.
  6157. @param y The y axis of the coordinate for the end point.
  6158. */
  6159. bezierCurveTo(c1x?: number, c1y?: number, c2x?: number, c2y?: number, x?: number, y?: number): void;
  6160. /**
  6161. !#en Adds a quadratic Bézier curve to the path
  6162. !#zh 绘制二次贝赛尔曲线路径
  6163. @param cx The x axis of the coordinate for the control point.
  6164. @param cy The y axis of the coordinate for the control point.
  6165. @param x The x axis of the coordinate for the end point.
  6166. @param y The y axis of the coordinate for the end point.
  6167. */
  6168. quadraticCurveTo(cx?: number, cy?: number, x?: number, y?: number): void;
  6169. /**
  6170. !#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).
  6171. !#zh 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  6172. @param cx The x axis of the coordinate for the center point.
  6173. @param cy The y axis of the coordinate for the center point.
  6174. @param r The arc's radius.
  6175. @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  6176. @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  6177. @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.
  6178. */
  6179. arc(cx?: number, cy?: number, r?: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
  6180. /**
  6181. !#en Adds an ellipse to the path.
  6182. !#zh 绘制椭圆路径。
  6183. @param cx The x axis of the coordinate for the center point.
  6184. @param cy The y axis of the coordinate for the center point.
  6185. @param rx The ellipse's x-axis radius.
  6186. @param ry The ellipse's y-axis radius.
  6187. */
  6188. ellipse(cx?: number, cy?: number, rx?: number, ry?: number): void;
  6189. /**
  6190. !#en Adds an circle to the path.
  6191. !#zh 绘制圆形路径。
  6192. @param cx The x axis of the coordinate for the center point.
  6193. @param cy The y axis of the coordinate for the center point.
  6194. @param r The circle's radius.
  6195. */
  6196. circle(cx?: number, cy?: number, r?: number): void;
  6197. /**
  6198. !#en Adds an rectangle to the path.
  6199. !#zh 绘制矩形路径。
  6200. @param x The x axis of the coordinate for the rectangle starting point.
  6201. @param y The y axis of the coordinate for the rectangle starting point.
  6202. @param w The rectangle's width.
  6203. @param h The rectangle's height.
  6204. */
  6205. rect(x?: number, y?: number, w?: number, h?: number): void;
  6206. /**
  6207. !#en Adds an round corner rectangle to the path.
  6208. !#zh 绘制圆角矩形路径。
  6209. @param x The x axis of the coordinate for the rectangle starting point.
  6210. @param y The y axis of the coordinate for the rectangle starting point.
  6211. @param w The rectangles width.
  6212. @param h The rectangle's height.
  6213. @param r The radius of the rectangle.
  6214. */
  6215. roundRect(x?: number, y?: number, w?: number, h?: number, r?: number): void;
  6216. /**
  6217. !#en Draws a filled rectangle.
  6218. !#zh 绘制填充矩形。
  6219. @param x The x axis of the coordinate for the rectangle starting point.
  6220. @param y The y axis of the coordinate for the rectangle starting point.
  6221. @param w The rectangle's width.
  6222. @param h The rectangle's height.
  6223. */
  6224. fillRect(x?: number, y?: number, w?: number, h?: number): void;
  6225. /**
  6226. !#en Erasing any previously drawn content.
  6227. !#zh 擦除之前绘制的所有内容的方法。
  6228. @param clean Whether to clean the graphics inner cache.
  6229. */
  6230. clear(clean?: boolean): void;
  6231. /**
  6232. !#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.
  6233. !#zh 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  6234. */
  6235. close(): void;
  6236. /**
  6237. !#en Strokes the current or given path with the current stroke style.
  6238. !#zh 根据当前的画线样式,绘制当前或已经存在的路径。
  6239. */
  6240. stroke(): void;
  6241. /**
  6242. !#en Fills the current or given path with the current fill style.
  6243. !#zh 根据当前的画线样式,填充当前或已经存在的路径。
  6244. */
  6245. fill(): void;
  6246. }
  6247. /** !#en The animation component is used to play back animations.
  6248. Animation provide several events to register:
  6249. - play : Emit when begin playing animation
  6250. - stop : Emit when stop playing animation
  6251. - pause : Emit when pause animation
  6252. - resume : Emit when resume animation
  6253. - lastframe : If animation repeat count is larger than 1, emit when animation play to the last frame
  6254. - finished : Emit when finish playing animation
  6255. !#zh Animation 组件用于播放动画。
  6256. Animation 提供了一系列可注册的事件:
  6257. - play : 开始播放时
  6258. - stop : 停止播放时
  6259. - pause : 暂停播放时
  6260. - resume : 恢复播放时
  6261. - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
  6262. - finished : 动画播放完成时 */
  6263. export class Animation extends Component implements EventTarget {
  6264. /** !#en Animation will play the default clip when start game.
  6265. !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */
  6266. defaultClip: AnimationClip;
  6267. /** !#en Current played clip.
  6268. !#zh 当前播放的动画剪辑。 */
  6269. currentClip: AnimationClip;
  6270. /** !#en Whether the animation should auto play the default clip when start game.
  6271. !#zh 是否在运行游戏后自动播放默认动画剪辑。 */
  6272. playOnLoad: boolean;
  6273. /**
  6274. !#en Get all the clips used in this animation.
  6275. !#zh 获取动画组件上的所有动画剪辑。
  6276. */
  6277. getClips(): AnimationClip[];
  6278. /**
  6279. !#en Plays an animation and stop other animations.
  6280. !#zh 播放指定的动画,并且停止当前正在播放动画。如果没有指定动画,则播放默认动画。
  6281. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  6282. @param startTime play an animation from startTime
  6283. @example
  6284. ```js
  6285. var animCtrl = this.node.getComponent(cc.Animation);
  6286. animCtrl.play("linear");
  6287. ```
  6288. */
  6289. play(name?: string, startTime?: number): AnimationState;
  6290. /**
  6291. !#en
  6292. Plays an additive animation, it will not stop other animations.
  6293. If there are other animations playing, then will play several animations at the same time.
  6294. !#zh 播放指定的动画(将不会停止当前播放的动画)。如果没有指定动画,则播放默认动画。
  6295. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  6296. @param startTime play an animation from startTime
  6297. @example
  6298. ```js
  6299. // linear_1 and linear_2 at the same time playing.
  6300. var animCtrl = this.node.getComponent(cc.Animation);
  6301. animCtrl.playAdditive("linear_1");
  6302. animCtrl.playAdditive("linear_2");
  6303. ```
  6304. */
  6305. playAdditive(name?: string, startTime?: number): AnimationState;
  6306. /**
  6307. !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>
  6308. Stopping an animation also Rewinds it to the Start.
  6309. !#zh 停止指定的动画。如果没有指定名字,则停止当前正在播放的动画。
  6310. @param name The animation to stop, if not supplied then stops all playing animations.
  6311. */
  6312. stop(name?: string): void;
  6313. /**
  6314. !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
  6315. !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
  6316. @param name The animation to pauses, if not supplied then pauses all playing animations.
  6317. */
  6318. pause(name?: string): void;
  6319. /**
  6320. !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
  6321. !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
  6322. @param name The animation to resumes, if not supplied then resumes all paused animations.
  6323. */
  6324. resume(name?: string): void;
  6325. /**
  6326. !#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.
  6327. !#zh 设置指定动画的播放时间。如果没有指定名字,则设置当前播放动画的播放时间。
  6328. @param time The time to go to
  6329. @param name Specified animation name, if not supplied then make all animations go to the time.
  6330. */
  6331. setCurrentTime(time?: number, name?: string): void;
  6332. /**
  6333. !#en Returns the animation state named name. If no animation with the specified name, the function will return null.
  6334. !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。
  6335. @param name name
  6336. */
  6337. getAnimationState(name: string): AnimationState;
  6338. /**
  6339. !#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.
  6340. !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
  6341. @param clip the clip to add
  6342. @param newName newName
  6343. */
  6344. addClip(clip: AnimationClip, newName?: string): AnimationState;
  6345. /**
  6346. !#en
  6347. Remove clip from the animation list. This will remove the clip and any animation states based on it.
  6348. If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
  6349. 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
  6350. !#zh
  6351. 从动画列表中移除指定的动画剪辑,<br/>
  6352. 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。
  6353. 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。
  6354. @param clip clip
  6355. @param force If force is true, then will always remove the clip and any animation states based on it.
  6356. */
  6357. removeClip(clip: AnimationClip, force?: boolean): void;
  6358. /**
  6359. !#en
  6360. Samples animations at the current state.<br/>
  6361. This is useful when you explicitly want to set up some animation state, and sample it once.
  6362. !#zh 对指定或当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
  6363. @param name name
  6364. */
  6365. sample(name: string): void;
  6366. /**
  6367. !#en
  6368. Register animation event callback.
  6369. The event arguments will provide the AnimationState which emit the event.
  6370. When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
  6371. !#zh
  6372. 注册动画事件回调。
  6373. 回调的事件里将会附上发送事件的 AnimationState。
  6374. 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  6375. @param type A string representing the event type to listen for.
  6376. @param callback The callback that will be invoked when the event is dispatched.
  6377. The callback is ignored if it is a duplicate (the callbacks are unique).
  6378. @param state state
  6379. @param target The target (this object) to invoke the callback, can be null
  6380. @param useCapture When set to true, the capture argument prevents callback
  6381. from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
  6382. When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
  6383. Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
  6384. @example
  6385. ```js
  6386. onPlay: function (type, state) {
  6387. // callback
  6388. }
  6389. // register event to all animation
  6390. animation.on('play', this.onPlay, this);
  6391. ```
  6392. */
  6393. on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void;
  6394. on<T>(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void;
  6395. /**
  6396. !#en
  6397. Unregister animation event callback.
  6398. !#zh
  6399. 取消注册动画事件回调。
  6400. @param type A string representing the event type being removed.
  6401. @param callback The callback to remove.
  6402. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6403. @param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.
  6404. If not specified, useCapture defaults to false. If a callback was registered twice,
  6405. one with capture and one without, each must be removed separately. Removal of a capturing callback
  6406. does not affect a non-capturing version of the same listener, and vice versa.
  6407. @example
  6408. ```js
  6409. // unregister event to all animation
  6410. animation.off('play', this.onPlay, this);
  6411. ```
  6412. */
  6413. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  6414. /**
  6415. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6416. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6417. @param type The type of event.
  6418. */
  6419. hasEventListener(type: string): boolean;
  6420. /**
  6421. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6422. This is not for removing all listeners in the current event target,
  6423. and this is not for removing all listeners the target parameter have registered.
  6424. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6425. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6426. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6427. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6428. @param target The target to be searched for all related listeners
  6429. */
  6430. targetOff(target: any): void;
  6431. /**
  6432. !#en
  6433. Register an callback of a specific event type on the EventTarget,
  6434. the callback will remove itself after the first time it is triggered.
  6435. !#zh
  6436. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6437. @param type A string representing the event type to listen for.
  6438. @param callback The callback that will be invoked when the event is dispatched.
  6439. The callback is ignored if it is a duplicate (the callbacks are unique).
  6440. @param target The target (this object) to invoke the callback, can be null
  6441. @example
  6442. ```js
  6443. eventTarget.once('fire', function () {
  6444. cc.log("this is the callback and will be invoked only once");
  6445. }, node);
  6446. ```
  6447. */
  6448. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6449. /**
  6450. !#en
  6451. Trigger an event directly with the event name and necessary arguments.
  6452. !#zh
  6453. 通过事件名发送自定义事件
  6454. @param type event type
  6455. @param arg1 First argument
  6456. @param arg2 Second argument
  6457. @param arg3 Third argument
  6458. @param arg4 Fourth argument
  6459. @param arg5 Fifth argument
  6460. @example
  6461. ```js
  6462. eventTarget.emit('fire', event);
  6463. eventTarget.emit('fire', message, emitter);
  6464. ```
  6465. */
  6466. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  6467. /**
  6468. !#en
  6469. Send an event with the event object.
  6470. !#zh
  6471. 通过事件对象派发事件
  6472. @param event event
  6473. */
  6474. dispatchEvent(event: Event): void;
  6475. }
  6476. /** !#en Audio Source.
  6477. !#zh 音频源组件,能对音频剪辑。 */
  6478. export class AudioSource extends Component {
  6479. /** !#en
  6480. Is the audio source playing (Read Only). <br/>
  6481. Note: isPlaying is not supported for Native platforms.
  6482. !#zh
  6483. 该音频剪辑是否正播放(只读)。<br/>
  6484. 注意:Native 平台暂时不支持 isPlaying。 */
  6485. isPlaying: boolean;
  6486. /** !#en The clip of the audio source to play.
  6487. !#zh 要播放的音频剪辑。 */
  6488. clip: AudioClip;
  6489. /** !#en The volume of the audio source.
  6490. !#zh 音频源的音量(0.0 ~ 1.0)。 */
  6491. volume: number;
  6492. /** !#en Is the audio source mute?
  6493. !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。 */
  6494. mute: boolean;
  6495. /** !#en Is the audio source looping?
  6496. !#zh 音频源是否循环播放? */
  6497. loop: boolean;
  6498. /** !#en If set to true, the audio source will automatically start playing on onEnable.
  6499. !#zh 如果设置为 true,音频源将在 onEnable 时自动播放。 */
  6500. playOnLoad: boolean;
  6501. /**
  6502. !#en Plays the clip.
  6503. !#zh 播放音频剪辑。
  6504. */
  6505. play(): void;
  6506. /**
  6507. !#en Stops the clip.
  6508. !#zh 停止当前音频剪辑。
  6509. */
  6510. stop(): void;
  6511. /**
  6512. !#en Pause the clip.
  6513. !#zh 暂停当前音频剪辑。
  6514. */
  6515. pause(): void;
  6516. /**
  6517. !#en Resume the clip.
  6518. !#zh 恢复播放。
  6519. */
  6520. resume(): void;
  6521. /**
  6522. !#en Rewind playing music.
  6523. !#zh 从头开始播放。
  6524. */
  6525. rewind(): void;
  6526. /**
  6527. !#en Get current time
  6528. !#zh 获取当前的播放时间
  6529. */
  6530. getCurrentTime(): number;
  6531. /**
  6532. !#en Set current time
  6533. !#zh 设置当前的播放时间
  6534. @param time time
  6535. */
  6536. setCurrentTime(time: number): number;
  6537. /**
  6538. !#en Get audio duration
  6539. !#zh 获取当前音频的长度
  6540. */
  6541. getDuration(): number;
  6542. }
  6543. /** !#en
  6544. 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>
  6545. This component does not have any API interface and can be added directly to the scene to take effect.
  6546. !#zh
  6547. 该组件将拦截所属节点 bounding box 内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  6548. 该组件没有任何 API 接口,直接添加到场景即可生效。 */
  6549. export class BlockInputEvents extends Component {
  6550. }
  6551. /** !#en
  6552. Button has 4 Transition types<br/>
  6553. When Button state changed:<br/>
  6554. If Transition type is Button.Transition.NONE, Button will do nothing<br/>
  6555. If Transition type is Button.Transition.COLOR, Button will change target's color<br/>
  6556. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite<br/>
  6557. If Transition type is Button.Transition.SCALE, Button will change target node's scale<br/>
  6558. Button will trigger 5 events:<br/>
  6559. Button.EVENT_TOUCH_DOWN<br/>
  6560. Button.EVENT_TOUCH_UP<br/>
  6561. Button.EVENT_HOVER_IN<br/>
  6562. Button.EVENT_HOVER_MOVE<br/>
  6563. Button.EVENT_HOVER_OUT<br/>
  6564. 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.
  6565. !#zh
  6566. 按钮组件。可以被按下,或者点击。<br/>
  6567. 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:<br/>
  6568. -Button.Transition.NONE // 不做任何过渡<br/>
  6569. -Button.Transition.COLOR // 进行颜色之间过渡<br/>
  6570. -Button.Transition.SPRITE // 进行精灵之间过渡<br/>
  6571. -Button.Transition.SCALE // 进行缩放过渡<br/>
  6572. 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):<br/>
  6573. // 以下事件可以在全平台上都触发<br/>
  6574. -cc.Node.EventType.TOUCH_START // 按下时事件<br/>
  6575. -cc.Node.EventType.TOUCH_Move // 按住移动后事件<br/>
  6576. -cc.Node.EventType.TOUCH_END // 按下后松开后事件<br/>
  6577. -cc.Node.EventType.TOUCH_CANCEL // 按下取消事件<br/>
  6578. // 以下事件只在 PC 平台上触发<br/>
  6579. -cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件<br/>
  6580. -cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件<br/>
  6581. -cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件<br/>
  6582. -cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件<br/>
  6583. -cc.Node.EventType.MOUSE_UP // 鼠标松开事件<br/>
  6584. -cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件<br/>
  6585. 用户可以通过获取 __点击事件__ 回调函数的参数 event 的 target 属性获取当前点击对象。 */
  6586. export class Button extends Component {
  6587. /** !#en
  6588. Whether the Button is disabled.
  6589. If true, the Button will trigger event and do transition.
  6590. !#zh
  6591. 按钮事件是否被响应,如果为 false,则按钮将被禁用。 */
  6592. interactable: boolean;
  6593. /** !#en When this flag is true, Button target sprite will turn gray when interactable is false.
  6594. !#zh 如果这个标记为 true,当 button 的 interactable 属性为 false 的时候,会使用内置 shader 让 button 的 target 节点的 sprite 组件变灰 */
  6595. enableAutoGrayEffect: boolean;
  6596. /** !#en Transition type
  6597. !#zh 按钮状态改变时过渡方式。 */
  6598. transition: Button.Transition;
  6599. /** !#en Normal state color.
  6600. !#zh 普通状态下按钮所显示的颜色。 */
  6601. normalColor: Color;
  6602. /** !#en Pressed state color
  6603. !#zh 按下状态时按钮所显示的颜色。 */
  6604. pressedColor: Color;
  6605. /** !#en Hover state color
  6606. !#zh 悬停状态下按钮所显示的颜色。 */
  6607. hoverColor: Color;
  6608. /** !#en Disabled state color
  6609. !#zh 禁用状态下按钮所显示的颜色。 */
  6610. disabledColor: Color;
  6611. /** !#en Color and Scale transition duration
  6612. !#zh 颜色过渡和缩放过渡时所需时间 */
  6613. duration: number;
  6614. /** !#en When user press the button, the button will zoom to a scale.
  6615. The final scale of the button equals (button original scale * zoomScale)
  6616. !#zh 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale */
  6617. zoomScale: number;
  6618. /** !#en Normal state sprite
  6619. !#zh 普通状态下按钮所显示的 Sprite 。 */
  6620. normalSprite: SpriteFrame;
  6621. /** !#en Pressed state sprite
  6622. !#zh 按下状态时按钮所显示的 Sprite 。 */
  6623. pressedSprite: SpriteFrame;
  6624. /** !#en Hover state sprite
  6625. !#zh 悬停状态下按钮所显示的 Sprite 。 */
  6626. hoverSprite: SpriteFrame;
  6627. /** !#en Disabled state sprite
  6628. !#zh 禁用状态下按钮所显示的 Sprite 。 */
  6629. disabledSprite: SpriteFrame;
  6630. /** !#en
  6631. Transition target.
  6632. When Button state changed:
  6633. If Transition type is Button.Transition.NONE, Button will do nothing
  6634. If Transition type is Button.Transition.COLOR, Button will change target's color
  6635. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
  6636. !#zh
  6637. 需要过渡的目标。
  6638. 当前按钮状态改变规则:
  6639. -如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
  6640. -如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
  6641. -如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */
  6642. target: Node;
  6643. /** !#en If Button is clicked, it will trigger event's handler
  6644. !#zh 按钮的点击事件列表。 */
  6645. clickEvents: Component.EventHandler[];
  6646. }
  6647. /** !#zh: 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。
  6648. 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 */
  6649. export class Canvas extends Component {
  6650. /** !#en Current active canvas, the scene should only have one active canvas at the same time.
  6651. !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。 */
  6652. static instance: Canvas;
  6653. /** !#en The desigin resolution for current scene.
  6654. !#zh 当前场景设计分辨率。 */
  6655. designResolution: Size;
  6656. /** !#en TODO
  6657. !#zh: 是否优先将设计分辨率高度撑满视图高度。 */
  6658. fitHeight: boolean;
  6659. /** !#en TODO
  6660. !#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */
  6661. fitWidth: boolean;
  6662. }
  6663. /** !#en
  6664. Base class for everything attached to Node(Entity).<br/>
  6665. <br/>
  6666. NOTE: Not allowed to use construction parameters for Component's subclasses,
  6667. because Component is created by the engine.
  6668. !#zh
  6669. 所有附加到节点的基类。<br/>
  6670. <br/>
  6671. 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。 */
  6672. export class Component extends Object {
  6673. /** !#en The node this component is attached to. A component is always attached to a node.
  6674. !#zh 该组件被附加到的节点。组件总会附加到一个节点。 */
  6675. node: Node;
  6676. /** !#en The uuid for editor.
  6677. !#zh 组件的 uuid,用于编辑器。 */
  6678. uuid: string;
  6679. /** !#en indicates whether this component is enabled or not.
  6680. !#zh 表示该组件自身是否启用。 */
  6681. enabled: boolean;
  6682. /** !#en indicates whether this component is enabled and its node is also active in the hierarchy.
  6683. !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。 */
  6684. enabledInHierarchy: boolean;
  6685. /** !#en Returns a value which used to indicate the onLoad get called or not.
  6686. !#zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。 */
  6687. _isOnLoadCalled: number;
  6688. /**
  6689. !#en Update is called every frame, if the Component is enabled.<br/>
  6690. 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.
  6691. !#zh 如果该组件启用,则每帧调用 update。<br/>
  6692. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6693. @param dt the delta time in seconds it took to complete the last frame
  6694. */
  6695. protected update(dt: number): void;
  6696. /**
  6697. !#en LateUpdate is called every frame, if the Component is enabled.<br/>
  6698. 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.
  6699. !#zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  6700. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6701. */
  6702. protected lateUpdate(): void;
  6703. /**
  6704. !#en
  6705. When attaching to an active node or its node first activated.
  6706. onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  6707. 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.
  6708. !#zh
  6709. 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  6710. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6711. */
  6712. protected onLoad(): void;
  6713. /**
  6714. !#en
  6715. Called before all scripts' update if the Component is enabled the first time.
  6716. Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  6717. 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.
  6718. !#zh
  6719. 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  6720. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6721. */
  6722. protected start(): void;
  6723. /**
  6724. !#en Called when this component becomes enabled and its node is active.<br/>
  6725. 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.
  6726. !#zh 当该组件被启用,并且它的节点也激活时。<br/>
  6727. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6728. */
  6729. protected onEnable(): void;
  6730. /**
  6731. !#en Called when this component becomes disabled or its node becomes inactive.<br/>
  6732. 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.
  6733. !#zh 当该组件被禁用或节点变为无效时调用。<br/>
  6734. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6735. */
  6736. protected onDisable(): void;
  6737. /**
  6738. !#en Called when this component will be destroyed.<br/>
  6739. 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.
  6740. !#zh 当该组件被销毁时调用<br/>
  6741. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6742. */
  6743. protected onDestroy(): void;
  6744. protected onFocusInEditor(): void;
  6745. protected onLostFocusInEditor(): void;
  6746. /**
  6747. !#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.
  6748. !#zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  6749. */
  6750. protected resetInEditor(): void;
  6751. /**
  6752. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  6753. !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
  6754. @param typeOrClassName the constructor or the class name of the component to add
  6755. @example
  6756. ```js
  6757. var sprite = node.addComponent(cc.Sprite);
  6758. var test = node.addComponent("Test");
  6759. ```
  6760. */
  6761. addComponent<T extends Component>(type: {new(): T}): T;
  6762. addComponent(className: string): any;
  6763. /**
  6764. !#en
  6765. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  6766. You can also get component in the node by passing in the name of the script.
  6767. !#zh
  6768. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  6769. 传入参数也可以是脚本的名称。
  6770. @param typeOrClassName typeOrClassName
  6771. @example
  6772. ```js
  6773. // get sprite component.
  6774. var sprite = node.getComponent(cc.Sprite);
  6775. // get custom test calss.
  6776. var test = node.getComponent("Test");
  6777. ```
  6778. */
  6779. getComponent<T extends Component>(type: {prototype: T}): T;
  6780. getComponent(className: string): any;
  6781. /**
  6782. !#en Returns all components of supplied Type in the node.
  6783. !#zh 返回节点上指定类型的所有组件。
  6784. @param typeOrClassName typeOrClassName
  6785. @example
  6786. ```js
  6787. var sprites = node.getComponents(cc.Sprite);
  6788. var tests = node.getComponents("Test");
  6789. ```
  6790. */
  6791. getComponents<T extends Component>(type: {prototype: T}): T[];
  6792. getComponents(className: string): any[];
  6793. /**
  6794. !#en Returns the component of supplied type in any of its children using depth first search.
  6795. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  6796. @param typeOrClassName typeOrClassName
  6797. @example
  6798. ```js
  6799. var sprite = node.getComponentInChildren(cc.Sprite);
  6800. var Test = node.getComponentInChildren("Test");
  6801. ```
  6802. */
  6803. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  6804. getComponentInChildren(className: string): any;
  6805. /**
  6806. !#en Returns the components of supplied type in self or any of its children using depth first search.
  6807. !#zh 递归查找自身或所有子节点中指定类型的组件
  6808. @param typeOrClassName typeOrClassName
  6809. @example
  6810. ```js
  6811. var sprites = node.getComponentsInChildren(cc.Sprite);
  6812. var tests = node.getComponentsInChildren("Test");
  6813. ```
  6814. */
  6815. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  6816. getComponentsInChildren(className: string): any[];
  6817. /**
  6818. !#en
  6819. If the component's bounding box is different from the node's, you can implement this method to supply
  6820. a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  6821. !#zh
  6822. 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  6823. 以便编辑器的场景视图可以正确地执行点选测试。
  6824. @param out_rect the Rect to receive the bounding box
  6825. */
  6826. _getLocalBounds(out_rect: Rect): void;
  6827. /**
  6828. !#en
  6829. onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  6830. an undo operation on this component.<br/>
  6831. <br/>
  6832. If the component contains the "internal state", short for "temporary member variables which not included<br/>
  6833. in its CCClass properties", then you may need to implement this function.<br/>
  6834. <br/>
  6835. The editor will call the getset accessors of your component to record/restore the component's state<br/>
  6836. for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  6837. this function to manually synchronize your component's "internal states" with its public properties.<br/>
  6838. Once you implement this function, all the getset accessors of your component will not be called when<br/>
  6839. the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  6840. will be recorded or restored by editor.<br/>
  6841. <br/>
  6842. Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  6843. to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  6844. properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  6845. will not be called during reset operation. Which means that only the properties with default value<br/>
  6846. will be reset by editor.
  6847. This function is only called in editor mode.
  6848. !#zh
  6849. onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  6850. <br/>
  6851. 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  6852. <br/>
  6853. 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。
  6854. 然而,在极端的情况下,它可能无法良好运作。<br/>
  6855. 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。
  6856. 一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。
  6857. 这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  6858. <br/>
  6859. 同样的,编辑可能无法在极端情况下正确地重置您的组件。<br/>
  6860. 于是如果你需要支持组件重置菜单,你需要在该方法中手工同步组件属性到“内部状态”。<br/>
  6861. 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
  6862. 这意味着仅仅指定了默认值的属性将被编辑器重置。
  6863. <br/>
  6864. 此方法仅在编辑器下会被调用。
  6865. */
  6866. onRestore(): void;
  6867. /**
  6868. !#en
  6869. Schedules a custom selector.<br/>
  6870. If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
  6871. !#zh
  6872. 调度一个自定义的回调函数。<br/>
  6873. 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
  6874. @param callback The callback function
  6875. @param interval Tick interval in seconds. 0 means tick every frame.
  6876. @param repeat The selector will be executed (repeat + 1) times, you can use cc.macro.REPEAT_FOREVER for tick infinitely.
  6877. @param delay The amount of time that the first tick will wait before execution.
  6878. @example
  6879. ```js
  6880. var timeCallback = function (dt) {
  6881. cc.log("time: " + dt);
  6882. }
  6883. this.schedule(timeCallback, 1);
  6884. ```
  6885. */
  6886. schedule(callback: Function, interval?: number, repeat?: number, delay?: number): void;
  6887. /**
  6888. !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
  6889. !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  6890. @param callback A function wrapped as a selector
  6891. @param delay The amount of time that the first tick will wait before execution.
  6892. @example
  6893. ```js
  6894. var timeCallback = function (dt) {
  6895. cc.log("time: " + dt);
  6896. }
  6897. this.scheduleOnce(timeCallback, 2);
  6898. ```
  6899. */
  6900. scheduleOnce(callback: Function, delay?: number): void;
  6901. /**
  6902. !#en Unschedules a custom callback function.
  6903. !#zh 取消调度一个自定义的回调函数。
  6904. @param callback_fn A function wrapped as a selector
  6905. @example
  6906. ```js
  6907. this.unschedule(_callback);
  6908. ```
  6909. */
  6910. unschedule(callback_fn: Function): void;
  6911. /**
  6912. !#en
  6913. unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
  6914. Actions are not affected by this method.
  6915. !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 'update' 回调函数。动作不受此方法影响。
  6916. @example
  6917. ```js
  6918. this.unscheduleAllCallbacks();
  6919. ```
  6920. */
  6921. unscheduleAllCallbacks(): void;
  6922. }
  6923. /** !#en The Label Component.
  6924. !#zh 文字标签组件 */
  6925. export class Label extends RenderComponent {
  6926. /** !#en Content string of label.
  6927. !#zh 标签显示的文本内容。 */
  6928. string: string;
  6929. /** !#en Horizontal Alignment of label.
  6930. !#zh 文本内容的水平对齐方式。 */
  6931. horizontalAlign: Label.HorizontalAlign;
  6932. /** !#en Vertical Alignment of label.
  6933. !#zh 文本内容的垂直对齐方式。 */
  6934. verticalAlign: Label.VerticalAlign;
  6935. /** !#en The actual rendering font size in shrink mode
  6936. !#zh SHRINK 模式下面文本实际渲染的字体大小 */
  6937. actualFontSize: number;
  6938. /** !#en Font size of label.
  6939. !#zh 文本字体大小。 */
  6940. fontSize: number;
  6941. /** !#en Font family of label, only take effect when useSystemFont property is true.
  6942. !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 */
  6943. fontFamily: string;
  6944. /** !#en Line Height of label.
  6945. !#zh 文本行高。 */
  6946. lineHeight: number;
  6947. /** !#en Overflow of label.
  6948. !#zh 文字显示超出范围时的处理方式。 */
  6949. overflow: Label.Overflow;
  6950. /** !#en Whether auto wrap label when string width is large than label width.
  6951. !#zh 是否自动换行。 */
  6952. enableWrapText: boolean;
  6953. /** !#en The font of label.
  6954. !#zh 文本字体。 */
  6955. font: Font;
  6956. /** !#en Whether use system font name or not.
  6957. !#zh 是否使用系统字体。 */
  6958. useSystemFont: boolean;
  6959. /** !#en The cache mode of label. This mode only supports system fonts.
  6960. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  6961. cacheMode: Label.CacheMode;
  6962. }
  6963. /** !#en Outline effect used to change the display, only used for TTF font
  6964. !#zh 描边效果组件,用于字体描边,只能用于系统字体 */
  6965. export class LabelOutline extends Component {
  6966. /** !#en Change the outline color
  6967. !#zh 改变描边的颜色 */
  6968. color: Color;
  6969. /** !#en Change the outline width
  6970. !#zh 改变描边的宽度 */
  6971. width: number;
  6972. }
  6973. /** !#en
  6974. The Layout is a container component, use it to arrange child elements easily.<br>
  6975. Note:<br>
  6976. 1.Scaling and rotation of child nodes are not considered.<br>
  6977. 2.After setting the Layout, the results need to be updated until the next frame,
  6978. unless you manually call {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。
  6979. !#zh
  6980. Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  6981. 注意:<br>
  6982. 1.不会考虑子节点的缩放和旋转。<br>
  6983. 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用 {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。 */
  6984. export class Layout extends Component {
  6985. /** !#en The layout type.
  6986. !#zh 布局类型 */
  6987. type: Layout.Type;
  6988. /** !#en
  6989. The are three resize modes for Layout.
  6990. None, resize Container and resize children.
  6991. !#zh 缩放模式 */
  6992. resizeMode: Layout.ResizeMode;
  6993. /** !#en The cell size for grid layout.
  6994. !#zh 每个格子的大小,只有布局类型为 GRID 的时候才有效。 */
  6995. cellSize: Size;
  6996. /** !#en
  6997. The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  6998. and then break line on demand. Choose vertical if you want to layout vertically at first .
  6999. !#zh 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。 */
  7000. startAxis: Layout.AxisDirection;
  7001. /** !#en The left padding of layout, it only effect the layout in one direction.
  7002. !#zh 容器内左边距,只会在一个布局方向上生效。 */
  7003. paddingLeft: number;
  7004. /** !#en The right padding of layout, it only effect the layout in one direction.
  7005. !#zh 容器内右边距,只会在一个布局方向上生效。 */
  7006. paddingRight: number;
  7007. /** !#en The top padding of layout, it only effect the layout in one direction.
  7008. !#zh 容器内上边距,只会在一个布局方向上生效。 */
  7009. paddingTop: number;
  7010. /** !#en The bottom padding of layout, it only effect the layout in one direction.
  7011. !#zh 容器内下边距,只会在一个布局方向上生效。 */
  7012. paddingBottom: number;
  7013. /** !#en The distance in x-axis between each element in layout.
  7014. !#zh 子节点之间的水平间距。 */
  7015. spacingX: number;
  7016. /** !#en The distance in y-axis between each element in layout.
  7017. !#zh 子节点之间的垂直间距。 */
  7018. spacingY: number;
  7019. /** !#en
  7020. Only take effect in Vertical layout mode.
  7021. This option changes the start element's positioning.
  7022. !#zh 垂直排列子节点的方向。 */
  7023. verticalDirection: Layout.VerticalDirection;
  7024. /** !#en
  7025. Only take effect in Horizontal layout mode.
  7026. This option changes the start element's positioning.
  7027. !#zh 水平排列子节点的方向。 */
  7028. horizontalDirection: Layout.HorizontalDirection;
  7029. /** !#en Adjust the layout if the children scaled.
  7030. !#zh 子节点缩放比例是否影响布局。 */
  7031. affectedByScale: boolean;
  7032. /**
  7033. !#en Perform the layout update
  7034. !#zh 立即执行更新布局
  7035. @example
  7036. ```js
  7037. layout.type = cc.Layout.HORIZONTAL;
  7038. layout.node.addChild(childNode);
  7039. cc.log(childNode.x); // not yet changed
  7040. layout.updateLayout();
  7041. cc.log(childNode.x); // changed
  7042. ```
  7043. */
  7044. updateLayout(): void;
  7045. /** !#en The padding of layout, it effects the layout in four direction.
  7046. !#zh 容器内边距,该属性会在四个布局方向上生效。 */
  7047. padding: number;
  7048. }
  7049. /** !#en The Mask Component
  7050. !#zh 遮罩组件 */
  7051. export class Mask extends RenderComponent {
  7052. /** !#en The mask type.
  7053. !#zh 遮罩类型 */
  7054. type: Mask.Type;
  7055. /** !#en The mask image
  7056. !#zh 遮罩所需要的贴图 */
  7057. spriteFrame: SpriteFrame;
  7058. /** !#en
  7059. The alpha threshold.(Not supported Canvas Mode) <br/>
  7060. The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  7061. Should be a float between 0 and 1. <br/>
  7062. This default to 0 (so alpha test is disabled).
  7063. When it's set to 1, the stencil will discard all pixels, nothing will be shown,
  7064. In previous version, it act as if the alpha test is disabled, which is incorrect.
  7065. !#zh
  7066. Alpha 阈值(不支持 Canvas 模式)<br/>
  7067. 只有当模板的像素的 alpha 大于 alphaThreshold 时,才会绘制内容。<br/>
  7068. 该数值 0 ~ 1 之间的浮点数,默认值为 0(因此禁用 alpha 测试)
  7069. 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容,在之前的版本中,设置为 1 等同于 0,这种效果其实是不正确的 */
  7070. alphaThreshold: number;
  7071. /** !#en Reverse mask (Not supported Canvas Mode)
  7072. !#zh 反向遮罩(不支持 Canvas 模式) */
  7073. inverted: boolean;
  7074. /** TODO: remove segments, not supported by graphics
  7075. !#en The segements for ellipse mask.
  7076. !#zh 椭圆遮罩的曲线细分数 */
  7077. segements: number;
  7078. }
  7079. /** !#en
  7080. cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  7081. You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  7082. length and color. The fadeTime controls how long it takes each vertex in <br/>
  7083. the streak to fade out, the minimum segment size it how many pixels the <br/>
  7084. streak will move before adding a new ribbon segment, and the texture <br/>
  7085. length is the how many pixels the texture is stretched across. The texture <br/>
  7086. is vertically aligned along the streak segment.
  7087. !#zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */
  7088. export class MotionStreak extends Component {
  7089. /** !#en
  7090. !#zh 在编辑器模式下预览拖尾效果。 */
  7091. preview: boolean;
  7092. /** !#en The fade time to fade.
  7093. !#zh 拖尾的渐隐时间,以秒为单位。 */
  7094. fadeTime: number;
  7095. /** !#en The minimum segment size.
  7096. !#zh 拖尾之间最小距离。 */
  7097. minSeg: number;
  7098. /** !#en The stroke's width.
  7099. !#zh 拖尾的宽度。 */
  7100. stroke: number;
  7101. /** !#en The texture of the MotionStreak.
  7102. !#zh 拖尾的贴图。 */
  7103. texture: Texture2D;
  7104. /** !#en The color of the MotionStreak.
  7105. !#zh 拖尾的颜色 */
  7106. color: Color;
  7107. /** !#en The fast Mode.
  7108. !#zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。 */
  7109. fastMode: boolean;
  7110. /**
  7111. !#en Remove all living segments of the ribbon.
  7112. !#zh 删除当前所有的拖尾片段。
  7113. @example
  7114. ```js
  7115. // Remove all living segments of the ribbon.
  7116. myMotionStreak.reset();
  7117. ```
  7118. */
  7119. reset(): void;
  7120. }
  7121. /** !#en The PageView control
  7122. !#zh 页面视图组件 */
  7123. export class PageView extends ScrollView {
  7124. /** !#en Specify the size type of each page in PageView.
  7125. !#zh 页面视图中每个页面大小类型 */
  7126. sizeMode: PageView.SizeMode;
  7127. /** !#en The page view direction
  7128. !#zh 页面视图滚动类型 */
  7129. direction: PageView.Direction;
  7130. /** !#en
  7131. The scroll threshold value, when drag exceeds this value,
  7132. release the next page will automatically scroll, less than the restore
  7133. !#zh 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。 */
  7134. scrollThreshold: number;
  7135. /** !#en
  7136. Auto page turning velocity threshold. When users swipe the PageView quickly,
  7137. it will calculate a velocity based on the scroll distance and time,
  7138. if the calculated velocity is larger than the threshold, then it will trigger page turning.
  7139. !#zh
  7140. 快速滑动翻页临界值。
  7141. 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  7142. 该值与此临界值相比较,如果大于临界值,则进行自动翻页。 */
  7143. autoPageTurningThreshold: number;
  7144. /** !#en Change the PageTurning event timing of PageView.
  7145. !#zh 设置 PageView PageTurning 事件的发送时机。 */
  7146. pageTurningEventTiming: number;
  7147. /** !#en The Page View Indicator
  7148. !#zh 页面视图指示器组件 */
  7149. indicator: PageViewIndicator;
  7150. /** !#en The time required to turn over a page. unit: second
  7151. !#zh 每个页面翻页时所需时间。单位:秒 */
  7152. pageTurningSpeed: number;
  7153. /** !#en PageView events callback
  7154. !#zh 滚动视图的事件回调函数 */
  7155. pageEvents: Component.EventHandler[];
  7156. /**
  7157. !#en Returns current page index
  7158. !#zh 返回当前页面索引
  7159. */
  7160. getCurrentPageIndex(): number;
  7161. /**
  7162. !#en Set current page index
  7163. !#zh 设置当前页面索引
  7164. @param index index
  7165. */
  7166. setCurrentPageIndex(index: number): void;
  7167. /**
  7168. !#en Returns all pages of pageview
  7169. !#zh 返回视图中的所有页面
  7170. */
  7171. getPages(): Node[];
  7172. /**
  7173. !#en At the end of the current page view to insert a new view
  7174. !#zh 在当前页面视图的尾部插入一个新视图
  7175. @param page page
  7176. */
  7177. addPage(page: Node): void;
  7178. /**
  7179. !#en Inserts a page in the specified location
  7180. !#zh 将页面插入指定位置中
  7181. @param page page
  7182. @param index index
  7183. */
  7184. insertPage(page: Node, index: number): void;
  7185. /**
  7186. !#en Removes a page from PageView.
  7187. !#zh 移除指定页面
  7188. @param page page
  7189. */
  7190. removePage(page: Node): void;
  7191. /**
  7192. !#en Removes a page at index of PageView.
  7193. !#zh 移除指定下标的页面
  7194. @param index index
  7195. */
  7196. removePageAtIndex(index: number): void;
  7197. /**
  7198. !#en Removes all pages from PageView
  7199. !#zh 移除所有页面
  7200. */
  7201. removeAllPages(): void;
  7202. /**
  7203. !#en Scroll PageView to index.
  7204. !#zh 滚动到指定页面
  7205. @param idx index of page.
  7206. @param timeInSecond scrolling time
  7207. */
  7208. scrollToPage(idx: number, timeInSecond: number): void;
  7209. }
  7210. /** !#en The Page View Indicator Component
  7211. !#zh 页面视图每页标记组件 */
  7212. export class PageViewIndicator extends Component {
  7213. /** !#en The spriteFrame for each element.
  7214. !#zh 每个页面标记显示的图片 */
  7215. spriteFrame: SpriteFrame;
  7216. /** !#en The location direction of PageViewIndicator.
  7217. !#zh 页面标记摆放方向 */
  7218. direction: PageViewIndicator.Direction;
  7219. /** !#en The cellSize for each element.
  7220. !#zh 每个页面标记的大小 */
  7221. cellSize: Size;
  7222. /** !#en The distance between each element.
  7223. !#zh 每个页面标记之间的边距 */
  7224. spacing: number;
  7225. /**
  7226. !#en Set Page View
  7227. !#zh 设置页面视图
  7228. @param target target
  7229. */
  7230. setPageView(target: PageView): void;
  7231. }
  7232. /** !#en
  7233. Visual indicator of progress in some operation.
  7234. Displays a bar to the user representing how far the operation has progressed.
  7235. !#zh
  7236. 进度条组件,可用于显示加载资源时的进度。 */
  7237. export class ProgressBar extends Component {
  7238. /** !#en The targeted Sprite which will be changed progressively.
  7239. !#zh 用来显示进度条比例的 Sprite 对象。 */
  7240. barSprite: Sprite;
  7241. /** !#en The progress mode, there are two modes supported now: horizontal and vertical.
  7242. !#zh 进度条的模式 */
  7243. mode: ProgressBar.Mode;
  7244. /** !#en The total width or height of the bar sprite.
  7245. !#zh 进度条实际的总长度 */
  7246. totalLength: number;
  7247. /** !#en The current progress of the bar sprite. The valid value is between 0-1.
  7248. !#zh 当前进度值,该数值的区间是 0-1 之间。 */
  7249. progress: number;
  7250. /** !#en Whether reverse the progress direction of the bar sprite.
  7251. !#zh 进度条是否进行反方向变化。 */
  7252. reverse: boolean;
  7253. }
  7254. /** !#en
  7255. Base class for components which supports rendering features.
  7256. !#zh
  7257. 所有支持渲染的组件的基类 */
  7258. export class RenderComponent extends Component {
  7259. }
  7260. /** !#en The RichText Component.
  7261. !#zh 富文本组件 */
  7262. export class RichText extends Component {
  7263. /** !#en Content string of RichText.
  7264. !#zh 富文本显示的文本内容。 */
  7265. string: string;
  7266. /** !#en Horizontal Alignment of each line in RichText.
  7267. !#zh 文本内容的水平对齐方式。 */
  7268. horizontalAlign: macro.TextAlignment;
  7269. /** !#en Font size of RichText.
  7270. !#zh 富文本字体大小。 */
  7271. fontSize: number;
  7272. /** !#en Custom System font of RichText
  7273. !#zh 富文本定制系统字体 */
  7274. fontFamily: string;
  7275. /** !#en Custom TTF font of RichText
  7276. !#zh 富文本定制字体 */
  7277. font: cc.TTFFont;
  7278. /** !#en Whether use system font name or not.
  7279. !#zh 是否使用系统字体。 */
  7280. useSystemFont: boolean;
  7281. /** !#en The maximize width of the RichText
  7282. !#zh 富文本的最大宽度 */
  7283. maxWidth: number;
  7284. /** !#en Line Height of RichText.
  7285. !#zh 富文本行高。 */
  7286. lineHeight: number;
  7287. /** !#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.
  7288. !#zh 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。 */
  7289. imageAtlas: SpriteAtlas;
  7290. /** !#en
  7291. Once checked, the RichText will block all input events (mouse and touch) within
  7292. the bounding box of the node, preventing the input from penetrating into the underlying node.
  7293. !#zh
  7294. 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。 */
  7295. handleTouchEvent: boolean;
  7296. }
  7297. /** !#en
  7298. The Scrollbar control allows the user to scroll an image or other view that is too large to see completely
  7299. !#zh 滚动条组件 */
  7300. export class Scrollbar extends Component {
  7301. /** !#en The "handle" part of the scrollbar.
  7302. !#zh 作为当前滚动区域位置显示的滑块 Sprite。 */
  7303. handle: Sprite;
  7304. /** !#en The direction of scrollbar.
  7305. !#zh ScrollBar 的滚动方向。 */
  7306. direction: Scrollbar.Direction;
  7307. /** !#en Whether enable auto hide or not.
  7308. !#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */
  7309. enableAutoHide: boolean;
  7310. /** !#en
  7311. The time to hide scrollbar when scroll finished.
  7312. Note: This value is only useful when enableAutoHide is true.
  7313. !#zh
  7314. 没有滚动动作后经过多久会自动隐藏。
  7315. 注意:只要当 “enableAutoHide” 为 true 时,才有效。 */
  7316. autoHideTime: number;
  7317. }
  7318. /** !#en
  7319. Layout container for a view hierarchy that can be scrolled by the user,
  7320. allowing it to be larger than the physical display.
  7321. !#zh
  7322. 滚动视图组件 */
  7323. export class ScrollView extends Component {
  7324. /** !#en This is a reference to the UI element to be scrolled.
  7325. !#zh 可滚动展示内容的节点。 */
  7326. content: Node;
  7327. /** !#en Enable horizontal scroll.
  7328. !#zh 是否开启水平滚动。 */
  7329. horizontal: boolean;
  7330. /** !#en Enable vertical scroll.
  7331. !#zh 是否开启垂直滚动。 */
  7332. vertical: boolean;
  7333. /** !#en When inertia is set, the content will continue to move when touch ended.
  7334. !#zh 是否开启滚动惯性。 */
  7335. inertia: boolean;
  7336. /** !#en
  7337. It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  7338. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  7339. !#zh
  7340. 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。 */
  7341. brake: number;
  7342. /** !#en When elastic is set, the content will be bounce back when move out of boundary.
  7343. !#zh 是否允许滚动内容超过边界,并在停止触摸后回弹。 */
  7344. elastic: boolean;
  7345. /** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.
  7346. !#zh 回弹持续的时间,0 表示将立即反弹。 */
  7347. bounceDuration: number;
  7348. /** !#en The horizontal scrollbar reference.
  7349. !#zh 水平滚动的 ScrollBar。 */
  7350. horizontalScrollBar: Scrollbar;
  7351. /** !#en The vertical scrollbar reference.
  7352. !#zh 垂直滚动的 ScrollBar。 */
  7353. verticalScrollBar: Scrollbar;
  7354. /** !#en Scrollview events callback
  7355. !#zh 滚动视图的事件回调函数 */
  7356. scrollEvents: Component.EventHandler[];
  7357. /** !#en If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  7358. It's set to true by default.
  7359. !#zh 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。
  7360. 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 */
  7361. cancelInnerEvents: boolean;
  7362. /**
  7363. !#en Scroll the content to the bottom boundary of ScrollView.
  7364. !#zh 视图内容将在规定时间内滚动到视图底部。
  7365. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7366. the content will jump to the bottom boundary immediately.
  7367. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7368. @example
  7369. ```js
  7370. // Scroll to the bottom of the view.
  7371. scrollView.scrollToBottom(0.1);
  7372. ```
  7373. */
  7374. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  7375. /**
  7376. !#en Scroll the content to the top boundary of ScrollView.
  7377. !#zh 视图内容将在规定时间内滚动到视图顶部。
  7378. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7379. the content will jump to the top boundary immediately.
  7380. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7381. @example
  7382. ```js
  7383. // Scroll to the top of the view.
  7384. scrollView.scrollToTop(0.1);
  7385. ```
  7386. */
  7387. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  7388. /**
  7389. !#en Scroll the content to the left boundary of ScrollView.
  7390. !#zh 视图内容将在规定时间内滚动到视图左边。
  7391. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7392. the content will jump to the left boundary immediately.
  7393. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7394. @example
  7395. ```js
  7396. // Scroll to the left of the view.
  7397. scrollView.scrollToLeft(0.1);
  7398. ```
  7399. */
  7400. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  7401. /**
  7402. !#en Scroll the content to the right boundary of ScrollView.
  7403. !#zh 视图内容将在规定时间内滚动到视图右边。
  7404. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7405. the content will jump to the right boundary immediately.
  7406. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7407. @example
  7408. ```js
  7409. // Scroll to the right of the view.
  7410. scrollView.scrollToRight(0.1);
  7411. ```
  7412. */
  7413. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  7414. /**
  7415. !#en Scroll the content to the top left boundary of ScrollView.
  7416. !#zh 视图内容将在规定时间内滚动到视图左上角。
  7417. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7418. the content will jump to the top left boundary immediately.
  7419. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7420. @example
  7421. ```js
  7422. // Scroll to the upper left corner of the view.
  7423. scrollView.scrollToTopLeft(0.1);
  7424. ```
  7425. */
  7426. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  7427. /**
  7428. !#en Scroll the content to the top right boundary of ScrollView.
  7429. !#zh 视图内容将在规定时间内滚动到视图右上角。
  7430. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7431. the content will jump to the top right boundary immediately.
  7432. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7433. @example
  7434. ```js
  7435. // Scroll to the top right corner of the view.
  7436. scrollView.scrollToTopRight(0.1);
  7437. ```
  7438. */
  7439. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  7440. /**
  7441. !#en Scroll the content to the bottom left boundary of ScrollView.
  7442. !#zh 视图内容将在规定时间内滚动到视图左下角。
  7443. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7444. the content will jump to the bottom left boundary immediately.
  7445. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7446. @example
  7447. ```js
  7448. // Scroll to the lower left corner of the view.
  7449. scrollView.scrollToBottomLeft(0.1);
  7450. ```
  7451. */
  7452. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  7453. /**
  7454. !#en Scroll the content to the bottom right boundary of ScrollView.
  7455. !#zh 视图内容将在规定时间内滚动到视图右下角。
  7456. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7457. the content will jump to the bottom right boundary immediately.
  7458. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7459. @example
  7460. ```js
  7461. // Scroll to the lower right corner of the view.
  7462. scrollView.scrollToBottomRight(0.1);
  7463. ```
  7464. */
  7465. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  7466. /**
  7467. !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the
  7468. specific offset immediately.
  7469. !#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传,则立即滚动到指定偏移位置。
  7470. @param offset A Vec2, the value of which each axis between 0 and maxScrollOffset
  7471. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7472. the content will jump to the specific offset of ScrollView immediately.
  7473. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7474. @example
  7475. ```js
  7476. // Scroll to middle position in 0.1 second in x-axis
  7477. let maxScrollOffset = this.getMaxScrollOffset();
  7478. scrollView.scrollToOffset(cc.v2(maxScrollOffset.x / 2, 0), 0.1);
  7479. ```
  7480. */
  7481. scrollToOffset(offset: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  7482. /**
  7483. !#en Get the positive offset value corresponds to the content's top left boundary.
  7484. !#zh 获取滚动视图相对于左上角原点的当前滚动偏移
  7485. */
  7486. getScrollOffset(): Vec2;
  7487. /**
  7488. !#en Get the maximize available scroll offset
  7489. !#zh 获取滚动视图最大可以滚动的偏移量
  7490. */
  7491. getMaxScrollOffset(): Vec2;
  7492. /**
  7493. !#en Scroll the content to the horizontal percent position of ScrollView.
  7494. !#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  7495. @param percent A value between 0 and 1.
  7496. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7497. the content will jump to the horizontal percent position of ScrollView immediately.
  7498. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7499. @example
  7500. ```js
  7501. // Scroll to middle position.
  7502. scrollView.scrollToBottomRight(0.5, 0.1);
  7503. ```
  7504. */
  7505. scrollToPercentHorizontal(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  7506. /**
  7507. !#en Scroll the content to the percent position of ScrollView in any direction.
  7508. !#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  7509. @param anchor A point which will be clamp between cc.v2(0,0) and cc.v2(1,1).
  7510. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7511. the content will jump to the percent position of ScrollView immediately.
  7512. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7513. @example
  7514. ```js
  7515. // Vertical scroll to the bottom of the view.
  7516. scrollView.scrollTo(cc.v2(0, 1), 0.1);
  7517. // Horizontal scroll to view right.
  7518. scrollView.scrollTo(cc.v2(1, 0), 0.1);
  7519. ```
  7520. */
  7521. scrollTo(anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  7522. /**
  7523. !#en Scroll the content to the vertical percent position of ScrollView.
  7524. !#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  7525. @param percent A value between 0 and 1.
  7526. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7527. the content will jump to the vertical percent position of ScrollView immediately.
  7528. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7529. // Scroll to middle position.
  7530. scrollView.scrollToPercentVertical(0.5, 0.1);
  7531. */
  7532. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  7533. /**
  7534. !#en Stop auto scroll immediately
  7535. !#zh 停止自动滚动, 调用此 API 可以让 Scrollview 立即停止滚动
  7536. */
  7537. stopAutoScroll(): void;
  7538. /**
  7539. !#en Modify the content position.
  7540. !#zh 设置当前视图内容的坐标点。
  7541. @param position The position in content's parent space.
  7542. */
  7543. setContentPosition(position: Vec2): void;
  7544. /**
  7545. !#en Query the content's position in its parent space.
  7546. !#zh 获取当前视图内容的坐标点。
  7547. */
  7548. getContentPosition(): Position;
  7549. /**
  7550. !#en Query whether the user is currently dragging the ScrollView to scroll it
  7551. !#zh 用户是否在拖拽当前滚动视图
  7552. */
  7553. isScrolling(): boolean;
  7554. /**
  7555. !#en Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  7556. !#zh 当前滚动视图是否在惯性滚动
  7557. */
  7558. isAutoScrolling(): boolean;
  7559. }
  7560. /** !#en The Slider Control
  7561. !#zh 滑动器组件 */
  7562. export class Slider extends Component {
  7563. /** !#en The "handle" part of the slider
  7564. !#zh 滑动器滑块按钮部件 */
  7565. handle: Button;
  7566. /** !#en The slider direction
  7567. !#zh 滑动器方向 */
  7568. direction: Slider.Direction;
  7569. /** !#en The current progress of the slider. The valid value is between 0-1
  7570. !#zh 当前进度值,该数值的区间是 0-1 之间 */
  7571. progress: number;
  7572. /** !#en The slider events callback
  7573. !#zh 滑动器组件事件回调函数 */
  7574. slideEvents: Component.EventHandler[];
  7575. }
  7576. /** !#en Renders a sprite in the scene.
  7577. !#zh 该组件用于在场景中渲染精灵。 */
  7578. export class Sprite extends RenderComponent {
  7579. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  7580. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  7581. srcBlendFactor: macro.BlendFactor;
  7582. /** !#en specify the destination Blend Factor.
  7583. !#zh 指定目标的混合模式 */
  7584. dstBlendFactor: macro.BlendFactor;
  7585. /** !#en The sprite frame of the sprite.
  7586. !#zh 精灵的精灵帧 */
  7587. spriteFrame: SpriteFrame;
  7588. /** !#en The sprite render type.
  7589. !#zh 精灵渲染类型 */
  7590. type: Sprite.Type;
  7591. /** !#en
  7592. The fill type, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7593. !#zh
  7594. 精灵填充类型,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7595. fillType: Sprite.FillType;
  7596. /** !#en
  7597. The fill Center, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7598. !#zh
  7599. 填充中心点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7600. fillCenter: Vec2;
  7601. /** !#en
  7602. The fill Start, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7603. !#zh
  7604. 填充起始点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7605. fillStart: number;
  7606. /** !#en
  7607. The fill Range, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7608. !#zh
  7609. 填充范围,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7610. fillRange: number;
  7611. /** !#en specify the frame is trimmed or not.
  7612. !#zh 是否使用裁剪模式 */
  7613. trim: boolean;
  7614. /** !#en specify the size tracing mode.
  7615. !#zh 精灵尺寸调整模式 */
  7616. sizeMode: Sprite.SizeMode;
  7617. /**
  7618. Change the state of sprite.
  7619. @param state NORMAL or GRAY State.
  7620. */
  7621. setState(state: Sprite.State): void;
  7622. /**
  7623. Gets the current state.
  7624. */
  7625. getState(): Sprite.State;
  7626. }
  7627. /** !#en The toggle component is a CheckBox, when it used together with a ToggleGroup, it
  7628. could be treated as a RadioButton.
  7629. !#zh Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。 */
  7630. export class Toggle extends Button {
  7631. /** !#en When this value is true, the check mark component will be enabled, otherwise
  7632. the check mark component will be disabled.
  7633. !#zh 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。 */
  7634. isChecked: boolean;
  7635. /** !#en The toggle group which the toggle belongs to, when it is null, the toggle is a CheckBox.
  7636. Otherwise, the toggle is a RadioButton.
  7637. !#zh Toggle 所属的 ToggleGroup,这个属性是可选的。如果这个属性为 null,则 Toggle 是一个 CheckBox,
  7638. 否则,Toggle 是一个 RadioButton。 */
  7639. toggleGroup: ToggleGroup;
  7640. /** !#en The image used for the checkmark.
  7641. !#zh Toggle 处于选中状态时显示的图片 */
  7642. checkMark: Sprite;
  7643. /** !#en If Toggle is clicked, it will trigger event's handler
  7644. !#zh Toggle 按钮的点击事件列表。 */
  7645. checkEvents: Component.EventHandler[];
  7646. /**
  7647. !#en Make the toggle button checked.
  7648. !#zh 使 toggle 按钮处于选中状态
  7649. */
  7650. check(): void;
  7651. /**
  7652. !#en Make the toggle button unchecked.
  7653. !#zh 使 toggle 按钮处于未选中状态
  7654. */
  7655. uncheck(): void;
  7656. }
  7657. /** !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. <br/>
  7658. Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  7659. Note: All the first layer child node containing the toggle component will auto be added to the container
  7660. !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。<br/>
  7661. 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。<br/>
  7662. 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 */
  7663. export class ToggleContainer extends Component {
  7664. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  7665. If it is false, it will make sure there is always only one toggle could be switched on
  7666. and the already switched on toggle can't be switched off.
  7667. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  7668. allowSwitchOff: boolean;
  7669. /** !#en If Toggle is clicked, it will trigger event's handler
  7670. !#zh Toggle 按钮的点击事件列表。 */
  7671. checkEvents: Component.EventHandler[];
  7672. /** !#en Read only property, return the toggle items array reference managed by ToggleContainer.
  7673. !#zh 只读属性,返回 ToggleContainer 管理的 toggle 数组引用 */
  7674. toggleItems: Toggle[];
  7675. }
  7676. /** !#en ToggleGroup is not a visiable UI component but a way to modify the behavior of a set of Toggles.
  7677. Toggles that belong to the same group could only have one of them to be switched on at a time.
  7678. !#zh ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,
  7679. 任何时候只能有一个 Toggle 处于选中状态。 */
  7680. export class ToggleGroup extends Component {
  7681. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  7682. If it is false, it will make sure there is always only one toggle could be switched on
  7683. and the already switched on toggle can't be switched off.
  7684. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  7685. allowSwitchOff: boolean;
  7686. /** !#en Read only property, return the toggle items array reference managed by toggleGroup.
  7687. !#zh 只读属性,返回 toggleGroup 管理的 toggle 数组引用 */
  7688. toggleItems: any[];
  7689. }
  7690. /** !#en
  7691. Handling touch events in a ViewGroup takes special care,
  7692. because it's common for a ViewGroup to have children that are targets for different touch events than the ViewGroup itself.
  7693. To make sure that each view correctly receives the touch events intended for it,
  7694. ViewGroup should register capture phase event and handle the event propagation properly.
  7695. Please refer to Scrollview for more information.
  7696. !#zh
  7697. ViewGroup的事件处理比较特殊,因为 ViewGroup 里面的子节点关心的事件跟 ViewGroup 本身可能不一样。
  7698. 为了让子节点能够正确地处理事件,ViewGroup 需要注册 capture 阶段的事件,并且合理地处理 ViewGroup 之间的事件传递。
  7699. 请参考 ScrollView 的实现来获取更多信息。 */
  7700. export class ViewGroup extends Component {
  7701. }
  7702. /** !#en
  7703. Stores and manipulate the anchoring based on its parent.
  7704. Widget are used for GUI but can also be used for other things.
  7705. 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.
  7706. !#zh
  7707. Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。
  7708. Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}}。 */
  7709. export class Widget extends Component {
  7710. /** !#en Specifies an alignment target that can only be one of the parent nodes of the current node.
  7711. The default value is null, and when null, indicates the current parent.
  7712. !#zh 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。 */
  7713. target: Node;
  7714. /** !#en Whether to align the top.
  7715. !#zh 是否对齐上边。 */
  7716. isAlignTop: boolean;
  7717. /** !#en
  7718. Vertically aligns the midpoint, This will open the other vertical alignment options cancel.
  7719. !#zh
  7720. 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。 */
  7721. isAlignVerticalCenter: boolean;
  7722. /** !#en Whether to align the bottom.
  7723. !#zh 是否对齐下边。 */
  7724. isAlignBottom: boolean;
  7725. /** !#en Whether to align the left.
  7726. !#zh 是否对齐左边 */
  7727. isAlignLeft: boolean;
  7728. /** !#en
  7729. Horizontal aligns the midpoint. This will open the other horizontal alignment options canceled.
  7730. !#zh
  7731. 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。 */
  7732. isAlignHorizontalCenter: boolean;
  7733. /** !#en Whether to align the right.
  7734. !#zh 是否对齐右边。 */
  7735. isAlignRight: boolean;
  7736. /** !#en
  7737. Whether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,
  7738. the width setting is invalid (read only).
  7739. !#zh
  7740. 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸,此时节点的宽度只读。 */
  7741. isStretchWidth: boolean;
  7742. /** !#en
  7743. Whether the stretched vertically, when enable the left and right alignment will be stretched vertically,
  7744. then height setting is invalid (read only)
  7745. !#zh
  7746. 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度只读。 */
  7747. isStretchHeight: boolean;
  7748. /** !#en
  7749. The margins between the top of this node and the top of parent node,
  7750. the value can be negative, Only available in 'isAlignTop' open.
  7751. !#zh
  7752. 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。 */
  7753. top: number;
  7754. /** !#en
  7755. The margins between the bottom of this node and the bottom of parent node,
  7756. the value can be negative, Only available in 'isAlignBottom' open.
  7757. !#zh
  7758. 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。 */
  7759. bottom: number;
  7760. /** !#en
  7761. The margins between the left of this node and the left of parent node,
  7762. the value can be negative, Only available in 'isAlignLeft' open.
  7763. !#zh
  7764. 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。 */
  7765. left: number;
  7766. /** !#en
  7767. The margins between the right of this node and the right of parent node,
  7768. the value can be negative, Only available in 'isAlignRight' open.
  7769. !#zh
  7770. 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。 */
  7771. right: number;
  7772. /** !#en
  7773. Horizontal aligns the midpoint offset value,
  7774. the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  7775. !#zh 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。 */
  7776. horizontalCenter: number;
  7777. /** !#en
  7778. Vertical aligns the midpoint offset value,
  7779. the value can be negative, Only available in 'isAlignVerticalCenter' open.
  7780. !#zh 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。 */
  7781. verticalCenter: number;
  7782. /** !#en If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  7783. !#zh 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  7784. isAbsoluteHorizontalCenter: boolean;
  7785. /** !#en If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  7786. !#zh 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  7787. isAbsoluteVerticalCenter: boolean;
  7788. /** !#en
  7789. If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  7790. !#zh
  7791. 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  7792. isAbsoluteTop: boolean;
  7793. /** !#en
  7794. If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  7795. !#zh
  7796. 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  7797. isAbsoluteBottom: boolean;
  7798. /** !#en
  7799. If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  7800. !#zh
  7801. 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  7802. isAbsoluteLeft: boolean;
  7803. /** !#en
  7804. If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  7805. !#zh
  7806. 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  7807. isAbsoluteRight: boolean;
  7808. /** !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  7809. !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 */
  7810. alignMode: Widget.AlignMode;
  7811. /**
  7812. !#en
  7813. Immediately perform the widget alignment. You need to manually call this method only if
  7814. you need to get the latest results after the alignment before the end of current frame.
  7815. !#zh
  7816. 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  7817. 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  7818. @example
  7819. ```js
  7820. widget.top = 10; // change top margin
  7821. cc.log(widget.node.y); // not yet changed
  7822. widget.updateAlignment();
  7823. cc.log(widget.node.y); // changed
  7824. ```
  7825. */
  7826. updateAlignment(): void;
  7827. /** !#en
  7828. When turned on, it will only be aligned once at the end of the onEnable frame,
  7829. then immediately disables the current component.
  7830. This will allow the script or animation to continue controlling the current node.
  7831. Note: It will still be aligned at the frame when onEnable is called.
  7832. !#zh
  7833. 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。
  7834. 这样便于脚本或动画继续控制当前节点。
  7835. 注意:onEnable 时所在的那一帧仍然会进行对齐。 */
  7836. isAlignOnce: boolean;
  7837. }
  7838. /** !#en SwanSubContextView is a view component which controls open data context viewport in WeChat game platform.<br/>
  7839. The component's node size decide the viewport of the sub context content in main context,
  7840. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  7841. This component provides multiple important features:<br/>
  7842. 1. Sub context could use its own resolution size and policy.<br/>
  7843. 2. Sub context could be minized to smallest size it needed.<br/>
  7844. 3. Resolution of sub context content could be increased.<br/>
  7845. 4. User touch input is transformed to the correct viewport.<br/>
  7846. 5. Texture update is handled by this component. User don't need to worry.<br/>
  7847. One important thing to be noted, whenever the node's bounding box change,
  7848. you need to manually reset the viewport of sub context using updateSubContextViewport.
  7849. !#zh SwanSubContextView 可以用来控制百度小游戏平台开放数据域在主域中的视窗的位置。<br/>
  7850. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  7851. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  7852. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  7853. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  7854. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  7855. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  7856. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  7857. 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。 */
  7858. export class SwanSubContextView extends Component {
  7859. /**
  7860. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  7861. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  7862. */
  7863. updateSubContextViewport(): void;
  7864. }
  7865. /** !#en WXSubContextView is a view component which controls open data context viewport in WeChat game platform.<br/>
  7866. The component's node size decide the viewport of the sub context content in main context,
  7867. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  7868. This component provides multiple important features:<br/>
  7869. 1. Sub context could use its own resolution size and policy.<br/>
  7870. 2. Sub context could be minized to smallest size it needed.<br/>
  7871. 3. Resolution of sub context content could be increased.<br/>
  7872. 4. User touch input is transformed to the correct viewport.<br/>
  7873. 5. Texture update is handled by this component. User don't need to worry.<br/>
  7874. One important thing to be noted, whenever the node's bounding box change,
  7875. you need to manually reset the viewport of sub context using updateSubContextViewport.
  7876. !#zh WXSubContextView 可以用来控制微信小游戏平台开放数据域在主域中的视窗的位置。<br/>
  7877. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  7878. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  7879. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  7880. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  7881. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  7882. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  7883. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  7884. 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。 */
  7885. export class WXSubContextView extends Component {
  7886. /**
  7887. !#en Reset open data context size and viewport
  7888. !#zh 重置开放数据域的尺寸和视窗
  7889. */
  7890. reset(): void;
  7891. /**
  7892. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  7893. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  7894. */
  7895. updateSubContextViewport(): void;
  7896. }
  7897. /** Loader for resource loading process. It's a singleton object. */
  7898. export class loader extends Pipeline {
  7899. /** The asset loader in cc.loader's pipeline, it's by default the first pipe.
  7900. It's used to identify an asset's type, and determine how to download it. */
  7901. static assetLoader: any;
  7902. /** The md5 pipe in cc.loader's pipeline, it could be absent if the project isn't build with md5 option.
  7903. It's used to modify the url to the real downloadable url with md5 suffix. */
  7904. static md5Pipe: any;
  7905. /** The downloader in cc.loader's pipeline, it's by default the second pipe.
  7906. It's used to download files with several handlers: pure text, image, script, audio, font, uuid.
  7907. You can add your own download function with addDownloadHandlers */
  7908. static downloader: any;
  7909. /** The loader in cc.loader's pipeline, it's by default the third pipe.
  7910. It's used to parse downloaded content with several handlers: JSON, image, plist, fnt, uuid.
  7911. You can add your own download function with addLoadHandlers */
  7912. static loader: any;
  7913. /**
  7914. Gets a new XMLHttpRequest instance.
  7915. */
  7916. static getXMLHttpRequest(): XMLHttpRequest;
  7917. /**
  7918. Add custom supported types handler or modify existing type handler for download process.
  7919. @param extMap Custom supported types with corresponded handler
  7920. @example
  7921. ```js
  7922. cc.loader.addDownloadHandlers({
  7923. // This will match all url with `.scene` extension or all url with `scene` type
  7924. 'scene' : function (url, callback) {}
  7925. });
  7926. ```
  7927. */
  7928. static addDownloadHandlers(extMap: any): void;
  7929. /**
  7930. Add custom supported types handler or modify existing type handler for load process.
  7931. @param extMap Custom supported types with corresponded handler
  7932. @example
  7933. ```js
  7934. cc.loader.addLoadHandlers({
  7935. // This will match all url with `.scene` extension or all url with `scene` type
  7936. 'scene' : function (url, callback) {}
  7937. });
  7938. ```
  7939. */
  7940. static addLoadHandlers(extMap: any): void;
  7941. /**
  7942. Load resources with a progression callback and a complete callback.
  7943. The progression callback is the same as Pipeline's {{#crossLink "LoadingItems/onProgress:method"}}onProgress{{/crossLink}}
  7944. The complete callback is almost the same as Pipeline's {{#crossLink "LoadingItems/onComplete:method"}}onComplete{{/crossLink}}
  7945. The only difference is when user pass a single url as resources, the complete callback will set its result directly as the second parameter.
  7946. @param resources Url list in an array
  7947. @param progressCallback Callback invoked when progression change
  7948. @param completeCallback Callback invoked when all resources loaded
  7949. @example
  7950. ```js
  7951. cc.loader.load('a.png', function (err, tex) {
  7952. cc.log('Result should be a texture: ' + (tex instanceof cc.Texture2D));
  7953. });
  7954. cc.loader.load('http://example.com/a.png', function (err, tex) {
  7955. cc.log('Should load a texture from external url: ' + (tex instanceof cc.Texture2D));
  7956. });
  7957. cc.loader.load({url: 'http://example.com/getImageREST?file=a.png', type: 'png'}, function (err, tex) {
  7958. cc.log('Should load a texture from RESTful API by specify the type: ' + (tex instanceof cc.Texture2D));
  7959. });
  7960. cc.loader.load(['a.png', 'b.json'], function (errors, results) {
  7961. if (errors) {
  7962. for (var i = 0; i < errors.length; i++) {
  7963. cc.log('Error url [' + errors[i] + ']: ' + results.getError(errors[i]));
  7964. }
  7965. }
  7966. var aTex = results.getContent('a.png');
  7967. var bJsonObj = results.getContent('b.json');
  7968. });
  7969. ```
  7970. */
  7971. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, completeCallback?: Function): void;
  7972. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: Function|null): void;
  7973. /**
  7974. Load resources from the "resources" folder inside the "assets" folder of your project.<br>
  7975. <br>
  7976. Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  7977. @param url Url of the target resource.
  7978. The url is relative to the "resources" folder, extensions must be omitted.
  7979. @param type Only asset of type will be loaded if this argument is supplied.
  7980. @param progressCallback Callback invoked when progression change.
  7981. @param completeCallback Callback invoked when the resource loaded.
  7982. @example
  7983. ```js
  7984. // load the prefab (project/assets/resources/misc/character/cocos) from resources folder
  7985. cc.loader.loadRes('misc/character/cocos', function (err, prefab) {
  7986. if (err) {
  7987. cc.error(err.message || err);
  7988. return;
  7989. }
  7990. cc.log('Result should be a prefab: ' + (prefab instanceof cc.Prefab));
  7991. });
  7992. // load the sprite frame of (project/assets/resources/imgs/cocos.png) from resources folder
  7993. cc.loader.loadRes('imgs/cocos', cc.SpriteFrame, function (err, spriteFrame) {
  7994. if (err) {
  7995. cc.error(err.message || err);
  7996. return;
  7997. }
  7998. cc.log('Result should be a sprite frame: ' + (spriteFrame instanceof cc.SpriteFrame));
  7999. });
  8000. ```
  8001. */
  8002. static loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  8003. static loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void;
  8004. static loadRes(url: string, type: typeof cc.Asset): void;
  8005. static loadRes(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  8006. static loadRes(url: string, completeCallback: (error: Error, resource: any) => void): void;
  8007. static loadRes(url: string): void;
  8008. /**
  8009. This method is like {{#crossLink "loader/loadRes:method"}}{{/crossLink}} except that it accepts array of url.
  8010. @param urls Array of URLs of the target resource.
  8011. The url is relative to the "resources" folder, extensions must be omitted.
  8012. @param type Only asset of type will be loaded if this argument is supplied.
  8013. @param progressCallback Callback invoked when progression change.
  8014. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  8015. @example
  8016. ```js
  8017. // load the SpriteFrames from resources folder
  8018. var spriteFrames;
  8019. var urls = ['misc/characters/character_01', 'misc/weapons/weapons_01'];
  8020. cc.loader.loadResArray(urls, cc.SpriteFrame, function (err, assets) {
  8021. if (err) {
  8022. cc.error(err);
  8023. return;
  8024. }
  8025. spriteFrames = assets;
  8026. // ...
  8027. });
  8028. ```
  8029. */
  8030. static loadResArray(url: string[], type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  8031. static loadResArray(url: string[], type: typeof cc.Asset, completeCallback: (error: Error, resource: any[]) => void): void;
  8032. static loadResArray(url: string[], type: typeof cc.Asset): void;
  8033. static loadResArray(url: string[], progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  8034. static loadResArray(url: string[], completeCallback: (error: Error, resource: any[]) => void): void;
  8035. static loadResArray(url: string[]): void;
  8036. static loadResArray(url: string[], type: typeof cc.Asset[]): void;
  8037. /**
  8038. Load all assets in a folder inside the "assets/resources" folder of your project.<br>
  8039. <br>
  8040. Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  8041. @param url Url of the target folder.
  8042. The url is relative to the "resources" folder, extensions must be omitted.
  8043. @param type Only asset of type will be loaded if this argument is supplied.
  8044. @param progressCallback Callback invoked when progression change.
  8045. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  8046. @example
  8047. ```js
  8048. // load the texture (resources/imgs/cocos.png) and the corresponding sprite frame
  8049. cc.loader.loadResDir('imgs/cocos', function (err, assets) {
  8050. if (err) {
  8051. cc.error(err);
  8052. return;
  8053. }
  8054. var texture = assets[0];
  8055. var spriteFrame = assets[1];
  8056. });
  8057. // load all textures in "resources/imgs/"
  8058. cc.loader.loadResDir('imgs', cc.Texture2D, function (err, textures) {
  8059. var texture1 = textures[0];
  8060. var texture2 = textures[1];
  8061. });
  8062. // load all JSONs in "resources/data/"
  8063. cc.loader.loadResDir('data', function (err, objects, urls) {
  8064. var data = objects[0];
  8065. var url = urls[0];
  8066. });
  8067. ```
  8068. */
  8069. 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;
  8070. static loadResDir(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  8071. static loadResDir(url: string, type: typeof cc.Asset): void;
  8072. static loadResDir(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  8073. static loadResDir(url: string, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  8074. static loadResDir(url: string): void;
  8075. /**
  8076. Get resource data by id. <br>
  8077. When you load resources with {{#crossLink "loader/load:method"}}{{/crossLink}} or {{#crossLink "loader/loadRes:method"}}{{/crossLink}},
  8078. the url will be the unique identity of the resource.
  8079. After loaded, you can acquire them by passing the url to this API.
  8080. @param url url
  8081. @param type Only asset of type will be returned if this argument is supplied.
  8082. */
  8083. static getRes(url: string, type?: Function): any;
  8084. /**
  8085. !#en
  8086. Get all resource dependencies of the loaded asset in an array, including itself.
  8087. The owner parameter accept the following types: 1. The asset itself; 2. The resource url; 3. The asset's uuid.<br>
  8088. The returned array stores the dependencies with their uuids, after retrieve dependencies,
  8089. you can release them, access dependent assets by passing the uuid to {{#crossLink "loader/getRes:method"}}{{/crossLink}}, or other stuffs you want.<br>
  8090. For release all dependencies of an asset, please refer to {{#crossLink "loader/release:method"}}{{/crossLink}}
  8091. Here is some examples:
  8092. !#zh
  8093. 获取某个已经加载好的资源的所有依赖资源,包含它自身,并保存在数组中返回。owner 参数接收以下几种类型:1. 资源 asset 对象;2. 资源目录下的 url;3. 资源的 uuid。<br>
  8094. 返回的数组将仅保存依赖资源的 uuid,获取这些 uuid 后,你可以从 loader 释放这些资源;通过 {{#crossLink "loader/getRes:method"}}{{/crossLink}} 获取某个资源或者进行其他你需要的操作。<br>
  8095. 想要释放一个资源及其依赖资源,可以参考 {{#crossLink "loader/release:method"}}{{/crossLink}}。下面是一些示例代码:
  8096. @param owner The owner asset or the resource url or the asset's uuid
  8097. @example
  8098. ```js
  8099. // Release all dependencies of a loaded prefab
  8100. var deps = cc.loader.getDependsRecursively(prefab);
  8101. cc.loader.release(deps);
  8102. // Retrieve all dependent textures
  8103. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  8104. var textures = [];
  8105. for (var i = 0; i < deps.length; ++i) {
  8106. var item = cc.loader.getRes(deps[i]);
  8107. if (item instanceof cc.Texture2D) {
  8108. textures.push(item);
  8109. }
  8110. }
  8111. ```
  8112. */
  8113. static getDependsRecursively(owner: Asset|RawAsset|string): any[];
  8114. /**
  8115. !#en
  8116. Release the content of an asset or an array of assets by uuid.
  8117. Start from v1.3, this method will not only remove the cache of the asset in loader, but also clean up its content.
  8118. For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  8119. In complexe project, you can use this function with {{#crossLink "loader/getDependsRecursively:method"}}{{/crossLink}} to free up memory in critical circumstances.
  8120. 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.
  8121. If you only want to remove the cache of an asset, please use {{#crossLink "pipeline/removeItem:method"}}{{/crossLink}}
  8122. !#zh
  8123. 通过 id(通常是资源 url)来释放一个资源或者一个资源数组。
  8124. 从 v1.3 开始,这个方法不仅会从 loader 中删除资源的缓存引用,还会清理它的资源内容。
  8125. 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  8126. 在复杂项目中,我们建议你结合 {{#crossLink "loader/getDependsRecursively:method"}}{{/crossLink}} 来使用,便于在设备内存告急的情况下更快地释放不再需要的资源的内存。
  8127. 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  8128. 如果你只想删除一个资源的缓存引用,请使用 {{#crossLink "pipeline/removeItem:method"}}{{/crossLink}}
  8129. @param asset asset
  8130. @example
  8131. ```js
  8132. // Release a texture which is no longer need
  8133. cc.loader.release(texture);
  8134. // Release all dependencies of a loaded prefab
  8135. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  8136. cc.loader.release(deps);
  8137. // If there is no instance of this prefab in the scene, the prefab and its dependencies like textures, sprite frames, etc, will be freed up.
  8138. // If you have some other nodes share a texture in this prefab, you can skip it in two ways:
  8139. // 1. Forbid auto release a texture before release
  8140. cc.loader.setAutoRelease(texture2d, false);
  8141. // 2. Remove it from the dependencies array
  8142. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  8143. var index = deps.indexOf(texture2d._uuid);
  8144. if (index !== -1)
  8145. deps.splice(index, 1);
  8146. cc.loader.release(deps);
  8147. ```
  8148. */
  8149. static release(asset: Asset|RawAsset|string|any[]): void;
  8150. /**
  8151. !#en Release the asset by its object. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  8152. !#zh 通过资源对象自身来释放资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  8153. @param asset asset
  8154. */
  8155. static releaseAsset(asset: Asset): void;
  8156. /**
  8157. !#en Release the asset loaded by {{#crossLink "loader/loadRes:method"}}{{/crossLink}}. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  8158. !#zh 释放通过 {{#crossLink "loader/loadRes:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  8159. @param url url
  8160. @param type Only asset of type will be released if this argument is supplied.
  8161. */
  8162. static releaseRes(url: string, type?: Function): void;
  8163. /**
  8164. !#en Release the all assets loaded by {{#crossLink "loader/loadResDir:method"}}{{/crossLink}}. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  8165. !#zh 释放通过 {{#crossLink "loader/loadResDir:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  8166. @param url url
  8167. @param type Only asset of type will be released if this argument is supplied.
  8168. */
  8169. static releaseResDir(url: string, type?: Function): void;
  8170. /**
  8171. !#en Resource all assets. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  8172. !#zh 释放所有资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  8173. */
  8174. static releaseAll(): void;
  8175. /**
  8176. !#en
  8177. Indicates whether to release the asset when loading a new scene.<br>
  8178. By default, when loading a new scene, all assets in the previous scene will be released or preserved
  8179. according to whether the previous scene checked the "Auto Release Assets" option.
  8180. On the other hand, assets dynamically loaded by using `cc.loader.loadRes` or `cc.loader.loadResDir`
  8181. will not be affected by that option, remain not released by default.<br>
  8182. Use this API to change the default behavior on a single asset, to force preserve or release specified asset when scene switching.<br>
  8183. <br>
  8184. See: {{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}, {{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  8185. !#zh
  8186. 设置当场景切换时是否自动释放资源。<br>
  8187. 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。
  8188. 而使用 `cc.loader.loadRes` 或 `cc.loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  8189. 使用这个 API 可以在单个资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  8190. <br>
  8191. 参考:{{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}},{{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  8192. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  8193. @param autoRelease indicates whether should release automatically
  8194. @example
  8195. ```js
  8196. // auto release the texture event if "Auto Release Assets" disabled in current scene
  8197. cc.loader.setAutoRelease(texture2d, true);
  8198. // don't release the texture even if "Auto Release Assets" enabled in current scene
  8199. cc.loader.setAutoRelease(texture2d, false);
  8200. // first parameter can be url
  8201. cc.loader.setAutoRelease(audioUrl, false);
  8202. ```
  8203. */
  8204. static setAutoRelease(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  8205. /**
  8206. !#en
  8207. Indicates whether to release the asset and its referenced other assets when loading a new scene.<br>
  8208. By default, when loading a new scene, all assets in the previous scene will be released or preserved
  8209. according to whether the previous scene checked the "Auto Release Assets" option.
  8210. On the other hand, assets dynamically loaded by using `cc.loader.loadRes` or `cc.loader.loadResDir`
  8211. will not be affected by that option, remain not released by default.<br>
  8212. Use this API to change the default behavior on the specified asset and its recursively referenced assets, to force preserve or release specified asset when scene switching.<br>
  8213. <br>
  8214. See: {{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}}, {{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  8215. !#zh
  8216. 设置当场景切换时是否自动释放资源及资源引用的其它资源。<br>
  8217. 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。
  8218. 而使用 `cc.loader.loadRes` 或 `cc.loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  8219. 使用这个 API 可以在指定资源及资源递归引用到的所有资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  8220. <br>
  8221. 参考:{{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}},{{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  8222. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  8223. @param autoRelease indicates whether should release automatically
  8224. @example
  8225. ```js
  8226. // auto release the SpriteFrame and its Texture event if "Auto Release Assets" disabled in current scene
  8227. cc.loader.setAutoReleaseRecursively(spriteFrame, true);
  8228. // don't release the SpriteFrame and its Texture even if "Auto Release Assets" enabled in current scene
  8229. cc.loader.setAutoReleaseRecursively(spriteFrame, false);
  8230. // don't release the Prefab and all the referenced assets
  8231. cc.loader.setAutoReleaseRecursively(prefab, false);
  8232. ```
  8233. */
  8234. static setAutoReleaseRecursively(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  8235. /**
  8236. !#en
  8237. Returns whether the asset is configured as auto released, despite how "Auto Release Assets" property is set on scene asset.<br>
  8238. <br>
  8239. See: {{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}}, {{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}
  8240. !#zh
  8241. 返回指定的资源是否有被设置为自动释放,不论场景的“Auto Release Assets”如何设置。<br>
  8242. <br>
  8243. 参考:{{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}},{{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}
  8244. @param assetOrUrl asset object or the raw asset's url
  8245. */
  8246. static isAutoRelease(assetOrUrl: Asset|string): boolean;
  8247. }
  8248. /** !#en
  8249. LoadingItems is the queue of items which can flow them into the loading pipeline.<br/>
  8250. Please don't construct it directly, use {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} instead, because we use an internal pool to recycle the queues.<br/>
  8251. It hold a map of items, each entry in the map is a url to object key value pair.<br/>
  8252. Each item always contains the following property:<br/>
  8253. - id: The identification of the item, usually it's identical to url<br/>
  8254. - url: The url <br/>
  8255. - type: The type, it's the extension name of the url by default, could be specified manually too.<br/>
  8256. - error: The error happened in pipeline will be stored in this property.<br/>
  8257. - content: The content processed by the pipeline, the final result will also be stored in this property.<br/>
  8258. - complete: The flag indicate whether the item is completed by the pipeline.<br/>
  8259. - states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE<br/>
  8260. <br/>
  8261. Item can hold other custom properties.<br/>
  8262. Each LoadingItems object will be destroyed for recycle after onComplete callback<br/>
  8263. So please don't hold its reference for later usage, you can copy properties in it though.
  8264. !#zh
  8265. LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。<br/>
  8266. 请不要直接使用 new 构造这个类的对象,你可以使用 {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} 来创建一个新的加载队列,这样可以允许我们的内部对象池回收并重利用加载队列。
  8267. 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。<br/>
  8268. 每个对象都会包含下列属性:<br/>
  8269. - id:该对象的标识,通常与 url 相同。<br/>
  8270. - url:路径 <br/>
  8271. - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。<br/>
  8272. - error:pipeline 中发生的错误将被保存在这个属性中。<br/>
  8273. - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。<br/>
  8274. - complete:该标志表明该对象是否通过 pipeline 完成。<br/>
  8275. - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE<br/>
  8276. <br/>
  8277. 对象可容纳其他自定义属性。<br/>
  8278. 每个 LoadingItems 对象都会在 onComplete 回调之后被销毁,所以请不要持有它的引用并在结束回调之后依赖它的内容执行任何逻辑,有这种需求的话你可以提前复制它的内容。 */
  8279. export class LoadingItems extends CallbacksInvoker {
  8280. /**
  8281. !#en This is a callback which will be invoked while an item flow out the pipeline.
  8282. You can pass the callback function in LoadingItems.create or set it later.
  8283. !#zh 这个回调函数将在 item 加载结束后被调用。你可以在构造时传递这个回调函数或者是在构造之后直接设置。
  8284. @param completedCount The number of the items that are already completed.
  8285. @param totalCount The total number of the items.
  8286. @param item The latest item which flow out the pipeline.
  8287. @example
  8288. ```js
  8289. loadingItems.onProgress = function (completedCount, totalCount, item) {
  8290. var progress = (100 * completedCount / totalCount).toFixed(2);
  8291. cc.log(progress + '%');
  8292. }
  8293. ```
  8294. */
  8295. onProgress(completedCount: number, totalCount: number, item: any): void;
  8296. /**
  8297. !#en This is a callback which will be invoked while all items is completed,
  8298. You can pass the callback function in LoadingItems.create or set it later.
  8299. !#zh 该函数将在加载队列全部完成时被调用。你可以在构造时传递这个回调函数或者是在构造之后直接设置。
  8300. @param errors All errored urls will be stored in this array, if no error happened, then it will be null
  8301. @param items All items.
  8302. @example
  8303. ```js
  8304. loadingItems.onComplete = function (errors, items) {
  8305. if (error)
  8306. cc.log('Completed with ' + errors.length + ' errors');
  8307. else
  8308. cc.log('Completed ' + items.totalCount + ' items');
  8309. }
  8310. ```
  8311. */
  8312. onComplete(errors: any[], items: LoadingItems): void;
  8313. /** !#en The map of all items.
  8314. !#zh 存储所有加载项的对象。 */
  8315. map: any;
  8316. /** !#en The map of completed items.
  8317. !#zh 存储已经完成的加载项。 */
  8318. completed: any;
  8319. /** !#en Total count of all items.
  8320. !#zh 所有加载项的总数。 */
  8321. totalCount: number;
  8322. /** !#en Total count of completed items.
  8323. !#zh 所有完成加载项的总数。 */
  8324. completedCount: number;
  8325. /** !#en Activated or not.
  8326. !#zh 是否启用。 */
  8327. active: boolean;
  8328. /**
  8329. !#en The constructor function of LoadingItems, this will use recycled LoadingItems in the internal pool if possible.
  8330. You can pass onProgress and onComplete callbacks to visualize the loading process.
  8331. !#zh LoadingItems 的构造函数,这种构造方式会重用内部对象缓冲池中的 LoadingItems 队列,以尽量避免对象创建。
  8332. 你可以传递 onProgress 和 onComplete 回调函数来获知加载进度信息。
  8333. @param pipeline The pipeline to process the queue.
  8334. @param urlList The items array.
  8335. @param onProgress The progression callback, refer to {{#crossLink "LoadingItems.onProgress"}}{{/crossLink}}
  8336. @param onComplete The completion callback, refer to {{#crossLink "LoadingItems.onComplete"}}{{/crossLink}}
  8337. @example
  8338. ```js
  8339. cc.LoadingItems.create(cc.loader, ['a.png', 'b.plist'], function (completedCount, totalCount, item) {
  8340. var progress = (100 * completedCount / totalCount).toFixed(2);
  8341. cc.log(progress + '%');
  8342. }, function (errors, items) {
  8343. if (errors) {
  8344. for (var i = 0; i < errors.length; ++i) {
  8345. cc.log('Error url: ' + errors[i] + ', error: ' + items.getError(errors[i]));
  8346. }
  8347. }
  8348. else {
  8349. var result_a = items.getContent('a.png');
  8350. // ...
  8351. }
  8352. })
  8353. ```
  8354. */
  8355. static create(pipeline: Pipeline, urlList: any[], onProgress: Function, onComplete: Function): LoadingItems;
  8356. /**
  8357. !#en Retrieve the LoadingItems queue object for an item.
  8358. !#zh 通过 item 对象获取它的 LoadingItems 队列。
  8359. @param item The item to query
  8360. */
  8361. static getQueue(item: any): LoadingItems;
  8362. /**
  8363. !#en Complete an item in the LoadingItems queue, please do not call this method unless you know what's happening.
  8364. !#zh 通知 LoadingItems 队列一个 item 对象已完成,请不要调用这个函数,除非你知道自己在做什么。
  8365. @param item The item which has completed
  8366. */
  8367. static itemComplete(item: any): void;
  8368. /**
  8369. !#en Add urls to the LoadingItems queue.
  8370. !#zh 向一个 LoadingItems 队列添加加载项。
  8371. @param urlList The url list to be appended, the url can be object or string
  8372. */
  8373. append(urlList: any[]): any[];
  8374. /**
  8375. !#en Complete a LoadingItems queue, please do not call this method unless you know what's happening.
  8376. !#zh 完成一个 LoadingItems 队列,请不要调用这个函数,除非你知道自己在做什么。
  8377. */
  8378. allComplete(): void;
  8379. /**
  8380. !#en Check whether all items are completed.
  8381. !#zh 检查是否所有加载项都已经完成。
  8382. */
  8383. isCompleted(): boolean;
  8384. /**
  8385. !#en Check whether an item is completed.
  8386. !#zh 通过 id 检查指定加载项是否已经加载完成。
  8387. @param id The item's id.
  8388. */
  8389. isItemCompleted(id: string): boolean;
  8390. /**
  8391. !#en Check whether an item exists.
  8392. !#zh 通过 id 检查加载项是否存在。
  8393. @param id The item's id.
  8394. */
  8395. exists(id: string): boolean;
  8396. /**
  8397. !#en Returns the content of an internal item.
  8398. !#zh 通过 id 获取指定对象的内容。
  8399. @param id The item's id.
  8400. */
  8401. getContent(id: string): any;
  8402. /**
  8403. !#en Returns the error of an internal item.
  8404. !#zh 通过 id 获取指定对象的错误信息。
  8405. @param id The item's id.
  8406. */
  8407. getError(id: string): any;
  8408. /**
  8409. !#en Add a listener for an item, the callback will be invoked when the item is completed.
  8410. !#zh 监听加载项(通过 key 指定)的完成事件。
  8411. @param key key
  8412. @param callback can be null
  8413. @param target can be null
  8414. */
  8415. addListener(key: string, callback: Function, target: any): boolean;
  8416. /**
  8417. !#en
  8418. Check if the specified key has any registered callback.
  8419. If a callback is also specified, it will only return true if the callback is registered.
  8420. !#zh
  8421. 检查指定的加载项是否有完成事件监听器。
  8422. 如果同时还指定了一个回调方法,并且回调有注册,它只会返回 true。
  8423. @param key key
  8424. @param callback callback
  8425. @param target target
  8426. */
  8427. hasListener(key: string, callback?: Function, target?: any): boolean;
  8428. /**
  8429. !#en
  8430. Removes a listener.
  8431. It will only remove when key, callback, target all match correctly.
  8432. !#zh
  8433. 移除指定加载项已经注册的完成事件监听器。
  8434. 只会删除 key, callback, target 均匹配的监听器。
  8435. @param key key
  8436. @param callback callback
  8437. @param target target
  8438. */
  8439. remove(key: string, callback: Function, target: any): boolean;
  8440. /**
  8441. !#en
  8442. Removes all callbacks registered in a certain event
  8443. type or all callbacks registered with a certain target.
  8444. !#zh 删除指定目标的所有完成事件监听器。
  8445. @param key The event key to be removed or the target to be removed
  8446. */
  8447. removeAllListeners(key: string|any): void;
  8448. /**
  8449. !#en Complete an item in the LoadingItems queue, please do not call this method unless you know what's happening.
  8450. !#zh 通知 LoadingItems 队列一个 item 对象已完成,请不要调用这个函数,除非你知道自己在做什么。
  8451. @param id The item url
  8452. */
  8453. itemComplete(id: string): void;
  8454. /**
  8455. !#en Destroy the LoadingItems queue, the queue object won't be garbage collected, it will be recycled, so every after destroy is not reliable.
  8456. !#zh 销毁一个 LoadingItems 队列,这个队列对象会被内部缓冲池回收,所以销毁后的所有内部信息都是不可依赖的。
  8457. */
  8458. destroy(): void;
  8459. }
  8460. /** !#en
  8461. A pipeline describes a sequence of manipulations, each manipulation is called a pipe.<br/>
  8462. It's designed for loading process. so items should be urls, and the url will be the identity of each item during the process.<br/>
  8463. A list of items can flow in the pipeline and it will output the results of all pipes.<br/>
  8464. They flow in the pipeline like water in tubes, they go through pipe by pipe separately.<br/>
  8465. Finally all items will flow out the pipeline and the process is finished.
  8466. !#zh
  8467. pipeline 描述了一系列的操作,每个操作都被称为 pipe。<br/>
  8468. 它被设计来做加载过程的流程管理。所以 item 应该是 url,并且该 url 将是在处理中的每个 item 的身份标识。<br/>
  8469. 一个 item 列表可以在 pipeline 中流动,它将输出加载项经过所有 pipe 之后的结果。<br/>
  8470. 它们穿过 pipeline 就像水在管子里流动,将会按顺序流过每个 pipe。<br/>
  8471. 最后当所有加载项都流出 pipeline 时,整个加载流程就结束了。 */
  8472. export class Pipeline {
  8473. /**
  8474. !#en
  8475. Constructor, pass an array of pipes to construct a new Pipeline,
  8476. the pipes will be chained in the given order.<br/>
  8477. A pipe is an object which must contain an `id` in string and a `handle` function,
  8478. the id must be unique in the pipeline.<br/>
  8479. It can also include `async` property to identify whether it's an asynchronous process.
  8480. !#zh
  8481. 构造函数,通过一系列的 pipe 来构造一个新的 pipeline,pipes 将会在给定的顺序中被锁定。<br/>
  8482. 一个 pipe 就是一个对象,它包含了字符串类型的 ‘id’ 和 ‘handle’ 函数,在 pipeline 中 id 必须是唯一的。<br/>
  8483. 它还可以包括 ‘async’ 属性以确定它是否是一个异步过程。
  8484. @param pipes pipes
  8485. @example
  8486. ```js
  8487. var pipeline = new Pipeline([
  8488. {
  8489. id: 'Downloader',
  8490. handle: function (item, callback) {},
  8491. async: true
  8492. },
  8493. {id: 'Parser', handle: function (item) {}, async: false}
  8494. ]);
  8495. ```
  8496. */
  8497. constructor(pipes: any[]);
  8498. /**
  8499. !#en
  8500. Insert a new pipe at the given index of the pipeline. <br/>
  8501. A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.
  8502. !#zh
  8503. 在给定的索引位置插入一个新的 pipe。<br/>
  8504. 一个 pipe 必须包含一个字符串类型的 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。
  8505. @param pipe The pipe to be inserted
  8506. @param index The index to insert
  8507. */
  8508. insertPipe(pipe: any, index: number): void;
  8509. /**
  8510. !en
  8511. Insert a pipe to the end of an existing pipe. The existing pipe must be a valid pipe in the pipeline.
  8512. !zh
  8513. 在当前 pipeline 的一个已知 pipe 后面插入一个新的 pipe。
  8514. @param refPipe An existing pipe in the pipeline.
  8515. @param newPipe The pipe to be inserted.
  8516. */
  8517. insertPipeAfter(refPipe: any, newPipe: any): void;
  8518. /**
  8519. !#en
  8520. Add a new pipe at the end of the pipeline. <br/>
  8521. A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.
  8522. !#zh
  8523. 添加一个新的 pipe 到 pipeline 尾部。 <br/>
  8524. 该 pipe 必须包含一个字符串类型 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。
  8525. @param pipe The pipe to be appended
  8526. */
  8527. appendPipe(pipe: any): void;
  8528. /**
  8529. !#en
  8530. Let new items flow into the pipeline. <br/>
  8531. Each item can be a simple url string or an object,
  8532. if it's an object, it must contain `id` property. <br/>
  8533. You can specify its type by `type` property, by default, the type is the extension name in url. <br/>
  8534. By adding a `skips` property including pipe ids, you can skip these pipe. <br/>
  8535. The object can contain any supplementary property as you want. <br/>
  8536. !#zh
  8537. 让新的 item 流入 pipeline 中。<br/>
  8538. 这里的每个 item 可以是一个简单字符串类型的 url 或者是一个对象,
  8539. 如果它是一个对象的话,他必须要包含 ‘id’ 属性。<br/>
  8540. 你也可以指定它的 ‘type’ 属性类型,默认情况下,该类型是 ‘url’ 的后缀名。<br/>
  8541. 也通过添加一个 包含 ‘skips’ 属性的 item 对象,你就可以跳过 skips 中包含的 pipe。<br/>
  8542. 该对象可以包含任何附加属性。
  8543. @param items items
  8544. @example
  8545. ```js
  8546. pipeline.flowIn([
  8547. 'res/Background.png',
  8548. {
  8549. id: 'res/scene.json',
  8550. type: 'scene',
  8551. name: 'scene',
  8552. skips: ['Downloader']
  8553. }
  8554. ]);
  8555. ```
  8556. */
  8557. flowIn(items: any[]): void;
  8558. /**
  8559. !#en
  8560. Copy the item states from one source item to all destination items. <br/>
  8561. It's quite useful when a pipe generate new items from one source item,<br/>
  8562. then you should flowIn these generated items into pipeline, <br/>
  8563. but you probably want them to skip all pipes the source item already go through,<br/>
  8564. you can achieve it with this API. <br/>
  8565. <br/>
  8566. For example, an unzip pipe will generate more items, but you won't want them to pass unzip or download pipe again.
  8567. !#zh
  8568. 从一个源 item 向所有目标 item 复制它的 pipe 状态,用于避免重复通过部分 pipe。<br/>
  8569. 当一个源 item 生成了一系列新的 items 时很有用,<br/>
  8570. 你希望让这些新的依赖项进入 pipeline,但是又不希望它们通过源 item 已经经过的 pipe,<br/>
  8571. 但是你可能希望他们源 item 已经通过并跳过所有 pipes,<br/>
  8572. 这个时候就可以使用这个 API。
  8573. @param srcItem The source item
  8574. @param dstItems A single destination item or an array of destination items
  8575. */
  8576. copyItemStates(srcItem: any, dstItems: any[]|any): void;
  8577. /**
  8578. !#en Returns an item in pipeline.
  8579. !#zh 根据 id 获取一个 item
  8580. @param id The id of the item
  8581. */
  8582. getItem(id: any): any;
  8583. /**
  8584. !#en Removes an completed item in pipeline.
  8585. It will only remove the cache in the pipeline or loader, its dependencies won't be released.
  8586. cc.loader provided another method to completely cleanup the resource and its dependencies,
  8587. please refer to {{#crossLink "loader/release:method"}}cc.loader.release{{/crossLink}}
  8588. !#zh 移除指定的已完成 item。
  8589. 这将仅仅从 pipeline 或者 loader 中删除其缓存,并不会释放它所依赖的资源。
  8590. cc.loader 中提供了另一种删除资源及其依赖的清理方法,请参考 {{#crossLink "loader/release:method"}}cc.loader.release{{/crossLink}}
  8591. @param id The id of the item
  8592. */
  8593. removeItem(id: any): boolean;
  8594. /**
  8595. !#en Clear the current pipeline, this function will clean up the items.
  8596. !#zh 清空当前 pipeline,该函数将清理 items。
  8597. */
  8598. clear(): void;
  8599. }
  8600. /** undefined */
  8601. export class WorldManifold {
  8602. /** !#en
  8603. world contact point (point of intersection)
  8604. !#zh
  8605. 碰撞点集合 */
  8606. points: [Vec2];
  8607. /** !#en
  8608. world vector pointing from A to B
  8609. !#zh
  8610. 世界坐标系下由 A 指向 B 的向量 */
  8611. normal: Vec2;
  8612. }
  8613. /** !#en
  8614. A manifold point is a contact point belonging to a contact manifold.
  8615. It holds details related to the geometry and dynamics of the contact points.
  8616. Note: the impulses are used for internal caching and may not
  8617. provide reliable contact forces, especially for high speed collisions.
  8618. !#zh
  8619. ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  8620. 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。 */
  8621. export class ManifoldPoint {
  8622. /** !#en
  8623. The local point usage depends on the manifold type:
  8624. -e_circles: the local center of circleB
  8625. -e_faceA: the local center of circleB or the clip point of polygonB
  8626. -e_faceB: the clip point of polygonA
  8627. !#zh
  8628. 本地坐标点的用途取决于 manifold 的类型
  8629. - e_circles: circleB 的本地中心点
  8630. - e_faceA: circleB 的本地中心点 或者是 polygonB 的截取点
  8631. - e_faceB: polygonB 的截取点 */
  8632. localPoint: Vec2;
  8633. /** !#en
  8634. Normal impulse.
  8635. !#zh
  8636. 法线冲量。 */
  8637. normalImpulse: number;
  8638. /** !#en
  8639. Tangent impulse.
  8640. !#zh
  8641. 切线冲量。 */
  8642. tangentImpulse: number;
  8643. }
  8644. /** undefined */
  8645. export class Manifold {
  8646. /** !#en
  8647. Manifold type : 0: e_circles, 1: e_faceA, 2: e_faceB
  8648. !#zh
  8649. Manifold 类型 : 0: e_circles, 1: e_faceA, 2: e_faceB */
  8650. type: number;
  8651. /** !#en
  8652. The local point usage depends on the manifold type:
  8653. -e_circles: the local center of circleA
  8654. -e_faceA: the center of faceA
  8655. -e_faceB: the center of faceB
  8656. !#zh
  8657. 用途取决于 manifold 类型
  8658. -e_circles: circleA 的本地中心点
  8659. -e_faceA: faceA 的本地中心点
  8660. -e_faceB: faceB 的本地中心点 */
  8661. localPoint: Vec2;
  8662. /** !#en
  8663. -e_circles: not used
  8664. -e_faceA: the normal on polygonA
  8665. -e_faceB: the normal on polygonB
  8666. !#zh
  8667. -e_circles: 没被使用到
  8668. -e_faceA: polygonA 的法向量
  8669. -e_faceB: polygonB 的法向量 */
  8670. localNormal: Vec2;
  8671. /** !#en
  8672. the points of contact.
  8673. !#zh
  8674. 接触点信息。 */
  8675. points: [ManifoldPoint];
  8676. }
  8677. /** !#en
  8678. Contact impulses for reporting.
  8679. !#zh
  8680. 用于返回给回调的接触冲量。 */
  8681. export class PhysicsImpulse {
  8682. /** !#en
  8683. Normal impulses.
  8684. !#zh
  8685. 法线方向的冲量 */
  8686. normalImpulses: void;
  8687. /** !#en
  8688. Tangent impulses
  8689. !#zh
  8690. 切线方向的冲量 */
  8691. tangentImpulses: void;
  8692. }
  8693. /** !#en
  8694. PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  8695. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  8696. !#zh
  8697. 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  8698. 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。 */
  8699. export class PhysicsContact {
  8700. /**
  8701. !#en
  8702. Get the world manifold.
  8703. !#zh
  8704. 获取世界坐标系下的碰撞信息。
  8705. */
  8706. getWorldManifold(): WorldManifold;
  8707. /**
  8708. !#en
  8709. Get the manifold.
  8710. !#zh
  8711. 获取本地(局部)坐标系下的碰撞信息。
  8712. */
  8713. getManifold(): Manifold;
  8714. /**
  8715. !#en
  8716. Get the impulses.
  8717. Note: PhysicsImpulse can only used in onPostSolve callback.
  8718. !#zh
  8719. 获取冲量信息
  8720. 注意:这个信息只有在 onPostSolve 回调中才能获取到
  8721. */
  8722. getImpulse(): PhysicsImpulse;
  8723. colliderA: Collider;
  8724. colliderB: Collider;
  8725. /** !#en
  8726. If set disabled to true, the contact will be ignored until contact end.
  8727. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  8728. !#zh
  8729. 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  8730. 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。 */
  8731. disabled: boolean;
  8732. /** !#en
  8733. Disabled contact for current time step or sub-step.
  8734. !#zh
  8735. 在当前时间步或子步中忽略此接触。 */
  8736. disabledOnce: boolean;
  8737. /**
  8738. !#en
  8739. Is this contact touching?
  8740. !#zh
  8741. 返回碰撞体是否已经接触到。
  8742. */
  8743. isTouching(): boolean;
  8744. /**
  8745. !#en
  8746. Set the desired tangent speed for a conveyor belt behavior.
  8747. !#zh
  8748. 为传送带设置期望的切线速度
  8749. @param tangentSpeed tangentSpeed
  8750. */
  8751. setTangentSpeed(tangentSpeed: number): void;
  8752. /**
  8753. !#en
  8754. Get the desired tangent speed.
  8755. !#zh
  8756. 获取切线速度
  8757. */
  8758. getTangentSpeed(): number;
  8759. /**
  8760. !#en
  8761. Override the default friction mixture. You can call this in onPreSolve callback.
  8762. !#zh
  8763. 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  8764. @param friction friction
  8765. */
  8766. setFriction(friction: number): void;
  8767. /**
  8768. !#en
  8769. Get the friction.
  8770. !#zh
  8771. 获取当前摩擦力系数
  8772. */
  8773. getFriction(): number;
  8774. /**
  8775. !#en
  8776. Reset the friction mixture to the default value.
  8777. !#zh
  8778. 重置摩擦力系数到默认值
  8779. */
  8780. resetFriction(): void;
  8781. /**
  8782. !#en
  8783. Override the default restitution mixture. You can call this in onPreSolve callback.
  8784. !#zh
  8785. 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  8786. @param restitution restitution
  8787. */
  8788. setRestitution(restitution: number): void;
  8789. /**
  8790. !#en
  8791. Get the restitution.
  8792. !#zh
  8793. 获取当前恢复系数
  8794. */
  8795. getRestitution(): number;
  8796. /**
  8797. !#en
  8798. Reset the restitution mixture to the default value.
  8799. !#zh
  8800. 重置恢复系数到默认值
  8801. */
  8802. resetRestitution(): void;
  8803. }
  8804. /** !#en
  8805. Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node).
  8806. You can visit some common box2d function through physics manager(hit testing, raycast, debug info).
  8807. Physics manager distributes the collision information to each collision callback when collision is produced.
  8808. Note: You need first enable the collision listener in the rigidbody.
  8809. !#zh
  8810. 物理系统将 box2d 作为内部物理系统,并且隐藏了大部分 box2d 实现细节(比如创建刚体,同步刚体信息到节点中等)。
  8811. 你可以通过物理系统访问一些 box2d 常用的功能,比如点击测试,射线测试,设置测试信息等。
  8812. 物理系统还管理碰撞信息的分发,她会在产生碰撞时,将碰撞信息分发到各个碰撞回调中。
  8813. 注意:你需要先在刚体中开启碰撞接听才会产生相应的碰撞回调。 */
  8814. export class PhysicsManager implements EventTarget {
  8815. /** !#en
  8816. The draw bits for drawing physics debug information.
  8817. !#zh
  8818. 指定物理系统需要绘制哪些调试信息。 */
  8819. static DrawBits: DrawBits;
  8820. /** !#en
  8821. The ratio transform between physics unit and pixel unit, generally is 32.
  8822. !#zh
  8823. 物理单位与像素单位互相转换的比率,一般是 32。 */
  8824. static PTM_RATIO: number;
  8825. /** !#en
  8826. The velocity iterations for the velocity constraint solver.
  8827. !#zh
  8828. 速度更新迭代数 */
  8829. static VELOCITY_ITERATIONS: number;
  8830. /** !#en
  8831. The position Iterations for the position constraint solver.
  8832. !#zh
  8833. 位置迭代更新数 */
  8834. static POSITION_ITERATIONS: number;
  8835. /** !#en
  8836. Specify the fixed time step.
  8837. Need enabledAccumulator to make it work.
  8838. !#zh
  8839. 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 */
  8840. static FIXED_TIME_STEP: number;
  8841. /** !#en
  8842. Specify the max accumulator time.
  8843. Need enabledAccumulator to make it work.
  8844. !#zh
  8845. 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 */
  8846. static MAX_ACCUMULATOR: number;
  8847. /** !#en
  8848. If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP.
  8849. And if the update dt is bigger than the time step, then will call step function several times.
  8850. If disabled accumulator, then will call step function with a time step calculated with the frame rate.
  8851. !#zh
  8852. 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。
  8853. 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 */
  8854. enabledAccumulator: boolean;
  8855. /**
  8856. !#en
  8857. Test which collider contains the given world point
  8858. !#zh
  8859. 获取包含给定世界坐标系点的碰撞体
  8860. @param point the world point
  8861. */
  8862. testPoint(point: Vec2): PhysicsCollider;
  8863. /**
  8864. !#en
  8865. Test which colliders intersect the given world rect
  8866. !#zh
  8867. 获取与给定世界坐标系矩形相交的碰撞体
  8868. @param rect the world rect
  8869. */
  8870. testAABB(rect: Rect): [PhysicsCollider];
  8871. /**
  8872. !#en
  8873. Raycast the world for all colliders in the path of the ray.
  8874. The raycast ignores colliders that contain the starting point.
  8875. !#zh
  8876. 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  8877. @param p1 start point of the raycast
  8878. @param p2 end point of the raycast
  8879. @param type optional, default is RayCastType.Closest
  8880. */
  8881. rayCast(p1: Vec2, p2: Vec2, type: RayCastType): [PhysicsRayCastResult];
  8882. /** !#en
  8883. Enabled the physics manager?
  8884. !#zh
  8885. 指定是否启用物理系统? */
  8886. enabled: boolean;
  8887. /** !#en
  8888. Debug draw flags.
  8889. !#zh
  8890. 设置调试绘制标志 */
  8891. debugDrawFlags: number;
  8892. /** !#en
  8893. The physics world gravity.
  8894. !#zh
  8895. 物理世界重力值 */
  8896. gravity: Vec2;
  8897. /**
  8898. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  8899. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  8900. @param type The type of event.
  8901. */
  8902. hasEventListener(type: string): boolean;
  8903. /**
  8904. !#en
  8905. Register an callback of a specific event type on the EventTarget.
  8906. This type of event should be triggered via `emit`.
  8907. !#zh
  8908. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  8909. @param type A string representing the event type to listen for.
  8910. @param callback The callback that will be invoked when the event is dispatched.
  8911. The callback is ignored if it is a duplicate (the callbacks are unique).
  8912. @param target The target (this object) to invoke the callback, can be null
  8913. @example
  8914. ```js
  8915. eventTarget.on('fire', function () {
  8916. cc.log("fire in the hole");
  8917. }, node);
  8918. ```
  8919. */
  8920. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  8921. /**
  8922. !#en
  8923. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  8924. if only type is passed as parameter, all listeners registered with that type will be removed.
  8925. !#zh
  8926. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  8927. @param type A string representing the event type being removed.
  8928. @param callback The callback to remove.
  8929. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  8930. @example
  8931. ```js
  8932. // register fire eventListener
  8933. var callback = eventTarget.on('fire', function () {
  8934. cc.log("fire in the hole");
  8935. }, target);
  8936. // remove fire event listener
  8937. eventTarget.off('fire', callback, target);
  8938. // remove all fire event listeners
  8939. eventTarget.off('fire');
  8940. ```
  8941. */
  8942. off(type: string, callback?: Function, target?: any): void;
  8943. /**
  8944. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  8945. This is not for removing all listeners in the current event target,
  8946. and this is not for removing all listeners the target parameter have registered.
  8947. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  8948. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  8949. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  8950. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  8951. @param target The target to be searched for all related listeners
  8952. */
  8953. targetOff(target: any): void;
  8954. /**
  8955. !#en
  8956. Register an callback of a specific event type on the EventTarget,
  8957. the callback will remove itself after the first time it is triggered.
  8958. !#zh
  8959. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  8960. @param type A string representing the event type to listen for.
  8961. @param callback The callback that will be invoked when the event is dispatched.
  8962. The callback is ignored if it is a duplicate (the callbacks are unique).
  8963. @param target The target (this object) to invoke the callback, can be null
  8964. @example
  8965. ```js
  8966. eventTarget.once('fire', function () {
  8967. cc.log("this is the callback and will be invoked only once");
  8968. }, node);
  8969. ```
  8970. */
  8971. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  8972. /**
  8973. !#en
  8974. Trigger an event directly with the event name and necessary arguments.
  8975. !#zh
  8976. 通过事件名发送自定义事件
  8977. @param type event type
  8978. @param arg1 First argument
  8979. @param arg2 Second argument
  8980. @param arg3 Third argument
  8981. @param arg4 Fourth argument
  8982. @param arg5 Fifth argument
  8983. @example
  8984. ```js
  8985. eventTarget.emit('fire', event);
  8986. eventTarget.emit('fire', message, emitter);
  8987. ```
  8988. */
  8989. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  8990. /**
  8991. !#en
  8992. Send an event with the event object.
  8993. !#zh
  8994. 通过事件对象派发事件
  8995. @param event event
  8996. */
  8997. dispatchEvent(event: Event): void;
  8998. }
  8999. /** undefined */
  9000. export enum DrawBits {
  9001. e_aabbBit = 0,
  9002. e_jointBit = 0,
  9003. e_shapeBit = 0,
  9004. }
  9005. /** undefined */
  9006. export class PhysicsRayCastResult {
  9007. /** !#en
  9008. The PhysicsCollider which intersects with the raycast
  9009. !#zh
  9010. 与射线相交的碰撞体 */
  9011. collider: PhysicsCollider;
  9012. /** !#en
  9013. The intersection point
  9014. !#zh
  9015. 射线与碰撞体相交的点 */
  9016. point: Vec2;
  9017. /** !#en
  9018. The normal vector at the point of intersection
  9019. !#zh
  9020. 射线与碰撞体相交的点的法向量 */
  9021. normal: Vec2;
  9022. /** !#en
  9023. The fraction of the raycast path at the point of intersection
  9024. !#zh
  9025. 射线与碰撞体相交的点占射线长度的分数 */
  9026. fraction: number;
  9027. }
  9028. /** !#en Enum for RigidBodyType.
  9029. !#zh 刚体类型 */
  9030. export enum RigidBodyType {
  9031. Static = 0,
  9032. Kinematic = 0,
  9033. Dynamic = 0,
  9034. Animated = 0,
  9035. }
  9036. /** !#en Enum for RayCastType.
  9037. !#zh 射线检测类型 */
  9038. export enum RayCastType {
  9039. Closest = 0,
  9040. Any = 0,
  9041. AllClosest = 0,
  9042. All = 0,
  9043. }
  9044. /** undefined */
  9045. export class RigidBody extends Component {
  9046. /** !#en
  9047. Should enabled contact listener?
  9048. When a collision is trigger, the collision callback will only be called when enabled contact listener.
  9049. !#zh
  9050. 是否启用接触接听器。
  9051. 当 collider 产生碰撞时,只有开启了接触接听器才会调用相应的回调函数 */
  9052. enabledContactListener: boolean;
  9053. /**
  9054. !#en
  9055. Collision callback.
  9056. Called when two collider begin to touch.
  9057. !#zh
  9058. 碰撞回调。
  9059. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体开始接触时被调用。
  9060. @param contact contact information
  9061. @param selfCollider the collider belong to this rigidbody
  9062. @param otherCollider the collider belong to another rigidbody
  9063. */
  9064. onBeginContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9065. /**
  9066. !#en
  9067. Collision callback.
  9068. Called when two collider cease to touch.
  9069. !#zh
  9070. 碰撞回调。
  9071. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体停止接触时被调用。
  9072. @param contact contact information
  9073. @param selfCollider the collider belong to this rigidbody
  9074. @param otherCollider the collider belong to another rigidbody
  9075. */
  9076. onEndContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9077. /**
  9078. !#en
  9079. Collision callback.
  9080. This is called when a contact is updated.
  9081. This allows you to inspect a contact before it goes to the solver(e.g. disable contact).
  9082. Note: this is called only for awake bodies.
  9083. Note: this is called even when the number of contact points is zero.
  9084. Note: this is not called for sensors.
  9085. !#zh
  9086. 碰撞回调。
  9087. 如果你的脚本中实现了这个函数,那么它将会在接触更新时被调用。
  9088. 你可以在接触被处理前根据他包含的信息作出相应的处理,比如将这个接触禁用掉。
  9089. 注意:回调只会为醒着的刚体调用。
  9090. 注意:接触点为零的时候也有可能被调用。
  9091. 注意:感知体(sensor)的回调不会被调用。
  9092. @param contact contact information
  9093. @param selfCollider the collider belong to this rigidbody
  9094. @param otherCollider the collider belong to another rigidbody
  9095. */
  9096. onPreSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9097. /**
  9098. !#en
  9099. Collision callback.
  9100. This is called after a contact is updated.
  9101. You can get the impulses from the contact in this callback.
  9102. !#zh
  9103. 碰撞回调。
  9104. 如果你的脚本中实现了这个函数,那么它将会在接触更新完后被调用。
  9105. 你可以在这个回调中从接触信息中获取到冲量信息。
  9106. @param contact contact information
  9107. @param selfCollider the collider belong to this rigidbody
  9108. @param otherCollider the collider belong to another rigidbody
  9109. */
  9110. onPostSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9111. /** !#en
  9112. Is this a fast moving body that should be prevented from tunneling through
  9113. other moving bodies?
  9114. Note :
  9115. - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  9116. - You should use this flag sparingly since it increases processing time.
  9117. !#zh
  9118. 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  9119. 需要注意的是 :
  9120. - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  9121. - 应该尽量少的使用此选项,因为它会增加程序处理时间。 */
  9122. bullet: boolean;
  9123. /** !#en
  9124. Rigidbody type : Static, Kinematic, Dynamic or Animated.
  9125. !#zh
  9126. 刚体类型: Static, Kinematic, Dynamic or Animated. */
  9127. type: RigidBodyType;
  9128. /** !#en
  9129. Set this flag to false if this body should never fall asleep.
  9130. Note that this increases CPU usage.
  9131. !#zh
  9132. 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  9133. 需要注意这将使 CPU 占用率提高。 */
  9134. allowSleep: boolean;
  9135. /** !#en
  9136. Scale the gravity applied to this body.
  9137. !#zh
  9138. 缩放应用在此刚体上的重力值 */
  9139. gravityScale: number;
  9140. /** !#en
  9141. Linear damping is use to reduce the linear velocity.
  9142. The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  9143. time step when the damping parameter is large.
  9144. !#zh
  9145. Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9146. linearDamping: number;
  9147. /** !#en
  9148. Angular damping is use to reduce the angular velocity. The damping parameter
  9149. can be larger than 1 but the damping effect becomes sensitive to the
  9150. time step when the damping parameter is large.
  9151. !#zh
  9152. Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9153. angularDamping: number;
  9154. /** !#en
  9155. The linear velocity of the body's origin in world co-ordinates.
  9156. !#zh
  9157. 刚体在世界坐标下的线性速度 */
  9158. linearVelocity: Vec2;
  9159. /** !#en
  9160. The angular velocity of the body.
  9161. !#zh
  9162. 刚体的角速度 */
  9163. angularVelocity: number;
  9164. /** !#en
  9165. Should this body be prevented from rotating?
  9166. !#zh
  9167. 是否禁止此刚体进行旋转 */
  9168. fixedRotation: boolean;
  9169. /** !#en
  9170. 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.)
  9171. !#zh
  9172. 设置刚体的睡眠状态。 睡眠的刚体具有非常低的 CPU 成本。(当刚体被碰撞到时,如果刚体处于睡眠状态,它会立即被唤醒) */
  9173. awake: boolean;
  9174. /** !#en
  9175. Whether to wake up this rigid body during initialization
  9176. !#zh
  9177. 是否在初始化时唤醒此刚体 */
  9178. awakeOnLoad: boolean;
  9179. /** !#en
  9180. Set the active state of the body. An inactive body is not
  9181. simulated and cannot be collided with or woken up.
  9182. If body is active, all fixtures will be added to the
  9183. broad-phase.
  9184. If body is inactive, all fixtures will be removed from
  9185. the broad-phase and all contacts will be destroyed.
  9186. Fixtures on an inactive body are implicitly inactive and will
  9187. not participate in collisions, ray-casts, or queries.
  9188. Joints connected to an inactive body are implicitly inactive.
  9189. !#zh
  9190. 设置刚体的激活状态。一个非激活状态下的刚体是不会被模拟和碰撞的,不管它是否处于睡眠状态下。
  9191. 如果刚体处于激活状态下,所有夹具会被添加到 粗测阶段(broad-phase)。
  9192. 如果刚体处于非激活状态下,所有夹具会被从 粗测阶段(broad-phase)中移除。
  9193. 在非激活状态下的夹具不会参与到碰撞,射线,或者查找中
  9194. 链接到非激活状态下刚体的关节也是非激活的。 */
  9195. active: boolean;
  9196. /**
  9197. !#en
  9198. Gets a local point relative to the body's origin given a world point.
  9199. !#zh
  9200. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  9201. @param worldPoint a point in world coordinates.
  9202. @param out optional, the receiving point
  9203. */
  9204. getLocalPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9205. /**
  9206. !#en
  9207. Get the world coordinates of a point given the local coordinates.
  9208. !#zh
  9209. 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点
  9210. @param localPoint a point in local coordinates.
  9211. @param out optional, the receiving point
  9212. */
  9213. getWorldPoint(localPoint: Vec2, out: Vec2): Vec2;
  9214. /**
  9215. !#en
  9216. Get the world coordinates of a vector given the local coordinates.
  9217. !#zh
  9218. 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量
  9219. @param localVector a vector in world coordinates.
  9220. @param out optional, the receiving vector
  9221. */
  9222. getWorldVector(localVector: Vec2, out: Vec2): Vec2;
  9223. /**
  9224. !#en
  9225. Gets a local vector relative to the body's origin given a world vector.
  9226. !#zh
  9227. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  9228. @param worldVector a vector in world coordinates.
  9229. @param out optional, the receiving vector
  9230. */
  9231. getLocalVector(worldVector: Vec2, out: Vec2): Vec2;
  9232. /**
  9233. !#en
  9234. Get the world body origin position.
  9235. !#zh
  9236. 获取刚体世界坐标系下的原点值
  9237. @param out optional, the receiving point
  9238. */
  9239. getWorldPosition(out: Vec2): Vec2;
  9240. /**
  9241. !#en
  9242. Get the world body rotation angle.
  9243. !#zh
  9244. 获取刚体世界坐标系下的旋转值。
  9245. */
  9246. getWorldRotation(): number;
  9247. /**
  9248. !#en
  9249. Get the local position of the center of mass.
  9250. !#zh
  9251. 获取刚体本地坐标系下的质心
  9252. */
  9253. getLocalCenter(): Vec2;
  9254. /**
  9255. !#en
  9256. Get the world position of the center of mass.
  9257. !#zh
  9258. 获取刚体世界坐标系下的质心
  9259. */
  9260. getWorldCenter(): Vec2;
  9261. /**
  9262. !#en
  9263. Get the world linear velocity of a world point attached to this body.
  9264. !#zh
  9265. 获取刚体上指定点的线性速度
  9266. @param worldPoint a point in world coordinates.
  9267. @param out optional, the receiving point
  9268. */
  9269. getLinearVelocityFromWorldPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9270. /**
  9271. !#en
  9272. Get total mass of the body.
  9273. !#zh
  9274. 获取刚体的质量。
  9275. */
  9276. getMass(): number;
  9277. /**
  9278. !#en
  9279. Get the rotational inertia of the body about the local origin.
  9280. !#zh
  9281. 获取刚体本地坐标系下原点的旋转惯性
  9282. */
  9283. getInertia(): number;
  9284. /**
  9285. !#en
  9286. Get all the joints connect to the rigidbody.
  9287. !#zh
  9288. 获取链接到此刚体的所有关节
  9289. */
  9290. getJointList(): [Joint];
  9291. /**
  9292. !#en
  9293. Apply a force at a world point. If the force is not
  9294. applied at the center of mass, it will generate a torque and
  9295. affect the angular velocity.
  9296. !#zh
  9297. 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  9298. @param force the world force vector.
  9299. @param point the world position.
  9300. @param wake also wake up the body.
  9301. */
  9302. applyForce(force: Vec2, point: Vec2, wake: boolean): void;
  9303. /**
  9304. !#en
  9305. Apply a force to the center of mass.
  9306. !#zh
  9307. 施加一个力到刚体上的质心上。
  9308. @param force the world force vector.
  9309. @param wake also wake up the body.
  9310. */
  9311. applyForceToCenter(force: Vec2, wake: boolean): void;
  9312. /**
  9313. !#en
  9314. Apply a torque. This affects the angular velocity.
  9315. !#zh
  9316. 施加一个扭矩力,将影响刚体的角速度
  9317. @param torque about the z-axis (out of the screen), usually in N-m.
  9318. @param wake also wake up the body
  9319. */
  9320. applyTorque(torque: number, wake: boolean): void;
  9321. /**
  9322. !#en
  9323. Apply a impulse at a world point, This immediately modifies the velocity.
  9324. If the impulse is not applied at the center of mass, it will generate a torque and
  9325. affect the angular velocity.
  9326. !#zh
  9327. 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  9328. 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  9329. @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
  9330. @param point the world position
  9331. @param wake alse wake up the body
  9332. */
  9333. applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
  9334. /**
  9335. !#en
  9336. Apply an angular impulse.
  9337. !#zh
  9338. 施加一个角速度冲量。
  9339. @param impulse the angular impulse in units of kg*m*m/s
  9340. @param wake also wake up the body
  9341. */
  9342. applyAngularImpulse(impulse: number, wake: boolean): void;
  9343. /**
  9344. !#en
  9345. Synchronize node's world position to box2d rigidbody's position.
  9346. If enableAnimated is true and rigidbody's type is Animated type,
  9347. will set linear velocity instead of directly set rigidbody's position.
  9348. !#zh
  9349. 同步节点的世界坐标到 box2d 刚体的坐标上。
  9350. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的线性速度来代替直接设置刚体的位置。
  9351. @param enableAnimated enableAnimated
  9352. */
  9353. syncPosition(enableAnimated: boolean): void;
  9354. /**
  9355. !#en
  9356. Synchronize node's world angle to box2d rigidbody's angle.
  9357. If enableAnimated is true and rigidbody's type is Animated type,
  9358. will set angular velocity instead of directly set rigidbody's angle.
  9359. !#zh
  9360. 同步节点的世界旋转角度值到 box2d 刚体的旋转值上。
  9361. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的角速度来代替直接设置刚体的角度。
  9362. @param enableAnimated enableAnimated
  9363. */
  9364. syncRotation(enableAnimated: boolean): void;
  9365. }
  9366. /** !#en the device accelerometer reports values for each axis in units of g-force.
  9367. !#zh 设备重力传感器传递的各个轴的数据。 */
  9368. export class constructor {
  9369. /**
  9370. whether enable accelerometer event
  9371. @param isEnable isEnable
  9372. */
  9373. setAccelerometerEnabled(isEnable: boolean): void;
  9374. /**
  9375. set accelerometer interval value
  9376. @param interval interval
  9377. */
  9378. setAccelerometerInterval(interval: number): void;
  9379. }
  9380. /** Predefined constants */
  9381. export class macro {
  9382. /** PI / 180 */
  9383. static RAD: number;
  9384. /** One degree */
  9385. static DEG: number;
  9386. static REPEAT_FOREVER: number;
  9387. static FLT_EPSILON: number;
  9388. /** Minimum z index value for node */
  9389. static MIN_ZINDEX: number;
  9390. /** Maximum z index value for node */
  9391. static MAX_ZINDEX: number;
  9392. static ONE: number;
  9393. static ZERO: number;
  9394. static SRC_ALPHA: number;
  9395. static SRC_ALPHA_SATURATE: number;
  9396. static SRC_COLOR: number;
  9397. static DST_ALPHA: number;
  9398. static DST_COLOR: number;
  9399. static ONE_MINUS_SRC_ALPHA: number;
  9400. static ONE_MINUS_SRC_COLOR: number;
  9401. static ONE_MINUS_DST_ALPHA: number;
  9402. static ONE_MINUS_DST_COLOR: number;
  9403. static ONE_MINUS_CONSTANT_ALPHA: number;
  9404. static ONE_MINUS_CONSTANT_COLOR: number;
  9405. /** Oriented vertically */
  9406. static ORIENTATION_PORTRAIT: number;
  9407. /** Oriented horizontally */
  9408. static ORIENTATION_LANDSCAPE: number;
  9409. /** Oriented automatically */
  9410. static ORIENTATION_AUTO: number;
  9411. /** <p>
  9412. If enabled, the texture coordinates will be calculated by using this formula: <br/>
  9413. - texCoord.left = (rect.x*2+1) / (texture.wide*2); <br/>
  9414. - texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2); <br/>
  9415. <br/>
  9416. The same for bottom and top. <br/>
  9417. <br/>
  9418. This formula prevents artifacts by using 99% of the texture. <br/>
  9419. The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel<br/>
  9420. <br/>
  9421. Affected component: <br/>
  9422. - cc.TMXLayer <br/>
  9423. <br/>
  9424. Enabled by default. To disabled set it to 0. <br/>
  9425. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
  9426. </p> */
  9427. static FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: number;
  9428. /** Position of the FPS (Default: 0,0 (bottom-left corner))<br/>
  9429. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h */
  9430. static DIRECTOR_STATS_POSITION: Vec2;
  9431. /** <p>
  9432. If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked. <br/>
  9433. 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/>
  9434. If disabled, only the last run action will take effect.
  9435. </p> */
  9436. static ENABLE_STACKABLE_ACTIONS: number;
  9437. /** !#en
  9438. The timeout to determine whether a touch is no longer active and should be removed.
  9439. The reason to add this timeout is due to an issue in X5 browser core,
  9440. when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  9441. no touch cancel event is triggered, and the touch will be considered active forever.
  9442. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  9443. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  9444. 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.
  9445. You can modify this value to have a better behavior if you find it's not enough.
  9446. !#zh
  9447. 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  9448. 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  9449. 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  9450. 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  9451. 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  9452. 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  9453. 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。 */
  9454. static TOUCH_TIMEOUT: number;
  9455. /** !#en
  9456. The maximum vertex count for a single batched draw call.
  9457. !#zh
  9458. 最大可以被单次批处理渲染的顶点数量。 */
  9459. static BATCH_VERTEX_COUNT: number;
  9460. /** !#en
  9461. 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.
  9462. !#zh
  9463. 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 的话,需要手动关闭,否则渲染会出错。 */
  9464. static ENABLE_TILEDMAP_CULLING: boolean;
  9465. /** !#en
  9466. The max concurrent task number for the downloader
  9467. !#zh
  9468. 下载任务的最大并发数限制,在安卓平台部分机型或版本上可能需要限制在较低的水平 */
  9469. static DOWNLOAD_MAX_CONCURRENT: number;
  9470. /** !#en
  9471. Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  9472. Though if you want to make your canvas background transparent and show other dom elements at the background,
  9473. you can set it to true before `cc.game.run`.
  9474. Web only.
  9475. !#zh
  9476. 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  9477. 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 `cc.game.run` 之前将这个值设为 true。
  9478. 仅支持 Web */
  9479. static ENABLE_TRANSPARENT_CANVAS: boolean;
  9480. /** !#en
  9481. Boolean that indicates if the WebGL context is created with `antialias` option turned on, default value is false.
  9482. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  9483. Whether to use this really depend on your game design and targeted platform,
  9484. device with retina display usually have good detail on graphics with or without this option,
  9485. you probably don't want antialias if your game style is pixel art based.
  9486. Also, it could have great performance impact with some browser / device using software MSAA.
  9487. You can set it to true before `cc.game.run`.
  9488. Web only.
  9489. !#zh
  9490. 用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。
  9491. 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  9492. 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  9493. 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  9494. 你可以在 `cc.game.run` 之前设置这个值,否则它不会生效。
  9495. 仅支持 Web */
  9496. static ENABLE_WEBGL_ANTIALIAS: boolean;
  9497. /** !#en
  9498. Whether or not enable auto culling.
  9499. This feature have been removed in v2.0 new renderer due to overall performance consumption.
  9500. We have no plan currently to re-enable auto culling.
  9501. If your game have more dynamic objects, we suggest to disable auto culling.
  9502. If your game have more static objects, we suggest to enable auto culling.
  9503. !#zh
  9504. 是否开启自动裁减功能,开启裁减功能将会把在屏幕外的物体从渲染队列中去除掉。
  9505. 这个功能在 v2.0 的新渲染器中被移除了,因为它在大多数游戏中所带来的损耗要高于性能的提升,目前我们没有计划重新支持自动裁剪。
  9506. 如果游戏中的动态物体比较多的话,建议将此选项关闭。
  9507. 如果游戏中的静态物体比较多的话,建议将此选项打开。 */
  9508. static ENABLE_CULLING: boolean;
  9509. /** !#en
  9510. Whether or not clear dom Image object cache after uploading to gl texture.
  9511. Concretely, we are setting image.src to empty string to release the cache.
  9512. Normally you don't need to enable this option, because on web the Image object doesn't consume too much memory.
  9513. But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  9514. So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
  9515. !#zh
  9516. 是否在将贴图上传至 GPU 之后删除 DOM Image 缓存。
  9517. 具体来说,我们通过设置 image.src 为空字符串来释放这部分内存。
  9518. 正常情况下,你不需要开启这个选项,因为在 web 平台,Image 对象所占用的内存很小。
  9519. 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  9520. 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 */
  9521. static CLEANUP_IMAGE_CACHE: boolean;
  9522. }
  9523. /** undefined */
  9524. export enum VerticalTextAlignment {
  9525. TOP = 0,
  9526. CENTER = 0,
  9527. BOTTOM = 0,
  9528. }
  9529. /** The base class of most of all the objects in Fireball. */
  9530. export class Object {
  9531. /** !#en The name of the object.
  9532. !#zh 该对象的名称。 */
  9533. name: string;
  9534. /** !#en
  9535. Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  9536. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  9537. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  9538. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  9539. but this is often caused by a particular logical requirements, which is not normally required.
  9540. !#zh
  9541. 表示该对象是否可用(被 destroy 后将不可用)。<br>
  9542. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。 */
  9543. isValid: boolean;
  9544. /**
  9545. !#en
  9546. Destroy this Object, and release all its own references to other objects.<br/>
  9547. Actual object destruction will delayed until before rendering.
  9548. From the next frame, this object is not usable any more.
  9549. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  9550. !#zh
  9551. 销毁该对象,并释放所有它对其它对象的引用。<br/>
  9552. 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  9553. 您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  9554. @example
  9555. ```js
  9556. obj.destroy();
  9557. ```
  9558. */
  9559. destroy(): boolean;
  9560. }
  9561. /** Bit mask that controls object states. */
  9562. export enum Flags {
  9563. DontSave = 0,
  9564. EditorOnly = 0,
  9565. }
  9566. /** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.
  9567. It's invalid on safari, QQbrowser and android browser */
  9568. export class screen {
  9569. /**
  9570. initialize
  9571. */
  9572. init(): void;
  9573. /**
  9574. return true if it's full now.
  9575. */
  9576. fullScreen(): boolean;
  9577. /**
  9578. change the screen to full mode.
  9579. @param element element
  9580. @param onFullScreenChange onFullScreenChange
  9581. */
  9582. requestFullScreen(element: Element, onFullScreenChange: Function): void;
  9583. /**
  9584. exit the full mode.
  9585. */
  9586. exitFullScreen(): boolean;
  9587. /**
  9588. Automatically request full screen with a touch/click event
  9589. @param element element
  9590. @param onFullScreenChange onFullScreenChange
  9591. */
  9592. autoFullScreen(element: Element, onFullScreenChange: Function): void;
  9593. }
  9594. /** System variables */
  9595. export class sys {
  9596. /** English language code */
  9597. static LANGUAGE_ENGLISH: string;
  9598. /** Chinese language code */
  9599. static LANGUAGE_CHINESE: string;
  9600. /** French language code */
  9601. static LANGUAGE_FRENCH: string;
  9602. /** Italian language code */
  9603. static LANGUAGE_ITALIAN: string;
  9604. /** German language code */
  9605. static LANGUAGE_GERMAN: string;
  9606. /** Spanish language code */
  9607. static LANGUAGE_SPANISH: string;
  9608. /** Spanish language code */
  9609. static LANGUAGE_DUTCH: string;
  9610. /** Russian language code */
  9611. static LANGUAGE_RUSSIAN: string;
  9612. /** Korean language code */
  9613. static LANGUAGE_KOREAN: string;
  9614. /** Japanese language code */
  9615. static LANGUAGE_JAPANESE: string;
  9616. /** Hungarian language code */
  9617. static LANGUAGE_HUNGARIAN: string;
  9618. /** Portuguese language code */
  9619. static LANGUAGE_PORTUGUESE: string;
  9620. /** Arabic language code */
  9621. static LANGUAGE_ARABIC: string;
  9622. /** Norwegian language code */
  9623. static LANGUAGE_NORWEGIAN: string;
  9624. /** Polish language code */
  9625. static LANGUAGE_POLISH: string;
  9626. /** Turkish language code */
  9627. static LANGUAGE_TURKISH: string;
  9628. /** Ukrainian language code */
  9629. static LANGUAGE_UKRAINIAN: string;
  9630. /** Romanian language code */
  9631. static LANGUAGE_ROMANIAN: string;
  9632. /** Bulgarian language code */
  9633. static LANGUAGE_BULGARIAN: string;
  9634. /** Unknown language code */
  9635. static LANGUAGE_UNKNOWN: string;
  9636. static OS_IOS: string;
  9637. static OS_ANDROID: string;
  9638. static OS_WINDOWS: string;
  9639. static OS_MARMALADE: string;
  9640. static OS_LINUX: string;
  9641. static OS_BADA: string;
  9642. static OS_BLACKBERRY: string;
  9643. static OS_OSX: string;
  9644. static OS_WP8: string;
  9645. static OS_WINRT: string;
  9646. static OS_UNKNOWN: string;
  9647. static UNKNOWN: number;
  9648. static WIN32: number;
  9649. static LINUX: number;
  9650. static MACOS: number;
  9651. static ANDROID: number;
  9652. static IPHONE: number;
  9653. static IPAD: number;
  9654. static BLACKBERRY: number;
  9655. static NACL: number;
  9656. static EMSCRIPTEN: number;
  9657. static TIZEN: number;
  9658. static WINRT: number;
  9659. static WP8: number;
  9660. static MOBILE_BROWSER: number;
  9661. static DESKTOP_BROWSER: number;
  9662. /** Indicates whether executes in editor's window process (Electron's renderer context) */
  9663. static EDITOR_PAGE: number;
  9664. /** Indicates whether executes in editor's main process (Electron's browser context) */
  9665. static EDITOR_CORE: number;
  9666. static WECHAT_GAME: number;
  9667. static QQ_PLAY: number;
  9668. static FB_PLAYABLE_ADS: number;
  9669. static BAIDU_GAME: number;
  9670. static VIVO_GAME: number;
  9671. static OPPO_GAME: number;
  9672. /** BROWSER_TYPE_WECHAT */
  9673. static BROWSER_TYPE_WECHAT: string;
  9674. /** BROWSER_TYPE_WECHAT_GAME */
  9675. static BROWSER_TYPE_WECHAT_GAME: string;
  9676. /** BROWSER_TYPE_WECHAT_GAME_SUB */
  9677. static BROWSER_TYPE_WECHAT_GAME_SUB: string;
  9678. /** BROWSER_TYPE_BAIDU_GAME */
  9679. static BROWSER_TYPE_BAIDU_GAME: string;
  9680. /** BROWSER_TYPE_BAIDU_GAME_SUB */
  9681. static BROWSER_TYPE_BAIDU_GAME_SUB: string;
  9682. /** BROWSER_TYPE_QQ_PLAY */
  9683. static BROWSER_TYPE_QQ_PLAY: string;
  9684. static BROWSER_TYPE_ANDROID: string;
  9685. static BROWSER_TYPE_IE: string;
  9686. static BROWSER_TYPE_QQ: string;
  9687. static BROWSER_TYPE_MOBILE_QQ: string;
  9688. static BROWSER_TYPE_UC: string;
  9689. /** uc third party integration. */
  9690. static BROWSER_TYPE_UCBS: string;
  9691. static BROWSER_TYPE_360: string;
  9692. static BROWSER_TYPE_BAIDU_APP: string;
  9693. static BROWSER_TYPE_BAIDU: string;
  9694. static BROWSER_TYPE_MAXTHON: string;
  9695. static BROWSER_TYPE_OPERA: string;
  9696. static BROWSER_TYPE_OUPENG: string;
  9697. static BROWSER_TYPE_MIUI: string;
  9698. static BROWSER_TYPE_FIREFOX: string;
  9699. static BROWSER_TYPE_SAFARI: string;
  9700. static BROWSER_TYPE_CHROME: string;
  9701. static BROWSER_TYPE_LIEBAO: string;
  9702. static BROWSER_TYPE_QZONE: string;
  9703. static BROWSER_TYPE_SOUGOU: string;
  9704. static BROWSER_TYPE_UNKNOWN: string;
  9705. /** Is native ? This is set to be true in jsb auto. */
  9706. static isNative: boolean;
  9707. /** Is web browser ? */
  9708. static isBrowser: boolean;
  9709. /** Indicate whether system is mobile system */
  9710. static isMobile: boolean;
  9711. /** Indicate the running platform */
  9712. static platform: number;
  9713. /** Get current language iso 639-1 code.
  9714. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc.
  9715. The actual value totally depends on results provided by destination platform. */
  9716. static languageCode: string;
  9717. /** Indicate the current language of the running system */
  9718. static language: string;
  9719. /** Indicate the running os name */
  9720. static os: string;
  9721. /** Indicate the running os version */
  9722. static osVersion: string;
  9723. /** Indicate the running os main version */
  9724. static osMainVersion: number;
  9725. /** Indicate the running browser type */
  9726. static browserType: string;
  9727. /** Indicate the running browser version */
  9728. static browserVersion: string;
  9729. /** Indicate the real pixel resolution of the whole game window */
  9730. static windowPixelResolution: Size;
  9731. /** cc.sys.localStorage is a local storage component. */
  9732. static localStorage: any;
  9733. /** The capabilities of the current platform */
  9734. static capabilities: any;
  9735. /**
  9736. !#en
  9737. Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
  9738. !#zh
  9739. 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  9740. */
  9741. static getNetworkType(): NetworkType;
  9742. /**
  9743. !#en
  9744. Get the battery level of current device, return 1.0 if failure.
  9745. !#zh
  9746. 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  9747. */
  9748. static getBatteryLevel(): number;
  9749. /**
  9750. Forces the garbage collection, only available in JSB
  9751. */
  9752. static garbageCollect(): void;
  9753. /**
  9754. Restart the JS VM, only available in JSB
  9755. */
  9756. static restartVM(): void;
  9757. /**
  9758. !#en
  9759. Return the safe area rect. <br/>
  9760. only available on the iOS native platform, otherwise it will return a rect with design resolution size.
  9761. !#zh
  9762. 返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。其它平台将默认返回设计分辨率尺寸。
  9763. */
  9764. static getSafeAreaRect(): Rect;
  9765. /**
  9766. Check whether an object is valid,
  9767. In web engine, it will return true if the object exist
  9768. In native engine, it will return true if the JS object and the correspond native object are both valid
  9769. @param obj obj
  9770. */
  9771. static isObjectValid(obj: any): boolean;
  9772. /**
  9773. Dump system informations
  9774. */
  9775. static dump(): void;
  9776. /**
  9777. Open a url in browser
  9778. @param url url
  9779. */
  9780. static openURL(url: string): void;
  9781. /**
  9782. Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
  9783. */
  9784. static now(): number;
  9785. }
  9786. /** !#en
  9787. Network type enumeration
  9788. !#zh
  9789. 网络类型枚举 */
  9790. export enum NetworkType {
  9791. NONE = 0,
  9792. LAN = 0,
  9793. WWAN = 0,
  9794. }
  9795. /** cc.view is the singleton object which represents the game window.<br/>
  9796. It's main task include: <br/>
  9797. - Apply the design resolution policy<br/>
  9798. - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>
  9799. - Manage the game view port which can be different with the window<br/>
  9800. - Manage the content scale and translation<br/>
  9801. <br/>
  9802. Since the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>
  9803. the standard way to use it is by calling:<br/>
  9804. - cc.view.methodName(); <br/> */
  9805. export class View {
  9806. /**
  9807. !#en
  9808. Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
  9809. 1. cc.macro.DENSITYDPI_DEVICE, value is "device-dpi" <br/>
  9810. 2. cc.macro.DENSITYDPI_HIGH, value is "high-dpi" (default value) <br/>
  9811. 3. cc.macro.DENSITYDPI_MEDIUM, value is "medium-dpi" (browser's default value) <br/>
  9812. 4. cc.macro.DENSITYDPI_LOW, value is "low-dpi" <br/>
  9813. 5. Custom value, e.g: "480" <br/>
  9814. !#zh 设置目标内容的每英寸像素点密度。
  9815. @param densityDPI densityDPI
  9816. */
  9817. setTargetDensityDPI(densityDPI: string): void;
  9818. /**
  9819. !#en
  9820. Returns the current target-densitydpi value of cc.view.
  9821. !#zh 获取目标内容的每英寸像素点密度。
  9822. */
  9823. getTargetDensityDPI(): string;
  9824. /**
  9825. !#en
  9826. Sets whether resize canvas automatically when browser's size changed.<br/>
  9827. Useful only on web.
  9828. !#zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  9829. 仅在 Web 模式下有效。
  9830. @param enabled Whether enable automatic resize with browser's resize event
  9831. */
  9832. resizeWithBrowserSize(enabled: boolean): void;
  9833. /**
  9834. !#en
  9835. Sets the callback function for cc.view's resize action,<br/>
  9836. this callback will be invoked before applying resolution policy, <br/>
  9837. so you can do any additional modifications within the callback.<br/>
  9838. Useful only on web.
  9839. !#zh 设置 cc.view 调整视窗尺寸行为的回调函数,
  9840. 这个回调函数会在应用适配模式之前被调用,
  9841. 因此你可以在这个回调函数内添加任意附加改变,
  9842. 仅在 Web 平台下有效。
  9843. @param callback The callback function
  9844. */
  9845. setResizeCallback(callback: Function|void): void;
  9846. /**
  9847. !#en
  9848. Sets the orientation of the game, it can be landscape, portrait or auto.
  9849. When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  9850. cc.view will automatically rotate the game canvas using CSS.
  9851. Note that this function doesn't have any effect in native,
  9852. in native, you need to set the application orientation in native project settings
  9853. !#zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  9854. 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  9855. cc.view 会自动用 CSS 旋转游戏场景的 canvas,
  9856. 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  9857. @param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO
  9858. */
  9859. setOrientation(orientation: number): void;
  9860. /**
  9861. !#en
  9862. Sets whether the engine modify the "viewport" meta in your web page.<br/>
  9863. It's enabled by default, we strongly suggest you not to disable it.<br/>
  9864. And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  9865. Only useful on web
  9866. !#zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  9867. 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  9868. 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  9869. 仅在 Web 模式下有效
  9870. @param enabled Enable automatic modification to "viewport" meta
  9871. */
  9872. adjustViewportMeta(enabled: boolean): void;
  9873. /**
  9874. !#en
  9875. Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  9876. it takes effect only when you called setDesignResolutionPolicy<br/>
  9877. Only useful on web
  9878. !#zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  9879. 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  9880. 仅在 Web 模式下有效。
  9881. @param enabled Enable or disable retina display
  9882. */
  9883. enableRetina(enabled: boolean): void;
  9884. /**
  9885. !#en
  9886. Check whether retina display is enabled.<br/>
  9887. Only useful on web
  9888. !#zh 检查是否对 Retina 显示设备进行优化。
  9889. 仅在 Web 模式下有效。
  9890. */
  9891. isRetinaEnabled(): boolean;
  9892. /**
  9893. !#en Whether to Enable on anti-alias
  9894. !#zh 控制抗锯齿是否开启
  9895. @param enabled Enable or not anti-alias
  9896. */
  9897. enableAntiAlias(enabled: boolean): void;
  9898. /**
  9899. !#en Returns whether the current enable on anti-alias
  9900. !#zh 返回当前是否抗锯齿
  9901. */
  9902. isAntiAliasEnabled(): boolean;
  9903. /**
  9904. !#en
  9905. If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  9906. You can pass true as parameter to enable it and disable it by passing false.<br/>
  9907. Only useful on web
  9908. !#zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  9909. 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  9910. @param enabled Enable or disable auto full screen on mobile devices
  9911. */
  9912. enableAutoFullScreen(enabled: boolean): void;
  9913. /**
  9914. !#en
  9915. Check whether auto full screen is enabled.<br/>
  9916. Only useful on web
  9917. !#zh 检查自动进入全屏模式是否启动。
  9918. 仅在 Web 模式下有效。
  9919. */
  9920. isAutoFullScreenEnabled(): boolean;
  9921. /**
  9922. !#en
  9923. Returns the canvas size of the view.<br/>
  9924. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  9925. On web, it returns the size of the canvas element.
  9926. !#zh 返回视图中 canvas 的尺寸。
  9927. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  9928. 在 Web 平台下,它返回 canvas 元素尺寸。
  9929. */
  9930. getCanvasSize(): Size;
  9931. /**
  9932. !#en
  9933. Returns the frame size of the view.<br/>
  9934. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  9935. On web, it returns the size of the canvas's outer DOM element.
  9936. !#zh 返回视图中边框尺寸。
  9937. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  9938. 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  9939. */
  9940. getFrameSize(): Size;
  9941. /**
  9942. !#en
  9943. On native, it sets the frame size of view.<br/>
  9944. On web, it sets the size of the canvas's outer DOM element.
  9945. !#zh 在 native 平台下,设置视图框架尺寸。
  9946. 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  9947. @param width width
  9948. @param height height
  9949. */
  9950. setFrameSize(width: number, height: number): void;
  9951. /**
  9952. !#en
  9953. Returns the visible area size of the view port.
  9954. !#zh 返回视图窗口可见区域尺寸。
  9955. */
  9956. getVisibleSize(): Size;
  9957. /**
  9958. !#en
  9959. Returns the visible area size of the view port.
  9960. !#zh 返回视图窗口可见区域像素尺寸。
  9961. */
  9962. getVisibleSizeInPixel(): Size;
  9963. /**
  9964. !#en
  9965. Returns the visible origin of the view port.
  9966. !#zh 返回视图窗口可见区域原点。
  9967. */
  9968. getVisibleOrigin(): Vec2;
  9969. /**
  9970. !#en
  9971. Returns the visible origin of the view port.
  9972. !#zh 返回视图窗口可见区域像素原点。
  9973. */
  9974. getVisibleOriginInPixel(): Vec2;
  9975. /**
  9976. !#en
  9977. Returns the current resolution policy
  9978. !#zh 返回当前分辨率方案
  9979. */
  9980. getResolutionPolicy(): ResolutionPolicy;
  9981. /**
  9982. !#en
  9983. Sets the current resolution policy
  9984. !#zh 设置当前分辨率模式
  9985. @param resolutionPolicy resolutionPolicy
  9986. */
  9987. setResolutionPolicy(resolutionPolicy: ResolutionPolicy|number): void;
  9988. /**
  9989. !#en
  9990. Sets the resolution policy with designed view size in points.<br/>
  9991. The resolution policy include: <br/>
  9992. [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/>
  9993. [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/>
  9994. [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/>
  9995. [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  9996. [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  9997. [cc.ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>
  9998. !#zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  9999. @param width Design resolution width.
  10000. @param height Design resolution height.
  10001. @param resolutionPolicy The resolution policy desired
  10002. */
  10003. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10004. /**
  10005. !#en
  10006. Returns the designed size for the view.
  10007. Default resolution size is the same as 'getFrameSize'.
  10008. !#zh 返回视图的设计分辨率。
  10009. 默认下分辨率尺寸同 `getFrameSize` 方法相同
  10010. */
  10011. getDesignResolutionSize(): Size;
  10012. /**
  10013. !#en
  10014. Sets the container to desired pixel resolution and fit the game content to it.
  10015. This function is very useful for adaptation in mobile browsers.
  10016. In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  10017. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  10018. But this API can be helpful to set a desired pixel resolution which is in between.
  10019. This API will do the following:
  10020. 1. Set viewport's width to the desired width in pixel
  10021. 2. Set body width to the exact pixel resolution
  10022. 3. The resolution policy will be reset with designed view size in points.
  10023. !#zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  10024. @param width Design resolution width.
  10025. @param height Design resolution height.
  10026. @param resolutionPolicy The resolution policy desired
  10027. */
  10028. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10029. /**
  10030. !#en
  10031. Sets view port rectangle with points.
  10032. !#zh 用设计分辨率下的点尺寸来设置视窗。
  10033. @param x x
  10034. @param y y
  10035. @param w width
  10036. @param h height
  10037. */
  10038. setViewportInPoints(x: number, y: number, w: number, h: number): void;
  10039. /**
  10040. !#en
  10041. Sets Scissor rectangle with points.
  10042. !#zh 用设计分辨率下的点的尺寸来设置 scissor 剪裁区域。
  10043. @param x x
  10044. @param y y
  10045. @param w w
  10046. @param h h
  10047. */
  10048. setScissorInPoints(x: number, y: number, w: number, h: number): void;
  10049. /**
  10050. !#en
  10051. Returns whether GL_SCISSOR_TEST is enable
  10052. !#zh 检查 scissor 是否生效。
  10053. */
  10054. isScissorEnabled(): boolean;
  10055. /**
  10056. !#en
  10057. Returns the current scissor rectangle
  10058. !#zh 返回当前的 scissor 剪裁区域。
  10059. */
  10060. getScissorRect(): Rect;
  10061. /**
  10062. !#en
  10063. Returns the view port rectangle.
  10064. !#zh 返回视窗剪裁区域。
  10065. */
  10066. getViewportRect(): Rect;
  10067. /**
  10068. !#en
  10069. Returns scale factor of the horizontal direction (X axis).
  10070. !#zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  10071. */
  10072. getScaleX(): number;
  10073. /**
  10074. !#en
  10075. Returns scale factor of the vertical direction (Y axis).
  10076. !#zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  10077. */
  10078. getScaleY(): number;
  10079. /**
  10080. !#en
  10081. Returns device pixel ratio for retina display.
  10082. !#zh 返回设备或浏览器像素比例。
  10083. */
  10084. getDevicePixelRatio(): number;
  10085. /**
  10086. !#en
  10087. Returns the real location in view for a translation based on a related position
  10088. !#zh 将屏幕坐标转换为游戏视图下的坐标。
  10089. @param tx The X axis translation
  10090. @param ty The Y axis translation
  10091. @param relatedPos The related position object including "left", "top", "width", "height" informations
  10092. */
  10093. convertToLocationInView(tx: number, ty: number, relatedPos: any): Vec2;
  10094. }
  10095. /** <p>cc.game.containerStrategy class is the root strategy class of container's scale strategy,
  10096. it controls the behavior of how to scale the cc.game.container and cc.game.canvas object</p> */
  10097. export class ContainerStrategy {
  10098. /**
  10099. !#en
  10100. Manipulation before appling the strategy
  10101. !#zh 在应用策略之前的操作
  10102. @param view The target view
  10103. */
  10104. preApply(view: View): void;
  10105. /**
  10106. !#en
  10107. Function to apply this strategy
  10108. !#zh 策略应用方法
  10109. @param view view
  10110. @param designedResolution designedResolution
  10111. */
  10112. apply(view: View, designedResolution: Size): void;
  10113. /**
  10114. !#en
  10115. Manipulation after applying the strategy
  10116. !#zh 策略调用之后的操作
  10117. @param view The target view
  10118. */
  10119. postApply(view: View): void;
  10120. }
  10121. /** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,
  10122. it controls the behavior of how to scale the scene and setup the viewport for the game</p> */
  10123. export class ContentStrategy {
  10124. /**
  10125. !#en
  10126. Manipulation before applying the strategy
  10127. !#zh 策略应用前的操作
  10128. @param view The target view
  10129. */
  10130. preApply(view: View): void;
  10131. /**
  10132. !#en Function to apply this strategy
  10133. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10134. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10135. !#zh 调用策略方法
  10136. @param view view
  10137. @param designedResolution designedResolution
  10138. */
  10139. apply(view: View, designedResolution: Size): any;
  10140. /**
  10141. !#en
  10142. Manipulation after applying the strategy
  10143. !#zh 策略调用之后的操作
  10144. @param view The target view
  10145. */
  10146. postApply(view: View): void;
  10147. }
  10148. /** undefined */
  10149. export class EqualToFrame extends ContainerStrategy {
  10150. }
  10151. /** undefined */
  10152. export class ProportionalToFrame extends ContainerStrategy {
  10153. }
  10154. /** undefined */
  10155. export class EqualToWindow extends EqualToFrame {
  10156. }
  10157. /** undefined */
  10158. export class ProportionalToWindow extends ProportionalToFrame {
  10159. }
  10160. /** undefined */
  10161. export class OriginalContainer extends ContainerStrategy {
  10162. }
  10163. /** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,
  10164. its main task is to maintain the compatibility with Cocos2d-x</p> */
  10165. export class ResolutionPolicy {
  10166. /**
  10167. @param containerStg The container strategy
  10168. @param contentStg The content strategy
  10169. */
  10170. constructor(containerStg: ContainerStrategy, contentStg: ContentStrategy);
  10171. /**
  10172. !#en Manipulation before applying the resolution policy
  10173. !#zh 策略应用前的操作
  10174. @param view The target view
  10175. */
  10176. preApply(view: View): void;
  10177. /**
  10178. !#en Function to apply this resolution policy
  10179. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10180. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10181. !#zh 调用策略方法
  10182. @param view The target view
  10183. @param designedResolution The user defined design resolution
  10184. */
  10185. apply(view: View, designedResolution: Size): any;
  10186. /**
  10187. !#en Manipulation after appyling the strategy
  10188. !#zh 策略应用之后的操作
  10189. @param view The target view
  10190. */
  10191. postApply(view: View): void;
  10192. /**
  10193. !#en
  10194. Setup the container's scale strategy
  10195. !#zh 设置容器的适配策略
  10196. @param containerStg containerStg
  10197. */
  10198. setContainerStrategy(containerStg: ContainerStrategy): void;
  10199. /**
  10200. !#en
  10201. Setup the content's scale strategy
  10202. !#zh 设置内容的适配策略
  10203. @param contentStg contentStg
  10204. */
  10205. setContentStrategy(contentStg: ContentStrategy): void;
  10206. /** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>
  10207. Distortion can occur, and the application may appear stretched or compressed. */
  10208. static EXACT_FIT: number;
  10209. /** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>
  10210. while maintaining the original aspect ratio of the application. */
  10211. static NO_BORDER: number;
  10212. /** The entire application is visible in the specified area without distortion while maintaining the original<br/>
  10213. aspect ratio of the application. Borders can appear on two sides of the application. */
  10214. static SHOW_ALL: number;
  10215. /** The application takes the height of the design resolution size and modifies the width of the internal<br/>
  10216. canvas so that it fits the aspect ratio of the device<br/>
  10217. no distortion will occur however you must make sure your application works on different<br/>
  10218. aspect ratios */
  10219. static FIXED_HEIGHT: number;
  10220. /** The application takes the width of the design resolution size and modifies the height of the internal<br/>
  10221. canvas so that it fits the aspect ratio of the device<br/>
  10222. no distortion will occur however you must make sure your application works on different<br/>
  10223. aspect ratios */
  10224. static FIXED_WIDTH: number;
  10225. /** Unknow policy */
  10226. static UNKNOWN: number;
  10227. }
  10228. /** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,
  10229. it should represent the same rect as cc.view.getViewportRect() */
  10230. export class visibleRect {
  10231. /**
  10232. initialize
  10233. @param visibleRect visibleRect
  10234. */
  10235. init(visibleRect: Rect): void;
  10236. /** Top left coordinate of the screen related to the game scene. */
  10237. topLeft: Vec2;
  10238. /** Top right coordinate of the screen related to the game scene. */
  10239. topRight: Vec2;
  10240. /** Top center coordinate of the screen related to the game scene. */
  10241. top: Vec2;
  10242. /** Bottom left coordinate of the screen related to the game scene. */
  10243. bottomLeft: Vec2;
  10244. /** Bottom right coordinate of the screen related to the game scene. */
  10245. bottomRight: Vec2;
  10246. /** Bottom center coordinate of the screen related to the game scene. */
  10247. bottom: Vec2;
  10248. /** Center coordinate of the screen related to the game scene. */
  10249. center: Vec2;
  10250. /** Left center coordinate of the screen related to the game scene. */
  10251. left: Vec2;
  10252. /** Right center coordinate of the screen related to the game scene. */
  10253. right: Vec2;
  10254. /** Width of the screen. */
  10255. width: number;
  10256. /** Height of the screen. */
  10257. height: number;
  10258. }
  10259. /** The CallbacksHandler is an abstract class that can register and unregister callbacks by key.
  10260. Subclasses should implement their own methods about how to invoke the callbacks. */
  10261. export class _CallbacksHandler {
  10262. /**
  10263. @param key key
  10264. @param callback callback
  10265. @param target can be null
  10266. */
  10267. add(key: string, callback: Function, target?: any): void;
  10268. /**
  10269. Check if the specified key has any registered callback. If a callback is also specified,
  10270. it will only return true if the callback is registered.
  10271. @param key key
  10272. @param callback callback
  10273. @param target target
  10274. */
  10275. hasEventListener(key: string, callback?: Function, target?: any): boolean;
  10276. /**
  10277. Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  10278. @param keyOrTarget The event key to be removed or the target to be removed
  10279. */
  10280. removeAll(keyOrTarget: string|any): void;
  10281. /**
  10282. @param key key
  10283. @param callback callback
  10284. @param target target
  10285. */
  10286. remove(key: string, callback: Function, target?: any): void;
  10287. }
  10288. /** !#en The callbacks invoker to handle and invoke callbacks by key.
  10289. !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */
  10290. export class CallbacksInvoker extends _CallbacksHandler {
  10291. /**
  10292. @param key key
  10293. @param p1 p1
  10294. @param p2 p2
  10295. @param p3 p3
  10296. @param p4 p4
  10297. @param p5 p5
  10298. */
  10299. invoke(key: string, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any): void;
  10300. }
  10301. /** !#en Contains information collected during deserialization
  10302. !#zh 包含反序列化时的一些信息 */
  10303. export class Details {
  10304. /** list of the depends assets' uuid */
  10305. uuidList: string[];
  10306. /** the obj list whose field needs to load asset by uuid */
  10307. uuidObjList: any[];
  10308. /** the corresponding field name which referenced to the asset */
  10309. uuidPropList: string[];
  10310. reset(): void;
  10311. /**
  10312. @param obj obj
  10313. @param propName propName
  10314. @param uuid uuid
  10315. */
  10316. push(obj: any, propName: string, uuid: string): void;
  10317. }
  10318. /** undefined */
  10319. export class url {
  10320. /**
  10321. Returns the url of raw assets, you will only need this if the raw asset is inside the "resources" folder.
  10322. @param url url
  10323. @example
  10324. ```js
  10325. ---
  10326. var url = cc.url.raw("textures/myTexture.png");
  10327. console.log(url); // "resources/raw/textures/myTexture.png"
  10328. ```
  10329. */
  10330. static raw(url: string): string;
  10331. }
  10332. /** !#en The module provides utilities for working with file and directory paths
  10333. !#zh 用于处理文件与目录的路径的模块 */
  10334. export class path {
  10335. /**
  10336. !#en Join strings to be a path.
  10337. !#zh 拼接字符串为 Path
  10338. @example
  10339. ```js
  10340. ------------------------------
  10341. cc.path.join("a", "b.png"); //-->"a/b.png"
  10342. cc.path.join("a", "b", "c.png"); //-->"a/b/c.png"
  10343. cc.path.join("a", "b"); //-->"a/b"
  10344. cc.path.join("a", "b", "/"); //-->"a/b/"
  10345. cc.path.join("a", "b/", "/"); //-->"a/b/"
  10346. ```
  10347. */
  10348. static join(): string;
  10349. /**
  10350. !#en Get the ext name of a path including '.', like '.png'.
  10351. !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  10352. @param pathStr pathStr
  10353. @example
  10354. ```js
  10355. ---------------------------
  10356. cc.path.extname("a/b.png"); //-->".png"
  10357. cc.path.extname("a/b.png?a=1&b=2"); //-->".png"
  10358. cc.path.extname("a/b"); //-->null
  10359. cc.path.extname("a/b?a=1&b=2"); //-->null
  10360. ```
  10361. */
  10362. static extname(pathStr: string): any;
  10363. /**
  10364. !#en Get the main name of a file name
  10365. !#zh 获取文件名的主名称
  10366. @param fileName fileName
  10367. */
  10368. static mainFileName(fileName: string): string;
  10369. /**
  10370. !#en Get the file name of a file path.
  10371. !#zh 获取文件路径的文件名。
  10372. @param pathStr pathStr
  10373. @param extname extname
  10374. @example
  10375. ```js
  10376. ---------------------------------
  10377. cc.path.basename("a/b.png"); //-->"b.png"
  10378. cc.path.basename("a/b.png?a=1&b=2"); //-->"b.png"
  10379. cc.path.basename("a/b.png", ".png"); //-->"b"
  10380. cc.path.basename("a/b.png?a=1&b=2", ".png"); //-->"b"
  10381. cc.path.basename("a/b.png", ".txt"); //-->"b.png"
  10382. ```
  10383. */
  10384. static basename(pathStr: string, extname?: string): any;
  10385. /**
  10386. !#en Get dirname of a file path.
  10387. !#zh 获取文件路径的目录名。
  10388. @param pathStr pathStr
  10389. @example
  10390. ```js
  10391. ---------------------------------
  10392. * unix
  10393. cc.path.driname("a/b/c.png"); //-->"a/b"
  10394. cc.path.driname("a/b/c.png?a=1&b=2"); //-->"a/b"
  10395. cc.path.dirname("a/b/"); //-->"a/b"
  10396. cc.path.dirname("c.png"); //-->""
  10397. * windows
  10398. cc.path.driname("a\\b\\c.png"); //-->"a\b"
  10399. cc.path.driname("a\\b\\c.png?a=1&b=2"); //-->"a\b"
  10400. ```
  10401. */
  10402. static dirname(pathStr: string): any;
  10403. /**
  10404. !#en Change extname of a file path.
  10405. !#zh 更改文件路径的扩展名。
  10406. @param pathStr pathStr
  10407. @param extname extname
  10408. @example
  10409. ```js
  10410. ---------------------------------
  10411. cc.path.changeExtname("a/b.png", ".plist"); //-->"a/b.plist"
  10412. cc.path.changeExtname("a/b.png?a=1&b=2", ".plist"); //-->"a/b.plist?a=1&b=2"
  10413. ```
  10414. */
  10415. static changeExtname(pathStr: string, extname?: string): string;
  10416. }
  10417. /** !#en
  10418. AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>
  10419. !#zh
  10420. AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转,缩放转变所组成。<br/> */
  10421. export class AffineTransform {
  10422. /**
  10423. !#en Create a AffineTransform object with all contents in the matrix.
  10424. !#zh 用在矩阵中的所有内容创建一个 AffineTransform 对象。
  10425. @param a a
  10426. @param b b
  10427. @param c c
  10428. @param d d
  10429. @param tx tx
  10430. @param ty ty
  10431. */
  10432. static create(a: number, b: number, c: number, d: number, tx: number, ty: number): AffineTransform;
  10433. /**
  10434. !#en
  10435. Create a identity transformation matrix: <br/>
  10436. [ 1, 0, 0, <br/>
  10437. 0, 1, 0 ]
  10438. !#zh
  10439. 单位矩阵:<br/>
  10440. [ 1, 0, 0, <br/>
  10441. 0, 1, 0 ]
  10442. */
  10443. static identity(): AffineTransform;
  10444. /**
  10445. !#en Clone a AffineTransform object from the specified transform.
  10446. !#zh 克隆指定的 AffineTransform 对象。
  10447. @param t t
  10448. */
  10449. static clone(t: AffineTransform): AffineTransform;
  10450. /**
  10451. !#en
  10452. Concatenate a transform matrix to another
  10453. The results are reflected in the out affine transform
  10454. out = t1 * t2
  10455. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10456. !#zh
  10457. 拼接两个矩阵,将结果保存到 out 矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10458. out = t1 * t2
  10459. @param out Out object to store the concat result
  10460. @param t1 The first transform object.
  10461. @param t2 The transform object to concatenate.
  10462. */
  10463. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): AffineTransform;
  10464. /**
  10465. !#en Get the invert transform of an AffineTransform object.
  10466. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10467. !#zh 求逆矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10468. @param out out
  10469. @param t t
  10470. */
  10471. static invert(out: AffineTransform, t: AffineTransform): AffineTransform;
  10472. /**
  10473. !#en Get an AffineTransform object from a given matrix 4x4.
  10474. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10475. !#zh 从一个 4x4 Matrix 获取 AffineTransform 对象。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10476. @param out out
  10477. @param mat mat
  10478. */
  10479. static invert(out: AffineTransform, mat: Mat4): AffineTransform;
  10480. /**
  10481. !#en Apply the affine transformation on a point.
  10482. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
  10483. !#zh 对一个点应用矩阵变换。这个函数不创建任何内存,你需要先创建一个 Vec2 对象用来存储结果,并作为第一个参数传入函数。
  10484. @param out The output point to store the result
  10485. @param point Point to apply transform or x.
  10486. @param transOrY transform matrix or y.
  10487. @param t transform matrix.
  10488. */
  10489. static transformVec2(out: Vec2, point: Vec2|number, transOrY: AffineTransform|number, t?: AffineTransform): Vec2;
  10490. /**
  10491. !#en Apply the affine transformation on a size.
  10492. This function is memory free, you should create the output Size by yourself and manage its memory.
  10493. !#zh 应用仿射变换矩阵到 Size 上。这个函数不创建任何内存,你需要先创建一个 Size 对象用来存储结果,并作为第一个参数传入函数。
  10494. @param out The output point to store the result
  10495. @param size size
  10496. @param t t
  10497. */
  10498. static transformSize(out: Size, size: Size, t: AffineTransform): Size;
  10499. /**
  10500. !#en Apply the affine transformation on a rect.
  10501. This function is memory free, you should create the output Rect by yourself and manage its memory.
  10502. !#zh 应用仿射变换矩阵到 Rect 上。这个函数不创建任何内存,你需要先创建一个 Rect 对象用来存储结果,并作为第一个参数传入函数。
  10503. @param out out
  10504. @param rect rect
  10505. @param anAffineTransform anAffineTransform
  10506. */
  10507. static transformRect(out: Rect, rect: Rect, anAffineTransform: AffineTransform): Rect;
  10508. /**
  10509. !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
  10510. This function is memory free, you should create the output vectors by yourself and manage their memory.
  10511. !#zh 应用仿射变换矩阵到 Rect 上, 并转换为有向包围盒。这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  10512. @param out_bl out_bl
  10513. @param out_tl out_tl
  10514. @param out_tr out_tr
  10515. @param out_br out_br
  10516. @param rect rect
  10517. @param anAffineTransform anAffineTransform
  10518. */
  10519. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform): void;
  10520. }
  10521. /** A base node for CCNode, it will:
  10522. - maintain scene hierarchy and active logic
  10523. - notifications if some properties changed
  10524. - define some interfaces shares between CCNode
  10525. - define machanisms for Enity Component Systems
  10526. - define prefab and serialize functions */
  10527. export class _BaseNode extends Object implements EventTarget {
  10528. /** !#en Name of node.
  10529. !#zh 该节点名称。 */
  10530. name: string;
  10531. /** !#en The uuid for editor, will be stripped before building project.
  10532. !#zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。 */
  10533. uuid: string;
  10534. /** !#en All children nodes.
  10535. !#zh 节点的所有子节点。 */
  10536. children: Node[];
  10537. /** !#en All children nodes.
  10538. !#zh 节点的子节点数量。 */
  10539. childrenCount: number;
  10540. /** !#en
  10541. The local active state of this node.<br/>
  10542. Note that a Node may be inactive because a parent is not active, even if this returns true.<br/>
  10543. Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
  10544. !#zh
  10545. 当前节点的自身激活状态。<br/>
  10546. 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。<br/>
  10547. 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。 */
  10548. active: boolean;
  10549. /** !#en Indicates whether this node is active in the scene.
  10550. !#zh 表示此节点是否在场景中激活。 */
  10551. activeInHierarchy: boolean;
  10552. /**
  10553. @param name name
  10554. */
  10555. constructor(name?: string);
  10556. /** !#en The parent of the node.
  10557. !#zh 该节点的父节点。 */
  10558. parent: Node;
  10559. /**
  10560. !#en Get parent of the node.
  10561. !#zh 获取该节点的父节点。
  10562. @example
  10563. ```js
  10564. var parent = this.node.getParent();
  10565. ```
  10566. */
  10567. getParent(): Node;
  10568. /**
  10569. !#en Set parent of the node.
  10570. !#zh 设置该节点的父节点。
  10571. @param value value
  10572. @example
  10573. ```js
  10574. node.setParent(newNode);
  10575. ```
  10576. */
  10577. setParent(value: Node): void;
  10578. /**
  10579. !#en
  10580. Properties configuration function <br/>
  10581. All properties in attrs will be set to the node, <br/>
  10582. when the setter of the node is available, <br/>
  10583. the property will be set via setter function.<br/>
  10584. !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  10585. @param attrs Properties to be set to node
  10586. @example
  10587. ```js
  10588. var attrs = { key: 0, num: 100 };
  10589. node.attr(attrs);
  10590. ```
  10591. */
  10592. attr(attrs: any): void;
  10593. /**
  10594. !#en Returns a child from the container given its uuid.
  10595. !#zh 通过 uuid 获取节点的子节点。
  10596. @param uuid The uuid to find the child node.
  10597. @example
  10598. ```js
  10599. var child = node.getChildByUuid(uuid);
  10600. ```
  10601. */
  10602. getChildByUuid(uuid: string): Node;
  10603. /**
  10604. !#en Returns a child from the container given its name.
  10605. !#zh 通过名称获取节点的子节点。
  10606. @param name A name to find the child node.
  10607. @example
  10608. ```js
  10609. var child = node.getChildByName("Test Node");
  10610. ```
  10611. */
  10612. getChildByName(name: string): Node;
  10613. /**
  10614. !#en
  10615. Inserts a child to the node at a specified index.
  10616. !#zh
  10617. 插入子节点到指定位置
  10618. @param child the child node to be inserted
  10619. @param siblingIndex the sibling index to place the child in
  10620. @example
  10621. ```js
  10622. node.insertChild(child, 2);
  10623. ```
  10624. */
  10625. insertChild(child: Node, siblingIndex: number): void;
  10626. /**
  10627. !#en Get the sibling index.
  10628. !#zh 获取同级索引。
  10629. @example
  10630. ```js
  10631. var index = node.getSiblingIndex();
  10632. ```
  10633. */
  10634. getSiblingIndex(): number;
  10635. /**
  10636. !#en Set the sibling index of this node.
  10637. !#zh 设置节点同级索引。
  10638. @param index index
  10639. @example
  10640. ```js
  10641. node.setSiblingIndex(1);
  10642. ```
  10643. */
  10644. setSiblingIndex(index: number): void;
  10645. /**
  10646. !#en Walk though the sub children tree of the current node.
  10647. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children.
  10648. This function call is not recursive, it's based on stack.
  10649. Please don't walk any other node inside the walk process.
  10650. !#zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  10651. 对子树中的所有节点,包含当前节点,会执行两次回调,prefunc 会在访问它的子节点之前调用,postfunc 会在访问所有子节点之后调用。
  10652. 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  10653. 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  10654. @param prefunc The callback to process node when reach the node for the first time
  10655. @param postfunc The callback to process node when re-visit the node after walked all children in its sub tree
  10656. @example
  10657. ```js
  10658. node.walk(function (target) {
  10659. console.log('Walked through node ' + target.name + ' for the first time');
  10660. }, function (target) {
  10661. console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  10662. });
  10663. ```
  10664. */
  10665. walk(prefunc: (target: _BaseNode) => void, postfunc: (target: _BaseNode) => void): void;
  10666. /**
  10667. !#en
  10668. Remove itself from its parent node. If cleanup is `true`, then also remove all events and actions. <br/>
  10669. 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/>
  10670. If the node orphan, then nothing happens.
  10671. !#zh
  10672. 从父节点中删除该节点。如果不传入 cleanup 参数或者传入 `true`,那么这个节点上所有绑定的事件、action 都会被删除。<br/>
  10673. 因此建议调用这个 API 时总是传入 `false` 参数。<br/>
  10674. 如果这个节点是一个孤节点,那么什么都不会发生。
  10675. @param cleanup true if all actions and callbacks on this node should be removed, false otherwise.
  10676. @example
  10677. ```js
  10678. node.removeFromParent();
  10679. node.removeFromParent(false);
  10680. ```
  10681. */
  10682. removeFromParent(cleanup?: boolean): void;
  10683. /**
  10684. !#en
  10685. Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
  10686. If the cleanup parameter is not passed, it will force a cleanup. <br/>
  10687. "remove" logic MUST only be on this method <br/>
  10688. If a class wants to extend the 'removeChild' behavior it only needs <br/>
  10689. to override this method.
  10690. !#zh
  10691. 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10692. 如果 cleanup 参数不传入,默认为 true 表示清理。<br/>
  10693. @param child The child node which will be removed.
  10694. @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
  10695. @example
  10696. ```js
  10697. node.removeChild(newNode);
  10698. node.removeChild(newNode, false);
  10699. ```
  10700. */
  10701. removeChild(child: Node, cleanup?: boolean): void;
  10702. /**
  10703. !#en
  10704. Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
  10705. If the cleanup parameter is not passed, it will force a cleanup.
  10706. !#zh
  10707. 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10708. 如果 cleanup 参数不传入,默认为 true 表示清理。
  10709. @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
  10710. @example
  10711. ```js
  10712. node.removeAllChildren();
  10713. node.removeAllChildren(false);
  10714. ```
  10715. */
  10716. removeAllChildren(cleanup?: boolean): void;
  10717. /**
  10718. !#en Is this node a child of the given node?
  10719. !#zh 是否是指定节点的子节点?
  10720. @param parent parent
  10721. @example
  10722. ```js
  10723. node.isChildOf(newNode);
  10724. ```
  10725. */
  10726. isChildOf(parent: Node): boolean;
  10727. /**
  10728. !#en
  10729. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  10730. You can also get component in the node by passing in the name of the script.
  10731. !#zh
  10732. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  10733. 传入参数也可以是脚本的名称。
  10734. @param typeOrClassName typeOrClassName
  10735. @example
  10736. ```js
  10737. // get sprite component.
  10738. var sprite = node.getComponent(cc.Sprite);
  10739. // get custom test calss.
  10740. var test = node.getComponent("Test");
  10741. ```
  10742. */
  10743. getComponent<T extends Component>(type: {prototype: T}): T;
  10744. getComponent(className: string): any;
  10745. /**
  10746. !#en Returns all components of supplied type in the node.
  10747. !#zh 返回节点上指定类型的所有组件。
  10748. @param typeOrClassName typeOrClassName
  10749. @example
  10750. ```js
  10751. var sprites = node.getComponents(cc.Sprite);
  10752. var tests = node.getComponents("Test");
  10753. ```
  10754. */
  10755. getComponents<T extends Component>(type: {prototype: T}): T[];
  10756. getComponents(className: string): any[];
  10757. /**
  10758. !#en Returns the component of supplied type in any of its children using depth first search.
  10759. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  10760. @param typeOrClassName typeOrClassName
  10761. @example
  10762. ```js
  10763. var sprite = node.getComponentInChildren(cc.Sprite);
  10764. var Test = node.getComponentInChildren("Test");
  10765. ```
  10766. */
  10767. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  10768. getComponentInChildren(className: string): any;
  10769. /**
  10770. !#en Returns all components of supplied type in self or any of its children.
  10771. !#zh 递归查找自身或所有子节点中指定类型的组件
  10772. @param typeOrClassName typeOrClassName
  10773. @example
  10774. ```js
  10775. var sprites = node.getComponentsInChildren(cc.Sprite);
  10776. var tests = node.getComponentsInChildren("Test");
  10777. ```
  10778. */
  10779. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  10780. getComponentsInChildren(className: string): any[];
  10781. /**
  10782. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  10783. !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  10784. @param typeOrClassName The constructor or the class name of the component to add
  10785. @example
  10786. ```js
  10787. var sprite = node.addComponent(cc.Sprite);
  10788. var test = node.addComponent("Test");
  10789. ```
  10790. */
  10791. addComponent<T extends Component>(type: {new(): T}): T;
  10792. addComponent(className: string): any;
  10793. /**
  10794. !#en
  10795. Removes a component identified by the given name or removes the component object given.
  10796. You can also use component.destroy() if you already have the reference.
  10797. !#zh
  10798. 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  10799. 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  10800. @param component The need remove component.
  10801. @example
  10802. ```js
  10803. node.removeComponent(cc.Sprite);
  10804. var Test = require("Test");
  10805. node.removeComponent(Test);
  10806. ```
  10807. */
  10808. removeComponent(component: string|Function|Component): void;
  10809. /**
  10810. !#en
  10811. Destroy all children from the node, and release all their own references to other objects.<br/>
  10812. Actual destruct operation will delayed until before rendering.
  10813. !#zh
  10814. 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
  10815. 实际销毁操作会延迟到当前帧渲染前执行。
  10816. @example
  10817. ```js
  10818. node.destroyAllChildren();
  10819. ```
  10820. */
  10821. destroyAllChildren(): void;
  10822. /**
  10823. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  10824. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  10825. @param type The type of event.
  10826. */
  10827. hasEventListener(type: string): boolean;
  10828. /**
  10829. !#en
  10830. Register an callback of a specific event type on the EventTarget.
  10831. This type of event should be triggered via `emit`.
  10832. !#zh
  10833. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  10834. @param type A string representing the event type to listen for.
  10835. @param callback The callback that will be invoked when the event is dispatched.
  10836. The callback is ignored if it is a duplicate (the callbacks are unique).
  10837. @param target The target (this object) to invoke the callback, can be null
  10838. @example
  10839. ```js
  10840. eventTarget.on('fire', function () {
  10841. cc.log("fire in the hole");
  10842. }, node);
  10843. ```
  10844. */
  10845. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  10846. /**
  10847. !#en
  10848. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  10849. if only type is passed as parameter, all listeners registered with that type will be removed.
  10850. !#zh
  10851. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  10852. @param type A string representing the event type being removed.
  10853. @param callback The callback to remove.
  10854. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  10855. @example
  10856. ```js
  10857. // register fire eventListener
  10858. var callback = eventTarget.on('fire', function () {
  10859. cc.log("fire in the hole");
  10860. }, target);
  10861. // remove fire event listener
  10862. eventTarget.off('fire', callback, target);
  10863. // remove all fire event listeners
  10864. eventTarget.off('fire');
  10865. ```
  10866. */
  10867. off(type: string, callback?: Function, target?: any): void;
  10868. /**
  10869. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  10870. This is not for removing all listeners in the current event target,
  10871. and this is not for removing all listeners the target parameter have registered.
  10872. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  10873. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  10874. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  10875. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  10876. @param target The target to be searched for all related listeners
  10877. */
  10878. targetOff(target: any): void;
  10879. /**
  10880. !#en
  10881. Register an callback of a specific event type on the EventTarget,
  10882. the callback will remove itself after the first time it is triggered.
  10883. !#zh
  10884. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  10885. @param type A string representing the event type to listen for.
  10886. @param callback The callback that will be invoked when the event is dispatched.
  10887. The callback is ignored if it is a duplicate (the callbacks are unique).
  10888. @param target The target (this object) to invoke the callback, can be null
  10889. @example
  10890. ```js
  10891. eventTarget.once('fire', function () {
  10892. cc.log("this is the callback and will be invoked only once");
  10893. }, node);
  10894. ```
  10895. */
  10896. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  10897. /**
  10898. !#en
  10899. Trigger an event directly with the event name and necessary arguments.
  10900. !#zh
  10901. 通过事件名发送自定义事件
  10902. @param type event type
  10903. @param arg1 First argument
  10904. @param arg2 Second argument
  10905. @param arg3 Third argument
  10906. @param arg4 Fourth argument
  10907. @param arg5 Fifth argument
  10908. @example
  10909. ```js
  10910. eventTarget.emit('fire', event);
  10911. eventTarget.emit('fire', message, emitter);
  10912. ```
  10913. */
  10914. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  10915. /**
  10916. !#en
  10917. Send an event with the event object.
  10918. !#zh
  10919. 通过事件对象派发事件
  10920. @param event event
  10921. */
  10922. dispatchEvent(event: Event): void;
  10923. }
  10924. /** misc utilities */
  10925. export class misc {
  10926. /**
  10927. !#en Clamp a value between from and to.
  10928. !#zh
  10929. 限定浮点数的最大最小值。<br/>
  10930. 数值大于 max_inclusive 则返回 max_inclusive。<br/>
  10931. 数值小于 min_inclusive 则返回 min_inclusive。<br/>
  10932. 否则返回自身。
  10933. @param value value
  10934. @param min_inclusive min_inclusive
  10935. @param max_inclusive max_inclusive
  10936. @example
  10937. ```js
  10938. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  10939. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  10940. var v3 = cc.misc.clampf(10, 0, 20); // 10;
  10941. ```
  10942. */
  10943. static clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  10944. /**
  10945. !#en Clamp a value between 0 and 1.
  10946. !#zh 限定浮点数的取值范围为 0 ~ 1 之间。
  10947. @param value value
  10948. @example
  10949. ```js
  10950. var v1 = cc.misc.clamp01(20); // 1;
  10951. var v2 = cc.misc.clamp01(-1); // 0;
  10952. var v3 = cc.misc.clamp01(0.5); // 0.5;
  10953. ```
  10954. */
  10955. static clamp01(value: number): number;
  10956. /**
  10957. Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  10958. @param a number A
  10959. @param b number B
  10960. @param r ratio between 0 and 1
  10961. @example
  10962. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/platform/CCMacro/lerp.js
  10963. */
  10964. static lerp(a: number, b: number, r: number): number;
  10965. /**
  10966. converts degrees to radians
  10967. @param angle angle
  10968. */
  10969. static degreesToRadians(angle: number): number;
  10970. /**
  10971. converts radians to degrees
  10972. @param angle angle
  10973. */
  10974. static radiansToDegrees(angle: number): number;
  10975. }
  10976. /** !#en The renderer object which provide access to render system APIs,
  10977. detailed APIs will be available progressively.
  10978. !#zh 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户 */
  10979. export class renderer {
  10980. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  10981. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  10982. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  10983. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  10984. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  10985. static renderEngine: any;
  10986. /** !#en The total draw call count in last rendered frame.
  10987. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  10988. static drawCalls: number;
  10989. }
  10990. /** !#en
  10991. Representation of RGBA colors.
  10992. Each color component is a floating point value with a range from 0 to 255.
  10993. You can also use the convenience method {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} to create a new Color.
  10994. !#zh
  10995. cc.Color 用于表示颜色。
  10996. 它包含 RGBA 四个以浮点数保存的颜色分量,每个的值都在 0 到 255 之间。
  10997. 您也可以通过使用 {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */
  10998. export class Color extends ValueType {
  10999. /**
  11000. @param r red component of the color, default value is 0.
  11001. @param g green component of the color, defualt value is 0.
  11002. @param b blue component of the color, default value is 0.
  11003. @param a alpha component of the color, default value is 255.
  11004. */
  11005. constructor(r?: number, g?: number, b?: number, a?: number);
  11006. /** !#en Solid white, RGBA is [255, 255, 255, 255].
  11007. !#zh 纯白色,RGBA 是 [255, 255, 255, 255]。 */
  11008. static WHITE: Color;
  11009. /** !#en Solid black, RGBA is [0, 0, 0, 255].
  11010. !#zh 纯黑色,RGBA 是 [0, 0, 0, 255]。 */
  11011. static BLACK: Color;
  11012. /** !#en Transparent, RGBA is [0, 0, 0, 0].
  11013. !#zh 透明,RGBA 是 [0, 0, 0, 0]。 */
  11014. static TRANSPARENT: Color;
  11015. /** !#en Grey, RGBA is [127.5, 127.5, 127.5].
  11016. !#zh 灰色,RGBA 是 [127.5, 127.5, 127.5]。 */
  11017. static GRAY: Color;
  11018. /** !#en Solid red, RGBA is [255, 0, 0].
  11019. !#zh 纯红色,RGBA 是 [255, 0, 0]。 */
  11020. static RED: Color;
  11021. /** !#en Solid green, RGBA is [0, 255, 0].
  11022. !#zh 纯绿色,RGBA 是 [0, 255, 0]。 */
  11023. static GREEN: Color;
  11024. /** !#en Solid blue, RGBA is [0, 0, 255].
  11025. !#zh 纯蓝色,RGBA 是 [0, 0, 255]。 */
  11026. static BLUE: Color;
  11027. /** !#en Yellow, RGBA is [255, 235, 4].
  11028. !#zh 黄色,RGBA 是 [255, 235, 4]。 */
  11029. static YELLOW: Color;
  11030. /** !#en Orange, RGBA is [255, 127, 0].
  11031. !#zh 橙色,RGBA 是 [255, 127, 0]。 */
  11032. static ORANGE: Color;
  11033. /** !#en Cyan, RGBA is [0, 255, 255].
  11034. !#zh 青色,RGBA 是 [0, 255, 255]。 */
  11035. static CYAN: Color;
  11036. /** !#en Magenta, RGBA is [255, 0, 255].
  11037. !#zh 洋红色(品红色),RGBA 是 [255, 0, 255]。 */
  11038. static MAGENTA: Color;
  11039. /**
  11040. !#en Clone a new color from the current color.
  11041. !#zh 克隆当前颜色。
  11042. @example
  11043. ```js
  11044. var color = new cc.Color();
  11045. var newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}
  11046. ```
  11047. */
  11048. clone(): Color;
  11049. /**
  11050. !#en TODO
  11051. !#zh 判断两个颜色是否相等。
  11052. @param other other
  11053. @example
  11054. ```js
  11055. var color1 = cc.Color.WHITE;
  11056. var color2 = new cc.Color(255, 255, 255);
  11057. cc.log(color1.equals(color2)); // true;
  11058. color2 = cc.Color.RED;
  11059. cc.log(color2.equals(color1)); // false;
  11060. ```
  11061. */
  11062. equals(other: Color): boolean;
  11063. /**
  11064. !#en TODO
  11065. !#zh 线性插值
  11066. @param to to
  11067. @param ratio the interpolation coefficient.
  11068. @param out optional, the receiving vector.
  11069. @example
  11070. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/lerp.js
  11071. */
  11072. lerp(to: Color, ratio: number, out?: Color): Color;
  11073. /**
  11074. !#en TODO
  11075. !#zh 转换为方便阅读的字符串。
  11076. @example
  11077. ```js
  11078. var color = cc.Color.WHITE;
  11079. color.toString(); // "rgba(255, 255, 255, 255)"
  11080. ```
  11081. */
  11082. toString(): string;
  11083. /**
  11084. !#en Gets red channel value
  11085. !#zh 获取当前颜色的红色值。
  11086. */
  11087. getR(): number;
  11088. /**
  11089. !#en Sets red value and return the current color object
  11090. !#zh 设置当前的红色值,并返回当前对象。
  11091. @param red the new Red component.
  11092. @example
  11093. ```js
  11094. var color = new cc.Color();
  11095. color.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}
  11096. ```
  11097. */
  11098. setR(red: number): Color;
  11099. /**
  11100. !#en Gets green channel value
  11101. !#zh 获取当前颜色的绿色值。
  11102. */
  11103. getG(): number;
  11104. /**
  11105. !#en Sets green value and return the current color object
  11106. !#zh 设置当前的绿色值,并返回当前对象。
  11107. @param green the new Green component.
  11108. @example
  11109. ```js
  11110. var color = new cc.Color();
  11111. color.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}
  11112. ```
  11113. */
  11114. setG(green: number): Color;
  11115. /**
  11116. !#en Gets blue channel value
  11117. !#zh 获取当前颜色的蓝色值。
  11118. */
  11119. getB(): number;
  11120. /**
  11121. !#en Sets blue value and return the current color object
  11122. !#zh 设置当前的蓝色值,并返回当前对象。
  11123. @param blue the new Blue component.
  11124. @example
  11125. ```js
  11126. var color = new cc.Color();
  11127. color.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}
  11128. ```
  11129. */
  11130. setB(blue: number): Color;
  11131. /**
  11132. !#en Gets alpha channel value
  11133. !#zh 获取当前颜色的透明度值。
  11134. */
  11135. getA(): number;
  11136. /**
  11137. !#en Sets alpha value and return the current color object
  11138. !#zh 设置当前的透明度,并返回当前对象。
  11139. @param alpha the new Alpha component.
  11140. @example
  11141. ```js
  11142. var color = new cc.Color();
  11143. color.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}
  11144. ```
  11145. */
  11146. setA(alpha: number): Color;
  11147. /**
  11148. !#en Convert color to css format.
  11149. !#zh 转换为 CSS 格式。
  11150. @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  11151. @example
  11152. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/toCSS.js
  11153. */
  11154. toCSS(opt: string): string;
  11155. /**
  11156. !#en Read hex string and store color data into the current color object, the hex string must be formated as rgba or rgb.
  11157. !#zh 读取 16 进制颜色。
  11158. @param hexString hexString
  11159. @example
  11160. ```js
  11161. var color = cc.Color.BLACK;
  11162. color.fromHEX("#FFFF33"); // Color {r: 255, g: 255, b: 51, a: 255};
  11163. ```
  11164. */
  11165. fromHEX(hexString: string): Color;
  11166. /**
  11167. !#en convert Color to HEX color string.
  11168. e.g. cc.color(255,6,255) to : "#ff06ff"
  11169. !#zh 转换为 16 进制。
  11170. @param fmt "#rgb", "#rrggbb" or "#rrggbbaa".
  11171. @example
  11172. ```js
  11173. var color = cc.Color.BLACK;
  11174. color.toHEX("#rgb"); // "000";
  11175. color.toHEX("#rrggbb"); // "000000";
  11176. ```
  11177. */
  11178. toHEX(fmt: string): string;
  11179. /**
  11180. !#en Convert to 24bit rgb value.
  11181. !#zh 转换为 24bit 的 RGB 值。
  11182. @example
  11183. ```js
  11184. var color = cc.Color.YELLOW;
  11185. color.toRGBValue(); // 16771844;
  11186. ```
  11187. */
  11188. toRGBValue(): number;
  11189. /**
  11190. !#en Read HSV model color and convert to RGB color
  11191. !#zh 读取 HSV(色彩模型)格式。
  11192. @param h h
  11193. @param s s
  11194. @param v v
  11195. @example
  11196. ```js
  11197. var color = cc.Color.YELLOW;
  11198. color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  11199. ```
  11200. */
  11201. fromHSV(h: number, s: number, v: number): Color;
  11202. /**
  11203. !#en Transform to HSV model color
  11204. !#zh 转换为 HSV(色彩模型)格式。
  11205. @example
  11206. ```js
  11207. var color = cc.Color.YELLOW;
  11208. color.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};
  11209. ```
  11210. */
  11211. toHSV(): any;
  11212. }
  11213. /** !#en Representation of 4*4 matrix.
  11214. !#zh 表示 4*4 矩阵 */
  11215. export class Mat4 extends ValueType {
  11216. /**
  11217. !#en
  11218. Constructor
  11219. see {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11220. !#zh
  11221. 构造函数,可查看 {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11222. @param m00 Component in column 0, row 0 position (index 0)
  11223. @param m01 Component in column 0, row 1 position (index 1)
  11224. @param m02 Component in column 0, row 2 position (index 2)
  11225. @param m03 Component in column 0, row 3 position (index 3)
  11226. @param m10 Component in column 1, row 0 position (index 4)
  11227. @param m11 Component in column 1, row 1 position (index 5)
  11228. @param m12 Component in column 1, row 2 position (index 6)
  11229. @param m13 Component in column 1, row 3 position (index 7)
  11230. @param m20 Component in column 2, row 0 position (index 8)
  11231. @param m21 Component in column 2, row 1 position (index 9)
  11232. @param m22 Component in column 2, row 2 position (index 10)
  11233. @param m23 Component in column 2, row 3 position (index 11)
  11234. @param m30 Component in column 3, row 0 position (index 12)
  11235. @param m31 Component in column 3, row 1 position (index 13)
  11236. @param m32 Component in column 3, row 2 position (index 14)
  11237. @param m33 Component in column 3, row 3 position (index 15)
  11238. */
  11239. constructor(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);
  11240. /**
  11241. !#en clone a Mat4 object
  11242. !#zh 克隆一个 Mat4 对象
  11243. */
  11244. clone(): Mat4;
  11245. /**
  11246. !#en Sets the matrix with another one's value
  11247. !#zh 用另一个矩阵设置这个矩阵的值。
  11248. @param srcObj srcObj
  11249. */
  11250. set(srcObj: Mat4): Mat4;
  11251. /**
  11252. !#en Check whether two matrix equal
  11253. !#zh 当前的矩阵是否与指定的矩阵相等。
  11254. @param other other
  11255. */
  11256. equals(other: Mat4): boolean;
  11257. /**
  11258. !#en Check whether two matrix equal with default degree of variance.
  11259. !#zh
  11260. 近似判断两个矩阵是否相等。<br/>
  11261. 判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
  11262. @param other other
  11263. */
  11264. fuzzyEquals(other: Mat4): boolean;
  11265. /**
  11266. !#en Transform to string with matrix informations
  11267. !#zh 转换为方便阅读的字符串。
  11268. */
  11269. toString(): string;
  11270. /**
  11271. Set the matrix to the identity matrix
  11272. */
  11273. identity(): Mat4;
  11274. /**
  11275. Transpose the values of a mat4
  11276. @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.
  11277. */
  11278. transpose(out?: Mat4): Mat4;
  11279. /**
  11280. Inverts a mat4
  11281. @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.
  11282. */
  11283. invert(out?: Mat4): Mat4;
  11284. /**
  11285. Calculates the adjugate of a mat4
  11286. @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.
  11287. */
  11288. adjoint(out?: Mat4): Mat4;
  11289. /**
  11290. Calculates the determinant of a mat4
  11291. */
  11292. determinant(): number;
  11293. /**
  11294. Adds two Mat4
  11295. @param other the second operand
  11296. @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.
  11297. */
  11298. add(other: Mat4, out?: Mat4): Mat4;
  11299. /**
  11300. Subtracts the current matrix with another one
  11301. @param other the second operand
  11302. @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
  11303. */
  11304. sub(other: Mat4, out?: Mat4): Mat4;
  11305. /**
  11306. Subtracts the current matrix with another one
  11307. @param other the second operand
  11308. @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
  11309. */
  11310. mul(other: Mat4, out?: Mat4): Mat4;
  11311. /**
  11312. Multiply each element of the matrix by a scalar.
  11313. @param number amount to scale the matrix's elements by
  11314. @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
  11315. */
  11316. mulScalar(number: number, out?: Mat4): Mat4;
  11317. /**
  11318. Translate a mat4 by the given vector
  11319. @param v vector to translate by
  11320. @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
  11321. */
  11322. translate(v: Vec3, out?: Mat4): Mat4;
  11323. /**
  11324. Scales the mat4 by the dimensions in the given vec3
  11325. @param v vector to scale by
  11326. @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
  11327. */
  11328. scale(v: Vec3, out?: Mat4): Mat4;
  11329. /**
  11330. Rotates a mat4 by the given angle around the given axis
  11331. @param rad the angle to rotate the matrix by
  11332. @param axis the axis to rotate around
  11333. @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
  11334. */
  11335. rotate(rad: number, axis: Vec3, out?: Mat4): Mat4;
  11336. /**
  11337. Returns the translation vector component of a transformation matrix.
  11338. @param out Vector to receive translation component, if not provided, a new vec3 will be created
  11339. */
  11340. getTranslation(out: Vec3): Vec3;
  11341. /**
  11342. Returns the scale factor component of a transformation matrix
  11343. @param out Vector to receive scale component, if not provided, a new vec3 will be created
  11344. */
  11345. getScale(out: Vec3): Vec3;
  11346. /**
  11347. Returns the rotation factor component of a transformation matrix
  11348. @param out Vector to receive rotation component, if not provided, a new quaternion object will be created
  11349. */
  11350. getRotation(out: Quat): Quat;
  11351. /**
  11352. Restore the matrix values from a quaternion rotation, vector translation and vector scale
  11353. @param q Rotation quaternion
  11354. @param v Translation vector
  11355. @param s Scaling vector
  11356. */
  11357. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  11358. /**
  11359. Restore the matrix values from a quaternion rotation
  11360. @param q Rotation quaternion
  11361. */
  11362. fromQuat(q: Quat): Mat4;
  11363. /**
  11364. !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
  11365. !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
  11366. @param m00 Component in column 0, row 0 position (index 0)
  11367. @param m01 Component in column 0, row 1 position (index 1)
  11368. @param m02 Component in column 0, row 2 position (index 2)
  11369. @param m03 Component in column 0, row 3 position (index 3)
  11370. @param m10 Component in column 1, row 0 position (index 4)
  11371. @param m11 Component in column 1, row 1 position (index 5)
  11372. @param m12 Component in column 1, row 2 position (index 6)
  11373. @param m13 Component in column 1, row 3 position (index 7)
  11374. @param m20 Component in column 2, row 0 position (index 8)
  11375. @param m21 Component in column 2, row 1 position (index 9)
  11376. @param m22 Component in column 2, row 2 position (index 10)
  11377. @param m23 Component in column 2, row 3 position (index 11)
  11378. @param m30 Component in column 3, row 0 position (index 12)
  11379. @param m31 Component in column 3, row 1 position (index 13)
  11380. @param m32 Component in column 3, row 2 position (index 14)
  11381. @param m33 Component in column 3, row 3 position (index 15)
  11382. */
  11383. 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;
  11384. }
  11385. /** !#en Representation of 2D vectors and points.
  11386. !#zh 表示 2D 向量和坐标 */
  11387. export class Quat extends ValueType {
  11388. /**
  11389. !#en
  11390. Constructor
  11391. see {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11392. !#zh
  11393. 构造函数,可查看 {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11394. @param x x
  11395. @param y y
  11396. @param z z
  11397. @param w w
  11398. */
  11399. constructor(x?: number, y?: number, z?: number, w?: number);
  11400. x: number;
  11401. y: number;
  11402. z: number;
  11403. w: number;
  11404. /**
  11405. !#en clone a Quat object and return the new object
  11406. !#zh 克隆一个四元数并返回
  11407. */
  11408. clone(): Quat;
  11409. /**
  11410. !#en Set values with another quaternion
  11411. !#zh 用另一个四元数的值设置到当前对象上。
  11412. @param newValue !#en new value to set. !#zh 要设置的新值
  11413. */
  11414. set(newValue: Quat): Quat;
  11415. /**
  11416. !#en Check whether current quaternion equals another
  11417. !#zh 当前的四元数是否与指定的四元数相等。
  11418. @param other other
  11419. */
  11420. equals(other: Quat): boolean;
  11421. /**
  11422. !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
  11423. !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
  11424. @param x x
  11425. @param y y
  11426. @param z z
  11427. @param w w
  11428. */
  11429. quat(x?: number|any, y?: number, z?: number, w?: number): Quat;
  11430. }
  11431. /** !#en A 2D rectangle defined by x, y position and width, height.
  11432. !#zh 通过位置和宽高定义的 2D 矩形。 */
  11433. export class Rect extends ValueType {
  11434. /**
  11435. !#en
  11436. Constructor of Rect class.
  11437. see {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} for convenience method.
  11438. !#zh
  11439. Rect类的构造函数。可以通过 {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} 简便方法进行创建。
  11440. @param x x
  11441. @param y y
  11442. @param w w
  11443. @param h h
  11444. */
  11445. constructor(x?: number, y?: number, w?: number, h?: number);
  11446. x: number;
  11447. y: number;
  11448. width: number;
  11449. height: number;
  11450. /**
  11451. !#en Creates a rectangle from two coordinate values.
  11452. !#zh 根据指定 2 个坐标创建出一个矩形区域。
  11453. @param v1 v1
  11454. @param v2 v2
  11455. @example
  11456. ```js
  11457. cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
  11458. ```
  11459. */
  11460. static fromMinMax(v1: Vec2, v2: Vec2): Rect;
  11461. /**
  11462. !#en TODO
  11463. !#zh 克隆一个新的 Rect。
  11464. @example
  11465. ```js
  11466. var a = new cc.Rect(0, 0, 10, 10);
  11467. a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
  11468. ```
  11469. */
  11470. clone(): Rect;
  11471. /**
  11472. !#en TODO
  11473. !#zh 是否等于指定的矩形。
  11474. @param other other
  11475. @example
  11476. ```js
  11477. var a = new cc.Rect(0, 0, 10, 10);
  11478. var b = new cc.Rect(0, 0, 10, 10);
  11479. a.equals(b);// true;
  11480. ```
  11481. */
  11482. equals(other: Rect): boolean;
  11483. /**
  11484. !#en TODO
  11485. !#zh 线性插值
  11486. @param to to
  11487. @param ratio the interpolation coefficient.
  11488. @param out optional, the receiving vector.
  11489. @example
  11490. ```js
  11491. var a = new cc.Rect(0, 0, 10, 10);
  11492. var b = new cc.Rect(50, 50, 100, 100);
  11493. update (dt) {
  11494. // method 1;
  11495. var c = a.lerp(b, dt * 0.1);
  11496. // method 2;
  11497. a.lerp(b, dt * 0.1, c);
  11498. }
  11499. ```
  11500. */
  11501. lerp(to: Rect, ratio: number, out?: Rect): Rect;
  11502. /**
  11503. !#en Check whether the current rectangle intersects with the given one
  11504. !#zh 当前矩形与指定矩形是否相交。
  11505. @param rect rect
  11506. @example
  11507. ```js
  11508. var a = new cc.Rect(0, 0, 10, 10);
  11509. var b = new cc.Rect(0, 0, 20, 20);
  11510. a.intersects(b);// true
  11511. ```
  11512. */
  11513. intersects(rect: Rect): boolean;
  11514. /**
  11515. !#en Returns the overlapping portion of 2 rectangles.
  11516. !#zh 返回 2 个矩形重叠的部分。
  11517. @param out Stores the result
  11518. @param rectB rectB
  11519. @example
  11520. ```js
  11521. var a = new cc.Rect(0, 10, 20, 20);
  11522. var b = new cc.Rect(0, 10, 10, 10);
  11523. var intersection = new cc.Rect();
  11524. a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
  11525. ```
  11526. */
  11527. intersection(out: Rect, rectB: Rect): Rect;
  11528. /**
  11529. !#en Check whether the current rect contains the given point
  11530. !#zh 当前矩形是否包含指定坐标点。
  11531. Returns true if the point inside this rectangle.
  11532. @param point point
  11533. @example
  11534. ```js
  11535. var a = new cc.Rect(0, 0, 10, 10);
  11536. var b = new cc.Vec2(0, 5);
  11537. a.contains(b);// true
  11538. ```
  11539. */
  11540. contains(point: Vec2): boolean;
  11541. /**
  11542. !#en Returns true if the other rect totally inside this rectangle.
  11543. !#zh 当前矩形是否包含指定矩形。
  11544. @param rect rect
  11545. @example
  11546. ```js
  11547. var a = new cc.Rect(0, 0, 20, 20);
  11548. var b = new cc.Rect(0, 0, 10, 10);
  11549. a.containsRect(b);// true
  11550. ```
  11551. */
  11552. containsRect(rect: Rect): boolean;
  11553. /**
  11554. !#en Returns the smallest rectangle that contains the current rect and the given rect.
  11555. !#zh 返回一个包含当前矩形和指定矩形的最小矩形。
  11556. @param out Stores the result
  11557. @param rectB rectB
  11558. @example
  11559. ```js
  11560. var a = new cc.Rect(0, 10, 20, 20);
  11561. var b = new cc.Rect(0, 10, 10, 10);
  11562. var union = new cc.Rect();
  11563. a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
  11564. ```
  11565. */
  11566. union(out: Rect, rectB: Rect): Rect;
  11567. /**
  11568. !#en Apply matrix4 to the rect.
  11569. !#zh 使用 mat4 对矩形进行矩阵转换。
  11570. @param out The output rect
  11571. @param mat The matrix4
  11572. */
  11573. transformMat4(out: Rect, mat: Mat4): void;
  11574. /**
  11575. !#en Output rect informations to string
  11576. !#zh 转换为方便阅读的字符串
  11577. @example
  11578. ```js
  11579. var a = new cc.Rect(0, 0, 10, 10);
  11580. a.toString();// "(0.00, 0.00, 10.00, 10.00)";
  11581. ```
  11582. */
  11583. toString(): string;
  11584. /** !#en The minimum x value, equals to rect.x
  11585. !#zh 矩形 x 轴上的最小值,等价于 rect.x。 */
  11586. xMin: number;
  11587. /** !#en The minimum y value, equals to rect.y
  11588. !#zh 矩形 y 轴上的最小值。 */
  11589. yMin: number;
  11590. /** !#en The maximum x value.
  11591. !#zh 矩形 x 轴上的最大值。 */
  11592. xMax: number;
  11593. /** !#en The maximum y value.
  11594. !#zh 矩形 y 轴上的最大值。 */
  11595. yMax: number;
  11596. /** !#en The position of the center of the rectangle.
  11597. !#zh 矩形的中心点。 */
  11598. center: Vec2;
  11599. /** !#en The X and Y position of the rectangle.
  11600. !#zh 矩形的 x 和 y 坐标。 */
  11601. origin: Vec2;
  11602. /** !#en Width and height of the rectangle.
  11603. !#zh 矩形的大小。 */
  11604. size: Size;
  11605. }
  11606. /** !#en
  11607. cc.Size is the class for size object,<br/>
  11608. please do not use its constructor to create sizes,<br/>
  11609. use {{#crossLink "cc/size:method"}}{{/crossLink}} alias function instead.<br/>
  11610. It will be deprecated soon, please use cc.Vec2 instead.
  11611. !#zh
  11612. cc.Size 是 size 对象的类。<br/>
  11613. 请不要使用它的构造函数创建的 size,<br/>
  11614. 使用 {{#crossLink "cc/size:method"}}{{/crossLink}} 别名函数。<br/>
  11615. 它不久将被取消,请使用cc.Vec2代替。 */
  11616. export class Size {
  11617. /**
  11618. @param width width
  11619. @param height height
  11620. */
  11621. constructor(width: number|Size, height?: number);
  11622. width: number;
  11623. height: number;
  11624. /** !#en return a Size object with width = 0 and height = 0.
  11625. !#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */
  11626. static ZERO: Size;
  11627. /**
  11628. !#en TODO
  11629. !#zh 克隆 size 对象。
  11630. @example
  11631. ```js
  11632. var a = new cc.size(10, 10);
  11633. a.clone();// return Size {width: 0, height: 0};
  11634. ```
  11635. */
  11636. clone(): Size;
  11637. /**
  11638. !#en TODO
  11639. !#zh 当前 Size 对象是否等于指定 Size 对象。
  11640. @param other other
  11641. @example
  11642. ```js
  11643. var a = new cc.size(10, 10);
  11644. a.equals(new cc.size(10, 10));// return true;
  11645. ```
  11646. */
  11647. equals(other: Size): boolean;
  11648. /**
  11649. !#en TODO
  11650. !#zh 线性插值。
  11651. @param to to
  11652. @param ratio the interpolation coefficient.
  11653. @param out optional, the receiving vector.
  11654. @example
  11655. ```js
  11656. var a = new cc.size(10, 10);
  11657. var b = new cc.rect(50, 50, 100, 100);
  11658. update (dt) {
  11659. // method 1;
  11660. var c = a.lerp(b, dt * 0.1);
  11661. // method 2;
  11662. a.lerp(b, dt * 0.1, c);
  11663. }
  11664. ```
  11665. */
  11666. lerp(to: Rect, ratio: number, out?: Size): Size;
  11667. /**
  11668. !#en TODO
  11669. !#zh 转换为方便阅读的字符串。
  11670. @example
  11671. ```js
  11672. var a = new cc.size(10, 10);
  11673. a.toString();// return "(10.00, 10.00)";
  11674. ```
  11675. */
  11676. toString(): string;
  11677. }
  11678. /** !#en The base class of all value types.
  11679. !#zh 所有值类型的基类。 */
  11680. export class ValueType {
  11681. /**
  11682. !#en This method returns an exact copy of current value.
  11683. !#zh 克隆当前值,该方法返回一个新对象,新对象的值和原对象相等。
  11684. */
  11685. clone(): ValueType;
  11686. /**
  11687. !#en Compares this object with the other one.
  11688. !#zh 当前对象是否等于指定对象。
  11689. @param other other
  11690. */
  11691. equals(other: ValueType): boolean;
  11692. /**
  11693. !#en
  11694. Linearly interpolates between this value to to value by ratio which is in the range [0, 1].
  11695. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
  11696. !#zh
  11697. 线性插值。<br/>
  11698. 当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
  11699. @param to the to value
  11700. @param ratio the interpolation coefficient
  11701. */
  11702. lerp(to: ValueType, ratio: number): ValueType;
  11703. /**
  11704. !#en
  11705. Copys all the properties from another given object to this value.
  11706. !#zh
  11707. 从其它对象把所有属性复制到当前对象。
  11708. @param source the source to copy
  11709. */
  11710. set(source: ValueType): void;
  11711. /**
  11712. !#en TODO
  11713. !#zh 转换为方便阅读的字符串。
  11714. */
  11715. toString(): string;
  11716. }
  11717. /** !#en Representation of 2D vectors and points.
  11718. !#zh 表示 2D 向量和坐标 */
  11719. export class Vec2 extends ValueType {
  11720. /**
  11721. !#en
  11722. Constructor
  11723. see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  11724. !#zh
  11725. 构造函数,可查看 {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} 或者 {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  11726. @param x x
  11727. @param y y
  11728. */
  11729. constructor(x?: number, y?: number);
  11730. x: number;
  11731. y: number;
  11732. /**
  11733. !#en clone a Vec2 object
  11734. !#zh 克隆一个 Vec2 对象
  11735. */
  11736. clone(): Vec2;
  11737. /**
  11738. !#en Sets vector with another's value
  11739. !#zh 设置向量值。
  11740. @param newValue !#en new value to set. !#zh 要设置的新值
  11741. */
  11742. set(newValue: Vec2): Vec2;
  11743. /**
  11744. !#en Check whether two vector equal
  11745. !#zh 当前的向量是否与指定的向量相等。
  11746. @param other other
  11747. */
  11748. equals(other: Vec2): boolean;
  11749. /**
  11750. !#en Check whether two vector equal with some degree of variance.
  11751. !#zh
  11752. 近似判断两个点是否相等。<br/>
  11753. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  11754. @param other other
  11755. @param variance variance
  11756. */
  11757. fuzzyEquals(other: Vec2, variance: number): boolean;
  11758. /**
  11759. !#en Transform to string with vector informations
  11760. !#zh 转换为方便阅读的字符串。
  11761. */
  11762. toString(): string;
  11763. /**
  11764. !#en Calculate linear interpolation result between this vector and another one with given ratio
  11765. !#zh 线性插值。
  11766. @param to to
  11767. @param ratio the interpolation coefficient
  11768. @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
  11769. */
  11770. lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;
  11771. /**
  11772. !#en Clamp the vector between from float and to float.
  11773. !#zh
  11774. 返回指定限制区域后的向量。<br/>
  11775. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  11776. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  11777. 否则返回自身。
  11778. @param min_inclusive min_inclusive
  11779. @param max_inclusive max_inclusive
  11780. @example
  11781. ```js
  11782. var min_inclusive = cc.v2(0, 0);
  11783. var max_inclusive = cc.v2(20, 20);
  11784. var v1 = cc.v2(20, 20).clampf(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
  11785. var v2 = cc.v2(0, 0).clampf(min_inclusive, max_inclusive); // Vec2 {x: 0, y: 0};
  11786. var v3 = cc.v2(10, 10).clampf(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
  11787. ```
  11788. */
  11789. clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;
  11790. /**
  11791. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  11792. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  11793. @param vector vector
  11794. @example
  11795. ```js
  11796. var v = cc.v2(10, 10);
  11797. v.addSelf(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
  11798. ```
  11799. */
  11800. addSelf(vector: Vec2): Vec2;
  11801. /**
  11802. !#en Adds two vectors, and returns the new result.
  11803. !#zh 向量加法,并返回新结果。
  11804. @param vector vector
  11805. @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
  11806. @example
  11807. ```js
  11808. var v = cc.v2(10, 10);
  11809. v.add(cc.v2(5, 5)); // return Vec2 {x: 15, y: 15};
  11810. var v1;
  11811. v.add(cc.v2(5, 5), v1); // return Vec2 {x: 15, y: 15};
  11812. ```
  11813. */
  11814. add(vector: Vec2, out?: Vec2): Vec2;
  11815. /**
  11816. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  11817. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  11818. @param vector vector
  11819. @example
  11820. ```js
  11821. var v = cc.v2(10, 10);
  11822. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  11823. ```
  11824. */
  11825. subSelf(vector: Vec2): Vec2;
  11826. /**
  11827. !#en Subtracts one vector from this, and returns the new result.
  11828. !#zh 向量减法,并返回新结果。
  11829. @param vector vector
  11830. @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
  11831. @example
  11832. ```js
  11833. var v = cc.v2(10, 10);
  11834. v.sub(cc.v2(5, 5)); // return Vec2 {x: 5, y: 5};
  11835. var v1;
  11836. v.sub(cc.v2(5, 5), v1); // return Vec2 {x: 5, y: 5};
  11837. ```
  11838. */
  11839. sub(vector: Vec2, out?: Vec2): Vec2;
  11840. /**
  11841. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  11842. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  11843. @param num num
  11844. @example
  11845. ```js
  11846. var v = cc.v2(10, 10);
  11847. v.mulSelf(5);// return Vec2 {x: 50, y: 50};
  11848. ```
  11849. */
  11850. mulSelf(num: number): Vec2;
  11851. /**
  11852. !#en Multiplies by a number, and returns the new result.
  11853. !#zh 缩放向量,并返回新结果。
  11854. @param num num
  11855. @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
  11856. @example
  11857. ```js
  11858. var v = cc.v2(10, 10);
  11859. v.mul(5); // return Vec2 {x: 50, y: 50};
  11860. var v1;
  11861. v.mul(5, v1); // return Vec2 {x: 50, y: 50};
  11862. ```
  11863. */
  11864. mul(num: number, out?: Vec2): Vec2;
  11865. /**
  11866. !#en Multiplies two vectors.
  11867. !#zh 分量相乘。
  11868. @param vector vector
  11869. @example
  11870. ```js
  11871. var v = cc.v2(10, 10);
  11872. v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  11873. ```
  11874. */
  11875. scaleSelf(vector: Vec2): Vec2;
  11876. /**
  11877. !#en Multiplies two vectors, and returns the new result.
  11878. !#zh 分量相乘,并返回新的结果。
  11879. @param vector vector
  11880. @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
  11881. @example
  11882. ```js
  11883. var v = cc.v2(10, 10);
  11884. v.scale(cc.v2(5, 5)); // return Vec2 {x: 50, y: 50};
  11885. var v1;
  11886. v.scale(cc.v2(5, 5), v1); // return Vec2 {x: 50, y: 50};
  11887. ```
  11888. */
  11889. scale(vector: Vec2, out?: Vec2): Vec2;
  11890. /**
  11891. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  11892. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  11893. @param divisor divisor
  11894. @example
  11895. ```js
  11896. var v = cc.v2(10, 10);
  11897. v.divSelf(5); // return Vec2 {x: 2, y: 2};
  11898. ```
  11899. */
  11900. divSelf(divisor: Vec2): Vec2;
  11901. /**
  11902. !#en Divides by a number, and returns the new result.
  11903. !#zh 向量除法,并返回新的结果。
  11904. @param divisor divisor
  11905. @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
  11906. @example
  11907. ```js
  11908. var v = cc.v2(10, 10);
  11909. v.div(5); // return Vec2 {x: 2, y: 2};
  11910. var v1;
  11911. v.div(5, v1); // return Vec2 {x: 2, y: 2};
  11912. ```
  11913. */
  11914. div(divisor: Vec2, out?: Vec2): Vec2;
  11915. /**
  11916. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  11917. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  11918. @example
  11919. ```js
  11920. var v = cc.v2(10, 10);
  11921. v.negSelf(); // return Vec2 {x: -10, y: -10};
  11922. ```
  11923. */
  11924. negSelf(): Vec2;
  11925. /**
  11926. !#en Negates the components, and returns the new result.
  11927. !#zh 返回取反后的新向量。
  11928. @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
  11929. @example
  11930. ```js
  11931. var v = cc.v2(10, 10);
  11932. var v1;
  11933. v.neg(v1); // return Vec2 {x: -10, y: -10};
  11934. ```
  11935. */
  11936. neg(out?: Vec2): Vec2;
  11937. /**
  11938. !#en Dot product
  11939. !#zh 当前向量与指定向量进行点乘。
  11940. @param vector vector
  11941. @example
  11942. ```js
  11943. var v = cc.v2(10, 10);
  11944. v.dot(cc.v2(5, 5)); // return 100;
  11945. ```
  11946. */
  11947. dot(vector?: Vec2): number;
  11948. /**
  11949. !#en Cross product
  11950. !#zh 当前向量与指定向量进行叉乘。
  11951. @param vector vector
  11952. @example
  11953. ```js
  11954. var v = cc.v2(10, 10);
  11955. v.cross(cc.v2(5, 5)); // return 0;
  11956. ```
  11957. */
  11958. cross(vector?: Vec2): number;
  11959. /**
  11960. !#en Returns the length of this vector.
  11961. !#zh 返回该向量的长度。
  11962. @example
  11963. ```js
  11964. var v = cc.v2(10, 10);
  11965. v.mag(); // return 14.142135623730951;
  11966. ```
  11967. */
  11968. mag(): number;
  11969. /**
  11970. !#en Returns the squared length of this vector.
  11971. !#zh 返回该向量的长度平方。
  11972. @example
  11973. ```js
  11974. var v = cc.v2(10, 10);
  11975. v.magSqr(); // return 200;
  11976. ```
  11977. */
  11978. magSqr(): number;
  11979. /**
  11980. !#en Make the length of this vector to 1.
  11981. !#zh 向量归一化,让这个向量的长度为 1。
  11982. @example
  11983. ```js
  11984. var v = cc.v2(10, 10);
  11985. v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
  11986. ```
  11987. */
  11988. normalizeSelf(): Vec2;
  11989. /**
  11990. !#en
  11991. Returns this vector with a magnitude of 1.<br/>
  11992. <br/>
  11993. 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.
  11994. !#zh
  11995. 返回归一化后的向量。<br/>
  11996. <br/>
  11997. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  11998. @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
  11999. */
  12000. normalize(out?: Vec2): Vec2;
  12001. /**
  12002. !#en Get angle in radian between this and vector.
  12003. !#zh 夹角的弧度。
  12004. @param vector vector
  12005. */
  12006. angle(vector: Vec2): number;
  12007. /**
  12008. !#en Get angle in radian between this and vector with direction.
  12009. !#zh 带方向的夹角的弧度。
  12010. @param vector vector
  12011. */
  12012. signAngle(vector: Vec2): number;
  12013. /**
  12014. !#en rotate
  12015. !#zh 返回旋转给定弧度后的新向量。
  12016. @param radians radians
  12017. @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
  12018. */
  12019. rotate(radians: number, out?: Vec2): Vec2;
  12020. /**
  12021. !#en rotate self
  12022. !#zh 按指定弧度旋转向量。
  12023. @param radians radians
  12024. */
  12025. rotateSelf(radians: number): Vec2;
  12026. /**
  12027. !#en Calculates the projection of the current vector over the given vector.
  12028. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  12029. @param vector vector
  12030. @example
  12031. ```js
  12032. var v1 = cc.v2(20, 20);
  12033. var v2 = cc.v2(5, 5);
  12034. v1.project(v2); // Vec2 {x: 20, y: 20};
  12035. ```
  12036. */
  12037. project(vector: Vec2): Vec2;
  12038. /**
  12039. Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  12040. @param m matrix to transform with
  12041. @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
  12042. */
  12043. transformMat4(m: (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) => void, out?: Vec2): Vec2;
  12044. /** !#en return a Vec2 object with x = 1 and y = 1.
  12045. !#zh 新 Vec2 对象。 */
  12046. static ONE: Vec2;
  12047. /** !#en return a Vec2 object with x = 0 and y = 0.
  12048. !#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */
  12049. static ZERO: Vec2;
  12050. /** !#en return a Vec2 object with x = 0 and y = 1.
  12051. !#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */
  12052. static UP: Vec2;
  12053. /** !#en return a Vec2 object with x = 1 and y = 0.
  12054. !#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */
  12055. static RIGHT: Vec2;
  12056. }
  12057. /** !#en Representation of 3D vectors and points.
  12058. !#zh 表示 3D 向量和坐标 */
  12059. export class Vec3 extends ValueType {
  12060. /**
  12061. !#en
  12062. Constructor
  12063. see {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  12064. !#zh
  12065. 构造函数,可查看 {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  12066. @param x x
  12067. @param y y
  12068. @param z z
  12069. */
  12070. constructor(x?: number, y?: number, z?: number);
  12071. x: number;
  12072. y: number;
  12073. z: number;
  12074. /**
  12075. !#en clone a Vec3 value
  12076. !#zh 克隆一个 Vec3 值
  12077. */
  12078. clone(): Vec3;
  12079. /**
  12080. !#en Set the current vector value with the given vector.
  12081. !#zh 用另一个向量设置当前的向量对象值。
  12082. @param newValue !#en new value to set. !#zh 要设置的新值
  12083. */
  12084. set(newValue: Vec3): Vec3;
  12085. /**
  12086. !#en Check whether the vector equals another one
  12087. !#zh 当前的向量是否与指定的向量相等。
  12088. @param other other
  12089. */
  12090. equals(other: Vec3): boolean;
  12091. /**
  12092. !#en Check whether two vector equal with some degree of variance.
  12093. !#zh
  12094. 近似判断两个点是否相等。<br/>
  12095. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  12096. @param other other
  12097. @param variance variance
  12098. */
  12099. fuzzyEquals(other: Vec3, variance: number): boolean;
  12100. /**
  12101. !#en Transform to string with vector informations
  12102. !#zh 转换为方便阅读的字符串。
  12103. */
  12104. toString(): string;
  12105. /**
  12106. !#en Calculate linear interpolation result between this vector and another one with given ratio
  12107. !#zh 线性插值。
  12108. @param to to
  12109. @param ratio the interpolation coefficient
  12110. @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
  12111. */
  12112. lerp(to: Vec3, ratio: number, out?: Vec3): Vec3;
  12113. /**
  12114. !#en Clamp the vector between from float and to float.
  12115. !#zh
  12116. 返回指定限制区域后的向量。<br/>
  12117. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  12118. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  12119. 否则返回自身。
  12120. @param min_inclusive min_inclusive
  12121. @param max_inclusive max_inclusive
  12122. */
  12123. clampf(min_inclusive: Vec3, max_inclusive: Vec3): Vec3;
  12124. /**
  12125. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  12126. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  12127. @param vector vector
  12128. */
  12129. addSelf(vector: Vec3): Vec3;
  12130. /**
  12131. !#en Adds two vectors, and returns the new result.
  12132. !#zh 向量加法,并返回新结果。
  12133. @param vector vector
  12134. @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
  12135. */
  12136. add(vector: Vec3, out?: Vec3): Vec3;
  12137. /**
  12138. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  12139. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  12140. @param vector vector
  12141. */
  12142. subSelf(vector: Vec3): Vec3;
  12143. /**
  12144. !#en Subtracts one vector from this, and returns the new result.
  12145. !#zh 向量减法,并返回新结果。
  12146. @param vector vector
  12147. @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
  12148. */
  12149. sub(vector: Vec3, out?: Vec3): Vec3;
  12150. /**
  12151. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  12152. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  12153. @param num num
  12154. */
  12155. mulSelf(num: number): Vec3;
  12156. /**
  12157. !#en Multiplies by a number, and returns the new result.
  12158. !#zh 缩放向量,并返回新结果。
  12159. @param num num
  12160. @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
  12161. */
  12162. mul(num: number, out?: Vec3): Vec3;
  12163. /**
  12164. !#en Multiplies two vectors.
  12165. !#zh 分量相乘。
  12166. @param vector vector
  12167. */
  12168. scaleSelf(vector: Vec3): Vec3;
  12169. /**
  12170. !#en Multiplies two vectors, and returns the new result.
  12171. !#zh 分量相乘,并返回新的结果。
  12172. @param vector vector
  12173. @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
  12174. */
  12175. scale(vector: Vec3, out?: Vec3): Vec3;
  12176. /**
  12177. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  12178. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  12179. @param vector vector
  12180. */
  12181. divSelf(vector: Vec3): Vec3;
  12182. /**
  12183. !#en Divides by a number, and returns the new result.
  12184. !#zh 向量除法,并返回新的结果。
  12185. @param vector vector
  12186. @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
  12187. */
  12188. div(vector: Vec3, out?: Vec3): Vec3;
  12189. /**
  12190. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  12191. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  12192. */
  12193. negSelf(): Vec3;
  12194. /**
  12195. !#en Negates the components, and returns the new result.
  12196. !#zh 返回取反后的新向量。
  12197. @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
  12198. */
  12199. neg(out?: Vec3): Vec3;
  12200. /**
  12201. !#en Dot product
  12202. !#zh 当前向量与指定向量进行点乘。
  12203. @param vector vector
  12204. */
  12205. dot(vector?: Vec3): number;
  12206. /**
  12207. !#en Cross product
  12208. !#zh 当前向量与指定向量进行叉乘。
  12209. @param vector vector
  12210. @param out out
  12211. */
  12212. cross(vector: Vec3, out?: Vec3): Vec3;
  12213. /**
  12214. !#en Returns the length of this vector.
  12215. !#zh 返回该向量的长度。
  12216. @example
  12217. ```js
  12218. var v = cc.v2(10, 10);
  12219. v.mag(); // return 14.142135623730951;
  12220. ```
  12221. */
  12222. mag(): number;
  12223. /**
  12224. !#en Returns the squared length of this vector.
  12225. !#zh 返回该向量的长度平方。
  12226. */
  12227. magSqr(): number;
  12228. /**
  12229. !#en Make the length of this vector to 1.
  12230. !#zh 向量归一化,让这个向量的长度为 1。
  12231. */
  12232. normalizeSelf(): Vec3;
  12233. /**
  12234. !#en
  12235. Returns this vector with a magnitude of 1.<br/>
  12236. <br/>
  12237. 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.
  12238. !#zh
  12239. 返回归一化后的向量。<br/>
  12240. <br/>
  12241. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  12242. @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
  12243. */
  12244. normalize(out?: Vec3): Vec3;
  12245. /**
  12246. Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  12247. @param m matrix to transform with
  12248. @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
  12249. */
  12250. transformMat4(m: (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) => void, out?: vec3): vec3;
  12251. /**
  12252. !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
  12253. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
  12254. @param x x
  12255. @param y y
  12256. @param z z
  12257. @example
  12258. ```js
  12259. var v1 = cc.v3();
  12260. var v2 = cc.v3(0, 0, 0);
  12261. var v3 = cc.v3(v2);
  12262. var v4 = cc.v3({x: 100, y: 100, z: 0});
  12263. ```
  12264. */
  12265. v3(x?: number|any, y?: number, z?: number): Vec3;
  12266. }
  12267. /** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.
  12268. !#zh EditBox 组件,用于获取用户的输入文本。 */
  12269. export class EditBox extends Component {
  12270. /** !#en Input string of EditBox.
  12271. !#zh 输入框的初始输入内容,如果为空则会显示占位符的文本。 */
  12272. string: string;
  12273. /** !#en The background image of EditBox.
  12274. !#zh 输入框的背景图片 */
  12275. backgroundImage: SpriteFrame;
  12276. /** !#en
  12277. The return key type of EditBox.
  12278. Note: it is meaningless for web platforms and desktop platforms.
  12279. !#zh
  12280. 指定移动设备上面回车按钮的样式。
  12281. 注意:这个选项对 web 平台与 desktop 平台无效。 */
  12282. returnType: EditBox.KeyboardReturnType;
  12283. /** !#en Set the input flags that are to be applied to the EditBox.
  12284. !#zh 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。 */
  12285. inputFlag: EditBox.InputFlag;
  12286. /** !#en
  12287. Set the input mode of the edit box.
  12288. If you pass ANY, it will create a multiline EditBox.
  12289. !#zh
  12290. 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。 */
  12291. inputMode: EditBox.InputMode;
  12292. /** !#en Font size of the input text.
  12293. !#zh 输入框文本的字体大小 */
  12294. fontSize: number;
  12295. /** !#en Change the lineHeight of displayed text.
  12296. !#zh 输入框文本的行高。 */
  12297. lineHeight: number;
  12298. /** !#en Font color of the input text.
  12299. !#zh 输入框文本的颜色。 */
  12300. fontColor: Color;
  12301. /** !#en The display text of placeholder.
  12302. !#zh 输入框占位符的文本内容。 */
  12303. placeholder: string;
  12304. /** !#en The font size of placeholder.
  12305. !#zh 输入框占位符的字体大小。 */
  12306. placeholderFontSize: number;
  12307. /** !#en The font color of placeholder.
  12308. !#zh 输入框占位符的字体颜色。 */
  12309. placeholderFontColor: Color;
  12310. /** !#en The maximize input length of EditBox.
  12311. - If pass a value less than 0, it won't limit the input number of characters.
  12312. - If pass 0, it doesn't allow input any characters.
  12313. !#zh 输入框最大允许输入的字符个数。
  12314. - 如果值为小于 0 的值,则不会限制输入字符个数。
  12315. - 如果值为 0,则不允许用户进行任何输入。 */
  12316. maxLength: number;
  12317. /** !#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
  12318. !zh 输入框总是可见,并且永远在游戏视图的上面(这个属性只有在 Web 上面修改有意义),该属性会在 v2.1 中移除
  12319. Note: only available on Web at the moment. */
  12320. stayOnTop: boolean;
  12321. /** !#en Set the tabIndex of the DOM input element (only useful on Web).
  12322. !#zh 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。 */
  12323. tabIndex: number;
  12324. /** !#en The event handler to be called when EditBox began to edit text.
  12325. !#zh 开始编辑文本输入框触发的事件回调。 */
  12326. editingDidBegan: Component.EventHandler[];
  12327. /** !#en The event handler to be called when EditBox text changes.
  12328. !#zh 编辑文本输入框时触发的事件回调。 */
  12329. textChanged: Component.EventHandler[];
  12330. /** !#en The event handler to be called when EditBox edit ends.
  12331. !#zh 结束编辑文本输入框时触发的事件回调。 */
  12332. editingDidEnded: Component.EventHandler[];
  12333. /** !#en The event handler to be called when return key is pressed. Windows is not supported.
  12334. !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 */
  12335. editingReturn: Component.EventHandler[];
  12336. /**
  12337. !#en Let the EditBox get focus, this method will be removed on v2.1
  12338. !#zh 让当前 EditBox 获得焦点, 这个方法会在 v2.1 中移除
  12339. */
  12340. setFocus(): void;
  12341. /**
  12342. !#en Determine whether EditBox is getting focus or not.
  12343. !#zh 判断 EditBox 是否获得了焦点
  12344. Note: only available on Web at the moment.
  12345. */
  12346. isFocused(): void;
  12347. /**
  12348. !#en if you don't need the EditBox and it isn't in any running Scene, you should
  12349. call the destroy method on this component or the associated node explicitly.
  12350. Otherwise, the created DOM element won't be removed from web page.
  12351. !#zh
  12352. 如果你不再使用 EditBox,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  12353. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  12354. @example
  12355. ```js
  12356. editbox.node.parent = null; // or editbox.node.removeFromParent(false);
  12357. // when you don't need editbox anymore
  12358. editbox.node.destroy();
  12359. ```
  12360. */
  12361. destroy(): boolean;
  12362. }
  12363. /** undefined */
  12364. export class PhysicsBoxCollider extends PhysicsCollider implements Collider.Box {
  12365. /** !#en Position offset
  12366. !#zh 位置偏移量 */
  12367. offset: Vec2;
  12368. /** !#en Box size
  12369. !#zh 包围盒大小 */
  12370. size: Size;
  12371. }
  12372. /** undefined */
  12373. export class PhysicsChainCollider extends PolygonCollider {
  12374. /** !#en Whether the chain is loop
  12375. !#zh 链条是否首尾相连 */
  12376. loop: boolean;
  12377. /** !#en Chain points
  12378. !#zh 链条顶点数组 */
  12379. points: Vec2[];
  12380. }
  12381. /** undefined */
  12382. export class PhysicsCircleCollider extends PhysicsCollider implements Collider.Circle {
  12383. /** !#en Position offset
  12384. !#zh 位置偏移量 */
  12385. offset: Vec2;
  12386. /** !#en Circle radius
  12387. !#zh 圆形半径 */
  12388. radius: number;
  12389. }
  12390. /** undefined */
  12391. export class PhysicsCollider extends Collider {
  12392. /** !#en
  12393. The density.
  12394. !#zh
  12395. 密度 */
  12396. density: number;
  12397. /** !#en
  12398. A sensor collider collects contact information but never generates a collision response
  12399. !#zh
  12400. 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。 */
  12401. sensor: boolean;
  12402. /** !#en
  12403. The friction coefficient, usually in the range [0,1].
  12404. !#zh
  12405. 摩擦系数,取值一般在 [0, 1] 之间 */
  12406. friction: number;
  12407. /** !#en
  12408. The restitution (elasticity) usually in the range [0,1].
  12409. !#zh
  12410. 弹性系数,取值一般在 [0, 1]之间 */
  12411. restitution: number;
  12412. /** !#en
  12413. Physics collider will find the rigidbody component on the node and set to this property.
  12414. !#zh
  12415. 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。 */
  12416. body: RigidBody;
  12417. /**
  12418. !#en
  12419. Apply current changes to collider, this will regenerate inner box2d fixtures.
  12420. !#zh
  12421. 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
  12422. */
  12423. apply(): void;
  12424. /**
  12425. !#en
  12426. Get the world aabb of the collider
  12427. !#zh
  12428. 获取碰撞体的世界坐标系下的包围盒
  12429. */
  12430. getAABB(): void;
  12431. }
  12432. /** undefined */
  12433. export class PhysicsPolygonCollider extends PhysicsCollider implements Collider.Polygon {
  12434. /** !#en Position offset
  12435. !#zh 位置偏移量 */
  12436. offset: Vec2;
  12437. /** !#en Polygon points
  12438. !#zh 多边形顶点数组 */
  12439. points: Vec2[];
  12440. }
  12441. /** !#en
  12442. A distance joint constrains two points on two bodies
  12443. to remain at a fixed distance from each other. You can view
  12444. this as a massless, rigid rod.
  12445. !#zh
  12446. 距离关节通过一个固定的长度来约束关节链接的两个刚体。你可以将它想象成一个无质量,坚固的木棍。 */
  12447. export class DistanceJoint extends Joint {
  12448. /** !#en
  12449. The distance separating the two ends of the joint.
  12450. !#zh
  12451. 关节两端的距离 */
  12452. distance: number;
  12453. /** !#en
  12454. The spring frequency.
  12455. !#zh
  12456. 弹性系数。 */
  12457. frequency: number;
  12458. /** !#en
  12459. The damping ratio.
  12460. !#zh
  12461. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12462. dampingRatio: number;
  12463. }
  12464. /** !#en
  12465. Base class for joints to connect rigidbody.
  12466. !#zh
  12467. 关节类的基类 */
  12468. export class Joint extends Component {
  12469. /** !#en
  12470. The anchor of the rigidbody.
  12471. !#zh
  12472. 刚体的锚点。 */
  12473. anchor: Vec2;
  12474. /** !#en
  12475. The anchor of the connected rigidbody.
  12476. !#zh
  12477. 关节另一端刚体的锚点。 */
  12478. connectedAnchor: Vec2;
  12479. /** !#en
  12480. The rigidbody to which the other end of the joint is attached.
  12481. !#zh
  12482. 关节另一端链接的刚体 */
  12483. connectedBody: RigidBody;
  12484. /** !#en
  12485. Should the two rigid bodies connected with this joint collide with each other?
  12486. !#zh
  12487. 链接到关节上的两个刚体是否应该相互碰撞? */
  12488. collideConnected: boolean;
  12489. /**
  12490. !#en
  12491. Apply current changes to joint, this will regenerate inner box2d joint.
  12492. !#zh
  12493. 应用当前关节中的修改,调用此函数会重新生成内部 box2d 的关节。
  12494. */
  12495. apply(): void;
  12496. /**
  12497. !#en
  12498. Get the anchor point on rigidbody in world coordinates.
  12499. !#zh
  12500. 获取刚体世界坐标系下的锚点。
  12501. */
  12502. getWorldAnchor(): Vec2;
  12503. /**
  12504. !#en
  12505. Get the anchor point on connected rigidbody in world coordinates.
  12506. !#zh
  12507. 获取链接刚体世界坐标系下的锚点。
  12508. */
  12509. getWorldConnectedAnchor(): Vec2;
  12510. /**
  12511. !#en
  12512. Gets the reaction force of the joint.
  12513. !#zh
  12514. 获取关节的反作用力。
  12515. @param timeStep The time to calculate the reaction force for.
  12516. */
  12517. getReactionForce(timeStep: number): Vec2;
  12518. /**
  12519. !#en
  12520. Gets the reaction torque of the joint.
  12521. !#zh
  12522. 获取关节的反扭矩。
  12523. @param timeStep The time to calculate the reaction torque for.
  12524. */
  12525. getReactionTorque(timeStep: number): number;
  12526. }
  12527. /** !#en
  12528. A motor joint is used to control the relative motion
  12529. between two bodies. A typical usage is to control the movement
  12530. of a dynamic body with respect to the ground.
  12531. !#zh
  12532. 马达关节被用来控制两个刚体间的相对运动。
  12533. 一个典型的例子是用来控制一个动态刚体相对于地面的运动。 */
  12534. export class MotorJoint extends Joint {
  12535. /** !#en
  12536. The anchor of the rigidbody.
  12537. !#zh
  12538. 刚体的锚点。 */
  12539. anchor: Vec2;
  12540. /** !#en
  12541. The anchor of the connected rigidbody.
  12542. !#zh
  12543. 关节另一端刚体的锚点。 */
  12544. connectedAnchor: Vec2;
  12545. /** !#en
  12546. The linear offset from connected rigidbody to rigidbody.
  12547. !#zh
  12548. 关节另一端的刚体相对于起始端刚体的位置偏移量 */
  12549. linearOffset: Vec2;
  12550. /** !#en
  12551. The angular offset from connected rigidbody to rigidbody.
  12552. !#zh
  12553. 关节另一端的刚体相对于起始端刚体的角度偏移量 */
  12554. angularOffset: number;
  12555. /** !#en
  12556. The maximum force can be applied to rigidbody.
  12557. !#zh
  12558. 可以应用于刚体的最大的力值 */
  12559. maxForce: number;
  12560. /** !#en
  12561. The maximum torque can be applied to rigidbody.
  12562. !#zh
  12563. 可以应用于刚体的最大扭矩值 */
  12564. maxTorque: number;
  12565. /** !#en
  12566. The position correction factor in the range [0,1].
  12567. !#zh
  12568. 位置矫正系数,范围为 [0, 1] */
  12569. correctionFactor: number;
  12570. }
  12571. /** !#en
  12572. A mouse joint is used to make a point on a body track a
  12573. specified world point. This a soft constraint with a maximum
  12574. force. This allows the constraint to stretch and without
  12575. applying huge forces.
  12576. Mouse Joint will auto register the touch event with the mouse region node,
  12577. and move the choosed rigidbody in touch move event.
  12578. Note : generally mouse joint only used in test bed.
  12579. !#zh
  12580. 鼠标关节用于使刚体上的一个点追踪一个指定的世界坐标系下的位置。
  12581. 鼠标关节可以指定一个最大的里来施加一个柔和的约束。
  12582. 鼠标关节会自动使用 mouse region 节点来注册鼠标事件,并且在触摸移动事件中移动选中的刚体。
  12583. 注意:一般鼠标关节只在测试环境中使用。 */
  12584. export class MouseJoint extends Joint {
  12585. /** !#en
  12586. The anchor of the rigidbody.
  12587. !#zh
  12588. 刚体的锚点。 */
  12589. anchor: Vec2;
  12590. /** !#en
  12591. The anchor of the connected rigidbody.
  12592. !#zh
  12593. 关节另一端刚体的锚点。 */
  12594. connectedAnchor: Vec2;
  12595. /** !#en
  12596. The node used to register touch evnet.
  12597. If this is null, it will be the joint's node.
  12598. !#zh
  12599. 用于注册触摸事件的节点。
  12600. 如果没有设置这个值,那么将会使用关节的节点来注册事件。 */
  12601. mouseRegion: Node;
  12602. /** !#en
  12603. The target point.
  12604. The mouse joint will move choosed rigidbody to target point.
  12605. !#zh
  12606. 目标点,鼠标关节将会移动选中的刚体到指定的目标点 */
  12607. target: Vec2;
  12608. /** !#en
  12609. The spring frequency.
  12610. !#zh
  12611. 弹簧系数。 */
  12612. frequency: number;
  12613. /** !#en
  12614. The damping ratio.
  12615. !#zh
  12616. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12617. 0: number;
  12618. /** !#en
  12619. The maximum force
  12620. !#zh
  12621. 最大阻力值 */
  12622. maxForce: number;
  12623. }
  12624. /** !#en
  12625. A prismatic joint. This joint provides one degree of freedom: translation
  12626. along an axis fixed in rigidbody. Relative rotation is prevented. You can
  12627. use a joint limit to restrict the range of motion and a joint motor to
  12628. drive the motion or to model joint friction.
  12629. !#zh
  12630. 移动关节指定了只能在一个方向上移动刚体。
  12631. 你可以开启关节限制来设置刚体运行移动的间距,也可以开启马达来使用关节马达驱动刚体的运行。 */
  12632. export class PrismaticJoint extends Joint {
  12633. /** !#en
  12634. The local joint axis relative to rigidbody.
  12635. !#zh
  12636. 指定刚体可以移动的方向。 */
  12637. localAxisA: Vec2;
  12638. /** !#en
  12639. The reference angle.
  12640. !#zh
  12641. 相对角度 */
  12642. referenceAngle: number;
  12643. /** !#en
  12644. Enable joint distance limit?
  12645. !#zh
  12646. 是否开启关节的距离限制? */
  12647. enableLimit: boolean;
  12648. /** !#en
  12649. Enable joint motor?
  12650. !#zh
  12651. 是否开启关节马达? */
  12652. enableMotor: boolean;
  12653. /** !#en
  12654. The lower joint limit.
  12655. !#zh
  12656. 刚体能够移动的最小值 */
  12657. lowerLimit: number;
  12658. /** !#en
  12659. The upper joint limit.
  12660. !#zh
  12661. 刚体能够移动的最大值 */
  12662. upperLimit: number;
  12663. /** !#en
  12664. The maxium force can be applied to rigidbody to rearch the target motor speed.
  12665. !#zh
  12666. 可以施加到刚体的最大力。 */
  12667. maxMotorForce: number;
  12668. /** !#en
  12669. The expected motor speed.
  12670. !#zh
  12671. 期望的马达速度。 */
  12672. motorSpeed: number;
  12673. }
  12674. /** !#en
  12675. A revolute joint constrains two bodies to share a common point while they
  12676. are free to rotate about the point. The relative rotation about the shared
  12677. point is the joint angle. You can limit the relative rotation with
  12678. a joint limit that specifies a lower and upper angle. You can use a motor
  12679. to drive the relative rotation about the shared point. A maximum motor torque
  12680. is provided so that infinite forces are not generated.
  12681. !#zh
  12682. 旋转关节可以约束两个刚体围绕一个点来进行旋转。
  12683. 你可以通过开启关节限制来限制旋转的最大角度和最小角度。
  12684. 你可以通过开启马达来施加一个扭矩力来驱动这两个刚体在这一点上的相对速度。 */
  12685. export class RevoluteJoint extends Joint {
  12686. /** !#en
  12687. The reference angle.
  12688. An angle between bodies considered to be zero for the joint angle.
  12689. !#zh
  12690. 相对角度。
  12691. 两个物体之间角度为零时可以看作相等于关节角度 */
  12692. referenceAngle: number;
  12693. /** !#en
  12694. The lower angle.
  12695. !#zh
  12696. 角度的最低限制。 */
  12697. lowerAngle: number;
  12698. /** !#en
  12699. The upper angle.
  12700. !#zh
  12701. 角度的最高限制。 */
  12702. upperAngle: number;
  12703. /** !#en
  12704. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  12705. !#zh
  12706. 可以施加到刚体的最大扭矩。 */
  12707. maxMotorTorque: number;
  12708. /** !#en
  12709. The expected motor speed.
  12710. !#zh
  12711. 期望的马达速度。 */
  12712. motorSpeed: number;
  12713. /** !#en
  12714. Enable joint limit?
  12715. !#zh
  12716. 是否开启关节的限制? */
  12717. enableLimit: boolean;
  12718. /** !#en
  12719. Enable joint motor?
  12720. !#zh
  12721. 是否开启关节马达? */
  12722. enableMotor: boolean;
  12723. /**
  12724. !#en
  12725. Get the joint angle.
  12726. !#zh
  12727. 获取关节角度。
  12728. */
  12729. getJointAngle(): number;
  12730. }
  12731. /** !#en
  12732. A rope joint enforces a maximum distance between two points
  12733. on two bodies. It has no other effect.
  12734. Warning: if you attempt to change the maximum length during
  12735. the simulation you will get some non-physical behavior.
  12736. !#zh
  12737. 绳子关节只指定两个刚体间的最大距离,没有其他的效果。
  12738. 注意:如果你试图动态修改关节的长度,这有可能会得到一些意外的效果。 */
  12739. export class RopeJoint extends Joint {
  12740. /** !#en
  12741. The max length.
  12742. !#zh
  12743. 最大长度。 */
  12744. maxLength: number;
  12745. }
  12746. /** !#en
  12747. A weld joint essentially glues two bodies together. A weld joint may
  12748. distort somewhat because the island constraint solver is approximate.
  12749. !#zh
  12750. 熔接关节相当于将两个刚体粘在了一起。
  12751. 熔接关节可能会使某些东西失真,因为约束求解器算出的都是近似值。 */
  12752. export class WeldJoint extends Joint {
  12753. /** !#en
  12754. The reference angle.
  12755. !#zh
  12756. 相对角度。 */
  12757. referenceAngle: number;
  12758. /** !#en
  12759. The frequency.
  12760. !#zh
  12761. 弹性系数。 */
  12762. frequency: number;
  12763. /** !#en
  12764. The damping ratio.
  12765. !#zh
  12766. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12767. 0: number;
  12768. }
  12769. /** !#en
  12770. A wheel joint. This joint provides two degrees of freedom: translation
  12771. along an axis fixed in bodyA and rotation in the plane. You can use a joint motor to drive
  12772. the rotation or to model rotational friction.
  12773. This joint is designed for vehicle suspensions.
  12774. !#zh
  12775. 轮子关节提供两个维度的自由度:旋转和沿着指定方向上位置的移动。
  12776. 你可以通过开启关节马达来使用马达驱动刚体的旋转。
  12777. 轮组关节是专门为机动车类型设计的。 */
  12778. export class WheelJoint extends Joint {
  12779. /** !#en
  12780. The local joint axis relative to rigidbody.
  12781. !#zh
  12782. 指定刚体可以移动的方向。 */
  12783. localAxisA: Vec2;
  12784. /** !#en
  12785. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  12786. !#zh
  12787. 可以施加到刚体的最大扭矩。 */
  12788. maxMotorTorque: number;
  12789. /** !#en
  12790. The expected motor speed.
  12791. !#zh
  12792. 期望的马达速度。 */
  12793. motorSpeed: number;
  12794. /** !#en
  12795. Enable joint motor?
  12796. !#zh
  12797. 是否开启关节马达? */
  12798. enableMotor: boolean;
  12799. /** !#en
  12800. The spring frequency.
  12801. !#zh
  12802. 弹性系数。 */
  12803. frequency: number;
  12804. /** !#en
  12805. The damping ratio.
  12806. !#zh
  12807. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12808. dampingRatio: number;
  12809. }
  12810. /** !#en Manager the dynamic atlas.
  12811. !#zh 管理动态图集。 */
  12812. export class DynamicAtlasManager {
  12813. /** !#en Enabled or Disabled dynamic atlas.
  12814. !#zh 开启或者关闭动态图集。 */
  12815. enabled: boolean;
  12816. /** !#en The maximum number of atlas that can be created.
  12817. !#zh 可以创建的最大图集数量。 */
  12818. maxAtlasCount: number;
  12819. /** !#en The size of the atlas that was created
  12820. !#zh 创建的图集的宽高 */
  12821. textureSize: number;
  12822. /** !#en The maximum size of the picture that can be added to the atlas.
  12823. !#zh 可以添加进图集的图片的最大尺寸。 */
  12824. maxFrameSize: number;
  12825. /**
  12826. !#en Append a sprite frame into the dynamic atlas.
  12827. !#zh 添加碎图进入动态图集。
  12828. @param spriteFrame spriteFrame
  12829. */
  12830. insertSpriteFrame(spriteFrame: SpriteFrame): void;
  12831. /**
  12832. !#en Resets all dynamic atlas, and the existing ones will be destroyed.
  12833. !#zh 重置所有动态图集,已有的动态图集会被销毁。
  12834. */
  12835. reset(): void;
  12836. /**
  12837. !#en Displays all the dynamic atlas in the current scene, which you can use to view the current atlas state.
  12838. !#zh 在当前场景中显示所有动态图集,可以用来查看当前的合图状态。
  12839. @param show show
  12840. */
  12841. showDebug(show: boolean): void;
  12842. }
  12843. /****************************************************
  12844. * audioEngine
  12845. *****************************************************/
  12846. export namespace audioEngine {
  12847. /** !#en Audio state.
  12848. !#zh 声音播放状态 */
  12849. export enum AudioState {
  12850. ERROR = 0,
  12851. INITIALZING = 0,
  12852. PLAYING = 0,
  12853. PAUSED = 0,
  12854. STOPPED = 0,
  12855. }
  12856. }
  12857. /****************************************************
  12858. * debug
  12859. *****************************************************/
  12860. export namespace debug {
  12861. /** !#en Enum for debug modes.
  12862. !#zh 调试模式 */
  12863. export enum DebugMode {
  12864. NONE = 0,
  12865. INFO = 0,
  12866. WARN = 0,
  12867. ERROR = 0,
  12868. INFO_FOR_WEB_PAGE = 0,
  12869. WARN_FOR_WEB_PAGE = 0,
  12870. ERROR_FOR_WEB_PAGE = 0,
  12871. }
  12872. }
  12873. /****************************************************
  12874. * Node
  12875. *****************************************************/
  12876. export namespace Node {
  12877. /** !#en Node's local dirty properties flag
  12878. !#zh Node 的本地属性 dirty 状态位 */
  12879. export enum _LocalDirtyFlag {
  12880. POSITION = 0,
  12881. SCALE = 0,
  12882. ROTATION = 0,
  12883. SKEW = 0,
  12884. RT = 0,
  12885. ALL = 0,
  12886. }
  12887. }
  12888. /****************************************************
  12889. * Node
  12890. *****************************************************/
  12891. export namespace Node {
  12892. /** !#en The event type supported by Node
  12893. !#zh Node 支持的事件类型 */
  12894. export class EventType {
  12895. /** !#en The event type for touch start event, you can use its value directly: 'touchstart'
  12896. !#zh 当手指触摸到屏幕时。 */
  12897. static TOUCH_START: string;
  12898. /** !#en The event type for touch move event, you can use its value directly: 'touchmove'
  12899. !#zh 当手指在屏幕上移动时。 */
  12900. static TOUCH_MOVE: string;
  12901. /** !#en The event type for touch end event, you can use its value directly: 'touchend'
  12902. !#zh 当手指在目标节点区域内离开屏幕时。 */
  12903. static TOUCH_END: string;
  12904. /** !#en The event type for touch end event, you can use its value directly: 'touchcancel'
  12905. !#zh 当手指在目标节点区域外离开屏幕时。 */
  12906. static TOUCH_CANCEL: string;
  12907. /** !#en The event type for mouse down events, you can use its value directly: 'mousedown'
  12908. !#zh 当鼠标按下时触发一次。 */
  12909. static MOUSE_DOWN: string;
  12910. /** !#en The event type for mouse move events, you can use its value directly: 'mousemove'
  12911. !#zh 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。 */
  12912. static MOUSE_MOVE: string;
  12913. /** !#en The event type for mouse enter target events, you can use its value directly: 'mouseenter'
  12914. !#zh 当鼠标移入目标节点区域时,不论是否按下。 */
  12915. static MOUSE_ENTER: string;
  12916. /** !#en The event type for mouse leave target events, you can use its value directly: 'mouseleave'
  12917. !#zh 当鼠标移出目标节点区域时,不论是否按下。 */
  12918. static MOUSE_LEAVE: string;
  12919. /** !#en The event type for mouse up events, you can use its value directly: 'mouseup'
  12920. !#zh 当鼠标从按下状态松开时触发一次。 */
  12921. static MOUSE_UP: string;
  12922. /** !#en The event type for mouse wheel events, you can use its value directly: 'mousewheel'
  12923. !#zh 当鼠标滚轮滚动时。 */
  12924. static MOUSE_WHEEL: string;
  12925. /** !#en The event type for position change events.
  12926. Performance note, this event will be triggered every time corresponding properties being changed,
  12927. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12928. !#zh 当节点位置改变时触发的事件。
  12929. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12930. static POSITION_CHANGED: string;
  12931. /** !#en The event type for rotation change events.
  12932. Performance note, this event will be triggered every time corresponding properties being changed,
  12933. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12934. !#zh 当节点旋转改变时触发的事件。
  12935. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12936. static ROTATION_CHANGED: string;
  12937. /** !#en The event type for scale change events.
  12938. Performance note, this event will be triggered every time corresponding properties being changed,
  12939. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12940. !#zh 当节点缩放改变时触发的事件。
  12941. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12942. static SCALE_CHANGED: string;
  12943. /** !#en The event type for size change events.
  12944. Performance note, this event will be triggered every time corresponding properties being changed,
  12945. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12946. !#zh 当节点尺寸改变时触发的事件。
  12947. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12948. static SIZE_CHANGED: string;
  12949. /** !#en The event type for anchor point change events.
  12950. Performance note, this event will be triggered every time corresponding properties being changed,
  12951. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12952. !#zh 当节点锚点改变时触发的事件。
  12953. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12954. static ANCHOR_CHANGED: string;
  12955. /** !#en The event type for color change events.
  12956. Performance note, this event will be triggered every time corresponding properties being changed,
  12957. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12958. !#zh 当节点颜色改变时触发的事件。
  12959. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12960. static COLOR_CHANGED: string;
  12961. /** !#en The event type for new child added events.
  12962. !#zh 当新的子节点被添加时触发的事件。 */
  12963. static CHILD_ADDED: string;
  12964. /** !#en The event type for child removed events.
  12965. !#zh 当子节点被移除时触发的事件。 */
  12966. static CHILD_REMOVED: string;
  12967. /** !#en The event type for children reorder events.
  12968. !#zh 当子节点顺序改变时触发的事件。 */
  12969. static CHILD_REORDER: string;
  12970. /** !#en The event type for node group changed events.
  12971. !#zh 当节点归属群组发生变化时触发的事件。 */
  12972. static GROUP_CHANGED: string;
  12973. }
  12974. }
  12975. /****************************************************
  12976. * ParticleSystem
  12977. *****************************************************/
  12978. export namespace ParticleSystem {
  12979. /** !#en Enum for emitter modes
  12980. !#zh 发射模式 */
  12981. export enum EmitterMode {
  12982. GRAVITY = 0,
  12983. RADIUS = 0,
  12984. }
  12985. }
  12986. /****************************************************
  12987. * ParticleSystem
  12988. *****************************************************/
  12989. export namespace ParticleSystem {
  12990. /** !#en Enum for particles movement type.
  12991. !#zh 粒子位置类型 */
  12992. export enum PositionType {
  12993. FREE = 0,
  12994. RELATIVE = 0,
  12995. GROUPED = 0,
  12996. }
  12997. }
  12998. /****************************************************
  12999. * TiledMap
  13000. *****************************************************/
  13001. export namespace TiledMap {
  13002. /** !#en The orientation of tiled map.
  13003. !#zh Tiled Map 地图方向。 */
  13004. export enum Orientation {
  13005. ORTHO = 0,
  13006. HEX = 0,
  13007. ISO = 0,
  13008. NONE = 0,
  13009. MAP = 0,
  13010. LAYER = 0,
  13011. OBJECTGROUP = 0,
  13012. OBJECT = 0,
  13013. TILE = 0,
  13014. HORIZONTAL = 0,
  13015. VERTICAL = 0,
  13016. DIAGONAL = 0,
  13017. FLIPPED_ALL = 0,
  13018. FLIPPED_MASK = 0,
  13019. STAGGERAXIS_X = 0,
  13020. STAGGERAXIS_Y = 0,
  13021. STAGGERINDEX_ODD = 0,
  13022. STAGGERINDEX_EVEN = 0,
  13023. }
  13024. }
  13025. /****************************************************
  13026. * WebView
  13027. *****************************************************/
  13028. export namespace WebView {
  13029. /** !#en WebView event type
  13030. !#zh 网页视图事件类型 */
  13031. export enum EventType {
  13032. LOADED = 0,
  13033. LOADING = 0,
  13034. ERROR = 0,
  13035. }
  13036. }
  13037. /****************************************************
  13038. * VideoPlayer
  13039. *****************************************************/
  13040. export namespace VideoPlayer {
  13041. /** !#en Video event type
  13042. !#zh 视频事件类型 */
  13043. export enum EventType {
  13044. PLAYING = 0,
  13045. PAUSED = 0,
  13046. STOPPED = 0,
  13047. COMPLETED = 0,
  13048. META_LOADED = 0,
  13049. CLICKED = 0,
  13050. READY_TO_PLAY = 0,
  13051. }
  13052. }
  13053. /****************************************************
  13054. * VideoPlayer
  13055. *****************************************************/
  13056. export namespace VideoPlayer {
  13057. /** !#en Enum for video resouce type type.
  13058. !#zh 视频来源 */
  13059. export enum ResourceType {
  13060. REMOTE = 0,
  13061. LOCAL = 0,
  13062. }
  13063. }
  13064. /****************************************************
  13065. * Prefab
  13066. *****************************************************/
  13067. export namespace Prefab {
  13068. /** !#zh
  13069. Prefab 创建实例所用的优化策略,配合 {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}} 使用。
  13070. !#en
  13071. An enumeration used with the {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}}
  13072. to specify how to optimize the instantiate operation. */
  13073. export enum OptimizationPolicy {
  13074. AUTO = 0,
  13075. SINGLE_INSTANCE = 0,
  13076. MULTI_INSTANCE = 0,
  13077. }
  13078. }
  13079. /****************************************************
  13080. * Texture2D
  13081. *****************************************************/
  13082. export namespace Texture2D {
  13083. /** The texture pixel format, default value is RGBA8888,
  13084. you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,
  13085. other formats are supported by compressed file types or raw data. */
  13086. export enum PixelFormat {
  13087. RGB565 = 0,
  13088. RGB5A1 = 0,
  13089. RGBA4444 = 0,
  13090. RGB888 = 0,
  13091. RGBA8888 = 0,
  13092. A8 = 0,
  13093. I8 = 0,
  13094. AI88 = 0,
  13095. }
  13096. }
  13097. /****************************************************
  13098. * Texture2D
  13099. *****************************************************/
  13100. export namespace Texture2D {
  13101. /** The texture wrap mode */
  13102. export enum WrapMode {
  13103. REPEAT = 0,
  13104. CLAMP_TO_EDGE = 0,
  13105. MIRRORED_REPEAT = 0,
  13106. }
  13107. }
  13108. /****************************************************
  13109. * Texture2D
  13110. *****************************************************/
  13111. export namespace Texture2D {
  13112. /** The texture filter mode */
  13113. export enum Filter {
  13114. LINEAR = 0,
  13115. NEAREST = 0,
  13116. }
  13117. }
  13118. /****************************************************
  13119. * Collider
  13120. *****************************************************/
  13121. export namespace Collider {
  13122. /** !#en Defines a Box Collider .
  13123. !#zh 用来定义包围盒碰撞体 */
  13124. export class Box {
  13125. /** !#en Position offset
  13126. !#zh 位置偏移量 */
  13127. offset: Vec2;
  13128. /** !#en Box size
  13129. !#zh 包围盒大小 */
  13130. size: Size;
  13131. }
  13132. }
  13133. /****************************************************
  13134. * Collider
  13135. *****************************************************/
  13136. export namespace Collider {
  13137. /** !#en Defines a Circle Collider .
  13138. !#zh 用来定义圆形碰撞体 */
  13139. export class Circle {
  13140. /** !#en Position offset
  13141. !#zh 位置偏移量 */
  13142. offset: Vec2;
  13143. /** !#en Circle radius
  13144. !#zh 圆形半径 */
  13145. radius: number;
  13146. }
  13147. }
  13148. /****************************************************
  13149. * Collider
  13150. *****************************************************/
  13151. export namespace Collider {
  13152. /** !#en Defines a Polygon Collider .
  13153. !#zh 用来定义多边形碰撞体 */
  13154. export class Polygon {
  13155. /** !#en Position offset
  13156. !#zh 位置偏移量 */
  13157. offset: Vec2;
  13158. /** !#en Polygon points
  13159. !#zh 多边形顶点数组 */
  13160. points: Vec2[];
  13161. }
  13162. }
  13163. /****************************************************
  13164. * Camera
  13165. *****************************************************/
  13166. export namespace Camera {
  13167. /** !#en Values for Camera.clearFlags, determining what to clear when rendering a Camera.
  13168. !#zh 摄像机清除标记位,决定摄像机渲染时会清除哪些状态 */
  13169. export enum ClearFlags {
  13170. }
  13171. }
  13172. /****************************************************
  13173. * Event
  13174. *****************************************************/
  13175. export namespace Event {
  13176. /** !#en The Custom event
  13177. !#zh 自定义事件 */
  13178. export class EventCustom extends Event {
  13179. /**
  13180. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  13181. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  13182. */
  13183. constructor(type: string, bubbles: boolean);
  13184. /** !#en A reference to the detailed data of the event
  13185. !#zh 事件的详细数据 */
  13186. detail: any;
  13187. /**
  13188. !#en Sets user data
  13189. !#zh 设置用户数据
  13190. @param data data
  13191. */
  13192. setUserData(data: any): void;
  13193. /**
  13194. !#en Gets user data
  13195. !#zh 获取用户数据
  13196. */
  13197. getUserData(): any;
  13198. /**
  13199. !#en Gets event name
  13200. !#zh 获取事件名称
  13201. */
  13202. getEventName(): string;
  13203. }
  13204. }
  13205. /****************************************************
  13206. * SystemEvent
  13207. *****************************************************/
  13208. export namespace SystemEvent {
  13209. /** !#en The event type supported by SystemEvent
  13210. !#zh SystemEvent 支持的事件类型 */
  13211. export class EventType {
  13212. /** !#en The event type for press the key down event, you can use its value directly: 'keydown'
  13213. !#zh 当按下按键时触发的事件 */
  13214. static KEY_DOWN: string;
  13215. /** !#en The event type for press the key up event, you can use its value directly: 'keyup'
  13216. !#zh 当松开按键时触发的事件 */
  13217. static KEY_UP: string;
  13218. /** !#en The event type for press the devicemotion event, you can use its value directly: 'devicemotion'
  13219. !#zh 重力感应 */
  13220. static DEVICEMOTION: string;
  13221. }
  13222. }
  13223. /****************************************************
  13224. * Event
  13225. *****************************************************/
  13226. export namespace Event {
  13227. /** !#en The mouse event
  13228. !#zh 鼠标事件类型 */
  13229. export class EventMouse extends Event {
  13230. /**
  13231. !#en Sets scroll data.
  13232. !#zh 设置鼠标的滚动数据。
  13233. @param scrollX scrollX
  13234. @param scrollY scrollY
  13235. */
  13236. setScrollData(scrollX: number, scrollY: number): void;
  13237. /**
  13238. !#en Returns the x axis scroll value.
  13239. !#zh 获取鼠标滚动的X轴距离,只有滚动时才有效。
  13240. */
  13241. getScrollX(): number;
  13242. /**
  13243. !#en Returns the y axis scroll value.
  13244. !#zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  13245. */
  13246. getScrollY(): number;
  13247. /**
  13248. !#en Sets cursor location.
  13249. !#zh 设置当前鼠标位置。
  13250. @param x x
  13251. @param y y
  13252. */
  13253. setLocation(x: number, y: number): void;
  13254. /**
  13255. !#en Returns cursor location.
  13256. !#zh 获取鼠标位置对象,对象包含 x 和 y 属性。
  13257. */
  13258. getLocation(): Vec2;
  13259. /**
  13260. !#en Returns the current cursor location in screen coordinates.
  13261. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  13262. */
  13263. getLocationInView(): Vec2;
  13264. /**
  13265. !#en Returns the previous touch location.
  13266. !#zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  13267. */
  13268. getPreviousLocation(): Vec2;
  13269. /**
  13270. !#en Returns the delta distance from the previous location to current location.
  13271. !#zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  13272. */
  13273. getDelta(): Vec2;
  13274. /**
  13275. !#en Returns the X axis delta distance from the previous location to current location.
  13276. !#zh 获取鼠标距离上一次事件移动的 X 轴距离。
  13277. */
  13278. getDeltaX(): number;
  13279. /**
  13280. !#en Returns the Y axis delta distance from the previous location to current location.
  13281. !#zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  13282. */
  13283. getDeltaY(): number;
  13284. /**
  13285. !#en Sets mouse button.
  13286. !#zh 设置鼠标按键。
  13287. @param button button
  13288. */
  13289. setButton(button: number): void;
  13290. /**
  13291. !#en Returns mouse button.
  13292. !#zh 获取鼠标按键。
  13293. */
  13294. getButton(): number;
  13295. /**
  13296. !#en Returns location X axis data.
  13297. !#zh 获取鼠标当前位置 X 轴。
  13298. */
  13299. getLocationX(): number;
  13300. /**
  13301. !#en Returns location Y axis data.
  13302. !#zh 获取鼠标当前位置 Y 轴。
  13303. */
  13304. getLocationY(): number;
  13305. /** !#en The none event code of mouse event.
  13306. !#zh 无。 */
  13307. static NONE: number;
  13308. /** !#en The event type code of mouse down event.
  13309. !#zh 鼠标按下事件。 */
  13310. static DOWN: number;
  13311. /** !#en The event type code of mouse up event.
  13312. !#zh 鼠标按下后释放事件。 */
  13313. static UP: number;
  13314. /** !#en The event type code of mouse move event.
  13315. !#zh 鼠标移动事件。 */
  13316. static MOVE: number;
  13317. /** !#en The event type code of mouse scroll event.
  13318. !#zh 鼠标滚轮事件。 */
  13319. static SCROLL: number;
  13320. /** !#en The tag of Mouse left button.
  13321. !#zh 鼠标左键的标签。 */
  13322. static BUTTON_LEFT: number;
  13323. /** !#en The tag of Mouse right button (The right button number is 2 on browser).
  13324. !#zh 鼠标右键的标签。 */
  13325. static BUTTON_RIGHT: number;
  13326. /** !#en The tag of Mouse middle button (The right button number is 1 on browser).
  13327. !#zh 鼠标中键的标签。 */
  13328. static BUTTON_MIDDLE: number;
  13329. /** !#en The tag of Mouse button 4.
  13330. !#zh 鼠标按键 4 的标签。 */
  13331. static BUTTON_4: number;
  13332. /** !#en The tag of Mouse button 5.
  13333. !#zh 鼠标按键 5 的标签。 */
  13334. static BUTTON_5: number;
  13335. /** !#en The tag of Mouse button 6.
  13336. !#zh 鼠标按键 6 的标签。 */
  13337. static BUTTON_6: number;
  13338. /** !#en The tag of Mouse button 7.
  13339. !#zh 鼠标按键 7 的标签。 */
  13340. static BUTTON_7: number;
  13341. /** !#en The tag of Mouse button 8.
  13342. !#zh 鼠标按键 8 的标签。 */
  13343. static BUTTON_8: number;
  13344. }
  13345. }
  13346. /****************************************************
  13347. * Event
  13348. *****************************************************/
  13349. export namespace Event {
  13350. /** !#en The touch event
  13351. !#zh 触摸事件 */
  13352. export class EventTouch extends Event {
  13353. /**
  13354. @param touchArr The array of the touches
  13355. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  13356. */
  13357. constructor(touchArr: any[], bubbles: boolean);
  13358. /** !#en The current touch object
  13359. !#zh 当前触点对象 */
  13360. touch: Touch;
  13361. /**
  13362. !#en Returns event code.
  13363. !#zh 获取事件类型。
  13364. */
  13365. getEventCode(): number;
  13366. /**
  13367. !#en Returns touches of event.
  13368. !#zh 获取触摸点的列表。
  13369. */
  13370. getTouches(): any[];
  13371. /**
  13372. !#en Sets touch location.
  13373. !#zh 设置当前触点位置
  13374. @param x x
  13375. @param y y
  13376. */
  13377. setLocation(x: number, y: number): void;
  13378. /**
  13379. !#en Returns touch location.
  13380. !#zh 获取触点位置。
  13381. */
  13382. getLocation(): Vec2;
  13383. /**
  13384. !#en Returns the current touch location in screen coordinates.
  13385. !#zh 获取当前触点在游戏窗口中的位置。
  13386. */
  13387. getLocationInView(): Vec2;
  13388. /**
  13389. !#en Returns the previous touch location.
  13390. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  13391. */
  13392. getPreviousLocation(): Vec2;
  13393. /**
  13394. !#en Returns the start touch location.
  13395. !#zh 获获取触点落下时的位置对象,对象包含 x 和 y 属性。
  13396. */
  13397. getStartLocation(): Vec2;
  13398. /**
  13399. !#en Returns the id of cc.Touch.
  13400. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  13401. */
  13402. getID(): number;
  13403. /**
  13404. !#en Returns the delta distance from the previous location to current location.
  13405. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  13406. */
  13407. getDelta(): Vec2;
  13408. /**
  13409. !#en Returns the X axis delta distance from the previous location to current location.
  13410. !#zh 获取触点距离上一次事件移动的 x 轴距离。
  13411. */
  13412. getDeltaX(): number;
  13413. /**
  13414. !#en Returns the Y axis delta distance from the previous location to current location.
  13415. !#zh 获取触点距离上一次事件移动的 y 轴距离。
  13416. */
  13417. getDeltaY(): number;
  13418. /**
  13419. !#en Returns location X axis data.
  13420. !#zh 获取当前触点 X 轴位置。
  13421. */
  13422. getLocationX(): number;
  13423. /**
  13424. !#en Returns location Y axis data.
  13425. !#zh 获取当前触点 Y 轴位置。
  13426. */
  13427. getLocationY(): number;
  13428. }
  13429. }
  13430. /****************************************************
  13431. * Event
  13432. *****************************************************/
  13433. export namespace Event {
  13434. /** !#en The acceleration event
  13435. !#zh 加速度事件 */
  13436. export class EventAcceleration extends Event {
  13437. }
  13438. }
  13439. /****************************************************
  13440. * Event
  13441. *****************************************************/
  13442. export namespace Event {
  13443. /** !#en The keyboard event
  13444. !#zh 键盘事件 */
  13445. export class EventKeyboard extends Event {
  13446. /** !#en
  13447. The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
  13448. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.
  13449. If the key can't be identified, this value is 0.
  13450. !#zh
  13451. keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
  13452. 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。
  13453. 如果无法识别该键,则该值为 0。 */
  13454. keyCode: number;
  13455. }
  13456. }
  13457. /****************************************************
  13458. * Graphics
  13459. *****************************************************/
  13460. export namespace Graphics {
  13461. /** !#en Enum for LineCap.
  13462. !#zh 线段末端属性 */
  13463. export enum LineCap {
  13464. BUTT = 0,
  13465. ROUND = 0,
  13466. SQUARE = 0,
  13467. }
  13468. }
  13469. /****************************************************
  13470. * Graphics
  13471. *****************************************************/
  13472. export namespace Graphics {
  13473. /** !#en Enum for LineJoin.
  13474. !#zh 线段拐角属性 */
  13475. export enum LineJoin {
  13476. BEVEL = 0,
  13477. ROUND = 0,
  13478. MITER = 0,
  13479. }
  13480. }
  13481. /****************************************************
  13482. * Animation
  13483. *****************************************************/
  13484. export namespace Animation {
  13485. /** !#en The event type supported by Animation
  13486. !#zh Animation 支持的事件类型 */
  13487. export class EventType {
  13488. /** !#en Emit when begin playing animation
  13489. !#zh 开始播放时触发 */
  13490. static PLAY: string;
  13491. /** !#en Emit when stop playing animation
  13492. !#zh 停止播放时触发 */
  13493. static STOP: string;
  13494. /** !#en Emit when pause animation
  13495. !#zh 暂停播放时触发 */
  13496. static PAUSE: string;
  13497. /** !#en Emit when resume animation
  13498. !#zh 恢复播放时触发 */
  13499. static RESUME: string;
  13500. /** !#en If animation repeat count is larger than 1, emit when animation play to the last frame
  13501. !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发 */
  13502. static LASTFRAME: string;
  13503. /** !#en Emit when finish playing animation
  13504. !#zh 动画播放完成时触发 */
  13505. static FINISHED: string;
  13506. }
  13507. }
  13508. /****************************************************
  13509. * Button
  13510. *****************************************************/
  13511. export namespace Button {
  13512. /** !#en Enum for transition type.
  13513. !#zh 过渡类型 */
  13514. export enum Transition {
  13515. NONE = 0,
  13516. COLOR = 0,
  13517. SPRITE = 0,
  13518. SCALE = 0,
  13519. }
  13520. }
  13521. /****************************************************
  13522. * Component
  13523. *****************************************************/
  13524. export namespace Component {
  13525. /** !#en
  13526. Component will register a event to target component's handler.
  13527. And it will trigger the handler when a certain event occurs.
  13528. !@zh
  13529. “EventHandler” 类用来设置场景中的事件回调,
  13530. 该类允许用户设置回调目标节点,目标组件名,组件方法名,
  13531. 并可通过 emit 方法调用目标函数。 */
  13532. export class EventHandler {
  13533. /** !#en Event target
  13534. !#zh 目标节点 */
  13535. target: Node;
  13536. /** !#en Component name
  13537. !#zh 目标组件名 */
  13538. component: string;
  13539. /** !#en Event handler
  13540. !#zh 响应事件函数名 */
  13541. handler: string;
  13542. /** !#en Custom Event Data
  13543. !#zh 自定义事件数据 */
  13544. customEventData: string;
  13545. /**
  13546. @param events events
  13547. @param params params
  13548. */
  13549. static emitEvents(events: Component.EventHandler[], ...params: any[]): void;
  13550. /**
  13551. !#en Emit event with params
  13552. !#zh 触发目标组件上的指定 handler 函数,该参数是回调函数的参数值(可不填)。
  13553. @param params params
  13554. @example
  13555. ```js
  13556. // Call Function
  13557. var eventHandler = new cc.Component.EventHandler();
  13558. eventHandler.target = newTarget;
  13559. eventHandler.component = "MainMenu";
  13560. eventHandler.handler = "OnClick"
  13561. eventHandler.emit(["param1", "param2", ....]);
  13562. ```
  13563. */
  13564. emit(params: any[]): void;
  13565. }
  13566. }
  13567. /****************************************************
  13568. * Label
  13569. *****************************************************/
  13570. export namespace Label {
  13571. /** !#en Enum for text alignment.
  13572. !#zh 文本横向对齐类型 */
  13573. export enum HorizontalAlign {
  13574. LEFT = 0,
  13575. CENTER = 0,
  13576. RIGHT = 0,
  13577. }
  13578. }
  13579. /****************************************************
  13580. * Label
  13581. *****************************************************/
  13582. export namespace Label {
  13583. /** !#en Enum for vertical text alignment.
  13584. !#zh 文本垂直对齐类型 */
  13585. export enum VerticalAlign {
  13586. TOP = 0,
  13587. CENTER = 0,
  13588. BOTTOM = 0,
  13589. }
  13590. }
  13591. /****************************************************
  13592. * Label
  13593. *****************************************************/
  13594. export namespace Label {
  13595. /** !#en Enum for Overflow.
  13596. !#zh Overflow 类型 */
  13597. export enum Overflow {
  13598. NONE = 0,
  13599. CLAMP = 0,
  13600. SHRINK = 0,
  13601. RESIZE_HEIGHT = 0,
  13602. }
  13603. }
  13604. /****************************************************
  13605. * Label
  13606. *****************************************************/
  13607. export namespace Label {
  13608. /** !#en Enum for font type.
  13609. !#zh Type 类型 */
  13610. export enum Type {
  13611. TTF = 0,
  13612. BMFont = 0,
  13613. SystemFont = 0,
  13614. NONE = 0,
  13615. BITMAP = 0,
  13616. CHAR = 0,
  13617. }
  13618. }
  13619. /****************************************************
  13620. * Layout
  13621. *****************************************************/
  13622. export namespace Layout {
  13623. /** !#en Enum for Layout type
  13624. !#zh 布局类型 */
  13625. export enum Type {
  13626. NONE = 0,
  13627. HORIZONTAL = 0,
  13628. VERTICAL = 0,
  13629. GRID = 0,
  13630. }
  13631. }
  13632. /****************************************************
  13633. * Layout
  13634. *****************************************************/
  13635. export namespace Layout {
  13636. /** !#en Enum for Layout Resize Mode
  13637. !#zh 缩放模式 */
  13638. export enum ResizeMode {
  13639. NONE = 0,
  13640. CONTAINER = 0,
  13641. CHILDREN = 0,
  13642. }
  13643. }
  13644. /****************************************************
  13645. * Layout
  13646. *****************************************************/
  13647. export namespace Layout {
  13648. /** !#en Enum for Grid Layout start axis direction.
  13649. The items in grid layout will be arranged in each axis at first.;
  13650. !#zh 布局轴向,只用于 GRID 布局。 */
  13651. export enum AxisDirection {
  13652. HORIZONTAL = 0,
  13653. VERTICAL = 0,
  13654. }
  13655. }
  13656. /****************************************************
  13657. * Layout
  13658. *****************************************************/
  13659. export namespace Layout {
  13660. /** !#en Enum for vertical layout direction.
  13661. Used in Grid Layout together with AxisDirection is VERTICAL
  13662. !#zh 垂直方向布局方式 */
  13663. export enum VerticalDirection {
  13664. BOTTOM_TO_TOP = 0,
  13665. TOP_TO_BOTTOM = 0,
  13666. }
  13667. }
  13668. /****************************************************
  13669. * Layout
  13670. *****************************************************/
  13671. export namespace Layout {
  13672. /** !#en Enum for horizontal layout direction.
  13673. Used in Grid Layout together with AxisDirection is HORIZONTAL
  13674. !#zh 水平方向布局方式 */
  13675. export enum HorizontalDirection {
  13676. LEFT_TO_RIGHT = 0,
  13677. RIGHT_TO_LEFT = 0,
  13678. }
  13679. }
  13680. /****************************************************
  13681. * Mask
  13682. *****************************************************/
  13683. export namespace Mask {
  13684. /** !#en the type for mask.
  13685. !#zh 遮罩组件类型 */
  13686. export enum Type {
  13687. RECT = 0,
  13688. ELLIPSE = 0,
  13689. IMAGE_STENCIL = 0,
  13690. }
  13691. }
  13692. /****************************************************
  13693. * PageView
  13694. *****************************************************/
  13695. export namespace PageView {
  13696. /** !#en The Page View Size Mode
  13697. !#zh 页面视图每个页面统一的大小类型 */
  13698. export enum SizeMode {
  13699. Unified = 0,
  13700. Free = 0,
  13701. }
  13702. }
  13703. /****************************************************
  13704. * PageView
  13705. *****************************************************/
  13706. export namespace PageView {
  13707. /** !#en The Page View Direction
  13708. !#zh 页面视图滚动类型 */
  13709. export enum Direction {
  13710. Horizontal = 0,
  13711. Vertical = 0,
  13712. }
  13713. }
  13714. /****************************************************
  13715. * PageView
  13716. *****************************************************/
  13717. export namespace PageView {
  13718. /** !#en Enum for ScrollView event type.
  13719. !#zh 滚动视图事件类型 */
  13720. export enum EventType {
  13721. PAGE_TURNING = 0,
  13722. }
  13723. }
  13724. /****************************************************
  13725. * PageViewIndicator
  13726. *****************************************************/
  13727. export namespace PageViewIndicator {
  13728. /** !#en Enum for PageView Indicator direction
  13729. !#zh 页面视图指示器的摆放方向 */
  13730. export enum Direction {
  13731. HORIZONTAL = 0,
  13732. VERTICAL = 0,
  13733. }
  13734. }
  13735. /****************************************************
  13736. * ProgressBar
  13737. *****************************************************/
  13738. export namespace ProgressBar {
  13739. /** !#en Enum for ProgressBar mode
  13740. !#zh 进度条模式 */
  13741. export enum Mode {
  13742. HORIZONTAL = 0,
  13743. VERTICAL = 0,
  13744. FILLED = 0,
  13745. }
  13746. }
  13747. /****************************************************
  13748. * Scrollbar
  13749. *****************************************************/
  13750. export namespace Scrollbar {
  13751. /** Enum for Scrollbar direction */
  13752. export enum Direction {
  13753. HORIZONTAL = 0,
  13754. VERTICAL = 0,
  13755. }
  13756. }
  13757. /****************************************************
  13758. * ScrollView
  13759. *****************************************************/
  13760. export namespace ScrollView {
  13761. /** !#en Enum for ScrollView event type.
  13762. !#zh 滚动视图事件类型 */
  13763. export enum EventType {
  13764. SCROLL_TO_TOP = 0,
  13765. SCROLL_TO_BOTTOM = 0,
  13766. SCROLL_TO_LEFT = 0,
  13767. SCROLL_TO_RIGHT = 0,
  13768. SCROLLING = 0,
  13769. BOUNCE_TOP = 0,
  13770. BOUNCE_BOTTOM = 0,
  13771. BOUNCE_LEFT = 0,
  13772. BOUNCE_RIGHT = 0,
  13773. SCROLL_ENDED = 0,
  13774. TOUCH_UP = 0,
  13775. AUTOSCROLL_ENDED_WITH_THRESHOLD = 0,
  13776. SCROLL_BEGAN = 0,
  13777. }
  13778. }
  13779. /****************************************************
  13780. * Slider
  13781. *****************************************************/
  13782. export namespace Slider {
  13783. /** !#en The Slider Direction
  13784. !#zh 滑动器方向 */
  13785. export enum Direction {
  13786. Horizontal = 0,
  13787. Vertical = 0,
  13788. }
  13789. }
  13790. /****************************************************
  13791. * Sprite
  13792. *****************************************************/
  13793. export namespace Sprite {
  13794. /** !#en Enum for sprite type.
  13795. !#zh Sprite 类型 */
  13796. export enum Type {
  13797. SIMPLE = 0,
  13798. SLICED = 0,
  13799. TILED = 0,
  13800. FILLED = 0,
  13801. MESH = 0,
  13802. }
  13803. }
  13804. /****************************************************
  13805. * Sprite
  13806. *****************************************************/
  13807. export namespace Sprite {
  13808. /** !#en Enum for fill type.
  13809. !#zh 填充类型 */
  13810. export enum FillType {
  13811. HORIZONTAL = 0,
  13812. VERTICAL = 0,
  13813. RADIAL = 0,
  13814. }
  13815. }
  13816. /****************************************************
  13817. * Sprite
  13818. *****************************************************/
  13819. export namespace Sprite {
  13820. /** !#en Sprite Size can track trimmed size, raw size or none.
  13821. !#zh 精灵尺寸调整模式 */
  13822. export enum SizeMode {
  13823. CUSTOM = 0,
  13824. TRIMMED = 0,
  13825. RAW = 0,
  13826. }
  13827. }
  13828. /****************************************************
  13829. * Sprite
  13830. *****************************************************/
  13831. export namespace Sprite {
  13832. /** !#en Sprite state can choice the normal or grayscale.
  13833. !#zh 精灵颜色通道模式。 */
  13834. export enum State {
  13835. NORMAL = 0,
  13836. GRAY = 0,
  13837. }
  13838. }
  13839. /****************************************************
  13840. * Widget
  13841. *****************************************************/
  13842. export namespace Widget {
  13843. /** !#en Enum for Widget's alignment mode, indicating when the widget should refresh.
  13844. !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 */
  13845. export enum AlignMode {
  13846. ONCE = 0,
  13847. ON_WINDOW_RESIZE = 0,
  13848. ALWAYS = 0,
  13849. }
  13850. }
  13851. /****************************************************
  13852. * Pipeline
  13853. *****************************************************/
  13854. export namespace Pipeline {
  13855. /** The downloader pipe, it can download several types of files:
  13856. 1. Text
  13857. 2. Image
  13858. 3. Script
  13859. 4. Audio
  13860. 5. Assets
  13861. All unknown type will be downloaded as plain text.
  13862. You can pass custom supported types in the constructor. */
  13863. export class Downloader {
  13864. /**
  13865. Constructor of Downloader, you can pass custom supported types.
  13866. @param extMap Custom supported types with corresponded handler
  13867. @example
  13868. ```js
  13869. var downloader = new Downloader({
  13870. // This will match all url with `.scene` extension or all url with `scene` type
  13871. 'scene' : function (url, callback) {}
  13872. });
  13873. ```
  13874. */
  13875. constructor(extMap: any);
  13876. /**
  13877. Add custom supported types handler or modify existing type handler.
  13878. @param extMap Custom supported types with corresponded handler
  13879. */
  13880. addHandlers(extMap: any): void;
  13881. /**
  13882. !#en
  13883. Load subpackage with name.
  13884. !#zh
  13885. 通过子包名加载子包代码。
  13886. @param name Subpackage name
  13887. @param completeCallback Callback invoked when subpackage loaded
  13888. */
  13889. loadSubpackage(name: string, completeCallback?: (error: Error) => void): void;
  13890. }
  13891. }
  13892. /****************************************************
  13893. * Pipeline
  13894. *****************************************************/
  13895. export namespace Pipeline {
  13896. /** The loader pipe, it can load several types of files:
  13897. 1. Images
  13898. 2. JSON
  13899. 3. Plist
  13900. 4. Audio
  13901. 5. Font
  13902. 6. Cocos Creator scene
  13903. It will not interfere with items of unknown type.
  13904. You can pass custom supported types in the constructor. */
  13905. export class Loader {
  13906. /**
  13907. Constructor of Loader, you can pass custom supported types.
  13908. @param extMap Custom supported types with corresponded handler
  13909. @example
  13910. ```js
  13911. var loader = new Loader({
  13912. // This will match all url with `.scene` extension or all url with `scene` type
  13913. 'scene' : function (url, callback) {}
  13914. });
  13915. ```
  13916. */
  13917. constructor(extMap: any);
  13918. /**
  13919. Add custom supported types handler or modify existing type handler.
  13920. @param extMap Custom supported types with corresponded handler
  13921. */
  13922. addHandlers(extMap: any): void;
  13923. }
  13924. }
  13925. /****************************************************
  13926. * LoadingItems
  13927. *****************************************************/
  13928. export namespace LoadingItems {
  13929. /** !#en The item states of the LoadingItems, its value could be LoadingItems.ItemState.WORKING | LoadingItems.ItemState.COMPLETET | LoadingItems.ItemState.ERROR
  13930. !#zh LoadingItems 队列中的加载项状态,状态的值可能是 LoadingItems.ItemState.WORKING | LoadingItems.ItemState.COMPLETET | LoadingItems.ItemState.ERROR */
  13931. export enum ItemState {
  13932. WORKING = 0,
  13933. COMPLETET = 0,
  13934. ERROR = 0,
  13935. }
  13936. }
  13937. /****************************************************
  13938. * macro
  13939. *****************************************************/
  13940. export namespace macro {
  13941. /** !#en Key map for keyboard event
  13942. !#zh 键盘事件的按键值 */
  13943. export enum KEY {
  13944. none = 0,
  13945. back = 0,
  13946. menu = 0,
  13947. backspace = 0,
  13948. tab = 0,
  13949. enter = 0,
  13950. shift = 0,
  13951. ctrl = 0,
  13952. alt = 0,
  13953. pause = 0,
  13954. capslock = 0,
  13955. escape = 0,
  13956. space = 0,
  13957. pageup = 0,
  13958. pagedown = 0,
  13959. end = 0,
  13960. home = 0,
  13961. left = 0,
  13962. up = 0,
  13963. right = 0,
  13964. down = 0,
  13965. select = 0,
  13966. insert = 0,
  13967. Delete = 0,
  13968. a = 0,
  13969. b = 0,
  13970. c = 0,
  13971. d = 0,
  13972. e = 0,
  13973. f = 0,
  13974. g = 0,
  13975. h = 0,
  13976. i = 0,
  13977. j = 0,
  13978. k = 0,
  13979. l = 0,
  13980. m = 0,
  13981. n = 0,
  13982. o = 0,
  13983. p = 0,
  13984. q = 0,
  13985. r = 0,
  13986. s = 0,
  13987. t = 0,
  13988. u = 0,
  13989. v = 0,
  13990. w = 0,
  13991. x = 0,
  13992. y = 0,
  13993. z = 0,
  13994. num0 = 0,
  13995. num1 = 0,
  13996. num2 = 0,
  13997. num3 = 0,
  13998. num4 = 0,
  13999. num5 = 0,
  14000. num6 = 0,
  14001. num7 = 0,
  14002. num8 = 0,
  14003. num9 = 0,
  14004. '*' = 0,
  14005. '+' = 0,
  14006. '-' = 0,
  14007. numdel = 0,
  14008. '/' = 0,
  14009. f1 = 0,
  14010. f2 = 0,
  14011. f3 = 0,
  14012. f4 = 0,
  14013. f5 = 0,
  14014. f6 = 0,
  14015. f7 = 0,
  14016. f8 = 0,
  14017. f9 = 0,
  14018. f10 = 0,
  14019. f11 = 0,
  14020. f12 = 0,
  14021. numlock = 0,
  14022. scrolllock = 0,
  14023. ';' = 0,
  14024. semicolon = 0,
  14025. equal = 0,
  14026. '=' = 0,
  14027. ',' = 0,
  14028. comma = 0,
  14029. dash = 0,
  14030. '.' = 0,
  14031. period = 0,
  14032. forwardslash = 0,
  14033. grave = 0,
  14034. '[' = 0,
  14035. openbracket = 0,
  14036. backslash = 0,
  14037. ']' = 0,
  14038. closebracket = 0,
  14039. quote = 0,
  14040. dpadLeft = 0,
  14041. dpadRight = 0,
  14042. dpadUp = 0,
  14043. dpadDown = 0,
  14044. dpadCenter = 0,
  14045. }
  14046. }
  14047. /****************************************************
  14048. * macro
  14049. *****************************************************/
  14050. export namespace macro {
  14051. /** Image formats */
  14052. export enum ImageFormat {
  14053. JPG = 0,
  14054. PNG = 0,
  14055. TIFF = 0,
  14056. WEBP = 0,
  14057. PVR = 0,
  14058. ETC = 0,
  14059. S3TC = 0,
  14060. ATITC = 0,
  14061. TGA = 0,
  14062. RAWDATA = 0,
  14063. UNKNOWN = 0,
  14064. }
  14065. }
  14066. /****************************************************
  14067. * macro
  14068. *****************************************************/
  14069. export namespace macro {
  14070. /** !#en
  14071. Enum for blend factor
  14072. Refer to: http://www.andersriggelsen.dk/glblendfunc.php
  14073. !#zh
  14074. 混合因子
  14075. 可参考: http://www.andersriggelsen.dk/glblendfunc.php */
  14076. export enum BlendFactor {
  14077. ONE = 0,
  14078. ZERO = 0,
  14079. SRC_ALPHA = 0,
  14080. SRC_COLOR = 0,
  14081. DST_ALPHA = 0,
  14082. DST_COLOR = 0,
  14083. ONE_MINUS_SRC_ALPHA = 0,
  14084. ONE_MINUS_SRC_COLOR = 0,
  14085. ONE_MINUS_DST_ALPHA = 0,
  14086. ONE_MINUS_DST_COLOR = 0,
  14087. }
  14088. }
  14089. /****************************************************
  14090. * macro
  14091. *****************************************************/
  14092. export namespace macro {
  14093. /** undefined */
  14094. export enum TextAlignment {
  14095. LEFT = 0,
  14096. CENTER = 0,
  14097. RIGHT = 0,
  14098. }
  14099. }
  14100. /****************************************************
  14101. * EditBox
  14102. *****************************************************/
  14103. export namespace EditBox {
  14104. /** !#en Enum for keyboard return types
  14105. !#zh 键盘的返回键类型 */
  14106. export enum KeyboardReturnType {
  14107. DEFAULT = 0,
  14108. DONE = 0,
  14109. SEND = 0,
  14110. SEARCH = 0,
  14111. GO = 0,
  14112. NEXT = 0,
  14113. }
  14114. }
  14115. /****************************************************
  14116. * EditBox
  14117. *****************************************************/
  14118. export namespace EditBox {
  14119. /** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.
  14120. !#zh 输入模式 */
  14121. export enum InputMode {
  14122. ANY = 0,
  14123. EMAIL_ADDR = 0,
  14124. NUMERIC = 0,
  14125. PHONE_NUMBER = 0,
  14126. URL = 0,
  14127. DECIMAL = 0,
  14128. SINGLE_LINE = 0,
  14129. }
  14130. }
  14131. /****************************************************
  14132. * EditBox
  14133. *****************************************************/
  14134. export namespace EditBox {
  14135. /** !#en Enum for the EditBox's input flags
  14136. !#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */
  14137. export enum InputFlag {
  14138. PASSWORD = 0,
  14139. SENSITIVE = 0,
  14140. INITIAL_CAPS_WORD = 0,
  14141. INITIAL_CAPS_SENTENCE = 0,
  14142. INITIAL_CAPS_ALL_CHARACTERS = 0,
  14143. DEFAULT = 0,
  14144. }
  14145. }
  14146. }
  14147. /** !#en
  14148. The global main namespace of DragonBones, all classes, functions,
  14149. properties and constants of DragonBones are defined in this namespace
  14150. !#zh
  14151. DragonBones 的全局的命名空间,
  14152. 与 DragonBones 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  14153. declare namespace dragonBones {
  14154. /** !#en
  14155. The Armature Display of DragonBones <br/>
  14156. <br/>
  14157. (Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  14158. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  14159. Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments.) <br/>
  14160. !#zh
  14161. DragonBones 骨骼动画 <br/>
  14162. <br/>
  14163. (Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  14164. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  14165. 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。)<br/> */
  14166. export class ArmatureDisplay extends cc.RenderComponent {
  14167. /** !#en
  14168. The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  14169. attachments, skins, etc) and animations but does not hold any state.<br/>
  14170. Multiple ArmatureDisplay can share the same DragonBones data.
  14171. !#zh
  14172. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  14173. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  14174. 多个 ArmatureDisplay 可以共用相同的骨骼数据。 */
  14175. dragonAsset: DragonBonesAsset;
  14176. /** !#en
  14177. The atlas asset for the DragonBones.
  14178. !#zh
  14179. 骨骼数据所需的 Atlas Texture 数据。 */
  14180. dragonAtlasAsset: DragonBonesAtlasAsset;
  14181. /** !#en The name of current armature.
  14182. !#zh 当前的 Armature 名称。 */
  14183. armatureName: string;
  14184. /** !#en The name of current playing animation.
  14185. !#zh 当前播放的动画名称。 */
  14186. animationName: string;
  14187. _defaultArmatureIndex: number;
  14188. /** !#en The time scale of this armature.
  14189. !#zh 当前骨骼中所有动画的时间缩放率。 */
  14190. timeScale: number;
  14191. /** !#en The play times of the default animation.
  14192. -1 means using the value of config file;
  14193. 0 means repeat for ever
  14194. >0 means repeat times
  14195. !#zh 播放默认动画的循环次数
  14196. -1 表示使用配置文件中的默认值;
  14197. 0 表示无限循环
  14198. >0 表示循环次数 */
  14199. playTimes: number;
  14200. /** !#en Indicates whether to enable premultiplied alpha.
  14201. You should disable this option when image's transparent area appears to have opaque pixels,
  14202. or enable this option when image's half transparent area appears to be darken.
  14203. !#zh 是否启用贴图预乘。
  14204. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  14205. premultipliedAlpha: boolean;
  14206. /** !#en Indicates whether open debug bones.
  14207. !#zh 是否显示 bone 的 debug 信息。 */
  14208. debugBones: boolean;
  14209. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  14210. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  14211. enableBatch: boolean;
  14212. /**
  14213. !#en
  14214. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  14215. If set the mode in editor, then no need to worry about order problem.
  14216. !#zh
  14217. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  14218. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  14219. @param cacheMode
  14220. @example
  14221. armatureDisplay.setAnimationCacheMode(dragonBones.ArmatureDisplay.AnimationCacheMode.SHARED_CACHE);
  14222. */
  14223. setAnimationCacheMode(...cacheMode
  14224. : AnimationCacheMode[]): void;
  14225. /**
  14226. !#en Whether in cached mode.
  14227. !#zh 当前是否处于缓存模式。
  14228. */
  14229. isAnimationCached(): void;
  14230. /**
  14231. !#en
  14232. Play the specified animation.
  14233. Parameter animName specify the animation name.
  14234. Parameter playTimes specify the repeat times of the animation.
  14235. -1 means use the value of the config file.
  14236. 0 means play the animation for ever.
  14237. >0 means repeat times.
  14238. !#zh
  14239. 播放指定的动画.
  14240. animName 指定播放动画的名称。
  14241. playTimes 指定播放动画的次数。
  14242. -1 为使用配置文件中的次数。
  14243. 0 为无限循环播放。
  14244. >0 为动画的重复次数。
  14245. @param animName animName
  14246. @param playTimes playTimes
  14247. */
  14248. playAnimation(animName: string, playTimes: number): dragonBones.AnimationState;
  14249. /**
  14250. !#en
  14251. Update an animation cache.
  14252. !#zh
  14253. 更新某个动画缓存。
  14254. @param animName animName
  14255. */
  14256. updateAnimationCache(animName: string): void;
  14257. /**
  14258. !#en
  14259. Get the all armature names in the DragonBones Data.
  14260. !#zh
  14261. 获取 DragonBones 数据中所有的 armature 名称
  14262. */
  14263. getArmatureNames(): any[];
  14264. /**
  14265. !#en
  14266. Get the all animation names of specified armature.
  14267. !#zh
  14268. 获取指定的 armature 的所有动画名称。
  14269. @param armatureName armatureName
  14270. */
  14271. getAnimationNames(armatureName: string): any[];
  14272. /**
  14273. !#en
  14274. Add event listener for the DragonBones Event, the same to addEventListener.
  14275. !#zh
  14276. 添加 DragonBones 事件监听器,与 addEventListener 作用相同。
  14277. @param type A string representing the event type to listen for.
  14278. @param listener The callback that will be invoked when the event is dispatched.
  14279. @param target The target (this object) to invoke the callback, can be null
  14280. */
  14281. on(type: string, listener: (event: cc.Event) => void, target?: any): void;
  14282. /**
  14283. !#en
  14284. Remove the event listener for the DragonBones Event, the same to removeEventListener.
  14285. !#zh
  14286. 移除 DragonBones 事件监听器,与 removeEventListener 作用相同。
  14287. @param type A string representing the event type to listen for.
  14288. @param listener listener
  14289. @param target target
  14290. */
  14291. off(type: string, listener?: Function, target?: any): void;
  14292. /**
  14293. !#en
  14294. Add event listener for the DragonBones Event, the same to addEventListener.
  14295. !#zh
  14296. 添加 DragonBones 一次性事件监听器,回调会在第一时间被触发后删除自身。。
  14297. @param type A string representing the event type to listen for.
  14298. @param listener The callback that will be invoked when the event is dispatched.
  14299. @param target The target (this object) to invoke the callback, can be null
  14300. */
  14301. on(type: string, listener: (event: cc.Event) => void, target?: any): void;
  14302. /**
  14303. !#en
  14304. Add event listener for the DragonBones Event.
  14305. !#zh
  14306. 添加 DragonBones 事件监听器。
  14307. @param type A string representing the event type to listen for.
  14308. @param listener The callback that will be invoked when the event is dispatched.
  14309. @param target The target (this object) to invoke the callback, can be null
  14310. */
  14311. addEventListener(type: string, listener: (event: cc.Event) => void, target?: any): void;
  14312. /**
  14313. !#en
  14314. Remove the event listener for the DragonBones Event.
  14315. !#zh
  14316. 移除 DragonBones 事件监听器。
  14317. @param type A string representing the event type to listen for.
  14318. @param listener listener
  14319. @param target target
  14320. */
  14321. removeEventListener(type: string, listener?: Function, target?: any): void;
  14322. /**
  14323. !#en
  14324. Build the armature for specified name.
  14325. !#zh
  14326. 构建指定名称的 armature 对象
  14327. @param armatureName armatureName
  14328. @param node node
  14329. */
  14330. buildArmature(armatureName: string, node: cc.Node): dragonBones.ArmatureDisplay;
  14331. /**
  14332. !#en
  14333. Get the current armature object of the ArmatureDisplay.
  14334. !#zh
  14335. 获取 ArmatureDisplay 当前使用的 Armature 对象
  14336. */
  14337. armature(): any;
  14338. }
  14339. /** undefined */
  14340. export class CCFactory extends BaseFactory {
  14341. /**
  14342. @example
  14343. ```js
  14344. let factory = dragonBones.CCFactory.getInstance();
  14345. ```
  14346. */
  14347. static getInstance(): CCFactory;
  14348. }
  14349. /** !#en The skeleton data of dragonBones.
  14350. !#zh dragonBones 的 骨骼数据。 */
  14351. export class DragonBonesAsset extends cc.Asset {
  14352. /** !#en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  14353. !#zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html */
  14354. dragonBonesJson: string;
  14355. }
  14356. /** !#en The skeleton atlas data of dragonBones.
  14357. !#zh dragonBones 的骨骼纹理数据。 */
  14358. export class DragonBonesAtlasAsset extends cc.Asset {
  14359. atlasJson: string;
  14360. texture: cc.Texture2D;
  14361. }
  14362. /****************************************************
  14363. * ArmatureDisplay
  14364. *****************************************************/
  14365. export namespace ArmatureDisplay {
  14366. /** !#en Enum for cache mode type.
  14367. !#zh Dragonbones渲染类型 */
  14368. export enum AnimationCacheMode {
  14369. REALTIME = 0,
  14370. SHARED_CACHE = 0,
  14371. PRIVATE_CACHE = 0,
  14372. }
  14373. }
  14374. }
  14375. /** !#en
  14376. AnySDK is a third party solution that offers game developers SDK integration without making changes to the SDK's features or parameters.It can do all of this while remaining invisible to your end user.Our goal is to handle all the tedious SDK integration work for you so that you can use your time to focus on the game itself.No matter if it’s the channel SDK, user system, payment system, ad system, statistics system, sharing system or any other type of SDK: we’ll take care of it for you.
  14377. !#zh
  14378. AnySDK 为 CP 提供一套第三方 SDK 接入解决方案,整个接入过程,不改变任何 SDK 的功能、特性、参数等,对于最终玩家而言是完全透明无感知的。
  14379. 目的是让 CP 商能有更多时间更专注于游戏本身的品质,所有 SDK 的接入工作统统交给我们吧。第三方 SDK 包括了渠道SDK、用户系统、支付系统、广告系统、统计系统、分享系统等等。 */
  14380. declare namespace anysdk {
  14381. /** !#en
  14382. agent manager of plugin
  14383. !#zh
  14384. 插件管理对象 */
  14385. export var agentManager: anysdk.AgentManager;
  14386. /** !#en
  14387. agent manager of plugin
  14388. !#zh
  14389. 插件管理类 */
  14390. export class AgentManager {
  14391. /**
  14392. !#en
  14393. AppKey appSecret and privateKey are the only three parameters generated
  14394. after the packing tool client finishes creating the game.
  14395. The oauthLoginServer parameter is the API address provided by the game service
  14396. to login verification
  14397. !#zh
  14398. appKey、appSecret、privateKey是通过 AnySDK 客户端工具创建游戏后生成的。
  14399. oauthLoginServer参数是游戏服务提供的用来做登陆验证转发的接口地址。
  14400. @param appKey appKey
  14401. @param appSecret appSecret
  14402. @param privateKey privateKey
  14403. @param oauthLoginServer oauthLoginServer
  14404. */
  14405. init(appKey: string, appSecret: string, privateKey: string, oauthLoginServer: string): void;
  14406. /**
  14407. !#en
  14408. load all plugins, the operation includes SDK`s initialization
  14409. !#zh
  14410. 加载所有插件,该操作包含了 SDKs 初始化
  14411. @param callback callback
  14412. @param target The object to bind to.
  14413. */
  14414. loadAllPlugins(callback: Function, target: any): void;
  14415. /**
  14416. !#en
  14417. unload all plugins
  14418. !#zh
  14419. 卸载插件
  14420. */
  14421. unloadAllPlugins(): void;
  14422. /**
  14423. !#en
  14424. get user system plugin
  14425. !#zh
  14426. 获取用户系统插件
  14427. */
  14428. getUserPlugin(): anysdk.ProtocolUser;
  14429. /**
  14430. !#en
  14431. get IAP system plugins
  14432. !#zh
  14433. 获取支付系统插件
  14434. */
  14435. getIAPPlugins(): anysdk.ProtocolIAP[];
  14436. /**
  14437. !#en
  14438. get IAP system plugin
  14439. !#zh
  14440. 获取支付系统插件
  14441. */
  14442. getIAPPlugin(): anysdk.ProtocolIAP;
  14443. /**
  14444. !#en
  14445. get social system plugin
  14446. !#zh
  14447. 获取社交系统插件
  14448. */
  14449. getSocialPlugin(): anysdk.ProtocolSocial;
  14450. /**
  14451. !#en
  14452. get share system plugin
  14453. !#zh
  14454. 获取分享系统插件
  14455. */
  14456. getSharePlugin(): anysdk.ProtocolShare;
  14457. /**
  14458. !#en
  14459. get analytics system plugin
  14460. !#zh
  14461. 获取统计系统插件
  14462. */
  14463. getAnalyticsPlugin(): anysdk.ProtocolAnalytics;
  14464. /**
  14465. !#en
  14466. get ads system plugin
  14467. !#zh
  14468. 获取广告系统插件
  14469. */
  14470. getAdsPlugin(): anysdk.ProtocolAds;
  14471. /**
  14472. !#en
  14473. get push system plugin
  14474. !#zh
  14475. 获取推送系统插件
  14476. */
  14477. getPushPlugin(): anysdk.ProtocolPush;
  14478. /**
  14479. !#en
  14480. get REC system plugin
  14481. !#zh
  14482. 获取录屏系统插件
  14483. */
  14484. getRECPlugin(): anysdk.ProtocolREC;
  14485. /**
  14486. !#en
  14487. get crash system plugin
  14488. !#zh
  14489. 获取崩溃分析系统插件
  14490. */
  14491. getCrashPlugin(): anysdk.ProtocolCrash;
  14492. /**
  14493. !#en
  14494. get ad track system plugin
  14495. !#zh
  14496. 获取广告追踪系统插件
  14497. */
  14498. getAdTrackingPlugin(): anysdk.ProtocolAdTracking;
  14499. /**
  14500. !#en
  14501. get custom system plugin
  14502. !#zh
  14503. 获取自定义系统插件
  14504. */
  14505. getCustomPlugin(): anysdk.ProtocolCustom;
  14506. /**
  14507. !#en
  14508. get custom parameter
  14509. !#zh
  14510. 获取自定义参数
  14511. */
  14512. getCustomParam(): string;
  14513. /**
  14514. !#en
  14515. get channel id
  14516. !#zh
  14517. 获取渠道唯一表示符
  14518. */
  14519. getChannelId(): string;
  14520. /**
  14521. !#en
  14522. get status of analytics
  14523. !#zh
  14524. 获取统计状态
  14525. */
  14526. isAnaylticsEnabled(): boolean;
  14527. /**
  14528. !#en
  14529. set whether to analytics
  14530. !#zh
  14531. 设置是否统计
  14532. @param enabled enabled
  14533. */
  14534. setIsAnaylticsEnabled(enabled: boolean): void;
  14535. /**
  14536. !#en
  14537. destory instance
  14538. !#zh
  14539. 销毁单例
  14540. */
  14541. static end(): void;
  14542. /**
  14543. !#en
  14544. get instance
  14545. !#zh
  14546. 获取单例
  14547. */
  14548. static getInstance(): anysdk.AgentManager;
  14549. }
  14550. /** !#en
  14551. plugin protocol
  14552. !#zh
  14553. 插件协议 */
  14554. export class PluginProtocol {
  14555. /**
  14556. !#en
  14557. Check whether the function is supported
  14558. !#zh
  14559. 判断函数是否支持
  14560. @param functionName functionName
  14561. */
  14562. isFunctionSupported(functionName: string): boolean;
  14563. /**
  14564. !#en
  14565. get plugin name
  14566. !#zh
  14567. 获取插件名称
  14568. */
  14569. getPluginName(): string;
  14570. /**
  14571. !#en
  14572. get plugin version
  14573. !#zh
  14574. 获取插件版本
  14575. */
  14576. getPluginVersion(): string;
  14577. /**
  14578. !#en
  14579. get SDK version
  14580. !#zh
  14581. 获取 SDK 版本
  14582. */
  14583. getSDKVersion(): string;
  14584. /**
  14585. !#en
  14586. void methods for reflections with parameter
  14587. !#zh
  14588. 反射调用带参数的void方法
  14589. @param funName funName
  14590. @param args optional arguments
  14591. */
  14592. callFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): void;
  14593. /**
  14594. !#en
  14595. String methods for reflections with parameter
  14596. !#zh
  14597. 反射调用带参数的 String 方法
  14598. @param funName funName
  14599. @param args optional arguments
  14600. */
  14601. callStringFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): string;
  14602. /**
  14603. !#en
  14604. int methods for reflections with parameter
  14605. !#zh
  14606. 反射调用带参数的 Int 方法
  14607. @param funName funName
  14608. @param args optional arguments
  14609. */
  14610. callIntFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): number;
  14611. /**
  14612. !#en
  14613. boolean methods for reflections with parameter
  14614. !#zh
  14615. 反射调用带参数的 boolean 方法
  14616. @param funName funName
  14617. @param args optional arguments
  14618. */
  14619. callBoolFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): boolean;
  14620. /**
  14621. !#en
  14622. float methods for reflections with parameter
  14623. !#zh
  14624. 反射调用带参数的 float 方法
  14625. @param funName funName
  14626. @param args optional arguments
  14627. */
  14628. callFloatFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): number;
  14629. }
  14630. /** !#en
  14631. user protocol
  14632. !#zh
  14633. 用户系统协议接口 */
  14634. export class ProtocolUser extends PluginProtocol {
  14635. /**
  14636. !#en
  14637. login interface
  14638. !#zh
  14639. 登录接口
  14640. @param args optional arguments
  14641. */
  14642. login(...args: string|any[]): void;
  14643. /**
  14644. !#en
  14645. get status of login
  14646. !#zh
  14647. 获取登录状态
  14648. */
  14649. isLogined(): boolean;
  14650. /**
  14651. !#en
  14652. get user ID
  14653. !#zh
  14654. 获取用户唯一标示符
  14655. */
  14656. getUserID(): string;
  14657. /**
  14658. !#en
  14659. get plugin ID
  14660. !#zh
  14661. 获取插件ID
  14662. */
  14663. getPluginId(): string;
  14664. /**
  14665. !#en
  14666. set listener
  14667. !#zh
  14668. 设置用户系统的监听
  14669. @param listener listener
  14670. @param target target
  14671. */
  14672. setListener(listener: Function, target: any): void;
  14673. /**
  14674. !#en
  14675. get listener
  14676. !#zh
  14677. 获取用户系统的监听
  14678. */
  14679. getListener(): Function;
  14680. /**
  14681. !#en
  14682. logout
  14683. Before to invoke, you need to verdict whether this properties existed
  14684. !#zh
  14685. 登出,调用前需要判断属性是否存在
  14686. */
  14687. logout(): void;
  14688. /**
  14689. !#en
  14690. show toolbar
  14691. Before to invoke, you need to verdict whether this properties existed
  14692. !#zh
  14693. 显示悬浮窗,调用前需要判断属性是否存在
  14694. @param place place
  14695. */
  14696. showToolBar(place: anysdk.ToolBarPlace): void;
  14697. /**
  14698. !#en
  14699. hide toolbar
  14700. Before to invoke, you need to verdict whether this properties existed
  14701. !#zh
  14702. 隐藏悬浮窗,调用前需要判断属性是否存在
  14703. */
  14704. hideToolBar(): void;
  14705. /**
  14706. !#en
  14707. enter platform
  14708. Before to invoke, you need to verdict whether this properties existed
  14709. !#zh
  14710. 显示平台中心,调用前需要判断属性是否存在
  14711. */
  14712. enterPlatform(): void;
  14713. /**
  14714. !#en
  14715. show exit page
  14716. Before to invoke, you need to verdict whether this properties existed
  14717. !#zh
  14718. 显示退出界面,调用前需要判断属性是否存在
  14719. */
  14720. exit(): void;
  14721. /**
  14722. !#en
  14723. show pause page
  14724. Before to invoke, you need to verdict whether this properties existed
  14725. !#zh
  14726. 显示暂停界面,调用前需要判断属性是否存在
  14727. */
  14728. pause(): void;
  14729. /**
  14730. !#en
  14731. Real-name registration
  14732. Before to invoke, you need to verdict whether this properties existed
  14733. !#zh
  14734. 实名注册,调用前需要判断属性是否存在
  14735. */
  14736. realNameRegister(): void;
  14737. /**
  14738. !#en
  14739. Anti-addiction query
  14740. Before to invoke, you need to verdict whether this properties existed
  14741. !#zh
  14742. 防沉迷查询,调用前需要判断属性是否存在
  14743. */
  14744. antiAddictionQuery(): void;
  14745. /**
  14746. !#en
  14747. submit game role information
  14748. Before to invoke, you need to verdict whether this properties existed
  14749. !#zh
  14750. 提交角色信息,调用前需要判断属性是否存在
  14751. @param data data
  14752. */
  14753. submitLoginGameRole(data: any): void;
  14754. /**
  14755. !#en
  14756. get user information
  14757. Before to invoke, you need to verdict whether this properties existed
  14758. !#zh
  14759. 获取用户信息,调用前需要判断属性是否存在
  14760. @param info info
  14761. */
  14762. getUserInfo(info: any): void;
  14763. /**
  14764. !#en
  14765. set login type
  14766. Before to invoke, you need to verdict whether this properties existed
  14767. !#zh
  14768. 设置登录类型,调用前需要判断属性是否存在
  14769. @param info info
  14770. */
  14771. getAvailableLoginType(info: any): void;
  14772. /**
  14773. !#en
  14774. set login type
  14775. Before to invoke, you need to verdict whether this properties existed
  14776. !#zh
  14777. 设置登录类型,调用前需要判断属性是否存在
  14778. @param loginType loginType
  14779. */
  14780. setLoginType(loginType: string): void;
  14781. /**
  14782. !#en
  14783. send to desktop
  14784. Before to invoke, you need to verdict whether this properties existed
  14785. !#zh
  14786. 发送到桌面,调用前需要判断属性是否存在
  14787. */
  14788. sendToDesktop(): void;
  14789. /**
  14790. !#en
  14791. open bbs
  14792. Before to invoke, you need to verdict whether this properties existed
  14793. !#zh
  14794. 打开论坛,调用前需要判断属性是否存在
  14795. */
  14796. openBBS(): void;
  14797. }
  14798. /** !#en
  14799. IAP protocol
  14800. !#zh
  14801. 支付系统协议接口 */
  14802. export class ProtocolIAP extends PluginProtocol {
  14803. /**
  14804. !#en
  14805. pay interface
  14806. !#zh
  14807. 支付接口
  14808. @param info Type:map
  14809. */
  14810. payForProduct(info: any): void;
  14811. /**
  14812. !#en
  14813. get order ID
  14814. !#zh
  14815. 获取订单ID
  14816. */
  14817. getOrderId(): string;
  14818. /**
  14819. !#en
  14820. reset the pay status
  14821. !#zh
  14822. 重置支付状态
  14823. */
  14824. static resetPayState(): void;
  14825. /**
  14826. !#en
  14827. get plugin ID
  14828. !#zh
  14829. 获取插件ID
  14830. */
  14831. getPluginId(): string;
  14832. /**
  14833. !#en
  14834. set listener
  14835. !#zh
  14836. 设置支付系统的监听
  14837. @param listener listener
  14838. @param target target
  14839. */
  14840. setListener(listener: Function, target: any): void;
  14841. /**
  14842. !#en
  14843. get listener
  14844. !#zh
  14845. 获取支付系统的监听
  14846. */
  14847. getListener(): Function;
  14848. }
  14849. /** !#en
  14850. analytics protocol
  14851. !#zh
  14852. 统计系统协议接口 */
  14853. export class ProtocolAnalytics extends PluginProtocol {
  14854. /**
  14855. !#en
  14856. Start a new session.
  14857. !#zh
  14858. 启动会话
  14859. */
  14860. startSession(): void;
  14861. /**
  14862. !#en
  14863. Stop a session.
  14864. !#zh
  14865. 关闭会话
  14866. */
  14867. stopSession(): void;
  14868. /**
  14869. !#en
  14870. Set the timeout for expiring a session.
  14871. !#zh
  14872. 设置会话超时时间
  14873. @param millis Type: long
  14874. */
  14875. setSessionContinueMillis(millis: number): void;
  14876. /**
  14877. !#en
  14878. log an error
  14879. !#zh
  14880. 捕捉异常
  14881. @param errorId errorId
  14882. @param message message
  14883. */
  14884. logError(errorId: string, message: string): void;
  14885. /**
  14886. !#en
  14887. log an event.
  14888. !#zh
  14889. 捕捉事件
  14890. @param errorId errorId
  14891. @param args optional arguments Type: map
  14892. */
  14893. logEvent(errorId: string, ...args: any[]): void;
  14894. /**
  14895. !#en
  14896. Track an event begin.
  14897. !#zh
  14898. 统计事件开始
  14899. @param eventId eventId
  14900. */
  14901. logTimedEventBegin(eventId: string): void;
  14902. /**
  14903. !#en
  14904. Track an event end.
  14905. !#zh
  14906. 统计事件结束
  14907. @param eventId eventId
  14908. */
  14909. logTimedEventEnd(eventId: string): void;
  14910. /**
  14911. !#en
  14912. set Whether to catch uncaught exceptions to server.
  14913. !#zh
  14914. 设置是否开启自动异常捕捉
  14915. @param enabled enabled
  14916. */
  14917. setCaptureUncaughtException(enabled: boolean): void;
  14918. /**
  14919. !#en
  14920. analytics account information
  14921. !#zh
  14922. 统计玩家帐户信息
  14923. @param paramMap Type: map
  14924. */
  14925. setAccount(paramMap: any): void;
  14926. /**
  14927. !#en
  14928. track user to request payment
  14929. !#zh
  14930. 跟踪用户支付请求
  14931. @param paramMap Type: map
  14932. */
  14933. onChargeRequest(paramMap: any): void;
  14934. /**
  14935. !#en
  14936. track Successful payment
  14937. !#zh
  14938. 追踪用户支付成功
  14939. @param orderID orderID
  14940. */
  14941. onChargeSuccess(orderID: string): void;
  14942. /**
  14943. !#en
  14944. track failed payment
  14945. !#zh
  14946. 追踪用户支付失败
  14947. @param paramMap Type: map
  14948. */
  14949. onChargeFail(paramMap: any): void;
  14950. /**
  14951. !#en
  14952. track Successful payment
  14953. !#zh
  14954. 统计玩家支付成功
  14955. @param paramMap Type: map
  14956. */
  14957. onChargeOnlySuccess(paramMap: any): void;
  14958. /**
  14959. !#en
  14960. track user purchase
  14961. !#zh
  14962. 统计玩家消费
  14963. @param paramMap Type: map
  14964. */
  14965. onPurchase(paramMap: any): void;
  14966. /**
  14967. !#en
  14968. track user to use goods
  14969. !#zh
  14970. 统计玩家使用道具
  14971. @param paramMap Type: map
  14972. */
  14973. onUse(paramMap: any): void;
  14974. /**
  14975. !#en
  14976. track user to reward goods
  14977. !#zh
  14978. 统计玩家获取奖励
  14979. @param paramMap Type: map
  14980. */
  14981. onReward(paramMap: any): void;
  14982. /**
  14983. !#en
  14984. start level
  14985. !#zh
  14986. 开始关卡
  14987. @param paramMap Type: map
  14988. */
  14989. startLevel(paramMap: any): void;
  14990. /**
  14991. !#en
  14992. finish level
  14993. !#zh
  14994. 结束关卡
  14995. @param levelID levelID
  14996. */
  14997. finishLevel(levelID: string): void;
  14998. /**
  14999. !#en
  15000. failed level
  15001. !#zh
  15002. 关卡失败
  15003. @param paramMap Type: map
  15004. */
  15005. failLevel(paramMap: any): void;
  15006. /**
  15007. !#en
  15008. start task
  15009. !#zh
  15010. 开始任务
  15011. @param paramMap Type: map
  15012. */
  15013. startTask(paramMap: any): void;
  15014. /**
  15015. !#en
  15016. finish task
  15017. !#zh
  15018. 完成任务
  15019. @param taskID taskID
  15020. */
  15021. finishTask(taskID: string): void;
  15022. /**
  15023. !#en
  15024. failed task
  15025. !#zh
  15026. 任务失败
  15027. @param paramMap Type: map
  15028. */
  15029. failTask(paramMap: any): void;
  15030. }
  15031. /** !#en
  15032. share protocol
  15033. !#zh
  15034. 分享系统协议接口 */
  15035. export class ProtocolShare extends PluginProtocol {
  15036. /**
  15037. !#en
  15038. share interface
  15039. !#zh
  15040. 分享
  15041. @param info Type: map
  15042. */
  15043. share(info: any): void;
  15044. /**
  15045. !#en
  15046. set listener
  15047. !#zh
  15048. 设置分享系统的监听
  15049. @param listener listener
  15050. @param target target
  15051. */
  15052. setListener(listener: Function, target: any): void;
  15053. /**
  15054. !#en
  15055. get listener
  15056. !#zh
  15057. 获取分享系统的监听
  15058. */
  15059. getListener(): Function;
  15060. }
  15061. /** !#en
  15062. ads protocol
  15063. !#zh
  15064. 广告系统协议接口 */
  15065. export class ProtocolAds extends PluginProtocol {
  15066. /**
  15067. !#en
  15068. hide ads view
  15069. !#zh
  15070. 隐藏广告
  15071. @param adstype adstype
  15072. @param idx idx
  15073. */
  15074. hideAds(adstype: anysdk.AdsType, idx: number): void;
  15075. /**
  15076. !#en
  15077. preload ads view
  15078. !#zh
  15079. 预加载广告
  15080. @param adstype adstype
  15081. @param idx idx
  15082. */
  15083. preloadAds(adstype: anysdk.AdsType, idx: number): void;
  15084. /**
  15085. !#en
  15086. query points
  15087. !#zh
  15088. 查询分数
  15089. */
  15090. queryPoints(): number;
  15091. /**
  15092. !#en
  15093. get whether the ads type is supported
  15094. !#zh
  15095. 获取广告类型是否支持
  15096. @param arg0 arg0
  15097. */
  15098. isAdTypeSupported(arg0: anysdk.AdsType): boolean;
  15099. /**
  15100. !#en
  15101. spend point
  15102. !#zh
  15103. 消费分数
  15104. @param points points
  15105. */
  15106. spendPoints(points: number): void;
  15107. /**
  15108. !#en
  15109. set listener
  15110. !#zh
  15111. 设置广告系统的监听
  15112. @param listener listener
  15113. @param target target
  15114. */
  15115. setListener(listener: Function, target: any): void;
  15116. /**
  15117. !#en
  15118. get listener
  15119. !#zh
  15120. 获取广告系统的监听
  15121. */
  15122. getListener(): Function;
  15123. }
  15124. /** !#en
  15125. social protocol
  15126. !#zh
  15127. 社交系统协议接口 */
  15128. export class ProtocolSocial extends PluginProtocol {
  15129. /**
  15130. !#en
  15131. sign in
  15132. !#zh
  15133. 登录
  15134. */
  15135. signIn(): void;
  15136. /**
  15137. !#en
  15138. sign out
  15139. !#zh
  15140. 登出
  15141. */
  15142. signOut(): void;
  15143. /**
  15144. !#en
  15145. submit score
  15146. !#zh
  15147. 提交分数
  15148. @param leadboardID leadboardID
  15149. @param score Type: long
  15150. */
  15151. submitScore(leadboardID: string, score: number): void;
  15152. /**
  15153. !#en
  15154. show the id of Leaderboard page
  15155. !#zh
  15156. 根据唯一标识符显示排行榜
  15157. @param leaderboardID leaderboardID
  15158. */
  15159. showLeaderboard(leaderboardID: string): void;
  15160. /**
  15161. !#en
  15162. show the page of achievements
  15163. !#zh
  15164. 显示成就榜
  15165. */
  15166. showAchievements(): void;
  15167. /**
  15168. !#en
  15169. unlock achievement
  15170. !#zh
  15171. 解锁成就
  15172. @param info Type: map
  15173. */
  15174. share(info: any): void;
  15175. /**
  15176. !#en
  15177. set listener
  15178. !#zh
  15179. 设置社交系统的监听
  15180. @param listener listener
  15181. @param target target
  15182. */
  15183. setListener(listener: Function, target: any): void;
  15184. /**
  15185. !#en
  15186. get listener
  15187. !#zh
  15188. 获取社交系统的监听
  15189. */
  15190. getListener(): Function;
  15191. /**
  15192. !#en
  15193. get friends info
  15194. Before to invoke, you need to verdict whether this properties existed
  15195. !#zh
  15196. 获取好友信息,调用前需要判断属性是否存在
  15197. */
  15198. pauseRecording(): void;
  15199. /**
  15200. !#en
  15201. interact
  15202. Before to invoke, you need to verdict whether this properties existed
  15203. !#zh
  15204. 订阅,调用前需要判断属性是否存在
  15205. */
  15206. interact(): void;
  15207. /**
  15208. !#en
  15209. subscribe
  15210. Before to invoke, you need to verdict whether this properties existed
  15211. !#zh
  15212. 关注,调用前需要判断属性是否存在
  15213. */
  15214. subscribe(): void;
  15215. }
  15216. /** !#en
  15217. push protocol
  15218. !#zh
  15219. 推送系统协议接口 */
  15220. export class ProtocolPush extends PluginProtocol {
  15221. /**
  15222. !#en
  15223. start Push services
  15224. !#zh
  15225. 启动推送服务
  15226. */
  15227. startPush(): void;
  15228. /**
  15229. !#en
  15230. close Push services
  15231. !#zh
  15232. 暂停推送服务
  15233. */
  15234. closePush(): void;
  15235. /**
  15236. !#en
  15237. delete alias
  15238. !#zh
  15239. 删除别名
  15240. @param alias alias
  15241. */
  15242. delAlias(alias: string): void;
  15243. /**
  15244. !#en
  15245. set alias
  15246. !#zh
  15247. 设置别名
  15248. @param alias alias
  15249. */
  15250. setAlias(alias: string): void;
  15251. /**
  15252. !#en
  15253. delete tags
  15254. !#zh
  15255. 删除标签
  15256. @param tags Type: list
  15257. */
  15258. delTags(tags: any): void;
  15259. /**
  15260. !#en
  15261. set tags
  15262. !#zh
  15263. 设置标签
  15264. @param tags Type: list
  15265. */
  15266. setTags(tags: any): void;
  15267. /**
  15268. !#en
  15269. set listener
  15270. !#zh
  15271. 设置推送系统的监听
  15272. @param listener listener
  15273. @param target target
  15274. */
  15275. setListener(listener: Function, target: any): void;
  15276. /**
  15277. !#en
  15278. get listener
  15279. !#zh
  15280. 获取推送系统的监听
  15281. */
  15282. getListener(): Function;
  15283. }
  15284. /** !#en
  15285. crash protocol
  15286. !#zh
  15287. 崩溃分析系统协议接口 */
  15288. export class ProtocolCrash extends PluginProtocol {
  15289. /**
  15290. !#en
  15291. set user identifier
  15292. !#zh
  15293. 统计用户唯一标识符
  15294. @param identifier identifier
  15295. */
  15296. setUserIdentifier(identifier: string): void;
  15297. /**
  15298. !#en
  15299. The uploader captured in exception information
  15300. !#zh
  15301. 上报异常信息
  15302. @param message message
  15303. @param exception exception
  15304. */
  15305. reportException(message: string, exception: string): void;
  15306. /**
  15307. !#en
  15308. customize logging
  15309. !#zh
  15310. 自定义日志记录
  15311. @param breadcrumb breadcrumb
  15312. */
  15313. leaveBreadcrumb(breadcrumb: string): void;
  15314. }
  15315. /** !#en
  15316. REC protocol
  15317. !#zh
  15318. 录屏系统协议接口 */
  15319. export class ProtocolREC extends PluginProtocol {
  15320. /**
  15321. !#en
  15322. share video
  15323. !#zh
  15324. 分享视频
  15325. @param info Type: map
  15326. */
  15327. share(info: any): void;
  15328. /**
  15329. !#en
  15330. Start to record video
  15331. !#zh
  15332. 开始录制视频
  15333. */
  15334. startRecording(): void;
  15335. /**
  15336. !#en
  15337. Start to record video
  15338. !#zh
  15339. 结束录制视频
  15340. */
  15341. stopRecording(): void;
  15342. /**
  15343. !#en
  15344. set listener
  15345. !#zh
  15346. 设置录屏系统的监听
  15347. @param listener listener
  15348. @param target target
  15349. */
  15350. setListener(listener: Function, target: any): void;
  15351. /**
  15352. !#en
  15353. get listener
  15354. !#zh
  15355. 获取录屏系统的监听
  15356. */
  15357. getListener(): Function;
  15358. /**
  15359. !#en
  15360. pause to record video
  15361. Before to invoke, you need to verdict whether this properties existed
  15362. !#zh
  15363. 暂停录制视频,调用前需要判断属性是否存在
  15364. */
  15365. pauseRecording(): void;
  15366. /**
  15367. !#en
  15368. resume to record video
  15369. Before to invoke, you need to verdict whether this properties existed
  15370. !#zh
  15371. 恢复录制视频,调用前需要判断属性是否存在
  15372. */
  15373. resumeRecording(): void;
  15374. /**
  15375. !#en
  15376. get whether the device is isAvailable
  15377. Before to invoke, you need to verdict whether this properties existed
  15378. !#zh
  15379. 获取设备是否可用,调用前需要判断属性是否存在
  15380. */
  15381. isAvailable(): boolean;
  15382. /**
  15383. !#en
  15384. get status of recording
  15385. Before to invoke, you need to verdict whether this properties existed
  15386. !#zh
  15387. 获取录制状态,调用前需要判断属性是否存在
  15388. */
  15389. isRecording(): boolean;
  15390. /**
  15391. !#en
  15392. show toolbar
  15393. Before to invoke, you need to verdict whether this properties existed
  15394. !#zh
  15395. 显示悬浮窗,调用前需要判断属性是否存在
  15396. */
  15397. showToolBar(): void;
  15398. /**
  15399. !#en
  15400. hide toolbar
  15401. Before to invoke, you need to verdict whether this properties existed
  15402. !#zh
  15403. 隐藏悬浮窗,调用前需要判断属性是否存在
  15404. */
  15405. hideToolBar(): void;
  15406. /**
  15407. !#en
  15408. show video center
  15409. Before to invoke, you need to verdict whether this properties existed
  15410. !#zh
  15411. 显示视频中心,调用前需要判断属性是否存在
  15412. */
  15413. showVideoCenter(): void;
  15414. /**
  15415. !#en
  15416. enter platform
  15417. Before to invoke, you need to verdict whether this properties existed
  15418. !#zh
  15419. 显示平台中心,调用前需要判断属性是否存在
  15420. */
  15421. enterPlatform(): void;
  15422. /**
  15423. !#en
  15424. Set the video data, it is recommended to check whether are recorded firstly
  15425. Before to invoke, you need to verdict whether this properties existed
  15426. !#zh
  15427. 设置视频相关数据,建议先检查是否是正在录制,调用前需要判断属性是否存在
  15428. @param info Type: map
  15429. */
  15430. setMetaData(info: any): void;
  15431. }
  15432. /** !#en
  15433. ad tracking protocol
  15434. !#zh
  15435. 广告追踪系统协议接口 */
  15436. export class ProtocolAdTracking extends PluginProtocol {
  15437. /**
  15438. !#en
  15439. Call this method if you want to track register events as happening during a section.
  15440. !#zh
  15441. 统计用户注册信息
  15442. @param productInfo Type: map
  15443. */
  15444. onPay(productInfo: any): void;
  15445. /**
  15446. !#en
  15447. Call this method if you want to track register events as happening during a section.
  15448. !#zh
  15449. 统计用户注册信息
  15450. @param userInfo Type: map
  15451. */
  15452. onLogin(userInfo: any): void;
  15453. /**
  15454. !#en
  15455. Call this method if you want to track register events as happening during a section.
  15456. !#zh
  15457. 统计用户注册信息
  15458. @param userId userId
  15459. */
  15460. onRegister(userId: string): void;
  15461. /**
  15462. !#en
  15463. Call this method if you want to track custom events with parameters as happening during a section.
  15464. !#zh
  15465. 统计自定义事件
  15466. @param eventId eventId
  15467. @param paramMap Type: map
  15468. */
  15469. trackEvent(eventId: string, paramMap: any): void;
  15470. /**
  15471. !#en
  15472. Call this method with parameters if you want to create role as happening during a section.
  15473. !#zh
  15474. 统计创建角色事件,调用前需要判断属性是否存在
  15475. @param userInfo Type: map
  15476. */
  15477. onCreateRole(userInfo: any): void;
  15478. /**
  15479. !#en
  15480. Call this method if you want to track levelup events with parameters as happening during a section.
  15481. Before to invoke, you need to verdict whether this properties existed
  15482. !#zh
  15483. 统计角色升级事件,调用前需要判断属性是否存在
  15484. @param info Type: map
  15485. */
  15486. onLevelUp(info: any): void;
  15487. /**
  15488. !#en
  15489. Invoke this method with parameters if you want to start to pay as happening during a section.
  15490. Before to invoke, you need to verdict whether this properties existed
  15491. !#zh
  15492. 统计开始充值事件,调用前需要判断属性是否存在
  15493. @param info Type: map
  15494. */
  15495. onStartToPay(info: any): void;
  15496. }
  15497. /** !#en
  15498. custom protocol
  15499. !#zh
  15500. 自定义系统协议接口 */
  15501. export class ProtocolCustom extends PluginProtocol {
  15502. /**
  15503. !#en
  15504. set listener
  15505. !#zh
  15506. 设置自定义系统的监听
  15507. @param listener listener
  15508. @param target target
  15509. */
  15510. setListener(listener: Function, target: any): void;
  15511. /**
  15512. !#en
  15513. get listener
  15514. !#zh
  15515. 获取自定义系统的监听
  15516. */
  15517. getListener(): Function;
  15518. }
  15519. /** !#en
  15520. Data structure class
  15521. !#zh
  15522. 数据结构类 */
  15523. export class PluginParam {
  15524. /**
  15525. !#en
  15526. create plugin parameters
  15527. !#zh
  15528. 创建对象
  15529. @param parameters parameters
  15530. */
  15531. static create(parameters: number|string|any): anysdk.PluginParam;
  15532. }
  15533. /** !#en The callback of user system
  15534. !#zh 用户系统回调 */
  15535. export enum UserActionResultCode {
  15536. kInitSuccess = 0,
  15537. kInitFail = 0,
  15538. kLoginSuccess = 0,
  15539. kLoginNetworkError = 0,
  15540. kLoginNoNeed = 0,
  15541. kLoginFail = 0,
  15542. kLoginCancel = 0,
  15543. kLogoutSuccess = 0,
  15544. kLogoutFail = 0,
  15545. kPlatformEnter = 0,
  15546. kPlatformBack = 0,
  15547. kPausePage = 0,
  15548. kExitPage = 0,
  15549. kAntiAddictionQuery = 0,
  15550. kRealNameRegister = 0,
  15551. kAccountSwitchSuccess = 0,
  15552. kAccountSwitchFail = 0,
  15553. kOpenShop = 0,
  15554. kAccountSwitchCancel = 0,
  15555. kUserExtension = 0,
  15556. kSendToDesktopSuccess = 0,
  15557. kSendToDesktopFail = 0,
  15558. kGetAvailableLoginTypeSuccess = 0,
  15559. kGetAvailableLoginTypeFail = 0,
  15560. kGetUserInfoSuccess = 0,
  15561. kGetUserInfoFail = 0,
  15562. kOpenBBSSuccess = 0,
  15563. kOpenBBSFail = 0,
  15564. }
  15565. /** !#en The toolbar position of user type
  15566. !#zh 用户系统悬浮窗位置 */
  15567. export enum ToolBarPlace {
  15568. kToolBarTopLeft = 0,
  15569. kToolBarTopRight = 0,
  15570. kToolBarMidLeft = 0,
  15571. kToolBarMidRight = 0,
  15572. kToolBarBottomLeft = 0,
  15573. kToolBarBottomRight = 0,
  15574. }
  15575. /** !#en The callback of requesting reStringge
  15576. !#zh 支付系统支付请求回调 */
  15577. export enum PayResultCode {
  15578. kPaySuccess = 0,
  15579. kPayFail = 0,
  15580. kPayCancel = 0,
  15581. kPayNetworkError = 0,
  15582. kPayProductionInforIncomplete = 0,
  15583. kPayInitSuccess = 0,
  15584. kPayInitFail = 0,
  15585. kPayNowPaying = 0,
  15586. kPayReStringgeSuccess = 0,
  15587. kPayExtension = 0,
  15588. kPayNeedLoginAgain = 0,
  15589. kRequestSuccess = 0,
  15590. kRequestFail = 0,
  15591. }
  15592. /** !#en The enum of account type
  15593. !#zh 统计系统的账号类型 */
  15594. export enum AccountType {
  15595. ANONYMOUS = 0,
  15596. REGISTED = 0,
  15597. SINA_WEIBO = 0,
  15598. TENCENT_WEIBO = 0,
  15599. QQ = 0,
  15600. ND91 = 0,
  15601. }
  15602. /** !#en The enum of account operation
  15603. !#zh 统计系统的账号操作 */
  15604. export enum AccountOperate {
  15605. LOGIN = 0,
  15606. LOGOUT = 0,
  15607. REGISTER = 0,
  15608. }
  15609. /** !#en The enum of gender
  15610. !#zh 统计系统的账号性别 */
  15611. export enum AccountGender {
  15612. MALE = 0,
  15613. FEMALE = 0,
  15614. UNKNOWN = 0,
  15615. }
  15616. /** !#en The enum of task type
  15617. !#zh 统计系统的任务类型 */
  15618. export enum TaskType {
  15619. GUIDE_LINE = 0,
  15620. MAIN_LINE = 0,
  15621. BRANCH_LINE = 0,
  15622. DAILY = 0,
  15623. ACTIVITY = 0,
  15624. OTHER = 0,
  15625. }
  15626. /** !#en The callback of share system
  15627. !#zh 分享系统回调 */
  15628. export enum ShareResultCode {
  15629. kShareSuccess = 0,
  15630. kShareFail = 0,
  15631. kShareCancel = 0,
  15632. kShareNetworkError = 0,
  15633. kShareExtension = 0,
  15634. }
  15635. /** !#en The callback of social system
  15636. !#zh 社交系统回调 */
  15637. export enum SocialRetCode {
  15638. kScoreSubmitSucceed = 0,
  15639. kScoreSubmitfail = 0,
  15640. kAchUnlockSucceed = 0,
  15641. kAchUnlockFail = 0,
  15642. kSocialSignInSucceed = 0,
  15643. kSocialSignInFail = 0,
  15644. kSocialSignOutSucceed = 0,
  15645. kSocialSignOutFail = 0,
  15646. kSocialGetGameFriends = 0,
  15647. kSocialExtensionCode = 0,
  15648. kSocialGetFriendsInfoSuccess = 0,
  15649. kSocialGetFriendsInfoFail = 0,
  15650. kSocialAlreadySubscription = 0,
  15651. kSocialNoSubscription = 0,
  15652. kSocialSubscriptionFail = 0,
  15653. }
  15654. /** !#en The callback of ads system
  15655. !#zh 广告系统回调 */
  15656. export enum AdsResultCode {
  15657. kAdsReceived = 0,
  15658. kAdsShown = 0,
  15659. kAdsDismissed = 0,
  15660. kPointsSpendSucceed = 0,
  15661. kPointsSpendFailed = 0,
  15662. kNetworkError = 0,
  15663. kUnknownError = 0,
  15664. kOfferWallOnPointsChanged = 0,
  15665. kRewardedVideoWithReward = 0,
  15666. kInAppPurchaseFinished = 0,
  15667. kAdsClicked = 0,
  15668. kAdsExtension = 0,
  15669. }
  15670. /** !#en The enum of ads position
  15671. !#zh 广告位置 */
  15672. export enum AdsPos {
  15673. kPosCenter = 0,
  15674. kPosTop = 0,
  15675. kPosTopLeft = 0,
  15676. kPosTopRight = 0,
  15677. kPosBottom = 0,
  15678. kPosBottomLeft = 0,
  15679. kPosBottomRight = 0,
  15680. }
  15681. /** !#en The enum of ads type
  15682. !#zh 广告类型 */
  15683. export enum AdsType {
  15684. AD_TYPE_BANNER = 0,
  15685. AD_TYPE_FULLSCREEN = 0,
  15686. AD_TYPE_MOREAPP = 0,
  15687. AD_TYPE_OFFERWALL = 0,
  15688. AD_TYPE_REWARDEDVIDEO = 0,
  15689. AD_TYPE_NATIVEEXPRESS = 0,
  15690. AD_TYPE_NATIVEADVANCED = 0,
  15691. }
  15692. /** !#en The callback of push system
  15693. !#zh 推送系统回调 */
  15694. export enum PushActionResultCode {
  15695. kPushReceiveMessage = 0,
  15696. kPushExtensionCode = 0,
  15697. }
  15698. /** !#en The callback of custom system
  15699. !#zh 自定义系统回调 */
  15700. export enum CustomResultCode {
  15701. kCustomExtension = 0,
  15702. }
  15703. /** !#en The callback of REC system
  15704. !#zh 录屏系统回调 */
  15705. export enum RECResultCode {
  15706. kRECInitSuccess = 0,
  15707. kRECInitFail = 0,
  15708. kRECStartRecording = 0,
  15709. kRECStopRecording = 0,
  15710. kRECPauseRecording = 0,
  15711. kRECResumeRecording = 0,
  15712. kRECEnterSDKPage = 0,
  15713. kRECQuitSDKPage = 0,
  15714. kRECShareSuccess = 0,
  15715. kRECShareFail = 0,
  15716. kRECExtension = 0,
  15717. }
  15718. }
  15719. /** !#en
  15720. The global main namespace of Spine, all classes, functions,
  15721. properties and constants of Spine are defined in this namespace
  15722. !#zh
  15723. Spine 的全局的命名空间,
  15724. 与 Spine 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  15725. declare namespace sp {
  15726. /** !#en
  15727. The skeleton of Spine <br/>
  15728. <br/>
  15729. (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  15730. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  15731. Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  15732. !#zh
  15733. Spine 骨骼动画 <br/>
  15734. <br/>
  15735. (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  15736. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  15737. 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。 */
  15738. export class Skeleton extends cc.RenderComponent {
  15739. /** !#en The skeletal animation is paused?
  15740. !#zh 该骨骼动画是否暂停。 */
  15741. paused: boolean;
  15742. /** !#en
  15743. The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  15744. attachments, skins, etc) and animations but does not hold any state.<br/>
  15745. Multiple skeletons can share the same skeleton data.
  15746. !#zh
  15747. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  15748. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  15749. 多个 Skeleton 可以共用相同的骨骼数据。 */
  15750. skeletonData: SkeletonData;
  15751. /** !#en The name of default skin.
  15752. !#zh 默认的皮肤名称。 */
  15753. defaultSkin: string;
  15754. /** !#en The name of default animation.
  15755. !#zh 默认的动画名称。 */
  15756. defaultAnimation: string;
  15757. /** !#en The name of current playing animation.
  15758. !#zh 当前播放的动画名称。 */
  15759. animation: string;
  15760. _defaultSkinIndex: number;
  15761. /** !#en TODO
  15762. !#zh 是否循环播放当前骨骼动画。 */
  15763. loop: boolean;
  15764. /** !#en Indicates whether to enable premultiplied alpha.
  15765. You should disable this option when image's transparent area appears to have opaque pixels,
  15766. or enable this option when image's half transparent area appears to be darken.
  15767. !#zh 是否启用贴图预乘。
  15768. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  15769. premultipliedAlpha: boolean;
  15770. /** !#en The time scale of this skeleton.
  15771. !#zh 当前骨骼中所有动画的时间缩放率。 */
  15772. timeScale: number;
  15773. /** !#en Indicates whether open debug slots.
  15774. !#zh 是否显示 slot 的 debug 信息。 */
  15775. debugSlots: boolean;
  15776. /** !#en Indicates whether open debug bones.
  15777. !#zh 是否显示 bone 的 debug 信息。 */
  15778. debugBones: boolean;
  15779. /** !#en Enabled two color tint.
  15780. !#zh 是否启用染色效果。 */
  15781. useTint: boolean;
  15782. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  15783. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  15784. enableBatch: boolean;
  15785. /**
  15786. !#en
  15787. Sets runtime skeleton data to sp.Skeleton.<br>
  15788. 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.
  15789. !#zh
  15790. 设置底层运行时用到的 SkeletonData。<br>
  15791. 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  15792. @param skeletonData skeletonData
  15793. */
  15794. setSkeletonData(skeletonData: sp.spine.SkeletonData): void;
  15795. /**
  15796. !#en Sets slots visible range.
  15797. !#zh 设置骨骼插槽可视范围。
  15798. @param skeletonData skeletonData
  15799. */
  15800. setSlotsRange(skeletonData: sp.spine.SkeletonData): void;
  15801. /**
  15802. !#en Sets animation state data.<br>
  15803. The parameter type is {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData.
  15804. !#zh 设置动画状态数据。<br>
  15805. 参数是 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData。
  15806. @param stateData stateData
  15807. */
  15808. setAnimationStateData(stateData: sp.spine.AnimationStateData): void;
  15809. /**
  15810. !#en
  15811. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  15812. If set the mode in editor, then no need to worry about order problem.
  15813. !#zh
  15814. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  15815. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  15816. @param cacheMode
  15817. @example
  15818. armatureDisplay.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
  15819. */
  15820. setAnimationCacheMode(...cacheMode
  15821. : AnimationCacheMode[]): void;
  15822. /**
  15823. !#en Whether in cached mode.
  15824. !#zh 当前是否处于缓存模式。
  15825. */
  15826. isAnimationCached(): void;
  15827. /**
  15828. !#en Computes the world SRT from the local SRT for each bone.
  15829. !#zh 重新更新所有骨骼的世界 Transform,
  15830. 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  15831. @example
  15832. ```js
  15833. var bone = spine.findBone('head');
  15834. cc.log(bone.worldX); // return 0;
  15835. spine.updateWorldTransform();
  15836. bone = spine.findBone('head');
  15837. cc.log(bone.worldX); // return -23.12;
  15838. ```
  15839. */
  15840. updateWorldTransform(): void;
  15841. /**
  15842. !#en Sets the bones and slots to the setup pose.
  15843. !#zh 还原到起始动作
  15844. */
  15845. setToSetupPose(): void;
  15846. /**
  15847. !#en
  15848. Sets the bones to the setup pose,
  15849. using the values from the `BoneData` list in the `SkeletonData`.
  15850. !#zh
  15851. 设置 bone 到起始动作
  15852. 使用 SkeletonData 中的 BoneData 列表中的值。
  15853. */
  15854. setBonesToSetupPose(): void;
  15855. /**
  15856. !#en
  15857. Sets the slots to the setup pose,
  15858. using the values from the `SlotData` list in the `SkeletonData`.
  15859. !#zh
  15860. 设置 slot 到起始动作。
  15861. 使用 SkeletonData 中的 SlotData 列表中的值。
  15862. */
  15863. setSlotsToSetupPose(): void;
  15864. /**
  15865. !#en
  15866. Update an animation cache.
  15867. !#zh
  15868. 更新某个动画缓存。
  15869. @param animName animName
  15870. */
  15871. updateAnimationCache(animName: string): void;
  15872. /**
  15873. !#en
  15874. Finds a bone by name.
  15875. This does a string comparison for every bone.<br>
  15876. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  15877. !#zh
  15878. 通过名称查找 bone。
  15879. 这里对每个 bone 的名称进行了对比。<br>
  15880. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  15881. @param boneName boneName
  15882. */
  15883. findBone(boneName: string): sp.spine.Bone;
  15884. /**
  15885. !#en
  15886. Finds a slot by name. This does a string comparison for every slot.<br>
  15887. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  15888. !#zh
  15889. 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  15890. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  15891. @param slotName slotName
  15892. */
  15893. findSlot(slotName: string): sp.spine.Slot;
  15894. /**
  15895. !#en
  15896. Finds a skin by name and makes it the active skin.
  15897. This does a string comparison for every skin.<br>
  15898. Note that setting the skin does not change which attachments are visible.<br>
  15899. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  15900. !#zh
  15901. 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  15902. 注意:设置皮肤不会改变 attachment 的可见性。<br>
  15903. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  15904. @param skinName skinName
  15905. */
  15906. setSkin(skinName: string): sp.spine.Skin;
  15907. /**
  15908. !#en
  15909. Returns the attachment for the slot and attachment name.
  15910. The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  15911. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  15912. !#zh
  15913. 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  15914. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  15915. @param slotName slotName
  15916. @param attachmentName attachmentName
  15917. */
  15918. getAttachment(slotName: string, attachmentName: string): sp.spine.Attachment;
  15919. /**
  15920. !#en
  15921. Sets the attachment for the slot and attachment name.
  15922. The skeleton looks first in its skin, then in the skeleton data’s default skin.
  15923. !#zh
  15924. 通过 slot 和 attachment 的名字来设置 attachment。
  15925. Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  15926. @param slotName slotName
  15927. @param attachmentName attachmentName
  15928. */
  15929. setAttachment(slotName: string, attachmentName: string): void;
  15930. /**
  15931. Return the renderer of attachment.
  15932. @param regionAttachment regionAttachment
  15933. */
  15934. getTextureAtlas(regionAttachment: sp.spine.RegionAttachment|spine.BoundingBoxAttachment): sp.spine.TextureAtlasRegion;
  15935. /**
  15936. !#en
  15937. Mix applies all keyframe values,
  15938. interpolated for the specified time and mixed with the current values.
  15939. !#zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  15940. @param fromAnimation fromAnimation
  15941. @param toAnimation toAnimation
  15942. @param duration duration
  15943. */
  15944. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  15945. /**
  15946. !#en Set the current animation. Any queued animations are cleared.<br>
  15947. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15948. !#zh 设置当前动画。队列中的任何的动画将被清除。<br>
  15949. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15950. @param trackIndex trackIndex
  15951. @param name name
  15952. @param loop loop
  15953. */
  15954. setAnimation(trackIndex: number, name: string, loop: boolean): sp.spine.TrackEntry;
  15955. /**
  15956. !#en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  15957. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15958. !#zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  15959. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15960. @param trackIndex trackIndex
  15961. @param name name
  15962. @param loop loop
  15963. @param delay delay
  15964. */
  15965. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): sp.spine.TrackEntry;
  15966. /**
  15967. !#en Find animation with specified name.
  15968. !#zh 查找指定名称的动画
  15969. @param name name
  15970. */
  15971. findAnimation(name: string): sp.spine.Animation;
  15972. /**
  15973. !#en Returns track entry by trackIndex.<br>
  15974. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15975. !#zh 通过 track 索引获取 TrackEntry。<br>
  15976. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15977. @param trackIndex trackIndex
  15978. */
  15979. getCurrent(trackIndex: void): sp.spine.TrackEntry;
  15980. /**
  15981. !#en Clears all tracks of animation state.
  15982. !#zh 清除所有 track 的动画状态。
  15983. */
  15984. clearTracks(): void;
  15985. /**
  15986. !#en Clears track of animation state by trackIndex.
  15987. !#zh 清除出指定 track 的动画状态。
  15988. @param trackIndex trackIndex
  15989. */
  15990. clearTrack(trackIndex: number): void;
  15991. /**
  15992. !#en Set the start event listener.
  15993. !#zh 用来设置开始播放动画的事件监听。
  15994. @param listener listener
  15995. */
  15996. setStartListener(listener: Function): void;
  15997. /**
  15998. !#en Set the interrupt event listener.
  15999. !#zh 用来设置动画被打断的事件监听。
  16000. @param listener listener
  16001. */
  16002. setInterruptListener(listener: Function): void;
  16003. /**
  16004. !#en Set the end event listener.
  16005. !#zh 用来设置动画播放完后的事件监听。
  16006. @param listener listener
  16007. */
  16008. setEndListener(listener: Function): void;
  16009. /**
  16010. !#en Set the dispose event listener.
  16011. !#zh 用来设置动画将被销毁的事件监听。
  16012. @param listener listener
  16013. */
  16014. setDisposeListener(listener: Function): void;
  16015. /**
  16016. !#en Set the complete event listener.
  16017. !#zh 用来设置动画播放一次循环结束后的事件监听。
  16018. @param listener listener
  16019. */
  16020. setCompleteListener(listener: Function): void;
  16021. /**
  16022. !#en Set the animation event listener.
  16023. !#zh 用来设置动画播放过程中帧事件的监听。
  16024. @param listener listener
  16025. */
  16026. setEventListener(listener: Function): void;
  16027. /**
  16028. !#en Set the start event listener for specified TrackEntry.
  16029. !#zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  16030. @param entry entry
  16031. @param listener listener
  16032. */
  16033. setTrackStartListener(entry: sp.spine.TrackEntry, listener: Function): void;
  16034. /**
  16035. !#en Set the interrupt event listener for specified TrackEntry.
  16036. !#zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  16037. @param entry entry
  16038. @param listener listener
  16039. */
  16040. setTrackInterruptListener(entry: sp.spine.TrackEntry, listener: Function): void;
  16041. /**
  16042. !#en Set the end event listener for specified TrackEntry.
  16043. !#zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  16044. @param entry entry
  16045. @param listener listener
  16046. */
  16047. setTrackEndListener(entry: sp.spine.TrackEntry, listener: Function): void;
  16048. /**
  16049. !#en Set the dispose event listener for specified TrackEntry.
  16050. !#zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  16051. @param entry entry
  16052. @param listener listener
  16053. */
  16054. setTrackDisposeListener(entry: sp.spine.TrackEntry, listener: Function): void;
  16055. /**
  16056. !#en Set the complete event listener for specified TrackEntry.
  16057. !#zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  16058. @param entry entry
  16059. @param listener listener
  16060. */
  16061. setTrackCompleteListener(entry: sp.spine.TrackEntry, listener: (entry: sp.spine.TrackEntry, loopCount: number) => void): void;
  16062. /**
  16063. !#en Set the event listener for specified TrackEntry.
  16064. !#zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  16065. @param entry entry
  16066. @param listener listener
  16067. */
  16068. setTrackEventListener(entry: sp.spine.TrackEntry, listener: Function): void;
  16069. /**
  16070. !#en Get the animation state object
  16071. !#zh 获取
  16072. */
  16073. setTrackEventListener(): sp.spine.AnimationState;
  16074. }
  16075. /** !#en The event type of spine skeleton animation.
  16076. !#zh 骨骼动画事件类型。 */
  16077. export enum AnimationEventType {
  16078. START = 0,
  16079. END = 0,
  16080. COMPLETE = 0,
  16081. EVENT = 0,
  16082. }
  16083. /** !#en The skeleton data of spine.
  16084. !#zh Spine 的 骨骼数据。 */
  16085. export class SkeletonData extends cc.Asset {
  16086. /** !#en See http://en.esotericsoftware.com/spine-json-format
  16087. !#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */
  16088. skeletonJson: any;
  16089. atlasText: string;
  16090. textures: cc.Texture2D[];
  16091. /** !#en
  16092. A scale can be specified on the JSON or binary loader which will scale the bone positions,
  16093. image sizes, and animation translations.
  16094. This can be useful when using different sized images than were used when designing the skeleton
  16095. in Spine. For example, if using images that are half the size than were used in Spine,
  16096. a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  16097. resolution texture atlases.
  16098. see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  16099. !#zh 可查看 Spine 官方文档: http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */
  16100. scale: number;
  16101. /**
  16102. !#en Get the included SkeletonData used in spine runtime.<br>
  16103. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData object.
  16104. !#zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  16105. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData 对象。
  16106. @param quiet quiet
  16107. */
  16108. getRuntimeData(quiet?: boolean): sp.spine.SkeletonData;
  16109. }
  16110. /****************************************************
  16111. * Skeleton
  16112. *****************************************************/
  16113. export namespace Skeleton {
  16114. /** !#en Enum for animation cache mode type.
  16115. !#zh Spine动画缓存类型 */
  16116. export enum AnimationCacheMode {
  16117. REALTIME = 0,
  16118. SHARED_CACHE = 0,
  16119. PRIVATE_CACHE = 0,
  16120. }
  16121. }
  16122. }
  16123. /** !#en
  16124. `sp.spine` is the namespace for official Spine Runtime, which officially implemented and maintained by Spine.<br>
  16125. Please refer to the official documentation for its detailed usage: [http://en.esotericsoftware.com/spine-using-runtimes](http://en.esotericsoftware.com/spine-using-runtimes)
  16126. !#zh
  16127. sp.spine 模块是 Spine 官方运行库的 API 入口,由 Spine 官方统一实现和维护,具体用法请参考:[http://zh.esotericsoftware.com/spine-using-runtimes](http://zh.esotericsoftware.com/spine-using-runtimes) */
  16128. declare namespace sp.spine {
  16129. }
  16130. /** !#en Some JavaScript decorators which can be accessed with "cc._decorator".
  16131. !#zh 一些 JavaScript 装饰器,目前可以通过 "cc._decorator" 来访问。
  16132. (这些 API 仍不完全稳定,有可能随着 JavaScript 装饰器的标准实现而调整) */
  16133. declare namespace cc._decorator {
  16134. /**
  16135. !#en
  16136. Declare the standard [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
  16137. as CCClass, please see [Class](../../../manual/en/scripting/class.html) for details.
  16138. !#zh
  16139. 将标准写法的 [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 声明为 CCClass,具体用法请参阅[类型定义](../../../manual/zh/scripting/class.html)。
  16140. @param name The class name used for serialization.
  16141. @example
  16142. ```js
  16143. const {ccclass} = cc._decorator;
  16144. // define a CCClass, omit the name
  16145. &#64;ccclass
  16146. class NewScript extends cc.Component {
  16147. // ...
  16148. }
  16149. // define a CCClass with a name
  16150. &#64;ccclass('LoginData')
  16151. class LoginData {
  16152. // ...
  16153. }
  16154. ```
  16155. */
  16156. export function ccclass(name?: string): Function;
  16157. export function ccclass(_class?: Function): void;
  16158. /**
  16159. !#en
  16160. Declare property for [CCClass](../../../manual/en/scripting/reference/attributes.html).
  16161. !#zh
  16162. 定义 [CCClass](../../../manual/zh/scripting/reference/attributes.html) 所用的属性。
  16163. @param options an object with some property attributes
  16164. @example
  16165. ```js
  16166. const {ccclass, property} = cc._decorator;
  16167. &#64;ccclass
  16168. class NewScript extends cc.Component {
  16169. &#64;property({
  16170. type: cc.Node
  16171. })
  16172. targetNode1 = null;
  16173. &#64;property(cc.Node)
  16174. targetNode2 = null;
  16175. &#64;property(cc.Button)
  16176. targetButton = null;
  16177. &#64;property
  16178. _width = 100;
  16179. &#64;property
  16180. get width () {
  16181. return this._width;
  16182. }
  16183. &#64;property
  16184. set width (value) {
  16185. this._width = value;
  16186. }
  16187. &#64;property
  16188. offset = new cc.Vec2(100, 100);
  16189. &#64;property(cc.Vec2)
  16190. offsets = [];
  16191. &#64;property(cc.SpriteFrame)
  16192. frame = null;
  16193. }
  16194. // above is equivalent to (上面的代码相当于):
  16195. var NewScript = cc.Class({
  16196. properties: {
  16197. targetNode1: {
  16198. default: null,
  16199. type: cc.Node
  16200. },
  16201. targetNode2: {
  16202. default: null,
  16203. type: cc.Node
  16204. },
  16205. targetButton: {
  16206. default: null,
  16207. type: cc.Button
  16208. },
  16209. _width: 100,
  16210. width: {
  16211. get () {
  16212. return this._width;
  16213. },
  16214. set (value) {
  16215. this._width = value;
  16216. }
  16217. },
  16218. offset: new cc.Vec2(100, 100)
  16219. offsets: {
  16220. default: [],
  16221. type: cc.Vec2
  16222. }
  16223. frame: {
  16224. default: null,
  16225. type: cc.SpriteFrame
  16226. },
  16227. }
  16228. });
  16229. ```
  16230. */
  16231. 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;
  16232. export function property(_target: Object, _key: any, _desc?: any): void;
  16233. /**
  16234. !#en
  16235. Makes a CCClass that inherit from component execute in edit mode.<br>
  16236. By default, all components are only executed in play mode,
  16237. which means they will not have their callback functions executed while the Editor is in edit mode.
  16238. !#zh
  16239. 允许继承自 Component 的 CCClass 在编辑器里执行。<br>
  16240. 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  16241. @example
  16242. ```js
  16243. const {ccclass, executeInEditMode} = cc._decorator;
  16244. &#64;ccclass
  16245. &#64;executeInEditMode
  16246. class NewScript extends cc.Component {
  16247. // ...
  16248. }
  16249. ```
  16250. */
  16251. export function executeInEditMode(): Function;
  16252. export function executeInEditMode(_class: Function): void;
  16253. /**
  16254. !#en
  16255. Automatically add required component as a dependency for the CCClass that inherit from component.
  16256. !#zh
  16257. 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  16258. @param requiredComponent requiredComponent
  16259. @example
  16260. ```js
  16261. const {ccclass, requireComponent} = cc._decorator;
  16262. &#64;ccclass
  16263. &#64;requireComponent(cc.Sprite)
  16264. class SpriteCtrl extends cc.Component {
  16265. // ...
  16266. }
  16267. ```
  16268. */
  16269. export function requireComponent(requiredComponent: typeof cc.Component): Function;
  16270. /**
  16271. !#en
  16272. The menu path to register a component to the editors "Component" menu. Eg. "Rendering/CameraCtrl".
  16273. !#zh
  16274. 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  16275. @param path The path is the menu represented like a pathname.
  16276. For example the menu could be "Rendering/CameraCtrl".
  16277. @example
  16278. ```js
  16279. const {ccclass, menu} = cc._decorator;
  16280. &#64;ccclass
  16281. &#64;menu("Rendering/CameraCtrl")
  16282. class NewScript extends cc.Component {
  16283. // ...
  16284. }
  16285. ```
  16286. */
  16287. export function menu(path: string): Function;
  16288. /**
  16289. !#en
  16290. The execution order of lifecycle methods for Component.
  16291. Those less than 0 will execute before while those greater than 0 will execute after.
  16292. The order will only affect onLoad, onEnable, start, update and lateUpdate while onDisable and onDestroy will not be affected.
  16293. !#zh
  16294. 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  16295. @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.
  16296. @example
  16297. ```js
  16298. const {ccclass, executionOrder} = cc._decorator;
  16299. &#64;ccclass
  16300. &#64;executionOrder(1)
  16301. class CameraCtrl extends cc.Component {
  16302. // ...
  16303. }
  16304. ```
  16305. */
  16306. export function executionOrder(order: number): Function;
  16307. /**
  16308. !#en
  16309. Prevents Component of the same type (or subtype) to be added more than once to a Node.
  16310. !#zh
  16311. 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  16312. @example
  16313. ```js
  16314. const {ccclass, disallowMultiple} = cc._decorator;
  16315. &#64;ccclass
  16316. &#64;disallowMultiple
  16317. class CameraCtrl extends cc.Component {
  16318. // ...
  16319. }
  16320. ```
  16321. */
  16322. export function disallowMultiple(): Function;
  16323. export function disallowMultiple(_class: Function): void;
  16324. /**
  16325. !#en
  16326. 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>
  16327. This property is only available if executeInEditMode is true.
  16328. !#zh
  16329. 当指定了 "executeInEditMode" 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  16330. @example
  16331. ```js
  16332. const {ccclass, playOnFocus, executeInEditMode} = cc._decorator;
  16333. &#64;ccclass
  16334. &#64;executeInEditMode
  16335. &#64;playOnFocus
  16336. class CameraCtrl extends cc.Component {
  16337. // ...
  16338. }
  16339. ```
  16340. */
  16341. export function playOnFocus(): Function;
  16342. export function playOnFocus(_class: Function): void;
  16343. /**
  16344. !#en
  16345. Specifying the url of the custom html to draw the component in **Properties**.
  16346. !#zh
  16347. 自定义当前组件在 **属性检查器** 中渲染时所用的网页 url。
  16348. @param url url
  16349. @example
  16350. ```js
  16351. const {ccclass, inspector} = cc._decorator;
  16352. &#64;ccclass
  16353. &#64;inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  16354. class NewScript extends cc.Component {
  16355. // ...
  16356. }
  16357. ```
  16358. */
  16359. export function inspector(path: string): Function;
  16360. /**
  16361. !#en
  16362. The custom documentation URL.
  16363. !#zh
  16364. 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  16365. @param url url
  16366. @example
  16367. ```js
  16368. const {ccclass, help} = cc._decorator;
  16369. &#64;ccclass
  16370. &#64;help("app://docs/html/components/spine.html")
  16371. class NewScript extends cc.Component {
  16372. // ...
  16373. }
  16374. ```
  16375. */
  16376. export function help(path: string): Function;
  16377. /**
  16378. NOTE:<br>
  16379. The old mixins implemented in cc.Class(ES5) behaves exact the same as multiple inheritance.
  16380. But since ES6, class constructor can't be function-called and class methods become non-enumerable,
  16381. so we can not mix in ES6 Classes.<br>
  16382. See:<br>
  16383. [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>
  16384. One possible solution (but IDE unfriendly):<br>
  16385. [http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/)<br>
  16386. <br>
  16387. NOTE:<br>
  16388. You must manually call mixins constructor, this is different from cc.Class(ES5).
  16389. @param ctor constructors to mix, only support ES5 constructors or classes defined by using `cc.Class`,
  16390. not support ES6 Classes.
  16391. @example
  16392. ```js
  16393. const {ccclass, mixins} = cc._decorator;
  16394. class Animal { ... }
  16395. const Fly = cc.Class({
  16396. constructor () { ... }
  16397. });
  16398. &#64;ccclass
  16399. &#64;mixins(cc.EventTarget, Fly)
  16400. class Bird extends Animal {
  16401. constructor () {
  16402. super();
  16403. // You must manually call mixins constructor, this is different from cc.Class(ES5)
  16404. cc.EventTarget.call(this);
  16405. Fly.call(this);
  16406. }
  16407. // ...
  16408. }
  16409. ```
  16410. */
  16411. export function mixins(ctor: Function, ...rest: Function[]): Function;
  16412. }
  16413. /** This module provides some JavaScript utilities.
  16414. All members can be accessed with "cc.js". */
  16415. declare namespace cc.js {
  16416. /**
  16417. Check the obj whether is number or not
  16418. If a number is created by using 'new Number(10086)', the typeof it will be "object"...
  16419. Then you can use this function if you care about this case.
  16420. @param obj obj
  16421. */
  16422. export function isNumber(obj: any): boolean;
  16423. /**
  16424. Check the obj whether is string or not.
  16425. If a string is created by using 'new String("blabla")', the typeof it will be "object"...
  16426. Then you can use this function if you care about this case.
  16427. @param obj obj
  16428. */
  16429. export function isString(obj: any): boolean;
  16430. /**
  16431. Copy all properties not defined in obj from arguments[1...n]
  16432. @param obj object to extend its properties
  16433. @param sourceObj source object to copy properties from
  16434. */
  16435. export function addon(obj: any, ...sourceObj: any[]): any;
  16436. /**
  16437. copy all properties from arguments[1...n] to obj
  16438. @param obj obj
  16439. @param sourceObj sourceObj
  16440. */
  16441. export function mixin(obj: any, ...sourceObj: any[]): any;
  16442. /**
  16443. Derive the class from the supplied base class.
  16444. Both classes are just native javascript constructors, not created by cc.Class, so
  16445. usually you will want to inherit using {{#crossLink "cc/Class:method"}}cc.Class {{/crossLink}} instead.
  16446. @param cls cls
  16447. @param base the baseclass to inherit
  16448. */
  16449. export function extend(cls: Function, base: Function): Function;
  16450. /**
  16451. Get super class
  16452. @param ctor the constructor of subclass
  16453. */
  16454. export function getSuper(ctor: Function): Function;
  16455. /**
  16456. Checks whether subclass is child of superclass or equals to superclass
  16457. @param subclass subclass
  16458. @param superclass superclass
  16459. */
  16460. export function isChildClassOf(subclass: Function, superclass: Function): boolean;
  16461. /**
  16462. Removes all enumerable properties from object
  16463. @param obj obj
  16464. */
  16465. export function clear(obj: any): void;
  16466. /**
  16467. Checks whether obj is an empty object
  16468. @param obj obj
  16469. */
  16470. export function isEmptyObject(obj: any): void;
  16471. /**
  16472. Get property descriptor in object and all its ancestors
  16473. @param obj obj
  16474. @param name name
  16475. */
  16476. export function getPropertyDescriptor(obj: any, name: string): any;
  16477. /**
  16478. Define value, just help to call Object.defineProperty.<br>
  16479. The configurable will be true.
  16480. @param obj obj
  16481. @param prop prop
  16482. @param value value
  16483. @param writable writable
  16484. @param enumerable enumerable
  16485. */
  16486. export function value(obj: any, prop: string, value: any, writable?: boolean, enumerable?: boolean): void;
  16487. /**
  16488. Define get set accessor, just help to call Object.defineProperty(...)
  16489. @param obj obj
  16490. @param prop prop
  16491. @param getter getter
  16492. @param setter setter
  16493. @param enumerable enumerable
  16494. */
  16495. export function getset(obj: any, prop: string, getter: Function, setter?: Function, enumerable?: boolean): void;
  16496. /**
  16497. Define get accessor, just help to call Object.defineProperty(...)
  16498. @param obj obj
  16499. @param prop prop
  16500. @param getter getter
  16501. @param enumerable enumerable
  16502. @param configurable configurable
  16503. */
  16504. export function get(obj: any, prop: string, getter: Function, enumerable?: boolean, configurable?: boolean): void;
  16505. /**
  16506. Define set accessor, just help to call Object.defineProperty(...)
  16507. @param obj obj
  16508. @param prop prop
  16509. @param setter setter
  16510. @param enumerable enumerable
  16511. @param configurable configurable
  16512. */
  16513. export function set(obj: any, prop: string, setter: Function, enumerable?: boolean, configurable?: boolean): void;
  16514. /**
  16515. Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  16516. (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code from this stackoverflow post</a>)
  16517. @param objOrCtor instance or constructor
  16518. */
  16519. export function getClassName(objOrCtor: any|Function): string;
  16520. /** !#en All classes registered in the engine, indexed by ID.
  16521. !#zh 引擎中已注册的所有类型,通过 ID 进行索引。 */
  16522. export var _registeredClassIds: void;
  16523. /** !#en All classes registered in the engine, indexed by name.
  16524. !#zh 引擎中已注册的所有类型,通过名称进行索引。 */
  16525. export var _registeredClassNames: void;
  16526. /**
  16527. Register the class by specified name manually
  16528. @param className className
  16529. @param constructor constructor
  16530. */
  16531. export function setClassName(className: string, constructor: Function): void;
  16532. /**
  16533. Unregister a class from fireball.
  16534. If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
  16535. Please note that its still your responsibility to free other references to the class.
  16536. @param constructor the class you will want to unregister, any number of classes can be added
  16537. */
  16538. export function unregisterClass(...constructor: Function[]): void;
  16539. /**
  16540. Get the registered class by name
  16541. @param classname classname
  16542. */
  16543. export function getClassByName(classname: string): Function;
  16544. /**
  16545. Defines a polyfill field for obsoleted codes.
  16546. @param obj YourObject or YourClass.prototype
  16547. @param obsoleted "OldParam" or "YourClass.OldParam"
  16548. @param newExpr "NewParam" or "YourClass.NewParam"
  16549. @param writable writable
  16550. */
  16551. export function obsolete(obj: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  16552. /**
  16553. Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
  16554. @param obj YourObject or YourClass.prototype
  16555. @param objName "YourObject" or "YourClass"
  16556. @param props props
  16557. @param writable writable
  16558. */
  16559. export function obsoletes(obj: any, objName: any, props: any, writable?: boolean): void;
  16560. /**
  16561. A string tool to construct a string with format string.
  16562. @param msg A JavaScript string containing zero or more substitution strings (%s).
  16563. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  16564. @example
  16565. ```js
  16566. cc.js.formatStr("a: %s, b: %s", a, b);
  16567. cc.js.formatStr(a, b, c);
  16568. ```
  16569. */
  16570. export function formatStr(msg: string|any, ...subst: any[]): string;
  16571. /**
  16572. !#en
  16573. 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.
  16574. !#zh
  16575. 该方法是对 `Object.create(null)` 的简单封装。`Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断。在需要频繁判断 `hasOwnProperty` 时,使用这个方法性能会比 `{}` 更高。
  16576. @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.
  16577. */
  16578. export function createMap(forceDictMode?: boolean): any;
  16579. /** undefined */
  16580. export class array {
  16581. /**
  16582. Removes the array item at the specified index.
  16583. @param array array
  16584. @param index index
  16585. */
  16586. static removeAt(array: any[], index: number): void;
  16587. /**
  16588. Removes the array item at the specified index.
  16589. It's faster but the order of the array will be changed.
  16590. @param array array
  16591. @param index index
  16592. */
  16593. static fastRemoveAt(array: any[], index: number): void;
  16594. /**
  16595. Removes the first occurrence of a specific object from the array.
  16596. @param array array
  16597. @param value value
  16598. */
  16599. static remove(array: any[], value: any): boolean;
  16600. /**
  16601. Removes the first occurrence of a specific object from the array.
  16602. It's faster but the order of the array will be changed.
  16603. @param array array
  16604. @param value value
  16605. */
  16606. static fastRemove(array: any[], value: number): void;
  16607. /**
  16608. Verify array's Type
  16609. @param array array
  16610. @param type type
  16611. */
  16612. static verifyType(array: any[], type: Function): boolean;
  16613. /**
  16614. Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.
  16615. @param array Source Array
  16616. @param minusArr minus Array
  16617. */
  16618. static removeArray(array: any[], minusArr: any[]): void;
  16619. /**
  16620. Inserts some objects at index
  16621. @param array array
  16622. @param addObjs addObjs
  16623. @param index index
  16624. */
  16625. static appendObjectsAt(array: any[], addObjs: any[], index: number): any[];
  16626. /**
  16627. Exact same function as Array.prototype.indexOf.<br>
  16628. HACK: ugliy hack for Baidu mobile browser compatibility, stupid Baidu guys modify Array.prototype.indexOf for all pages loaded, their version changes strict comparison to non-strict comparison, it also ignores the second parameter of the original API, and this will cause event handler enter infinite loop.<br>
  16629. Baidu developers, if you ever see this documentation, here is the standard: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf, Seriously!
  16630. @param searchElement Element to locate in the array.
  16631. @param fromIndex The index to start the search at
  16632. */
  16633. static indexOf(searchElement: any, fromIndex?: number): number;
  16634. /**
  16635. Determines whether the array contains a specific value.
  16636. @param array array
  16637. @param value value
  16638. */
  16639. static contains(array: any[], value: any): boolean;
  16640. /**
  16641. Copy an array's item to a new array (its performance is better than Array.slice)
  16642. @param array array
  16643. */
  16644. static copy(array: any[]): any[];
  16645. }
  16646. /** !#en
  16647. A fixed-length object pool designed for general type.<br>
  16648. The implementation of this object pool is very simple,
  16649. it can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  16650. !#zh
  16651. 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  16652. 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。 */
  16653. export class Pool {
  16654. /**
  16655. !#en
  16656. Constructor for creating an object pool for the specific object type.
  16657. You can pass a callback argument for process the cleanup logic when the object is recycled.
  16658. !#zh
  16659. 使用构造函数来创建一个指定对象类型的对象池,您可以传递一个回调函数,用于处理对象回收时的清理逻辑。
  16660. @param cleanupFunc the callback method used to process the cleanup logic when the object is recycled.
  16661. @param size initializes the length of the array
  16662. */
  16663. constructor(cleanupFunc: (obj: any) => void, size: number);
  16664. constructor(size: number);
  16665. /**
  16666. !#en
  16667. Get and initialize an object from pool. This method defaults to null and requires the user to implement it.
  16668. !#zh
  16669. 获取并初始化对象池中的对象。这个方法默认为空,需要用户自己实现。
  16670. @param params parameters to used to initialize the object
  16671. */
  16672. get(...params: any[]): any;
  16673. /** !#en
  16674. The current number of available objects, the default is 0, it will gradually increase with the recycle of the object,
  16675. the maximum will not exceed the size specified when the constructor is called.
  16676. !#zh
  16677. 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。 */
  16678. count: number;
  16679. /**
  16680. !#en
  16681. Get an object from pool, if no available object in the pool, null will be returned.
  16682. !#zh
  16683. 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  16684. */
  16685. _get(): any;
  16686. /**
  16687. !#en Put an object into the pool.
  16688. !#zh 向对象池返还一个不再需要的对象。
  16689. */
  16690. put(): void;
  16691. /**
  16692. !#en Resize the pool.
  16693. !#zh 设置对象池容量。
  16694. */
  16695. resize(): void;
  16696. }
  16697. }
  16698. declare namespace dragonBones {
  16699. /**
  16700. * @internal
  16701. * @private
  16702. */
  16703. const webAssemblyModule: {
  16704. HEAP16: Int16Array;
  16705. _malloc(byteSize: number): number;
  16706. _free(pointer: number): void;
  16707. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  16708. };
  16709. }
  16710. /**
  16711. * The MIT License (MIT)
  16712. *
  16713. * Copyright (c) 2012-2017 DragonBones team and other contributors
  16714. *
  16715. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  16716. * this software and associated documentation files (the "Software"), to deal in
  16717. * the Software without restriction, including without limitation the rights to
  16718. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  16719. * the Software, and to permit persons to whom the Software is furnished to do so,
  16720. * subject to the following conditions:
  16721. *
  16722. * The above copyright notice and this permission notice shall be included in all
  16723. * copies or substantial portions of the Software.
  16724. *
  16725. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16726. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16727. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16728. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16729. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16730. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16731. */
  16732. declare namespace dragonBones {
  16733. /**
  16734. * @internal
  16735. * @private
  16736. */
  16737. const enum BinaryOffset {
  16738. WeigthBoneCount = 0,
  16739. WeigthFloatOffset = 1,
  16740. WeigthBoneIndices = 2,
  16741. MeshVertexCount = 0,
  16742. MeshTriangleCount = 1,
  16743. MeshFloatOffset = 2,
  16744. MeshWeightOffset = 3,
  16745. MeshVertexIndices = 4,
  16746. TimelineScale = 0,
  16747. TimelineOffset = 1,
  16748. TimelineKeyFrameCount = 2,
  16749. TimelineFrameValueCount = 3,
  16750. TimelineFrameValueOffset = 4,
  16751. TimelineFrameOffset = 5,
  16752. FramePosition = 0,
  16753. FrameTweenType = 1,
  16754. FrameTweenEasingOrCurveSampleCount = 2,
  16755. FrameCurveSamples = 3,
  16756. DeformMeshOffset = 0,
  16757. DeformCount = 1,
  16758. DeformValueCount = 2,
  16759. DeformValueOffset = 3,
  16760. DeformFloatOffset = 4,
  16761. }
  16762. /**
  16763. * @internal
  16764. * @private
  16765. */
  16766. const enum ArmatureType {
  16767. Armature = 0,
  16768. MovieClip = 1,
  16769. Stage = 2,
  16770. }
  16771. /**
  16772. * @internal
  16773. * @private
  16774. */
  16775. const enum BoneType {
  16776. Bone = 0,
  16777. Surface = 1,
  16778. }
  16779. /**
  16780. * @private
  16781. */
  16782. const enum DisplayType {
  16783. Image = 0,
  16784. Armature = 1,
  16785. Mesh = 2,
  16786. BoundingBox = 3,
  16787. }
  16788. /**
  16789. * - Bounding box type.
  16790. * @version DragonBones 5.0
  16791. * @language en_US
  16792. */
  16793. /**
  16794. * - 边界框类型。
  16795. * @version DragonBones 5.0
  16796. * @language zh_CN
  16797. */
  16798. const enum BoundingBoxType {
  16799. Rectangle = 0,
  16800. Ellipse = 1,
  16801. Polygon = 2,
  16802. }
  16803. /**
  16804. * @internal
  16805. * @private
  16806. */
  16807. const enum ActionType {
  16808. Play = 0,
  16809. Frame = 10,
  16810. Sound = 11,
  16811. }
  16812. /**
  16813. * @internal
  16814. * @private
  16815. */
  16816. const enum BlendMode {
  16817. Normal = 0,
  16818. Add = 1,
  16819. Alpha = 2,
  16820. Darken = 3,
  16821. Difference = 4,
  16822. Erase = 5,
  16823. HardLight = 6,
  16824. Invert = 7,
  16825. Layer = 8,
  16826. Lighten = 9,
  16827. Multiply = 10,
  16828. Overlay = 11,
  16829. Screen = 12,
  16830. Subtract = 13,
  16831. }
  16832. /**
  16833. * @internal
  16834. * @private
  16835. */
  16836. const enum TweenType {
  16837. None = 0,
  16838. Line = 1,
  16839. Curve = 2,
  16840. QuadIn = 3,
  16841. QuadOut = 4,
  16842. QuadInOut = 5,
  16843. }
  16844. /**
  16845. * @internal
  16846. * @private
  16847. */
  16848. const enum TimelineType {
  16849. Action = 0,
  16850. ZOrder = 1,
  16851. BoneAll = 10,
  16852. BoneTranslate = 11,
  16853. BoneRotate = 12,
  16854. BoneScale = 13,
  16855. Surface = 50,
  16856. SlotDisplay = 20,
  16857. SlotColor = 21,
  16858. SlotFFD = 22,
  16859. IKConstraint = 30,
  16860. AnimationTime = 40,
  16861. AnimationWeight = 41,
  16862. }
  16863. /**
  16864. * - Offset mode.
  16865. * @version DragonBones 5.5
  16866. * @language en_US
  16867. */
  16868. /**
  16869. * - 偏移模式。
  16870. * @version DragonBones 5.5
  16871. * @language zh_CN
  16872. */
  16873. const enum OffsetMode {
  16874. None = 0,
  16875. Additive = 1,
  16876. Override = 2,
  16877. }
  16878. /**
  16879. * - Animation fade out mode.
  16880. * @version DragonBones 4.5
  16881. * @language en_US
  16882. */
  16883. /**
  16884. * - 动画淡出模式。
  16885. * @version DragonBones 4.5
  16886. * @language zh_CN
  16887. */
  16888. const enum AnimationFadeOutMode {
  16889. /**
  16890. * - Do not fade out of any animation states.
  16891. * @language en_US
  16892. */
  16893. /**
  16894. * - 不淡出任何的动画状态。
  16895. * @language zh_CN
  16896. */
  16897. None = 0,
  16898. /**
  16899. * - Fade out the animation states of the same layer.
  16900. * @language en_US
  16901. */
  16902. /**
  16903. * - 淡出同层的动画状态。
  16904. * @language zh_CN
  16905. */
  16906. SameLayer = 1,
  16907. /**
  16908. * - Fade out the animation states of the same group.
  16909. * @language en_US
  16910. */
  16911. /**
  16912. * - 淡出同组的动画状态。
  16913. * @language zh_CN
  16914. */
  16915. SameGroup = 2,
  16916. /**
  16917. * - Fade out the animation states of the same layer and group.
  16918. * @language en_US
  16919. */
  16920. /**
  16921. * - 淡出同层并且同组的动画状态。
  16922. * @language zh_CN
  16923. */
  16924. SameLayerAndGroup = 3,
  16925. /**
  16926. * - Fade out of all animation states.
  16927. * @language en_US
  16928. */
  16929. /**
  16930. * - 淡出所有的动画状态。
  16931. * @language zh_CN
  16932. */
  16933. All = 4,
  16934. /**
  16935. * - Does not replace the animation state with the same name.
  16936. * @language en_US
  16937. */
  16938. /**
  16939. * - 不替换同名的动画状态。
  16940. * @language zh_CN
  16941. */
  16942. Single = 5,
  16943. }
  16944. /**
  16945. * @private
  16946. */
  16947. interface Map<T> {
  16948. [key: string]: T;
  16949. }
  16950. /**
  16951. * @private
  16952. */
  16953. class DragonBones {
  16954. static readonly VERSION: string;
  16955. static yDown: boolean;
  16956. static debug: boolean;
  16957. static debugDraw: boolean;
  16958. static webAssembly: boolean;
  16959. private readonly _clock;
  16960. private readonly _events;
  16961. private readonly _objects;
  16962. private _eventManager;
  16963. constructor(eventManager: IEventDispatcher);
  16964. advanceTime(passedTime: number): void;
  16965. bufferEvent(value: EventObject): void;
  16966. bufferObject(object: BaseObject): void;
  16967. readonly clock: WorldClock;
  16968. readonly eventManager: IEventDispatcher;
  16969. }
  16970. }
  16971. /**
  16972. * The MIT License (MIT)
  16973. *
  16974. * Copyright (c) 2012-2017 DragonBones team and other contributors
  16975. *
  16976. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  16977. * this software and associated documentation files (the "Software"), to deal in
  16978. * the Software without restriction, including without limitation the rights to
  16979. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  16980. * the Software, and to permit persons to whom the Software is furnished to do so,
  16981. * subject to the following conditions:
  16982. *
  16983. * The above copyright notice and this permission notice shall be included in all
  16984. * copies or substantial portions of the Software.
  16985. *
  16986. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16987. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16988. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16989. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16990. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16991. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16992. */
  16993. declare namespace dragonBones {
  16994. /**
  16995. * - The BaseObject is the base class for all objects in the DragonBones framework.
  16996. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  16997. * @version DragonBones 4.5
  16998. * @language en_US
  16999. */
  17000. /**
  17001. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  17002. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  17003. * @version DragonBones 4.5
  17004. * @language zh_CN
  17005. */
  17006. abstract class BaseObject {
  17007. private static _hashCode;
  17008. private static _defaultMaxCount;
  17009. private static readonly _maxCountMap;
  17010. private static readonly _poolsMap;
  17011. private static _returnObject(object);
  17012. static toString(): string;
  17013. /**
  17014. * - Set the maximum cache count of the specify object pool.
  17015. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  17016. * @param maxCount - Max count.
  17017. * @version DragonBones 4.5
  17018. * @language en_US
  17019. */
  17020. /**
  17021. * - 设置特定对象池的最大缓存数量。
  17022. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  17023. * @param maxCount - 最大缓存数量。
  17024. * @version DragonBones 4.5
  17025. * @language zh_CN
  17026. */
  17027. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  17028. /**
  17029. * - Clear the cached instances of a specify object pool.
  17030. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  17031. * @version DragonBones 4.5
  17032. * @language en_US
  17033. */
  17034. /**
  17035. * - 清除特定对象池的缓存实例。
  17036. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  17037. * @version DragonBones 4.5
  17038. * @language zh_CN
  17039. */
  17040. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  17041. /**
  17042. * - Get an instance of the specify class from object pool.
  17043. * @param objectConstructor - The specify class.
  17044. * @version DragonBones 4.5
  17045. * @language en_US
  17046. */
  17047. /**
  17048. * - 从对象池中获取特定类的实例。
  17049. * @param objectConstructor - 特定的类。
  17050. * @version DragonBones 4.5
  17051. * @language zh_CN
  17052. */
  17053. static borrowObject<T extends BaseObject>(objectConstructor: {
  17054. new (): T;
  17055. }): T;
  17056. /**
  17057. * - A unique identification number assigned to the object.
  17058. * @version DragonBones 4.5
  17059. * @language en_US
  17060. */
  17061. /**
  17062. * - 分配给此实例的唯一标识号。
  17063. * @version DragonBones 4.5
  17064. * @language zh_CN
  17065. */
  17066. readonly hashCode: number;
  17067. private _isInPool;
  17068. /**
  17069. * @private
  17070. */
  17071. protected abstract _onClear(): void;
  17072. /**
  17073. * - Clear the object and return it back to object pool。
  17074. * @version DragonBones 4.5
  17075. * @language en_US
  17076. */
  17077. /**
  17078. * - 清除该实例的所有数据并将其返还对象池。
  17079. * @version DragonBones 4.5
  17080. * @language zh_CN
  17081. */
  17082. returnToPool(): void;
  17083. }
  17084. }
  17085. /**
  17086. * The MIT License (MIT)
  17087. *
  17088. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17089. *
  17090. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17091. * this software and associated documentation files (the "Software"), to deal in
  17092. * the Software without restriction, including without limitation the rights to
  17093. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17094. * the Software, and to permit persons to whom the Software is furnished to do so,
  17095. * subject to the following conditions:
  17096. *
  17097. * The above copyright notice and this permission notice shall be included in all
  17098. * copies or substantial portions of the Software.
  17099. *
  17100. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17101. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17102. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17103. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17104. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17105. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17106. */
  17107. declare namespace dragonBones {
  17108. /**
  17109. * - 2D Transform matrix.
  17110. * @version DragonBones 3.0
  17111. * @language en_US
  17112. */
  17113. /**
  17114. * - 2D 转换矩阵。
  17115. * @version DragonBones 3.0
  17116. * @language zh_CN
  17117. */
  17118. class Matrix {
  17119. /**
  17120. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  17121. * @default 1.0
  17122. * @version DragonBones 3.0
  17123. * @language en_US
  17124. */
  17125. /**
  17126. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  17127. * @default 1.0
  17128. * @version DragonBones 3.0
  17129. * @language zh_CN
  17130. */
  17131. a: number;
  17132. /**
  17133. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  17134. * @default 0.0
  17135. * @version DragonBones 3.0
  17136. * @language en_US
  17137. */
  17138. /**
  17139. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  17140. * @default 0.0
  17141. * @version DragonBones 3.0
  17142. * @language zh_CN
  17143. */
  17144. b: number;
  17145. /**
  17146. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  17147. * @default 0.0
  17148. * @version DragonBones 3.0
  17149. * @language en_US
  17150. */
  17151. /**
  17152. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  17153. * @default 0.0
  17154. * @version DragonBones 3.0
  17155. * @language zh_CN
  17156. */
  17157. c: number;
  17158. /**
  17159. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  17160. * @default 1.0
  17161. * @version DragonBones 3.0
  17162. * @language en_US
  17163. */
  17164. /**
  17165. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  17166. * @default 1.0
  17167. * @version DragonBones 3.0
  17168. * @language zh_CN
  17169. */
  17170. d: number;
  17171. /**
  17172. * - The distance by which to translate each point along the x axis.
  17173. * @default 0.0
  17174. * @version DragonBones 3.0
  17175. * @language en_US
  17176. */
  17177. /**
  17178. * - 沿 x 轴平移每个点的距离。
  17179. * @default 0.0
  17180. * @version DragonBones 3.0
  17181. * @language zh_CN
  17182. */
  17183. tx: number;
  17184. /**
  17185. * - The distance by which to translate each point along the y axis.
  17186. * @default 0.0
  17187. * @version DragonBones 3.0
  17188. * @language en_US
  17189. */
  17190. /**
  17191. * - 沿 y 轴平移每个点的距离。
  17192. * @default 0.0
  17193. * @version DragonBones 3.0
  17194. * @language zh_CN
  17195. */
  17196. ty: number;
  17197. /**
  17198. * @private
  17199. */
  17200. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  17201. toString(): string;
  17202. /**
  17203. * @private
  17204. */
  17205. copyFrom(value: Matrix): Matrix;
  17206. /**
  17207. * @private
  17208. */
  17209. copyFromArray(value: Array<number>, offset?: number): Matrix;
  17210. /**
  17211. * - Convert to unit matrix.
  17212. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  17213. * @version DragonBones 3.0
  17214. * @language en_US
  17215. */
  17216. /**
  17217. * - 转换为单位矩阵。
  17218. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  17219. * @version DragonBones 3.0
  17220. * @language zh_CN
  17221. */
  17222. identity(): Matrix;
  17223. /**
  17224. * - Multiplies the current matrix with another matrix.
  17225. * @param value - The matrix that needs to be multiplied.
  17226. * @version DragonBones 3.0
  17227. * @language en_US
  17228. */
  17229. /**
  17230. * - 将当前矩阵与另一个矩阵相乘。
  17231. * @param value - 需要相乘的矩阵。
  17232. * @version DragonBones 3.0
  17233. * @language zh_CN
  17234. */
  17235. concat(value: Matrix): Matrix;
  17236. /**
  17237. * - Convert to inverse matrix.
  17238. * @version DragonBones 3.0
  17239. * @language en_US
  17240. */
  17241. /**
  17242. * - 转换为逆矩阵。
  17243. * @version DragonBones 3.0
  17244. * @language zh_CN
  17245. */
  17246. invert(): Matrix;
  17247. /**
  17248. * - Apply a matrix transformation to a specific point.
  17249. * @param x - X coordinate.
  17250. * @param y - Y coordinate.
  17251. * @param result - The point after the transformation is applied.
  17252. * @param delta - Whether to ignore tx, ty's conversion to point.
  17253. * @version DragonBones 3.0
  17254. * @language en_US
  17255. */
  17256. /**
  17257. * - 将矩阵转换应用于特定点。
  17258. * @param x - 横坐标。
  17259. * @param y - 纵坐标。
  17260. * @param result - 应用转换之后的点。
  17261. * @param delta - 是否忽略 tx,ty 对点的转换。
  17262. * @version DragonBones 3.0
  17263. * @language zh_CN
  17264. */
  17265. transformPoint(x: number, y: number, result: {
  17266. x: number;
  17267. y: number;
  17268. }, delta?: boolean): void;
  17269. /**
  17270. * @private
  17271. */
  17272. transformRectangle(rectangle: {
  17273. x: number;
  17274. y: number;
  17275. width: number;
  17276. height: number;
  17277. }, delta?: boolean): void;
  17278. }
  17279. }
  17280. /**
  17281. * The MIT License (MIT)
  17282. *
  17283. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17284. *
  17285. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17286. * this software and associated documentation files (the "Software"), to deal in
  17287. * the Software without restriction, including without limitation the rights to
  17288. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17289. * the Software, and to permit persons to whom the Software is furnished to do so,
  17290. * subject to the following conditions:
  17291. *
  17292. * The above copyright notice and this permission notice shall be included in all
  17293. * copies or substantial portions of the Software.
  17294. *
  17295. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17296. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17297. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17298. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17299. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17300. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17301. */
  17302. declare namespace dragonBones {
  17303. /**
  17304. * - 2D Transform.
  17305. * @version DragonBones 3.0
  17306. * @language en_US
  17307. */
  17308. /**
  17309. * - 2D 变换。
  17310. * @version DragonBones 3.0
  17311. * @language zh_CN
  17312. */
  17313. class Transform {
  17314. /**
  17315. * @private
  17316. */
  17317. static readonly PI: number;
  17318. /**
  17319. * @private
  17320. */
  17321. static readonly PI_D: number;
  17322. /**
  17323. * @private
  17324. */
  17325. static readonly PI_H: number;
  17326. /**
  17327. * @private
  17328. */
  17329. static readonly PI_Q: number;
  17330. /**
  17331. * @private
  17332. */
  17333. static readonly RAD_DEG: number;
  17334. /**
  17335. * @private
  17336. */
  17337. static readonly DEG_RAD: number;
  17338. /**
  17339. * @private
  17340. */
  17341. static normalizeRadian(value: number): number;
  17342. /**
  17343. * - Horizontal translate.
  17344. * @version DragonBones 3.0
  17345. * @language en_US
  17346. */
  17347. /**
  17348. * - 水平位移。
  17349. * @version DragonBones 3.0
  17350. * @language zh_CN
  17351. */
  17352. x: number;
  17353. /**
  17354. * - Vertical translate.
  17355. * @version DragonBones 3.0
  17356. * @language en_US
  17357. */
  17358. /**
  17359. * - 垂直位移。
  17360. * @version DragonBones 3.0
  17361. * @language zh_CN
  17362. */
  17363. y: number;
  17364. /**
  17365. * - Skew. (In radians)
  17366. * @version DragonBones 3.0
  17367. * @language en_US
  17368. */
  17369. /**
  17370. * - 倾斜。 (以弧度为单位)
  17371. * @version DragonBones 3.0
  17372. * @language zh_CN
  17373. */
  17374. skew: number;
  17375. /**
  17376. * - rotation. (In radians)
  17377. * @version DragonBones 3.0
  17378. * @language en_US
  17379. */
  17380. /**
  17381. * - 旋转。 (以弧度为单位)
  17382. * @version DragonBones 3.0
  17383. * @language zh_CN
  17384. */
  17385. rotation: number;
  17386. /**
  17387. * - Horizontal Scaling.
  17388. * @version DragonBones 3.0
  17389. * @language en_US
  17390. */
  17391. /**
  17392. * - 水平缩放。
  17393. * @version DragonBones 3.0
  17394. * @language zh_CN
  17395. */
  17396. scaleX: number;
  17397. /**
  17398. * - Vertical scaling.
  17399. * @version DragonBones 3.0
  17400. * @language en_US
  17401. */
  17402. /**
  17403. * - 垂直缩放。
  17404. * @version DragonBones 3.0
  17405. * @language zh_CN
  17406. */
  17407. scaleY: number;
  17408. /**
  17409. * @private
  17410. */
  17411. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  17412. toString(): string;
  17413. /**
  17414. * @private
  17415. */
  17416. copyFrom(value: Transform): Transform;
  17417. /**
  17418. * @private
  17419. */
  17420. identity(): Transform;
  17421. /**
  17422. * @private
  17423. */
  17424. add(value: Transform): Transform;
  17425. /**
  17426. * @private
  17427. */
  17428. minus(value: Transform): Transform;
  17429. /**
  17430. * @private
  17431. */
  17432. fromMatrix(matrix: Matrix): Transform;
  17433. /**
  17434. * @private
  17435. */
  17436. toMatrix(matrix: Matrix): Transform;
  17437. }
  17438. }
  17439. /**
  17440. * The MIT License (MIT)
  17441. *
  17442. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17443. *
  17444. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17445. * this software and associated documentation files (the "Software"), to deal in
  17446. * the Software without restriction, including without limitation the rights to
  17447. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17448. * the Software, and to permit persons to whom the Software is furnished to do so,
  17449. * subject to the following conditions:
  17450. *
  17451. * The above copyright notice and this permission notice shall be included in all
  17452. * copies or substantial portions of the Software.
  17453. *
  17454. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17455. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17456. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17457. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17458. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17459. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17460. */
  17461. declare namespace dragonBones {
  17462. /**
  17463. * @internal
  17464. * @private
  17465. */
  17466. class ColorTransform {
  17467. alphaMultiplier: number;
  17468. redMultiplier: number;
  17469. greenMultiplier: number;
  17470. blueMultiplier: number;
  17471. alphaOffset: number;
  17472. redOffset: number;
  17473. greenOffset: number;
  17474. blueOffset: number;
  17475. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  17476. copyFrom(value: ColorTransform): void;
  17477. identity(): void;
  17478. }
  17479. }
  17480. /**
  17481. * The MIT License (MIT)
  17482. *
  17483. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17484. *
  17485. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17486. * this software and associated documentation files (the "Software"), to deal in
  17487. * the Software without restriction, including without limitation the rights to
  17488. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17489. * the Software, and to permit persons to whom the Software is furnished to do so,
  17490. * subject to the following conditions:
  17491. *
  17492. * The above copyright notice and this permission notice shall be included in all
  17493. * copies or substantial portions of the Software.
  17494. *
  17495. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17496. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17497. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17498. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17499. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17500. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17501. */
  17502. declare namespace dragonBones {
  17503. /**
  17504. * - The Point object represents a location in a two-dimensional coordinate system.
  17505. * @version DragonBones 3.0
  17506. * @language en_US
  17507. */
  17508. /**
  17509. * - Point 对象表示二维坐标系统中的某个位置。
  17510. * @version DragonBones 3.0
  17511. * @language zh_CN
  17512. */
  17513. class Point {
  17514. /**
  17515. * - The horizontal coordinate.
  17516. * @default 0.0
  17517. * @version DragonBones 3.0
  17518. * @language en_US
  17519. */
  17520. /**
  17521. * - 该点的水平坐标。
  17522. * @default 0.0
  17523. * @version DragonBones 3.0
  17524. * @language zh_CN
  17525. */
  17526. x: number;
  17527. /**
  17528. * - The vertical coordinate.
  17529. * @default 0.0
  17530. * @version DragonBones 3.0
  17531. * @language en_US
  17532. */
  17533. /**
  17534. * - 该点的垂直坐标。
  17535. * @default 0.0
  17536. * @version DragonBones 3.0
  17537. * @language zh_CN
  17538. */
  17539. y: number;
  17540. /**
  17541. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  17542. * @param x - The horizontal coordinate.
  17543. * @param y - The vertical coordinate.
  17544. * @version DragonBones 3.0
  17545. * @language en_US
  17546. */
  17547. /**
  17548. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  17549. * @param x - 该对象的x属性值,默认为 0.0。
  17550. * @param y - 该对象的y属性值,默认为 0.0。
  17551. * @version DragonBones 3.0
  17552. * @language zh_CN
  17553. */
  17554. constructor(x?: number, y?: number);
  17555. /**
  17556. * @private
  17557. */
  17558. copyFrom(value: Point): void;
  17559. /**
  17560. * @private
  17561. */
  17562. clear(): void;
  17563. }
  17564. }
  17565. /**
  17566. * The MIT License (MIT)
  17567. *
  17568. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17569. *
  17570. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17571. * this software and associated documentation files (the "Software"), to deal in
  17572. * the Software without restriction, including without limitation the rights to
  17573. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17574. * the Software, and to permit persons to whom the Software is furnished to do so,
  17575. * subject to the following conditions:
  17576. *
  17577. * The above copyright notice and this permission notice shall be included in all
  17578. * copies or substantial portions of the Software.
  17579. *
  17580. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17581. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17582. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17583. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17584. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17585. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17586. */
  17587. declare namespace dragonBones {
  17588. /**
  17589. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  17590. * width and its height.<br/>
  17591. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  17592. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  17593. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  17594. * if you change the bottom property, the value of the height property changes.
  17595. * @version DragonBones 3.0
  17596. * @language en_US
  17597. */
  17598. /**
  17599. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  17600. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  17601. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  17602. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  17603. * @version DragonBones 3.0
  17604. * @language zh_CN
  17605. */
  17606. class Rectangle {
  17607. /**
  17608. * - The x coordinate of the top-left corner of the rectangle.
  17609. * @default 0.0
  17610. * @version DragonBones 3.0
  17611. * @language en_US
  17612. */
  17613. /**
  17614. * - 矩形左上角的 x 坐标。
  17615. * @default 0.0
  17616. * @version DragonBones 3.0
  17617. * @language zh_CN
  17618. */
  17619. x: number;
  17620. /**
  17621. * - The y coordinate of the top-left corner of the rectangle.
  17622. * @default 0.0
  17623. * @version DragonBones 3.0
  17624. * @language en_US
  17625. */
  17626. /**
  17627. * - 矩形左上角的 y 坐标。
  17628. * @default 0.0
  17629. * @version DragonBones 3.0
  17630. * @language zh_CN
  17631. */
  17632. y: number;
  17633. /**
  17634. * - The width of the rectangle, in pixels.
  17635. * @default 0.0
  17636. * @version DragonBones 3.0
  17637. * @language en_US
  17638. */
  17639. /**
  17640. * - 矩形的宽度(以像素为单位)。
  17641. * @default 0.0
  17642. * @version DragonBones 3.0
  17643. * @language zh_CN
  17644. */
  17645. width: number;
  17646. /**
  17647. * - 矩形的高度(以像素为单位)。
  17648. * @default 0.0
  17649. * @version DragonBones 3.0
  17650. * @language en_US
  17651. */
  17652. /**
  17653. * - The height of the rectangle, in pixels.
  17654. * @default 0.0
  17655. * @version DragonBones 3.0
  17656. * @language zh_CN
  17657. */
  17658. height: number;
  17659. /**
  17660. * @private
  17661. */
  17662. constructor(x?: number, y?: number, width?: number, height?: number);
  17663. /**
  17664. * @private
  17665. */
  17666. copyFrom(value: Rectangle): void;
  17667. /**
  17668. * @private
  17669. */
  17670. clear(): void;
  17671. }
  17672. }
  17673. /**
  17674. * The MIT License (MIT)
  17675. *
  17676. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17677. *
  17678. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17679. * this software and associated documentation files (the "Software"), to deal in
  17680. * the Software without restriction, including without limitation the rights to
  17681. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17682. * the Software, and to permit persons to whom the Software is furnished to do so,
  17683. * subject to the following conditions:
  17684. *
  17685. * The above copyright notice and this permission notice shall be included in all
  17686. * copies or substantial portions of the Software.
  17687. *
  17688. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17689. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17690. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17691. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17692. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17693. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17694. */
  17695. declare namespace dragonBones {
  17696. /**
  17697. * - The user custom data.
  17698. * @version DragonBones 5.0
  17699. * @language en_US
  17700. */
  17701. /**
  17702. * - 用户自定义数据。
  17703. * @version DragonBones 5.0
  17704. * @language zh_CN
  17705. */
  17706. class UserData extends BaseObject {
  17707. static toString(): string;
  17708. /**
  17709. * - The custom int numbers.
  17710. * @version DragonBones 5.0
  17711. * @language en_US
  17712. */
  17713. /**
  17714. * - 自定义整数。
  17715. * @version DragonBones 5.0
  17716. * @language zh_CN
  17717. */
  17718. readonly ints: Array<number>;
  17719. /**
  17720. * - The custom float numbers.
  17721. * @version DragonBones 5.0
  17722. * @language en_US
  17723. */
  17724. /**
  17725. * - 自定义浮点数。
  17726. * @version DragonBones 5.0
  17727. * @language zh_CN
  17728. */
  17729. readonly floats: Array<number>;
  17730. /**
  17731. * - The custom strings.
  17732. * @version DragonBones 5.0
  17733. * @language en_US
  17734. */
  17735. /**
  17736. * - 自定义字符串。
  17737. * @version DragonBones 5.0
  17738. * @language zh_CN
  17739. */
  17740. readonly strings: Array<string>;
  17741. /**
  17742. * @inheritDoc
  17743. */
  17744. protected _onClear(): void;
  17745. /**
  17746. * @internal
  17747. * @private
  17748. */
  17749. addInt(value: number): void;
  17750. /**
  17751. * @internal
  17752. * @private
  17753. */
  17754. addFloat(value: number): void;
  17755. /**
  17756. * @internal
  17757. * @private
  17758. */
  17759. addString(value: string): void;
  17760. /**
  17761. * - Get the custom int number.
  17762. * @version DragonBones 5.0
  17763. * @language en_US
  17764. */
  17765. /**
  17766. * - 获取自定义整数。
  17767. * @version DragonBones 5.0
  17768. * @language zh_CN
  17769. */
  17770. getInt(index?: number): number;
  17771. /**
  17772. * - Get the custom float number.
  17773. * @version DragonBones 5.0
  17774. * @language en_US
  17775. */
  17776. /**
  17777. * - 获取自定义浮点数。
  17778. * @version DragonBones 5.0
  17779. * @language zh_CN
  17780. */
  17781. getFloat(index?: number): number;
  17782. /**
  17783. * - Get the custom string.
  17784. * @version DragonBones 5.0
  17785. * @language en_US
  17786. */
  17787. /**
  17788. * - 获取自定义字符串。
  17789. * @version DragonBones 5.0
  17790. * @language zh_CN
  17791. */
  17792. getString(index?: number): string;
  17793. }
  17794. /**
  17795. * @internal
  17796. * @private
  17797. */
  17798. class ActionData extends BaseObject {
  17799. static toString(): string;
  17800. type: ActionType;
  17801. name: string;
  17802. bone: BoneData | null;
  17803. slot: SlotData | null;
  17804. data: UserData | null;
  17805. protected _onClear(): void;
  17806. }
  17807. }
  17808. /**
  17809. * The MIT License (MIT)
  17810. *
  17811. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17812. *
  17813. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17814. * this software and associated documentation files (the "Software"), to deal in
  17815. * the Software without restriction, including without limitation the rights to
  17816. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17817. * the Software, and to permit persons to whom the Software is furnished to do so,
  17818. * subject to the following conditions:
  17819. *
  17820. * The above copyright notice and this permission notice shall be included in all
  17821. * copies or substantial portions of the Software.
  17822. *
  17823. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17824. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17825. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17826. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17827. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17828. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17829. */
  17830. declare namespace dragonBones {
  17831. /**
  17832. * - The DragonBones data.
  17833. * A DragonBones data contains multiple armature data.
  17834. * @see dragonBones.ArmatureData
  17835. * @version DragonBones 3.0
  17836. * @language en_US
  17837. */
  17838. /**
  17839. * - 龙骨数据。
  17840. * 一个龙骨数据包含多个骨架数据。
  17841. * @see dragonBones.ArmatureData
  17842. * @version DragonBones 3.0
  17843. * @language zh_CN
  17844. */
  17845. class DragonBonesData extends BaseObject {
  17846. static toString(): string;
  17847. /**
  17848. * @private
  17849. */
  17850. autoSearch: boolean;
  17851. /**
  17852. * - The animation frame rate.
  17853. * @version DragonBones 3.0
  17854. * @language en_US
  17855. */
  17856. /**
  17857. * - 动画帧频。
  17858. * @version DragonBones 3.0
  17859. * @language zh_CN
  17860. */
  17861. frameRate: number;
  17862. /**
  17863. * - The data version.
  17864. * @version DragonBones 3.0
  17865. * @language en_US
  17866. */
  17867. /**
  17868. * - 数据版本。
  17869. * @version DragonBones 3.0
  17870. * @language zh_CN
  17871. */
  17872. version: string;
  17873. /**
  17874. * - The DragonBones data name.
  17875. * The name is consistent with the DragonBones project name.
  17876. * @version DragonBones 3.0
  17877. * @language en_US
  17878. */
  17879. /**
  17880. * - 龙骨数据名称。
  17881. * 该名称与龙骨项目名保持一致。
  17882. * @version DragonBones 3.0
  17883. * @language zh_CN
  17884. */
  17885. name: string;
  17886. /**
  17887. * @private
  17888. */
  17889. stage: ArmatureData | null;
  17890. /**
  17891. * @internal
  17892. * @private
  17893. */
  17894. readonly frameIndices: Array<number>;
  17895. /**
  17896. * @internal
  17897. * @private
  17898. */
  17899. readonly cachedFrames: Array<number>;
  17900. /**
  17901. * - All armature data names.
  17902. * @version DragonBones 3.0
  17903. * @language en_US
  17904. */
  17905. /**
  17906. * - 所有的骨架数据名称。
  17907. * @version DragonBones 3.0
  17908. * @language zh_CN
  17909. */
  17910. readonly armatureNames: Array<string>;
  17911. /**
  17912. * @private
  17913. */
  17914. readonly armatures: Map<ArmatureData>;
  17915. /**
  17916. * @internal
  17917. * @private
  17918. */
  17919. binary: ArrayBuffer;
  17920. /**
  17921. * @internal
  17922. * @private
  17923. */
  17924. intArray: Int16Array;
  17925. /**
  17926. * @internal
  17927. * @private
  17928. */
  17929. floatArray: Float32Array;
  17930. /**
  17931. * @internal
  17932. * @private
  17933. */
  17934. frameIntArray: Int16Array;
  17935. /**
  17936. * @internal
  17937. * @private
  17938. */
  17939. frameFloatArray: Float32Array;
  17940. /**
  17941. * @internal
  17942. * @private
  17943. */
  17944. frameArray: Int16Array;
  17945. /**
  17946. * @internal
  17947. * @private
  17948. */
  17949. timelineArray: Uint16Array;
  17950. /**
  17951. * @private
  17952. */
  17953. userData: UserData | null;
  17954. /**
  17955. * @inheritDoc
  17956. */
  17957. protected _onClear(): void;
  17958. /**
  17959. * @internal
  17960. * @private
  17961. */
  17962. addArmature(value: ArmatureData): void;
  17963. /**
  17964. * - Get a specific armature data.
  17965. * @param name - The armature data name.
  17966. * @version DragonBones 3.0
  17967. * @language en_US
  17968. */
  17969. /**
  17970. * - 获取特定的骨架数据。
  17971. * @param name - 骨架数据名称。
  17972. * @version DragonBones 3.0
  17973. * @language zh_CN
  17974. */
  17975. getArmature(name: string): ArmatureData | null;
  17976. /**
  17977. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  17978. * @deprecated
  17979. * @language en_US
  17980. */
  17981. /**
  17982. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  17983. * @deprecated
  17984. * @language zh_CN
  17985. */
  17986. dispose(): void;
  17987. }
  17988. }
  17989. /**
  17990. * The MIT License (MIT)
  17991. *
  17992. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17993. *
  17994. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17995. * this software and associated documentation files (the "Software"), to deal in
  17996. * the Software without restriction, including without limitation the rights to
  17997. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17998. * the Software, and to permit persons to whom the Software is furnished to do so,
  17999. * subject to the following conditions:
  18000. *
  18001. * The above copyright notice and this permission notice shall be included in all
  18002. * copies or substantial portions of the Software.
  18003. *
  18004. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18005. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18006. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18007. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18008. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18009. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18010. */
  18011. declare namespace dragonBones {
  18012. /**
  18013. * - The armature data.
  18014. * @version DragonBones 3.0
  18015. * @language en_US
  18016. */
  18017. /**
  18018. * - 骨架数据。
  18019. * @version DragonBones 3.0
  18020. * @language zh_CN
  18021. */
  18022. class ArmatureData extends BaseObject {
  18023. static toString(): string;
  18024. /**
  18025. * @private
  18026. */
  18027. type: ArmatureType;
  18028. /**
  18029. * - The animation frame rate.
  18030. * @version DragonBones 3.0
  18031. * @language en_US
  18032. */
  18033. /**
  18034. * - 动画帧率。
  18035. * @version DragonBones 3.0
  18036. * @language zh_CN
  18037. */
  18038. frameRate: number;
  18039. /**
  18040. * @private
  18041. */
  18042. cacheFrameRate: number;
  18043. /**
  18044. * @private
  18045. */
  18046. scale: number;
  18047. /**
  18048. * - The armature name.
  18049. * @version DragonBones 3.0
  18050. * @language en_US
  18051. */
  18052. /**
  18053. * - 骨架名称。
  18054. * @version DragonBones 3.0
  18055. * @language zh_CN
  18056. */
  18057. name: string;
  18058. /**
  18059. * @private
  18060. */
  18061. readonly aabb: Rectangle;
  18062. /**
  18063. * - The names of all the animation data.
  18064. * @version DragonBones 3.0
  18065. * @language en_US
  18066. */
  18067. /**
  18068. * - 所有的动画数据名称。
  18069. * @version DragonBones 3.0
  18070. * @language zh_CN
  18071. */
  18072. readonly animationNames: Array<string>;
  18073. /**
  18074. * @private
  18075. */
  18076. readonly sortedBones: Array<BoneData>;
  18077. /**
  18078. * @private
  18079. */
  18080. readonly sortedSlots: Array<SlotData>;
  18081. /**
  18082. * @private
  18083. */
  18084. readonly defaultActions: Array<ActionData>;
  18085. /**
  18086. * @private
  18087. */
  18088. readonly actions: Array<ActionData>;
  18089. /**
  18090. * @private
  18091. */
  18092. readonly bones: Map<BoneData>;
  18093. /**
  18094. * @private
  18095. */
  18096. readonly slots: Map<SlotData>;
  18097. /**
  18098. * @private
  18099. */
  18100. readonly constraints: Map<ConstraintData>;
  18101. /**
  18102. * @private
  18103. */
  18104. readonly skins: Map<SkinData>;
  18105. /**
  18106. * @private
  18107. */
  18108. readonly animations: Map<AnimationData>;
  18109. /**
  18110. * - The default skin data.
  18111. * @version DragonBones 4.5
  18112. * @language en_US
  18113. */
  18114. /**
  18115. * - 默认插槽数据。
  18116. * @version DragonBones 4.5
  18117. * @language zh_CN
  18118. */
  18119. defaultSkin: SkinData | null;
  18120. /**
  18121. * - The default animation data.
  18122. * @version DragonBones 4.5
  18123. * @language en_US
  18124. */
  18125. /**
  18126. * - 默认动画数据。
  18127. * @version DragonBones 4.5
  18128. * @language zh_CN
  18129. */
  18130. defaultAnimation: AnimationData | null;
  18131. /**
  18132. * @private
  18133. */
  18134. canvas: CanvasData | null;
  18135. /**
  18136. * @private
  18137. */
  18138. userData: UserData | null;
  18139. /**
  18140. * @private
  18141. */
  18142. parent: DragonBonesData;
  18143. /**
  18144. * @inheritDoc
  18145. */
  18146. protected _onClear(): void;
  18147. /**
  18148. * @internal
  18149. * @private
  18150. */
  18151. sortBones(): void;
  18152. /**
  18153. * @internal
  18154. * @private
  18155. */
  18156. cacheFrames(frameRate: number): void;
  18157. /**
  18158. * @internal
  18159. * @private
  18160. */
  18161. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  18162. /**
  18163. * @internal
  18164. * @private
  18165. */
  18166. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  18167. /**
  18168. * @internal
  18169. * @private
  18170. */
  18171. addBone(value: BoneData): void;
  18172. /**
  18173. * @internal
  18174. * @private
  18175. */
  18176. addSlot(value: SlotData): void;
  18177. /**
  18178. * @internal
  18179. * @private
  18180. */
  18181. addConstraint(value: ConstraintData): void;
  18182. /**
  18183. * @internal
  18184. * @private
  18185. */
  18186. addSkin(value: SkinData): void;
  18187. /**
  18188. * @internal
  18189. * @private
  18190. */
  18191. addAnimation(value: AnimationData): void;
  18192. /**
  18193. * @internal
  18194. * @private
  18195. */
  18196. addAction(value: ActionData, isDefault: boolean): void;
  18197. /**
  18198. * - Get a specific done data.
  18199. * @param name - The bone name.
  18200. * @version DragonBones 3.0
  18201. * @language en_US
  18202. */
  18203. /**
  18204. * - 获取特定的骨骼数据。
  18205. * @param name - 骨骼名称。
  18206. * @version DragonBones 3.0
  18207. * @language zh_CN
  18208. */
  18209. getBone(name: string): BoneData | null;
  18210. /**
  18211. * - Get a specific slot data.
  18212. * @param name - The slot name.
  18213. * @version DragonBones 3.0
  18214. * @language en_US
  18215. */
  18216. /**
  18217. * - 获取特定的插槽数据。
  18218. * @param name - 插槽名称。
  18219. * @version DragonBones 3.0
  18220. * @language zh_CN
  18221. */
  18222. getSlot(name: string): SlotData | null;
  18223. /**
  18224. * @private
  18225. */
  18226. getConstraint(name: string): ConstraintData | null;
  18227. /**
  18228. * - Get a specific skin data.
  18229. * @param name - The skin name.
  18230. * @version DragonBones 3.0
  18231. * @language en_US
  18232. */
  18233. /**
  18234. * - 获取特定皮肤数据。
  18235. * @param name - 皮肤名称。
  18236. * @version DragonBones 3.0
  18237. * @language zh_CN
  18238. */
  18239. getSkin(name: string): SkinData | null;
  18240. /**
  18241. * @internal
  18242. * @private
  18243. */
  18244. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  18245. /**
  18246. * - Get a specific animation data.
  18247. * @param name - The animation name.
  18248. * @version DragonBones 3.0
  18249. * @language en_US
  18250. */
  18251. /**
  18252. * - 获取特定的动画数据。
  18253. * @param name - 动画名称。
  18254. * @version DragonBones 3.0
  18255. * @language zh_CN
  18256. */
  18257. getAnimation(name: string): AnimationData | null;
  18258. }
  18259. /**
  18260. * - The bone data.
  18261. * @version DragonBones 3.0
  18262. * @language en_US
  18263. */
  18264. /**
  18265. * - 骨骼数据。
  18266. * @version DragonBones 3.0
  18267. * @language zh_CN
  18268. */
  18269. class BoneData extends BaseObject {
  18270. static toString(): string;
  18271. /**
  18272. * @private
  18273. */
  18274. inheritTranslation: boolean;
  18275. /**
  18276. * @private
  18277. */
  18278. inheritRotation: boolean;
  18279. /**
  18280. * @private
  18281. */
  18282. inheritScale: boolean;
  18283. /**
  18284. * @private
  18285. */
  18286. inheritReflection: boolean;
  18287. /**
  18288. * @private
  18289. */
  18290. type: BoneType;
  18291. /**
  18292. * - The bone length.
  18293. * @version DragonBones 3.0
  18294. * @language en_US
  18295. */
  18296. /**
  18297. * - 骨骼长度。
  18298. * @version DragonBones 3.0
  18299. * @language zh_CN
  18300. */
  18301. length: number;
  18302. /**
  18303. * - The bone name.
  18304. * @version DragonBones 3.0
  18305. * @language en_US
  18306. */
  18307. /**
  18308. * - 骨骼名称。
  18309. * @version DragonBones 3.0
  18310. * @language zh_CN
  18311. */
  18312. name: string;
  18313. /**
  18314. * @private
  18315. */
  18316. readonly transform: Transform;
  18317. /**
  18318. * @private
  18319. */
  18320. userData: UserData | null;
  18321. /**
  18322. * - The parent bone data.
  18323. * @version DragonBones 3.0
  18324. * @language en_US
  18325. */
  18326. /**
  18327. * - 父骨骼数据。
  18328. * @version DragonBones 3.0
  18329. * @language zh_CN
  18330. */
  18331. parent: BoneData | null;
  18332. /**
  18333. * @inheritDoc
  18334. */
  18335. protected _onClear(): void;
  18336. }
  18337. /**
  18338. * @internal
  18339. * @private
  18340. */
  18341. class SurfaceData extends BoneData {
  18342. static toString(): string;
  18343. segmentX: number;
  18344. segmentY: number;
  18345. readonly vertices: Array<number>;
  18346. /**
  18347. * @inheritDoc
  18348. */
  18349. protected _onClear(): void;
  18350. }
  18351. /**
  18352. * - The slot data.
  18353. * @version DragonBones 3.0
  18354. * @language en_US
  18355. */
  18356. /**
  18357. * - 插槽数据。
  18358. * @version DragonBones 3.0
  18359. * @language zh_CN
  18360. */
  18361. class SlotData extends BaseObject {
  18362. /**
  18363. * @internal
  18364. * @private
  18365. */
  18366. static readonly DEFAULT_COLOR: ColorTransform;
  18367. /**
  18368. * @internal
  18369. * @private
  18370. */
  18371. static createColor(): ColorTransform;
  18372. static toString(): string;
  18373. /**
  18374. * @private
  18375. */
  18376. blendMode: BlendMode;
  18377. /**
  18378. * @private
  18379. */
  18380. displayIndex: number;
  18381. /**
  18382. * @private
  18383. */
  18384. zOrder: number;
  18385. /**
  18386. * - The slot name.
  18387. * @version DragonBones 3.0
  18388. * @language en_US
  18389. */
  18390. /**
  18391. * - 插槽名称。
  18392. * @version DragonBones 3.0
  18393. * @language zh_CN
  18394. */
  18395. name: string;
  18396. /**
  18397. * @private
  18398. */
  18399. color: ColorTransform;
  18400. /**
  18401. * @private
  18402. */
  18403. userData: UserData | null;
  18404. /**
  18405. * - The parent bone data.
  18406. * @version DragonBones 3.0
  18407. * @language en_US
  18408. */
  18409. /**
  18410. * - 父骨骼数据。
  18411. * @version DragonBones 3.0
  18412. * @language zh_CN
  18413. */
  18414. parent: BoneData;
  18415. /**
  18416. * @inheritDoc
  18417. */
  18418. protected _onClear(): void;
  18419. }
  18420. }
  18421. /**
  18422. * The MIT License (MIT)
  18423. *
  18424. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18425. *
  18426. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18427. * this software and associated documentation files (the "Software"), to deal in
  18428. * the Software without restriction, including without limitation the rights to
  18429. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18430. * the Software, and to permit persons to whom the Software is furnished to do so,
  18431. * subject to the following conditions:
  18432. *
  18433. * The above copyright notice and this permission notice shall be included in all
  18434. * copies or substantial portions of the Software.
  18435. *
  18436. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18437. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18438. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18439. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18440. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18441. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18442. */
  18443. declare namespace dragonBones {
  18444. /**
  18445. * @internal
  18446. * @private
  18447. */
  18448. abstract class ConstraintData extends BaseObject {
  18449. order: number;
  18450. name: string;
  18451. target: BoneData;
  18452. root: BoneData;
  18453. bone: BoneData | null;
  18454. protected _onClear(): void;
  18455. }
  18456. /**
  18457. * @internal
  18458. * @private
  18459. */
  18460. class IKConstraintData extends ConstraintData {
  18461. static toString(): string;
  18462. scaleEnabled: boolean;
  18463. bendPositive: boolean;
  18464. weight: number;
  18465. protected _onClear(): void;
  18466. }
  18467. }
  18468. /**
  18469. * The MIT License (MIT)
  18470. *
  18471. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18472. *
  18473. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18474. * this software and associated documentation files (the "Software"), to deal in
  18475. * the Software without restriction, including without limitation the rights to
  18476. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18477. * the Software, and to permit persons to whom the Software is furnished to do so,
  18478. * subject to the following conditions:
  18479. *
  18480. * The above copyright notice and this permission notice shall be included in all
  18481. * copies or substantial portions of the Software.
  18482. *
  18483. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18484. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18485. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18486. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18487. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18488. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18489. */
  18490. declare namespace dragonBones {
  18491. /**
  18492. * @internal
  18493. * @private
  18494. */
  18495. class CanvasData extends BaseObject {
  18496. static toString(): string;
  18497. hasBackground: boolean;
  18498. color: number;
  18499. x: number;
  18500. y: number;
  18501. width: number;
  18502. height: number;
  18503. protected _onClear(): void;
  18504. }
  18505. }
  18506. /**
  18507. * The MIT License (MIT)
  18508. *
  18509. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18510. *
  18511. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18512. * this software and associated documentation files (the "Software"), to deal in
  18513. * the Software without restriction, including without limitation the rights to
  18514. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18515. * the Software, and to permit persons to whom the Software is furnished to do so,
  18516. * subject to the following conditions:
  18517. *
  18518. * The above copyright notice and this permission notice shall be included in all
  18519. * copies or substantial portions of the Software.
  18520. *
  18521. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18522. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18523. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18524. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18525. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18526. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18527. */
  18528. declare namespace dragonBones {
  18529. /**
  18530. * - The skin data, typically a armature data instance contains at least one skinData.
  18531. * @version DragonBones 3.0
  18532. * @language en_US
  18533. */
  18534. /**
  18535. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  18536. * @version DragonBones 3.0
  18537. * @language zh_CN
  18538. */
  18539. class SkinData extends BaseObject {
  18540. static toString(): string;
  18541. /**
  18542. * - The skin name.
  18543. * @version DragonBones 3.0
  18544. * @language en_US
  18545. */
  18546. /**
  18547. * - 皮肤名称。
  18548. * @version DragonBones 3.0
  18549. * @language zh_CN
  18550. */
  18551. name: string;
  18552. /**
  18553. * @private
  18554. */
  18555. readonly displays: Map<Array<DisplayData | null>>;
  18556. /**
  18557. * @private
  18558. */
  18559. parent: ArmatureData;
  18560. /**
  18561. * @inheritDoc
  18562. */
  18563. protected _onClear(): void;
  18564. /**
  18565. * @internal
  18566. * @private
  18567. */
  18568. addDisplay(slotName: string, value: DisplayData | null): void;
  18569. /**
  18570. * @private
  18571. */
  18572. getDisplay(slotName: string, displayName: string): DisplayData | null;
  18573. /**
  18574. * @private
  18575. */
  18576. getDisplays(slotName: string): Array<DisplayData | null> | null;
  18577. }
  18578. }
  18579. /**
  18580. * The MIT License (MIT)
  18581. *
  18582. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18583. *
  18584. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18585. * this software and associated documentation files (the "Software"), to deal in
  18586. * the Software without restriction, including without limitation the rights to
  18587. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18588. * the Software, and to permit persons to whom the Software is furnished to do so,
  18589. * subject to the following conditions:
  18590. *
  18591. * The above copyright notice and this permission notice shall be included in all
  18592. * copies or substantial portions of the Software.
  18593. *
  18594. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18595. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18596. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18597. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18598. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18599. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18600. */
  18601. declare namespace dragonBones {
  18602. /**
  18603. * @internal
  18604. * @private
  18605. */
  18606. abstract class DisplayData extends BaseObject {
  18607. type: DisplayType;
  18608. name: string;
  18609. path: string;
  18610. parent: SkinData;
  18611. readonly transform: Transform;
  18612. protected _onClear(): void;
  18613. }
  18614. /**
  18615. * @internal
  18616. * @private
  18617. */
  18618. class ImageDisplayData extends DisplayData {
  18619. static toString(): string;
  18620. readonly pivot: Point;
  18621. texture: TextureData | null;
  18622. protected _onClear(): void;
  18623. }
  18624. /**
  18625. * @internal
  18626. * @private
  18627. */
  18628. class ArmatureDisplayData extends DisplayData {
  18629. static toString(): string;
  18630. inheritAnimation: boolean;
  18631. readonly actions: Array<ActionData>;
  18632. armature: ArmatureData | null;
  18633. protected _onClear(): void;
  18634. /**
  18635. * @private
  18636. */
  18637. addAction(value: ActionData): void;
  18638. }
  18639. /**
  18640. * @internal
  18641. * @private
  18642. */
  18643. class MeshDisplayData extends DisplayData {
  18644. static toString(): string;
  18645. inheritDeform: boolean;
  18646. offset: number;
  18647. weight: WeightData | null;
  18648. glue: GlueData | null;
  18649. texture: TextureData | null;
  18650. protected _onClear(): void;
  18651. }
  18652. /**
  18653. * @internal
  18654. * @private
  18655. */
  18656. class BoundingBoxDisplayData extends DisplayData {
  18657. static toString(): string;
  18658. boundingBox: BoundingBoxData | null;
  18659. protected _onClear(): void;
  18660. }
  18661. /**
  18662. * @internal
  18663. * @private
  18664. */
  18665. class WeightData extends BaseObject {
  18666. static toString(): string;
  18667. count: number;
  18668. offset: number;
  18669. readonly bones: Array<BoneData>;
  18670. protected _onClear(): void;
  18671. addBone(value: BoneData): void;
  18672. }
  18673. /**
  18674. * @internal
  18675. * @private
  18676. */
  18677. class GlueData extends BaseObject {
  18678. static toString(): string;
  18679. readonly weights: Array<number>;
  18680. readonly meshes: Array<MeshDisplayData | null>;
  18681. protected _onClear(): void;
  18682. addMesh(value: MeshDisplayData | null): void;
  18683. }
  18684. }
  18685. /**
  18686. * The MIT License (MIT)
  18687. *
  18688. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18689. *
  18690. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18691. * this software and associated documentation files (the "Software"), to deal in
  18692. * the Software without restriction, including without limitation the rights to
  18693. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18694. * the Software, and to permit persons to whom the Software is furnished to do so,
  18695. * subject to the following conditions:
  18696. *
  18697. * The above copyright notice and this permission notice shall be included in all
  18698. * copies or substantial portions of the Software.
  18699. *
  18700. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18701. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18702. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18703. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18704. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18705. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18706. */
  18707. declare namespace dragonBones {
  18708. /**
  18709. * - The base class of bounding box data.
  18710. * @see dragonBones.RectangleData
  18711. * @see dragonBones.EllipseData
  18712. * @see dragonBones.PolygonData
  18713. * @version DragonBones 5.0
  18714. * @language en_US
  18715. */
  18716. /**
  18717. * - 边界框数据基类。
  18718. * @see dragonBones.RectangleData
  18719. * @see dragonBones.EllipseData
  18720. * @see dragonBones.PolygonData
  18721. * @version DragonBones 5.0
  18722. * @language zh_CN
  18723. */
  18724. abstract class BoundingBoxData extends BaseObject {
  18725. /**
  18726. * - The bounding box type.
  18727. * @version DragonBones 5.0
  18728. * @language en_US
  18729. */
  18730. /**
  18731. * - 边界框类型。
  18732. * @version DragonBones 5.0
  18733. * @language zh_CN
  18734. */
  18735. type: BoundingBoxType;
  18736. /**
  18737. * @private
  18738. */
  18739. color: number;
  18740. /**
  18741. * @private
  18742. */
  18743. width: number;
  18744. /**
  18745. * @private
  18746. */
  18747. height: number;
  18748. /**
  18749. * @private
  18750. */
  18751. protected _onClear(): void;
  18752. /**
  18753. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  18754. * @version DragonBones 5.0
  18755. * @language en_US
  18756. */
  18757. /**
  18758. * - 检查边界框是否包含特定点。(本地坐标系)
  18759. * @version DragonBones 5.0
  18760. * @language zh_CN
  18761. */
  18762. abstract containsPoint(pX: number, pY: number): boolean;
  18763. /**
  18764. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  18765. * @version DragonBones 5.0
  18766. * @language en_US
  18767. */
  18768. /**
  18769. * - 检查边界框是否与特定线段相交。(本地坐标系)
  18770. * @version DragonBones 5.0
  18771. * @language zh_CN
  18772. */
  18773. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  18774. x: number;
  18775. y: number;
  18776. } | null, intersectionPointB: {
  18777. x: number;
  18778. y: number;
  18779. } | null, normalRadians: {
  18780. x: number;
  18781. y: number;
  18782. } | null): number;
  18783. }
  18784. /**
  18785. * - The rectangle bounding box data.
  18786. * @version DragonBones 5.1
  18787. * @language en_US
  18788. */
  18789. /**
  18790. * - 矩形边界框数据。
  18791. * @version DragonBones 5.1
  18792. * @language zh_CN
  18793. */
  18794. class RectangleBoundingBoxData extends BoundingBoxData {
  18795. static toString(): string;
  18796. /**
  18797. * - Compute the bit code for a point (x, y) using the clip rectangle
  18798. */
  18799. private static _computeOutCode(x, y, xMin, yMin, xMax, yMax);
  18800. /**
  18801. * @private
  18802. */
  18803. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  18804. x: number;
  18805. y: number;
  18806. } | null, intersectionPointB?: {
  18807. x: number;
  18808. y: number;
  18809. } | null, normalRadians?: {
  18810. x: number;
  18811. y: number;
  18812. } | null): number;
  18813. /**
  18814. * @inheritDoc
  18815. * @private
  18816. */
  18817. protected _onClear(): void;
  18818. /**
  18819. * @inheritDoc
  18820. */
  18821. containsPoint(pX: number, pY: number): boolean;
  18822. /**
  18823. * @inheritDoc
  18824. */
  18825. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18826. x: number;
  18827. y: number;
  18828. } | null, intersectionPointB?: {
  18829. x: number;
  18830. y: number;
  18831. } | null, normalRadians?: {
  18832. x: number;
  18833. y: number;
  18834. } | null): number;
  18835. }
  18836. /**
  18837. * - The ellipse bounding box data.
  18838. * @version DragonBones 5.1
  18839. * @language en_US
  18840. */
  18841. /**
  18842. * - 椭圆边界框数据。
  18843. * @version DragonBones 5.1
  18844. * @language zh_CN
  18845. */
  18846. class EllipseBoundingBoxData extends BoundingBoxData {
  18847. static toString(): string;
  18848. /**
  18849. * @private
  18850. */
  18851. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  18852. x: number;
  18853. y: number;
  18854. } | null, intersectionPointB?: {
  18855. x: number;
  18856. y: number;
  18857. } | null, normalRadians?: {
  18858. x: number;
  18859. y: number;
  18860. } | null): number;
  18861. /**
  18862. * @inheritDoc
  18863. * @private
  18864. */
  18865. protected _onClear(): void;
  18866. /**
  18867. * @inheritDoc
  18868. */
  18869. containsPoint(pX: number, pY: number): boolean;
  18870. /**
  18871. * @inheritDoc
  18872. */
  18873. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18874. x: number;
  18875. y: number;
  18876. } | null, intersectionPointB?: {
  18877. x: number;
  18878. y: number;
  18879. } | null, normalRadians?: {
  18880. x: number;
  18881. y: number;
  18882. } | null): number;
  18883. }
  18884. /**
  18885. * - The polygon bounding box data.
  18886. * @version DragonBones 5.1
  18887. * @language en_US
  18888. */
  18889. /**
  18890. * - 多边形边界框数据。
  18891. * @version DragonBones 5.1
  18892. * @language zh_CN
  18893. */
  18894. class PolygonBoundingBoxData extends BoundingBoxData {
  18895. static toString(): string;
  18896. /**
  18897. * @private
  18898. */
  18899. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  18900. x: number;
  18901. y: number;
  18902. } | null, intersectionPointB?: {
  18903. x: number;
  18904. y: number;
  18905. } | null, normalRadians?: {
  18906. x: number;
  18907. y: number;
  18908. } | null): number;
  18909. /**
  18910. * @private
  18911. */
  18912. x: number;
  18913. /**
  18914. * @private
  18915. */
  18916. y: number;
  18917. /**
  18918. * - The polygon vertices.
  18919. * @version DragonBones 5.1
  18920. * @language en_US
  18921. */
  18922. /**
  18923. * - 多边形顶点。
  18924. * @version DragonBones 5.1
  18925. * @language zh_CN
  18926. */
  18927. readonly vertices: Array<number>;
  18928. /**
  18929. * @private
  18930. */
  18931. weight: WeightData | null;
  18932. /**
  18933. * @inheritDoc
  18934. * @private
  18935. */
  18936. protected _onClear(): void;
  18937. /**
  18938. * @inheritDoc
  18939. */
  18940. containsPoint(pX: number, pY: number): boolean;
  18941. /**
  18942. * @inheritDoc
  18943. */
  18944. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18945. x: number;
  18946. y: number;
  18947. } | null, intersectionPointB?: {
  18948. x: number;
  18949. y: number;
  18950. } | null, normalRadians?: {
  18951. x: number;
  18952. y: number;
  18953. } | null): number;
  18954. }
  18955. }
  18956. /**
  18957. * The MIT License (MIT)
  18958. *
  18959. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18960. *
  18961. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18962. * this software and associated documentation files (the "Software"), to deal in
  18963. * the Software without restriction, including without limitation the rights to
  18964. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18965. * the Software, and to permit persons to whom the Software is furnished to do so,
  18966. * subject to the following conditions:
  18967. *
  18968. * The above copyright notice and this permission notice shall be included in all
  18969. * copies or substantial portions of the Software.
  18970. *
  18971. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18972. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18973. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18974. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18975. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18976. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18977. */
  18978. declare namespace dragonBones {
  18979. /**
  18980. * - The animation data.
  18981. * @version DragonBones 3.0
  18982. * @language en_US
  18983. */
  18984. /**
  18985. * - 动画数据。
  18986. * @version DragonBones 3.0
  18987. * @language zh_CN
  18988. */
  18989. class AnimationData extends BaseObject {
  18990. static toString(): string;
  18991. /**
  18992. * - FrameIntArray.
  18993. * @internal
  18994. * @private
  18995. */
  18996. frameIntOffset: number;
  18997. /**
  18998. * - FrameFloatArray.
  18999. * @internal
  19000. * @private
  19001. */
  19002. frameFloatOffset: number;
  19003. /**
  19004. * - FrameArray.
  19005. * @internal
  19006. * @private
  19007. */
  19008. frameOffset: number;
  19009. /**
  19010. * - The frame count of the animation.
  19011. * @version DragonBones 3.0
  19012. * @language en_US
  19013. */
  19014. /**
  19015. * - 动画的帧数。
  19016. * @version DragonBones 3.0
  19017. * @language zh_CN
  19018. */
  19019. frameCount: number;
  19020. /**
  19021. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  19022. * @version DragonBones 3.0
  19023. * @language en_US
  19024. */
  19025. /**
  19026. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  19027. * @version DragonBones 3.0
  19028. * @language zh_CN
  19029. */
  19030. playTimes: number;
  19031. /**
  19032. * - The duration of the animation. (In seconds)
  19033. * @version DragonBones 3.0
  19034. * @language en_US
  19035. */
  19036. /**
  19037. * - 动画的持续时间。 (以秒为单位)
  19038. * @version DragonBones 3.0
  19039. * @language zh_CN
  19040. */
  19041. duration: number;
  19042. /**
  19043. * @private
  19044. */
  19045. scale: number;
  19046. /**
  19047. * - The fade in time of the animation. (In seconds)
  19048. * @version DragonBones 3.0
  19049. * @language en_US
  19050. */
  19051. /**
  19052. * - 动画的淡入时间。 (以秒为单位)
  19053. * @version DragonBones 3.0
  19054. * @language zh_CN
  19055. */
  19056. fadeInTime: number;
  19057. /**
  19058. * @private
  19059. */
  19060. cacheFrameRate: number;
  19061. /**
  19062. * - The animation name.
  19063. * @version DragonBones 3.0
  19064. * @language en_US
  19065. */
  19066. /**
  19067. * - 动画名称。
  19068. * @version DragonBones 3.0
  19069. * @language zh_CN
  19070. */
  19071. name: string;
  19072. /**
  19073. * @private
  19074. */
  19075. readonly cachedFrames: Array<boolean>;
  19076. /**
  19077. * @private
  19078. */
  19079. readonly boneTimelines: Map<Array<TimelineData>>;
  19080. /**
  19081. * @private
  19082. */
  19083. readonly surfaceTimelines: Map<Array<TimelineData>>;
  19084. /**
  19085. * @private
  19086. */
  19087. readonly slotTimelines: Map<Array<TimelineData>>;
  19088. /**
  19089. * @private
  19090. */
  19091. readonly constraintTimelines: Map<Array<TimelineData>>;
  19092. /**
  19093. * @private
  19094. */
  19095. readonly animationTimelines: Map<Array<TimelineData>>;
  19096. /**
  19097. * @private
  19098. */
  19099. readonly boneCachedFrameIndices: Map<Array<number>>;
  19100. /**
  19101. * @private
  19102. */
  19103. readonly slotCachedFrameIndices: Map<Array<number>>;
  19104. /**
  19105. * @private
  19106. */
  19107. actionTimeline: TimelineData | null;
  19108. /**
  19109. * @private
  19110. */
  19111. zOrderTimeline: TimelineData | null;
  19112. /**
  19113. * @private
  19114. */
  19115. parent: ArmatureData;
  19116. /**
  19117. * @inheritDoc
  19118. */
  19119. protected _onClear(): void;
  19120. /**
  19121. * @internal
  19122. * @private
  19123. */
  19124. cacheFrames(frameRate: number): void;
  19125. /**
  19126. * @private
  19127. */
  19128. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  19129. /**
  19130. * @private
  19131. */
  19132. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  19133. /**
  19134. * @private
  19135. */
  19136. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  19137. /**
  19138. * @private
  19139. */
  19140. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  19141. /**
  19142. * @private
  19143. */
  19144. addAnimationTimeline(name: string, timeline: TimelineData): void;
  19145. /**
  19146. * @private
  19147. */
  19148. getBoneTimelines(name: string): Array<TimelineData> | null;
  19149. /**
  19150. * @private
  19151. */
  19152. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  19153. /**
  19154. * @private
  19155. */
  19156. getSlotTimelines(name: string): Array<TimelineData> | null;
  19157. /**
  19158. * @private
  19159. */
  19160. getConstraintTimelines(name: string): Array<TimelineData> | null;
  19161. /**
  19162. * @private
  19163. */
  19164. getAnimationTimelines(name: string): Array<TimelineData> | null;
  19165. /**
  19166. * @private
  19167. */
  19168. getBoneCachedFrameIndices(name: string): Array<number> | null;
  19169. /**
  19170. * @private
  19171. */
  19172. getSlotCachedFrameIndices(name: string): Array<number> | null;
  19173. }
  19174. /**
  19175. * @internal
  19176. * @private
  19177. */
  19178. class TimelineData extends BaseObject {
  19179. static toString(): string;
  19180. type: TimelineType;
  19181. offset: number;
  19182. frameIndicesOffset: number;
  19183. protected _onClear(): void;
  19184. }
  19185. }
  19186. /**
  19187. * The MIT License (MIT)
  19188. *
  19189. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19190. *
  19191. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19192. * this software and associated documentation files (the "Software"), to deal in
  19193. * the Software without restriction, including without limitation the rights to
  19194. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19195. * the Software, and to permit persons to whom the Software is furnished to do so,
  19196. * subject to the following conditions:
  19197. *
  19198. * The above copyright notice and this permission notice shall be included in all
  19199. * copies or substantial portions of the Software.
  19200. *
  19201. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19202. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19203. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19204. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19205. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19206. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19207. */
  19208. declare namespace dragonBones {
  19209. /**
  19210. * - The animation config is used to describe all the information needed to play an animation state.
  19211. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  19212. * @see dragonBones.AnimationState
  19213. * @beta
  19214. * @version DragonBones 5.0
  19215. * @language en_US
  19216. */
  19217. /**
  19218. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  19219. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  19220. * @see dragonBones.AnimationState
  19221. * @beta
  19222. * @version DragonBones 5.0
  19223. * @language zh_CN
  19224. */
  19225. class AnimationConfig extends BaseObject {
  19226. static toString(): string;
  19227. /**
  19228. * @private
  19229. */
  19230. pauseFadeOut: boolean;
  19231. /**
  19232. * - Fade out the pattern of other animation states when the animation state is fade in.
  19233. * This property is typically used to specify the substitution of multiple animation states blend.
  19234. * @default dragonBones.AnimationFadeOutMode.All
  19235. * @version DragonBones 5.0
  19236. * @language en_US
  19237. */
  19238. /**
  19239. * - 淡入动画状态时淡出其他动画状态的模式。
  19240. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  19241. * @default dragonBones.AnimationFadeOutMode.All
  19242. * @version DragonBones 5.0
  19243. * @language zh_CN
  19244. */
  19245. fadeOutMode: AnimationFadeOutMode;
  19246. /**
  19247. * @private
  19248. */
  19249. fadeOutTweenType: TweenType;
  19250. /**
  19251. * @private
  19252. */
  19253. fadeOutTime: number;
  19254. /**
  19255. * @private
  19256. */
  19257. pauseFadeIn: boolean;
  19258. /**
  19259. * @private
  19260. */
  19261. actionEnabled: boolean;
  19262. /**
  19263. * @private
  19264. */
  19265. additiveBlending: boolean;
  19266. /**
  19267. * - Whether the animation state has control over the display property of the slots.
  19268. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  19269. * especially if other animation state are controlling the display properties of the slots.
  19270. * @default true
  19271. * @version DragonBones 5.0
  19272. * @language en_US
  19273. */
  19274. /**
  19275. * - 动画状态是否对插槽的显示对象属性有控制权。
  19276. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  19277. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  19278. * @default true
  19279. * @version DragonBones 5.0
  19280. * @language zh_CN
  19281. */
  19282. displayControl: boolean;
  19283. /**
  19284. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  19285. * This property should usually be set to false when blend multiple animation states.
  19286. * @default true
  19287. * @version DragonBones 5.1
  19288. * @language en_US
  19289. */
  19290. /**
  19291. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  19292. * 通常在混合多个动画状态时应该将该属性设置为 false。
  19293. * @default true
  19294. * @version DragonBones 5.1
  19295. * @language zh_CN
  19296. */
  19297. resetToPose: boolean;
  19298. /**
  19299. * @private
  19300. */
  19301. fadeInTweenType: TweenType;
  19302. /**
  19303. * - The play times. [0: Loop play, [1~N]: Play N times]
  19304. * @version DragonBones 3.0
  19305. * @language en_US
  19306. */
  19307. /**
  19308. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  19309. * @version DragonBones 3.0
  19310. * @language zh_CN
  19311. */
  19312. playTimes: number;
  19313. /**
  19314. * - The blend layer.
  19315. * High layer animation state will get the blend weight first.
  19316. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  19317. * @readonly
  19318. * @version DragonBones 5.0
  19319. * @language en_US
  19320. */
  19321. /**
  19322. * - 混合图层。
  19323. * 图层高的动画状态会优先获取混合权重。
  19324. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  19325. * @readonly
  19326. * @version DragonBones 5.0
  19327. * @language zh_CN
  19328. */
  19329. layer: number;
  19330. /**
  19331. * - The start time of play. (In seconds)
  19332. * @default 0.0
  19333. * @version DragonBones 5.0
  19334. * @language en_US
  19335. */
  19336. /**
  19337. * - 播放的开始时间。 (以秒为单位)
  19338. * @default 0.0
  19339. * @version DragonBones 5.0
  19340. * @language zh_CN
  19341. */
  19342. position: number;
  19343. /**
  19344. * - The duration of play.
  19345. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  19346. * @default -1.0
  19347. * @version DragonBones 5.0
  19348. * @language en_US
  19349. */
  19350. /**
  19351. * - 播放的持续时间。
  19352. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  19353. * @default -1.0
  19354. * @version DragonBones 5.0
  19355. * @language zh_CN
  19356. */
  19357. duration: number;
  19358. /**
  19359. * - The play speed.
  19360. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  19361. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  19362. * @default 1.0
  19363. * @version DragonBones 3.0
  19364. * @language en_US
  19365. */
  19366. /**
  19367. * - 播放速度。
  19368. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  19369. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  19370. * @default 1.0
  19371. * @version DragonBones 3.0
  19372. * @language zh_CN
  19373. */
  19374. timeScale: number;
  19375. /**
  19376. * - The blend weight.
  19377. * @default 1.0
  19378. * @version DragonBones 5.0
  19379. * @language en_US
  19380. */
  19381. /**
  19382. * - 混合权重。
  19383. * @default 1.0
  19384. * @version DragonBones 5.0
  19385. * @language zh_CN
  19386. */
  19387. weight: number;
  19388. /**
  19389. * - The fade in time.
  19390. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  19391. * @default -1.0
  19392. * @version DragonBones 5.0
  19393. * @language en_US
  19394. */
  19395. /**
  19396. * - 淡入时间。
  19397. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  19398. * @default -1.0
  19399. * @version DragonBones 5.0
  19400. * @language zh_CN
  19401. */
  19402. fadeInTime: number;
  19403. /**
  19404. * - The auto fade out time when the animation state play completed.
  19405. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  19406. * @default -1.0
  19407. * @version DragonBones 5.0
  19408. * @language en_US
  19409. */
  19410. /**
  19411. * - 动画状态播放完成后的自动淡出时间。
  19412. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  19413. * @default -1.0
  19414. * @version DragonBones 5.0
  19415. * @language zh_CN
  19416. */
  19417. autoFadeOutTime: number;
  19418. /**
  19419. * - The name of the animation state. (Can be different from the name of the animation data)
  19420. * @version DragonBones 5.0
  19421. * @language en_US
  19422. */
  19423. /**
  19424. * - 动画状态名称。 (可以不同于动画数据)
  19425. * @version DragonBones 5.0
  19426. * @language zh_CN
  19427. */
  19428. name: string;
  19429. /**
  19430. * - The animation data name.
  19431. * @version DragonBones 5.0
  19432. * @language en_US
  19433. */
  19434. /**
  19435. * - 动画数据名称。
  19436. * @version DragonBones 5.0
  19437. * @language zh_CN
  19438. */
  19439. animation: string;
  19440. /**
  19441. * - The blend group name of the animation state.
  19442. * This property is typically used to specify the substitution of multiple animation states blend.
  19443. * @readonly
  19444. * @version DragonBones 5.0
  19445. * @language en_US
  19446. */
  19447. /**
  19448. * - 混合组名称。
  19449. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  19450. * @readonly
  19451. * @version DragonBones 5.0
  19452. * @language zh_CN
  19453. */
  19454. group: string;
  19455. /**
  19456. * @private
  19457. */
  19458. readonly boneMask: Array<string>;
  19459. /**
  19460. * @private
  19461. */
  19462. protected _onClear(): void;
  19463. /**
  19464. * @private
  19465. */
  19466. clear(): void;
  19467. /**
  19468. * @private
  19469. */
  19470. copyFrom(value: AnimationConfig): void;
  19471. /**
  19472. * @private
  19473. */
  19474. containsBoneMask(name: string): boolean;
  19475. /**
  19476. * @private
  19477. */
  19478. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  19479. /**
  19480. * @private
  19481. */
  19482. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  19483. }
  19484. }
  19485. /**
  19486. * The MIT License (MIT)
  19487. *
  19488. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19489. *
  19490. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19491. * this software and associated documentation files (the "Software"), to deal in
  19492. * the Software without restriction, including without limitation the rights to
  19493. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19494. * the Software, and to permit persons to whom the Software is furnished to do so,
  19495. * subject to the following conditions:
  19496. *
  19497. * The above copyright notice and this permission notice shall be included in all
  19498. * copies or substantial portions of the Software.
  19499. *
  19500. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19501. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19502. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19503. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19504. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19505. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19506. */
  19507. declare namespace dragonBones {
  19508. /**
  19509. * - The texture atlas data.
  19510. * @version DragonBones 3.0
  19511. * @language en_US
  19512. */
  19513. /**
  19514. * - 贴图集数据。
  19515. * @version DragonBones 3.0
  19516. * @language zh_CN
  19517. */
  19518. abstract class TextureAtlasData extends BaseObject {
  19519. /**
  19520. * @private
  19521. */
  19522. autoSearch: boolean;
  19523. /**
  19524. * @private
  19525. */
  19526. width: number;
  19527. /**
  19528. * @private
  19529. */
  19530. height: number;
  19531. /**
  19532. * @private
  19533. */
  19534. scale: number;
  19535. /**
  19536. * - The texture atlas name.
  19537. * @version DragonBones 3.0
  19538. * @language en_US
  19539. */
  19540. /**
  19541. * - 贴图集名称。
  19542. * @version DragonBones 3.0
  19543. * @language zh_CN
  19544. */
  19545. name: string;
  19546. /**
  19547. * - The image path of the texture atlas.
  19548. * @version DragonBones 3.0
  19549. * @language en_US
  19550. */
  19551. /**
  19552. * - 贴图集图片路径。
  19553. * @version DragonBones 3.0
  19554. * @language zh_CN
  19555. */
  19556. imagePath: string;
  19557. /**
  19558. * @private
  19559. */
  19560. readonly textures: Map<TextureData>;
  19561. /**
  19562. * @inheritDoc
  19563. */
  19564. protected _onClear(): void;
  19565. /**
  19566. * @private
  19567. */
  19568. copyFrom(value: TextureAtlasData): void;
  19569. /**
  19570. * @internal
  19571. * @private
  19572. */
  19573. abstract createTexture(): TextureData;
  19574. /**
  19575. * @internal
  19576. * @private
  19577. */
  19578. addTexture(value: TextureData): void;
  19579. /**
  19580. * @private
  19581. */
  19582. getTexture(name: string): TextureData | null;
  19583. }
  19584. /**
  19585. * @internal
  19586. * @private
  19587. */
  19588. abstract class TextureData extends BaseObject {
  19589. static createRectangle(): Rectangle;
  19590. rotated: boolean;
  19591. name: string;
  19592. readonly region: Rectangle;
  19593. parent: TextureAtlasData;
  19594. frame: Rectangle | null;
  19595. protected _onClear(): void;
  19596. copyFrom(value: TextureData): void;
  19597. }
  19598. }
  19599. /**
  19600. * The MIT License (MIT)
  19601. *
  19602. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19603. *
  19604. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19605. * this software and associated documentation files (the "Software"), to deal in
  19606. * the Software without restriction, including without limitation the rights to
  19607. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19608. * the Software, and to permit persons to whom the Software is furnished to do so,
  19609. * subject to the following conditions:
  19610. *
  19611. * The above copyright notice and this permission notice shall be included in all
  19612. * copies or substantial portions of the Software.
  19613. *
  19614. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19615. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19616. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19617. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19618. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19619. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19620. */
  19621. declare namespace dragonBones {
  19622. /**
  19623. * - The armature proxy interface, the docking engine needs to implement it concretely.
  19624. * @see dragonBones.Armature
  19625. * @version DragonBones 5.0
  19626. * @language en_US
  19627. */
  19628. /**
  19629. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  19630. * @see dragonBones.Armature
  19631. * @version DragonBones 5.0
  19632. * @language zh_CN
  19633. */
  19634. interface IArmatureProxy extends IEventDispatcher {
  19635. /**
  19636. * @internal
  19637. * @private
  19638. */
  19639. dbInit(armature: Armature): void;
  19640. /**
  19641. * @internal
  19642. * @private
  19643. */
  19644. dbClear(): void;
  19645. /**
  19646. * @internal
  19647. * @private
  19648. */
  19649. dbUpdate(): void;
  19650. /**
  19651. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  19652. * @example
  19653. * <pre>
  19654. * removeChild(armatureDisplay);
  19655. * armatureDisplay.dispose();
  19656. * </pre>
  19657. * @version DragonBones 4.5
  19658. * @language en_US
  19659. */
  19660. /**
  19661. * - 释放该实例和骨架。 (骨架会回收到对象池)
  19662. * @example
  19663. * <pre>
  19664. * removeChild(armatureDisplay);
  19665. * armatureDisplay.dispose();
  19666. * </pre>
  19667. * @version DragonBones 4.5
  19668. * @language zh_CN
  19669. */
  19670. dispose(disposeProxy: boolean): void;
  19671. /**
  19672. * - The armature.
  19673. * @version DragonBones 4.5
  19674. * @language en_US
  19675. */
  19676. /**
  19677. * - 骨架。
  19678. * @version DragonBones 4.5
  19679. * @language zh_CN
  19680. */
  19681. readonly armature: Armature;
  19682. /**
  19683. * - The animation player.
  19684. * @version DragonBones 3.0
  19685. * @language en_US
  19686. */
  19687. /**
  19688. * - 动画播放器。
  19689. * @version DragonBones 3.0
  19690. * @language zh_CN
  19691. */
  19692. readonly animation: Animation;
  19693. }
  19694. }
  19695. /**
  19696. * The MIT License (MIT)
  19697. *
  19698. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19699. *
  19700. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19701. * this software and associated documentation files (the "Software"), to deal in
  19702. * the Software without restriction, including without limitation the rights to
  19703. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19704. * the Software, and to permit persons to whom the Software is furnished to do so,
  19705. * subject to the following conditions:
  19706. *
  19707. * The above copyright notice and this permission notice shall be included in all
  19708. * copies or substantial portions of the Software.
  19709. *
  19710. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19711. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19712. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19713. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19714. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19715. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19716. */
  19717. declare namespace dragonBones {
  19718. /**
  19719. * - Armature is the core of the skeleton animation system.
  19720. * @see dragonBones.ArmatureData
  19721. * @see dragonBones.Bone
  19722. * @see dragonBones.Slot
  19723. * @see dragonBones.Animation
  19724. * @version DragonBones 3.0
  19725. * @language en_US
  19726. */
  19727. /**
  19728. * - 骨架是骨骼动画系统的核心。
  19729. * @see dragonBones.ArmatureData
  19730. * @see dragonBones.Bone
  19731. * @see dragonBones.Slot
  19732. * @see dragonBones.Animation
  19733. * @version DragonBones 3.0
  19734. * @language zh_CN
  19735. */
  19736. class Armature extends BaseObject implements IAnimatable {
  19737. static toString(): string;
  19738. private static _onSortSlots(a, b);
  19739. /**
  19740. * - Whether to inherit the animation control of the parent armature.
  19741. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  19742. * @default true
  19743. * @version DragonBones 4.5
  19744. * @language en_US
  19745. */
  19746. /**
  19747. * - 是否继承父骨架的动画控制。
  19748. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  19749. * @default true
  19750. * @version DragonBones 4.5
  19751. * @language zh_CN
  19752. */
  19753. inheritAnimation: boolean;
  19754. /**
  19755. * @private
  19756. */
  19757. userData: any;
  19758. private _lockUpdate;
  19759. private _bonesDirty;
  19760. private _slotsDirty;
  19761. private _zOrderDirty;
  19762. private _flipX;
  19763. private _flipY;
  19764. /**
  19765. * @internal
  19766. * @private
  19767. */
  19768. _cacheFrameIndex: number;
  19769. private readonly _bones;
  19770. private readonly _slots;
  19771. /**
  19772. * @internal
  19773. * @private
  19774. */
  19775. readonly _glueSlots: Array<Slot>;
  19776. /**
  19777. * @internal
  19778. * @private
  19779. */
  19780. readonly _constraints: Array<Constraint>;
  19781. private readonly _actions;
  19782. /**
  19783. * @internal
  19784. * @private
  19785. */
  19786. _armatureData: ArmatureData;
  19787. private _animation;
  19788. private _proxy;
  19789. private _display;
  19790. /**
  19791. * @internal
  19792. * @private
  19793. */
  19794. _replaceTextureAtlasData: TextureAtlasData | null;
  19795. private _replacedTexture;
  19796. /**
  19797. * @internal
  19798. * @private
  19799. */
  19800. _dragonBones: DragonBones;
  19801. private _clock;
  19802. /**
  19803. * @internal
  19804. * @private
  19805. */
  19806. _parent: Slot | null;
  19807. /**
  19808. * @private
  19809. */
  19810. protected _onClear(): void;
  19811. private _sortBones();
  19812. private _sortSlots();
  19813. /**
  19814. * @internal
  19815. * @private
  19816. */
  19817. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  19818. /**
  19819. * @internal
  19820. * @private
  19821. */
  19822. _addBoneToBoneList(value: Bone): void;
  19823. /**
  19824. * @internal
  19825. * @private
  19826. */
  19827. _removeBoneFromBoneList(value: Bone): void;
  19828. /**
  19829. * @internal
  19830. * @private
  19831. */
  19832. _addSlotToSlotList(value: Slot): void;
  19833. /**
  19834. * @internal
  19835. * @private
  19836. */
  19837. _removeSlotFromSlotList(value: Slot): void;
  19838. /**
  19839. * @internal
  19840. * @private
  19841. */
  19842. _bufferAction(action: ActionData, append: boolean): void;
  19843. /**
  19844. * - Dispose the armature. (Return to the object pool)
  19845. * @example
  19846. * <pre>
  19847. * removeChild(armature.display);
  19848. * armature.dispose();
  19849. * </pre>
  19850. * @version DragonBones 3.0
  19851. * @language en_US
  19852. */
  19853. /**
  19854. * - 释放骨架。 (回收到对象池)
  19855. * @example
  19856. * <pre>
  19857. * removeChild(armature.display);
  19858. * armature.dispose();
  19859. * </pre>
  19860. * @version DragonBones 3.0
  19861. * @language zh_CN
  19862. */
  19863. dispose(): void;
  19864. /**
  19865. * @internal
  19866. * @private
  19867. */
  19868. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  19869. /**
  19870. * @inheritDoc
  19871. */
  19872. advanceTime(passedTime: number): void;
  19873. /**
  19874. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  19875. * @param boneName - The bone name. (If not set, all bones will be update)
  19876. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  19877. * @see dragonBones.Bone#invalidUpdate()
  19878. * @see dragonBones.Slot#invalidUpdate()
  19879. * @version DragonBones 3.0
  19880. * @language en_US
  19881. */
  19882. /**
  19883. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  19884. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  19885. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  19886. * @see dragonBones.Bone#invalidUpdate()
  19887. * @see dragonBones.Slot#invalidUpdate()
  19888. * @version DragonBones 3.0
  19889. * @language zh_CN
  19890. */
  19891. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  19892. /**
  19893. * - Check whether a specific point is inside a custom bounding box in a slot.
  19894. * The coordinate system of the point is the inner coordinate system of the armature.
  19895. * Custom bounding boxes need to be customized in Dragonbones Pro.
  19896. * @param x - The horizontal coordinate of the point.
  19897. * @param y - The vertical coordinate of the point.
  19898. * @version DragonBones 5.0
  19899. * @language en_US
  19900. */
  19901. /**
  19902. * - 检查特定点是否在某个插槽的自定义边界框内。
  19903. * 点的坐标系为骨架内坐标系。
  19904. * 自定义边界框需要在 DragonBones Pro 中自定义。
  19905. * @param x - 点的水平坐标。
  19906. * @param y - 点的垂直坐标。
  19907. * @version DragonBones 5.0
  19908. * @language zh_CN
  19909. */
  19910. containsPoint(x: number, y: number): Slot | null;
  19911. /**
  19912. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  19913. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  19914. * Custom bounding boxes need to be customized in Dragonbones Pro.
  19915. * @param xA - The horizontal coordinate of the beginning of the segment.
  19916. * @param yA - The vertical coordinate of the beginning of the segment.
  19917. * @param xB - The horizontal coordinate of the end point of the segment.
  19918. * @param yB - The vertical coordinate of the end point of the segment.
  19919. * @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)
  19920. * @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)
  19921. * @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)
  19922. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  19923. * @version DragonBones 5.0
  19924. * @language en_US
  19925. */
  19926. /**
  19927. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  19928. * 线段和交点的坐标系均为骨架内坐标系。
  19929. * 自定义边界框需要在 DragonBones Pro 中自定义。
  19930. * @param xA - 线段起点的水平坐标。
  19931. * @param yA - 线段起点的垂直坐标。
  19932. * @param xB - 线段终点的水平坐标。
  19933. * @param yB - 线段终点的垂直坐标。
  19934. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  19935. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  19936. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  19937. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  19938. * @version DragonBones 5.0
  19939. * @language zh_CN
  19940. */
  19941. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  19942. x: number;
  19943. y: number;
  19944. } | null, intersectionPointB?: {
  19945. x: number;
  19946. y: number;
  19947. } | null, normalRadians?: {
  19948. x: number;
  19949. y: number;
  19950. } | null): Slot | null;
  19951. /**
  19952. * - Get a specific bone.
  19953. * @param name - The bone name.
  19954. * @see dragonBones.Bone
  19955. * @version DragonBones 3.0
  19956. * @language en_US
  19957. */
  19958. /**
  19959. * - 获取特定的骨骼。
  19960. * @param name - 骨骼名称。
  19961. * @see dragonBones.Bone
  19962. * @version DragonBones 3.0
  19963. * @language zh_CN
  19964. */
  19965. getBone(name: string): Bone | null;
  19966. /**
  19967. * - Get a specific bone by the display.
  19968. * @param display - The display object.
  19969. * @see dragonBones.Bone
  19970. * @version DragonBones 3.0
  19971. * @language en_US
  19972. */
  19973. /**
  19974. * - 通过显示对象获取特定的骨骼。
  19975. * @param display - 显示对象。
  19976. * @see dragonBones.Bone
  19977. * @version DragonBones 3.0
  19978. * @language zh_CN
  19979. */
  19980. getBoneByDisplay(display: any): Bone | null;
  19981. /**
  19982. * - Get a specific slot.
  19983. * @param name - The slot name.
  19984. * @see dragonBones.Slot
  19985. * @version DragonBones 3.0
  19986. * @language en_US
  19987. */
  19988. /**
  19989. * - 获取特定的插槽。
  19990. * @param name - 插槽名称。
  19991. * @see dragonBones.Slot
  19992. * @version DragonBones 3.0
  19993. * @language zh_CN
  19994. */
  19995. getSlot(name: string): Slot | null;
  19996. /**
  19997. * - Get a specific slot by the display.
  19998. * @param display - The display object.
  19999. * @see dragonBones.Slot
  20000. * @version DragonBones 3.0
  20001. * @language en_US
  20002. */
  20003. /**
  20004. * - 通过显示对象获取特定的插槽。
  20005. * @param display - 显示对象。
  20006. * @see dragonBones.Slot
  20007. * @version DragonBones 3.0
  20008. * @language zh_CN
  20009. */
  20010. getSlotByDisplay(display: any): Slot | null;
  20011. /**
  20012. * @deprecated
  20013. */
  20014. addBone(value: Bone, parentName: string): void;
  20015. /**
  20016. * @deprecated
  20017. */
  20018. addSlot(value: Slot, parentName: string): void;
  20019. /**
  20020. * @private
  20021. */
  20022. addConstraint(value: Constraint): void;
  20023. /**
  20024. * @deprecated
  20025. */
  20026. removeBone(value: Bone): void;
  20027. /**
  20028. * @deprecated
  20029. */
  20030. removeSlot(value: Slot): void;
  20031. /**
  20032. * - Get all bones.
  20033. * @see dragonBones.Bone
  20034. * @version DragonBones 3.0
  20035. * @language en_US
  20036. */
  20037. /**
  20038. * - 获取所有的骨骼。
  20039. * @see dragonBones.Bone
  20040. * @version DragonBones 3.0
  20041. * @language zh_CN
  20042. */
  20043. getBones(): Array<Bone>;
  20044. /**
  20045. * - Get all slots.
  20046. * @see dragonBones.Slot
  20047. * @version DragonBones 3.0
  20048. * @language en_US
  20049. */
  20050. /**
  20051. * - 获取所有的插槽。
  20052. * @see dragonBones.Slot
  20053. * @version DragonBones 3.0
  20054. * @language zh_CN
  20055. */
  20056. getSlots(): Array<Slot>;
  20057. /**
  20058. * - Whether to flip the armature horizontally.
  20059. * @version DragonBones 5.5
  20060. * @language en_US
  20061. */
  20062. /**
  20063. * - 是否将骨架水平翻转。
  20064. * @version DragonBones 5.5
  20065. * @language zh_CN
  20066. */
  20067. flipX: boolean;
  20068. /**
  20069. * - Whether to flip the armature vertically.
  20070. * @version DragonBones 5.5
  20071. * @language en_US
  20072. */
  20073. /**
  20074. * - 是否将骨架垂直翻转。
  20075. * @version DragonBones 5.5
  20076. * @language zh_CN
  20077. */
  20078. flipY: boolean;
  20079. /**
  20080. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  20081. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  20082. * 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.
  20083. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  20084. * @example
  20085. * <pre>
  20086. * armature.cacheFrameRate = 24;
  20087. * </pre>
  20088. * @see dragonBones.DragonBonesData#frameRate
  20089. * @see dragonBones.ArmatureData#frameRate
  20090. * @version DragonBones 4.5
  20091. * @language en_US
  20092. */
  20093. /**
  20094. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  20095. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  20096. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  20097. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  20098. * @example
  20099. * <pre>
  20100. * armature.cacheFrameRate = 24;
  20101. * </pre>
  20102. * @see dragonBones.DragonBonesData#frameRate
  20103. * @see dragonBones.ArmatureData#frameRate
  20104. * @version DragonBones 4.5
  20105. * @language zh_CN
  20106. */
  20107. cacheFrameRate: number;
  20108. /**
  20109. * - The armature name.
  20110. * @version DragonBones 3.0
  20111. * @language en_US
  20112. */
  20113. /**
  20114. * - 骨架名称。
  20115. * @version DragonBones 3.0
  20116. * @language zh_CN
  20117. */
  20118. readonly name: string;
  20119. /**
  20120. * - The armature data.
  20121. * @see dragonBones.ArmatureData
  20122. * @version DragonBones 4.5
  20123. * @language en_US
  20124. */
  20125. /**
  20126. * - 骨架数据。
  20127. * @see dragonBones.ArmatureData
  20128. * @version DragonBones 4.5
  20129. * @language zh_CN
  20130. */
  20131. readonly armatureData: ArmatureData;
  20132. /**
  20133. * - The animation player.
  20134. * @see dragonBones.Animation
  20135. * @version DragonBones 3.0
  20136. * @language en_US
  20137. */
  20138. /**
  20139. * - 动画播放器。
  20140. * @see dragonBones.Animation
  20141. * @version DragonBones 3.0
  20142. * @language zh_CN
  20143. */
  20144. readonly animation: Animation;
  20145. /**
  20146. * @pivate
  20147. */
  20148. readonly proxy: IArmatureProxy;
  20149. /**
  20150. * - The EventDispatcher instance of the armature.
  20151. * @version DragonBones 4.5
  20152. * @language en_US
  20153. */
  20154. /**
  20155. * - 该骨架的 EventDispatcher 实例。
  20156. * @version DragonBones 4.5
  20157. * @language zh_CN
  20158. */
  20159. readonly eventDispatcher: IEventDispatcher;
  20160. /**
  20161. * - The display container.
  20162. * The display of the slot is displayed as the parent.
  20163. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  20164. * @version DragonBones 3.0
  20165. * @language en_US
  20166. */
  20167. /**
  20168. * - 显示容器实例。
  20169. * 插槽的显示对象都会以此显示容器为父级。
  20170. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  20171. * @version DragonBones 3.0
  20172. * @language zh_CN
  20173. */
  20174. readonly display: any;
  20175. /**
  20176. * @private
  20177. */
  20178. replacedTexture: any;
  20179. /**
  20180. * @inheritDoc
  20181. */
  20182. clock: WorldClock | null;
  20183. /**
  20184. * - Get the parent slot which the armature belongs to.
  20185. * @see dragonBones.Slot
  20186. * @version DragonBones 4.5
  20187. * @language en_US
  20188. */
  20189. /**
  20190. * - 该骨架所属的父插槽。
  20191. * @see dragonBones.Slot
  20192. * @version DragonBones 4.5
  20193. * @language zh_CN
  20194. */
  20195. readonly parent: Slot | null;
  20196. /**
  20197. * @deprecated
  20198. * @private
  20199. */
  20200. replaceTexture(texture: any): void;
  20201. /**
  20202. * - Deprecated, please refer to {@link #eventDispatcher}.
  20203. * @deprecated
  20204. * @language en_US
  20205. */
  20206. /**
  20207. * - 已废弃,请参考 {@link #eventDispatcher}。
  20208. * @deprecated
  20209. * @language zh_CN
  20210. */
  20211. hasEventListener(type: EventStringType): boolean;
  20212. /**
  20213. * - Deprecated, please refer to {@link #eventDispatcher}.
  20214. * @deprecated
  20215. * @language en_US
  20216. */
  20217. /**
  20218. * - 已废弃,请参考 {@link #eventDispatcher}。
  20219. * @deprecated
  20220. * @language zh_CN
  20221. */
  20222. addEventListener(type: EventStringType, listener: Function, target: any): void;
  20223. /**
  20224. * - Deprecated, please refer to {@link #eventDispatcher}.
  20225. * @deprecated
  20226. * @language en_US
  20227. */
  20228. /**
  20229. * - 已废弃,请参考 {@link #eventDispatcher}。
  20230. * @deprecated
  20231. * @language zh_CN
  20232. */
  20233. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  20234. /**
  20235. * - Deprecated, please refer to {@link #cacheFrameRate}.
  20236. * @deprecated
  20237. * @language en_US
  20238. */
  20239. /**
  20240. * - 已废弃,请参考 {@link #cacheFrameRate}。
  20241. * @deprecated
  20242. * @language zh_CN
  20243. */
  20244. enableAnimationCache(frameRate: number): void;
  20245. /**
  20246. * - Deprecated, please refer to {@link #display}.
  20247. * @deprecated
  20248. * @language en_US
  20249. */
  20250. /**
  20251. * - 已废弃,请参考 {@link #display}。
  20252. * @deprecated
  20253. * @language zh_CN
  20254. */
  20255. getDisplay(): any;
  20256. }
  20257. }
  20258. /**
  20259. * The MIT License (MIT)
  20260. *
  20261. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20262. *
  20263. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20264. * this software and associated documentation files (the "Software"), to deal in
  20265. * the Software without restriction, including without limitation the rights to
  20266. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20267. * the Software, and to permit persons to whom the Software is furnished to do so,
  20268. * subject to the following conditions:
  20269. *
  20270. * The above copyright notice and this permission notice shall be included in all
  20271. * copies or substantial portions of the Software.
  20272. *
  20273. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20274. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20275. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20276. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20277. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20278. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20279. */
  20280. declare namespace dragonBones {
  20281. /**
  20282. * - The base class of the transform object.
  20283. * @see dragonBones.Transform
  20284. * @version DragonBones 4.5
  20285. * @language en_US
  20286. */
  20287. /**
  20288. * - 变换对象的基类。
  20289. * @see dragonBones.Transform
  20290. * @version DragonBones 4.5
  20291. * @language zh_CN
  20292. */
  20293. abstract class TransformObject extends BaseObject {
  20294. /**
  20295. * @private
  20296. */
  20297. protected static readonly _helpMatrix: Matrix;
  20298. /**
  20299. * @private
  20300. */
  20301. protected static readonly _helpTransform: Transform;
  20302. /**
  20303. * @private
  20304. */
  20305. protected static readonly _helpPoint: Point;
  20306. /**
  20307. * - A matrix relative to the armature coordinate system.
  20308. * @version DragonBones 3.0
  20309. * @language en_US
  20310. */
  20311. /**
  20312. * - 相对于骨架坐标系的矩阵。
  20313. * @version DragonBones 3.0
  20314. * @language zh_CN
  20315. */
  20316. readonly globalTransformMatrix: Matrix;
  20317. /**
  20318. * - A transform relative to the armature coordinate system.
  20319. * @see #updateGlobalTransform()
  20320. * @version DragonBones 3.0
  20321. * @language en_US
  20322. */
  20323. /**
  20324. * - 相对于骨架坐标系的变换。
  20325. * @see #updateGlobalTransform()
  20326. * @version DragonBones 3.0
  20327. * @language zh_CN
  20328. */
  20329. readonly global: Transform;
  20330. /**
  20331. * - The offset transform relative to the armature or the parent bone coordinate system.
  20332. * @see #dragonBones.Bone#invalidUpdate()
  20333. * @version DragonBones 3.0
  20334. * @language en_US
  20335. */
  20336. /**
  20337. * - 相对于骨架或父骨骼坐标系的偏移变换。
  20338. * @see #dragonBones.Bone#invalidUpdate()
  20339. * @version DragonBones 3.0
  20340. * @language zh_CN
  20341. */
  20342. readonly offset: Transform;
  20343. /**
  20344. * @private
  20345. */
  20346. origin: Transform | null;
  20347. /**
  20348. * @private
  20349. */
  20350. userData: any;
  20351. /**
  20352. * @private
  20353. */
  20354. protected _globalDirty: boolean;
  20355. /**
  20356. * @internal
  20357. * @private
  20358. */
  20359. _armature: Armature;
  20360. /**
  20361. * @internal
  20362. * @private
  20363. */
  20364. _parent: Bone;
  20365. /**
  20366. * @private
  20367. */
  20368. protected _onClear(): void;
  20369. /**
  20370. * @internal
  20371. * @private
  20372. */
  20373. _setArmature(value: Armature | null): void;
  20374. /**
  20375. * @internal
  20376. * @private
  20377. */
  20378. _setParent(value: Bone | null): void;
  20379. /**
  20380. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  20381. * some engines do not rely on these attributes to update rendering, such as Egret.
  20382. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  20383. * @example
  20384. * <pre>
  20385. * bone.updateGlobalTransform();
  20386. * let rotation = bone.global.rotation;
  20387. * </pre>
  20388. * @version DragonBones 3.0
  20389. * @language en_US
  20390. */
  20391. /**
  20392. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  20393. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  20394. * @example
  20395. * <pre>
  20396. * bone.updateGlobalTransform();
  20397. * let rotation = bone.global.rotation;
  20398. * </pre>
  20399. * @version DragonBones 3.0
  20400. * @language zh_CN
  20401. */
  20402. updateGlobalTransform(): void;
  20403. /**
  20404. * - The armature to which it belongs.
  20405. * @version DragonBones 3.0
  20406. * @language en_US
  20407. */
  20408. /**
  20409. * - 所属的骨架。
  20410. * @version DragonBones 3.0
  20411. * @language zh_CN
  20412. */
  20413. readonly armature: Armature;
  20414. /**
  20415. * - The parent bone to which it belongs.
  20416. * @version DragonBones 3.0
  20417. * @language en_US
  20418. */
  20419. /**
  20420. * - 所属的父骨骼。
  20421. * @version DragonBones 3.0
  20422. * @language zh_CN
  20423. */
  20424. readonly parent: Bone;
  20425. }
  20426. }
  20427. /**
  20428. * The MIT License (MIT)
  20429. *
  20430. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20431. *
  20432. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20433. * this software and associated documentation files (the "Software"), to deal in
  20434. * the Software without restriction, including without limitation the rights to
  20435. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20436. * the Software, and to permit persons to whom the Software is furnished to do so,
  20437. * subject to the following conditions:
  20438. *
  20439. * The above copyright notice and this permission notice shall be included in all
  20440. * copies or substantial portions of the Software.
  20441. *
  20442. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20443. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20444. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20445. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20446. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20447. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20448. */
  20449. declare namespace dragonBones {
  20450. /**
  20451. * - Bone is one of the most important logical units in the armature animation system,
  20452. * and is responsible for the realization of translate, rotation, scaling in the animations.
  20453. * A armature can contain multiple bones.
  20454. * @see dragonBones.BoneData
  20455. * @see dragonBones.Armature
  20456. * @see dragonBones.Slot
  20457. * @version DragonBones 3.0
  20458. * @language en_US
  20459. */
  20460. /**
  20461. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  20462. * 一个骨架中可以包含多个骨骼。
  20463. * @see dragonBones.BoneData
  20464. * @see dragonBones.Armature
  20465. * @see dragonBones.Slot
  20466. * @version DragonBones 3.0
  20467. * @language zh_CN
  20468. */
  20469. class Bone extends TransformObject {
  20470. static toString(): string;
  20471. /**
  20472. * - The offset mode.
  20473. * @see #offset
  20474. * @version DragonBones 5.5
  20475. * @language en_US
  20476. */
  20477. /**
  20478. * - 偏移模式。
  20479. * @see #offset
  20480. * @version DragonBones 5.5
  20481. * @language zh_CN
  20482. */
  20483. offsetMode: OffsetMode;
  20484. /**
  20485. * @internal
  20486. * @private
  20487. */
  20488. readonly animationPose: Transform;
  20489. /**
  20490. * @internal
  20491. * @private
  20492. */
  20493. _transformDirty: boolean;
  20494. /**
  20495. * @internal
  20496. * @private
  20497. */
  20498. _childrenTransformDirty: boolean;
  20499. protected _localDirty: boolean;
  20500. /**
  20501. * @internal
  20502. * @private
  20503. */
  20504. _hasConstraint: boolean;
  20505. private _visible;
  20506. protected _cachedFrameIndex: number;
  20507. /**
  20508. * @internal
  20509. * @private
  20510. */
  20511. readonly _blendState: BlendState;
  20512. /**
  20513. * @internal
  20514. * @private
  20515. */
  20516. _boneData: BoneData;
  20517. /**
  20518. * @internal
  20519. * @private
  20520. */
  20521. _cachedFrameIndices: Array<number> | null;
  20522. /**
  20523. * @inheritDoc
  20524. */
  20525. protected _onClear(): void;
  20526. /**
  20527. * @private
  20528. */
  20529. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  20530. /**
  20531. * @inheritDoc
  20532. */
  20533. _setArmature(value: Armature | null): void;
  20534. /**
  20535. * @internal
  20536. * @private
  20537. */
  20538. init(boneData: BoneData): void;
  20539. /**
  20540. * @internal
  20541. * @private
  20542. */
  20543. update(cacheFrameIndex: number): void;
  20544. /**
  20545. * @internal
  20546. * @private
  20547. */
  20548. updateByConstraint(): void;
  20549. /**
  20550. * - Forces the bone to update the transform in the next frame.
  20551. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  20552. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  20553. * @example
  20554. * <pre>
  20555. * let bone = armature.getBone("arm");
  20556. * bone.offset.scaleX = 2.0;
  20557. * bone.invalidUpdate();
  20558. * </pre>
  20559. * @version DragonBones 3.0
  20560. * @language en_US
  20561. */
  20562. /**
  20563. * - 强制骨骼在下一帧更新变换。
  20564. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  20565. * @example
  20566. * <pre>
  20567. * let bone = armature.getBone("arm");
  20568. * bone.offset.scaleX = 2.0;
  20569. * bone.invalidUpdate();
  20570. * </pre>
  20571. * @version DragonBones 3.0
  20572. * @language zh_CN
  20573. */
  20574. invalidUpdate(): void;
  20575. /**
  20576. * - Check whether the bone contains a specific bone or slot.
  20577. * @see dragonBones.Bone
  20578. * @see dragonBones.Slot
  20579. * @version DragonBones 3.0
  20580. * @language en_US
  20581. */
  20582. /**
  20583. * - 检查该骨骼是否包含特定的骨骼或插槽。
  20584. * @see dragonBones.Bone
  20585. * @see dragonBones.Slot
  20586. * @version DragonBones 3.0
  20587. * @language zh_CN
  20588. */
  20589. contains(value: TransformObject): boolean;
  20590. /**
  20591. * - The bone data.
  20592. * @version DragonBones 4.5
  20593. * @language en_US
  20594. */
  20595. /**
  20596. * - 骨骼数据。
  20597. * @version DragonBones 4.5
  20598. * @language zh_CN
  20599. */
  20600. readonly boneData: BoneData;
  20601. /**
  20602. * - The visible of all slots in the bone.
  20603. * @default true
  20604. * @see dragonBones.Slot#visible
  20605. * @version DragonBones 3.0
  20606. * @language en_US
  20607. */
  20608. /**
  20609. * - 此骨骼所有插槽的可见。
  20610. * @default true
  20611. * @see dragonBones.Slot#visible
  20612. * @version DragonBones 3.0
  20613. * @language zh_CN
  20614. */
  20615. visible: boolean;
  20616. /**
  20617. * - The bone name.
  20618. * @version DragonBones 3.0
  20619. * @language en_US
  20620. */
  20621. /**
  20622. * - 骨骼名称。
  20623. * @version DragonBones 3.0
  20624. * @language zh_CN
  20625. */
  20626. readonly name: string;
  20627. /**
  20628. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  20629. * @deprecated
  20630. * @language en_US
  20631. */
  20632. /**
  20633. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  20634. * @deprecated
  20635. * @language zh_CN
  20636. */
  20637. getBones(): Array<Bone>;
  20638. /**
  20639. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  20640. * @deprecated
  20641. * @language en_US
  20642. */
  20643. /**
  20644. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  20645. * @deprecated
  20646. * @language zh_CN
  20647. */
  20648. getSlots(): Array<Slot>;
  20649. /**
  20650. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  20651. * @deprecated
  20652. * @language en_US
  20653. */
  20654. /**
  20655. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  20656. * @deprecated
  20657. * @language zh_CN
  20658. */
  20659. readonly slot: Slot | null;
  20660. }
  20661. }
  20662. /**
  20663. * The MIT License (MIT)
  20664. *
  20665. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20666. *
  20667. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20668. * this software and associated documentation files (the "Software"), to deal in
  20669. * the Software without restriction, including without limitation the rights to
  20670. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20671. * the Software, and to permit persons to whom the Software is furnished to do so,
  20672. * subject to the following conditions:
  20673. *
  20674. * The above copyright notice and this permission notice shall be included in all
  20675. * copies or substantial portions of the Software.
  20676. *
  20677. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20678. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20679. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20680. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20681. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20682. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20683. */
  20684. declare namespace dragonBones {
  20685. /**
  20686. * @internal
  20687. * @private
  20688. */
  20689. class Surface extends Bone {
  20690. static toString(): string;
  20691. private _dX;
  20692. private _dY;
  20693. private _k;
  20694. private _kX;
  20695. private _kY;
  20696. /**
  20697. * For debug draw.
  20698. * @internal
  20699. * @private
  20700. */
  20701. readonly _vertices: Array<number>;
  20702. /**
  20703. * For timeline state.
  20704. * @internal
  20705. * @private
  20706. */
  20707. readonly _deformVertices: Array<number>;
  20708. /**
  20709. * x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y
  20710. */
  20711. private readonly _hullCache;
  20712. /**
  20713. * Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty]
  20714. */
  20715. private readonly _matrixCahce;
  20716. /**
  20717. * @inheritDoc
  20718. */
  20719. protected _onClear(): void;
  20720. private _getAffineTransform(x, y, lX, lY, aX, aY, bX, bY, cX, cY, transform, matrix, isDown);
  20721. private _updateVertices();
  20722. /**
  20723. * @private
  20724. */
  20725. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  20726. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  20727. init(surfaceData: SurfaceData): void;
  20728. /**
  20729. * @internal
  20730. * @private
  20731. */
  20732. update(cacheFrameIndex: number): void;
  20733. }
  20734. }
  20735. /**
  20736. * The MIT License (MIT)
  20737. *
  20738. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20739. *
  20740. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20741. * this software and associated documentation files (the "Software"), to deal in
  20742. * the Software without restriction, including without limitation the rights to
  20743. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20744. * the Software, and to permit persons to whom the Software is furnished to do so,
  20745. * subject to the following conditions:
  20746. *
  20747. * The above copyright notice and this permission notice shall be included in all
  20748. * copies or substantial portions of the Software.
  20749. *
  20750. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20751. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20752. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20753. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20754. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20755. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20756. */
  20757. declare namespace dragonBones {
  20758. /**
  20759. * - The slot attached to the armature, controls the display status and properties of the display object.
  20760. * A bone can contain multiple slots.
  20761. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  20762. * but you can toggle the display object into frame animation while the animation is playing.
  20763. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  20764. * and a custom other display object.
  20765. * @see dragonBones.Armature
  20766. * @see dragonBones.Bone
  20767. * @see dragonBones.SlotData
  20768. * @version DragonBones 3.0
  20769. * @language en_US
  20770. */
  20771. /**
  20772. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  20773. * 一个骨骼上可以包含多个插槽。
  20774. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  20775. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  20776. * @see dragonBones.Armature
  20777. * @see dragonBones.Bone
  20778. * @see dragonBones.SlotData
  20779. * @version DragonBones 3.0
  20780. * @language zh_CN
  20781. */
  20782. abstract class Slot extends TransformObject {
  20783. /**
  20784. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  20785. * @default null
  20786. * @see dragonBones.AnimationState#displayControl
  20787. * @see dragonBones.AnimationState#name
  20788. * @see dragonBones.AnimationState#group
  20789. * @version DragonBones 4.5
  20790. * @language en_US
  20791. */
  20792. /**
  20793. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  20794. * @default null
  20795. * @see dragonBones.AnimationState#displayControl
  20796. * @see dragonBones.AnimationState#name
  20797. * @see dragonBones.AnimationState#group
  20798. * @version DragonBones 4.5
  20799. * @language zh_CN
  20800. */
  20801. displayController: string | null;
  20802. /**
  20803. * @private
  20804. */
  20805. protected _displayDirty: boolean;
  20806. /**
  20807. * @private
  20808. */
  20809. protected _zOrderDirty: boolean;
  20810. /**
  20811. * @private
  20812. */
  20813. protected _visibleDirty: boolean;
  20814. /**
  20815. * @private
  20816. */
  20817. protected _blendModeDirty: boolean;
  20818. /**
  20819. * @internal
  20820. * @private
  20821. */
  20822. _colorDirty: boolean;
  20823. /**
  20824. * @internal
  20825. * @private
  20826. */
  20827. _meshDirty: boolean;
  20828. /**
  20829. * @private
  20830. */
  20831. protected _transformDirty: boolean;
  20832. /**
  20833. * @private
  20834. */
  20835. protected _visible: boolean;
  20836. /**
  20837. * @private
  20838. */
  20839. protected _blendMode: BlendMode;
  20840. /**
  20841. * @private
  20842. */
  20843. protected _displayIndex: number;
  20844. /**
  20845. * @private
  20846. */
  20847. protected _animationDisplayIndex: number;
  20848. /**
  20849. * @internal
  20850. * @private
  20851. */
  20852. _zOrder: number;
  20853. /**
  20854. * @private
  20855. */
  20856. protected _cachedFrameIndex: number;
  20857. /**
  20858. * @internal
  20859. * @private
  20860. */
  20861. _pivotX: number;
  20862. /**
  20863. * @internal
  20864. * @private
  20865. */
  20866. _pivotY: number;
  20867. /**
  20868. * @private
  20869. */
  20870. protected readonly _localMatrix: Matrix;
  20871. /**
  20872. * @internal
  20873. * @private
  20874. */
  20875. readonly _colorTransform: ColorTransform;
  20876. /**
  20877. * @internal
  20878. * @private
  20879. */
  20880. readonly _deformVertices: Array<number>;
  20881. /**
  20882. * @private
  20883. */
  20884. readonly _displayDatas: Array<DisplayData | null>;
  20885. /**
  20886. * @private
  20887. */
  20888. protected readonly _displayList: Array<any | Armature>;
  20889. /**
  20890. * @private
  20891. */
  20892. protected readonly _meshBones: Array<Bone | null>;
  20893. /**
  20894. * @private
  20895. */
  20896. protected readonly _meshSlots: Array<Slot | null>;
  20897. /**
  20898. * @internal
  20899. * @private
  20900. */
  20901. _slotData: SlotData;
  20902. /**
  20903. * @private
  20904. */
  20905. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  20906. /**
  20907. * @private
  20908. */
  20909. protected _displayData: DisplayData | null;
  20910. /**
  20911. * @private
  20912. */
  20913. protected _textureData: TextureData | null;
  20914. /**
  20915. * @internal
  20916. * @private
  20917. */
  20918. _meshData: MeshDisplayData | null;
  20919. /**
  20920. * @private
  20921. */
  20922. protected _boundingBoxData: BoundingBoxData | null;
  20923. /**
  20924. * @private
  20925. */
  20926. protected _rawDisplay: any;
  20927. /**
  20928. * @private
  20929. */
  20930. protected _meshDisplay: any;
  20931. /**
  20932. * @private
  20933. */
  20934. protected _display: any;
  20935. /**
  20936. * @private
  20937. */
  20938. protected _childArmature: Armature | null;
  20939. /**
  20940. * @internal
  20941. * @private
  20942. */
  20943. _cachedFrameIndices: Array<number> | null;
  20944. /**
  20945. * @inheritDoc
  20946. */
  20947. protected _onClear(): void;
  20948. /**
  20949. * @private
  20950. */
  20951. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  20952. /**
  20953. * @private
  20954. */
  20955. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  20956. /**
  20957. * @private
  20958. */
  20959. protected abstract _onUpdateDisplay(): void;
  20960. /**
  20961. * @private
  20962. */
  20963. protected abstract _addDisplay(): void;
  20964. /**
  20965. * @private
  20966. */
  20967. protected abstract _replaceDisplay(value: any): void;
  20968. /**
  20969. * @private
  20970. */
  20971. protected abstract _removeDisplay(): void;
  20972. /**
  20973. * @private
  20974. */
  20975. protected abstract _updateZOrder(): void;
  20976. /**
  20977. * @private
  20978. */
  20979. abstract _updateVisible(): void;
  20980. /**
  20981. * @private
  20982. */
  20983. protected abstract _updateBlendMode(): void;
  20984. /**
  20985. * @private
  20986. */
  20987. protected abstract _updateColor(): void;
  20988. /**
  20989. * @private
  20990. */
  20991. protected abstract _updateFrame(): void;
  20992. /**
  20993. * @private
  20994. */
  20995. protected abstract _updateMesh(): void;
  20996. /**
  20997. * @internal
  20998. * @private
  20999. */
  21000. abstract _updateGlueMesh(): void;
  21001. /**
  21002. * @private
  21003. */
  21004. protected abstract _updateTransform(): void;
  21005. /**
  21006. * @private
  21007. */
  21008. protected abstract _identityTransform(): void;
  21009. /**
  21010. * @private
  21011. */
  21012. protected _getDefaultRawDisplayData(): DisplayData | null;
  21013. /**
  21014. * @private
  21015. */
  21016. protected _updateDisplayData(): void;
  21017. /**
  21018. * @private
  21019. */
  21020. protected _updateDisplay(): void;
  21021. /**
  21022. * @private
  21023. */
  21024. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  21025. /**
  21026. * @private
  21027. */
  21028. protected _isMeshBonesUpdate(): boolean;
  21029. /**
  21030. * @inheritDoc
  21031. */
  21032. _setArmature(value: Armature | null): void;
  21033. /**
  21034. * @internal
  21035. * @private
  21036. */
  21037. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  21038. /**
  21039. * @internal
  21040. * @private
  21041. */
  21042. _setZorder(value: number): boolean;
  21043. /**
  21044. * @internal
  21045. * @private
  21046. */
  21047. _setColor(value: ColorTransform): boolean;
  21048. /**
  21049. * @internal
  21050. * @private
  21051. */
  21052. _setDisplayList(value: Array<any> | null): boolean;
  21053. /**
  21054. * @internal
  21055. * @private
  21056. */
  21057. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  21058. /**
  21059. * @internal
  21060. * @private
  21061. */
  21062. update(cacheFrameIndex: number): void;
  21063. /**
  21064. * @private
  21065. */
  21066. updateTransformAndMatrix(): void;
  21067. /**
  21068. * @private
  21069. */
  21070. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  21071. /**
  21072. * - Check whether a specific point is inside a custom bounding box in the slot.
  21073. * The coordinate system of the point is the inner coordinate system of the armature.
  21074. * Custom bounding boxes need to be customized in Dragonbones Pro.
  21075. * @param x - The horizontal coordinate of the point.
  21076. * @param y - The vertical coordinate of the point.
  21077. * @version DragonBones 5.0
  21078. * @language en_US
  21079. */
  21080. /**
  21081. * - 检查特定点是否在插槽的自定义边界框内。
  21082. * 点的坐标系为骨架内坐标系。
  21083. * 自定义边界框需要在 DragonBones Pro 中自定义。
  21084. * @param x - 点的水平坐标。
  21085. * @param y - 点的垂直坐标。
  21086. * @version DragonBones 5.0
  21087. * @language zh_CN
  21088. */
  21089. containsPoint(x: number, y: number): boolean;
  21090. /**
  21091. * - Check whether a specific segment intersects a custom bounding box for the slot.
  21092. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  21093. * Custom bounding boxes need to be customized in Dragonbones Pro.
  21094. * @param xA - The horizontal coordinate of the beginning of the segment.
  21095. * @param yA - The vertical coordinate of the beginning of the segment.
  21096. * @param xB - The horizontal coordinate of the end point of the segment.
  21097. * @param yB - The vertical coordinate of the end point of the segment.
  21098. * @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)
  21099. * @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)
  21100. * @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)
  21101. * @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]
  21102. * @version DragonBones 5.0
  21103. * @language en_US
  21104. */
  21105. /**
  21106. * - 检查特定线段是否与插槽的自定义边界框相交。
  21107. * 线段和交点的坐标系均为骨架内坐标系。
  21108. * 自定义边界框需要在 DragonBones Pro 中自定义。
  21109. * @param xA - 线段起点的水平坐标。
  21110. * @param yA - 线段起点的垂直坐标。
  21111. * @param xB - 线段终点的水平坐标。
  21112. * @param yB - 线段终点的垂直坐标。
  21113. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  21114. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  21115. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  21116. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  21117. * @version DragonBones 5.0
  21118. * @language zh_CN
  21119. */
  21120. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  21121. x: number;
  21122. y: number;
  21123. } | null, intersectionPointB?: {
  21124. x: number;
  21125. y: number;
  21126. } | null, normalRadians?: {
  21127. x: number;
  21128. y: number;
  21129. } | null): number;
  21130. /**
  21131. * - Forces the slot to update the state of the display object in the next frame.
  21132. * @version DragonBones 4.5
  21133. * @language en_US
  21134. */
  21135. /**
  21136. * - 强制插槽在下一帧更新显示对象的状态。
  21137. * @version DragonBones 4.5
  21138. * @language zh_CN
  21139. */
  21140. invalidUpdate(): void;
  21141. /**
  21142. * - The visible of slot's display object.
  21143. * @default true
  21144. * @version DragonBones 5.6
  21145. * @language en_US
  21146. */
  21147. /**
  21148. * - 插槽的显示对象的可见。
  21149. * @default true
  21150. * @version DragonBones 5.6
  21151. * @language zh_CN
  21152. */
  21153. visible: boolean;
  21154. /**
  21155. * - The index of the display object displayed in the display list.
  21156. * @example
  21157. * <pre>
  21158. * let slot = armature.getSlot("weapon");
  21159. * slot.displayIndex = 3;
  21160. * slot.displayController = "none";
  21161. * </pre>
  21162. * @version DragonBones 4.5
  21163. * @language en_US
  21164. */
  21165. /**
  21166. * - 此时显示的显示对象在显示列表中的索引。
  21167. * @example
  21168. * <pre>
  21169. * let slot = armature.getSlot("weapon");
  21170. * slot.displayIndex = 3;
  21171. * slot.displayController = "none";
  21172. * </pre>
  21173. * @version DragonBones 4.5
  21174. * @language zh_CN
  21175. */
  21176. displayIndex: number;
  21177. /**
  21178. * - The slot name.
  21179. * @see dragonBones.SlotData#name
  21180. * @version DragonBones 3.0
  21181. * @language en_US
  21182. */
  21183. /**
  21184. * - 插槽名称。
  21185. * @see dragonBones.SlotData#name
  21186. * @version DragonBones 3.0
  21187. * @language zh_CN
  21188. */
  21189. readonly name: string;
  21190. /**
  21191. * - Contains a display list of display objects or child armatures.
  21192. * @version DragonBones 3.0
  21193. * @language en_US
  21194. */
  21195. /**
  21196. * - 包含显示对象或子骨架的显示列表。
  21197. * @version DragonBones 3.0
  21198. * @language zh_CN
  21199. */
  21200. displayList: Array<any>;
  21201. /**
  21202. * - The slot data.
  21203. * @see dragonBones.SlotData
  21204. * @version DragonBones 4.5
  21205. * @language en_US
  21206. */
  21207. /**
  21208. * - 插槽数据。
  21209. * @see dragonBones.SlotData
  21210. * @version DragonBones 4.5
  21211. * @language zh_CN
  21212. */
  21213. readonly slotData: SlotData;
  21214. /**
  21215. * @private
  21216. */
  21217. rawDisplayDatas: Array<DisplayData | null> | null;
  21218. /**
  21219. * - The custom bounding box data for the slot at current time.
  21220. * @version DragonBones 5.0
  21221. * @language en_US
  21222. */
  21223. /**
  21224. * - 插槽此时的自定义包围盒数据。
  21225. * @version DragonBones 5.0
  21226. * @language zh_CN
  21227. */
  21228. readonly boundingBoxData: BoundingBoxData | null;
  21229. /**
  21230. * @private
  21231. */
  21232. readonly rawDisplay: any;
  21233. /**
  21234. * @private
  21235. */
  21236. readonly meshDisplay: any;
  21237. /**
  21238. * - The display object that the slot displays at this time.
  21239. * @example
  21240. * <pre>
  21241. * let slot = armature.getSlot("text");
  21242. * slot.display = new yourEngine.TextField();
  21243. * </pre>
  21244. * @version DragonBones 3.0
  21245. * @language en_US
  21246. */
  21247. /**
  21248. * - 插槽此时显示的显示对象。
  21249. * @example
  21250. * <pre>
  21251. * let slot = armature.getSlot("text");
  21252. * slot.display = new yourEngine.TextField();
  21253. * </pre>
  21254. * @version DragonBones 3.0
  21255. * @language zh_CN
  21256. */
  21257. display: any;
  21258. /**
  21259. * - The child armature that the slot displayed at current time.
  21260. * @example
  21261. * <pre>
  21262. * let slot = armature.getSlot("weapon");
  21263. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  21264. * </pre>
  21265. * @version DragonBones 3.0
  21266. * @language en_US
  21267. */
  21268. /**
  21269. * - 插槽此时显示的子骨架。
  21270. * @example
  21271. * <pre>
  21272. * let slot = armature.getSlot("weapon");
  21273. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  21274. * </pre>
  21275. * @version DragonBones 3.0
  21276. * @language zh_CN
  21277. */
  21278. childArmature: Armature | null;
  21279. /**
  21280. * - Deprecated, please refer to {@link #display}.
  21281. * @deprecated
  21282. * @language en_US
  21283. */
  21284. /**
  21285. * - 已废弃,请参考 {@link #display}。
  21286. * @deprecated
  21287. * @language zh_CN
  21288. */
  21289. getDisplay(): any;
  21290. /**
  21291. * - Deprecated, please refer to {@link #display}.
  21292. * @deprecated
  21293. * @language en_US
  21294. */
  21295. /**
  21296. * - 已废弃,请参考 {@link #display}。
  21297. * @deprecated
  21298. * @language zh_CN
  21299. */
  21300. setDisplay(value: any): void;
  21301. }
  21302. }
  21303. /**
  21304. * The MIT License (MIT)
  21305. *
  21306. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21307. *
  21308. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21309. * this software and associated documentation files (the "Software"), to deal in
  21310. * the Software without restriction, including without limitation the rights to
  21311. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21312. * the Software, and to permit persons to whom the Software is furnished to do so,
  21313. * subject to the following conditions:
  21314. *
  21315. * The above copyright notice and this permission notice shall be included in all
  21316. * copies or substantial portions of the Software.
  21317. *
  21318. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21319. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21320. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21321. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21322. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21323. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21324. */
  21325. declare namespace dragonBones {
  21326. /**
  21327. * @internal
  21328. * @private
  21329. */
  21330. abstract class Constraint extends BaseObject {
  21331. protected static readonly _helpMatrix: Matrix;
  21332. protected static readonly _helpTransform: Transform;
  21333. protected static readonly _helpPoint: Point;
  21334. /**
  21335. * - For timeline state.
  21336. * @internal
  21337. */
  21338. _constraintData: ConstraintData;
  21339. protected _armature: Armature;
  21340. /**
  21341. * - For sort bones.
  21342. * @internal
  21343. */
  21344. _target: Bone;
  21345. /**
  21346. * - For sort bones.
  21347. * @internal
  21348. */
  21349. _root: Bone;
  21350. protected _bone: Bone | null;
  21351. protected _onClear(): void;
  21352. abstract init(constraintData: ConstraintData, armature: Armature): void;
  21353. abstract update(): void;
  21354. abstract invalidUpdate(): void;
  21355. readonly name: string;
  21356. }
  21357. /**
  21358. * @internal
  21359. * @private
  21360. */
  21361. class IKConstraint extends Constraint {
  21362. static toString(): string;
  21363. private _scaleEnabled;
  21364. /**
  21365. * - For timeline state.
  21366. * @internal
  21367. */
  21368. _bendPositive: boolean;
  21369. /**
  21370. * - For timeline state.
  21371. * @internal
  21372. */
  21373. _weight: number;
  21374. protected _onClear(): void;
  21375. private _computeA();
  21376. private _computeB();
  21377. init(constraintData: ConstraintData, armature: Armature): void;
  21378. update(): void;
  21379. invalidUpdate(): void;
  21380. }
  21381. }
  21382. /**
  21383. * The MIT License (MIT)
  21384. *
  21385. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21386. *
  21387. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21388. * this software and associated documentation files (the "Software"), to deal in
  21389. * the Software without restriction, including without limitation the rights to
  21390. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21391. * the Software, and to permit persons to whom the Software is furnished to do so,
  21392. * subject to the following conditions:
  21393. *
  21394. * The above copyright notice and this permission notice shall be included in all
  21395. * copies or substantial portions of the Software.
  21396. *
  21397. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21398. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21399. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21400. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21401. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21402. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21403. */
  21404. declare namespace dragonBones {
  21405. /**
  21406. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  21407. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  21408. * @see dragonBones.WorldClock
  21409. * @see dragonBones.Armature
  21410. * @version DragonBones 3.0
  21411. * @language en_US
  21412. */
  21413. /**
  21414. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  21415. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  21416. * @see dragonBones.WorldClock
  21417. * @see dragonBones.Armature
  21418. * @version DragonBones 3.0
  21419. * @language zh_CN
  21420. */
  21421. interface IAnimatable {
  21422. /**
  21423. * - Advance time.
  21424. * @param passedTime - Passed time. (In seconds)
  21425. * @version DragonBones 3.0
  21426. * @language en_US
  21427. */
  21428. /**
  21429. * - 更新时间。
  21430. * @param passedTime - 前进的时间。 (以秒为单位)
  21431. * @version DragonBones 3.0
  21432. * @language zh_CN
  21433. */
  21434. advanceTime(passedTime: number): void;
  21435. /**
  21436. * - The Wordclock instance to which the current belongs.
  21437. * @example
  21438. * <pre>
  21439. * armature.clock = factory.clock; // Add armature to clock.
  21440. * armature.clock = null; // Remove armature from clock.
  21441. * </pre>
  21442. * @version DragonBones 5.0
  21443. * @language en_US
  21444. */
  21445. /**
  21446. * - 当前所属的 WordClock 实例。
  21447. * @example
  21448. * <pre>
  21449. * armature.clock = factory.clock; // 将骨架添加到时钟。
  21450. * armature.clock = null; // 将骨架从时钟移除。
  21451. * </pre>
  21452. * @version DragonBones 5.0
  21453. * @language zh_CN
  21454. */
  21455. clock: WorldClock | null;
  21456. }
  21457. }
  21458. /**
  21459. * The MIT License (MIT)
  21460. *
  21461. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21462. *
  21463. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21464. * this software and associated documentation files (the "Software"), to deal in
  21465. * the Software without restriction, including without limitation the rights to
  21466. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21467. * the Software, and to permit persons to whom the Software is furnished to do so,
  21468. * subject to the following conditions:
  21469. *
  21470. * The above copyright notice and this permission notice shall be included in all
  21471. * copies or substantial portions of the Software.
  21472. *
  21473. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21474. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21475. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21476. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21477. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21478. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21479. */
  21480. declare namespace dragonBones {
  21481. /**
  21482. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  21483. * @see dragonBones.IAnimateble
  21484. * @see dragonBones.Armature
  21485. * @version DragonBones 3.0
  21486. * @language en_US
  21487. */
  21488. /**
  21489. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  21490. * @see dragonBones.IAnimateble
  21491. * @see dragonBones.Armature
  21492. * @version DragonBones 3.0
  21493. * @language zh_CN
  21494. */
  21495. class WorldClock implements IAnimatable {
  21496. /**
  21497. * - Current time. (In seconds)
  21498. * @version DragonBones 3.0
  21499. * @language en_US
  21500. */
  21501. /**
  21502. * - 当前的时间。 (以秒为单位)
  21503. * @version DragonBones 3.0
  21504. * @language zh_CN
  21505. */
  21506. time: number;
  21507. /**
  21508. * - The play speed, used to control animation speed-shift play.
  21509. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  21510. * @default 1.0
  21511. * @version DragonBones 3.0
  21512. * @language en_US
  21513. */
  21514. /**
  21515. * - 播放速度,用于控制动画变速播放。
  21516. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  21517. * @default 1.0
  21518. * @version DragonBones 3.0
  21519. * @language zh_CN
  21520. */
  21521. timeScale: number;
  21522. private readonly _animatebles;
  21523. private _clock;
  21524. /**
  21525. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  21526. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  21527. * @version DragonBones 3.0
  21528. * @language en_US
  21529. */
  21530. /**
  21531. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  21532. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  21533. * @version DragonBones 3.0
  21534. * @language zh_CN
  21535. */
  21536. constructor(time?: number);
  21537. /**
  21538. * - Advance time for all IAnimatable instances.
  21539. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  21540. * @version DragonBones 3.0
  21541. * @language en_US
  21542. */
  21543. /**
  21544. * - 为所有的 IAnimatable 实例更新时间。
  21545. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  21546. * @version DragonBones 3.0
  21547. * @language zh_CN
  21548. */
  21549. advanceTime(passedTime: number): void;
  21550. /**
  21551. * - Check whether contains a specific instance of IAnimatable.
  21552. * @param value - The IAnimatable instance.
  21553. * @version DragonBones 3.0
  21554. * @language en_US
  21555. */
  21556. /**
  21557. * - 检查是否包含特定的 IAnimatable 实例。
  21558. * @param value - IAnimatable 实例。
  21559. * @version DragonBones 3.0
  21560. * @language zh_CN
  21561. */
  21562. contains(value: IAnimatable): boolean;
  21563. /**
  21564. * - Add IAnimatable instance.
  21565. * @param value - The IAnimatable instance.
  21566. * @version DragonBones 3.0
  21567. * @language en_US
  21568. */
  21569. /**
  21570. * - 添加 IAnimatable 实例。
  21571. * @param value - IAnimatable 实例。
  21572. * @version DragonBones 3.0
  21573. * @language zh_CN
  21574. */
  21575. add(value: IAnimatable): void;
  21576. /**
  21577. * - Removes a specified IAnimatable instance.
  21578. * @param value - The IAnimatable instance.
  21579. * @version DragonBones 3.0
  21580. * @language en_US
  21581. */
  21582. /**
  21583. * - 移除特定的 IAnimatable 实例。
  21584. * @param value - IAnimatable 实例。
  21585. * @version DragonBones 3.0
  21586. * @language zh_CN
  21587. */
  21588. remove(value: IAnimatable): void;
  21589. /**
  21590. * - Clear all IAnimatable instances.
  21591. * @version DragonBones 3.0
  21592. * @language en_US
  21593. */
  21594. /**
  21595. * - 清除所有的 IAnimatable 实例。
  21596. * @version DragonBones 3.0
  21597. * @language zh_CN
  21598. */
  21599. clear(): void;
  21600. /**
  21601. * @inheritDoc
  21602. */
  21603. clock: WorldClock | null;
  21604. /**
  21605. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  21606. * @deprecated
  21607. * @language en_US
  21608. */
  21609. /**
  21610. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  21611. * @deprecated
  21612. * @language zh_CN
  21613. */
  21614. static readonly clock: WorldClock;
  21615. }
  21616. }
  21617. /**
  21618. * The MIT License (MIT)
  21619. *
  21620. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21621. *
  21622. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21623. * this software and associated documentation files (the "Software"), to deal in
  21624. * the Software without restriction, including without limitation the rights to
  21625. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21626. * the Software, and to permit persons to whom the Software is furnished to do so,
  21627. * subject to the following conditions:
  21628. *
  21629. * The above copyright notice and this permission notice shall be included in all
  21630. * copies or substantial portions of the Software.
  21631. *
  21632. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21633. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21634. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21635. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21636. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21637. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21638. */
  21639. declare namespace dragonBones {
  21640. /**
  21641. * - The animation player is used to play the animation data and manage the animation states.
  21642. * @see dragonBones.AnimationData
  21643. * @see dragonBones.AnimationState
  21644. * @version DragonBones 3.0
  21645. * @language en_US
  21646. */
  21647. /**
  21648. * - 动画播放器用来播放动画数据和管理动画状态。
  21649. * @see dragonBones.AnimationData
  21650. * @see dragonBones.AnimationState
  21651. * @version DragonBones 3.0
  21652. * @language zh_CN
  21653. */
  21654. class Animation extends BaseObject {
  21655. static toString(): string;
  21656. /**
  21657. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  21658. * @default 1.0
  21659. * @version DragonBones 3.0
  21660. * @language en_US
  21661. */
  21662. /**
  21663. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  21664. * @default 1.0
  21665. * @version DragonBones 3.0
  21666. * @language zh_CN
  21667. */
  21668. timeScale: number;
  21669. private _lockUpdate;
  21670. private _animationDirty;
  21671. private _inheritTimeScale;
  21672. private readonly _animationNames;
  21673. private readonly _animationStates;
  21674. private readonly _animations;
  21675. private _armature;
  21676. private _animationConfig;
  21677. private _lastAnimationState;
  21678. /**
  21679. * @private
  21680. */
  21681. protected _onClear(): void;
  21682. private _fadeOut(animationConfig);
  21683. /**
  21684. * @internal
  21685. * @private
  21686. */
  21687. init(armature: Armature): void;
  21688. /**
  21689. * @internal
  21690. * @private
  21691. */
  21692. advanceTime(passedTime: number): void;
  21693. /**
  21694. * - Clear all animations states.
  21695. * @see dragonBones.AnimationState
  21696. * @version DragonBones 4.5
  21697. * @language en_US
  21698. */
  21699. /**
  21700. * - 清除所有的动画状态。
  21701. * @see dragonBones.AnimationState
  21702. * @version DragonBones 4.5
  21703. * @language zh_CN
  21704. */
  21705. reset(): void;
  21706. /**
  21707. * - Pause a specific animation state.
  21708. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  21709. * @see dragonBones.AnimationState
  21710. * @version DragonBones 3.0
  21711. * @language en_US
  21712. */
  21713. /**
  21714. * - 暂停指定动画状态的播放。
  21715. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  21716. * @see dragonBones.AnimationState
  21717. * @version DragonBones 3.0
  21718. * @language zh_CN
  21719. */
  21720. stop(animationName?: string | null): void;
  21721. /**
  21722. * - Play animation with a specific animation config.
  21723. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  21724. * @param animationConfig - The animation config.
  21725. * @returns The playing animation state.
  21726. * @see dragonBones.AnimationConfig
  21727. * @beta
  21728. * @version DragonBones 5.0
  21729. * @language en_US
  21730. */
  21731. /**
  21732. * - 通过指定的动画配置来播放动画。
  21733. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  21734. * @param animationConfig - 动画配置。
  21735. * @returns 播放的动画状态。
  21736. * @see dragonBones.AnimationConfig
  21737. * @beta
  21738. * @version DragonBones 5.0
  21739. * @language zh_CN
  21740. */
  21741. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  21742. /**
  21743. * - Play a specific animation.
  21744. * @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)
  21745. * @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)
  21746. * @returns The playing animation state.
  21747. * @example
  21748. * <pre>
  21749. * armature.animation.play("walk");
  21750. * </pre>
  21751. * @version DragonBones 3.0
  21752. * @language en_US
  21753. */
  21754. /**
  21755. * - 播放指定动画。
  21756. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  21757. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21758. * @returns 播放的动画状态。
  21759. * @example
  21760. * <pre>
  21761. * armature.animation.play("walk");
  21762. * </pre>
  21763. * @version DragonBones 3.0
  21764. * @language zh_CN
  21765. */
  21766. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  21767. /**
  21768. * - Fade in a specific animation.
  21769. * @param animationName - The name of animation data.
  21770. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  21771. * @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)
  21772. * @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)
  21773. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  21774. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  21775. * @returns The playing animation state.
  21776. * @example
  21777. * <pre>
  21778. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  21779. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  21780. * </pre>
  21781. * @version DragonBones 4.5
  21782. * @language en_US
  21783. */
  21784. /**
  21785. * - 淡入播放指定的动画。
  21786. * @param animationName - 动画数据名称。
  21787. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  21788. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21789. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  21790. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  21791. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  21792. * @returns 播放的动画状态。
  21793. * @example
  21794. * <pre>
  21795. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  21796. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  21797. * </pre>
  21798. * @version DragonBones 4.5
  21799. * @language zh_CN
  21800. */
  21801. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
  21802. /**
  21803. * - Play a specific animation from the specific time.
  21804. * @param animationName - The name of animation data.
  21805. * @param time - The start time point of playing. (In seconds)
  21806. * @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)
  21807. * @returns The played animation state.
  21808. * @version DragonBones 4.5
  21809. * @language en_US
  21810. */
  21811. /**
  21812. * - 从指定时间开始播放指定的动画。
  21813. * @param animationName - 动画数据名称。
  21814. * @param time - 播放开始的时间。 (以秒为单位)
  21815. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21816. * @returns 播放的动画状态。
  21817. * @version DragonBones 4.5
  21818. * @language zh_CN
  21819. */
  21820. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  21821. /**
  21822. * - Play a specific animation from the specific frame.
  21823. * @param animationName - The name of animation data.
  21824. * @param frame - The start frame of playing.
  21825. * @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)
  21826. * @returns The played animation state.
  21827. * @version DragonBones 4.5
  21828. * @language en_US
  21829. */
  21830. /**
  21831. * - 从指定帧开始播放指定的动画。
  21832. * @param animationName - 动画数据名称。
  21833. * @param frame - 播放开始的帧数。
  21834. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21835. * @returns 播放的动画状态。
  21836. * @version DragonBones 4.5
  21837. * @language zh_CN
  21838. */
  21839. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  21840. /**
  21841. * - Play a specific animation from the specific progress.
  21842. * @param animationName - The name of animation data.
  21843. * @param progress - The start progress value of playing.
  21844. * @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)
  21845. * @returns The played animation state.
  21846. * @version DragonBones 4.5
  21847. * @language en_US
  21848. */
  21849. /**
  21850. * - 从指定进度开始播放指定的动画。
  21851. * @param animationName - 动画数据名称。
  21852. * @param progress - 开始播放的进度。
  21853. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21854. * @returns 播放的动画状态。
  21855. * @version DragonBones 4.5
  21856. * @language zh_CN
  21857. */
  21858. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  21859. /**
  21860. * - Stop a specific animation at the specific time.
  21861. * @param animationName - The name of animation data.
  21862. * @param time - The stop time. (In seconds)
  21863. * @returns The played animation state.
  21864. * @version DragonBones 4.5
  21865. * @language en_US
  21866. */
  21867. /**
  21868. * - 在指定时间停止指定动画播放
  21869. * @param animationName - 动画数据名称。
  21870. * @param time - 停止的时间。 (以秒为单位)
  21871. * @returns 播放的动画状态。
  21872. * @version DragonBones 4.5
  21873. * @language zh_CN
  21874. */
  21875. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  21876. /**
  21877. * - Stop a specific animation at the specific frame.
  21878. * @param animationName - The name of animation data.
  21879. * @param frame - The stop frame.
  21880. * @returns The played animation state.
  21881. * @version DragonBones 4.5
  21882. * @language en_US
  21883. */
  21884. /**
  21885. * - 在指定帧停止指定动画的播放
  21886. * @param animationName - 动画数据名称。
  21887. * @param frame - 停止的帧数。
  21888. * @returns 播放的动画状态。
  21889. * @version DragonBones 4.5
  21890. * @language zh_CN
  21891. */
  21892. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  21893. /**
  21894. * - Stop a specific animation at the specific progress.
  21895. * @param animationName - The name of animation data.
  21896. * @param progress - The stop progress value.
  21897. * @returns The played animation state.
  21898. * @version DragonBones 4.5
  21899. * @language en_US
  21900. */
  21901. /**
  21902. * - 在指定的进度停止指定的动画播放。
  21903. * @param animationName - 动画数据名称。
  21904. * @param progress - 停止进度。
  21905. * @returns 播放的动画状态。
  21906. * @version DragonBones 4.5
  21907. * @language zh_CN
  21908. */
  21909. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  21910. /**
  21911. * - Get a specific animation state.
  21912. * @param animationName - The name of animation state.
  21913. * @example
  21914. * <pre>
  21915. * armature.animation.play("walk");
  21916. * let walkState = armature.animation.getState("walk");
  21917. * walkState.timeScale = 0.5;
  21918. * </pre>
  21919. * @version DragonBones 3.0
  21920. * @language en_US
  21921. */
  21922. /**
  21923. * - 获取指定的动画状态
  21924. * @param animationName - 动画状态名称。
  21925. * @example
  21926. * <pre>
  21927. * armature.animation.play("walk");
  21928. * let walkState = armature.animation.getState("walk");
  21929. * walkState.timeScale = 0.5;
  21930. * </pre>
  21931. * @version DragonBones 3.0
  21932. * @language zh_CN
  21933. */
  21934. getState(animationName: string): AnimationState | null;
  21935. /**
  21936. * - Check whether a specific animation data is included.
  21937. * @param animationName - The name of animation data.
  21938. * @see dragonBones.AnimationData
  21939. * @version DragonBones 3.0
  21940. * @language en_US
  21941. */
  21942. /**
  21943. * - 检查是否包含指定的动画数据
  21944. * @param animationName - 动画数据名称。
  21945. * @see dragonBones.AnimationData
  21946. * @version DragonBones 3.0
  21947. * @language zh_CN
  21948. */
  21949. hasAnimation(animationName: string): boolean;
  21950. /**
  21951. * - Get all the animation states.
  21952. * @version DragonBones 5.1
  21953. * @language en_US
  21954. */
  21955. /**
  21956. * - 获取所有的动画状态
  21957. * @version DragonBones 5.1
  21958. * @language zh_CN
  21959. */
  21960. getStates(): Array<AnimationState>;
  21961. /**
  21962. * - Check whether there is an animation state is playing
  21963. * @see dragonBones.AnimationState
  21964. * @version DragonBones 3.0
  21965. * @language en_US
  21966. */
  21967. /**
  21968. * - 检查是否有动画状态正在播放
  21969. * @see dragonBones.AnimationState
  21970. * @version DragonBones 3.0
  21971. * @language zh_CN
  21972. */
  21973. readonly isPlaying: boolean;
  21974. /**
  21975. * - Check whether all the animation states' playing were finished.
  21976. * @see dragonBones.AnimationState
  21977. * @version DragonBones 3.0
  21978. * @language en_US
  21979. */
  21980. /**
  21981. * - 检查是否所有的动画状态均已播放完毕。
  21982. * @see dragonBones.AnimationState
  21983. * @version DragonBones 3.0
  21984. * @language zh_CN
  21985. */
  21986. readonly isCompleted: boolean;
  21987. /**
  21988. * - The name of the last playing animation state.
  21989. * @see #lastAnimationState
  21990. * @version DragonBones 3.0
  21991. * @language en_US
  21992. */
  21993. /**
  21994. * - 上一个播放的动画状态名称
  21995. * @see #lastAnimationState
  21996. * @version DragonBones 3.0
  21997. * @language zh_CN
  21998. */
  21999. readonly lastAnimationName: string;
  22000. /**
  22001. * - The name of all animation data
  22002. * @version DragonBones 4.5
  22003. * @language en_US
  22004. */
  22005. /**
  22006. * - 所有动画数据的名称
  22007. * @version DragonBones 4.5
  22008. * @language zh_CN
  22009. */
  22010. readonly animationNames: Array<string>;
  22011. /**
  22012. * - All animation data.
  22013. * @version DragonBones 4.5
  22014. * @language en_US
  22015. */
  22016. /**
  22017. * - 所有的动画数据。
  22018. * @version DragonBones 4.5
  22019. * @language zh_CN
  22020. */
  22021. animations: Map<AnimationData>;
  22022. /**
  22023. * - An AnimationConfig instance that can be used quickly.
  22024. * @see dragonBones.AnimationConfig
  22025. * @version DragonBones 5.0
  22026. * @language en_US
  22027. */
  22028. /**
  22029. * - 一个可以快速使用的动画配置实例。
  22030. * @see dragonBones.AnimationConfig
  22031. * @version DragonBones 5.0
  22032. * @language zh_CN
  22033. */
  22034. readonly animationConfig: AnimationConfig;
  22035. /**
  22036. * - The last playing animation state
  22037. * @see dragonBones.AnimationState
  22038. * @version DragonBones 3.0
  22039. * @language en_US
  22040. */
  22041. /**
  22042. * - 上一个播放的动画状态
  22043. * @see dragonBones.AnimationState
  22044. * @version DragonBones 3.0
  22045. * @language zh_CN
  22046. */
  22047. readonly lastAnimationState: AnimationState | null;
  22048. /**
  22049. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  22050. * @deprecated
  22051. * @language en_US
  22052. */
  22053. /**
  22054. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  22055. * @deprecated
  22056. * @language zh_CN
  22057. */
  22058. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  22059. /**
  22060. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  22061. * @deprecated
  22062. * @language en_US
  22063. */
  22064. /**
  22065. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  22066. * @deprecated
  22067. * @language zh_CN
  22068. */
  22069. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  22070. /**
  22071. * - Deprecated, please refer to {@link #animationNames}.
  22072. * @deprecated
  22073. * @language en_US
  22074. */
  22075. /**
  22076. * - 已废弃,请参考 {@link #animationNames}。
  22077. * @deprecated
  22078. * @language zh_CN
  22079. */
  22080. readonly animationList: Array<string>;
  22081. /**
  22082. * - Deprecated, please refer to {@link #animationNames}.
  22083. * @deprecated
  22084. * @language en_US
  22085. */
  22086. /**
  22087. * - 已废弃,请参考 {@link #animationNames}。
  22088. * @deprecated
  22089. * @language zh_CN
  22090. */
  22091. readonly animationDataList: Array<AnimationData>;
  22092. }
  22093. }
  22094. /**
  22095. * The MIT License (MIT)
  22096. *
  22097. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22098. *
  22099. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22100. * this software and associated documentation files (the "Software"), to deal in
  22101. * the Software without restriction, including without limitation the rights to
  22102. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22103. * the Software, and to permit persons to whom the Software is furnished to do so,
  22104. * subject to the following conditions:
  22105. *
  22106. * The above copyright notice and this permission notice shall be included in all
  22107. * copies or substantial portions of the Software.
  22108. *
  22109. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22110. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22111. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22112. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22113. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22114. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22115. */
  22116. declare namespace dragonBones {
  22117. /**
  22118. * - The animation state is generated when the animation data is played.
  22119. * @see dragonBones.Animation
  22120. * @see dragonBones.AnimationData
  22121. * @version DragonBones 3.0
  22122. * @language en_US
  22123. */
  22124. /**
  22125. * - 动画状态由播放动画数据时产生。
  22126. * @see dragonBones.Animation
  22127. * @see dragonBones.AnimationData
  22128. * @version DragonBones 3.0
  22129. * @language zh_CN
  22130. */
  22131. class AnimationState extends BaseObject {
  22132. static toString(): string;
  22133. /**
  22134. * @private
  22135. */
  22136. actionEnabled: boolean;
  22137. /**
  22138. * @private
  22139. */
  22140. additiveBlending: boolean;
  22141. /**
  22142. * - Whether the animation state has control over the display object properties of the slots.
  22143. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  22144. * especially if other animation state are controlling the display object properties of the slots.
  22145. * @default true
  22146. * @version DragonBones 5.0
  22147. * @language en_US
  22148. */
  22149. /**
  22150. * - 动画状态是否对插槽的显示对象属性有控制权。
  22151. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  22152. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  22153. * @default true
  22154. * @version DragonBones 5.0
  22155. * @language zh_CN
  22156. */
  22157. displayControl: boolean;
  22158. /**
  22159. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  22160. * This property should usually be set to false when blend multiple animation states.
  22161. * @default true
  22162. * @version DragonBones 5.1
  22163. * @language en_US
  22164. */
  22165. /**
  22166. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  22167. * 通常在混合多个动画状态时应该将该属性设置为 false。
  22168. * @default true
  22169. * @version DragonBones 5.1
  22170. * @language zh_CN
  22171. */
  22172. resetToPose: boolean;
  22173. /**
  22174. * - The play times. [0: Loop play, [1~N]: Play N times]
  22175. * @version DragonBones 3.0
  22176. * @language en_US
  22177. */
  22178. /**
  22179. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  22180. * @version DragonBones 3.0
  22181. * @language zh_CN
  22182. */
  22183. playTimes: number;
  22184. /**
  22185. * - The blend layer.
  22186. * High layer animation state will get the blend weight first.
  22187. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  22188. * @readonly
  22189. * @version DragonBones 5.0
  22190. * @language en_US
  22191. */
  22192. /**
  22193. * - 混合图层。
  22194. * 图层高的动画状态会优先获取混合权重。
  22195. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  22196. * @readonly
  22197. * @version DragonBones 5.0
  22198. * @language zh_CN
  22199. */
  22200. layer: number;
  22201. /**
  22202. * - The play speed.
  22203. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  22204. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  22205. * @default 1.0
  22206. * @version DragonBones 3.0
  22207. * @language en_US
  22208. */
  22209. /**
  22210. * - 播放速度。
  22211. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  22212. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  22213. * @default 1.0
  22214. * @version DragonBones 3.0
  22215. * @language zh_CN
  22216. */
  22217. timeScale: number;
  22218. /**
  22219. * - The blend weight.
  22220. * @default 1.0
  22221. * @version DragonBones 5.0
  22222. * @language en_US
  22223. */
  22224. /**
  22225. * - 混合权重。
  22226. * @default 1.0
  22227. * @version DragonBones 5.0
  22228. * @language zh_CN
  22229. */
  22230. weight: number;
  22231. /**
  22232. * - The auto fade out time when the animation state play completed.
  22233. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  22234. * @default -1.0
  22235. * @version DragonBones 5.0
  22236. * @language en_US
  22237. */
  22238. /**
  22239. * - 动画状态播放完成后的自动淡出时间。
  22240. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  22241. * @default -1.0
  22242. * @version DragonBones 5.0
  22243. * @language zh_CN
  22244. */
  22245. autoFadeOutTime: number;
  22246. /**
  22247. * @private
  22248. */
  22249. fadeTotalTime: number;
  22250. /**
  22251. * - The name of the animation state. (Can be different from the name of the animation data)
  22252. * @readonly
  22253. * @version DragonBones 5.0
  22254. * @language en_US
  22255. */
  22256. /**
  22257. * - 动画状态名称。 (可以不同于动画数据)
  22258. * @readonly
  22259. * @version DragonBones 5.0
  22260. * @language zh_CN
  22261. */
  22262. name: string;
  22263. /**
  22264. * - The blend group name of the animation state.
  22265. * This property is typically used to specify the substitution of multiple animation states blend.
  22266. * @readonly
  22267. * @version DragonBones 5.0
  22268. * @language en_US
  22269. */
  22270. /**
  22271. * - 混合组名称。
  22272. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  22273. * @readonly
  22274. * @version DragonBones 5.0
  22275. * @language zh_CN
  22276. */
  22277. group: string;
  22278. private _timelineDirty;
  22279. /**
  22280. * - xx: Play Enabled, Fade Play Enabled
  22281. * @internal
  22282. * @private
  22283. */
  22284. _playheadState: number;
  22285. /**
  22286. * -1: Fade in, 0: Fade complete, 1: Fade out;
  22287. * @internal
  22288. * @private
  22289. */
  22290. _fadeState: number;
  22291. /**
  22292. * -1: Fade start, 0: Fading, 1: Fade complete;
  22293. * @internal
  22294. * @private
  22295. */
  22296. _subFadeState: number;
  22297. /**
  22298. * @internal
  22299. * @private
  22300. */
  22301. _position: number;
  22302. /**
  22303. * @internal
  22304. * @private
  22305. */
  22306. _duration: number;
  22307. private _fadeTime;
  22308. private _time;
  22309. /**
  22310. * @internal
  22311. * @private
  22312. */
  22313. _fadeProgress: number;
  22314. /**
  22315. * @internal
  22316. * @private
  22317. */
  22318. _weightResult: number;
  22319. /**
  22320. * @internal
  22321. * @private
  22322. */
  22323. readonly _blendState: BlendState;
  22324. private readonly _boneMask;
  22325. private readonly _boneTimelines;
  22326. private readonly _surfaceTimelines;
  22327. private readonly _slotTimelines;
  22328. private readonly _constraintTimelines;
  22329. private readonly _animationTimelines;
  22330. private readonly _poseTimelines;
  22331. private readonly _bonePoses;
  22332. /**
  22333. * @internal
  22334. * @private
  22335. */
  22336. _animationData: AnimationData;
  22337. private _armature;
  22338. /**
  22339. * @internal
  22340. * @private
  22341. */
  22342. _actionTimeline: ActionTimelineState;
  22343. private _zOrderTimeline;
  22344. /**
  22345. * @internal
  22346. * @private
  22347. */
  22348. _parent: AnimationState;
  22349. /**
  22350. * @private
  22351. */
  22352. protected _onClear(): void;
  22353. private _updateTimelines();
  22354. private _updateBoneAndSlotTimelines();
  22355. private _advanceFadeTime(passedTime);
  22356. /**
  22357. * @internal
  22358. * @private
  22359. */
  22360. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  22361. /**
  22362. * @internal
  22363. * @private
  22364. */
  22365. advanceTime(passedTime: number, cacheFrameRate: number): void;
  22366. /**
  22367. * - Continue play.
  22368. * @version DragonBones 3.0
  22369. * @language en_US
  22370. */
  22371. /**
  22372. * - 继续播放。
  22373. * @version DragonBones 3.0
  22374. * @language zh_CN
  22375. */
  22376. play(): void;
  22377. /**
  22378. * - Stop play.
  22379. * @version DragonBones 3.0
  22380. * @language en_US
  22381. */
  22382. /**
  22383. * - 暂停播放。
  22384. * @version DragonBones 3.0
  22385. * @language zh_CN
  22386. */
  22387. stop(): void;
  22388. /**
  22389. * - Fade out the animation state.
  22390. * @param fadeOutTime - The fade out time. (In seconds)
  22391. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  22392. * @version DragonBones 3.0
  22393. * @language en_US
  22394. */
  22395. /**
  22396. * - 淡出动画状态。
  22397. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  22398. * @param pausePlayhead - 淡出时是否暂停播放。
  22399. * @version DragonBones 3.0
  22400. * @language zh_CN
  22401. */
  22402. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  22403. /**
  22404. * - Check if a specific bone mask is included.
  22405. * @param name - The bone name.
  22406. * @version DragonBones 3.0
  22407. * @language en_US
  22408. */
  22409. /**
  22410. * - 检查是否包含特定骨骼遮罩。
  22411. * @param name - 骨骼名称。
  22412. * @version DragonBones 3.0
  22413. * @language zh_CN
  22414. */
  22415. containsBoneMask(name: string): boolean;
  22416. /**
  22417. * - Add a specific bone mask.
  22418. * @param name - The bone name.
  22419. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  22420. * @version DragonBones 3.0
  22421. * @language en_US
  22422. */
  22423. /**
  22424. * - 添加特定的骨骼遮罩。
  22425. * @param name - 骨骼名称。
  22426. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  22427. * @version DragonBones 3.0
  22428. * @language zh_CN
  22429. */
  22430. addBoneMask(name: string, recursive?: boolean): void;
  22431. /**
  22432. * - Remove the mask of a specific bone.
  22433. * @param name - The bone name.
  22434. * @param recursive - Whether to remove the bone's sub-bone mask.
  22435. * @version DragonBones 3.0
  22436. * @language en_US
  22437. */
  22438. /**
  22439. * - 删除特定骨骼的遮罩。
  22440. * @param name - 骨骼名称。
  22441. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  22442. * @version DragonBones 3.0
  22443. * @language zh_CN
  22444. */
  22445. removeBoneMask(name: string, recursive?: boolean): void;
  22446. /**
  22447. * - Remove all bone masks.
  22448. * @version DragonBones 3.0
  22449. * @language en_US
  22450. */
  22451. /**
  22452. * - 删除所有骨骼遮罩。
  22453. * @version DragonBones 3.0
  22454. * @language zh_CN
  22455. */
  22456. removeAllBoneMask(): void;
  22457. /**
  22458. * - Whether the animation state is fading in.
  22459. * @version DragonBones 5.1
  22460. * @language en_US
  22461. */
  22462. /**
  22463. * - 是否正在淡入。
  22464. * @version DragonBones 5.1
  22465. * @language zh_CN
  22466. */
  22467. readonly isFadeIn: boolean;
  22468. /**
  22469. * - Whether the animation state is fading out.
  22470. * @version DragonBones 5.1
  22471. * @language en_US
  22472. */
  22473. /**
  22474. * - 是否正在淡出。
  22475. * @version DragonBones 5.1
  22476. * @language zh_CN
  22477. */
  22478. readonly isFadeOut: boolean;
  22479. /**
  22480. * - Whether the animation state is fade completed.
  22481. * @version DragonBones 5.1
  22482. * @language en_US
  22483. */
  22484. /**
  22485. * - 是否淡入或淡出完毕。
  22486. * @version DragonBones 5.1
  22487. * @language zh_CN
  22488. */
  22489. readonly isFadeComplete: boolean;
  22490. /**
  22491. * - Whether the animation state is playing.
  22492. * @version DragonBones 3.0
  22493. * @language en_US
  22494. */
  22495. /**
  22496. * - 是否正在播放。
  22497. * @version DragonBones 3.0
  22498. * @language zh_CN
  22499. */
  22500. readonly isPlaying: boolean;
  22501. /**
  22502. * - Whether the animation state is play completed.
  22503. * @version DragonBones 3.0
  22504. * @language en_US
  22505. */
  22506. /**
  22507. * - 是否播放完毕。
  22508. * @version DragonBones 3.0
  22509. * @language zh_CN
  22510. */
  22511. readonly isCompleted: boolean;
  22512. /**
  22513. * - The times has been played.
  22514. * @version DragonBones 3.0
  22515. * @language en_US
  22516. */
  22517. /**
  22518. * - 已经循环播放的次数。
  22519. * @version DragonBones 3.0
  22520. * @language zh_CN
  22521. */
  22522. readonly currentPlayTimes: number;
  22523. /**
  22524. * - The total time. (In seconds)
  22525. * @version DragonBones 3.0
  22526. * @language en_US
  22527. */
  22528. /**
  22529. * - 总播放时间。 (以秒为单位)
  22530. * @version DragonBones 3.0
  22531. * @language zh_CN
  22532. */
  22533. readonly totalTime: number;
  22534. /**
  22535. * - The time is currently playing. (In seconds)
  22536. * @version DragonBones 3.0
  22537. * @language en_US
  22538. */
  22539. /**
  22540. * - 当前播放的时间。 (以秒为单位)
  22541. * @version DragonBones 3.0
  22542. * @language zh_CN
  22543. */
  22544. currentTime: number;
  22545. /**
  22546. * - The animation data.
  22547. * @see dragonBones.AnimationData
  22548. * @version DragonBones 3.0
  22549. * @language en_US
  22550. */
  22551. /**
  22552. * - 动画数据。
  22553. * @see dragonBones.AnimationData
  22554. * @version DragonBones 3.0
  22555. * @language zh_CN
  22556. */
  22557. readonly animationData: AnimationData;
  22558. }
  22559. /**
  22560. * @internal
  22561. * @private
  22562. */
  22563. class BonePose extends BaseObject {
  22564. static toString(): string;
  22565. readonly current: Transform;
  22566. readonly delta: Transform;
  22567. readonly result: Transform;
  22568. protected _onClear(): void;
  22569. }
  22570. /**
  22571. * @internal
  22572. * @private
  22573. */
  22574. class BlendState {
  22575. dirty: boolean;
  22576. layer: number;
  22577. leftWeight: number;
  22578. layerWeight: number;
  22579. blendWeight: number;
  22580. update(weight: number, layer: number): number;
  22581. clear(): void;
  22582. }
  22583. }
  22584. /**
  22585. * The MIT License (MIT)
  22586. *
  22587. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22588. *
  22589. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22590. * this software and associated documentation files (the "Software"), to deal in
  22591. * the Software without restriction, including without limitation the rights to
  22592. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22593. * the Software, and to permit persons to whom the Software is furnished to do so,
  22594. * subject to the following conditions:
  22595. *
  22596. * The above copyright notice and this permission notice shall be included in all
  22597. * copies or substantial portions of the Software.
  22598. *
  22599. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22600. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22601. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22602. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22603. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22604. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22605. */
  22606. declare namespace dragonBones {
  22607. /**
  22608. * @internal
  22609. * @private
  22610. */
  22611. const enum TweenState {
  22612. None = 0,
  22613. Once = 1,
  22614. Always = 2,
  22615. }
  22616. /**
  22617. * @internal
  22618. * @private
  22619. */
  22620. abstract class TimelineState extends BaseObject {
  22621. playState: number;
  22622. currentPlayTimes: number;
  22623. currentTime: number;
  22624. protected _tweenState: TweenState;
  22625. protected _frameRate: number;
  22626. protected _frameValueOffset: number;
  22627. protected _frameCount: number;
  22628. protected _frameOffset: number;
  22629. protected _frameIndex: number;
  22630. protected _frameRateR: number;
  22631. protected _position: number;
  22632. protected _duration: number;
  22633. protected _timeScale: number;
  22634. protected _timeOffset: number;
  22635. protected _dragonBonesData: DragonBonesData;
  22636. protected _animationData: AnimationData;
  22637. protected _timelineData: TimelineData | null;
  22638. protected _armature: Armature;
  22639. protected _animationState: AnimationState;
  22640. protected _actionTimeline: TimelineState;
  22641. protected _frameArray: Array<number> | Int16Array;
  22642. protected _frameIntArray: Array<number> | Int16Array;
  22643. protected _frameFloatArray: Array<number> | Int16Array;
  22644. protected _timelineArray: Array<number> | Uint16Array;
  22645. protected _frameIndices: Array<number>;
  22646. protected _onClear(): void;
  22647. protected abstract _onArriveAtFrame(): void;
  22648. protected abstract _onUpdateFrame(): void;
  22649. protected _setCurrentTime(passedTime: number): boolean;
  22650. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22651. fadeOut(): void;
  22652. update(passedTime: number): void;
  22653. }
  22654. /**
  22655. * @internal
  22656. * @private
  22657. */
  22658. abstract class TweenTimelineState extends TimelineState {
  22659. private static _getEasingValue(tweenType, progress, easing);
  22660. private static _getEasingCurveValue(progress, samples, count, offset);
  22661. protected _tweenType: TweenType;
  22662. protected _curveCount: number;
  22663. protected _framePosition: number;
  22664. protected _frameDurationR: number;
  22665. protected _tweenProgress: number;
  22666. protected _tweenEasing: number;
  22667. protected _onClear(): void;
  22668. protected _onArriveAtFrame(): void;
  22669. protected _onUpdateFrame(): void;
  22670. }
  22671. /**
  22672. * @internal
  22673. * @private
  22674. */
  22675. abstract class BoneTimelineState extends TweenTimelineState {
  22676. bone: Bone;
  22677. bonePose: BonePose;
  22678. protected _onClear(): void;
  22679. blend(state: number): void;
  22680. }
  22681. /**
  22682. * @internal
  22683. * @private
  22684. */
  22685. abstract class SlotTimelineState extends TweenTimelineState {
  22686. slot: Slot;
  22687. protected _onClear(): void;
  22688. }
  22689. /**
  22690. * @internal
  22691. * @private
  22692. */
  22693. abstract class ConstraintTimelineState extends TweenTimelineState {
  22694. constraint: Constraint;
  22695. protected _onClear(): void;
  22696. }
  22697. }
  22698. /**
  22699. * The MIT License (MIT)
  22700. *
  22701. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22702. *
  22703. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22704. * this software and associated documentation files (the "Software"), to deal in
  22705. * the Software without restriction, including without limitation the rights to
  22706. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22707. * the Software, and to permit persons to whom the Software is furnished to do so,
  22708. * subject to the following conditions:
  22709. *
  22710. * The above copyright notice and this permission notice shall be included in all
  22711. * copies or substantial portions of the Software.
  22712. *
  22713. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22714. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22715. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22716. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22717. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22718. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22719. */
  22720. declare namespace dragonBones {
  22721. /**
  22722. * @internal
  22723. * @private
  22724. */
  22725. class ActionTimelineState extends TimelineState {
  22726. static toString(): string;
  22727. private _onCrossFrame(frameIndex);
  22728. protected _onArriveAtFrame(): void;
  22729. protected _onUpdateFrame(): void;
  22730. update(passedTime: number): void;
  22731. setCurrentTime(value: number): void;
  22732. }
  22733. /**
  22734. * @internal
  22735. * @private
  22736. */
  22737. class ZOrderTimelineState extends TimelineState {
  22738. static toString(): string;
  22739. protected _onArriveAtFrame(): void;
  22740. protected _onUpdateFrame(): void;
  22741. }
  22742. /**
  22743. * @internal
  22744. * @private
  22745. */
  22746. class BoneAllTimelineState extends BoneTimelineState {
  22747. static toString(): string;
  22748. protected _onArriveAtFrame(): void;
  22749. protected _onUpdateFrame(): void;
  22750. fadeOut(): void;
  22751. }
  22752. /**
  22753. * @internal
  22754. * @private
  22755. */
  22756. class BoneTranslateTimelineState extends BoneTimelineState {
  22757. static toString(): string;
  22758. protected _onArriveAtFrame(): void;
  22759. protected _onUpdateFrame(): void;
  22760. }
  22761. /**
  22762. * @internal
  22763. * @private
  22764. */
  22765. class BoneRotateTimelineState extends BoneTimelineState {
  22766. static toString(): string;
  22767. protected _onArriveAtFrame(): void;
  22768. protected _onUpdateFrame(): void;
  22769. fadeOut(): void;
  22770. }
  22771. /**
  22772. * @internal
  22773. * @private
  22774. */
  22775. class BoneScaleTimelineState extends BoneTimelineState {
  22776. static toString(): string;
  22777. protected _onArriveAtFrame(): void;
  22778. protected _onUpdateFrame(): void;
  22779. }
  22780. /**
  22781. * @internal
  22782. * @private
  22783. */
  22784. class SurfaceTimelineState extends TweenTimelineState {
  22785. static toString(): string;
  22786. surface: Surface;
  22787. private _frameFloatOffset;
  22788. private _valueCount;
  22789. private _deformCount;
  22790. private _valueOffset;
  22791. private readonly _current;
  22792. private readonly _delta;
  22793. private readonly _result;
  22794. protected _onClear(): void;
  22795. protected _onArriveAtFrame(): void;
  22796. protected _onUpdateFrame(): void;
  22797. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22798. blend(state: number): void;
  22799. }
  22800. /**
  22801. * @internal
  22802. * @private
  22803. */
  22804. class SlotDislayTimelineState extends SlotTimelineState {
  22805. static toString(): string;
  22806. protected _onArriveAtFrame(): void;
  22807. }
  22808. /**
  22809. * @internal
  22810. * @private
  22811. */
  22812. class SlotColorTimelineState extends SlotTimelineState {
  22813. static toString(): string;
  22814. private _dirty;
  22815. private readonly _current;
  22816. private readonly _delta;
  22817. private readonly _result;
  22818. protected _onClear(): void;
  22819. protected _onArriveAtFrame(): void;
  22820. protected _onUpdateFrame(): void;
  22821. fadeOut(): void;
  22822. update(passedTime: number): void;
  22823. }
  22824. /**
  22825. * @internal
  22826. * @private
  22827. */
  22828. class SlotFFDTimelineState extends SlotTimelineState {
  22829. static toString(): string;
  22830. meshOffset: number;
  22831. private _dirty;
  22832. private _frameFloatOffset;
  22833. private _valueCount;
  22834. private _deformCount;
  22835. private _valueOffset;
  22836. private readonly _current;
  22837. private readonly _delta;
  22838. private readonly _result;
  22839. protected _onClear(): void;
  22840. protected _onArriveAtFrame(): void;
  22841. protected _onUpdateFrame(): void;
  22842. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22843. fadeOut(): void;
  22844. update(passedTime: number): void;
  22845. }
  22846. /**
  22847. * @internal
  22848. * @private
  22849. */
  22850. class IKConstraintTimelineState extends ConstraintTimelineState {
  22851. static toString(): string;
  22852. private _current;
  22853. private _delta;
  22854. protected _onClear(): void;
  22855. protected _onArriveAtFrame(): void;
  22856. protected _onUpdateFrame(): void;
  22857. }
  22858. /**
  22859. * @internal
  22860. * @private
  22861. */
  22862. class AnimationTimelineState extends TweenTimelineState {
  22863. static toString(): string;
  22864. animationState: AnimationState;
  22865. private readonly _floats;
  22866. protected _onClear(): void;
  22867. protected _onArriveAtFrame(): void;
  22868. protected _onUpdateFrame(): void;
  22869. blend(state: number): void;
  22870. }
  22871. }
  22872. /**
  22873. * The MIT License (MIT)
  22874. *
  22875. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22876. *
  22877. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22878. * this software and associated documentation files (the "Software"), to deal in
  22879. * the Software without restriction, including without limitation the rights to
  22880. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22881. * the Software, and to permit persons to whom the Software is furnished to do so,
  22882. * subject to the following conditions:
  22883. *
  22884. * The above copyright notice and this permission notice shall be included in all
  22885. * copies or substantial portions of the Software.
  22886. *
  22887. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22888. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22889. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22890. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22891. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22892. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22893. */
  22894. declare namespace dragonBones {
  22895. /**
  22896. * - The properties of the object carry basic information about an event,
  22897. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  22898. * @version DragonBones 4.5
  22899. * @language en_US
  22900. */
  22901. /**
  22902. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  22903. * @version DragonBones 4.5
  22904. * @language zh_CN
  22905. */
  22906. class EventObject extends BaseObject {
  22907. /**
  22908. * - Animation start play.
  22909. * @version DragonBones 4.5
  22910. * @language en_US
  22911. */
  22912. /**
  22913. * - 动画开始播放。
  22914. * @version DragonBones 4.5
  22915. * @language zh_CN
  22916. */
  22917. static readonly START: string;
  22918. /**
  22919. * - Animation loop play complete once.
  22920. * @version DragonBones 4.5
  22921. * @language en_US
  22922. */
  22923. /**
  22924. * - 动画循环播放完成一次。
  22925. * @version DragonBones 4.5
  22926. * @language zh_CN
  22927. */
  22928. static readonly LOOP_COMPLETE: string;
  22929. /**
  22930. * - Animation play complete.
  22931. * @version DragonBones 4.5
  22932. * @language en_US
  22933. */
  22934. /**
  22935. * - 动画播放完成。
  22936. * @version DragonBones 4.5
  22937. * @language zh_CN
  22938. */
  22939. static readonly COMPLETE: string;
  22940. /**
  22941. * - Animation fade in start.
  22942. * @version DragonBones 4.5
  22943. * @language en_US
  22944. */
  22945. /**
  22946. * - 动画淡入开始。
  22947. * @version DragonBones 4.5
  22948. * @language zh_CN
  22949. */
  22950. static readonly FADE_IN: string;
  22951. /**
  22952. * - Animation fade in complete.
  22953. * @version DragonBones 4.5
  22954. * @language en_US
  22955. */
  22956. /**
  22957. * - 动画淡入完成。
  22958. * @version DragonBones 4.5
  22959. * @language zh_CN
  22960. */
  22961. static readonly FADE_IN_COMPLETE: string;
  22962. /**
  22963. * - Animation fade out start.
  22964. * @version DragonBones 4.5
  22965. * @language en_US
  22966. */
  22967. /**
  22968. * - 动画淡出开始。
  22969. * @version DragonBones 4.5
  22970. * @language zh_CN
  22971. */
  22972. static readonly FADE_OUT: string;
  22973. /**
  22974. * - Animation fade out complete.
  22975. * @version DragonBones 4.5
  22976. * @language en_US
  22977. */
  22978. /**
  22979. * - 动画淡出完成。
  22980. * @version DragonBones 4.5
  22981. * @language zh_CN
  22982. */
  22983. static readonly FADE_OUT_COMPLETE: string;
  22984. /**
  22985. * - Animation frame event.
  22986. * @version DragonBones 4.5
  22987. * @language en_US
  22988. */
  22989. /**
  22990. * - 动画帧事件。
  22991. * @version DragonBones 4.5
  22992. * @language zh_CN
  22993. */
  22994. static readonly FRAME_EVENT: string;
  22995. /**
  22996. * - Animation frame sound event.
  22997. * @version DragonBones 4.5
  22998. * @language en_US
  22999. */
  23000. /**
  23001. * - 动画帧声音事件。
  23002. * @version DragonBones 4.5
  23003. * @language zh_CN
  23004. */
  23005. static readonly SOUND_EVENT: string;
  23006. static toString(): string;
  23007. /**
  23008. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  23009. * @version DragonBones 4.5
  23010. * @language en_US
  23011. */
  23012. /**
  23013. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  23014. * @version DragonBones 4.5
  23015. * @language zh_CN
  23016. */
  23017. time: number;
  23018. /**
  23019. * - The event type。
  23020. * @version DragonBones 4.5
  23021. * @language en_US
  23022. */
  23023. /**
  23024. * - 事件类型。
  23025. * @version DragonBones 4.5
  23026. * @language zh_CN
  23027. */
  23028. type: EventStringType;
  23029. /**
  23030. * - The event name. (The frame event name or the frame sound name)
  23031. * @version DragonBones 4.5
  23032. * @language en_US
  23033. */
  23034. /**
  23035. * - 事件名称。 (帧事件的名称或帧声音的名称)
  23036. * @version DragonBones 4.5
  23037. * @language zh_CN
  23038. */
  23039. name: string;
  23040. /**
  23041. * - The armature that dispatch the event.
  23042. * @see dragonBones.Armature
  23043. * @version DragonBones 4.5
  23044. * @language en_US
  23045. */
  23046. /**
  23047. * - 发出该事件的骨架。
  23048. * @see dragonBones.Armature
  23049. * @version DragonBones 4.5
  23050. * @language zh_CN
  23051. */
  23052. armature: Armature;
  23053. /**
  23054. * - The bone that dispatch the event.
  23055. * @see dragonBones.Bone
  23056. * @version DragonBones 4.5
  23057. * @language en_US
  23058. */
  23059. /**
  23060. * - 发出该事件的骨骼。
  23061. * @see dragonBones.Bone
  23062. * @version DragonBones 4.5
  23063. * @language zh_CN
  23064. */
  23065. bone: Bone | null;
  23066. /**
  23067. * - The slot that dispatch the event.
  23068. * @see dragonBones.Slot
  23069. * @version DragonBones 4.5
  23070. * @language en_US
  23071. */
  23072. /**
  23073. * - 发出该事件的插槽。
  23074. * @see dragonBones.Slot
  23075. * @version DragonBones 4.5
  23076. * @language zh_CN
  23077. */
  23078. slot: Slot | null;
  23079. /**
  23080. * - The animation state that dispatch the event.
  23081. * @see dragonBones.AnimationState
  23082. * @version DragonBones 4.5
  23083. * @language en_US
  23084. */
  23085. /**
  23086. * - 发出该事件的动画状态。
  23087. * @see dragonBones.AnimationState
  23088. * @version DragonBones 4.5
  23089. * @language zh_CN
  23090. */
  23091. animationState: AnimationState;
  23092. /**
  23093. * - The custom data.
  23094. * @see dragonBones.CustomData
  23095. * @version DragonBones 5.0
  23096. * @language en_US
  23097. */
  23098. /**
  23099. * - 自定义数据。
  23100. * @see dragonBones.CustomData
  23101. * @version DragonBones 5.0
  23102. * @language zh_CN
  23103. */
  23104. data: UserData | null;
  23105. /**
  23106. * @private
  23107. */
  23108. protected _onClear(): void;
  23109. }
  23110. }
  23111. /**
  23112. * The MIT License (MIT)
  23113. *
  23114. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23115. *
  23116. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23117. * this software and associated documentation files (the "Software"), to deal in
  23118. * the Software without restriction, including without limitation the rights to
  23119. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23120. * the Software, and to permit persons to whom the Software is furnished to do so,
  23121. * subject to the following conditions:
  23122. *
  23123. * The above copyright notice and this permission notice shall be included in all
  23124. * copies or substantial portions of the Software.
  23125. *
  23126. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23127. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23128. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23129. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23130. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23131. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23132. */
  23133. declare namespace dragonBones {
  23134. /**
  23135. * @private
  23136. */
  23137. type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  23138. /**
  23139. * - The event dispatcher interface.
  23140. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  23141. * @version DragonBones 4.5
  23142. * @language en_US
  23143. */
  23144. /**
  23145. * - 事件派发接口。
  23146. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  23147. * @version DragonBones 4.5
  23148. * @language zh_CN
  23149. */
  23150. interface IEventDispatcher {
  23151. /**
  23152. * - Checks whether the object has any listeners registered for a specific type of event。
  23153. * @param type - Event type.
  23154. * @version DragonBones 4.5
  23155. * @language en_US
  23156. */
  23157. /**
  23158. * - 检查是否为特定的事件类型注册了任何侦听器。
  23159. * @param type - 事件类型。
  23160. * @version DragonBones 4.5
  23161. * @language zh_CN
  23162. */
  23163. hasDBEventListener(type: EventStringType): boolean;
  23164. /**
  23165. * - Dispatches an event into the event flow.
  23166. * @param type - Event type.
  23167. * @param eventObject - Event object.
  23168. * @see dragonBones.EventObject
  23169. * @version DragonBones 4.5
  23170. * @language en_US
  23171. */
  23172. /**
  23173. * - 分派特定的事件到事件流中。
  23174. * @param type - 事件类型。
  23175. * @param eventObject - 事件数据。
  23176. * @see dragonBones.EventObject
  23177. * @version DragonBones 4.5
  23178. * @language zh_CN
  23179. */
  23180. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  23181. /**
  23182. * - Add an event listener object so that the listener receives notification of an event.
  23183. * @param type - Event type.
  23184. * @param listener - Event listener.
  23185. * @param thisObject - The listener function's "this".
  23186. * @version DragonBones 4.5
  23187. * @language en_US
  23188. */
  23189. /**
  23190. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  23191. * @param type - 事件类型。
  23192. * @param listener - 事件侦听器。
  23193. * @param thisObject - 侦听函数绑定的 this 对象。
  23194. * @version DragonBones 4.5
  23195. * @language zh_CN
  23196. */
  23197. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  23198. /**
  23199. * - Removes a listener from the object.
  23200. * @param type - Event type.
  23201. * @param listener - Event listener.
  23202. * @param thisObject - The listener function's "this".
  23203. * @version DragonBones 4.5
  23204. * @language en_US
  23205. */
  23206. /**
  23207. * - 删除特定事件类型的侦听器。
  23208. * @param type - 事件类型。
  23209. * @param listener - 事件侦听器。
  23210. * @param thisObject - 侦听函数绑定的 this 对象。
  23211. * @version DragonBones 4.5
  23212. * @language zh_CN
  23213. */
  23214. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  23215. /**
  23216. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  23217. * @deprecated
  23218. * @language en_US
  23219. */
  23220. /**
  23221. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  23222. * @deprecated
  23223. * @language zh_CN
  23224. */
  23225. hasEvent(type: EventStringType): boolean;
  23226. /**
  23227. * - Deprecated, please refer to {@link #addDBEventListener()}.
  23228. * @deprecated
  23229. * @language en_US
  23230. */
  23231. /**
  23232. * - 已废弃,请参考 {@link #addDBEventListener()}。
  23233. * @deprecated
  23234. * @language zh_CN
  23235. */
  23236. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  23237. /**
  23238. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  23239. * @deprecated
  23240. * @language en_US
  23241. */
  23242. /**
  23243. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  23244. * @deprecated
  23245. * @language zh_CN
  23246. */
  23247. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  23248. }
  23249. }
  23250. /**
  23251. * The MIT License (MIT)
  23252. *
  23253. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23254. *
  23255. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23256. * this software and associated documentation files (the "Software"), to deal in
  23257. * the Software without restriction, including without limitation the rights to
  23258. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23259. * the Software, and to permit persons to whom the Software is furnished to do so,
  23260. * subject to the following conditions:
  23261. *
  23262. * The above copyright notice and this permission notice shall be included in all
  23263. * copies or substantial portions of the Software.
  23264. *
  23265. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23266. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23267. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23268. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23269. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23270. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23271. */
  23272. declare namespace dragonBones {
  23273. /**
  23274. * @internal
  23275. * @private
  23276. */
  23277. abstract class DataParser {
  23278. protected static readonly DATA_VERSION_2_3: string;
  23279. protected static readonly DATA_VERSION_3_0: string;
  23280. protected static readonly DATA_VERSION_4_0: string;
  23281. protected static readonly DATA_VERSION_4_5: string;
  23282. protected static readonly DATA_VERSION_5_0: string;
  23283. protected static readonly DATA_VERSION_5_5: string;
  23284. protected static readonly DATA_VERSION: string;
  23285. protected static readonly DATA_VERSIONS: Array<string>;
  23286. protected static readonly TEXTURE_ATLAS: string;
  23287. protected static readonly SUB_TEXTURE: string;
  23288. protected static readonly FORMAT: string;
  23289. protected static readonly IMAGE_PATH: string;
  23290. protected static readonly WIDTH: string;
  23291. protected static readonly HEIGHT: string;
  23292. protected static readonly ROTATED: string;
  23293. protected static readonly FRAME_X: string;
  23294. protected static readonly FRAME_Y: string;
  23295. protected static readonly FRAME_WIDTH: string;
  23296. protected static readonly FRAME_HEIGHT: string;
  23297. protected static readonly DRADON_BONES: string;
  23298. protected static readonly USER_DATA: string;
  23299. protected static readonly ARMATURE: string;
  23300. protected static readonly BONE: string;
  23301. protected static readonly SURFACE: string;
  23302. protected static readonly SLOT: string;
  23303. protected static readonly CONSTRAINT: string;
  23304. protected static readonly IK: string;
  23305. protected static readonly SKIN: string;
  23306. protected static readonly DISPLAY: string;
  23307. protected static readonly ANIMATION: string;
  23308. protected static readonly Z_ORDER: string;
  23309. protected static readonly FFD: string;
  23310. protected static readonly FRAME: string;
  23311. protected static readonly TRANSLATE_FRAME: string;
  23312. protected static readonly ROTATE_FRAME: string;
  23313. protected static readonly SCALE_FRAME: string;
  23314. protected static readonly DISPLAY_FRAME: string;
  23315. protected static readonly COLOR_FRAME: string;
  23316. protected static readonly DEFAULT_ACTIONS: string;
  23317. protected static readonly ACTIONS: string;
  23318. protected static readonly EVENTS: string;
  23319. protected static readonly INTS: string;
  23320. protected static readonly FLOATS: string;
  23321. protected static readonly STRINGS: string;
  23322. protected static readonly CANVAS: string;
  23323. protected static readonly TRANSFORM: string;
  23324. protected static readonly PIVOT: string;
  23325. protected static readonly AABB: string;
  23326. protected static readonly COLOR: string;
  23327. protected static readonly VERSION: string;
  23328. protected static readonly COMPATIBLE_VERSION: string;
  23329. protected static readonly FRAME_RATE: string;
  23330. protected static readonly TYPE: string;
  23331. protected static readonly SUB_TYPE: string;
  23332. protected static readonly NAME: string;
  23333. protected static readonly PARENT: string;
  23334. protected static readonly TARGET: string;
  23335. protected static readonly STAGE: string;
  23336. protected static readonly SHARE: string;
  23337. protected static readonly PATH: string;
  23338. protected static readonly LENGTH: string;
  23339. protected static readonly DISPLAY_INDEX: string;
  23340. protected static readonly BLEND_MODE: string;
  23341. protected static readonly INHERIT_TRANSLATION: string;
  23342. protected static readonly INHERIT_ROTATION: string;
  23343. protected static readonly INHERIT_SCALE: string;
  23344. protected static readonly INHERIT_REFLECTION: string;
  23345. protected static readonly INHERIT_ANIMATION: string;
  23346. protected static readonly INHERIT_DEFORM: string;
  23347. protected static readonly SEGMENT_X: string;
  23348. protected static readonly SEGMENT_Y: string;
  23349. protected static readonly BEND_POSITIVE: string;
  23350. protected static readonly CHAIN: string;
  23351. protected static readonly WEIGHT: string;
  23352. protected static readonly FADE_IN_TIME: string;
  23353. protected static readonly PLAY_TIMES: string;
  23354. protected static readonly SCALE: string;
  23355. protected static readonly OFFSET: string;
  23356. protected static readonly POSITION: string;
  23357. protected static readonly DURATION: string;
  23358. protected static readonly TWEEN_EASING: string;
  23359. protected static readonly TWEEN_ROTATE: string;
  23360. protected static readonly TWEEN_SCALE: string;
  23361. protected static readonly CLOCK_WISE: string;
  23362. protected static readonly CURVE: string;
  23363. protected static readonly SOUND: string;
  23364. protected static readonly EVENT: string;
  23365. protected static readonly ACTION: string;
  23366. protected static readonly X: string;
  23367. protected static readonly Y: string;
  23368. protected static readonly SKEW_X: string;
  23369. protected static readonly SKEW_Y: string;
  23370. protected static readonly SCALE_X: string;
  23371. protected static readonly SCALE_Y: string;
  23372. protected static readonly VALUE: string;
  23373. protected static readonly ROTATE: string;
  23374. protected static readonly SKEW: string;
  23375. protected static readonly ALPHA_OFFSET: string;
  23376. protected static readonly RED_OFFSET: string;
  23377. protected static readonly GREEN_OFFSET: string;
  23378. protected static readonly BLUE_OFFSET: string;
  23379. protected static readonly ALPHA_MULTIPLIER: string;
  23380. protected static readonly RED_MULTIPLIER: string;
  23381. protected static readonly GREEN_MULTIPLIER: string;
  23382. protected static readonly BLUE_MULTIPLIER: string;
  23383. protected static readonly UVS: string;
  23384. protected static readonly VERTICES: string;
  23385. protected static readonly TRIANGLES: string;
  23386. protected static readonly WEIGHTS: string;
  23387. protected static readonly SLOT_POSE: string;
  23388. protected static readonly BONE_POSE: string;
  23389. protected static readonly GLUE_WEIGHTS: string;
  23390. protected static readonly GLUE_MESHES: string;
  23391. protected static readonly GOTO_AND_PLAY: string;
  23392. protected static readonly DEFAULT_NAME: string;
  23393. protected static _getArmatureType(value: string): ArmatureType;
  23394. protected static _getBoneType(value: string): BoneType;
  23395. protected static _getDisplayType(value: string): DisplayType;
  23396. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  23397. protected static _getActionType(value: string): ActionType;
  23398. protected static _getBlendMode(value: string): BlendMode;
  23399. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  23400. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  23401. /**
  23402. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  23403. * @deprecated
  23404. * @language en_US
  23405. */
  23406. /**
  23407. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  23408. * @deprecated
  23409. * @language zh_CN
  23410. */
  23411. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  23412. /**
  23413. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  23414. * @deprecated
  23415. * @language en_US
  23416. */
  23417. /**
  23418. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  23419. * @deprecated
  23420. * @language zh_CN
  23421. */
  23422. static parseTextureAtlasData(rawData: any, scale?: number): any;
  23423. }
  23424. }
  23425. /**
  23426. * The MIT License (MIT)
  23427. *
  23428. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23429. *
  23430. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23431. * this software and associated documentation files (the "Software"), to deal in
  23432. * the Software without restriction, including without limitation the rights to
  23433. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23434. * the Software, and to permit persons to whom the Software is furnished to do so,
  23435. * subject to the following conditions:
  23436. *
  23437. * The above copyright notice and this permission notice shall be included in all
  23438. * copies or substantial portions of the Software.
  23439. *
  23440. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23441. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23442. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23443. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23444. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23445. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23446. */
  23447. declare namespace dragonBones {
  23448. /**
  23449. * @internal
  23450. * @private
  23451. */
  23452. class ObjectDataParser extends DataParser {
  23453. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  23454. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  23455. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  23456. protected _rawTextureAtlasIndex: number;
  23457. protected readonly _rawBones: Array<BoneData>;
  23458. protected _data: DragonBonesData;
  23459. protected _armature: ArmatureData;
  23460. protected _bone: BoneData;
  23461. protected _surface: SurfaceData;
  23462. protected _slot: SlotData;
  23463. protected _skin: SkinData;
  23464. protected _mesh: MeshDisplayData;
  23465. protected _animation: AnimationData;
  23466. protected _timeline: TimelineData;
  23467. protected _rawTextureAtlases: Array<any> | null;
  23468. private _defaultColorOffset;
  23469. private _prevClockwise;
  23470. private _prevRotation;
  23471. private readonly _helpMatrixA;
  23472. private readonly _helpMatrixB;
  23473. private readonly _helpTransform;
  23474. private readonly _helpColorTransform;
  23475. private readonly _helpPoint;
  23476. private readonly _helpArray;
  23477. private readonly _intArray;
  23478. private readonly _floatArray;
  23479. private readonly _frameIntArray;
  23480. private readonly _frameFloatArray;
  23481. private readonly _frameArray;
  23482. private readonly _timelineArray;
  23483. private readonly _cacheRawMeshes;
  23484. private readonly _cacheMeshes;
  23485. private readonly _actionFrames;
  23486. private readonly _weightSlotPose;
  23487. private readonly _weightBonePoses;
  23488. private readonly _cacheBones;
  23489. private readonly _slotChildActions;
  23490. private _getCurvePoint(x1, y1, x2, y2, x3, y3, x4, y4, t, result);
  23491. private _samplingEasingCurve(curve, samples);
  23492. private _parseActionDataInFrame(rawData, frameStart, bone, slot);
  23493. private _mergeActionFrame(rawData, frameStart, type, bone, slot);
  23494. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  23495. protected _parseBone(rawData: any): BoneData;
  23496. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  23497. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  23498. protected _parseSkin(rawData: any): SkinData;
  23499. protected _parseDisplay(rawData: any): DisplayData | null;
  23500. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  23501. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  23502. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  23503. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  23504. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  23505. protected _parseAnimation(rawData: any): AnimationData;
  23506. 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;
  23507. protected _parseBoneTimeline(rawData: any): void;
  23508. protected _parseSlotTimeline(rawData: any): void;
  23509. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  23510. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  23511. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  23512. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  23513. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  23514. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  23515. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  23516. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  23517. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  23518. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  23519. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  23520. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  23521. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  23522. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  23523. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  23524. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  23525. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  23526. protected _parseArray(rawData: any): void;
  23527. protected _modifyArray(): void;
  23528. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  23529. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  23530. private static _objectDataParserInstance;
  23531. /**
  23532. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  23533. * @deprecated
  23534. * @language en_US
  23535. */
  23536. /**
  23537. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  23538. * @deprecated
  23539. * @language zh_CN
  23540. */
  23541. static getInstance(): ObjectDataParser;
  23542. }
  23543. /**
  23544. * @internal
  23545. * @private
  23546. */
  23547. class ActionFrame {
  23548. frameStart: number;
  23549. readonly actions: Array<number>;
  23550. }
  23551. }
  23552. /**
  23553. * The MIT License (MIT)
  23554. *
  23555. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23556. *
  23557. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23558. * this software and associated documentation files (the "Software"), to deal in
  23559. * the Software without restriction, including without limitation the rights to
  23560. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23561. * the Software, and to permit persons to whom the Software is furnished to do so,
  23562. * subject to the following conditions:
  23563. *
  23564. * The above copyright notice and this permission notice shall be included in all
  23565. * copies or substantial portions of the Software.
  23566. *
  23567. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23568. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23569. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23570. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23571. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23572. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23573. */
  23574. declare namespace dragonBones {
  23575. /**
  23576. * @internal
  23577. * @private
  23578. */
  23579. class BinaryDataParser extends ObjectDataParser {
  23580. private _binaryOffset;
  23581. private _binary;
  23582. private _intArrayBuffer;
  23583. private _floatArrayBuffer;
  23584. private _frameIntArrayBuffer;
  23585. private _frameFloatArrayBuffer;
  23586. private _frameArrayBuffer;
  23587. private _timelineArrayBuffer;
  23588. private _inRange(a, min, max);
  23589. private _decodeUTF8(data);
  23590. private _getUTF16Key(value);
  23591. private _parseBinaryTimeline(type, offset, timelineData?);
  23592. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  23593. protected _parseAnimation(rawData: any): AnimationData;
  23594. protected _parseArray(rawData: any): void;
  23595. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  23596. private static _binaryDataParserInstance;
  23597. /**
  23598. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  23599. * @deprecated
  23600. * @language en_US
  23601. */
  23602. /**
  23603. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  23604. * @deprecated
  23605. * @language zh_CN
  23606. */
  23607. static getInstance(): BinaryDataParser;
  23608. }
  23609. }
  23610. /**
  23611. * The MIT License (MIT)
  23612. *
  23613. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23614. *
  23615. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23616. * this software and associated documentation files (the "Software"), to deal in
  23617. * the Software without restriction, including without limitation the rights to
  23618. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23619. * the Software, and to permit persons to whom the Software is furnished to do so,
  23620. * subject to the following conditions:
  23621. *
  23622. * The above copyright notice and this permission notice shall be included in all
  23623. * copies or substantial portions of the Software.
  23624. *
  23625. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23626. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23627. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23628. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23629. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23630. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23631. */
  23632. declare namespace dragonBones {
  23633. /**
  23634. * - Base class for the factory that create the armatures. (Typically only one global factory instance is required)
  23635. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  23636. * 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.
  23637. * @see dragonBones.DragonBonesData
  23638. * @see dragonBones.TextureAtlasData
  23639. * @see dragonBones.ArmatureData
  23640. * @see dragonBones.Armature
  23641. * @version DragonBones 3.0
  23642. * @language en_US
  23643. */
  23644. /**
  23645. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  23646. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  23647. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  23648. * @see dragonBones.DragonBonesData
  23649. * @see dragonBones.TextureAtlasData
  23650. * @see dragonBones.ArmatureData
  23651. * @see dragonBones.Armature
  23652. * @version DragonBones 3.0
  23653. * @language zh_CN
  23654. */
  23655. abstract class BaseFactory {
  23656. /**
  23657. * @private
  23658. */
  23659. protected static _objectParser: ObjectDataParser;
  23660. /**
  23661. * @private
  23662. */
  23663. protected static _binaryParser: BinaryDataParser;
  23664. /**
  23665. * @private
  23666. */
  23667. autoSearch: boolean;
  23668. /**
  23669. * @private
  23670. */
  23671. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  23672. /**
  23673. * @private
  23674. */
  23675. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  23676. /**
  23677. * @private
  23678. */
  23679. protected _dragonBones: DragonBones;
  23680. /**
  23681. * @private
  23682. */
  23683. protected _dataParser: DataParser;
  23684. /**
  23685. * - Create a factory instance. (typically only one global factory instance is required)
  23686. * @version DragonBones 3.0
  23687. * @language en_US
  23688. */
  23689. /**
  23690. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  23691. * @version DragonBones 3.0
  23692. * @language zh_CN
  23693. */
  23694. constructor(dataParser?: DataParser | null);
  23695. /**
  23696. * @private
  23697. */
  23698. protected _isSupportMesh(): boolean;
  23699. /**
  23700. * @private
  23701. */
  23702. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  23703. /**
  23704. * @private
  23705. */
  23706. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  23707. /**
  23708. * @private
  23709. */
  23710. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  23711. /**
  23712. * @private
  23713. */
  23714. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  23715. /**
  23716. * @private
  23717. */
  23718. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  23719. /**
  23720. * @private
  23721. */
  23722. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  23723. /**
  23724. * @private
  23725. */
  23726. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  23727. /**
  23728. * @private
  23729. */
  23730. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  23731. /**
  23732. * @private
  23733. */
  23734. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  23735. /**
  23736. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  23737. * @param rawData - The raw data.
  23738. * @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)
  23739. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  23740. * @returns DragonBonesData instance
  23741. * @see #getDragonBonesData()
  23742. * @see #addDragonBonesData()
  23743. * @see #removeDragonBonesData()
  23744. * @see dragonBones.DragonBonesData
  23745. * @version DragonBones 4.5
  23746. * @language en_US
  23747. */
  23748. /**
  23749. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  23750. * @param rawData - 原始数据。
  23751. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23752. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  23753. * @returns DragonBonesData 实例
  23754. * @see #getDragonBonesData()
  23755. * @see #addDragonBonesData()
  23756. * @see #removeDragonBonesData()
  23757. * @see dragonBones.DragonBonesData
  23758. * @version DragonBones 4.5
  23759. * @language zh_CN
  23760. */
  23761. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  23762. /**
  23763. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  23764. * @param rawData - The raw texture atlas data.
  23765. * @param textureAtlas - The texture atlas object.
  23766. * @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)
  23767. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  23768. * @returns TextureAtlasData instance
  23769. * @see #getTextureAtlasData()
  23770. * @see #addTextureAtlasData()
  23771. * @see #removeTextureAtlasData()
  23772. * @see dragonBones.TextureAtlasData
  23773. * @version DragonBones 4.5
  23774. * @language en_US
  23775. */
  23776. /**
  23777. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  23778. * @param rawData - 原始贴图集数据。
  23779. * @param textureAtlas - 贴图集对象。
  23780. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23781. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  23782. * @returns TextureAtlasData 实例
  23783. * @see #getTextureAtlasData()
  23784. * @see #addTextureAtlasData()
  23785. * @see #removeTextureAtlasData()
  23786. * @see dragonBones.TextureAtlasData
  23787. * @version DragonBones 4.5
  23788. * @language zh_CN
  23789. */
  23790. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  23791. /**
  23792. * @private
  23793. */
  23794. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  23795. /**
  23796. * - Get a specific DragonBonesData instance.
  23797. * @param name - The DragonBonesData instance cache name.
  23798. * @returns DragonBonesData instance
  23799. * @see #parseDragonBonesData()
  23800. * @see #addDragonBonesData()
  23801. * @see #removeDragonBonesData()
  23802. * @see dragonBones.DragonBonesData
  23803. * @version DragonBones 3.0
  23804. * @language en_US
  23805. */
  23806. /**
  23807. * - 获取特定的 DragonBonesData 实例。
  23808. * @param name - DragonBonesData 实例的缓存名称。
  23809. * @returns DragonBonesData 实例
  23810. * @see #parseDragonBonesData()
  23811. * @see #addDragonBonesData()
  23812. * @see #removeDragonBonesData()
  23813. * @see dragonBones.DragonBonesData
  23814. * @version DragonBones 3.0
  23815. * @language zh_CN
  23816. */
  23817. getDragonBonesData(name: string): DragonBonesData | null;
  23818. /**
  23819. * - Cache a DragonBonesData instance to the factory.
  23820. * @param data - The DragonBonesData instance.
  23821. * @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)
  23822. * @see #parseDragonBonesData()
  23823. * @see #getDragonBonesData()
  23824. * @see #removeDragonBonesData()
  23825. * @see dragonBones.DragonBonesData
  23826. * @version DragonBones 3.0
  23827. * @language en_US
  23828. */
  23829. /**
  23830. * - 将 DragonBonesData 实例缓存到工厂中。
  23831. * @param data - DragonBonesData 实例。
  23832. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23833. * @see #parseDragonBonesData()
  23834. * @see #getDragonBonesData()
  23835. * @see #removeDragonBonesData()
  23836. * @see dragonBones.DragonBonesData
  23837. * @version DragonBones 3.0
  23838. * @language zh_CN
  23839. */
  23840. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  23841. /**
  23842. * - Remove a DragonBonesData instance.
  23843. * @param name - The DragonBonesData instance cache name.
  23844. * @param disposeData - Whether to dispose data. (Default: true)
  23845. * @see #parseDragonBonesData()
  23846. * @see #getDragonBonesData()
  23847. * @see #addDragonBonesData()
  23848. * @see dragonBones.DragonBonesData
  23849. * @version DragonBones 3.0
  23850. * @language en_US
  23851. */
  23852. /**
  23853. * - 移除 DragonBonesData 实例。
  23854. * @param name - DragonBonesData 实例缓存名称。
  23855. * @param disposeData - 是否释放数据。 (默认: true)
  23856. * @see #parseDragonBonesData()
  23857. * @see #getDragonBonesData()
  23858. * @see #addDragonBonesData()
  23859. * @see dragonBones.DragonBonesData
  23860. * @version DragonBones 3.0
  23861. * @language zh_CN
  23862. */
  23863. removeDragonBonesData(name: string, disposeData?: boolean): void;
  23864. /**
  23865. * - Get a list of specific TextureAtlasData instances.
  23866. * @param name - The TextureAtlasData cahce name.
  23867. * @see #parseTextureAtlasData()
  23868. * @see #addTextureAtlasData()
  23869. * @see #removeTextureAtlasData()
  23870. * @see dragonBones.TextureAtlasData
  23871. * @version DragonBones 3.0
  23872. * @language en_US
  23873. */
  23874. /**
  23875. * - 获取特定的 TextureAtlasData 实例列表。
  23876. * @param name - TextureAtlasData 实例缓存名称。
  23877. * @see #parseTextureAtlasData()
  23878. * @see #addTextureAtlasData()
  23879. * @see #removeTextureAtlasData()
  23880. * @see dragonBones.TextureAtlasData
  23881. * @version DragonBones 3.0
  23882. * @language zh_CN
  23883. */
  23884. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  23885. /**
  23886. * - Cache a TextureAtlasData instance to the factory.
  23887. * @param data - The TextureAtlasData instance.
  23888. * @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)
  23889. * @see #parseTextureAtlasData()
  23890. * @see #getTextureAtlasData()
  23891. * @see #removeTextureAtlasData()
  23892. * @see dragonBones.TextureAtlasData
  23893. * @version DragonBones 3.0
  23894. * @language en_US
  23895. */
  23896. /**
  23897. * - 将 TextureAtlasData 实例缓存到工厂中。
  23898. * @param data - TextureAtlasData 实例。
  23899. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23900. * @see #parseTextureAtlasData()
  23901. * @see #getTextureAtlasData()
  23902. * @see #removeTextureAtlasData()
  23903. * @see dragonBones.TextureAtlasData
  23904. * @version DragonBones 3.0
  23905. * @language zh_CN
  23906. */
  23907. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  23908. /**
  23909. * - Remove a TextureAtlasData instance.
  23910. * @param name - The TextureAtlasData instance cache name.
  23911. * @param disposeData - Whether to dispose data.
  23912. * @see #parseTextureAtlasData()
  23913. * @see #getTextureAtlasData()
  23914. * @see #addTextureAtlasData()
  23915. * @see dragonBones.TextureAtlasData
  23916. * @version DragonBones 3.0
  23917. * @language en_US
  23918. */
  23919. /**
  23920. * - 移除 TextureAtlasData 实例。
  23921. * @param name - TextureAtlasData 实例的缓存名称。
  23922. * @param disposeData - 是否释放数据。
  23923. * @see #parseTextureAtlasData()
  23924. * @see #getTextureAtlasData()
  23925. * @see #addTextureAtlasData()
  23926. * @see dragonBones.TextureAtlasData
  23927. * @version DragonBones 3.0
  23928. * @language zh_CN
  23929. */
  23930. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  23931. /**
  23932. * - Get a specific armature data.
  23933. * @param name - The armature data name.
  23934. * @param dragonBonesName - The cached name for DragonbonesData instance.
  23935. * @see dragonBones.ArmatureData
  23936. * @version DragonBones 5.1
  23937. * @language en_US
  23938. */
  23939. /**
  23940. * - 获取特定的骨架数据。
  23941. * @param name - 骨架数据名称。
  23942. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  23943. * @see dragonBones.ArmatureData
  23944. * @version DragonBones 5.1
  23945. * @language zh_CN
  23946. */
  23947. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  23948. /**
  23949. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  23950. * @param disposeData - Whether to dispose data.
  23951. * @version DragonBones 4.5
  23952. * @language en_US
  23953. */
  23954. /**
  23955. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  23956. * @param disposeData - 是否释放数据。
  23957. * @version DragonBones 4.5
  23958. * @language zh_CN
  23959. */
  23960. clear(disposeData?: boolean): void;
  23961. /**
  23962. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  23963. * @param armatureName - The armature data name.
  23964. * @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)
  23965. * @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)
  23966. * @returns The armature.
  23967. * @example
  23968. * <pre>
  23969. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  23970. * armature.clock = factory.clock;
  23971. * </pre>
  23972. * @see dragonBones.DragonBonesData
  23973. * @see dragonBones.ArmatureData
  23974. * @see dragonBones.Armature
  23975. * @version DragonBones 3.0
  23976. * @language en_US
  23977. */
  23978. /**
  23979. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  23980. * @param armatureName - 骨架数据名称。
  23981. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  23982. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  23983. * @returns 骨架。
  23984. * @example
  23985. * <pre>
  23986. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  23987. * armature.clock = factory.clock;
  23988. * </pre>
  23989. * @see dragonBones.DragonBonesData
  23990. * @see dragonBones.ArmatureData
  23991. * @see dragonBones.Armature
  23992. * @version DragonBones 3.0
  23993. * @language zh_CN
  23994. */
  23995. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  23996. /**
  23997. * @private
  23998. */
  23999. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  24000. /**
  24001. * - Replaces the current display data for a particular slot with a specific display data.
  24002. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  24003. * @param dragonBonesName - The DragonBonesData instance cache name.
  24004. * @param armatureName - The armature data name.
  24005. * @param slotName - The slot data name.
  24006. * @param displayName - The display data name.
  24007. * @param slot - The slot.
  24008. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  24009. * @example
  24010. * <pre>
  24011. * let slot = armature.getSlot("weapon");
  24012. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  24013. * </pre>
  24014. * @version DragonBones 4.5
  24015. * @language en_US
  24016. */
  24017. /**
  24018. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  24019. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  24020. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  24021. * @param armatureName - 骨架数据名称。
  24022. * @param slotName - 插槽数据名称。
  24023. * @param displayName - 显示对象数据名称。
  24024. * @param slot - 插槽。
  24025. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  24026. * @example
  24027. * <pre>
  24028. * let slot = armature.getSlot("weapon");
  24029. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  24030. * </pre>
  24031. * @version DragonBones 4.5
  24032. * @language zh_CN
  24033. */
  24034. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  24035. /**
  24036. * @private
  24037. */
  24038. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  24039. /**
  24040. * - Share specific skin data with specific armature.
  24041. * @param armature - The armature.
  24042. * @param skin - The skin data.
  24043. * @param isOverride - Whether it completely override the original skin. (Default: false)
  24044. * @param exclude - A list of slot names that do not need to be replace.
  24045. * @example
  24046. * <pre>
  24047. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  24048. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  24049. * if (armatureDataB && armatureDataB.defaultSkin) {
  24050. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  24051. * }
  24052. * </pre>
  24053. * @see dragonBones.Armature
  24054. * @see dragonBones.SkinData
  24055. * @version DragonBones 5.6
  24056. * @language en_US
  24057. */
  24058. /**
  24059. * - 将特定的皮肤数据共享给特定的骨架使用。
  24060. * @param armature - 骨架。
  24061. * @param skin - 皮肤数据。
  24062. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  24063. * @param exclude - 不需要被替换的插槽名称列表。
  24064. * @example
  24065. * <pre>
  24066. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  24067. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  24068. * if (armatureDataB && armatureDataB.defaultSkin) {
  24069. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  24070. * }
  24071. * </pre>
  24072. * @see dragonBones.Armature
  24073. * @see dragonBones.SkinData
  24074. * @version DragonBones 5.6
  24075. * @language zh_CN
  24076. */
  24077. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  24078. /**
  24079. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  24080. * This enables you to make a armature template so that other armature without animations can share it's animations.
  24081. * @param armature - The armtaure.
  24082. * @param armatureData - The armature data.
  24083. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  24084. * @example
  24085. * <pre>
  24086. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  24087. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  24088. * if (armatureDataB) {
  24089. * factory.replaceAnimation(armatureA, armatureDataB);
  24090. * }
  24091. * </pre>
  24092. * @see dragonBones.Armature
  24093. * @see dragonBones.ArmatureData
  24094. * @version DragonBones 5.6
  24095. * @language en_US
  24096. */
  24097. /**
  24098. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  24099. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  24100. * @param armature - 骨架。
  24101. * @param armatureData - 骨架数据。
  24102. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  24103. * @example
  24104. * <pre>
  24105. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  24106. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  24107. * if (armatureDataB) {
  24108. * factory.replaceAnimation(armatureA, armatureDataB);
  24109. * }
  24110. * </pre>
  24111. * @see dragonBones.Armature
  24112. * @see dragonBones.ArmatureData
  24113. * @version DragonBones 5.6
  24114. * @language zh_CN
  24115. */
  24116. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  24117. /**
  24118. * @private
  24119. */
  24120. getAllDragonBonesData(): Map<DragonBonesData>;
  24121. /**
  24122. * @private
  24123. */
  24124. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  24125. /**
  24126. * - An Worldclock instance updated by engine.
  24127. * @version DragonBones 5.7
  24128. * @language en_US
  24129. */
  24130. /**
  24131. * - 由引擎驱动的 WorldClock 实例。
  24132. * @version DragonBones 5.7
  24133. * @language zh_CN
  24134. */
  24135. readonly clock: WorldClock;
  24136. /**
  24137. * @private
  24138. */
  24139. readonly dragonBones: DragonBones;
  24140. /**
  24141. * - Deprecated, please refer to {@link #replaceSkin}.
  24142. * @deprecated
  24143. * @language en_US
  24144. */
  24145. /**
  24146. * - 已废弃,请参考 {@link #replaceSkin}。
  24147. * @deprecated
  24148. * @language zh_CN
  24149. */
  24150. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  24151. /**
  24152. * - Deprecated, please refer to {@link #replaceAnimation}.
  24153. * @deprecated
  24154. * @language en_US
  24155. */
  24156. /**
  24157. * - 已废弃,请参考 {@link #replaceAnimation}。
  24158. * @deprecated
  24159. * @language zh_CN
  24160. */
  24161. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  24162. }
  24163. /**
  24164. * @internal
  24165. * @private
  24166. */
  24167. class BuildArmaturePackage {
  24168. dataName: string;
  24169. textureAtlasName: string;
  24170. data: DragonBonesData;
  24171. armature: ArmatureData;
  24172. skin: SkinData | null;
  24173. }
  24174. }
  24175. declare let jsb: any;
  24176. /** Running in the editor. */
  24177. declare let CC_EDITOR: boolean;
  24178. /** Preview in browser or simulator. */
  24179. declare let CC_PREVIEW: boolean;
  24180. /** Running in the editor or preview. */
  24181. declare let CC_DEV: boolean;
  24182. /** Running in the editor or preview, or build in debug mode. */
  24183. declare let CC_DEBUG: boolean;
  24184. /** Running in published project. */
  24185. declare let CC_BUILD: boolean;
  24186. /** Running in native platform (mobile app, desktop app, or simulator). */
  24187. declare let CC_JSB: boolean;
  24188. /** Running in the engine's unit test. */
  24189. declare let CC_TEST: boolean;
  24190. /** Running in the Wechat's mini game. */
  24191. declare let CC_WECHATGAME: boolean;
  24192. /** Running in the bricks. */
  24193. declare let CC_QQPLAY: boolean;