creator.d.ts 857 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606
  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 module 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. Creates the speed action which changes the speed of an action, making it take longer (speed > 1)
  13. or less (speed < 1) time. <br/>
  14. Useful to simulate 'slow motion' or 'fast forward' effect.
  15. !#zh 修改目标动作的速率。
  16. @param action action
  17. @param speed speed
  18. @example
  19. ```js
  20. // change the target action speed;
  21. var action = cc.scaleTo(0.2, 1, 0.6);
  22. var newAction = cc.speed(action, 0.5);
  23. ```
  24. */
  25. export function speed(action: ActionInterval, speed: number): Action;
  26. /**
  27. !#en Create a follow action which makes its target follows another node.
  28. !#zh 追踪目标节点的位置。
  29. @param followedNode followedNode
  30. @param rect rect
  31. @example
  32. ```js
  33. // example
  34. // creates the action with a set boundary
  35. var followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight));
  36. node.runAction(followAction);
  37. // creates the action with no boundary set
  38. var followAction = cc.follow(targetNode);
  39. node.runAction(followAction);
  40. ```
  41. */
  42. export function follow(followedNode: Node, rect: Rect): Action;
  43. /**
  44. Points setter
  45. @param points points
  46. */
  47. export function setPoints(points: any[]): void;
  48. /**
  49. !#en Creates an action with a Cardinal Spline array of points and tension.
  50. !#zh 按基数样条曲线轨迹移动到目标位置。
  51. @param duration duration
  52. @param points array of control points
  53. @param tension tension
  54. @example
  55. ```js
  56. //create a cc.CardinalSplineTo
  57. var action1 = cc.cardinalSplineTo(3, array, 0);
  58. ```
  59. */
  60. export function cardinalSplineTo(duration: number, points: any[], tension: number): ActionInterval;
  61. /**
  62. update position of target
  63. @param newPos newPos
  64. */
  65. export function updatePosition(newPos: Vec2): void;
  66. /**
  67. !#en Creates an action with a Cardinal Spline array of points and tension.
  68. !#zh 按基数样条曲线轨迹移动指定的距离。
  69. @param duration duration
  70. @param points points
  71. @param tension tension
  72. */
  73. export function cardinalSplineBy(duration: number, points: any[], tension: number): ActionInterval;
  74. /**
  75. !#en Creates an action with a Cardinal Spline array of points and tension.
  76. !#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。
  77. @param dt dt
  78. @param points points
  79. @example
  80. ```js
  81. var action1 = cc.catmullRomTo(3, array);
  82. ```
  83. */
  84. export function catmullRomTo(dt: number, points: any[]): ActionInterval;
  85. /**
  86. !#en Creates an action with a Cardinal Spline array of points and tension.
  87. !#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。
  88. @param dt dt
  89. @param points points
  90. @example
  91. ```js
  92. var action1 = cc.catmullRomBy(3, array);
  93. ```
  94. */
  95. export function catmullRomBy(dt: number, points: any[]): ActionInterval;
  96. /**
  97. !#en Show the Node.
  98. !#zh 立即显示。
  99. @example
  100. ```js
  101. // example
  102. var showAction = cc.show();
  103. ```
  104. */
  105. export function show(): ActionInstant;
  106. /**
  107. !#en Hide the node.
  108. !#zh 立即隐藏。
  109. @example
  110. ```js
  111. // example
  112. var hideAction = cc.hide();
  113. ```
  114. */
  115. export function hide(): ActionInstant;
  116. /**
  117. !#en Toggles the visibility of a node.
  118. !#zh 显隐状态切换。
  119. @example
  120. ```js
  121. // example
  122. var toggleVisibilityAction = cc.toggleVisibility();
  123. ```
  124. */
  125. export function toggleVisibility(): ActionInstant;
  126. /**
  127. !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
  128. !#zh 从父节点移除自身。
  129. @param isNeedCleanUp isNeedCleanUp
  130. @example
  131. ```js
  132. // example
  133. var removeSelfAction = cc.removeSelf();
  134. ```
  135. */
  136. export function removeSelf(isNeedCleanUp ?: boolean): ActionInstant;
  137. /**
  138. !#en Create a FlipX action to flip or unflip the target.
  139. !#zh X轴翻转。
  140. @param flip Indicate whether the target should be flipped or not
  141. @example
  142. ```js
  143. var flipXAction = cc.flipX(true);
  144. ```
  145. */
  146. export function flipX(flip: boolean): ActionInstant;
  147. /**
  148. !#en Create a FlipY action to flip or unflip the target.
  149. !#zh Y轴翻转。
  150. @param flip flip
  151. @example
  152. ```js
  153. var flipYAction = cc.flipY(true);
  154. ```
  155. */
  156. export function flipY(flip: boolean): ActionInstant;
  157. /**
  158. !#en Creates a Place action with a position.
  159. !#zh 放置在目标位置。
  160. @param pos pos
  161. @param y y
  162. @example
  163. ```js
  164. // example
  165. var placeAction = cc.place(cc.v2(200, 200));
  166. var placeAction = cc.place(200, 200);
  167. ```
  168. */
  169. export function place(pos: Vec2|number, y?: number): ActionInstant;
  170. /**
  171. !#en Creates the action with the callback.
  172. !#zh 执行回调函数。
  173. @param selector selector
  174. @param selectorTarget selectorTarget
  175. @param data data for function, it accepts all data types.
  176. @example
  177. ```js
  178. // example
  179. // CallFunc without data
  180. var finish = cc.callFunc(this.removeSprite, this);
  181. // CallFunc with data
  182. var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini, true);
  183. ```
  184. */
  185. export function callFunc(selector: Function, selectorTarget?: any, data?: any): ActionInstant;
  186. /**
  187. !#en
  188. Creates the action easing object with the rate parameter. <br />
  189. From slow to fast.
  190. !#zh 创建 easeIn 缓动对象,由慢到快。
  191. @param rate rate
  192. @example
  193. ```js
  194. action.easing(cc.easeIn(3.0));
  195. ```
  196. */
  197. export function easeIn(rate: number): any;
  198. /**
  199. !#en
  200. Creates the action easing object with the rate parameter. <br />
  201. From fast to slow.
  202. !#zh 创建 easeOut 缓动对象,由快到慢。
  203. @param rate rate
  204. @example
  205. ```js
  206. action.easing(cc.easeOut(3.0));
  207. ```
  208. */
  209. export function easeOut(rate: number): any;
  210. /**
  211. !#en
  212. Creates the action easing object with the rate parameter. <br />
  213. Slow to fast then to slow.
  214. !#zh 创建 easeInOut 缓动对象,慢到快,然后慢。
  215. @param rate rate
  216. @example
  217. ```js
  218. action.easing(cc.easeInOut(3.0));
  219. ```
  220. */
  221. export function easeInOut(rate: number): any;
  222. /**
  223. !#en
  224. Creates the action easing object with the rate parameter. <br />
  225. Reference easeInExpo: <br />
  226. http://www.zhihu.com/question/21981571/answer/19925418
  227. !#zh
  228. 创建 easeExponentialIn 缓动对象。<br />
  229. EaseExponentialIn 是按指数函数缓动进入的动作。<br />
  230. 参考 easeInExpo:http://www.zhihu.com/question/21981571/answer/19925418
  231. @example
  232. ```js
  233. action.easing(cc.easeExponentialIn());
  234. ```
  235. */
  236. export function easeExponentialIn(): any;
  237. /**
  238. !#en
  239. Creates the action easing object. <br />
  240. Reference easeOutExpo: <br />
  241. http://www.zhihu.com/question/21981571/answer/19925418
  242. !#zh
  243. 创建 easeExponentialOut 缓动对象。<br />
  244. EaseExponentialOut 是按指数函数缓动退出的动作。<br />
  245. 参考 easeOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  246. @example
  247. ```js
  248. action.easing(cc.easeExponentialOut());
  249. ```
  250. */
  251. export function easeExponentialOut(): any;
  252. /**
  253. !#en
  254. Creates an EaseExponentialInOut action easing object. <br />
  255. Reference easeInOutExpo: <br />
  256. http://www.zhihu.com/question/21981571/answer/19925418
  257. !#zh
  258. 创建 easeExponentialInOut 缓动对象。<br />
  259. EaseExponentialInOut 是按指数函数缓动进入并退出的动作。<br />
  260. 参考 easeInOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  261. @example
  262. ```js
  263. action.easing(cc.easeExponentialInOut());
  264. ```
  265. */
  266. export function easeExponentialInOut(): any;
  267. /**
  268. !#en
  269. Creates an EaseSineIn action. <br />
  270. Reference easeInSine: <br />
  271. http://www.zhihu.com/question/21981571/answer/19925418
  272. !#zh
  273. 创建 EaseSineIn 缓动对象。<br />
  274. EaseSineIn 是按正弦函数缓动进入的动作。<br />
  275. 参考 easeInSine:http://www.zhihu.com/question/21981571/answer/19925418
  276. @example
  277. ```js
  278. action.easing(cc.easeSineIn());
  279. ```
  280. */
  281. export function easeSineIn(): any;
  282. /**
  283. !#en
  284. Creates an EaseSineOut action easing object. <br />
  285. Reference easeOutSine: <br />
  286. http://www.zhihu.com/question/21981571/answer/19925418
  287. !#zh
  288. 创建 EaseSineOut 缓动对象。<br />
  289. EaseSineIn 是按正弦函数缓动退出的动作。<br />
  290. 参考 easeOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  291. @example
  292. ```js
  293. action.easing(cc.easeSineOut());
  294. ```
  295. */
  296. export function easeSineOut(): any;
  297. /**
  298. !#en
  299. Creates the action easing object. <br />
  300. Reference easeInOutSine: <br />
  301. http://www.zhihu.com/question/21981571/answer/19925418
  302. !#zh
  303. 创建 easeSineInOut 缓动对象。<br />
  304. EaseSineIn 是按正弦函数缓动进入并退出的动作。<br />
  305. 参考 easeInOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  306. @example
  307. ```js
  308. action.easing(cc.easeSineInOut());
  309. ```
  310. */
  311. export function easeSineInOut(): any;
  312. /**
  313. !#en
  314. Creates the action easing object with the period in radians (default is 0.3). <br />
  315. Reference easeInElastic: <br />
  316. http://www.zhihu.com/question/21981571/answer/19925418
  317. !#zh
  318. 创建 easeElasticIn 缓动对象。<br />
  319. EaseElasticIn 是按弹性曲线缓动进入的动作。<br />
  320. 参数 easeInElastic:http://www.zhihu.com/question/21981571/answer/19925418
  321. @param period period
  322. @example
  323. ```js
  324. // example
  325. action.easing(cc.easeElasticIn(3.0));
  326. ```
  327. */
  328. export function easeElasticIn(period: number): any;
  329. /**
  330. !#en
  331. Creates the action easing object with the period in radians (default is 0.3). <br />
  332. Reference easeOutElastic: <br />
  333. http://www.zhihu.com/question/21981571/answer/19925418
  334. !#zh
  335. 创建 easeElasticOut 缓动对象。<br />
  336. EaseElasticOut 是按弹性曲线缓动退出的动作。<br />
  337. 参考 easeOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  338. @param period period
  339. @example
  340. ```js
  341. // example
  342. action.easing(cc.easeElasticOut(3.0));
  343. ```
  344. */
  345. export function easeElasticOut(period: number): any;
  346. /**
  347. !#en
  348. Creates the action easing object with the period in radians (default is 0.3). <br />
  349. Reference easeInOutElastic: <br />
  350. http://www.zhihu.com/question/21981571/answer/19925418
  351. !#zh
  352. 创建 easeElasticInOut 缓动对象。<br />
  353. EaseElasticInOut 是按弹性曲线缓动进入并退出的动作。<br />
  354. 参考 easeInOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  355. @param period period
  356. @example
  357. ```js
  358. // example
  359. action.easing(cc.easeElasticInOut(3.0));
  360. ```
  361. */
  362. export function easeElasticInOut(period: number): any;
  363. /**
  364. !#en
  365. Creates the action easing object. <br />
  366. Eased bounce effect at the beginning.
  367. !#zh
  368. 创建 easeBounceIn 缓动对象。<br />
  369. EaseBounceIn 是按弹跳动作缓动进入的动作。
  370. @example
  371. ```js
  372. // example
  373. action.easing(cc.easeBounceIn());
  374. ```
  375. */
  376. export function easeBounceIn(): any;
  377. /**
  378. !#en
  379. Creates the action easing object. <br />
  380. Eased bounce effect at the ending.
  381. !#zh
  382. 创建 easeBounceOut 缓动对象。<br />
  383. EaseBounceOut 是按弹跳动作缓动退出的动作。
  384. @example
  385. ```js
  386. // example
  387. action.easing(cc.easeBounceOut());
  388. ```
  389. */
  390. export function easeBounceOut(): any;
  391. /**
  392. !#en
  393. Creates the action easing object. <br />
  394. Eased bounce effect at the begining and ending.
  395. !#zh
  396. 创建 easeBounceInOut 缓动对象。<br />
  397. EaseBounceInOut 是按弹跳动作缓动进入并退出的动作。
  398. @example
  399. ```js
  400. // example
  401. action.easing(cc.easeBounceInOut());
  402. ```
  403. */
  404. export function easeBounceInOut(): any;
  405. /**
  406. !#en
  407. Creates the action easing object. <br />
  408. In the opposite direction to move slowly, and then accelerated to the right direction.
  409. !#zh
  410. 创建 easeBackIn 缓动对象。<br />
  411. easeBackIn 是在相反的方向缓慢移动,然后加速到正确的方向。<br />
  412. @example
  413. ```js
  414. // example
  415. action.easing(cc.easeBackIn());
  416. ```
  417. */
  418. export function easeBackIn(): any;
  419. /**
  420. !#en
  421. Creates the action easing object. <br />
  422. Fast moving more than the finish, and then slowly back to the finish.
  423. !#zh
  424. 创建 easeBackOut 缓动对象。<br />
  425. easeBackOut 快速移动超出目标,然后慢慢回到目标点。
  426. @example
  427. ```js
  428. // example
  429. action.easing(cc.easeBackOut());
  430. ```
  431. */
  432. export function easeBackOut(): any;
  433. /**
  434. !#en
  435. Creates the action easing object. <br />
  436. Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
  437. !#zh
  438. 创建 easeBackInOut 缓动对象。<br />
  439. @example
  440. ```js
  441. // example
  442. action.easing(cc.easeBackInOut());
  443. ```
  444. */
  445. export function easeBackInOut(): any;
  446. /**
  447. !#en
  448. Creates the action easing object. <br />
  449. Into the 4 reference point. <br />
  450. To calculate the motion curve.
  451. !#zh
  452. 创建 easeBezierAction 缓动对象。<br />
  453. EaseBezierAction 是按贝塞尔曲线缓动的动作。
  454. @param p0 The first bezier parameter
  455. @param p1 The second bezier parameter
  456. @param p2 The third bezier parameter
  457. @param p3 The fourth bezier parameter
  458. @example
  459. ```js
  460. // example
  461. action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
  462. ```
  463. */
  464. export function easeBezierAction(p0: number, p1: number, p2: number, p3: number): any;
  465. /**
  466. !#en
  467. Creates the action easing object. <br />
  468. Reference easeInQuad: <br />
  469. http://www.zhihu.com/question/21981571/answer/19925418
  470. !#zh
  471. 创建 easeQuadraticActionIn 缓动对象。<br />
  472. EaseQuadraticIn是按二次函数缓动进入的动作。<br />
  473. 参考 easeInQuad:http://www.zhihu.com/question/21981571/answer/19925418
  474. @example
  475. ```js
  476. //example
  477. action.easing(cc.easeQuadraticActionIn());
  478. ```
  479. */
  480. export function easeQuadraticActionIn(): any;
  481. /**
  482. !#en
  483. Creates the action easing object. <br />
  484. Reference easeOutQuad: <br />
  485. http://www.zhihu.com/question/21981571/answer/19925418
  486. !#zh
  487. 创建 easeQuadraticActionOut 缓动对象。<br />
  488. EaseQuadraticOut 是按二次函数缓动退出的动作。<br />
  489. 参考 easeOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  490. @example
  491. ```js
  492. //example
  493. action.easing(cc.easeQuadraticActionOut());
  494. ```
  495. */
  496. export function easeQuadraticActionOut(): any;
  497. /**
  498. !#en
  499. Creates the action easing object. <br />
  500. Reference easeInOutQuad: <br />
  501. http://www.zhihu.com/question/21981571/answer/19925418
  502. !#zh
  503. 创建 easeQuadraticActionInOut 缓动对象。<br />
  504. EaseQuadraticInOut 是按二次函数缓动进入并退出的动作。<br />
  505. 参考 easeInOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  506. @example
  507. ```js
  508. //example
  509. action.easing(cc.easeQuadraticActionInOut());
  510. ```
  511. */
  512. export function easeQuadraticActionInOut(): any;
  513. /**
  514. !#en
  515. Creates the action easing object. <br />
  516. Reference easeIntQuart: <br />
  517. http://www.zhihu.com/question/21981571/answer/19925418
  518. !#zh
  519. 创建 easeQuarticActionIn 缓动对象。<br />
  520. EaseQuarticIn 是按四次函数缓动进入的动作。<br />
  521. 参考 easeIntQuart:http://www.zhihu.com/question/21981571/answer/19925418
  522. @example
  523. ```js
  524. //example
  525. action.easing(cc.easeQuarticActionIn());
  526. ```
  527. */
  528. export function easeQuarticActionIn(): any;
  529. /**
  530. !#en
  531. Creates the action easing object. <br />
  532. Reference easeOutQuart: <br />
  533. http://www.zhihu.com/question/21981571/answer/19925418
  534. !#zh
  535. 创建 easeQuarticActionOut 缓动对象。<br />
  536. EaseQuarticOut 是按四次函数缓动退出的动作。<br />
  537. 参考 easeOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  538. @example
  539. ```js
  540. //example
  541. action.easing(cc.QuarticActionOut());
  542. ```
  543. */
  544. export function easeQuarticActionOut(): any;
  545. /**
  546. !#en
  547. Creates the action easing object. <br />
  548. Reference easeInOutQuart: <br />
  549. http://www.zhihu.com/question/21981571/answer/19925418
  550. !#zh
  551. 创建 easeQuarticActionInOut 缓动对象。<br />
  552. EaseQuarticInOut 是按四次函数缓动进入并退出的动作。<br />
  553. 参考 easeInOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  554. */
  555. export function easeQuarticActionInOut(): any;
  556. /**
  557. !#en
  558. Creates the action easing object. <br />
  559. Reference easeInQuint: <br />
  560. http://www.zhihu.com/question/21981571/answer/19925418
  561. !#zh
  562. 创建 easeQuinticActionIn 缓动对象。<br />
  563. EaseQuinticIn 是按五次函数缓动进的动作。<br />
  564. 参考 easeInQuint:http://www.zhihu.com/question/21981571/answer/19925418
  565. @example
  566. ```js
  567. //example
  568. action.easing(cc.easeQuinticActionIn());
  569. ```
  570. */
  571. export function easeQuinticActionIn(): any;
  572. /**
  573. !#en
  574. Creates the action easing object. <br />
  575. Reference easeOutQuint: <br />
  576. http://www.zhihu.com/question/21981571/answer/19925418
  577. !#zh
  578. 创建 easeQuinticActionOut 缓动对象。<br />
  579. EaseQuinticOut 是按五次函数缓动退出的动作
  580. 参考 easeOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  581. @example
  582. ```js
  583. //example
  584. action.easing(cc.easeQuadraticActionOut());
  585. ```
  586. */
  587. export function easeQuinticActionOut(): any;
  588. /**
  589. !#en
  590. Creates the action easing object. <br />
  591. Reference easeInOutQuint: <br />
  592. http://www.zhihu.com/question/21981571/answer/19925418
  593. !#zh
  594. 创建 easeQuinticActionInOut 缓动对象。<br />
  595. EaseQuinticInOut是按五次函数缓动进入并退出的动作。<br />
  596. 参考 easeInOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  597. @example
  598. ```js
  599. //example
  600. action.easing(cc.easeQuinticActionInOut());
  601. ```
  602. */
  603. export function easeQuinticActionInOut(): any;
  604. /**
  605. !#en
  606. Creates the action easing object. <br />
  607. Reference easeInCirc: <br />
  608. http://www.zhihu.com/question/21981571/answer/19925418
  609. !#zh
  610. 创建 easeCircleActionIn 缓动对象。<br />
  611. EaseCircleIn是按圆形曲线缓动进入的动作。<br />
  612. 参考 easeInCirc:http://www.zhihu.com/question/21981571/answer/19925418
  613. @example
  614. ```js
  615. //example
  616. action.easing(cc.easeCircleActionIn());
  617. ```
  618. */
  619. export function easeCircleActionIn(): any;
  620. /**
  621. !#en
  622. Creates the action easing object. <br />
  623. Reference easeOutCirc: <br />
  624. http://www.zhihu.com/question/21981571/answer/19925418
  625. !#zh
  626. 创建 easeCircleActionOut 缓动对象。<br />
  627. EaseCircleOut是按圆形曲线缓动退出的动作。<br />
  628. 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  629. @example
  630. ```js
  631. //example
  632. actioneasing(cc.easeCircleActionOut());
  633. ```
  634. */
  635. export function easeCircleActionOut(): any;
  636. /**
  637. !#en
  638. Creates the action easing object. <br />
  639. Reference easeInOutCirc: <br />
  640. http://www.zhihu.com/question/21981571/answer/19925418
  641. !#zh
  642. 创建 easeCircleActionInOut 缓动对象。<br />
  643. EaseCircleInOut 是按圆形曲线缓动进入并退出的动作。<br />
  644. 参考 easeInOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  645. @example
  646. ```js
  647. //example
  648. action.easing(cc.easeCircleActionInOut());
  649. ```
  650. */
  651. export function easeCircleActionInOut(): any;
  652. /**
  653. !#en
  654. Creates the action easing object. <br />
  655. Reference easeInCubic: <br />
  656. http://www.zhihu.com/question/21981571/answer/19925418
  657. !#zh
  658. 创建 easeCubicActionIn 缓动对象。<br />
  659. EaseCubicIn 是按三次函数缓动进入的动作。<br />
  660. 参考 easeInCubic:http://www.zhihu.com/question/21981571/answer/19925418
  661. @example
  662. ```js
  663. //example
  664. action.easing(cc.easeCubicActionIn());
  665. ```
  666. */
  667. export function easeCubicActionIn(): any;
  668. /**
  669. !#en
  670. Creates the action easing object. <br />
  671. Reference easeOutCubic: <br />
  672. http://www.zhihu.com/question/21981571/answer/19925418
  673. !#zh
  674. 创建 easeCubicActionOut 缓动对象。<br />
  675. EaseCubicOut 是按三次函数缓动退出的动作。<br />
  676. 参考 easeOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  677. @example
  678. ```js
  679. //example
  680. action.easing(cc.easeCubicActionOut());
  681. ```
  682. */
  683. export function easeCubicActionOut(): any;
  684. /**
  685. !#en
  686. Creates the action easing object. <br />
  687. Reference easeInOutCubic: <br />
  688. http://www.zhihu.com/question/21981571/answer/19925418
  689. !#zh
  690. 创建 easeCubicActionInOut 缓动对象。<br />
  691. EaseCubicInOut是按三次函数缓动进入并退出的动作。<br />
  692. 参考 easeInOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  693. */
  694. export function easeCubicActionInOut(): any;
  695. /**
  696. !#en
  697. Helper constructor to create an array of sequenceable actions
  698. The created action will run actions sequentially, one after another.
  699. !#zh 顺序执行动作,创建的动作将按顺序依次运行。
  700. @param actionOrActionArray actionOrActionArray
  701. @param tempArray tempArray
  702. @example
  703. ```js
  704. // example
  705. // create sequence with actions
  706. var seq = cc.sequence(act1, act2);
  707. // create sequence with array
  708. var seq = cc.sequence(actArray);
  709. ```
  710. */
  711. export function sequence(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): ActionInterval;
  712. /**
  713. !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
  714. !#zh 重复动作,可以按一定次数重复一个动,如果想永远重复一个动作请使用 repeatForever 动作来完成。
  715. @param action action
  716. @param times times
  717. @example
  718. ```js
  719. // example
  720. var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
  721. ```
  722. */
  723. export function repeat(action: FiniteTimeAction, times: number): ActionInterval;
  724. /**
  725. !#en Create a acton which repeat forever, as it runs forever, it can't be added into cc.sequence and cc.spawn.
  726. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 repeat 动作,由于这个动作不会停止,所以不能被添加到 cc.sequence 或 cc.spawn 中。
  727. @param action action
  728. @example
  729. ```js
  730. // example
  731. var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
  732. ```
  733. */
  734. export function repeatForever(action: FiniteTimeAction): ActionInterval;
  735. /**
  736. !#en Create a spawn action which runs several actions in parallel.
  737. !#zh 同步执行动作,同步执行一组动作。
  738. @param actionOrActionArray actionOrActionArray
  739. @param tempArray tempArray
  740. @example
  741. ```js
  742. // example
  743. var action = cc.spawn(cc.jumpBy(2, cc.v2(300, 0), 50, 4), cc.rotateBy(2, 720));
  744. todo:It should be the direct use new
  745. ```
  746. */
  747. export function spawn(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): FiniteTimeAction;
  748. /**
  749. !#en
  750. Rotates a Node object to a certain angle by modifying its rotation property. <br/>
  751. The direction will be decided by the shortest angle.
  752. !#zh 旋转到目标角度,通过逐帧修改它的 rotation 属性,旋转方向将由最短的角度决定。
  753. @param duration duration in seconds
  754. @param dstAngleX dstAngleX in degrees.
  755. @param dstAngleY dstAngleY in degrees.
  756. @param dstAngleZ dstAngleZ in degrees.
  757. @example
  758. ```js
  759. // example
  760. var rotateTo = cc.rotateTo(2, 61.0);
  761. ```
  762. */
  763. export function rotateTo(duration: number, dstAngleX: number, dstAngleY?: number, dstAngleZ?: number): ActionInterval;
  764. /**
  765. !#en
  766. Rotates a Node object clockwise a number of degrees by modifying its rotation property.
  767. Relative to its properties to modify.
  768. !#zh 旋转指定的角度。
  769. @param duration duration in seconds
  770. @param deltaAngleX deltaAngleX in degrees
  771. @param deltaAngleY deltaAngleY in degrees
  772. @param deltaAngleZ deltaAngleZ in degrees
  773. @example
  774. ```js
  775. // example
  776. var actionBy = cc.rotateBy(2, 360);
  777. ```
  778. */
  779. export function rotateBy(duration: number, deltaAngleX: number, deltaAngleY?: number, deltaAngleZ?: number): ActionInterval;
  780. /**
  781. !#en
  782. Moves a Node object x,y pixels by modifying its position property. <br/>
  783. x and y are relative to the position of the object. <br/>
  784. Several MoveBy actions can be concurrently called, and the resulting <br/>
  785. movement will be the sum of individual movements.
  786. !#zh 移动指定的距离。
  787. @param duration duration in seconds
  788. @param deltaPos deltaPos
  789. @param deltaY deltaY
  790. @example
  791. ```js
  792. // example
  793. var actionTo = cc.moveBy(2, cc.v2(windowSize.width - 40, windowSize.height - 40));
  794. ```
  795. */
  796. export function moveBy(duration: number, deltaPos: Vec2|number, deltaY?: number): ActionInterval;
  797. /**
  798. !#en
  799. Moves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property. <br/>
  800. Several MoveTo actions can be concurrently called, and the resulting <br/>
  801. movement will be the sum of individual movements.
  802. !#zh 移动到目标位置。
  803. @param duration duration in seconds
  804. @param position position
  805. @param y y
  806. @example
  807. ```js
  808. // example
  809. var actionBy = cc.moveTo(2, cc.v2(80, 80));
  810. ```
  811. */
  812. export function moveTo(duration: number, position: Vec2|number, y?: number): ActionInterval;
  813. /**
  814. !#en
  815. Create a action which skews a Node object to given angles by modifying its skewX and skewY properties.
  816. Changes to the specified value.
  817. !#zh 偏斜到目标角度。
  818. @param t time in seconds
  819. @param sx sx
  820. @param sy sy
  821. @example
  822. ```js
  823. // example
  824. var actionTo = cc.skewTo(2, 37.2, -37.2);
  825. ```
  826. */
  827. export function skewTo(t: number, sx: number, sy: number): ActionInterval;
  828. /**
  829. !#en
  830. Skews a Node object by skewX and skewY degrees. <br />
  831. Relative to its property modification.
  832. !#zh 偏斜指定的角度。
  833. @param t time in seconds
  834. @param sx sx skew in degrees for X axis
  835. @param sy sy skew in degrees for Y axis
  836. @example
  837. ```js
  838. // example
  839. var actionBy = cc.skewBy(2, 0, -90);
  840. ```
  841. */
  842. export function skewBy(t: number, sx: number, sy: number): ActionInterval;
  843. /**
  844. !#en
  845. Moves a Node object simulating a parabolic jump movement by modifying it's position property.
  846. Relative to its movement.
  847. !#zh 用跳跃的方式移动指定的距离。
  848. @param duration duration
  849. @param position position
  850. @param y y
  851. @param height height
  852. @param jumps jumps
  853. @example
  854. ```js
  855. // example
  856. var actionBy = cc.jumpBy(2, cc.v2(300, 0), 50, 4);
  857. var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
  858. ```
  859. */
  860. export function jumpBy(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  861. /**
  862. !#en
  863. Moves a Node object to a parabolic position simulating a jump movement by modifying its position property. <br />
  864. Jump to the specified location.
  865. !#zh 用跳跃的方式移动到目标位置。
  866. @param duration duration
  867. @param position position
  868. @param y y
  869. @param height height
  870. @param jumps jumps
  871. @example
  872. ```js
  873. // example
  874. var actionTo = cc.jumpTo(2, cc.v2(300, 300), 50, 4);
  875. var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
  876. ```
  877. */
  878. export function jumpTo(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  879. /**
  880. !#en
  881. An action that moves the target with a cubic Bezier curve by a certain distance.
  882. Relative to its movement.
  883. !#zh 按贝赛尔曲线轨迹移动指定的距离。
  884. @param t time in seconds
  885. @param c Array of points
  886. @example
  887. ```js
  888. // example
  889. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  890. var bezierForward = cc.bezierBy(3, bezier);
  891. ```
  892. */
  893. export function bezierBy(t: number, c: Vec2[]): ActionInterval;
  894. /**
  895. !#en An action that moves the target with a cubic Bezier curve to a destination point.
  896. !#zh 按贝赛尔曲线轨迹移动到目标位置。
  897. @param t t
  898. @param c Array of points
  899. @example
  900. ```js
  901. // example
  902. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  903. var bezierTo = cc.bezierTo(2, bezier);
  904. ```
  905. */
  906. export function bezierTo(t: number, c: Vec2[]): ActionInterval;
  907. /**
  908. !#en Scales a Node object to a zoom factor by modifying it's scale property.
  909. !#zh 将节点大小缩放到指定的倍数。
  910. @param duration duration
  911. @param sx scale parameter in X
  912. @param sy scale parameter in Y, if Null equal to sx
  913. @example
  914. ```js
  915. // example
  916. // It scales to 0.5 in both X and Y.
  917. var actionTo = cc.scaleTo(2, 0.5);
  918. // It scales to 0.5 in x and 2 in Y
  919. var actionTo = cc.scaleTo(2, 0.5, 2);
  920. ```
  921. */
  922. export function scaleTo(duration: number, sx: number, sy?: number): ActionInterval;
  923. /**
  924. !#en
  925. Scales a Node object a zoom factor by modifying it's scale property.
  926. Relative to its changes.
  927. !#zh 按指定的倍数缩放节点大小。
  928. @param duration duration in seconds
  929. @param sx sx scale parameter in X
  930. @param sy sy scale parameter in Y, if Null equal to sx
  931. @example
  932. ```js
  933. // example without sy, it scales by 2 both in X and Y
  934. var actionBy = cc.scaleBy(2, 2);
  935. //example with sy, it scales by 0.25 in X and 4.5 in Y
  936. var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
  937. ```
  938. */
  939. export function scaleBy(duration: number, sx: number, sy?: number|void): ActionInterval;
  940. /**
  941. !#en Blinks a Node object by modifying it's visible property.
  942. !#zh 闪烁(基于透明度)。
  943. @param duration duration in seconds
  944. @param blinks blinks in times
  945. @example
  946. ```js
  947. // example
  948. var action = cc.blink(2, 10);
  949. ```
  950. */
  951. export function blink(duration: number, blinks: number): ActionInterval;
  952. /**
  953. !#en
  954. Fades an object that implements the cc.RGBAProtocol protocol.
  955. It modifies the opacity from the current value to a custom one.
  956. !#zh 修改透明度到指定值。
  957. @param duration duration
  958. @param opacity 0-255, 0 is transparent
  959. @example
  960. ```js
  961. // example
  962. var action = cc.fadeTo(1.0, 0);
  963. ```
  964. */
  965. export function fadeTo(duration: number, opacity: number): ActionInterval;
  966. /**
  967. !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
  968. !#zh 渐显效果。
  969. @param duration duration in seconds
  970. @example
  971. ```js
  972. //example
  973. var action = cc.fadeIn(1.0);
  974. ```
  975. */
  976. export function fadeIn(duration: number): ActionInterval;
  977. /**
  978. !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
  979. !#zh 渐隐效果。
  980. @param d duration in seconds
  981. @example
  982. ```js
  983. // example
  984. var action = cc.fadeOut(1.0);
  985. ```
  986. */
  987. export function fadeOut(d: number): ActionInterval;
  988. /**
  989. !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  990. !#zh 修改颜色到指定值。
  991. @param duration duration
  992. @param red 0-255
  993. @param green 0-255
  994. @param blue 0-255
  995. @example
  996. ```js
  997. // example
  998. var action = cc.tintTo(2, 255, 0, 255);
  999. ```
  1000. */
  1001. export function tintTo(duration: number, red: number, green: number, blue: number): ActionInterval;
  1002. /**
  1003. !#en
  1004. Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  1005. Relative to their own color change.
  1006. !#zh 按照指定的增量修改颜色。
  1007. @param duration duration in seconds
  1008. @param deltaRed deltaRed
  1009. @param deltaGreen deltaGreen
  1010. @param deltaBlue deltaBlue
  1011. @example
  1012. ```js
  1013. // example
  1014. var action = cc.tintBy(2, -127, -255, -127);
  1015. ```
  1016. */
  1017. export function tintBy(duration: number, deltaRed: number, deltaGreen: number, deltaBlue: number): ActionInterval;
  1018. /**
  1019. !#en Delays the action a certain amount of seconds.
  1020. !#zh 延迟指定的时间量。
  1021. @param d duration in seconds
  1022. @example
  1023. ```js
  1024. // example
  1025. var delay = cc.delayTime(1);
  1026. ```
  1027. */
  1028. export function delayTime(d: number): ActionInterval;
  1029. /**
  1030. !#en Executes an action in reverse order, from time=duration to time=0.
  1031. !#zh 反转目标动作的时间轴。
  1032. @param action action
  1033. @example
  1034. ```js
  1035. // example
  1036. var reverse = cc.reverseTime(this);
  1037. ```
  1038. */
  1039. export function reverseTime(action: FiniteTimeAction): ActionInterval;
  1040. /**
  1041. !#en Create an action with the specified action and forced target.
  1042. !#zh 用已有动作和一个新的目标节点创建动作。
  1043. @param target target
  1044. @param action action
  1045. */
  1046. export function targetedAction(target: Node, action: FiniteTimeAction): ActionInterval;
  1047. /**
  1048. !#en
  1049. Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
  1050. - In Cocos Creator, error is red.<br/>
  1051. - In Chrome, error have a red icon along with red message text.<br/>
  1052. !#zh
  1053. 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
  1054. - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
  1055. - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
  1056. @param msg A JavaScript string containing zero or more substitution strings.
  1057. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1058. */
  1059. export function error(msg: any, ...subst: any[]): void;
  1060. /**
  1061. !#en
  1062. Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).
  1063. - In Cocos Creator, warning is yellow.
  1064. - In Chrome, warning have a yellow warning icon with the message text.
  1065. !#zh
  1066. 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>
  1067. - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
  1068. - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
  1069. @param msg A JavaScript string containing zero or more substitution strings.
  1070. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1071. */
  1072. export function warn(msg: any, ...subst: any[]): void;
  1073. /**
  1074. !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
  1075. !#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
  1076. @param msg A JavaScript string containing zero or more substitution strings.
  1077. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1078. */
  1079. export function log(msg: string|any, ...subst: any[]): void;
  1080. /** !#en Director
  1081. !#zh 导演类。 */
  1082. export var director: Director;
  1083. /** !#en This is a Game instance.
  1084. !#zh 这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。。 */
  1085. export var game: Game;
  1086. /** !#en The System event singleton for global usage
  1087. !#zh 系统事件单例,方便全局使用 */
  1088. export var systemEvent: SystemEvent;
  1089. /**
  1090. !#en Defines a CCClass using the given specification, please see [Class](/docs/editors_and_tools/creator-chapters/scripting/class.html) for details.
  1091. !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/docs/creator/scripting/class.html)。
  1092. @param options options
  1093. @example
  1094. ```js
  1095. // define base class
  1096. var Node = cc.Class();
  1097. // define sub class
  1098. var Sprite = cc.Class({
  1099. name: 'Sprite',
  1100. extends: Node,
  1101. ctor: function () {
  1102. this.url = "";
  1103. this.id = 0;
  1104. },
  1105. statics: {
  1106. // define static members
  1107. count: 0,
  1108. getBounds: function (spriteList) {
  1109. // compute bounds...
  1110. }
  1111. },
  1112. properties {
  1113. width: {
  1114. default: 128,
  1115. type: 'Integer',
  1116. tooltip: 'The width of sprite'
  1117. },
  1118. height: 128,
  1119. size: {
  1120. get: function () {
  1121. return cc.v2(this.width, this.height);
  1122. }
  1123. }
  1124. },
  1125. load: function () {
  1126. // load this.url...
  1127. };
  1128. });
  1129. // instantiate
  1130. var obj = new Sprite();
  1131. obj.url = 'sprite.png';
  1132. obj.load();
  1133. ```
  1134. */
  1135. 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;
  1136. /**
  1137. !#en
  1138. Define an enum type. <br/>
  1139. 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/>
  1140. Otherwise it will use the value specified by user who writes the enum definition.
  1141. !#zh
  1142. 定义一个枚举类型。<br/>
  1143. 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  1144. @param obj a JavaScript literal object containing enum names and values, or a TypeScript enum type
  1145. @example
  1146. ```js
  1147. // JavaScript:
  1148. var WrapMode = cc.Enum({
  1149. Repeat: -1,
  1150. Clamp: -1
  1151. });
  1152. // Texture.WrapMode.Repeat == 0
  1153. // Texture.WrapMode.Clamp == 1
  1154. // Texture.WrapMode[0] == "Repeat"
  1155. // Texture.WrapMode[1] == "Clamp"
  1156. var FlagType = cc.Enum({
  1157. Flag1: 1,
  1158. Flag2: 2,
  1159. Flag3: 4,
  1160. Flag4: 8,
  1161. });
  1162. var AtlasSizeList = cc.Enum({
  1163. 128: 128,
  1164. 256: 256,
  1165. 512: 512,
  1166. 1024: 1024,
  1167. });
  1168. // TypeScript:
  1169. // If used in TypeScript, just define a TypeScript enum:
  1170. enum Direction {
  1171. Up,
  1172. Down,
  1173. Left,
  1174. Right
  1175. }
  1176. // If you need to inspect the enum in Properties panel, you can call cc.Enum:
  1177. const {ccclass, property} = cc._decorator;
  1178. @ccclass
  1179. class NewScript extends cc.Component {
  1180. @property({
  1181. type: cc.Enum(Direction) // call cc.Enum
  1182. })
  1183. direction: Direction = Direction.Up;
  1184. }
  1185. ```
  1186. */
  1187. export function Enum<T>(obj: T): T;
  1188. /**
  1189. @param touches touches
  1190. */
  1191. export function handleTouchesBegin(touches: any[]): void;
  1192. /**
  1193. @param touches touches
  1194. */
  1195. export function handleTouchesMove(touches: any[]): void;
  1196. /**
  1197. @param touches touches
  1198. */
  1199. export function handleTouchesEnd(touches: any[]): void;
  1200. /**
  1201. @param touches touches
  1202. */
  1203. export function handleTouchesCancel(touches: any[]): void;
  1204. /**
  1205. @param touches touches
  1206. */
  1207. export function getSetOfTouchesEndOrCancel(touches: any[]): any[];
  1208. /**
  1209. @param element element
  1210. */
  1211. export function getHTMLElementPosition(element: HTMLElement): any;
  1212. /**
  1213. @param touch touch
  1214. */
  1215. export function getPreTouch(touch: Touch): Touch;
  1216. /**
  1217. @param touch touch
  1218. */
  1219. export function setPreTouch(touch: Touch): void;
  1220. /**
  1221. @param tx tx
  1222. @param ty ty
  1223. @param pos pos
  1224. */
  1225. export function getTouchByXY(tx: number, ty: number, pos: Vec2): Touch;
  1226. /**
  1227. @param location location
  1228. @param pos pos
  1229. @param eventType eventType
  1230. */
  1231. export function getMouseEvent(location: Vec2, pos: Vec2, eventType: number): Event.EventMouse;
  1232. /**
  1233. @param event event
  1234. @param pos pos
  1235. */
  1236. export function getPointByEvent(event: Touch, pos: Vec2): Vec2;
  1237. /**
  1238. @param event event
  1239. @param pos pos
  1240. */
  1241. export function getTouchesByEvent(event: Touch, pos: Vec2): any[];
  1242. /**
  1243. @param element element
  1244. */
  1245. export function registerSystemEvent(element: HTMLElement): void;
  1246. /**
  1247. @param dt dt
  1248. */
  1249. export function update(dt: number): void;
  1250. /**
  1251. !#en
  1252. Checks whether the object is non-nil and not yet destroyed.<br>
  1253. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  1254. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  1255. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  1256. but this is often caused by a particular logical requirements, which is not normally required.
  1257. !#zh
  1258. 检查该对象是否不为 null 并且尚未销毁。<br>
  1259. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
  1260. @param value value
  1261. @param strictMode If true, Object called destroy() in this frame will also treated as invalid.
  1262. @example
  1263. ```js
  1264. var node = new cc.Node();
  1265. cc.log(cc.isValid(node)); // true
  1266. node.destroy();
  1267. cc.log(cc.isValid(node)); // true, still valid in this frame
  1268. // after a frame...
  1269. cc.log(cc.isValid(node)); // false, destroyed in the end of last frame
  1270. ```
  1271. */
  1272. export function isValid(value: any, strictMode?: boolean): boolean;
  1273. /** !#en cc.view is the shared view object.
  1274. !#zh cc.view 是全局的视图对象。 */
  1275. export var view: View;
  1276. /** !#en cc.winSize is the alias object for the size of the current game window.
  1277. !#zh cc.winSize 为当前的游戏窗口的大小。 */
  1278. export var winSize: Size;
  1279. /** Specify that the input value must be integer in Inspector.
  1280. Also used to indicates that the elements in array should be type integer. */
  1281. export var Integer: string;
  1282. /** Indicates that the elements in array should be type double. */
  1283. export var Float: string;
  1284. /** Indicates that the elements in array should be type boolean. */
  1285. export var Boolean: string;
  1286. /** Indicates that the elements in array should be type string. */
  1287. export var String: string;
  1288. /**
  1289. !#en Deserialize json to cc.Asset
  1290. !#zh 将 JSON 反序列化为对象实例。
  1291. 当指定了 target 选项时,如果 target 引用的其它 asset 的 uuid 不变,则不会改变 target 对 asset 的引用,
  1292. 也不会将 uuid 保存到 result 对象中。
  1293. @param data the serialized cc.Asset json string or json object.
  1294. @param details additional loading result
  1295. @param options options
  1296. */
  1297. export function deserialize(data: string|any, details?: Details, options?: any): any;
  1298. /**
  1299. !#en Clones the object `original` and returns the clone, or instantiate a node from the Prefab.
  1300. !#zh 克隆指定的任意类型的对象,或者从 Prefab 实例化出新节点。
  1301. (Instantiate 时,function 和 dom 等非可序列化对象会直接保留原有引用,Asset 会直接进行浅拷贝,可序列化类型会进行深拷贝。)
  1302. @param original An existing object that you want to make a copy of.
  1303. @example
  1304. ```js
  1305. // instantiate node from prefab
  1306. var scene = cc.director.getScene();
  1307. var node = cc.instantiate(prefabAsset);
  1308. node.parent = scene;
  1309. // clone node
  1310. var scene = cc.director.getScene();
  1311. var node = cc.instantiate(targetNode);
  1312. node.parent = scene;
  1313. ```
  1314. */
  1315. export function instantiate(original: Prefab): Node;
  1316. export function instantiate<T>(original: T): T;
  1317. /**
  1318. Finds a node by hierarchy path, the path is case-sensitive.
  1319. It will traverse the hierarchy by splitting the path using '/' character.
  1320. This function will still returns the node even if it is inactive.
  1321. It is recommended to not use this function every frame instead cache the result at startup.
  1322. @param path path
  1323. @param referenceNode referenceNode
  1324. */
  1325. export function find(path: string, referenceNode?: Node): Node;
  1326. /**
  1327. !#en
  1328. The convenience method to create a new {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}}
  1329. Alpha channel is optional. Default value is 255.
  1330. !#zh
  1331. 通过该方法来创建一个新的 {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}} 对象。
  1332. Alpha 通道是可选的。默认值是 255。
  1333. @param r r
  1334. @param g g
  1335. @param b b
  1336. @param a a
  1337. @example
  1338. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/color.js
  1339. */
  1340. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  1341. /**
  1342. !#en
  1343. The convenience method to create a new Rect.
  1344. see {{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1345. !#zh
  1346. 该方法用来快速创建一个新的矩形。{{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1347. @param x x
  1348. @param y y
  1349. @param w w
  1350. @param h h
  1351. @example
  1352. ```js
  1353. var a = new cc.Rect(0 , 0, 10, 0);
  1354. ```
  1355. */
  1356. export function rect(x?: number, y?: number, w?: number, h?: number): Rect;
  1357. /**
  1358. !#en
  1359. Helper function that creates a cc.Size.<br/>
  1360. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.
  1361. !#zh
  1362. 创建一个 cc.Size 对象的帮助函数。<br/>
  1363. 注意:可以使用 cc.p 或者是 cc.v2 代替,它们将很快取代 cc.Size。
  1364. @param w width or a size object
  1365. @param h height
  1366. @example
  1367. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCSize/size.js
  1368. */
  1369. export function size(w: number|Size, h?: number): Size;
  1370. /**
  1371. !#en The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
  1372. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}} 对象。
  1373. @param x x
  1374. @param y y
  1375. @example
  1376. ```js
  1377. var v1 = cc.v2();
  1378. var v2 = cc.v2(0, 0);
  1379. var v3 = cc.v2(v2);
  1380. var v4 = cc.v2({x: 100, y: 100});
  1381. ```
  1382. */
  1383. export function v2(x?: number|any, y?: number): Vec2;
  1384. /**
  1385. !#en This function is deprecated since v2.0, please use {{#crossLink "v2"}}cc.v2{{/crossLink}}.
  1386. !#zh 这个函数从 v2.0 开始被废弃,请使用 {{#crossLink "v2"}}cc.v2{{/crossLink}}。
  1387. @param x a Number or a size object
  1388. @param y y
  1389. */
  1390. export function p(x?: number|any, y?: number): Vec2;
  1391. export var dynamicAtlasManager: DynamicAtlasManager;
  1392. /** !#en Base class cc.Action for action classes.
  1393. !#zh Action 类是所有动作类型的基类。 */
  1394. export class Action {
  1395. /**
  1396. !#en
  1397. to copy object with deep copy.
  1398. returns a clone of action.
  1399. !#zh 返回一个克隆的动作。
  1400. */
  1401. clone(): Action;
  1402. /**
  1403. !#en
  1404. return true if the action has finished.
  1405. !#zh 如果动作已完成就返回 true。
  1406. */
  1407. isDone(): boolean;
  1408. /**
  1409. !#en get the target.
  1410. !#zh 获取当前目标节点。
  1411. */
  1412. getTarget(): Node;
  1413. /**
  1414. !#en The action will modify the target properties.
  1415. !#zh 设置目标节点。
  1416. @param target target
  1417. */
  1418. setTarget(target: Node): void;
  1419. /**
  1420. !#en get the original target.
  1421. !#zh 获取原始目标节点。
  1422. */
  1423. getOriginalTarget(): Node;
  1424. /**
  1425. !#en get tag number.
  1426. !#zh 获取用于识别动作的标签。
  1427. */
  1428. getTag(): number;
  1429. /**
  1430. !#en set tag number.
  1431. !#zh 设置标签,用于识别动作。
  1432. @param tag tag
  1433. */
  1434. setTag(tag: number): void;
  1435. /** !#en Default Action tag.
  1436. !#zh 默认动作标签。 */
  1437. static TAG_INVALID: number;
  1438. }
  1439. /** !#en
  1440. Base class actions that do have a finite time duration. <br/>
  1441. Possible actions: <br/>
  1442. - An action with a duration of 0 seconds. <br/>
  1443. - An action with a duration of 35.5 seconds.
  1444. Infinite time actions are valid
  1445. !#zh 有限时间动作,这种动作拥有时长 duration 属性。 */
  1446. export class FiniteTimeAction extends Action {
  1447. /**
  1448. !#en get duration of the action. (seconds).
  1449. !#zh 获取动作以秒为单位的持续时间。
  1450. */
  1451. getDuration(): number;
  1452. /**
  1453. !#en set duration of the action. (seconds).
  1454. !#zh 设置动作以秒为单位的持续时间。
  1455. @param duration duration
  1456. */
  1457. setDuration(duration: number): void;
  1458. /**
  1459. !#en
  1460. Returns a reversed action. <br />
  1461. For example: <br />
  1462. - The action will be x coordinates of 0 move to 100. <br />
  1463. - The reversed action will be x of 100 move to 0.
  1464. - Will be rewritten
  1465. !#zh 返回一个新的动作,执行与原动作完全相反的动作。
  1466. */
  1467. reverse(): void;
  1468. /**
  1469. !#en
  1470. to copy object with deep copy.
  1471. returns a clone of action.
  1472. !#zh 返回一个克隆的动作。
  1473. */
  1474. clone(): FiniteTimeAction;
  1475. }
  1476. /** !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions.
  1477. !#zh 即时动作,这种动作立即就会执行,继承自 FiniteTimeAction。 */
  1478. export class ActionInstant extends FiniteTimeAction {
  1479. }
  1480. /** !#en
  1481. <p> An interval action is an action that takes place within a certain period of time. <br/>
  1482. It has an start time, and a finish time. The finish time is the parameter<br/>
  1483. duration plus the start time.</p>
  1484. <p>These CCActionInterval actions have some interesting properties, like:<br/>
  1485. - They can run normally (default) <br/>
  1486. - They can run reversed with the reverse method <br/>
  1487. - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>
  1488. <p>For example, you can simulate a Ping Pong effect running the action normally and<br/>
  1489. then running it again in Reverse mode. </p>
  1490. !#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。 */
  1491. export class ActionInterval extends FiniteTimeAction {
  1492. /**
  1493. !#en Implementation of ease motion.
  1494. !#zh 缓动运动。
  1495. @param easeObj easeObj
  1496. @example
  1497. ```js
  1498. action.easing(cc.easeIn(3.0));
  1499. ```
  1500. */
  1501. easing(easeObj: any): ActionInterval;
  1502. /**
  1503. !#en
  1504. Repeats an action a number of times.
  1505. To repeat an action forever use the CCRepeatForever action.
  1506. !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。
  1507. @param times times
  1508. */
  1509. repeat(times: number): ActionInterval;
  1510. /**
  1511. !#en
  1512. Repeats an action for ever. <br/>
  1513. To repeat the an action for a limited number of times use the Repeat action. <br/>
  1514. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。
  1515. */
  1516. repeatForever(): ActionInterval;
  1517. }
  1518. /** !#en
  1519. cc.ActionManager is a class that can manage actions.<br/>
  1520. Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
  1521. which uses this class's singleton object.
  1522. But there are some cases where you might need to use this class. <br/>
  1523. Examples:<br/>
  1524. - When you want to run an action where the target is different from a CCNode.<br/>
  1525. - When you want to pause / resume the actions<br/>
  1526. !#zh
  1527. cc.ActionManager 是可以管理动作的单例类。<br/>
  1528. 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
  1529. 但也有一些情况下,您可能需要使用这个类。 <br/>
  1530. 例如:
  1531. - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
  1532. - 当你想要暂停/恢复动作时。 <br/> */
  1533. export class ActionManager {
  1534. /**
  1535. !#en
  1536. Adds an action with a target.<br/>
  1537. If the target is already present, then the action will be added to the existing target.
  1538. 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.
  1539. When the target is paused, the queued actions won't be 'ticked'.
  1540. !#zh
  1541. 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
  1542. 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
  1543. 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
  1544. 当目标状态的 paused 为 true,动作将不会被执行
  1545. @param action action
  1546. @param target target
  1547. @param paused paused
  1548. */
  1549. addAction(action: Action, target: Node, paused: boolean): void;
  1550. /**
  1551. !#en Removes all actions from all the targets.
  1552. !#zh 移除所有对象的所有动作。
  1553. */
  1554. removeAllActions(): void;
  1555. /**
  1556. !#en
  1557. Removes all actions from a certain target. <br/>
  1558. All the actions that belongs to the target will be removed.
  1559. !#zh
  1560. 移除指定对象上的所有动作。<br/>
  1561. 属于该目标的所有的动作将被删除。
  1562. @param target target
  1563. @param forceDelete forceDelete
  1564. */
  1565. removeAllActionsFromTarget(target: Node, forceDelete: boolean): void;
  1566. /**
  1567. !#en Removes an action given an action reference.
  1568. !#zh 移除指定的动作。
  1569. @param action action
  1570. */
  1571. removeAction(action: Action): void;
  1572. /**
  1573. !#en Removes an action given its tag and the target.
  1574. !#zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
  1575. @param tag tag
  1576. @param target target
  1577. */
  1578. removeActionByTag(tag: number, target: Node): void;
  1579. /**
  1580. !#en Gets an action given its tag an a target.
  1581. !#zh 通过目标对象和标签获取一个动作。
  1582. @param tag tag
  1583. @param target target
  1584. */
  1585. getActionByTag(tag: number, target: Node): Action;
  1586. /**
  1587. !#en
  1588. Returns the numbers of actions that are running in a certain target. <br/>
  1589. Composable actions are counted as 1 action. <br/>
  1590. Example: <br/>
  1591. - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  1592. - If you are running 7 Sequences of 2 actions, it will return 7.
  1593. !#zh
  1594. 返回指定对象下所有正在运行的动作数量。 <br/>
  1595. 组合动作被算作一个动作。<br/>
  1596. 例如:<br/>
  1597. - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
  1598. - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
  1599. @param target target
  1600. */
  1601. getNumberOfRunningActionsInTarget(target: Node): number;
  1602. /**
  1603. !#en Pauses the target: all running actions and newly added actions will be paused.
  1604. !#zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
  1605. @param target target
  1606. */
  1607. pauseTarget(target: Node): void;
  1608. /**
  1609. !#en Resumes the target. All queued actions will be resumed.
  1610. !#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
  1611. @param target target
  1612. */
  1613. resumeTarget(target: Node): void;
  1614. /**
  1615. !#en Pauses all running actions, returning a list of targets whose actions were paused.
  1616. !#zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
  1617. */
  1618. pauseAllRunningActions(): any[];
  1619. /**
  1620. !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
  1621. !#zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
  1622. @param targetsToResume targetsToResume
  1623. */
  1624. resumeTargets(targetsToResume: any[]): void;
  1625. /**
  1626. !#en Pause a set of targets.
  1627. !#zh 暂停一组指定对象。
  1628. @param targetsToPause targetsToPause
  1629. */
  1630. pauseTargets(targetsToPause: any[]): void;
  1631. /**
  1632. !#en
  1633. purges the shared action manager. It releases the retained instance. <br/>
  1634. because it uses this, so it can not be static.
  1635. !#zh
  1636. 清除共用的动作管理器。它释放了持有的实例。 <br/>
  1637. 因为它使用 this,因此它不能是静态的。
  1638. */
  1639. purgeSharedManager(): void;
  1640. /**
  1641. !#en The ActionManager update。
  1642. !#zh ActionManager 主循环。
  1643. @param dt delta time in seconds
  1644. */
  1645. update(dt: number): void;
  1646. }
  1647. /** Class for particle asset handling. */
  1648. export class ParticleAsset extends Asset {
  1649. }
  1650. /** Particle System base class. <br/>
  1651. Attributes of a Particle System:<br/>
  1652. - emmision rate of the particles<br/>
  1653. - Gravity Mode (Mode A): <br/>
  1654. - gravity <br/>
  1655. - direction <br/>
  1656. - speed +- variance <br/>
  1657. - tangential acceleration +- variance<br/>
  1658. - radial acceleration +- variance<br/>
  1659. - Radius Mode (Mode B): <br/>
  1660. - startRadius +- variance <br/>
  1661. - endRadius +- variance <br/>
  1662. - rotate +- variance <br/>
  1663. - Properties common to all modes: <br/>
  1664. - life +- life variance <br/>
  1665. - start spin +- variance <br/>
  1666. - end spin +- variance <br/>
  1667. - start size +- variance <br/>
  1668. - end size +- variance <br/>
  1669. - start color +- variance <br/>
  1670. - end color +- variance <br/>
  1671. - life +- variance <br/>
  1672. - blending function <br/>
  1673. - texture <br/>
  1674. <br/>
  1675. cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
  1676. 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
  1677. cocos2d uses a another approach, but the results are almost identical.<br/>
  1678. cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
  1679. - spinning particles (supported when using ParticleSystem) <br/>
  1680. - tangential acceleration (Gravity mode) <br/>
  1681. - radial acceleration (Gravity mode) <br/>
  1682. - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
  1683. It is possible to customize any of the above mentioned properties in runtime. Example: <br/> */
  1684. export class ParticleSystem extends RenderComponent {
  1685. /** !#en Play particle in edit mode.
  1686. !#zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。 */
  1687. preview: boolean;
  1688. /** !#en
  1689. If set custom to true, then use custom properties insteadof read particle file.
  1690. !#zh 是否自定义粒子属性。 */
  1691. custom: boolean;
  1692. /** !#en The plist file.
  1693. !#zh plist 格式的粒子配置文件。 */
  1694. file: string;
  1695. /** !#en SpriteFrame used for particles display
  1696. !#zh 用于粒子呈现的 SpriteFrame */
  1697. spriteFrame: SpriteFrame;
  1698. /** !#en Texture of Particle System, readonly, please use spriteFrame to setup new texture。
  1699. !#zh 粒子贴图,只读属性,请使用 spriteFrame 属性来替换贴图。 */
  1700. texture: string;
  1701. /** !#en Current quantity of particles that are being simulated.
  1702. !#zh 当前播放的粒子数量。 */
  1703. particleCount: number;
  1704. /** !#en Indicate whether the system simulation have stopped.
  1705. !#zh 指示粒子播放是否完毕。 */
  1706. stopped: boolean;
  1707. /** !#en If set to true, the particle system will automatically start playing on onLoad.
  1708. !#zh 如果设置为 true 运行时会自动发射粒子。 */
  1709. playOnLoad: boolean;
  1710. /** !#en Indicate whether the owner node will be auto-removed when it has no particles left.
  1711. !#zh 粒子播放完毕后自动销毁所在的节点。 */
  1712. autoRemoveOnFinish: boolean;
  1713. /** !#en Indicate whether the particle system is activated.
  1714. !#zh 是否激活粒子。 */
  1715. active: boolean;
  1716. /** !#en Maximum particles of the system.
  1717. !#zh 粒子最大数量。 */
  1718. totalParticles: number;
  1719. /** !#en How many seconds the emitter wil run. -1 means 'forever'.
  1720. !#zh 发射器生存时间,单位秒,-1表示持续发射。 */
  1721. duration: number;
  1722. /** !#en Emission rate of the particles.
  1723. !#zh 每秒发射的粒子数目。 */
  1724. emissionRate: number;
  1725. /** !#en Life of each particle setter.
  1726. !#zh 粒子的运行时间。 */
  1727. life: number;
  1728. /** !#en Variation of life.
  1729. !#zh 粒子的运行时间变化范围。 */
  1730. lifeVar: number;
  1731. /** !#en Start color of each particle.
  1732. !#zh 粒子初始颜色。 */
  1733. startColor: cc.Color;
  1734. /** !#en Variation of the start color.
  1735. !#zh 粒子初始颜色变化范围。 */
  1736. startColorVar: cc.Color;
  1737. /** !#en Ending color of each particle.
  1738. !#zh 粒子结束颜色。 */
  1739. endColor: cc.Color;
  1740. /** !#en Variation of the end color.
  1741. !#zh 粒子结束颜色变化范围。 */
  1742. endColorVar: cc.Color;
  1743. /** !#en Angle of each particle setter.
  1744. !#zh 粒子角度。 */
  1745. angle: number;
  1746. /** !#en Variation of angle of each particle setter.
  1747. !#zh 粒子角度变化范围。 */
  1748. angleVar: number;
  1749. /** !#en Start size in pixels of each particle.
  1750. !#zh 粒子的初始大小。 */
  1751. startSize: number;
  1752. /** !#en Variation of start size in pixels.
  1753. !#zh 粒子初始大小的变化范围。 */
  1754. startSizeVar: number;
  1755. /** !#en End size in pixels of each particle.
  1756. !#zh 粒子结束时的大小。 */
  1757. endSize: number;
  1758. /** !#en Variation of end size in pixels.
  1759. !#zh 粒子结束大小的变化范围。 */
  1760. endSizeVar: number;
  1761. /** !#en Start angle of each particle.
  1762. !#zh 粒子开始自旋角度。 */
  1763. startSpin: number;
  1764. /** !#en Variation of start angle.
  1765. !#zh 粒子开始自旋角度变化范围。 */
  1766. startSpinVar: number;
  1767. /** !#en End angle of each particle.
  1768. !#zh 粒子结束自旋角度。 */
  1769. endSpin: number;
  1770. /** !#en Variation of end angle.
  1771. !#zh 粒子结束自旋角度变化范围。 */
  1772. endSpinVar: number;
  1773. /** !#en Source position of the emitter.
  1774. !#zh 发射器位置。 */
  1775. sourcePos: Vec2;
  1776. /** !#en Variation of source position.
  1777. !#zh 发射器位置的变化范围。(横向和纵向) */
  1778. posVar: Vec2;
  1779. /** !#en Particles movement type.
  1780. !#zh 粒子位置类型。 */
  1781. positionType: ParticleSystem.PositionType;
  1782. /** !#en Particles emitter modes.
  1783. !#zh 发射器类型。 */
  1784. emitterMode: ParticleSystem.EmitterMode;
  1785. /** !#en Gravity of the emitter.
  1786. !#zh 重力。 */
  1787. gravity: Vec2;
  1788. /** !#en Speed of the emitter.
  1789. !#zh 速度。 */
  1790. speed: number;
  1791. /** !#en Variation of the speed.
  1792. !#zh 速度变化范围。 */
  1793. speedVar: number;
  1794. /** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  1795. !#zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。 */
  1796. tangentialAccel: number;
  1797. /** !#en Variation of the tangential acceleration.
  1798. !#zh 每个粒子的切向加速度变化范围。 */
  1799. tangentialAccelVar: number;
  1800. /** !#en Acceleration of each particle. Only available in 'Gravity' mode.
  1801. !#zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。 */
  1802. radialAccel: number;
  1803. /** !#en Variation of the radial acceleration.
  1804. !#zh 粒子径向加速度变化范围。 */
  1805. radialAccelVar: number;
  1806. /** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  1807. !#zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。 */
  1808. rotationIsDir: boolean;
  1809. /** !#en Starting radius of the particles. Only available in 'Radius' mode.
  1810. !#zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。 */
  1811. startRadius: number;
  1812. /** !#en Variation of the starting radius.
  1813. !#zh 初始半径变化范围。 */
  1814. startRadiusVar: number;
  1815. /** !#en Ending radius of the particles. Only available in 'Radius' mode.
  1816. !#zh 结束半径,只有在半径模式下可用。 */
  1817. endRadius: number;
  1818. /** !#en Variation of the ending radius.
  1819. !#zh 结束半径变化范围。 */
  1820. endRadiusVar: number;
  1821. /** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  1822. !#zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。 */
  1823. rotatePerS: number;
  1824. /** !#en Variation of the degress to rotate a particle around the source pos per second.
  1825. !#zh 粒子每秒围绕起始点的旋转角度变化范围。 */
  1826. rotatePerSVar: number;
  1827. /** !#en The Particle emitter lives forever.
  1828. !#zh 表示发射器永久存在 */
  1829. static DURATION_INFINITY: number;
  1830. /** !#en The starting size of the particle is equal to the ending size.
  1831. !#zh 表示粒子的起始大小等于结束大小。 */
  1832. static START_SIZE_EQUAL_TO_END_SIZE: number;
  1833. /** !#en The starting radius of the particle is equal to the ending radius.
  1834. !#zh 表示粒子的起始半径等于结束半径。 */
  1835. static START_RADIUS_EQUAL_TO_END_RADIUS: number;
  1836. /**
  1837. !#en Stop emitting particles. Running particles will continue to run until they die.
  1838. !#zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  1839. @example
  1840. ```js
  1841. // stop particle system.
  1842. myParticleSystem.stopSystem();
  1843. ```
  1844. */
  1845. stopSystem(): void;
  1846. /**
  1847. !#en Kill all living particles.
  1848. !#zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  1849. @example
  1850. ```js
  1851. // play particle system.
  1852. myParticleSystem.resetSystem();
  1853. ```
  1854. */
  1855. resetSystem(): void;
  1856. /**
  1857. !#en Whether or not the system is full.
  1858. !#zh 发射器中粒子是否大于等于设置的总粒子数量。
  1859. */
  1860. isFull(): boolean;
  1861. /**
  1862. !#en Sets a new texture with a rect. The rect is in texture position and size.
  1863. Please use spriteFrame property instead, this function is deprecated since v1.9
  1864. !#zh 设置一张新贴图和关联的矩形。
  1865. 请直接设置 spriteFrame 属性,这个函数从 v1.9 版本开始已经被废弃
  1866. @param texture texture
  1867. @param rect rect
  1868. */
  1869. setTextureWithRect(texture: Texture2D, rect: Rect): void;
  1870. }
  1871. /** !#en Class for animation data handling.
  1872. !#zh 动画剪辑,用于存储动画数据。 */
  1873. export class AnimationClip extends Asset {
  1874. /** !#en Duration of this animation.
  1875. !#zh 动画的持续时间。 */
  1876. duration: number;
  1877. /** !#en FrameRate of this animation.
  1878. !#zh 动画的帧速率。 */
  1879. sample: number;
  1880. /** !#en Speed of this animation.
  1881. !#zh 动画的播放速度。 */
  1882. speed: number;
  1883. /** !#en WrapMode of this animation.
  1884. !#zh 动画的循环模式。 */
  1885. wrapMode: WrapMode;
  1886. /** !#en Curve data.
  1887. !#zh 曲线数据。 */
  1888. curveData: any;
  1889. /** !#en Event data.
  1890. !#zh 事件数据。 */
  1891. events: {frame: number, func: string, params: string[]}[];
  1892. /**
  1893. !#en Crate clip with a set of sprite frames
  1894. !#zh 使用一组序列帧图片来创建动画剪辑
  1895. @param spriteFrames spriteFrames
  1896. @param sample sample
  1897. @example
  1898. ```js
  1899. var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  1900. ```
  1901. */
  1902. static createWithSpriteFrames(spriteFrames: [SpriteFrame], sample: number): AnimationClip;
  1903. }
  1904. /** !#en
  1905. The AnimationState gives full control over animation playback process.
  1906. In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  1907. !#zh
  1908. AnimationState 完全控制动画播放过程。<br/>
  1909. 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 */
  1910. export class AnimationState extends Playable {
  1911. /**
  1912. @param clip clip
  1913. @param name name
  1914. */
  1915. constructor(clip: AnimationClip, name?: string);
  1916. animator: AnimationAnimator;
  1917. /** !#en The curves list.
  1918. !#zh 曲线列表。 */
  1919. curves: any[];
  1920. /** !#en The start delay which represents the number of seconds from an animation's start time to the start of
  1921. the active interval.
  1922. !#zh 延迟多少秒播放。 */
  1923. delay: number;
  1924. /** !#en The animation's iteration count property.
  1925. A real number greater than or equal to zero (including positive infinity) representing the number of times
  1926. to repeat the animation node.
  1927. Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  1928. calculations.
  1929. !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) */
  1930. repeatCount: number;
  1931. /** !#en The iteration duration of this animation in seconds. (length)
  1932. !#zh 单次动画的持续时间,秒。 */
  1933. duration: number;
  1934. /** !#en The animation's playback speed. 1 is normal playback speed.
  1935. !#zh 播放速率。 */
  1936. speed: number;
  1937. /** !#en
  1938. Wrapping mode of the playing animation.
  1939. Notice : dynamic change wrapMode will reset time and repeatCount property
  1940. !#zh
  1941. 动画循环方式。
  1942. 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount */
  1943. wrapMode: WrapMode;
  1944. /** !#en The current time of this animation in seconds.
  1945. !#zh 动画当前的时间,秒。 */
  1946. time: number;
  1947. /** !#en The clip that is being played by this animation state.
  1948. !#zh 此动画状态正在播放的剪辑。 */
  1949. clip: AnimationClip;
  1950. /** !#en The name of the playing animation.
  1951. !#zh 动画的名字 */
  1952. name: string;
  1953. }
  1954. /** undefined */
  1955. export class Playable {
  1956. /** !#en Is playing or paused in play mode?
  1957. !#zh 当前是否正在播放。 */
  1958. isPlaying: boolean;
  1959. /** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).
  1960. !#zh 当前是否正在暂停 */
  1961. isPaused: boolean;
  1962. /**
  1963. !#en Play this animation.
  1964. !#zh 播放动画。
  1965. */
  1966. play(): void;
  1967. /**
  1968. !#en Stop this animation.
  1969. !#zh 停止动画播放。
  1970. */
  1971. stop(): void;
  1972. /**
  1973. !#en Pause this animation.
  1974. !#zh 暂停动画。
  1975. */
  1976. pause(): void;
  1977. /**
  1978. !#en Resume this animation.
  1979. !#zh 重新播放动画。
  1980. */
  1981. resume(): void;
  1982. /**
  1983. !#en Perform a single frame step.
  1984. !#zh 执行一帧动画。
  1985. */
  1986. step(): void;
  1987. }
  1988. /** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.
  1989. !#zh 动画使用的循环模式。 */
  1990. export enum WrapMode {
  1991. Default = 0,
  1992. Normal = 0,
  1993. Reverse = 0,
  1994. Loop = 0,
  1995. LoopReverse = 0,
  1996. PingPong = 0,
  1997. PingPongReverse = 0,
  1998. }
  1999. /** !#en cc.audioEngine is the singleton object, it provide simple audio APIs.
  2000. !#zh
  2001. cc.audioengine是单例对象。<br/>
  2002. 主要用来播放音频,播放的时候会返回一个 audioID,之后都可以通过这个 audioID 来操作这个音频对象。<br/>
  2003. 不使用的时候,请使用 cc.audioEngine.uncache(filePath); 进行资源释放 <br/>
  2004. 注意:<br/>
  2005. 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。<br/>
  2006. 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,<br/>
  2007. 有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。 */
  2008. export class audioEngine {
  2009. /**
  2010. !#en Play audio.
  2011. !#zh 播放音频
  2012. @param clip The audio clip to play.
  2013. @param loop Whether the music loop or not.
  2014. @param volume Volume size.
  2015. @example
  2016. ```js
  2017. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  2018. var audioID = cc.audioEngine.play(clip, false, 0.5);
  2019. });
  2020. ```
  2021. */
  2022. static play(clip: AudioClip, loop: boolean, volume: number): number;
  2023. /**
  2024. !#en Set audio loop.
  2025. !#zh 设置音频是否循环。
  2026. @param audioID audio id.
  2027. @param loop Whether cycle.
  2028. @example
  2029. ```js
  2030. cc.audioEngine.setLoop(id, true);
  2031. ```
  2032. */
  2033. static setLoop(audioID: number, loop: boolean): void;
  2034. /**
  2035. !#en Get audio cycle state.
  2036. !#zh 获取音频的循环状态。
  2037. @param audioID audio id.
  2038. @example
  2039. ```js
  2040. cc.audioEngine.isLoop(id);
  2041. ```
  2042. */
  2043. static isLoop(audioID: number): boolean;
  2044. /**
  2045. !#en Set the volume of audio.
  2046. !#zh 设置音量(0.0 ~ 1.0)。
  2047. @param audioID audio id.
  2048. @param volume Volume must be in 0.0~1.0 .
  2049. @example
  2050. ```js
  2051. cc.audioEngine.setVolume(id, 0.5);
  2052. ```
  2053. */
  2054. static setVolume(audioID: number, volume: number): void;
  2055. /**
  2056. !#en The volume of the music max value is 1.0,the min value is 0.0 .
  2057. !#zh 获取音量(0.0 ~ 1.0)。
  2058. @param audioID audio id.
  2059. @example
  2060. ```js
  2061. var volume = cc.audioEngine.getVolume(id);
  2062. ```
  2063. */
  2064. static getVolume(audioID: number): number;
  2065. /**
  2066. !#en Set current time
  2067. !#zh 设置当前的音频时间。
  2068. @param audioID audio id.
  2069. @param sec current time.
  2070. @example
  2071. ```js
  2072. cc.audioEngine.setCurrentTime(id, 2);
  2073. ```
  2074. */
  2075. static setCurrentTime(audioID: number, sec: number): boolean;
  2076. /**
  2077. !#en Get current time
  2078. !#zh 获取当前的音频播放时间。
  2079. @param audioID audio id.
  2080. @example
  2081. ```js
  2082. var time = cc.audioEngine.getCurrentTime(id);
  2083. ```
  2084. */
  2085. static getCurrentTime(audioID: number): number;
  2086. /**
  2087. !#en Get audio duration
  2088. !#zh 获取音频总时长。
  2089. @param audioID audio id.
  2090. @example
  2091. ```js
  2092. var time = cc.audioEngine.getDuration(id);
  2093. ```
  2094. */
  2095. static getDuration(audioID: number): number;
  2096. /**
  2097. !#en Get audio state
  2098. !#zh 获取音频状态。
  2099. @param audioID audio id.
  2100. @example
  2101. ```js
  2102. var state = cc.audioEngine.getState(id);
  2103. ```
  2104. */
  2105. static getState(audioID: number): audioEngine.AudioState;
  2106. /**
  2107. !#en Set Audio finish callback
  2108. !#zh 设置一个音频结束后的回调
  2109. @param audioID audio id.
  2110. @param callback loaded callback.
  2111. @example
  2112. ```js
  2113. cc.audioEngine.setFinishCallback(id, function () {});
  2114. ```
  2115. */
  2116. static setFinishCallback(audioID: number, callback: Function): void;
  2117. /**
  2118. !#en Pause playing audio.
  2119. !#zh 暂停正在播放音频。
  2120. @param audioID The return value of function play.
  2121. @example
  2122. ```js
  2123. cc.audioEngine.pause(audioID);
  2124. ```
  2125. */
  2126. static pause(audioID: number): void;
  2127. /**
  2128. !#en Pause all playing audio
  2129. !#zh 暂停现在正在播放的所有音频。
  2130. @example
  2131. ```js
  2132. cc.audioEngine.pauseAll();
  2133. ```
  2134. */
  2135. static pauseAll(): void;
  2136. /**
  2137. !#en Resume playing audio.
  2138. !#zh 恢复播放指定的音频。
  2139. @param audioID The return value of function play.
  2140. @example
  2141. ```js
  2142. cc.audioEngine.resume(audioID);
  2143. ```
  2144. */
  2145. static resume(audioID: number): void;
  2146. /**
  2147. !#en Resume all playing audio.
  2148. !#zh 恢复播放所有之前暂停的所有音频。
  2149. @example
  2150. ```js
  2151. cc.audioEngine.resumeAll();
  2152. ```
  2153. */
  2154. static resumeAll(): void;
  2155. /**
  2156. !#en Stop playing audio.
  2157. !#zh 停止播放指定音频。
  2158. @param audioID The return value of function play.
  2159. @example
  2160. ```js
  2161. cc.audioEngine.stop(audioID);
  2162. ```
  2163. */
  2164. static stop(audioID: number): void;
  2165. /**
  2166. !#en Stop all playing audio.
  2167. !#zh 停止正在播放的所有音频。
  2168. @example
  2169. ```js
  2170. cc.audioEngine.stopAll();
  2171. ```
  2172. */
  2173. static stopAll(): void;
  2174. /**
  2175. !#en Set up an audio can generate a few examples.
  2176. !#zh 设置一个音频可以设置几个实例
  2177. @param num a number of instances to be created from within an audio
  2178. @example
  2179. ```js
  2180. cc.audioEngine.setMaxAudioInstance(20);
  2181. ```
  2182. */
  2183. static setMaxAudioInstance(num: number): void;
  2184. /**
  2185. !#en Getting audio can produce several examples.
  2186. !#zh 获取一个音频可以设置几个实例
  2187. @example
  2188. ```js
  2189. cc.audioEngine.getMaxAudioInstance();
  2190. ```
  2191. */
  2192. static getMaxAudioInstance(): number;
  2193. /**
  2194. !#en Unload the preloaded audio from internal buffer.
  2195. !#zh 卸载预加载的音频。
  2196. @param clip clip
  2197. @example
  2198. ```js
  2199. cc.audioEngine.uncache(filePath);
  2200. ```
  2201. */
  2202. static uncache(clip: AudioClip): void;
  2203. /**
  2204. !#en Unload all audio from internal buffer.
  2205. !#zh 卸载所有音频。
  2206. @example
  2207. ```js
  2208. cc.audioEngine.uncacheAll();
  2209. ```
  2210. */
  2211. static uncacheAll(): void;
  2212. /**
  2213. !#en Preload audio file.
  2214. !#zh 预加载一个音频
  2215. @param filePath The file path of an audio.
  2216. @param callback The callback of an audio.
  2217. @example
  2218. ```js
  2219. cc.audioEngine.preload(path);
  2220. ```
  2221. */
  2222. static preload(filePath: string, callback?: Function): void;
  2223. /**
  2224. !#en Set a size, the unit is KB. Over this size is directly resolved into DOM nodes.
  2225. !#zh 设置一个以 KB 为单位的尺寸,大于这个尺寸的音频在加载的时候会强制使用 dom 方式加载
  2226. @param kb The file path of an audio.
  2227. @example
  2228. ```js
  2229. cc.audioEngine.setMaxWebAudioSize(300);
  2230. ```
  2231. */
  2232. static setMaxWebAudioSize(kb: number): void;
  2233. /**
  2234. !#en Play background music
  2235. !#zh 播放背景音乐
  2236. @param clip The audio clip to play.
  2237. @param loop Whether the music loop or not.
  2238. @example
  2239. ```js
  2240. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  2241. var audioID = cc.audioEngine.playMusic(clip, false);
  2242. });
  2243. ```
  2244. */
  2245. static playMusic(clip: AudioClip, loop: boolean): number;
  2246. /**
  2247. !#en Stop background music.
  2248. !#zh 停止播放背景音乐。
  2249. @example
  2250. ```js
  2251. cc.audioEngine.stopMusic();
  2252. ```
  2253. */
  2254. static stopMusic(): void;
  2255. /**
  2256. !#en Pause the background music.
  2257. !#zh 暂停播放背景音乐。
  2258. @example
  2259. ```js
  2260. cc.audioEngine.pauseMusic();
  2261. ```
  2262. */
  2263. static pauseMusic(): void;
  2264. /**
  2265. !#en Resume playing background music.
  2266. !#zh 恢复播放背景音乐。
  2267. @example
  2268. ```js
  2269. cc.audioEngine.resumeMusic();
  2270. ```
  2271. */
  2272. static resumeMusic(): void;
  2273. /**
  2274. !#en Get the volume(0.0 ~ 1.0).
  2275. !#zh 获取音量(0.0 ~ 1.0)。
  2276. @example
  2277. ```js
  2278. var volume = cc.audioEngine.getMusicVolume();
  2279. ```
  2280. */
  2281. static getMusicVolume(): number;
  2282. /**
  2283. !#en Set the background music volume.
  2284. !#zh 设置背景音乐音量(0.0 ~ 1.0)。
  2285. @param volume Volume must be in 0.0~1.0.
  2286. @example
  2287. ```js
  2288. cc.audioEngine.setMusicVolume(0.5);
  2289. ```
  2290. */
  2291. static setMusicVolume(volume: number): void;
  2292. /**
  2293. !#en Background music playing state
  2294. !#zh 背景音乐是否正在播放
  2295. @example
  2296. ```js
  2297. cc.audioEngine.isMusicPlaying();
  2298. ```
  2299. */
  2300. static isMusicPlaying(): boolean;
  2301. /**
  2302. !#en Play effect audio.
  2303. !#zh 播放音效
  2304. @param clip The audio clip to play.
  2305. @param loop Whether the music loop or not.
  2306. @example
  2307. ```js
  2308. cc.loader.loadRes(url, cc.AudioClip, function (err, clip) {
  2309. var audioID = cc.audioEngine.playEffect(clip, false);
  2310. });
  2311. ```
  2312. */
  2313. static playEffect(clip: AudioClip, loop: boolean): number;
  2314. /**
  2315. !#en Set the volume of effect audio.
  2316. !#zh 设置音效音量(0.0 ~ 1.0)。
  2317. @param volume Volume must be in 0.0~1.0.
  2318. @example
  2319. ```js
  2320. cc.audioEngine.setEffectsVolume(0.5);
  2321. ```
  2322. */
  2323. static setEffectsVolume(volume: number): void;
  2324. /**
  2325. !#en The volume of the effect audio max value is 1.0,the min value is 0.0 .
  2326. !#zh 获取音效音量(0.0 ~ 1.0)。
  2327. @example
  2328. ```js
  2329. var volume = cc.audioEngine.getEffectsVolume();
  2330. ```
  2331. */
  2332. static getEffectsVolume(): number;
  2333. /**
  2334. !#en Pause effect audio.
  2335. !#zh 暂停播放音效。
  2336. @param audioID audio id.
  2337. @example
  2338. ```js
  2339. cc.audioEngine.pauseEffect(audioID);
  2340. ```
  2341. */
  2342. static pauseEffect(audioID: number): void;
  2343. /**
  2344. !#en Stop playing all the sound effects.
  2345. !#zh 暂停播放所有音效。
  2346. @example
  2347. ```js
  2348. cc.audioEngine.pauseAllEffects();
  2349. ```
  2350. */
  2351. static pauseAllEffects(): void;
  2352. /**
  2353. !#en Resume effect audio.
  2354. !#zh 恢复播放音效音频。
  2355. @param audioID The return value of function play.
  2356. @example
  2357. ```js
  2358. cc.audioEngine.resumeEffect(audioID);
  2359. ```
  2360. */
  2361. static resumeEffect(audioID: number): void;
  2362. /**
  2363. !#en Resume all effect audio.
  2364. !#zh 恢复播放所有之前暂停的音效。
  2365. @example
  2366. ```js
  2367. cc.audioEngine.resumeAllEffects();
  2368. ```
  2369. */
  2370. static resumeAllEffects(): void;
  2371. /**
  2372. !#en Stop playing the effect audio.
  2373. !#zh 停止播放音效。
  2374. @param audioID audio id.
  2375. @example
  2376. ```js
  2377. cc.audioEngine.stopEffect(id);
  2378. ```
  2379. */
  2380. static stopEffect(audioID: number): void;
  2381. /**
  2382. !#en Stop playing all the effects.
  2383. !#zh 停止播放所有音效。
  2384. @example
  2385. ```js
  2386. cc.audioEngine.stopAllEffects();
  2387. ```
  2388. */
  2389. static stopAllEffects(): void;
  2390. }
  2391. /** !#en An object to boot the game.
  2392. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2393. export class debug {
  2394. /**
  2395. !#en Gets error message with the error id and possible parameters.
  2396. !#zh 通过 error id 和必要的参数来获取错误信息。
  2397. @param errorId errorId
  2398. @param param param
  2399. */
  2400. static getError(errorId: id, param?: any): string;
  2401. /**
  2402. !#en Returns whether or not to display the FPS informations.
  2403. !#zh 是否显示 FPS 信息。
  2404. */
  2405. static isDisplayStats(): boolean;
  2406. /**
  2407. !#en Sets whether display the FPS on the bottom-left corner.
  2408. !#zh 设置是否在左下角显示 FPS。
  2409. @param displayStats displayStats
  2410. */
  2411. static setDisplayStats(displayStats: boolean): void;
  2412. }
  2413. /** !#en
  2414. <p>
  2415. ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
  2416. cc.director is a singleton object which manage your game's logic flow.<br/>
  2417. Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>
  2418. the standard way to use it is by calling:<br/>
  2419. - cc.director.methodName(); <br/>
  2420. It creates and handle the main Window and manages how and when to execute the Scenes.<br/>
  2421. <br/>
  2422. The cc.director is also responsible for:<br/>
  2423. - initializing the OpenGL context<br/>
  2424. - setting the OpenGL pixel format (default on is RGB565)<br/>
  2425. - setting the OpenGL buffer depth (default on is 0-bit)<br/>
  2426. - setting the color for clear screen (default one is BLACK)<br/>
  2427. - setting the projection (default one is 3D)<br/>
  2428. - setting the orientation (default one is Portrait)<br/>
  2429. <br/>
  2430. <br/>
  2431. The cc.director also sets the default OpenGL context:<br/>
  2432. - GL_TEXTURE_2D is enabled<br/>
  2433. - GL_VERTEX_ARRAY is enabled<br/>
  2434. - GL_COLOR_ARRAY is enabled<br/>
  2435. - GL_TEXTURE_COORD_ARRAY is enabled<br/>
  2436. </p>
  2437. <p>
  2438. cc.director also synchronizes timers with the refresh rate of the display.<br/>
  2439. Features and Limitations:<br/>
  2440. - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
  2441. - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
  2442. </p>
  2443. !#zh
  2444. <p>
  2445. 注意:用 cc.director 代替 cc.Director。<br/>
  2446. cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>
  2447. 由于 cc.director 是一个单例,你不需要调用任何构造函数或创建函数,<br/>
  2448. 使用它的标准方法是通过调用:<br/>
  2449. - cc.director.methodName();
  2450. <br/>
  2451. 它创建和处理主窗口并且管理什么时候执行场景。<br/>
  2452. <br/>
  2453. cc.director 还负责:<br/>
  2454. - 初始化 OpenGL 环境。<br/>
  2455. - 设置OpenGL像素格式。(默认是 RGB565)<br/>
  2456. - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>
  2457. - 设置空白场景的颜色 (默认是 黑色)<br/>
  2458. - 设置投影 (默认是 3D)<br/>
  2459. - 设置方向 (默认是 Portrait)<br/>
  2460. <br/>
  2461. cc.director 设置了 OpenGL 默认环境 <br/>
  2462. - GL_TEXTURE_2D 启用。<br/>
  2463. - GL_VERTEX_ARRAY 启用。<br/>
  2464. - GL_COLOR_ARRAY 启用。<br/>
  2465. - GL_TEXTURE_COORD_ARRAY 启用。<br/>
  2466. </p>
  2467. <p>
  2468. cc.director 也同步定时器与显示器的刷新速率。
  2469. <br/>
  2470. 特点和局限性: <br/>
  2471. - 将计时器 & 渲染与显示器的刷新频率同步。<br/>
  2472. - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>
  2473. </p> */
  2474. export class Director extends EventTarget {
  2475. /**
  2476. !#en
  2477. Converts a view coordinate to an WebGL coordinate<br/>
  2478. Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)<br/>
  2479. Implementation can be found in CCDirectorWebGL.
  2480. !#zh 将触摸点的屏幕坐标转换为 WebGL View 下的坐标。
  2481. @param uiPoint uiPoint
  2482. */
  2483. convertToGL(uiPoint: Vec2): Vec2;
  2484. /**
  2485. !#en
  2486. Converts an OpenGL coordinate to a view coordinate<br/>
  2487. Useful to convert node points to window points for calls such as glScissor<br/>
  2488. Implementation can be found in CCDirectorWebGL.
  2489. !#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。
  2490. @param glPoint glPoint
  2491. */
  2492. convertToUI(glPoint: Vec2): Vec2;
  2493. /**
  2494. End the life of director in the next frame
  2495. */
  2496. end(): void;
  2497. /**
  2498. !#en
  2499. Returns the size of the WebGL view in points.<br/>
  2500. It takes into account any possible rotation (device orientation) of the window.
  2501. !#zh 获取视图的大小,以点为单位。
  2502. */
  2503. getWinSize(): Size;
  2504. /**
  2505. !#en
  2506. Returns the size of the OpenGL view in pixels.<br/>
  2507. It takes into account any possible rotation (device orientation) of the window.<br/>
  2508. On Mac winSize and winSizeInPixels return the same value.
  2509. (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())
  2510. !#zh
  2511. 获取视图大小,以像素为单位(这里的像素指的是资源分辨率。
  2512. 如果要获取屏幕物理分辨率,需要用 cc.view.getFrameSize())
  2513. */
  2514. getWinSizeInPixels(): Size;
  2515. /**
  2516. !#en Pause the director's ticker, only involve the game logic execution.
  2517. It won't pause the rendering process nor the event manager.
  2518. If you want to pause the entier game including rendering, audio and event,
  2519. please use {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}
  2520. !#zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。
  2521. 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}。
  2522. */
  2523. pause(): void;
  2524. /**
  2525. !#en
  2526. Run a scene. Replaces the running scene with a new one or enter the first scene.<br/>
  2527. The new scene will be launched immediately.
  2528. !#zh 立刻切换指定场景。
  2529. @param scene The need run scene.
  2530. @param onBeforeLoadScene The function invoked at the scene before loading.
  2531. @param onLaunched The function invoked at the scene after launch.
  2532. */
  2533. runSceneImmediate(scene: Scene, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2534. /**
  2535. !#en Loads the scene by its name.
  2536. !#zh 通过场景名称进行加载场景。
  2537. @param sceneName The name of the scene to load.
  2538. @param onLaunched callback, will be called after scene launched.
  2539. */
  2540. loadScene(sceneName: string, onLaunched?: Function): boolean;
  2541. /**
  2542. !#en
  2543. Preloads the scene to reduces loading time. You can call this method at any time you want.
  2544. After calling this method, you still need to launch the scene by `cc.director.loadScene`.
  2545. It will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not
  2546. yet finished, the scene will be launched after loaded automatically.
  2547. !#zh 预加载场景,你可以在任何时候调用这个方法。
  2548. 调用完后,你仍然需要通过 `cc.director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。
  2549. 就算预加载还没完成,你也可以直接调用 `cc.director.loadScene`,加载完成后场景就会启动。
  2550. @param sceneName The name of the scene to preload.
  2551. @param onProgress callback, will be called when the load progression change.
  2552. @param onLoaded callback, will be called after scene loaded.
  2553. */
  2554. preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error) => void): void;
  2555. /**
  2556. !#en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  2557. !#zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  2558. */
  2559. resume(): void;
  2560. /**
  2561. !#en
  2562. Enables or disables WebGL depth test.<br/>
  2563. Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
  2564. !#zh 启用/禁用深度测试(在 Canvas 渲染模式下不会生效)。
  2565. @param on on
  2566. */
  2567. setDepthTest(on: boolean): void;
  2568. /**
  2569. !#en
  2570. Set color for clear screen.<br/>
  2571. (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
  2572. !#zh
  2573. 设置场景的默认擦除颜色。<br/>
  2574. 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
  2575. @param clearColor clearColor
  2576. */
  2577. setClearColor(clearColor: Color): void;
  2578. /**
  2579. !#en Returns current logic Scene.
  2580. !#zh 获取当前逻辑场景。
  2581. @example
  2582. ```js
  2583. // This will help you to get the Canvas node in scene
  2584. cc.director.getScene().getChildByName('Canvas');
  2585. ```
  2586. */
  2587. getScene(): Scene;
  2588. /**
  2589. !#en Returns the FPS value. Please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} to control animation interval.
  2590. !#zh 获取单位帧执行时间。请使用 {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} 来控制游戏帧率。
  2591. */
  2592. getAnimationInterval(): number;
  2593. /**
  2594. Sets animation interval, this doesn't control the main loop.
  2595. To control the game's frame rate overall, please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}}
  2596. @param value The animation interval desired.
  2597. */
  2598. setAnimationInterval(value: number): void;
  2599. /**
  2600. !#en Returns the delta time since last frame.
  2601. !#zh 获取上一帧的增量时间。
  2602. */
  2603. getDeltaTime(): number;
  2604. /**
  2605. !#en Returns how many frames were called since the director started.
  2606. !#zh 获取 director 启动以来游戏运行的总帧数。
  2607. */
  2608. getTotalFrames(): number;
  2609. /**
  2610. !#en Returns whether or not the Director is paused.
  2611. !#zh 是否处于暂停状态。
  2612. */
  2613. isPaused(): boolean;
  2614. /**
  2615. !#en Returns the cc.Scheduler associated with this director.
  2616. !#zh 获取和 director 相关联的 cc.Scheduler。
  2617. */
  2618. getScheduler(): Scheduler;
  2619. /**
  2620. !#en Sets the cc.Scheduler associated with this director.
  2621. !#zh 设置和 director 相关联的 cc.Scheduler。
  2622. @param scheduler scheduler
  2623. */
  2624. setScheduler(scheduler: Scheduler): void;
  2625. /**
  2626. !#en Returns the cc.ActionManager associated with this director.
  2627. !#zh 获取和 director 相关联的 cc.ActionManager(动作管理器)。
  2628. */
  2629. getActionManager(): ActionManager;
  2630. /**
  2631. !#en Sets the cc.ActionManager associated with this director.
  2632. !#zh 设置和 director 相关联的 cc.ActionManager(动作管理器)。
  2633. @param actionManager actionManager
  2634. */
  2635. setActionManager(actionManager: ActionManager): void;
  2636. /**
  2637. !#en Returns the cc.CollisionManager associated with this director.
  2638. !#zh 获取和 director 相关联的 cc.CollisionManager (碰撞管理器)。
  2639. */
  2640. getCollisionManager(): CollisionManager;
  2641. /**
  2642. !#en Returns the cc.PhysicsManager associated with this director.
  2643. !#zh 返回与 director 相关联的 cc.PhysicsManager (物理管理器)。
  2644. */
  2645. getPhysicsManager(): PhysicsManager;
  2646. /** !#en The event projection changed of cc.Director. This event will not get triggered since v2.0
  2647. !#zh cc.Director 投影变化的事件。从 v2.0 开始这个事件不会再被触发 */
  2648. static EVENT_PROJECTION_CHANGED: string;
  2649. /** !#en The event which will be triggered before loading a new scene.
  2650. !#zh 加载新场景之前所触发的事件。 */
  2651. static EVENT_BEFORE_SCENE_LOADING: string;
  2652. /** !#en The event which will be triggered before launching a new scene.
  2653. !#zh 运行新场景之前所触发的事件。 */
  2654. static EVENT_BEFORE_SCENE_LAUNCH: string;
  2655. /** !#en The event which will be triggered after launching a new scene.
  2656. !#zh 运行新场景之后所触发的事件。 */
  2657. static EVENT_AFTER_SCENE_LAUNCH: string;
  2658. /** !#en The event which will be triggered at the beginning of every frame.
  2659. !#zh 每个帧的开始时所触发的事件。 */
  2660. static EVENT_BEFORE_UPDATE: string;
  2661. /** !#en The event which will be triggered after engine and components update logic.
  2662. !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 */
  2663. static EVENT_AFTER_UPDATE: string;
  2664. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  2665. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  2666. static EVENT_BEFORE_VISIT: string;
  2667. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  2668. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  2669. static EVENT_AFTER_VISIT: string;
  2670. /** !#en The event which will be triggered before the rendering process.
  2671. !#zh 渲染过程之前所触发的事件。 */
  2672. static EVENT_BEFORE_DRAW: string;
  2673. /** !#en The event which will be triggered after the rendering process.
  2674. !#zh 渲染过程之后所触发的事件。 */
  2675. static EVENT_AFTER_DRAW: string;
  2676. /** Constant for 2D projection (orthogonal projection) */
  2677. static PROJECTION_2D: number;
  2678. /** Constant for 3D projection with a fovy=60, znear=0.5f and zfar=1500. */
  2679. static PROJECTION_3D: number;
  2680. /** Constant for custom projection, if cc.Director's projection set to it, it calls "updateProjection" on the projection delegate. */
  2681. static PROJECTION_CUSTOM: number;
  2682. /** Constant for default projection of cc.Director, default projection is 2D projection */
  2683. static PROJECTION_DEFAULT: number;
  2684. }
  2685. /** !#en An object to boot the game.
  2686. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2687. export class Game extends EventTarget {
  2688. /** !#en Event triggered when game hide to background.
  2689. Please note that this event is not 100% guaranteed to be fired on Web platform,
  2690. on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  2691. !#zh 游戏进入后台时触发的事件。
  2692. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  2693. 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。 */
  2694. EVENT_HIDE: string;
  2695. /** Event triggered when game back to foreground
  2696. Please note that this event is not 100% guaranteed to be fired on Web platform,
  2697. on native platforms, it corresponds to enter foreground event.
  2698. !#zh 游戏进入前台运行时触发的事件。
  2699. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  2700. 在原生平台,它对应的是应用被切换到前台事件。 */
  2701. EVENT_SHOW: string;
  2702. /** Event triggered after game inited, at this point all engine objects and game scripts are loaded */
  2703. EVENT_GAME_INITED: string;
  2704. /** Event triggered after engine inited, at this point you will be able to use all engine classes.
  2705. It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0 */
  2706. EVENT_ENGINE_INITED: string;
  2707. /** Web Canvas 2d API as renderer backend */
  2708. RENDER_TYPE_CANVAS: number;
  2709. /** WebGL API as renderer backend */
  2710. RENDER_TYPE_WEBGL: number;
  2711. /** OpenGL API as renderer backend */
  2712. RENDER_TYPE_OPENGL: number;
  2713. /** !#en The outer frame of the game canvas, parent of game container.
  2714. !#zh 游戏画布的外框,container 的父容器。 */
  2715. frame: any;
  2716. /** !#en The container of game canvas.
  2717. !#zh 游戏画布的容器。 */
  2718. container: HTMLDivElement;
  2719. /** !#en The canvas of the game.
  2720. !#zh 游戏的画布。 */
  2721. canvas: HTMLCanvasElement;
  2722. /** !#en The renderer backend of the game.
  2723. !#zh 游戏的渲染器类型。 */
  2724. renderType: number;
  2725. /** !#en
  2726. The current game configuration, including:<br/>
  2727. 1. debugMode<br/>
  2728. "debugMode" possible values :<br/>
  2729. 0 - No message will be printed. <br/>
  2730. 1 - cc.error, cc.assert, cc.warn, cc.log will print in console. <br/>
  2731. 2 - cc.error, cc.assert, cc.warn will print in console. <br/>
  2732. 3 - cc.error, cc.assert will print in console. <br/>
  2733. 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>
  2734. 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web. <br/>
  2735. 6 - cc.error, cc.assert will print on canvas, available only on web. <br/>
  2736. 2. showFPS<br/>
  2737. Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.<br/>
  2738. 3. exposeClassName<br/>
  2739. Expose class name to chrome debug tools, the class intantiate performance is a little bit slower when exposed.<br/>
  2740. 4. frameRate<br/>
  2741. "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>
  2742. 5. id<br/>
  2743. "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.<br/>
  2744. 6. renderMode<br/>
  2745. "renderMode" sets the renderer type, only useful on web :<br/>
  2746. 0 - Automatically chosen by engine<br/>
  2747. 1 - Forced to use canvas renderer<br/>
  2748. 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>
  2749. 7. scenes<br/>
  2750. "scenes" include available scenes in the current bundle.<br/>
  2751. <br/>
  2752. Please DO NOT modify this object directly, it won't have any effect.<br/>
  2753. !#zh
  2754. 当前的游戏配置,包括: <br/>
  2755. 1. debugMode(debug 模式,但是在浏览器中这个选项会被忽略) <br/>
  2756. "debugMode" 各种设置选项的意义。 <br/>
  2757. 0 - 没有消息被打印出来。 <br/>
  2758. 1 - cc.error,cc.assert,cc.warn,cc.log 将打印在 console 中。 <br/>
  2759. 2 - cc.error,cc.assert,cc.warn 将打印在 console 中。 <br/>
  2760. 3 - cc.error,cc.assert 将打印在 console 中。 <br/>
  2761. 4 - cc.error,cc.assert,cc.warn,cc.log 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2762. 5 - cc.error,cc.assert,cc.warn 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2763. 6 - cc.error,cc.assert 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  2764. 2. showFPS(显示 FPS) <br/>
  2765. 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。 <br/>
  2766. 3. exposeClassName <br/>
  2767. 暴露类名让 Chrome DevTools 可以识别,如果开启会稍稍降低类的创建过程的性能,但对对象构造没有影响。 <br/>
  2768. 4. frameRate (帧率) <br/>
  2769. “frameRate” 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。 <br/>
  2770. 5. id <br/>
  2771. "gameCanvas" Web 页面上的 Canvas Element ID,仅适用于 web 端。 <br/>
  2772. 6. renderMode(渲染模式) <br/>
  2773. “renderMode” 设置渲染器类型,仅适用于 web 端: <br/>
  2774. 0 - 通过引擎自动选择。 <br/>
  2775. 1 - 强制使用 canvas 渲染。
  2776. 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。 <br/>
  2777. 7. scenes <br/>
  2778. “scenes” 当前包中可用场景。 <br/>
  2779. <br/>
  2780. 注意:请不要直接修改这个对象,它不会有任何效果。 */
  2781. config: any;
  2782. /**
  2783. !#en Callback when the scripts of engine have been load.
  2784. !#zh 当引擎完成启动后的回调函数。
  2785. */
  2786. onStart(): void;
  2787. /**
  2788. !#en Set frame rate of game.
  2789. !#zh 设置游戏帧率。
  2790. @param frameRate frameRate
  2791. */
  2792. setFrameRate(frameRate: number): void;
  2793. /**
  2794. !#en Get frame rate set for the game, it doesn't represent the real frame rate.
  2795. !#zh 获取设置的游戏帧率(不等同于实际帧率)。
  2796. */
  2797. getFrameRate(): number;
  2798. /**
  2799. !#en Run the game frame by frame.
  2800. !#zh 执行一帧游戏循环。
  2801. */
  2802. step(): void;
  2803. /**
  2804. !#en Pause the game main loop. This will pause:
  2805. game logic execution, rendering process, event manager, background music and all audio effects.
  2806. This is different with cc.director.pause which only pause the game logic execution.
  2807. !#zh 暂停游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。这点和只暂停游戏逻辑的 cc.director.pause 不同。
  2808. */
  2809. pause(): void;
  2810. /**
  2811. !#en Resume the game from pause. This will resume:
  2812. game logic execution, rendering process, event manager, background music and all audio effects.
  2813. !#zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  2814. */
  2815. resume(): void;
  2816. /**
  2817. !#en Check whether the game is paused.
  2818. !#zh 判断游戏是否暂停。
  2819. */
  2820. isPaused(): boolean;
  2821. /**
  2822. !#en Restart game.
  2823. !#zh 重新开始游戏
  2824. */
  2825. restart(): void;
  2826. /**
  2827. !#en End game, it will close the game window
  2828. !#zh 退出游戏
  2829. */
  2830. end(): void;
  2831. /**
  2832. !#en
  2833. Register an callback of a specific event type on the game object.
  2834. This type of event should be triggered via `emit`.
  2835. !#zh
  2836. 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  2837. @param type A string representing the event type to listen for.
  2838. @param callback The callback that will be invoked when the event is dispatched.
  2839. The callback is ignored if it is a duplicate (the callbacks are unique).
  2840. @param target The target (this object) to invoke the callback, can be null
  2841. */
  2842. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  2843. /**
  2844. !#en
  2845. Register an callback of a specific event type on the game object,
  2846. the callback will remove itself after the first time it is triggered.
  2847. !#zh
  2848. 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  2849. @param type A string representing the event type to listen for.
  2850. @param callback The callback that will be invoked when the event is dispatched.
  2851. The callback is ignored if it is a duplicate (the callbacks are unique).
  2852. @param target The target (this object) to invoke the callback, can be null
  2853. */
  2854. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  2855. /**
  2856. !#en Prepare game.
  2857. !#zh 准备引擎,请不要直接调用这个函数。
  2858. @param cb cb
  2859. */
  2860. prepare(cb: Function): void;
  2861. /**
  2862. !#en Run game with configuration object and onStart function.
  2863. !#zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  2864. @param config Pass configuration object or onStart function
  2865. @param onStart function to be executed after game initialized
  2866. */
  2867. run(config: any, onStart: Function): void;
  2868. /**
  2869. !#en
  2870. Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>
  2871. The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  2872. !#zh
  2873. 声明常驻根节点,该节点不会被在场景切换中被销毁。<br/>
  2874. 目标节点必须位于为层级的根节点,否则无效。
  2875. @param node The node to be made persistent
  2876. */
  2877. addPersistRootNode(node: Node): void;
  2878. /**
  2879. !#en Remove a persistent root node.
  2880. !#zh 取消常驻根节点。
  2881. @param node The node to be removed from persistent node list
  2882. */
  2883. removePersistRootNode(node: Node): void;
  2884. /**
  2885. !#en Check whether the node is a persistent root node.
  2886. !#zh 检查节点是否是常驻根节点。
  2887. @param node The node to be checked
  2888. */
  2889. isPersistRootNode(node: Node): boolean;
  2890. }
  2891. /** !#en
  2892. Class of all entities in Cocos Creator scenes.<br/>
  2893. For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
  2894. !#zh
  2895. Cocos Creator 场景中的所有节点类。<br/>
  2896. 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。 */
  2897. export class Node extends _BaseNode {
  2898. /** !#en
  2899. Group index of node.<br/>
  2900. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  2901. !#zh
  2902. 节点的分组索引。<br/>
  2903. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  2904. groupIndex: number;
  2905. /** !#en
  2906. Group of node.<br/>
  2907. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  2908. !#zh
  2909. 节点的分组。<br/>
  2910. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  2911. group: string;
  2912. /** !#en The position (x, y) of the node in its parent's coordinates.
  2913. !#zh 节点在父节点坐标系中的位置(x, y)。 */
  2914. position: Vec2;
  2915. /** !#en x axis position of node.
  2916. !#zh 节点 X 轴坐标。 */
  2917. x: number;
  2918. /** !#en y axis position of node.
  2919. !#zh 节点 Y 轴坐标。 */
  2920. y: number;
  2921. /** !#en z axis position of node.
  2922. !#zh 节点 Z 轴坐标。 */
  2923. z: number;
  2924. /** !#en Rotation of node.
  2925. !#zh 该节点旋转角度。 */
  2926. rotation: number;
  2927. /** !#en
  2928. Angle of node, the positive value is anti-clockwise direction.
  2929. !#zh
  2930. 该节点的旋转角度,正值为逆时针方向。 */
  2931. angle: number;
  2932. /** !#en The rotation as Euler angles in degrees, used in 2.5D project.
  2933. !#zh 该节点的欧拉角度,用于 2.5D 项目。 */
  2934. eulerAngles: Vec3;
  2935. /** !#en Rotation on x axis.
  2936. !#zh 该节点 X 轴旋转角度。 */
  2937. rotationX: number;
  2938. /** !#en Rotation on y axis.
  2939. !#zh 该节点 Y 轴旋转角度。 */
  2940. rotationY: number;
  2941. /** !#en The local scale relative to the parent.
  2942. !#zh 节点相对父节点的缩放。 */
  2943. scale: number;
  2944. /** !#en Scale on x axis.
  2945. !#zh 节点 X 轴缩放。 */
  2946. scaleX: number;
  2947. /** !#en Scale on y axis.
  2948. !#zh 节点 Y 轴缩放。 */
  2949. scaleY: number;
  2950. /** !#en Scale on z axis.
  2951. !#zh 节点 Z 轴缩放。 */
  2952. scaleZ: number;
  2953. /** !#en Skew x
  2954. !#zh 该节点 X 轴倾斜角度。 */
  2955. skewX: number;
  2956. /** !#en Skew y
  2957. !#zh 该节点 Y 轴倾斜角度。 */
  2958. skewY: number;
  2959. /** !#en Opacity of node, default value is 255.
  2960. !#zh 节点透明度,默认值为 255。 */
  2961. opacity: number;
  2962. /** !#en Color of node, default value is white: (255, 255, 255).
  2963. !#zh 节点颜色。默认为白色,数值为:(255,255,255)。 */
  2964. color: Color;
  2965. /** !#en Anchor point's position on x axis.
  2966. !#zh 节点 X 轴锚点位置。 */
  2967. anchorX: number;
  2968. /** !#en Anchor point's position on y axis.
  2969. !#zh 节点 Y 轴锚点位置。 */
  2970. anchorY: number;
  2971. /** !#en Width of node.
  2972. !#zh 节点宽度。 */
  2973. width: number;
  2974. /** !#en Height of node.
  2975. !#zh 节点高度。 */
  2976. height: number;
  2977. /** !#en zIndex is the 'key' used to sort the node relative to its siblings.<br/>
  2978. The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.<br/>
  2979. The Node's parent will sort all its children based on the zIndex value and the arrival order.<br/>
  2980. Nodes with greater zIndex will be sorted after nodes with smaller zIndex.<br/>
  2981. 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/>
  2982. Node's order in children list will affect its rendering order. Parent is always rendering before all children.
  2983. !#zh zIndex 是用来对节点进行排序的关键属性,它决定一个节点在兄弟节点之间的位置。<br/>
  2984. zIndex 的取值应该介于 cc.macro.MIN_ZINDEX 和 cc.macro.MAX_ZINDEX 之间
  2985. 父节点主要根据节点的 zIndex 和添加次序来排序,拥有更高 zIndex 的节点将被排在后面,如果两个节点的 zIndex 一致,先添加的节点会稳定排在另一个节点之前。<br/>
  2986. 节点在 children 中的顺序决定了其渲染顺序。父节点永远在所有子节点之前被渲染 */
  2987. zIndex: number;
  2988. /**
  2989. @param name name
  2990. */
  2991. constructor(name?: string);
  2992. /**
  2993. !#en
  2994. Register a callback of a specific event type on Node.<br/>
  2995. Use this method to register touch or mouse event permit propagation based on scene graph,<br/>
  2996. These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:<br/>
  2997. 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target<br/>
  2998. 2. At target phase: dispatch to the listeners of the real target<br/>
  2999. 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root<br/>
  3000. In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.<br/>
  3001. It's the recommended way to register touch/mouse event for Node,<br/>
  3002. please do not use cc.eventManager directly for Node.<br/>
  3003. You can also register custom event and use `emit` to trigger custom event on Node.<br/>
  3004. 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/>
  3005. You can also pass event callback parameters with `emit` by passing parameters after `type`.
  3006. !#zh
  3007. 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。<br/>
  3008. 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:<br/>
  3009. 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。<br/>
  3010. 2. 目标阶段:派发给目标节点的监听器。<br/>
  3011. 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发知道根节点。<br/>
  3012. 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
  3013. 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。<br/>
  3014. 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器<br/>
  3015. 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  3016. @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.
  3017. @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).
  3018. @param target The target (this object) to invoke the callback, can be null
  3019. @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.
  3020. @example
  3021. ```js
  3022. this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  3023. node.on(cc.Node.EventType.TOUCH_START, callback, this);
  3024. node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
  3025. node.on(cc.Node.EventType.TOUCH_END, callback, this);
  3026. node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
  3027. node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3028. node.on(cc.Node.EventType.COLOR_CHANGED, callback);
  3029. ```
  3030. */
  3031. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3032. /**
  3033. !#en
  3034. Register an callback of a specific event type on the Node,
  3035. the callback will remove itself after the first time it is triggered.
  3036. !#zh
  3037. 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3038. @param type A string representing the event type to listen for.
  3039. @param callback The callback that will be invoked when the event is dispatched.
  3040. The callback is ignored if it is a duplicate (the callbacks are unique).
  3041. @param target The target (this object) to invoke the callback, can be null
  3042. @example
  3043. ```js
  3044. node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3045. ```
  3046. */
  3047. once<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3048. /**
  3049. !#en
  3050. Removes the callback previously registered with the same type, callback, target and or useCapture.
  3051. This method is merely an alias to removeEventListener.
  3052. !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  3053. @param type A string representing the event type being removed.
  3054. @param callback The callback to remove.
  3055. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  3056. @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.
  3057. @example
  3058. ```js
  3059. this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
  3060. node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
  3061. node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
  3062. ```
  3063. */
  3064. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  3065. /**
  3066. !#en Removes all callbacks previously registered with the same target.
  3067. !#zh 移除目标上的所有注册事件。
  3068. @param target The target to be searched for all related callbacks
  3069. @example
  3070. ```js
  3071. node.targetOff(target);
  3072. ```
  3073. */
  3074. targetOff(target: any): void;
  3075. /**
  3076. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  3077. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  3078. @param type The type of event.
  3079. */
  3080. hasEventListener(type: string): boolean;
  3081. /**
  3082. !#en
  3083. Trigger an event directly with the event name and necessary arguments.
  3084. !#zh
  3085. 通过事件名发送自定义事件
  3086. @param type event type
  3087. @param arg1 First argument in callback
  3088. @param arg2 Second argument in callback
  3089. @param arg3 Third argument in callback
  3090. @param arg4 Fourth argument in callback
  3091. @param arg5 Fifth argument in callback
  3092. @example
  3093. ```js
  3094. eventTarget.emit('fire', event);
  3095. eventTarget.emit('fire', message, emitter);
  3096. ```
  3097. */
  3098. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  3099. /**
  3100. !#en
  3101. Dispatches an event into the event flow.
  3102. The event target is the EventTarget object upon which the dispatchEvent() method is called.
  3103. !#zh 分发事件到事件流中。
  3104. @param event The Event object that is dispatched into the event flow
  3105. */
  3106. dispatchEvent(event: Event): void;
  3107. /**
  3108. !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
  3109. 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.
  3110. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3111. !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3112. 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  3113. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3114. @param recursive Whether to pause node system events on the sub node tree.
  3115. @example
  3116. ```js
  3117. node.pauseSystemEvents(true);
  3118. ```
  3119. */
  3120. pauseSystemEvents(recursive: boolean): void;
  3121. /**
  3122. !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
  3123. 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.
  3124. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3125. !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3126. 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  3127. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3128. @param recursive Whether to resume node system events on the sub node tree.
  3129. @example
  3130. ```js
  3131. node.resumeSystemEvents(true);
  3132. ```
  3133. */
  3134. resumeSystemEvents(recursive: boolean): void;
  3135. /**
  3136. !#en
  3137. Executes an action, and returns the action that is executed.<br/>
  3138. The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
  3139. Calling runAction while the node is not active won't have any effect. <br/>
  3140. Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
  3141. if you want to modify, when you define action plus.
  3142. !#zh
  3143. 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
  3144. 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
  3145. 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
  3146. @param action action
  3147. @example
  3148. ```js
  3149. var action = cc.scaleTo(0.2, 1, 0.6);
  3150. node.runAction(action);
  3151. node.runAction(action).repeatForever(); // fail
  3152. node.runAction(action.repeatForever()); // right
  3153. ```
  3154. */
  3155. runAction(action: Action): Action;
  3156. /**
  3157. !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
  3158. !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
  3159. @example
  3160. ```js
  3161. node.pauseAllActions();
  3162. ```
  3163. */
  3164. pauseAllActions(): void;
  3165. /**
  3166. !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
  3167. !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
  3168. @example
  3169. ```js
  3170. node.resumeAllActions();
  3171. ```
  3172. */
  3173. resumeAllActions(): void;
  3174. /**
  3175. !#en Stops and removes all actions from the running action list .
  3176. !#zh 停止并且移除所有正在运行的动作列表。
  3177. @example
  3178. ```js
  3179. node.stopAllActions();
  3180. ```
  3181. */
  3182. stopAllActions(): void;
  3183. /**
  3184. !#en Stops and removes an action from the running action list.
  3185. !#zh 停止并移除指定的动作。
  3186. @param action An action object to be removed.
  3187. @example
  3188. ```js
  3189. var action = cc.scaleTo(0.2, 1, 0.6);
  3190. node.stopAction(action);
  3191. ```
  3192. */
  3193. stopAction(action: Action): void;
  3194. /**
  3195. !#en Removes an action from the running action list by its tag.
  3196. !#zh 停止并且移除指定标签的动作。
  3197. @param tag A tag that indicates the action to be removed.
  3198. @example
  3199. ```js
  3200. node.stopAction(1);
  3201. ```
  3202. */
  3203. stopActionByTag(tag: number): void;
  3204. /**
  3205. !#en Returns an action from the running action list by its tag.
  3206. !#zh 通过标签获取指定动作。
  3207. @param tag tag
  3208. @example
  3209. ```js
  3210. var action = node.getActionByTag(1);
  3211. ```
  3212. */
  3213. getActionByTag(tag: number): Action;
  3214. /**
  3215. !#en
  3216. Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
  3217. Composable actions are counted as 1 action. Example:<br/>
  3218. If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  3219. If you are running 7 Sequences of 2 actions, it will return 7.</p>
  3220. !#zh
  3221. 获取运行着的动作加上正在调度运行的动作的总数。<br/>
  3222. 例如:<br/>
  3223. - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。<br/>
  3224. - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。<br/>
  3225. @example
  3226. ```js
  3227. var count = node.getNumberOfRunningActions();
  3228. cc.log("Running Action Count: " + count);
  3229. ```
  3230. */
  3231. getNumberOfRunningActions(): number;
  3232. /**
  3233. !#en
  3234. Returns a copy of the position (x, y, z) of the node in its parent's coordinates.
  3235. You can pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3236. !#zh
  3237. 获取节点在父节点坐标系中的位置(x, y, z)。
  3238. 你可以传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3239. @param out The return value to receive position
  3240. @example
  3241. ```js
  3242. cc.log("Node Position: " + node.getPosition());
  3243. ```
  3244. */
  3245. getPosition(out?: Vec2|Vec3): Vec2;
  3246. /**
  3247. !#en
  3248. Sets the position (x, y, z) of the node in its parent's coordinates.<br/>
  3249. Usually we use cc.v2(x, y) to compose cc.Vec2 object,<br/>
  3250. and passing two numbers (x, y) is more efficient than passing cc.Vec2 object.
  3251. For 3D node we can use cc.v3(x, y, z) to compose cc.Vec3 object,<br/>
  3252. and passing three numbers (x, y, z) is more efficient than passing cc.Vec3 object.
  3253. !#zh
  3254. 设置节点在父节点坐标系中的位置。<br/>
  3255. 可以通过下面的方式设置坐标点:<br/>
  3256. 1. 传入 2 个数值 x, y。<br/>
  3257. 2. 传入 cc.v2(x, y) 类型为 cc.Vec2 的对象。
  3258. 3. 对于 3D 节点可以传入 3 个数值 x, y, z。<br/>
  3259. 4. 对于 3D 节点可以传入 cc.v3(x, y, z) 类型为 cc.Vec3 的对象。
  3260. @param newPosOrX X coordinate for position or the position (x, y, z) of the node in coordinates
  3261. @param y Y coordinate for position
  3262. @param z Z coordinate for position
  3263. */
  3264. setPosition(newPosOrX: Vec2|Vec3|number, y?: number, z?: number): void;
  3265. /**
  3266. !#en
  3267. Returns the scale factor of the node.
  3268. Need pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3269. !#zh 获取节点的缩放,需要传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3270. @param out out
  3271. @example
  3272. ```js
  3273. cc.log("Node Scale: " + node.getScale(cc.v3()));
  3274. ```
  3275. */
  3276. getScale(out: Vec2|Vec3): Vec2;
  3277. /**
  3278. !#en
  3279. Sets the scale of axis in local coordinates of the node.
  3280. You can operate 2 axis in 2D node, and 3 axis in 3D node.
  3281. !#zh
  3282. 设置节点在本地坐标系中坐标轴上的缩放比例。
  3283. 2D 节点可以操作两个坐标轴,而 3D 节点可以操作三个坐标轴。
  3284. @param x scaleX or scale object
  3285. @param y y
  3286. @param z z
  3287. @example
  3288. ```js
  3289. node.setScale(cc.v2(2, 2));
  3290. node.setScale(cc.v3(2, 2, 2)); // for 3D node
  3291. node.setScale(2);
  3292. ```
  3293. */
  3294. setScale(x: number|Vec2|Vec3, y?: number, z?: number): void;
  3295. /**
  3296. !#en
  3297. Get rotation of node (in quaternion).
  3298. Need pass a cc.Quat as the argument to receive the return values.
  3299. !#zh
  3300. 获取该节点的 quaternion 旋转角度,需要传一个 cc.Quat 作为参数来接收返回值。
  3301. @param out out
  3302. */
  3303. getRotation(out: Quat): Quat;
  3304. /**
  3305. !#en Set rotation of node (in quaternion).
  3306. !#zh 设置该节点的 quaternion 旋转角度。
  3307. @param quat Quaternion object represents the rotation or the x value of quaternion
  3308. @param y y value of quternion
  3309. @param z z value of quternion
  3310. @param w w value of quternion
  3311. */
  3312. setRotation(quat: cc.Quat|number, y: number, z: number, w: number): void;
  3313. /**
  3314. !#en
  3315. Returns a copy the untransformed size of the node. <br/>
  3316. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3317. All nodes has a size. Layer and Scene has the same size of the screen by default. <br/>
  3318. !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
  3319. @example
  3320. ```js
  3321. cc.log("Content Size: " + node.getContentSize());
  3322. ```
  3323. */
  3324. getContentSize(): Size;
  3325. /**
  3326. !#en
  3327. Sets the untransformed size of the node.<br/>
  3328. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3329. All nodes has a size. Layer and Scene has the same size of the screen.
  3330. !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
  3331. @param size The untransformed size of the node or The untransformed size's width of the node.
  3332. @param height The untransformed size's height of the node.
  3333. @example
  3334. ```js
  3335. node.setContentSize(cc.size(100, 100));
  3336. node.setContentSize(100, 100);
  3337. ```
  3338. */
  3339. setContentSize(size: Size|number, height?: number): void;
  3340. /**
  3341. !#en
  3342. Returns a copy of the anchor point.<br/>
  3343. Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
  3344. It's like a pin in the node where it is "attached" to its parent. <br/>
  3345. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
  3346. But you can use values higher than (1,1) and lower than (0,0) too. <br/>
  3347. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3348. !#zh
  3349. 获取节点锚点,用百分比表示。<br/>
  3350. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3351. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3352. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3353. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3354. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3355. @example
  3356. ```js
  3357. cc.log("Node AnchorPoint: " + node.getAnchorPoint());
  3358. ```
  3359. */
  3360. getAnchorPoint(): Vec2;
  3361. /**
  3362. !#en
  3363. Sets the anchor point in percent. <br/>
  3364. anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  3365. It's like a pin in the node where it is "attached" to its parent. <br/>
  3366. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  3367. But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  3368. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3369. !#zh
  3370. 设置锚点的百分比。<br/>
  3371. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3372. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3373. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3374. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3375. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3376. @param point The anchor point of node or The x axis anchor of node.
  3377. @param y The y axis anchor of node.
  3378. @example
  3379. ```js
  3380. node.setAnchorPoint(cc.v2(1, 1));
  3381. node.setAnchorPoint(1, 1);
  3382. ```
  3383. */
  3384. setAnchorPoint(point: Vec2|number, y?: number): void;
  3385. /**
  3386. !#en Set rotation by lookAt target point, normally used by Camera Node
  3387. !#zh 通过观察目标来设置 rotation,一般用于 Camera Node 上
  3388. @param pos pos
  3389. @param up default is (0,1,0)
  3390. */
  3391. lookAt(pos: Vec3, up?: Vec3): void;
  3392. /**
  3393. !#en
  3394. Get the local transform matrix (4x4), based on parent node coordinates
  3395. !#zh 返回局部空间坐标系的矩阵,基于父节点坐标系。
  3396. @param out The matrix object to be filled with data
  3397. @example
  3398. ```js
  3399. let mat4 = cc.mat4();
  3400. node.getLocalMatrix(mat4);
  3401. ```
  3402. */
  3403. getLocalMatrix(out: Mat4): Mat4;
  3404. /**
  3405. !#en
  3406. Get the world transform matrix (4x4)
  3407. !#zh 返回世界空间坐标系的矩阵。
  3408. @param out The matrix object to be filled with data
  3409. @example
  3410. ```js
  3411. let mat4 = cc.mat4();
  3412. node.getWorldMatrix(mat4);
  3413. ```
  3414. */
  3415. getWorldMatrix(out: Mat4): Mat4;
  3416. /**
  3417. !#en Converts a Point to node (local) space coordinates then add the anchor point position.
  3418. So the return position will be related to the left bottom corner of the node's bounding box.
  3419. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
  3420. !#zh 将一个点转换到节点 (局部) 坐标系,并加上锚点的坐标。<br/>
  3421. 也就是说返回的坐标是相对于节点包围盒左下角的坐标。<br/>
  3422. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToNodeSpaceAR。
  3423. @param worldPoint worldPoint
  3424. @example
  3425. ```js
  3426. var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
  3427. ```
  3428. */
  3429. convertToNodeSpace(worldPoint: Vec2): Vec2;
  3430. /**
  3431. !#en Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.
  3432. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
  3433. !#zh 将一个相对于节点左下角的坐标位置转换到世界空间坐标系。
  3434. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToWorldSpaceAR
  3435. @param nodePoint nodePoint
  3436. @example
  3437. ```js
  3438. var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
  3439. ```
  3440. */
  3441. convertToWorldSpace(nodePoint: Vec2): Vec2;
  3442. /**
  3443. !#en
  3444. Converts a Point to node (local) space coordinates in which the anchor point is the origin position.
  3445. !#zh
  3446. 将一个点转换到节点 (局部) 空间坐标系,这个坐标系以锚点为原点。
  3447. @param worldPoint worldPoint
  3448. @example
  3449. ```js
  3450. var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
  3451. ```
  3452. */
  3453. convertToNodeSpaceAR(worldPoint: Vec2): Vec2;
  3454. /**
  3455. !#en
  3456. Converts a Point in node coordinates to world space coordinates.
  3457. !#zh
  3458. 将节点坐标系下的一个点转换到世界空间坐标系。
  3459. @param nodePoint nodePoint
  3460. @example
  3461. ```js
  3462. var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
  3463. ```
  3464. */
  3465. convertToWorldSpaceAR(nodePoint: Vec2): Vec2;
  3466. /**
  3467. !#en
  3468. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3469. The matrix is in Pixels.
  3470. !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
  3471. @param out The affine transform object to be filled with data
  3472. @example
  3473. ```js
  3474. let affineTransform = cc.AffineTransform.create();
  3475. node.getNodeToParentTransform(affineTransform);
  3476. ```
  3477. */
  3478. getNodeToParentTransform(out?: AffineTransform): AffineTransform;
  3479. /**
  3480. !#en
  3481. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3482. The matrix is in Pixels.<br/>
  3483. This method is AR (Anchor Relative).
  3484. !#zh
  3485. 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>
  3486. 这个矩阵以像素为单位。<br/>
  3487. 该方法基于节点坐标。
  3488. @param out The affine transform object to be filled with data
  3489. @example
  3490. ```js
  3491. let affineTransform = cc.AffineTransform.create();
  3492. node.getNodeToParentTransformAR(affineTransform);
  3493. ```
  3494. */
  3495. getNodeToParentTransformAR(out?: AffineTransform): AffineTransform;
  3496. /**
  3497. !#en Returns the world affine transform matrix. The matrix is in Pixels.
  3498. !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
  3499. @param out The affine transform object to be filled with data
  3500. @example
  3501. ```js
  3502. let affineTransform = cc.AffineTransform.create();
  3503. node.getNodeToWorldTransform(affineTransform);
  3504. ```
  3505. */
  3506. getNodeToWorldTransform(out?: AffineTransform): AffineTransform;
  3507. /**
  3508. !#en
  3509. Returns the world affine transform matrix. The matrix is in Pixels.<br/>
  3510. This method is AR (Anchor Relative).
  3511. !#zh
  3512. 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>
  3513. 该方法基于节点坐标。
  3514. @param out The affine transform object to be filled with data
  3515. @example
  3516. ```js
  3517. let affineTransform = cc.AffineTransform.create();
  3518. node.getNodeToWorldTransformAR(affineTransform);
  3519. ```
  3520. */
  3521. getNodeToWorldTransformAR(out?: AffineTransform): AffineTransform;
  3522. /**
  3523. !#en
  3524. Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
  3525. The matrix is in Pixels. The returned transform is readonly and cannot be changed.
  3526. !#zh
  3527. 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。<br/>
  3528. 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
  3529. @param out The affine transform object to be filled with data
  3530. @example
  3531. ```js
  3532. let affineTransform = cc.AffineTransform.create();
  3533. node.getParentToNodeTransform(affineTransform);
  3534. ```
  3535. */
  3536. getParentToNodeTransform(out?: AffineTransform): AffineTransform;
  3537. /**
  3538. !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
  3539. !#en 返回世界坐标系到节点坐标系的逆矩阵。
  3540. @param out The affine transform object to be filled with data
  3541. @example
  3542. ```js
  3543. let affineTransform = cc.AffineTransform.create();
  3544. node.getWorldToNodeTransform(affineTransform);
  3545. ```
  3546. */
  3547. getWorldToNodeTransform(out?: AffineTransform): AffineTransform;
  3548. /**
  3549. !#en convenience methods which take a cc.Touch instead of cc.Vec2.
  3550. !#zh 将触摸点转换成本地坐标系中位置。
  3551. @param touch The touch object
  3552. @example
  3553. ```js
  3554. var newVec2 = node.convertTouchToNodeSpace(touch);
  3555. ```
  3556. */
  3557. convertTouchToNodeSpace(touch: Touch): Vec2;
  3558. /**
  3559. !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
  3560. !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
  3561. @param touch The touch object
  3562. @example
  3563. ```js
  3564. var newVec2 = node.convertTouchToNodeSpaceAR(touch);
  3565. ```
  3566. */
  3567. convertTouchToNodeSpaceAR(touch: Touch): Vec2;
  3568. /**
  3569. !#en
  3570. Returns a "local" axis aligned bounding box of the node. <br/>
  3571. The returned box is relative only to its parent.
  3572. !#zh 返回父节坐标系下的轴向对齐的包围盒。
  3573. @example
  3574. ```js
  3575. var boundingBox = node.getBoundingBox();
  3576. ```
  3577. */
  3578. getBoundingBox(): Rect;
  3579. /**
  3580. !#en
  3581. Returns a "world" axis aligned bounding box of the node.<br/>
  3582. The bounding box contains self and active children's world bounding box.
  3583. !#zh
  3584. 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。<br/>
  3585. 该边框包含自身和已激活的子节点的世界边框。
  3586. @example
  3587. ```js
  3588. var newRect = node.getBoundingBoxToWorld();
  3589. ```
  3590. */
  3591. getBoundingBoxToWorld(): Rect;
  3592. /**
  3593. !#en
  3594. Adds a child to the node with z order and name.
  3595. !#zh
  3596. 添加子节点,并且可以修改该节点的 局部 Z 顺序和名字。
  3597. @param child A child node
  3598. @param zIndex Z order for drawing priority. Please refer to zIndex property
  3599. @param name A name to identify the node easily. Please refer to name property
  3600. @example
  3601. ```js
  3602. node.addChild(newNode, 1, "node");
  3603. ```
  3604. */
  3605. addChild(child: Node, zIndex?: number, name?: string): void;
  3606. /**
  3607. !#en Stops all running actions and schedulers.
  3608. !#zh 停止所有正在播放的动作和计时器。
  3609. @example
  3610. ```js
  3611. node.cleanup();
  3612. ```
  3613. */
  3614. cleanup(): void;
  3615. /**
  3616. !#en Sorts the children array depends on children's zIndex and arrivalOrder,
  3617. normally you won't need to invoke this function.
  3618. !#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序,正常情况下开发者不需要手动调用这个函数。
  3619. */
  3620. sortAllChildren(): void;
  3621. /** !en
  3622. Switch 2D/3D node. The 2D nodes will run faster.
  3623. !zh
  3624. 切换 2D/3D 节点,2D 节点会有更高的运行效率 */
  3625. is3DNode: boolean;
  3626. /**
  3627. !#en
  3628. Returns the displayed opacity of Node,
  3629. 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.
  3630. !#zh
  3631. 获取节点显示透明度,
  3632. 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
  3633. 显示透明度是基于自身透明度和父节点透明度计算的。
  3634. */
  3635. getDisplayedOpacity(): number;
  3636. /**
  3637. !#en
  3638. Returns the displayed color of Node,
  3639. 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.
  3640. !#zh
  3641. 获取节点的显示颜色,
  3642. 显示颜色和颜色之间的不同之处在于当启用级连颜色时,
  3643. 显示颜色是基于自身颜色和父节点颜色计算的。
  3644. */
  3645. getDisplayedColor(): Color;
  3646. /** !#en Cascade opacity is removed from v2.0
  3647. Indicate whether node's opacity value affect its child nodes, default value is true.
  3648. !#zh 透明度级联功能从 v2.0 开始已移除
  3649. 节点的不透明度值是否影响其子节点,默认值为 true。 */
  3650. cascadeOpacity: boolean;
  3651. /**
  3652. !#en Cascade opacity is removed from v2.0
  3653. Returns whether node's opacity value affect its child nodes.
  3654. !#zh 透明度级联功能从 v2.0 开始已移除
  3655. 返回节点的不透明度值是否影响其子节点。
  3656. */
  3657. isCascadeOpacityEnabled(): boolean;
  3658. /**
  3659. !#en Cascade opacity is removed from v2.0
  3660. Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
  3661. !#zh 透明度级联功能从 v2.0 开始已移除
  3662. 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
  3663. @param cascadeOpacityEnabled cascadeOpacityEnabled
  3664. */
  3665. setCascadeOpacityEnabled(cascadeOpacityEnabled: boolean): void;
  3666. /**
  3667. !#en Opacity modify RGB have been removed since v2.0
  3668. Set whether color should be changed with the opacity value,
  3669. useless in ccsg.Node, but this function is override in some class to have such behavior.
  3670. !#zh 透明度影响颜色配置已经被废弃
  3671. 设置更改透明度时是否修改RGB值,
  3672. @param opacityValue opacityValue
  3673. */
  3674. setOpacityModifyRGB(opacityValue: boolean): void;
  3675. /**
  3676. !#en Opacity modify RGB have been removed since v2.0
  3677. Get whether color should be changed with the opacity value.
  3678. !#zh 透明度影响颜色配置已经被废弃
  3679. 获取更改透明度时是否修改RGB值。
  3680. */
  3681. isOpacityModifyRGB(): boolean;
  3682. }
  3683. /** !#en
  3684. Class of private entities in Cocos Creator scenes.<br/>
  3685. The PrivateNode is hidden in editor, and completely transparent to users.<br/>
  3686. It's normally used as Node's private content created by components in parent node.<br/>
  3687. So in theory private nodes are not children, they are part of the parent node.<br/>
  3688. Private node have two important characteristics:<br/>
  3689. 1. It has the minimum z index and cannot be modified, because they can't be displayed over real children.<br/>
  3690. 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/>
  3691. In this way, they can be easily kept inside the bounding box.<br/>
  3692. Currently, it's used by RichText component and TileMap component.
  3693. !#zh
  3694. Cocos Creator 场景中的私有节点类。<br/>
  3695. 私有节点在编辑器中不可见,对用户透明。<br/>
  3696. 通常私有节点是被一些特殊的组件创建出来作为父节点的一部分而存在的,理论上来说,它们不是子节点,而是父节点的组成部分。<br/>
  3697. 私有节点有两个非常重要的特性:<br/>
  3698. 1. 它有着最小的渲染排序的 Z 轴深度,并且无法被更改,因为它们不能被显示在其他正常子节点之上。<br/>
  3699. 2. 它的定位也是特殊的,对于私有节点来说,父节点包围盒的左下角是它的局部坐标系原点,这个原点相当于父节点的位置减去它锚点的偏移。这样私有节点可以比较容易被控制在包围盒之中。<br/>
  3700. 目前在引擎中,RichText 和 TileMap 都有可能生成私有节点。 */
  3701. export class PrivateNode extends Node {
  3702. /**
  3703. @param name name
  3704. */
  3705. constructor(name?: string);
  3706. }
  3707. /** !#en
  3708. cc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>
  3709. cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.
  3710. !#zh
  3711. cc.Scene 是 cc.Node 的子类,仅作为一个抽象的概念。<br/>
  3712. cc.Scene 和 cc.Node 有点不同,用户不应直接修改 cc.Scene。 */
  3713. export class Scene extends Node {
  3714. /** !#en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  3715. !#zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。 */
  3716. autoReleaseAssets: boolean;
  3717. }
  3718. /** !#en
  3719. Scheduler is responsible of triggering the scheduled callbacks.<br/>
  3720. You should not use NSTimer. Instead use this class.<br/>
  3721. <br/>
  3722. There are 2 different types of callbacks (selectors):<br/>
  3723. - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>
  3724. - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>
  3725. <br/>
  3726. The 'custom selectors' should be avoided when possible. It is faster,
  3727. and consumes less memory to use the 'update callback'. *
  3728. !#zh
  3729. Scheduler 是负责触发回调函数的类。<br/>
  3730. 通常情况下,建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>
  3731. 有两种不同类型的定时器:<br/>
  3732. - update 定时器:每一帧都会触发。您可以自定义优先级。<br/>
  3733. - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>
  3734. 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。 */
  3735. export class Scheduler {
  3736. /**
  3737. !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.
  3738. This method will add a `_id` property if it doesn't exist.
  3739. !zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  3740. 这个方法会给对象添加一个 `_id` 属性,如果这个属性不存在的话。
  3741. @param target target
  3742. */
  3743. enableForTarget(target: any): void;
  3744. /**
  3745. !#en
  3746. Modifies the time of all scheduled callbacks.<br/>
  3747. You can use this property to create a 'slow motion' or 'fast forward' effect.<br/>
  3748. Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>
  3749. To create a 'fast forward' effect, use values higher than 1.0.<br/>
  3750. Note:It will affect EVERY scheduled selector / action.
  3751. !#zh
  3752. 设置时间间隔的缩放比例。<br/>
  3753. 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br/>
  3754. 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br/>
  3755. 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br/>
  3756. 注意:它影响该 Scheduler 下管理的所有定时器。
  3757. @param timeScale timeScale
  3758. */
  3759. setTimeScale(timeScale: number): void;
  3760. /**
  3761. !#en Returns time scale of scheduler.
  3762. !#zh 获取时间间隔的缩放比例。
  3763. */
  3764. getTimeScale(): number;
  3765. /**
  3766. !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  3767. !#zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  3768. @param dt delta time
  3769. */
  3770. update(dt: number): void;
  3771. /**
  3772. !#en
  3773. <p>
  3774. The scheduled method will be called every 'interval' seconds.<br/>
  3775. If paused is YES, then it won't be called until it is resumed.<br/>
  3776. If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
  3777. If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
  3778. repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
  3779. delay is the amount of time the action will wait before it'll start<br/>
  3780. </p>
  3781. !#zh
  3782. 指定回调函数,调用对象等信息来添加一个新的定时器。<br/>
  3783. 如果 paused 值为 true,那么直到 resume 被调用才开始计时。<br/>
  3784. 当时间间隔达到指定值时,设置的回调函数将会被调用。<br/>
  3785. 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
  3786. 建议使用 scheduleUpdateForTarget 代替。<br/>
  3787. 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
  3788. repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
  3789. 可以让定时器一直循环触发。<br/>
  3790. delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
  3791. @param callback callback
  3792. @param target target
  3793. @param interval interval
  3794. @param repeat repeat
  3795. @param delay delay
  3796. @param paused paused
  3797. @example
  3798. ```js
  3799. //register a schedule to scheduler
  3800. cc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);
  3801. ```
  3802. */
  3803. schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void;
  3804. schedule(callback: Function, target: any, interval: number, paused?: boolean): void;
  3805. /**
  3806. !#en
  3807. Schedules the update callback for a given target,
  3808. During every frame after schedule started, the "update" function of target will be invoked.
  3809. !#zh
  3810. 使用指定的优先级为指定的对象设置 update 定时器。
  3811. update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。
  3812. 优先级的值越低,定时器被触发的越早。
  3813. @param target target
  3814. @param priority priority
  3815. @param paused paused
  3816. */
  3817. scheduleUpdate(target: any, priority: number, paused: boolean): void;
  3818. /**
  3819. !#en
  3820. Unschedules a callback for a callback and a given target.
  3821. If you want to unschedule the "update", use `unscheduleUpdate()`
  3822. !#zh
  3823. 取消指定对象定时器。
  3824. 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  3825. @param callback The callback to be unscheduled
  3826. @param target The target bound to the callback.
  3827. */
  3828. unschedule(callback: Function, target: any): void;
  3829. /**
  3830. !#en Unschedules the update callback for a given target.
  3831. !#zh 取消指定对象的 update 定时器。
  3832. @param target The target to be unscheduled.
  3833. */
  3834. unscheduleUpdate(target: any): void;
  3835. /**
  3836. !#en
  3837. Unschedules all scheduled callbacks for a given target.
  3838. This also includes the "update" callback.
  3839. !#zh 取消指定对象的所有定时器,包括 update 定时器。
  3840. @param target The target to be unscheduled.
  3841. */
  3842. unscheduleAllForTarget(target: any): void;
  3843. /**
  3844. !#en
  3845. Unschedules all scheduled callbacks from all targets including the system callbacks.<br/>
  3846. You should NEVER call this method, unless you know what you are doing.
  3847. !#zh
  3848. 取消所有对象的所有定时器,包括系统定时器。<br/>
  3849. 不用调用此函数,除非你确定你在做什么。
  3850. */
  3851. unscheduleAll(): void;
  3852. /**
  3853. !#en
  3854. Unschedules all callbacks from all targets with a minimum priority.<br/>
  3855. You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  3856. !#zh
  3857. 取消所有优先级的值大于指定优先级的定时器。<br/>
  3858. 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  3859. @param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
  3860. priority is higher than minPriority will be unscheduled.
  3861. */
  3862. unscheduleAllWithMinPriority(minPriority: number): void;
  3863. /**
  3864. !#en Checks whether a callback for a given target is scheduled.
  3865. !#zh 检查指定的回调函数和回调对象组合是否存在定时器。
  3866. @param callback The callback to check.
  3867. @param target The target of the callback.
  3868. */
  3869. isScheduled(callback: Function, target: any): boolean;
  3870. /**
  3871. !#en
  3872. Pause all selectors from all targets.<br/>
  3873. You should NEVER call this method, unless you know what you are doing.
  3874. !#zh
  3875. 暂停所有对象的所有定时器。<br/>
  3876. 不要调用这个方法,除非你知道你正在做什么。
  3877. */
  3878. pauseAllTargets(): void;
  3879. /**
  3880. !#en
  3881. Pause all selectors from all targets with a minimum priority. <br/>
  3882. You should only call this with kCCPriorityNonSystemMin or higher.
  3883. !#zh
  3884. 暂停所有优先级的值大于指定优先级的定时器。<br/>
  3885. 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  3886. @param minPriority minPriority
  3887. */
  3888. pauseAllTargetsWithMinPriority(minPriority: number): void;
  3889. /**
  3890. !#en
  3891. Resume selectors on a set of targets.<br/>
  3892. This can be useful for undoing a call to pauseAllCallbacks.
  3893. !#zh
  3894. 恢复指定数组中所有对象的定时器。<br/>
  3895. 这个函数是 pauseAllCallbacks 的逆操作。
  3896. @param targetsToResume targetsToResume
  3897. */
  3898. resumeTargets(targetsToResume: any[]): void;
  3899. /**
  3900. !#en
  3901. Pauses the target.<br/>
  3902. All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  3903. If the target is not present, nothing happens.
  3904. !#zh
  3905. 暂停指定对象的定时器。<br/>
  3906. 指定对象的所有定时器都会被暂停。<br/>
  3907. 如果指定的对象没有定时器,什么也不会发生。
  3908. @param target target
  3909. */
  3910. pauseTarget(target: any): void;
  3911. /**
  3912. !#en
  3913. Resumes the target.<br/>
  3914. The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  3915. If the target is not present, nothing happens.
  3916. !#zh
  3917. 恢复指定对象的所有定时器。<br/>
  3918. 指定对象的所有定时器将继续工作。<br/>
  3919. 如果指定的对象没有定时器,什么也不会发生。
  3920. @param target target
  3921. */
  3922. resumeTarget(target: any): void;
  3923. /**
  3924. !#en Returns whether or not the target is paused.
  3925. !#zh 返回指定对象的定时器是否暂停了。
  3926. @param target target
  3927. */
  3928. isTargetPaused(target: any): boolean;
  3929. /** !#en Priority level reserved for system services.
  3930. !#zh 系统服务的优先级。 */
  3931. static PRIORITY_SYSTEM: number;
  3932. /** !#en Minimum priority level for user scheduling.
  3933. !#zh 用户调度最低优先级。 */
  3934. static PRIORITY_NON_SYSTEM: number;
  3935. }
  3936. /** !#en Render the TMX layer.
  3937. !#zh 渲染 TMX layer。 */
  3938. export class TiledLayer extends Component {
  3939. /**
  3940. !#en Gets the layer name.
  3941. !#zh 获取层的名称。
  3942. @example
  3943. ```js
  3944. let layerName = tiledLayer.getLayerName();
  3945. cc.log(layerName);
  3946. ```
  3947. */
  3948. getLayerName(): string;
  3949. /**
  3950. !#en Set the layer name.
  3951. !#zh 设置层的名称
  3952. @param layerName layerName
  3953. @example
  3954. ```js
  3955. tiledLayer.setLayerName("New Layer");
  3956. ```
  3957. */
  3958. SetLayerName(layerName: string): void;
  3959. /**
  3960. !#en Return the value for the specific property name.
  3961. !#zh 获取指定属性名的值。
  3962. @param propertyName propertyName
  3963. @example
  3964. ```js
  3965. let property = tiledLayer.getProperty("info");
  3966. cc.log(property);
  3967. ```
  3968. */
  3969. getProperty(propertyName: string): any;
  3970. /**
  3971. !#en Returns the position in pixels of a given tile coordinate.
  3972. !#zh 获取指定 tile 的像素坐标。
  3973. @param pos position or x
  3974. @param y y
  3975. @example
  3976. ```js
  3977. let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  3978. cc.log("Pos: " + pos);
  3979. let pos = tiledLayer.getPositionAt(0, 0);
  3980. cc.log("Pos: " + pos);
  3981. ```
  3982. */
  3983. getPositionAt(pos: Vec2|number, y?: number): Vec2;
  3984. /**
  3985. !#en
  3986. Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  3987. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  3988. If a tile is already placed at that position, then it will be removed.
  3989. !#zh
  3990. 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  3991. tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  3992. 如果一个 tile 已经放在那个位置,那么它将被删除。
  3993. @param gid gid
  3994. @param posOrX position or x
  3995. @param flagsOrY flags or y
  3996. @param flags flags
  3997. @example
  3998. ```js
  3999. tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  4000. ```
  4001. */
  4002. setTileGIDAt(gid: number, posOrX: Vec2|number, flagsOrY: number, flags?: number): void;
  4003. /**
  4004. !#en
  4005. Returns the tile gid at a given tile coordinate. <br />
  4006. if it returns 0, it means that the tile is empty. <br />
  4007. !#zh
  4008. 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  4009. 如果它返回 0,则表示该 tile 为空。<br />
  4010. @param pos or x
  4011. @param y y
  4012. @example
  4013. ```js
  4014. let tileGid = tiledLayer.getTileGIDAt(0, 0);
  4015. ```
  4016. */
  4017. getTileGIDAt(pos: Vec2|number, y?: number): number;
  4018. /**
  4019. !#en
  4020. Get the TiledTile with the tile coordinate.<br/>
  4021. If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  4022. then will create a new TiledTile at the coordinate.
  4023. The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  4024. !#zh
  4025. 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  4026. 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  4027. 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  4028. @param x x
  4029. @param y y
  4030. @param forceCreate forceCreate
  4031. @example
  4032. ```js
  4033. let tile = tiledLayer.getTiledTileAt(100, 100, true);
  4034. cc.log(tile);
  4035. ```
  4036. */
  4037. getTiledTileAt(x: number, y: number, forceCreate: boolean): cc.TiledTile;
  4038. /**
  4039. !#en
  4040. Change tile to TiledTile at the specified coordinate.
  4041. !#zh
  4042. 将指定的 tile 坐标替换为指定的 TiledTile。
  4043. @param x x
  4044. @param y y
  4045. @param tiledTile tiledTile
  4046. */
  4047. setTiledTileAt(x: number, y: number, tiledTile: cc.TiledTile): cc.TiledTile;
  4048. /**
  4049. !#en Return texture of cc.SpriteBatchNode.
  4050. !#zh 获取纹理。
  4051. @example
  4052. ```js
  4053. let texture = tiledLayer.getTexture();
  4054. cc.log("Texture: " + texture);
  4055. ```
  4056. */
  4057. getTexture(): Texture2D;
  4058. /**
  4059. !#en Set the texture of cc.SpriteBatchNode.
  4060. !#zh 设置纹理。
  4061. @param texture texture
  4062. @example
  4063. ```js
  4064. tiledLayer.setTexture(texture);
  4065. ```
  4066. */
  4067. setTexture(texture: Texture2D): void;
  4068. /**
  4069. !#en Gets layer size.
  4070. !#zh 获得层大小。
  4071. @example
  4072. ```js
  4073. let size = tiledLayer.getLayerSize();
  4074. cc.log("layer size: " + size);
  4075. ```
  4076. */
  4077. getLayerSize(): Size;
  4078. /**
  4079. !#en Size of the map's tile (could be different from the tile's size).
  4080. !#zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  4081. @example
  4082. ```js
  4083. let mapTileSize = tiledLayer.getMapTileSize();
  4084. cc.log("MapTile size: " + mapTileSize);
  4085. ```
  4086. */
  4087. getMapTileSize(): Size;
  4088. /**
  4089. !#en Tile set information for the layer.
  4090. !#zh 获取 layer 的 Tileset 信息。
  4091. @example
  4092. ```js
  4093. let tileset = tiledLayer.getTileSet();
  4094. ```
  4095. */
  4096. getTileSet(): TMXTilesetInfo;
  4097. /**
  4098. !#en Tile set information for the layer.
  4099. !#zh 设置 layer 的 Tileset 信息。
  4100. @param tileset tileset
  4101. @example
  4102. ```js
  4103. tiledLayer.setTileSet(tileset);
  4104. ```
  4105. */
  4106. setTileSet(tileset: TMXTilesetInfo): void;
  4107. /**
  4108. !#en Layer orientation, which is the same as the map orientation.
  4109. !#zh 获取 Layer 方向(同地图方向)。
  4110. @example
  4111. ```js
  4112. let orientation = tiledLayer.getLayerOrientation();
  4113. cc.log("Layer Orientation: " + orientation);
  4114. ```
  4115. */
  4116. getLayerOrientation(): number;
  4117. /**
  4118. !#en properties from the layer. They can be added using Tiled.
  4119. !#zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  4120. @example
  4121. ```js
  4122. let properties = tiledLayer.getProperties();
  4123. cc.log("Properties: " + properties);
  4124. ```
  4125. */
  4126. getProperties(): any[];
  4127. }
  4128. /** !#en Renders a TMX Tile Map in the scene.
  4129. !#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */
  4130. export class TiledMap extends Component {
  4131. /** !#en The TiledMap Asset.
  4132. !#zh TiledMap 资源。 */
  4133. tmxAsset: TiledMapAsset;
  4134. /**
  4135. !#en Gets the map size.
  4136. !#zh 获取地图大小。
  4137. @example
  4138. ```js
  4139. let mapSize = tiledMap.getMapSize();
  4140. cc.log("Map Size: " + mapSize);
  4141. ```
  4142. */
  4143. getMapSize(): Size;
  4144. /**
  4145. !#en Gets the tile size.
  4146. !#zh 获取地图背景中 tile 元素的大小。
  4147. @example
  4148. ```js
  4149. let tileSize = tiledMap.getTileSize();
  4150. cc.log("Tile Size: " + tileSize);
  4151. ```
  4152. */
  4153. getTileSize(): Size;
  4154. /**
  4155. !#en map orientation.
  4156. !#zh 获取地图方向。
  4157. @example
  4158. ```js
  4159. let mapOrientation = tiledMap.getMapOrientation();
  4160. cc.log("Map Orientation: " + mapOrientation);
  4161. ```
  4162. */
  4163. getMapOrientation(): number;
  4164. /**
  4165. !#en object groups.
  4166. !#zh 获取所有的对象层。
  4167. @example
  4168. ```js
  4169. let objGroups = titledMap.getObjectGroups();
  4170. for (let i = 0; i < objGroups.length; ++i) {
  4171. cc.log("obj: " + objGroups[i]);
  4172. }
  4173. ```
  4174. */
  4175. getObjectGroups(): TiledObjectGroup[];
  4176. /**
  4177. !#en Return the TMXObjectGroup for the specific group.
  4178. !#zh 获取指定的 TMXObjectGroup。
  4179. @param groupName groupName
  4180. @example
  4181. ```js
  4182. let group = titledMap.getObjectGroup("Players");
  4183. cc.log("ObjectGroup: " + group);
  4184. ```
  4185. */
  4186. getObjectGroup(groupName: string): TiledObjectGroup;
  4187. /**
  4188. !#en Gets the map properties.
  4189. !#zh 获取地图的属性。
  4190. @example
  4191. ```js
  4192. let properties = titledMap.getProperties();
  4193. for (let i = 0; i < properties.length; ++i) {
  4194. cc.log("Properties: " + properties[i]);
  4195. }
  4196. ```
  4197. */
  4198. getProperties(): any[];
  4199. /**
  4200. !#en Return All layers array.
  4201. !#zh 返回包含所有 layer 的数组。
  4202. @example
  4203. ```js
  4204. let layers = titledMap.allLayers();
  4205. for (let i = 0; i < layers.length; ++i) {
  4206. cc.log("Layers: " + layers[i]);
  4207. }
  4208. ```
  4209. */
  4210. getLayers(): TiledLayer[];
  4211. /**
  4212. !#en return the cc.TiledLayer for the specific layer.
  4213. !#zh 获取指定名称的 layer。
  4214. @param layerName layerName
  4215. @example
  4216. ```js
  4217. let layer = titledMap.getLayer("Player");
  4218. cc.log(layer);
  4219. ```
  4220. */
  4221. getLayer(layerName: string): TiledLayer;
  4222. /**
  4223. !#en Return the value for the specific property name.
  4224. !#zh 通过属性名称,获取指定的属性。
  4225. @param propertyName propertyName
  4226. @example
  4227. ```js
  4228. let property = titledMap.getProperty("info");
  4229. cc.log("Property: " + property);
  4230. ```
  4231. */
  4232. getProperty(propertyName: string): string;
  4233. /**
  4234. !#en Return properties dictionary for tile GID.
  4235. !#zh 通过 GID ,获取指定的属性。
  4236. @param GID GID
  4237. @example
  4238. ```js
  4239. let properties = titledMap.getPropertiesForGID(GID);
  4240. cc.log("Properties: " + properties);
  4241. ```
  4242. */
  4243. getPropertiesForGID(GID: number): any;
  4244. }
  4245. /** Class for tiled map asset handling. */
  4246. export class TiledMapAsset extends Asset {
  4247. textures: Texture2D[];
  4248. textureNames: string[];
  4249. }
  4250. /** !#en Renders the TMX object group.
  4251. !#zh 渲染 tmx object group。 */
  4252. export class TiledObjectGroup extends Component {
  4253. /**
  4254. !#en Offset position of child objects.
  4255. !#zh 获取子对象的偏移位置。
  4256. @example
  4257. ```js
  4258. let offset = tMXObjectGroup.getPositionOffset();
  4259. ```
  4260. */
  4261. getPositionOffset(): Vec2;
  4262. /**
  4263. !#en List of properties stored in a dictionary.
  4264. !#zh 以映射的形式获取属性列表。
  4265. @example
  4266. ```js
  4267. let offset = tMXObjectGroup.getProperties();
  4268. ```
  4269. */
  4270. getProperties(): any;
  4271. /**
  4272. !#en Gets the Group name.
  4273. !#zh 获取组名称。
  4274. @example
  4275. ```js
  4276. let groupName = tMXObjectGroup.getGroupName;
  4277. ```
  4278. */
  4279. getGroupName(): string;
  4280. /**
  4281. !#en
  4282. Return the object for the specific object name. <br />
  4283. It will return the 1st object found on the array for the given name.
  4284. !#zh 获取指定的对象。
  4285. @param objectName objectName
  4286. @example
  4287. ```js
  4288. let object = tMXObjectGroup.getObject("Group");
  4289. ```
  4290. */
  4291. getObject(objectName: string): any;
  4292. /**
  4293. !#en Gets the objects.
  4294. !#zh 获取对象数组。
  4295. @example
  4296. ```js
  4297. let objects = tMXObjectGroup.getObjects();
  4298. ```
  4299. */
  4300. getObjects(): any[];
  4301. }
  4302. /** !#en TiledTile can control the specified map tile.
  4303. It will apply the node rotation, scale, translate to the map tile.
  4304. You can change the TiledTile's gid to change the map tile's style.
  4305. !#zh TiledTile 可以单独对某一个地图块进行操作。
  4306. 他会将节点的旋转,缩放,平移操作应用在这个地图块上,并可以通过更换当前地图块的 gid 来更换地图块的显示样式。 */
  4307. export class TiledTile extends Component {
  4308. /** !#en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  4309. !#zh 指定 TiledTile 的横向坐标,以地图块为单位 */
  4310. x: number;
  4311. /** !#en Specify the TiledTile vertical coordinate,use map tile as the unit.
  4312. !#zh 指定 TiledTile 的纵向坐标,以地图块为单位 */
  4313. y: number;
  4314. /** !#en Specify the TiledTile gid.
  4315. !#zh 指定 TiledTile 的 gid 值 */
  4316. gid: number;
  4317. }
  4318. /** !#en cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game.
  4319. !#zh Video 组件,用于在游戏中播放视频 */
  4320. export class VideoPlayer extends Component {
  4321. /** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.
  4322. !#zh 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。 */
  4323. resourceType: VideoPlayer.ResourceType;
  4324. /** !#en The remote URL of video.
  4325. !#zh 远程视频的 URL */
  4326. remoteURL: string;
  4327. /** !#en The local video full path.
  4328. !#zh 本地视频的 URL */
  4329. clip: string;
  4330. /** !#en The current playback time of the now playing item in seconds, you could also change the start playback time.
  4331. !#zh 指定视频从什么时间点开始播放,单位是秒,也可以用来获取当前视频播放的时间进度。 */
  4332. currentTime: number;
  4333. /** !#en The volume of the video.
  4334. !#zh 视频的音量(0.0 ~ 1.0) */
  4335. volume: number;
  4336. /** !#en Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume.
  4337. !#zh 是否静音视频。静音时设置音量为 0,取消静音是恢复原来的音量。 */
  4338. mute: boolean;
  4339. /** !#en Whether keep the aspect ration of the original video.
  4340. !#zh 是否保持视频原来的宽高比 */
  4341. keepAspectRatio: boolean;
  4342. /** !#en Whether play video in fullscreen mode.
  4343. !#zh 是否全屏播放视频 */
  4344. isFullscreen: boolean;
  4345. /** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.
  4346. !#zh 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。 */
  4347. videoPlayerEvent: Component.EventHandler[];
  4348. /**
  4349. !#en If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.
  4350. !#zh 如果视频被暂停播放了,调用这个接口可以继续播放。如果视频被停止播放了,调用这个接口可以从头开始播放。
  4351. */
  4352. play(): void;
  4353. /**
  4354. !#en If a video is paused, call this method to resume playing.
  4355. !#zh 如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  4356. */
  4357. resume(): void;
  4358. /**
  4359. !#en If a video is playing, call this method to pause playing.
  4360. !#zh 如果一个视频正在播放,调用这个接口可以暂停播放。
  4361. */
  4362. pause(): void;
  4363. /**
  4364. !#en If a video is playing, call this method to stop playing immediately.
  4365. !#zh 如果一个视频正在播放,调用这个接口可以立马停止播放。
  4366. */
  4367. stop(): void;
  4368. /**
  4369. !#en Gets the duration of the video
  4370. !#zh 获取视频文件的播放总时长
  4371. */
  4372. getDuration(): number;
  4373. /**
  4374. !#en Determine whether video is playing or not.
  4375. !#zh 判断当前视频是否处于播放状态
  4376. */
  4377. isPlaying(): boolean;
  4378. /**
  4379. !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should
  4380. call the destroy method on this component or the associated node explicitly.
  4381. Otherwise, the created DOM element won't be removed from web page.
  4382. !#zh
  4383. 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4384. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4385. @example
  4386. ```js
  4387. videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false);
  4388. // when you don't need videoplayer anymore
  4389. videoplayer.node.destroy();
  4390. ```
  4391. */
  4392. destroy(): boolean;
  4393. }
  4394. /** !#en cc.WebView is a component for display web pages in the game
  4395. !#zh WebView 组件,用于在游戏中显示网页 */
  4396. export class WebView extends Component {
  4397. /** !#en A given URL to be loaded by the WebView, it should have a http or https prefix.
  4398. !#zh 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串 */
  4399. url: string;
  4400. /** !#en The webview's event callback , it will be triggered when certain webview event occurs.
  4401. !#zh WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数 */
  4402. webviewLoadedEvents: Component.EventHandler[];
  4403. /**
  4404. !#en
  4405. Set javascript interface scheme (see also setOnJSCallback). <br/>
  4406. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4407. Please refer to the official documentation for more details.
  4408. !#zh
  4409. 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。<br/>
  4410. 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。<br/>
  4411. 详情请参阅官方文档
  4412. @param scheme scheme
  4413. */
  4414. setJavascriptInterfaceScheme(scheme: string): void;
  4415. /**
  4416. !#en
  4417. This callback called when load URL that start with javascript
  4418. interface scheme (see also setJavascriptInterfaceScheme). <br/>
  4419. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4420. Please refer to the official documentation for more details.
  4421. !#zh
  4422. 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。<br/>
  4423. 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  4424. 详情请参阅官方文档
  4425. @param callback callback
  4426. */
  4427. setOnJSCallback(callback: Function): void;
  4428. /**
  4429. !#en
  4430. Evaluates JavaScript in the context of the currently displayed page. <br/>
  4431. Please refer to the official document for more details <br/>
  4432. Note: Cross domain issues need to be resolved by yourself <br/>
  4433. !#zh
  4434. 执行 WebView 内部页面脚本(详情请参阅官方文档) <br/>
  4435. 注意:需要自行解决跨域问题
  4436. @param str str
  4437. */
  4438. evaluateJS(str: string): void;
  4439. /**
  4440. !#en if you don't need the WebView and it isn't in any running Scene, you should
  4441. call the destroy method on this component or the associated node explicitly.
  4442. Otherwise, the created DOM element won't be removed from web page.
  4443. !#zh
  4444. 如果你不再使用 WebView,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4445. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4446. @example
  4447. ```js
  4448. webview.node.parent = null; // or webview.node.removeFromParent(false);
  4449. // when you don't need webview anymore
  4450. webview.node.destroy();
  4451. ```
  4452. */
  4453. destroy(): boolean;
  4454. }
  4455. /** !#en
  4456. cc.NodePool is the cache pool designed for node type.<br/>
  4457. It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  4458. It's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,
  4459. for example, a prefab is a specific node type. <br/>
  4460. When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  4461. Some common use case is :<br/>
  4462. 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  4463. 2. Blocks in candy crash (massive creation and recreation)<br/>
  4464. etc...
  4465. !#zh
  4466. cc.NodePool 是用于管理节点对象的对象缓存池。<br/>
  4467. 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  4468. 以前 cocos2d-x 中的 cc.pool 和新的节点事件注册系统不兼容,因此请使用 cc.NodePool 来代替。
  4469. 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  4470. 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  4471. 一些常见的用例是:<br/>
  4472. 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  4473. 2.糖果粉碎传奇中的木块(频繁创建)。
  4474. 等等.... */
  4475. export class NodePool {
  4476. /**
  4477. !#en
  4478. 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.
  4479. !#zh
  4480. 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  4481. @param poolHandlerComp !#en The constructor or the class name of the component to control the unuse/reuse logic. !#zh 处理节点回收和复用事件逻辑的组件类型或名称。
  4482. @example
  4483. ```js
  4484. properties: {
  4485. template: cc.Prefab
  4486. },
  4487. onLoad () {
  4488. // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  4489. this.myPool = new cc.NodePool('MyTemplateHandler');
  4490. }
  4491. ```
  4492. */
  4493. constructor(poolHandlerComp?: {prototype: Component}|string);
  4494. /** !#en The pool handler component, it could be the class name or the constructor.
  4495. !#zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。 */
  4496. poolHandlerComp: Function|string;
  4497. /**
  4498. !#en The current available size in the pool
  4499. !#zh 获取当前缓冲池的可用对象数量
  4500. */
  4501. size(): number;
  4502. /**
  4503. !#en Destroy all cached nodes in the pool
  4504. !#zh 销毁对象池中缓存的所有节点
  4505. */
  4506. clear(): void;
  4507. /**
  4508. !#en Put a new Node into the pool.
  4509. It will automatically remove the node from its parent without cleanup.
  4510. It will also invoke unuse method of the poolHandlerComp if exist.
  4511. !#zh 向缓冲池中存入一个不再需要的节点对象。
  4512. 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  4513. 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  4514. @param obj obj
  4515. @example
  4516. ```js
  4517. let myNode = cc.instantiate(this.template);
  4518. this.myPool.put(myNode);
  4519. ```
  4520. */
  4521. put(obj: Node): void;
  4522. /**
  4523. !#en Get a obj from pool, if no available object in pool, null will be returned.
  4524. This function will invoke the reuse function of poolHandlerComp if exist.
  4525. !#zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  4526. 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  4527. @param params !#en Params to pass to 'reuse' method in poolHandlerComp !#zh 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  4528. @example
  4529. ```js
  4530. let newNode = this.myPool.get();
  4531. ```
  4532. */
  4533. get(...params: any[]): Node;
  4534. }
  4535. /** !#en
  4536. Camera is usefull when making reel game or other games which need scroll screen.
  4537. Using camera will be more efficient than moving node to scroll screen.
  4538. Camera
  4539. !#zh
  4540. 摄像机在制作卷轴或是其他需要移动屏幕的游戏时比较有用,使用摄像机将会比移动节点来移动屏幕更加高效。 */
  4541. export class Camera extends Component {
  4542. /** !#en
  4543. The camera zoom ratio.
  4544. !#zh
  4545. 摄像机缩放比率 */
  4546. zoomRatio: number;
  4547. /** !#en
  4548. Field of view. The width of the Camera’s view angle, measured in degrees along the local Y axis.
  4549. !#zh
  4550. 决定摄像机视角的宽度,当摄像机处于透视投影模式下这个属性才会生效。 */
  4551. fov: number;
  4552. /** !#en
  4553. The viewport size of the Camera when set to orthographic projection.
  4554. !#zh
  4555. 摄像机在正交投影模式下的视窗大小。 */
  4556. orthoSize: number;
  4557. /** !#en
  4558. The near clipping plane.
  4559. !#zh
  4560. 摄像机的近剪裁面。 */
  4561. nearClip: number;
  4562. /** !#en
  4563. The far clipping plane.
  4564. !#zh
  4565. 摄像机的远剪裁面。 */
  4566. farClip: number;
  4567. /** !#en
  4568. Is the camera orthographic (true) or perspective (false)?
  4569. !#zh
  4570. 设置摄像机的投影模式是正交还是透视模式。 */
  4571. ortho: boolean;
  4572. /** !#en
  4573. Four values (0-1) that indicate where on the screen this camera view will be drawn.
  4574. !#zh
  4575. 决定摄像机绘制在屏幕上哪个位置,值为 0-1。 */
  4576. rect: Rect;
  4577. /** !#en
  4578. This is used to render parts of the scene selectively.
  4579. !#zh
  4580. 决定摄像机会渲染场景的哪一部分。 */
  4581. cullingMask: number;
  4582. /** !#en
  4583. Determining what to clear when camera rendering.
  4584. !#zh
  4585. 决定摄像机渲染时会清除哪些状态。 */
  4586. clearFlags: Camera.ClearFlags;
  4587. /** !#en
  4588. The color with which the screen will be cleared.
  4589. !#zh
  4590. 摄像机用于清除屏幕的背景色。 */
  4591. backgroundColor: Color;
  4592. /** !#en
  4593. Camera's depth in the camera rendering order.
  4594. !#zh
  4595. 摄像机深度,用于决定摄像机的渲染顺序。 */
  4596. depth: number;
  4597. /** !#en
  4598. Destination render texture.
  4599. Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture.
  4600. !#zh
  4601. 摄像机渲染的目标 RenderTexture。
  4602. 一般摄像机会直接渲染到屏幕上,但是有一些效果可以使用摄像机渲染到 RenderTexture 上再对 RenderTexture 进行处理来实现。 */
  4603. targetTexture: RenderTexture;
  4604. /** !#en
  4605. The first enabled camera.
  4606. !#zh
  4607. 第一个被激活的摄像机。 */
  4608. static main: Camera;
  4609. /** !#en
  4610. All enabled cameras.
  4611. !#zh
  4612. 激活的所有摄像机。 */
  4613. static cameras: [Camera];
  4614. /**
  4615. !#en
  4616. Get the first camera which the node belong to.
  4617. !#zh
  4618. 获取节点所在的第一个摄像机。
  4619. @param node node
  4620. */
  4621. static findCamera(node: Node): Camera;
  4622. /**
  4623. !#en
  4624. Returns the matrix that transform the node's (local) space coordinates into the camera's space coordinates.
  4625. !#zh
  4626. 返回一个将节点坐标系转换到摄像机坐标系下的矩阵
  4627. @param node the node which should transform
  4628. */
  4629. getNodeToCameraTransform(node: Node): AffineTransform;
  4630. /**
  4631. !#en
  4632. Conver a camera coordinates point to world coordinates.
  4633. !#zh
  4634. 将一个摄像机坐标系下的点转换到世界坐标系下。
  4635. @param point the point which should transform
  4636. @param out the point to receive the result
  4637. */
  4638. getCameraToWorldPoint(point: Vec2, out: Vec2): Vec2;
  4639. /**
  4640. !#en
  4641. Conver a world coordinates point to camera coordinates.
  4642. !#zh
  4643. 将一个世界坐标系下的点转换到摄像机坐标系下。
  4644. @param point point
  4645. @param out the point to receive the result
  4646. */
  4647. getWorldToCameraPoint(point: Vec2, out: Vec2): Vec2;
  4648. /**
  4649. !#en
  4650. Get the camera to world matrix
  4651. !#zh
  4652. 获取摄像机坐标系到世界坐标系的矩阵
  4653. @param out the matrix to receive the result
  4654. */
  4655. getCameraToWorldMatrix(out: Mat4): Mat4;
  4656. /**
  4657. !#en
  4658. Get the world to camera matrix
  4659. !#zh
  4660. 获取世界坐标系到摄像机坐标系的矩阵
  4661. @param out the matrix to receive the result
  4662. */
  4663. getWorldToCameraMatrix(out: Mat4): Mat4;
  4664. /**
  4665. !#en
  4666. Get a ray from screen position
  4667. !#zh
  4668. 从屏幕坐标获取一条射线
  4669. @param screenPos screenPos
  4670. */
  4671. getRay(screenPos: Vec2): Ray;
  4672. /**
  4673. !#en
  4674. Check whether the node is in the camera.
  4675. !#zh
  4676. 检测节点是否被此摄像机影响
  4677. @param node the node which need to check
  4678. */
  4679. containsNode(node: Node): boolean;
  4680. /**
  4681. !#en
  4682. Render the camera manually.
  4683. !#zh
  4684. 手动渲染摄像机。
  4685. @param root root
  4686. */
  4687. render(root: Node): void;
  4688. }
  4689. /** !#en
  4690. Base class for handling assets used in Creator.<br/>
  4691. You may want to override:<br/>
  4692. - createNode<br/>
  4693. - getset functions of _nativeAsset<br/>
  4694. - cc.Object._serialize<br/>
  4695. - cc.Object._deserialize<br/>
  4696. !#zh
  4697. Creator 中的资源基类。<br/>
  4698. 您可能需要重写:<br/>
  4699. - createNode <br/>
  4700. - _nativeAsset 的 getset 方法<br/>
  4701. - cc.Object._serialize<br/>
  4702. - cc.Object._deserialize<br/> */
  4703. export class Asset extends RawAsset {
  4704. /** !#en
  4705. Whether the asset is loaded or not
  4706. !#zh
  4707. 该资源是否已经成功加载 */
  4708. loaded: boolean;
  4709. /** !#en
  4710. Returns the url of this asset's native object, if none it will returns an empty string.
  4711. !#zh
  4712. 返回该资源对应的目标平台资源的 URL,如果没有将返回一个空字符串。 */
  4713. nativeUrl: string;
  4714. /** !#en Indicates whether its dependent raw assets can support deferred load if the owner scene (or prefab) is marked as `asyncLoadAssets`.
  4715. !#zh 当场景或 Prefab 被标记为 `asyncLoadAssets`,禁止延迟加载该资源所依赖的其它 RawAsset。 */
  4716. static preventDeferredLoadDependents: boolean;
  4717. /** !#en Indicates whether its native object should be preloaded from native url.
  4718. !#zh 禁止预加载原生对象。 */
  4719. static preventPreloadNativeObject: boolean;
  4720. /**
  4721. Returns the asset's url.
  4722. The `Asset` object overrides the `toString()` method of the `Object` object.
  4723. For `Asset` objects, the toString() method returns a string representation of the object.
  4724. 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.
  4725. */
  4726. toString(): string;
  4727. /**
  4728. !#en
  4729. Create a new node using this asset in the scene.<br/>
  4730. If this type of asset dont have its corresponding node type, this method should be null.
  4731. !#zh
  4732. 使用该资源在场景中创建一个新节点。<br/>
  4733. 如果这类资源没有相应的节点类型,该方法应该是空的。
  4734. @param callback callback
  4735. */
  4736. createNode(callback: (error: string, node: any) => void): void;
  4737. }
  4738. /** !#en Class for audio data handling.
  4739. !#zh 音频资源类。 */
  4740. export class AudioClip extends Asset implements EventTarget {
  4741. /**
  4742. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  4743. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  4744. @param type The type of event.
  4745. */
  4746. hasEventListener(type: string): boolean;
  4747. /**
  4748. !#en
  4749. Register an callback of a specific event type on the EventTarget.
  4750. This type of event should be triggered via `emit`.
  4751. !#zh
  4752. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  4753. @param type A string representing the event type to listen for.
  4754. @param callback The callback that will be invoked when the event is dispatched.
  4755. The callback is ignored if it is a duplicate (the callbacks are unique).
  4756. @param target The target (this object) to invoke the callback, can be null
  4757. @example
  4758. ```js
  4759. eventTarget.on('fire', function () {
  4760. cc.log("fire in the hole");
  4761. }, node);
  4762. ```
  4763. */
  4764. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  4765. /**
  4766. !#en
  4767. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  4768. if only type is passed as parameter, all listeners registered with that type will be removed.
  4769. !#zh
  4770. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  4771. @param type A string representing the event type being removed.
  4772. @param callback The callback to remove.
  4773. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  4774. @example
  4775. ```js
  4776. // register fire eventListener
  4777. var callback = eventTarget.on('fire', function () {
  4778. cc.log("fire in the hole");
  4779. }, target);
  4780. // remove fire event listener
  4781. eventTarget.off('fire', callback, target);
  4782. // remove all fire event listeners
  4783. eventTarget.off('fire');
  4784. ```
  4785. */
  4786. off(type: string, callback?: Function, target?: any): void;
  4787. /**
  4788. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  4789. This is not for removing all listeners in the current event target,
  4790. and this is not for removing all listeners the target parameter have registered.
  4791. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  4792. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  4793. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  4794. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  4795. @param target The target to be searched for all related listeners
  4796. */
  4797. targetOff(target: any): void;
  4798. /**
  4799. !#en
  4800. Register an callback of a specific event type on the EventTarget,
  4801. the callback will remove itself after the first time it is triggered.
  4802. !#zh
  4803. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  4804. @param type A string representing the event type to listen for.
  4805. @param callback The callback that will be invoked when the event is dispatched.
  4806. The callback is ignored if it is a duplicate (the callbacks are unique).
  4807. @param target The target (this object) to invoke the callback, can be null
  4808. @example
  4809. ```js
  4810. eventTarget.once('fire', function () {
  4811. cc.log("this is the callback and will be invoked only once");
  4812. }, node);
  4813. ```
  4814. */
  4815. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  4816. /**
  4817. !#en
  4818. Trigger an event directly with the event name and necessary arguments.
  4819. !#zh
  4820. 通过事件名发送自定义事件
  4821. @param type event type
  4822. @param arg1 First argument
  4823. @param arg2 Second argument
  4824. @param arg3 Third argument
  4825. @param arg4 Fourth argument
  4826. @param arg5 Fifth argument
  4827. @example
  4828. ```js
  4829. eventTarget.emit('fire', event);
  4830. eventTarget.emit('fire', message, emitter);
  4831. ```
  4832. */
  4833. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  4834. /**
  4835. !#en
  4836. Send an event with the event object.
  4837. !#zh
  4838. 通过事件对象派发事件
  4839. @param event event
  4840. */
  4841. dispatchEvent(event: Event): void;
  4842. }
  4843. /** !#en Class for BitmapFont handling.
  4844. !#zh 位图字体资源类。 */
  4845. export class BitmapFont extends Font {
  4846. }
  4847. /** undefined */
  4848. export class BufferAsset extends Asset {
  4849. }
  4850. /** !#en Class for Font handling.
  4851. !#zh 字体资源类。 */
  4852. export class Font extends Asset {
  4853. }
  4854. /** !#en
  4855. Class for JSON file. When the JSON file is loaded, this object is returned.
  4856. The parsed JSON object can be accessed through the `json` attribute in it.<br>
  4857. If you want to get the original JSON text, you should modify the extname to `.txt`
  4858. so that it is loaded as a `TextAsset` instead of a `JsonAsset`.
  4859. !#zh
  4860. JSON 资源类。JSON 文件加载后,将会返回该对象。可以通过其中的 `json` 属性访问解析后的 JSON 对象。<br>
  4861. 如果你想要获得 JSON 的原始文本,那么应该修改源文件的后缀为 `.txt`,这样就会加载为一个 `TextAsset` 而不是 `JsonAsset`。 */
  4862. export class JsonAsset extends Asset {
  4863. /** The loaded JSON object. */
  4864. json: any;
  4865. }
  4866. /** !#en Class for LabelAtlas handling.
  4867. !#zh 艺术数字字体资源类。 */
  4868. export class LabelAtlas extends BitmapFont {
  4869. }
  4870. /** !#en Class for prefab handling.
  4871. !#zh 预制资源类。 */
  4872. export class Prefab extends Asset {
  4873. /** the main cc.Node in the prefab */
  4874. data: Node;
  4875. /** !#zh
  4876. 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。
  4877. !#en
  4878. Indicates the optimization policy for instantiating this prefab.
  4879. Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab. */
  4880. optimizationPolicy: Prefab.OptimizationPolicy;
  4881. /** !#en Indicates the raw assets of this prefab can be load after prefab loaded.
  4882. !#zh 指示该 Prefab 依赖的资源可否在 Prefab 加载后再延迟加载。 */
  4883. asyncLoadAssets: boolean;
  4884. readonly: boolean;
  4885. /**
  4886. Dynamically translation prefab data into minimized code.<br/>
  4887. This method will be called automatically before the first time the prefab being instantiated,
  4888. but you can re-call to refresh the create function once you modified the original prefab data in script.
  4889. */
  4890. compileCreateFunction(): void;
  4891. }
  4892. /** !#en
  4893. The base class for registering asset types.
  4894. !#zh
  4895. 注册用的资源基类。 */
  4896. export class RawAsset extends Object {
  4897. }
  4898. /** Render textures are textures that can be rendered to. */
  4899. export class RenderTexture extends Texture2D {
  4900. /**
  4901. !#en
  4902. Init the render texture with size.
  4903. !#zh
  4904. 初始化 render texture
  4905. @param width width
  4906. @param height height
  4907. @param depthStencilFormat depthStencilFormat
  4908. */
  4909. initWithSize(width?: number, height?: number, depthStencilFormat?: number): void;
  4910. /**
  4911. !#en
  4912. Get pixels from render texture, the pixels data stores in a RGBA Uint8Array.
  4913. It will return a new (width * height * 4) length Uint8Array by default。
  4914. You can specify a data to store the pixels to reuse the data,
  4915. you and can specify other params to specify the texture region to read.
  4916. !#zh
  4917. 从 render texture 读取像素数据,数据类型为 RGBA 格式的 Uint8Array 数组。
  4918. 默认每次调用此函数会生成一个大小为 (长 x 高 x 4) 的 Uint8Array。
  4919. 你可以通过传入 data 来接收像素数据,也可以通过传参来指定需要读取的区域的像素。
  4920. @param data data
  4921. @param x x
  4922. @param y y
  4923. @param w w
  4924. @param h h
  4925. */
  4926. readPixels(data?: Uint8Array, x?: number, y?: number, w?: number, h?: number): Uint8Array;
  4927. }
  4928. /** !#en Class for scene handling.
  4929. !#zh 场景资源类。 */
  4930. export class SceneAsset extends Asset {
  4931. scene: Scene;
  4932. /** !#en Indicates the raw assets of this scene can be load after scene launched.
  4933. !#zh 指示该场景依赖的资源可否在场景切换后再延迟加载。 */
  4934. asyncLoadAssets: boolean;
  4935. }
  4936. /** !#en Class for script handling.
  4937. !#zh Script 资源类。 */
  4938. export class _Script extends Asset {
  4939. }
  4940. /** !#en Class for JavaScript handling.
  4941. !#zh JavaScript 资源类。 */
  4942. export class _JavaScript extends Asset {
  4943. }
  4944. /** !#en Class for coffeescript handling.
  4945. !#zh CoffeeScript 资源类。 */
  4946. export class CoffeeScript extends Asset {
  4947. }
  4948. /** !#en Class for TypeScript handling.
  4949. !#zh TypeScript 资源类。 */
  4950. export class TypeScript extends Asset {
  4951. }
  4952. /** !#en Class for sprite atlas handling.
  4953. !#zh 精灵图集资源类。 */
  4954. export class SpriteAtlas extends Asset {
  4955. /**
  4956. Returns the texture of the sprite atlas
  4957. */
  4958. getTexture(): Texture2D;
  4959. /**
  4960. Returns the sprite frame correspond to the given key in sprite atlas.
  4961. @param key key
  4962. */
  4963. getSpriteFrame(key: string): SpriteFrame;
  4964. /**
  4965. Returns the sprite frames in sprite atlas.
  4966. */
  4967. getSpriteFrames(): [SpriteFrame];
  4968. }
  4969. /** !#en
  4970. A cc.SpriteFrame has:<br/>
  4971. - texture: A cc.Texture2D that will be used by render components<br/>
  4972. - rectangle: A rectangle of the texture
  4973. !#zh
  4974. 一个 SpriteFrame 包含:<br/>
  4975. - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
  4976. - 矩形:在纹理中的矩形区域。 */
  4977. export class SpriteFrame extends Asset implements EventTarget {
  4978. /** !#en Top border of the sprite
  4979. !#zh sprite 的顶部边框 */
  4980. insetTop: number;
  4981. /** !#en Bottom border of the sprite
  4982. !#zh sprite 的底部边框 */
  4983. insetBottom: number;
  4984. /** !#en Left border of the sprite
  4985. !#zh sprite 的左边边框 */
  4986. insetLeft: number;
  4987. /** !#en Right border of the sprite
  4988. !#zh sprite 的左边边框 */
  4989. insetRight: number;
  4990. /**
  4991. !#en
  4992. Constructor of SpriteFrame class.
  4993. !#zh
  4994. SpriteFrame 类的构造函数。
  4995. @param filename filename
  4996. @param rect rect
  4997. @param rotated Whether the frame is rotated in the texture
  4998. @param offset The offset of the frame in the texture
  4999. @param originalSize The size of the frame in the texture
  5000. */
  5001. constructor(filename?: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size);
  5002. /**
  5003. !#en Returns whether the texture have been loaded
  5004. !#zh 返回是否已加载纹理
  5005. */
  5006. textureLoaded(): boolean;
  5007. /**
  5008. !#en Returns whether the sprite frame is rotated in the texture.
  5009. !#zh 获取 SpriteFrame 是否旋转
  5010. */
  5011. isRotated(): boolean;
  5012. /**
  5013. !#en Set whether the sprite frame is rotated in the texture.
  5014. !#zh 设置 SpriteFrame 是否旋转
  5015. @param bRotated bRotated
  5016. */
  5017. setRotated(bRotated: boolean): void;
  5018. /**
  5019. !#en Returns the rect of the sprite frame in the texture.
  5020. !#zh 获取 SpriteFrame 的纹理矩形区域
  5021. */
  5022. getRect(): Rect;
  5023. /**
  5024. !#en Sets the rect of the sprite frame in the texture.
  5025. !#zh 设置 SpriteFrame 的纹理矩形区域
  5026. @param rect rect
  5027. */
  5028. setRect(rect: Rect): void;
  5029. /**
  5030. !#en Returns the original size of the trimmed image.
  5031. !#zh 获取修剪前的原始大小
  5032. */
  5033. getOriginalSize(): Size;
  5034. /**
  5035. !#en Sets the original size of the trimmed image.
  5036. !#zh 设置修剪前的原始大小
  5037. @param size size
  5038. */
  5039. setOriginalSize(size: Size): void;
  5040. /**
  5041. !#en Returns the texture of the frame.
  5042. !#zh 获取使用的纹理实例
  5043. */
  5044. getTexture(): Texture2D;
  5045. /**
  5046. !#en Returns the offset of the frame in the texture.
  5047. !#zh 获取偏移量
  5048. */
  5049. getOffset(): Vec2;
  5050. /**
  5051. !#en Sets the offset of the frame in the texture.
  5052. !#zh 设置偏移量
  5053. @param offsets offsets
  5054. */
  5055. setOffset(offsets: Vec2): void;
  5056. /**
  5057. !#en Clone the sprite frame.
  5058. !#zh 克隆 SpriteFrame
  5059. */
  5060. clone(): SpriteFrame;
  5061. /**
  5062. !#en Set SpriteFrame with Texture, rect, rotated, offset and originalSize.<br/>
  5063. !#zh 通过 Texture,rect,rotated,offset 和 originalSize 设置 SpriteFrame。
  5064. @param textureOrTextureFile textureOrTextureFile
  5065. @param rect rect
  5066. @param rotated rotated
  5067. @param offset offset
  5068. @param originalSize originalSize
  5069. */
  5070. setTexture(textureOrTextureFile: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size): boolean;
  5071. /**
  5072. !#en If a loading scene (or prefab) is marked as `asyncLoadAssets`, all the textures of the SpriteFrame which
  5073. associated by user's custom Components in the scene, will not preload automatically.
  5074. These textures will be load when Sprite component is going to render the SpriteFrames.
  5075. You can call this method if you want to load the texture early.
  5076. !#zh 当加载中的场景或 Prefab 被标记为 `asyncLoadAssets` 时,用户在场景中由自定义组件关联到的所有 SpriteFrame 的贴图都不会被提前加载。
  5077. 只有当 Sprite 组件要渲染这些 SpriteFrame 时,才会检查贴图是否加载。如果你希望加载过程提前,你可以手工调用这个方法。
  5078. @example
  5079. ```js
  5080. if (spriteFrame.textureLoaded()) {
  5081. this._onSpriteFrameLoaded();
  5082. }
  5083. else {
  5084. spriteFrame.once('load', this._onSpriteFrameLoaded, this);
  5085. spriteFrame.ensureLoadTexture();
  5086. }
  5087. ```
  5088. */
  5089. ensureLoadTexture(): void;
  5090. /**
  5091. !#en
  5092. 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.
  5093. !#zh
  5094. 当你暂时不再使用这个 SpriteFrame 时,可以调用这个方法来保证引用的贴图对象能被 GC。然后当你要渲染 SpriteFrame 时,你需要手动调用 `ensureLoadTexture` 来重新加载贴图。
  5095. @example
  5096. ```js
  5097. spriteFrame.clearTexture();
  5098. // when you need the SpriteFrame again...
  5099. spriteFrame.once('load', onSpriteFrameLoaded);
  5100. spriteFrame.ensureLoadTexture();
  5101. ```
  5102. */
  5103. clearTexture(): void;
  5104. /**
  5105. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5106. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5107. @param type The type of event.
  5108. */
  5109. hasEventListener(type: string): boolean;
  5110. /**
  5111. !#en
  5112. Register an callback of a specific event type on the EventTarget.
  5113. This type of event should be triggered via `emit`.
  5114. !#zh
  5115. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5116. @param type A string representing the event type to listen for.
  5117. @param callback The callback that will be invoked when the event is dispatched.
  5118. The callback is ignored if it is a duplicate (the callbacks are unique).
  5119. @param target The target (this object) to invoke the callback, can be null
  5120. @example
  5121. ```js
  5122. eventTarget.on('fire', function () {
  5123. cc.log("fire in the hole");
  5124. }, node);
  5125. ```
  5126. */
  5127. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5128. /**
  5129. !#en
  5130. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5131. if only type is passed as parameter, all listeners registered with that type will be removed.
  5132. !#zh
  5133. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5134. @param type A string representing the event type being removed.
  5135. @param callback The callback to remove.
  5136. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5137. @example
  5138. ```js
  5139. // register fire eventListener
  5140. var callback = eventTarget.on('fire', function () {
  5141. cc.log("fire in the hole");
  5142. }, target);
  5143. // remove fire event listener
  5144. eventTarget.off('fire', callback, target);
  5145. // remove all fire event listeners
  5146. eventTarget.off('fire');
  5147. ```
  5148. */
  5149. off(type: string, callback?: Function, target?: any): void;
  5150. /**
  5151. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5152. This is not for removing all listeners in the current event target,
  5153. and this is not for removing all listeners the target parameter have registered.
  5154. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5155. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5156. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5157. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5158. @param target The target to be searched for all related listeners
  5159. */
  5160. targetOff(target: any): void;
  5161. /**
  5162. !#en
  5163. Register an callback of a specific event type on the EventTarget,
  5164. the callback will remove itself after the first time it is triggered.
  5165. !#zh
  5166. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5167. @param type A string representing the event type to listen for.
  5168. @param callback The callback that will be invoked when the event is dispatched.
  5169. The callback is ignored if it is a duplicate (the callbacks are unique).
  5170. @param target The target (this object) to invoke the callback, can be null
  5171. @example
  5172. ```js
  5173. eventTarget.once('fire', function () {
  5174. cc.log("this is the callback and will be invoked only once");
  5175. }, node);
  5176. ```
  5177. */
  5178. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5179. /**
  5180. !#en
  5181. Trigger an event directly with the event name and necessary arguments.
  5182. !#zh
  5183. 通过事件名发送自定义事件
  5184. @param type event type
  5185. @param arg1 First argument
  5186. @param arg2 Second argument
  5187. @param arg3 Third argument
  5188. @param arg4 Fourth argument
  5189. @param arg5 Fifth argument
  5190. @example
  5191. ```js
  5192. eventTarget.emit('fire', event);
  5193. eventTarget.emit('fire', message, emitter);
  5194. ```
  5195. */
  5196. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5197. /**
  5198. !#en
  5199. Send an event with the event object.
  5200. !#zh
  5201. 通过事件对象派发事件
  5202. @param event event
  5203. */
  5204. dispatchEvent(event: Event): void;
  5205. }
  5206. /** !#en Class for TTFFont handling.
  5207. !#zh TTF 字体资源类。 */
  5208. export class TTFFont extends Font {
  5209. }
  5210. /** !#en Class for text file.
  5211. !#zh 文本资源类。 */
  5212. export class TextAsset extends Asset {
  5213. /** The text contents of the resource. */
  5214. text: string;
  5215. }
  5216. /** This class allows to easily create OpenGL or Canvas 2D textures from images or raw data. */
  5217. export class Texture2D extends Asset implements EventTarget {
  5218. /** !#en
  5219. The url of the texture, this could be empty if the texture wasn't created via a file.
  5220. !#zh
  5221. 贴图文件的 url,当贴图不是由文件创建时值可能为空 */
  5222. url: string;
  5223. /** !#en
  5224. Whether the texture is loaded or not
  5225. !#zh
  5226. 贴图是否已经成功加载 */
  5227. loaded: boolean;
  5228. /** !#en
  5229. Texture width in pixel
  5230. !#zh
  5231. 贴图像素宽度 */
  5232. width: number;
  5233. /** !#en
  5234. Texture height in pixel
  5235. !#zh
  5236. 贴图像素高度 */
  5237. height: number;
  5238. /**
  5239. !#en
  5240. Get renderer texture implementation object
  5241. extended from renderEngine.TextureAsset
  5242. !#zh 返回渲染器内部贴图对象
  5243. */
  5244. getImpl(): void;
  5245. /**
  5246. Update texture options, not available in Canvas render mode.
  5247. image, format, premultiplyAlpha can not be updated in native.
  5248. @param options options
  5249. */
  5250. update(options: {image: DOMImageElement; mipmap: boolean; format: PixelFormat; minFilter: Filter; magFilter: Filter; wrapS: WrapMode; wrapT: WrapMode; premultiplyAlpha: boolean; }): void;
  5251. /**
  5252. !#en
  5253. Init with HTML element.
  5254. !#zh 用 HTML Image 或 Canvas 对象初始化贴图。
  5255. @param element element
  5256. @example
  5257. ```js
  5258. var img = new Image();
  5259. img.src = dataURL;
  5260. texture.initWithElement(img);
  5261. ```
  5262. */
  5263. initWithElement(element: HTMLImageElement|HTMLCanvasElement): void;
  5264. /**
  5265. !#en
  5266. Intializes with a texture2d with data in Uint8Array.
  5267. !#zh 使用一个存储在 Unit8Array 中的图像数据(raw data)初始化数据。
  5268. @param data data
  5269. @param pixelFormat pixelFormat
  5270. @param pixelsWidth pixelsWidth
  5271. @param pixelsHeight pixelsHeight
  5272. */
  5273. initWithData(data: TypedArray, pixelFormat: number, pixelsWidth: number, pixelsHeight: number): boolean;
  5274. /**
  5275. !#en
  5276. HTMLElement Object getter, available only on web.
  5277. !#zh 获取当前贴图对应的 HTML Image 或 Canvas 对象,只在 Web 平台下有效。
  5278. */
  5279. getHtmlElementObj(): HTMLImageElement;
  5280. /**
  5281. !#en
  5282. Destory this texture and immediately release its video memory. (Inherit from cc.Object.destroy)<br>
  5283. After destroy, this object is not usable any more.
  5284. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  5285. !#zh
  5286. 销毁该贴图,并立即释放它对应的显存。(继承自 cc.Object.destroy)<br/>
  5287. 销毁后,该对象不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  5288. */
  5289. destroy(): boolean;
  5290. /**
  5291. !#en
  5292. Pixel format of the texture.
  5293. !#zh 获取纹理的像素格式。
  5294. */
  5295. getPixelFormat(): number;
  5296. /**
  5297. !#en
  5298. Whether or not the texture has their Alpha premultiplied.
  5299. !#zh 检查纹理在上传 GPU 时预乘选项是否开启。
  5300. */
  5301. hasPremultipliedAlpha(): boolean;
  5302. /**
  5303. !#en
  5304. Whether or not use mipmap.
  5305. !#zh 检查问题在上传 GPU 时是否生成 mipmap。
  5306. */
  5307. hasMipmap(): boolean;
  5308. /**
  5309. !#en
  5310. Handler of texture loaded event.
  5311. Since v2.0, you don't need to invoke this function, it will be invoked automatically after texture loaded.
  5312. !#zh 贴图加载事件处理器。v2.0 之后你将不在需要手动执行这个函数,它会在贴图加载成功之后自动执行。
  5313. @param premultiplied premultiplied
  5314. */
  5315. handleLoadedTexture(premultiplied?: boolean): void;
  5316. /**
  5317. !#en
  5318. Description of cc.Texture2D.
  5319. !#zh cc.Texture2D 描述。
  5320. */
  5321. description(): string;
  5322. /**
  5323. !#en
  5324. Release texture, please use destroy instead.
  5325. !#zh 释放纹理,请使用 destroy 替代。
  5326. */
  5327. releaseTexture(): void;
  5328. /**
  5329. !#en Sets the wrap s and wrap t options. <br/>
  5330. 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}.
  5331. !#zh 设置纹理包装模式。
  5332. 若纹理贴图尺寸是 NPOT(non power of 2),则只能使用 Texture2D.WrapMode.CLAMP_TO_EDGE。
  5333. @param wrapS wrapS
  5334. @param wrapT wrapT
  5335. */
  5336. setTexParameters(wrapS: Texture2D.WrapMode, wrapT: Texture2D.WrapMode): void;
  5337. /**
  5338. !#en Sets the minFilter and magFilter options
  5339. !#zh 设置纹理贴图缩小和放大过滤器算法选项。
  5340. @param minFilter minFilter
  5341. @param magFilter magFilter
  5342. */
  5343. setFilters(minFilter: Texture2D.Filter, magFilter: Texture2D.Filter): void;
  5344. /**
  5345. !#en
  5346. Sets the flipY options
  5347. !#zh 设置贴图的纵向翻转选项。
  5348. @param flipY flipY
  5349. */
  5350. setFlipY(flipY: boolean): void;
  5351. /**
  5352. !#en
  5353. Sets the premultiply alpha options
  5354. !#zh 设置贴图的预乘选项。
  5355. @param premultiply premultiply
  5356. */
  5357. setPremultiplyAlpha(premultiply: boolean): void;
  5358. /**
  5359. !#en
  5360. Sets whether generate mipmaps for the texture
  5361. !#zh 是否为纹理设置生成 mipmaps。
  5362. @param mipmap mipmap
  5363. */
  5364. setMipmap(mipmap: boolean): void;
  5365. /**
  5366. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5367. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5368. @param type The type of event.
  5369. */
  5370. hasEventListener(type: string): boolean;
  5371. /**
  5372. !#en
  5373. Register an callback of a specific event type on the EventTarget.
  5374. This type of event should be triggered via `emit`.
  5375. !#zh
  5376. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5377. @param type A string representing the event type to listen for.
  5378. @param callback The callback that will be invoked when the event is dispatched.
  5379. The callback is ignored if it is a duplicate (the callbacks are unique).
  5380. @param target The target (this object) to invoke the callback, can be null
  5381. @example
  5382. ```js
  5383. eventTarget.on('fire', function () {
  5384. cc.log("fire in the hole");
  5385. }, node);
  5386. ```
  5387. */
  5388. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5389. /**
  5390. !#en
  5391. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5392. if only type is passed as parameter, all listeners registered with that type will be removed.
  5393. !#zh
  5394. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5395. @param type A string representing the event type being removed.
  5396. @param callback The callback to remove.
  5397. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5398. @example
  5399. ```js
  5400. // register fire eventListener
  5401. var callback = eventTarget.on('fire', function () {
  5402. cc.log("fire in the hole");
  5403. }, target);
  5404. // remove fire event listener
  5405. eventTarget.off('fire', callback, target);
  5406. // remove all fire event listeners
  5407. eventTarget.off('fire');
  5408. ```
  5409. */
  5410. off(type: string, callback?: Function, target?: any): void;
  5411. /**
  5412. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5413. This is not for removing all listeners in the current event target,
  5414. and this is not for removing all listeners the target parameter have registered.
  5415. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5416. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5417. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5418. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5419. @param target The target to be searched for all related listeners
  5420. */
  5421. targetOff(target: any): void;
  5422. /**
  5423. !#en
  5424. Register an callback of a specific event type on the EventTarget,
  5425. the callback will remove itself after the first time it is triggered.
  5426. !#zh
  5427. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5428. @param type A string representing the event type to listen for.
  5429. @param callback The callback that will be invoked when the event is dispatched.
  5430. The callback is ignored if it is a duplicate (the callbacks are unique).
  5431. @param target The target (this object) to invoke the callback, can be null
  5432. @example
  5433. ```js
  5434. eventTarget.once('fire', function () {
  5435. cc.log("this is the callback and will be invoked only once");
  5436. }, node);
  5437. ```
  5438. */
  5439. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5440. /**
  5441. !#en
  5442. Trigger an event directly with the event name and necessary arguments.
  5443. !#zh
  5444. 通过事件名发送自定义事件
  5445. @param type event type
  5446. @param arg1 First argument
  5447. @param arg2 Second argument
  5448. @param arg3 Third argument
  5449. @param arg4 Fourth argument
  5450. @param arg5 Fifth argument
  5451. @example
  5452. ```js
  5453. eventTarget.emit('fire', event);
  5454. eventTarget.emit('fire', message, emitter);
  5455. ```
  5456. */
  5457. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5458. /**
  5459. !#en
  5460. Send an event with the event object.
  5461. !#zh
  5462. 通过事件对象派发事件
  5463. @param event event
  5464. */
  5465. dispatchEvent(event: Event): void;
  5466. }
  5467. /** !#en Box Collider.
  5468. !#zh 包围盒碰撞组件 */
  5469. export class BoxCollider extends Collider implements Collider.Box {
  5470. /** !#en Position offset
  5471. !#zh 位置偏移量 */
  5472. offset: Vec2;
  5473. /** !#en Box size
  5474. !#zh 包围盒大小 */
  5475. size: Size;
  5476. }
  5477. /** !#en Circle Collider.
  5478. !#zh 圆形碰撞组件 */
  5479. export class CircleCollider extends Collider implements Collider.Circle {
  5480. /** !#en Position offset
  5481. !#zh 位置偏移量 */
  5482. offset: Vec2;
  5483. /** !#en Circle radius
  5484. !#zh 圆形半径 */
  5485. radius: number;
  5486. }
  5487. /** !#en Collider component base class.
  5488. !#zh 碰撞组件基类 */
  5489. export class Collider extends Component {
  5490. /** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  5491. !#zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */
  5492. tag: number;
  5493. }
  5494. /** !#en
  5495. A simple collision manager class.
  5496. It will calculate whether the collider collides other colliders, if collides then call the callbacks.
  5497. !#zh
  5498. 一个简单的碰撞组件管理类,用于处理节点之间的碰撞组件是否产生了碰撞,并调用相应回调函数。 */
  5499. export class CollisionManager implements EventTarget {
  5500. /** !#en
  5501. !#zh
  5502. 是否开启碰撞管理,默认为不开启 */
  5503. enabled: boolean;
  5504. /** !#en
  5505. !#zh
  5506. 是否绘制碰撞组件的包围盒,默认为不绘制 */
  5507. enabledDrawBoundingBox: boolean;
  5508. /** !#en
  5509. !#zh
  5510. 是否绘制碰撞组件的形状,默认为不绘制 */
  5511. enabledDebugDraw: boolean;
  5512. /**
  5513. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5514. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5515. @param type The type of event.
  5516. */
  5517. hasEventListener(type: string): boolean;
  5518. /**
  5519. !#en
  5520. Register an callback of a specific event type on the EventTarget.
  5521. This type of event should be triggered via `emit`.
  5522. !#zh
  5523. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5524. @param type A string representing the event type to listen for.
  5525. @param callback The callback that will be invoked when the event is dispatched.
  5526. The callback is ignored if it is a duplicate (the callbacks are unique).
  5527. @param target The target (this object) to invoke the callback, can be null
  5528. @example
  5529. ```js
  5530. eventTarget.on('fire', function () {
  5531. cc.log("fire in the hole");
  5532. }, node);
  5533. ```
  5534. */
  5535. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5536. /**
  5537. !#en
  5538. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5539. if only type is passed as parameter, all listeners registered with that type will be removed.
  5540. !#zh
  5541. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5542. @param type A string representing the event type being removed.
  5543. @param callback The callback to remove.
  5544. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5545. @example
  5546. ```js
  5547. // register fire eventListener
  5548. var callback = eventTarget.on('fire', function () {
  5549. cc.log("fire in the hole");
  5550. }, target);
  5551. // remove fire event listener
  5552. eventTarget.off('fire', callback, target);
  5553. // remove all fire event listeners
  5554. eventTarget.off('fire');
  5555. ```
  5556. */
  5557. off(type: string, callback?: Function, target?: any): void;
  5558. /**
  5559. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5560. This is not for removing all listeners in the current event target,
  5561. and this is not for removing all listeners the target parameter have registered.
  5562. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5563. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5564. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5565. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5566. @param target The target to be searched for all related listeners
  5567. */
  5568. targetOff(target: any): void;
  5569. /**
  5570. !#en
  5571. Register an callback of a specific event type on the EventTarget,
  5572. the callback will remove itself after the first time it is triggered.
  5573. !#zh
  5574. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5575. @param type A string representing the event type to listen for.
  5576. @param callback The callback that will be invoked when the event is dispatched.
  5577. The callback is ignored if it is a duplicate (the callbacks are unique).
  5578. @param target The target (this object) to invoke the callback, can be null
  5579. @example
  5580. ```js
  5581. eventTarget.once('fire', function () {
  5582. cc.log("this is the callback and will be invoked only once");
  5583. }, node);
  5584. ```
  5585. */
  5586. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5587. /**
  5588. !#en
  5589. Trigger an event directly with the event name and necessary arguments.
  5590. !#zh
  5591. 通过事件名发送自定义事件
  5592. @param type event type
  5593. @param arg1 First argument
  5594. @param arg2 Second argument
  5595. @param arg3 Third argument
  5596. @param arg4 Fourth argument
  5597. @param arg5 Fifth argument
  5598. @example
  5599. ```js
  5600. eventTarget.emit('fire', event);
  5601. eventTarget.emit('fire', message, emitter);
  5602. ```
  5603. */
  5604. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5605. /**
  5606. !#en
  5607. Send an event with the event object.
  5608. !#zh
  5609. 通过事件对象派发事件
  5610. @param event event
  5611. */
  5612. dispatchEvent(event: Event): void;
  5613. }
  5614. /** !#en Intersection helper class
  5615. !#zh 辅助类,用于测试形状与形状是否相交 */
  5616. export class Intersection {
  5617. /**
  5618. !#en Test line and line
  5619. !#zh 测试线段与线段是否相交
  5620. @param a1 The start point of the first line
  5621. @param a2 The end point of the first line
  5622. @param b1 The start point of the second line
  5623. @param b2 The end point of the second line
  5624. */
  5625. static lineLine(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): boolean;
  5626. /**
  5627. !#en Test line and rect
  5628. !#zh 测试线段与矩形是否相交
  5629. @param a1 The start point of the line
  5630. @param a2 The end point of the line
  5631. @param b The rect
  5632. */
  5633. static lineRect(a1: Vec2, a2: Vec2, b: Rect): boolean;
  5634. /**
  5635. !#en Test line and polygon
  5636. !#zh 测试线段与多边形是否相交
  5637. @param a1 The start point of the line
  5638. @param a2 The end point of the line
  5639. @param b The polygon, a set of points
  5640. */
  5641. static linePolygon(a1: Vec2, a2: Vec2, b: Vec2[]): boolean;
  5642. /**
  5643. !#en Test rect and rect
  5644. !#zh 测试矩形与矩形是否相交
  5645. @param a The first rect
  5646. @param b The second rect
  5647. */
  5648. static rectRect(a: Rect, b: Rect): boolean;
  5649. /**
  5650. !#en Test rect and polygon
  5651. !#zh 测试矩形与多边形是否相交
  5652. @param a The rect
  5653. @param b The polygon, a set of points
  5654. */
  5655. static rectPolygon(a: Rect, b: Vec2[]): boolean;
  5656. /**
  5657. !#en Test polygon and polygon
  5658. !#zh 测试多边形与多边形是否相交
  5659. @param a The first polygon, a set of points
  5660. @param b The second polygon, a set of points
  5661. */
  5662. static polygonPolygon(a: Vec2[], b: Vec2[]): boolean;
  5663. /**
  5664. !#en Test circle and circle
  5665. !#zh 测试圆形与圆形是否相交
  5666. @param a Object contains position and radius
  5667. @param b Object contains position and radius
  5668. */
  5669. static circleCircle(a: {position: Vec2, radius: number}, b: {position: Vec2, radius: number}): boolean;
  5670. /**
  5671. !#en Test polygon and circle
  5672. !#zh 测试矩形与圆形是否相交
  5673. @param polygon The Polygon, a set of points
  5674. @param circle Object contains position and radius
  5675. */
  5676. static polygonCircle(polygon: Vec2[], circle: {position: Vec2, radius: number}): boolean;
  5677. /**
  5678. !#en Test whether the point is in the polygon
  5679. !#zh 测试一个点是否在一个多边形中
  5680. @param point The point
  5681. @param polygon The polygon, a set of points
  5682. */
  5683. static pointInPolygon(point: Vec2, polygon: Vec2[]): boolean;
  5684. /**
  5685. !#en Calculate the distance of point to line.
  5686. !#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  5687. @param point The point
  5688. @param start The start point of line
  5689. @param end The end point of line
  5690. @param isSegment whether this line is a segment
  5691. */
  5692. static pointLineDistance(point: Vec2, start: Vec2, end: Vec2, isSegment: boolean): boolean;
  5693. }
  5694. /** !#en Polygon Collider.
  5695. !#zh 多边形碰撞组件 */
  5696. export class PolygonCollider extends Collider implements Collider.Polygon {
  5697. /** !#en Position offset
  5698. !#zh 位置偏移量 */
  5699. offset: Vec2;
  5700. /** !#en Polygon points
  5701. !#zh 多边形顶点数组 */
  5702. points: Vec2[];
  5703. }
  5704. /** !#en
  5705. EventTarget is an object to which an event is dispatched when something has occurred.
  5706. Entity are the most common event targets, but other objects can be event targets too.
  5707. Event targets are an important part of the Fireball event model.
  5708. The event target serves as the focal point for how events flow through the scene graph.
  5709. When an event such as a mouse click or a keypress occurs, Fireball dispatches an event object
  5710. into the event flow from the root of the hierarchy. The event object then makes its way through
  5711. the scene graph until it reaches the event target, at which point it begins its return trip through
  5712. the scene graph. This round-trip journey to the event target is conceptually divided into three phases:
  5713. - The capture phase comprises the journey from the root to the last node before the event target's node
  5714. - The target phase comprises only the event target node
  5715. - The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree
  5716. See also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5717. Event targets can implement the following methods:
  5718. - _getCapturingTargets
  5719. - _getBubblingTargets
  5720. !#zh
  5721. 事件目标是事件触发时,分派的事件对象,Node 是最常见的事件目标,
  5722. 但是其他对象也可以是事件目标。<br/> */
  5723. export class EventTarget {
  5724. /**
  5725. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5726. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5727. @param type The type of event.
  5728. */
  5729. hasEventListener(type: string): boolean;
  5730. /**
  5731. !#en
  5732. Register an callback of a specific event type on the EventTarget.
  5733. This type of event should be triggered via `emit`.
  5734. !#zh
  5735. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5736. @param type A string representing the event type to listen for.
  5737. @param callback The callback that will be invoked when the event is dispatched.
  5738. The callback is ignored if it is a duplicate (the callbacks are unique).
  5739. @param target The target (this object) to invoke the callback, can be null
  5740. @example
  5741. ```js
  5742. eventTarget.on('fire', function () {
  5743. cc.log("fire in the hole");
  5744. }, node);
  5745. ```
  5746. */
  5747. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5748. /**
  5749. !#en
  5750. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5751. if only type is passed as parameter, all listeners registered with that type will be removed.
  5752. !#zh
  5753. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5754. @param type A string representing the event type being removed.
  5755. @param callback The callback to remove.
  5756. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5757. @example
  5758. ```js
  5759. // register fire eventListener
  5760. var callback = eventTarget.on('fire', function () {
  5761. cc.log("fire in the hole");
  5762. }, target);
  5763. // remove fire event listener
  5764. eventTarget.off('fire', callback, target);
  5765. // remove all fire event listeners
  5766. eventTarget.off('fire');
  5767. ```
  5768. */
  5769. off(type: string, callback?: Function, target?: any): void;
  5770. /**
  5771. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5772. This is not for removing all listeners in the current event target,
  5773. and this is not for removing all listeners the target parameter have registered.
  5774. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5775. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5776. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5777. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5778. @param target The target to be searched for all related listeners
  5779. */
  5780. targetOff(target: any): void;
  5781. /**
  5782. !#en
  5783. Register an callback of a specific event type on the EventTarget,
  5784. the callback will remove itself after the first time it is triggered.
  5785. !#zh
  5786. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5787. @param type A string representing the event type to listen for.
  5788. @param callback The callback that will be invoked when the event is dispatched.
  5789. The callback is ignored if it is a duplicate (the callbacks are unique).
  5790. @param target The target (this object) to invoke the callback, can be null
  5791. @example
  5792. ```js
  5793. eventTarget.once('fire', function () {
  5794. cc.log("this is the callback and will be invoked only once");
  5795. }, node);
  5796. ```
  5797. */
  5798. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5799. /**
  5800. !#en
  5801. Trigger an event directly with the event name and necessary arguments.
  5802. !#zh
  5803. 通过事件名发送自定义事件
  5804. @param type event type
  5805. @param arg1 First argument
  5806. @param arg2 Second argument
  5807. @param arg3 Third argument
  5808. @param arg4 Fourth argument
  5809. @param arg5 Fifth argument
  5810. @example
  5811. ```js
  5812. eventTarget.emit('fire', event);
  5813. eventTarget.emit('fire', message, emitter);
  5814. ```
  5815. */
  5816. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  5817. /**
  5818. !#en
  5819. Send an event with the event object.
  5820. !#zh
  5821. 通过事件对象派发事件
  5822. @param event event
  5823. */
  5824. dispatchEvent(event: Event): void;
  5825. }
  5826. /** !#en Base class of all kinds of events.
  5827. !#zh 包含事件相关信息的对象。 */
  5828. export class Event {
  5829. /**
  5830. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  5831. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  5832. */
  5833. constructor(type: string, bubbles: boolean);
  5834. /** !#en The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  5835. !#zh 事件类型。 */
  5836. type: string;
  5837. /** !#en Indicate whether the event bubbles up through the tree or not.
  5838. !#zh 表示该事件是否进行冒泡。 */
  5839. bubbles: boolean;
  5840. /** !#en A reference to the target to which the event was originally dispatched.
  5841. !#zh 最初事件触发的目标 */
  5842. target: any;
  5843. /** !#en A reference to the currently registered target for the event.
  5844. !#zh 当前目标 */
  5845. currentTarget: any;
  5846. /** !#en
  5847. Indicates which phase of the event flow is currently being evaluated.
  5848. Returns an integer value represented by 4 constants:
  5849. - Event.NONE = 0
  5850. - Event.CAPTURING_PHASE = 1
  5851. - Event.AT_TARGET = 2
  5852. - Event.BUBBLING_PHASE = 3
  5853. The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  5854. (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  5855. !#zh 事件阶段 */
  5856. eventPhase: number;
  5857. /**
  5858. !#en Reset the event for being stored in the object pool.
  5859. !#zh 重置对象池中存储的事件。
  5860. */
  5861. unuse(): string;
  5862. /**
  5863. !#en Reuse the event for being used again by the object pool.
  5864. !#zh 用于对象池再次使用的事件。
  5865. */
  5866. reuse(): string;
  5867. /**
  5868. !#en Stops propagation for current event.
  5869. !#zh 停止传递当前事件。
  5870. */
  5871. stopPropagation(): void;
  5872. /**
  5873. !#en Stops propagation for current event immediately,
  5874. the event won't even be dispatched to the listeners attached in the current target.
  5875. !#zh 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  5876. */
  5877. stopPropagationImmediate(): void;
  5878. /**
  5879. !#en Checks whether the event has been stopped.
  5880. !#zh 检查该事件是否已经停止传递.
  5881. */
  5882. isStopped(): boolean;
  5883. /**
  5884. !#en
  5885. <p>
  5886. Gets current target of the event <br/>
  5887. note: It only be available when the event listener is associated with node. <br/>
  5888. It returns 0 when the listener is associated with fixed priority.
  5889. </p>
  5890. !#zh 获取当前目标节点
  5891. */
  5892. getCurrentTarget(): Node;
  5893. /**
  5894. !#en Gets the event type.
  5895. !#zh 获取事件类型
  5896. */
  5897. getType(): string;
  5898. /** !#en Code for event without type.
  5899. !#zh 没有类型的事件 */
  5900. static NO_TYPE: string;
  5901. /** !#en The type code of Touch event.
  5902. !#zh 触摸事件类型 */
  5903. static TOUCH: string;
  5904. /** !#en The type code of Mouse event.
  5905. !#zh 鼠标事件类型 */
  5906. static MOUSE: string;
  5907. /** !#en The type code of Keyboard event.
  5908. !#zh 键盘事件类型 */
  5909. static KEYBOARD: string;
  5910. /** !#en The type code of Acceleration event.
  5911. !#zh 加速器事件类型 */
  5912. static ACCELERATION: string;
  5913. /** !#en Events not currently dispatched are in this phase
  5914. !#zh 尚未派发事件阶段 */
  5915. static NONE: number;
  5916. /** !#en
  5917. The capturing phase comprises the journey from the root to the last node before the event target's node
  5918. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5919. !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 */
  5920. static CAPTURING_PHASE: number;
  5921. /** !#en
  5922. The target phase comprises only the event target node
  5923. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5924. !#zh 目标阶段仅包括事件目标节点。 */
  5925. static AT_TARGET: number;
  5926. /** !#en
  5927. The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  5928. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  5929. !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 */
  5930. static BUBBLING_PHASE: number;
  5931. }
  5932. /** !#en
  5933. The System event, it currently supports keyboard events and accelerometer events.<br>
  5934. You can get the SystemEvent instance with cc.systemEvent.<br>
  5935. example:
  5936. ```
  5937. cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  5938. cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  5939. ```
  5940. !#zh
  5941. 系统事件,它目前支持按键事件和重力感应事件。<br>
  5942. 你可以通过 cc.systemEvent 获取到 SystemEvent 的实例。<br>
  5943. 参考示例:
  5944. ```
  5945. cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  5946. cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  5947. ``` */
  5948. export class SystemEvent extends EventTarget {
  5949. /**
  5950. !#en whether enable accelerometer event
  5951. !#zh 是否启用加速度计事件
  5952. @param isEnable isEnable
  5953. */
  5954. setAccelerometerEnabled(isEnable: boolean): void;
  5955. /**
  5956. !#en set accelerometer interval value
  5957. !#zh 设置加速度计间隔值
  5958. @param interval interval
  5959. */
  5960. setAccelerometerInterval(interval: number): void;
  5961. }
  5962. /** !#en The animation component is used to play back animations.
  5963. Animation provide several events to register:
  5964. - play : Emit when begin playing animation
  5965. - stop : Emit when stop playing animation
  5966. - pause : Emit when pause animation
  5967. - resume : Emit when resume animation
  5968. - lastframe : If animation repeat count is larger than 1, emit when animation play to the last frame
  5969. - finished : Emit when finish playing animation
  5970. !#zh Animation 组件用于播放动画。
  5971. Animation 提供了一系列可注册的事件:
  5972. - play : 开始播放时
  5973. - stop : 停止播放时
  5974. - pause : 暂停播放时
  5975. - resume : 恢复播放时
  5976. - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
  5977. - finished : 动画播放完成时 */
  5978. export class Animation extends Component implements EventTarget {
  5979. /** !#en Animation will play the default clip when start game.
  5980. !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */
  5981. defaultClip: AnimationClip;
  5982. /** !#en Current played clip.
  5983. !#zh 当前播放的动画剪辑。 */
  5984. currentClip: AnimationClip;
  5985. /** !#en Whether the animation should auto play the default clip when start game.
  5986. !#zh 是否在运行游戏后自动播放默认动画剪辑。 */
  5987. playOnLoad: boolean;
  5988. /**
  5989. !#en Get all the clips used in this animation.
  5990. !#zh 获取动画组件上的所有动画剪辑。
  5991. */
  5992. getClips(): AnimationClip[];
  5993. /**
  5994. !#en Plays an animation and stop other animations.
  5995. !#zh 播放指定的动画,并且停止当前正在播放动画。如果没有指定动画,则播放默认动画。
  5996. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  5997. @param startTime play an animation from startTime
  5998. @example
  5999. ```js
  6000. var animCtrl = this.node.getComponent(cc.Animation);
  6001. animCtrl.play("linear");
  6002. ```
  6003. */
  6004. play(name?: string, startTime?: number): AnimationState;
  6005. /**
  6006. !#en
  6007. Plays an additive animation, it will not stop other animations.
  6008. If there are other animations playing, then will play several animations at the same time.
  6009. !#zh 播放指定的动画(将不会停止当前播放的动画)。如果没有指定动画,则播放默认动画。
  6010. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  6011. @param startTime play an animation from startTime
  6012. @example
  6013. ```js
  6014. // linear_1 and linear_2 at the same time playing.
  6015. var animCtrl = this.node.getComponent(cc.Animation);
  6016. animCtrl.playAdditive("linear_1");
  6017. animCtrl.playAdditive("linear_2");
  6018. ```
  6019. */
  6020. playAdditive(name?: string, startTime?: number): AnimationState;
  6021. /**
  6022. !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>
  6023. Stopping an animation also Rewinds it to the Start.
  6024. !#zh 停止指定的动画。如果没有指定名字,则停止当前正在播放的动画。
  6025. @param name The animation to stop, if not supplied then stops all playing animations.
  6026. */
  6027. stop(name?: string): void;
  6028. /**
  6029. !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
  6030. !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
  6031. @param name The animation to pauses, if not supplied then pauses all playing animations.
  6032. */
  6033. pause(name?: string): void;
  6034. /**
  6035. !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
  6036. !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
  6037. @param name The animation to resumes, if not supplied then resumes all paused animations.
  6038. */
  6039. resume(name?: string): void;
  6040. /**
  6041. !#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.
  6042. !#zh 设置指定动画的播放时间。如果没有指定名字,则设置当前播放动画的播放时间。
  6043. @param time The time to go to
  6044. @param name Specified animation name, if not supplied then make all animations go to the time.
  6045. */
  6046. setCurrentTime(time?: number, name?: string): void;
  6047. /**
  6048. !#en Returns the animation state named name. If no animation with the specified name, the function will return null.
  6049. !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。
  6050. @param name name
  6051. */
  6052. getAnimationState(name: string): AnimationState;
  6053. /**
  6054. !#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.
  6055. !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
  6056. @param clip the clip to add
  6057. @param newName newName
  6058. */
  6059. addClip(clip: AnimationClip, newName?: string): AnimationState;
  6060. /**
  6061. !#en
  6062. Remove clip from the animation list. This will remove the clip and any animation states based on it.
  6063. If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
  6064. 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
  6065. !#zh
  6066. 从动画列表中移除指定的动画剪辑,<br/>
  6067. 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。
  6068. 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。
  6069. @param clip clip
  6070. @param force If force is true, then will always remove the clip and any animation states based on it.
  6071. */
  6072. removeClip(clip: AnimationClip, force?: boolean): void;
  6073. /**
  6074. !#en
  6075. Samples animations at the current state.<br/>
  6076. This is useful when you explicitly want to set up some animation state, and sample it once.
  6077. !#zh 对指定或当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
  6078. @param name name
  6079. */
  6080. sample(name: string): void;
  6081. /**
  6082. !#en
  6083. Register animation event callback.
  6084. The event arguments will provide the AnimationState which emit the event.
  6085. When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
  6086. !#zh
  6087. 注册动画事件回调。
  6088. 回调的事件里将会附上发送事件的 AnimationState。
  6089. 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  6090. @param type A string representing the event type to listen for.
  6091. @param callback The callback that will be invoked when the event is dispatched.
  6092. The callback is ignored if it is a duplicate (the callbacks are unique).
  6093. @param state state
  6094. @param target The target (this object) to invoke the callback, can be null
  6095. @param useCapture When set to true, the capture argument prevents callback
  6096. from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
  6097. When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
  6098. Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
  6099. @example
  6100. ```js
  6101. onPlay: function (type, state) {
  6102. // callback
  6103. }
  6104. // register event to all animation
  6105. animation.on('play', this.onPlay, this);
  6106. ```
  6107. */
  6108. on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void;
  6109. on<T>(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void;
  6110. /**
  6111. !#en
  6112. Unregister animation event callback.
  6113. !#zh
  6114. 取消注册动画事件回调。
  6115. @param type A string representing the event type being removed.
  6116. @param callback The callback to remove.
  6117. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6118. @param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.
  6119. If not specified, useCapture defaults to false. If a callback was registered twice,
  6120. one with capture and one without, each must be removed separately. Removal of a capturing callback
  6121. does not affect a non-capturing version of the same listener, and vice versa.
  6122. @example
  6123. ```js
  6124. // unregister event to all animation
  6125. animation.off('play', this.onPlay, this);
  6126. ```
  6127. */
  6128. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  6129. /**
  6130. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6131. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6132. @param type The type of event.
  6133. */
  6134. hasEventListener(type: string): boolean;
  6135. /**
  6136. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6137. This is not for removing all listeners in the current event target,
  6138. and this is not for removing all listeners the target parameter have registered.
  6139. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6140. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6141. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6142. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6143. @param target The target to be searched for all related listeners
  6144. */
  6145. targetOff(target: any): void;
  6146. /**
  6147. !#en
  6148. Register an callback of a specific event type on the EventTarget,
  6149. the callback will remove itself after the first time it is triggered.
  6150. !#zh
  6151. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6152. @param type A string representing the event type to listen for.
  6153. @param callback The callback that will be invoked when the event is dispatched.
  6154. The callback is ignored if it is a duplicate (the callbacks are unique).
  6155. @param target The target (this object) to invoke the callback, can be null
  6156. @example
  6157. ```js
  6158. eventTarget.once('fire', function () {
  6159. cc.log("this is the callback and will be invoked only once");
  6160. }, node);
  6161. ```
  6162. */
  6163. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6164. /**
  6165. !#en
  6166. Trigger an event directly with the event name and necessary arguments.
  6167. !#zh
  6168. 通过事件名发送自定义事件
  6169. @param type event type
  6170. @param arg1 First argument
  6171. @param arg2 Second argument
  6172. @param arg3 Third argument
  6173. @param arg4 Fourth argument
  6174. @param arg5 Fifth argument
  6175. @example
  6176. ```js
  6177. eventTarget.emit('fire', event);
  6178. eventTarget.emit('fire', message, emitter);
  6179. ```
  6180. */
  6181. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  6182. /**
  6183. !#en
  6184. Send an event with the event object.
  6185. !#zh
  6186. 通过事件对象派发事件
  6187. @param event event
  6188. */
  6189. dispatchEvent(event: Event): void;
  6190. }
  6191. /** !#en Audio Source.
  6192. !#zh 音频源组件,能对音频剪辑。 */
  6193. export class AudioSource extends Component {
  6194. /** !#en
  6195. Is the audio source playing (Read Only). <br/>
  6196. Note: isPlaying is not supported for Native platforms.
  6197. !#zh
  6198. 该音频剪辑是否正播放(只读)。<br/>
  6199. 注意:Native 平台暂时不支持 isPlaying。 */
  6200. isPlaying: boolean;
  6201. /** !#en The clip of the audio source to play.
  6202. !#zh 要播放的音频剪辑。 */
  6203. clip: AudioClip;
  6204. /** !#en The volume of the audio source.
  6205. !#zh 音频源的音量(0.0 ~ 1.0)。 */
  6206. volume: number;
  6207. /** !#en Is the audio source mute?
  6208. !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。 */
  6209. mute: boolean;
  6210. /** !#en Is the audio source looping?
  6211. !#zh 音频源是否循环播放? */
  6212. loop: boolean;
  6213. /** !#en If set to true, the audio source will automatically start playing on onEnable.
  6214. !#zh 如果设置为 true,音频源将在 onEnable 时自动播放。 */
  6215. playOnLoad: boolean;
  6216. /**
  6217. !#en Plays the clip.
  6218. !#zh 播放音频剪辑。
  6219. */
  6220. play(): void;
  6221. /**
  6222. !#en Stops the clip.
  6223. !#zh 停止当前音频剪辑。
  6224. */
  6225. stop(): void;
  6226. /**
  6227. !#en Pause the clip.
  6228. !#zh 暂停当前音频剪辑。
  6229. */
  6230. pause(): void;
  6231. /**
  6232. !#en Resume the clip.
  6233. !#zh 恢复播放。
  6234. */
  6235. resume(): void;
  6236. /**
  6237. !#en Rewind playing music.
  6238. !#zh 从头开始播放。
  6239. */
  6240. rewind(): void;
  6241. /**
  6242. !#en Get current time
  6243. !#zh 获取当前的播放时间
  6244. */
  6245. getCurrentTime(): number;
  6246. /**
  6247. !#en Set current time
  6248. !#zh 设置当前的播放时间
  6249. @param time time
  6250. */
  6251. setCurrentTime(time: number): number;
  6252. /**
  6253. !#en Get audio duration
  6254. !#zh 获取当前音频的长度
  6255. */
  6256. getDuration(): number;
  6257. }
  6258. /** !#en
  6259. 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>
  6260. This component does not have any API interface and can be added directly to the scene to take effect.
  6261. !#zh
  6262. 该组件将拦截所属节点 bounding box 内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  6263. 该组件没有任何 API 接口,直接添加到场景即可生效。 */
  6264. export class BlockInputEvents extends Component {
  6265. }
  6266. /** !#en
  6267. Button has 4 Transition types<br/>
  6268. When Button state changed:<br/>
  6269. If Transition type is Button.Transition.NONE, Button will do nothing<br/>
  6270. If Transition type is Button.Transition.COLOR, Button will change target's color<br/>
  6271. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite<br/>
  6272. If Transition type is Button.Transition.SCALE, Button will change target node's scale<br/>
  6273. Button will trigger 5 events:<br/>
  6274. Button.EVENT_TOUCH_DOWN<br/>
  6275. Button.EVENT_TOUCH_UP<br/>
  6276. Button.EVENT_HOVER_IN<br/>
  6277. Button.EVENT_HOVER_MOVE<br/>
  6278. Button.EVENT_HOVER_OUT<br/>
  6279. !#zh
  6280. 按钮组件。可以被按下,或者点击。<br/>
  6281. 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:<br/>
  6282. -Button.Transition.NONE // 不做任何过渡<br/>
  6283. -Button.Transition.COLOR // 进行颜色之间过渡<br/>
  6284. -Button.Transition.SPRITE // 进行精灵之间过渡<br/>
  6285. -Button.Transition.SCALE // 进行缩放过渡<br/>
  6286. 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):<br/>
  6287. // 以下事件可以在全平台上都触发<br/>
  6288. -cc.Node.EventType.TOUCH_START // 按下时事件<br/>
  6289. -cc.Node.EventType.TOUCH_Move // 按住移动后事件<br/>
  6290. -cc.Node.EventType.TOUCH_END // 按下后松开后事件<br/>
  6291. -cc.Node.EventType.TOUCH_CANCEL // 按下取消事件<br/>
  6292. // 以下事件只在 PC 平台上触发<br/>
  6293. -cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件<br/>
  6294. -cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件<br/>
  6295. -cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件<br/>
  6296. -cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件<br/>
  6297. -cc.Node.EventType.MOUSE_UP // 鼠标松开事件<br/>
  6298. -cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件<br/> */
  6299. export class Button extends Component {
  6300. /** !#en
  6301. Whether the Button is disabled.
  6302. If true, the Button will trigger event and do transition.
  6303. !#zh
  6304. 按钮事件是否被响应,如果为 false,则按钮将被禁用。 */
  6305. interactable: boolean;
  6306. /** !#en When this flag is true, Button target sprite will turn gray when interactable is false.
  6307. !#zh 如果这个标记为 true,当 button 的 interactable 属性为 false 的时候,会使用内置 shader 让 button 的 target 节点的 sprite 组件变灰 */
  6308. enableAutoGrayEffect: boolean;
  6309. /** !#en Transition type
  6310. !#zh 按钮状态改变时过渡方式。 */
  6311. transition: Button.Transition;
  6312. /** !#en Normal state color.
  6313. !#zh 普通状态下按钮所显示的颜色。 */
  6314. normalColor: Color;
  6315. /** !#en Pressed state color
  6316. !#zh 按下状态时按钮所显示的颜色。 */
  6317. pressedColor: Color;
  6318. /** !#en Hover state color
  6319. !#zh 悬停状态下按钮所显示的颜色。 */
  6320. hoverColor: Color;
  6321. /** !#en Disabled state color
  6322. !#zh 禁用状态下按钮所显示的颜色。 */
  6323. disabledColor: Color;
  6324. /** !#en Color and Scale transition duration
  6325. !#zh 颜色过渡和缩放过渡时所需时间 */
  6326. duration: number;
  6327. /** !#en When user press the button, the button will zoom to a scale.
  6328. The final scale of the button equals (button original scale * zoomScale)
  6329. !#zh 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale */
  6330. zoomScale: number;
  6331. /** !#en Normal state sprite
  6332. !#zh 普通状态下按钮所显示的 Sprite 。 */
  6333. normalSprite: SpriteFrame;
  6334. /** !#en Pressed state sprite
  6335. !#zh 按下状态时按钮所显示的 Sprite 。 */
  6336. pressedSprite: SpriteFrame;
  6337. /** !#en Hover state sprite
  6338. !#zh 悬停状态下按钮所显示的 Sprite 。 */
  6339. hoverSprite: SpriteFrame;
  6340. /** !#en Disabled state sprite
  6341. !#zh 禁用状态下按钮所显示的 Sprite 。 */
  6342. disabledSprite: SpriteFrame;
  6343. /** !#en
  6344. Transition target.
  6345. When Button state changed:
  6346. If Transition type is Button.Transition.NONE, Button will do nothing
  6347. If Transition type is Button.Transition.COLOR, Button will change target's color
  6348. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
  6349. !#zh
  6350. 需要过渡的目标。
  6351. 当前按钮状态改变规则:
  6352. -如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
  6353. -如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
  6354. -如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */
  6355. target: Node;
  6356. /** !#en If Button is clicked, it will trigger event's handler
  6357. !#zh 按钮的点击事件列表。 */
  6358. clickEvents: Component.EventHandler[];
  6359. }
  6360. /** !#zh: 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。
  6361. 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 */
  6362. export class Canvas extends Component {
  6363. /** !#en Current active canvas, the scene should only have one active canvas at the same time.
  6364. !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。 */
  6365. static instance: Canvas;
  6366. /** !#en The desigin resolution for current scene.
  6367. !#zh 当前场景设计分辨率。 */
  6368. designResolution: Size;
  6369. /** !#en TODO
  6370. !#zh: 是否优先将设计分辨率高度撑满视图高度。 */
  6371. fitHeight: boolean;
  6372. /** !#en TODO
  6373. !#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */
  6374. fitWidth: boolean;
  6375. }
  6376. /** !#en
  6377. Base class for everything attached to Node(Entity).<br/>
  6378. <br/>
  6379. NOTE: Not allowed to use construction parameters for Component's subclasses,
  6380. because Component is created by the engine.
  6381. !#zh
  6382. 所有附加到节点的基类。<br/>
  6383. <br/>
  6384. 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。 */
  6385. export class Component extends Object {
  6386. /** !#en The node this component is attached to. A component is always attached to a node.
  6387. !#zh 该组件被附加到的节点。组件总会附加到一个节点。 */
  6388. node: Node;
  6389. /** !#en The uuid for editor.
  6390. !#zh 组件的 uuid,用于编辑器。 */
  6391. uuid: string;
  6392. /** !#en indicates whether this component is enabled or not.
  6393. !#zh 表示该组件自身是否启用。 */
  6394. enabled: boolean;
  6395. /** !#en indicates whether this component is enabled and its node is also active in the hierarchy.
  6396. !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。 */
  6397. enabledInHierarchy: boolean;
  6398. /** !#en Returns a value which used to indicate the onLoad get called or not.
  6399. !#zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。 */
  6400. _isOnLoadCalled: number;
  6401. /**
  6402. !#en Update is called every frame, if the Component is enabled.<br/>
  6403. 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.
  6404. !#zh 如果该组件启用,则每帧调用 update。<br/>
  6405. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6406. @param dt the delta time in seconds it took to complete the last frame
  6407. */
  6408. protected update(dt: number): void;
  6409. /**
  6410. !#en LateUpdate is called every frame, if the Component is enabled.<br/>
  6411. 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.
  6412. !#zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  6413. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6414. */
  6415. protected lateUpdate(): void;
  6416. /**
  6417. !#en
  6418. When attaching to an active node or its node first activated.
  6419. onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  6420. 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.
  6421. !#zh
  6422. 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  6423. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6424. */
  6425. protected onLoad(): void;
  6426. /**
  6427. !#en
  6428. Called before all scripts' update if the Component is enabled the first time.
  6429. Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  6430. 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.
  6431. !#zh
  6432. 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  6433. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6434. */
  6435. protected start(): void;
  6436. /**
  6437. !#en Called when this component becomes enabled and its node is active.<br/>
  6438. 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.
  6439. !#zh 当该组件被启用,并且它的节点也激活时。<br/>
  6440. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6441. */
  6442. protected onEnable(): void;
  6443. /**
  6444. !#en Called when this component becomes disabled or its node becomes inactive.<br/>
  6445. 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.
  6446. !#zh 当该组件被禁用或节点变为无效时调用。<br/>
  6447. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6448. */
  6449. protected onDisable(): void;
  6450. /**
  6451. !#en Called when this component will be destroyed.<br/>
  6452. 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.
  6453. !#zh 当该组件被销毁时调用<br/>
  6454. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  6455. */
  6456. protected onDestroy(): void;
  6457. protected onFocusInEditor(): void;
  6458. protected onLostFocusInEditor(): void;
  6459. /**
  6460. !#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.
  6461. !#zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  6462. */
  6463. protected resetInEditor(): void;
  6464. /**
  6465. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  6466. !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
  6467. @param typeOrClassName the constructor or the class name of the component to add
  6468. @example
  6469. ```js
  6470. var sprite = node.addComponent(cc.Sprite);
  6471. var test = node.addComponent("Test");
  6472. ```
  6473. */
  6474. addComponent<T extends Component>(type: {new(): T}): T;
  6475. addComponent(className: string): any;
  6476. /**
  6477. !#en
  6478. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  6479. You can also get component in the node by passing in the name of the script.
  6480. !#zh
  6481. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  6482. 传入参数也可以是脚本的名称。
  6483. @param typeOrClassName typeOrClassName
  6484. @example
  6485. ```js
  6486. // get sprite component.
  6487. var sprite = node.getComponent(cc.Sprite);
  6488. // get custom test calss.
  6489. var test = node.getComponent("Test");
  6490. ```
  6491. */
  6492. getComponent<T extends Component>(type: {prototype: T}): T;
  6493. getComponent(className: string): any;
  6494. /**
  6495. !#en Returns all components of supplied Type in the node.
  6496. !#zh 返回节点上指定类型的所有组件。
  6497. @param typeOrClassName typeOrClassName
  6498. @example
  6499. ```js
  6500. var sprites = node.getComponents(cc.Sprite);
  6501. var tests = node.getComponents("Test");
  6502. ```
  6503. */
  6504. getComponents<T extends Component>(type: {prototype: T}): T[];
  6505. getComponents(className: string): any[];
  6506. /**
  6507. !#en Returns the component of supplied type in any of its children using depth first search.
  6508. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  6509. @param typeOrClassName typeOrClassName
  6510. @example
  6511. ```js
  6512. var sprite = node.getComponentInChildren(cc.Sprite);
  6513. var Test = node.getComponentInChildren("Test");
  6514. ```
  6515. */
  6516. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  6517. getComponentInChildren(className: string): any;
  6518. /**
  6519. !#en Returns the components of supplied type in self or any of its children using depth first search.
  6520. !#zh 递归查找自身或所有子节点中指定类型的组件
  6521. @param typeOrClassName typeOrClassName
  6522. @example
  6523. ```js
  6524. var sprites = node.getComponentsInChildren(cc.Sprite);
  6525. var tests = node.getComponentsInChildren("Test");
  6526. ```
  6527. */
  6528. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  6529. getComponentsInChildren(className: string): any[];
  6530. /**
  6531. !#en
  6532. If the component's bounding box is different from the node's, you can implement this method to supply
  6533. a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  6534. !#zh
  6535. 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  6536. 以便编辑器的场景视图可以正确地执行点选测试。
  6537. @param out_rect the Rect to receive the bounding box
  6538. */
  6539. _getLocalBounds(out_rect: Rect): void;
  6540. /**
  6541. !#en
  6542. onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  6543. an undo operation on this component.<br/>
  6544. <br/>
  6545. If the component contains the "internal state", short for "temporary member variables which not included<br/>
  6546. in its CCClass properties", then you may need to implement this function.<br/>
  6547. <br/>
  6548. The editor will call the getset accessors of your component to record/restore the component's state<br/>
  6549. for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  6550. this function to manually synchronize your component's "internal states" with its public properties.<br/>
  6551. Once you implement this function, all the getset accessors of your component will not be called when<br/>
  6552. the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  6553. will be recorded or restored by editor.<br/>
  6554. <br/>
  6555. Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  6556. to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  6557. properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  6558. will not be called during reset operation. Which means that only the properties with default value<br/>
  6559. will be reset by editor.
  6560. This function is only called in editor mode.
  6561. !#zh
  6562. onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  6563. <br/>
  6564. 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  6565. <br/>
  6566. 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。
  6567. 然而,在极端的情况下,它可能无法良好运作。<br/>
  6568. 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。
  6569. 一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。
  6570. 这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  6571. <br/>
  6572. 同样的,编辑可能无法在极端情况下正确地重置您的组件。<br/>
  6573. 于是如果你需要支持组件重置菜单,你需要在该方法中手工同步组件属性到“内部状态”。<br/>
  6574. 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
  6575. 这意味着仅仅指定了默认值的属性将被编辑器重置。
  6576. <br/>
  6577. 此方法仅在编辑器下会被调用。
  6578. */
  6579. onRestore(): void;
  6580. /**
  6581. !#en
  6582. Schedules a custom selector.<br/>
  6583. If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
  6584. !#zh
  6585. 调度一个自定义的回调函数。<br/>
  6586. 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
  6587. @param callback The callback function
  6588. @param interval Tick interval in seconds. 0 means tick every frame.
  6589. @param repeat The selector will be executed (repeat + 1) times, you can use cc.macro.REPEAT_FOREVER for tick infinitely.
  6590. @param delay The amount of time that the first tick will wait before execution.
  6591. @example
  6592. ```js
  6593. var timeCallback = function (dt) {
  6594. cc.log("time: " + dt);
  6595. }
  6596. this.schedule(timeCallback, 1);
  6597. ```
  6598. */
  6599. schedule(callback: Function, interval?: number, repeat?: number, delay?: number): void;
  6600. /**
  6601. !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
  6602. !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  6603. @param callback A function wrapped as a selector
  6604. @param delay The amount of time that the first tick will wait before execution.
  6605. @example
  6606. ```js
  6607. var timeCallback = function (dt) {
  6608. cc.log("time: " + dt);
  6609. }
  6610. this.scheduleOnce(timeCallback, 2);
  6611. ```
  6612. */
  6613. scheduleOnce(callback: Function, delay?: number): void;
  6614. /**
  6615. !#en Unschedules a custom callback function.
  6616. !#zh 取消调度一个自定义的回调函数。
  6617. @param callback_fn A function wrapped as a selector
  6618. @example
  6619. ```js
  6620. this.unschedule(_callback);
  6621. ```
  6622. */
  6623. unschedule(callback_fn: Function): void;
  6624. /**
  6625. !#en
  6626. unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
  6627. Actions are not affected by this method.
  6628. !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 'update' 回调函数。动作不受此方法影响。
  6629. @example
  6630. ```js
  6631. this.unscheduleAllCallbacks();
  6632. ```
  6633. */
  6634. unscheduleAllCallbacks(): void;
  6635. }
  6636. /** !#en The Label Component.
  6637. !#zh 文字标签组件 */
  6638. export class Label extends RenderComponent {
  6639. /** !#en Content string of label.
  6640. !#zh 标签显示的文本内容。 */
  6641. string: string;
  6642. /** !#en Horizontal Alignment of label.
  6643. !#zh 文本内容的水平对齐方式。 */
  6644. horizontalAlign: Label.HorizontalAlign;
  6645. /** !#en Vertical Alignment of label.
  6646. !#zh 文本内容的垂直对齐方式。 */
  6647. verticalAlign: Label.VerticalAlign;
  6648. /** !#en The actual rendering font size in shrink mode
  6649. !#zh SHRINK 模式下面文本实际渲染的字体大小 */
  6650. actualFontSize: number;
  6651. /** !#en Font size of label.
  6652. !#zh 文本字体大小。 */
  6653. fontSize: number;
  6654. /** !#en Font family of label, only take effect when useSystemFont property is true.
  6655. !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 */
  6656. fontFamily: string;
  6657. /** !#en Line Height of label.
  6658. !#zh 文本行高。 */
  6659. lineHeight: number;
  6660. /** !#en Overflow of label.
  6661. !#zh 文字显示超出范围时的处理方式。 */
  6662. overflow: Label.Overflow;
  6663. /** !#en Whether auto wrap label when string width is large than label width.
  6664. !#zh 是否自动换行。 */
  6665. enableWrapText: boolean;
  6666. /** !#en The font of label.
  6667. !#zh 文本字体。 */
  6668. font: Font;
  6669. /** !#en Whether use system font name or not.
  6670. !#zh 是否使用系统字体。 */
  6671. isSystemFontUsed: boolean;
  6672. }
  6673. /** !#en Outline effect used to change the display, only used for TTF font
  6674. !#zh 描边效果组件,用于字体描边,只能用于系统字体 */
  6675. export class LabelOutline extends Component {
  6676. /** !#en Change the outline color
  6677. !#zh 改变描边的颜色 */
  6678. color: Color;
  6679. /** !#en Change the outline width
  6680. !#zh 改变描边的宽度 */
  6681. width: number;
  6682. }
  6683. /** !#en
  6684. The Layout is a container component, use it to arrange child elements easily.<br>
  6685. Note:<br>
  6686. 1.Scaling and rotation of child nodes are not considered.<br>
  6687. 2.After setting the Layout, the results need to be updated until the next frame,
  6688. unless you manually call {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。
  6689. !#zh
  6690. Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  6691. 注意:<br>
  6692. 1.不会考虑子节点的缩放和旋转。<br>
  6693. 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用 {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。 */
  6694. export class Layout extends Component {
  6695. /** !#en The layout type.
  6696. !#zh 布局类型 */
  6697. type: Layout.Type;
  6698. /** !#en
  6699. The are three resize modes for Layout.
  6700. None, resize Container and resize children.
  6701. !#zh 缩放模式 */
  6702. resizeMode: Layout.ResizeMode;
  6703. /** !#en The cell size for grid layout.
  6704. !#zh 每个格子的大小,只有布局类型为 GRID 的时候才有效。 */
  6705. cellSize: Size;
  6706. /** !#en
  6707. The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  6708. and then break line on demand. Choose vertical if you want to layout vertically at first .
  6709. !#zh 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。 */
  6710. startAxis: Layout.AxisDirection;
  6711. /** !#en The left padding of layout, it only effect the layout in one direction.
  6712. !#zh 容器内左边距,只会在一个布局方向上生效。 */
  6713. paddingLeft: number;
  6714. /** !#en The right padding of layout, it only effect the layout in one direction.
  6715. !#zh 容器内右边距,只会在一个布局方向上生效。 */
  6716. paddingRight: number;
  6717. /** !#en The top padding of layout, it only effect the layout in one direction.
  6718. !#zh 容器内上边距,只会在一个布局方向上生效。 */
  6719. paddingTop: number;
  6720. /** !#en The bottom padding of layout, it only effect the layout in one direction.
  6721. !#zh 容器内下边距,只会在一个布局方向上生效。 */
  6722. paddingBottom: number;
  6723. /** !#en The distance in x-axis between each element in layout.
  6724. !#zh 子节点之间的水平间距。 */
  6725. spacingX: number;
  6726. /** !#en The distance in y-axis between each element in layout.
  6727. !#zh 子节点之间的垂直间距。 */
  6728. spacingY: number;
  6729. /** !#en
  6730. Only take effect in Vertical layout mode.
  6731. This option changes the start element's positioning.
  6732. !#zh 垂直排列子节点的方向。 */
  6733. verticalDirection: Layout.VerticalDirection;
  6734. /** !#en
  6735. Only take effect in Horizontal layout mode.
  6736. This option changes the start element's positioning.
  6737. !#zh 水平排列子节点的方向。 */
  6738. horizontalDirection: Layout.HorizontalDirection;
  6739. /** !#en Adjust the layout if the children scaled.
  6740. !#zh 子节点缩放比例是否影响布局。 */
  6741. affectedByScale: boolean;
  6742. /**
  6743. !#en Perform the layout update
  6744. !#zh 立即执行更新布局
  6745. @example
  6746. ```js
  6747. layout.type = cc.Layout.HORIZONTAL;
  6748. layout.node.addChild(childNode);
  6749. cc.log(childNode.x); // not yet changed
  6750. layout.updateLayout();
  6751. cc.log(childNode.x); // changed
  6752. ```
  6753. */
  6754. updateLayout(): void;
  6755. /** !#en The padding of layout, it effects the layout in four direction.
  6756. !#zh 容器内边距,该属性会在四个布局方向上生效。 */
  6757. padding: number;
  6758. }
  6759. /** !#en The Mask Component
  6760. !#zh 遮罩组件 */
  6761. export class Mask extends RenderComponent {
  6762. /** !#en The mask type.
  6763. !#zh 遮罩类型 */
  6764. type: Mask.Type;
  6765. /** !#en The mask image
  6766. !#zh 遮罩所需要的贴图 */
  6767. spriteFrame: SpriteFrame;
  6768. /** !#en
  6769. The alpha threshold.(Not supported Canvas Mode) <br/>
  6770. The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  6771. Should be a float between 0 and 1. <br/>
  6772. This default to 0 (so alpha test is disabled).
  6773. When it's set to 1, the stencil will discard all pixels, nothing will be shown,
  6774. In previous version, it act as if the alpha test is disabled, which is incorrect.
  6775. !#zh
  6776. Alpha 阈值(不支持 Canvas 模式)<br/>
  6777. 只有当模板的像素的 alpha 大于 alphaThreshold 时,才会绘制内容。<br/>
  6778. 该数值 0 ~ 1 之间的浮点数,默认值为 0(因此禁用 alpha 测试)
  6779. 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容,在之前的版本中,设置为 1 等同于 0,这种效果其实是不正确的 */
  6780. alphaThreshold: number;
  6781. /** !#en Reverse mask (Not supported Canvas Mode)
  6782. !#zh 反向遮罩(不支持 Canvas 模式) */
  6783. inverted: boolean;
  6784. /** TODO: remove segments, not supported by graphics
  6785. !#en The segements for ellipse mask.
  6786. !#zh 椭圆遮罩的曲线细分数 */
  6787. segements: number;
  6788. }
  6789. /** !#en
  6790. cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  6791. You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  6792. length and color. The fadeTime controls how long it takes each vertex in <br/>
  6793. the streak to fade out, the minimum segment size it how many pixels the <br/>
  6794. streak will move before adding a new ribbon segment, and the texture <br/>
  6795. length is the how many pixels the texture is stretched across. The texture <br/>
  6796. is vertically aligned along the streak segment.
  6797. !#zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */
  6798. export class MotionStreak extends Component {
  6799. /** !#en
  6800. !#zh 在编辑器模式下预览拖尾效果。 */
  6801. preview: boolean;
  6802. /** !#en The fade time to fade.
  6803. !#zh 拖尾的渐隐时间,以秒为单位。 */
  6804. fadeTime: number;
  6805. /** !#en The minimum segment size.
  6806. !#zh 拖尾之间最小距离。 */
  6807. minSeg: number;
  6808. /** !#en The stroke's width.
  6809. !#zh 拖尾的宽度。 */
  6810. stroke: number;
  6811. /** !#en The texture of the MotionStreak.
  6812. !#zh 拖尾的贴图。 */
  6813. texture: Texture2D;
  6814. /** !#en The color of the MotionStreak.
  6815. !#zh 拖尾的颜色 */
  6816. color: Color;
  6817. /** !#en The fast Mode.
  6818. !#zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。 */
  6819. fastMode: boolean;
  6820. /**
  6821. !#en Remove all living segments of the ribbon.
  6822. !#zh 删除当前所有的拖尾片段。
  6823. @example
  6824. ```js
  6825. // Remove all living segments of the ribbon.
  6826. myMotionStreak.reset();
  6827. ```
  6828. */
  6829. reset(): void;
  6830. }
  6831. /** !#en The PageView control
  6832. !#zh 页面视图组件 */
  6833. export class PageView extends ScrollView {
  6834. /** !#en Specify the size type of each page in PageView.
  6835. !#zh 页面视图中每个页面大小类型 */
  6836. sizeMode: PageView.SizeMode;
  6837. /** !#en The page view direction
  6838. !#zh 页面视图滚动类型 */
  6839. direction: PageView.Direction;
  6840. /** !#en
  6841. The scroll threshold value, when drag exceeds this value,
  6842. release the next page will automatically scroll, less than the restore
  6843. !#zh 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。 */
  6844. scrollThreshold: number;
  6845. /** !#en
  6846. Auto page turning velocity threshold. When users swipe the PageView quickly,
  6847. it will calculate a velocity based on the scroll distance and time,
  6848. if the calculated velocity is larger than the threshold, then it will trigger page turning.
  6849. !#zh
  6850. 快速滑动翻页临界值。
  6851. 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  6852. 该值与此临界值相比较,如果大于临界值,则进行自动翻页。 */
  6853. autoPageTurningThreshold: number;
  6854. /** !#en Change the PageTurning event timing of PageView.
  6855. !#zh 设置 PageView PageTurning 事件的发送时机。 */
  6856. pageTurningEventTiming: number;
  6857. /** !#en The Page View Indicator
  6858. !#zh 页面视图指示器组件 */
  6859. indicator: PageViewIndicator;
  6860. /** !#en The time required to turn over a page. unit: second
  6861. !#zh 每个页面翻页时所需时间。单位:秒 */
  6862. pageTurningSpeed: number;
  6863. /** !#en PageView events callback
  6864. !#zh 滚动视图的事件回调函数 */
  6865. pageEvents: Component.EventHandler[];
  6866. /**
  6867. !#en Returns current page index
  6868. !#zh 返回当前页面索引
  6869. */
  6870. getCurrentPageIndex(): number;
  6871. /**
  6872. !#en Set current page index
  6873. !#zh 设置当前页面索引
  6874. @param index index
  6875. */
  6876. setCurrentPageIndex(index: number): void;
  6877. /**
  6878. !#en Returns all pages of pageview
  6879. !#zh 返回视图中的所有页面
  6880. */
  6881. getPages(): Node[];
  6882. /**
  6883. !#en At the end of the current page view to insert a new view
  6884. !#zh 在当前页面视图的尾部插入一个新视图
  6885. @param page page
  6886. */
  6887. addPage(page: Node): void;
  6888. /**
  6889. !#en Inserts a page in the specified location
  6890. !#zh 将页面插入指定位置中
  6891. @param page page
  6892. @param index index
  6893. */
  6894. insertPage(page: Node, index: number): void;
  6895. /**
  6896. !#en Removes a page from PageView.
  6897. !#zh 移除指定页面
  6898. @param page page
  6899. */
  6900. removePage(page: Node): void;
  6901. /**
  6902. !#en Removes a page at index of PageView.
  6903. !#zh 移除指定下标的页面
  6904. @param index index
  6905. */
  6906. removePageAtIndex(index: number): void;
  6907. /**
  6908. !#en Removes all pages from PageView
  6909. !#zh 移除所有页面
  6910. */
  6911. removeAllPages(): void;
  6912. /**
  6913. !#en Scroll PageView to index.
  6914. !#zh 滚动到指定页面
  6915. @param idx index of page.
  6916. @param timeInSecond scrolling time
  6917. */
  6918. scrollToPage(idx: number, timeInSecond: number): void;
  6919. }
  6920. /** !#en The Page View Indicator Component
  6921. !#zh 页面视图每页标记组件 */
  6922. export class PageViewIndicator extends Component {
  6923. /** !#en The spriteFrame for each element.
  6924. !#zh 每个页面标记显示的图片 */
  6925. spriteFrame: SpriteFrame;
  6926. /** !#en The location direction of PageViewIndicator.
  6927. !#zh 页面标记摆放方向 */
  6928. direction: PageViewIndicator.Direction;
  6929. /** !#en The cellSize for each element.
  6930. !#zh 每个页面标记的大小 */
  6931. cellSize: Size;
  6932. /** !#en The distance between each element.
  6933. !#zh 每个页面标记之间的边距 */
  6934. spacing: number;
  6935. /**
  6936. !#en Set Page View
  6937. !#zh 设置页面视图
  6938. @param target target
  6939. */
  6940. setPageView(target: PageView): void;
  6941. }
  6942. /** !#en
  6943. Visual indicator of progress in some operation.
  6944. Displays a bar to the user representing how far the operation has progressed.
  6945. !#zh
  6946. 进度条组件,可用于显示加载资源时的进度。 */
  6947. export class ProgressBar extends Component {
  6948. /** !#en The targeted Sprite which will be changed progressively.
  6949. !#zh 用来显示进度条比例的 Sprite 对象。 */
  6950. barSprite: Sprite;
  6951. /** !#en The progress mode, there are two modes supported now: horizontal and vertical.
  6952. !#zh 进度条的模式 */
  6953. mode: ProgressBar.Mode;
  6954. /** !#en The total width or height of the bar sprite.
  6955. !#zh 进度条实际的总长度 */
  6956. totalLength: number;
  6957. /** !#en The current progress of the bar sprite. The valid value is between 0-1.
  6958. !#zh 当前进度值,该数值的区间是 0-1 之间。 */
  6959. progress: number;
  6960. /** !#en Whether reverse the progress direction of the bar sprite.
  6961. !#zh 进度条是否进行反方向变化。 */
  6962. reverse: boolean;
  6963. }
  6964. /** !#en
  6965. Base class for components which supports rendering features.
  6966. !#zh
  6967. 所有支持渲染的组件的基类 */
  6968. export class RenderComponent extends Component {
  6969. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  6970. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的 */
  6971. srcBlendFactor: macro.BlendFactor;
  6972. /** !#en specify the destination Blend Factor.
  6973. !#zh 指定目标的混合模式 */
  6974. dstBlendFactor: macro.BlendFactor;
  6975. }
  6976. /** !#en The RichText Component.
  6977. !#zh 富文本组件 */
  6978. export class RichText extends Component {
  6979. /** !#en Content string of RichText.
  6980. !#zh 富文本显示的文本内容。 */
  6981. string: string;
  6982. /** !#en Horizontal Alignment of each line in RichText.
  6983. !#zh 文本内容的水平对齐方式。 */
  6984. horizontalAlign: macro.TextAlignment;
  6985. /** !#en Font size of RichText.
  6986. !#zh 富文本字体大小。 */
  6987. fontSize: number;
  6988. /** !#en Custom TTF font of RichText
  6989. !#zh 富文本定制字体 */
  6990. font: cc.TTFFont;
  6991. /** !#en The maximize width of the RichText
  6992. !#zh 富文本的最大宽度 */
  6993. maxWidth: number;
  6994. /** !#en Line Height of RichText.
  6995. !#zh 富文本行高。 */
  6996. lineHeight: number;
  6997. /** !#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.
  6998. !#zh 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。 */
  6999. imageAtlas: SpriteAtlas;
  7000. /** !#en
  7001. Once checked, the RichText will block all input events (mouse and touch) within
  7002. the bounding box of the node, preventing the input from penetrating into the underlying node.
  7003. !#zh
  7004. 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。 */
  7005. handleTouchEvent: boolean;
  7006. }
  7007. /** !#en
  7008. The Scrollbar control allows the user to scroll an image or other view that is too large to see completely
  7009. !#zh 滚动条组件 */
  7010. export class Scrollbar extends Component {
  7011. /** !#en The "handle" part of the scrollbar.
  7012. !#zh 作为当前滚动区域位置显示的滑块 Sprite。 */
  7013. handle: Sprite;
  7014. /** !#en The direction of scrollbar.
  7015. !#zh ScrollBar 的滚动方向。 */
  7016. direction: Scrollbar.Direction;
  7017. /** !#en Whether enable auto hide or not.
  7018. !#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */
  7019. enableAutoHide: boolean;
  7020. /** !#en
  7021. The time to hide scrollbar when scroll finished.
  7022. Note: This value is only useful when enableAutoHide is true.
  7023. !#zh
  7024. 没有滚动动作后经过多久会自动隐藏。
  7025. 注意:只要当 “enableAutoHide” 为 true 时,才有效。 */
  7026. autoHideTime: number;
  7027. }
  7028. /** !#en
  7029. Layout container for a view hierarchy that can be scrolled by the user,
  7030. allowing it to be larger than the physical display.
  7031. !#zh
  7032. 滚动视图组件 */
  7033. export class ScrollView extends Component {
  7034. /** !#en This is a reference to the UI element to be scrolled.
  7035. !#zh 可滚动展示内容的节点。 */
  7036. content: Node;
  7037. /** !#en Enable horizontal scroll.
  7038. !#zh 是否开启水平滚动。 */
  7039. horizontal: boolean;
  7040. /** !#en Enable vertical scroll.
  7041. !#zh 是否开启垂直滚动。 */
  7042. vertical: boolean;
  7043. /** !#en When inertia is set, the content will continue to move when touch ended.
  7044. !#zh 是否开启滚动惯性。 */
  7045. inertia: boolean;
  7046. /** !#en
  7047. It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  7048. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  7049. !#zh
  7050. 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。 */
  7051. brake: number;
  7052. /** !#en When elastic is set, the content will be bounce back when move out of boundary.
  7053. !#zh 是否允许滚动内容超过边界,并在停止触摸后回弹。 */
  7054. elastic: boolean;
  7055. /** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.
  7056. !#zh 回弹持续的时间,0 表示将立即反弹。 */
  7057. bounceDuration: number;
  7058. /** !#en The horizontal scrollbar reference.
  7059. !#zh 水平滚动的 ScrollBar。 */
  7060. horizontalScrollBar: Scrollbar;
  7061. /** !#en The vertical scrollbar reference.
  7062. !#zh 垂直滚动的 ScrollBar。 */
  7063. verticalScrollBar: Scrollbar;
  7064. /** !#en Scrollview events callback
  7065. !#zh 滚动视图的事件回调函数 */
  7066. scrollEvents: Component.EventHandler[];
  7067. /** !#en If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  7068. It's set to true by default.
  7069. !#zh 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。
  7070. 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 */
  7071. cancelInnerEvents: boolean;
  7072. /**
  7073. !#en Scroll the content to the bottom boundary of ScrollView.
  7074. !#zh 视图内容将在规定时间内滚动到视图底部。
  7075. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7076. the content will jump to the bottom boundary immediately.
  7077. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7078. @example
  7079. ```js
  7080. // Scroll to the bottom of the view.
  7081. scrollView.scrollToBottom(0.1);
  7082. ```
  7083. */
  7084. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  7085. /**
  7086. !#en Scroll the content to the top boundary of ScrollView.
  7087. !#zh 视图内容将在规定时间内滚动到视图顶部。
  7088. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7089. the content will jump to the top boundary immediately.
  7090. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7091. @example
  7092. ```js
  7093. // Scroll to the top of the view.
  7094. scrollView.scrollToTop(0.1);
  7095. ```
  7096. */
  7097. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  7098. /**
  7099. !#en Scroll the content to the left boundary of ScrollView.
  7100. !#zh 视图内容将在规定时间内滚动到视图左边。
  7101. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7102. the content will jump to the left boundary immediately.
  7103. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7104. @example
  7105. ```js
  7106. // Scroll to the left of the view.
  7107. scrollView.scrollToLeft(0.1);
  7108. ```
  7109. */
  7110. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  7111. /**
  7112. !#en Scroll the content to the right boundary of ScrollView.
  7113. !#zh 视图内容将在规定时间内滚动到视图右边。
  7114. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7115. the content will jump to the right boundary immediately.
  7116. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7117. @example
  7118. ```js
  7119. // Scroll to the right of the view.
  7120. scrollView.scrollToRight(0.1);
  7121. ```
  7122. */
  7123. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  7124. /**
  7125. !#en Scroll the content to the top left boundary of ScrollView.
  7126. !#zh 视图内容将在规定时间内滚动到视图左上角。
  7127. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7128. the content will jump to the top left boundary immediately.
  7129. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7130. @example
  7131. ```js
  7132. // Scroll to the upper left corner of the view.
  7133. scrollView.scrollToTopLeft(0.1);
  7134. ```
  7135. */
  7136. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  7137. /**
  7138. !#en Scroll the content to the top right boundary of ScrollView.
  7139. !#zh 视图内容将在规定时间内滚动到视图右上角。
  7140. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7141. the content will jump to the top right boundary immediately.
  7142. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7143. @example
  7144. ```js
  7145. // Scroll to the top right corner of the view.
  7146. scrollView.scrollToTopRight(0.1);
  7147. ```
  7148. */
  7149. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  7150. /**
  7151. !#en Scroll the content to the bottom left boundary of ScrollView.
  7152. !#zh 视图内容将在规定时间内滚动到视图左下角。
  7153. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7154. the content will jump to the bottom left boundary immediately.
  7155. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7156. @example
  7157. ```js
  7158. // Scroll to the lower left corner of the view.
  7159. scrollView.scrollToBottomLeft(0.1);
  7160. ```
  7161. */
  7162. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  7163. /**
  7164. !#en Scroll the content to the bottom right boundary of ScrollView.
  7165. !#zh 视图内容将在规定时间内滚动到视图右下角。
  7166. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7167. the content will jump to the bottom right boundary immediately.
  7168. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7169. @example
  7170. ```js
  7171. // Scroll to the lower right corner of the view.
  7172. scrollView.scrollToBottomRight(0.1);
  7173. ```
  7174. */
  7175. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  7176. /**
  7177. !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the
  7178. specific offset immediately.
  7179. !#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传,则立即滚动到指定偏移位置。
  7180. @param offset A Vec2, the value of which each axis between 0 and maxScrollOffset
  7181. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7182. the content will jump to the specific offset of ScrollView immediately.
  7183. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7184. @example
  7185. ```js
  7186. // Scroll to middle position in 0.1 second in x-axis
  7187. let maxScrollOffset = this.getMaxScrollOffset();
  7188. scrollView.scrollToOffset(cc.v2(maxScrollOffset.x / 2, 0), 0.1);
  7189. ```
  7190. */
  7191. scrollToOffset(offset: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  7192. /**
  7193. !#en Get the positive offset value corresponds to the content's top left boundary.
  7194. !#zh 获取滚动视图相对于左上角原点的当前滚动偏移
  7195. */
  7196. getScrollOffset(): Vec2;
  7197. /**
  7198. !#en Get the maximize available scroll offset
  7199. !#zh 获取滚动视图最大可以滚动的偏移量
  7200. */
  7201. getMaxScrollOffset(): Vec2;
  7202. /**
  7203. !#en Scroll the content to the horizontal percent position of ScrollView.
  7204. !#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  7205. @param percent A value between 0 and 1.
  7206. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7207. the content will jump to the horizontal percent position of ScrollView immediately.
  7208. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7209. @example
  7210. ```js
  7211. // Scroll to middle position.
  7212. scrollView.scrollToBottomRight(0.5, 0.1);
  7213. ```
  7214. */
  7215. scrollToPercentHorizontal(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  7216. /**
  7217. !#en Scroll the content to the percent position of ScrollView in any direction.
  7218. !#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  7219. @param anchor A point which will be clamp between cc.v2(0,0) and cc.v2(1,1).
  7220. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7221. the content will jump to the percent position of ScrollView immediately.
  7222. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7223. @example
  7224. ```js
  7225. // Vertical scroll to the bottom of the view.
  7226. scrollView.scrollTo(cc.v2(0, 1), 0.1);
  7227. // Horizontal scroll to view right.
  7228. scrollView.scrollTo(cc.v2(1, 0), 0.1);
  7229. ```
  7230. */
  7231. scrollTo(anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  7232. /**
  7233. !#en Scroll the content to the vertical percent position of ScrollView.
  7234. !#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  7235. @param percent A value between 0 and 1.
  7236. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  7237. the content will jump to the vertical percent position of ScrollView immediately.
  7238. @param attenuated Whether the scroll acceleration attenuated, default is true.
  7239. // Scroll to middle position.
  7240. scrollView.scrollToPercentVertical(0.5, 0.1);
  7241. */
  7242. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  7243. /**
  7244. !#en Stop auto scroll immediately
  7245. !#zh 停止自动滚动, 调用此 API 可以让 Scrollview 立即停止滚动
  7246. */
  7247. stopAutoScroll(): void;
  7248. /**
  7249. !#en Modify the content position.
  7250. !#zh 设置当前视图内容的坐标点。
  7251. @param position The position in content's parent space.
  7252. */
  7253. setContentPosition(position: Vec2): void;
  7254. /**
  7255. !#en Query the content's position in its parent space.
  7256. !#zh 获取当前视图内容的坐标点。
  7257. */
  7258. getContentPosition(): Position;
  7259. /**
  7260. !#en Query whether the user is currently dragging the ScrollView to scroll it
  7261. !#zh 用户是否在拖拽当前滚动视图
  7262. */
  7263. isScrolling(): boolean;
  7264. /**
  7265. !#en Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  7266. !#zh 当前滚动视图是否在惯性滚动
  7267. */
  7268. isAutoScrolling(): boolean;
  7269. }
  7270. /** !#en The Slider Control
  7271. !#zh 滑动器组件 */
  7272. export class Slider extends Component {
  7273. /** !#en The "handle" part of the slider
  7274. !#zh 滑动器滑块按钮部件 */
  7275. handle: Button;
  7276. /** !#en The slider direction
  7277. !#zh 滑动器方向 */
  7278. direction: Slider.Direction;
  7279. /** !#en The current progress of the slider. The valid value is between 0-1
  7280. !#zh 当前进度值,该数值的区间是 0-1 之间 */
  7281. progress: number;
  7282. /** !#en The slider events callback
  7283. !#zh 滑动器组件事件回调函数 */
  7284. slideEvents: Component.EventHandler[];
  7285. }
  7286. /** !#en Renders a sprite in the scene.
  7287. !#zh 该组件用于在场景中渲染精灵。 */
  7288. export class Sprite extends RenderComponent {
  7289. /** !#en The sprite frame of the sprite.
  7290. !#zh 精灵的精灵帧 */
  7291. spriteFrame: SpriteFrame;
  7292. /** !#en The sprite render type.
  7293. !#zh 精灵渲染类型 */
  7294. type: Sprite.Type;
  7295. /** !#en
  7296. The fill type, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7297. !#zh
  7298. 精灵填充类型,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7299. fillType: Sprite.FillType;
  7300. /** !#en
  7301. The fill Center, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7302. !#zh
  7303. 填充中心点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7304. fillCenter: Vec2;
  7305. /** !#en
  7306. The fill Start, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7307. !#zh
  7308. 填充起始点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7309. fillStart: number;
  7310. /** !#en
  7311. The fill Range, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  7312. !#zh
  7313. 填充范围,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  7314. fillRange: number;
  7315. /** !#en specify the frame is trimmed or not.
  7316. !#zh 是否使用裁剪模式 */
  7317. trim: boolean;
  7318. /** !#en specify the size tracing mode.
  7319. !#zh 精灵尺寸调整模式 */
  7320. sizeMode: Sprite.SizeMode;
  7321. /**
  7322. Change the state of sprite.
  7323. @param state NORMAL or GRAY State.
  7324. */
  7325. setState(state: Sprite.State): void;
  7326. /**
  7327. Gets the current state.
  7328. */
  7329. getState(): Sprite.State;
  7330. }
  7331. /** !#en The toggle component is a CheckBox, when it used together with a ToggleGroup, it
  7332. could be treated as a RadioButton.
  7333. !#zh Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。 */
  7334. export class Toggle extends Button {
  7335. /** !#en When this value is true, the check mark component will be enabled, otherwise
  7336. the check mark component will be disabled.
  7337. !#zh 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。 */
  7338. isChecked: boolean;
  7339. /** !#en The toggle group which the toggle belongs to, when it is null, the toggle is a CheckBox.
  7340. Otherwise, the toggle is a RadioButton.
  7341. !#zh Toggle 所属的 ToggleGroup,这个属性是可选的。如果这个属性为 null,则 Toggle 是一个 CheckBox,
  7342. 否则,Toggle 是一个 RadioButton。 */
  7343. toggleGroup: ToggleGroup;
  7344. /** !#en The image used for the checkmark.
  7345. !#zh Toggle 处于选中状态时显示的图片 */
  7346. checkMark: Sprite;
  7347. /** !#en If Toggle is clicked, it will trigger event's handler
  7348. !#zh Toggle 按钮的点击事件列表。 */
  7349. checkEvents: Component.EventHandler[];
  7350. /**
  7351. !#en Make the toggle button checked.
  7352. !#zh 使 toggle 按钮处于选中状态
  7353. */
  7354. check(): void;
  7355. /**
  7356. !#en Make the toggle button unchecked.
  7357. !#zh 使 toggle 按钮处于未选中状态
  7358. */
  7359. uncheck(): void;
  7360. }
  7361. /** !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. <br/>
  7362. Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  7363. Note: All the first layer child node containing the toggle component will auto be added to the container
  7364. !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。<br/>
  7365. 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。<br/>
  7366. 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 */
  7367. export class ToggleContainer extends Component {
  7368. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  7369. If it is false, it will make sure there is always only one toggle could be switched on
  7370. and the already switched on toggle can't be switched off.
  7371. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  7372. allowSwitchOff: boolean;
  7373. /** !#en If Toggle is clicked, it will trigger event's handler
  7374. !#zh Toggle 按钮的点击事件列表。 */
  7375. checkEvents: Component.EventHandler[];
  7376. /** !#en Read only property, return the toggle items array reference managed by ToggleContainer.
  7377. !#zh 只读属性,返回 ToggleContainer 管理的 toggle 数组引用 */
  7378. toggleItems: Toggle[];
  7379. }
  7380. /** !#en ToggleGroup is not a visiable UI component but a way to modify the behavior of a set of Toggles.
  7381. Toggles that belong to the same group could only have one of them to be switched on at a time.
  7382. !#zh ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,
  7383. 任何时候只能有一个 Toggle 处于选中状态。 */
  7384. export class ToggleGroup extends Component {
  7385. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  7386. If it is false, it will make sure there is always only one toggle could be switched on
  7387. and the already switched on toggle can't be switched off.
  7388. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  7389. allowSwitchOff: boolean;
  7390. /** !#en Read only property, return the toggle items array reference managed by toggleGroup.
  7391. !#zh 只读属性,返回 toggleGroup 管理的 toggle 数组引用 */
  7392. toggleItems: any[];
  7393. }
  7394. /** !#en
  7395. Handling touch events in a ViewGroup takes special care,
  7396. because it's common for a ViewGroup to have children that are targets for different touch events than the ViewGroup itself.
  7397. To make sure that each view correctly receives the touch events intended for it,
  7398. ViewGroup should register capture phase event and handle the event propagation properly.
  7399. Please refer to Scrollview for more information.
  7400. !#zh
  7401. ViewGroup的事件处理比较特殊,因为 ViewGroup 里面的子节点关心的事件跟 ViewGroup 本身可能不一样。
  7402. 为了让子节点能够正确地处理事件,ViewGroup 需要注册 capture 阶段的事件,并且合理地处理 ViewGroup 之间的事件传递。
  7403. 请参考 ScrollView 的实现来获取更多信息。 */
  7404. export class ViewGroup extends Component {
  7405. }
  7406. /** !#en
  7407. Stores and manipulate the anchoring based on its parent.
  7408. Widget are used for GUI but can also be used for other things.
  7409. 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.
  7410. !#zh
  7411. Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。
  7412. Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}}。 */
  7413. export class Widget extends Component {
  7414. /** !#en Specifies an alignment target that can only be one of the parent nodes of the current node.
  7415. The default value is null, and when null, indicates the current parent.
  7416. !#zh 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。 */
  7417. target: Node;
  7418. /** !#en Whether to align the top.
  7419. !#zh 是否对齐上边。 */
  7420. isAlignTop: boolean;
  7421. /** !#en
  7422. Vertically aligns the midpoint, This will open the other vertical alignment options cancel.
  7423. !#zh
  7424. 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。 */
  7425. isAlignVerticalCenter: boolean;
  7426. /** !#en Whether to align the bottom.
  7427. !#zh 是否对齐下边。 */
  7428. isAlignBottom: boolean;
  7429. /** !#en Whether to align the left.
  7430. !#zh 是否对齐左边 */
  7431. isAlignLeft: boolean;
  7432. /** !#en
  7433. Horizontal aligns the midpoint. This will open the other horizontal alignment options canceled.
  7434. !#zh
  7435. 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。 */
  7436. isAlignHorizontalCenter: boolean;
  7437. /** !#en Whether to align the right.
  7438. !#zh 是否对齐右边。 */
  7439. isAlignRight: boolean;
  7440. /** !#en
  7441. Whether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,
  7442. the width setting is invalid (read only).
  7443. !#zh
  7444. 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸,此时节点的宽度只读。 */
  7445. isStretchWidth: boolean;
  7446. /** !#en
  7447. Whether the stretched vertically, when enable the left and right alignment will be stretched vertically,
  7448. then height setting is invalid (read only)
  7449. !#zh
  7450. 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度只读。 */
  7451. isStretchHeight: boolean;
  7452. /** !#en
  7453. The margins between the top of this node and the top of parent node,
  7454. the value can be negative, Only available in 'isAlignTop' open.
  7455. !#zh
  7456. 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。 */
  7457. top: number;
  7458. /** !#en
  7459. The margins between the bottom of this node and the bottom of parent node,
  7460. the value can be negative, Only available in 'isAlignBottom' open.
  7461. !#zh
  7462. 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。 */
  7463. bottom: number;
  7464. /** !#en
  7465. The margins between the left of this node and the left of parent node,
  7466. the value can be negative, Only available in 'isAlignLeft' open.
  7467. !#zh
  7468. 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。 */
  7469. left: number;
  7470. /** !#en
  7471. The margins between the right of this node and the right of parent node,
  7472. the value can be negative, Only available in 'isAlignRight' open.
  7473. !#zh
  7474. 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。 */
  7475. right: number;
  7476. /** !#en
  7477. Horizontal aligns the midpoint offset value,
  7478. the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  7479. !#zh 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。 */
  7480. horizontalCenter: number;
  7481. /** !#en
  7482. Vertical aligns the midpoint offset value,
  7483. the value can be negative, Only available in 'isAlignVerticalCenter' open.
  7484. !#zh 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。 */
  7485. verticalCenter: number;
  7486. /** !#en If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  7487. !#zh 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  7488. isAbsoluteHorizontalCenter: boolean;
  7489. /** !#en If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  7490. !#zh 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  7491. isAbsoluteVerticalCenter: boolean;
  7492. /** !#en
  7493. If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  7494. !#zh
  7495. 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  7496. isAbsoluteTop: boolean;
  7497. /** !#en
  7498. If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  7499. !#zh
  7500. 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  7501. isAbsoluteBottom: boolean;
  7502. /** !#en
  7503. If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  7504. !#zh
  7505. 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  7506. isAbsoluteLeft: boolean;
  7507. /** !#en
  7508. If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  7509. !#zh
  7510. 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  7511. isAbsoluteRight: boolean;
  7512. /** !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  7513. !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 */
  7514. alignMode: Widget.AlignMode;
  7515. /**
  7516. !#en
  7517. Immediately perform the widget alignment. You need to manually call this method only if
  7518. you need to get the latest results after the alignment before the end of current frame.
  7519. !#zh
  7520. 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  7521. 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  7522. @example
  7523. ```js
  7524. widget.top = 10; // change top margin
  7525. cc.log(widget.node.y); // not yet changed
  7526. widget.updateAlignment();
  7527. cc.log(widget.node.y); // changed
  7528. ```
  7529. */
  7530. updateAlignment(): void;
  7531. /** !#en
  7532. When turned on, it will only be aligned once at the end of the onEnable frame,
  7533. then immediately disables the current component.
  7534. This will allow the script or animation to continue controlling the current node.
  7535. Note: It will still be aligned at the frame when onEnable is called.
  7536. !#zh
  7537. 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。
  7538. 这样便于脚本或动画继续控制当前节点。
  7539. 注意:onEnable 时所在的那一帧仍然会进行对齐。 */
  7540. isAlignOnce: boolean;
  7541. }
  7542. /** !#en WXSubContextView is a view component which controls open data context viewport in Wechat game platform.<br/>
  7543. The component's node size decide the viewport of the sub context content in main context,
  7544. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  7545. This component provides multiple important features:<br/>
  7546. 1. Sub context could use its own resolution size and policy.<br/>
  7547. 2. Sub context could be minized to smallest size it needed.<br/>
  7548. 3. Resolution of sub context content could be increased.<br/>
  7549. 4. User touch input is transformed to the correct viewport.<br/>
  7550. 5. Texture update is handled by this component. User don't need to worry.<br/>
  7551. One important thing to be noted, whenever the node's bounding box change,
  7552. you need to manually reset the viewport of sub context using updateSubContextViewport.
  7553. !#zh WXSubContextView 可以用来控制微信小游戏平台开放数据域在主域中的视窗的位置。<br/>
  7554. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  7555. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  7556. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  7557. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  7558. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  7559. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  7560. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  7561. 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。 */
  7562. export class WXSubContextView extends Component {
  7563. /**
  7564. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  7565. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  7566. */
  7567. updateSubContextViewport(): void;
  7568. }
  7569. /** Loader for resource loading process. It's a singleton object. */
  7570. export class loader extends Pipeline {
  7571. /** The asset loader in cc.loader's pipeline, it's by default the first pipe.
  7572. It's used to identify an asset's type, and determine how to download it. */
  7573. static assetLoader: any;
  7574. /** The md5 pipe in cc.loader's pipeline, it could be absent if the project isn't build with md5 option.
  7575. It's used to modify the url to the real downloadable url with md5 suffix. */
  7576. static md5Pipe: any;
  7577. /** The downloader in cc.loader's pipeline, it's by default the second pipe.
  7578. It's used to download files with several handlers: pure text, image, script, audio, font, uuid.
  7579. You can add your own download function with addDownloadHandlers */
  7580. static downloader: any;
  7581. /** The loader in cc.loader's pipeline, it's by default the third pipe.
  7582. It's used to parse downloaded content with several handlers: JSON, image, plist, fnt, uuid.
  7583. You can add your own download function with addLoadHandlers */
  7584. static loader: any;
  7585. /**
  7586. Gets a new XMLHttpRequest instance.
  7587. */
  7588. static getXMLHttpRequest(): XMLHttpRequest;
  7589. /**
  7590. Add custom supported types handler or modify existing type handler for download process.
  7591. @param extMap Custom supported types with corresponded handler
  7592. @example
  7593. ```js
  7594. cc.loader.addDownloadHandlers({
  7595. // This will match all url with `.scene` extension or all url with `scene` type
  7596. 'scene' : function (url, callback) {}
  7597. });
  7598. ```
  7599. */
  7600. static addDownloadHandlers(extMap: any): void;
  7601. /**
  7602. Add custom supported types handler or modify existing type handler for load process.
  7603. @param extMap Custom supported types with corresponded handler
  7604. @example
  7605. ```js
  7606. cc.loader.addLoadHandlers({
  7607. // This will match all url with `.scene` extension or all url with `scene` type
  7608. 'scene' : function (url, callback) {}
  7609. });
  7610. ```
  7611. */
  7612. static addLoadHandlers(extMap: any): void;
  7613. /**
  7614. Load resources with a progression callback and a complete callback.
  7615. The progression callback is the same as Pipeline's {{#crossLink "LoadingItems/onProgress:method"}}onProgress{{/crossLink}}
  7616. The complete callback is almost the same as Pipeline's {{#crossLink "LoadingItems/onComplete:method"}}onComplete{{/crossLink}}
  7617. The only difference is when user pass a single url as resources, the complete callback will set its result directly as the second parameter.
  7618. @param resources Url list in an array
  7619. @param progressCallback Callback invoked when progression change
  7620. @param completeCallback Callback invoked when all resources loaded
  7621. @example
  7622. ```js
  7623. cc.loader.load('a.png', function (err, tex) {
  7624. cc.log('Result should be a texture: ' + (tex instanceof cc.Texture2D));
  7625. });
  7626. cc.loader.load('http://example.com/a.png', function (err, tex) {
  7627. cc.log('Should load a texture from external url: ' + (tex instanceof cc.Texture2D));
  7628. });
  7629. cc.loader.load({url: 'http://example.com/getImageREST?file=a.png', type: 'png'}, function (err, tex) {
  7630. cc.log('Should load a texture from RESTful API by specify the type: ' + (tex instanceof cc.Texture2D));
  7631. });
  7632. cc.loader.load(['a.png', 'b.json'], function (errors, results) {
  7633. if (errors) {
  7634. for (var i = 0; i < errors.length; i++) {
  7635. cc.log('Error url [' + errors[i] + ']: ' + results.getError(errors[i]));
  7636. }
  7637. }
  7638. var aTex = results.getContent('a.png');
  7639. var bJsonObj = results.getContent('b.json');
  7640. });
  7641. ```
  7642. */
  7643. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, completeCallback?: Function): void;
  7644. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: Function|null): void;
  7645. /**
  7646. Load resources from the "resources" folder inside the "assets" folder of your project.<br>
  7647. <br>
  7648. Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  7649. @param url Url of the target resource.
  7650. The url is relative to the "resources" folder, extensions must be omitted.
  7651. @param type Only asset of type will be loaded if this argument is supplied.
  7652. @param progressCallback Callback invoked when progression change.
  7653. @param completeCallback Callback invoked when the resource loaded.
  7654. @example
  7655. ```js
  7656. // load the prefab (project/assets/resources/misc/character/cocos) from resources folder
  7657. cc.loader.loadRes('misc/character/cocos', function (err, prefab) {
  7658. if (err) {
  7659. cc.error(err.message || err);
  7660. return;
  7661. }
  7662. cc.log('Result should be a prefab: ' + (prefab instanceof cc.Prefab));
  7663. });
  7664. // load the sprite frame of (project/assets/resources/imgs/cocos.png) from resources folder
  7665. cc.loader.loadRes('imgs/cocos', cc.SpriteFrame, function (err, spriteFrame) {
  7666. if (err) {
  7667. cc.error(err.message || err);
  7668. return;
  7669. }
  7670. cc.log('Result should be a sprite frame: ' + (spriteFrame instanceof cc.SpriteFrame));
  7671. });
  7672. ```
  7673. */
  7674. static loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  7675. static loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void;
  7676. static loadRes(url: string, type: typeof cc.Asset): void;
  7677. static loadRes(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  7678. static loadRes(url: string, completeCallback: (error: Error, resource: any) => void): void;
  7679. static loadRes(url: string): void;
  7680. /**
  7681. This method is like {{#crossLink "loader/loadRes:method"}}{{/crossLink}} except that it accepts array of url.
  7682. @param urls Array of URLs of the target resource.
  7683. The url is relative to the "resources" folder, extensions must be omitted.
  7684. @param type Only asset of type will be loaded if this argument is supplied.
  7685. @param progressCallback Callback invoked when progression change.
  7686. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  7687. @example
  7688. ```js
  7689. // load the SpriteFrames from resources folder
  7690. var spriteFrames;
  7691. var urls = ['misc/characters/character_01', 'misc/weapons/weapons_01'];
  7692. cc.loader.loadResArray(urls, cc.SpriteFrame, function (err, assets) {
  7693. if (err) {
  7694. cc.error(err);
  7695. return;
  7696. }
  7697. spriteFrames = assets;
  7698. // ...
  7699. });
  7700. ```
  7701. */
  7702. static loadResArray(url: string[], type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  7703. static loadResArray(url: string[], type: typeof cc.Asset, completeCallback: (error: Error, resource: any[]) => void): void;
  7704. static loadResArray(url: string[], type: typeof cc.Asset): void;
  7705. static loadResArray(url: string[], progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  7706. static loadResArray(url: string[], completeCallback: (error: Error, resource: any[]) => void): void;
  7707. static loadResArray(url: string[]): void;
  7708. static loadResArray(url: string[], type: typeof cc.Asset[]): void;
  7709. /**
  7710. Load all assets in a folder inside the "assets/resources" folder of your project.<br>
  7711. <br>
  7712. Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  7713. @param url Url of the target folder.
  7714. The url is relative to the "resources" folder, extensions must be omitted.
  7715. @param type Only asset of type will be loaded if this argument is supplied.
  7716. @param progressCallback Callback invoked when progression change.
  7717. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  7718. @example
  7719. ```js
  7720. // load the texture (resources/imgs/cocos.png) and the corresponding sprite frame
  7721. cc.loader.loadResDir('imgs/cocos', function (err, assets) {
  7722. if (err) {
  7723. cc.error(err);
  7724. return;
  7725. }
  7726. var texture = assets[0];
  7727. var spriteFrame = assets[1];
  7728. });
  7729. // load all textures in "resources/imgs/"
  7730. cc.loader.loadResDir('imgs', cc.Texture2D, function (err, textures) {
  7731. var texture1 = textures[0];
  7732. var texture2 = textures[1];
  7733. });
  7734. // load all JSONs in "resources/data/"
  7735. cc.loader.loadResDir('data', function (err, objects, urls) {
  7736. var data = objects[0];
  7737. var url = urls[0];
  7738. });
  7739. ```
  7740. */
  7741. 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;
  7742. static loadResDir(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  7743. static loadResDir(url: string, type: typeof cc.Asset): void;
  7744. static loadResDir(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  7745. static loadResDir(url: string, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  7746. static loadResDir(url: string): void;
  7747. /**
  7748. Get resource data by id. <br>
  7749. When you load resources with {{#crossLink "loader/load:method"}}{{/crossLink}} or {{#crossLink "loader/loadRes:method"}}{{/crossLink}},
  7750. the url will be the unique identity of the resource.
  7751. After loaded, you can acquire them by passing the url to this API.
  7752. @param url url
  7753. @param type Only asset of type will be returned if this argument is supplied.
  7754. */
  7755. static getRes(url: string, type?: Function): any;
  7756. /**
  7757. !#en
  7758. Get all resource dependencies of the loaded asset in an array, including itself.
  7759. The owner parameter accept the following types: 1. The asset itself; 2. The resource url; 3. The asset's uuid.<br>
  7760. The returned array stores the dependencies with their uuids, after retrieve dependencies,
  7761. you can release them, access dependent assets by passing the uuid to {{#crossLink "loader/getRes:method"}}{{/crossLink}}, or other stuffs you want.<br>
  7762. For release all dependencies of an asset, please refer to {{#crossLink "loader/release:method"}}{{/crossLink}}
  7763. Here is some examples:
  7764. !#zh
  7765. 获取某个已经加载好的资源的所有依赖资源,包含它自身,并保存在数组中返回。owner 参数接收以下几种类型:1. 资源 asset 对象;2. 资源目录下的 url;3. 资源的 uuid。<br>
  7766. 返回的数组将仅保存依赖资源的 uuid,获取这些 uuid 后,你可以从 loader 释放这些资源;通过 {{#crossLink "loader/getRes:method"}}{{/crossLink}} 获取某个资源或者进行其他你需要的操作。<br>
  7767. 想要释放一个资源及其依赖资源,可以参考 {{#crossLink "loader/release:method"}}{{/crossLink}}。下面是一些示例代码:
  7768. @param owner The owner asset or the resource url or the asset's uuid
  7769. @example
  7770. ```js
  7771. // Release all dependencies of a loaded prefab
  7772. var deps = cc.loader.getDependsRecursively(prefab);
  7773. cc.loader.release(deps);
  7774. // Retrieve all dependent textures
  7775. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  7776. var textures = [];
  7777. for (var i = 0; i < deps.length; ++i) {
  7778. var item = cc.loader.getRes(deps[i]);
  7779. if (item instanceof cc.Texture2D) {
  7780. textures.push(item);
  7781. }
  7782. }
  7783. ```
  7784. */
  7785. static getDependsRecursively(owner: Asset|RawAsset|string): any[];
  7786. /**
  7787. !#en
  7788. Release the content of an asset or an array of assets by uuid.
  7789. Start from v1.3, this method will not only remove the cache of the asset in loader, but also clean up its content.
  7790. For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  7791. In complexe project, you can use this function with {{#crossLink "loader/getDependsRecursively:method"}}{{/crossLink}} to free up memory in critical circumstances.
  7792. 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.
  7793. If you only want to remove the cache of an asset, please use {{#crossLink "pipeline/removeItem:method"}}{{/crossLink}}
  7794. !#zh
  7795. 通过 id(通常是资源 url)来释放一个资源或者一个资源数组。
  7796. 从 v1.3 开始,这个方法不仅会从 loader 中删除资源的缓存引用,还会清理它的资源内容。
  7797. 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  7798. 在复杂项目中,我们建议你结合 {{#crossLink "loader/getDependsRecursively:method"}}{{/crossLink}} 来使用,便于在设备内存告急的情况下更快地释放不再需要的资源的内存。
  7799. 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  7800. 如果你只想删除一个资源的缓存引用,请使用 {{#crossLink "pipeline/removeItem:method"}}{{/crossLink}}
  7801. @param asset asset
  7802. @example
  7803. ```js
  7804. // Release a texture which is no longer need
  7805. cc.loader.release(texture);
  7806. // Release all dependencies of a loaded prefab
  7807. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  7808. cc.loader.release(deps);
  7809. // 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.
  7810. // If you have some other nodes share a texture in this prefab, you can skip it in two ways:
  7811. // 1. Forbid auto release a texture before release
  7812. cc.loader.setAutoRelease(texture2d, false);
  7813. // 2. Remove it from the dependencies array
  7814. var deps = cc.loader.getDependsRecursively('prefabs/sample');
  7815. var index = deps.indexOf(texture2d._uuid);
  7816. if (index !== -1)
  7817. deps.splice(index, 1);
  7818. cc.loader.release(deps);
  7819. ```
  7820. */
  7821. static release(asset: Asset|RawAsset|string|any[]): void;
  7822. /**
  7823. !#en Release the asset by its object. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  7824. !#zh 通过资源对象自身来释放资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  7825. @param asset asset
  7826. */
  7827. static releaseAsset(asset: Asset): void;
  7828. /**
  7829. !#en Release the asset loaded by {{#crossLink "loader/loadRes:method"}}{{/crossLink}}. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  7830. !#zh 释放通过 {{#crossLink "loader/loadRes:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  7831. @param url url
  7832. @param type Only asset of type will be released if this argument is supplied.
  7833. */
  7834. static releaseRes(url: string, type?: Function): void;
  7835. /**
  7836. !#en Release the all assets loaded by {{#crossLink "loader/loadResDir:method"}}{{/crossLink}}. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  7837. !#zh 释放通过 {{#crossLink "loader/loadResDir:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  7838. @param url url
  7839. @param type Only asset of type will be released if this argument is supplied.
  7840. */
  7841. static releaseResDir(url: string, type?: Function): void;
  7842. /**
  7843. !#en Resource all assets. Refer to {{#crossLink "loader/release:method"}}{{/crossLink}} for detailed informations.
  7844. !#zh 释放所有资源。详细信息请参考 {{#crossLink "loader/release:method"}}{{/crossLink}}
  7845. */
  7846. static releaseAll(): void;
  7847. /**
  7848. !#en
  7849. Indicates whether to release the asset when loading a new scene.<br>
  7850. By default, when loading a new scene, all assets in the previous scene will be released or preserved
  7851. according to whether the previous scene checked the "Auto Release Assets" option.
  7852. On the other hand, assets dynamically loaded by using `cc.loader.loadRes` or `cc.loader.loadResDir`
  7853. will not be affected by that option, remain not released by default.<br>
  7854. Use this API to change the default behavior on a single asset, to force preserve or release specified asset when scene switching.<br>
  7855. <br>
  7856. See: {{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}, {{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  7857. !#zh
  7858. 设置当场景切换时是否自动释放资源。<br>
  7859. 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。
  7860. 而使用 `cc.loader.loadRes` 或 `cc.loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  7861. 使用这个 API 可以在单个资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  7862. <br>
  7863. 参考:{{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}},{{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  7864. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  7865. @param autoRelease indicates whether should release automatically
  7866. @example
  7867. ```js
  7868. // auto release the texture event if "Auto Release Assets" disabled in current scene
  7869. cc.loader.setAutoRelease(texture2d, true);
  7870. // don't release the texture even if "Auto Release Assets" enabled in current scene
  7871. cc.loader.setAutoRelease(texture2d, false);
  7872. // first parameter can be url
  7873. cc.loader.setAutoRelease(audioUrl, false);
  7874. ```
  7875. */
  7876. static setAutoRelease(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  7877. /**
  7878. !#en
  7879. Indicates whether to release the asset and its referenced other assets when loading a new scene.<br>
  7880. By default, when loading a new scene, all assets in the previous scene will be released or preserved
  7881. according to whether the previous scene checked the "Auto Release Assets" option.
  7882. On the other hand, assets dynamically loaded by using `cc.loader.loadRes` or `cc.loader.loadResDir`
  7883. will not be affected by that option, remain not released by default.<br>
  7884. 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>
  7885. <br>
  7886. See: {{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}}, {{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  7887. !#zh
  7888. 设置当场景切换时是否自动释放资源及资源引用的其它资源。<br>
  7889. 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。
  7890. 而使用 `cc.loader.loadRes` 或 `cc.loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  7891. 使用这个 API 可以在指定资源及资源递归引用到的所有资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  7892. <br>
  7893. 参考:{{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}},{{#crossLink "loader/isAutoRelease:method"}}cc.loader.isAutoRelease{{/crossLink}}
  7894. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  7895. @param autoRelease indicates whether should release automatically
  7896. @example
  7897. ```js
  7898. // auto release the SpriteFrame and its Texture event if "Auto Release Assets" disabled in current scene
  7899. cc.loader.setAutoReleaseRecursively(spriteFrame, true);
  7900. // don't release the SpriteFrame and its Texture even if "Auto Release Assets" enabled in current scene
  7901. cc.loader.setAutoReleaseRecursively(spriteFrame, false);
  7902. // don't release the Prefab and all the referenced assets
  7903. cc.loader.setAutoReleaseRecursively(prefab, false);
  7904. ```
  7905. */
  7906. static setAutoReleaseRecursively(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  7907. /**
  7908. !#en
  7909. Returns whether the asset is configured as auto released, despite how "Auto Release Assets" property is set on scene asset.<br>
  7910. <br>
  7911. See: {{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}}, {{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}
  7912. !#zh
  7913. 返回指定的资源是否有被设置为自动释放,不论场景的“Auto Release Assets”如何设置。<br>
  7914. <br>
  7915. 参考:{{#crossLink "loader/setAutoRelease:method"}}cc.loader.setAutoRelease{{/crossLink}},{{#crossLink "loader/setAutoReleaseRecursively:method"}}cc.loader.setAutoReleaseRecursively{{/crossLink}}
  7916. @param assetOrUrl asset object or the raw asset's url
  7917. */
  7918. static isAutoRelease(assetOrUrl: Asset|string): boolean;
  7919. }
  7920. /** !#en
  7921. LoadingItems is the queue of items which can flow them into the loading pipeline.<br/>
  7922. 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/>
  7923. It hold a map of items, each entry in the map is a url to object key value pair.<br/>
  7924. Each item always contains the following property:<br/>
  7925. - id: The identification of the item, usually it's identical to url<br/>
  7926. - url: The url <br/>
  7927. - type: The type, it's the extension name of the url by default, could be specified manually too.<br/>
  7928. - error: The error happened in pipeline will be stored in this property.<br/>
  7929. - content: The content processed by the pipeline, the final result will also be stored in this property.<br/>
  7930. - complete: The flag indicate whether the item is completed by the pipeline.<br/>
  7931. - 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/>
  7932. <br/>
  7933. Item can hold other custom properties.<br/>
  7934. Each LoadingItems object will be destroyed for recycle after onComplete callback<br/>
  7935. So please don't hold its reference for later usage, you can copy properties in it though.
  7936. !#zh
  7937. LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。<br/>
  7938. 请不要直接使用 new 构造这个类的对象,你可以使用 {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} 来创建一个新的加载队列,这样可以允许我们的内部对象池回收并重利用加载队列。
  7939. 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。<br/>
  7940. 每个对象都会包含下列属性:<br/>
  7941. - id:该对象的标识,通常与 url 相同。<br/>
  7942. - url:路径 <br/>
  7943. - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。<br/>
  7944. - error:pipeline 中发生的错误将被保存在这个属性中。<br/>
  7945. - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。<br/>
  7946. - complete:该标志表明该对象是否通过 pipeline 完成。<br/>
  7947. - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE<br/>
  7948. <br/>
  7949. 对象可容纳其他自定义属性。<br/>
  7950. 每个 LoadingItems 对象都会在 onComplete 回调之后被销毁,所以请不要持有它的引用并在结束回调之后依赖它的内容执行任何逻辑,有这种需求的话你可以提前复制它的内容。 */
  7951. export class LoadingItems extends CallbacksInvoker {
  7952. /**
  7953. !#en This is a callback which will be invoked while an item flow out the pipeline.
  7954. You can pass the callback function in LoadingItems.create or set it later.
  7955. !#zh 这个回调函数将在 item 加载结束后被调用。你可以在构造时传递这个回调函数或者是在构造之后直接设置。
  7956. @param completedCount The number of the items that are already completed.
  7957. @param totalCount The total number of the items.
  7958. @param item The latest item which flow out the pipeline.
  7959. @example
  7960. ```js
  7961. loadingItems.onProgress = function (completedCount, totalCount, item) {
  7962. var progress = (100 * completedCount / totalCount).toFixed(2);
  7963. cc.log(progress + '%');
  7964. }
  7965. ```
  7966. */
  7967. onProgress(completedCount: number, totalCount: number, item: any): void;
  7968. /**
  7969. !#en This is a callback which will be invoked while all items is completed,
  7970. You can pass the callback function in LoadingItems.create or set it later.
  7971. !#zh 该函数将在加载队列全部完成时被调用。你可以在构造时传递这个回调函数或者是在构造之后直接设置。
  7972. @param errors All errored urls will be stored in this array, if no error happened, then it will be null
  7973. @param items All items.
  7974. @example
  7975. ```js
  7976. loadingItems.onComplete = function (errors, items) {
  7977. if (error)
  7978. cc.log('Completed with ' + errors.length + ' errors');
  7979. else
  7980. cc.log('Completed ' + items.totalCount + ' items');
  7981. }
  7982. ```
  7983. */
  7984. onComplete(errors: any[], items: LoadingItems): void;
  7985. /** !#en The map of all items.
  7986. !#zh 存储所有加载项的对象。 */
  7987. map: any;
  7988. /** !#en The map of completed items.
  7989. !#zh 存储已经完成的加载项。 */
  7990. completed: any;
  7991. /** !#en Total count of all items.
  7992. !#zh 所有加载项的总数。 */
  7993. totalCount: number;
  7994. /** !#en Total count of completed items.
  7995. !#zh 所有完成加载项的总数。 */
  7996. completedCount: number;
  7997. /** !#en Activated or not.
  7998. !#zh 是否启用。 */
  7999. active: boolean;
  8000. /**
  8001. !#en The constructor function of LoadingItems, this will use recycled LoadingItems in the internal pool if possible.
  8002. You can pass onProgress and onComplete callbacks to visualize the loading process.
  8003. !#zh LoadingItems 的构造函数,这种构造方式会重用内部对象缓冲池中的 LoadingItems 队列,以尽量避免对象创建。
  8004. 你可以传递 onProgress 和 onComplete 回调函数来获知加载进度信息。
  8005. @param pipeline The pipeline to process the queue.
  8006. @param urlList The items array.
  8007. @param onProgress The progression callback, refer to {{#crossLink "LoadingItems.onProgress"}}{{/crossLink}}
  8008. @param onComplete The completion callback, refer to {{#crossLink "LoadingItems.onComplete"}}{{/crossLink}}
  8009. @example
  8010. ```js
  8011. cc.LoadingItems.create(cc.loader, ['a.png', 'b.plist'], function (completedCount, totalCount, item) {
  8012. var progress = (100 * completedCount / totalCount).toFixed(2);
  8013. cc.log(progress + '%');
  8014. }, function (errors, items) {
  8015. if (errors) {
  8016. for (var i = 0; i < errors.length; ++i) {
  8017. cc.log('Error url: ' + errors[i] + ', error: ' + items.getError(errors[i]));
  8018. }
  8019. }
  8020. else {
  8021. var result_a = items.getContent('a.png');
  8022. // ...
  8023. }
  8024. })
  8025. ```
  8026. */
  8027. static create(pipeline: Pipeline, urlList: any[], onProgress: Function, onComplete: Function): LoadingItems;
  8028. /**
  8029. !#en Retrieve the LoadingItems queue object for an item.
  8030. !#zh 通过 item 对象获取它的 LoadingItems 队列。
  8031. @param item The item to query
  8032. */
  8033. static getQueue(item: any): LoadingItems;
  8034. /**
  8035. !#en Complete an item in the LoadingItems queue, please do not call this method unless you know what's happening.
  8036. !#zh 通知 LoadingItems 队列一个 item 对象已完成,请不要调用这个函数,除非你知道自己在做什么。
  8037. @param item The item which has completed
  8038. */
  8039. static itemComplete(item: any): void;
  8040. /**
  8041. !#en Add urls to the LoadingItems queue.
  8042. !#zh 向一个 LoadingItems 队列添加加载项。
  8043. @param urlList The url list to be appended, the url can be object or string
  8044. */
  8045. append(urlList: any[]): any[];
  8046. /**
  8047. !#en Complete a LoadingItems queue, please do not call this method unless you know what's happening.
  8048. !#zh 完成一个 LoadingItems 队列,请不要调用这个函数,除非你知道自己在做什么。
  8049. */
  8050. allComplete(): void;
  8051. /**
  8052. !#en Check whether all items are completed.
  8053. !#zh 检查是否所有加载项都已经完成。
  8054. */
  8055. isCompleted(): boolean;
  8056. /**
  8057. !#en Check whether an item is completed.
  8058. !#zh 通过 id 检查指定加载项是否已经加载完成。
  8059. @param id The item's id.
  8060. */
  8061. isItemCompleted(id: string): boolean;
  8062. /**
  8063. !#en Check whether an item exists.
  8064. !#zh 通过 id 检查加载项是否存在。
  8065. @param id The item's id.
  8066. */
  8067. exists(id: string): boolean;
  8068. /**
  8069. !#en Returns the content of an internal item.
  8070. !#zh 通过 id 获取指定对象的内容。
  8071. @param id The item's id.
  8072. */
  8073. getContent(id: string): any;
  8074. /**
  8075. !#en Returns the error of an internal item.
  8076. !#zh 通过 id 获取指定对象的错误信息。
  8077. @param id The item's id.
  8078. */
  8079. getError(id: string): any;
  8080. /**
  8081. !#en Add a listener for an item, the callback will be invoked when the item is completed.
  8082. !#zh 监听加载项(通过 key 指定)的完成事件。
  8083. @param key key
  8084. @param callback can be null
  8085. @param target can be null
  8086. */
  8087. addListener(key: string, callback: Function, target: any): boolean;
  8088. /**
  8089. !#en
  8090. Check if the specified key has any registered callback.
  8091. If a callback is also specified, it will only return true if the callback is registered.
  8092. !#zh
  8093. 检查指定的加载项是否有完成事件监听器。
  8094. 如果同时还指定了一个回调方法,并且回调有注册,它只会返回 true。
  8095. @param key key
  8096. @param callback callback
  8097. @param target target
  8098. */
  8099. hasListener(key: string, callback?: Function, target?: any): boolean;
  8100. /**
  8101. !#en
  8102. Removes a listener.
  8103. It will only remove when key, callback, target all match correctly.
  8104. !#zh
  8105. 移除指定加载项已经注册的完成事件监听器。
  8106. 只会删除 key, callback, target 均匹配的监听器。
  8107. @param key key
  8108. @param callback callback
  8109. @param target target
  8110. */
  8111. remove(key: string, callback: Function, target: any): boolean;
  8112. /**
  8113. !#en
  8114. Removes all callbacks registered in a certain event
  8115. type or all callbacks registered with a certain target.
  8116. !#zh 删除指定目标的所有完成事件监听器。
  8117. @param key The event key to be removed or the target to be removed
  8118. */
  8119. removeAllListeners(key: string|any): void;
  8120. /**
  8121. !#en Complete an item in the LoadingItems queue, please do not call this method unless you know what's happening.
  8122. !#zh 通知 LoadingItems 队列一个 item 对象已完成,请不要调用这个函数,除非你知道自己在做什么。
  8123. @param id The item url
  8124. */
  8125. itemComplete(id: string): void;
  8126. /**
  8127. !#en Destroy the LoadingItems queue, the queue object won't be garbage collected, it will be recycled, so every after destroy is not reliable.
  8128. !#zh 销毁一个 LoadingItems 队列,这个队列对象会被内部缓冲池回收,所以销毁后的所有内部信息都是不可依赖的。
  8129. */
  8130. destroy(): void;
  8131. }
  8132. /** !#en
  8133. A pipeline describes a sequence of manipulations, each manipulation is called a pipe.<br/>
  8134. 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/>
  8135. A list of items can flow in the pipeline and it will output the results of all pipes.<br/>
  8136. They flow in the pipeline like water in tubes, they go through pipe by pipe separately.<br/>
  8137. Finally all items will flow out the pipeline and the process is finished.
  8138. !#zh
  8139. pipeline 描述了一系列的操作,每个操作都被称为 pipe。<br/>
  8140. 它被设计来做加载过程的流程管理。所以 item 应该是 url,并且该 url 将是在处理中的每个 item 的身份标识。<br/>
  8141. 一个 item 列表可以在 pipeline 中流动,它将输出加载项经过所有 pipe 之后的结果。<br/>
  8142. 它们穿过 pipeline 就像水在管子里流动,将会按顺序流过每个 pipe。<br/>
  8143. 最后当所有加载项都流出 pipeline 时,整个加载流程就结束了。 */
  8144. export class Pipeline {
  8145. /**
  8146. !#en
  8147. Constructor, pass an array of pipes to construct a new Pipeline,
  8148. the pipes will be chained in the given order.<br/>
  8149. A pipe is an object which must contain an `id` in string and a `handle` function,
  8150. the id must be unique in the pipeline.<br/>
  8151. It can also include `async` property to identify whether it's an asynchronous process.
  8152. !#zh
  8153. 构造函数,通过一系列的 pipe 来构造一个新的 pipeline,pipes 将会在给定的顺序中被锁定。<br/>
  8154. 一个 pipe 就是一个对象,它包含了字符串类型的 ‘id’ 和 ‘handle’ 函数,在 pipeline 中 id 必须是唯一的。<br/>
  8155. 它还可以包括 ‘async’ 属性以确定它是否是一个异步过程。
  8156. @param pipes pipes
  8157. @example
  8158. ```js
  8159. var pipeline = new Pipeline([
  8160. {
  8161. id: 'Downloader',
  8162. handle: function (item, callback) {},
  8163. async: true
  8164. },
  8165. {id: 'Parser', handle: function (item) {}, async: false}
  8166. ]);
  8167. ```
  8168. */
  8169. constructor(pipes: any[]);
  8170. /**
  8171. !#en
  8172. Insert a new pipe at the given index of the pipeline. <br/>
  8173. A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.
  8174. !#zh
  8175. 在给定的索引位置插入一个新的 pipe。<br/>
  8176. 一个 pipe 必须包含一个字符串类型的 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。
  8177. @param pipe The pipe to be inserted
  8178. @param index The index to insert
  8179. */
  8180. insertPipe(pipe: any, index: number): void;
  8181. /**
  8182. !en
  8183. Insert a pipe to the end of an existing pipe. The existing pipe must be a valid pipe in the pipeline.
  8184. !zh
  8185. 在当前 pipeline 的一个已知 pipe 后面插入一个新的 pipe。
  8186. @param refPipe An existing pipe in the pipeline.
  8187. @param newPipe The pipe to be inserted.
  8188. */
  8189. insertPipeAfter(refPipe: any, newPipe: any): void;
  8190. /**
  8191. !#en
  8192. Add a new pipe at the end of the pipeline. <br/>
  8193. A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.
  8194. !#zh
  8195. 添加一个新的 pipe 到 pipeline 尾部。 <br/>
  8196. 该 pipe 必须包含一个字符串类型 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。
  8197. @param pipe The pipe to be appended
  8198. */
  8199. appendPipe(pipe: any): void;
  8200. /**
  8201. !#en
  8202. Let new items flow into the pipeline. <br/>
  8203. Each item can be a simple url string or an object,
  8204. if it's an object, it must contain `id` property. <br/>
  8205. You can specify its type by `type` property, by default, the type is the extension name in url. <br/>
  8206. By adding a `skips` property including pipe ids, you can skip these pipe. <br/>
  8207. The object can contain any supplementary property as you want. <br/>
  8208. !#zh
  8209. 让新的 item 流入 pipeline 中。<br/>
  8210. 这里的每个 item 可以是一个简单字符串类型的 url 或者是一个对象,
  8211. 如果它是一个对象的话,他必须要包含 ‘id’ 属性。<br/>
  8212. 你也可以指定它的 ‘type’ 属性类型,默认情况下,该类型是 ‘url’ 的后缀名。<br/>
  8213. 也通过添加一个 包含 ‘skips’ 属性的 item 对象,你就可以跳过 skips 中包含的 pipe。<br/>
  8214. 该对象可以包含任何附加属性。
  8215. @param items items
  8216. @example
  8217. ```js
  8218. pipeline.flowIn([
  8219. 'res/Background.png',
  8220. {
  8221. id: 'res/scene.json',
  8222. type: 'scene',
  8223. name: 'scene',
  8224. skips: ['Downloader']
  8225. }
  8226. ]);
  8227. ```
  8228. */
  8229. flowIn(items: any[]): void;
  8230. /**
  8231. !#en
  8232. Copy the item states from one source item to all destination items. <br/>
  8233. It's quite useful when a pipe generate new items from one source item,<br/>
  8234. then you should flowIn these generated items into pipeline, <br/>
  8235. but you probably want them to skip all pipes the source item already go through,<br/>
  8236. you can achieve it with this API. <br/>
  8237. <br/>
  8238. For example, an unzip pipe will generate more items, but you won't want them to pass unzip or download pipe again.
  8239. !#zh
  8240. 从一个源 item 向所有目标 item 复制它的 pipe 状态,用于避免重复通过部分 pipe。<br/>
  8241. 当一个源 item 生成了一系列新的 items 时很有用,<br/>
  8242. 你希望让这些新的依赖项进入 pipeline,但是又不希望它们通过源 item 已经经过的 pipe,<br/>
  8243. 但是你可能希望他们源 item 已经通过并跳过所有 pipes,<br/>
  8244. 这个时候就可以使用这个 API。
  8245. @param srcItem The source item
  8246. @param dstItems A single destination item or an array of destination items
  8247. */
  8248. copyItemStates(srcItem: any, dstItems: any[]|any): void;
  8249. /**
  8250. !#en Returns an item in pipeline.
  8251. !#zh 根据 id 获取一个 item
  8252. @param id The id of the item
  8253. */
  8254. getItem(id: any): any;
  8255. /**
  8256. !#en Removes an completed item in pipeline.
  8257. It will only remove the cache in the pipeline or loader, its dependencies won't be released.
  8258. cc.loader provided another method to completely cleanup the resource and its dependencies,
  8259. please refer to {{#crossLink "loader/release:method"}}cc.loader.release{{/crossLink}}
  8260. !#zh 移除指定的已完成 item。
  8261. 这将仅仅从 pipeline 或者 loader 中删除其缓存,并不会释放它所依赖的资源。
  8262. cc.loader 中提供了另一种删除资源及其依赖的清理方法,请参考 {{#crossLink "loader/release:method"}}cc.loader.release{{/crossLink}}
  8263. @param id The id of the item
  8264. */
  8265. removeItem(id: any): boolean;
  8266. /**
  8267. !#en Clear the current pipeline, this function will clean up the items.
  8268. !#zh 清空当前 pipeline,该函数将清理 items。
  8269. */
  8270. clear(): void;
  8271. }
  8272. /** !#en The touch event class
  8273. !#zh 封装了触摸相关的信息。 */
  8274. export class Touch {
  8275. /**
  8276. !#en Returns the current touch location in OpenGL coordinates.、
  8277. !#zh 获取当前触点位置。
  8278. */
  8279. getLocation(): Vec2;
  8280. /**
  8281. !#en Returns X axis location value.
  8282. !#zh 获取当前触点 X 轴位置。
  8283. */
  8284. getLocationX(): number;
  8285. /**
  8286. !#en Returns Y axis location value.
  8287. !#zh 获取当前触点 Y 轴位置。
  8288. */
  8289. getLocationY(): number;
  8290. /**
  8291. !#en Returns the previous touch location in OpenGL coordinates.
  8292. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  8293. */
  8294. getPreviousLocation(): Vec2;
  8295. /**
  8296. !#en Returns the start touch location in OpenGL coordinates.
  8297. !#zh 获获取触点落下时的位置对象,对象包含 x 和 y 属性。
  8298. */
  8299. getStartLocation(): Vec2;
  8300. /**
  8301. !#en Returns the delta distance from the previous touche to the current one in screen coordinates.
  8302. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  8303. */
  8304. getDelta(): Vec2;
  8305. /**
  8306. !#en Returns the current touch location in screen coordinates.
  8307. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  8308. */
  8309. getLocationInView(): Vec2;
  8310. /**
  8311. !#en Returns the previous touch location in screen coordinates.
  8312. !#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  8313. */
  8314. getPreviousLocationInView(): Vec2;
  8315. /**
  8316. !#en Returns the start touch location in screen coordinates.
  8317. !#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  8318. */
  8319. getStartLocationInView(): Vec2;
  8320. /**
  8321. !#en Returns the id of cc.Touch.
  8322. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  8323. */
  8324. getID(): number;
  8325. /**
  8326. !#en Sets information to touch.
  8327. !#zh 设置触摸相关的信息。用于监控触摸事件。
  8328. @param id id
  8329. @param x x
  8330. @param y y
  8331. */
  8332. setTouchInfo(id: number, x: number, y: number): void;
  8333. }
  8334. /** !#en The renderer object which provide access to render system APIs,
  8335. detailed APIs will be available progressively.
  8336. !#zh 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户 */
  8337. export class renderer {
  8338. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  8339. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  8340. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  8341. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  8342. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  8343. static renderEngine: any;
  8344. /** !#en The total draw call count in last rendered frame.
  8345. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  8346. static drawCalls: number;
  8347. }
  8348. /** undefined */
  8349. export class WorldManifold {
  8350. /** !#en
  8351. world contact point (point of intersection)
  8352. !#zh
  8353. 碰撞点集合 */
  8354. points: [Vec2];
  8355. /** !#en
  8356. world vector pointing from A to B
  8357. !#zh
  8358. 世界坐标系下由 A 指向 B 的向量 */
  8359. normal: Vec2;
  8360. }
  8361. /** !#en
  8362. A manifold point is a contact point belonging to a contact manifold.
  8363. It holds details related to the geometry and dynamics of the contact points.
  8364. Note: the impulses are used for internal caching and may not
  8365. provide reliable contact forces, especially for high speed collisions.
  8366. !#zh
  8367. ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  8368. 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。 */
  8369. export class ManifoldPoint {
  8370. /** !#en
  8371. The local point usage depends on the manifold type:
  8372. -e_circles: the local center of circleB
  8373. -e_faceA: the local center of circleB or the clip point of polygonB
  8374. -e_faceB: the clip point of polygonA
  8375. !#zh
  8376. 本地坐标点的用途取决于 manifold 的类型
  8377. - e_circles: circleB 的本地中心点
  8378. - e_faceA: circleB 的本地中心点 或者是 polygonB 的截取点
  8379. - e_faceB: polygonB 的截取点 */
  8380. localPoint: Vec2;
  8381. /** !#en
  8382. Normal impulse.
  8383. !#zh
  8384. 法线冲量。 */
  8385. normalImpulse: number;
  8386. /** !#en
  8387. Tangent impulse.
  8388. !#zh
  8389. 切线冲量。 */
  8390. tangentImpulse: number;
  8391. }
  8392. /** undefined */
  8393. export class Manifold {
  8394. /** !#en
  8395. Manifold type : 0: e_circles, 1: e_faceA, 2: e_faceB
  8396. !#zh
  8397. Manifold 类型 : 0: e_circles, 1: e_faceA, 2: e_faceB */
  8398. type: number;
  8399. /** !#en
  8400. The local point usage depends on the manifold type:
  8401. -e_circles: the local center of circleA
  8402. -e_faceA: the center of faceA
  8403. -e_faceB: the center of faceB
  8404. !#zh
  8405. 用途取决于 manifold 类型
  8406. -e_circles: circleA 的本地中心点
  8407. -e_faceA: faceA 的本地中心点
  8408. -e_faceB: faceB 的本地中心点 */
  8409. localPoint: Vec2;
  8410. /** !#en
  8411. -e_circles: not used
  8412. -e_faceA: the normal on polygonA
  8413. -e_faceB: the normal on polygonB
  8414. !#zh
  8415. -e_circles: 没被使用到
  8416. -e_faceA: polygonA 的法向量
  8417. -e_faceB: polygonB 的法向量 */
  8418. localNormal: Vec2;
  8419. /** !#en
  8420. the points of contact.
  8421. !#zh
  8422. 接触点信息。 */
  8423. points: [ManifoldPoint];
  8424. }
  8425. /** !#en
  8426. Contact impulses for reporting.
  8427. !#zh
  8428. 用于返回给回调的接触冲量。 */
  8429. export class PhysicsImpulse {
  8430. /** !#en
  8431. Normal impulses.
  8432. !#zh
  8433. 法线方向的冲量 */
  8434. normalImpulses: void;
  8435. /** !#en
  8436. Tangent impulses
  8437. !#zh
  8438. 切线方向的冲量 */
  8439. tangentImpulses: void;
  8440. }
  8441. /** !#en
  8442. PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  8443. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  8444. !#zh
  8445. 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  8446. 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。 */
  8447. export class PhysicsContact {
  8448. /**
  8449. !#en
  8450. Get the world manifold.
  8451. !#zh
  8452. 获取世界坐标系下的碰撞信息。
  8453. */
  8454. getWorldManifold(): WorldManifold;
  8455. /**
  8456. !#en
  8457. Get the manifold.
  8458. !#zh
  8459. 获取本地(局部)坐标系下的碰撞信息。
  8460. */
  8461. getManifold(): Manifold;
  8462. /**
  8463. !#en
  8464. Get the impulses.
  8465. Note: PhysicsImpulse can only used in onPostSolve callback.
  8466. !#zh
  8467. 获取冲量信息
  8468. 注意:这个信息只有在 onPostSolve 回调中才能获取到
  8469. */
  8470. getImpulse(): PhysicsImpulse;
  8471. colliderA: Collider;
  8472. colliderB: Collider;
  8473. /** !#en
  8474. If set disabled to true, the contact will be ignored until contact end.
  8475. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  8476. !#zh
  8477. 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  8478. 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。 */
  8479. disabled: boolean;
  8480. /** !#en
  8481. Disabled contact for current time step or sub-step.
  8482. !#zh
  8483. 在当前时间步或子步中忽略此接触。 */
  8484. disabledOnce: boolean;
  8485. /**
  8486. !#en
  8487. Is this contact touching?
  8488. !#zh
  8489. 返回碰撞体是否已经接触到。
  8490. */
  8491. isTouching(): boolean;
  8492. /**
  8493. !#en
  8494. Set the desired tangent speed for a conveyor belt behavior.
  8495. !#zh
  8496. 为传送带设置期望的切线速度
  8497. @param tangentSpeed tangentSpeed
  8498. */
  8499. setTangentSpeed(tangentSpeed: number): void;
  8500. /**
  8501. !#en
  8502. Get the desired tangent speed.
  8503. !#zh
  8504. 获取切线速度
  8505. */
  8506. getTangentSpeed(): number;
  8507. /**
  8508. !#en
  8509. Override the default friction mixture. You can call this in onPreSolve callback.
  8510. !#zh
  8511. 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  8512. @param friction friction
  8513. */
  8514. setFriction(friction: number): void;
  8515. /**
  8516. !#en
  8517. Get the friction.
  8518. !#zh
  8519. 获取当前摩擦力系数
  8520. */
  8521. getFriction(): number;
  8522. /**
  8523. !#en
  8524. Reset the friction mixture to the default value.
  8525. !#zh
  8526. 重置摩擦力系数到默认值
  8527. */
  8528. resetFriction(): void;
  8529. /**
  8530. !#en
  8531. Override the default restitution mixture. You can call this in onPreSolve callback.
  8532. !#zh
  8533. 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  8534. @param restitution restitution
  8535. */
  8536. setRestitution(restitution: number): void;
  8537. /**
  8538. !#en
  8539. Get the restitution.
  8540. !#zh
  8541. 获取当前恢复系数
  8542. */
  8543. getRestitution(): number;
  8544. /**
  8545. !#en
  8546. Reset the restitution mixture to the default value.
  8547. !#zh
  8548. 重置恢复系数到默认值
  8549. */
  8550. resetRestitution(): void;
  8551. }
  8552. /** !#en
  8553. Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node).
  8554. You can visit some common box2d function through physics manager(hit testing, raycast, debug info).
  8555. Physics manager distributes the collision information to each collision callback when collision is produced.
  8556. Note: You need first enable the collision listener in the rigidbody.
  8557. !#zh
  8558. 物理系统将 box2d 作为内部物理系统,并且隐藏了大部分 box2d 实现细节(比如创建刚体,同步刚体信息到节点中等)。
  8559. 你可以通过物理系统访问一些 box2d 常用的功能,比如点击测试,射线测试,设置测试信息等。
  8560. 物理系统还管理碰撞信息的分发,她会在产生碰撞时,将碰撞信息分发到各个碰撞回调中。
  8561. 注意:你需要先在刚体中开启碰撞接听才会产生相应的碰撞回调。 */
  8562. export class PhysicsManager implements EventTarget {
  8563. /** !#en
  8564. The draw bits for drawing physics debug information.
  8565. !#zh
  8566. 指定物理系统需要绘制哪些调试信息。 */
  8567. static DrawBits: DrawBits;
  8568. /** !#en
  8569. The ratio transform between physics unit and pixel unit, generally is 32.
  8570. !#zh
  8571. 物理单位与像素单位互相转换的比率,一般是 32。 */
  8572. static PTM_RATIO: number;
  8573. /** !#en
  8574. The velocity iterations for the velocity constraint solver.
  8575. !#zh
  8576. 速度更新迭代数 */
  8577. static VELOCITY_ITERATIONS: number;
  8578. /** !#en
  8579. The position Iterations for the position constraint solver.
  8580. !#zh
  8581. 位置迭代更新数 */
  8582. static POSITION_ITERATIONS: number;
  8583. /** !#en
  8584. Specify the fixed time step.
  8585. Need enabledAccumulator to make it work.
  8586. !#zh
  8587. 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 */
  8588. static FIXED_TIME_STEP: number;
  8589. /** !#en
  8590. Specify the max accumulator time.
  8591. Need enabledAccumulator to make it work.
  8592. !#zh
  8593. 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 */
  8594. static MAX_ACCUMULATOR: number;
  8595. /** !#en
  8596. If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP.
  8597. And if the update dt is bigger than the time step, then will call step function several times.
  8598. If disabled accumulator, then will call step function with a time step calculated with the frame rate.
  8599. !#zh
  8600. 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。
  8601. 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 */
  8602. enabledAccumulator: boolean;
  8603. /**
  8604. !#en
  8605. Test which collider contains the given world point
  8606. !#zh
  8607. 获取包含给定世界坐标系点的碰撞体
  8608. @param point the world point
  8609. */
  8610. testPoint(point: Vec2): PhysicsCollider;
  8611. /**
  8612. !#en
  8613. Test which colliders intersect the given world rect
  8614. !#zh
  8615. 获取与给定世界坐标系矩形相交的碰撞体
  8616. @param rect the world rect
  8617. */
  8618. testAABB(rect: Rect): [PhysicsCollider];
  8619. /**
  8620. !#en
  8621. Raycast the world for all colliders in the path of the ray.
  8622. The raycast ignores colliders that contain the starting point.
  8623. !#zh
  8624. 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  8625. @param p1 start point of the raycast
  8626. @param p2 end point of the raycast
  8627. @param type optional, default is RayCastType.Closest
  8628. */
  8629. rayCast(p1: Vec2, p2: Vec2, type: RayCastType): [PhysicsRayCastResult];
  8630. /** !#en
  8631. Enabled the physics manager?
  8632. !#zh
  8633. 指定是否启用物理系统? */
  8634. enabled: boolean;
  8635. /** !#en
  8636. Debug draw flags.
  8637. !#zh
  8638. 设置调试绘制标志 */
  8639. debugDrawFlags: number;
  8640. /** !#en
  8641. The physics world gravity.
  8642. !#zh
  8643. 物理世界重力值 */
  8644. gravity: Vec2;
  8645. /**
  8646. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  8647. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  8648. @param type The type of event.
  8649. */
  8650. hasEventListener(type: string): boolean;
  8651. /**
  8652. !#en
  8653. Register an callback of a specific event type on the EventTarget.
  8654. This type of event should be triggered via `emit`.
  8655. !#zh
  8656. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  8657. @param type A string representing the event type to listen for.
  8658. @param callback The callback that will be invoked when the event is dispatched.
  8659. The callback is ignored if it is a duplicate (the callbacks are unique).
  8660. @param target The target (this object) to invoke the callback, can be null
  8661. @example
  8662. ```js
  8663. eventTarget.on('fire', function () {
  8664. cc.log("fire in the hole");
  8665. }, node);
  8666. ```
  8667. */
  8668. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  8669. /**
  8670. !#en
  8671. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  8672. if only type is passed as parameter, all listeners registered with that type will be removed.
  8673. !#zh
  8674. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  8675. @param type A string representing the event type being removed.
  8676. @param callback The callback to remove.
  8677. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  8678. @example
  8679. ```js
  8680. // register fire eventListener
  8681. var callback = eventTarget.on('fire', function () {
  8682. cc.log("fire in the hole");
  8683. }, target);
  8684. // remove fire event listener
  8685. eventTarget.off('fire', callback, target);
  8686. // remove all fire event listeners
  8687. eventTarget.off('fire');
  8688. ```
  8689. */
  8690. off(type: string, callback?: Function, target?: any): void;
  8691. /**
  8692. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  8693. This is not for removing all listeners in the current event target,
  8694. and this is not for removing all listeners the target parameter have registered.
  8695. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  8696. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  8697. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  8698. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  8699. @param target The target to be searched for all related listeners
  8700. */
  8701. targetOff(target: any): void;
  8702. /**
  8703. !#en
  8704. Register an callback of a specific event type on the EventTarget,
  8705. the callback will remove itself after the first time it is triggered.
  8706. !#zh
  8707. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  8708. @param type A string representing the event type to listen for.
  8709. @param callback The callback that will be invoked when the event is dispatched.
  8710. The callback is ignored if it is a duplicate (the callbacks are unique).
  8711. @param target The target (this object) to invoke the callback, can be null
  8712. @example
  8713. ```js
  8714. eventTarget.once('fire', function () {
  8715. cc.log("this is the callback and will be invoked only once");
  8716. }, node);
  8717. ```
  8718. */
  8719. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  8720. /**
  8721. !#en
  8722. Trigger an event directly with the event name and necessary arguments.
  8723. !#zh
  8724. 通过事件名发送自定义事件
  8725. @param type event type
  8726. @param arg1 First argument
  8727. @param arg2 Second argument
  8728. @param arg3 Third argument
  8729. @param arg4 Fourth argument
  8730. @param arg5 Fifth argument
  8731. @example
  8732. ```js
  8733. eventTarget.emit('fire', event);
  8734. eventTarget.emit('fire', message, emitter);
  8735. ```
  8736. */
  8737. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  8738. /**
  8739. !#en
  8740. Send an event with the event object.
  8741. !#zh
  8742. 通过事件对象派发事件
  8743. @param event event
  8744. */
  8745. dispatchEvent(event: Event): void;
  8746. }
  8747. /** undefined */
  8748. export enum DrawBits {
  8749. e_aabbBit = 0,
  8750. e_jointBit = 0,
  8751. e_shapeBit = 0,
  8752. }
  8753. /** undefined */
  8754. export class PhysicsRayCastResult {
  8755. /** !#en
  8756. The PhysicsCollider which intersects with the raycast
  8757. !#zh
  8758. 与射线相交的碰撞体 */
  8759. collider: PhysicsCollider;
  8760. /** !#en
  8761. The intersection point
  8762. !#zh
  8763. 射线与碰撞体相交的点 */
  8764. point: Vec2;
  8765. /** !#en
  8766. The normal vector at the point of intersection
  8767. !#zh
  8768. 射线与碰撞体相交的点的法向量 */
  8769. normal: Vec2;
  8770. /** !#en
  8771. The fraction of the raycast path at the point of intersection
  8772. !#zh
  8773. 射线与碰撞体相交的点占射线长度的分数 */
  8774. fraction: number;
  8775. }
  8776. /** !#en Enum for RigidBodyType.
  8777. !#zh 刚体类型 */
  8778. export enum RigidBodyType {
  8779. Static = 0,
  8780. Kinematic = 0,
  8781. Dynamic = 0,
  8782. Animated = 0,
  8783. }
  8784. /** !#en Enum for RayCastType.
  8785. !#zh 射线检测类型 */
  8786. export enum RayCastType {
  8787. Closest = 0,
  8788. Any = 0,
  8789. AllClosest = 0,
  8790. All = 0,
  8791. }
  8792. /** undefined */
  8793. export class RigidBody extends Component {
  8794. /** !#en
  8795. Should enabled contact listener?
  8796. When a collision is trigger, the collision callback will only be called when enabled contact listener.
  8797. !#zh
  8798. 是否启用接触接听器。
  8799. 当 collider 产生碰撞时,只有开启了接触接听器才会调用相应的回调函数 */
  8800. enabledContactListener: boolean;
  8801. /**
  8802. !#en
  8803. Collision callback.
  8804. Called when two collider begin to touch.
  8805. !#zh
  8806. 碰撞回调。
  8807. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体开始接触时被调用。
  8808. @param contact contact information
  8809. @param selfCollider the collider belong to this rigidbody
  8810. @param otherCollider the collider belong to another rigidbody
  8811. */
  8812. onBeginContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  8813. /**
  8814. !#en
  8815. Collision callback.
  8816. Called when two collider cease to touch.
  8817. !#zh
  8818. 碰撞回调。
  8819. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体停止接触时被调用。
  8820. @param contact contact information
  8821. @param selfCollider the collider belong to this rigidbody
  8822. @param otherCollider the collider belong to another rigidbody
  8823. */
  8824. onEndContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  8825. /**
  8826. !#en
  8827. Collision callback.
  8828. This is called when a contact is updated.
  8829. This allows you to inspect a contact before it goes to the solver(e.g. disable contact).
  8830. Note: this is called only for awake bodies.
  8831. Note: this is called even when the number of contact points is zero.
  8832. Note: this is not called for sensors.
  8833. !#zh
  8834. 碰撞回调。
  8835. 如果你的脚本中实现了这个函数,那么它将会在接触更新时被调用。
  8836. 你可以在接触被处理前根据他包含的信息作出相应的处理,比如将这个接触禁用掉。
  8837. 注意:回调只会为醒着的刚体调用。
  8838. 注意:接触点为零的时候也有可能被调用。
  8839. 注意:感知体(sensor)的回调不会被调用。
  8840. @param contact contact information
  8841. @param selfCollider the collider belong to this rigidbody
  8842. @param otherCollider the collider belong to another rigidbody
  8843. */
  8844. onPreSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  8845. /**
  8846. !#en
  8847. Collision callback.
  8848. This is called after a contact is updated.
  8849. You can get the impulses from the contact in this callback.
  8850. !#zh
  8851. 碰撞回调。
  8852. 如果你的脚本中实现了这个函数,那么它将会在接触更新完后被调用。
  8853. 你可以在这个回调中从接触信息中获取到冲量信息。
  8854. @param contact contact information
  8855. @param selfCollider the collider belong to this rigidbody
  8856. @param otherCollider the collider belong to another rigidbody
  8857. */
  8858. onPostSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  8859. /** !#en
  8860. Is this a fast moving body that should be prevented from tunneling through
  8861. other moving bodies?
  8862. Note :
  8863. - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  8864. - You should use this flag sparingly since it increases processing time.
  8865. !#zh
  8866. 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  8867. 需要注意的是 :
  8868. - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  8869. - 应该尽量少的使用此选项,因为它会增加程序处理时间。 */
  8870. bullet: boolean;
  8871. /** !#en
  8872. Rigidbody type : Static, Kinematic, Dynamic or Animated.
  8873. !#zh
  8874. 刚体类型: Static, Kinematic, Dynamic or Animated. */
  8875. type: RigidBodyType;
  8876. /** !#en
  8877. Set this flag to false if this body should never fall asleep.
  8878. Note that this increases CPU usage.
  8879. !#zh
  8880. 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  8881. 需要注意这将使 CPU 占用率提高。 */
  8882. allowSleep: boolean;
  8883. /** !#en
  8884. Scale the gravity applied to this body.
  8885. !#zh
  8886. 缩放应用在此刚体上的重力值 */
  8887. gravityScale: number;
  8888. /** !#en
  8889. Linear damping is use to reduce the linear velocity.
  8890. The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  8891. time step when the damping parameter is large.
  8892. !#zh
  8893. Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  8894. linearDamping: number;
  8895. /** !#en
  8896. Angular damping is use to reduce the angular velocity. The damping parameter
  8897. can be larger than 1 but the damping effect becomes sensitive to the
  8898. time step when the damping parameter is large.
  8899. !#zh
  8900. Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  8901. angularDamping: number;
  8902. /** !#en
  8903. The linear velocity of the body's origin in world co-ordinates.
  8904. !#zh
  8905. 刚体在世界坐标下的线性速度 */
  8906. linearVelocity: Vec2;
  8907. /** !#en
  8908. The angular velocity of the body.
  8909. !#zh
  8910. 刚体的角速度 */
  8911. angularVelocity: number;
  8912. /** !#en
  8913. Should this body be prevented from rotating?
  8914. !#zh
  8915. 是否禁止此刚体进行旋转 */
  8916. fixedRotation: boolean;
  8917. /** !#en
  8918. Is this body initially awake or sleeping?
  8919. !#zh
  8920. 是否立刻唤醒此刚体 */
  8921. awake: boolean;
  8922. /** !#en
  8923. Set the active state of the body. An inactive body is not
  8924. simulated and cannot be collided with or woken up.
  8925. If body is active, all fixtures will be added to the
  8926. broad-phase.
  8927. If body is inactive, all fixtures will be removed from
  8928. the broad-phase and all contacts will be destroyed.
  8929. Fixtures on an inactive body are implicitly inactive and will
  8930. not participate in collisions, ray-casts, or queries.
  8931. Joints connected to an inactive body are implicitly inactive.
  8932. !#zh
  8933. 设置刚体的激活状态。一个非激活状态下的刚体是不会被模拟和碰撞的,不管它是否处于睡眠状态下。
  8934. 如果刚体处于激活状态下,所有夹具会被添加到 粗测阶段(broad-phase)。
  8935. 如果刚体处于非激活状态下,所有夹具会被从 粗测阶段(broad-phase)中移除。
  8936. 在非激活状态下的夹具不会参与到碰撞,射线,或者查找中
  8937. 链接到非激活状态下刚体的关节也是非激活的。 */
  8938. active: boolean;
  8939. /**
  8940. !#en
  8941. Gets a local point relative to the body's origin given a world point.
  8942. !#zh
  8943. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  8944. @param worldPoint a point in world coordinates.
  8945. @param out optional, the receiving point
  8946. */
  8947. getLocalPoint(worldPoint: Vec2, out: Vec2): Vec2;
  8948. /**
  8949. !#en
  8950. Get the world coordinates of a point given the local coordinates.
  8951. !#zh
  8952. 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点
  8953. @param localPoint a point in local coordinates.
  8954. @param out optional, the receiving point
  8955. */
  8956. getWorldPoint(localPoint: Vec2, out: Vec2): Vec2;
  8957. /**
  8958. !#en
  8959. Get the world coordinates of a vector given the local coordinates.
  8960. !#zh
  8961. 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量
  8962. @param localVector a vector in world coordinates.
  8963. @param out optional, the receiving vector
  8964. */
  8965. getWorldVector(localVector: Vec2, out: Vec2): Vec2;
  8966. /**
  8967. !#en
  8968. Gets a local vector relative to the body's origin given a world vector.
  8969. !#zh
  8970. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  8971. @param worldVector a vector in world coordinates.
  8972. @param out optional, the receiving vector
  8973. */
  8974. getLocalVector(worldVector: Vec2, out: Vec2): Vec2;
  8975. /**
  8976. !#en
  8977. Get the world body origin position.
  8978. !#zh
  8979. 获取刚体世界坐标系下的原点值
  8980. @param out optional, the receiving point
  8981. */
  8982. getWorldPosition(out: Vec2): Vec2;
  8983. /**
  8984. !#en
  8985. Get the world body rotation angle.
  8986. !#zh
  8987. 获取刚体世界坐标系下的旋转值。
  8988. */
  8989. getWorldRotation(): number;
  8990. /**
  8991. !#en
  8992. Get the local position of the center of mass.
  8993. !#zh
  8994. 获取刚体本地坐标系下的质心
  8995. */
  8996. getLocalCenter(): Vec2;
  8997. /**
  8998. !#en
  8999. Get the world position of the center of mass.
  9000. !#zh
  9001. 获取刚体世界坐标系下的质心
  9002. */
  9003. getWorldCenter(): Vec2;
  9004. /**
  9005. !#en
  9006. Get the world linear velocity of a world point attached to this body.
  9007. !#zh
  9008. 获取刚体上指定点的线性速度
  9009. @param worldPoint a point in world coordinates.
  9010. @param out optional, the receiving point
  9011. */
  9012. getLinearVelocityFromWorldPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9013. /**
  9014. !#en
  9015. Get total mass of the body.
  9016. !#zh
  9017. 获取刚体的质量。
  9018. */
  9019. getMass(): number;
  9020. /**
  9021. !#en
  9022. Get the rotational inertia of the body about the local origin.
  9023. !#zh
  9024. 获取刚体本地坐标系下原点的旋转惯性
  9025. */
  9026. getInertia(): number;
  9027. /**
  9028. !#en
  9029. Get all the joints connect to the rigidbody.
  9030. !#zh
  9031. 获取链接到此刚体的所有关节
  9032. */
  9033. getJointList(): [Joint];
  9034. /**
  9035. !#en
  9036. Apply a force at a world point. If the force is not
  9037. applied at the center of mass, it will generate a torque and
  9038. affect the angular velocity.
  9039. !#zh
  9040. 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  9041. @param force the world force vector.
  9042. @param point the world position.
  9043. @param wake also wake up the body.
  9044. */
  9045. applyForce(force: Vec2, point: Vec2, wake: boolean): void;
  9046. /**
  9047. !#en
  9048. Apply a force to the center of mass.
  9049. !#zh
  9050. 施加一个力到刚体上的质心上。
  9051. @param force the world force vector.
  9052. @param wake also wake up the body.
  9053. */
  9054. applyForceToCenter(force: Vec2, wake: boolean): void;
  9055. /**
  9056. !#en
  9057. Apply a torque. This affects the angular velocity.
  9058. !#zh
  9059. 施加一个扭矩力,将影响刚体的角速度
  9060. @param torque about the z-axis (out of the screen), usually in N-m.
  9061. @param wake also wake up the body
  9062. */
  9063. applyTorque(torque: number, wake: boolean): void;
  9064. /**
  9065. !#en
  9066. Apply a impulse at a world point, This immediately modifies the velocity.
  9067. If the impulse is not applied at the center of mass, it will generate a torque and
  9068. affect the angular velocity.
  9069. !#zh
  9070. 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  9071. 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  9072. @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
  9073. @param point the world position
  9074. @param wake alse wake up the body
  9075. */
  9076. applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
  9077. /**
  9078. !#en
  9079. Apply an angular impulse.
  9080. !#zh
  9081. 施加一个角速度冲量。
  9082. @param impulse the angular impulse in units of kg*m*m/s
  9083. @param wake also wake up the body
  9084. */
  9085. applyAngularImpulse(impulse: number, wake: boolean): void;
  9086. /**
  9087. !#en
  9088. Synchronize node's world position to box2d rigidbody's position.
  9089. If enableAnimated is true and rigidbody's type is Animated type,
  9090. will set linear velocity instead of directly set rigidbody's position.
  9091. !#zh
  9092. 同步节点的世界坐标到 box2d 刚体的坐标上。
  9093. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的线性速度来代替直接设置刚体的位置。
  9094. @param enableAnimated enableAnimated
  9095. */
  9096. syncPosition(enableAnimated: boolean): void;
  9097. /**
  9098. !#en
  9099. Synchronize node's world angle to box2d rigidbody's angle.
  9100. If enableAnimated is true and rigidbody's type is Animated type,
  9101. will set angular velocity instead of directly set rigidbody's angle.
  9102. !#zh
  9103. 同步节点的世界旋转角度值到 box2d 刚体的旋转值上。
  9104. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的角速度来代替直接设置刚体的角度。
  9105. @param enableAnimated enableAnimated
  9106. */
  9107. syncRotation(enableAnimated: boolean): void;
  9108. }
  9109. /** undefined */
  9110. export class Graphics extends RenderComponent {
  9111. /** !#en
  9112. Current line width.
  9113. !#zh
  9114. 当前线条宽度 */
  9115. lineWidth: number;
  9116. /** !#en
  9117. lineJoin determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  9118. !#zh
  9119. lineJoin 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。 */
  9120. lineJoin: Graphics.LineJoin;
  9121. /** !#en
  9122. lineCap determines how the end points of every line are drawn.
  9123. !#zh
  9124. lineCap 指定如何绘制每一条线段末端。 */
  9125. lineCap: Graphics.LineCap;
  9126. /** !#en
  9127. stroke color
  9128. !#zh
  9129. 线段颜色 */
  9130. strokeColor: Color;
  9131. /** !#en
  9132. fill color
  9133. !#zh
  9134. 填充颜色 */
  9135. fillColor: Color;
  9136. /** !#en
  9137. Sets the miter limit ratio
  9138. !#zh
  9139. 设置斜接面限制比例 */
  9140. miterLimit: number;
  9141. /**
  9142. !#en Move path start point to (x,y).
  9143. !#zh 移动路径起点到坐标(x, y)
  9144. @param x The x axis of the coordinate for the end point.
  9145. @param y The y axis of the coordinate for the end point.
  9146. */
  9147. moveTo(x?: number, y?: number): void;
  9148. /**
  9149. !#en Adds a straight line to the path
  9150. !#zh 绘制直线路径
  9151. @param x The x axis of the coordinate for the end point.
  9152. @param y The y axis of the coordinate for the end point.
  9153. */
  9154. lineTo(x?: number, y?: number): void;
  9155. /**
  9156. !#en Adds a cubic Bézier curve to the path
  9157. !#zh 绘制三次贝赛尔曲线路径
  9158. @param c1x The x axis of the coordinate for the first control point.
  9159. @param c1y The y axis of the coordinate for first control point.
  9160. @param c2x The x axis of the coordinate for the second control point.
  9161. @param c2y The y axis of the coordinate for the second control point.
  9162. @param x The x axis of the coordinate for the end point.
  9163. @param y The y axis of the coordinate for the end point.
  9164. */
  9165. bezierCurveTo(c1x?: number, c1y?: number, c2x?: number, c2y?: number, x?: number, y?: number): void;
  9166. /**
  9167. !#en Adds a quadratic Bézier curve to the path
  9168. !#zh 绘制二次贝赛尔曲线路径
  9169. @param cx The x axis of the coordinate for the control point.
  9170. @param cy The y axis of the coordinate for the control point.
  9171. @param x The x axis of the coordinate for the end point.
  9172. @param y The y axis of the coordinate for the end point.
  9173. */
  9174. quadraticCurveTo(cx?: number, cy?: number, x?: number, y?: number): void;
  9175. /**
  9176. !#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).
  9177. !#zh 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  9178. @param cx The x axis of the coordinate for the center point.
  9179. @param cy The y axis of the coordinate for the center point.
  9180. @param r The arc's radius.
  9181. @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  9182. @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  9183. @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.
  9184. */
  9185. arc(cx?: number, cy?: number, r?: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
  9186. /**
  9187. !#en Adds an ellipse to the path.
  9188. !#zh 绘制椭圆路径。
  9189. @param cx The x axis of the coordinate for the center point.
  9190. @param cy The y axis of the coordinate for the center point.
  9191. @param rx The ellipse's x-axis radius.
  9192. @param ry The ellipse's y-axis radius.
  9193. */
  9194. ellipse(cx?: number, cy?: number, rx?: number, ry?: number): void;
  9195. /**
  9196. !#en Adds an circle to the path.
  9197. !#zh 绘制圆形路径。
  9198. @param cx The x axis of the coordinate for the center point.
  9199. @param cy The y axis of the coordinate for the center point.
  9200. @param r The circle's radius.
  9201. */
  9202. circle(cx?: number, cy?: number, r?: number): void;
  9203. /**
  9204. !#en Adds an rectangle to the path.
  9205. !#zh 绘制矩形路径。
  9206. @param x The x axis of the coordinate for the rectangle starting point.
  9207. @param y The y axis of the coordinate for the rectangle starting point.
  9208. @param w The rectangle's width.
  9209. @param h The rectangle's height.
  9210. */
  9211. rect(x?: number, y?: number, w?: number, h?: number): void;
  9212. /**
  9213. !#en Adds an round corner rectangle to the path.
  9214. !#zh 绘制圆角矩形路径。
  9215. @param x The x axis of the coordinate for the rectangle starting point.
  9216. @param y The y axis of the coordinate for the rectangle starting point.
  9217. @param w The rectangles width.
  9218. @param h The rectangle's height.
  9219. @param r The radius of the rectangle.
  9220. */
  9221. roundRect(x?: number, y?: number, w?: number, h?: number, r?: number): void;
  9222. /**
  9223. !#en Draws a filled rectangle.
  9224. !#zh 绘制填充矩形。
  9225. @param x The x axis of the coordinate for the rectangle starting point.
  9226. @param y The y axis of the coordinate for the rectangle starting point.
  9227. @param w The rectangle's width.
  9228. @param h The rectangle's height.
  9229. */
  9230. fillRect(x?: number, y?: number, w?: number, h?: number): void;
  9231. /**
  9232. !#en Erasing any previously drawn content.
  9233. !#zh 擦除之前绘制的所有内容的方法。
  9234. @param clean Whether to clean the graphics inner cache.
  9235. */
  9236. clear(clean?: boolean): void;
  9237. /**
  9238. !#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.
  9239. !#zh 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  9240. */
  9241. close(): void;
  9242. /**
  9243. !#en Strokes the current or given path with the current stroke style.
  9244. !#zh 根据当前的画线样式,绘制当前或已经存在的路径。
  9245. */
  9246. stroke(): void;
  9247. /**
  9248. !#en Fills the current or given path with the current fill style.
  9249. !#zh 根据当前的画线样式,填充当前或已经存在的路径。
  9250. */
  9251. fill(): void;
  9252. }
  9253. /** !#en the device accelerometer reports values for each axis in units of g-force.
  9254. !#zh 设备重力传感器传递的各个轴的数据。 */
  9255. export class constructor {
  9256. /**
  9257. whether enable accelerometer event
  9258. @param isEnable isEnable
  9259. */
  9260. setAccelerometerEnabled(isEnable: boolean): void;
  9261. /**
  9262. set accelerometer interval value
  9263. @param interval interval
  9264. */
  9265. setAccelerometerInterval(interval: number): void;
  9266. }
  9267. /** Predefined constants */
  9268. export class macro {
  9269. /** PI / 180 */
  9270. static RAD: number;
  9271. /** One degree */
  9272. static DEG: number;
  9273. static REPEAT_FOREVER: number;
  9274. static FLT_EPSILON: number;
  9275. /** Minimum z index value for node */
  9276. static MIN_ZINDEX: number;
  9277. /** Maximum z index value for node */
  9278. static MAX_ZINDEX: number;
  9279. static ONE: number;
  9280. static ZERO: number;
  9281. static SRC_ALPHA: number;
  9282. static SRC_ALPHA_SATURATE: number;
  9283. static SRC_COLOR: number;
  9284. static DST_ALPHA: number;
  9285. static DST_COLOR: number;
  9286. static ONE_MINUS_SRC_ALPHA: number;
  9287. static ONE_MINUS_SRC_COLOR: number;
  9288. static ONE_MINUS_DST_ALPHA: number;
  9289. static ONE_MINUS_DST_COLOR: number;
  9290. static ONE_MINUS_CONSTANT_ALPHA: number;
  9291. static ONE_MINUS_CONSTANT_COLOR: number;
  9292. /** Oriented vertically */
  9293. static ORIENTATION_PORTRAIT: number;
  9294. /** Oriented horizontally */
  9295. static ORIENTATION_LANDSCAPE: number;
  9296. /** Oriented automatically */
  9297. static ORIENTATION_AUTO: number;
  9298. /** <p>
  9299. If enabled, the texture coordinates will be calculated by using this formula: <br/>
  9300. - texCoord.left = (rect.x*2+1) / (texture.wide*2); <br/>
  9301. - texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2); <br/>
  9302. <br/>
  9303. The same for bottom and top. <br/>
  9304. <br/>
  9305. This formula prevents artifacts by using 99% of the texture. <br/>
  9306. The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel<br/>
  9307. <br/>
  9308. Affected component: <br/>
  9309. - cc.TMXLayer <br/>
  9310. <br/>
  9311. Enabled by default. To disabled set it to 0. <br/>
  9312. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
  9313. </p> */
  9314. static FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: number;
  9315. /** Position of the FPS (Default: 0,0 (bottom-left corner))<br/>
  9316. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h */
  9317. static DIRECTOR_STATS_POSITION: Vec2;
  9318. /** <p>
  9319. If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked. <br/>
  9320. 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/>
  9321. If disabled, only the last run action will take effect.
  9322. </p> */
  9323. static ENABLE_STACKABLE_ACTIONS: number;
  9324. /** !#en
  9325. The timeout to determine whether a touch is no longer active and should be removed.
  9326. The reason to add this timeout is due to an issue in X5 browser core,
  9327. when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  9328. no touch cancel event is triggered, and the touch will be considered active forever.
  9329. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  9330. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  9331. 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.
  9332. You can modify this value to have a better behavior if you find it's not enough.
  9333. !#zh
  9334. 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  9335. 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  9336. 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  9337. 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  9338. 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  9339. 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  9340. 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。 */
  9341. static TOUCH_TIMEOUT: number;
  9342. /** !#en
  9343. The maximum vertex count for a single batched draw call.
  9344. !#zh
  9345. 最大可以被单次批处理渲染的顶点数量。 */
  9346. static BATCH_VERTEX_COUNT: number;
  9347. /** !#en
  9348. 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.
  9349. !#zh
  9350. 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 的话,需要手动关闭,否则渲染会出错。 */
  9351. static ENABLE_TILEDMAP_CULLING: boolean;
  9352. /** !#en
  9353. The max concurrent task number for the downloader
  9354. !#zh
  9355. 下载任务的最大并发数限制,在安卓平台部分机型或版本上可能需要限制在较低的水平 */
  9356. static DOWNLOAD_MAX_CONCURRENT: number;
  9357. /** !#en
  9358. Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  9359. Though if you want to make your canvas background transparent and show other dom elements at the background,
  9360. you can set it to true before `cc.game.run`.
  9361. Web only.
  9362. !#zh
  9363. 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  9364. 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 `cc.game.run` 之前将这个值设为 true。
  9365. 仅支持 Web */
  9366. static ENABLE_TRANSPARENT_CANVAS: boolean;
  9367. /** !#en
  9368. Boolean that indicates if the WebGL context is created with `antialias` option turned on, default value is false.
  9369. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  9370. Whether to use this really depend on your game design and targeted platform,
  9371. device with retina display usually have good detail on graphics with or without this option,
  9372. you probably don't want antialias if your game style is pixel art based.
  9373. Also, it could have great performance impact with some browser / device using software MSAA.
  9374. You can set it to true before `cc.game.run`.
  9375. Web only.
  9376. !#zh
  9377. 用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。
  9378. 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  9379. 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  9380. 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  9381. 你可以在 `cc.game.run` 之前设置这个值,否则它不会生效。
  9382. 仅支持 Web */
  9383. static ENABLE_WEBGL_ANTIALIAS: boolean;
  9384. /** !#en
  9385. Whether or not enable auto culling.
  9386. This feature have been removed in v2.0 new renderer due to overall performance consumption.
  9387. We have no plan currently to re-enable auto culling.
  9388. If your game have more dynamic objects, we suggest to disable auto culling.
  9389. If your game have more static objects, we suggest to enable auto culling.
  9390. !#zh
  9391. 是否开启自动裁减功能,开启裁减功能将会把在屏幕外的物体从渲染队列中去除掉。
  9392. 这个功能在 v2.0 的新渲染器中被移除了,因为它在大多数游戏中所带来的损耗要高于性能的提升,目前我们没有计划重新支持自动裁剪。
  9393. 如果游戏中的动态物体比较多的话,建议将此选项关闭。
  9394. 如果游戏中的静态物体比较多的话,建议将此选项打开。 */
  9395. static ENABLE_CULLING: boolean;
  9396. /** !#en
  9397. Whether or not clear dom Image object cache after uploading to gl texture.
  9398. Concretely, we are setting image.src to empty string to release the cache.
  9399. Normally you don't need to enable this option, because on web the Image object doesn't consume too much memory.
  9400. But on Wechat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  9401. So we enabled this option by default on Wechat, so that we can release Image cache immediately after uploaded to GPU.
  9402. !#zh
  9403. 是否在将贴图上传至 GPU 之后删除 DOM Image 缓存。
  9404. 具体来说,我们通过设置 image.src 为空字符串来释放这部分内存。
  9405. 正常情况下,你不需要开启这个选项,因为在 web 平台,Image 对象所占用的内存很小。
  9406. 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  9407. 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 */
  9408. static CLEANUP_IMAGE_CACHE: boolean;
  9409. /** !#en
  9410. Whether or not show mesh wire frame.
  9411. !#zh
  9412. 是否显示网格的线框。 */
  9413. static SHOW_MESH_WIREFRAME: boolean;
  9414. /** !en
  9415. The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
  9416. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
  9417. !zh
  9418. 引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
  9419. 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。 */
  9420. static SUPPORT_TEXTURE_FORMATS: [String];
  9421. }
  9422. /** undefined */
  9423. export enum VerticalTextAlignment {
  9424. TOP = 0,
  9425. CENTER = 0,
  9426. BOTTOM = 0,
  9427. }
  9428. /** The base class of most of all the objects in Fireball. */
  9429. export class Object {
  9430. /** !#en The name of the object.
  9431. !#zh 该对象的名称。 */
  9432. name: string;
  9433. /** !#en
  9434. Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  9435. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  9436. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  9437. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  9438. but this is often caused by a particular logical requirements, which is not normally required.
  9439. !#zh
  9440. 表示该对象是否可用(被 destroy 后将不可用)。<br>
  9441. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。 */
  9442. isValid: boolean;
  9443. /**
  9444. !#en
  9445. Destroy this Object, and release all its own references to other objects.<br/>
  9446. Actual object destruction will delayed until before rendering.
  9447. From the next frame, this object is not usable any more.
  9448. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  9449. !#zh
  9450. 销毁该对象,并释放所有它对其它对象的引用。<br/>
  9451. 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  9452. 您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  9453. @example
  9454. ```js
  9455. obj.destroy();
  9456. ```
  9457. */
  9458. destroy(): boolean;
  9459. }
  9460. /** Bit mask that controls object states. */
  9461. export enum Flags {
  9462. DontSave = 0,
  9463. EditorOnly = 0,
  9464. }
  9465. /** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.
  9466. It's invalid on safari, QQbrowser and android browser */
  9467. export class screen {
  9468. /**
  9469. initialize
  9470. */
  9471. init(): void;
  9472. /**
  9473. return true if it's full now.
  9474. */
  9475. fullScreen(): boolean;
  9476. /**
  9477. change the screen to full mode.
  9478. @param element element
  9479. @param onFullScreenChange onFullScreenChange
  9480. */
  9481. requestFullScreen(element: Element, onFullScreenChange: Function): void;
  9482. /**
  9483. exit the full mode.
  9484. */
  9485. exitFullScreen(): boolean;
  9486. /**
  9487. Automatically request full screen with a touch/click event
  9488. @param element element
  9489. @param onFullScreenChange onFullScreenChange
  9490. */
  9491. autoFullScreen(element: Element, onFullScreenChange: Function): void;
  9492. }
  9493. /** System variables */
  9494. export class sys {
  9495. /** English language code */
  9496. static LANGUAGE_ENGLISH: string;
  9497. /** Chinese language code */
  9498. static LANGUAGE_CHINESE: string;
  9499. /** French language code */
  9500. static LANGUAGE_FRENCH: string;
  9501. /** Italian language code */
  9502. static LANGUAGE_ITALIAN: string;
  9503. /** German language code */
  9504. static LANGUAGE_GERMAN: string;
  9505. /** Spanish language code */
  9506. static LANGUAGE_SPANISH: string;
  9507. /** Spanish language code */
  9508. static LANGUAGE_DUTCH: string;
  9509. /** Russian language code */
  9510. static LANGUAGE_RUSSIAN: string;
  9511. /** Korean language code */
  9512. static LANGUAGE_KOREAN: string;
  9513. /** Japanese language code */
  9514. static LANGUAGE_JAPANESE: string;
  9515. /** Hungarian language code */
  9516. static LANGUAGE_HUNGARIAN: string;
  9517. /** Portuguese language code */
  9518. static LANGUAGE_PORTUGUESE: string;
  9519. /** Arabic language code */
  9520. static LANGUAGE_ARABIC: string;
  9521. /** Norwegian language code */
  9522. static LANGUAGE_NORWEGIAN: string;
  9523. /** Polish language code */
  9524. static LANGUAGE_POLISH: string;
  9525. /** Turkish language code */
  9526. static LANGUAGE_TURKISH: string;
  9527. /** Ukrainian language code */
  9528. static LANGUAGE_UKRAINIAN: string;
  9529. /** Romanian language code */
  9530. static LANGUAGE_ROMANIAN: string;
  9531. /** Bulgarian language code */
  9532. static LANGUAGE_BULGARIAN: string;
  9533. /** Unknown language code */
  9534. static LANGUAGE_UNKNOWN: string;
  9535. static OS_IOS: string;
  9536. static OS_ANDROID: string;
  9537. static OS_WINDOWS: string;
  9538. static OS_MARMALADE: string;
  9539. static OS_LINUX: string;
  9540. static OS_BADA: string;
  9541. static OS_BLACKBERRY: string;
  9542. static OS_OSX: string;
  9543. static OS_WP8: string;
  9544. static OS_WINRT: string;
  9545. static OS_UNKNOWN: string;
  9546. static UNKNOWN: number;
  9547. static WIN32: number;
  9548. static LINUX: number;
  9549. static MACOS: number;
  9550. static ANDROID: number;
  9551. static IPHONE: number;
  9552. static IPAD: number;
  9553. static BLACKBERRY: number;
  9554. static NACL: number;
  9555. static EMSCRIPTEN: number;
  9556. static TIZEN: number;
  9557. static WINRT: number;
  9558. static WP8: number;
  9559. static MOBILE_BROWSER: number;
  9560. static DESKTOP_BROWSER: number;
  9561. /** Indicates whether executes in editor's window process (Electron's renderer context) */
  9562. static EDITOR_PAGE: number;
  9563. /** Indicates whether executes in editor's main process (Electron's browser context) */
  9564. static EDITOR_CORE: number;
  9565. static WECHAT_GAME: number;
  9566. static QQ_PLAY: number;
  9567. static FB_PLAYABLE_ADS: number;
  9568. /** BROWSER_TYPE_WECHAT */
  9569. static BROWSER_TYPE_WECHAT: string;
  9570. /** BROWSER_TYPE_WECHAT_GAME */
  9571. static BROWSER_TYPE_WECHAT_GAME: string;
  9572. /** BROWSER_TYPE_WECHAT_GAME_SUB */
  9573. static BROWSER_TYPE_WECHAT_GAME_SUB: string;
  9574. /** BROWSER_TYPE_QQ_PLAY */
  9575. static BROWSER_TYPE_QQ_PLAY: string;
  9576. static BROWSER_TYPE_ANDROID: string;
  9577. static BROWSER_TYPE_IE: string;
  9578. static BROWSER_TYPE_QQ: string;
  9579. static BROWSER_TYPE_MOBILE_QQ: string;
  9580. static BROWSER_TYPE_UC: string;
  9581. /** uc third party integration. */
  9582. static BROWSER_TYPE_UCBS: string;
  9583. static BROWSER_TYPE_360: string;
  9584. static BROWSER_TYPE_BAIDU_APP: string;
  9585. static BROWSER_TYPE_BAIDU: string;
  9586. static BROWSER_TYPE_MAXTHON: string;
  9587. static BROWSER_TYPE_OPERA: string;
  9588. static BROWSER_TYPE_OUPENG: string;
  9589. static BROWSER_TYPE_MIUI: string;
  9590. static BROWSER_TYPE_FIREFOX: string;
  9591. static BROWSER_TYPE_SAFARI: string;
  9592. static BROWSER_TYPE_CHROME: string;
  9593. static BROWSER_TYPE_LIEBAO: string;
  9594. static BROWSER_TYPE_QZONE: string;
  9595. static BROWSER_TYPE_SOUGOU: string;
  9596. static BROWSER_TYPE_UNKNOWN: string;
  9597. /** Is native ? This is set to be true in jsb auto. */
  9598. static isNative: boolean;
  9599. /** Is web browser ? */
  9600. static isBrowser: boolean;
  9601. /** Indicate whether system is mobile system */
  9602. static isMobile: boolean;
  9603. /** Indicate the running platform */
  9604. static platform: number;
  9605. /** Indicate the current language of the running system */
  9606. static language: string;
  9607. /** Indicate the running os name */
  9608. static os: string;
  9609. /** Indicate the running os version */
  9610. static osVersion: string;
  9611. /** Indicate the running os main version */
  9612. static osMainVersion: number;
  9613. /** Indicate the running browser type */
  9614. static browserType: string;
  9615. /** Indicate the running browser version */
  9616. static browserVersion: string;
  9617. /** Indicate the real pixel resolution of the whole game window */
  9618. static windowPixelResolution: Size;
  9619. /** cc.sys.localStorage is a local storage component. */
  9620. static localStorage: any;
  9621. /** The capabilities of the current platform */
  9622. static capabilities: any;
  9623. /**
  9624. !#en
  9625. Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
  9626. !#zh
  9627. 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  9628. */
  9629. static getNetworkType(): NetworkType;
  9630. /**
  9631. !#en
  9632. Get the battery level of current device, return 1.0 if failure.
  9633. !#zh
  9634. 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  9635. */
  9636. static getBatteryLevel(): number;
  9637. /**
  9638. Forces the garbage collection, only available in JSB
  9639. */
  9640. static garbageCollect(): void;
  9641. /**
  9642. Restart the JS VM, only available in JSB
  9643. */
  9644. static restartVM(): void;
  9645. /**
  9646. !#en
  9647. Return the safe area rect. <br/>
  9648. only available on the iOS native platform, otherwise it will return a rect with design resolution size.
  9649. !#zh
  9650. 返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。其它平台将默认返回设计分辨率尺寸。
  9651. */
  9652. static getSafeAreaRect(): Rect;
  9653. /**
  9654. Check whether an object is valid,
  9655. In web engine, it will return true if the object exist
  9656. In native engine, it will return true if the JS object and the correspond native object are both valid
  9657. @param obj obj
  9658. */
  9659. static isObjectValid(obj: any): boolean;
  9660. /**
  9661. Dump system informations
  9662. */
  9663. static dump(): void;
  9664. /**
  9665. Open a url in browser
  9666. @param url url
  9667. */
  9668. static openURL(url: string): void;
  9669. /**
  9670. Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
  9671. */
  9672. static now(): number;
  9673. }
  9674. /** !#en
  9675. Network type enumeration
  9676. !#zh
  9677. 网络类型枚举 */
  9678. export enum NetworkType {
  9679. NONE = 0,
  9680. LAN = 0,
  9681. WWAN = 0,
  9682. }
  9683. /** cc.view is the singleton object which represents the game window.<br/>
  9684. It's main task include: <br/>
  9685. - Apply the design resolution policy<br/>
  9686. - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>
  9687. - Manage the game view port which can be different with the window<br/>
  9688. - Manage the content scale and translation<br/>
  9689. <br/>
  9690. Since the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>
  9691. the standard way to use it is by calling:<br/>
  9692. - cc.view.methodName(); <br/> */
  9693. export class View {
  9694. /**
  9695. !#en
  9696. Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
  9697. 1. cc.macro.DENSITYDPI_DEVICE, value is "device-dpi" <br/>
  9698. 2. cc.macro.DENSITYDPI_HIGH, value is "high-dpi" (default value) <br/>
  9699. 3. cc.macro.DENSITYDPI_MEDIUM, value is "medium-dpi" (browser's default value) <br/>
  9700. 4. cc.macro.DENSITYDPI_LOW, value is "low-dpi" <br/>
  9701. 5. Custom value, e.g: "480" <br/>
  9702. !#zh 设置目标内容的每英寸像素点密度。
  9703. @param densityDPI densityDPI
  9704. */
  9705. setTargetDensityDPI(densityDPI: string): void;
  9706. /**
  9707. !#en
  9708. Returns the current target-densitydpi value of cc.view.
  9709. !#zh 获取目标内容的每英寸像素点密度。
  9710. */
  9711. getTargetDensityDPI(): string;
  9712. /**
  9713. !#en
  9714. Sets whether resize canvas automatically when browser's size changed.<br/>
  9715. Useful only on web.
  9716. !#zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  9717. 仅在 Web 模式下有效。
  9718. @param enabled Whether enable automatic resize with browser's resize event
  9719. */
  9720. resizeWithBrowserSize(enabled: boolean): void;
  9721. /**
  9722. !#en
  9723. Sets the callback function for cc.view's resize action,<br/>
  9724. this callback will be invoked before applying resolution policy, <br/>
  9725. so you can do any additional modifications within the callback.<br/>
  9726. Useful only on web.
  9727. !#zh 设置 cc.view 调整视窗尺寸行为的回调函数,
  9728. 这个回调函数会在应用适配模式之前被调用,
  9729. 因此你可以在这个回调函数内添加任意附加改变,
  9730. 仅在 Web 平台下有效。
  9731. @param callback The callback function
  9732. */
  9733. setResizeCallback(callback: Function|void): void;
  9734. /**
  9735. !#en
  9736. Sets the orientation of the game, it can be landscape, portrait or auto.
  9737. When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  9738. cc.view will automatically rotate the game canvas using CSS.
  9739. Note that this function doesn't have any effect in native,
  9740. in native, you need to set the application orientation in native project settings
  9741. !#zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  9742. 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  9743. cc.view 会自动用 CSS 旋转游戏场景的 canvas,
  9744. 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  9745. @param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO
  9746. */
  9747. setOrientation(orientation: number): void;
  9748. /**
  9749. !#en
  9750. Sets whether the engine modify the "viewport" meta in your web page.<br/>
  9751. It's enabled by default, we strongly suggest you not to disable it.<br/>
  9752. And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  9753. Only useful on web
  9754. !#zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  9755. 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  9756. 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  9757. 仅在 Web 模式下有效
  9758. @param enabled Enable automatic modification to "viewport" meta
  9759. */
  9760. adjustViewportMeta(enabled: boolean): void;
  9761. /**
  9762. !#en
  9763. Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  9764. it takes effect only when you called setDesignResolutionPolicy<br/>
  9765. Only useful on web
  9766. !#zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  9767. 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  9768. 仅在 Web 模式下有效。
  9769. @param enabled Enable or disable retina display
  9770. */
  9771. enableRetina(enabled: boolean): void;
  9772. /**
  9773. !#en
  9774. Check whether retina display is enabled.<br/>
  9775. Only useful on web
  9776. !#zh 检查是否对 Retina 显示设备进行优化。
  9777. 仅在 Web 模式下有效。
  9778. */
  9779. isRetinaEnabled(): boolean;
  9780. /**
  9781. !#en Whether to Enable on anti-alias
  9782. !#zh 控制抗锯齿是否开启
  9783. @param enabled Enable or not anti-alias
  9784. */
  9785. enableAntiAlias(enabled: boolean): void;
  9786. /**
  9787. !#en Returns whether the current enable on anti-alias
  9788. !#zh 返回当前是否抗锯齿
  9789. */
  9790. isAntiAliasEnabled(): boolean;
  9791. /**
  9792. !#en
  9793. If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  9794. You can pass true as parameter to enable it and disable it by passing false.<br/>
  9795. Only useful on web
  9796. !#zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  9797. 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  9798. @param enabled Enable or disable auto full screen on mobile devices
  9799. */
  9800. enableAutoFullScreen(enabled: boolean): void;
  9801. /**
  9802. !#en
  9803. Check whether auto full screen is enabled.<br/>
  9804. Only useful on web
  9805. !#zh 检查自动进入全屏模式是否启动。
  9806. 仅在 Web 模式下有效。
  9807. */
  9808. isAutoFullScreenEnabled(): boolean;
  9809. /**
  9810. !#en
  9811. Returns the canvas size of the view.<br/>
  9812. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  9813. On web, it returns the size of the canvas element.
  9814. !#zh 返回视图中 canvas 的尺寸。
  9815. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  9816. 在 Web 平台下,它返回 canvas 元素尺寸。
  9817. */
  9818. getCanvasSize(): Size;
  9819. /**
  9820. !#en
  9821. Returns the frame size of the view.<br/>
  9822. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  9823. On web, it returns the size of the canvas's outer DOM element.
  9824. !#zh 返回视图中边框尺寸。
  9825. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  9826. 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  9827. */
  9828. getFrameSize(): Size;
  9829. /**
  9830. !#en
  9831. On native, it sets the frame size of view.<br/>
  9832. On web, it sets the size of the canvas's outer DOM element.
  9833. !#zh 在 native 平台下,设置视图框架尺寸。
  9834. 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  9835. @param width width
  9836. @param height height
  9837. */
  9838. setFrameSize(width: number, height: number): void;
  9839. /**
  9840. !#en
  9841. Returns the visible area size of the view port.
  9842. !#zh 返回视图窗口可见区域尺寸。
  9843. */
  9844. getVisibleSize(): Size;
  9845. /**
  9846. !#en
  9847. Returns the visible area size of the view port.
  9848. !#zh 返回视图窗口可见区域像素尺寸。
  9849. */
  9850. getVisibleSizeInPixel(): Size;
  9851. /**
  9852. !#en
  9853. Returns the visible origin of the view port.
  9854. !#zh 返回视图窗口可见区域原点。
  9855. */
  9856. getVisibleOrigin(): Vec2;
  9857. /**
  9858. !#en
  9859. Returns the visible origin of the view port.
  9860. !#zh 返回视图窗口可见区域像素原点。
  9861. */
  9862. getVisibleOriginInPixel(): Vec2;
  9863. /**
  9864. !#en
  9865. Returns the current resolution policy
  9866. !#zh 返回当前分辨率方案
  9867. */
  9868. getResolutionPolicy(): ResolutionPolicy;
  9869. /**
  9870. !#en
  9871. Sets the current resolution policy
  9872. !#zh 设置当前分辨率模式
  9873. @param resolutionPolicy resolutionPolicy
  9874. */
  9875. setResolutionPolicy(resolutionPolicy: ResolutionPolicy|number): void;
  9876. /**
  9877. !#en
  9878. Sets the resolution policy with designed view size in points.<br/>
  9879. The resolution policy include: <br/>
  9880. [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/>
  9881. [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/>
  9882. [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/>
  9883. [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  9884. [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  9885. [cc.ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>
  9886. !#zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  9887. @param width Design resolution width.
  9888. @param height Design resolution height.
  9889. @param resolutionPolicy The resolution policy desired
  9890. */
  9891. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  9892. /**
  9893. !#en
  9894. Returns the designed size for the view.
  9895. Default resolution size is the same as 'getFrameSize'.
  9896. !#zh 返回视图的设计分辨率。
  9897. 默认下分辨率尺寸同 `getFrameSize` 方法相同
  9898. */
  9899. getDesignResolutionSize(): Size;
  9900. /**
  9901. !#en
  9902. Sets the container to desired pixel resolution and fit the game content to it.
  9903. This function is very useful for adaptation in mobile browsers.
  9904. In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  9905. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  9906. But this API can be helpful to set a desired pixel resolution which is in between.
  9907. This API will do the following:
  9908. 1. Set viewport's width to the desired width in pixel
  9909. 2. Set body width to the exact pixel resolution
  9910. 3. The resolution policy will be reset with designed view size in points.
  9911. !#zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  9912. @param width Design resolution width.
  9913. @param height Design resolution height.
  9914. @param resolutionPolicy The resolution policy desired
  9915. */
  9916. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  9917. /**
  9918. !#en
  9919. Sets view port rectangle with points.
  9920. !#zh 用设计分辨率下的点尺寸来设置视窗。
  9921. @param x x
  9922. @param y y
  9923. @param w width
  9924. @param h height
  9925. */
  9926. setViewportInPoints(x: number, y: number, w: number, h: number): void;
  9927. /**
  9928. !#en
  9929. Sets Scissor rectangle with points.
  9930. !#zh 用设计分辨率下的点的尺寸来设置 scissor 剪裁区域。
  9931. @param x x
  9932. @param y y
  9933. @param w w
  9934. @param h h
  9935. */
  9936. setScissorInPoints(x: number, y: number, w: number, h: number): void;
  9937. /**
  9938. !#en
  9939. Returns whether GL_SCISSOR_TEST is enable
  9940. !#zh 检查 scissor 是否生效。
  9941. */
  9942. isScissorEnabled(): boolean;
  9943. /**
  9944. !#en
  9945. Returns the current scissor rectangle
  9946. !#zh 返回当前的 scissor 剪裁区域。
  9947. */
  9948. getScissorRect(): Rect;
  9949. /**
  9950. !#en
  9951. Returns the view port rectangle.
  9952. !#zh 返回视窗剪裁区域。
  9953. */
  9954. getViewportRect(): Rect;
  9955. /**
  9956. !#en
  9957. Returns scale factor of the horizontal direction (X axis).
  9958. !#zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  9959. */
  9960. getScaleX(): number;
  9961. /**
  9962. !#en
  9963. Returns scale factor of the vertical direction (Y axis).
  9964. !#zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  9965. */
  9966. getScaleY(): number;
  9967. /**
  9968. !#en
  9969. Returns device pixel ratio for retina display.
  9970. !#zh 返回设备或浏览器像素比例。
  9971. */
  9972. getDevicePixelRatio(): number;
  9973. /**
  9974. !#en
  9975. Returns the real location in view for a translation based on a related position
  9976. !#zh 将屏幕坐标转换为游戏视图下的坐标。
  9977. @param tx The X axis translation
  9978. @param ty The Y axis translation
  9979. @param relatedPos The related position object including "left", "top", "width", "height" informations
  9980. */
  9981. convertToLocationInView(tx: number, ty: number, relatedPos: any): Vec2;
  9982. }
  9983. /** <p>cc.game.containerStrategy class is the root strategy class of container's scale strategy,
  9984. it controls the behavior of how to scale the cc.game.container and cc.game.canvas object</p> */
  9985. export class ContainerStrategy {
  9986. /**
  9987. !#en
  9988. Manipulation before appling the strategy
  9989. !#zh 在应用策略之前的操作
  9990. @param view The target view
  9991. */
  9992. preApply(view: View): void;
  9993. /**
  9994. !#en
  9995. Function to apply this strategy
  9996. !#zh 策略应用方法
  9997. @param view view
  9998. @param designedResolution designedResolution
  9999. */
  10000. apply(view: View, designedResolution: Size): void;
  10001. /**
  10002. !#en
  10003. Manipulation after applying the strategy
  10004. !#zh 策略调用之后的操作
  10005. @param view The target view
  10006. */
  10007. postApply(view: View): void;
  10008. }
  10009. /** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,
  10010. it controls the behavior of how to scale the scene and setup the viewport for the game</p> */
  10011. export class ContentStrategy {
  10012. /**
  10013. !#en
  10014. Manipulation before applying the strategy
  10015. !#zh 策略应用前的操作
  10016. @param view The target view
  10017. */
  10018. preApply(view: View): void;
  10019. /**
  10020. !#en Function to apply this strategy
  10021. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10022. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10023. !#zh 调用策略方法
  10024. @param view view
  10025. @param designedResolution designedResolution
  10026. */
  10027. apply(view: View, designedResolution: Size): any;
  10028. /**
  10029. !#en
  10030. Manipulation after applying the strategy
  10031. !#zh 策略调用之后的操作
  10032. @param view The target view
  10033. */
  10034. postApply(view: View): void;
  10035. }
  10036. /** undefined */
  10037. export class EqualToFrame extends ContainerStrategy {
  10038. }
  10039. /** undefined */
  10040. export class ProportionalToFrame extends ContainerStrategy {
  10041. }
  10042. /** undefined */
  10043. export class EqualToWindow extends EqualToFrame {
  10044. }
  10045. /** undefined */
  10046. export class ProportionalToWindow extends ProportionalToFrame {
  10047. }
  10048. /** undefined */
  10049. export class OriginalContainer extends ContainerStrategy {
  10050. }
  10051. /** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,
  10052. its main task is to maintain the compatibility with Cocos2d-x</p> */
  10053. export class ResolutionPolicy {
  10054. /**
  10055. @param containerStg The container strategy
  10056. @param contentStg The content strategy
  10057. */
  10058. constructor(containerStg: ContainerStrategy, contentStg: ContentStrategy);
  10059. /**
  10060. !#en Manipulation before applying the resolution policy
  10061. !#zh 策略应用前的操作
  10062. @param view The target view
  10063. */
  10064. preApply(view: View): void;
  10065. /**
  10066. !#en Function to apply this resolution policy
  10067. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10068. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10069. !#zh 调用策略方法
  10070. @param view The target view
  10071. @param designedResolution The user defined design resolution
  10072. */
  10073. apply(view: View, designedResolution: Size): any;
  10074. /**
  10075. !#en Manipulation after appyling the strategy
  10076. !#zh 策略应用之后的操作
  10077. @param view The target view
  10078. */
  10079. postApply(view: View): void;
  10080. /**
  10081. !#en
  10082. Setup the container's scale strategy
  10083. !#zh 设置容器的适配策略
  10084. @param containerStg containerStg
  10085. */
  10086. setContainerStrategy(containerStg: ContainerStrategy): void;
  10087. /**
  10088. !#en
  10089. Setup the content's scale strategy
  10090. !#zh 设置内容的适配策略
  10091. @param contentStg contentStg
  10092. */
  10093. setContentStrategy(contentStg: ContentStrategy): void;
  10094. /** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>
  10095. Distortion can occur, and the application may appear stretched or compressed. */
  10096. static EXACT_FIT: number;
  10097. /** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>
  10098. while maintaining the original aspect ratio of the application. */
  10099. static NO_BORDER: number;
  10100. /** The entire application is visible in the specified area without distortion while maintaining the original<br/>
  10101. aspect ratio of the application. Borders can appear on two sides of the application. */
  10102. static SHOW_ALL: number;
  10103. /** The application takes the height of the design resolution size and modifies the width of the internal<br/>
  10104. canvas so that it fits the aspect ratio of the device<br/>
  10105. no distortion will occur however you must make sure your application works on different<br/>
  10106. aspect ratios */
  10107. static FIXED_HEIGHT: number;
  10108. /** The application takes the width of the design resolution size and modifies the height of the internal<br/>
  10109. canvas so that it fits the aspect ratio of the device<br/>
  10110. no distortion will occur however you must make sure your application works on different<br/>
  10111. aspect ratios */
  10112. static FIXED_WIDTH: number;
  10113. /** Unknow policy */
  10114. static UNKNOWN: number;
  10115. }
  10116. /** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,
  10117. it should represent the same rect as cc.view.getViewportRect() */
  10118. export class visibleRect {
  10119. /**
  10120. initialize
  10121. @param visibleRect visibleRect
  10122. */
  10123. init(visibleRect: Rect): void;
  10124. /** Top left coordinate of the screen related to the game scene. */
  10125. topLeft: Vec2;
  10126. /** Top right coordinate of the screen related to the game scene. */
  10127. topRight: Vec2;
  10128. /** Top center coordinate of the screen related to the game scene. */
  10129. top: Vec2;
  10130. /** Bottom left coordinate of the screen related to the game scene. */
  10131. bottomLeft: Vec2;
  10132. /** Bottom right coordinate of the screen related to the game scene. */
  10133. bottomRight: Vec2;
  10134. /** Bottom center coordinate of the screen related to the game scene. */
  10135. bottom: Vec2;
  10136. /** Center coordinate of the screen related to the game scene. */
  10137. center: Vec2;
  10138. /** Left center coordinate of the screen related to the game scene. */
  10139. left: Vec2;
  10140. /** Right center coordinate of the screen related to the game scene. */
  10141. right: Vec2;
  10142. /** Width of the screen. */
  10143. width: number;
  10144. /** Height of the screen. */
  10145. height: number;
  10146. }
  10147. /** The CallbacksHandler is an abstract class that can register and unregister callbacks by key.
  10148. Subclasses should implement their own methods about how to invoke the callbacks. */
  10149. export class _CallbacksHandler {
  10150. /**
  10151. @param key key
  10152. @param callback callback
  10153. @param target can be null
  10154. */
  10155. add(key: string, callback: Function, target?: any): void;
  10156. /**
  10157. Check if the specified key has any registered callback. If a callback is also specified,
  10158. it will only return true if the callback is registered.
  10159. @param key key
  10160. @param callback callback
  10161. @param target target
  10162. */
  10163. hasEventListener(key: string, callback?: Function, target?: any): boolean;
  10164. /**
  10165. Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  10166. @param keyOrTarget The event key to be removed or the target to be removed
  10167. */
  10168. removeAll(keyOrTarget: string|any): void;
  10169. /**
  10170. @param key key
  10171. @param callback callback
  10172. @param target target
  10173. */
  10174. remove(key: string, callback: Function, target?: any): void;
  10175. }
  10176. /** !#en The callbacks invoker to handle and invoke callbacks by key.
  10177. !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */
  10178. export class CallbacksInvoker extends _CallbacksHandler {
  10179. /**
  10180. @param key key
  10181. @param p1 p1
  10182. @param p2 p2
  10183. @param p3 p3
  10184. @param p4 p4
  10185. @param p5 p5
  10186. */
  10187. invoke(key: string, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any): void;
  10188. }
  10189. /** !#en Contains information collected during deserialization
  10190. !#zh 包含反序列化时的一些信息 */
  10191. export class Details {
  10192. /** list of the depends assets' uuid */
  10193. uuidList: string[];
  10194. /** the obj list whose field needs to load asset by uuid */
  10195. uuidObjList: any[];
  10196. /** the corresponding field name which referenced to the asset */
  10197. uuidPropList: string[];
  10198. reset(): void;
  10199. /**
  10200. @param obj obj
  10201. @param propName propName
  10202. @param uuid uuid
  10203. */
  10204. push(obj: any, propName: string, uuid: string): void;
  10205. }
  10206. /** undefined */
  10207. export class url {
  10208. /**
  10209. Returns the url of raw assets, you will only need this if the raw asset is inside the "resources" folder.
  10210. @param url url
  10211. @example
  10212. ```js
  10213. ---
  10214. var url = cc.url.raw("textures/myTexture.png");
  10215. console.log(url); // "resources/raw/textures/myTexture.png"
  10216. ```
  10217. */
  10218. static raw(url: string): string;
  10219. }
  10220. /** !#en The module provides utilities for working with file and directory paths
  10221. !#zh 用于处理文件与目录的路径的模块 */
  10222. export class path {
  10223. /**
  10224. !#en Join strings to be a path.
  10225. !#zh 拼接字符串为 Path
  10226. @example
  10227. ```js
  10228. ------------------------------
  10229. cc.path.join("a", "b.png"); //-->"a/b.png"
  10230. cc.path.join("a", "b", "c.png"); //-->"a/b/c.png"
  10231. cc.path.join("a", "b"); //-->"a/b"
  10232. cc.path.join("a", "b", "/"); //-->"a/b/"
  10233. cc.path.join("a", "b/", "/"); //-->"a/b/"
  10234. ```
  10235. */
  10236. static join(): string;
  10237. /**
  10238. !#en Get the ext name of a path including '.', like '.png'.
  10239. !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  10240. @param pathStr pathStr
  10241. @example
  10242. ```js
  10243. ---------------------------
  10244. cc.path.extname("a/b.png"); //-->".png"
  10245. cc.path.extname("a/b.png?a=1&b=2"); //-->".png"
  10246. cc.path.extname("a/b"); //-->null
  10247. cc.path.extname("a/b?a=1&b=2"); //-->null
  10248. ```
  10249. */
  10250. static extname(pathStr: string): any;
  10251. /**
  10252. !#en Get the main name of a file name
  10253. !#zh 获取文件名的主名称
  10254. @param fileName fileName
  10255. */
  10256. static mainFileName(fileName: string): string;
  10257. /**
  10258. !#en Get the file name of a file path.
  10259. !#zh 获取文件路径的文件名。
  10260. @param pathStr pathStr
  10261. @param extname extname
  10262. @example
  10263. ```js
  10264. ---------------------------------
  10265. cc.path.basename("a/b.png"); //-->"b.png"
  10266. cc.path.basename("a/b.png?a=1&b=2"); //-->"b.png"
  10267. cc.path.basename("a/b.png", ".png"); //-->"b"
  10268. cc.path.basename("a/b.png?a=1&b=2", ".png"); //-->"b"
  10269. cc.path.basename("a/b.png", ".txt"); //-->"b.png"
  10270. ```
  10271. */
  10272. static basename(pathStr: string, extname?: string): any;
  10273. /**
  10274. !#en Get dirname of a file path.
  10275. !#zh 获取文件路径的目录名。
  10276. @param pathStr pathStr
  10277. @example
  10278. ```js
  10279. ---------------------------------
  10280. * unix
  10281. cc.path.driname("a/b/c.png"); //-->"a/b"
  10282. cc.path.driname("a/b/c.png?a=1&b=2"); //-->"a/b"
  10283. cc.path.dirname("a/b/"); //-->"a/b"
  10284. cc.path.dirname("c.png"); //-->""
  10285. * windows
  10286. cc.path.driname("a\\b\\c.png"); //-->"a\b"
  10287. cc.path.driname("a\\b\\c.png?a=1&b=2"); //-->"a\b"
  10288. ```
  10289. */
  10290. static dirname(pathStr: string): any;
  10291. /**
  10292. !#en Change extname of a file path.
  10293. !#zh 更改文件路径的扩展名。
  10294. @param pathStr pathStr
  10295. @param extname extname
  10296. @example
  10297. ```js
  10298. ---------------------------------
  10299. cc.path.changeExtname("a/b.png", ".plist"); //-->"a/b.plist"
  10300. cc.path.changeExtname("a/b.png?a=1&b=2", ".plist"); //-->"a/b.plist?a=1&b=2"
  10301. ```
  10302. */
  10303. static changeExtname(pathStr: string, extname?: string): string;
  10304. }
  10305. /** !#en
  10306. AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>
  10307. !#zh
  10308. AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转,缩放转变所组成。<br/> */
  10309. export class AffineTransform {
  10310. /**
  10311. !#en Create a AffineTransform object with all contents in the matrix.
  10312. !#zh 用在矩阵中的所有内容创建一个 AffineTransform 对象。
  10313. @param a a
  10314. @param b b
  10315. @param c c
  10316. @param d d
  10317. @param tx tx
  10318. @param ty ty
  10319. */
  10320. static create(a: number, b: number, c: number, d: number, tx: number, ty: number): AffineTransform;
  10321. /**
  10322. !#en
  10323. Create a identity transformation matrix: <br/>
  10324. [ 1, 0, 0, <br/>
  10325. 0, 1, 0 ]
  10326. !#zh
  10327. 单位矩阵:<br/>
  10328. [ 1, 0, 0, <br/>
  10329. 0, 1, 0 ]
  10330. */
  10331. static identity(): AffineTransform;
  10332. /**
  10333. !#en Clone a AffineTransform object from the specified transform.
  10334. !#zh 克隆指定的 AffineTransform 对象。
  10335. @param t t
  10336. */
  10337. static clone(t: AffineTransform): AffineTransform;
  10338. /**
  10339. !#en
  10340. Concatenate a transform matrix to another
  10341. The results are reflected in the out affine transform
  10342. out = t1 * t2
  10343. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10344. !#zh
  10345. 拼接两个矩阵,将结果保存到 out 矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10346. out = t1 * t2
  10347. @param out Out object to store the concat result
  10348. @param t1 The first transform object.
  10349. @param t2 The transform object to concatenate.
  10350. */
  10351. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): AffineTransform;
  10352. /**
  10353. !#en Get the invert transform of an AffineTransform object.
  10354. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10355. !#zh 求逆矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10356. @param out out
  10357. @param t t
  10358. */
  10359. static invert(out: AffineTransform, t: AffineTransform): AffineTransform;
  10360. /**
  10361. !#en Get an AffineTransform object from a given matrix 4x4.
  10362. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  10363. !#zh 从一个 4x4 Matrix 获取 AffineTransform 对象。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  10364. @param out out
  10365. @param mat mat
  10366. */
  10367. static invert(out: AffineTransform, mat: Mat4): AffineTransform;
  10368. /**
  10369. !#en Apply the affine transformation on a point.
  10370. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
  10371. !#zh 对一个点应用矩阵变换。这个函数不创建任何内存,你需要先创建一个 Vec2 对象用来存储结果,并作为第一个参数传入函数。
  10372. @param out The output point to store the result
  10373. @param point Point to apply transform or x.
  10374. @param transOrY transform matrix or y.
  10375. @param t transform matrix.
  10376. */
  10377. static transformVec2(out: Vec2, point: Vec2|number, transOrY: AffineTransform|number, t?: AffineTransform): Vec2;
  10378. /**
  10379. !#en Apply the affine transformation on a size.
  10380. This function is memory free, you should create the output Size by yourself and manage its memory.
  10381. !#zh 应用仿射变换矩阵到 Size 上。这个函数不创建任何内存,你需要先创建一个 Size 对象用来存储结果,并作为第一个参数传入函数。
  10382. @param out The output point to store the result
  10383. @param size size
  10384. @param t t
  10385. */
  10386. static transformSize(out: Size, size: Size, t: AffineTransform): Size;
  10387. /**
  10388. !#en Apply the affine transformation on a rect.
  10389. This function is memory free, you should create the output Rect by yourself and manage its memory.
  10390. !#zh 应用仿射变换矩阵到 Rect 上。这个函数不创建任何内存,你需要先创建一个 Rect 对象用来存储结果,并作为第一个参数传入函数。
  10391. @param out out
  10392. @param rect rect
  10393. @param anAffineTransform anAffineTransform
  10394. */
  10395. static transformRect(out: Rect, rect: Rect, anAffineTransform: AffineTransform): Rect;
  10396. /**
  10397. !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
  10398. This function is memory free, you should create the output vectors by yourself and manage their memory.
  10399. !#zh 应用仿射变换矩阵到 Rect 上, 并转换为有向包围盒。这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  10400. @param out_bl out_bl
  10401. @param out_tl out_tl
  10402. @param out_tr out_tr
  10403. @param out_br out_br
  10404. @param rect rect
  10405. @param anAffineTransform anAffineTransform
  10406. */
  10407. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform): void;
  10408. }
  10409. /** A base node for CCNode, it will:
  10410. - maintain scene hierarchy and active logic
  10411. - notifications if some properties changed
  10412. - define some interfaces shares between CCNode
  10413. - define machanisms for Enity Component Systems
  10414. - define prefab and serialize functions */
  10415. export class _BaseNode extends Object implements EventTarget {
  10416. /** !#en Name of node.
  10417. !#zh 该节点名称。 */
  10418. name: string;
  10419. /** !#en The uuid for editor, will be stripped before building project.
  10420. !#zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。 */
  10421. uuid: string;
  10422. /** !#en All children nodes.
  10423. !#zh 节点的所有子节点。 */
  10424. children: Node[];
  10425. /** !#en All children nodes.
  10426. !#zh 节点的子节点数量。 */
  10427. childrenCount: number;
  10428. /** !#en
  10429. The local active state of this node.<br/>
  10430. Note that a Node may be inactive because a parent is not active, even if this returns true.<br/>
  10431. Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
  10432. !#zh
  10433. 当前节点的自身激活状态。<br/>
  10434. 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。<br/>
  10435. 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。 */
  10436. active: boolean;
  10437. /** !#en Indicates whether this node is active in the scene.
  10438. !#zh 表示此节点是否在场景中激活。 */
  10439. activeInHierarchy: boolean;
  10440. /**
  10441. @param name name
  10442. */
  10443. constructor(name?: string);
  10444. /** !#en The parent of the node.
  10445. !#zh 该节点的父节点。 */
  10446. parent: Node;
  10447. /**
  10448. !#en Get parent of the node.
  10449. !#zh 获取该节点的父节点。
  10450. @example
  10451. ```js
  10452. var parent = this.node.getParent();
  10453. ```
  10454. */
  10455. getParent(): Node;
  10456. /**
  10457. !#en Set parent of the node.
  10458. !#zh 设置该节点的父节点。
  10459. @param value value
  10460. @example
  10461. ```js
  10462. node.setParent(newNode);
  10463. ```
  10464. */
  10465. setParent(value: Node): void;
  10466. /**
  10467. !#en
  10468. Properties configuration function <br/>
  10469. All properties in attrs will be set to the node, <br/>
  10470. when the setter of the node is available, <br/>
  10471. the property will be set via setter function.<br/>
  10472. !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  10473. @param attrs Properties to be set to node
  10474. @example
  10475. ```js
  10476. var attrs = { key: 0, num: 100 };
  10477. node.attr(attrs);
  10478. ```
  10479. */
  10480. attr(attrs: any): void;
  10481. /**
  10482. !#en Returns a child from the container given its uuid.
  10483. !#zh 通过 uuid 获取节点的子节点。
  10484. @param uuid The uuid to find the child node.
  10485. @example
  10486. ```js
  10487. var child = node.getChildByUuid(uuid);
  10488. ```
  10489. */
  10490. getChildByUuid(uuid: string): Node;
  10491. /**
  10492. !#en Returns a child from the container given its name.
  10493. !#zh 通过名称获取节点的子节点。
  10494. @param name A name to find the child node.
  10495. @example
  10496. ```js
  10497. var child = node.getChildByName("Test Node");
  10498. ```
  10499. */
  10500. getChildByName(name: string): Node;
  10501. /**
  10502. !#en
  10503. Inserts a child to the node at a specified index.
  10504. !#zh
  10505. 插入子节点到指定位置
  10506. @param child the child node to be inserted
  10507. @param siblingIndex the sibling index to place the child in
  10508. @example
  10509. ```js
  10510. node.insertChild(child, 2);
  10511. ```
  10512. */
  10513. insertChild(child: Node, siblingIndex: number): void;
  10514. /**
  10515. !#en Get the sibling index.
  10516. !#zh 获取同级索引。
  10517. @example
  10518. ```js
  10519. var index = node.getSiblingIndex();
  10520. ```
  10521. */
  10522. getSiblingIndex(): number;
  10523. /**
  10524. !#en Set the sibling index of this node.
  10525. !#zh 设置节点同级索引。
  10526. @param index index
  10527. @example
  10528. ```js
  10529. node.setSiblingIndex(1);
  10530. ```
  10531. */
  10532. setSiblingIndex(index: number): void;
  10533. /**
  10534. !#en Walk though the sub children tree of the current node.
  10535. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children.
  10536. This function call is not recursive, it's based on stack.
  10537. Please don't walk any other node inside the walk process.
  10538. !#zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  10539. 对子树中的所有节点,包含当前节点,会执行两次回调,prefunc 会在访问它的子节点之前调用,postfunc 会在访问所有子节点之后调用。
  10540. 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  10541. 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  10542. @param prefunc The callback to process node when reach the node for the first time
  10543. @param postfunc The callback to process node when re-visit the node after walked all children in its sub tree
  10544. @example
  10545. ```js
  10546. node.walk(function (target) {
  10547. console.log('Walked through node ' + target.name + ' for the first time');
  10548. }, function (target) {
  10549. console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  10550. });
  10551. ```
  10552. */
  10553. walk(prefunc: (target: _BaseNode) => void, postfunc: (target: _BaseNode) => void): void;
  10554. /**
  10555. !#en
  10556. Remove itself from its parent node. If cleanup is `true`, then also remove all events and actions. <br/>
  10557. 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/>
  10558. If the node orphan, then nothing happens.
  10559. !#zh
  10560. 从父节点中删除该节点。如果不传入 cleanup 参数或者传入 `true`,那么这个节点上所有绑定的事件、action 都会被删除。<br/>
  10561. 因此建议调用这个 API 时总是传入 `false` 参数。<br/>
  10562. 如果这个节点是一个孤节点,那么什么都不会发生。
  10563. @param cleanup true if all actions and callbacks on this node should be removed, false otherwise.
  10564. @example
  10565. ```js
  10566. node.removeFromParent();
  10567. node.removeFromParent(false);
  10568. ```
  10569. */
  10570. removeFromParent(cleanup?: boolean): void;
  10571. /**
  10572. !#en
  10573. Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
  10574. If the cleanup parameter is not passed, it will force a cleanup. <br/>
  10575. "remove" logic MUST only be on this method <br/>
  10576. If a class wants to extend the 'removeChild' behavior it only needs <br/>
  10577. to override this method.
  10578. !#zh
  10579. 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10580. 如果 cleanup 参数不传入,默认为 true 表示清理。<br/>
  10581. @param child The child node which will be removed.
  10582. @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
  10583. @example
  10584. ```js
  10585. node.removeChild(newNode);
  10586. node.removeChild(newNode, false);
  10587. ```
  10588. */
  10589. removeChild(child: Node, cleanup?: boolean): void;
  10590. /**
  10591. !#en
  10592. Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
  10593. If the cleanup parameter is not passed, it will force a cleanup.
  10594. !#zh
  10595. 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  10596. 如果 cleanup 参数不传入,默认为 true 表示清理。
  10597. @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
  10598. @example
  10599. ```js
  10600. node.removeAllChildren();
  10601. node.removeAllChildren(false);
  10602. ```
  10603. */
  10604. removeAllChildren(cleanup?: boolean): void;
  10605. /**
  10606. !#en Is this node a child of the given node?
  10607. !#zh 是否是指定节点的子节点?
  10608. @param parent parent
  10609. @example
  10610. ```js
  10611. node.isChildOf(newNode);
  10612. ```
  10613. */
  10614. isChildOf(parent: Node): boolean;
  10615. /**
  10616. !#en
  10617. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  10618. You can also get component in the node by passing in the name of the script.
  10619. !#zh
  10620. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  10621. 传入参数也可以是脚本的名称。
  10622. @param typeOrClassName typeOrClassName
  10623. @example
  10624. ```js
  10625. // get sprite component.
  10626. var sprite = node.getComponent(cc.Sprite);
  10627. // get custom test calss.
  10628. var test = node.getComponent("Test");
  10629. ```
  10630. */
  10631. getComponent<T extends Component>(type: {prototype: T}): T;
  10632. getComponent(className: string): any;
  10633. /**
  10634. !#en Returns all components of supplied type in the node.
  10635. !#zh 返回节点上指定类型的所有组件。
  10636. @param typeOrClassName typeOrClassName
  10637. @example
  10638. ```js
  10639. var sprites = node.getComponents(cc.Sprite);
  10640. var tests = node.getComponents("Test");
  10641. ```
  10642. */
  10643. getComponents<T extends Component>(type: {prototype: T}): T[];
  10644. getComponents(className: string): any[];
  10645. /**
  10646. !#en Returns the component of supplied type in any of its children using depth first search.
  10647. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  10648. @param typeOrClassName typeOrClassName
  10649. @example
  10650. ```js
  10651. var sprite = node.getComponentInChildren(cc.Sprite);
  10652. var Test = node.getComponentInChildren("Test");
  10653. ```
  10654. */
  10655. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  10656. getComponentInChildren(className: string): any;
  10657. /**
  10658. !#en Returns all components of supplied type in self or any of its children.
  10659. !#zh 递归查找自身或所有子节点中指定类型的组件
  10660. @param typeOrClassName typeOrClassName
  10661. @example
  10662. ```js
  10663. var sprites = node.getComponentsInChildren(cc.Sprite);
  10664. var tests = node.getComponentsInChildren("Test");
  10665. ```
  10666. */
  10667. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  10668. getComponentsInChildren(className: string): any[];
  10669. /**
  10670. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  10671. !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  10672. @param typeOrClassName The constructor or the class name of the component to add
  10673. @example
  10674. ```js
  10675. var sprite = node.addComponent(cc.Sprite);
  10676. var test = node.addComponent("Test");
  10677. ```
  10678. */
  10679. addComponent<T extends Component>(type: {new(): T}): T;
  10680. addComponent(className: string): any;
  10681. /**
  10682. !#en
  10683. Removes a component identified by the given name or removes the component object given.
  10684. You can also use component.destroy() if you already have the reference.
  10685. !#zh
  10686. 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  10687. 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  10688. @param component The need remove component.
  10689. @example
  10690. ```js
  10691. node.removeComponent(cc.Sprite);
  10692. var Test = require("Test");
  10693. node.removeComponent(Test);
  10694. ```
  10695. */
  10696. removeComponent(component: string|Function|Component): void;
  10697. /**
  10698. !#en
  10699. Destroy all children from the node, and release all their own references to other objects.<br/>
  10700. Actual destruct operation will delayed until before rendering.
  10701. !#zh
  10702. 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
  10703. 实际销毁操作会延迟到当前帧渲染前执行。
  10704. @example
  10705. ```js
  10706. node.destroyAllChildren();
  10707. ```
  10708. */
  10709. destroyAllChildren(): void;
  10710. /**
  10711. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  10712. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  10713. @param type The type of event.
  10714. */
  10715. hasEventListener(type: string): boolean;
  10716. /**
  10717. !#en
  10718. Register an callback of a specific event type on the EventTarget.
  10719. This type of event should be triggered via `emit`.
  10720. !#zh
  10721. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  10722. @param type A string representing the event type to listen for.
  10723. @param callback The callback that will be invoked when the event is dispatched.
  10724. The callback is ignored if it is a duplicate (the callbacks are unique).
  10725. @param target The target (this object) to invoke the callback, can be null
  10726. @example
  10727. ```js
  10728. eventTarget.on('fire', function () {
  10729. cc.log("fire in the hole");
  10730. }, node);
  10731. ```
  10732. */
  10733. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  10734. /**
  10735. !#en
  10736. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  10737. if only type is passed as parameter, all listeners registered with that type will be removed.
  10738. !#zh
  10739. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  10740. @param type A string representing the event type being removed.
  10741. @param callback The callback to remove.
  10742. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  10743. @example
  10744. ```js
  10745. // register fire eventListener
  10746. var callback = eventTarget.on('fire', function () {
  10747. cc.log("fire in the hole");
  10748. }, target);
  10749. // remove fire event listener
  10750. eventTarget.off('fire', callback, target);
  10751. // remove all fire event listeners
  10752. eventTarget.off('fire');
  10753. ```
  10754. */
  10755. off(type: string, callback?: Function, target?: any): void;
  10756. /**
  10757. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  10758. This is not for removing all listeners in the current event target,
  10759. and this is not for removing all listeners the target parameter have registered.
  10760. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  10761. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  10762. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  10763. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  10764. @param target The target to be searched for all related listeners
  10765. */
  10766. targetOff(target: any): void;
  10767. /**
  10768. !#en
  10769. Register an callback of a specific event type on the EventTarget,
  10770. the callback will remove itself after the first time it is triggered.
  10771. !#zh
  10772. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  10773. @param type A string representing the event type to listen for.
  10774. @param callback The callback that will be invoked when the event is dispatched.
  10775. The callback is ignored if it is a duplicate (the callbacks are unique).
  10776. @param target The target (this object) to invoke the callback, can be null
  10777. @example
  10778. ```js
  10779. eventTarget.once('fire', function () {
  10780. cc.log("this is the callback and will be invoked only once");
  10781. }, node);
  10782. ```
  10783. */
  10784. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  10785. /**
  10786. !#en
  10787. Trigger an event directly with the event name and necessary arguments.
  10788. !#zh
  10789. 通过事件名发送自定义事件
  10790. @param type event type
  10791. @param arg1 First argument
  10792. @param arg2 Second argument
  10793. @param arg3 Third argument
  10794. @param arg4 Fourth argument
  10795. @param arg5 Fifth argument
  10796. @example
  10797. ```js
  10798. eventTarget.emit('fire', event);
  10799. eventTarget.emit('fire', message, emitter);
  10800. ```
  10801. */
  10802. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  10803. /**
  10804. !#en
  10805. Send an event with the event object.
  10806. !#zh
  10807. 通过事件对象派发事件
  10808. @param event event
  10809. */
  10810. dispatchEvent(event: Event): void;
  10811. }
  10812. /** misc utilities */
  10813. export class misc {
  10814. /**
  10815. !#en Clamp a value between from and to.
  10816. !#zh
  10817. 限定浮点数的最大最小值。<br/>
  10818. 数值大于 max_inclusive 则返回 max_inclusive。<br/>
  10819. 数值小于 min_inclusive 则返回 min_inclusive。<br/>
  10820. 否则返回自身。
  10821. @param value value
  10822. @param min_inclusive min_inclusive
  10823. @param max_inclusive max_inclusive
  10824. @example
  10825. ```js
  10826. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  10827. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  10828. var v3 = cc.misc.clampf(10, 0, 20); // 10;
  10829. ```
  10830. */
  10831. static clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  10832. /**
  10833. !#en Clamp a value between 0 and 1.
  10834. !#zh 限定浮点数的取值范围为 0 ~ 1 之间。
  10835. @param value value
  10836. @example
  10837. ```js
  10838. var v1 = cc.misc.clamp01(20); // 1;
  10839. var v2 = cc.misc.clamp01(-1); // 0;
  10840. var v3 = cc.misc.clamp01(0.5); // 0.5;
  10841. ```
  10842. */
  10843. static clamp01(value: number): number;
  10844. /**
  10845. Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  10846. @param a number A
  10847. @param b number B
  10848. @param r ratio between 0 and 1
  10849. @example
  10850. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/platform/CCMacro/lerp.js
  10851. */
  10852. static lerp(a: number, b: number, r: number): number;
  10853. /**
  10854. converts degrees to radians
  10855. @param angle angle
  10856. */
  10857. static degreesToRadians(angle: number): number;
  10858. /**
  10859. converts radians to degrees
  10860. @param angle angle
  10861. */
  10862. static radiansToDegrees(angle: number): number;
  10863. }
  10864. /** !#en
  10865. Representation of RGBA colors.
  10866. Each color component is a floating point value with a range from 0 to 255.
  10867. You can also use the convenience method {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} to create a new Color.
  10868. !#zh
  10869. cc.Color 用于表示颜色。
  10870. 它包含 RGBA 四个以浮点数保存的颜色分量,每个的值都在 0 到 255 之间。
  10871. 您也可以通过使用 {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */
  10872. export class Color extends ValueType {
  10873. /**
  10874. @param r red component of the color, default value is 0.
  10875. @param g green component of the color, defualt value is 0.
  10876. @param b blue component of the color, default value is 0.
  10877. @param a alpha component of the color, default value is 255.
  10878. */
  10879. constructor(r?: number, g?: number, b?: number, a?: number);
  10880. /** !#en Solid white, RGBA is [255, 255, 255, 255].
  10881. !#zh 纯白色,RGBA 是 [255, 255, 255, 255]。 */
  10882. static WHITE: Color;
  10883. /** !#en Solid black, RGBA is [0, 0, 0, 255].
  10884. !#zh 纯黑色,RGBA 是 [0, 0, 0, 255]。 */
  10885. static BLACK: Color;
  10886. /** !#en Transparent, RGBA is [0, 0, 0, 0].
  10887. !#zh 透明,RGBA 是 [0, 0, 0, 0]。 */
  10888. static TRANSPARENT: Color;
  10889. /** !#en Grey, RGBA is [127.5, 127.5, 127.5].
  10890. !#zh 灰色,RGBA 是 [127.5, 127.5, 127.5]。 */
  10891. static GRAY: Color;
  10892. /** !#en Solid red, RGBA is [255, 0, 0].
  10893. !#zh 纯红色,RGBA 是 [255, 0, 0]。 */
  10894. static RED: Color;
  10895. /** !#en Solid green, RGBA is [0, 255, 0].
  10896. !#zh 纯绿色,RGBA 是 [0, 255, 0]。 */
  10897. static GREEN: Color;
  10898. /** !#en Solid blue, RGBA is [0, 0, 255].
  10899. !#zh 纯蓝色,RGBA 是 [0, 0, 255]。 */
  10900. static BLUE: Color;
  10901. /** !#en Yellow, RGBA is [255, 235, 4].
  10902. !#zh 黄色,RGBA 是 [255, 235, 4]。 */
  10903. static YELLOW: Color;
  10904. /** !#en Orange, RGBA is [255, 127, 0].
  10905. !#zh 橙色,RGBA 是 [255, 127, 0]。 */
  10906. static ORANGE: Color;
  10907. /** !#en Cyan, RGBA is [0, 255, 255].
  10908. !#zh 青色,RGBA 是 [0, 255, 255]。 */
  10909. static CYAN: Color;
  10910. /** !#en Magenta, RGBA is [255, 0, 255].
  10911. !#zh 洋红色(品红色),RGBA 是 [255, 0, 255]。 */
  10912. static MAGENTA: Color;
  10913. /**
  10914. !#en Clone a new color from the current color.
  10915. !#zh 克隆当前颜色。
  10916. @example
  10917. ```js
  10918. var color = new cc.Color();
  10919. var newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}
  10920. ```
  10921. */
  10922. clone(): Color;
  10923. /**
  10924. !#en TODO
  10925. !#zh 判断两个颜色是否相等。
  10926. @param other other
  10927. @example
  10928. ```js
  10929. var color1 = cc.Color.WHITE;
  10930. var color2 = new cc.Color(255, 255, 255);
  10931. cc.log(color1.equals(color2)); // true;
  10932. color2 = cc.Color.RED;
  10933. cc.log(color2.equals(color1)); // false;
  10934. ```
  10935. */
  10936. equals(other: Color): boolean;
  10937. /**
  10938. !#en TODO
  10939. !#zh 线性插值
  10940. @param to to
  10941. @param ratio the interpolation coefficient.
  10942. @param out optional, the receiving vector.
  10943. @example
  10944. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/lerp.js
  10945. */
  10946. lerp(to: Color, ratio: number, out?: Color): Color;
  10947. /**
  10948. !#en TODO
  10949. !#zh 转换为方便阅读的字符串。
  10950. @example
  10951. ```js
  10952. var color = cc.Color.WHITE;
  10953. color.toString(); // "rgba(255, 255, 255, 255)"
  10954. ```
  10955. */
  10956. toString(): string;
  10957. /**
  10958. !#en Gets red channel value
  10959. !#zh 获取当前颜色的红色值。
  10960. */
  10961. getR(): number;
  10962. /**
  10963. !#en Sets red value and return the current color object
  10964. !#zh 设置当前的红色值,并返回当前对象。
  10965. @param red the new Red component.
  10966. @example
  10967. ```js
  10968. var color = new cc.Color();
  10969. color.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}
  10970. ```
  10971. */
  10972. setR(red: number): Color;
  10973. /**
  10974. !#en Gets green channel value
  10975. !#zh 获取当前颜色的绿色值。
  10976. */
  10977. getG(): number;
  10978. /**
  10979. !#en Sets green value and return the current color object
  10980. !#zh 设置当前的绿色值,并返回当前对象。
  10981. @param green the new Green component.
  10982. @example
  10983. ```js
  10984. var color = new cc.Color();
  10985. color.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}
  10986. ```
  10987. */
  10988. setG(green: number): Color;
  10989. /**
  10990. !#en Gets blue channel value
  10991. !#zh 获取当前颜色的蓝色值。
  10992. */
  10993. getB(): number;
  10994. /**
  10995. !#en Sets blue value and return the current color object
  10996. !#zh 设置当前的蓝色值,并返回当前对象。
  10997. @param blue the new Blue component.
  10998. @example
  10999. ```js
  11000. var color = new cc.Color();
  11001. color.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}
  11002. ```
  11003. */
  11004. setB(blue: number): Color;
  11005. /**
  11006. !#en Gets alpha channel value
  11007. !#zh 获取当前颜色的透明度值。
  11008. */
  11009. getA(): number;
  11010. /**
  11011. !#en Sets alpha value and return the current color object
  11012. !#zh 设置当前的透明度,并返回当前对象。
  11013. @param alpha the new Alpha component.
  11014. @example
  11015. ```js
  11016. var color = new cc.Color();
  11017. color.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}
  11018. ```
  11019. */
  11020. setA(alpha: number): Color;
  11021. /**
  11022. !#en Convert color to css format.
  11023. !#zh 转换为 CSS 格式。
  11024. @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  11025. @example
  11026. ```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/value-types/CCColor/toCSS.js
  11027. */
  11028. toCSS(opt: string): string;
  11029. /**
  11030. !#en Read hex string and store color data into the current color object, the hex string must be formated as rgba or rgb.
  11031. !#zh 读取 16 进制颜色。
  11032. @param hexString hexString
  11033. @example
  11034. ```js
  11035. var color = cc.Color.BLACK;
  11036. color.fromHEX("#FFFF33"); // Color {r: 255, g: 255, b: 51, a: 255};
  11037. ```
  11038. */
  11039. fromHEX(hexString: string): Color;
  11040. /**
  11041. !#en convert Color to HEX color string.
  11042. e.g. cc.color(255,6,255) to : "#ff06ff"
  11043. !#zh 转换为 16 进制。
  11044. @param fmt "#rgb", "#rrggbb" or "#rrggbbaa".
  11045. @example
  11046. ```js
  11047. var color = cc.Color.BLACK;
  11048. color.toHEX("#rgb"); // "000";
  11049. color.toHEX("#rrggbb"); // "000000";
  11050. ```
  11051. */
  11052. toHEX(fmt: string): string;
  11053. /**
  11054. !#en Convert to 24bit rgb value.
  11055. !#zh 转换为 24bit 的 RGB 值。
  11056. @example
  11057. ```js
  11058. var color = cc.Color.YELLOW;
  11059. color.toRGBValue(); // 16771844;
  11060. ```
  11061. */
  11062. toRGBValue(): number;
  11063. /**
  11064. !#en Read HSV model color and convert to RGB color
  11065. !#zh 读取 HSV(色彩模型)格式。
  11066. @param h h
  11067. @param s s
  11068. @param v v
  11069. @example
  11070. ```js
  11071. var color = cc.Color.YELLOW;
  11072. color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  11073. ```
  11074. */
  11075. fromHSV(h: number, s: number, v: number): Color;
  11076. /**
  11077. !#en Transform to HSV model color
  11078. !#zh 转换为 HSV(色彩模型)格式。
  11079. @example
  11080. ```js
  11081. var color = cc.Color.YELLOW;
  11082. color.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};
  11083. ```
  11084. */
  11085. toHSV(): any;
  11086. }
  11087. /** !#en Representation of 4*4 matrix.
  11088. !#zh 表示 4*4 矩阵 */
  11089. export class Mat4 extends ValueType {
  11090. /**
  11091. !#en
  11092. Constructor
  11093. see {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11094. !#zh
  11095. 构造函数,可查看 {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11096. @param m00 Component in column 0, row 0 position (index 0)
  11097. @param m01 Component in column 0, row 1 position (index 1)
  11098. @param m02 Component in column 0, row 2 position (index 2)
  11099. @param m03 Component in column 0, row 3 position (index 3)
  11100. @param m10 Component in column 1, row 0 position (index 4)
  11101. @param m11 Component in column 1, row 1 position (index 5)
  11102. @param m12 Component in column 1, row 2 position (index 6)
  11103. @param m13 Component in column 1, row 3 position (index 7)
  11104. @param m20 Component in column 2, row 0 position (index 8)
  11105. @param m21 Component in column 2, row 1 position (index 9)
  11106. @param m22 Component in column 2, row 2 position (index 10)
  11107. @param m23 Component in column 2, row 3 position (index 11)
  11108. @param m30 Component in column 3, row 0 position (index 12)
  11109. @param m31 Component in column 3, row 1 position (index 13)
  11110. @param m32 Component in column 3, row 2 position (index 14)
  11111. @param m33 Component in column 3, row 3 position (index 15)
  11112. */
  11113. 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);
  11114. /**
  11115. !#en clone a Mat4 object
  11116. !#zh 克隆一个 Mat4 对象
  11117. */
  11118. clone(): Mat4;
  11119. /**
  11120. !#en Sets the matrix with another one's value
  11121. !#zh 用另一个矩阵设置这个矩阵的值。
  11122. @param srcObj srcObj
  11123. */
  11124. set(srcObj: Mat4): Mat4;
  11125. /**
  11126. !#en Check whether two matrix equal
  11127. !#zh 当前的矩阵是否与指定的矩阵相等。
  11128. @param other other
  11129. */
  11130. equals(other: Mat4): boolean;
  11131. /**
  11132. !#en Check whether two matrix equal with default degree of variance.
  11133. !#zh
  11134. 近似判断两个矩阵是否相等。<br/>
  11135. 判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
  11136. @param other other
  11137. */
  11138. fuzzyEquals(other: Mat4): boolean;
  11139. /**
  11140. !#en Transform to string with matrix informations
  11141. !#zh 转换为方便阅读的字符串。
  11142. */
  11143. toString(): string;
  11144. /**
  11145. Set the matrix to the identity matrix
  11146. */
  11147. identity(): Mat4;
  11148. /**
  11149. Transpose the values of a mat4
  11150. @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.
  11151. */
  11152. transpose(out?: Mat4): Mat4;
  11153. /**
  11154. Inverts a mat4
  11155. @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.
  11156. */
  11157. invert(out?: Mat4): Mat4;
  11158. /**
  11159. Calculates the adjugate of a mat4
  11160. @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.
  11161. */
  11162. adjoint(out?: Mat4): Mat4;
  11163. /**
  11164. Calculates the determinant of a mat4
  11165. */
  11166. determinant(): number;
  11167. /**
  11168. Adds two Mat4
  11169. @param other the second operand
  11170. @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.
  11171. */
  11172. add(other: Mat4, out?: Mat4): Mat4;
  11173. /**
  11174. Subtracts the current matrix with another one
  11175. @param other the second operand
  11176. @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
  11177. */
  11178. sub(other: Mat4, out?: Mat4): Mat4;
  11179. /**
  11180. Subtracts the current matrix with another one
  11181. @param other the second operand
  11182. @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
  11183. */
  11184. mul(other: Mat4, out?: Mat4): Mat4;
  11185. /**
  11186. Multiply each element of the matrix by a scalar.
  11187. @param number amount to scale the matrix's elements by
  11188. @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
  11189. */
  11190. mulScalar(number: number, out?: Mat4): Mat4;
  11191. /**
  11192. Translate a mat4 by the given vector
  11193. @param v vector to translate by
  11194. @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
  11195. */
  11196. translate(v: Vec3, out?: Mat4): Mat4;
  11197. /**
  11198. Scales the mat4 by the dimensions in the given vec3
  11199. @param v vector to scale by
  11200. @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
  11201. */
  11202. scale(v: Vec3, out?: Mat4): Mat4;
  11203. /**
  11204. Rotates a mat4 by the given angle around the given axis
  11205. @param rad the angle to rotate the matrix by
  11206. @param axis the axis to rotate around
  11207. @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
  11208. */
  11209. rotate(rad: number, axis: Vec3, out?: Mat4): Mat4;
  11210. /**
  11211. Returns the translation vector component of a transformation matrix.
  11212. @param out Vector to receive translation component, if not provided, a new vec3 will be created
  11213. */
  11214. getTranslation(out: Vec3): Vec3;
  11215. /**
  11216. Returns the scale factor component of a transformation matrix
  11217. @param out Vector to receive scale component, if not provided, a new vec3 will be created
  11218. */
  11219. getScale(out: Vec3): Vec3;
  11220. /**
  11221. Returns the rotation factor component of a transformation matrix
  11222. @param out Vector to receive rotation component, if not provided, a new quaternion object will be created
  11223. */
  11224. getRotation(out: Quat): Quat;
  11225. /**
  11226. Restore the matrix values from a quaternion rotation, vector translation and vector scale
  11227. @param q Rotation quaternion
  11228. @param v Translation vector
  11229. @param s Scaling vector
  11230. */
  11231. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  11232. /**
  11233. Restore the matrix values from a quaternion rotation
  11234. @param q Rotation quaternion
  11235. */
  11236. fromQuat(q: Quat): Mat4;
  11237. /**
  11238. !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
  11239. !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
  11240. @param m00 Component in column 0, row 0 position (index 0)
  11241. @param m01 Component in column 0, row 1 position (index 1)
  11242. @param m02 Component in column 0, row 2 position (index 2)
  11243. @param m03 Component in column 0, row 3 position (index 3)
  11244. @param m10 Component in column 1, row 0 position (index 4)
  11245. @param m11 Component in column 1, row 1 position (index 5)
  11246. @param m12 Component in column 1, row 2 position (index 6)
  11247. @param m13 Component in column 1, row 3 position (index 7)
  11248. @param m20 Component in column 2, row 0 position (index 8)
  11249. @param m21 Component in column 2, row 1 position (index 9)
  11250. @param m22 Component in column 2, row 2 position (index 10)
  11251. @param m23 Component in column 2, row 3 position (index 11)
  11252. @param m30 Component in column 3, row 0 position (index 12)
  11253. @param m31 Component in column 3, row 1 position (index 13)
  11254. @param m32 Component in column 3, row 2 position (index 14)
  11255. @param m33 Component in column 3, row 3 position (index 15)
  11256. */
  11257. 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;
  11258. }
  11259. /** !#en A 2D rectangle defined by x, y position and width, height.
  11260. !#zh 通过位置和宽高定义的 2D 矩形。 */
  11261. export class Rect extends ValueType {
  11262. /**
  11263. !#en
  11264. Constructor of Rect class.
  11265. see {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} for convenience method.
  11266. !#zh
  11267. Rect类的构造函数。可以通过 {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} 简便方法进行创建。
  11268. @param x x
  11269. @param y y
  11270. @param w w
  11271. @param h h
  11272. */
  11273. constructor(x?: number, y?: number, w?: number, h?: number);
  11274. x: number;
  11275. y: number;
  11276. width: number;
  11277. height: number;
  11278. /**
  11279. !#en Creates a rectangle from two coordinate values.
  11280. !#zh 根据指定 2 个坐标创建出一个矩形区域。
  11281. @param v1 v1
  11282. @param v2 v2
  11283. @example
  11284. ```js
  11285. cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
  11286. ```
  11287. */
  11288. static fromMinMax(v1: Vec2, v2: Vec2): Rect;
  11289. /**
  11290. !#en TODO
  11291. !#zh 克隆一个新的 Rect。
  11292. @example
  11293. ```js
  11294. var a = new cc.Rect(0, 0, 10, 10);
  11295. a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
  11296. ```
  11297. */
  11298. clone(): Rect;
  11299. /**
  11300. !#en TODO
  11301. !#zh 是否等于指定的矩形。
  11302. @param other other
  11303. @example
  11304. ```js
  11305. var a = new cc.Rect(0, 0, 10, 10);
  11306. var b = new cc.Rect(0, 0, 10, 10);
  11307. a.equals(b);// true;
  11308. ```
  11309. */
  11310. equals(other: Rect): boolean;
  11311. /**
  11312. !#en TODO
  11313. !#zh 线性插值
  11314. @param to to
  11315. @param ratio the interpolation coefficient.
  11316. @param out optional, the receiving vector.
  11317. @example
  11318. ```js
  11319. var a = new cc.Rect(0, 0, 10, 10);
  11320. var b = new cc.Rect(50, 50, 100, 100);
  11321. update (dt) {
  11322. // method 1;
  11323. var c = a.lerp(b, dt * 0.1);
  11324. // method 2;
  11325. a.lerp(b, dt * 0.1, c);
  11326. }
  11327. ```
  11328. */
  11329. lerp(to: Rect, ratio: number, out?: Rect): Rect;
  11330. /**
  11331. !#en Check whether the current rectangle intersects with the given one
  11332. !#zh 当前矩形与指定矩形是否相交。
  11333. @param rect rect
  11334. @example
  11335. ```js
  11336. var a = new cc.Rect(0, 0, 10, 10);
  11337. var b = new cc.Rect(0, 0, 20, 20);
  11338. a.intersects(b);// true
  11339. ```
  11340. */
  11341. intersects(rect: Rect): boolean;
  11342. /**
  11343. !#en Returns the overlapping portion of 2 rectangles.
  11344. !#zh 返回 2 个矩形重叠的部分。
  11345. @param out Stores the result
  11346. @param rectB rectB
  11347. @example
  11348. ```js
  11349. var a = new cc.Rect(0, 10, 20, 20);
  11350. var b = new cc.Rect(0, 10, 10, 10);
  11351. var intersection = new cc.Rect();
  11352. a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
  11353. ```
  11354. */
  11355. intersection(out: Rect, rectB: Rect): Rect;
  11356. /**
  11357. !#en Check whether the current rect contains the given point
  11358. !#zh 当前矩形是否包含指定坐标点。
  11359. Returns true if the point inside this rectangle.
  11360. @param point point
  11361. @example
  11362. ```js
  11363. var a = new cc.Rect(0, 0, 10, 10);
  11364. var b = new cc.Vec2(0, 5);
  11365. a.contains(b);// true
  11366. ```
  11367. */
  11368. contains(point: Vec2): boolean;
  11369. /**
  11370. !#en Returns true if the other rect totally inside this rectangle.
  11371. !#zh 当前矩形是否包含指定矩形。
  11372. @param rect rect
  11373. @example
  11374. ```js
  11375. var a = new cc.Rect(0, 0, 20, 20);
  11376. var b = new cc.Rect(0, 0, 10, 10);
  11377. a.containsRect(b);// true
  11378. ```
  11379. */
  11380. containsRect(rect: Rect): boolean;
  11381. /**
  11382. !#en Returns the smallest rectangle that contains the current rect and the given rect.
  11383. !#zh 返回一个包含当前矩形和指定矩形的最小矩形。
  11384. @param out Stores the result
  11385. @param rectB rectB
  11386. @example
  11387. ```js
  11388. var a = new cc.Rect(0, 10, 20, 20);
  11389. var b = new cc.Rect(0, 10, 10, 10);
  11390. var union = new cc.Rect();
  11391. a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
  11392. ```
  11393. */
  11394. union(out: Rect, rectB: Rect): Rect;
  11395. /**
  11396. !#en Apply matrix4 to the rect.
  11397. !#zh 使用 mat4 对矩形进行矩阵转换。
  11398. @param out The output rect
  11399. @param mat The matrix4
  11400. */
  11401. transformMat4(out: Rect, mat: Mat4): void;
  11402. /**
  11403. !#en Output rect informations to string
  11404. !#zh 转换为方便阅读的字符串
  11405. @example
  11406. ```js
  11407. var a = new cc.Rect(0, 0, 10, 10);
  11408. a.toString();// "(0.00, 0.00, 10.00, 10.00)";
  11409. ```
  11410. */
  11411. toString(): string;
  11412. /** !#en The minimum x value, equals to rect.x
  11413. !#zh 矩形 x 轴上的最小值,等价于 rect.x。 */
  11414. xMin: number;
  11415. /** !#en The minimum y value, equals to rect.y
  11416. !#zh 矩形 y 轴上的最小值。 */
  11417. yMin: number;
  11418. /** !#en The maximum x value.
  11419. !#zh 矩形 x 轴上的最大值。 */
  11420. xMax: number;
  11421. /** !#en The maximum y value.
  11422. !#zh 矩形 y 轴上的最大值。 */
  11423. yMax: number;
  11424. /** !#en The position of the center of the rectangle.
  11425. !#zh 矩形的中心点。 */
  11426. center: Vec2;
  11427. /** !#en The X and Y position of the rectangle.
  11428. !#zh 矩形的 x 和 y 坐标。 */
  11429. origin: Vec2;
  11430. /** !#en Width and height of the rectangle.
  11431. !#zh 矩形的大小。 */
  11432. size: Size;
  11433. }
  11434. /** !#en Representation of 2D vectors and points.
  11435. !#zh 表示 2D 向量和坐标 */
  11436. export class Quat extends ValueType {
  11437. /**
  11438. !#en
  11439. Constructor
  11440. see {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11441. !#zh
  11442. 构造函数,可查看 {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11443. @param x x
  11444. @param y y
  11445. @param z z
  11446. @param w w
  11447. */
  11448. constructor(x?: number, y?: number, z?: number, w?: number);
  11449. x: number;
  11450. y: number;
  11451. z: number;
  11452. w: number;
  11453. /**
  11454. !#en clone a Quat object and return the new object
  11455. !#zh 克隆一个四元数并返回
  11456. */
  11457. clone(): Quat;
  11458. /**
  11459. !#en Set values with another quaternion
  11460. !#zh 用另一个四元数的值设置到当前对象上。
  11461. @param newValue !#en new value to set. !#zh 要设置的新值
  11462. */
  11463. set(newValue: Quat): Quat;
  11464. /**
  11465. !#en Check whether current quaternion equals another
  11466. !#zh 当前的四元数是否与指定的四元数相等。
  11467. @param other other
  11468. */
  11469. equals(other: Quat): boolean;
  11470. /**
  11471. !#en Convert quaternion to euler
  11472. !#zh 转换四元数到欧拉角
  11473. @param out out
  11474. */
  11475. toEuler(out: Vec3): Vec3;
  11476. /**
  11477. !#en Convert euler to quaternion
  11478. !#zh 转换欧拉角到四元数
  11479. @param euler euler
  11480. */
  11481. fromEuler(euler: Vec3): Quat;
  11482. /**
  11483. !#en Calculate the interpolation result between this quaternion and another one with given ratio
  11484. !#zh 计算四元数的插值结果
  11485. @param to to
  11486. @param ratio ratio
  11487. @param out out
  11488. */
  11489. lerp(to: Quat, ratio: number, out: Quat): void;
  11490. /**
  11491. !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
  11492. !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
  11493. @param x x
  11494. @param y y
  11495. @param z z
  11496. @param w w
  11497. */
  11498. quat(x?: number|any, y?: number, z?: number, w?: number): Quat;
  11499. }
  11500. /** !#en
  11501. cc.Size is the class for size object,<br/>
  11502. please do not use its constructor to create sizes,<br/>
  11503. use {{#crossLink "cc/size:method"}}{{/crossLink}} alias function instead.<br/>
  11504. It will be deprecated soon, please use cc.Vec2 instead.
  11505. !#zh
  11506. cc.Size 是 size 对象的类。<br/>
  11507. 请不要使用它的构造函数创建的 size,<br/>
  11508. 使用 {{#crossLink "cc/size:method"}}{{/crossLink}} 别名函数。<br/>
  11509. 它不久将被取消,请使用cc.Vec2代替。 */
  11510. export class Size {
  11511. /**
  11512. @param width width
  11513. @param height height
  11514. */
  11515. constructor(width: number|Size, height?: number);
  11516. width: number;
  11517. height: number;
  11518. /** !#en return a Size object with width = 0 and height = 0.
  11519. !#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */
  11520. static ZERO: Size;
  11521. /**
  11522. !#en TODO
  11523. !#zh 克隆 size 对象。
  11524. @example
  11525. ```js
  11526. var a = new cc.size(10, 10);
  11527. a.clone();// return Size {width: 0, height: 0};
  11528. ```
  11529. */
  11530. clone(): Size;
  11531. /**
  11532. !#en TODO
  11533. !#zh 当前 Size 对象是否等于指定 Size 对象。
  11534. @param other other
  11535. @example
  11536. ```js
  11537. var a = new cc.size(10, 10);
  11538. a.equals(new cc.size(10, 10));// return true;
  11539. ```
  11540. */
  11541. equals(other: Size): boolean;
  11542. /**
  11543. !#en TODO
  11544. !#zh 线性插值。
  11545. @param to to
  11546. @param ratio the interpolation coefficient.
  11547. @param out optional, the receiving vector.
  11548. @example
  11549. ```js
  11550. var a = new cc.size(10, 10);
  11551. var b = new cc.rect(50, 50, 100, 100);
  11552. update (dt) {
  11553. // method 1;
  11554. var c = a.lerp(b, dt * 0.1);
  11555. // method 2;
  11556. a.lerp(b, dt * 0.1, c);
  11557. }
  11558. ```
  11559. */
  11560. lerp(to: Rect, ratio: number, out?: Size): Size;
  11561. /**
  11562. !#en TODO
  11563. !#zh 转换为方便阅读的字符串。
  11564. @example
  11565. ```js
  11566. var a = new cc.size(10, 10);
  11567. a.toString();// return "(10.00, 10.00)";
  11568. ```
  11569. */
  11570. toString(): string;
  11571. }
  11572. /** !#en The base class of all value types.
  11573. !#zh 所有值类型的基类。 */
  11574. export class ValueType {
  11575. /**
  11576. !#en This method returns an exact copy of current value.
  11577. !#zh 克隆当前值,该方法返回一个新对象,新对象的值和原对象相等。
  11578. */
  11579. clone(): ValueType;
  11580. /**
  11581. !#en Compares this object with the other one.
  11582. !#zh 当前对象是否等于指定对象。
  11583. @param other other
  11584. */
  11585. equals(other: ValueType): boolean;
  11586. /**
  11587. !#en
  11588. Linearly interpolates between this value to to value by ratio which is in the range [0, 1].
  11589. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
  11590. !#zh
  11591. 线性插值。<br/>
  11592. 当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
  11593. @param to the to value
  11594. @param ratio the interpolation coefficient
  11595. */
  11596. lerp(to: ValueType, ratio: number): ValueType;
  11597. /**
  11598. !#en
  11599. Copys all the properties from another given object to this value.
  11600. !#zh
  11601. 从其它对象把所有属性复制到当前对象。
  11602. @param source the source to copy
  11603. */
  11604. set(source: ValueType): void;
  11605. /**
  11606. !#en TODO
  11607. !#zh 转换为方便阅读的字符串。
  11608. */
  11609. toString(): string;
  11610. }
  11611. /** !#en Representation of 2D vectors and points.
  11612. !#zh 表示 2D 向量和坐标 */
  11613. export class Vec2 extends ValueType {
  11614. /**
  11615. !#en
  11616. Constructor
  11617. see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  11618. !#zh
  11619. 构造函数,可查看 {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} 或者 {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  11620. @param x x
  11621. @param y y
  11622. */
  11623. constructor(x?: number, y?: number);
  11624. x: number;
  11625. y: number;
  11626. /**
  11627. !#en clone a Vec2 object
  11628. !#zh 克隆一个 Vec2 对象
  11629. */
  11630. clone(): Vec2;
  11631. /**
  11632. !#en Sets vector with another's value
  11633. !#zh 设置向量值。
  11634. @param newValue !#en new value to set. !#zh 要设置的新值
  11635. */
  11636. set(newValue: Vec2): Vec2;
  11637. /**
  11638. !#en Check whether two vector equal
  11639. !#zh 当前的向量是否与指定的向量相等。
  11640. @param other other
  11641. */
  11642. equals(other: Vec2): boolean;
  11643. /**
  11644. !#en Check whether two vector equal with some degree of variance.
  11645. !#zh
  11646. 近似判断两个点是否相等。<br/>
  11647. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  11648. @param other other
  11649. @param variance variance
  11650. */
  11651. fuzzyEquals(other: Vec2, variance: number): boolean;
  11652. /**
  11653. !#en Transform to string with vector informations
  11654. !#zh 转换为方便阅读的字符串。
  11655. */
  11656. toString(): string;
  11657. /**
  11658. !#en Calculate linear interpolation result between this vector and another one with given ratio
  11659. !#zh 线性插值。
  11660. @param to to
  11661. @param ratio the interpolation coefficient
  11662. @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
  11663. */
  11664. lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;
  11665. /**
  11666. !#en Clamp the vector between from float and to float.
  11667. !#zh
  11668. 返回指定限制区域后的向量。<br/>
  11669. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  11670. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  11671. 否则返回自身。
  11672. @param min_inclusive min_inclusive
  11673. @param max_inclusive max_inclusive
  11674. @example
  11675. ```js
  11676. var min_inclusive = cc.v2(0, 0);
  11677. var max_inclusive = cc.v2(20, 20);
  11678. var v1 = cc.v2(20, 20).clamp(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
  11679. var v2 = cc.v2(0, 0).clamp(min_inclusive, max_inclusive); // Vec2 {x: 0, y: 0};
  11680. var v3 = cc.v2(10, 10).clamp(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
  11681. ```
  11682. */
  11683. clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;
  11684. /**
  11685. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  11686. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  11687. @param vector vector
  11688. @example
  11689. ```js
  11690. var v = cc.v2(10, 10);
  11691. v.addSelf(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
  11692. ```
  11693. */
  11694. addSelf(vector: Vec2): Vec2;
  11695. /**
  11696. !#en Adds two vectors, and returns the new result.
  11697. !#zh 向量加法,并返回新结果。
  11698. @param vector vector
  11699. @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
  11700. @example
  11701. ```js
  11702. var v = cc.v2(10, 10);
  11703. v.add(cc.v2(5, 5)); // return Vec2 {x: 15, y: 15};
  11704. var v1;
  11705. v.add(cc.v2(5, 5), v1); // return Vec2 {x: 15, y: 15};
  11706. ```
  11707. */
  11708. add(vector: Vec2, out?: Vec2): Vec2;
  11709. /**
  11710. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  11711. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  11712. @param vector vector
  11713. @example
  11714. ```js
  11715. var v = cc.v2(10, 10);
  11716. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  11717. ```
  11718. */
  11719. subSelf(vector: Vec2): Vec2;
  11720. /**
  11721. !#en Subtracts one vector from this, and returns the new result.
  11722. !#zh 向量减法,并返回新结果。
  11723. @param vector vector
  11724. @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
  11725. @example
  11726. ```js
  11727. var v = cc.v2(10, 10);
  11728. v.sub(cc.v2(5, 5)); // return Vec2 {x: 5, y: 5};
  11729. var v1;
  11730. v.sub(cc.v2(5, 5), v1); // return Vec2 {x: 5, y: 5};
  11731. ```
  11732. */
  11733. sub(vector: Vec2, out?: Vec2): Vec2;
  11734. /**
  11735. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  11736. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  11737. @param num num
  11738. @example
  11739. ```js
  11740. var v = cc.v2(10, 10);
  11741. v.mulSelf(5);// return Vec2 {x: 50, y: 50};
  11742. ```
  11743. */
  11744. mulSelf(num: number): Vec2;
  11745. /**
  11746. !#en Multiplies by a number, and returns the new result.
  11747. !#zh 缩放向量,并返回新结果。
  11748. @param num num
  11749. @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
  11750. @example
  11751. ```js
  11752. var v = cc.v2(10, 10);
  11753. v.mul(5); // return Vec2 {x: 50, y: 50};
  11754. var v1;
  11755. v.mul(5, v1); // return Vec2 {x: 50, y: 50};
  11756. ```
  11757. */
  11758. mul(num: number, out?: Vec2): Vec2;
  11759. /**
  11760. !#en Multiplies two vectors.
  11761. !#zh 分量相乘。
  11762. @param vector vector
  11763. @example
  11764. ```js
  11765. var v = cc.v2(10, 10);
  11766. v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  11767. ```
  11768. */
  11769. scaleSelf(vector: Vec2): Vec2;
  11770. /**
  11771. !#en Multiplies two vectors, and returns the new result.
  11772. !#zh 分量相乘,并返回新的结果。
  11773. @param vector vector
  11774. @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
  11775. @example
  11776. ```js
  11777. var v = cc.v2(10, 10);
  11778. v.scale(cc.v2(5, 5)); // return Vec2 {x: 50, y: 50};
  11779. var v1;
  11780. v.scale(cc.v2(5, 5), v1); // return Vec2 {x: 50, y: 50};
  11781. ```
  11782. */
  11783. scale(vector: Vec2, out?: Vec2): Vec2;
  11784. /**
  11785. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  11786. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  11787. @param divisor divisor
  11788. @example
  11789. ```js
  11790. var v = cc.v2(10, 10);
  11791. v.divSelf(5); // return Vec2 {x: 2, y: 2};
  11792. ```
  11793. */
  11794. divSelf(divisor: Vec2): Vec2;
  11795. /**
  11796. !#en Divides by a number, and returns the new result.
  11797. !#zh 向量除法,并返回新的结果。
  11798. @param divisor divisor
  11799. @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
  11800. @example
  11801. ```js
  11802. var v = cc.v2(10, 10);
  11803. v.div(5); // return Vec2 {x: 2, y: 2};
  11804. var v1;
  11805. v.div(5, v1); // return Vec2 {x: 2, y: 2};
  11806. ```
  11807. */
  11808. div(divisor: Vec2, out?: Vec2): Vec2;
  11809. /**
  11810. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  11811. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  11812. @example
  11813. ```js
  11814. var v = cc.v2(10, 10);
  11815. v.negSelf(); // return Vec2 {x: -10, y: -10};
  11816. ```
  11817. */
  11818. negSelf(): Vec2;
  11819. /**
  11820. !#en Negates the components, and returns the new result.
  11821. !#zh 返回取反后的新向量。
  11822. @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
  11823. @example
  11824. ```js
  11825. var v = cc.v2(10, 10);
  11826. var v1;
  11827. v.neg(v1); // return Vec2 {x: -10, y: -10};
  11828. ```
  11829. */
  11830. neg(out?: Vec2): Vec2;
  11831. /**
  11832. !#en Dot product
  11833. !#zh 当前向量与指定向量进行点乘。
  11834. @param vector vector
  11835. @example
  11836. ```js
  11837. var v = cc.v2(10, 10);
  11838. v.dot(cc.v2(5, 5)); // return 100;
  11839. ```
  11840. */
  11841. dot(vector?: Vec2): number;
  11842. /**
  11843. !#en Cross product
  11844. !#zh 当前向量与指定向量进行叉乘。
  11845. @param vector vector
  11846. @example
  11847. ```js
  11848. var v = cc.v2(10, 10);
  11849. v.cross(cc.v2(5, 5)); // return 0;
  11850. ```
  11851. */
  11852. cross(vector?: Vec2): number;
  11853. /**
  11854. !#en Returns the length of this vector.
  11855. !#zh 返回该向量的长度。
  11856. @example
  11857. ```js
  11858. var v = cc.v2(10, 10);
  11859. v.mag(); // return 14.142135623730951;
  11860. ```
  11861. */
  11862. mag(): number;
  11863. /**
  11864. !#en Returns the squared length of this vector.
  11865. !#zh 返回该向量的长度平方。
  11866. @example
  11867. ```js
  11868. var v = cc.v2(10, 10);
  11869. v.magSqr(); // return 200;
  11870. ```
  11871. */
  11872. magSqr(): number;
  11873. /**
  11874. !#en Make the length of this vector to 1.
  11875. !#zh 向量归一化,让这个向量的长度为 1。
  11876. @example
  11877. ```js
  11878. var v = cc.v2(10, 10);
  11879. v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
  11880. ```
  11881. */
  11882. normalizeSelf(): Vec2;
  11883. /**
  11884. !#en
  11885. Returns this vector with a magnitude of 1.<br/>
  11886. <br/>
  11887. 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.
  11888. !#zh
  11889. 返回归一化后的向量。<br/>
  11890. <br/>
  11891. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  11892. @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
  11893. */
  11894. normalize(out?: Vec2): Vec2;
  11895. /**
  11896. !#en Get angle in radian between this and vector.
  11897. !#zh 夹角的弧度。
  11898. @param vector vector
  11899. */
  11900. angle(vector: Vec2): number;
  11901. /**
  11902. !#en Get angle in radian between this and vector with direction.
  11903. !#zh 带方向的夹角的弧度。
  11904. @param vector vector
  11905. */
  11906. signAngle(vector: Vec2): number;
  11907. /**
  11908. !#en rotate
  11909. !#zh 返回旋转给定弧度后的新向量。
  11910. @param radians radians
  11911. @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
  11912. */
  11913. rotate(radians: number, out?: Vec2): Vec2;
  11914. /**
  11915. !#en rotate self
  11916. !#zh 按指定弧度旋转向量。
  11917. @param radians radians
  11918. */
  11919. rotateSelf(radians: number): Vec2;
  11920. /**
  11921. !#en Calculates the projection of the current vector over the given vector.
  11922. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  11923. @param vector vector
  11924. @example
  11925. ```js
  11926. var v1 = cc.v2(20, 20);
  11927. var v2 = cc.v2(5, 5);
  11928. v1.project(v2); // Vec2 {x: 20, y: 20};
  11929. ```
  11930. */
  11931. project(vector: Vec2): Vec2;
  11932. /**
  11933. Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  11934. @param m matrix to transform with
  11935. @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
  11936. */
  11937. 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;
  11938. /** !#en return a Vec2 object with x = 1 and y = 1.
  11939. !#zh 新 Vec2 对象。 */
  11940. static ONE: Vec2;
  11941. /** !#en return a Vec2 object with x = 0 and y = 0.
  11942. !#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */
  11943. static ZERO: Vec2;
  11944. /** !#en return a Vec2 object with x = 0 and y = 1.
  11945. !#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */
  11946. static UP: Vec2;
  11947. /** !#en return a Vec2 object with x = 1 and y = 0.
  11948. !#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */
  11949. static RIGHT: Vec2;
  11950. }
  11951. /** !#en Representation of 3D vectors and points.
  11952. !#zh 表示 3D 向量和坐标 */
  11953. export class Vec3 extends ValueType {
  11954. /**
  11955. !#en
  11956. Constructor
  11957. see {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  11958. !#zh
  11959. 构造函数,可查看 {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  11960. @param x x
  11961. @param y y
  11962. @param z z
  11963. */
  11964. constructor(x?: number, y?: number, z?: number);
  11965. x: number;
  11966. y: number;
  11967. z: number;
  11968. /**
  11969. !#en clone a Vec3 value
  11970. !#zh 克隆一个 Vec3 值
  11971. */
  11972. clone(): Vec3;
  11973. /**
  11974. !#en Set the current vector value with the given vector.
  11975. !#zh 用另一个向量设置当前的向量对象值。
  11976. @param newValue !#en new value to set. !#zh 要设置的新值
  11977. */
  11978. set(newValue: Vec3): Vec3;
  11979. /**
  11980. !#en Check whether the vector equals another one
  11981. !#zh 当前的向量是否与指定的向量相等。
  11982. @param other other
  11983. */
  11984. equals(other: Vec3): boolean;
  11985. /**
  11986. !#en Check whether two vector equal with some degree of variance.
  11987. !#zh
  11988. 近似判断两个点是否相等。<br/>
  11989. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  11990. @param other other
  11991. @param variance variance
  11992. */
  11993. fuzzyEquals(other: Vec3, variance: number): boolean;
  11994. /**
  11995. !#en Transform to string with vector informations
  11996. !#zh 转换为方便阅读的字符串。
  11997. */
  11998. toString(): string;
  11999. /**
  12000. !#en Calculate linear interpolation result between this vector and another one with given ratio
  12001. !#zh 线性插值。
  12002. @param to to
  12003. @param ratio the interpolation coefficient
  12004. @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
  12005. */
  12006. lerp(to: Vec3, ratio: number, out?: Vec3): Vec3;
  12007. /**
  12008. !#en Clamp the vector between from float and to float.
  12009. !#zh
  12010. 返回指定限制区域后的向量。<br/>
  12011. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  12012. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  12013. 否则返回自身。
  12014. @param min_inclusive min_inclusive
  12015. @param max_inclusive max_inclusive
  12016. */
  12017. clampf(min_inclusive: Vec3, max_inclusive: Vec3): Vec3;
  12018. /**
  12019. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  12020. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  12021. @param vector vector
  12022. */
  12023. addSelf(vector: Vec3): Vec3;
  12024. /**
  12025. !#en Adds two vectors, and returns the new result.
  12026. !#zh 向量加法,并返回新结果。
  12027. @param vector vector
  12028. @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
  12029. */
  12030. add(vector: Vec3, out?: Vec3): Vec3;
  12031. /**
  12032. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  12033. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  12034. @param vector vector
  12035. */
  12036. subSelf(vector: Vec3): Vec3;
  12037. /**
  12038. !#en Subtracts one vector from this, and returns the new result.
  12039. !#zh 向量减法,并返回新结果。
  12040. @param vector vector
  12041. @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
  12042. */
  12043. sub(vector: Vec3, out?: Vec3): Vec3;
  12044. /**
  12045. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  12046. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  12047. @param num num
  12048. */
  12049. mulSelf(num: number): Vec3;
  12050. /**
  12051. !#en Multiplies by a number, and returns the new result.
  12052. !#zh 缩放向量,并返回新结果。
  12053. @param num num
  12054. @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
  12055. */
  12056. mul(num: number, out?: Vec3): Vec3;
  12057. /**
  12058. !#en Multiplies two vectors.
  12059. !#zh 分量相乘。
  12060. @param vector vector
  12061. */
  12062. scaleSelf(vector: Vec3): Vec3;
  12063. /**
  12064. !#en Multiplies two vectors, and returns the new result.
  12065. !#zh 分量相乘,并返回新的结果。
  12066. @param vector vector
  12067. @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
  12068. */
  12069. scale(vector: Vec3, out?: Vec3): Vec3;
  12070. /**
  12071. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  12072. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  12073. @param vector vector
  12074. */
  12075. divSelf(vector: Vec3): Vec3;
  12076. /**
  12077. !#en Divides by a number, and returns the new result.
  12078. !#zh 向量除法,并返回新的结果。
  12079. @param vector vector
  12080. @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
  12081. */
  12082. div(vector: Vec3, out?: Vec3): Vec3;
  12083. /**
  12084. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  12085. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  12086. */
  12087. negSelf(): Vec3;
  12088. /**
  12089. !#en Negates the components, and returns the new result.
  12090. !#zh 返回取反后的新向量。
  12091. @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
  12092. */
  12093. neg(out?: Vec3): Vec3;
  12094. /**
  12095. !#en Dot product
  12096. !#zh 当前向量与指定向量进行点乘。
  12097. @param vector vector
  12098. */
  12099. dot(vector?: Vec3): number;
  12100. /**
  12101. !#en Cross product
  12102. !#zh 当前向量与指定向量进行叉乘。
  12103. @param vector vector
  12104. @param out out
  12105. */
  12106. cross(vector: Vec3, out?: Vec3): Vec3;
  12107. /**
  12108. !#en Returns the length of this vector.
  12109. !#zh 返回该向量的长度。
  12110. @example
  12111. ```js
  12112. var v = cc.v2(10, 10);
  12113. v.mag(); // return 14.142135623730951;
  12114. ```
  12115. */
  12116. mag(): number;
  12117. /**
  12118. !#en Returns the squared length of this vector.
  12119. !#zh 返回该向量的长度平方。
  12120. */
  12121. magSqr(): number;
  12122. /**
  12123. !#en Make the length of this vector to 1.
  12124. !#zh 向量归一化,让这个向量的长度为 1。
  12125. */
  12126. normalizeSelf(): Vec3;
  12127. /**
  12128. !#en
  12129. Returns this vector with a magnitude of 1.<br/>
  12130. <br/>
  12131. 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.
  12132. !#zh
  12133. 返回归一化后的向量。<br/>
  12134. <br/>
  12135. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  12136. @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
  12137. */
  12138. normalize(out?: Vec3): Vec3;
  12139. /**
  12140. Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  12141. @param m matrix to transform with
  12142. @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
  12143. */
  12144. 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;
  12145. /**
  12146. !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
  12147. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
  12148. @param x x
  12149. @param y y
  12150. @param z z
  12151. @example
  12152. ```js
  12153. var v1 = cc.v3();
  12154. var v2 = cc.v3(0, 0, 0);
  12155. var v3 = cc.v3(v2);
  12156. var v4 = cc.v3({x: 100, y: 100, z: 0});
  12157. ```
  12158. */
  12159. v3(x?: number|any, y?: number, z?: number): Vec3;
  12160. }
  12161. /** undefined */
  12162. export class PhysicsBoxCollider extends PhysicsCollider implements Collider.Box {
  12163. /** !#en Position offset
  12164. !#zh 位置偏移量 */
  12165. offset: Vec2;
  12166. /** !#en Box size
  12167. !#zh 包围盒大小 */
  12168. size: Size;
  12169. }
  12170. /** undefined */
  12171. export class PhysicsChainCollider extends PolygonCollider {
  12172. /** !#en Whether the chain is loop
  12173. !#zh 链条是否首尾相连 */
  12174. loop: boolean;
  12175. /** !#en Chain points
  12176. !#zh 链条顶点数组 */
  12177. points: Vec2[];
  12178. }
  12179. /** undefined */
  12180. export class PhysicsCircleCollider extends PhysicsCollider implements Collider.Circle {
  12181. /** !#en Position offset
  12182. !#zh 位置偏移量 */
  12183. offset: Vec2;
  12184. /** !#en Circle radius
  12185. !#zh 圆形半径 */
  12186. radius: number;
  12187. }
  12188. /** undefined */
  12189. export class PhysicsCollider extends Collider {
  12190. /** !#en
  12191. The density.
  12192. !#zh
  12193. 密度 */
  12194. density: number;
  12195. /** !#en
  12196. A sensor collider collects contact information but never generates a collision response
  12197. !#zh
  12198. 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。 */
  12199. sensor: boolean;
  12200. /** !#en
  12201. The friction coefficient, usually in the range [0,1].
  12202. !#zh
  12203. 摩擦系数,取值一般在 [0, 1] 之间 */
  12204. friction: number;
  12205. /** !#en
  12206. The restitution (elasticity) usually in the range [0,1].
  12207. !#zh
  12208. 弹性系数,取值一般在 [0, 1]之间 */
  12209. restitution: number;
  12210. /** !#en
  12211. Physics collider will find the rigidbody component on the node and set to this property.
  12212. !#zh
  12213. 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。 */
  12214. body: RigidBody;
  12215. /**
  12216. !#en
  12217. Apply current changes to collider, this will regenerate inner box2d fixtures.
  12218. !#zh
  12219. 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
  12220. */
  12221. apply(): void;
  12222. /**
  12223. !#en
  12224. Get the world aabb of the collider
  12225. !#zh
  12226. 获取碰撞体的世界坐标系下的包围盒
  12227. */
  12228. getAABB(): void;
  12229. }
  12230. /** undefined */
  12231. export class PhysicsPolygonCollider extends PhysicsCollider implements Collider.Polygon {
  12232. /** !#en Position offset
  12233. !#zh 位置偏移量 */
  12234. offset: Vec2;
  12235. /** !#en Polygon points
  12236. !#zh 多边形顶点数组 */
  12237. points: Vec2[];
  12238. }
  12239. /** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.
  12240. !#zh EditBox 组件,用于获取用户的输入文本。 */
  12241. export class EditBox extends Component {
  12242. /** !#en Input string of EditBox.
  12243. !#zh 输入框的初始输入内容,如果为空则会显示占位符的文本。 */
  12244. string: string;
  12245. /** !#en The background image of EditBox.
  12246. !#zh 输入框的背景图片 */
  12247. backgroundImage: SpriteFrame;
  12248. /** !#en
  12249. The return key type of EditBox.
  12250. Note: it is meaningless for web platforms and desktop platforms.
  12251. !#zh
  12252. 指定移动设备上面回车按钮的样式。
  12253. 注意:这个选项对 web 平台与 desktop 平台无效。 */
  12254. returnType: EditBox.KeyboardReturnType;
  12255. /** !#en Set the input flags that are to be applied to the EditBox.
  12256. !#zh 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。 */
  12257. inputFlag: EditBox.InputFlag;
  12258. /** !#en
  12259. Set the input mode of the edit box.
  12260. If you pass ANY, it will create a multiline EditBox.
  12261. !#zh
  12262. 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。 */
  12263. inputMode: EditBox.InputMode;
  12264. /** !#en Font size of the input text.
  12265. !#zh 输入框文本的字体大小 */
  12266. fontSize: number;
  12267. /** !#en Change the lineHeight of displayed text.
  12268. !#zh 输入框文本的行高。 */
  12269. lineHeight: number;
  12270. /** !#en Font color of the input text.
  12271. !#zh 输入框文本的颜色。 */
  12272. fontColor: Color;
  12273. /** !#en The display text of placeholder.
  12274. !#zh 输入框占位符的文本内容。 */
  12275. placeholder: string;
  12276. /** !#en The font size of placeholder.
  12277. !#zh 输入框占位符的字体大小。 */
  12278. placeholderFontSize: number;
  12279. /** !#en The font color of placeholder.
  12280. !#zh 输入框占位符的字体颜色。 */
  12281. placeholderFontColor: Color;
  12282. /** !#en The maximize input length of EditBox.
  12283. - If pass a value less than 0, it won't limit the input number of characters.
  12284. - If pass 0, it doesn't allow input any characters.
  12285. !#zh 输入框最大允许输入的字符个数。
  12286. - 如果值为小于 0 的值,则不会限制输入字符个数。
  12287. - 如果值为 0,则不允许用户进行任何输入。 */
  12288. maxLength: number;
  12289. /** !#en The input is always visible and be on top of the game view (only useful on Web).
  12290. !zh 输入框总是可见,并且永远在游戏视图的上面(这个属性只有在 Web 上面修改有意义)
  12291. Note: only available on Web at the moment. */
  12292. stayOnTop: boolean;
  12293. /** !#en Set the tabIndex of the DOM input element (only useful on Web).
  12294. !#zh 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。 */
  12295. tabIndex: number;
  12296. /** !#en The event handler to be called when EditBox began to edit text.
  12297. !#zh 开始编辑文本输入框触发的事件回调。 */
  12298. editingDidBegan: Component.EventHandler[];
  12299. /** !#en The event handler to be called when EditBox text changes.
  12300. !#zh 编辑文本输入框时触发的事件回调。 */
  12301. textChanged: Component.EventHandler[];
  12302. /** !#en The event handler to be called when EditBox edit ends.
  12303. !#zh 结束编辑文本输入框时触发的事件回调。 */
  12304. editingDidEnded: Component.EventHandler[];
  12305. /** !#en The event handler to be called when return key is pressed. Windows is not supported.
  12306. !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 */
  12307. editingReturn: Component.EventHandler[];
  12308. /**
  12309. !#en Let the EditBox get focus
  12310. !#zh 让当前 EditBox 获得焦点
  12311. */
  12312. setFocus(): void;
  12313. /**
  12314. !#en Determine whether EditBox is getting focus or not.
  12315. !#zh 判断 EditBox 是否获得了焦点
  12316. Note: only available on Web at the moment.
  12317. */
  12318. isFocused(): void;
  12319. /**
  12320. !#en if you don't need the EditBox and it isn't in any running Scene, you should
  12321. call the destroy method on this component or the associated node explicitly.
  12322. Otherwise, the created DOM element won't be removed from web page.
  12323. !#zh
  12324. 如果你不再使用 EditBox,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  12325. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  12326. @example
  12327. ```js
  12328. editbox.node.parent = null; // or editbox.node.removeFromParent(false);
  12329. // when you don't need editbox anymore
  12330. editbox.node.destroy();
  12331. ```
  12332. */
  12333. destroy(): boolean;
  12334. }
  12335. /** !#en
  12336. A distance joint constrains two points on two bodies
  12337. to remain at a fixed distance from each other. You can view
  12338. this as a massless, rigid rod.
  12339. !#zh
  12340. 距离关节通过一个固定的长度来约束关节链接的两个刚体。你可以将它想象成一个无质量,坚固的木棍。 */
  12341. export class DistanceJoint extends Joint {
  12342. /** !#en
  12343. The distance separating the two ends of the joint.
  12344. !#zh
  12345. 关节两端的距离 */
  12346. distance: number;
  12347. /** !#en
  12348. The spring frequency.
  12349. !#zh
  12350. 弹性系数。 */
  12351. frequency: number;
  12352. /** !#en
  12353. The damping ratio.
  12354. !#zh
  12355. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12356. dampingRatio: number;
  12357. }
  12358. /** !#en
  12359. Base class for joints to connect rigidbody.
  12360. !#zh
  12361. 关节类的基类 */
  12362. export class Joint extends Component {
  12363. /** !#en
  12364. The anchor of the rigidbody.
  12365. !#zh
  12366. 刚体的锚点。 */
  12367. anchor: Vec2;
  12368. /** !#en
  12369. The anchor of the connected rigidbody.
  12370. !#zh
  12371. 关节另一端刚体的锚点。 */
  12372. connectedAnchor: Vec2;
  12373. /** !#en
  12374. The rigidbody to which the other end of the joint is attached.
  12375. !#zh
  12376. 关节另一端链接的刚体 */
  12377. connectedBody: RigidBody;
  12378. /** !#en
  12379. Should the two rigid bodies connected with this joint collide with each other?
  12380. !#zh
  12381. 链接到关节上的两个刚体是否应该相互碰撞? */
  12382. collideConnected: boolean;
  12383. /**
  12384. !#en
  12385. Apply current changes to joint, this will regenerate inner box2d joint.
  12386. !#zh
  12387. 应用当前关节中的修改,调用此函数会重新生成内部 box2d 的关节。
  12388. */
  12389. apply(): void;
  12390. /**
  12391. !#en
  12392. Get the anchor point on rigidbody in world coordinates.
  12393. !#zh
  12394. 获取刚体世界坐标系下的锚点。
  12395. */
  12396. getWorldAnchor(): Vec2;
  12397. /**
  12398. !#en
  12399. Get the anchor point on connected rigidbody in world coordinates.
  12400. !#zh
  12401. 获取链接刚体世界坐标系下的锚点。
  12402. */
  12403. getWorldConnectedAnchor(): Vec2;
  12404. /**
  12405. !#en
  12406. Gets the reaction force of the joint.
  12407. !#zh
  12408. 获取关节的反作用力。
  12409. @param timeStep The time to calculate the reaction force for.
  12410. */
  12411. getReactionForce(timeStep: number): Vec2;
  12412. /**
  12413. !#en
  12414. Gets the reaction torque of the joint.
  12415. !#zh
  12416. 获取关节的反扭矩。
  12417. @param timeStep The time to calculate the reaction torque for.
  12418. */
  12419. getReactionTorque(timeStep: number): number;
  12420. }
  12421. /** !#en
  12422. A motor joint is used to control the relative motion
  12423. between two bodies. A typical usage is to control the movement
  12424. of a dynamic body with respect to the ground.
  12425. !#zh
  12426. 马达关节被用来控制两个刚体间的相对运动。
  12427. 一个典型的例子是用来控制一个动态刚体相对于地面的运动。 */
  12428. export class MotorJoint extends Joint {
  12429. /** !#en
  12430. The anchor of the rigidbody.
  12431. !#zh
  12432. 刚体的锚点。 */
  12433. anchor: Vec2;
  12434. /** !#en
  12435. The anchor of the connected rigidbody.
  12436. !#zh
  12437. 关节另一端刚体的锚点。 */
  12438. connectedAnchor: Vec2;
  12439. /** !#en
  12440. The linear offset from connected rigidbody to rigidbody.
  12441. !#zh
  12442. 关节另一端的刚体相对于起始端刚体的位置偏移量 */
  12443. linearOffset: Vec2;
  12444. /** !#en
  12445. The angular offset from connected rigidbody to rigidbody.
  12446. !#zh
  12447. 关节另一端的刚体相对于起始端刚体的角度偏移量 */
  12448. angularOffset: number;
  12449. /** !#en
  12450. The maximum force can be applied to rigidbody.
  12451. !#zh
  12452. 可以应用于刚体的最大的力值 */
  12453. maxForce: number;
  12454. /** !#en
  12455. The maximum torque can be applied to rigidbody.
  12456. !#zh
  12457. 可以应用于刚体的最大扭矩值 */
  12458. maxTorque: number;
  12459. /** !#en
  12460. The position correction factor in the range [0,1].
  12461. !#zh
  12462. 位置矫正系数,范围为 [0, 1] */
  12463. correctionFactor: number;
  12464. }
  12465. /** !#en
  12466. A mouse joint is used to make a point on a body track a
  12467. specified world point. This a soft constraint with a maximum
  12468. force. This allows the constraint to stretch and without
  12469. applying huge forces.
  12470. Mouse Joint will auto register the touch event with the mouse region node,
  12471. and move the choosed rigidbody in touch move event.
  12472. Note : generally mouse joint only used in test bed.
  12473. !#zh
  12474. 鼠标关节用于使刚体上的一个点追踪一个指定的世界坐标系下的位置。
  12475. 鼠标关节可以指定一个最大的里来施加一个柔和的约束。
  12476. 鼠标关节会自动使用 mouse region 节点来注册鼠标事件,并且在触摸移动事件中移动选中的刚体。
  12477. 注意:一般鼠标关节只在测试环境中使用。 */
  12478. export class MouseJoint extends Joint {
  12479. /** !#en
  12480. The anchor of the rigidbody.
  12481. !#zh
  12482. 刚体的锚点。 */
  12483. anchor: Vec2;
  12484. /** !#en
  12485. The anchor of the connected rigidbody.
  12486. !#zh
  12487. 关节另一端刚体的锚点。 */
  12488. connectedAnchor: Vec2;
  12489. /** !#en
  12490. The node used to register touch evnet.
  12491. If this is null, it will be the joint's node.
  12492. !#zh
  12493. 用于注册触摸事件的节点。
  12494. 如果没有设置这个值,那么将会使用关节的节点来注册事件。 */
  12495. mouseRegion: Node;
  12496. /** !#en
  12497. The target point.
  12498. The mouse joint will move choosed rigidbody to target point.
  12499. !#zh
  12500. 目标点,鼠标关节将会移动选中的刚体到指定的目标点 */
  12501. target: Vec2;
  12502. /** !#en
  12503. The spring frequency.
  12504. !#zh
  12505. 弹簧系数。 */
  12506. frequency: number;
  12507. /** !#en
  12508. The damping ratio.
  12509. !#zh
  12510. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12511. 0: number;
  12512. /** !#en
  12513. The maximum force
  12514. !#zh
  12515. 最大阻力值 */
  12516. maxForce: number;
  12517. }
  12518. /** !#en
  12519. A prismatic joint. This joint provides one degree of freedom: translation
  12520. along an axis fixed in rigidbody. Relative rotation is prevented. You can
  12521. use a joint limit to restrict the range of motion and a joint motor to
  12522. drive the motion or to model joint friction.
  12523. !#zh
  12524. 移动关节指定了只能在一个方向上移动刚体。
  12525. 你可以开启关节限制来设置刚体运行移动的间距,也可以开启马达来使用关节马达驱动刚体的运行。 */
  12526. export class PrismaticJoint extends Joint {
  12527. /** !#en
  12528. The local joint axis relative to rigidbody.
  12529. !#zh
  12530. 指定刚体可以移动的方向。 */
  12531. localAxisA: Vec2;
  12532. /** !#en
  12533. The reference angle.
  12534. !#zh
  12535. 相对角度 */
  12536. referenceAngle: number;
  12537. /** !#en
  12538. Enable joint distance limit?
  12539. !#zh
  12540. 是否开启关节的距离限制? */
  12541. enableLimit: boolean;
  12542. /** !#en
  12543. Enable joint motor?
  12544. !#zh
  12545. 是否开启关节马达? */
  12546. enableMotor: boolean;
  12547. /** !#en
  12548. The lower joint limit.
  12549. !#zh
  12550. 刚体能够移动的最小值 */
  12551. lowerLimit: number;
  12552. /** !#en
  12553. The upper joint limit.
  12554. !#zh
  12555. 刚体能够移动的最大值 */
  12556. upperLimit: number;
  12557. /** !#en
  12558. The maxium force can be applied to rigidbody to rearch the target motor speed.
  12559. !#zh
  12560. 可以施加到刚体的最大力。 */
  12561. maxMotorForce: number;
  12562. /** !#en
  12563. The expected motor speed.
  12564. !#zh
  12565. 期望的马达速度。 */
  12566. motorSpeed: number;
  12567. }
  12568. /** !#en
  12569. A revolute joint constrains two bodies to share a common point while they
  12570. are free to rotate about the point. The relative rotation about the shared
  12571. point is the joint angle. You can limit the relative rotation with
  12572. a joint limit that specifies a lower and upper angle. You can use a motor
  12573. to drive the relative rotation about the shared point. A maximum motor torque
  12574. is provided so that infinite forces are not generated.
  12575. !#zh
  12576. 旋转关节可以约束两个刚体围绕一个点来进行旋转。
  12577. 你可以通过开启关节限制来限制旋转的最大角度和最小角度。
  12578. 你可以通过开启马达来施加一个扭矩力来驱动这两个刚体在这一点上的相对速度。 */
  12579. export class RevoluteJoint extends Joint {
  12580. /** !#en
  12581. The reference angle.
  12582. An angle between bodies considered to be zero for the joint angle.
  12583. !#zh
  12584. 相对角度。
  12585. 两个物体之间角度为零时可以看作相等于关节角度 */
  12586. referenceAngle: number;
  12587. /** !#en
  12588. The lower angle.
  12589. !#zh
  12590. 角度的最低限制。 */
  12591. lowerAngle: number;
  12592. /** !#en
  12593. The upper angle.
  12594. !#zh
  12595. 角度的最高限制。 */
  12596. upperAngle: number;
  12597. /** !#en
  12598. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  12599. !#zh
  12600. 可以施加到刚体的最大扭矩。 */
  12601. maxMotorTorque: number;
  12602. /** !#en
  12603. The expected motor speed.
  12604. !#zh
  12605. 期望的马达速度。 */
  12606. motorSpeed: number;
  12607. /** !#en
  12608. Enable joint limit?
  12609. !#zh
  12610. 是否开启关节的限制? */
  12611. enableLimit: boolean;
  12612. /** !#en
  12613. Enable joint motor?
  12614. !#zh
  12615. 是否开启关节马达? */
  12616. enableMotor: boolean;
  12617. /**
  12618. !#en
  12619. Get the joint angle.
  12620. !#zh
  12621. 获取关节角度。
  12622. */
  12623. getJointAngle(): number;
  12624. }
  12625. /** !#en
  12626. A rope joint enforces a maximum distance between two points
  12627. on two bodies. It has no other effect.
  12628. Warning: if you attempt to change the maximum length during
  12629. the simulation you will get some non-physical behavior.
  12630. !#zh
  12631. 绳子关节只指定两个刚体间的最大距离,没有其他的效果。
  12632. 注意:如果你试图动态修改关节的长度,这有可能会得到一些意外的效果。 */
  12633. export class RopeJoint extends Joint {
  12634. /** !#en
  12635. The max length.
  12636. !#zh
  12637. 最大长度。 */
  12638. maxLength: number;
  12639. }
  12640. /** !#en
  12641. A weld joint essentially glues two bodies together. A weld joint may
  12642. distort somewhat because the island constraint solver is approximate.
  12643. !#zh
  12644. 熔接关节相当于将两个刚体粘在了一起。
  12645. 熔接关节可能会使某些东西失真,因为约束求解器算出的都是近似值。 */
  12646. export class WeldJoint extends Joint {
  12647. /** !#en
  12648. The reference angle.
  12649. !#zh
  12650. 相对角度。 */
  12651. referenceAngle: number;
  12652. /** !#en
  12653. The frequency.
  12654. !#zh
  12655. 弹性系数。 */
  12656. frequency: number;
  12657. /** !#en
  12658. The damping ratio.
  12659. !#zh
  12660. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12661. 0: number;
  12662. }
  12663. /** !#en
  12664. A wheel joint. This joint provides two degrees of freedom: translation
  12665. along an axis fixed in bodyA and rotation in the plane. You can use a joint motor to drive
  12666. the rotation or to model rotational friction.
  12667. This joint is designed for vehicle suspensions.
  12668. !#zh
  12669. 轮子关节提供两个维度的自由度:旋转和沿着指定方向上位置的移动。
  12670. 你可以通过开启关节马达来使用马达驱动刚体的旋转。
  12671. 轮组关节是专门为机动车类型设计的。 */
  12672. export class WheelJoint extends Joint {
  12673. /** !#en
  12674. The local joint axis relative to rigidbody.
  12675. !#zh
  12676. 指定刚体可以移动的方向。 */
  12677. localAxisA: Vec2;
  12678. /** !#en
  12679. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  12680. !#zh
  12681. 可以施加到刚体的最大扭矩。 */
  12682. maxMotorTorque: number;
  12683. /** !#en
  12684. The expected motor speed.
  12685. !#zh
  12686. 期望的马达速度。 */
  12687. motorSpeed: number;
  12688. /** !#en
  12689. Enable joint motor?
  12690. !#zh
  12691. 是否开启关节马达? */
  12692. enableMotor: boolean;
  12693. /** !#en
  12694. The spring frequency.
  12695. !#zh
  12696. 弹性系数。 */
  12697. frequency: number;
  12698. /** !#en
  12699. The damping ratio.
  12700. !#zh
  12701. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  12702. dampingRatio: number;
  12703. }
  12704. /** !#en Manager the dynamic atlas.
  12705. !#zh 管理动态图集。 */
  12706. export class DynamicAtlasManager {
  12707. /** !#en Enabled or Disabled dynamic atlas.
  12708. !#zh 开启或者关闭动态图集。 */
  12709. enabled: boolean;
  12710. /** !#en The maximum number of atlas that can be created.
  12711. !#zh 可以创建的最大图集数量。 */
  12712. maxAtlasCount: number;
  12713. /** !#en The size of the atlas that was created
  12714. !#zh 创建的图集的宽高 */
  12715. textureSize: number;
  12716. /** !#en The maximum size of the picture that can be added to the atlas.
  12717. !#zh 可以添加进图集的图片的最大尺寸。 */
  12718. maxFrameSize: number;
  12719. /**
  12720. !#en Append a sprite frame into the dynamic atlas.
  12721. !#zh 添加碎图进入动态图集。
  12722. @param spriteFrame spriteFrame
  12723. */
  12724. insertSpriteFrame(spriteFrame: SpriteFrame): void;
  12725. /**
  12726. !#en Resets all dynamic atlas, and the existing ones will be destroyed.
  12727. !#zh 重置所有动态图集,已有的动态图集会被销毁。
  12728. */
  12729. reset(): void;
  12730. /**
  12731. !#en Displays all the dynamic atlas in the current scene, which you can use to view the current atlas state.
  12732. !#zh 在当前场景中显示所有动态图集,可以用来查看当前的合图状态。
  12733. @param show show
  12734. */
  12735. showDebug(show: boolean): void;
  12736. }
  12737. /****************************************************
  12738. * ParticleSystem
  12739. *****************************************************/
  12740. export module ParticleSystem {
  12741. /** !#en Enum for emitter modes
  12742. !#zh 发射模式 */
  12743. export enum EmitterMode {
  12744. GRAVITY = 0,
  12745. RADIUS = 0,
  12746. }
  12747. }
  12748. /****************************************************
  12749. * ParticleSystem
  12750. *****************************************************/
  12751. export module ParticleSystem {
  12752. /** !#en Enum for particles movement type.
  12753. !#zh 粒子位置类型 */
  12754. export enum PositionType {
  12755. FREE = 0,
  12756. RELATIVE = 0,
  12757. GROUPED = 0,
  12758. }
  12759. }
  12760. /****************************************************
  12761. * audioEngine
  12762. *****************************************************/
  12763. export module audioEngine {
  12764. /** !#en Audio state.
  12765. !#zh 声音播放状态 */
  12766. export enum AudioState {
  12767. ERROR = 0,
  12768. INITIALZING = 0,
  12769. PLAYING = 0,
  12770. PAUSED = 0,
  12771. STOPPED = 0,
  12772. }
  12773. }
  12774. /****************************************************
  12775. * debug
  12776. *****************************************************/
  12777. export module debug {
  12778. /** !#en Enum for debug modes.
  12779. !#zh 调试模式 */
  12780. export enum DebugMode {
  12781. NONE = 0,
  12782. INFO = 0,
  12783. WARN = 0,
  12784. ERROR = 0,
  12785. INFO_FOR_WEB_PAGE = 0,
  12786. WARN_FOR_WEB_PAGE = 0,
  12787. ERROR_FOR_WEB_PAGE = 0,
  12788. }
  12789. }
  12790. /****************************************************
  12791. * Node
  12792. *****************************************************/
  12793. export module Node {
  12794. /** !#en Node's local dirty properties flag
  12795. !#zh Node 的本地属性 dirty 状态位 */
  12796. export enum _LocalDirtyFlag {
  12797. POSITION = 0,
  12798. SCALE = 0,
  12799. ROTATION = 0,
  12800. SKEW = 0,
  12801. RT = 0,
  12802. ALL = 0,
  12803. }
  12804. }
  12805. /****************************************************
  12806. * Node
  12807. *****************************************************/
  12808. export module Node {
  12809. /** !#en The event type supported by Node
  12810. !#zh Node 支持的事件类型 */
  12811. export class EventType {
  12812. /** !#en The event type for touch start event, you can use its value directly: 'touchstart'
  12813. !#zh 当手指触摸到屏幕时。 */
  12814. static TOUCH_START: string;
  12815. /** !#en The event type for touch move event, you can use its value directly: 'touchmove'
  12816. !#zh 当手指在屏幕上移动时。 */
  12817. static TOUCH_MOVE: string;
  12818. /** !#en The event type for touch end event, you can use its value directly: 'touchend'
  12819. !#zh 当手指在目标节点区域内离开屏幕时。 */
  12820. static TOUCH_END: string;
  12821. /** !#en The event type for touch end event, you can use its value directly: 'touchcancel'
  12822. !#zh 当手指在目标节点区域外离开屏幕时。 */
  12823. static TOUCH_CANCEL: string;
  12824. /** !#en The event type for mouse down events, you can use its value directly: 'mousedown'
  12825. !#zh 当鼠标按下时触发一次。 */
  12826. static MOUSE_DOWN: string;
  12827. /** !#en The event type for mouse move events, you can use its value directly: 'mousemove'
  12828. !#zh 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。 */
  12829. static MOUSE_MOVE: string;
  12830. /** !#en The event type for mouse enter target events, you can use its value directly: 'mouseenter'
  12831. !#zh 当鼠标移入目标节点区域时,不论是否按下。 */
  12832. static MOUSE_ENTER: string;
  12833. /** !#en The event type for mouse leave target events, you can use its value directly: 'mouseleave'
  12834. !#zh 当鼠标移出目标节点区域时,不论是否按下。 */
  12835. static MOUSE_LEAVE: string;
  12836. /** !#en The event type for mouse up events, you can use its value directly: 'mouseup'
  12837. !#zh 当鼠标从按下状态松开时触发一次。 */
  12838. static MOUSE_UP: string;
  12839. /** !#en The event type for mouse wheel events, you can use its value directly: 'mousewheel'
  12840. !#zh 当鼠标滚轮滚动时。 */
  12841. static MOUSE_WHEEL: string;
  12842. /** !#en The event type for position change events.
  12843. Performance note, this event will be triggered every time corresponding properties being changed,
  12844. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12845. !#zh 当节点位置改变时触发的事件。
  12846. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12847. static POSITION_CHANGED: string;
  12848. /** !#en The event type for rotation change events.
  12849. Performance note, this event will be triggered every time corresponding properties being changed,
  12850. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12851. !#zh 当节点旋转改变时触发的事件。
  12852. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12853. static ROTATION_CHANGED: string;
  12854. /** !#en The event type for scale change events.
  12855. Performance note, this event will be triggered every time corresponding properties being changed,
  12856. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12857. !#zh 当节点缩放改变时触发的事件。
  12858. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12859. static SCALE_CHANGED: string;
  12860. /** !#en The event type for size change events.
  12861. Performance note, this event will be triggered every time corresponding properties being changed,
  12862. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12863. !#zh 当节点尺寸改变时触发的事件。
  12864. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12865. static SIZE_CHANGED: string;
  12866. /** !#en The event type for anchor point change events.
  12867. Performance note, this event will be triggered every time corresponding properties being changed,
  12868. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12869. !#zh 当节点锚点改变时触发的事件。
  12870. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12871. static ANCHOR_CHANGED: string;
  12872. /** !#en The event type for color change events.
  12873. Performance note, this event will be triggered every time corresponding properties being changed,
  12874. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  12875. !#zh 当节点颜色改变时触发的事件。
  12876. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  12877. static COLOR_CHANGED: string;
  12878. /** !#en The event type for new child added events.
  12879. !#zh 当新的子节点被添加时触发的事件。 */
  12880. static CHILD_ADDED: string;
  12881. /** !#en The event type for child removed events.
  12882. !#zh 当子节点被移除时触发的事件。 */
  12883. static CHILD_REMOVED: string;
  12884. /** !#en The event type for children reorder events.
  12885. !#zh 当子节点顺序改变时触发的事件。 */
  12886. static CHILD_REORDER: string;
  12887. /** !#en The event type for node group changed events.
  12888. !#zh 当节点归属群组发生变化时触发的事件。 */
  12889. static GROUP_CHANGED: string;
  12890. }
  12891. }
  12892. /****************************************************
  12893. * TiledMap
  12894. *****************************************************/
  12895. export module TiledMap {
  12896. /** !#en The orientation of tiled map.
  12897. !#zh Tiled Map 地图方向。 */
  12898. export enum Orientation {
  12899. ORTHO = 0,
  12900. HEX = 0,
  12901. ISO = 0,
  12902. NONE = 0,
  12903. MAP = 0,
  12904. LAYER = 0,
  12905. OBJECTGROUP = 0,
  12906. OBJECT = 0,
  12907. TILE = 0,
  12908. HORIZONTAL = 0,
  12909. VERTICAL = 0,
  12910. DIAGONAL = 0,
  12911. FLIPPED_ALL = 0,
  12912. FLIPPED_MASK = 0,
  12913. STAGGERAXIS_X = 0,
  12914. STAGGERAXIS_Y = 0,
  12915. STAGGERINDEX_ODD = 0,
  12916. STAGGERINDEX_EVEN = 0,
  12917. }
  12918. }
  12919. /****************************************************
  12920. * VideoPlayer
  12921. *****************************************************/
  12922. export module VideoPlayer {
  12923. /** !#en Video event type
  12924. !#zh 视频事件类型 */
  12925. export enum EventType {
  12926. PLAYING = 0,
  12927. PAUSED = 0,
  12928. STOPPED = 0,
  12929. COMPLETED = 0,
  12930. META_LOADED = 0,
  12931. CLICKED = 0,
  12932. READY_TO_PLAY = 0,
  12933. }
  12934. }
  12935. /****************************************************
  12936. * VideoPlayer
  12937. *****************************************************/
  12938. export module VideoPlayer {
  12939. /** !#en Enum for video resouce type type.
  12940. !#zh 视频来源 */
  12941. export enum ResourceType {
  12942. REMOTE = 0,
  12943. LOCAL = 0,
  12944. }
  12945. }
  12946. /****************************************************
  12947. * WebView
  12948. *****************************************************/
  12949. export module WebView {
  12950. /** !#en WebView event type
  12951. !#zh 网页视图事件类型 */
  12952. export enum EventType {
  12953. LOADED = 0,
  12954. LOADING = 0,
  12955. ERROR = 0,
  12956. }
  12957. }
  12958. /****************************************************
  12959. * Camera
  12960. *****************************************************/
  12961. export module Camera {
  12962. /** !#en Values for Camera.clearFlags, determining what to clear when rendering a Camera.
  12963. !#zh 摄像机清除标记位,决定摄像机渲染时会清除哪些状态 */
  12964. export enum ClearFlags {
  12965. COLOR = 0,
  12966. DEPTH = 0,
  12967. STENCIL = 0,
  12968. }
  12969. }
  12970. /****************************************************
  12971. * Prefab
  12972. *****************************************************/
  12973. export module Prefab {
  12974. /** !#zh
  12975. Prefab 创建实例所用的优化策略,配合 {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}} 使用。
  12976. !#en
  12977. An enumeration used with the {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}}
  12978. to specify how to optimize the instantiate operation. */
  12979. export enum OptimizationPolicy {
  12980. AUTO = 0,
  12981. SINGLE_INSTANCE = 0,
  12982. MULTI_INSTANCE = 0,
  12983. }
  12984. }
  12985. /****************************************************
  12986. * Texture2D
  12987. *****************************************************/
  12988. export module Texture2D {
  12989. /** The texture pixel format, default value is RGBA8888,
  12990. you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,
  12991. other formats are supported by compressed file types or raw data. */
  12992. export enum PixelFormat {
  12993. RGB565 = 0,
  12994. RGB5A1 = 0,
  12995. RGBA4444 = 0,
  12996. RGB888 = 0,
  12997. RGBA8888 = 0,
  12998. RGBA32F = 0,
  12999. A8 = 0,
  13000. I8 = 0,
  13001. AI88 = 0,
  13002. RGB_PVRTC_2BPPV1 = 0,
  13003. RGBA_PVRTC_2BPPV1 = 0,
  13004. RGB_PVRTC_4BPPV1 = 0,
  13005. RGBA_PVRTC_4BPPV1 = 0,
  13006. }
  13007. }
  13008. /****************************************************
  13009. * Texture2D
  13010. *****************************************************/
  13011. export module Texture2D {
  13012. /** The texture wrap mode */
  13013. export enum WrapMode {
  13014. REPEAT = 0,
  13015. CLAMP_TO_EDGE = 0,
  13016. MIRRORED_REPEAT = 0,
  13017. }
  13018. }
  13019. /****************************************************
  13020. * Texture2D
  13021. *****************************************************/
  13022. export module Texture2D {
  13023. /** The texture filter mode */
  13024. export enum Filter {
  13025. LINEAR = 0,
  13026. NEAREST = 0,
  13027. }
  13028. }
  13029. /****************************************************
  13030. * Collider
  13031. *****************************************************/
  13032. export module Collider {
  13033. /** !#en Defines a Box Collider .
  13034. !#zh 用来定义包围盒碰撞体 */
  13035. export class Box {
  13036. /** !#en Position offset
  13037. !#zh 位置偏移量 */
  13038. offset: Vec2;
  13039. /** !#en Box size
  13040. !#zh 包围盒大小 */
  13041. size: Size;
  13042. }
  13043. }
  13044. /****************************************************
  13045. * Collider
  13046. *****************************************************/
  13047. export module Collider {
  13048. /** !#en Defines a Circle Collider .
  13049. !#zh 用来定义圆形碰撞体 */
  13050. export class Circle {
  13051. /** !#en Position offset
  13052. !#zh 位置偏移量 */
  13053. offset: Vec2;
  13054. /** !#en Circle radius
  13055. !#zh 圆形半径 */
  13056. radius: number;
  13057. }
  13058. }
  13059. /****************************************************
  13060. * Collider
  13061. *****************************************************/
  13062. export module Collider {
  13063. /** !#en Defines a Polygon Collider .
  13064. !#zh 用来定义多边形碰撞体 */
  13065. export class Polygon {
  13066. /** !#en Position offset
  13067. !#zh 位置偏移量 */
  13068. offset: Vec2;
  13069. /** !#en Polygon points
  13070. !#zh 多边形顶点数组 */
  13071. points: Vec2[];
  13072. }
  13073. }
  13074. /****************************************************
  13075. * Event
  13076. *****************************************************/
  13077. export module Event {
  13078. /** !#en The Custom event
  13079. !#zh 自定义事件 */
  13080. export class EventCustom extends Event {
  13081. /**
  13082. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  13083. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  13084. */
  13085. constructor(type: string, bubbles: boolean);
  13086. /** !#en A reference to the detailed data of the event
  13087. !#zh 事件的详细数据 */
  13088. detail: any;
  13089. /**
  13090. !#en Sets user data
  13091. !#zh 设置用户数据
  13092. @param data data
  13093. */
  13094. setUserData(data: any): void;
  13095. /**
  13096. !#en Gets user data
  13097. !#zh 获取用户数据
  13098. */
  13099. getUserData(): any;
  13100. /**
  13101. !#en Gets event name
  13102. !#zh 获取事件名称
  13103. */
  13104. getEventName(): string;
  13105. }
  13106. }
  13107. /****************************************************
  13108. * SystemEvent
  13109. *****************************************************/
  13110. export module SystemEvent {
  13111. /** !#en The event type supported by SystemEvent
  13112. !#zh SystemEvent 支持的事件类型 */
  13113. export class EventType {
  13114. /** !#en The event type for press the key down event, you can use its value directly: 'keydown'
  13115. !#zh 当按下按键时触发的事件 */
  13116. static KEY_DOWN: string;
  13117. /** !#en The event type for press the key up event, you can use its value directly: 'keyup'
  13118. !#zh 当松开按键时触发的事件 */
  13119. static KEY_UP: string;
  13120. /** !#en The event type for press the devicemotion event, you can use its value directly: 'devicemotion'
  13121. !#zh 重力感应 */
  13122. static DEVICEMOTION: string;
  13123. }
  13124. }
  13125. /****************************************************
  13126. * Animation
  13127. *****************************************************/
  13128. export module Animation {
  13129. /** !#en The event type supported by Animation
  13130. !#zh Animation 支持的事件类型 */
  13131. export class EventType {
  13132. /** !#en Emit when begin playing animation
  13133. !#zh 开始播放时触发 */
  13134. static PLAY: string;
  13135. /** !#en Emit when stop playing animation
  13136. !#zh 停止播放时触发 */
  13137. static STOP: string;
  13138. /** !#en Emit when pause animation
  13139. !#zh 暂停播放时触发 */
  13140. static PAUSE: string;
  13141. /** !#en Emit when resume animation
  13142. !#zh 恢复播放时触发 */
  13143. static RESUME: string;
  13144. /** !#en If animation repeat count is larger than 1, emit when animation play to the last frame
  13145. !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发 */
  13146. static LASTFRAME: string;
  13147. /** !#en Emit when finish playing animation
  13148. !#zh 动画播放完成时触发 */
  13149. static FINISHED: string;
  13150. }
  13151. }
  13152. /****************************************************
  13153. * Button
  13154. *****************************************************/
  13155. export module Button {
  13156. /** !#en Enum for transition type.
  13157. !#zh 过渡类型 */
  13158. export enum Transition {
  13159. NONE = 0,
  13160. COLOR = 0,
  13161. SPRITE = 0,
  13162. SCALE = 0,
  13163. }
  13164. }
  13165. /****************************************************
  13166. * Component
  13167. *****************************************************/
  13168. export module Component {
  13169. /** !#en
  13170. Component will register a event to target component's handler.
  13171. And it will trigger the handler when a certain event occurs.
  13172. !@zh
  13173. “EventHandler” 类用来设置场景中的事件回调,
  13174. 该类允许用户设置回调目标节点,目标组件名,组件方法名,
  13175. 并可通过 emit 方法调用目标函数。 */
  13176. export class EventHandler {
  13177. /** !#en Event target
  13178. !#zh 目标节点 */
  13179. target: Node;
  13180. /** !#en Component name
  13181. !#zh 目标组件名 */
  13182. component: string;
  13183. /** !#en Event handler
  13184. !#zh 响应事件函数名 */
  13185. handler: string;
  13186. /** !#en Custom Event Data
  13187. !#zh 自定义事件数据 */
  13188. customEventData: string;
  13189. /**
  13190. @param events events
  13191. @param params params
  13192. */
  13193. static emitEvents(events: Component.EventHandler[], ...params: any[]): void;
  13194. /**
  13195. !#en Emit event with params
  13196. !#zh 触发目标组件上的指定 handler 函数,该参数是回调函数的参数值(可不填)。
  13197. @param params params
  13198. @example
  13199. ```js
  13200. // Call Function
  13201. var eventHandler = new cc.Component.EventHandler();
  13202. eventHandler.target = newTarget;
  13203. eventHandler.component = "MainMenu";
  13204. eventHandler.handler = "OnClick"
  13205. eventHandler.emit(["param1", "param2", ....]);
  13206. ```
  13207. */
  13208. emit(params: any[]): void;
  13209. }
  13210. }
  13211. /****************************************************
  13212. * Label
  13213. *****************************************************/
  13214. export module Label {
  13215. /** !#en Enum for text alignment.
  13216. !#zh 文本横向对齐类型 */
  13217. export enum HorizontalAlign {
  13218. LEFT = 0,
  13219. CENTER = 0,
  13220. RIGHT = 0,
  13221. }
  13222. }
  13223. /****************************************************
  13224. * Label
  13225. *****************************************************/
  13226. export module Label {
  13227. /** !#en Enum for vertical text alignment.
  13228. !#zh 文本垂直对齐类型 */
  13229. export enum VerticalAlign {
  13230. TOP = 0,
  13231. CENTER = 0,
  13232. BOTTOM = 0,
  13233. }
  13234. }
  13235. /****************************************************
  13236. * Label
  13237. *****************************************************/
  13238. export module Label {
  13239. /** !#en Enum for Overflow.
  13240. !#zh Overflow 类型 */
  13241. export enum Overflow {
  13242. NONE = 0,
  13243. CLAMP = 0,
  13244. SHRINK = 0,
  13245. RESIZE_HEIGHT = 0,
  13246. }
  13247. }
  13248. /****************************************************
  13249. * Label
  13250. *****************************************************/
  13251. export module Label {
  13252. /** !#en Enum for font type.
  13253. !#zh Type 类型 */
  13254. export enum Type {
  13255. TTF = 0,
  13256. BMFont = 0,
  13257. SystemFont = 0,
  13258. }
  13259. }
  13260. /****************************************************
  13261. * Layout
  13262. *****************************************************/
  13263. export module Layout {
  13264. /** !#en Enum for Layout type
  13265. !#zh 布局类型 */
  13266. export enum Type {
  13267. NONE = 0,
  13268. HORIZONTAL = 0,
  13269. VERTICAL = 0,
  13270. GRID = 0,
  13271. }
  13272. }
  13273. /****************************************************
  13274. * Layout
  13275. *****************************************************/
  13276. export module Layout {
  13277. /** !#en Enum for Layout Resize Mode
  13278. !#zh 缩放模式 */
  13279. export enum ResizeMode {
  13280. NONE = 0,
  13281. CONTAINER = 0,
  13282. CHILDREN = 0,
  13283. }
  13284. }
  13285. /****************************************************
  13286. * Layout
  13287. *****************************************************/
  13288. export module Layout {
  13289. /** !#en Enum for Grid Layout start axis direction.
  13290. The items in grid layout will be arranged in each axis at first.;
  13291. !#zh 布局轴向,只用于 GRID 布局。 */
  13292. export enum AxisDirection {
  13293. HORIZONTAL = 0,
  13294. VERTICAL = 0,
  13295. }
  13296. }
  13297. /****************************************************
  13298. * Layout
  13299. *****************************************************/
  13300. export module Layout {
  13301. /** !#en Enum for vertical layout direction.
  13302. Used in Grid Layout together with AxisDirection is VERTICAL
  13303. !#zh 垂直方向布局方式 */
  13304. export enum VerticalDirection {
  13305. BOTTOM_TO_TOP = 0,
  13306. TOP_TO_BOTTOM = 0,
  13307. }
  13308. }
  13309. /****************************************************
  13310. * Layout
  13311. *****************************************************/
  13312. export module Layout {
  13313. /** !#en Enum for horizontal layout direction.
  13314. Used in Grid Layout together with AxisDirection is HORIZONTAL
  13315. !#zh 水平方向布局方式 */
  13316. export enum HorizontalDirection {
  13317. LEFT_TO_RIGHT = 0,
  13318. RIGHT_TO_LEFT = 0,
  13319. }
  13320. }
  13321. /****************************************************
  13322. * Mask
  13323. *****************************************************/
  13324. export module Mask {
  13325. /** !#en the type for mask.
  13326. !#zh 遮罩组件类型 */
  13327. export enum Type {
  13328. RECT = 0,
  13329. ELLIPSE = 0,
  13330. IMAGE_STENCIL = 0,
  13331. }
  13332. }
  13333. /****************************************************
  13334. * PageView
  13335. *****************************************************/
  13336. export module PageView {
  13337. /** !#en The Page View Size Mode
  13338. !#zh 页面视图每个页面统一的大小类型 */
  13339. export enum SizeMode {
  13340. Unified = 0,
  13341. Free = 0,
  13342. }
  13343. }
  13344. /****************************************************
  13345. * PageView
  13346. *****************************************************/
  13347. export module PageView {
  13348. /** !#en The Page View Direction
  13349. !#zh 页面视图滚动类型 */
  13350. export enum Direction {
  13351. Horizontal = 0,
  13352. Vertical = 0,
  13353. }
  13354. }
  13355. /****************************************************
  13356. * PageView
  13357. *****************************************************/
  13358. export module PageView {
  13359. /** !#en Enum for ScrollView event type.
  13360. !#zh 滚动视图事件类型 */
  13361. export enum EventType {
  13362. PAGE_TURNING = 0,
  13363. }
  13364. }
  13365. /****************************************************
  13366. * PageViewIndicator
  13367. *****************************************************/
  13368. export module PageViewIndicator {
  13369. /** !#en Enum for PageView Indicator direction
  13370. !#zh 页面视图指示器的摆放方向 */
  13371. export enum Direction {
  13372. HORIZONTAL = 0,
  13373. VERTICAL = 0,
  13374. }
  13375. }
  13376. /****************************************************
  13377. * ProgressBar
  13378. *****************************************************/
  13379. export module ProgressBar {
  13380. /** !#en Enum for ProgressBar mode
  13381. !#zh 进度条模式 */
  13382. export enum Mode {
  13383. HORIZONTAL = 0,
  13384. VERTICAL = 0,
  13385. FILLED = 0,
  13386. }
  13387. }
  13388. /****************************************************
  13389. * Scrollbar
  13390. *****************************************************/
  13391. export module Scrollbar {
  13392. /** Enum for Scrollbar direction */
  13393. export enum Direction {
  13394. HORIZONTAL = 0,
  13395. VERTICAL = 0,
  13396. }
  13397. }
  13398. /****************************************************
  13399. * ScrollView
  13400. *****************************************************/
  13401. export module ScrollView {
  13402. /** !#en Enum for ScrollView event type.
  13403. !#zh 滚动视图事件类型 */
  13404. export enum EventType {
  13405. SCROLL_TO_TOP = 0,
  13406. SCROLL_TO_BOTTOM = 0,
  13407. SCROLL_TO_LEFT = 0,
  13408. SCROLL_TO_RIGHT = 0,
  13409. SCROLLING = 0,
  13410. BOUNCE_TOP = 0,
  13411. BOUNCE_BOTTOM = 0,
  13412. BOUNCE_LEFT = 0,
  13413. BOUNCE_RIGHT = 0,
  13414. SCROLL_ENDED = 0,
  13415. TOUCH_UP = 0,
  13416. AUTOSCROLL_ENDED_WITH_THRESHOLD = 0,
  13417. SCROLL_BEGAN = 0,
  13418. }
  13419. }
  13420. /****************************************************
  13421. * Slider
  13422. *****************************************************/
  13423. export module Slider {
  13424. /** !#en The Slider Direction
  13425. !#zh 滑动器方向 */
  13426. export enum Direction {
  13427. Horizontal = 0,
  13428. Vertical = 0,
  13429. }
  13430. }
  13431. /****************************************************
  13432. * Sprite
  13433. *****************************************************/
  13434. export module Sprite {
  13435. /** !#en Enum for sprite type.
  13436. !#zh Sprite 类型 */
  13437. export enum Type {
  13438. SIMPLE = 0,
  13439. SLICED = 0,
  13440. TILED = 0,
  13441. FILLED = 0,
  13442. MESH = 0,
  13443. }
  13444. }
  13445. /****************************************************
  13446. * Sprite
  13447. *****************************************************/
  13448. export module Sprite {
  13449. /** !#en Enum for fill type.
  13450. !#zh 填充类型 */
  13451. export enum FillType {
  13452. HORIZONTAL = 0,
  13453. VERTICAL = 0,
  13454. RADIAL = 0,
  13455. }
  13456. }
  13457. /****************************************************
  13458. * Sprite
  13459. *****************************************************/
  13460. export module Sprite {
  13461. /** !#en Sprite Size can track trimmed size, raw size or none.
  13462. !#zh 精灵尺寸调整模式 */
  13463. export enum SizeMode {
  13464. CUSTOM = 0,
  13465. TRIMMED = 0,
  13466. RAW = 0,
  13467. }
  13468. }
  13469. /****************************************************
  13470. * Sprite
  13471. *****************************************************/
  13472. export module Sprite {
  13473. /** !#en Sprite state can choice the normal or grayscale.
  13474. !#zh 精灵颜色通道模式。 */
  13475. export enum State {
  13476. NORMAL = 0,
  13477. GRAY = 0,
  13478. }
  13479. }
  13480. /****************************************************
  13481. * Widget
  13482. *****************************************************/
  13483. export module Widget {
  13484. /** !#en Enum for Widget's alignment mode, indicating when the widget should refresh.
  13485. !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 */
  13486. export enum AlignMode {
  13487. ONCE = 0,
  13488. ON_WINDOW_RESIZE = 0,
  13489. ALWAYS = 0,
  13490. }
  13491. }
  13492. /****************************************************
  13493. * Pipeline
  13494. *****************************************************/
  13495. export module Pipeline {
  13496. /** The downloader pipe, it can download several types of files:
  13497. 1. Text
  13498. 2. Image
  13499. 3. Script
  13500. 4. Audio
  13501. 5. Assets
  13502. All unknown type will be downloaded as plain text.
  13503. You can pass custom supported types in the constructor. */
  13504. export class Downloader {
  13505. /**
  13506. Constructor of Downloader, you can pass custom supported types.
  13507. @param extMap Custom supported types with corresponded handler
  13508. @example
  13509. ```js
  13510. var downloader = new Downloader({
  13511. // This will match all url with `.scene` extension or all url with `scene` type
  13512. 'scene' : function (url, callback) {}
  13513. });
  13514. ```
  13515. */
  13516. constructor(extMap: any);
  13517. /**
  13518. Add custom supported types handler or modify existing type handler.
  13519. @param extMap Custom supported types with corresponded handler
  13520. */
  13521. addHandlers(extMap: any): void;
  13522. /**
  13523. !#en
  13524. Load subpackage with name.
  13525. !#zh
  13526. 通过子包名加载子包代码。
  13527. @param name Subpackage name
  13528. @param completeCallback Callback invoked when subpackage loaded
  13529. */
  13530. loadSubpackage(name: string, completeCallback?: (error: Error) => void): void;
  13531. }
  13532. }
  13533. /****************************************************
  13534. * Pipeline
  13535. *****************************************************/
  13536. export module Pipeline {
  13537. /** The loader pipe, it can load several types of files:
  13538. 1. Images
  13539. 2. JSON
  13540. 3. Plist
  13541. 4. Audio
  13542. 5. Font
  13543. 6. Cocos Creator scene
  13544. It will not interfere with items of unknown type.
  13545. You can pass custom supported types in the constructor. */
  13546. export class Loader {
  13547. /**
  13548. Constructor of Loader, you can pass custom supported types.
  13549. @param extMap Custom supported types with corresponded handler
  13550. @example
  13551. ```js
  13552. var loader = new Loader({
  13553. // This will match all url with `.scene` extension or all url with `scene` type
  13554. 'scene' : function (url, callback) {}
  13555. });
  13556. ```
  13557. */
  13558. constructor(extMap: any);
  13559. /**
  13560. Add custom supported types handler or modify existing type handler.
  13561. @param extMap Custom supported types with corresponded handler
  13562. */
  13563. addHandlers(extMap: any): void;
  13564. }
  13565. }
  13566. /****************************************************
  13567. * LoadingItems
  13568. *****************************************************/
  13569. export module LoadingItems {
  13570. /** !#en The item states of the LoadingItems, its value could be LoadingItems.ItemState.WORKING | LoadingItems.ItemState.COMPLETET | LoadingItems.ItemState.ERROR
  13571. !#zh LoadingItems 队列中的加载项状态,状态的值可能是 LoadingItems.ItemState.WORKING | LoadingItems.ItemState.COMPLETET | LoadingItems.ItemState.ERROR */
  13572. export enum ItemState {
  13573. WORKING = 0,
  13574. COMPLETET = 0,
  13575. ERROR = 0,
  13576. }
  13577. }
  13578. /****************************************************
  13579. * Event
  13580. *****************************************************/
  13581. export module Event {
  13582. /** !#en The mouse event
  13583. !#zh 鼠标事件类型 */
  13584. export class EventMouse extends Event {
  13585. /**
  13586. !#en Sets scroll data.
  13587. !#zh 设置鼠标的滚动数据。
  13588. @param scrollX scrollX
  13589. @param scrollY scrollY
  13590. */
  13591. setScrollData(scrollX: number, scrollY: number): void;
  13592. /**
  13593. !#en Returns the x axis scroll value.
  13594. !#zh 获取鼠标滚动的X轴距离,只有滚动时才有效。
  13595. */
  13596. getScrollX(): number;
  13597. /**
  13598. !#en Returns the y axis scroll value.
  13599. !#zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  13600. */
  13601. getScrollY(): number;
  13602. /**
  13603. !#en Sets cursor location.
  13604. !#zh 设置当前鼠标位置。
  13605. @param x x
  13606. @param y y
  13607. */
  13608. setLocation(x: number, y: number): void;
  13609. /**
  13610. !#en Returns cursor location.
  13611. !#zh 获取鼠标位置对象,对象包含 x 和 y 属性。
  13612. */
  13613. getLocation(): Vec2;
  13614. /**
  13615. !#en Returns the current cursor location in screen coordinates.
  13616. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  13617. */
  13618. getLocationInView(): Vec2;
  13619. /**
  13620. !#en Returns the previous touch location.
  13621. !#zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  13622. */
  13623. getPreviousLocation(): Vec2;
  13624. /**
  13625. !#en Returns the delta distance from the previous location to current location.
  13626. !#zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  13627. */
  13628. getDelta(): Vec2;
  13629. /**
  13630. !#en Returns the X axis delta distance from the previous location to current location.
  13631. !#zh 获取鼠标距离上一次事件移动的 X 轴距离。
  13632. */
  13633. getDeltaX(): number;
  13634. /**
  13635. !#en Returns the Y axis delta distance from the previous location to current location.
  13636. !#zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  13637. */
  13638. getDeltaY(): number;
  13639. /**
  13640. !#en Sets mouse button.
  13641. !#zh 设置鼠标按键。
  13642. @param button button
  13643. */
  13644. setButton(button: number): void;
  13645. /**
  13646. !#en Returns mouse button.
  13647. !#zh 获取鼠标按键。
  13648. */
  13649. getButton(): number;
  13650. /**
  13651. !#en Returns location X axis data.
  13652. !#zh 获取鼠标当前位置 X 轴。
  13653. */
  13654. getLocationX(): number;
  13655. /**
  13656. !#en Returns location Y axis data.
  13657. !#zh 获取鼠标当前位置 Y 轴。
  13658. */
  13659. getLocationY(): number;
  13660. /** !#en The none event code of mouse event.
  13661. !#zh 无。 */
  13662. static NONE: number;
  13663. /** !#en The event type code of mouse down event.
  13664. !#zh 鼠标按下事件。 */
  13665. static DOWN: number;
  13666. /** !#en The event type code of mouse up event.
  13667. !#zh 鼠标按下后释放事件。 */
  13668. static UP: number;
  13669. /** !#en The event type code of mouse move event.
  13670. !#zh 鼠标移动事件。 */
  13671. static MOVE: number;
  13672. /** !#en The event type code of mouse scroll event.
  13673. !#zh 鼠标滚轮事件。 */
  13674. static SCROLL: number;
  13675. /** !#en The tag of Mouse left button.
  13676. !#zh 鼠标左键的标签。 */
  13677. static BUTTON_LEFT: number;
  13678. /** !#en The tag of Mouse right button (The right button number is 2 on browser).
  13679. !#zh 鼠标右键的标签。 */
  13680. static BUTTON_RIGHT: number;
  13681. /** !#en The tag of Mouse middle button (The right button number is 1 on browser).
  13682. !#zh 鼠标中键的标签。 */
  13683. static BUTTON_MIDDLE: number;
  13684. /** !#en The tag of Mouse button 4.
  13685. !#zh 鼠标按键 4 的标签。 */
  13686. static BUTTON_4: number;
  13687. /** !#en The tag of Mouse button 5.
  13688. !#zh 鼠标按键 5 的标签。 */
  13689. static BUTTON_5: number;
  13690. /** !#en The tag of Mouse button 6.
  13691. !#zh 鼠标按键 6 的标签。 */
  13692. static BUTTON_6: number;
  13693. /** !#en The tag of Mouse button 7.
  13694. !#zh 鼠标按键 7 的标签。 */
  13695. static BUTTON_7: number;
  13696. /** !#en The tag of Mouse button 8.
  13697. !#zh 鼠标按键 8 的标签。 */
  13698. static BUTTON_8: number;
  13699. }
  13700. }
  13701. /****************************************************
  13702. * Event
  13703. *****************************************************/
  13704. export module Event {
  13705. /** !#en The touch event
  13706. !#zh 触摸事件 */
  13707. export class EventTouch extends Event {
  13708. /**
  13709. @param touchArr The array of the touches
  13710. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  13711. */
  13712. constructor(touchArr: any[], bubbles: boolean);
  13713. /** !#en The current touch object
  13714. !#zh 当前触点对象 */
  13715. touch: Touch;
  13716. /**
  13717. !#en Returns event code.
  13718. !#zh 获取事件类型。
  13719. */
  13720. getEventCode(): number;
  13721. /**
  13722. !#en Returns touches of event.
  13723. !#zh 获取触摸点的列表。
  13724. */
  13725. getTouches(): any[];
  13726. /**
  13727. !#en Sets touch location.
  13728. !#zh 设置当前触点位置
  13729. @param x x
  13730. @param y y
  13731. */
  13732. setLocation(x: number, y: number): void;
  13733. /**
  13734. !#en Returns touch location.
  13735. !#zh 获取触点位置。
  13736. */
  13737. getLocation(): Vec2;
  13738. /**
  13739. !#en Returns the current touch location in screen coordinates.
  13740. !#zh 获取当前触点在游戏窗口中的位置。
  13741. */
  13742. getLocationInView(): Vec2;
  13743. /**
  13744. !#en Returns the previous touch location.
  13745. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  13746. */
  13747. getPreviousLocation(): Vec2;
  13748. /**
  13749. !#en Returns the start touch location.
  13750. !#zh 获获取触点落下时的位置对象,对象包含 x 和 y 属性。
  13751. */
  13752. getStartLocation(): Vec2;
  13753. /**
  13754. !#en Returns the id of cc.Touch.
  13755. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  13756. */
  13757. getID(): number;
  13758. /**
  13759. !#en Returns the delta distance from the previous location to current location.
  13760. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  13761. */
  13762. getDelta(): Vec2;
  13763. /**
  13764. !#en Returns the X axis delta distance from the previous location to current location.
  13765. !#zh 获取触点距离上一次事件移动的 x 轴距离。
  13766. */
  13767. getDeltaX(): number;
  13768. /**
  13769. !#en Returns the Y axis delta distance from the previous location to current location.
  13770. !#zh 获取触点距离上一次事件移动的 y 轴距离。
  13771. */
  13772. getDeltaY(): number;
  13773. /**
  13774. !#en Returns location X axis data.
  13775. !#zh 获取当前触点 X 轴位置。
  13776. */
  13777. getLocationX(): number;
  13778. /**
  13779. !#en Returns location Y axis data.
  13780. !#zh 获取当前触点 Y 轴位置。
  13781. */
  13782. getLocationY(): number;
  13783. }
  13784. }
  13785. /****************************************************
  13786. * Event
  13787. *****************************************************/
  13788. export module Event {
  13789. /** !#en The acceleration event
  13790. !#zh 加速度事件 */
  13791. export class EventAcceleration extends Event {
  13792. }
  13793. }
  13794. /****************************************************
  13795. * Event
  13796. *****************************************************/
  13797. export module Event {
  13798. /** !#en The keyboard event
  13799. !#zh 键盘事件 */
  13800. export class EventKeyboard extends Event {
  13801. /** !#en
  13802. The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
  13803. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.
  13804. If the key can't be identified, this value is 0.
  13805. !#zh
  13806. keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
  13807. 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。
  13808. 如果无法识别该键,则该值为 0。 */
  13809. keyCode: number;
  13810. }
  13811. }
  13812. /****************************************************
  13813. * Graphics
  13814. *****************************************************/
  13815. export module Graphics {
  13816. /** !#en Enum for LineCap.
  13817. !#zh 线段末端属性 */
  13818. export enum LineCap {
  13819. BUTT = 0,
  13820. ROUND = 0,
  13821. SQUARE = 0,
  13822. }
  13823. }
  13824. /****************************************************
  13825. * Graphics
  13826. *****************************************************/
  13827. export module Graphics {
  13828. /** !#en Enum for LineJoin.
  13829. !#zh 线段拐角属性 */
  13830. export enum LineJoin {
  13831. BEVEL = 0,
  13832. ROUND = 0,
  13833. MITER = 0,
  13834. }
  13835. }
  13836. /****************************************************
  13837. * macro
  13838. *****************************************************/
  13839. export module macro {
  13840. /** !#en Key map for keyboard event
  13841. !#zh 键盘事件的按键值 */
  13842. export enum KEY {
  13843. none = 0,
  13844. back = 0,
  13845. menu = 0,
  13846. backspace = 0,
  13847. tab = 0,
  13848. enter = 0,
  13849. shift = 0,
  13850. ctrl = 0,
  13851. alt = 0,
  13852. pause = 0,
  13853. capslock = 0,
  13854. escape = 0,
  13855. space = 0,
  13856. pageup = 0,
  13857. pagedown = 0,
  13858. end = 0,
  13859. home = 0,
  13860. left = 0,
  13861. up = 0,
  13862. right = 0,
  13863. down = 0,
  13864. select = 0,
  13865. insert = 0,
  13866. Delete = 0,
  13867. a = 0,
  13868. b = 0,
  13869. c = 0,
  13870. d = 0,
  13871. e = 0,
  13872. f = 0,
  13873. g = 0,
  13874. h = 0,
  13875. i = 0,
  13876. j = 0,
  13877. k = 0,
  13878. l = 0,
  13879. m = 0,
  13880. n = 0,
  13881. o = 0,
  13882. p = 0,
  13883. q = 0,
  13884. r = 0,
  13885. s = 0,
  13886. t = 0,
  13887. u = 0,
  13888. v = 0,
  13889. w = 0,
  13890. x = 0,
  13891. y = 0,
  13892. z = 0,
  13893. num0 = 0,
  13894. num1 = 0,
  13895. num2 = 0,
  13896. num3 = 0,
  13897. num4 = 0,
  13898. num5 = 0,
  13899. num6 = 0,
  13900. num7 = 0,
  13901. num8 = 0,
  13902. num9 = 0,
  13903. '*' = 0,
  13904. '+' = 0,
  13905. '-' = 0,
  13906. numdel = 0,
  13907. '/' = 0,
  13908. f1 = 0,
  13909. f2 = 0,
  13910. f3 = 0,
  13911. f4 = 0,
  13912. f5 = 0,
  13913. f6 = 0,
  13914. f7 = 0,
  13915. f8 = 0,
  13916. f9 = 0,
  13917. f10 = 0,
  13918. f11 = 0,
  13919. f12 = 0,
  13920. numlock = 0,
  13921. scrolllock = 0,
  13922. ';' = 0,
  13923. semicolon = 0,
  13924. equal = 0,
  13925. '=' = 0,
  13926. ',' = 0,
  13927. comma = 0,
  13928. dash = 0,
  13929. '.' = 0,
  13930. period = 0,
  13931. forwardslash = 0,
  13932. grave = 0,
  13933. '[' = 0,
  13934. openbracket = 0,
  13935. backslash = 0,
  13936. ']' = 0,
  13937. closebracket = 0,
  13938. quote = 0,
  13939. dpadLeft = 0,
  13940. dpadRight = 0,
  13941. dpadUp = 0,
  13942. dpadDown = 0,
  13943. dpadCenter = 0,
  13944. }
  13945. }
  13946. /****************************************************
  13947. * macro
  13948. *****************************************************/
  13949. export module macro {
  13950. /** Image formats */
  13951. export enum ImageFormat {
  13952. JPG = 0,
  13953. PNG = 0,
  13954. TIFF = 0,
  13955. WEBP = 0,
  13956. PVR = 0,
  13957. ETC = 0,
  13958. S3TC = 0,
  13959. ATITC = 0,
  13960. TGA = 0,
  13961. RAWDATA = 0,
  13962. UNKNOWN = 0,
  13963. }
  13964. }
  13965. /****************************************************
  13966. * macro
  13967. *****************************************************/
  13968. export module macro {
  13969. /** !#en
  13970. Enum for blend factor
  13971. Refer to: http://www.andersriggelsen.dk/glblendfunc.php
  13972. !#zh
  13973. 混合因子
  13974. 可参考: http://www.andersriggelsen.dk/glblendfunc.php */
  13975. export enum BlendFactor {
  13976. ONE = 0,
  13977. ZERO = 0,
  13978. SRC_ALPHA = 0,
  13979. SRC_COLOR = 0,
  13980. DST_ALPHA = 0,
  13981. DST_COLOR = 0,
  13982. ONE_MINUS_SRC_ALPHA = 0,
  13983. ONE_MINUS_SRC_COLOR = 0,
  13984. ONE_MINUS_DST_ALPHA = 0,
  13985. ONE_MINUS_DST_COLOR = 0,
  13986. }
  13987. }
  13988. /****************************************************
  13989. * macro
  13990. *****************************************************/
  13991. export module macro {
  13992. /** undefined */
  13993. export enum TextAlignment {
  13994. LEFT = 0,
  13995. CENTER = 0,
  13996. RIGHT = 0,
  13997. }
  13998. }
  13999. /****************************************************
  14000. * EditBox
  14001. *****************************************************/
  14002. export module EditBox {
  14003. /** !#en Enum for keyboard return types
  14004. !#zh 键盘的返回键类型 */
  14005. export enum KeyboardReturnType {
  14006. DEFAULT = 0,
  14007. DONE = 0,
  14008. SEND = 0,
  14009. SEARCH = 0,
  14010. GO = 0,
  14011. NEXT = 0,
  14012. }
  14013. }
  14014. /****************************************************
  14015. * EditBox
  14016. *****************************************************/
  14017. export module EditBox {
  14018. /** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.
  14019. !#zh 输入模式 */
  14020. export enum InputMode {
  14021. ANY = 0,
  14022. EMAIL_ADDR = 0,
  14023. NUMERIC = 0,
  14024. PHONE_NUMBER = 0,
  14025. URL = 0,
  14026. DECIMAL = 0,
  14027. SINGLE_LINE = 0,
  14028. }
  14029. }
  14030. /****************************************************
  14031. * EditBox
  14032. *****************************************************/
  14033. export module EditBox {
  14034. /** !#en Enum for the EditBox's input flags
  14035. !#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */
  14036. export enum InputFlag {
  14037. PASSWORD = 0,
  14038. SENSITIVE = 0,
  14039. INITIAL_CAPS_WORD = 0,
  14040. INITIAL_CAPS_SENTENCE = 0,
  14041. INITIAL_CAPS_ALL_CHARACTERS = 0,
  14042. DEFAULT = 0,
  14043. }
  14044. }
  14045. }
  14046. /** !#en
  14047. 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.
  14048. !#zh
  14049. AnySDK 为 CP 提供一套第三方 SDK 接入解决方案,整个接入过程,不改变任何 SDK 的功能、特性、参数等,对于最终玩家而言是完全透明无感知的。
  14050. 目的是让 CP 商能有更多时间更专注于游戏本身的品质,所有 SDK 的接入工作统统交给我们吧。第三方 SDK 包括了渠道SDK、用户系统、支付系统、广告系统、统计系统、分享系统等等。 */
  14051. declare module anysdk {
  14052. /** !#en
  14053. agent manager of plugin
  14054. !#zh
  14055. 插件管理对象 */
  14056. export var agentManager: anysdk.AgentManager;
  14057. /** !#en
  14058. agent manager of plugin
  14059. !#zh
  14060. 插件管理类 */
  14061. export class AgentManager {
  14062. /**
  14063. !#en
  14064. AppKey appSecret and privateKey are the only three parameters generated
  14065. after the packing tool client finishes creating the game.
  14066. The oauthLoginServer parameter is the API address provided by the game service
  14067. to login verification
  14068. !#zh
  14069. appKey、appSecret、privateKey是通过 AnySDK 客户端工具创建游戏后生成的。
  14070. oauthLoginServer参数是游戏服务提供的用来做登陆验证转发的接口地址。
  14071. @param appKey appKey
  14072. @param appSecret appSecret
  14073. @param privateKey privateKey
  14074. @param oauthLoginServer oauthLoginServer
  14075. */
  14076. init(appKey: string, appSecret: string, privateKey: string, oauthLoginServer: string): void;
  14077. /**
  14078. !#en
  14079. load all plugins, the operation includes SDK`s initialization
  14080. !#zh
  14081. 加载所有插件,该操作包含了 SDKs 初始化
  14082. @param callback callback
  14083. @param target The object to bind to.
  14084. */
  14085. loadAllPlugins(callback: Function, target: any): void;
  14086. /**
  14087. !#en
  14088. unload all plugins
  14089. !#zh
  14090. 卸载插件
  14091. */
  14092. unloadAllPlugins(): void;
  14093. /**
  14094. !#en
  14095. get user system plugin
  14096. !#zh
  14097. 获取用户系统插件
  14098. */
  14099. getUserPlugin(): anysdk.ProtocolUser;
  14100. /**
  14101. !#en
  14102. get IAP system plugins
  14103. !#zh
  14104. 获取支付系统插件
  14105. */
  14106. getIAPPlugins(): anysdk.ProtocolIAP[];
  14107. /**
  14108. !#en
  14109. get IAP system plugin
  14110. !#zh
  14111. 获取支付系统插件
  14112. */
  14113. getIAPPlugin(): anysdk.ProtocolIAP;
  14114. /**
  14115. !#en
  14116. get social system plugin
  14117. !#zh
  14118. 获取社交系统插件
  14119. */
  14120. getSocialPlugin(): anysdk.ProtocolSocial;
  14121. /**
  14122. !#en
  14123. get share system plugin
  14124. !#zh
  14125. 获取分享系统插件
  14126. */
  14127. getSharePlugin(): anysdk.ProtocolShare;
  14128. /**
  14129. !#en
  14130. get analytics system plugin
  14131. !#zh
  14132. 获取统计系统插件
  14133. */
  14134. getAnalyticsPlugin(): anysdk.ProtocolAnalytics;
  14135. /**
  14136. !#en
  14137. get ads system plugin
  14138. !#zh
  14139. 获取广告系统插件
  14140. */
  14141. getAdsPlugin(): anysdk.ProtocolAds;
  14142. /**
  14143. !#en
  14144. get push system plugin
  14145. !#zh
  14146. 获取推送系统插件
  14147. */
  14148. getPushPlugin(): anysdk.ProtocolPush;
  14149. /**
  14150. !#en
  14151. get REC system plugin
  14152. !#zh
  14153. 获取录屏系统插件
  14154. */
  14155. getRECPlugin(): anysdk.ProtocolREC;
  14156. /**
  14157. !#en
  14158. get crash system plugin
  14159. !#zh
  14160. 获取崩溃分析系统插件
  14161. */
  14162. getCrashPlugin(): anysdk.ProtocolCrash;
  14163. /**
  14164. !#en
  14165. get ad track system plugin
  14166. !#zh
  14167. 获取广告追踪系统插件
  14168. */
  14169. getAdTrackingPlugin(): anysdk.ProtocolAdTracking;
  14170. /**
  14171. !#en
  14172. get custom system plugin
  14173. !#zh
  14174. 获取自定义系统插件
  14175. */
  14176. getCustomPlugin(): anysdk.ProtocolCustom;
  14177. /**
  14178. !#en
  14179. get custom parameter
  14180. !#zh
  14181. 获取自定义参数
  14182. */
  14183. getCustomParam(): string;
  14184. /**
  14185. !#en
  14186. get channel id
  14187. !#zh
  14188. 获取渠道唯一表示符
  14189. */
  14190. getChannelId(): string;
  14191. /**
  14192. !#en
  14193. get status of analytics
  14194. !#zh
  14195. 获取统计状态
  14196. */
  14197. isAnaylticsEnabled(): boolean;
  14198. /**
  14199. !#en
  14200. set whether to analytics
  14201. !#zh
  14202. 设置是否统计
  14203. @param enabled enabled
  14204. */
  14205. setIsAnaylticsEnabled(enabled: boolean): void;
  14206. /**
  14207. !#en
  14208. destory instance
  14209. !#zh
  14210. 销毁单例
  14211. */
  14212. static end(): void;
  14213. /**
  14214. !#en
  14215. get instance
  14216. !#zh
  14217. 获取单例
  14218. */
  14219. static getInstance(): anysdk.AgentManager;
  14220. }
  14221. /** !#en
  14222. plugin protocol
  14223. !#zh
  14224. 插件协议 */
  14225. export class PluginProtocol {
  14226. /**
  14227. !#en
  14228. Check whether the function is supported
  14229. !#zh
  14230. 判断函数是否支持
  14231. @param functionName functionName
  14232. */
  14233. isFunctionSupported(functionName: string): boolean;
  14234. /**
  14235. !#en
  14236. get plugin name
  14237. !#zh
  14238. 获取插件名称
  14239. */
  14240. getPluginName(): string;
  14241. /**
  14242. !#en
  14243. get plugin version
  14244. !#zh
  14245. 获取插件版本
  14246. */
  14247. getPluginVersion(): string;
  14248. /**
  14249. !#en
  14250. get SDK version
  14251. !#zh
  14252. 获取 SDK 版本
  14253. */
  14254. getSDKVersion(): string;
  14255. /**
  14256. !#en
  14257. void methods for reflections with parameter
  14258. !#zh
  14259. 反射调用带参数的void方法
  14260. @param funName funName
  14261. @param args optional arguments
  14262. */
  14263. callFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): void;
  14264. /**
  14265. !#en
  14266. String methods for reflections with parameter
  14267. !#zh
  14268. 反射调用带参数的 String 方法
  14269. @param funName funName
  14270. @param args optional arguments
  14271. */
  14272. callStringFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): string;
  14273. /**
  14274. !#en
  14275. int methods for reflections with parameter
  14276. !#zh
  14277. 反射调用带参数的 Int 方法
  14278. @param funName funName
  14279. @param args optional arguments
  14280. */
  14281. callIntFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): number;
  14282. /**
  14283. !#en
  14284. boolean methods for reflections with parameter
  14285. !#zh
  14286. 反射调用带参数的 boolean 方法
  14287. @param funName funName
  14288. @param args optional arguments
  14289. */
  14290. callBoolFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): boolean;
  14291. /**
  14292. !#en
  14293. float methods for reflections with parameter
  14294. !#zh
  14295. 反射调用带参数的 float 方法
  14296. @param funName funName
  14297. @param args optional arguments
  14298. */
  14299. callFloatFuncWithParam(funName: string, ...args: any|anysdk.PluginParam[]): number;
  14300. }
  14301. /** !#en
  14302. user protocol
  14303. !#zh
  14304. 用户系统协议接口 */
  14305. export class ProtocolUser extends PluginProtocol {
  14306. /**
  14307. !#en
  14308. login interface
  14309. !#zh
  14310. 登录接口
  14311. @param args optional arguments
  14312. */
  14313. login(...args: string|any[]): void;
  14314. /**
  14315. !#en
  14316. get status of login
  14317. !#zh
  14318. 获取登录状态
  14319. */
  14320. isLogined(): boolean;
  14321. /**
  14322. !#en
  14323. get user ID
  14324. !#zh
  14325. 获取用户唯一标示符
  14326. */
  14327. getUserID(): string;
  14328. /**
  14329. !#en
  14330. get plugin ID
  14331. !#zh
  14332. 获取插件ID
  14333. */
  14334. getPluginId(): string;
  14335. /**
  14336. !#en
  14337. set listener
  14338. !#zh
  14339. 设置用户系统的监听
  14340. @param listener listener
  14341. @param target target
  14342. */
  14343. setListener(listener: Function, target: any): void;
  14344. /**
  14345. !#en
  14346. get listener
  14347. !#zh
  14348. 获取用户系统的监听
  14349. */
  14350. getListener(): Function;
  14351. /**
  14352. !#en
  14353. logout
  14354. Before to invoke, you need to verdict whether this properties existed
  14355. !#zh
  14356. 登出,调用前需要判断属性是否存在
  14357. */
  14358. logout(): void;
  14359. /**
  14360. !#en
  14361. show toolbar
  14362. Before to invoke, you need to verdict whether this properties existed
  14363. !#zh
  14364. 显示悬浮窗,调用前需要判断属性是否存在
  14365. @param place place
  14366. */
  14367. showToolBar(place: anysdk.ToolBarPlace): void;
  14368. /**
  14369. !#en
  14370. hide toolbar
  14371. Before to invoke, you need to verdict whether this properties existed
  14372. !#zh
  14373. 隐藏悬浮窗,调用前需要判断属性是否存在
  14374. */
  14375. hideToolBar(): void;
  14376. /**
  14377. !#en
  14378. enter platform
  14379. Before to invoke, you need to verdict whether this properties existed
  14380. !#zh
  14381. 显示平台中心,调用前需要判断属性是否存在
  14382. */
  14383. enterPlatform(): void;
  14384. /**
  14385. !#en
  14386. show exit page
  14387. Before to invoke, you need to verdict whether this properties existed
  14388. !#zh
  14389. 显示退出界面,调用前需要判断属性是否存在
  14390. */
  14391. exit(): void;
  14392. /**
  14393. !#en
  14394. show pause page
  14395. Before to invoke, you need to verdict whether this properties existed
  14396. !#zh
  14397. 显示暂停界面,调用前需要判断属性是否存在
  14398. */
  14399. pause(): void;
  14400. /**
  14401. !#en
  14402. Real-name registration
  14403. Before to invoke, you need to verdict whether this properties existed
  14404. !#zh
  14405. 实名注册,调用前需要判断属性是否存在
  14406. */
  14407. realNameRegister(): void;
  14408. /**
  14409. !#en
  14410. Anti-addiction query
  14411. Before to invoke, you need to verdict whether this properties existed
  14412. !#zh
  14413. 防沉迷查询,调用前需要判断属性是否存在
  14414. */
  14415. antiAddictionQuery(): void;
  14416. /**
  14417. !#en
  14418. submit game role information
  14419. Before to invoke, you need to verdict whether this properties existed
  14420. !#zh
  14421. 提交角色信息,调用前需要判断属性是否存在
  14422. @param data data
  14423. */
  14424. submitLoginGameRole(data: any): void;
  14425. /**
  14426. !#en
  14427. get user information
  14428. Before to invoke, you need to verdict whether this properties existed
  14429. !#zh
  14430. 获取用户信息,调用前需要判断属性是否存在
  14431. @param info info
  14432. */
  14433. getUserInfo(info: any): void;
  14434. /**
  14435. !#en
  14436. set login type
  14437. Before to invoke, you need to verdict whether this properties existed
  14438. !#zh
  14439. 设置登录类型,调用前需要判断属性是否存在
  14440. @param info info
  14441. */
  14442. getAvailableLoginType(info: any): void;
  14443. /**
  14444. !#en
  14445. set login type
  14446. Before to invoke, you need to verdict whether this properties existed
  14447. !#zh
  14448. 设置登录类型,调用前需要判断属性是否存在
  14449. @param loginType loginType
  14450. */
  14451. setLoginType(loginType: string): void;
  14452. /**
  14453. !#en
  14454. send to desktop
  14455. Before to invoke, you need to verdict whether this properties existed
  14456. !#zh
  14457. 发送到桌面,调用前需要判断属性是否存在
  14458. */
  14459. sendToDesktop(): void;
  14460. /**
  14461. !#en
  14462. open bbs
  14463. Before to invoke, you need to verdict whether this properties existed
  14464. !#zh
  14465. 打开论坛,调用前需要判断属性是否存在
  14466. */
  14467. openBBS(): void;
  14468. }
  14469. /** !#en
  14470. IAP protocol
  14471. !#zh
  14472. 支付系统协议接口 */
  14473. export class ProtocolIAP extends PluginProtocol {
  14474. /**
  14475. !#en
  14476. pay interface
  14477. !#zh
  14478. 支付接口
  14479. @param info Type:map
  14480. */
  14481. payForProduct(info: any): void;
  14482. /**
  14483. !#en
  14484. get order ID
  14485. !#zh
  14486. 获取订单ID
  14487. */
  14488. getOrderId(): string;
  14489. /**
  14490. !#en
  14491. reset the pay status
  14492. !#zh
  14493. 重置支付状态
  14494. */
  14495. static resetPayState(): void;
  14496. /**
  14497. !#en
  14498. get plugin ID
  14499. !#zh
  14500. 获取插件ID
  14501. */
  14502. getPluginId(): string;
  14503. /**
  14504. !#en
  14505. set listener
  14506. !#zh
  14507. 设置支付系统的监听
  14508. @param listener listener
  14509. @param target target
  14510. */
  14511. setListener(listener: Function, target: any): void;
  14512. /**
  14513. !#en
  14514. get listener
  14515. !#zh
  14516. 获取支付系统的监听
  14517. */
  14518. getListener(): Function;
  14519. }
  14520. /** !#en
  14521. analytics protocol
  14522. !#zh
  14523. 统计系统协议接口 */
  14524. export class ProtocolAnalytics extends PluginProtocol {
  14525. /**
  14526. !#en
  14527. Start a new session.
  14528. !#zh
  14529. 启动会话
  14530. */
  14531. startSession(): void;
  14532. /**
  14533. !#en
  14534. Stop a session.
  14535. !#zh
  14536. 关闭会话
  14537. */
  14538. stopSession(): void;
  14539. /**
  14540. !#en
  14541. Set the timeout for expiring a session.
  14542. !#zh
  14543. 设置会话超时时间
  14544. @param millis Type: long
  14545. */
  14546. setSessionContinueMillis(millis: number): void;
  14547. /**
  14548. !#en
  14549. log an error
  14550. !#zh
  14551. 捕捉异常
  14552. @param errorId errorId
  14553. @param message message
  14554. */
  14555. logError(errorId: string, message: string): void;
  14556. /**
  14557. !#en
  14558. log an event.
  14559. !#zh
  14560. 捕捉事件
  14561. @param errorId errorId
  14562. @param args optional arguments Type: map
  14563. */
  14564. logEvent(errorId: string, ...args: any[]): void;
  14565. /**
  14566. !#en
  14567. Track an event begin.
  14568. !#zh
  14569. 统计事件开始
  14570. @param eventId eventId
  14571. */
  14572. logTimedEventBegin(eventId: string): void;
  14573. /**
  14574. !#en
  14575. Track an event end.
  14576. !#zh
  14577. 统计事件结束
  14578. @param eventId eventId
  14579. */
  14580. logTimedEventEnd(eventId: string): void;
  14581. /**
  14582. !#en
  14583. set Whether to catch uncaught exceptions to server.
  14584. !#zh
  14585. 设置是否开启自动异常捕捉
  14586. @param enabled enabled
  14587. */
  14588. setCaptureUncaughtException(enabled: boolean): void;
  14589. /**
  14590. !#en
  14591. analytics account information
  14592. !#zh
  14593. 统计玩家帐户信息
  14594. @param paramMap Type: map
  14595. */
  14596. setAccount(paramMap: any): void;
  14597. /**
  14598. !#en
  14599. track user to request payment
  14600. !#zh
  14601. 跟踪用户支付请求
  14602. @param paramMap Type: map
  14603. */
  14604. onChargeRequest(paramMap: any): void;
  14605. /**
  14606. !#en
  14607. track Successful payment
  14608. !#zh
  14609. 追踪用户支付成功
  14610. @param orderID orderID
  14611. */
  14612. onChargeSuccess(orderID: string): void;
  14613. /**
  14614. !#en
  14615. track failed payment
  14616. !#zh
  14617. 追踪用户支付失败
  14618. @param paramMap Type: map
  14619. */
  14620. onChargeFail(paramMap: any): void;
  14621. /**
  14622. !#en
  14623. track Successful payment
  14624. !#zh
  14625. 统计玩家支付成功
  14626. @param paramMap Type: map
  14627. */
  14628. onChargeOnlySuccess(paramMap: any): void;
  14629. /**
  14630. !#en
  14631. track user purchase
  14632. !#zh
  14633. 统计玩家消费
  14634. @param paramMap Type: map
  14635. */
  14636. onPurchase(paramMap: any): void;
  14637. /**
  14638. !#en
  14639. track user to use goods
  14640. !#zh
  14641. 统计玩家使用道具
  14642. @param paramMap Type: map
  14643. */
  14644. onUse(paramMap: any): void;
  14645. /**
  14646. !#en
  14647. track user to reward goods
  14648. !#zh
  14649. 统计玩家获取奖励
  14650. @param paramMap Type: map
  14651. */
  14652. onReward(paramMap: any): void;
  14653. /**
  14654. !#en
  14655. start level
  14656. !#zh
  14657. 开始关卡
  14658. @param paramMap Type: map
  14659. */
  14660. startLevel(paramMap: any): void;
  14661. /**
  14662. !#en
  14663. finish level
  14664. !#zh
  14665. 结束关卡
  14666. @param levelID levelID
  14667. */
  14668. finishLevel(levelID: string): void;
  14669. /**
  14670. !#en
  14671. failed level
  14672. !#zh
  14673. 关卡失败
  14674. @param paramMap Type: map
  14675. */
  14676. failLevel(paramMap: any): void;
  14677. /**
  14678. !#en
  14679. start task
  14680. !#zh
  14681. 开始任务
  14682. @param paramMap Type: map
  14683. */
  14684. startTask(paramMap: any): void;
  14685. /**
  14686. !#en
  14687. finish task
  14688. !#zh
  14689. 完成任务
  14690. @param taskID taskID
  14691. */
  14692. finishTask(taskID: string): void;
  14693. /**
  14694. !#en
  14695. failed task
  14696. !#zh
  14697. 任务失败
  14698. @param paramMap Type: map
  14699. */
  14700. failTask(paramMap: any): void;
  14701. }
  14702. /** !#en
  14703. share protocol
  14704. !#zh
  14705. 分享系统协议接口 */
  14706. export class ProtocolShare extends PluginProtocol {
  14707. /**
  14708. !#en
  14709. share interface
  14710. !#zh
  14711. 分享
  14712. @param info Type: map
  14713. */
  14714. share(info: any): void;
  14715. /**
  14716. !#en
  14717. set listener
  14718. !#zh
  14719. 设置分享系统的监听
  14720. @param listener listener
  14721. @param target target
  14722. */
  14723. setListener(listener: Function, target: any): void;
  14724. /**
  14725. !#en
  14726. get listener
  14727. !#zh
  14728. 获取分享系统的监听
  14729. */
  14730. getListener(): Function;
  14731. }
  14732. /** !#en
  14733. ads protocol
  14734. !#zh
  14735. 广告系统协议接口 */
  14736. export class ProtocolAds extends PluginProtocol {
  14737. /**
  14738. !#en
  14739. hide ads view
  14740. !#zh
  14741. 隐藏广告
  14742. @param adstype adstype
  14743. @param idx idx
  14744. */
  14745. hideAds(adstype: anysdk.AdsType, idx: number): void;
  14746. /**
  14747. !#en
  14748. preload ads view
  14749. !#zh
  14750. 预加载广告
  14751. @param adstype adstype
  14752. @param idx idx
  14753. */
  14754. preloadAds(adstype: anysdk.AdsType, idx: number): void;
  14755. /**
  14756. !#en
  14757. query points
  14758. !#zh
  14759. 查询分数
  14760. */
  14761. queryPoints(): number;
  14762. /**
  14763. !#en
  14764. get whether the ads type is supported
  14765. !#zh
  14766. 获取广告类型是否支持
  14767. @param arg0 arg0
  14768. */
  14769. isAdTypeSupported(arg0: anysdk.AdsType): boolean;
  14770. /**
  14771. !#en
  14772. spend point
  14773. !#zh
  14774. 消费分数
  14775. @param points points
  14776. */
  14777. spendPoints(points: number): void;
  14778. /**
  14779. !#en
  14780. set listener
  14781. !#zh
  14782. 设置广告系统的监听
  14783. @param listener listener
  14784. @param target target
  14785. */
  14786. setListener(listener: Function, target: any): void;
  14787. /**
  14788. !#en
  14789. get listener
  14790. !#zh
  14791. 获取广告系统的监听
  14792. */
  14793. getListener(): Function;
  14794. }
  14795. /** !#en
  14796. social protocol
  14797. !#zh
  14798. 社交系统协议接口 */
  14799. export class ProtocolSocial extends PluginProtocol {
  14800. /**
  14801. !#en
  14802. sign in
  14803. !#zh
  14804. 登录
  14805. */
  14806. signIn(): void;
  14807. /**
  14808. !#en
  14809. sign out
  14810. !#zh
  14811. 登出
  14812. */
  14813. signOut(): void;
  14814. /**
  14815. !#en
  14816. submit score
  14817. !#zh
  14818. 提交分数
  14819. @param leadboardID leadboardID
  14820. @param score Type: long
  14821. */
  14822. submitScore(leadboardID: string, score: number): void;
  14823. /**
  14824. !#en
  14825. show the id of Leaderboard page
  14826. !#zh
  14827. 根据唯一标识符显示排行榜
  14828. @param leaderboardID leaderboardID
  14829. */
  14830. showLeaderboard(leaderboardID: string): void;
  14831. /**
  14832. !#en
  14833. show the page of achievements
  14834. !#zh
  14835. 显示成就榜
  14836. */
  14837. showAchievements(): void;
  14838. /**
  14839. !#en
  14840. unlock achievement
  14841. !#zh
  14842. 解锁成就
  14843. @param info Type: map
  14844. */
  14845. share(info: any): void;
  14846. /**
  14847. !#en
  14848. set listener
  14849. !#zh
  14850. 设置社交系统的监听
  14851. @param listener listener
  14852. @param target target
  14853. */
  14854. setListener(listener: Function, target: any): void;
  14855. /**
  14856. !#en
  14857. get listener
  14858. !#zh
  14859. 获取社交系统的监听
  14860. */
  14861. getListener(): Function;
  14862. /**
  14863. !#en
  14864. get friends info
  14865. Before to invoke, you need to verdict whether this properties existed
  14866. !#zh
  14867. 获取好友信息,调用前需要判断属性是否存在
  14868. */
  14869. pauseRecording(): void;
  14870. /**
  14871. !#en
  14872. interact
  14873. Before to invoke, you need to verdict whether this properties existed
  14874. !#zh
  14875. 订阅,调用前需要判断属性是否存在
  14876. */
  14877. interact(): void;
  14878. /**
  14879. !#en
  14880. subscribe
  14881. Before to invoke, you need to verdict whether this properties existed
  14882. !#zh
  14883. 关注,调用前需要判断属性是否存在
  14884. */
  14885. subscribe(): void;
  14886. }
  14887. /** !#en
  14888. push protocol
  14889. !#zh
  14890. 推送系统协议接口 */
  14891. export class ProtocolPush extends PluginProtocol {
  14892. /**
  14893. !#en
  14894. start Push services
  14895. !#zh
  14896. 启动推送服务
  14897. */
  14898. startPush(): void;
  14899. /**
  14900. !#en
  14901. close Push services
  14902. !#zh
  14903. 暂停推送服务
  14904. */
  14905. closePush(): void;
  14906. /**
  14907. !#en
  14908. delete alias
  14909. !#zh
  14910. 删除别名
  14911. @param alias alias
  14912. */
  14913. delAlias(alias: string): void;
  14914. /**
  14915. !#en
  14916. set alias
  14917. !#zh
  14918. 设置别名
  14919. @param alias alias
  14920. */
  14921. setAlias(alias: string): void;
  14922. /**
  14923. !#en
  14924. delete tags
  14925. !#zh
  14926. 删除标签
  14927. @param tags Type: list
  14928. */
  14929. delTags(tags: any): void;
  14930. /**
  14931. !#en
  14932. set tags
  14933. !#zh
  14934. 设置标签
  14935. @param tags Type: list
  14936. */
  14937. setTags(tags: any): void;
  14938. /**
  14939. !#en
  14940. set listener
  14941. !#zh
  14942. 设置推送系统的监听
  14943. @param listener listener
  14944. @param target target
  14945. */
  14946. setListener(listener: Function, target: any): void;
  14947. /**
  14948. !#en
  14949. get listener
  14950. !#zh
  14951. 获取推送系统的监听
  14952. */
  14953. getListener(): Function;
  14954. }
  14955. /** !#en
  14956. crash protocol
  14957. !#zh
  14958. 崩溃分析系统协议接口 */
  14959. export class ProtocolCrash extends PluginProtocol {
  14960. /**
  14961. !#en
  14962. set user identifier
  14963. !#zh
  14964. 统计用户唯一标识符
  14965. @param identifier identifier
  14966. */
  14967. setUserIdentifier(identifier: string): void;
  14968. /**
  14969. !#en
  14970. The uploader captured in exception information
  14971. !#zh
  14972. 上报异常信息
  14973. @param message message
  14974. @param exception exception
  14975. */
  14976. reportException(message: string, exception: string): void;
  14977. /**
  14978. !#en
  14979. customize logging
  14980. !#zh
  14981. 自定义日志记录
  14982. @param breadcrumb breadcrumb
  14983. */
  14984. leaveBreadcrumb(breadcrumb: string): void;
  14985. }
  14986. /** !#en
  14987. REC protocol
  14988. !#zh
  14989. 录屏系统协议接口 */
  14990. export class ProtocolREC extends PluginProtocol {
  14991. /**
  14992. !#en
  14993. share video
  14994. !#zh
  14995. 分享视频
  14996. @param info Type: map
  14997. */
  14998. share(info: any): void;
  14999. /**
  15000. !#en
  15001. Start to record video
  15002. !#zh
  15003. 开始录制视频
  15004. */
  15005. startRecording(): void;
  15006. /**
  15007. !#en
  15008. Start to record video
  15009. !#zh
  15010. 结束录制视频
  15011. */
  15012. stopRecording(): void;
  15013. /**
  15014. !#en
  15015. set listener
  15016. !#zh
  15017. 设置录屏系统的监听
  15018. @param listener listener
  15019. @param target target
  15020. */
  15021. setListener(listener: Function, target: any): void;
  15022. /**
  15023. !#en
  15024. get listener
  15025. !#zh
  15026. 获取录屏系统的监听
  15027. */
  15028. getListener(): Function;
  15029. /**
  15030. !#en
  15031. pause to record video
  15032. Before to invoke, you need to verdict whether this properties existed
  15033. !#zh
  15034. 暂停录制视频,调用前需要判断属性是否存在
  15035. */
  15036. pauseRecording(): void;
  15037. /**
  15038. !#en
  15039. resume to record video
  15040. Before to invoke, you need to verdict whether this properties existed
  15041. !#zh
  15042. 恢复录制视频,调用前需要判断属性是否存在
  15043. */
  15044. resumeRecording(): void;
  15045. /**
  15046. !#en
  15047. get whether the device is isAvailable
  15048. Before to invoke, you need to verdict whether this properties existed
  15049. !#zh
  15050. 获取设备是否可用,调用前需要判断属性是否存在
  15051. */
  15052. isAvailable(): boolean;
  15053. /**
  15054. !#en
  15055. get status of recording
  15056. Before to invoke, you need to verdict whether this properties existed
  15057. !#zh
  15058. 获取录制状态,调用前需要判断属性是否存在
  15059. */
  15060. isRecording(): boolean;
  15061. /**
  15062. !#en
  15063. show toolbar
  15064. Before to invoke, you need to verdict whether this properties existed
  15065. !#zh
  15066. 显示悬浮窗,调用前需要判断属性是否存在
  15067. */
  15068. showToolBar(): void;
  15069. /**
  15070. !#en
  15071. hide toolbar
  15072. Before to invoke, you need to verdict whether this properties existed
  15073. !#zh
  15074. 隐藏悬浮窗,调用前需要判断属性是否存在
  15075. */
  15076. hideToolBar(): void;
  15077. /**
  15078. !#en
  15079. show video center
  15080. Before to invoke, you need to verdict whether this properties existed
  15081. !#zh
  15082. 显示视频中心,调用前需要判断属性是否存在
  15083. */
  15084. showVideoCenter(): void;
  15085. /**
  15086. !#en
  15087. enter platform
  15088. Before to invoke, you need to verdict whether this properties existed
  15089. !#zh
  15090. 显示平台中心,调用前需要判断属性是否存在
  15091. */
  15092. enterPlatform(): void;
  15093. /**
  15094. !#en
  15095. Set the video data, it is recommended to check whether are recorded firstly
  15096. Before to invoke, you need to verdict whether this properties existed
  15097. !#zh
  15098. 设置视频相关数据,建议先检查是否是正在录制,调用前需要判断属性是否存在
  15099. @param info Type: map
  15100. */
  15101. setMetaData(info: any): void;
  15102. }
  15103. /** !#en
  15104. ad tracking protocol
  15105. !#zh
  15106. 广告追踪系统协议接口 */
  15107. export class ProtocolAdTracking extends PluginProtocol {
  15108. /**
  15109. !#en
  15110. Call this method if you want to track register events as happening during a section.
  15111. !#zh
  15112. 统计用户注册信息
  15113. @param productInfo Type: map
  15114. */
  15115. onPay(productInfo: any): void;
  15116. /**
  15117. !#en
  15118. Call this method if you want to track register events as happening during a section.
  15119. !#zh
  15120. 统计用户注册信息
  15121. @param userInfo Type: map
  15122. */
  15123. onLogin(userInfo: any): void;
  15124. /**
  15125. !#en
  15126. Call this method if you want to track register events as happening during a section.
  15127. !#zh
  15128. 统计用户注册信息
  15129. @param userId userId
  15130. */
  15131. onRegister(userId: string): void;
  15132. /**
  15133. !#en
  15134. Call this method if you want to track custom events with parameters as happening during a section.
  15135. !#zh
  15136. 统计自定义事件
  15137. @param eventId eventId
  15138. @param paramMap Type: map
  15139. */
  15140. trackEvent(eventId: string, paramMap: any): void;
  15141. /**
  15142. !#en
  15143. Call this method with parameters if you want to create role as happening during a section.
  15144. !#zh
  15145. 统计创建角色事件,调用前需要判断属性是否存在
  15146. @param userInfo Type: map
  15147. */
  15148. onCreateRole(userInfo: any): void;
  15149. /**
  15150. !#en
  15151. Call this method if you want to track levelup events with parameters as happening during a section.
  15152. Before to invoke, you need to verdict whether this properties existed
  15153. !#zh
  15154. 统计角色升级事件,调用前需要判断属性是否存在
  15155. @param info Type: map
  15156. */
  15157. onLevelUp(info: any): void;
  15158. /**
  15159. !#en
  15160. Invoke this method with parameters if you want to start to pay as happening during a section.
  15161. Before to invoke, you need to verdict whether this properties existed
  15162. !#zh
  15163. 统计开始充值事件,调用前需要判断属性是否存在
  15164. @param info Type: map
  15165. */
  15166. onStartToPay(info: any): void;
  15167. }
  15168. /** !#en
  15169. custom protocol
  15170. !#zh
  15171. 自定义系统协议接口 */
  15172. export class ProtocolCustom extends PluginProtocol {
  15173. /**
  15174. !#en
  15175. set listener
  15176. !#zh
  15177. 设置自定义系统的监听
  15178. @param listener listener
  15179. @param target target
  15180. */
  15181. setListener(listener: Function, target: any): void;
  15182. /**
  15183. !#en
  15184. get listener
  15185. !#zh
  15186. 获取自定义系统的监听
  15187. */
  15188. getListener(): Function;
  15189. }
  15190. /** !#en
  15191. Data structure class
  15192. !#zh
  15193. 数据结构类 */
  15194. export class PluginParam {
  15195. /**
  15196. !#en
  15197. create plugin parameters
  15198. !#zh
  15199. 创建对象
  15200. @param parameters parameters
  15201. */
  15202. static create(parameters: number|string|any): anysdk.PluginParam;
  15203. }
  15204. /** !#en The callback of user system
  15205. !#zh 用户系统回调 */
  15206. export enum UserActionResultCode {
  15207. kInitSuccess = 0,
  15208. kInitFail = 0,
  15209. kLoginSuccess = 0,
  15210. kLoginNetworkError = 0,
  15211. kLoginNoNeed = 0,
  15212. kLoginFail = 0,
  15213. kLoginCancel = 0,
  15214. kLogoutSuccess = 0,
  15215. kLogoutFail = 0,
  15216. kPlatformEnter = 0,
  15217. kPlatformBack = 0,
  15218. kPausePage = 0,
  15219. kExitPage = 0,
  15220. kAntiAddictionQuery = 0,
  15221. kRealNameRegister = 0,
  15222. kAccountSwitchSuccess = 0,
  15223. kAccountSwitchFail = 0,
  15224. kOpenShop = 0,
  15225. kAccountSwitchCancel = 0,
  15226. kUserExtension = 0,
  15227. kSendToDesktopSuccess = 0,
  15228. kSendToDesktopFail = 0,
  15229. kGetAvailableLoginTypeSuccess = 0,
  15230. kGetAvailableLoginTypeFail = 0,
  15231. kGetUserInfoSuccess = 0,
  15232. kGetUserInfoFail = 0,
  15233. kOpenBBSSuccess = 0,
  15234. kOpenBBSFail = 0,
  15235. }
  15236. /** !#en The toolbar position of user type
  15237. !#zh 用户系统悬浮窗位置 */
  15238. export enum ToolBarPlace {
  15239. kToolBarTopLeft = 0,
  15240. kToolBarTopRight = 0,
  15241. kToolBarMidLeft = 0,
  15242. kToolBarMidRight = 0,
  15243. kToolBarBottomLeft = 0,
  15244. kToolBarBottomRight = 0,
  15245. }
  15246. /** !#en The callback of requesting reStringge
  15247. !#zh 支付系统支付请求回调 */
  15248. export enum PayResultCode {
  15249. kPaySuccess = 0,
  15250. kPayFail = 0,
  15251. kPayCancel = 0,
  15252. kPayNetworkError = 0,
  15253. kPayProductionInforIncomplete = 0,
  15254. kPayInitSuccess = 0,
  15255. kPayInitFail = 0,
  15256. kPayNowPaying = 0,
  15257. kPayReStringgeSuccess = 0,
  15258. kPayExtension = 0,
  15259. kPayNeedLoginAgain = 0,
  15260. kRequestSuccess = 0,
  15261. kRequestFail = 0,
  15262. }
  15263. /** !#en The enum of account type
  15264. !#zh 统计系统的账号类型 */
  15265. export enum AccountType {
  15266. ANONYMOUS = 0,
  15267. REGISTED = 0,
  15268. SINA_WEIBO = 0,
  15269. TENCENT_WEIBO = 0,
  15270. QQ = 0,
  15271. ND91 = 0,
  15272. }
  15273. /** !#en The enum of account operation
  15274. !#zh 统计系统的账号操作 */
  15275. export enum AccountOperate {
  15276. LOGIN = 0,
  15277. LOGOUT = 0,
  15278. REGISTER = 0,
  15279. }
  15280. /** !#en The enum of gender
  15281. !#zh 统计系统的账号性别 */
  15282. export enum AccountGender {
  15283. MALE = 0,
  15284. FEMALE = 0,
  15285. UNKNOWN = 0,
  15286. }
  15287. /** !#en The enum of task type
  15288. !#zh 统计系统的任务类型 */
  15289. export enum TaskType {
  15290. GUIDE_LINE = 0,
  15291. MAIN_LINE = 0,
  15292. BRANCH_LINE = 0,
  15293. DAILY = 0,
  15294. ACTIVITY = 0,
  15295. OTHER = 0,
  15296. }
  15297. /** !#en The callback of share system
  15298. !#zh 分享系统回调 */
  15299. export enum ShareResultCode {
  15300. kShareSuccess = 0,
  15301. kShareFail = 0,
  15302. kShareCancel = 0,
  15303. kShareNetworkError = 0,
  15304. kShareExtension = 0,
  15305. }
  15306. /** !#en The callback of social system
  15307. !#zh 社交系统回调 */
  15308. export enum SocialRetCode {
  15309. kScoreSubmitSucceed = 0,
  15310. kScoreSubmitfail = 0,
  15311. kAchUnlockSucceed = 0,
  15312. kAchUnlockFail = 0,
  15313. kSocialSignInSucceed = 0,
  15314. kSocialSignInFail = 0,
  15315. kSocialSignOutSucceed = 0,
  15316. kSocialSignOutFail = 0,
  15317. kSocialGetGameFriends = 0,
  15318. kSocialExtensionCode = 0,
  15319. kSocialGetFriendsInfoSuccess = 0,
  15320. kSocialGetFriendsInfoFail = 0,
  15321. kSocialAlreadySubscription = 0,
  15322. kSocialNoSubscription = 0,
  15323. kSocialSubscriptionFail = 0,
  15324. }
  15325. /** !#en The callback of ads system
  15326. !#zh 广告系统回调 */
  15327. export enum AdsResultCode {
  15328. kAdsReceived = 0,
  15329. kAdsShown = 0,
  15330. kAdsDismissed = 0,
  15331. kPointsSpendSucceed = 0,
  15332. kPointsSpendFailed = 0,
  15333. kNetworkError = 0,
  15334. kUnknownError = 0,
  15335. kOfferWallOnPointsChanged = 0,
  15336. kRewardedVideoWithReward = 0,
  15337. kInAppPurchaseFinished = 0,
  15338. kAdsClicked = 0,
  15339. kAdsExtension = 0,
  15340. }
  15341. /** !#en The enum of ads position
  15342. !#zh 广告位置 */
  15343. export enum AdsPos {
  15344. kPosCenter = 0,
  15345. kPosTop = 0,
  15346. kPosTopLeft = 0,
  15347. kPosTopRight = 0,
  15348. kPosBottom = 0,
  15349. kPosBottomLeft = 0,
  15350. kPosBottomRight = 0,
  15351. }
  15352. /** !#en The enum of ads type
  15353. !#zh 广告类型 */
  15354. export enum AdsType {
  15355. AD_TYPE_BANNER = 0,
  15356. AD_TYPE_FULLSCREEN = 0,
  15357. AD_TYPE_MOREAPP = 0,
  15358. AD_TYPE_OFFERWALL = 0,
  15359. AD_TYPE_REWARDEDVIDEO = 0,
  15360. AD_TYPE_NATIVEEXPRESS = 0,
  15361. AD_TYPE_NATIVEADVANCED = 0,
  15362. }
  15363. /** !#en The callback of push system
  15364. !#zh 推送系统回调 */
  15365. export enum PushActionResultCode {
  15366. kPushReceiveMessage = 0,
  15367. kPushExtensionCode = 0,
  15368. }
  15369. /** !#en The callback of custom system
  15370. !#zh 自定义系统回调 */
  15371. export enum CustomResultCode {
  15372. kCustomExtension = 0,
  15373. }
  15374. /** !#en The callback of REC system
  15375. !#zh 录屏系统回调 */
  15376. export enum RECResultCode {
  15377. kRECInitSuccess = 0,
  15378. kRECInitFail = 0,
  15379. kRECStartRecording = 0,
  15380. kRECStopRecording = 0,
  15381. kRECPauseRecording = 0,
  15382. kRECResumeRecording = 0,
  15383. kRECEnterSDKPage = 0,
  15384. kRECQuitSDKPage = 0,
  15385. kRECShareSuccess = 0,
  15386. kRECShareFail = 0,
  15387. kRECExtension = 0,
  15388. }
  15389. }
  15390. /** !#en
  15391. The global main namespace of DragonBones, all classes, functions,
  15392. properties and constants of DragonBones are defined in this namespace
  15393. !#zh
  15394. DragonBones 的全局的命名空间,
  15395. 与 DragonBones 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  15396. declare module dragonBones {
  15397. /** !#en
  15398. The Armature Display of DragonBones <br/>
  15399. <br/>
  15400. (Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  15401. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  15402. Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments.) <br/>
  15403. !#zh
  15404. DragonBones 骨骼动画 <br/>
  15405. <br/>
  15406. (Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  15407. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  15408. 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。)<br/> */
  15409. export class ArmatureDisplay extends cc.RenderComponent {
  15410. /** !#en
  15411. The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  15412. attachments, skins, etc) and animations but does not hold any state.<br/>
  15413. Multiple ArmatureDisplay can share the same DragonBones data.
  15414. !#zh
  15415. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  15416. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  15417. 多个 ArmatureDisplay 可以共用相同的骨骼数据。 */
  15418. dragonAsset: DragonBonesAsset;
  15419. /** !#en
  15420. The atlas asset for the DragonBones.
  15421. !#zh
  15422. 骨骼数据所需的 Atlas Texture 数据。 */
  15423. dragonAtlasAsset: DragonBonesAtlasAsset;
  15424. /** !#en The name of current armature.
  15425. !#zh 当前的 Armature 名称。 */
  15426. armatureName: string;
  15427. /** !#en The name of current playing animation.
  15428. !#zh 当前播放的动画名称。 */
  15429. animationName: string;
  15430. _defaultArmatureIndex: number;
  15431. /** !#en The time scale of this armature.
  15432. !#zh 当前骨骼中所有动画的时间缩放率。 */
  15433. timeScale: number;
  15434. /** !#en The play times of the default animation.
  15435. -1 means using the value of config file;
  15436. 0 means repeat for ever
  15437. >0 means repeat times
  15438. !#zh 播放默认动画的循环次数
  15439. -1 表示使用配置文件中的默认值;
  15440. 0 表示无限循环
  15441. >0 表示循环次数 */
  15442. playTimes: number;
  15443. /** !#en Indicates whether open debug bones.
  15444. !#zh 是否显示 bone 的 debug 信息。 */
  15445. debugBones: boolean;
  15446. /**
  15447. !#en
  15448. Play the specified animation.
  15449. Parameter animName specify the animation name.
  15450. Parameter playTimes specify the repeat times of the animation.
  15451. -1 means use the value of the config file.
  15452. 0 means play the animation for ever.
  15453. >0 means repeat times.
  15454. !#zh
  15455. 播放指定的动画.
  15456. animName 指定播放动画的名称。
  15457. playTimes 指定播放动画的次数。
  15458. -1 为使用配置文件中的次数。
  15459. 0 为无限循环播放。
  15460. >0 为动画的重复次数。
  15461. @param animName animName
  15462. @param playTimes playTimes
  15463. */
  15464. playAnimation(animName: string, playTimes: number): dragonBones.AnimationState;
  15465. /**
  15466. !#en
  15467. Get the all armature names in the DragonBones Data.
  15468. !#zh
  15469. 获取 DragonBones 数据中所有的 armature 名称
  15470. */
  15471. getArmatureNames(): any[];
  15472. /**
  15473. !#en
  15474. Get the all animation names of specified armature.
  15475. !#zh
  15476. 获取指定的 armature 的所有动画名称。
  15477. @param armatureName armatureName
  15478. */
  15479. getAnimationNames(armatureName: string): any[];
  15480. /**
  15481. !#en
  15482. Add event listener for the DragonBones Event.
  15483. !#zh
  15484. 添加 DragonBones 事件监听器。
  15485. @param type A string representing the event type to listen for.
  15486. @param listener The callback that will be invoked when the event is dispatched.
  15487. @param target The target (this object) to invoke the callback, can be null
  15488. */
  15489. addEventListener(type: string, listener: (event: cc.Event) => void, target?: any): void;
  15490. /**
  15491. !#en
  15492. Remove the event listener for the DragonBones Event.
  15493. !#zh
  15494. 移除 DragonBones 事件监听器。
  15495. @param type A string representing the event type to listen for.
  15496. @param listener listener
  15497. @param target target
  15498. */
  15499. removeEventListener(type: string, listener?: Function, target?: any): void;
  15500. /**
  15501. !#en
  15502. Build the armature for specified name.
  15503. !#zh
  15504. 构建指定名称的 armature 对象
  15505. @param armatureName armatureName
  15506. @param node node
  15507. */
  15508. buildArmature(armatureName: string, node: cc.Node): dragonBones.ArmatureDisplay;
  15509. /**
  15510. !#en
  15511. Get the current armature object of the ArmatureDisplay.
  15512. !#zh
  15513. 获取 ArmatureDisplay 当前使用的 Armature 对象
  15514. */
  15515. armature(): any;
  15516. }
  15517. /** undefined */
  15518. export class CCFactory extends BaseFactory {
  15519. /**
  15520. @example
  15521. ```js
  15522. let factory = dragonBones.CCFactory.getInstance();
  15523. ```
  15524. */
  15525. static getInstance(): CCFactory;
  15526. }
  15527. /** !#en The skeleton data of dragonBones.
  15528. !#zh dragonBones 的 骨骼数据。 */
  15529. export class DragonBonesAsset extends cc.Asset {
  15530. /** !#en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  15531. !#zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html */
  15532. dragonBonesJson: string;
  15533. }
  15534. /** !#en The skeleton atlas data of dragonBones.
  15535. !#zh dragonBones 的骨骼纹理数据。 */
  15536. export class DragonBonesAtlasAsset extends cc.Asset {
  15537. atlasJson: string;
  15538. texture: cc.Texture2D;
  15539. }
  15540. }
  15541. /** !#en
  15542. The global main namespace of Spine, all classes, functions,
  15543. properties and constants of Spine are defined in this namespace
  15544. !#zh
  15545. Spine 的全局的命名空间,
  15546. 与 Spine 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  15547. declare module sp {
  15548. /** !#en
  15549. The skeleton of Spine <br/>
  15550. <br/>
  15551. (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  15552. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  15553. Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  15554. !#zh
  15555. Spine 骨骼动画 <br/>
  15556. <br/>
  15557. (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  15558. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  15559. 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。 */
  15560. export class Skeleton extends cc.RenderComponent {
  15561. /** !#en The skeletal animation is paused?
  15562. !#zh 该骨骼动画是否暂停。 */
  15563. paused: boolean;
  15564. /** !#en
  15565. The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  15566. attachments, skins, etc) and animations but does not hold any state.<br/>
  15567. Multiple skeletons can share the same skeleton data.
  15568. !#zh
  15569. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  15570. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  15571. 多个 Skeleton 可以共用相同的骨骼数据。 */
  15572. skeletonData: SkeletonData;
  15573. /** !#en The name of default skin.
  15574. !#zh 默认的皮肤名称。 */
  15575. defaultSkin: string;
  15576. /** !#en The name of default animation.
  15577. !#zh 默认的动画名称。 */
  15578. defaultAnimation: string;
  15579. /** !#en The name of current playing animation.
  15580. !#zh 当前播放的动画名称。 */
  15581. animation: string;
  15582. _defaultSkinIndex: number;
  15583. /** !#en TODO
  15584. !#zh 是否循环播放当前骨骼动画。 */
  15585. loop: boolean;
  15586. /** !#en Indicates whether to enable premultiplied alpha.
  15587. You should disable this option when image's transparent area appears to have opaque pixels,
  15588. or enable this option when image's half transparent area appears to be darken.
  15589. !#zh 是否启用贴图预乘。
  15590. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  15591. premultipliedAlpha: boolean;
  15592. /** !#en The time scale of this skeleton.
  15593. !#zh 当前骨骼中所有动画的时间缩放率。 */
  15594. timeScale: number;
  15595. /** !#en Indicates whether open debug slots.
  15596. !#zh 是否显示 slot 的 debug 信息。 */
  15597. debugSlots: boolean;
  15598. /** !#en Indicates whether open debug bones.
  15599. !#zh 是否显示 bone 的 debug 信息。 */
  15600. debugBones: boolean;
  15601. /**
  15602. !#en
  15603. Sets runtime skeleton data to sp.Skeleton.<br>
  15604. 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.
  15605. !#zh
  15606. 设置底层运行时用到的 SkeletonData。<br>
  15607. 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  15608. @param skeletonData skeletonData
  15609. */
  15610. setSkeletonData(skeletonData: sp.spine.SkeletonData): void;
  15611. /**
  15612. !#en Sets animation state data.<br>
  15613. The parameter type is {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData.
  15614. !#zh 设置动画状态数据。<br>
  15615. 参数是 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData。
  15616. @param stateData stateData
  15617. */
  15618. setAnimationStateData(stateData: sp.spine.AnimationStateData): void;
  15619. /**
  15620. !#en Computes the world SRT from the local SRT for each bone.
  15621. !#zh 重新更新所有骨骼的世界 Transform,
  15622. 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  15623. @example
  15624. ```js
  15625. var bone = spine.findBone('head');
  15626. cc.log(bone.worldX); // return 0;
  15627. spine.updateWorldTransform();
  15628. bone = spine.findBone('head');
  15629. cc.log(bone.worldX); // return -23.12;
  15630. ```
  15631. */
  15632. updateWorldTransform(): void;
  15633. /**
  15634. !#en Sets the bones and slots to the setup pose.
  15635. !#zh 还原到起始动作
  15636. */
  15637. setToSetupPose(): void;
  15638. /**
  15639. !#en
  15640. Sets the bones to the setup pose,
  15641. using the values from the `BoneData` list in the `SkeletonData`.
  15642. !#zh
  15643. 设置 bone 到起始动作
  15644. 使用 SkeletonData 中的 BoneData 列表中的值。
  15645. */
  15646. setBonesToSetupPose(): void;
  15647. /**
  15648. !#en
  15649. Sets the slots to the setup pose,
  15650. using the values from the `SlotData` list in the `SkeletonData`.
  15651. !#zh
  15652. 设置 slot 到起始动作。
  15653. 使用 SkeletonData 中的 SlotData 列表中的值。
  15654. */
  15655. setSlotsToSetupPose(): void;
  15656. /**
  15657. !#en
  15658. Finds a bone by name.
  15659. This does a string comparison for every bone.<br>
  15660. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  15661. !#zh
  15662. 通过名称查找 bone。
  15663. 这里对每个 bone 的名称进行了对比。<br>
  15664. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  15665. @param boneName boneName
  15666. */
  15667. findBone(boneName: string): sp.spine.Bone;
  15668. /**
  15669. !#en
  15670. Finds a slot by name. This does a string comparison for every slot.<br>
  15671. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  15672. !#zh
  15673. 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  15674. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  15675. @param slotName slotName
  15676. */
  15677. findSlot(slotName: string): sp.spine.Slot;
  15678. /**
  15679. !#en
  15680. Finds a skin by name and makes it the active skin.
  15681. This does a string comparison for every skin.<br>
  15682. Note that setting the skin does not change which attachments are visible.<br>
  15683. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  15684. !#zh
  15685. 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  15686. 注意:设置皮肤不会改变 attachment 的可见性。<br>
  15687. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  15688. @param skinName skinName
  15689. */
  15690. setSkin(skinName: string): sp.spine.Skin;
  15691. /**
  15692. !#en
  15693. Returns the attachment for the slot and attachment name.
  15694. The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  15695. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  15696. !#zh
  15697. 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  15698. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  15699. @param slotName slotName
  15700. @param attachmentName attachmentName
  15701. */
  15702. getAttachment(slotName: string, attachmentName: string): sp.spine.Attachment;
  15703. /**
  15704. !#en
  15705. Sets the attachment for the slot and attachment name.
  15706. The skeleton looks first in its skin, then in the skeleton data’s default skin.
  15707. !#zh
  15708. 通过 slot 和 attachment 的名字来设置 attachment。
  15709. Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  15710. @param slotName slotName
  15711. @param attachmentName attachmentName
  15712. */
  15713. setAttachment(slotName: string, attachmentName: string): void;
  15714. /**
  15715. Return the renderer of attachment.
  15716. @param regionAttachment regionAttachment
  15717. */
  15718. getTextureAtlas(regionAttachment: sp.spine.RegionAttachment|spine.BoundingBoxAttachment): sp.spine.TextureAtlasRegion;
  15719. /**
  15720. !#en
  15721. Mix applies all keyframe values,
  15722. interpolated for the specified time and mixed with the current values.
  15723. !#zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  15724. @param fromAnimation fromAnimation
  15725. @param toAnimation toAnimation
  15726. @param duration duration
  15727. */
  15728. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  15729. /**
  15730. !#en Set the current animation. Any queued animations are cleared.<br>
  15731. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15732. !#zh 设置当前动画。队列中的任何的动画将被清除。<br>
  15733. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15734. @param trackIndex trackIndex
  15735. @param name name
  15736. @param loop loop
  15737. */
  15738. setAnimation(trackIndex: number, name: string, loop: boolean): sp.spine.TrackEntry;
  15739. /**
  15740. !#en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  15741. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15742. !#zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  15743. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15744. @param trackIndex trackIndex
  15745. @param name name
  15746. @param loop loop
  15747. @param delay delay
  15748. */
  15749. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): sp.spine.TrackEntry;
  15750. /**
  15751. !#en Find animation with specified name.
  15752. !#zh 查找指定名称的动画
  15753. @param name name
  15754. */
  15755. findAnimation(name: string): sp.spine.Animation;
  15756. /**
  15757. !#en Returns track entry by trackIndex.<br>
  15758. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  15759. !#zh 通过 track 索引获取 TrackEntry。<br>
  15760. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  15761. @param trackIndex trackIndex
  15762. */
  15763. getCurrent(trackIndex: void): sp.spine.TrackEntry;
  15764. /**
  15765. !#en Clears all tracks of animation state.
  15766. !#zh 清除所有 track 的动画状态。
  15767. */
  15768. clearTracks(): void;
  15769. /**
  15770. !#en Clears track of animation state by trackIndex.
  15771. !#zh 清除出指定 track 的动画状态。
  15772. @param trackIndex trackIndex
  15773. */
  15774. clearTrack(trackIndex: number): void;
  15775. /**
  15776. !#en Set the start event listener.
  15777. !#zh 用来设置开始播放动画的事件监听。
  15778. @param listener listener
  15779. */
  15780. setStartListener(listener: Function): void;
  15781. /**
  15782. !#en Set the interrupt event listener.
  15783. !#zh 用来设置动画被打断的事件监听。
  15784. @param listener listener
  15785. */
  15786. setInterruptListener(listener: Function): void;
  15787. /**
  15788. !#en Set the end event listener.
  15789. !#zh 用来设置动画播放完后的事件监听。
  15790. @param listener listener
  15791. */
  15792. setEndListener(listener: Function): void;
  15793. /**
  15794. !#en Set the dispose event listener.
  15795. !#zh 用来设置动画将被销毁的事件监听。
  15796. @param listener listener
  15797. */
  15798. setDisposeListener(listener: Function): void;
  15799. /**
  15800. !#en Set the complete event listener.
  15801. !#zh 用来设置动画播放一次循环结束后的事件监听。
  15802. @param listener listener
  15803. */
  15804. setCompleteListener(listener: Function): void;
  15805. /**
  15806. !#en Set the animation event listener.
  15807. !#zh 用来设置动画播放过程中帧事件的监听。
  15808. @param listener listener
  15809. */
  15810. setEventListener(listener: Function): void;
  15811. /**
  15812. !#en Set the start event listener for specified TrackEntry.
  15813. !#zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  15814. @param entry entry
  15815. @param listener listener
  15816. */
  15817. setTrackStartListener(entry: sp.spine.TrackEntry, listener: Function): void;
  15818. /**
  15819. !#en Set the interrupt event listener for specified TrackEntry.
  15820. !#zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  15821. @param entry entry
  15822. @param listener listener
  15823. */
  15824. setTrackInterruptListener(entry: sp.spine.TrackEntry, listener: Function): void;
  15825. /**
  15826. !#en Set the end event listener for specified TrackEntry.
  15827. !#zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  15828. @param entry entry
  15829. @param listener listener
  15830. */
  15831. setTrackEndListener(entry: sp.spine.TrackEntry, listener: Function): void;
  15832. /**
  15833. !#en Set the dispose event listener for specified TrackEntry.
  15834. !#zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  15835. @param entry entry
  15836. @param listener listener
  15837. */
  15838. setTrackDisposeListener(entry: sp.spine.TrackEntry, listener: Function): void;
  15839. /**
  15840. !#en Set the complete event listener for specified TrackEntry.
  15841. !#zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  15842. @param entry entry
  15843. @param listener listener
  15844. */
  15845. setTrackCompleteListener(entry: sp.spine.TrackEntry, listener: (entry: sp.spine.TrackEntry, loopCount: number) => void): void;
  15846. /**
  15847. !#en Set the event listener for specified TrackEntry.
  15848. !#zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  15849. @param entry entry
  15850. @param listener listener
  15851. */
  15852. setTrackEventListener(entry: sp.spine.TrackEntry, listener: Function): void;
  15853. /**
  15854. !#en Get the animation state object
  15855. !#zh 获取
  15856. */
  15857. setTrackEventListener(): sp.spine.AnimationState;
  15858. }
  15859. /** !#en The event type of spine skeleton animation.
  15860. !#zh 骨骼动画事件类型。 */
  15861. export enum AnimationEventType {
  15862. START = 0,
  15863. END = 0,
  15864. COMPLETE = 0,
  15865. EVENT = 0,
  15866. }
  15867. /** !#en The skeleton data of spine.
  15868. !#zh Spine 的 骨骼数据。 */
  15869. export class SkeletonData extends cc.Asset {
  15870. /** !#en See http://en.esotericsoftware.com/spine-json-format
  15871. !#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */
  15872. skeletonJson: any;
  15873. atlasText: string;
  15874. textures: cc.Texture2D[];
  15875. /** !#en
  15876. A scale can be specified on the JSON or binary loader which will scale the bone positions,
  15877. image sizes, and animation translations.
  15878. This can be useful when using different sized images than were used when designing the skeleton
  15879. in Spine. For example, if using images that are half the size than were used in Spine,
  15880. a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  15881. resolution texture atlases.
  15882. see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  15883. !#zh 可查看 Spine 官方文档: http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */
  15884. scale: number;
  15885. /**
  15886. !#en Get the included SkeletonData used in spine runtime.<br>
  15887. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData object.
  15888. !#zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  15889. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData 对象。
  15890. @param quiet quiet
  15891. */
  15892. getRuntimeData(quiet?: boolean): sp.spine.SkeletonData;
  15893. }
  15894. }
  15895. /** !#en
  15896. `sp.spine` is the namespace for official Spine Runtime, which officially implemented and maintained by Spine.<br>
  15897. Please refer to the official documentation for its detailed usage: [http://en.esotericsoftware.com/spine-using-runtimes](http://en.esotericsoftware.com/spine-using-runtimes)
  15898. !#zh
  15899. sp.spine 模块是 Spine 官方运行库的 API 入口,由 Spine 官方统一实现和维护,具体用法请参考:[http://zh.esotericsoftware.com/spine-using-runtimes](http://zh.esotericsoftware.com/spine-using-runtimes) */
  15900. declare module sp.spine {
  15901. }
  15902. /** !#en Some JavaScript decorators which can be accessed with "cc._decorator".
  15903. !#zh 一些 JavaScript 装饰器,目前可以通过 "cc._decorator" 来访问。
  15904. (这些 API 仍不完全稳定,有可能随着 JavaScript 装饰器的标准实现而调整) */
  15905. declare module cc._decorator {
  15906. /**
  15907. !#en
  15908. Declare the standard [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
  15909. as CCClass, please see [Class](../../../manual/en/scripting/class.html) for details.
  15910. !#zh
  15911. 将标准写法的 [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 声明为 CCClass,具体用法请参阅[类型定义](../../../manual/zh/scripting/class.html)。
  15912. @param name The class name used for serialization.
  15913. @example
  15914. ```js
  15915. const {ccclass} = cc._decorator;
  15916. // define a CCClass, omit the name
  15917. &#64;ccclass
  15918. class NewScript extends cc.Component {
  15919. // ...
  15920. }
  15921. // define a CCClass with a name
  15922. &#64;ccclass('LoginData')
  15923. class LoginData {
  15924. // ...
  15925. }
  15926. ```
  15927. */
  15928. export function ccclass(name?: string): Function;
  15929. export function ccclass(_class?: Function): void;
  15930. /**
  15931. !#en
  15932. Declare property for [CCClass](../../../manual/en/scripting/reference/attributes.html).
  15933. !#zh
  15934. 定义 [CCClass](../../../manual/zh/scripting/reference/attributes.html) 所用的属性。
  15935. @param options an object with some property attributes
  15936. @example
  15937. ```js
  15938. const {ccclass, property} = cc._decorator;
  15939. &#64;ccclass
  15940. class NewScript extends cc.Component {
  15941. &#64;property({
  15942. type: cc.Node
  15943. })
  15944. targetNode1 = null;
  15945. &#64;property(cc.Node)
  15946. targetNode2 = null;
  15947. &#64;property(cc.Button)
  15948. targetButton = null;
  15949. &#64;property
  15950. _width = 100;
  15951. &#64;property
  15952. get width () {
  15953. return this._width;
  15954. }
  15955. &#64;property
  15956. set width (value) {
  15957. this._width = value;
  15958. }
  15959. &#64;property
  15960. offset = new cc.Vec2(100, 100);
  15961. &#64;property(cc.Vec2)
  15962. offsets = [];
  15963. &#64;property(cc.SpriteFrame)
  15964. frame = null;
  15965. }
  15966. // above is equivalent to (上面的代码相当于):
  15967. var NewScript = cc.Class({
  15968. properties: {
  15969. targetNode1: {
  15970. default: null,
  15971. type: cc.Node
  15972. },
  15973. targetNode2: {
  15974. default: null,
  15975. type: cc.Node
  15976. },
  15977. targetButton: {
  15978. default: null,
  15979. type: cc.Button
  15980. },
  15981. _width: 100,
  15982. width: {
  15983. get () {
  15984. return this._width;
  15985. },
  15986. set (value) {
  15987. this._width = value;
  15988. }
  15989. },
  15990. offset: new cc.Vec2(100, 100)
  15991. offsets: {
  15992. default: [],
  15993. type: cc.Vec2
  15994. }
  15995. frame: {
  15996. default: null,
  15997. type: cc.SpriteFrame
  15998. },
  15999. }
  16000. });
  16001. ```
  16002. */
  16003. 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;
  16004. export function property(_target: Object, _key: any, _desc?: any): void;
  16005. /**
  16006. !#en
  16007. Makes a CCClass that inherit from component execute in edit mode.<br>
  16008. By default, all components are only executed in play mode,
  16009. which means they will not have their callback functions executed while the Editor is in edit mode.
  16010. !#zh
  16011. 允许继承自 Component 的 CCClass 在编辑器里执行。<br>
  16012. 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  16013. @example
  16014. ```js
  16015. const {ccclass, executeInEditMode} = cc._decorator;
  16016. &#64;ccclass
  16017. &#64;executeInEditMode
  16018. class NewScript extends cc.Component {
  16019. // ...
  16020. }
  16021. ```
  16022. */
  16023. export function executeInEditMode(): Function;
  16024. export function executeInEditMode(_class: Function): void;
  16025. /**
  16026. !#en
  16027. Automatically add required component as a dependency for the CCClass that inherit from component.
  16028. !#zh
  16029. 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  16030. @param requiredComponent requiredComponent
  16031. @example
  16032. ```js
  16033. const {ccclass, requireComponent} = cc._decorator;
  16034. &#64;ccclass
  16035. &#64;requireComponent(cc.Sprite)
  16036. class SpriteCtrl extends cc.Component {
  16037. // ...
  16038. }
  16039. ```
  16040. */
  16041. export function requireComponent(requiredComponent: typeof cc.Component): Function;
  16042. /**
  16043. !#en
  16044. The menu path to register a component to the editors "Component" menu. Eg. "Rendering/CameraCtrl".
  16045. !#zh
  16046. 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  16047. @param path The path is the menu represented like a pathname.
  16048. For example the menu could be "Rendering/CameraCtrl".
  16049. @example
  16050. ```js
  16051. const {ccclass, menu} = cc._decorator;
  16052. &#64;ccclass
  16053. &#64;menu("Rendering/CameraCtrl")
  16054. class NewScript extends cc.Component {
  16055. // ...
  16056. }
  16057. ```
  16058. */
  16059. export function menu(path: string): Function;
  16060. /**
  16061. !#en
  16062. The execution order of lifecycle methods for Component.
  16063. Those less than 0 will execute before while those greater than 0 will execute after.
  16064. The order will only affect onLoad, onEnable, start, update and lateUpdate while onDisable and onDestroy will not be affected.
  16065. !#zh
  16066. 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  16067. @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.
  16068. @example
  16069. ```js
  16070. const {ccclass, executionOrder} = cc._decorator;
  16071. &#64;ccclass
  16072. &#64;executionOrder(1)
  16073. class CameraCtrl extends cc.Component {
  16074. // ...
  16075. }
  16076. ```
  16077. */
  16078. export function executionOrder(order: number): Function;
  16079. /**
  16080. !#en
  16081. Prevents Component of the same type (or subtype) to be added more than once to a Node.
  16082. !#zh
  16083. 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  16084. @example
  16085. ```js
  16086. const {ccclass, disallowMultiple} = cc._decorator;
  16087. &#64;ccclass
  16088. &#64;disallowMultiple
  16089. class CameraCtrl extends cc.Component {
  16090. // ...
  16091. }
  16092. ```
  16093. */
  16094. export function disallowMultiple(): Function;
  16095. export function disallowMultiple(_class: Function): void;
  16096. /**
  16097. !#en
  16098. 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>
  16099. This property is only available if executeInEditMode is true.
  16100. !#zh
  16101. 当指定了 "executeInEditMode" 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  16102. @example
  16103. ```js
  16104. const {ccclass, playOnFocus, executeInEditMode} = cc._decorator;
  16105. &#64;ccclass
  16106. &#64;executeInEditMode
  16107. &#64;playOnFocus
  16108. class CameraCtrl extends cc.Component {
  16109. // ...
  16110. }
  16111. ```
  16112. */
  16113. export function playOnFocus(): Function;
  16114. export function playOnFocus(_class: Function): void;
  16115. /**
  16116. !#en
  16117. Specifying the url of the custom html to draw the component in **Properties**.
  16118. !#zh
  16119. 自定义当前组件在 **属性检查器** 中渲染时所用的网页 url。
  16120. @param url url
  16121. @example
  16122. ```js
  16123. const {ccclass, inspector} = cc._decorator;
  16124. &#64;ccclass
  16125. &#64;inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  16126. class NewScript extends cc.Component {
  16127. // ...
  16128. }
  16129. ```
  16130. */
  16131. export function inspector(path: string): Function;
  16132. /**
  16133. !#en
  16134. The custom documentation URL.
  16135. !#zh
  16136. 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  16137. @param url url
  16138. @example
  16139. ```js
  16140. const {ccclass, help} = cc._decorator;
  16141. &#64;ccclass
  16142. &#64;help("app://docs/html/components/spine.html")
  16143. class NewScript extends cc.Component {
  16144. // ...
  16145. }
  16146. ```
  16147. */
  16148. export function help(path: string): Function;
  16149. /**
  16150. NOTE:<br>
  16151. The old mixins implemented in cc.Class(ES5) behaves exact the same as multiple inheritance.
  16152. But since ES6, class constructor can't be function-called and class methods become non-enumerable,
  16153. so we can not mix in ES6 Classes.<br>
  16154. See:<br>
  16155. [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>
  16156. One possible solution (but IDE unfriendly):<br>
  16157. [http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/)<br>
  16158. <br>
  16159. NOTE:<br>
  16160. You must manually call mixins constructor, this is different from cc.Class(ES5).
  16161. @param ctor constructors to mix, only support ES5 constructors or classes defined by using `cc.Class`,
  16162. not support ES6 Classes.
  16163. @example
  16164. ```js
  16165. const {ccclass, mixins} = cc._decorator;
  16166. class Animal { ... }
  16167. const Fly = cc.Class({
  16168. constructor () { ... }
  16169. });
  16170. &#64;ccclass
  16171. &#64;mixins(cc.EventTarget, Fly)
  16172. class Bird extends Animal {
  16173. constructor () {
  16174. super();
  16175. // You must manually call mixins constructor, this is different from cc.Class(ES5)
  16176. cc.EventTarget.call(this);
  16177. Fly.call(this);
  16178. }
  16179. // ...
  16180. }
  16181. ```
  16182. */
  16183. export function mixins(ctor: Function, ...rest: Function[]): Function;
  16184. }
  16185. /** This module provides some JavaScript utilities.
  16186. All members can be accessed with "cc.js". */
  16187. declare module cc.js {
  16188. /**
  16189. Check the obj whether is number or not
  16190. If a number is created by using 'new Number(10086)', the typeof it will be "object"...
  16191. Then you can use this function if you care about this case.
  16192. @param obj obj
  16193. */
  16194. export function isNumber(obj: any): boolean;
  16195. /**
  16196. Check the obj whether is string or not.
  16197. If a string is created by using 'new String("blabla")', the typeof it will be "object"...
  16198. Then you can use this function if you care about this case.
  16199. @param obj obj
  16200. */
  16201. export function isString(obj: any): boolean;
  16202. /**
  16203. Copy all properties not defined in obj from arguments[1...n]
  16204. @param obj object to extend its properties
  16205. @param sourceObj source object to copy properties from
  16206. */
  16207. export function addon(obj: any, ...sourceObj: any[]): any;
  16208. /**
  16209. copy all properties from arguments[1...n] to obj
  16210. @param obj obj
  16211. @param sourceObj sourceObj
  16212. */
  16213. export function mixin(obj: any, ...sourceObj: any[]): any;
  16214. /**
  16215. Derive the class from the supplied base class.
  16216. Both classes are just native javascript constructors, not created by cc.Class, so
  16217. usually you will want to inherit using {{#crossLink "cc/Class:method"}}cc.Class {{/crossLink}} instead.
  16218. @param cls cls
  16219. @param base the baseclass to inherit
  16220. */
  16221. export function extend(cls: Function, base: Function): Function;
  16222. /**
  16223. Get super class
  16224. @param ctor the constructor of subclass
  16225. */
  16226. export function getSuper(ctor: Function): Function;
  16227. /**
  16228. Checks whether subclass is child of superclass or equals to superclass
  16229. @param subclass subclass
  16230. @param superclass superclass
  16231. */
  16232. export function isChildClassOf(subclass: Function, superclass: Function): boolean;
  16233. /**
  16234. Removes all enumerable properties from object
  16235. @param obj obj
  16236. */
  16237. export function clear(obj: any): void;
  16238. /**
  16239. Get property descriptor in object and all its ancestors
  16240. @param obj obj
  16241. @param name name
  16242. */
  16243. export function getPropertyDescriptor(obj: any, name: string): any;
  16244. /**
  16245. Define value, just help to call Object.defineProperty.<br>
  16246. The configurable will be true.
  16247. @param obj obj
  16248. @param prop prop
  16249. @param value value
  16250. @param writable writable
  16251. @param enumerable enumerable
  16252. */
  16253. export function value(obj: any, prop: string, value: any, writable?: boolean, enumerable?: boolean): void;
  16254. /**
  16255. Define get set accessor, just help to call Object.defineProperty(...)
  16256. @param obj obj
  16257. @param prop prop
  16258. @param getter getter
  16259. @param setter setter
  16260. @param enumerable enumerable
  16261. @param configurable configurable
  16262. */
  16263. export function getset(obj: any, prop: string, getter: Function, setter?: Function, enumerable?: boolean, configurable?: boolean): void;
  16264. /**
  16265. Define get accessor, just help to call Object.defineProperty(...)
  16266. @param obj obj
  16267. @param prop prop
  16268. @param getter getter
  16269. @param enumerable enumerable
  16270. @param configurable configurable
  16271. */
  16272. export function get(obj: any, prop: string, getter: Function, enumerable?: boolean, configurable?: boolean): void;
  16273. /**
  16274. Define set accessor, just help to call Object.defineProperty(...)
  16275. @param obj obj
  16276. @param prop prop
  16277. @param setter setter
  16278. @param enumerable enumerable
  16279. @param configurable configurable
  16280. */
  16281. export function set(obj: any, prop: string, setter: Function, enumerable?: boolean, configurable?: boolean): void;
  16282. /**
  16283. Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  16284. (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code from this stackoverflow post</a>)
  16285. @param objOrCtor instance or constructor
  16286. */
  16287. export function getClassName(objOrCtor: any|Function): string;
  16288. /** !#en All classes registered in the engine, indexed by ID.
  16289. !#zh 引擎中已注册的所有类型,通过 ID 进行索引。 */
  16290. export var _registeredClassIds: void;
  16291. /** !#en All classes registered in the engine, indexed by name.
  16292. !#zh 引擎中已注册的所有类型,通过名称进行索引。 */
  16293. export var _registeredClassNames: void;
  16294. /**
  16295. Register the class by specified name manually
  16296. @param className className
  16297. @param constructor constructor
  16298. */
  16299. export function setClassName(className: string, constructor: Function): void;
  16300. /**
  16301. Unregister a class from fireball.
  16302. If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
  16303. Please note that its still your responsibility to free other references to the class.
  16304. @param constructor the class you will want to unregister, any number of classes can be added
  16305. */
  16306. export function unregisterClass(...constructor: Function[]): void;
  16307. /**
  16308. Get the registered class by name
  16309. @param classname classname
  16310. */
  16311. export function getClassByName(classname: string): Function;
  16312. /**
  16313. Defines a polyfill field for obsoleted codes.
  16314. @param obj YourObject or YourClass.prototype
  16315. @param obsoleted "OldParam" or "YourClass.OldParam"
  16316. @param newExpr "NewParam" or "YourClass.NewParam"
  16317. @param writable writable
  16318. */
  16319. export function obsolete(obj: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  16320. /**
  16321. Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
  16322. @param obj YourObject or YourClass.prototype
  16323. @param objName "YourObject" or "YourClass"
  16324. @param props props
  16325. @param writable writable
  16326. */
  16327. export function obsoletes(obj: any, objName: any, props: any, writable?: boolean): void;
  16328. /**
  16329. A string tool to construct a string with format string.
  16330. @param msg A JavaScript string containing zero or more substitution strings (%s).
  16331. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  16332. @example
  16333. ```js
  16334. cc.js.formatStr("a: %s, b: %s", a, b);
  16335. cc.js.formatStr(a, b, c);
  16336. ```
  16337. */
  16338. export function formatStr(msg: string|any, ...subst: any[]): string;
  16339. /**
  16340. !#en
  16341. 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.
  16342. !#zh
  16343. 该方法是对 `Object.create(null)` 的简单封装。`Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断。在需要频繁判断 `hasOwnProperty` 时,使用这个方法性能会比 `{}` 更高。
  16344. @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.
  16345. */
  16346. export function createMap(forceDictMode?: boolean): any;
  16347. /** undefined */
  16348. export class array {
  16349. /**
  16350. Removes the array item at the specified index.
  16351. @param array array
  16352. @param index index
  16353. */
  16354. static removeAt(array: any[], index: number): void;
  16355. /**
  16356. Removes the array item at the specified index.
  16357. It's faster but the order of the array will be changed.
  16358. @param array array
  16359. @param index index
  16360. */
  16361. static fastRemoveAt(array: any[], index: number): void;
  16362. /**
  16363. Removes the first occurrence of a specific object from the array.
  16364. @param array array
  16365. @param value value
  16366. */
  16367. static remove(array: any[], value: any): boolean;
  16368. /**
  16369. Removes the first occurrence of a specific object from the array.
  16370. It's faster but the order of the array will be changed.
  16371. @param array array
  16372. @param value value
  16373. */
  16374. static fastRemove(array: any[], value: number): void;
  16375. /**
  16376. Verify array's Type
  16377. @param array array
  16378. @param type type
  16379. */
  16380. static verifyType(array: any[], type: Function): boolean;
  16381. /**
  16382. Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.
  16383. @param array Source Array
  16384. @param minusArr minus Array
  16385. */
  16386. static removeArray(array: any[], minusArr: any[]): void;
  16387. /**
  16388. Inserts some objects at index
  16389. @param array array
  16390. @param addObjs addObjs
  16391. @param index index
  16392. */
  16393. static appendObjectsAt(array: any[], addObjs: any[], index: number): any[];
  16394. /**
  16395. Exact same function as Array.prototype.indexOf.<br>
  16396. 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>
  16397. 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!
  16398. @param searchElement Element to locate in the array.
  16399. @param fromIndex The index to start the search at
  16400. */
  16401. static indexOf(searchElement: any, fromIndex?: number): number;
  16402. /**
  16403. Determines whether the array contains a specific value.
  16404. @param array array
  16405. @param value value
  16406. */
  16407. static contains(array: any[], value: any): boolean;
  16408. /**
  16409. Copy an array's item to a new array (its performance is better than Array.slice)
  16410. @param array array
  16411. */
  16412. static copy(array: any[]): any[];
  16413. }
  16414. /** !#en
  16415. A fixed-length object pool designed for general type.<br>
  16416. The implementation of this object pool is very simple,
  16417. it can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  16418. !#zh
  16419. 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  16420. 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。 */
  16421. export class Pool {
  16422. /**
  16423. !#en
  16424. Constructor for creating an object pool for the specific object type.
  16425. You can pass a callback argument for process the cleanup logic when the object is recycled.
  16426. !#zh
  16427. 使用构造函数来创建一个指定对象类型的对象池,您可以传递一个回调函数,用于处理对象回收时的清理逻辑。
  16428. @param cleanupFunc the callback method used to process the cleanup logic when the object is recycled.
  16429. @param size initializes the length of the array
  16430. */
  16431. constructor(cleanupFunc: (obj: any) => void, size: number);
  16432. constructor(size: number);
  16433. /**
  16434. !#en
  16435. Get and initialize an object from pool. This method defaults to null and requires the user to implement it.
  16436. !#zh
  16437. 获取并初始化对象池中的对象。这个方法默认为空,需要用户自己实现。
  16438. @param params parameters to used to initialize the object
  16439. */
  16440. get(...params: any[]): any;
  16441. /** !#en
  16442. The current number of available objects, the default is 0, it will gradually increase with the recycle of the object,
  16443. the maximum will not exceed the size specified when the constructor is called.
  16444. !#zh
  16445. 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。 */
  16446. count: number;
  16447. /**
  16448. !#en
  16449. Get an object from pool, if no available object in the pool, null will be returned.
  16450. !#zh
  16451. 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  16452. */
  16453. _get(): any;
  16454. /**
  16455. !#en Put an object into the pool.
  16456. !#zh 向对象池返还一个不再需要的对象。
  16457. */
  16458. put(): void;
  16459. /**
  16460. !#en Resize the pool.
  16461. !#zh 设置对象池容量。
  16462. */
  16463. resize(): void;
  16464. }
  16465. }
  16466. declare namespace dragonBones {
  16467. /**
  16468. * @internal
  16469. * @private
  16470. */
  16471. const webAssemblyModule: {
  16472. HEAP16: Int16Array;
  16473. _malloc(byteSize: number): number;
  16474. _free(pointer: number): void;
  16475. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  16476. };
  16477. }
  16478. /**
  16479. * The MIT License (MIT)
  16480. *
  16481. * Copyright (c) 2012-2017 DragonBones team and other contributors
  16482. *
  16483. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  16484. * this software and associated documentation files (the "Software"), to deal in
  16485. * the Software without restriction, including without limitation the rights to
  16486. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  16487. * the Software, and to permit persons to whom the Software is furnished to do so,
  16488. * subject to the following conditions:
  16489. *
  16490. * The above copyright notice and this permission notice shall be included in all
  16491. * copies or substantial portions of the Software.
  16492. *
  16493. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16494. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16495. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16496. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16497. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16498. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16499. */
  16500. declare namespace dragonBones {
  16501. /**
  16502. * @internal
  16503. * @private
  16504. */
  16505. const enum BinaryOffset {
  16506. WeigthBoneCount = 0,
  16507. WeigthFloatOffset = 1,
  16508. WeigthBoneIndices = 2,
  16509. MeshVertexCount = 0,
  16510. MeshTriangleCount = 1,
  16511. MeshFloatOffset = 2,
  16512. MeshWeightOffset = 3,
  16513. MeshVertexIndices = 4,
  16514. TimelineScale = 0,
  16515. TimelineOffset = 1,
  16516. TimelineKeyFrameCount = 2,
  16517. TimelineFrameValueCount = 3,
  16518. TimelineFrameValueOffset = 4,
  16519. TimelineFrameOffset = 5,
  16520. FramePosition = 0,
  16521. FrameTweenType = 1,
  16522. FrameTweenEasingOrCurveSampleCount = 2,
  16523. FrameCurveSamples = 3,
  16524. DeformMeshOffset = 0,
  16525. DeformCount = 1,
  16526. DeformValueCount = 2,
  16527. DeformValueOffset = 3,
  16528. DeformFloatOffset = 4,
  16529. }
  16530. /**
  16531. * @internal
  16532. * @private
  16533. */
  16534. const enum ArmatureType {
  16535. Armature = 0,
  16536. MovieClip = 1,
  16537. Stage = 2,
  16538. }
  16539. /**
  16540. * @internal
  16541. * @private
  16542. */
  16543. const enum BoneType {
  16544. Bone = 0,
  16545. Surface = 1,
  16546. }
  16547. /**
  16548. * @private
  16549. */
  16550. const enum DisplayType {
  16551. Image = 0,
  16552. Armature = 1,
  16553. Mesh = 2,
  16554. BoundingBox = 3,
  16555. }
  16556. /**
  16557. * - Bounding box type.
  16558. * @version DragonBones 5.0
  16559. * @language en_US
  16560. */
  16561. /**
  16562. * - 边界框类型。
  16563. * @version DragonBones 5.0
  16564. * @language zh_CN
  16565. */
  16566. const enum BoundingBoxType {
  16567. Rectangle = 0,
  16568. Ellipse = 1,
  16569. Polygon = 2,
  16570. }
  16571. /**
  16572. * @internal
  16573. * @private
  16574. */
  16575. const enum ActionType {
  16576. Play = 0,
  16577. Frame = 10,
  16578. Sound = 11,
  16579. }
  16580. /**
  16581. * @internal
  16582. * @private
  16583. */
  16584. const enum BlendMode {
  16585. Normal = 0,
  16586. Add = 1,
  16587. Alpha = 2,
  16588. Darken = 3,
  16589. Difference = 4,
  16590. Erase = 5,
  16591. HardLight = 6,
  16592. Invert = 7,
  16593. Layer = 8,
  16594. Lighten = 9,
  16595. Multiply = 10,
  16596. Overlay = 11,
  16597. Screen = 12,
  16598. Subtract = 13,
  16599. }
  16600. /**
  16601. * @internal
  16602. * @private
  16603. */
  16604. const enum TweenType {
  16605. None = 0,
  16606. Line = 1,
  16607. Curve = 2,
  16608. QuadIn = 3,
  16609. QuadOut = 4,
  16610. QuadInOut = 5,
  16611. }
  16612. /**
  16613. * @internal
  16614. * @private
  16615. */
  16616. const enum TimelineType {
  16617. Action = 0,
  16618. ZOrder = 1,
  16619. BoneAll = 10,
  16620. BoneTranslate = 11,
  16621. BoneRotate = 12,
  16622. BoneScale = 13,
  16623. Surface = 50,
  16624. SlotDisplay = 20,
  16625. SlotColor = 21,
  16626. SlotFFD = 22,
  16627. IKConstraint = 30,
  16628. AnimationTime = 40,
  16629. AnimationWeight = 41,
  16630. }
  16631. /**
  16632. * - Offset mode.
  16633. * @version DragonBones 5.5
  16634. * @language en_US
  16635. */
  16636. /**
  16637. * - 偏移模式。
  16638. * @version DragonBones 5.5
  16639. * @language zh_CN
  16640. */
  16641. const enum OffsetMode {
  16642. None = 0,
  16643. Additive = 1,
  16644. Override = 2,
  16645. }
  16646. /**
  16647. * - Animation fade out mode.
  16648. * @version DragonBones 4.5
  16649. * @language en_US
  16650. */
  16651. /**
  16652. * - 动画淡出模式。
  16653. * @version DragonBones 4.5
  16654. * @language zh_CN
  16655. */
  16656. const enum AnimationFadeOutMode {
  16657. /**
  16658. * - Do not fade out of any animation states.
  16659. * @language en_US
  16660. */
  16661. /**
  16662. * - 不淡出任何的动画状态。
  16663. * @language zh_CN
  16664. */
  16665. None = 0,
  16666. /**
  16667. * - Fade out the animation states of the same layer.
  16668. * @language en_US
  16669. */
  16670. /**
  16671. * - 淡出同层的动画状态。
  16672. * @language zh_CN
  16673. */
  16674. SameLayer = 1,
  16675. /**
  16676. * - Fade out the animation states of the same group.
  16677. * @language en_US
  16678. */
  16679. /**
  16680. * - 淡出同组的动画状态。
  16681. * @language zh_CN
  16682. */
  16683. SameGroup = 2,
  16684. /**
  16685. * - Fade out the animation states of the same layer and group.
  16686. * @language en_US
  16687. */
  16688. /**
  16689. * - 淡出同层并且同组的动画状态。
  16690. * @language zh_CN
  16691. */
  16692. SameLayerAndGroup = 3,
  16693. /**
  16694. * - Fade out of all animation states.
  16695. * @language en_US
  16696. */
  16697. /**
  16698. * - 淡出所有的动画状态。
  16699. * @language zh_CN
  16700. */
  16701. All = 4,
  16702. /**
  16703. * - Does not replace the animation state with the same name.
  16704. * @language en_US
  16705. */
  16706. /**
  16707. * - 不替换同名的动画状态。
  16708. * @language zh_CN
  16709. */
  16710. Single = 5,
  16711. }
  16712. /**
  16713. * @private
  16714. */
  16715. interface Map<T> {
  16716. [key: string]: T;
  16717. }
  16718. /**
  16719. * @private
  16720. */
  16721. class DragonBones {
  16722. static readonly VERSION: string;
  16723. static yDown: boolean;
  16724. static debug: boolean;
  16725. static debugDraw: boolean;
  16726. static webAssembly: boolean;
  16727. private readonly _clock;
  16728. private readonly _events;
  16729. private readonly _objects;
  16730. private _eventManager;
  16731. constructor(eventManager: IEventDispatcher);
  16732. advanceTime(passedTime: number): void;
  16733. bufferEvent(value: EventObject): void;
  16734. bufferObject(object: BaseObject): void;
  16735. readonly clock: WorldClock;
  16736. readonly eventManager: IEventDispatcher;
  16737. }
  16738. }
  16739. /**
  16740. * The MIT License (MIT)
  16741. *
  16742. * Copyright (c) 2012-2017 DragonBones team and other contributors
  16743. *
  16744. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  16745. * this software and associated documentation files (the "Software"), to deal in
  16746. * the Software without restriction, including without limitation the rights to
  16747. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  16748. * the Software, and to permit persons to whom the Software is furnished to do so,
  16749. * subject to the following conditions:
  16750. *
  16751. * The above copyright notice and this permission notice shall be included in all
  16752. * copies or substantial portions of the Software.
  16753. *
  16754. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16755. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16756. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16757. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16758. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16759. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16760. */
  16761. declare namespace dragonBones {
  16762. /**
  16763. * - The BaseObject is the base class for all objects in the DragonBones framework.
  16764. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  16765. * @version DragonBones 4.5
  16766. * @language en_US
  16767. */
  16768. /**
  16769. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  16770. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  16771. * @version DragonBones 4.5
  16772. * @language zh_CN
  16773. */
  16774. abstract class BaseObject {
  16775. private static _hashCode;
  16776. private static _defaultMaxCount;
  16777. private static readonly _maxCountMap;
  16778. private static readonly _poolsMap;
  16779. private static _returnObject(object);
  16780. static toString(): string;
  16781. /**
  16782. * - Set the maximum cache count of the specify object pool.
  16783. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  16784. * @param maxCount - Max count.
  16785. * @version DragonBones 4.5
  16786. * @language en_US
  16787. */
  16788. /**
  16789. * - 设置特定对象池的最大缓存数量。
  16790. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  16791. * @param maxCount - 最大缓存数量。
  16792. * @version DragonBones 4.5
  16793. * @language zh_CN
  16794. */
  16795. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  16796. /**
  16797. * - Clear the cached instances of a specify object pool.
  16798. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  16799. * @version DragonBones 4.5
  16800. * @language en_US
  16801. */
  16802. /**
  16803. * - 清除特定对象池的缓存实例。
  16804. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  16805. * @version DragonBones 4.5
  16806. * @language zh_CN
  16807. */
  16808. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  16809. /**
  16810. * - Get an instance of the specify class from object pool.
  16811. * @param objectConstructor - The specify class.
  16812. * @version DragonBones 4.5
  16813. * @language en_US
  16814. */
  16815. /**
  16816. * - 从对象池中获取特定类的实例。
  16817. * @param objectConstructor - 特定的类。
  16818. * @version DragonBones 4.5
  16819. * @language zh_CN
  16820. */
  16821. static borrowObject<T extends BaseObject>(objectConstructor: {
  16822. new (): T;
  16823. }): T;
  16824. /**
  16825. * - A unique identification number assigned to the object.
  16826. * @version DragonBones 4.5
  16827. * @language en_US
  16828. */
  16829. /**
  16830. * - 分配给此实例的唯一标识号。
  16831. * @version DragonBones 4.5
  16832. * @language zh_CN
  16833. */
  16834. readonly hashCode: number;
  16835. private _isInPool;
  16836. /**
  16837. * @private
  16838. */
  16839. protected abstract _onClear(): void;
  16840. /**
  16841. * - Clear the object and return it back to object pool。
  16842. * @version DragonBones 4.5
  16843. * @language en_US
  16844. */
  16845. /**
  16846. * - 清除该实例的所有数据并将其返还对象池。
  16847. * @version DragonBones 4.5
  16848. * @language zh_CN
  16849. */
  16850. returnToPool(): void;
  16851. }
  16852. }
  16853. /**
  16854. * The MIT License (MIT)
  16855. *
  16856. * Copyright (c) 2012-2017 DragonBones team and other contributors
  16857. *
  16858. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  16859. * this software and associated documentation files (the "Software"), to deal in
  16860. * the Software without restriction, including without limitation the rights to
  16861. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  16862. * the Software, and to permit persons to whom the Software is furnished to do so,
  16863. * subject to the following conditions:
  16864. *
  16865. * The above copyright notice and this permission notice shall be included in all
  16866. * copies or substantial portions of the Software.
  16867. *
  16868. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16869. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16870. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16871. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16872. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16873. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16874. */
  16875. declare namespace dragonBones {
  16876. /**
  16877. * - 2D Transform matrix.
  16878. * @version DragonBones 3.0
  16879. * @language en_US
  16880. */
  16881. /**
  16882. * - 2D 转换矩阵。
  16883. * @version DragonBones 3.0
  16884. * @language zh_CN
  16885. */
  16886. class Matrix {
  16887. /**
  16888. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  16889. * @default 1.0
  16890. * @version DragonBones 3.0
  16891. * @language en_US
  16892. */
  16893. /**
  16894. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  16895. * @default 1.0
  16896. * @version DragonBones 3.0
  16897. * @language zh_CN
  16898. */
  16899. a: number;
  16900. /**
  16901. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  16902. * @default 0.0
  16903. * @version DragonBones 3.0
  16904. * @language en_US
  16905. */
  16906. /**
  16907. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  16908. * @default 0.0
  16909. * @version DragonBones 3.0
  16910. * @language zh_CN
  16911. */
  16912. b: number;
  16913. /**
  16914. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  16915. * @default 0.0
  16916. * @version DragonBones 3.0
  16917. * @language en_US
  16918. */
  16919. /**
  16920. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  16921. * @default 0.0
  16922. * @version DragonBones 3.0
  16923. * @language zh_CN
  16924. */
  16925. c: number;
  16926. /**
  16927. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  16928. * @default 1.0
  16929. * @version DragonBones 3.0
  16930. * @language en_US
  16931. */
  16932. /**
  16933. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  16934. * @default 1.0
  16935. * @version DragonBones 3.0
  16936. * @language zh_CN
  16937. */
  16938. d: number;
  16939. /**
  16940. * - The distance by which to translate each point along the x axis.
  16941. * @default 0.0
  16942. * @version DragonBones 3.0
  16943. * @language en_US
  16944. */
  16945. /**
  16946. * - 沿 x 轴平移每个点的距离。
  16947. * @default 0.0
  16948. * @version DragonBones 3.0
  16949. * @language zh_CN
  16950. */
  16951. tx: number;
  16952. /**
  16953. * - The distance by which to translate each point along the y axis.
  16954. * @default 0.0
  16955. * @version DragonBones 3.0
  16956. * @language en_US
  16957. */
  16958. /**
  16959. * - 沿 y 轴平移每个点的距离。
  16960. * @default 0.0
  16961. * @version DragonBones 3.0
  16962. * @language zh_CN
  16963. */
  16964. ty: number;
  16965. /**
  16966. * @private
  16967. */
  16968. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  16969. toString(): string;
  16970. /**
  16971. * @private
  16972. */
  16973. copyFrom(value: Matrix): Matrix;
  16974. /**
  16975. * @private
  16976. */
  16977. copyFromArray(value: Array<number>, offset?: number): Matrix;
  16978. /**
  16979. * - Convert to unit matrix.
  16980. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  16981. * @version DragonBones 3.0
  16982. * @language en_US
  16983. */
  16984. /**
  16985. * - 转换为单位矩阵。
  16986. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  16987. * @version DragonBones 3.0
  16988. * @language zh_CN
  16989. */
  16990. identity(): Matrix;
  16991. /**
  16992. * - Multiplies the current matrix with another matrix.
  16993. * @param value - The matrix that needs to be multiplied.
  16994. * @version DragonBones 3.0
  16995. * @language en_US
  16996. */
  16997. /**
  16998. * - 将当前矩阵与另一个矩阵相乘。
  16999. * @param value - 需要相乘的矩阵。
  17000. * @version DragonBones 3.0
  17001. * @language zh_CN
  17002. */
  17003. concat(value: Matrix): Matrix;
  17004. /**
  17005. * - Convert to inverse matrix.
  17006. * @version DragonBones 3.0
  17007. * @language en_US
  17008. */
  17009. /**
  17010. * - 转换为逆矩阵。
  17011. * @version DragonBones 3.0
  17012. * @language zh_CN
  17013. */
  17014. invert(): Matrix;
  17015. /**
  17016. * - Apply a matrix transformation to a specific point.
  17017. * @param x - X coordinate.
  17018. * @param y - Y coordinate.
  17019. * @param result - The point after the transformation is applied.
  17020. * @param delta - Whether to ignore tx, ty's conversion to point.
  17021. * @version DragonBones 3.0
  17022. * @language en_US
  17023. */
  17024. /**
  17025. * - 将矩阵转换应用于特定点。
  17026. * @param x - 横坐标。
  17027. * @param y - 纵坐标。
  17028. * @param result - 应用转换之后的点。
  17029. * @param delta - 是否忽略 tx,ty 对点的转换。
  17030. * @version DragonBones 3.0
  17031. * @language zh_CN
  17032. */
  17033. transformPoint(x: number, y: number, result: {
  17034. x: number;
  17035. y: number;
  17036. }, delta?: boolean): void;
  17037. /**
  17038. * @private
  17039. */
  17040. transformRectangle(rectangle: {
  17041. x: number;
  17042. y: number;
  17043. width: number;
  17044. height: number;
  17045. }, delta?: boolean): void;
  17046. }
  17047. }
  17048. /**
  17049. * The MIT License (MIT)
  17050. *
  17051. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17052. *
  17053. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17054. * this software and associated documentation files (the "Software"), to deal in
  17055. * the Software without restriction, including without limitation the rights to
  17056. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17057. * the Software, and to permit persons to whom the Software is furnished to do so,
  17058. * subject to the following conditions:
  17059. *
  17060. * The above copyright notice and this permission notice shall be included in all
  17061. * copies or substantial portions of the Software.
  17062. *
  17063. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17064. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17065. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17066. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17067. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17068. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17069. */
  17070. declare namespace dragonBones {
  17071. /**
  17072. * - 2D Transform.
  17073. * @version DragonBones 3.0
  17074. * @language en_US
  17075. */
  17076. /**
  17077. * - 2D 变换。
  17078. * @version DragonBones 3.0
  17079. * @language zh_CN
  17080. */
  17081. class Transform {
  17082. /**
  17083. * @private
  17084. */
  17085. static readonly PI: number;
  17086. /**
  17087. * @private
  17088. */
  17089. static readonly PI_D: number;
  17090. /**
  17091. * @private
  17092. */
  17093. static readonly PI_H: number;
  17094. /**
  17095. * @private
  17096. */
  17097. static readonly PI_Q: number;
  17098. /**
  17099. * @private
  17100. */
  17101. static readonly RAD_DEG: number;
  17102. /**
  17103. * @private
  17104. */
  17105. static readonly DEG_RAD: number;
  17106. /**
  17107. * @private
  17108. */
  17109. static normalizeRadian(value: number): number;
  17110. /**
  17111. * - Horizontal translate.
  17112. * @version DragonBones 3.0
  17113. * @language en_US
  17114. */
  17115. /**
  17116. * - 水平位移。
  17117. * @version DragonBones 3.0
  17118. * @language zh_CN
  17119. */
  17120. x: number;
  17121. /**
  17122. * - Vertical translate.
  17123. * @version DragonBones 3.0
  17124. * @language en_US
  17125. */
  17126. /**
  17127. * - 垂直位移。
  17128. * @version DragonBones 3.0
  17129. * @language zh_CN
  17130. */
  17131. y: number;
  17132. /**
  17133. * - Skew. (In radians)
  17134. * @version DragonBones 3.0
  17135. * @language en_US
  17136. */
  17137. /**
  17138. * - 倾斜。 (以弧度为单位)
  17139. * @version DragonBones 3.0
  17140. * @language zh_CN
  17141. */
  17142. skew: number;
  17143. /**
  17144. * - rotation. (In radians)
  17145. * @version DragonBones 3.0
  17146. * @language en_US
  17147. */
  17148. /**
  17149. * - 旋转。 (以弧度为单位)
  17150. * @version DragonBones 3.0
  17151. * @language zh_CN
  17152. */
  17153. rotation: number;
  17154. /**
  17155. * - Horizontal Scaling.
  17156. * @version DragonBones 3.0
  17157. * @language en_US
  17158. */
  17159. /**
  17160. * - 水平缩放。
  17161. * @version DragonBones 3.0
  17162. * @language zh_CN
  17163. */
  17164. scaleX: number;
  17165. /**
  17166. * - Vertical scaling.
  17167. * @version DragonBones 3.0
  17168. * @language en_US
  17169. */
  17170. /**
  17171. * - 垂直缩放。
  17172. * @version DragonBones 3.0
  17173. * @language zh_CN
  17174. */
  17175. scaleY: number;
  17176. /**
  17177. * @private
  17178. */
  17179. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  17180. toString(): string;
  17181. /**
  17182. * @private
  17183. */
  17184. copyFrom(value: Transform): Transform;
  17185. /**
  17186. * @private
  17187. */
  17188. identity(): Transform;
  17189. /**
  17190. * @private
  17191. */
  17192. add(value: Transform): Transform;
  17193. /**
  17194. * @private
  17195. */
  17196. minus(value: Transform): Transform;
  17197. /**
  17198. * @private
  17199. */
  17200. fromMatrix(matrix: Matrix): Transform;
  17201. /**
  17202. * @private
  17203. */
  17204. toMatrix(matrix: Matrix): Transform;
  17205. }
  17206. }
  17207. /**
  17208. * The MIT License (MIT)
  17209. *
  17210. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17211. *
  17212. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17213. * this software and associated documentation files (the "Software"), to deal in
  17214. * the Software without restriction, including without limitation the rights to
  17215. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17216. * the Software, and to permit persons to whom the Software is furnished to do so,
  17217. * subject to the following conditions:
  17218. *
  17219. * The above copyright notice and this permission notice shall be included in all
  17220. * copies or substantial portions of the Software.
  17221. *
  17222. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17223. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17224. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17225. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17226. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17227. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17228. */
  17229. declare namespace dragonBones {
  17230. /**
  17231. * @internal
  17232. * @private
  17233. */
  17234. class ColorTransform {
  17235. alphaMultiplier: number;
  17236. redMultiplier: number;
  17237. greenMultiplier: number;
  17238. blueMultiplier: number;
  17239. alphaOffset: number;
  17240. redOffset: number;
  17241. greenOffset: number;
  17242. blueOffset: number;
  17243. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  17244. copyFrom(value: ColorTransform): void;
  17245. identity(): void;
  17246. }
  17247. }
  17248. /**
  17249. * The MIT License (MIT)
  17250. *
  17251. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17252. *
  17253. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17254. * this software and associated documentation files (the "Software"), to deal in
  17255. * the Software without restriction, including without limitation the rights to
  17256. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17257. * the Software, and to permit persons to whom the Software is furnished to do so,
  17258. * subject to the following conditions:
  17259. *
  17260. * The above copyright notice and this permission notice shall be included in all
  17261. * copies or substantial portions of the Software.
  17262. *
  17263. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17264. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17265. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17266. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17267. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17268. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17269. */
  17270. declare namespace dragonBones {
  17271. /**
  17272. * - The Point object represents a location in a two-dimensional coordinate system.
  17273. * @version DragonBones 3.0
  17274. * @language en_US
  17275. */
  17276. /**
  17277. * - Point 对象表示二维坐标系统中的某个位置。
  17278. * @version DragonBones 3.0
  17279. * @language zh_CN
  17280. */
  17281. class Point {
  17282. /**
  17283. * - The horizontal coordinate.
  17284. * @default 0.0
  17285. * @version DragonBones 3.0
  17286. * @language en_US
  17287. */
  17288. /**
  17289. * - 该点的水平坐标。
  17290. * @default 0.0
  17291. * @version DragonBones 3.0
  17292. * @language zh_CN
  17293. */
  17294. x: number;
  17295. /**
  17296. * - The vertical coordinate.
  17297. * @default 0.0
  17298. * @version DragonBones 3.0
  17299. * @language en_US
  17300. */
  17301. /**
  17302. * - 该点的垂直坐标。
  17303. * @default 0.0
  17304. * @version DragonBones 3.0
  17305. * @language zh_CN
  17306. */
  17307. y: number;
  17308. /**
  17309. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  17310. * @param x - The horizontal coordinate.
  17311. * @param y - The vertical coordinate.
  17312. * @version DragonBones 3.0
  17313. * @language en_US
  17314. */
  17315. /**
  17316. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  17317. * @param x - 该对象的x属性值,默认为 0.0。
  17318. * @param y - 该对象的y属性值,默认为 0.0。
  17319. * @version DragonBones 3.0
  17320. * @language zh_CN
  17321. */
  17322. constructor(x?: number, y?: number);
  17323. /**
  17324. * @private
  17325. */
  17326. copyFrom(value: Point): void;
  17327. /**
  17328. * @private
  17329. */
  17330. clear(): void;
  17331. }
  17332. }
  17333. /**
  17334. * The MIT License (MIT)
  17335. *
  17336. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17337. *
  17338. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17339. * this software and associated documentation files (the "Software"), to deal in
  17340. * the Software without restriction, including without limitation the rights to
  17341. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17342. * the Software, and to permit persons to whom the Software is furnished to do so,
  17343. * subject to the following conditions:
  17344. *
  17345. * The above copyright notice and this permission notice shall be included in all
  17346. * copies or substantial portions of the Software.
  17347. *
  17348. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17349. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17350. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17351. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17352. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17353. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17354. */
  17355. declare namespace dragonBones {
  17356. /**
  17357. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  17358. * width and its height.<br/>
  17359. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  17360. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  17361. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  17362. * if you change the bottom property, the value of the height property changes.
  17363. * @version DragonBones 3.0
  17364. * @language en_US
  17365. */
  17366. /**
  17367. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  17368. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  17369. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  17370. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  17371. * @version DragonBones 3.0
  17372. * @language zh_CN
  17373. */
  17374. class Rectangle {
  17375. /**
  17376. * - The x coordinate of the top-left corner of the rectangle.
  17377. * @default 0.0
  17378. * @version DragonBones 3.0
  17379. * @language en_US
  17380. */
  17381. /**
  17382. * - 矩形左上角的 x 坐标。
  17383. * @default 0.0
  17384. * @version DragonBones 3.0
  17385. * @language zh_CN
  17386. */
  17387. x: number;
  17388. /**
  17389. * - The y coordinate of the top-left corner of the rectangle.
  17390. * @default 0.0
  17391. * @version DragonBones 3.0
  17392. * @language en_US
  17393. */
  17394. /**
  17395. * - 矩形左上角的 y 坐标。
  17396. * @default 0.0
  17397. * @version DragonBones 3.0
  17398. * @language zh_CN
  17399. */
  17400. y: number;
  17401. /**
  17402. * - The width of the rectangle, in pixels.
  17403. * @default 0.0
  17404. * @version DragonBones 3.0
  17405. * @language en_US
  17406. */
  17407. /**
  17408. * - 矩形的宽度(以像素为单位)。
  17409. * @default 0.0
  17410. * @version DragonBones 3.0
  17411. * @language zh_CN
  17412. */
  17413. width: number;
  17414. /**
  17415. * - 矩形的高度(以像素为单位)。
  17416. * @default 0.0
  17417. * @version DragonBones 3.0
  17418. * @language en_US
  17419. */
  17420. /**
  17421. * - The height of the rectangle, in pixels.
  17422. * @default 0.0
  17423. * @version DragonBones 3.0
  17424. * @language zh_CN
  17425. */
  17426. height: number;
  17427. /**
  17428. * @private
  17429. */
  17430. constructor(x?: number, y?: number, width?: number, height?: number);
  17431. /**
  17432. * @private
  17433. */
  17434. copyFrom(value: Rectangle): void;
  17435. /**
  17436. * @private
  17437. */
  17438. clear(): void;
  17439. }
  17440. }
  17441. /**
  17442. * The MIT License (MIT)
  17443. *
  17444. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17445. *
  17446. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17447. * this software and associated documentation files (the "Software"), to deal in
  17448. * the Software without restriction, including without limitation the rights to
  17449. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17450. * the Software, and to permit persons to whom the Software is furnished to do so,
  17451. * subject to the following conditions:
  17452. *
  17453. * The above copyright notice and this permission notice shall be included in all
  17454. * copies or substantial portions of the Software.
  17455. *
  17456. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17457. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17458. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17459. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17460. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17461. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17462. */
  17463. declare namespace dragonBones {
  17464. /**
  17465. * - The user custom data.
  17466. * @version DragonBones 5.0
  17467. * @language en_US
  17468. */
  17469. /**
  17470. * - 用户自定义数据。
  17471. * @version DragonBones 5.0
  17472. * @language zh_CN
  17473. */
  17474. class UserData extends BaseObject {
  17475. static toString(): string;
  17476. /**
  17477. * - The custom int numbers.
  17478. * @version DragonBones 5.0
  17479. * @language en_US
  17480. */
  17481. /**
  17482. * - 自定义整数。
  17483. * @version DragonBones 5.0
  17484. * @language zh_CN
  17485. */
  17486. readonly ints: Array<number>;
  17487. /**
  17488. * - The custom float numbers.
  17489. * @version DragonBones 5.0
  17490. * @language en_US
  17491. */
  17492. /**
  17493. * - 自定义浮点数。
  17494. * @version DragonBones 5.0
  17495. * @language zh_CN
  17496. */
  17497. readonly floats: Array<number>;
  17498. /**
  17499. * - The custom strings.
  17500. * @version DragonBones 5.0
  17501. * @language en_US
  17502. */
  17503. /**
  17504. * - 自定义字符串。
  17505. * @version DragonBones 5.0
  17506. * @language zh_CN
  17507. */
  17508. readonly strings: Array<string>;
  17509. /**
  17510. * @inheritDoc
  17511. */
  17512. protected _onClear(): void;
  17513. /**
  17514. * @internal
  17515. * @private
  17516. */
  17517. addInt(value: number): void;
  17518. /**
  17519. * @internal
  17520. * @private
  17521. */
  17522. addFloat(value: number): void;
  17523. /**
  17524. * @internal
  17525. * @private
  17526. */
  17527. addString(value: string): void;
  17528. /**
  17529. * - Get the custom int number.
  17530. * @version DragonBones 5.0
  17531. * @language en_US
  17532. */
  17533. /**
  17534. * - 获取自定义整数。
  17535. * @version DragonBones 5.0
  17536. * @language zh_CN
  17537. */
  17538. getInt(index?: number): number;
  17539. /**
  17540. * - Get the custom float number.
  17541. * @version DragonBones 5.0
  17542. * @language en_US
  17543. */
  17544. /**
  17545. * - 获取自定义浮点数。
  17546. * @version DragonBones 5.0
  17547. * @language zh_CN
  17548. */
  17549. getFloat(index?: number): number;
  17550. /**
  17551. * - Get the custom string.
  17552. * @version DragonBones 5.0
  17553. * @language en_US
  17554. */
  17555. /**
  17556. * - 获取自定义字符串。
  17557. * @version DragonBones 5.0
  17558. * @language zh_CN
  17559. */
  17560. getString(index?: number): string;
  17561. }
  17562. /**
  17563. * @internal
  17564. * @private
  17565. */
  17566. class ActionData extends BaseObject {
  17567. static toString(): string;
  17568. type: ActionType;
  17569. name: string;
  17570. bone: BoneData | null;
  17571. slot: SlotData | null;
  17572. data: UserData | null;
  17573. protected _onClear(): void;
  17574. }
  17575. }
  17576. /**
  17577. * The MIT License (MIT)
  17578. *
  17579. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17580. *
  17581. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17582. * this software and associated documentation files (the "Software"), to deal in
  17583. * the Software without restriction, including without limitation the rights to
  17584. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17585. * the Software, and to permit persons to whom the Software is furnished to do so,
  17586. * subject to the following conditions:
  17587. *
  17588. * The above copyright notice and this permission notice shall be included in all
  17589. * copies or substantial portions of the Software.
  17590. *
  17591. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17592. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17593. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17594. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17595. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17596. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17597. */
  17598. declare namespace dragonBones {
  17599. /**
  17600. * - The DragonBones data.
  17601. * A DragonBones data contains multiple armature data.
  17602. * @see dragonBones.ArmatureData
  17603. * @version DragonBones 3.0
  17604. * @language en_US
  17605. */
  17606. /**
  17607. * - 龙骨数据。
  17608. * 一个龙骨数据包含多个骨架数据。
  17609. * @see dragonBones.ArmatureData
  17610. * @version DragonBones 3.0
  17611. * @language zh_CN
  17612. */
  17613. class DragonBonesData extends BaseObject {
  17614. static toString(): string;
  17615. /**
  17616. * @private
  17617. */
  17618. autoSearch: boolean;
  17619. /**
  17620. * - The animation frame rate.
  17621. * @version DragonBones 3.0
  17622. * @language en_US
  17623. */
  17624. /**
  17625. * - 动画帧频。
  17626. * @version DragonBones 3.0
  17627. * @language zh_CN
  17628. */
  17629. frameRate: number;
  17630. /**
  17631. * - The data version.
  17632. * @version DragonBones 3.0
  17633. * @language en_US
  17634. */
  17635. /**
  17636. * - 数据版本。
  17637. * @version DragonBones 3.0
  17638. * @language zh_CN
  17639. */
  17640. version: string;
  17641. /**
  17642. * - The DragonBones data name.
  17643. * The name is consistent with the DragonBones project name.
  17644. * @version DragonBones 3.0
  17645. * @language en_US
  17646. */
  17647. /**
  17648. * - 龙骨数据名称。
  17649. * 该名称与龙骨项目名保持一致。
  17650. * @version DragonBones 3.0
  17651. * @language zh_CN
  17652. */
  17653. name: string;
  17654. /**
  17655. * @private
  17656. */
  17657. stage: ArmatureData | null;
  17658. /**
  17659. * @internal
  17660. * @private
  17661. */
  17662. readonly frameIndices: Array<number>;
  17663. /**
  17664. * @internal
  17665. * @private
  17666. */
  17667. readonly cachedFrames: Array<number>;
  17668. /**
  17669. * - All armature data names.
  17670. * @version DragonBones 3.0
  17671. * @language en_US
  17672. */
  17673. /**
  17674. * - 所有的骨架数据名称。
  17675. * @version DragonBones 3.0
  17676. * @language zh_CN
  17677. */
  17678. readonly armatureNames: Array<string>;
  17679. /**
  17680. * @private
  17681. */
  17682. readonly armatures: Map<ArmatureData>;
  17683. /**
  17684. * @internal
  17685. * @private
  17686. */
  17687. binary: ArrayBuffer;
  17688. /**
  17689. * @internal
  17690. * @private
  17691. */
  17692. intArray: Int16Array;
  17693. /**
  17694. * @internal
  17695. * @private
  17696. */
  17697. floatArray: Float32Array;
  17698. /**
  17699. * @internal
  17700. * @private
  17701. */
  17702. frameIntArray: Int16Array;
  17703. /**
  17704. * @internal
  17705. * @private
  17706. */
  17707. frameFloatArray: Float32Array;
  17708. /**
  17709. * @internal
  17710. * @private
  17711. */
  17712. frameArray: Int16Array;
  17713. /**
  17714. * @internal
  17715. * @private
  17716. */
  17717. timelineArray: Uint16Array;
  17718. /**
  17719. * @private
  17720. */
  17721. userData: UserData | null;
  17722. /**
  17723. * @inheritDoc
  17724. */
  17725. protected _onClear(): void;
  17726. /**
  17727. * @internal
  17728. * @private
  17729. */
  17730. addArmature(value: ArmatureData): void;
  17731. /**
  17732. * - Get a specific armature data.
  17733. * @param name - The armature data name.
  17734. * @version DragonBones 3.0
  17735. * @language en_US
  17736. */
  17737. /**
  17738. * - 获取特定的骨架数据。
  17739. * @param name - 骨架数据名称。
  17740. * @version DragonBones 3.0
  17741. * @language zh_CN
  17742. */
  17743. getArmature(name: string): ArmatureData | null;
  17744. /**
  17745. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  17746. * @deprecated
  17747. * @language en_US
  17748. */
  17749. /**
  17750. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  17751. * @deprecated
  17752. * @language zh_CN
  17753. */
  17754. dispose(): void;
  17755. }
  17756. }
  17757. /**
  17758. * The MIT License (MIT)
  17759. *
  17760. * Copyright (c) 2012-2017 DragonBones team and other contributors
  17761. *
  17762. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  17763. * this software and associated documentation files (the "Software"), to deal in
  17764. * the Software without restriction, including without limitation the rights to
  17765. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  17766. * the Software, and to permit persons to whom the Software is furnished to do so,
  17767. * subject to the following conditions:
  17768. *
  17769. * The above copyright notice and this permission notice shall be included in all
  17770. * copies or substantial portions of the Software.
  17771. *
  17772. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17773. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17774. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17775. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17776. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17777. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17778. */
  17779. declare namespace dragonBones {
  17780. /**
  17781. * - The armature data.
  17782. * @version DragonBones 3.0
  17783. * @language en_US
  17784. */
  17785. /**
  17786. * - 骨架数据。
  17787. * @version DragonBones 3.0
  17788. * @language zh_CN
  17789. */
  17790. class ArmatureData extends BaseObject {
  17791. static toString(): string;
  17792. /**
  17793. * @private
  17794. */
  17795. type: ArmatureType;
  17796. /**
  17797. * - The animation frame rate.
  17798. * @version DragonBones 3.0
  17799. * @language en_US
  17800. */
  17801. /**
  17802. * - 动画帧率。
  17803. * @version DragonBones 3.0
  17804. * @language zh_CN
  17805. */
  17806. frameRate: number;
  17807. /**
  17808. * @private
  17809. */
  17810. cacheFrameRate: number;
  17811. /**
  17812. * @private
  17813. */
  17814. scale: number;
  17815. /**
  17816. * - The armature name.
  17817. * @version DragonBones 3.0
  17818. * @language en_US
  17819. */
  17820. /**
  17821. * - 骨架名称。
  17822. * @version DragonBones 3.0
  17823. * @language zh_CN
  17824. */
  17825. name: string;
  17826. /**
  17827. * @private
  17828. */
  17829. readonly aabb: Rectangle;
  17830. /**
  17831. * - The names of all the animation data.
  17832. * @version DragonBones 3.0
  17833. * @language en_US
  17834. */
  17835. /**
  17836. * - 所有的动画数据名称。
  17837. * @version DragonBones 3.0
  17838. * @language zh_CN
  17839. */
  17840. readonly animationNames: Array<string>;
  17841. /**
  17842. * @private
  17843. */
  17844. readonly sortedBones: Array<BoneData>;
  17845. /**
  17846. * @private
  17847. */
  17848. readonly sortedSlots: Array<SlotData>;
  17849. /**
  17850. * @private
  17851. */
  17852. readonly defaultActions: Array<ActionData>;
  17853. /**
  17854. * @private
  17855. */
  17856. readonly actions: Array<ActionData>;
  17857. /**
  17858. * @private
  17859. */
  17860. readonly bones: Map<BoneData>;
  17861. /**
  17862. * @private
  17863. */
  17864. readonly slots: Map<SlotData>;
  17865. /**
  17866. * @private
  17867. */
  17868. readonly constraints: Map<ConstraintData>;
  17869. /**
  17870. * @private
  17871. */
  17872. readonly skins: Map<SkinData>;
  17873. /**
  17874. * @private
  17875. */
  17876. readonly animations: Map<AnimationData>;
  17877. /**
  17878. * - The default skin data.
  17879. * @version DragonBones 4.5
  17880. * @language en_US
  17881. */
  17882. /**
  17883. * - 默认插槽数据。
  17884. * @version DragonBones 4.5
  17885. * @language zh_CN
  17886. */
  17887. defaultSkin: SkinData | null;
  17888. /**
  17889. * - The default animation data.
  17890. * @version DragonBones 4.5
  17891. * @language en_US
  17892. */
  17893. /**
  17894. * - 默认动画数据。
  17895. * @version DragonBones 4.5
  17896. * @language zh_CN
  17897. */
  17898. defaultAnimation: AnimationData | null;
  17899. /**
  17900. * @private
  17901. */
  17902. canvas: CanvasData | null;
  17903. /**
  17904. * @private
  17905. */
  17906. userData: UserData | null;
  17907. /**
  17908. * @private
  17909. */
  17910. parent: DragonBonesData;
  17911. /**
  17912. * @inheritDoc
  17913. */
  17914. protected _onClear(): void;
  17915. /**
  17916. * @internal
  17917. * @private
  17918. */
  17919. sortBones(): void;
  17920. /**
  17921. * @internal
  17922. * @private
  17923. */
  17924. cacheFrames(frameRate: number): void;
  17925. /**
  17926. * @internal
  17927. * @private
  17928. */
  17929. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  17930. /**
  17931. * @internal
  17932. * @private
  17933. */
  17934. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  17935. /**
  17936. * @internal
  17937. * @private
  17938. */
  17939. addBone(value: BoneData): void;
  17940. /**
  17941. * @internal
  17942. * @private
  17943. */
  17944. addSlot(value: SlotData): void;
  17945. /**
  17946. * @internal
  17947. * @private
  17948. */
  17949. addConstraint(value: ConstraintData): void;
  17950. /**
  17951. * @internal
  17952. * @private
  17953. */
  17954. addSkin(value: SkinData): void;
  17955. /**
  17956. * @internal
  17957. * @private
  17958. */
  17959. addAnimation(value: AnimationData): void;
  17960. /**
  17961. * @internal
  17962. * @private
  17963. */
  17964. addAction(value: ActionData, isDefault: boolean): void;
  17965. /**
  17966. * - Get a specific done data.
  17967. * @param name - The bone name.
  17968. * @version DragonBones 3.0
  17969. * @language en_US
  17970. */
  17971. /**
  17972. * - 获取特定的骨骼数据。
  17973. * @param name - 骨骼名称。
  17974. * @version DragonBones 3.0
  17975. * @language zh_CN
  17976. */
  17977. getBone(name: string): BoneData | null;
  17978. /**
  17979. * - Get a specific slot data.
  17980. * @param name - The slot name.
  17981. * @version DragonBones 3.0
  17982. * @language en_US
  17983. */
  17984. /**
  17985. * - 获取特定的插槽数据。
  17986. * @param name - 插槽名称。
  17987. * @version DragonBones 3.0
  17988. * @language zh_CN
  17989. */
  17990. getSlot(name: string): SlotData | null;
  17991. /**
  17992. * @private
  17993. */
  17994. getConstraint(name: string): ConstraintData | null;
  17995. /**
  17996. * - Get a specific skin data.
  17997. * @param name - The skin name.
  17998. * @version DragonBones 3.0
  17999. * @language en_US
  18000. */
  18001. /**
  18002. * - 获取特定皮肤数据。
  18003. * @param name - 皮肤名称。
  18004. * @version DragonBones 3.0
  18005. * @language zh_CN
  18006. */
  18007. getSkin(name: string): SkinData | null;
  18008. /**
  18009. * @internal
  18010. * @private
  18011. */
  18012. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  18013. /**
  18014. * - Get a specific animation data.
  18015. * @param name - The animation name.
  18016. * @version DragonBones 3.0
  18017. * @language en_US
  18018. */
  18019. /**
  18020. * - 获取特定的动画数据。
  18021. * @param name - 动画名称。
  18022. * @version DragonBones 3.0
  18023. * @language zh_CN
  18024. */
  18025. getAnimation(name: string): AnimationData | null;
  18026. }
  18027. /**
  18028. * - The bone data.
  18029. * @version DragonBones 3.0
  18030. * @language en_US
  18031. */
  18032. /**
  18033. * - 骨骼数据。
  18034. * @version DragonBones 3.0
  18035. * @language zh_CN
  18036. */
  18037. class BoneData extends BaseObject {
  18038. static toString(): string;
  18039. /**
  18040. * @private
  18041. */
  18042. inheritTranslation: boolean;
  18043. /**
  18044. * @private
  18045. */
  18046. inheritRotation: boolean;
  18047. /**
  18048. * @private
  18049. */
  18050. inheritScale: boolean;
  18051. /**
  18052. * @private
  18053. */
  18054. inheritReflection: boolean;
  18055. /**
  18056. * @private
  18057. */
  18058. type: BoneType;
  18059. /**
  18060. * - The bone length.
  18061. * @version DragonBones 3.0
  18062. * @language en_US
  18063. */
  18064. /**
  18065. * - 骨骼长度。
  18066. * @version DragonBones 3.0
  18067. * @language zh_CN
  18068. */
  18069. length: number;
  18070. /**
  18071. * - The bone name.
  18072. * @version DragonBones 3.0
  18073. * @language en_US
  18074. */
  18075. /**
  18076. * - 骨骼名称。
  18077. * @version DragonBones 3.0
  18078. * @language zh_CN
  18079. */
  18080. name: string;
  18081. /**
  18082. * @private
  18083. */
  18084. readonly transform: Transform;
  18085. /**
  18086. * @private
  18087. */
  18088. userData: UserData | null;
  18089. /**
  18090. * - The parent bone data.
  18091. * @version DragonBones 3.0
  18092. * @language en_US
  18093. */
  18094. /**
  18095. * - 父骨骼数据。
  18096. * @version DragonBones 3.0
  18097. * @language zh_CN
  18098. */
  18099. parent: BoneData | null;
  18100. /**
  18101. * @inheritDoc
  18102. */
  18103. protected _onClear(): void;
  18104. }
  18105. /**
  18106. * @internal
  18107. * @private
  18108. */
  18109. class SurfaceData extends BoneData {
  18110. static toString(): string;
  18111. segmentX: number;
  18112. segmentY: number;
  18113. readonly vertices: Array<number>;
  18114. /**
  18115. * @inheritDoc
  18116. */
  18117. protected _onClear(): void;
  18118. }
  18119. /**
  18120. * - The slot data.
  18121. * @version DragonBones 3.0
  18122. * @language en_US
  18123. */
  18124. /**
  18125. * - 插槽数据。
  18126. * @version DragonBones 3.0
  18127. * @language zh_CN
  18128. */
  18129. class SlotData extends BaseObject {
  18130. /**
  18131. * @internal
  18132. * @private
  18133. */
  18134. static readonly DEFAULT_COLOR: ColorTransform;
  18135. /**
  18136. * @internal
  18137. * @private
  18138. */
  18139. static createColor(): ColorTransform;
  18140. static toString(): string;
  18141. /**
  18142. * @private
  18143. */
  18144. blendMode: BlendMode;
  18145. /**
  18146. * @private
  18147. */
  18148. displayIndex: number;
  18149. /**
  18150. * @private
  18151. */
  18152. zOrder: number;
  18153. /**
  18154. * - The slot name.
  18155. * @version DragonBones 3.0
  18156. * @language en_US
  18157. */
  18158. /**
  18159. * - 插槽名称。
  18160. * @version DragonBones 3.0
  18161. * @language zh_CN
  18162. */
  18163. name: string;
  18164. /**
  18165. * @private
  18166. */
  18167. color: ColorTransform;
  18168. /**
  18169. * @private
  18170. */
  18171. userData: UserData | null;
  18172. /**
  18173. * - The parent bone data.
  18174. * @version DragonBones 3.0
  18175. * @language en_US
  18176. */
  18177. /**
  18178. * - 父骨骼数据。
  18179. * @version DragonBones 3.0
  18180. * @language zh_CN
  18181. */
  18182. parent: BoneData;
  18183. /**
  18184. * @inheritDoc
  18185. */
  18186. protected _onClear(): void;
  18187. }
  18188. }
  18189. /**
  18190. * The MIT License (MIT)
  18191. *
  18192. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18193. *
  18194. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18195. * this software and associated documentation files (the "Software"), to deal in
  18196. * the Software without restriction, including without limitation the rights to
  18197. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18198. * the Software, and to permit persons to whom the Software is furnished to do so,
  18199. * subject to the following conditions:
  18200. *
  18201. * The above copyright notice and this permission notice shall be included in all
  18202. * copies or substantial portions of the Software.
  18203. *
  18204. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18205. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18206. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18207. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18208. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18209. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18210. */
  18211. declare namespace dragonBones {
  18212. /**
  18213. * @internal
  18214. * @private
  18215. */
  18216. abstract class ConstraintData extends BaseObject {
  18217. order: number;
  18218. name: string;
  18219. target: BoneData;
  18220. root: BoneData;
  18221. bone: BoneData | null;
  18222. protected _onClear(): void;
  18223. }
  18224. /**
  18225. * @internal
  18226. * @private
  18227. */
  18228. class IKConstraintData extends ConstraintData {
  18229. static toString(): string;
  18230. scaleEnabled: boolean;
  18231. bendPositive: boolean;
  18232. weight: number;
  18233. protected _onClear(): void;
  18234. }
  18235. }
  18236. /**
  18237. * The MIT License (MIT)
  18238. *
  18239. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18240. *
  18241. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18242. * this software and associated documentation files (the "Software"), to deal in
  18243. * the Software without restriction, including without limitation the rights to
  18244. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18245. * the Software, and to permit persons to whom the Software is furnished to do so,
  18246. * subject to the following conditions:
  18247. *
  18248. * The above copyright notice and this permission notice shall be included in all
  18249. * copies or substantial portions of the Software.
  18250. *
  18251. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18252. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18253. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18254. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18255. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18256. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18257. */
  18258. declare namespace dragonBones {
  18259. /**
  18260. * @internal
  18261. * @private
  18262. */
  18263. class CanvasData extends BaseObject {
  18264. static toString(): string;
  18265. hasBackground: boolean;
  18266. color: number;
  18267. x: number;
  18268. y: number;
  18269. width: number;
  18270. height: number;
  18271. protected _onClear(): void;
  18272. }
  18273. }
  18274. /**
  18275. * The MIT License (MIT)
  18276. *
  18277. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18278. *
  18279. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18280. * this software and associated documentation files (the "Software"), to deal in
  18281. * the Software without restriction, including without limitation the rights to
  18282. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18283. * the Software, and to permit persons to whom the Software is furnished to do so,
  18284. * subject to the following conditions:
  18285. *
  18286. * The above copyright notice and this permission notice shall be included in all
  18287. * copies or substantial portions of the Software.
  18288. *
  18289. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18290. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18291. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18292. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18293. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18294. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18295. */
  18296. declare namespace dragonBones {
  18297. /**
  18298. * - The skin data, typically a armature data instance contains at least one skinData.
  18299. * @version DragonBones 3.0
  18300. * @language en_US
  18301. */
  18302. /**
  18303. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  18304. * @version DragonBones 3.0
  18305. * @language zh_CN
  18306. */
  18307. class SkinData extends BaseObject {
  18308. static toString(): string;
  18309. /**
  18310. * - The skin name.
  18311. * @version DragonBones 3.0
  18312. * @language en_US
  18313. */
  18314. /**
  18315. * - 皮肤名称。
  18316. * @version DragonBones 3.0
  18317. * @language zh_CN
  18318. */
  18319. name: string;
  18320. /**
  18321. * @private
  18322. */
  18323. readonly displays: Map<Array<DisplayData | null>>;
  18324. /**
  18325. * @private
  18326. */
  18327. parent: ArmatureData;
  18328. /**
  18329. * @inheritDoc
  18330. */
  18331. protected _onClear(): void;
  18332. /**
  18333. * @internal
  18334. * @private
  18335. */
  18336. addDisplay(slotName: string, value: DisplayData | null): void;
  18337. /**
  18338. * @private
  18339. */
  18340. getDisplay(slotName: string, displayName: string): DisplayData | null;
  18341. /**
  18342. * @private
  18343. */
  18344. getDisplays(slotName: string): Array<DisplayData | null> | null;
  18345. }
  18346. }
  18347. /**
  18348. * The MIT License (MIT)
  18349. *
  18350. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18351. *
  18352. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18353. * this software and associated documentation files (the "Software"), to deal in
  18354. * the Software without restriction, including without limitation the rights to
  18355. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18356. * the Software, and to permit persons to whom the Software is furnished to do so,
  18357. * subject to the following conditions:
  18358. *
  18359. * The above copyright notice and this permission notice shall be included in all
  18360. * copies or substantial portions of the Software.
  18361. *
  18362. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18363. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18364. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18365. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18366. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18367. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18368. */
  18369. declare namespace dragonBones {
  18370. /**
  18371. * @internal
  18372. * @private
  18373. */
  18374. abstract class DisplayData extends BaseObject {
  18375. type: DisplayType;
  18376. name: string;
  18377. path: string;
  18378. parent: SkinData;
  18379. readonly transform: Transform;
  18380. protected _onClear(): void;
  18381. }
  18382. /**
  18383. * @internal
  18384. * @private
  18385. */
  18386. class ImageDisplayData extends DisplayData {
  18387. static toString(): string;
  18388. readonly pivot: Point;
  18389. texture: TextureData | null;
  18390. protected _onClear(): void;
  18391. }
  18392. /**
  18393. * @internal
  18394. * @private
  18395. */
  18396. class ArmatureDisplayData extends DisplayData {
  18397. static toString(): string;
  18398. inheritAnimation: boolean;
  18399. readonly actions: Array<ActionData>;
  18400. armature: ArmatureData | null;
  18401. protected _onClear(): void;
  18402. /**
  18403. * @private
  18404. */
  18405. addAction(value: ActionData): void;
  18406. }
  18407. /**
  18408. * @internal
  18409. * @private
  18410. */
  18411. class MeshDisplayData extends DisplayData {
  18412. static toString(): string;
  18413. inheritDeform: boolean;
  18414. offset: number;
  18415. weight: WeightData | null;
  18416. glue: GlueData | null;
  18417. texture: TextureData | null;
  18418. protected _onClear(): void;
  18419. }
  18420. /**
  18421. * @internal
  18422. * @private
  18423. */
  18424. class BoundingBoxDisplayData extends DisplayData {
  18425. static toString(): string;
  18426. boundingBox: BoundingBoxData | null;
  18427. protected _onClear(): void;
  18428. }
  18429. /**
  18430. * @internal
  18431. * @private
  18432. */
  18433. class WeightData extends BaseObject {
  18434. static toString(): string;
  18435. count: number;
  18436. offset: number;
  18437. readonly bones: Array<BoneData>;
  18438. protected _onClear(): void;
  18439. addBone(value: BoneData): void;
  18440. }
  18441. /**
  18442. * @internal
  18443. * @private
  18444. */
  18445. class GlueData extends BaseObject {
  18446. static toString(): string;
  18447. readonly weights: Array<number>;
  18448. readonly meshes: Array<MeshDisplayData | null>;
  18449. protected _onClear(): void;
  18450. addMesh(value: MeshDisplayData | null): void;
  18451. }
  18452. }
  18453. /**
  18454. * The MIT License (MIT)
  18455. *
  18456. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18457. *
  18458. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18459. * this software and associated documentation files (the "Software"), to deal in
  18460. * the Software without restriction, including without limitation the rights to
  18461. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18462. * the Software, and to permit persons to whom the Software is furnished to do so,
  18463. * subject to the following conditions:
  18464. *
  18465. * The above copyright notice and this permission notice shall be included in all
  18466. * copies or substantial portions of the Software.
  18467. *
  18468. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18469. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18470. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18471. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18472. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18473. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18474. */
  18475. declare namespace dragonBones {
  18476. /**
  18477. * - The base class of bounding box data.
  18478. * @see dragonBones.RectangleData
  18479. * @see dragonBones.EllipseData
  18480. * @see dragonBones.PolygonData
  18481. * @version DragonBones 5.0
  18482. * @language en_US
  18483. */
  18484. /**
  18485. * - 边界框数据基类。
  18486. * @see dragonBones.RectangleData
  18487. * @see dragonBones.EllipseData
  18488. * @see dragonBones.PolygonData
  18489. * @version DragonBones 5.0
  18490. * @language zh_CN
  18491. */
  18492. abstract class BoundingBoxData extends BaseObject {
  18493. /**
  18494. * - The bounding box type.
  18495. * @version DragonBones 5.0
  18496. * @language en_US
  18497. */
  18498. /**
  18499. * - 边界框类型。
  18500. * @version DragonBones 5.0
  18501. * @language zh_CN
  18502. */
  18503. type: BoundingBoxType;
  18504. /**
  18505. * @private
  18506. */
  18507. color: number;
  18508. /**
  18509. * @private
  18510. */
  18511. width: number;
  18512. /**
  18513. * @private
  18514. */
  18515. height: number;
  18516. /**
  18517. * @private
  18518. */
  18519. protected _onClear(): void;
  18520. /**
  18521. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  18522. * @version DragonBones 5.0
  18523. * @language en_US
  18524. */
  18525. /**
  18526. * - 检查边界框是否包含特定点。(本地坐标系)
  18527. * @version DragonBones 5.0
  18528. * @language zh_CN
  18529. */
  18530. abstract containsPoint(pX: number, pY: number): boolean;
  18531. /**
  18532. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  18533. * @version DragonBones 5.0
  18534. * @language en_US
  18535. */
  18536. /**
  18537. * - 检查边界框是否与特定线段相交。(本地坐标系)
  18538. * @version DragonBones 5.0
  18539. * @language zh_CN
  18540. */
  18541. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  18542. x: number;
  18543. y: number;
  18544. } | null, intersectionPointB: {
  18545. x: number;
  18546. y: number;
  18547. } | null, normalRadians: {
  18548. x: number;
  18549. y: number;
  18550. } | null): number;
  18551. }
  18552. /**
  18553. * - The rectangle bounding box data.
  18554. * @version DragonBones 5.1
  18555. * @language en_US
  18556. */
  18557. /**
  18558. * - 矩形边界框数据。
  18559. * @version DragonBones 5.1
  18560. * @language zh_CN
  18561. */
  18562. class RectangleBoundingBoxData extends BoundingBoxData {
  18563. static toString(): string;
  18564. /**
  18565. * - Compute the bit code for a point (x, y) using the clip rectangle
  18566. */
  18567. private static _computeOutCode(x, y, xMin, yMin, xMax, yMax);
  18568. /**
  18569. * @private
  18570. */
  18571. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  18572. x: number;
  18573. y: number;
  18574. } | null, intersectionPointB?: {
  18575. x: number;
  18576. y: number;
  18577. } | null, normalRadians?: {
  18578. x: number;
  18579. y: number;
  18580. } | null): number;
  18581. /**
  18582. * @inheritDoc
  18583. * @private
  18584. */
  18585. protected _onClear(): void;
  18586. /**
  18587. * @inheritDoc
  18588. */
  18589. containsPoint(pX: number, pY: number): boolean;
  18590. /**
  18591. * @inheritDoc
  18592. */
  18593. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18594. x: number;
  18595. y: number;
  18596. } | null, intersectionPointB?: {
  18597. x: number;
  18598. y: number;
  18599. } | null, normalRadians?: {
  18600. x: number;
  18601. y: number;
  18602. } | null): number;
  18603. }
  18604. /**
  18605. * - The ellipse bounding box data.
  18606. * @version DragonBones 5.1
  18607. * @language en_US
  18608. */
  18609. /**
  18610. * - 椭圆边界框数据。
  18611. * @version DragonBones 5.1
  18612. * @language zh_CN
  18613. */
  18614. class EllipseBoundingBoxData extends BoundingBoxData {
  18615. static toString(): string;
  18616. /**
  18617. * @private
  18618. */
  18619. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  18620. x: number;
  18621. y: number;
  18622. } | null, intersectionPointB?: {
  18623. x: number;
  18624. y: number;
  18625. } | null, normalRadians?: {
  18626. x: number;
  18627. y: number;
  18628. } | null): number;
  18629. /**
  18630. * @inheritDoc
  18631. * @private
  18632. */
  18633. protected _onClear(): void;
  18634. /**
  18635. * @inheritDoc
  18636. */
  18637. containsPoint(pX: number, pY: number): boolean;
  18638. /**
  18639. * @inheritDoc
  18640. */
  18641. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18642. x: number;
  18643. y: number;
  18644. } | null, intersectionPointB?: {
  18645. x: number;
  18646. y: number;
  18647. } | null, normalRadians?: {
  18648. x: number;
  18649. y: number;
  18650. } | null): number;
  18651. }
  18652. /**
  18653. * - The polygon bounding box data.
  18654. * @version DragonBones 5.1
  18655. * @language en_US
  18656. */
  18657. /**
  18658. * - 多边形边界框数据。
  18659. * @version DragonBones 5.1
  18660. * @language zh_CN
  18661. */
  18662. class PolygonBoundingBoxData extends BoundingBoxData {
  18663. static toString(): string;
  18664. /**
  18665. * @private
  18666. */
  18667. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  18668. x: number;
  18669. y: number;
  18670. } | null, intersectionPointB?: {
  18671. x: number;
  18672. y: number;
  18673. } | null, normalRadians?: {
  18674. x: number;
  18675. y: number;
  18676. } | null): number;
  18677. /**
  18678. * @private
  18679. */
  18680. x: number;
  18681. /**
  18682. * @private
  18683. */
  18684. y: number;
  18685. /**
  18686. * - The polygon vertices.
  18687. * @version DragonBones 5.1
  18688. * @language en_US
  18689. */
  18690. /**
  18691. * - 多边形顶点。
  18692. * @version DragonBones 5.1
  18693. * @language zh_CN
  18694. */
  18695. readonly vertices: Array<number>;
  18696. /**
  18697. * @private
  18698. */
  18699. weight: WeightData | null;
  18700. /**
  18701. * @inheritDoc
  18702. * @private
  18703. */
  18704. protected _onClear(): void;
  18705. /**
  18706. * @inheritDoc
  18707. */
  18708. containsPoint(pX: number, pY: number): boolean;
  18709. /**
  18710. * @inheritDoc
  18711. */
  18712. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  18713. x: number;
  18714. y: number;
  18715. } | null, intersectionPointB?: {
  18716. x: number;
  18717. y: number;
  18718. } | null, normalRadians?: {
  18719. x: number;
  18720. y: number;
  18721. } | null): number;
  18722. }
  18723. }
  18724. /**
  18725. * The MIT License (MIT)
  18726. *
  18727. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18728. *
  18729. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18730. * this software and associated documentation files (the "Software"), to deal in
  18731. * the Software without restriction, including without limitation the rights to
  18732. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18733. * the Software, and to permit persons to whom the Software is furnished to do so,
  18734. * subject to the following conditions:
  18735. *
  18736. * The above copyright notice and this permission notice shall be included in all
  18737. * copies or substantial portions of the Software.
  18738. *
  18739. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18740. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18741. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18742. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18743. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18744. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18745. */
  18746. declare namespace dragonBones {
  18747. /**
  18748. * - The animation data.
  18749. * @version DragonBones 3.0
  18750. * @language en_US
  18751. */
  18752. /**
  18753. * - 动画数据。
  18754. * @version DragonBones 3.0
  18755. * @language zh_CN
  18756. */
  18757. class AnimationData extends BaseObject {
  18758. static toString(): string;
  18759. /**
  18760. * - FrameIntArray.
  18761. * @internal
  18762. * @private
  18763. */
  18764. frameIntOffset: number;
  18765. /**
  18766. * - FrameFloatArray.
  18767. * @internal
  18768. * @private
  18769. */
  18770. frameFloatOffset: number;
  18771. /**
  18772. * - FrameArray.
  18773. * @internal
  18774. * @private
  18775. */
  18776. frameOffset: number;
  18777. /**
  18778. * - The frame count of the animation.
  18779. * @version DragonBones 3.0
  18780. * @language en_US
  18781. */
  18782. /**
  18783. * - 动画的帧数。
  18784. * @version DragonBones 3.0
  18785. * @language zh_CN
  18786. */
  18787. frameCount: number;
  18788. /**
  18789. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  18790. * @version DragonBones 3.0
  18791. * @language en_US
  18792. */
  18793. /**
  18794. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  18795. * @version DragonBones 3.0
  18796. * @language zh_CN
  18797. */
  18798. playTimes: number;
  18799. /**
  18800. * - The duration of the animation. (In seconds)
  18801. * @version DragonBones 3.0
  18802. * @language en_US
  18803. */
  18804. /**
  18805. * - 动画的持续时间。 (以秒为单位)
  18806. * @version DragonBones 3.0
  18807. * @language zh_CN
  18808. */
  18809. duration: number;
  18810. /**
  18811. * @private
  18812. */
  18813. scale: number;
  18814. /**
  18815. * - The fade in time of the animation. (In seconds)
  18816. * @version DragonBones 3.0
  18817. * @language en_US
  18818. */
  18819. /**
  18820. * - 动画的淡入时间。 (以秒为单位)
  18821. * @version DragonBones 3.0
  18822. * @language zh_CN
  18823. */
  18824. fadeInTime: number;
  18825. /**
  18826. * @private
  18827. */
  18828. cacheFrameRate: number;
  18829. /**
  18830. * - The animation name.
  18831. * @version DragonBones 3.0
  18832. * @language en_US
  18833. */
  18834. /**
  18835. * - 动画名称。
  18836. * @version DragonBones 3.0
  18837. * @language zh_CN
  18838. */
  18839. name: string;
  18840. /**
  18841. * @private
  18842. */
  18843. readonly cachedFrames: Array<boolean>;
  18844. /**
  18845. * @private
  18846. */
  18847. readonly boneTimelines: Map<Array<TimelineData>>;
  18848. /**
  18849. * @private
  18850. */
  18851. readonly surfaceTimelines: Map<Array<TimelineData>>;
  18852. /**
  18853. * @private
  18854. */
  18855. readonly slotTimelines: Map<Array<TimelineData>>;
  18856. /**
  18857. * @private
  18858. */
  18859. readonly constraintTimelines: Map<Array<TimelineData>>;
  18860. /**
  18861. * @private
  18862. */
  18863. readonly animationTimelines: Map<Array<TimelineData>>;
  18864. /**
  18865. * @private
  18866. */
  18867. readonly boneCachedFrameIndices: Map<Array<number>>;
  18868. /**
  18869. * @private
  18870. */
  18871. readonly slotCachedFrameIndices: Map<Array<number>>;
  18872. /**
  18873. * @private
  18874. */
  18875. actionTimeline: TimelineData | null;
  18876. /**
  18877. * @private
  18878. */
  18879. zOrderTimeline: TimelineData | null;
  18880. /**
  18881. * @private
  18882. */
  18883. parent: ArmatureData;
  18884. /**
  18885. * @inheritDoc
  18886. */
  18887. protected _onClear(): void;
  18888. /**
  18889. * @internal
  18890. * @private
  18891. */
  18892. cacheFrames(frameRate: number): void;
  18893. /**
  18894. * @private
  18895. */
  18896. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  18897. /**
  18898. * @private
  18899. */
  18900. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  18901. /**
  18902. * @private
  18903. */
  18904. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  18905. /**
  18906. * @private
  18907. */
  18908. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  18909. /**
  18910. * @private
  18911. */
  18912. addAnimationTimeline(name: string, timeline: TimelineData): void;
  18913. /**
  18914. * @private
  18915. */
  18916. getBoneTimelines(name: string): Array<TimelineData> | null;
  18917. /**
  18918. * @private
  18919. */
  18920. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  18921. /**
  18922. * @private
  18923. */
  18924. getSlotTimelines(name: string): Array<TimelineData> | null;
  18925. /**
  18926. * @private
  18927. */
  18928. getConstraintTimelines(name: string): Array<TimelineData> | null;
  18929. /**
  18930. * @private
  18931. */
  18932. getAnimationTimelines(name: string): Array<TimelineData> | null;
  18933. /**
  18934. * @private
  18935. */
  18936. getBoneCachedFrameIndices(name: string): Array<number> | null;
  18937. /**
  18938. * @private
  18939. */
  18940. getSlotCachedFrameIndices(name: string): Array<number> | null;
  18941. }
  18942. /**
  18943. * @internal
  18944. * @private
  18945. */
  18946. class TimelineData extends BaseObject {
  18947. static toString(): string;
  18948. type: TimelineType;
  18949. offset: number;
  18950. frameIndicesOffset: number;
  18951. protected _onClear(): void;
  18952. }
  18953. }
  18954. /**
  18955. * The MIT License (MIT)
  18956. *
  18957. * Copyright (c) 2012-2017 DragonBones team and other contributors
  18958. *
  18959. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  18960. * this software and associated documentation files (the "Software"), to deal in
  18961. * the Software without restriction, including without limitation the rights to
  18962. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  18963. * the Software, and to permit persons to whom the Software is furnished to do so,
  18964. * subject to the following conditions:
  18965. *
  18966. * The above copyright notice and this permission notice shall be included in all
  18967. * copies or substantial portions of the Software.
  18968. *
  18969. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18970. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18971. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18972. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18973. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18974. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18975. */
  18976. declare namespace dragonBones {
  18977. /**
  18978. * - The animation config is used to describe all the information needed to play an animation state.
  18979. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  18980. * @see dragonBones.AnimationState
  18981. * @beta
  18982. * @version DragonBones 5.0
  18983. * @language en_US
  18984. */
  18985. /**
  18986. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  18987. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  18988. * @see dragonBones.AnimationState
  18989. * @beta
  18990. * @version DragonBones 5.0
  18991. * @language zh_CN
  18992. */
  18993. class AnimationConfig extends BaseObject {
  18994. static toString(): string;
  18995. /**
  18996. * @private
  18997. */
  18998. pauseFadeOut: boolean;
  18999. /**
  19000. * - Fade out the pattern of other animation states when the animation state is fade in.
  19001. * This property is typically used to specify the substitution of multiple animation states blend.
  19002. * @default dragonBones.AnimationFadeOutMode.All
  19003. * @version DragonBones 5.0
  19004. * @language en_US
  19005. */
  19006. /**
  19007. * - 淡入动画状态时淡出其他动画状态的模式。
  19008. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  19009. * @default dragonBones.AnimationFadeOutMode.All
  19010. * @version DragonBones 5.0
  19011. * @language zh_CN
  19012. */
  19013. fadeOutMode: AnimationFadeOutMode;
  19014. /**
  19015. * @private
  19016. */
  19017. fadeOutTweenType: TweenType;
  19018. /**
  19019. * @private
  19020. */
  19021. fadeOutTime: number;
  19022. /**
  19023. * @private
  19024. */
  19025. pauseFadeIn: boolean;
  19026. /**
  19027. * @private
  19028. */
  19029. actionEnabled: boolean;
  19030. /**
  19031. * @private
  19032. */
  19033. additiveBlending: boolean;
  19034. /**
  19035. * - Whether the animation state has control over the display property of the slots.
  19036. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  19037. * especially if other animation state are controlling the display properties of the slots.
  19038. * @default true
  19039. * @version DragonBones 5.0
  19040. * @language en_US
  19041. */
  19042. /**
  19043. * - 动画状态是否对插槽的显示对象属性有控制权。
  19044. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  19045. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  19046. * @default true
  19047. * @version DragonBones 5.0
  19048. * @language zh_CN
  19049. */
  19050. displayControl: boolean;
  19051. /**
  19052. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  19053. * This property should usually be set to false when blend multiple animation states.
  19054. * @default true
  19055. * @version DragonBones 5.1
  19056. * @language en_US
  19057. */
  19058. /**
  19059. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  19060. * 通常在混合多个动画状态时应该将该属性设置为 false。
  19061. * @default true
  19062. * @version DragonBones 5.1
  19063. * @language zh_CN
  19064. */
  19065. resetToPose: boolean;
  19066. /**
  19067. * @private
  19068. */
  19069. fadeInTweenType: TweenType;
  19070. /**
  19071. * - The play times. [0: Loop play, [1~N]: Play N times]
  19072. * @version DragonBones 3.0
  19073. * @language en_US
  19074. */
  19075. /**
  19076. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  19077. * @version DragonBones 3.0
  19078. * @language zh_CN
  19079. */
  19080. playTimes: number;
  19081. /**
  19082. * - The blend layer.
  19083. * High layer animation state will get the blend weight first.
  19084. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  19085. * @readonly
  19086. * @version DragonBones 5.0
  19087. * @language en_US
  19088. */
  19089. /**
  19090. * - 混合图层。
  19091. * 图层高的动画状态会优先获取混合权重。
  19092. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  19093. * @readonly
  19094. * @version DragonBones 5.0
  19095. * @language zh_CN
  19096. */
  19097. layer: number;
  19098. /**
  19099. * - The start time of play. (In seconds)
  19100. * @default 0.0
  19101. * @version DragonBones 5.0
  19102. * @language en_US
  19103. */
  19104. /**
  19105. * - 播放的开始时间。 (以秒为单位)
  19106. * @default 0.0
  19107. * @version DragonBones 5.0
  19108. * @language zh_CN
  19109. */
  19110. position: number;
  19111. /**
  19112. * - The duration of play.
  19113. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  19114. * @default -1.0
  19115. * @version DragonBones 5.0
  19116. * @language en_US
  19117. */
  19118. /**
  19119. * - 播放的持续时间。
  19120. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  19121. * @default -1.0
  19122. * @version DragonBones 5.0
  19123. * @language zh_CN
  19124. */
  19125. duration: number;
  19126. /**
  19127. * - The play speed.
  19128. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  19129. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  19130. * @default 1.0
  19131. * @version DragonBones 3.0
  19132. * @language en_US
  19133. */
  19134. /**
  19135. * - 播放速度。
  19136. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  19137. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  19138. * @default 1.0
  19139. * @version DragonBones 3.0
  19140. * @language zh_CN
  19141. */
  19142. timeScale: number;
  19143. /**
  19144. * - The blend weight.
  19145. * @default 1.0
  19146. * @version DragonBones 5.0
  19147. * @language en_US
  19148. */
  19149. /**
  19150. * - 混合权重。
  19151. * @default 1.0
  19152. * @version DragonBones 5.0
  19153. * @language zh_CN
  19154. */
  19155. weight: number;
  19156. /**
  19157. * - The fade in time.
  19158. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  19159. * @default -1.0
  19160. * @version DragonBones 5.0
  19161. * @language en_US
  19162. */
  19163. /**
  19164. * - 淡入时间。
  19165. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  19166. * @default -1.0
  19167. * @version DragonBones 5.0
  19168. * @language zh_CN
  19169. */
  19170. fadeInTime: number;
  19171. /**
  19172. * - The auto fade out time when the animation state play completed.
  19173. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  19174. * @default -1.0
  19175. * @version DragonBones 5.0
  19176. * @language en_US
  19177. */
  19178. /**
  19179. * - 动画状态播放完成后的自动淡出时间。
  19180. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  19181. * @default -1.0
  19182. * @version DragonBones 5.0
  19183. * @language zh_CN
  19184. */
  19185. autoFadeOutTime: number;
  19186. /**
  19187. * - The name of the animation state. (Can be different from the name of the animation data)
  19188. * @version DragonBones 5.0
  19189. * @language en_US
  19190. */
  19191. /**
  19192. * - 动画状态名称。 (可以不同于动画数据)
  19193. * @version DragonBones 5.0
  19194. * @language zh_CN
  19195. */
  19196. name: string;
  19197. /**
  19198. * - The animation data name.
  19199. * @version DragonBones 5.0
  19200. * @language en_US
  19201. */
  19202. /**
  19203. * - 动画数据名称。
  19204. * @version DragonBones 5.0
  19205. * @language zh_CN
  19206. */
  19207. animation: string;
  19208. /**
  19209. * - The blend group name of the animation state.
  19210. * This property is typically used to specify the substitution of multiple animation states blend.
  19211. * @readonly
  19212. * @version DragonBones 5.0
  19213. * @language en_US
  19214. */
  19215. /**
  19216. * - 混合组名称。
  19217. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  19218. * @readonly
  19219. * @version DragonBones 5.0
  19220. * @language zh_CN
  19221. */
  19222. group: string;
  19223. /**
  19224. * @private
  19225. */
  19226. readonly boneMask: Array<string>;
  19227. /**
  19228. * @private
  19229. */
  19230. protected _onClear(): void;
  19231. /**
  19232. * @private
  19233. */
  19234. clear(): void;
  19235. /**
  19236. * @private
  19237. */
  19238. copyFrom(value: AnimationConfig): void;
  19239. /**
  19240. * @private
  19241. */
  19242. containsBoneMask(name: string): boolean;
  19243. /**
  19244. * @private
  19245. */
  19246. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  19247. /**
  19248. * @private
  19249. */
  19250. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  19251. }
  19252. }
  19253. /**
  19254. * The MIT License (MIT)
  19255. *
  19256. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19257. *
  19258. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19259. * this software and associated documentation files (the "Software"), to deal in
  19260. * the Software without restriction, including without limitation the rights to
  19261. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19262. * the Software, and to permit persons to whom the Software is furnished to do so,
  19263. * subject to the following conditions:
  19264. *
  19265. * The above copyright notice and this permission notice shall be included in all
  19266. * copies or substantial portions of the Software.
  19267. *
  19268. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19269. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19270. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19271. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19272. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19273. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19274. */
  19275. declare namespace dragonBones {
  19276. /**
  19277. * - The texture atlas data.
  19278. * @version DragonBones 3.0
  19279. * @language en_US
  19280. */
  19281. /**
  19282. * - 贴图集数据。
  19283. * @version DragonBones 3.0
  19284. * @language zh_CN
  19285. */
  19286. abstract class TextureAtlasData extends BaseObject {
  19287. /**
  19288. * @private
  19289. */
  19290. autoSearch: boolean;
  19291. /**
  19292. * @private
  19293. */
  19294. width: number;
  19295. /**
  19296. * @private
  19297. */
  19298. height: number;
  19299. /**
  19300. * @private
  19301. */
  19302. scale: number;
  19303. /**
  19304. * - The texture atlas name.
  19305. * @version DragonBones 3.0
  19306. * @language en_US
  19307. */
  19308. /**
  19309. * - 贴图集名称。
  19310. * @version DragonBones 3.0
  19311. * @language zh_CN
  19312. */
  19313. name: string;
  19314. /**
  19315. * - The image path of the texture atlas.
  19316. * @version DragonBones 3.0
  19317. * @language en_US
  19318. */
  19319. /**
  19320. * - 贴图集图片路径。
  19321. * @version DragonBones 3.0
  19322. * @language zh_CN
  19323. */
  19324. imagePath: string;
  19325. /**
  19326. * @private
  19327. */
  19328. readonly textures: Map<TextureData>;
  19329. /**
  19330. * @inheritDoc
  19331. */
  19332. protected _onClear(): void;
  19333. /**
  19334. * @private
  19335. */
  19336. copyFrom(value: TextureAtlasData): void;
  19337. /**
  19338. * @internal
  19339. * @private
  19340. */
  19341. abstract createTexture(): TextureData;
  19342. /**
  19343. * @internal
  19344. * @private
  19345. */
  19346. addTexture(value: TextureData): void;
  19347. /**
  19348. * @private
  19349. */
  19350. getTexture(name: string): TextureData | null;
  19351. }
  19352. /**
  19353. * @internal
  19354. * @private
  19355. */
  19356. abstract class TextureData extends BaseObject {
  19357. static createRectangle(): Rectangle;
  19358. rotated: boolean;
  19359. name: string;
  19360. readonly region: Rectangle;
  19361. parent: TextureAtlasData;
  19362. frame: Rectangle | null;
  19363. protected _onClear(): void;
  19364. copyFrom(value: TextureData): void;
  19365. }
  19366. }
  19367. /**
  19368. * The MIT License (MIT)
  19369. *
  19370. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19371. *
  19372. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19373. * this software and associated documentation files (the "Software"), to deal in
  19374. * the Software without restriction, including without limitation the rights to
  19375. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19376. * the Software, and to permit persons to whom the Software is furnished to do so,
  19377. * subject to the following conditions:
  19378. *
  19379. * The above copyright notice and this permission notice shall be included in all
  19380. * copies or substantial portions of the Software.
  19381. *
  19382. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19383. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19384. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19385. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19386. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19387. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19388. */
  19389. declare namespace dragonBones {
  19390. /**
  19391. * - The armature proxy interface, the docking engine needs to implement it concretely.
  19392. * @see dragonBones.Armature
  19393. * @version DragonBones 5.0
  19394. * @language en_US
  19395. */
  19396. /**
  19397. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  19398. * @see dragonBones.Armature
  19399. * @version DragonBones 5.0
  19400. * @language zh_CN
  19401. */
  19402. interface IArmatureProxy extends IEventDispatcher {
  19403. /**
  19404. * @internal
  19405. * @private
  19406. */
  19407. dbInit(armature: Armature): void;
  19408. /**
  19409. * @internal
  19410. * @private
  19411. */
  19412. dbClear(): void;
  19413. /**
  19414. * @internal
  19415. * @private
  19416. */
  19417. dbUpdate(): void;
  19418. /**
  19419. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  19420. * @example
  19421. * <pre>
  19422. * removeChild(armatureDisplay);
  19423. * armatureDisplay.dispose();
  19424. * </pre>
  19425. * @version DragonBones 4.5
  19426. * @language en_US
  19427. */
  19428. /**
  19429. * - 释放该实例和骨架。 (骨架会回收到对象池)
  19430. * @example
  19431. * <pre>
  19432. * removeChild(armatureDisplay);
  19433. * armatureDisplay.dispose();
  19434. * </pre>
  19435. * @version DragonBones 4.5
  19436. * @language zh_CN
  19437. */
  19438. dispose(disposeProxy: boolean): void;
  19439. /**
  19440. * - The armature.
  19441. * @version DragonBones 4.5
  19442. * @language en_US
  19443. */
  19444. /**
  19445. * - 骨架。
  19446. * @version DragonBones 4.5
  19447. * @language zh_CN
  19448. */
  19449. readonly armature: Armature;
  19450. /**
  19451. * - The animation player.
  19452. * @version DragonBones 3.0
  19453. * @language en_US
  19454. */
  19455. /**
  19456. * - 动画播放器。
  19457. * @version DragonBones 3.0
  19458. * @language zh_CN
  19459. */
  19460. readonly animation: Animation;
  19461. }
  19462. }
  19463. /**
  19464. * The MIT License (MIT)
  19465. *
  19466. * Copyright (c) 2012-2017 DragonBones team and other contributors
  19467. *
  19468. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  19469. * this software and associated documentation files (the "Software"), to deal in
  19470. * the Software without restriction, including without limitation the rights to
  19471. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19472. * the Software, and to permit persons to whom the Software is furnished to do so,
  19473. * subject to the following conditions:
  19474. *
  19475. * The above copyright notice and this permission notice shall be included in all
  19476. * copies or substantial portions of the Software.
  19477. *
  19478. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19479. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19480. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19481. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19482. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19483. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19484. */
  19485. declare namespace dragonBones {
  19486. /**
  19487. * - Armature is the core of the skeleton animation system.
  19488. * @see dragonBones.ArmatureData
  19489. * @see dragonBones.Bone
  19490. * @see dragonBones.Slot
  19491. * @see dragonBones.Animation
  19492. * @version DragonBones 3.0
  19493. * @language en_US
  19494. */
  19495. /**
  19496. * - 骨架是骨骼动画系统的核心。
  19497. * @see dragonBones.ArmatureData
  19498. * @see dragonBones.Bone
  19499. * @see dragonBones.Slot
  19500. * @see dragonBones.Animation
  19501. * @version DragonBones 3.0
  19502. * @language zh_CN
  19503. */
  19504. class Armature extends BaseObject implements IAnimatable {
  19505. static toString(): string;
  19506. private static _onSortSlots(a, b);
  19507. /**
  19508. * - Whether to inherit the animation control of the parent armature.
  19509. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  19510. * @default true
  19511. * @version DragonBones 4.5
  19512. * @language en_US
  19513. */
  19514. /**
  19515. * - 是否继承父骨架的动画控制。
  19516. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  19517. * @default true
  19518. * @version DragonBones 4.5
  19519. * @language zh_CN
  19520. */
  19521. inheritAnimation: boolean;
  19522. /**
  19523. * @private
  19524. */
  19525. userData: any;
  19526. private _lockUpdate;
  19527. private _bonesDirty;
  19528. private _slotsDirty;
  19529. private _zOrderDirty;
  19530. private _flipX;
  19531. private _flipY;
  19532. /**
  19533. * @internal
  19534. * @private
  19535. */
  19536. _cacheFrameIndex: number;
  19537. private readonly _bones;
  19538. private readonly _slots;
  19539. /**
  19540. * @internal
  19541. * @private
  19542. */
  19543. readonly _glueSlots: Array<Slot>;
  19544. /**
  19545. * @internal
  19546. * @private
  19547. */
  19548. readonly _constraints: Array<Constraint>;
  19549. private readonly _actions;
  19550. /**
  19551. * @internal
  19552. * @private
  19553. */
  19554. _armatureData: ArmatureData;
  19555. private _animation;
  19556. private _proxy;
  19557. private _display;
  19558. /**
  19559. * @internal
  19560. * @private
  19561. */
  19562. _replaceTextureAtlasData: TextureAtlasData | null;
  19563. private _replacedTexture;
  19564. /**
  19565. * @internal
  19566. * @private
  19567. */
  19568. _dragonBones: DragonBones;
  19569. private _clock;
  19570. /**
  19571. * @internal
  19572. * @private
  19573. */
  19574. _parent: Slot | null;
  19575. /**
  19576. * @private
  19577. */
  19578. protected _onClear(): void;
  19579. private _sortBones();
  19580. private _sortSlots();
  19581. /**
  19582. * @internal
  19583. * @private
  19584. */
  19585. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  19586. /**
  19587. * @internal
  19588. * @private
  19589. */
  19590. _addBoneToBoneList(value: Bone): void;
  19591. /**
  19592. * @internal
  19593. * @private
  19594. */
  19595. _removeBoneFromBoneList(value: Bone): void;
  19596. /**
  19597. * @internal
  19598. * @private
  19599. */
  19600. _addSlotToSlotList(value: Slot): void;
  19601. /**
  19602. * @internal
  19603. * @private
  19604. */
  19605. _removeSlotFromSlotList(value: Slot): void;
  19606. /**
  19607. * @internal
  19608. * @private
  19609. */
  19610. _bufferAction(action: ActionData, append: boolean): void;
  19611. /**
  19612. * - Dispose the armature. (Return to the object pool)
  19613. * @example
  19614. * <pre>
  19615. * removeChild(armature.display);
  19616. * armature.dispose();
  19617. * </pre>
  19618. * @version DragonBones 3.0
  19619. * @language en_US
  19620. */
  19621. /**
  19622. * - 释放骨架。 (回收到对象池)
  19623. * @example
  19624. * <pre>
  19625. * removeChild(armature.display);
  19626. * armature.dispose();
  19627. * </pre>
  19628. * @version DragonBones 3.0
  19629. * @language zh_CN
  19630. */
  19631. dispose(): void;
  19632. /**
  19633. * @internal
  19634. * @private
  19635. */
  19636. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  19637. /**
  19638. * @inheritDoc
  19639. */
  19640. advanceTime(passedTime: number): void;
  19641. /**
  19642. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  19643. * @param boneName - The bone name. (If not set, all bones will be update)
  19644. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  19645. * @see dragonBones.Bone#invalidUpdate()
  19646. * @see dragonBones.Slot#invalidUpdate()
  19647. * @version DragonBones 3.0
  19648. * @language en_US
  19649. */
  19650. /**
  19651. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  19652. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  19653. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  19654. * @see dragonBones.Bone#invalidUpdate()
  19655. * @see dragonBones.Slot#invalidUpdate()
  19656. * @version DragonBones 3.0
  19657. * @language zh_CN
  19658. */
  19659. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  19660. /**
  19661. * - Check whether a specific point is inside a custom bounding box in a slot.
  19662. * The coordinate system of the point is the inner coordinate system of the armature.
  19663. * Custom bounding boxes need to be customized in Dragonbones Pro.
  19664. * @param x - The horizontal coordinate of the point.
  19665. * @param y - The vertical coordinate of the point.
  19666. * @version DragonBones 5.0
  19667. * @language en_US
  19668. */
  19669. /**
  19670. * - 检查特定点是否在某个插槽的自定义边界框内。
  19671. * 点的坐标系为骨架内坐标系。
  19672. * 自定义边界框需要在 DragonBones Pro 中自定义。
  19673. * @param x - 点的水平坐标。
  19674. * @param y - 点的垂直坐标。
  19675. * @version DragonBones 5.0
  19676. * @language zh_CN
  19677. */
  19678. containsPoint(x: number, y: number): Slot | null;
  19679. /**
  19680. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  19681. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  19682. * Custom bounding boxes need to be customized in Dragonbones Pro.
  19683. * @param xA - The horizontal coordinate of the beginning of the segment.
  19684. * @param yA - The vertical coordinate of the beginning of the segment.
  19685. * @param xB - The horizontal coordinate of the end point of the segment.
  19686. * @param yB - The vertical coordinate of the end point of the segment.
  19687. * @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)
  19688. * @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)
  19689. * @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)
  19690. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  19691. * @version DragonBones 5.0
  19692. * @language en_US
  19693. */
  19694. /**
  19695. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  19696. * 线段和交点的坐标系均为骨架内坐标系。
  19697. * 自定义边界框需要在 DragonBones Pro 中自定义。
  19698. * @param xA - 线段起点的水平坐标。
  19699. * @param yA - 线段起点的垂直坐标。
  19700. * @param xB - 线段终点的水平坐标。
  19701. * @param yB - 线段终点的垂直坐标。
  19702. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  19703. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  19704. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  19705. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  19706. * @version DragonBones 5.0
  19707. * @language zh_CN
  19708. */
  19709. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  19710. x: number;
  19711. y: number;
  19712. } | null, intersectionPointB?: {
  19713. x: number;
  19714. y: number;
  19715. } | null, normalRadians?: {
  19716. x: number;
  19717. y: number;
  19718. } | null): Slot | null;
  19719. /**
  19720. * - Get a specific bone.
  19721. * @param name - The bone name.
  19722. * @see dragonBones.Bone
  19723. * @version DragonBones 3.0
  19724. * @language en_US
  19725. */
  19726. /**
  19727. * - 获取特定的骨骼。
  19728. * @param name - 骨骼名称。
  19729. * @see dragonBones.Bone
  19730. * @version DragonBones 3.0
  19731. * @language zh_CN
  19732. */
  19733. getBone(name: string): Bone | null;
  19734. /**
  19735. * - Get a specific bone by the display.
  19736. * @param display - The display object.
  19737. * @see dragonBones.Bone
  19738. * @version DragonBones 3.0
  19739. * @language en_US
  19740. */
  19741. /**
  19742. * - 通过显示对象获取特定的骨骼。
  19743. * @param display - 显示对象。
  19744. * @see dragonBones.Bone
  19745. * @version DragonBones 3.0
  19746. * @language zh_CN
  19747. */
  19748. getBoneByDisplay(display: any): Bone | null;
  19749. /**
  19750. * - Get a specific slot.
  19751. * @param name - The slot name.
  19752. * @see dragonBones.Slot
  19753. * @version DragonBones 3.0
  19754. * @language en_US
  19755. */
  19756. /**
  19757. * - 获取特定的插槽。
  19758. * @param name - 插槽名称。
  19759. * @see dragonBones.Slot
  19760. * @version DragonBones 3.0
  19761. * @language zh_CN
  19762. */
  19763. getSlot(name: string): Slot | null;
  19764. /**
  19765. * - Get a specific slot by the display.
  19766. * @param display - The display object.
  19767. * @see dragonBones.Slot
  19768. * @version DragonBones 3.0
  19769. * @language en_US
  19770. */
  19771. /**
  19772. * - 通过显示对象获取特定的插槽。
  19773. * @param display - 显示对象。
  19774. * @see dragonBones.Slot
  19775. * @version DragonBones 3.0
  19776. * @language zh_CN
  19777. */
  19778. getSlotByDisplay(display: any): Slot | null;
  19779. /**
  19780. * @deprecated
  19781. */
  19782. addBone(value: Bone, parentName: string): void;
  19783. /**
  19784. * @deprecated
  19785. */
  19786. addSlot(value: Slot, parentName: string): void;
  19787. /**
  19788. * @private
  19789. */
  19790. addConstraint(value: Constraint): void;
  19791. /**
  19792. * @deprecated
  19793. */
  19794. removeBone(value: Bone): void;
  19795. /**
  19796. * @deprecated
  19797. */
  19798. removeSlot(value: Slot): void;
  19799. /**
  19800. * - Get all bones.
  19801. * @see dragonBones.Bone
  19802. * @version DragonBones 3.0
  19803. * @language en_US
  19804. */
  19805. /**
  19806. * - 获取所有的骨骼。
  19807. * @see dragonBones.Bone
  19808. * @version DragonBones 3.0
  19809. * @language zh_CN
  19810. */
  19811. getBones(): Array<Bone>;
  19812. /**
  19813. * - Get all slots.
  19814. * @see dragonBones.Slot
  19815. * @version DragonBones 3.0
  19816. * @language en_US
  19817. */
  19818. /**
  19819. * - 获取所有的插槽。
  19820. * @see dragonBones.Slot
  19821. * @version DragonBones 3.0
  19822. * @language zh_CN
  19823. */
  19824. getSlots(): Array<Slot>;
  19825. /**
  19826. * - Whether to flip the armature horizontally.
  19827. * @version DragonBones 5.5
  19828. * @language en_US
  19829. */
  19830. /**
  19831. * - 是否将骨架水平翻转。
  19832. * @version DragonBones 5.5
  19833. * @language zh_CN
  19834. */
  19835. flipX: boolean;
  19836. /**
  19837. * - Whether to flip the armature vertically.
  19838. * @version DragonBones 5.5
  19839. * @language en_US
  19840. */
  19841. /**
  19842. * - 是否将骨架垂直翻转。
  19843. * @version DragonBones 5.5
  19844. * @language zh_CN
  19845. */
  19846. flipY: boolean;
  19847. /**
  19848. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  19849. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  19850. * 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.
  19851. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  19852. * @example
  19853. * <pre>
  19854. * armature.cacheFrameRate = 24;
  19855. * </pre>
  19856. * @see dragonBones.DragonBonesData#frameRate
  19857. * @see dragonBones.ArmatureData#frameRate
  19858. * @version DragonBones 4.5
  19859. * @language en_US
  19860. */
  19861. /**
  19862. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  19863. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  19864. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  19865. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  19866. * @example
  19867. * <pre>
  19868. * armature.cacheFrameRate = 24;
  19869. * </pre>
  19870. * @see dragonBones.DragonBonesData#frameRate
  19871. * @see dragonBones.ArmatureData#frameRate
  19872. * @version DragonBones 4.5
  19873. * @language zh_CN
  19874. */
  19875. cacheFrameRate: number;
  19876. /**
  19877. * - The armature name.
  19878. * @version DragonBones 3.0
  19879. * @language en_US
  19880. */
  19881. /**
  19882. * - 骨架名称。
  19883. * @version DragonBones 3.0
  19884. * @language zh_CN
  19885. */
  19886. readonly name: string;
  19887. /**
  19888. * - The armature data.
  19889. * @see dragonBones.ArmatureData
  19890. * @version DragonBones 4.5
  19891. * @language en_US
  19892. */
  19893. /**
  19894. * - 骨架数据。
  19895. * @see dragonBones.ArmatureData
  19896. * @version DragonBones 4.5
  19897. * @language zh_CN
  19898. */
  19899. readonly armatureData: ArmatureData;
  19900. /**
  19901. * - The animation player.
  19902. * @see dragonBones.Animation
  19903. * @version DragonBones 3.0
  19904. * @language en_US
  19905. */
  19906. /**
  19907. * - 动画播放器。
  19908. * @see dragonBones.Animation
  19909. * @version DragonBones 3.0
  19910. * @language zh_CN
  19911. */
  19912. readonly animation: Animation;
  19913. /**
  19914. * @pivate
  19915. */
  19916. readonly proxy: IArmatureProxy;
  19917. /**
  19918. * - The EventDispatcher instance of the armature.
  19919. * @version DragonBones 4.5
  19920. * @language en_US
  19921. */
  19922. /**
  19923. * - 该骨架的 EventDispatcher 实例。
  19924. * @version DragonBones 4.5
  19925. * @language zh_CN
  19926. */
  19927. readonly eventDispatcher: IEventDispatcher;
  19928. /**
  19929. * - The display container.
  19930. * The display of the slot is displayed as the parent.
  19931. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  19932. * @version DragonBones 3.0
  19933. * @language en_US
  19934. */
  19935. /**
  19936. * - 显示容器实例。
  19937. * 插槽的显示对象都会以此显示容器为父级。
  19938. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  19939. * @version DragonBones 3.0
  19940. * @language zh_CN
  19941. */
  19942. readonly display: any;
  19943. /**
  19944. * @private
  19945. */
  19946. replacedTexture: any;
  19947. /**
  19948. * @inheritDoc
  19949. */
  19950. clock: WorldClock | null;
  19951. /**
  19952. * - Get the parent slot which the armature belongs to.
  19953. * @see dragonBones.Slot
  19954. * @version DragonBones 4.5
  19955. * @language en_US
  19956. */
  19957. /**
  19958. * - 该骨架所属的父插槽。
  19959. * @see dragonBones.Slot
  19960. * @version DragonBones 4.5
  19961. * @language zh_CN
  19962. */
  19963. readonly parent: Slot | null;
  19964. /**
  19965. * @deprecated
  19966. * @private
  19967. */
  19968. replaceTexture(texture: any): void;
  19969. /**
  19970. * - Deprecated, please refer to {@link #eventDispatcher}.
  19971. * @deprecated
  19972. * @language en_US
  19973. */
  19974. /**
  19975. * - 已废弃,请参考 {@link #eventDispatcher}。
  19976. * @deprecated
  19977. * @language zh_CN
  19978. */
  19979. hasEventListener(type: EventStringType): boolean;
  19980. /**
  19981. * - Deprecated, please refer to {@link #eventDispatcher}.
  19982. * @deprecated
  19983. * @language en_US
  19984. */
  19985. /**
  19986. * - 已废弃,请参考 {@link #eventDispatcher}。
  19987. * @deprecated
  19988. * @language zh_CN
  19989. */
  19990. addEventListener(type: EventStringType, listener: Function, target: any): void;
  19991. /**
  19992. * - Deprecated, please refer to {@link #eventDispatcher}.
  19993. * @deprecated
  19994. * @language en_US
  19995. */
  19996. /**
  19997. * - 已废弃,请参考 {@link #eventDispatcher}。
  19998. * @deprecated
  19999. * @language zh_CN
  20000. */
  20001. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  20002. /**
  20003. * - Deprecated, please refer to {@link #cacheFrameRate}.
  20004. * @deprecated
  20005. * @language en_US
  20006. */
  20007. /**
  20008. * - 已废弃,请参考 {@link #cacheFrameRate}。
  20009. * @deprecated
  20010. * @language zh_CN
  20011. */
  20012. enableAnimationCache(frameRate: number): void;
  20013. /**
  20014. * - Deprecated, please refer to {@link #display}.
  20015. * @deprecated
  20016. * @language en_US
  20017. */
  20018. /**
  20019. * - 已废弃,请参考 {@link #display}。
  20020. * @deprecated
  20021. * @language zh_CN
  20022. */
  20023. getDisplay(): any;
  20024. }
  20025. }
  20026. /**
  20027. * The MIT License (MIT)
  20028. *
  20029. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20030. *
  20031. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20032. * this software and associated documentation files (the "Software"), to deal in
  20033. * the Software without restriction, including without limitation the rights to
  20034. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20035. * the Software, and to permit persons to whom the Software is furnished to do so,
  20036. * subject to the following conditions:
  20037. *
  20038. * The above copyright notice and this permission notice shall be included in all
  20039. * copies or substantial portions of the Software.
  20040. *
  20041. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20042. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20043. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20044. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20045. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20046. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20047. */
  20048. declare namespace dragonBones {
  20049. /**
  20050. * - The base class of the transform object.
  20051. * @see dragonBones.Transform
  20052. * @version DragonBones 4.5
  20053. * @language en_US
  20054. */
  20055. /**
  20056. * - 变换对象的基类。
  20057. * @see dragonBones.Transform
  20058. * @version DragonBones 4.5
  20059. * @language zh_CN
  20060. */
  20061. abstract class TransformObject extends BaseObject {
  20062. /**
  20063. * @private
  20064. */
  20065. protected static readonly _helpMatrix: Matrix;
  20066. /**
  20067. * @private
  20068. */
  20069. protected static readonly _helpTransform: Transform;
  20070. /**
  20071. * @private
  20072. */
  20073. protected static readonly _helpPoint: Point;
  20074. /**
  20075. * - A matrix relative to the armature coordinate system.
  20076. * @version DragonBones 3.0
  20077. * @language en_US
  20078. */
  20079. /**
  20080. * - 相对于骨架坐标系的矩阵。
  20081. * @version DragonBones 3.0
  20082. * @language zh_CN
  20083. */
  20084. readonly globalTransformMatrix: Matrix;
  20085. /**
  20086. * - A transform relative to the armature coordinate system.
  20087. * @see #updateGlobalTransform()
  20088. * @version DragonBones 3.0
  20089. * @language en_US
  20090. */
  20091. /**
  20092. * - 相对于骨架坐标系的变换。
  20093. * @see #updateGlobalTransform()
  20094. * @version DragonBones 3.0
  20095. * @language zh_CN
  20096. */
  20097. readonly global: Transform;
  20098. /**
  20099. * - The offset transform relative to the armature or the parent bone coordinate system.
  20100. * @see #dragonBones.Bone#invalidUpdate()
  20101. * @version DragonBones 3.0
  20102. * @language en_US
  20103. */
  20104. /**
  20105. * - 相对于骨架或父骨骼坐标系的偏移变换。
  20106. * @see #dragonBones.Bone#invalidUpdate()
  20107. * @version DragonBones 3.0
  20108. * @language zh_CN
  20109. */
  20110. readonly offset: Transform;
  20111. /**
  20112. * @private
  20113. */
  20114. origin: Transform | null;
  20115. /**
  20116. * @private
  20117. */
  20118. userData: any;
  20119. /**
  20120. * @private
  20121. */
  20122. protected _globalDirty: boolean;
  20123. /**
  20124. * @internal
  20125. * @private
  20126. */
  20127. _armature: Armature;
  20128. /**
  20129. * @internal
  20130. * @private
  20131. */
  20132. _parent: Bone;
  20133. /**
  20134. * @private
  20135. */
  20136. protected _onClear(): void;
  20137. /**
  20138. * @internal
  20139. * @private
  20140. */
  20141. _setArmature(value: Armature | null): void;
  20142. /**
  20143. * @internal
  20144. * @private
  20145. */
  20146. _setParent(value: Bone | null): void;
  20147. /**
  20148. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  20149. * some engines do not rely on these attributes to update rendering, such as Egret.
  20150. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  20151. * @example
  20152. * <pre>
  20153. * bone.updateGlobalTransform();
  20154. * let rotation = bone.global.rotation;
  20155. * </pre>
  20156. * @version DragonBones 3.0
  20157. * @language en_US
  20158. */
  20159. /**
  20160. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  20161. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  20162. * @example
  20163. * <pre>
  20164. * bone.updateGlobalTransform();
  20165. * let rotation = bone.global.rotation;
  20166. * </pre>
  20167. * @version DragonBones 3.0
  20168. * @language zh_CN
  20169. */
  20170. updateGlobalTransform(): void;
  20171. /**
  20172. * - The armature to which it belongs.
  20173. * @version DragonBones 3.0
  20174. * @language en_US
  20175. */
  20176. /**
  20177. * - 所属的骨架。
  20178. * @version DragonBones 3.0
  20179. * @language zh_CN
  20180. */
  20181. readonly armature: Armature;
  20182. /**
  20183. * - The parent bone to which it belongs.
  20184. * @version DragonBones 3.0
  20185. * @language en_US
  20186. */
  20187. /**
  20188. * - 所属的父骨骼。
  20189. * @version DragonBones 3.0
  20190. * @language zh_CN
  20191. */
  20192. readonly parent: Bone;
  20193. }
  20194. }
  20195. /**
  20196. * The MIT License (MIT)
  20197. *
  20198. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20199. *
  20200. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20201. * this software and associated documentation files (the "Software"), to deal in
  20202. * the Software without restriction, including without limitation the rights to
  20203. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20204. * the Software, and to permit persons to whom the Software is furnished to do so,
  20205. * subject to the following conditions:
  20206. *
  20207. * The above copyright notice and this permission notice shall be included in all
  20208. * copies or substantial portions of the Software.
  20209. *
  20210. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20211. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20212. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20213. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20214. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20215. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20216. */
  20217. declare namespace dragonBones {
  20218. /**
  20219. * - Bone is one of the most important logical units in the armature animation system,
  20220. * and is responsible for the realization of translate, rotation, scaling in the animations.
  20221. * A armature can contain multiple bones.
  20222. * @see dragonBones.BoneData
  20223. * @see dragonBones.Armature
  20224. * @see dragonBones.Slot
  20225. * @version DragonBones 3.0
  20226. * @language en_US
  20227. */
  20228. /**
  20229. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  20230. * 一个骨架中可以包含多个骨骼。
  20231. * @see dragonBones.BoneData
  20232. * @see dragonBones.Armature
  20233. * @see dragonBones.Slot
  20234. * @version DragonBones 3.0
  20235. * @language zh_CN
  20236. */
  20237. class Bone extends TransformObject {
  20238. static toString(): string;
  20239. /**
  20240. * - The offset mode.
  20241. * @see #offset
  20242. * @version DragonBones 5.5
  20243. * @language en_US
  20244. */
  20245. /**
  20246. * - 偏移模式。
  20247. * @see #offset
  20248. * @version DragonBones 5.5
  20249. * @language zh_CN
  20250. */
  20251. offsetMode: OffsetMode;
  20252. /**
  20253. * @internal
  20254. * @private
  20255. */
  20256. readonly animationPose: Transform;
  20257. /**
  20258. * @internal
  20259. * @private
  20260. */
  20261. _transformDirty: boolean;
  20262. /**
  20263. * @internal
  20264. * @private
  20265. */
  20266. _childrenTransformDirty: boolean;
  20267. protected _localDirty: boolean;
  20268. /**
  20269. * @internal
  20270. * @private
  20271. */
  20272. _hasConstraint: boolean;
  20273. private _visible;
  20274. protected _cachedFrameIndex: number;
  20275. /**
  20276. * @internal
  20277. * @private
  20278. */
  20279. readonly _blendState: BlendState;
  20280. /**
  20281. * @internal
  20282. * @private
  20283. */
  20284. _boneData: BoneData;
  20285. /**
  20286. * @internal
  20287. * @private
  20288. */
  20289. _cachedFrameIndices: Array<number> | null;
  20290. /**
  20291. * @inheritDoc
  20292. */
  20293. protected _onClear(): void;
  20294. /**
  20295. * @private
  20296. */
  20297. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  20298. /**
  20299. * @inheritDoc
  20300. */
  20301. _setArmature(value: Armature | null): void;
  20302. /**
  20303. * @internal
  20304. * @private
  20305. */
  20306. init(boneData: BoneData): void;
  20307. /**
  20308. * @internal
  20309. * @private
  20310. */
  20311. update(cacheFrameIndex: number): void;
  20312. /**
  20313. * @internal
  20314. * @private
  20315. */
  20316. updateByConstraint(): void;
  20317. /**
  20318. * - Forces the bone to update the transform in the next frame.
  20319. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  20320. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  20321. * @example
  20322. * <pre>
  20323. * let bone = armature.getBone("arm");
  20324. * bone.offset.scaleX = 2.0;
  20325. * bone.invalidUpdate();
  20326. * </pre>
  20327. * @version DragonBones 3.0
  20328. * @language en_US
  20329. */
  20330. /**
  20331. * - 强制骨骼在下一帧更新变换。
  20332. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  20333. * @example
  20334. * <pre>
  20335. * let bone = armature.getBone("arm");
  20336. * bone.offset.scaleX = 2.0;
  20337. * bone.invalidUpdate();
  20338. * </pre>
  20339. * @version DragonBones 3.0
  20340. * @language zh_CN
  20341. */
  20342. invalidUpdate(): void;
  20343. /**
  20344. * - Check whether the bone contains a specific bone or slot.
  20345. * @see dragonBones.Bone
  20346. * @see dragonBones.Slot
  20347. * @version DragonBones 3.0
  20348. * @language en_US
  20349. */
  20350. /**
  20351. * - 检查该骨骼是否包含特定的骨骼或插槽。
  20352. * @see dragonBones.Bone
  20353. * @see dragonBones.Slot
  20354. * @version DragonBones 3.0
  20355. * @language zh_CN
  20356. */
  20357. contains(value: TransformObject): boolean;
  20358. /**
  20359. * - The bone data.
  20360. * @version DragonBones 4.5
  20361. * @language en_US
  20362. */
  20363. /**
  20364. * - 骨骼数据。
  20365. * @version DragonBones 4.5
  20366. * @language zh_CN
  20367. */
  20368. readonly boneData: BoneData;
  20369. /**
  20370. * - The visible of all slots in the bone.
  20371. * @default true
  20372. * @see dragonBones.Slot#visible
  20373. * @version DragonBones 3.0
  20374. * @language en_US
  20375. */
  20376. /**
  20377. * - 此骨骼所有插槽的可见。
  20378. * @default true
  20379. * @see dragonBones.Slot#visible
  20380. * @version DragonBones 3.0
  20381. * @language zh_CN
  20382. */
  20383. visible: boolean;
  20384. /**
  20385. * - The bone name.
  20386. * @version DragonBones 3.0
  20387. * @language en_US
  20388. */
  20389. /**
  20390. * - 骨骼名称。
  20391. * @version DragonBones 3.0
  20392. * @language zh_CN
  20393. */
  20394. readonly name: string;
  20395. /**
  20396. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  20397. * @deprecated
  20398. * @language en_US
  20399. */
  20400. /**
  20401. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  20402. * @deprecated
  20403. * @language zh_CN
  20404. */
  20405. getBones(): Array<Bone>;
  20406. /**
  20407. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  20408. * @deprecated
  20409. * @language en_US
  20410. */
  20411. /**
  20412. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  20413. * @deprecated
  20414. * @language zh_CN
  20415. */
  20416. getSlots(): Array<Slot>;
  20417. /**
  20418. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  20419. * @deprecated
  20420. * @language en_US
  20421. */
  20422. /**
  20423. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  20424. * @deprecated
  20425. * @language zh_CN
  20426. */
  20427. readonly slot: Slot | null;
  20428. }
  20429. }
  20430. /**
  20431. * The MIT License (MIT)
  20432. *
  20433. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20434. *
  20435. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20436. * this software and associated documentation files (the "Software"), to deal in
  20437. * the Software without restriction, including without limitation the rights to
  20438. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20439. * the Software, and to permit persons to whom the Software is furnished to do so,
  20440. * subject to the following conditions:
  20441. *
  20442. * The above copyright notice and this permission notice shall be included in all
  20443. * copies or substantial portions of the Software.
  20444. *
  20445. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20446. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20447. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20448. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20449. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20450. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20451. */
  20452. declare namespace dragonBones {
  20453. /**
  20454. * @internal
  20455. * @private
  20456. */
  20457. class Surface extends Bone {
  20458. static toString(): string;
  20459. private _dX;
  20460. private _dY;
  20461. private _k;
  20462. private _kX;
  20463. private _kY;
  20464. /**
  20465. * For debug draw.
  20466. * @internal
  20467. * @private
  20468. */
  20469. readonly _vertices: Array<number>;
  20470. /**
  20471. * For timeline state.
  20472. * @internal
  20473. * @private
  20474. */
  20475. readonly _deformVertices: Array<number>;
  20476. /**
  20477. * x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y
  20478. */
  20479. private readonly _hullCache;
  20480. /**
  20481. * Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty]
  20482. */
  20483. private readonly _matrixCahce;
  20484. /**
  20485. * @inheritDoc
  20486. */
  20487. protected _onClear(): void;
  20488. private _getAffineTransform(x, y, lX, lY, aX, aY, bX, bY, cX, cY, transform, matrix, isDown);
  20489. private _updateVertices();
  20490. /**
  20491. * @private
  20492. */
  20493. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  20494. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  20495. init(surfaceData: SurfaceData): void;
  20496. /**
  20497. * @internal
  20498. * @private
  20499. */
  20500. update(cacheFrameIndex: number): void;
  20501. }
  20502. }
  20503. /**
  20504. * The MIT License (MIT)
  20505. *
  20506. * Copyright (c) 2012-2017 DragonBones team and other contributors
  20507. *
  20508. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  20509. * this software and associated documentation files (the "Software"), to deal in
  20510. * the Software without restriction, including without limitation the rights to
  20511. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  20512. * the Software, and to permit persons to whom the Software is furnished to do so,
  20513. * subject to the following conditions:
  20514. *
  20515. * The above copyright notice and this permission notice shall be included in all
  20516. * copies or substantial portions of the Software.
  20517. *
  20518. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20519. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  20520. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20521. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20522. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20523. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20524. */
  20525. declare namespace dragonBones {
  20526. /**
  20527. * - The slot attached to the armature, controls the display status and properties of the display object.
  20528. * A bone can contain multiple slots.
  20529. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  20530. * but you can toggle the display object into frame animation while the animation is playing.
  20531. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  20532. * and a custom other display object.
  20533. * @see dragonBones.Armature
  20534. * @see dragonBones.Bone
  20535. * @see dragonBones.SlotData
  20536. * @version DragonBones 3.0
  20537. * @language en_US
  20538. */
  20539. /**
  20540. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  20541. * 一个骨骼上可以包含多个插槽。
  20542. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  20543. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  20544. * @see dragonBones.Armature
  20545. * @see dragonBones.Bone
  20546. * @see dragonBones.SlotData
  20547. * @version DragonBones 3.0
  20548. * @language zh_CN
  20549. */
  20550. abstract class Slot extends TransformObject {
  20551. /**
  20552. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  20553. * @default null
  20554. * @see dragonBones.AnimationState#displayControl
  20555. * @see dragonBones.AnimationState#name
  20556. * @see dragonBones.AnimationState#group
  20557. * @version DragonBones 4.5
  20558. * @language en_US
  20559. */
  20560. /**
  20561. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  20562. * @default null
  20563. * @see dragonBones.AnimationState#displayControl
  20564. * @see dragonBones.AnimationState#name
  20565. * @see dragonBones.AnimationState#group
  20566. * @version DragonBones 4.5
  20567. * @language zh_CN
  20568. */
  20569. displayController: string | null;
  20570. /**
  20571. * @private
  20572. */
  20573. protected _displayDirty: boolean;
  20574. /**
  20575. * @private
  20576. */
  20577. protected _zOrderDirty: boolean;
  20578. /**
  20579. * @private
  20580. */
  20581. protected _visibleDirty: boolean;
  20582. /**
  20583. * @private
  20584. */
  20585. protected _blendModeDirty: boolean;
  20586. /**
  20587. * @internal
  20588. * @private
  20589. */
  20590. _colorDirty: boolean;
  20591. /**
  20592. * @internal
  20593. * @private
  20594. */
  20595. _meshDirty: boolean;
  20596. /**
  20597. * @private
  20598. */
  20599. protected _transformDirty: boolean;
  20600. /**
  20601. * @private
  20602. */
  20603. protected _visible: boolean;
  20604. /**
  20605. * @private
  20606. */
  20607. protected _blendMode: BlendMode;
  20608. /**
  20609. * @private
  20610. */
  20611. protected _displayIndex: number;
  20612. /**
  20613. * @private
  20614. */
  20615. protected _animationDisplayIndex: number;
  20616. /**
  20617. * @internal
  20618. * @private
  20619. */
  20620. _zOrder: number;
  20621. /**
  20622. * @private
  20623. */
  20624. protected _cachedFrameIndex: number;
  20625. /**
  20626. * @internal
  20627. * @private
  20628. */
  20629. _pivotX: number;
  20630. /**
  20631. * @internal
  20632. * @private
  20633. */
  20634. _pivotY: number;
  20635. /**
  20636. * @private
  20637. */
  20638. protected readonly _localMatrix: Matrix;
  20639. /**
  20640. * @internal
  20641. * @private
  20642. */
  20643. readonly _colorTransform: ColorTransform;
  20644. /**
  20645. * @internal
  20646. * @private
  20647. */
  20648. readonly _deformVertices: Array<number>;
  20649. /**
  20650. * @private
  20651. */
  20652. readonly _displayDatas: Array<DisplayData | null>;
  20653. /**
  20654. * @private
  20655. */
  20656. protected readonly _displayList: Array<any | Armature>;
  20657. /**
  20658. * @private
  20659. */
  20660. protected readonly _meshBones: Array<Bone | null>;
  20661. /**
  20662. * @private
  20663. */
  20664. protected readonly _meshSlots: Array<Slot | null>;
  20665. /**
  20666. * @internal
  20667. * @private
  20668. */
  20669. _slotData: SlotData;
  20670. /**
  20671. * @private
  20672. */
  20673. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  20674. /**
  20675. * @private
  20676. */
  20677. protected _displayData: DisplayData | null;
  20678. /**
  20679. * @private
  20680. */
  20681. protected _textureData: TextureData | null;
  20682. /**
  20683. * @internal
  20684. * @private
  20685. */
  20686. _meshData: MeshDisplayData | null;
  20687. /**
  20688. * @private
  20689. */
  20690. protected _boundingBoxData: BoundingBoxData | null;
  20691. /**
  20692. * @private
  20693. */
  20694. protected _rawDisplay: any;
  20695. /**
  20696. * @private
  20697. */
  20698. protected _meshDisplay: any;
  20699. /**
  20700. * @private
  20701. */
  20702. protected _display: any;
  20703. /**
  20704. * @private
  20705. */
  20706. protected _childArmature: Armature | null;
  20707. /**
  20708. * @internal
  20709. * @private
  20710. */
  20711. _cachedFrameIndices: Array<number> | null;
  20712. /**
  20713. * @inheritDoc
  20714. */
  20715. protected _onClear(): void;
  20716. /**
  20717. * @private
  20718. */
  20719. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  20720. /**
  20721. * @private
  20722. */
  20723. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  20724. /**
  20725. * @private
  20726. */
  20727. protected abstract _onUpdateDisplay(): void;
  20728. /**
  20729. * @private
  20730. */
  20731. protected abstract _addDisplay(): void;
  20732. /**
  20733. * @private
  20734. */
  20735. protected abstract _replaceDisplay(value: any): void;
  20736. /**
  20737. * @private
  20738. */
  20739. protected abstract _removeDisplay(): void;
  20740. /**
  20741. * @private
  20742. */
  20743. protected abstract _updateZOrder(): void;
  20744. /**
  20745. * @private
  20746. */
  20747. abstract _updateVisible(): void;
  20748. /**
  20749. * @private
  20750. */
  20751. protected abstract _updateBlendMode(): void;
  20752. /**
  20753. * @private
  20754. */
  20755. protected abstract _updateColor(): void;
  20756. /**
  20757. * @private
  20758. */
  20759. protected abstract _updateFrame(): void;
  20760. /**
  20761. * @private
  20762. */
  20763. protected abstract _updateMesh(): void;
  20764. /**
  20765. * @internal
  20766. * @private
  20767. */
  20768. abstract _updateGlueMesh(): void;
  20769. /**
  20770. * @private
  20771. */
  20772. protected abstract _updateTransform(): void;
  20773. /**
  20774. * @private
  20775. */
  20776. protected abstract _identityTransform(): void;
  20777. /**
  20778. * @private
  20779. */
  20780. protected _getDefaultRawDisplayData(): DisplayData | null;
  20781. /**
  20782. * @private
  20783. */
  20784. protected _updateDisplayData(): void;
  20785. /**
  20786. * @private
  20787. */
  20788. protected _updateDisplay(): void;
  20789. /**
  20790. * @private
  20791. */
  20792. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  20793. /**
  20794. * @private
  20795. */
  20796. protected _isMeshBonesUpdate(): boolean;
  20797. /**
  20798. * @inheritDoc
  20799. */
  20800. _setArmature(value: Armature | null): void;
  20801. /**
  20802. * @internal
  20803. * @private
  20804. */
  20805. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  20806. /**
  20807. * @internal
  20808. * @private
  20809. */
  20810. _setZorder(value: number): boolean;
  20811. /**
  20812. * @internal
  20813. * @private
  20814. */
  20815. _setColor(value: ColorTransform): boolean;
  20816. /**
  20817. * @internal
  20818. * @private
  20819. */
  20820. _setDisplayList(value: Array<any> | null): boolean;
  20821. /**
  20822. * @internal
  20823. * @private
  20824. */
  20825. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  20826. /**
  20827. * @internal
  20828. * @private
  20829. */
  20830. update(cacheFrameIndex: number): void;
  20831. /**
  20832. * @private
  20833. */
  20834. updateTransformAndMatrix(): void;
  20835. /**
  20836. * @private
  20837. */
  20838. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  20839. /**
  20840. * - Check whether a specific point is inside a custom bounding box in the slot.
  20841. * The coordinate system of the point is the inner coordinate system of the armature.
  20842. * Custom bounding boxes need to be customized in Dragonbones Pro.
  20843. * @param x - The horizontal coordinate of the point.
  20844. * @param y - The vertical coordinate of the point.
  20845. * @version DragonBones 5.0
  20846. * @language en_US
  20847. */
  20848. /**
  20849. * - 检查特定点是否在插槽的自定义边界框内。
  20850. * 点的坐标系为骨架内坐标系。
  20851. * 自定义边界框需要在 DragonBones Pro 中自定义。
  20852. * @param x - 点的水平坐标。
  20853. * @param y - 点的垂直坐标。
  20854. * @version DragonBones 5.0
  20855. * @language zh_CN
  20856. */
  20857. containsPoint(x: number, y: number): boolean;
  20858. /**
  20859. * - Check whether a specific segment intersects a custom bounding box for the slot.
  20860. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  20861. * Custom bounding boxes need to be customized in Dragonbones Pro.
  20862. * @param xA - The horizontal coordinate of the beginning of the segment.
  20863. * @param yA - The vertical coordinate of the beginning of the segment.
  20864. * @param xB - The horizontal coordinate of the end point of the segment.
  20865. * @param yB - The vertical coordinate of the end point of the segment.
  20866. * @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)
  20867. * @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)
  20868. * @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)
  20869. * @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]
  20870. * @version DragonBones 5.0
  20871. * @language en_US
  20872. */
  20873. /**
  20874. * - 检查特定线段是否与插槽的自定义边界框相交。
  20875. * 线段和交点的坐标系均为骨架内坐标系。
  20876. * 自定义边界框需要在 DragonBones Pro 中自定义。
  20877. * @param xA - 线段起点的水平坐标。
  20878. * @param yA - 线段起点的垂直坐标。
  20879. * @param xB - 线段终点的水平坐标。
  20880. * @param yB - 线段终点的垂直坐标。
  20881. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  20882. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  20883. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  20884. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  20885. * @version DragonBones 5.0
  20886. * @language zh_CN
  20887. */
  20888. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  20889. x: number;
  20890. y: number;
  20891. } | null, intersectionPointB?: {
  20892. x: number;
  20893. y: number;
  20894. } | null, normalRadians?: {
  20895. x: number;
  20896. y: number;
  20897. } | null): number;
  20898. /**
  20899. * - Forces the slot to update the state of the display object in the next frame.
  20900. * @version DragonBones 4.5
  20901. * @language en_US
  20902. */
  20903. /**
  20904. * - 强制插槽在下一帧更新显示对象的状态。
  20905. * @version DragonBones 4.5
  20906. * @language zh_CN
  20907. */
  20908. invalidUpdate(): void;
  20909. /**
  20910. * - The visible of slot's display object.
  20911. * @default true
  20912. * @version DragonBones 5.6
  20913. * @language en_US
  20914. */
  20915. /**
  20916. * - 插槽的显示对象的可见。
  20917. * @default true
  20918. * @version DragonBones 5.6
  20919. * @language zh_CN
  20920. */
  20921. visible: boolean;
  20922. /**
  20923. * - The index of the display object displayed in the display list.
  20924. * @example
  20925. * <pre>
  20926. * let slot = armature.getSlot("weapon");
  20927. * slot.displayIndex = 3;
  20928. * slot.displayController = "none";
  20929. * </pre>
  20930. * @version DragonBones 4.5
  20931. * @language en_US
  20932. */
  20933. /**
  20934. * - 此时显示的显示对象在显示列表中的索引。
  20935. * @example
  20936. * <pre>
  20937. * let slot = armature.getSlot("weapon");
  20938. * slot.displayIndex = 3;
  20939. * slot.displayController = "none";
  20940. * </pre>
  20941. * @version DragonBones 4.5
  20942. * @language zh_CN
  20943. */
  20944. displayIndex: number;
  20945. /**
  20946. * - The slot name.
  20947. * @see dragonBones.SlotData#name
  20948. * @version DragonBones 3.0
  20949. * @language en_US
  20950. */
  20951. /**
  20952. * - 插槽名称。
  20953. * @see dragonBones.SlotData#name
  20954. * @version DragonBones 3.0
  20955. * @language zh_CN
  20956. */
  20957. readonly name: string;
  20958. /**
  20959. * - Contains a display list of display objects or child armatures.
  20960. * @version DragonBones 3.0
  20961. * @language en_US
  20962. */
  20963. /**
  20964. * - 包含显示对象或子骨架的显示列表。
  20965. * @version DragonBones 3.0
  20966. * @language zh_CN
  20967. */
  20968. displayList: Array<any>;
  20969. /**
  20970. * - The slot data.
  20971. * @see dragonBones.SlotData
  20972. * @version DragonBones 4.5
  20973. * @language en_US
  20974. */
  20975. /**
  20976. * - 插槽数据。
  20977. * @see dragonBones.SlotData
  20978. * @version DragonBones 4.5
  20979. * @language zh_CN
  20980. */
  20981. readonly slotData: SlotData;
  20982. /**
  20983. * @private
  20984. */
  20985. rawDisplayDatas: Array<DisplayData | null> | null;
  20986. /**
  20987. * - The custom bounding box data for the slot at current time.
  20988. * @version DragonBones 5.0
  20989. * @language en_US
  20990. */
  20991. /**
  20992. * - 插槽此时的自定义包围盒数据。
  20993. * @version DragonBones 5.0
  20994. * @language zh_CN
  20995. */
  20996. readonly boundingBoxData: BoundingBoxData | null;
  20997. /**
  20998. * @private
  20999. */
  21000. readonly rawDisplay: any;
  21001. /**
  21002. * @private
  21003. */
  21004. readonly meshDisplay: any;
  21005. /**
  21006. * - The display object that the slot displays at this time.
  21007. * @example
  21008. * <pre>
  21009. * let slot = armature.getSlot("text");
  21010. * slot.display = new yourEngine.TextField();
  21011. * </pre>
  21012. * @version DragonBones 3.0
  21013. * @language en_US
  21014. */
  21015. /**
  21016. * - 插槽此时显示的显示对象。
  21017. * @example
  21018. * <pre>
  21019. * let slot = armature.getSlot("text");
  21020. * slot.display = new yourEngine.TextField();
  21021. * </pre>
  21022. * @version DragonBones 3.0
  21023. * @language zh_CN
  21024. */
  21025. display: any;
  21026. /**
  21027. * - The child armature that the slot displayed at current time.
  21028. * @example
  21029. * <pre>
  21030. * let slot = armature.getSlot("weapon");
  21031. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  21032. * </pre>
  21033. * @version DragonBones 3.0
  21034. * @language en_US
  21035. */
  21036. /**
  21037. * - 插槽此时显示的子骨架。
  21038. * @example
  21039. * <pre>
  21040. * let slot = armature.getSlot("weapon");
  21041. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  21042. * </pre>
  21043. * @version DragonBones 3.0
  21044. * @language zh_CN
  21045. */
  21046. childArmature: Armature | null;
  21047. /**
  21048. * - Deprecated, please refer to {@link #display}.
  21049. * @deprecated
  21050. * @language en_US
  21051. */
  21052. /**
  21053. * - 已废弃,请参考 {@link #display}。
  21054. * @deprecated
  21055. * @language zh_CN
  21056. */
  21057. getDisplay(): any;
  21058. /**
  21059. * - Deprecated, please refer to {@link #display}.
  21060. * @deprecated
  21061. * @language en_US
  21062. */
  21063. /**
  21064. * - 已废弃,请参考 {@link #display}。
  21065. * @deprecated
  21066. * @language zh_CN
  21067. */
  21068. setDisplay(value: any): void;
  21069. }
  21070. }
  21071. /**
  21072. * The MIT License (MIT)
  21073. *
  21074. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21075. *
  21076. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21077. * this software and associated documentation files (the "Software"), to deal in
  21078. * the Software without restriction, including without limitation the rights to
  21079. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21080. * the Software, and to permit persons to whom the Software is furnished to do so,
  21081. * subject to the following conditions:
  21082. *
  21083. * The above copyright notice and this permission notice shall be included in all
  21084. * copies or substantial portions of the Software.
  21085. *
  21086. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21087. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21088. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21089. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21090. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21091. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21092. */
  21093. declare namespace dragonBones {
  21094. /**
  21095. * @internal
  21096. * @private
  21097. */
  21098. abstract class Constraint extends BaseObject {
  21099. protected static readonly _helpMatrix: Matrix;
  21100. protected static readonly _helpTransform: Transform;
  21101. protected static readonly _helpPoint: Point;
  21102. /**
  21103. * - For timeline state.
  21104. * @internal
  21105. */
  21106. _constraintData: ConstraintData;
  21107. protected _armature: Armature;
  21108. /**
  21109. * - For sort bones.
  21110. * @internal
  21111. */
  21112. _target: Bone;
  21113. /**
  21114. * - For sort bones.
  21115. * @internal
  21116. */
  21117. _root: Bone;
  21118. protected _bone: Bone | null;
  21119. protected _onClear(): void;
  21120. abstract init(constraintData: ConstraintData, armature: Armature): void;
  21121. abstract update(): void;
  21122. abstract invalidUpdate(): void;
  21123. readonly name: string;
  21124. }
  21125. /**
  21126. * @internal
  21127. * @private
  21128. */
  21129. class IKConstraint extends Constraint {
  21130. static toString(): string;
  21131. private _scaleEnabled;
  21132. /**
  21133. * - For timeline state.
  21134. * @internal
  21135. */
  21136. _bendPositive: boolean;
  21137. /**
  21138. * - For timeline state.
  21139. * @internal
  21140. */
  21141. _weight: number;
  21142. protected _onClear(): void;
  21143. private _computeA();
  21144. private _computeB();
  21145. init(constraintData: ConstraintData, armature: Armature): void;
  21146. update(): void;
  21147. invalidUpdate(): void;
  21148. }
  21149. }
  21150. /**
  21151. * The MIT License (MIT)
  21152. *
  21153. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21154. *
  21155. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21156. * this software and associated documentation files (the "Software"), to deal in
  21157. * the Software without restriction, including without limitation the rights to
  21158. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21159. * the Software, and to permit persons to whom the Software is furnished to do so,
  21160. * subject to the following conditions:
  21161. *
  21162. * The above copyright notice and this permission notice shall be included in all
  21163. * copies or substantial portions of the Software.
  21164. *
  21165. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21166. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21167. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21168. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21169. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21170. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21171. */
  21172. declare namespace dragonBones {
  21173. /**
  21174. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  21175. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  21176. * @see dragonBones.WorldClock
  21177. * @see dragonBones.Armature
  21178. * @version DragonBones 3.0
  21179. * @language en_US
  21180. */
  21181. /**
  21182. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  21183. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  21184. * @see dragonBones.WorldClock
  21185. * @see dragonBones.Armature
  21186. * @version DragonBones 3.0
  21187. * @language zh_CN
  21188. */
  21189. interface IAnimatable {
  21190. /**
  21191. * - Advance time.
  21192. * @param passedTime - Passed time. (In seconds)
  21193. * @version DragonBones 3.0
  21194. * @language en_US
  21195. */
  21196. /**
  21197. * - 更新时间。
  21198. * @param passedTime - 前进的时间。 (以秒为单位)
  21199. * @version DragonBones 3.0
  21200. * @language zh_CN
  21201. */
  21202. advanceTime(passedTime: number): void;
  21203. /**
  21204. * - The Wordclock instance to which the current belongs.
  21205. * @example
  21206. * <pre>
  21207. * armature.clock = factory.clock; // Add armature to clock.
  21208. * armature.clock = null; // Remove armature from clock.
  21209. * </pre>
  21210. * @version DragonBones 5.0
  21211. * @language en_US
  21212. */
  21213. /**
  21214. * - 当前所属的 WordClock 实例。
  21215. * @example
  21216. * <pre>
  21217. * armature.clock = factory.clock; // 将骨架添加到时钟。
  21218. * armature.clock = null; // 将骨架从时钟移除。
  21219. * </pre>
  21220. * @version DragonBones 5.0
  21221. * @language zh_CN
  21222. */
  21223. clock: WorldClock | null;
  21224. }
  21225. }
  21226. /**
  21227. * The MIT License (MIT)
  21228. *
  21229. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21230. *
  21231. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21232. * this software and associated documentation files (the "Software"), to deal in
  21233. * the Software without restriction, including without limitation the rights to
  21234. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21235. * the Software, and to permit persons to whom the Software is furnished to do so,
  21236. * subject to the following conditions:
  21237. *
  21238. * The above copyright notice and this permission notice shall be included in all
  21239. * copies or substantial portions of the Software.
  21240. *
  21241. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21242. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21243. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21244. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21245. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21246. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21247. */
  21248. declare namespace dragonBones {
  21249. /**
  21250. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  21251. * @see dragonBones.IAnimateble
  21252. * @see dragonBones.Armature
  21253. * @version DragonBones 3.0
  21254. * @language en_US
  21255. */
  21256. /**
  21257. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  21258. * @see dragonBones.IAnimateble
  21259. * @see dragonBones.Armature
  21260. * @version DragonBones 3.0
  21261. * @language zh_CN
  21262. */
  21263. class WorldClock implements IAnimatable {
  21264. /**
  21265. * - Current time. (In seconds)
  21266. * @version DragonBones 3.0
  21267. * @language en_US
  21268. */
  21269. /**
  21270. * - 当前的时间。 (以秒为单位)
  21271. * @version DragonBones 3.0
  21272. * @language zh_CN
  21273. */
  21274. time: number;
  21275. /**
  21276. * - The play speed, used to control animation speed-shift play.
  21277. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  21278. * @default 1.0
  21279. * @version DragonBones 3.0
  21280. * @language en_US
  21281. */
  21282. /**
  21283. * - 播放速度,用于控制动画变速播放。
  21284. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  21285. * @default 1.0
  21286. * @version DragonBones 3.0
  21287. * @language zh_CN
  21288. */
  21289. timeScale: number;
  21290. private readonly _animatebles;
  21291. private _clock;
  21292. /**
  21293. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  21294. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  21295. * @version DragonBones 3.0
  21296. * @language en_US
  21297. */
  21298. /**
  21299. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  21300. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  21301. * @version DragonBones 3.0
  21302. * @language zh_CN
  21303. */
  21304. constructor(time?: number);
  21305. /**
  21306. * - Advance time for all IAnimatable instances.
  21307. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  21308. * @version DragonBones 3.0
  21309. * @language en_US
  21310. */
  21311. /**
  21312. * - 为所有的 IAnimatable 实例更新时间。
  21313. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  21314. * @version DragonBones 3.0
  21315. * @language zh_CN
  21316. */
  21317. advanceTime(passedTime: number): void;
  21318. /**
  21319. * - Check whether contains a specific instance of IAnimatable.
  21320. * @param value - The IAnimatable instance.
  21321. * @version DragonBones 3.0
  21322. * @language en_US
  21323. */
  21324. /**
  21325. * - 检查是否包含特定的 IAnimatable 实例。
  21326. * @param value - IAnimatable 实例。
  21327. * @version DragonBones 3.0
  21328. * @language zh_CN
  21329. */
  21330. contains(value: IAnimatable): boolean;
  21331. /**
  21332. * - Add IAnimatable instance.
  21333. * @param value - The IAnimatable instance.
  21334. * @version DragonBones 3.0
  21335. * @language en_US
  21336. */
  21337. /**
  21338. * - 添加 IAnimatable 实例。
  21339. * @param value - IAnimatable 实例。
  21340. * @version DragonBones 3.0
  21341. * @language zh_CN
  21342. */
  21343. add(value: IAnimatable): void;
  21344. /**
  21345. * - Removes a specified IAnimatable instance.
  21346. * @param value - The IAnimatable instance.
  21347. * @version DragonBones 3.0
  21348. * @language en_US
  21349. */
  21350. /**
  21351. * - 移除特定的 IAnimatable 实例。
  21352. * @param value - IAnimatable 实例。
  21353. * @version DragonBones 3.0
  21354. * @language zh_CN
  21355. */
  21356. remove(value: IAnimatable): void;
  21357. /**
  21358. * - Clear all IAnimatable instances.
  21359. * @version DragonBones 3.0
  21360. * @language en_US
  21361. */
  21362. /**
  21363. * - 清除所有的 IAnimatable 实例。
  21364. * @version DragonBones 3.0
  21365. * @language zh_CN
  21366. */
  21367. clear(): void;
  21368. /**
  21369. * @inheritDoc
  21370. */
  21371. clock: WorldClock | null;
  21372. /**
  21373. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  21374. * @deprecated
  21375. * @language en_US
  21376. */
  21377. /**
  21378. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  21379. * @deprecated
  21380. * @language zh_CN
  21381. */
  21382. static readonly clock: WorldClock;
  21383. }
  21384. }
  21385. /**
  21386. * The MIT License (MIT)
  21387. *
  21388. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21389. *
  21390. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21391. * this software and associated documentation files (the "Software"), to deal in
  21392. * the Software without restriction, including without limitation the rights to
  21393. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21394. * the Software, and to permit persons to whom the Software is furnished to do so,
  21395. * subject to the following conditions:
  21396. *
  21397. * The above copyright notice and this permission notice shall be included in all
  21398. * copies or substantial portions of the Software.
  21399. *
  21400. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21401. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21402. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21403. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21404. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21405. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21406. */
  21407. declare namespace dragonBones {
  21408. /**
  21409. * - The animation player is used to play the animation data and manage the animation states.
  21410. * @see dragonBones.AnimationData
  21411. * @see dragonBones.AnimationState
  21412. * @version DragonBones 3.0
  21413. * @language en_US
  21414. */
  21415. /**
  21416. * - 动画播放器用来播放动画数据和管理动画状态。
  21417. * @see dragonBones.AnimationData
  21418. * @see dragonBones.AnimationState
  21419. * @version DragonBones 3.0
  21420. * @language zh_CN
  21421. */
  21422. class Animation extends BaseObject {
  21423. static toString(): string;
  21424. /**
  21425. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  21426. * @default 1.0
  21427. * @version DragonBones 3.0
  21428. * @language en_US
  21429. */
  21430. /**
  21431. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  21432. * @default 1.0
  21433. * @version DragonBones 3.0
  21434. * @language zh_CN
  21435. */
  21436. timeScale: number;
  21437. private _lockUpdate;
  21438. private _animationDirty;
  21439. private _inheritTimeScale;
  21440. private readonly _animationNames;
  21441. private readonly _animationStates;
  21442. private readonly _animations;
  21443. private _armature;
  21444. private _animationConfig;
  21445. private _lastAnimationState;
  21446. /**
  21447. * @private
  21448. */
  21449. protected _onClear(): void;
  21450. private _fadeOut(animationConfig);
  21451. /**
  21452. * @internal
  21453. * @private
  21454. */
  21455. init(armature: Armature): void;
  21456. /**
  21457. * @internal
  21458. * @private
  21459. */
  21460. advanceTime(passedTime: number): void;
  21461. /**
  21462. * - Clear all animations states.
  21463. * @see dragonBones.AnimationState
  21464. * @version DragonBones 4.5
  21465. * @language en_US
  21466. */
  21467. /**
  21468. * - 清除所有的动画状态。
  21469. * @see dragonBones.AnimationState
  21470. * @version DragonBones 4.5
  21471. * @language zh_CN
  21472. */
  21473. reset(): void;
  21474. /**
  21475. * - Pause a specific animation state.
  21476. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  21477. * @see dragonBones.AnimationState
  21478. * @version DragonBones 3.0
  21479. * @language en_US
  21480. */
  21481. /**
  21482. * - 暂停指定动画状态的播放。
  21483. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  21484. * @see dragonBones.AnimationState
  21485. * @version DragonBones 3.0
  21486. * @language zh_CN
  21487. */
  21488. stop(animationName?: string | null): void;
  21489. /**
  21490. * - Play animation with a specific animation config.
  21491. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  21492. * @param animationConfig - The animation config.
  21493. * @returns The playing animation state.
  21494. * @see dragonBones.AnimationConfig
  21495. * @beta
  21496. * @version DragonBones 5.0
  21497. * @language en_US
  21498. */
  21499. /**
  21500. * - 通过指定的动画配置来播放动画。
  21501. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  21502. * @param animationConfig - 动画配置。
  21503. * @returns 播放的动画状态。
  21504. * @see dragonBones.AnimationConfig
  21505. * @beta
  21506. * @version DragonBones 5.0
  21507. * @language zh_CN
  21508. */
  21509. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  21510. /**
  21511. * - Play a specific animation.
  21512. * @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)
  21513. * @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)
  21514. * @returns The playing animation state.
  21515. * @example
  21516. * <pre>
  21517. * armature.animation.play("walk");
  21518. * </pre>
  21519. * @version DragonBones 3.0
  21520. * @language en_US
  21521. */
  21522. /**
  21523. * - 播放指定动画。
  21524. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  21525. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21526. * @returns 播放的动画状态。
  21527. * @example
  21528. * <pre>
  21529. * armature.animation.play("walk");
  21530. * </pre>
  21531. * @version DragonBones 3.0
  21532. * @language zh_CN
  21533. */
  21534. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  21535. /**
  21536. * - Fade in a specific animation.
  21537. * @param animationName - The name of animation data.
  21538. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  21539. * @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)
  21540. * @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)
  21541. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  21542. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  21543. * @returns The playing animation state.
  21544. * @example
  21545. * <pre>
  21546. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  21547. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  21548. * </pre>
  21549. * @version DragonBones 4.5
  21550. * @language en_US
  21551. */
  21552. /**
  21553. * - 淡入播放指定的动画。
  21554. * @param animationName - 动画数据名称。
  21555. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  21556. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21557. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  21558. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  21559. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  21560. * @returns 播放的动画状态。
  21561. * @example
  21562. * <pre>
  21563. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  21564. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  21565. * </pre>
  21566. * @version DragonBones 4.5
  21567. * @language zh_CN
  21568. */
  21569. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
  21570. /**
  21571. * - Play a specific animation from the specific time.
  21572. * @param animationName - The name of animation data.
  21573. * @param time - The start time point of playing. (In seconds)
  21574. * @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)
  21575. * @returns The played animation state.
  21576. * @version DragonBones 4.5
  21577. * @language en_US
  21578. */
  21579. /**
  21580. * - 从指定时间开始播放指定的动画。
  21581. * @param animationName - 动画数据名称。
  21582. * @param time - 播放开始的时间。 (以秒为单位)
  21583. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21584. * @returns 播放的动画状态。
  21585. * @version DragonBones 4.5
  21586. * @language zh_CN
  21587. */
  21588. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  21589. /**
  21590. * - Play a specific animation from the specific frame.
  21591. * @param animationName - The name of animation data.
  21592. * @param frame - The start frame of playing.
  21593. * @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)
  21594. * @returns The played animation state.
  21595. * @version DragonBones 4.5
  21596. * @language en_US
  21597. */
  21598. /**
  21599. * - 从指定帧开始播放指定的动画。
  21600. * @param animationName - 动画数据名称。
  21601. * @param frame - 播放开始的帧数。
  21602. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21603. * @returns 播放的动画状态。
  21604. * @version DragonBones 4.5
  21605. * @language zh_CN
  21606. */
  21607. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  21608. /**
  21609. * - Play a specific animation from the specific progress.
  21610. * @param animationName - The name of animation data.
  21611. * @param progress - The start progress value of playing.
  21612. * @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)
  21613. * @returns The played animation state.
  21614. * @version DragonBones 4.5
  21615. * @language en_US
  21616. */
  21617. /**
  21618. * - 从指定进度开始播放指定的动画。
  21619. * @param animationName - 动画数据名称。
  21620. * @param progress - 开始播放的进度。
  21621. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  21622. * @returns 播放的动画状态。
  21623. * @version DragonBones 4.5
  21624. * @language zh_CN
  21625. */
  21626. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  21627. /**
  21628. * - Stop a specific animation at the specific time.
  21629. * @param animationName - The name of animation data.
  21630. * @param time - The stop time. (In seconds)
  21631. * @returns The played animation state.
  21632. * @version DragonBones 4.5
  21633. * @language en_US
  21634. */
  21635. /**
  21636. * - 在指定时间停止指定动画播放
  21637. * @param animationName - 动画数据名称。
  21638. * @param time - 停止的时间。 (以秒为单位)
  21639. * @returns 播放的动画状态。
  21640. * @version DragonBones 4.5
  21641. * @language zh_CN
  21642. */
  21643. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  21644. /**
  21645. * - Stop a specific animation at the specific frame.
  21646. * @param animationName - The name of animation data.
  21647. * @param frame - The stop frame.
  21648. * @returns The played animation state.
  21649. * @version DragonBones 4.5
  21650. * @language en_US
  21651. */
  21652. /**
  21653. * - 在指定帧停止指定动画的播放
  21654. * @param animationName - 动画数据名称。
  21655. * @param frame - 停止的帧数。
  21656. * @returns 播放的动画状态。
  21657. * @version DragonBones 4.5
  21658. * @language zh_CN
  21659. */
  21660. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  21661. /**
  21662. * - Stop a specific animation at the specific progress.
  21663. * @param animationName - The name of animation data.
  21664. * @param progress - The stop progress value.
  21665. * @returns The played animation state.
  21666. * @version DragonBones 4.5
  21667. * @language en_US
  21668. */
  21669. /**
  21670. * - 在指定的进度停止指定的动画播放。
  21671. * @param animationName - 动画数据名称。
  21672. * @param progress - 停止进度。
  21673. * @returns 播放的动画状态。
  21674. * @version DragonBones 4.5
  21675. * @language zh_CN
  21676. */
  21677. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  21678. /**
  21679. * - Get a specific animation state.
  21680. * @param animationName - The name of animation state.
  21681. * @example
  21682. * <pre>
  21683. * armature.animation.play("walk");
  21684. * let walkState = armature.animation.getState("walk");
  21685. * walkState.timeScale = 0.5;
  21686. * </pre>
  21687. * @version DragonBones 3.0
  21688. * @language en_US
  21689. */
  21690. /**
  21691. * - 获取指定的动画状态
  21692. * @param animationName - 动画状态名称。
  21693. * @example
  21694. * <pre>
  21695. * armature.animation.play("walk");
  21696. * let walkState = armature.animation.getState("walk");
  21697. * walkState.timeScale = 0.5;
  21698. * </pre>
  21699. * @version DragonBones 3.0
  21700. * @language zh_CN
  21701. */
  21702. getState(animationName: string): AnimationState | null;
  21703. /**
  21704. * - Check whether a specific animation data is included.
  21705. * @param animationName - The name of animation data.
  21706. * @see dragonBones.AnimationData
  21707. * @version DragonBones 3.0
  21708. * @language en_US
  21709. */
  21710. /**
  21711. * - 检查是否包含指定的动画数据
  21712. * @param animationName - 动画数据名称。
  21713. * @see dragonBones.AnimationData
  21714. * @version DragonBones 3.0
  21715. * @language zh_CN
  21716. */
  21717. hasAnimation(animationName: string): boolean;
  21718. /**
  21719. * - Get all the animation states.
  21720. * @version DragonBones 5.1
  21721. * @language en_US
  21722. */
  21723. /**
  21724. * - 获取所有的动画状态
  21725. * @version DragonBones 5.1
  21726. * @language zh_CN
  21727. */
  21728. getStates(): Array<AnimationState>;
  21729. /**
  21730. * - Check whether there is an animation state is playing
  21731. * @see dragonBones.AnimationState
  21732. * @version DragonBones 3.0
  21733. * @language en_US
  21734. */
  21735. /**
  21736. * - 检查是否有动画状态正在播放
  21737. * @see dragonBones.AnimationState
  21738. * @version DragonBones 3.0
  21739. * @language zh_CN
  21740. */
  21741. readonly isPlaying: boolean;
  21742. /**
  21743. * - Check whether all the animation states' playing were finished.
  21744. * @see dragonBones.AnimationState
  21745. * @version DragonBones 3.0
  21746. * @language en_US
  21747. */
  21748. /**
  21749. * - 检查是否所有的动画状态均已播放完毕。
  21750. * @see dragonBones.AnimationState
  21751. * @version DragonBones 3.0
  21752. * @language zh_CN
  21753. */
  21754. readonly isCompleted: boolean;
  21755. /**
  21756. * - The name of the last playing animation state.
  21757. * @see #lastAnimationState
  21758. * @version DragonBones 3.0
  21759. * @language en_US
  21760. */
  21761. /**
  21762. * - 上一个播放的动画状态名称
  21763. * @see #lastAnimationState
  21764. * @version DragonBones 3.0
  21765. * @language zh_CN
  21766. */
  21767. readonly lastAnimationName: string;
  21768. /**
  21769. * - The name of all animation data
  21770. * @version DragonBones 4.5
  21771. * @language en_US
  21772. */
  21773. /**
  21774. * - 所有动画数据的名称
  21775. * @version DragonBones 4.5
  21776. * @language zh_CN
  21777. */
  21778. readonly animationNames: Array<string>;
  21779. /**
  21780. * - All animation data.
  21781. * @version DragonBones 4.5
  21782. * @language en_US
  21783. */
  21784. /**
  21785. * - 所有的动画数据。
  21786. * @version DragonBones 4.5
  21787. * @language zh_CN
  21788. */
  21789. animations: Map<AnimationData>;
  21790. /**
  21791. * - An AnimationConfig instance that can be used quickly.
  21792. * @see dragonBones.AnimationConfig
  21793. * @version DragonBones 5.0
  21794. * @language en_US
  21795. */
  21796. /**
  21797. * - 一个可以快速使用的动画配置实例。
  21798. * @see dragonBones.AnimationConfig
  21799. * @version DragonBones 5.0
  21800. * @language zh_CN
  21801. */
  21802. readonly animationConfig: AnimationConfig;
  21803. /**
  21804. * - The last playing animation state
  21805. * @see dragonBones.AnimationState
  21806. * @version DragonBones 3.0
  21807. * @language en_US
  21808. */
  21809. /**
  21810. * - 上一个播放的动画状态
  21811. * @see dragonBones.AnimationState
  21812. * @version DragonBones 3.0
  21813. * @language zh_CN
  21814. */
  21815. readonly lastAnimationState: AnimationState | null;
  21816. /**
  21817. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  21818. * @deprecated
  21819. * @language en_US
  21820. */
  21821. /**
  21822. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  21823. * @deprecated
  21824. * @language zh_CN
  21825. */
  21826. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  21827. /**
  21828. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  21829. * @deprecated
  21830. * @language en_US
  21831. */
  21832. /**
  21833. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  21834. * @deprecated
  21835. * @language zh_CN
  21836. */
  21837. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  21838. /**
  21839. * - Deprecated, please refer to {@link #animationNames}.
  21840. * @deprecated
  21841. * @language en_US
  21842. */
  21843. /**
  21844. * - 已废弃,请参考 {@link #animationNames}。
  21845. * @deprecated
  21846. * @language zh_CN
  21847. */
  21848. readonly animationList: Array<string>;
  21849. /**
  21850. * - Deprecated, please refer to {@link #animationNames}.
  21851. * @deprecated
  21852. * @language en_US
  21853. */
  21854. /**
  21855. * - 已废弃,请参考 {@link #animationNames}。
  21856. * @deprecated
  21857. * @language zh_CN
  21858. */
  21859. readonly animationDataList: Array<AnimationData>;
  21860. }
  21861. }
  21862. /**
  21863. * The MIT License (MIT)
  21864. *
  21865. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21866. *
  21867. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21868. * this software and associated documentation files (the "Software"), to deal in
  21869. * the Software without restriction, including without limitation the rights to
  21870. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21871. * the Software, and to permit persons to whom the Software is furnished to do so,
  21872. * subject to the following conditions:
  21873. *
  21874. * The above copyright notice and this permission notice shall be included in all
  21875. * copies or substantial portions of the Software.
  21876. *
  21877. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21878. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21879. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21880. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21881. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21882. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21883. */
  21884. declare namespace dragonBones {
  21885. /**
  21886. * - The animation state is generated when the animation data is played.
  21887. * @see dragonBones.Animation
  21888. * @see dragonBones.AnimationData
  21889. * @version DragonBones 3.0
  21890. * @language en_US
  21891. */
  21892. /**
  21893. * - 动画状态由播放动画数据时产生。
  21894. * @see dragonBones.Animation
  21895. * @see dragonBones.AnimationData
  21896. * @version DragonBones 3.0
  21897. * @language zh_CN
  21898. */
  21899. class AnimationState extends BaseObject {
  21900. static toString(): string;
  21901. /**
  21902. * @private
  21903. */
  21904. actionEnabled: boolean;
  21905. /**
  21906. * @private
  21907. */
  21908. additiveBlending: boolean;
  21909. /**
  21910. * - Whether the animation state has control over the display object properties of the slots.
  21911. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  21912. * especially if other animation state are controlling the display object properties of the slots.
  21913. * @default true
  21914. * @version DragonBones 5.0
  21915. * @language en_US
  21916. */
  21917. /**
  21918. * - 动画状态是否对插槽的显示对象属性有控制权。
  21919. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  21920. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  21921. * @default true
  21922. * @version DragonBones 5.0
  21923. * @language zh_CN
  21924. */
  21925. displayControl: boolean;
  21926. /**
  21927. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  21928. * This property should usually be set to false when blend multiple animation states.
  21929. * @default true
  21930. * @version DragonBones 5.1
  21931. * @language en_US
  21932. */
  21933. /**
  21934. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  21935. * 通常在混合多个动画状态时应该将该属性设置为 false。
  21936. * @default true
  21937. * @version DragonBones 5.1
  21938. * @language zh_CN
  21939. */
  21940. resetToPose: boolean;
  21941. /**
  21942. * - The play times. [0: Loop play, [1~N]: Play N times]
  21943. * @version DragonBones 3.0
  21944. * @language en_US
  21945. */
  21946. /**
  21947. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  21948. * @version DragonBones 3.0
  21949. * @language zh_CN
  21950. */
  21951. playTimes: number;
  21952. /**
  21953. * - The blend layer.
  21954. * High layer animation state will get the blend weight first.
  21955. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  21956. * @readonly
  21957. * @version DragonBones 5.0
  21958. * @language en_US
  21959. */
  21960. /**
  21961. * - 混合图层。
  21962. * 图层高的动画状态会优先获取混合权重。
  21963. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  21964. * @readonly
  21965. * @version DragonBones 5.0
  21966. * @language zh_CN
  21967. */
  21968. layer: number;
  21969. /**
  21970. * - The play speed.
  21971. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  21972. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  21973. * @default 1.0
  21974. * @version DragonBones 3.0
  21975. * @language en_US
  21976. */
  21977. /**
  21978. * - 播放速度。
  21979. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  21980. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  21981. * @default 1.0
  21982. * @version DragonBones 3.0
  21983. * @language zh_CN
  21984. */
  21985. timeScale: number;
  21986. /**
  21987. * - The blend weight.
  21988. * @default 1.0
  21989. * @version DragonBones 5.0
  21990. * @language en_US
  21991. */
  21992. /**
  21993. * - 混合权重。
  21994. * @default 1.0
  21995. * @version DragonBones 5.0
  21996. * @language zh_CN
  21997. */
  21998. weight: number;
  21999. /**
  22000. * - The auto fade out time when the animation state play completed.
  22001. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  22002. * @default -1.0
  22003. * @version DragonBones 5.0
  22004. * @language en_US
  22005. */
  22006. /**
  22007. * - 动画状态播放完成后的自动淡出时间。
  22008. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  22009. * @default -1.0
  22010. * @version DragonBones 5.0
  22011. * @language zh_CN
  22012. */
  22013. autoFadeOutTime: number;
  22014. /**
  22015. * @private
  22016. */
  22017. fadeTotalTime: number;
  22018. /**
  22019. * - The name of the animation state. (Can be different from the name of the animation data)
  22020. * @readonly
  22021. * @version DragonBones 5.0
  22022. * @language en_US
  22023. */
  22024. /**
  22025. * - 动画状态名称。 (可以不同于动画数据)
  22026. * @readonly
  22027. * @version DragonBones 5.0
  22028. * @language zh_CN
  22029. */
  22030. name: string;
  22031. /**
  22032. * - The blend group name of the animation state.
  22033. * This property is typically used to specify the substitution of multiple animation states blend.
  22034. * @readonly
  22035. * @version DragonBones 5.0
  22036. * @language en_US
  22037. */
  22038. /**
  22039. * - 混合组名称。
  22040. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  22041. * @readonly
  22042. * @version DragonBones 5.0
  22043. * @language zh_CN
  22044. */
  22045. group: string;
  22046. private _timelineDirty;
  22047. /**
  22048. * - xx: Play Enabled, Fade Play Enabled
  22049. * @internal
  22050. * @private
  22051. */
  22052. _playheadState: number;
  22053. /**
  22054. * -1: Fade in, 0: Fade complete, 1: Fade out;
  22055. * @internal
  22056. * @private
  22057. */
  22058. _fadeState: number;
  22059. /**
  22060. * -1: Fade start, 0: Fading, 1: Fade complete;
  22061. * @internal
  22062. * @private
  22063. */
  22064. _subFadeState: number;
  22065. /**
  22066. * @internal
  22067. * @private
  22068. */
  22069. _position: number;
  22070. /**
  22071. * @internal
  22072. * @private
  22073. */
  22074. _duration: number;
  22075. private _fadeTime;
  22076. private _time;
  22077. /**
  22078. * @internal
  22079. * @private
  22080. */
  22081. _fadeProgress: number;
  22082. /**
  22083. * @internal
  22084. * @private
  22085. */
  22086. _weightResult: number;
  22087. /**
  22088. * @internal
  22089. * @private
  22090. */
  22091. readonly _blendState: BlendState;
  22092. private readonly _boneMask;
  22093. private readonly _boneTimelines;
  22094. private readonly _surfaceTimelines;
  22095. private readonly _slotTimelines;
  22096. private readonly _constraintTimelines;
  22097. private readonly _animationTimelines;
  22098. private readonly _poseTimelines;
  22099. private readonly _bonePoses;
  22100. /**
  22101. * @internal
  22102. * @private
  22103. */
  22104. _animationData: AnimationData;
  22105. private _armature;
  22106. /**
  22107. * @internal
  22108. * @private
  22109. */
  22110. _actionTimeline: ActionTimelineState;
  22111. private _zOrderTimeline;
  22112. /**
  22113. * @internal
  22114. * @private
  22115. */
  22116. _parent: AnimationState;
  22117. /**
  22118. * @private
  22119. */
  22120. protected _onClear(): void;
  22121. private _updateTimelines();
  22122. private _updateBoneAndSlotTimelines();
  22123. private _advanceFadeTime(passedTime);
  22124. /**
  22125. * @internal
  22126. * @private
  22127. */
  22128. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  22129. /**
  22130. * @internal
  22131. * @private
  22132. */
  22133. advanceTime(passedTime: number, cacheFrameRate: number): void;
  22134. /**
  22135. * - Continue play.
  22136. * @version DragonBones 3.0
  22137. * @language en_US
  22138. */
  22139. /**
  22140. * - 继续播放。
  22141. * @version DragonBones 3.0
  22142. * @language zh_CN
  22143. */
  22144. play(): void;
  22145. /**
  22146. * - Stop play.
  22147. * @version DragonBones 3.0
  22148. * @language en_US
  22149. */
  22150. /**
  22151. * - 暂停播放。
  22152. * @version DragonBones 3.0
  22153. * @language zh_CN
  22154. */
  22155. stop(): void;
  22156. /**
  22157. * - Fade out the animation state.
  22158. * @param fadeOutTime - The fade out time. (In seconds)
  22159. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  22160. * @version DragonBones 3.0
  22161. * @language en_US
  22162. */
  22163. /**
  22164. * - 淡出动画状态。
  22165. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  22166. * @param pausePlayhead - 淡出时是否暂停播放。
  22167. * @version DragonBones 3.0
  22168. * @language zh_CN
  22169. */
  22170. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  22171. /**
  22172. * - Check if a specific bone mask is included.
  22173. * @param name - The bone name.
  22174. * @version DragonBones 3.0
  22175. * @language en_US
  22176. */
  22177. /**
  22178. * - 检查是否包含特定骨骼遮罩。
  22179. * @param name - 骨骼名称。
  22180. * @version DragonBones 3.0
  22181. * @language zh_CN
  22182. */
  22183. containsBoneMask(name: string): boolean;
  22184. /**
  22185. * - Add a specific bone mask.
  22186. * @param name - The bone name.
  22187. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  22188. * @version DragonBones 3.0
  22189. * @language en_US
  22190. */
  22191. /**
  22192. * - 添加特定的骨骼遮罩。
  22193. * @param name - 骨骼名称。
  22194. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  22195. * @version DragonBones 3.0
  22196. * @language zh_CN
  22197. */
  22198. addBoneMask(name: string, recursive?: boolean): void;
  22199. /**
  22200. * - Remove the mask of a specific bone.
  22201. * @param name - The bone name.
  22202. * @param recursive - Whether to remove the bone's sub-bone mask.
  22203. * @version DragonBones 3.0
  22204. * @language en_US
  22205. */
  22206. /**
  22207. * - 删除特定骨骼的遮罩。
  22208. * @param name - 骨骼名称。
  22209. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  22210. * @version DragonBones 3.0
  22211. * @language zh_CN
  22212. */
  22213. removeBoneMask(name: string, recursive?: boolean): void;
  22214. /**
  22215. * - Remove all bone masks.
  22216. * @version DragonBones 3.0
  22217. * @language en_US
  22218. */
  22219. /**
  22220. * - 删除所有骨骼遮罩。
  22221. * @version DragonBones 3.0
  22222. * @language zh_CN
  22223. */
  22224. removeAllBoneMask(): void;
  22225. /**
  22226. * - Whether the animation state is fading in.
  22227. * @version DragonBones 5.1
  22228. * @language en_US
  22229. */
  22230. /**
  22231. * - 是否正在淡入。
  22232. * @version DragonBones 5.1
  22233. * @language zh_CN
  22234. */
  22235. readonly isFadeIn: boolean;
  22236. /**
  22237. * - Whether the animation state is fading out.
  22238. * @version DragonBones 5.1
  22239. * @language en_US
  22240. */
  22241. /**
  22242. * - 是否正在淡出。
  22243. * @version DragonBones 5.1
  22244. * @language zh_CN
  22245. */
  22246. readonly isFadeOut: boolean;
  22247. /**
  22248. * - Whether the animation state is fade completed.
  22249. * @version DragonBones 5.1
  22250. * @language en_US
  22251. */
  22252. /**
  22253. * - 是否淡入或淡出完毕。
  22254. * @version DragonBones 5.1
  22255. * @language zh_CN
  22256. */
  22257. readonly isFadeComplete: boolean;
  22258. /**
  22259. * - Whether the animation state is playing.
  22260. * @version DragonBones 3.0
  22261. * @language en_US
  22262. */
  22263. /**
  22264. * - 是否正在播放。
  22265. * @version DragonBones 3.0
  22266. * @language zh_CN
  22267. */
  22268. readonly isPlaying: boolean;
  22269. /**
  22270. * - Whether the animation state is play completed.
  22271. * @version DragonBones 3.0
  22272. * @language en_US
  22273. */
  22274. /**
  22275. * - 是否播放完毕。
  22276. * @version DragonBones 3.0
  22277. * @language zh_CN
  22278. */
  22279. readonly isCompleted: boolean;
  22280. /**
  22281. * - The times has been played.
  22282. * @version DragonBones 3.0
  22283. * @language en_US
  22284. */
  22285. /**
  22286. * - 已经循环播放的次数。
  22287. * @version DragonBones 3.0
  22288. * @language zh_CN
  22289. */
  22290. readonly currentPlayTimes: number;
  22291. /**
  22292. * - The total time. (In seconds)
  22293. * @version DragonBones 3.0
  22294. * @language en_US
  22295. */
  22296. /**
  22297. * - 总播放时间。 (以秒为单位)
  22298. * @version DragonBones 3.0
  22299. * @language zh_CN
  22300. */
  22301. readonly totalTime: number;
  22302. /**
  22303. * - The time is currently playing. (In seconds)
  22304. * @version DragonBones 3.0
  22305. * @language en_US
  22306. */
  22307. /**
  22308. * - 当前播放的时间。 (以秒为单位)
  22309. * @version DragonBones 3.0
  22310. * @language zh_CN
  22311. */
  22312. currentTime: number;
  22313. /**
  22314. * - The animation data.
  22315. * @see dragonBones.AnimationData
  22316. * @version DragonBones 3.0
  22317. * @language en_US
  22318. */
  22319. /**
  22320. * - 动画数据。
  22321. * @see dragonBones.AnimationData
  22322. * @version DragonBones 3.0
  22323. * @language zh_CN
  22324. */
  22325. readonly animationData: AnimationData;
  22326. }
  22327. /**
  22328. * @internal
  22329. * @private
  22330. */
  22331. class BonePose extends BaseObject {
  22332. static toString(): string;
  22333. readonly current: Transform;
  22334. readonly delta: Transform;
  22335. readonly result: Transform;
  22336. protected _onClear(): void;
  22337. }
  22338. /**
  22339. * @internal
  22340. * @private
  22341. */
  22342. class BlendState {
  22343. dirty: boolean;
  22344. layer: number;
  22345. leftWeight: number;
  22346. layerWeight: number;
  22347. blendWeight: number;
  22348. update(weight: number, layer: number): number;
  22349. clear(): void;
  22350. }
  22351. }
  22352. /**
  22353. * The MIT License (MIT)
  22354. *
  22355. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22356. *
  22357. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22358. * this software and associated documentation files (the "Software"), to deal in
  22359. * the Software without restriction, including without limitation the rights to
  22360. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22361. * the Software, and to permit persons to whom the Software is furnished to do so,
  22362. * subject to the following conditions:
  22363. *
  22364. * The above copyright notice and this permission notice shall be included in all
  22365. * copies or substantial portions of the Software.
  22366. *
  22367. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22368. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22369. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22370. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22371. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22372. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22373. */
  22374. declare namespace dragonBones {
  22375. /**
  22376. * @internal
  22377. * @private
  22378. */
  22379. const enum TweenState {
  22380. None = 0,
  22381. Once = 1,
  22382. Always = 2,
  22383. }
  22384. /**
  22385. * @internal
  22386. * @private
  22387. */
  22388. abstract class TimelineState extends BaseObject {
  22389. playState: number;
  22390. currentPlayTimes: number;
  22391. currentTime: number;
  22392. protected _tweenState: TweenState;
  22393. protected _frameRate: number;
  22394. protected _frameValueOffset: number;
  22395. protected _frameCount: number;
  22396. protected _frameOffset: number;
  22397. protected _frameIndex: number;
  22398. protected _frameRateR: number;
  22399. protected _position: number;
  22400. protected _duration: number;
  22401. protected _timeScale: number;
  22402. protected _timeOffset: number;
  22403. protected _dragonBonesData: DragonBonesData;
  22404. protected _animationData: AnimationData;
  22405. protected _timelineData: TimelineData | null;
  22406. protected _armature: Armature;
  22407. protected _animationState: AnimationState;
  22408. protected _actionTimeline: TimelineState;
  22409. protected _frameArray: Array<number> | Int16Array;
  22410. protected _frameIntArray: Array<number> | Int16Array;
  22411. protected _frameFloatArray: Array<number> | Int16Array;
  22412. protected _timelineArray: Array<number> | Uint16Array;
  22413. protected _frameIndices: Array<number>;
  22414. protected _onClear(): void;
  22415. protected abstract _onArriveAtFrame(): void;
  22416. protected abstract _onUpdateFrame(): void;
  22417. protected _setCurrentTime(passedTime: number): boolean;
  22418. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22419. fadeOut(): void;
  22420. update(passedTime: number): void;
  22421. }
  22422. /**
  22423. * @internal
  22424. * @private
  22425. */
  22426. abstract class TweenTimelineState extends TimelineState {
  22427. private static _getEasingValue(tweenType, progress, easing);
  22428. private static _getEasingCurveValue(progress, samples, count, offset);
  22429. protected _tweenType: TweenType;
  22430. protected _curveCount: number;
  22431. protected _framePosition: number;
  22432. protected _frameDurationR: number;
  22433. protected _tweenProgress: number;
  22434. protected _tweenEasing: number;
  22435. protected _onClear(): void;
  22436. protected _onArriveAtFrame(): void;
  22437. protected _onUpdateFrame(): void;
  22438. }
  22439. /**
  22440. * @internal
  22441. * @private
  22442. */
  22443. abstract class BoneTimelineState extends TweenTimelineState {
  22444. bone: Bone;
  22445. bonePose: BonePose;
  22446. protected _onClear(): void;
  22447. blend(state: number): void;
  22448. }
  22449. /**
  22450. * @internal
  22451. * @private
  22452. */
  22453. abstract class SlotTimelineState extends TweenTimelineState {
  22454. slot: Slot;
  22455. protected _onClear(): void;
  22456. }
  22457. /**
  22458. * @internal
  22459. * @private
  22460. */
  22461. abstract class ConstraintTimelineState extends TweenTimelineState {
  22462. constraint: Constraint;
  22463. protected _onClear(): void;
  22464. }
  22465. }
  22466. /**
  22467. * The MIT License (MIT)
  22468. *
  22469. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22470. *
  22471. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22472. * this software and associated documentation files (the "Software"), to deal in
  22473. * the Software without restriction, including without limitation the rights to
  22474. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22475. * the Software, and to permit persons to whom the Software is furnished to do so,
  22476. * subject to the following conditions:
  22477. *
  22478. * The above copyright notice and this permission notice shall be included in all
  22479. * copies or substantial portions of the Software.
  22480. *
  22481. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22482. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22483. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22484. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22485. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22486. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22487. */
  22488. declare namespace dragonBones {
  22489. /**
  22490. * @internal
  22491. * @private
  22492. */
  22493. class ActionTimelineState extends TimelineState {
  22494. static toString(): string;
  22495. private _onCrossFrame(frameIndex);
  22496. protected _onArriveAtFrame(): void;
  22497. protected _onUpdateFrame(): void;
  22498. update(passedTime: number): void;
  22499. setCurrentTime(value: number): void;
  22500. }
  22501. /**
  22502. * @internal
  22503. * @private
  22504. */
  22505. class ZOrderTimelineState extends TimelineState {
  22506. static toString(): string;
  22507. protected _onArriveAtFrame(): void;
  22508. protected _onUpdateFrame(): void;
  22509. }
  22510. /**
  22511. * @internal
  22512. * @private
  22513. */
  22514. class BoneAllTimelineState extends BoneTimelineState {
  22515. static toString(): string;
  22516. protected _onArriveAtFrame(): void;
  22517. protected _onUpdateFrame(): void;
  22518. fadeOut(): void;
  22519. }
  22520. /**
  22521. * @internal
  22522. * @private
  22523. */
  22524. class BoneTranslateTimelineState extends BoneTimelineState {
  22525. static toString(): string;
  22526. protected _onArriveAtFrame(): void;
  22527. protected _onUpdateFrame(): void;
  22528. }
  22529. /**
  22530. * @internal
  22531. * @private
  22532. */
  22533. class BoneRotateTimelineState extends BoneTimelineState {
  22534. static toString(): string;
  22535. protected _onArriveAtFrame(): void;
  22536. protected _onUpdateFrame(): void;
  22537. fadeOut(): void;
  22538. }
  22539. /**
  22540. * @internal
  22541. * @private
  22542. */
  22543. class BoneScaleTimelineState extends BoneTimelineState {
  22544. static toString(): string;
  22545. protected _onArriveAtFrame(): void;
  22546. protected _onUpdateFrame(): void;
  22547. }
  22548. /**
  22549. * @internal
  22550. * @private
  22551. */
  22552. class SurfaceTimelineState extends TweenTimelineState {
  22553. static toString(): string;
  22554. surface: Surface;
  22555. private _frameFloatOffset;
  22556. private _valueCount;
  22557. private _deformCount;
  22558. private _valueOffset;
  22559. private readonly _current;
  22560. private readonly _delta;
  22561. private readonly _result;
  22562. protected _onClear(): void;
  22563. protected _onArriveAtFrame(): void;
  22564. protected _onUpdateFrame(): void;
  22565. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22566. blend(state: number): void;
  22567. }
  22568. /**
  22569. * @internal
  22570. * @private
  22571. */
  22572. class SlotDislayTimelineState extends SlotTimelineState {
  22573. static toString(): string;
  22574. protected _onArriveAtFrame(): void;
  22575. }
  22576. /**
  22577. * @internal
  22578. * @private
  22579. */
  22580. class SlotColorTimelineState extends SlotTimelineState {
  22581. static toString(): string;
  22582. private _dirty;
  22583. private readonly _current;
  22584. private readonly _delta;
  22585. private readonly _result;
  22586. protected _onClear(): void;
  22587. protected _onArriveAtFrame(): void;
  22588. protected _onUpdateFrame(): void;
  22589. fadeOut(): void;
  22590. update(passedTime: number): void;
  22591. }
  22592. /**
  22593. * @internal
  22594. * @private
  22595. */
  22596. class SlotFFDTimelineState extends SlotTimelineState {
  22597. static toString(): string;
  22598. meshOffset: number;
  22599. private _dirty;
  22600. private _frameFloatOffset;
  22601. private _valueCount;
  22602. private _deformCount;
  22603. private _valueOffset;
  22604. private readonly _current;
  22605. private readonly _delta;
  22606. private readonly _result;
  22607. protected _onClear(): void;
  22608. protected _onArriveAtFrame(): void;
  22609. protected _onUpdateFrame(): void;
  22610. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  22611. fadeOut(): void;
  22612. update(passedTime: number): void;
  22613. }
  22614. /**
  22615. * @internal
  22616. * @private
  22617. */
  22618. class IKConstraintTimelineState extends ConstraintTimelineState {
  22619. static toString(): string;
  22620. private _current;
  22621. private _delta;
  22622. protected _onClear(): void;
  22623. protected _onArriveAtFrame(): void;
  22624. protected _onUpdateFrame(): void;
  22625. }
  22626. /**
  22627. * @internal
  22628. * @private
  22629. */
  22630. class AnimationTimelineState extends TweenTimelineState {
  22631. static toString(): string;
  22632. animationState: AnimationState;
  22633. private readonly _floats;
  22634. protected _onClear(): void;
  22635. protected _onArriveAtFrame(): void;
  22636. protected _onUpdateFrame(): void;
  22637. blend(state: number): void;
  22638. }
  22639. }
  22640. /**
  22641. * The MIT License (MIT)
  22642. *
  22643. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22644. *
  22645. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22646. * this software and associated documentation files (the "Software"), to deal in
  22647. * the Software without restriction, including without limitation the rights to
  22648. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22649. * the Software, and to permit persons to whom the Software is furnished to do so,
  22650. * subject to the following conditions:
  22651. *
  22652. * The above copyright notice and this permission notice shall be included in all
  22653. * copies or substantial portions of the Software.
  22654. *
  22655. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22656. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22657. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22658. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22659. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22660. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22661. */
  22662. declare namespace dragonBones {
  22663. /**
  22664. * - The properties of the object carry basic information about an event,
  22665. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  22666. * @version DragonBones 4.5
  22667. * @language en_US
  22668. */
  22669. /**
  22670. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  22671. * @version DragonBones 4.5
  22672. * @language zh_CN
  22673. */
  22674. class EventObject extends BaseObject {
  22675. /**
  22676. * - Animation start play.
  22677. * @version DragonBones 4.5
  22678. * @language en_US
  22679. */
  22680. /**
  22681. * - 动画开始播放。
  22682. * @version DragonBones 4.5
  22683. * @language zh_CN
  22684. */
  22685. static readonly START: string;
  22686. /**
  22687. * - Animation loop play complete once.
  22688. * @version DragonBones 4.5
  22689. * @language en_US
  22690. */
  22691. /**
  22692. * - 动画循环播放完成一次。
  22693. * @version DragonBones 4.5
  22694. * @language zh_CN
  22695. */
  22696. static readonly LOOP_COMPLETE: string;
  22697. /**
  22698. * - Animation play complete.
  22699. * @version DragonBones 4.5
  22700. * @language en_US
  22701. */
  22702. /**
  22703. * - 动画播放完成。
  22704. * @version DragonBones 4.5
  22705. * @language zh_CN
  22706. */
  22707. static readonly COMPLETE: string;
  22708. /**
  22709. * - Animation fade in start.
  22710. * @version DragonBones 4.5
  22711. * @language en_US
  22712. */
  22713. /**
  22714. * - 动画淡入开始。
  22715. * @version DragonBones 4.5
  22716. * @language zh_CN
  22717. */
  22718. static readonly FADE_IN: string;
  22719. /**
  22720. * - Animation fade in complete.
  22721. * @version DragonBones 4.5
  22722. * @language en_US
  22723. */
  22724. /**
  22725. * - 动画淡入完成。
  22726. * @version DragonBones 4.5
  22727. * @language zh_CN
  22728. */
  22729. static readonly FADE_IN_COMPLETE: string;
  22730. /**
  22731. * - Animation fade out start.
  22732. * @version DragonBones 4.5
  22733. * @language en_US
  22734. */
  22735. /**
  22736. * - 动画淡出开始。
  22737. * @version DragonBones 4.5
  22738. * @language zh_CN
  22739. */
  22740. static readonly FADE_OUT: string;
  22741. /**
  22742. * - Animation fade out complete.
  22743. * @version DragonBones 4.5
  22744. * @language en_US
  22745. */
  22746. /**
  22747. * - 动画淡出完成。
  22748. * @version DragonBones 4.5
  22749. * @language zh_CN
  22750. */
  22751. static readonly FADE_OUT_COMPLETE: string;
  22752. /**
  22753. * - Animation frame event.
  22754. * @version DragonBones 4.5
  22755. * @language en_US
  22756. */
  22757. /**
  22758. * - 动画帧事件。
  22759. * @version DragonBones 4.5
  22760. * @language zh_CN
  22761. */
  22762. static readonly FRAME_EVENT: string;
  22763. /**
  22764. * - Animation frame sound event.
  22765. * @version DragonBones 4.5
  22766. * @language en_US
  22767. */
  22768. /**
  22769. * - 动画帧声音事件。
  22770. * @version DragonBones 4.5
  22771. * @language zh_CN
  22772. */
  22773. static readonly SOUND_EVENT: string;
  22774. static toString(): string;
  22775. /**
  22776. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  22777. * @version DragonBones 4.5
  22778. * @language en_US
  22779. */
  22780. /**
  22781. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  22782. * @version DragonBones 4.5
  22783. * @language zh_CN
  22784. */
  22785. time: number;
  22786. /**
  22787. * - The event type。
  22788. * @version DragonBones 4.5
  22789. * @language en_US
  22790. */
  22791. /**
  22792. * - 事件类型。
  22793. * @version DragonBones 4.5
  22794. * @language zh_CN
  22795. */
  22796. type: EventStringType;
  22797. /**
  22798. * - The event name. (The frame event name or the frame sound name)
  22799. * @version DragonBones 4.5
  22800. * @language en_US
  22801. */
  22802. /**
  22803. * - 事件名称。 (帧事件的名称或帧声音的名称)
  22804. * @version DragonBones 4.5
  22805. * @language zh_CN
  22806. */
  22807. name: string;
  22808. /**
  22809. * - The armature that dispatch the event.
  22810. * @see dragonBones.Armature
  22811. * @version DragonBones 4.5
  22812. * @language en_US
  22813. */
  22814. /**
  22815. * - 发出该事件的骨架。
  22816. * @see dragonBones.Armature
  22817. * @version DragonBones 4.5
  22818. * @language zh_CN
  22819. */
  22820. armature: Armature;
  22821. /**
  22822. * - The bone that dispatch the event.
  22823. * @see dragonBones.Bone
  22824. * @version DragonBones 4.5
  22825. * @language en_US
  22826. */
  22827. /**
  22828. * - 发出该事件的骨骼。
  22829. * @see dragonBones.Bone
  22830. * @version DragonBones 4.5
  22831. * @language zh_CN
  22832. */
  22833. bone: Bone | null;
  22834. /**
  22835. * - The slot that dispatch the event.
  22836. * @see dragonBones.Slot
  22837. * @version DragonBones 4.5
  22838. * @language en_US
  22839. */
  22840. /**
  22841. * - 发出该事件的插槽。
  22842. * @see dragonBones.Slot
  22843. * @version DragonBones 4.5
  22844. * @language zh_CN
  22845. */
  22846. slot: Slot | null;
  22847. /**
  22848. * - The animation state that dispatch the event.
  22849. * @see dragonBones.AnimationState
  22850. * @version DragonBones 4.5
  22851. * @language en_US
  22852. */
  22853. /**
  22854. * - 发出该事件的动画状态。
  22855. * @see dragonBones.AnimationState
  22856. * @version DragonBones 4.5
  22857. * @language zh_CN
  22858. */
  22859. animationState: AnimationState;
  22860. /**
  22861. * - The custom data.
  22862. * @see dragonBones.CustomData
  22863. * @version DragonBones 5.0
  22864. * @language en_US
  22865. */
  22866. /**
  22867. * - 自定义数据。
  22868. * @see dragonBones.CustomData
  22869. * @version DragonBones 5.0
  22870. * @language zh_CN
  22871. */
  22872. data: UserData | null;
  22873. /**
  22874. * @private
  22875. */
  22876. protected _onClear(): void;
  22877. }
  22878. }
  22879. /**
  22880. * The MIT License (MIT)
  22881. *
  22882. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22883. *
  22884. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22885. * this software and associated documentation files (the "Software"), to deal in
  22886. * the Software without restriction, including without limitation the rights to
  22887. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22888. * the Software, and to permit persons to whom the Software is furnished to do so,
  22889. * subject to the following conditions:
  22890. *
  22891. * The above copyright notice and this permission notice shall be included in all
  22892. * copies or substantial portions of the Software.
  22893. *
  22894. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22895. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22896. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22897. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22898. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22899. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22900. */
  22901. declare namespace dragonBones {
  22902. /**
  22903. * @private
  22904. */
  22905. type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  22906. /**
  22907. * - The event dispatcher interface.
  22908. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  22909. * @version DragonBones 4.5
  22910. * @language en_US
  22911. */
  22912. /**
  22913. * - 事件派发接口。
  22914. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  22915. * @version DragonBones 4.5
  22916. * @language zh_CN
  22917. */
  22918. interface IEventDispatcher {
  22919. /**
  22920. * - Checks whether the object has any listeners registered for a specific type of event。
  22921. * @param type - Event type.
  22922. * @version DragonBones 4.5
  22923. * @language en_US
  22924. */
  22925. /**
  22926. * - 检查是否为特定的事件类型注册了任何侦听器。
  22927. * @param type - 事件类型。
  22928. * @version DragonBones 4.5
  22929. * @language zh_CN
  22930. */
  22931. hasDBEventListener(type: EventStringType): boolean;
  22932. /**
  22933. * - Dispatches an event into the event flow.
  22934. * @param type - Event type.
  22935. * @param eventObject - Event object.
  22936. * @see dragonBones.EventObject
  22937. * @version DragonBones 4.5
  22938. * @language en_US
  22939. */
  22940. /**
  22941. * - 分派特定的事件到事件流中。
  22942. * @param type - 事件类型。
  22943. * @param eventObject - 事件数据。
  22944. * @see dragonBones.EventObject
  22945. * @version DragonBones 4.5
  22946. * @language zh_CN
  22947. */
  22948. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  22949. /**
  22950. * - Add an event listener object so that the listener receives notification of an event.
  22951. * @param type - Event type.
  22952. * @param listener - Event listener.
  22953. * @param thisObject - The listener function's "this".
  22954. * @version DragonBones 4.5
  22955. * @language en_US
  22956. */
  22957. /**
  22958. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  22959. * @param type - 事件类型。
  22960. * @param listener - 事件侦听器。
  22961. * @param thisObject - 侦听函数绑定的 this 对象。
  22962. * @version DragonBones 4.5
  22963. * @language zh_CN
  22964. */
  22965. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  22966. /**
  22967. * - Removes a listener from the object.
  22968. * @param type - Event type.
  22969. * @param listener - Event listener.
  22970. * @param thisObject - The listener function's "this".
  22971. * @version DragonBones 4.5
  22972. * @language en_US
  22973. */
  22974. /**
  22975. * - 删除特定事件类型的侦听器。
  22976. * @param type - 事件类型。
  22977. * @param listener - 事件侦听器。
  22978. * @param thisObject - 侦听函数绑定的 this 对象。
  22979. * @version DragonBones 4.5
  22980. * @language zh_CN
  22981. */
  22982. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  22983. /**
  22984. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  22985. * @deprecated
  22986. * @language en_US
  22987. */
  22988. /**
  22989. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  22990. * @deprecated
  22991. * @language zh_CN
  22992. */
  22993. hasEvent(type: EventStringType): boolean;
  22994. /**
  22995. * - Deprecated, please refer to {@link #addDBEventListener()}.
  22996. * @deprecated
  22997. * @language en_US
  22998. */
  22999. /**
  23000. * - 已废弃,请参考 {@link #addDBEventListener()}。
  23001. * @deprecated
  23002. * @language zh_CN
  23003. */
  23004. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  23005. /**
  23006. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  23007. * @deprecated
  23008. * @language en_US
  23009. */
  23010. /**
  23011. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  23012. * @deprecated
  23013. * @language zh_CN
  23014. */
  23015. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  23016. }
  23017. }
  23018. /**
  23019. * The MIT License (MIT)
  23020. *
  23021. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23022. *
  23023. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23024. * this software and associated documentation files (the "Software"), to deal in
  23025. * the Software without restriction, including without limitation the rights to
  23026. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23027. * the Software, and to permit persons to whom the Software is furnished to do so,
  23028. * subject to the following conditions:
  23029. *
  23030. * The above copyright notice and this permission notice shall be included in all
  23031. * copies or substantial portions of the Software.
  23032. *
  23033. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23034. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23035. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23036. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23037. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23038. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23039. */
  23040. declare namespace dragonBones {
  23041. /**
  23042. * @internal
  23043. * @private
  23044. */
  23045. abstract class DataParser {
  23046. protected static readonly DATA_VERSION_2_3: string;
  23047. protected static readonly DATA_VERSION_3_0: string;
  23048. protected static readonly DATA_VERSION_4_0: string;
  23049. protected static readonly DATA_VERSION_4_5: string;
  23050. protected static readonly DATA_VERSION_5_0: string;
  23051. protected static readonly DATA_VERSION_5_5: string;
  23052. protected static readonly DATA_VERSION: string;
  23053. protected static readonly DATA_VERSIONS: Array<string>;
  23054. protected static readonly TEXTURE_ATLAS: string;
  23055. protected static readonly SUB_TEXTURE: string;
  23056. protected static readonly FORMAT: string;
  23057. protected static readonly IMAGE_PATH: string;
  23058. protected static readonly WIDTH: string;
  23059. protected static readonly HEIGHT: string;
  23060. protected static readonly ROTATED: string;
  23061. protected static readonly FRAME_X: string;
  23062. protected static readonly FRAME_Y: string;
  23063. protected static readonly FRAME_WIDTH: string;
  23064. protected static readonly FRAME_HEIGHT: string;
  23065. protected static readonly DRADON_BONES: string;
  23066. protected static readonly USER_DATA: string;
  23067. protected static readonly ARMATURE: string;
  23068. protected static readonly BONE: string;
  23069. protected static readonly SURFACE: string;
  23070. protected static readonly SLOT: string;
  23071. protected static readonly CONSTRAINT: string;
  23072. protected static readonly IK: string;
  23073. protected static readonly SKIN: string;
  23074. protected static readonly DISPLAY: string;
  23075. protected static readonly ANIMATION: string;
  23076. protected static readonly Z_ORDER: string;
  23077. protected static readonly FFD: string;
  23078. protected static readonly FRAME: string;
  23079. protected static readonly TRANSLATE_FRAME: string;
  23080. protected static readonly ROTATE_FRAME: string;
  23081. protected static readonly SCALE_FRAME: string;
  23082. protected static readonly DISPLAY_FRAME: string;
  23083. protected static readonly COLOR_FRAME: string;
  23084. protected static readonly DEFAULT_ACTIONS: string;
  23085. protected static readonly ACTIONS: string;
  23086. protected static readonly EVENTS: string;
  23087. protected static readonly INTS: string;
  23088. protected static readonly FLOATS: string;
  23089. protected static readonly STRINGS: string;
  23090. protected static readonly CANVAS: string;
  23091. protected static readonly TRANSFORM: string;
  23092. protected static readonly PIVOT: string;
  23093. protected static readonly AABB: string;
  23094. protected static readonly COLOR: string;
  23095. protected static readonly VERSION: string;
  23096. protected static readonly COMPATIBLE_VERSION: string;
  23097. protected static readonly FRAME_RATE: string;
  23098. protected static readonly TYPE: string;
  23099. protected static readonly SUB_TYPE: string;
  23100. protected static readonly NAME: string;
  23101. protected static readonly PARENT: string;
  23102. protected static readonly TARGET: string;
  23103. protected static readonly STAGE: string;
  23104. protected static readonly SHARE: string;
  23105. protected static readonly PATH: string;
  23106. protected static readonly LENGTH: string;
  23107. protected static readonly DISPLAY_INDEX: string;
  23108. protected static readonly BLEND_MODE: string;
  23109. protected static readonly INHERIT_TRANSLATION: string;
  23110. protected static readonly INHERIT_ROTATION: string;
  23111. protected static readonly INHERIT_SCALE: string;
  23112. protected static readonly INHERIT_REFLECTION: string;
  23113. protected static readonly INHERIT_ANIMATION: string;
  23114. protected static readonly INHERIT_DEFORM: string;
  23115. protected static readonly SEGMENT_X: string;
  23116. protected static readonly SEGMENT_Y: string;
  23117. protected static readonly BEND_POSITIVE: string;
  23118. protected static readonly CHAIN: string;
  23119. protected static readonly WEIGHT: string;
  23120. protected static readonly FADE_IN_TIME: string;
  23121. protected static readonly PLAY_TIMES: string;
  23122. protected static readonly SCALE: string;
  23123. protected static readonly OFFSET: string;
  23124. protected static readonly POSITION: string;
  23125. protected static readonly DURATION: string;
  23126. protected static readonly TWEEN_EASING: string;
  23127. protected static readonly TWEEN_ROTATE: string;
  23128. protected static readonly TWEEN_SCALE: string;
  23129. protected static readonly CLOCK_WISE: string;
  23130. protected static readonly CURVE: string;
  23131. protected static readonly SOUND: string;
  23132. protected static readonly EVENT: string;
  23133. protected static readonly ACTION: string;
  23134. protected static readonly X: string;
  23135. protected static readonly Y: string;
  23136. protected static readonly SKEW_X: string;
  23137. protected static readonly SKEW_Y: string;
  23138. protected static readonly SCALE_X: string;
  23139. protected static readonly SCALE_Y: string;
  23140. protected static readonly VALUE: string;
  23141. protected static readonly ROTATE: string;
  23142. protected static readonly SKEW: string;
  23143. protected static readonly ALPHA_OFFSET: string;
  23144. protected static readonly RED_OFFSET: string;
  23145. protected static readonly GREEN_OFFSET: string;
  23146. protected static readonly BLUE_OFFSET: string;
  23147. protected static readonly ALPHA_MULTIPLIER: string;
  23148. protected static readonly RED_MULTIPLIER: string;
  23149. protected static readonly GREEN_MULTIPLIER: string;
  23150. protected static readonly BLUE_MULTIPLIER: string;
  23151. protected static readonly UVS: string;
  23152. protected static readonly VERTICES: string;
  23153. protected static readonly TRIANGLES: string;
  23154. protected static readonly WEIGHTS: string;
  23155. protected static readonly SLOT_POSE: string;
  23156. protected static readonly BONE_POSE: string;
  23157. protected static readonly GLUE_WEIGHTS: string;
  23158. protected static readonly GLUE_MESHES: string;
  23159. protected static readonly GOTO_AND_PLAY: string;
  23160. protected static readonly DEFAULT_NAME: string;
  23161. protected static _getArmatureType(value: string): ArmatureType;
  23162. protected static _getBoneType(value: string): BoneType;
  23163. protected static _getDisplayType(value: string): DisplayType;
  23164. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  23165. protected static _getActionType(value: string): ActionType;
  23166. protected static _getBlendMode(value: string): BlendMode;
  23167. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  23168. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  23169. /**
  23170. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  23171. * @deprecated
  23172. * @language en_US
  23173. */
  23174. /**
  23175. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  23176. * @deprecated
  23177. * @language zh_CN
  23178. */
  23179. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  23180. /**
  23181. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  23182. * @deprecated
  23183. * @language en_US
  23184. */
  23185. /**
  23186. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  23187. * @deprecated
  23188. * @language zh_CN
  23189. */
  23190. static parseTextureAtlasData(rawData: any, scale?: number): any;
  23191. }
  23192. }
  23193. /**
  23194. * The MIT License (MIT)
  23195. *
  23196. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23197. *
  23198. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23199. * this software and associated documentation files (the "Software"), to deal in
  23200. * the Software without restriction, including without limitation the rights to
  23201. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23202. * the Software, and to permit persons to whom the Software is furnished to do so,
  23203. * subject to the following conditions:
  23204. *
  23205. * The above copyright notice and this permission notice shall be included in all
  23206. * copies or substantial portions of the Software.
  23207. *
  23208. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23209. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23210. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23211. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23212. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23213. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23214. */
  23215. declare namespace dragonBones {
  23216. /**
  23217. * @internal
  23218. * @private
  23219. */
  23220. class ObjectDataParser extends DataParser {
  23221. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  23222. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  23223. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  23224. protected _rawTextureAtlasIndex: number;
  23225. protected readonly _rawBones: Array<BoneData>;
  23226. protected _data: DragonBonesData;
  23227. protected _armature: ArmatureData;
  23228. protected _bone: BoneData;
  23229. protected _surface: SurfaceData;
  23230. protected _slot: SlotData;
  23231. protected _skin: SkinData;
  23232. protected _mesh: MeshDisplayData;
  23233. protected _animation: AnimationData;
  23234. protected _timeline: TimelineData;
  23235. protected _rawTextureAtlases: Array<any> | null;
  23236. private _defaultColorOffset;
  23237. private _prevClockwise;
  23238. private _prevRotation;
  23239. private readonly _helpMatrixA;
  23240. private readonly _helpMatrixB;
  23241. private readonly _helpTransform;
  23242. private readonly _helpColorTransform;
  23243. private readonly _helpPoint;
  23244. private readonly _helpArray;
  23245. private readonly _intArray;
  23246. private readonly _floatArray;
  23247. private readonly _frameIntArray;
  23248. private readonly _frameFloatArray;
  23249. private readonly _frameArray;
  23250. private readonly _timelineArray;
  23251. private readonly _cacheRawMeshes;
  23252. private readonly _cacheMeshes;
  23253. private readonly _actionFrames;
  23254. private readonly _weightSlotPose;
  23255. private readonly _weightBonePoses;
  23256. private readonly _cacheBones;
  23257. private readonly _slotChildActions;
  23258. private _getCurvePoint(x1, y1, x2, y2, x3, y3, x4, y4, t, result);
  23259. private _samplingEasingCurve(curve, samples);
  23260. private _parseActionDataInFrame(rawData, frameStart, bone, slot);
  23261. private _mergeActionFrame(rawData, frameStart, type, bone, slot);
  23262. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  23263. protected _parseBone(rawData: any): BoneData;
  23264. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  23265. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  23266. protected _parseSkin(rawData: any): SkinData;
  23267. protected _parseDisplay(rawData: any): DisplayData | null;
  23268. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  23269. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  23270. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  23271. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  23272. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  23273. protected _parseAnimation(rawData: any): AnimationData;
  23274. 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;
  23275. protected _parseBoneTimeline(rawData: any): void;
  23276. protected _parseSlotTimeline(rawData: any): void;
  23277. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  23278. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  23279. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  23280. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  23281. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  23282. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  23283. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  23284. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  23285. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  23286. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  23287. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  23288. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  23289. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  23290. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  23291. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  23292. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  23293. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  23294. protected _parseArray(rawData: any): void;
  23295. protected _modifyArray(): void;
  23296. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  23297. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  23298. private static _objectDataParserInstance;
  23299. /**
  23300. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  23301. * @deprecated
  23302. * @language en_US
  23303. */
  23304. /**
  23305. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  23306. * @deprecated
  23307. * @language zh_CN
  23308. */
  23309. static getInstance(): ObjectDataParser;
  23310. }
  23311. /**
  23312. * @internal
  23313. * @private
  23314. */
  23315. class ActionFrame {
  23316. frameStart: number;
  23317. readonly actions: Array<number>;
  23318. }
  23319. }
  23320. /**
  23321. * The MIT License (MIT)
  23322. *
  23323. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23324. *
  23325. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23326. * this software and associated documentation files (the "Software"), to deal in
  23327. * the Software without restriction, including without limitation the rights to
  23328. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23329. * the Software, and to permit persons to whom the Software is furnished to do so,
  23330. * subject to the following conditions:
  23331. *
  23332. * The above copyright notice and this permission notice shall be included in all
  23333. * copies or substantial portions of the Software.
  23334. *
  23335. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23336. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23337. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23338. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23339. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23340. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23341. */
  23342. declare namespace dragonBones {
  23343. /**
  23344. * @internal
  23345. * @private
  23346. */
  23347. class BinaryDataParser extends ObjectDataParser {
  23348. private _binaryOffset;
  23349. private _binary;
  23350. private _intArrayBuffer;
  23351. private _floatArrayBuffer;
  23352. private _frameIntArrayBuffer;
  23353. private _frameFloatArrayBuffer;
  23354. private _frameArrayBuffer;
  23355. private _timelineArrayBuffer;
  23356. private _inRange(a, min, max);
  23357. private _decodeUTF8(data);
  23358. private _getUTF16Key(value);
  23359. private _parseBinaryTimeline(type, offset, timelineData?);
  23360. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  23361. protected _parseAnimation(rawData: any): AnimationData;
  23362. protected _parseArray(rawData: any): void;
  23363. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  23364. private static _binaryDataParserInstance;
  23365. /**
  23366. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  23367. * @deprecated
  23368. * @language en_US
  23369. */
  23370. /**
  23371. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  23372. * @deprecated
  23373. * @language zh_CN
  23374. */
  23375. static getInstance(): BinaryDataParser;
  23376. }
  23377. }
  23378. /**
  23379. * The MIT License (MIT)
  23380. *
  23381. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23382. *
  23383. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23384. * this software and associated documentation files (the "Software"), to deal in
  23385. * the Software without restriction, including without limitation the rights to
  23386. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23387. * the Software, and to permit persons to whom the Software is furnished to do so,
  23388. * subject to the following conditions:
  23389. *
  23390. * The above copyright notice and this permission notice shall be included in all
  23391. * copies or substantial portions of the Software.
  23392. *
  23393. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23394. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23395. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23396. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23397. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23398. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23399. */
  23400. declare namespace dragonBones {
  23401. /**
  23402. * - Base class for the factory that create the armatures. (Typically only one global factory instance is required)
  23403. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  23404. * 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.
  23405. * @see dragonBones.DragonBonesData
  23406. * @see dragonBones.TextureAtlasData
  23407. * @see dragonBones.ArmatureData
  23408. * @see dragonBones.Armature
  23409. * @version DragonBones 3.0
  23410. * @language en_US
  23411. */
  23412. /**
  23413. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  23414. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  23415. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  23416. * @see dragonBones.DragonBonesData
  23417. * @see dragonBones.TextureAtlasData
  23418. * @see dragonBones.ArmatureData
  23419. * @see dragonBones.Armature
  23420. * @version DragonBones 3.0
  23421. * @language zh_CN
  23422. */
  23423. abstract class BaseFactory {
  23424. /**
  23425. * @private
  23426. */
  23427. protected static _objectParser: ObjectDataParser;
  23428. /**
  23429. * @private
  23430. */
  23431. protected static _binaryParser: BinaryDataParser;
  23432. /**
  23433. * @private
  23434. */
  23435. autoSearch: boolean;
  23436. /**
  23437. * @private
  23438. */
  23439. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  23440. /**
  23441. * @private
  23442. */
  23443. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  23444. /**
  23445. * @private
  23446. */
  23447. protected _dragonBones: DragonBones;
  23448. /**
  23449. * @private
  23450. */
  23451. protected _dataParser: DataParser;
  23452. /**
  23453. * - Create a factory instance. (typically only one global factory instance is required)
  23454. * @version DragonBones 3.0
  23455. * @language en_US
  23456. */
  23457. /**
  23458. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  23459. * @version DragonBones 3.0
  23460. * @language zh_CN
  23461. */
  23462. constructor(dataParser?: DataParser | null);
  23463. /**
  23464. * @private
  23465. */
  23466. protected _isSupportMesh(): boolean;
  23467. /**
  23468. * @private
  23469. */
  23470. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  23471. /**
  23472. * @private
  23473. */
  23474. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  23475. /**
  23476. * @private
  23477. */
  23478. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  23479. /**
  23480. * @private
  23481. */
  23482. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  23483. /**
  23484. * @private
  23485. */
  23486. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  23487. /**
  23488. * @private
  23489. */
  23490. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  23491. /**
  23492. * @private
  23493. */
  23494. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  23495. /**
  23496. * @private
  23497. */
  23498. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  23499. /**
  23500. * @private
  23501. */
  23502. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  23503. /**
  23504. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  23505. * @param rawData - The raw data.
  23506. * @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)
  23507. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  23508. * @returns DragonBonesData instance
  23509. * @see #getDragonBonesData()
  23510. * @see #addDragonBonesData()
  23511. * @see #removeDragonBonesData()
  23512. * @see dragonBones.DragonBonesData
  23513. * @version DragonBones 4.5
  23514. * @language en_US
  23515. */
  23516. /**
  23517. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  23518. * @param rawData - 原始数据。
  23519. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23520. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  23521. * @returns DragonBonesData 实例
  23522. * @see #getDragonBonesData()
  23523. * @see #addDragonBonesData()
  23524. * @see #removeDragonBonesData()
  23525. * @see dragonBones.DragonBonesData
  23526. * @version DragonBones 4.5
  23527. * @language zh_CN
  23528. */
  23529. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  23530. /**
  23531. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  23532. * @param rawData - The raw texture atlas data.
  23533. * @param textureAtlas - The texture atlas object.
  23534. * @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)
  23535. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  23536. * @returns TextureAtlasData instance
  23537. * @see #getTextureAtlasData()
  23538. * @see #addTextureAtlasData()
  23539. * @see #removeTextureAtlasData()
  23540. * @see dragonBones.TextureAtlasData
  23541. * @version DragonBones 4.5
  23542. * @language en_US
  23543. */
  23544. /**
  23545. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  23546. * @param rawData - 原始贴图集数据。
  23547. * @param textureAtlas - 贴图集对象。
  23548. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23549. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  23550. * @returns TextureAtlasData 实例
  23551. * @see #getTextureAtlasData()
  23552. * @see #addTextureAtlasData()
  23553. * @see #removeTextureAtlasData()
  23554. * @see dragonBones.TextureAtlasData
  23555. * @version DragonBones 4.5
  23556. * @language zh_CN
  23557. */
  23558. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  23559. /**
  23560. * @private
  23561. */
  23562. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  23563. /**
  23564. * - Get a specific DragonBonesData instance.
  23565. * @param name - The DragonBonesData instance cache name.
  23566. * @returns DragonBonesData instance
  23567. * @see #parseDragonBonesData()
  23568. * @see #addDragonBonesData()
  23569. * @see #removeDragonBonesData()
  23570. * @see dragonBones.DragonBonesData
  23571. * @version DragonBones 3.0
  23572. * @language en_US
  23573. */
  23574. /**
  23575. * - 获取特定的 DragonBonesData 实例。
  23576. * @param name - DragonBonesData 实例的缓存名称。
  23577. * @returns DragonBonesData 实例
  23578. * @see #parseDragonBonesData()
  23579. * @see #addDragonBonesData()
  23580. * @see #removeDragonBonesData()
  23581. * @see dragonBones.DragonBonesData
  23582. * @version DragonBones 3.0
  23583. * @language zh_CN
  23584. */
  23585. getDragonBonesData(name: string): DragonBonesData | null;
  23586. /**
  23587. * - Cache a DragonBonesData instance to the factory.
  23588. * @param data - The DragonBonesData instance.
  23589. * @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)
  23590. * @see #parseDragonBonesData()
  23591. * @see #getDragonBonesData()
  23592. * @see #removeDragonBonesData()
  23593. * @see dragonBones.DragonBonesData
  23594. * @version DragonBones 3.0
  23595. * @language en_US
  23596. */
  23597. /**
  23598. * - 将 DragonBonesData 实例缓存到工厂中。
  23599. * @param data - DragonBonesData 实例。
  23600. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23601. * @see #parseDragonBonesData()
  23602. * @see #getDragonBonesData()
  23603. * @see #removeDragonBonesData()
  23604. * @see dragonBones.DragonBonesData
  23605. * @version DragonBones 3.0
  23606. * @language zh_CN
  23607. */
  23608. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  23609. /**
  23610. * - Remove a DragonBonesData instance.
  23611. * @param name - The DragonBonesData instance cache name.
  23612. * @param disposeData - Whether to dispose data. (Default: true)
  23613. * @see #parseDragonBonesData()
  23614. * @see #getDragonBonesData()
  23615. * @see #addDragonBonesData()
  23616. * @see dragonBones.DragonBonesData
  23617. * @version DragonBones 3.0
  23618. * @language en_US
  23619. */
  23620. /**
  23621. * - 移除 DragonBonesData 实例。
  23622. * @param name - DragonBonesData 实例缓存名称。
  23623. * @param disposeData - 是否释放数据。 (默认: true)
  23624. * @see #parseDragonBonesData()
  23625. * @see #getDragonBonesData()
  23626. * @see #addDragonBonesData()
  23627. * @see dragonBones.DragonBonesData
  23628. * @version DragonBones 3.0
  23629. * @language zh_CN
  23630. */
  23631. removeDragonBonesData(name: string, disposeData?: boolean): void;
  23632. /**
  23633. * - Get a list of specific TextureAtlasData instances.
  23634. * @param name - The TextureAtlasData cahce name.
  23635. * @see #parseTextureAtlasData()
  23636. * @see #addTextureAtlasData()
  23637. * @see #removeTextureAtlasData()
  23638. * @see dragonBones.TextureAtlasData
  23639. * @version DragonBones 3.0
  23640. * @language en_US
  23641. */
  23642. /**
  23643. * - 获取特定的 TextureAtlasData 实例列表。
  23644. * @param name - TextureAtlasData 实例缓存名称。
  23645. * @see #parseTextureAtlasData()
  23646. * @see #addTextureAtlasData()
  23647. * @see #removeTextureAtlasData()
  23648. * @see dragonBones.TextureAtlasData
  23649. * @version DragonBones 3.0
  23650. * @language zh_CN
  23651. */
  23652. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  23653. /**
  23654. * - Cache a TextureAtlasData instance to the factory.
  23655. * @param data - The TextureAtlasData instance.
  23656. * @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)
  23657. * @see #parseTextureAtlasData()
  23658. * @see #getTextureAtlasData()
  23659. * @see #removeTextureAtlasData()
  23660. * @see dragonBones.TextureAtlasData
  23661. * @version DragonBones 3.0
  23662. * @language en_US
  23663. */
  23664. /**
  23665. * - 将 TextureAtlasData 实例缓存到工厂中。
  23666. * @param data - TextureAtlasData 实例。
  23667. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  23668. * @see #parseTextureAtlasData()
  23669. * @see #getTextureAtlasData()
  23670. * @see #removeTextureAtlasData()
  23671. * @see dragonBones.TextureAtlasData
  23672. * @version DragonBones 3.0
  23673. * @language zh_CN
  23674. */
  23675. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  23676. /**
  23677. * - Remove a TextureAtlasData instance.
  23678. * @param name - The TextureAtlasData instance cache name.
  23679. * @param disposeData - Whether to dispose data.
  23680. * @see #parseTextureAtlasData()
  23681. * @see #getTextureAtlasData()
  23682. * @see #addTextureAtlasData()
  23683. * @see dragonBones.TextureAtlasData
  23684. * @version DragonBones 3.0
  23685. * @language en_US
  23686. */
  23687. /**
  23688. * - 移除 TextureAtlasData 实例。
  23689. * @param name - TextureAtlasData 实例的缓存名称。
  23690. * @param disposeData - 是否释放数据。
  23691. * @see #parseTextureAtlasData()
  23692. * @see #getTextureAtlasData()
  23693. * @see #addTextureAtlasData()
  23694. * @see dragonBones.TextureAtlasData
  23695. * @version DragonBones 3.0
  23696. * @language zh_CN
  23697. */
  23698. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  23699. /**
  23700. * - Get a specific armature data.
  23701. * @param name - The armature data name.
  23702. * @param dragonBonesName - The cached name for DragonbonesData instance.
  23703. * @see dragonBones.ArmatureData
  23704. * @version DragonBones 5.1
  23705. * @language en_US
  23706. */
  23707. /**
  23708. * - 获取特定的骨架数据。
  23709. * @param name - 骨架数据名称。
  23710. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  23711. * @see dragonBones.ArmatureData
  23712. * @version DragonBones 5.1
  23713. * @language zh_CN
  23714. */
  23715. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  23716. /**
  23717. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  23718. * @param disposeData - Whether to dispose data.
  23719. * @version DragonBones 4.5
  23720. * @language en_US
  23721. */
  23722. /**
  23723. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  23724. * @param disposeData - 是否释放数据。
  23725. * @version DragonBones 4.5
  23726. * @language zh_CN
  23727. */
  23728. clear(disposeData?: boolean): void;
  23729. /**
  23730. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  23731. * @param armatureName - The armature data name.
  23732. * @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)
  23733. * @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)
  23734. * @returns The armature.
  23735. * @example
  23736. * <pre>
  23737. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  23738. * armature.clock = factory.clock;
  23739. * </pre>
  23740. * @see dragonBones.DragonBonesData
  23741. * @see dragonBones.ArmatureData
  23742. * @see dragonBones.Armature
  23743. * @version DragonBones 3.0
  23744. * @language en_US
  23745. */
  23746. /**
  23747. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  23748. * @param armatureName - 骨架数据名称。
  23749. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  23750. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  23751. * @returns 骨架。
  23752. * @example
  23753. * <pre>
  23754. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  23755. * armature.clock = factory.clock;
  23756. * </pre>
  23757. * @see dragonBones.DragonBonesData
  23758. * @see dragonBones.ArmatureData
  23759. * @see dragonBones.Armature
  23760. * @version DragonBones 3.0
  23761. * @language zh_CN
  23762. */
  23763. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  23764. /**
  23765. * @private
  23766. */
  23767. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  23768. /**
  23769. * - Replaces the current display data for a particular slot with a specific display data.
  23770. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  23771. * @param dragonBonesName - The DragonBonesData instance cache name.
  23772. * @param armatureName - The armature data name.
  23773. * @param slotName - The slot data name.
  23774. * @param displayName - The display data name.
  23775. * @param slot - The slot.
  23776. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  23777. * @example
  23778. * <pre>
  23779. * let slot = armature.getSlot("weapon");
  23780. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  23781. * </pre>
  23782. * @version DragonBones 4.5
  23783. * @language en_US
  23784. */
  23785. /**
  23786. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  23787. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  23788. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  23789. * @param armatureName - 骨架数据名称。
  23790. * @param slotName - 插槽数据名称。
  23791. * @param displayName - 显示对象数据名称。
  23792. * @param slot - 插槽。
  23793. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  23794. * @example
  23795. * <pre>
  23796. * let slot = armature.getSlot("weapon");
  23797. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  23798. * </pre>
  23799. * @version DragonBones 4.5
  23800. * @language zh_CN
  23801. */
  23802. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  23803. /**
  23804. * @private
  23805. */
  23806. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  23807. /**
  23808. * - Share specific skin data with specific armature.
  23809. * @param armature - The armature.
  23810. * @param skin - The skin data.
  23811. * @param isOverride - Whether it completely override the original skin. (Default: false)
  23812. * @param exclude - A list of slot names that do not need to be replace.
  23813. * @example
  23814. * <pre>
  23815. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  23816. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  23817. * if (armatureDataB && armatureDataB.defaultSkin) {
  23818. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  23819. * }
  23820. * </pre>
  23821. * @see dragonBones.Armature
  23822. * @see dragonBones.SkinData
  23823. * @version DragonBones 5.6
  23824. * @language en_US
  23825. */
  23826. /**
  23827. * - 将特定的皮肤数据共享给特定的骨架使用。
  23828. * @param armature - 骨架。
  23829. * @param skin - 皮肤数据。
  23830. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  23831. * @param exclude - 不需要被替换的插槽名称列表。
  23832. * @example
  23833. * <pre>
  23834. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  23835. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  23836. * if (armatureDataB && armatureDataB.defaultSkin) {
  23837. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  23838. * }
  23839. * </pre>
  23840. * @see dragonBones.Armature
  23841. * @see dragonBones.SkinData
  23842. * @version DragonBones 5.6
  23843. * @language zh_CN
  23844. */
  23845. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  23846. /**
  23847. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  23848. * This enables you to make a armature template so that other armature without animations can share it's animations.
  23849. * @param armature - The armtaure.
  23850. * @param armatureData - The armature data.
  23851. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  23852. * @example
  23853. * <pre>
  23854. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  23855. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  23856. * if (armatureDataB) {
  23857. * factory.replaceAnimation(armatureA, armatureDataB);
  23858. * }
  23859. * </pre>
  23860. * @see dragonBones.Armature
  23861. * @see dragonBones.ArmatureData
  23862. * @version DragonBones 5.6
  23863. * @language en_US
  23864. */
  23865. /**
  23866. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  23867. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  23868. * @param armature - 骨架。
  23869. * @param armatureData - 骨架数据。
  23870. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  23871. * @example
  23872. * <pre>
  23873. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  23874. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  23875. * if (armatureDataB) {
  23876. * factory.replaceAnimation(armatureA, armatureDataB);
  23877. * }
  23878. * </pre>
  23879. * @see dragonBones.Armature
  23880. * @see dragonBones.ArmatureData
  23881. * @version DragonBones 5.6
  23882. * @language zh_CN
  23883. */
  23884. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  23885. /**
  23886. * @private
  23887. */
  23888. getAllDragonBonesData(): Map<DragonBonesData>;
  23889. /**
  23890. * @private
  23891. */
  23892. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  23893. /**
  23894. * - An Worldclock instance updated by engine.
  23895. * @version DragonBones 5.7
  23896. * @language en_US
  23897. */
  23898. /**
  23899. * - 由引擎驱动的 WorldClock 实例。
  23900. * @version DragonBones 5.7
  23901. * @language zh_CN
  23902. */
  23903. readonly clock: WorldClock;
  23904. /**
  23905. * @private
  23906. */
  23907. readonly dragonBones: DragonBones;
  23908. /**
  23909. * - Deprecated, please refer to {@link #replaceSkin}.
  23910. * @deprecated
  23911. * @language en_US
  23912. */
  23913. /**
  23914. * - 已废弃,请参考 {@link #replaceSkin}。
  23915. * @deprecated
  23916. * @language zh_CN
  23917. */
  23918. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  23919. /**
  23920. * - Deprecated, please refer to {@link #replaceAnimation}.
  23921. * @deprecated
  23922. * @language en_US
  23923. */
  23924. /**
  23925. * - 已废弃,请参考 {@link #replaceAnimation}。
  23926. * @deprecated
  23927. * @language zh_CN
  23928. */
  23929. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  23930. }
  23931. /**
  23932. * @internal
  23933. * @private
  23934. */
  23935. class BuildArmaturePackage {
  23936. dataName: string;
  23937. textureAtlasName: string;
  23938. data: DragonBonesData;
  23939. armature: ArmatureData;
  23940. skin: SkinData | null;
  23941. }
  23942. }
  23943. declare let jsb: any;
  23944. /** Running in the editor. */
  23945. declare let CC_EDITOR: boolean;
  23946. /** Preview in browser or simulator. */
  23947. declare let CC_PREVIEW: boolean;
  23948. /** Running in the editor or preview. */
  23949. declare let CC_DEV: boolean;
  23950. /** Running in the editor or preview, or build in debug mode. */
  23951. declare let CC_DEBUG: boolean;
  23952. /** Running in published project. */
  23953. declare let CC_BUILD: boolean;
  23954. /** Running in native platform (mobile app, desktop app, or simulator). */
  23955. declare let CC_JSB: boolean;
  23956. /** Running in the engine's unit test. */
  23957. declare let CC_TEST: boolean;
  23958. /** Running in the Wechat's mini game. */
  23959. declare let CC_WECHATGAME: boolean;
  23960. /** Running in the bricks. */
  23961. declare let CC_QQPLAY: boolean;