bundle.js 329 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997
  1. (function () {
  2. 'use strict';
  3. class ImageRunTime extends Laya.Image {
  4. constructor() {
  5. super();
  6. this.scaleTime = 80;
  7. this.clickId = false;
  8. this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
  9. this.on(Laya.Event.MOUSE_OVER, this, this.overs);
  10. this.on(Laya.Event.MOUSE_UP, this, this.scaleBig);
  11. this.on(Laya.Event.MOUSE_OUT, this, this.mouseout);
  12. }
  13. scaleBig(e) {
  14. if (!this.clickId)
  15. return;
  16. this.clickId = false;
  17. this.alpha = 1;
  18. if (this.CZ) {
  19. this.CZ();
  20. }
  21. }
  22. overs() {
  23. this.alpha = 0.7;
  24. }
  25. mouseout() {
  26. this.alpha = 1;
  27. }
  28. scaleSmall(e) {
  29. this.clickId = true;
  30. }
  31. onDestroy() {
  32. this.ClearRunTime();
  33. }
  34. ClearRunTime() {
  35. this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
  36. this.off(Laya.Event.MOUSE_UP, this, this.scaleBig);
  37. this.off(Laya.Event.MOUSE_OUT, this, this.mouseout);
  38. this.off(Laya.Event.MOUSE_OVER, this, this.overs);
  39. this.CZ = null;
  40. }
  41. }
  42. class GameTool {
  43. static getM_Vector(v1, v2) {
  44. let temp = new Laya.Vector3();
  45. Laya.Vector3.add(v1, v2, temp);
  46. return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
  47. }
  48. static SpliteString(s, sp) {
  49. var _sp = sp ? sp : ";";
  50. let s_s = s.split(_sp);
  51. let result = [];
  52. for (let i = 0; i < s_s.length; i++) {
  53. result.push(s_s[i]);
  54. }
  55. return result;
  56. }
  57. static random_1to1() {
  58. var iszheng = Math.random() > 0.5 ? -1 : 1;
  59. return Math.random() * iszheng;
  60. }
  61. static get64Encode(str) {
  62. var c1, c2, c3;
  63. var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  64. var i = 0, len = str.length, string = '';
  65. while (i < len) {
  66. c1 = str.charCodeAt(i++) & 0xff;
  67. if (i == len) {
  68. string += base64EncodeChars.charAt(c1 >> 2);
  69. string += base64EncodeChars.charAt((c1 & 0x3) << 4);
  70. string += "==";
  71. break;
  72. }
  73. c2 = str.charCodeAt(i++);
  74. if (i == len) {
  75. string += base64EncodeChars.charAt(c1 >> 2);
  76. string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  77. string += base64EncodeChars.charAt((c2 & 0xF) << 2);
  78. string += "=";
  79. break;
  80. }
  81. c3 = str.charCodeAt(i++);
  82. string += base64EncodeChars.charAt(c1 >> 2);
  83. string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  84. string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
  85. string += base64EncodeChars.charAt(c3 & 0x3F);
  86. }
  87. return string;
  88. }
  89. static randomInt(min, max) {
  90. if (max < min)
  91. return parseInt(min);
  92. return parseInt(Math.random() * (max - min + 1) + min);
  93. }
  94. }
  95. class Dictionary {
  96. constructor() {
  97. this._container = {};
  98. this._length = 0;
  99. }
  100. get container() {
  101. return this._container;
  102. }
  103. get size() {
  104. return this._length;
  105. }
  106. set(key, value) {
  107. if (!this._container.hasOwnProperty(key)) {
  108. this._length++;
  109. }
  110. this._container[key] = value;
  111. }
  112. delete(key) {
  113. if (this._container.hasOwnProperty(key)) {
  114. delete this._container[key];
  115. this._length--;
  116. }
  117. }
  118. has(key) {
  119. return this._container.hasOwnProperty(key) ? true : false;
  120. }
  121. get(key) {
  122. if (this._container.hasOwnProperty(key)) {
  123. return this._container[key];
  124. }
  125. else {
  126. return undefined;
  127. }
  128. }
  129. clear() {
  130. this._container = {};
  131. this._length = 0;
  132. }
  133. }
  134. class DispatcherManager {
  135. static get Disispatcher() {
  136. return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
  137. }
  138. static on(type, call, data) {
  139. this.Disispatcher.on(type, call, data);
  140. }
  141. static off(type, call, data) {
  142. this.Disispatcher.off(type, call, data);
  143. }
  144. static event(type, data = null) {
  145. this.Disispatcher.event(type, data);
  146. }
  147. }
  148. class EventType {
  149. loadUI() {
  150. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  151. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式"));
  152. changeActionButton.size(160, 40);
  153. changeActionButton.labelBold = true;
  154. changeActionButton.labelSize = 30;
  155. changeActionButton.sizeGrid = "4,4,4,4";
  156. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  157. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  158. changeActionButton.on(Laya.Event.CLICK, this, function () {
  159. if (++this.curStateIndex % 2 == 1) {
  160. this.sprite3D.active = false;
  161. this.lineSprite3D.active = true;
  162. changeActionButton.label = "网格模式";
  163. }
  164. else {
  165. this.sprite3D.active = true;
  166. this.lineSprite3D.active = false;
  167. changeActionButton.label = "正常模式";
  168. }
  169. });
  170. }));
  171. }
  172. }
  173. EventType.Event = {
  174. CamFollowArg: "CamFollowArg",
  175. SetAimPos: "SetAimPos",
  176. RefreshBulletCount: "RefreshBulletCount",
  177. RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
  178. GameShowTips: "GameShowTips",
  179. StartShot: 'StartShot',
  180. StopShot: 'StopShot',
  181. ShowMainUi: "ShowMainUi",
  182. SetMonery: "SetMonery",
  183. SetStage: "SetStage",
  184. SetStagePro: "SetStagePro"
  185. };
  186. class GameVersion {
  187. }
  188. GameVersion.VER = "1.0.11";
  189. GameVersion.CFG = "CFG";
  190. GameVersion.wxValue = "";
  191. GameVersion.isX = false;
  192. GameVersion.mSharePeopleScene = null;
  193. var Particle2D = Laya.Particle2D;
  194. var SoundType;
  195. (function (SoundType) {
  196. SoundType[SoundType["hit"] = 0] = "hit";
  197. SoundType[SoundType["click"] = 1] = "click";
  198. SoundType[SoundType["win"] = 2] = "win";
  199. SoundType[SoundType["defeat"] = 3] = "defeat";
  200. })(SoundType || (SoundType = {}));
  201. class SettingController {
  202. constructor() {
  203. this.vibrate = true;
  204. this.sound = true;
  205. this.SoundType = {
  206. click: "subpackage1/sound/click.mp3",
  207. win: "subpackage1/sound/vector.mp3",
  208. defeat: "subpackage1/sound/defeat.mp3",
  209. car_crush_1: "subpackage1/sound/car_crush_1.mp3",
  210. car_crush_2: "subpackage1/sound/car_crush_2.mp3",
  211. car_crush_3: "subpackage1/sound/car_crush_3.mp3",
  212. explotion1: "subpackage1/sound/explotion1.mp3",
  213. explotion2: "subpackage1/sound/explotion2.mp3",
  214. gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
  215. gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
  216. gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
  217. reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
  218. reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
  219. hitcar: "subpackage1/sound/hitcar.mp3",
  220. hitrole: "subpackage1/sound/hitrole.mp3",
  221. hit: "subpackage1/sound/hit.mp3"
  222. };
  223. this.bgm = "subpackage1/sound/bgm.mp3";
  224. }
  225. static get Instance() {
  226. return this.instasnce || (this.instasnce = new SettingController());
  227. }
  228. onAssetsLoaded(settings) {
  229. this.sp = new Particle2D(settings);
  230. this.sp.emitter.start();
  231. this.sp.play();
  232. Laya.stage.addChild(this.sp);
  233. this.sp.x = Laya.stage.width / 2;
  234. this.sp.y = Laya.stage.height / 2;
  235. }
  236. SettingSound(value) {
  237. }
  238. _playMusic(on) {
  239. }
  240. SetSoundV(value) {
  241. }
  242. PlaySound(type) {
  243. }
  244. StopSound(type) {
  245. }
  246. Init() {
  247. var v = Laya.LocalStorage.getItem("vibrate");
  248. this.vibrate = Number(v) ? v == "1" ? true : false : true;
  249. }
  250. }
  251. class ShareModule {
  252. static GoShare(callBack) {
  253. ShareModule.ShareTime = new Date().getTime();
  254. console.log("分享点击时间=" + ShareModule.ShareTime);
  255. ShareModule.IsSharing = true;
  256. ShareModule.callback = callBack;
  257. }
  258. static OnShowHandle() {
  259. if (Laya.Browser.window.wx) {
  260. Laya.Browser.window.wx.onShow(function (option) {
  261. SettingController.Instance.SetSoundV(1);
  262. console.log("onshow share start");
  263. console.log("进入微信");
  264. if (ShareModule.IsSharing) {
  265. ShareModule.IsSharing = false;
  266. let time = new Date().getTime();
  267. console.log("分享回到游戏时间" + time);
  268. let wait = (time - ShareModule.ShareTime) / 1000;
  269. console.log("分享停留时间为:" + wait);
  270. if (wait >= 2) {
  271. if (Math.random() <= 1) {
  272. if (!ShareModule.callback)
  273. return;
  274. ShareModule.callback(true, 1);
  275. }
  276. else {
  277. if (!ShareModule.callback)
  278. return;
  279. if (Math.random() <= 0.5) {
  280. ViewManager.Instance.ShowTips("分享失败!");
  281. }
  282. else {
  283. ViewManager.Instance.ShowTips("请分享到不同的群!");
  284. }
  285. ShareModule.callback(false, 1);
  286. }
  287. }
  288. else {
  289. if (!ShareModule.callback)
  290. return;
  291. if (Math.random() <= 0.5) {
  292. ViewManager.Instance.ShowTips("分享失败!");
  293. }
  294. else {
  295. ViewManager.Instance.ShowTips("请分享到不同的群!");
  296. }
  297. ShareModule.callback(false, 1);
  298. }
  299. }
  300. });
  301. }
  302. }
  303. }
  304. ShareModule.IsSharing = false;
  305. class OnHideHandler {
  306. static Reg() {
  307. }
  308. }
  309. var Templet = Laya.Templet;
  310. var Event = Laya.Event;
  311. class NetInfoManager {
  312. constructor() {
  313. this.mStartX = 200;
  314. this.mStartY = 500;
  315. this.mActionIndex = 0;
  316. this.mCurrIndex = 0;
  317. this.mCurrSkinIndex = 0;
  318. }
  319. static get Instance() {
  320. return this.instance || (this.instance = new NetInfoManager());
  321. }
  322. GetThing(id) {
  323. if (this._thing) {
  324. return this._thing[id - 1];
  325. }
  326. return null;
  327. }
  328. GetTheme(id) {
  329. if (this._theme) {
  330. return this._theme[id - 1];
  331. }
  332. return null;
  333. }
  334. GetRoad(id) {
  335. if (this._road) {
  336. return this._road[id - 1];
  337. }
  338. return null;
  339. }
  340. GetRate(id) {
  341. if (this._rate) {
  342. return this._rate[id - 1];
  343. }
  344. return null;
  345. }
  346. GetStreet(id) {
  347. if (this._block) {
  348. return this._block[id - 1];
  349. }
  350. return null;
  351. }
  352. GetGlobal(key) {
  353. if (this._globe) {
  354. for (let index = 0; index < this._globe.length; index++) {
  355. const element = this._globe[index];
  356. if (element.key == key) {
  357. return element.value;
  358. }
  359. }
  360. }
  361. }
  362. GetLevel(id) {
  363. if (this._level) {
  364. return this._level[id - 1];
  365. }
  366. return null;
  367. }
  368. GetAtk(id) {
  369. if (this._atk) {
  370. return this._atk[id - 1];
  371. }
  372. return null;
  373. }
  374. startFun() {
  375. this.mAniPath = "res/spine/spineRes5/vine.sk";
  376. this.mFactory = new Templet();
  377. this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
  378. this.mFactory.on(Event.ERROR, this, this.onError);
  379. this.mFactory.loadAni(this.mAniPath);
  380. }
  381. onError() {
  382. console.log("error");
  383. }
  384. parseComplete() {
  385. this.mArmature = this.mFactory.buildArmature(1);
  386. this.mArmature.x = this.mStartX;
  387. this.mArmature.y = this.mStartY;
  388. this.mArmature.scale(0.5, 0.5);
  389. Laya.stage.addChild(this.mArmature);
  390. this.mArmature.on(Event.STOPPED, this, this.completeHandler);
  391. this.play();
  392. }
  393. completeHandler() {
  394. this.play();
  395. }
  396. play() {
  397. this.mCurrIndex++;
  398. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  399. this.mCurrIndex = 0;
  400. }
  401. this.mArmature.play(this.mCurrIndex, false);
  402. }
  403. }
  404. class AssetPath {
  405. loadUI() {
  406. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  407. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换注视目标"));
  408. changeActionButton.size(200, 40);
  409. changeActionButton.labelBold = true;
  410. changeActionButton.labelSize = 30;
  411. changeActionButton.sizeGrid = "4,4,4,4";
  412. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  413. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  414. changeActionButton.on(Laya.Event.CLICK, this, function () {
  415. this.index++;
  416. if (this.index % 3 === 1) {
  417. this.camera.transform.lookAt(this.box.transform.position, this.upVector);
  418. }
  419. else if (this.index % 3 === 2) {
  420. this.camera.transform.lookAt(this.cylinder.transform.position, this.upVector);
  421. }
  422. else {
  423. this.camera.transform.lookAt(this.capsule.transform.position, this.upVector);
  424. }
  425. });
  426. }));
  427. }
  428. }
  429. AssetPath.MainScene = "subpackage/LayaScene_MainScene/Conventional/main.ls";
  430. AssetPath.Player = ["subpackage/LayaScene_Character/Conventional/Character1.lh",
  431. "subpackage/LayaScene_Character/Conventional/Character2.lh",
  432. "subpackage/LayaScene_Character/Conventional/Character3.lh",
  433. "subpackage/LayaScene_Character/Conventional/Character4.lh",
  434. "subpackage/LayaScene_Character/Conventional/Character5.lh",
  435. "subpackage/LayaScene_Character/Conventional/Character6.lh",
  436. "subpackage/LayaScene_Character/Conventional/Character7.lh",
  437. "subpackage/LayaScene_Character/Conventional/Character8.lh",
  438. ];
  439. AssetPath.Enemy = "subpackage/LayaScene_Character/Conventional/enemy.lh";
  440. AssetPath.PlayerShot = "subpackage/LayaScene_Property/Conventional/PlayerShoot.lh";
  441. AssetPath.Mound = "subpackage/LayaScene_Property/Conventional/Mound.lh";
  442. AssetPath.Barrier = [
  443. "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
  444. "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
  445. "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
  446. "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
  447. "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
  448. "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
  449. "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
  450. "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
  451. "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
  452. "subpackage/LayaScene_barrier/Conventional/Block1.lh",
  453. ];
  454. AssetPath.Particle = [
  455. "subpackage/LayaScene_Particle/Conventional/Explode.lh",
  456. "subpackage/LayaScene_Particle/Conventional/Hit.lh",
  457. "subpackage/LayaScene_Particle/Conventional/Blood.lh",
  458. ];
  459. AssetPath.Config = {
  460. level: "level",
  461. road: "road",
  462. block: "block",
  463. thing: "thing",
  464. atk: "atk",
  465. rate: "rate",
  466. global: "global",
  467. theme: "theme"
  468. };
  469. class AppSetting {
  470. constructor() {
  471. this._outHitResult = new Laya.HitResult();
  472. this.outs = new Array();
  473. this.posX = 0.0;
  474. this.posY = 0.0;
  475. this.point = new Laya.Vector2();
  476. }
  477. addBoxXYZ(x, y, z) {
  478. var mat1 = new Laya.BlinnPhongMaterial();
  479. Laya.Texture2D.load("res/threeDimen/Physics/rocks.jpg", Laya.Handler.create(null, function (tex) {
  480. mat1.albedoTexture = tex;
  481. }));
  482. var sX = Math.random() * 0.75 + 0.25;
  483. var sY = Math.random() * 0.75 + 0.25;
  484. var sZ = Math.random() * 0.75 + 0.25;
  485. var box = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ));
  486. this.scene.addChild(box);
  487. box.meshRenderer.material = mat1;
  488. this.tmpVector.setValue(x, y, z);
  489. box.transform.position = this.tmpVector;
  490. this.tmpVector.setValue(Math.random() * 360, Math.random() * 360, Math.random() * 360);
  491. box.transform.rotationEuler = this.tmpVector;
  492. var rigidBody = box.addComponent(Laya.Rigidbody3D);
  493. var boxShape = new Laya.BoxColliderShape(sX, sY, sZ);
  494. rigidBody.colliderShape = boxShape;
  495. rigidBody.mass = 10;
  496. }
  497. }
  498. AppSetting.moveTime = 1;
  499. var TiledMap = Laya.TiledMap;
  500. var Rectangle = Laya.Rectangle;
  501. var Browser = Laya.Browser;
  502. var Handler = Laya.Handler;
  503. class PlayerManager {
  504. constructor() {
  505. this.stage = 1;
  506. this.equipId = 1;
  507. this.mLastMouseX = 0;
  508. this.mLastMouseY = 0;
  509. this.mX = 0;
  510. this.mY = 0;
  511. }
  512. static get Instance() {
  513. return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
  514. }
  515. static GlobalMessage() {
  516. PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal("tower_reward"));
  517. PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal("block_reward"));
  518. PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal("enemy_reward"));
  519. }
  520. InitPlayer() {
  521. var usermodel = UserModel.Instance.CurModel;
  522. PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
  523. PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  524. this.SetInfo();
  525. }
  526. SpeedUp(level, chanel, count, callback) {
  527. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  528. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  529. if (callback)
  530. callback(true);
  531. }, (data) => {
  532. if (callback)
  533. callback(false);
  534. });
  535. }
  536. SetInfo() {
  537. let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
  538. if (power)
  539. this.powerLevel = Number(power);
  540. else
  541. this.powerLevel = 1;
  542. let al = NetInfoManager.Instance._atk.length;
  543. let t = this.powerLevel > al ? al : this.powerLevel;
  544. PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)["atk"];
  545. let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
  546. if (rate)
  547. this.rateLevel = Number(rate);
  548. else
  549. this.rateLevel = 1;
  550. let al1 = NetInfoManager.Instance._rate.length;
  551. let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
  552. PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)["rate"];
  553. }
  554. createMap() {
  555. this.tiledMap = new TiledMap();
  556. this.mX = this.mY = 0;
  557. this.tiledMap.createMap("res/tiledMap/desert.json", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler));
  558. }
  559. completeHandler() {
  560. console.log("地图创建完成");
  561. console.log("ClientW:" + Browser.clientWidth + " ClientH:" + Browser.clientHeight);
  562. Laya.stage.on(Laya.Event.RESIZE, this, this.resize);
  563. this.resize();
  564. }
  565. mouseDown() {
  566. this.mLastMouseX = Laya.stage.mouseX;
  567. this.mLastMouseY = Laya.stage.mouseY;
  568. Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  569. }
  570. mouseMove() {
  571. this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY));
  572. }
  573. mouseUp() {
  574. this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX);
  575. this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY);
  576. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  577. }
  578. resize() {
  579. this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height);
  580. }
  581. PowerUp(level, chanel, count, callback) {
  582. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  583. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  584. if (callback)
  585. callback(true);
  586. }, (data) => {
  587. if (callback)
  588. callback(false);
  589. });
  590. }
  591. }
  592. PlayerManager.bulletAttack = 1;
  593. PlayerManager.bulletTime = 0.3;
  594. class GlobalParam {
  595. }
  596. GlobalParam.playerRayLengthF = 1.3;
  597. GlobalParam.playerRayLengthLR = 0.3;
  598. GlobalParam.bulletRayLength = 1;
  599. GlobalParam.bulletMaxDis = 40;
  600. GlobalParam.barrierRoadLength = 50;
  601. GlobalParam.barrierRoadAverageNum = 50;
  602. GlobalParam.playerspeed = 0.1;
  603. GlobalParam.matespeed = 0.2;
  604. GlobalParam.hitmaxcount = 2;
  605. GlobalParam.boommaxcount = 2;
  606. GlobalParam.blockLRmoveMaxDis = 5;
  607. GlobalParam.arriveStandWidth = 5;
  608. GlobalParam.enemySpeed = 0.1;
  609. GlobalParam.shootspeed = 0.8;
  610. GlobalParam.sliderFactor = 0.02;
  611. GlobalParam.playerMoveMaxX = 4.5;
  612. var Sprite = Laya.Sprite;
  613. var Event$1 = Laya.Event;
  614. var SoundManager = Laya.SoundManager;
  615. var Handler$1 = Laya.Handler;
  616. class UserInfoManager {
  617. static GameInfo() {
  618. PlayerManager.Instance.InitPlayer();
  619. }
  620. static SetCfg(cfg) {
  621. NetInfoManager.Instance._level = cfg[AssetPath.Config.level];
  622. NetInfoManager.Instance._road = cfg[AssetPath.Config.road];
  623. NetInfoManager.Instance._block = cfg[AssetPath.Config.block];
  624. NetInfoManager.Instance._thing = cfg[AssetPath.Config.thing];
  625. NetInfoManager.Instance._atk = cfg[AssetPath.Config.atk];
  626. NetInfoManager.Instance._rate = cfg[AssetPath.Config.rate];
  627. NetInfoManager.Instance._theme = cfg[AssetPath.Config.theme];
  628. NetInfoManager.Instance._globe = cfg[AssetPath.Config.global];
  629. PlayerManager.GlobalMessage();
  630. }
  631. setup() {
  632. var gap = 10;
  633. var soundButton = this.createButton("播放音效");
  634. soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2;
  635. soundButton.y = (Laya.stage.height - soundButton.height) / 2;
  636. Laya.stage.addChild(soundButton);
  637. var musicButton = this.createButton("播放音乐");
  638. musicButton.x = soundButton.x + gap + soundButton.width;
  639. musicButton.y = soundButton.y;
  640. Laya.stage.addChild(musicButton);
  641. soundButton.on(Event$1.CLICK, this, this.onPlaySound);
  642. musicButton.on(Event$1.CLICK, this, this.onPlayMusic);
  643. }
  644. createButton(label) {
  645. var w = 110;
  646. var h = 40;
  647. var button = new Sprite();
  648. button.size(w, h);
  649. button.graphics.drawRect(0, 0, w, h, "#FF7F50");
  650. button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center");
  651. Laya.stage.addChild(button);
  652. return button;
  653. }
  654. onPlayMusic(e) {
  655. console.log("播放音乐");
  656. SoundManager.playMusic("res/sounds/bgm.mp3", 1, new Handler$1(this, this.onComplete));
  657. }
  658. onPlaySound(e) {
  659. console.log("播放音效");
  660. SoundManager.playSound("res/sounds/btn.mp3", 1, new Handler$1(this, this.onComplete));
  661. }
  662. onComplete() {
  663. console.log("播放完成");
  664. }
  665. static Appseting(data) {
  666. AppSetting.shareimage = data["shareimage"];
  667. AppSetting.sharetitle = data["sharetitle"];
  668. AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
  669. AppSetting.moveTime = Number(data["moveTime"]);
  670. AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
  671. AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
  672. AppSetting.freecoinValue = Number(data["freecoinValue"]);
  673. AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
  674. AppSetting.cheat = data["cheat"];
  675. AppSetting.cheattime = data["cheattime"];
  676. AppSetting.checkscene = data["checkscene"];
  677. GlobalParam.playerspeed = Number(data["playerspeed"]);
  678. GlobalParam.matespeed = Number(data["friendspeed"]);
  679. GlobalParam.shootspeed = Number(data["bulletspeed"]);
  680. GlobalParam.sliderFactor = Number(data["sliderFactor"]);
  681. GlobalParam.playerMoveMaxX = Number(data["playerMoveMaxX"]);
  682. GlobalParam.playerRayLengthF = Number(data["playerRayLengthF"]);
  683. GlobalParam.playerRayLengthLR = Number(data["playerRayLengthLR"]);
  684. GlobalParam.bulletRayLength = Number(data["bulletRayLength"]);
  685. GlobalParam.bulletMaxDis = Number(data["bulletMaxDis"]);
  686. GlobalParam.barrierRoadLength = Number(data["barrierRoadLength"]);
  687. GlobalParam.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
  688. GlobalParam.hitmaxcount = Number(data["hitmaxcount"]);
  689. GlobalParam.boommaxcount = Number(data["boommaxcount"]);
  690. GlobalParam.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
  691. GlobalParam.arriveStandWidth = Number(data["arriveStandWidth"]);
  692. GlobalParam.enemySpeed = Number(data["enemySpeed"]);
  693. }
  694. static get Cheat() {
  695. return AppSetting.cheat == "1";
  696. }
  697. static get CheatTime() {
  698. return Number(AppSetting.cheattime);
  699. }
  700. static get CheckScene() {
  701. return AppSetting.checkscene == "1";
  702. }
  703. }
  704. var Event$2 = Laya.Event;
  705. var HttpRequest = Laya.HttpRequest;
  706. const PROTOCOL_URL = "https://gungangfengyunapi.xwxgame.com/";
  707. class PROTOCOLS {
  708. }
  709. PROTOCOLS.protocols = {
  710. Login: "user/login",
  711. Userauth: "user/auth",
  712. BuyLand: "shop/land",
  713. UserSync: "user/sync",
  714. ShopBuild: "shop/build",
  715. ShopUpgrade: "shop/upgrade",
  716. ShopSale: "shop/sale",
  717. RoleUpgrade: "role/upgrade",
  718. Fissionvd: "fission/vd",
  719. DailyTaskrefresh: "dailytask/refresh",
  720. DailyTaskrewards: "dailytask/rewards",
  721. Rankingvmoney: "ranking/vmoney",
  722. Lotterylottery: "lottery/lottery",
  723. AchievementgetRewards: "achievement/getRewards",
  724. Fissiondeduct: "fission/deduct",
  725. Sign: "sign/sign",
  726. InvitegetRewards: "invite/getRewards",
  727. InvitetargetRewards: "invite/targetRewards",
  728. GameResult: "game/play",
  729. Easter: "game/revival",
  730. GetCfg: "config/table",
  731. DoubleAward: "fission/vd",
  732. KunDiscard: "kun/discard",
  733. KunEquip: "kun/equip",
  734. KunMove: "kun/move",
  735. KunBuy: "kun/buy",
  736. Opentreasure: "treasure/open",
  737. Entertreasure: "treasure/enter",
  738. Buy: "theme/buy",
  739. Equip: "theme/equip",
  740. themefission: "theme/fission",
  741. Start: "game/start",
  742. UpgradeAttr: "attr/upgrade"
  743. };
  744. class NetManager {
  745. PostTokenRequest(protocol, completecb, errorcb, isload = true) {
  746. let args = "";
  747. let url = PROTOCOL_URL + protocol;
  748. args = args = `token=${UserModel.Instance.CurModel.m_token}`;
  749. let httpRequest = new HttpRequest();
  750. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  751. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  752. httpRequest.send(url, args, "post", "text");
  753. if (isload) {
  754. WXSdk.ShowLoading("");
  755. }
  756. }
  757. onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
  758. let data;
  759. if (isload) {
  760. WXSdk.HideLoading();
  761. }
  762. data = JSON.parse(httpRequest.data);
  763. console.log("请求成功:" + JSON.stringify(data));
  764. if (data["code"] == 0) {
  765. UserModel.Instance.RefreshModel(data);
  766. if (succeedcb != null) {
  767. succeedcb(data);
  768. }
  769. }
  770. else {
  771. if (failurecb != null) {
  772. var mess = GameTool.SpliteString(data["message"], ",")[0];
  773. failurecb(mess);
  774. }
  775. }
  776. }
  777. onHttpRequestError(errorcb, httpRequest, isload) {
  778. if (errorcb != null) {
  779. var data = JSON.parse(httpRequest.data);
  780. errorcb(data);
  781. }
  782. console.log("Error! Http request error, code: " + data);
  783. if (isload) {
  784. WXSdk.HideLoading();
  785. }
  786. }
  787. static get Instance() {
  788. return NetManager.instance || (NetManager.instance = new NetManager());
  789. }
  790. login(progresscb, completecb, errorcb) {
  791. console.log("发送登录请求");
  792. var userInfor = UserModel.Instance;
  793. var ver = GameVersion.VER;
  794. let args = `code=${userInfor.m_code}&nickname=${userInfor.m_nickname}&avatar=${userInfor.m_avatar}&gender=${userInfor.m_gender}&country=${userInfor.m_country}&province=${userInfor.m_province}&city=${userInfor.m_city}&device=${userInfor.m_device}&share_id=${userInfor.m_share_id}&scene=${userInfor.channel}&v=${ver}`;
  795. console.log("登录 参数: " + args);
  796. let httpRequest = new HttpRequest();
  797. httpRequest.once(Event$2.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
  798. httpRequest.once(Event$2.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
  799. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  800. httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
  801. }
  802. onHttpRequestProgress() {
  803. }
  804. onLoginRequestComplete(completecb, httpRequest) {
  805. let data = JSON.parse(httpRequest.data);
  806. console.log(data);
  807. console.log("登录完成");
  808. if (data["code"] != "0") {
  809. var errInfo = JSON.stringify(httpRequest.data);
  810. console.log("登录异常错误!错误信息:", errInfo);
  811. completecb(data);
  812. return;
  813. }
  814. UserModel.Instance.SetUserModel(new NetUserModel(data["token"], data["configs"], data["app_setting"], data["user"], data["user_base"], data["user_invite"], data["user_lottery"], data["user_treasure"], data["t"], data["user_achievement"], data["user_sign"], data["user_arena"], data["is_new"], data["user_shop"], data["user_daily_task"], data["user_video"]));
  815. UserInfoManager.Appseting(data["app_setting"]);
  816. var ver = data["table_version"];
  817. UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
  818. if (c) {
  819. UserInfoManager.GameInfo();
  820. completecb(data);
  821. }
  822. });
  823. WXSdk.ShareMessage();
  824. }
  825. PostCfgRequest(completecb, errorcb) {
  826. let args = "";
  827. let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
  828. args = `token=${UserModel.Instance.CurModel.m_token}`;
  829. let httpRequest = new HttpRequest();
  830. httpRequest.once(Event$2.COMPLETE, this, () => {
  831. var data = JSON.parse(httpRequest.data);
  832. if (data["code"] == 0) {
  833. if (completecb != null) {
  834. if (data["configs"]) {
  835. completecb(data["configs"]);
  836. }
  837. }
  838. }
  839. else {
  840. if (errorcb != null) {
  841. errorcb(data);
  842. }
  843. }
  844. });
  845. httpRequest.once(Event$2.ERROR, this, () => {
  846. var data = JSON.parse(httpRequest.data);
  847. if (errorcb != null) {
  848. errorcb(data);
  849. }
  850. });
  851. httpRequest.send(url, args, "post", "text");
  852. }
  853. HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
  854. let args = "";
  855. let url = PROTOCOL_URL + protocol;
  856. if (hasToken == true) {
  857. args = `token=${UserModel.Instance.CurModel.m_token}&`;
  858. }
  859. if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
  860. || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
  861. || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
  862. || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
  863. let str = "abcdefghijkimnopqrstuvwxyz0123456789";
  864. let code = "{";
  865. let mask = "";
  866. for (let i = 0; i < 4; i++) {
  867. mask += str[Math.floor(Math.random() * 100) % str.length];
  868. }
  869. for (let i = 0; i < param.length; i++) {
  870. for (let key in param[i]) {
  871. code += "\"" + key + "\":";
  872. if (typeof param[i][key] === 'string') {
  873. code += "\"" + param[i][key] + "\"";
  874. }
  875. else {
  876. code += param[i][key];
  877. }
  878. }
  879. if (i < param.length - 1) {
  880. code += ",";
  881. }
  882. else {
  883. code += "}";
  884. }
  885. }
  886. args += "_r=" + mask + GameTool.get64Encode(code);
  887. }
  888. else {
  889. if (param != null) {
  890. for (let i = 0; i < param.length; i++) {
  891. for (let key in param[i]) {
  892. let val = param[i][key];
  893. args += `${key}=${val}`;
  894. if (i < param.length - 1) {
  895. args += "&";
  896. }
  897. }
  898. }
  899. }
  900. }
  901. let httpRequest = new HttpRequest();
  902. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  903. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
  904. httpRequest.send(url, args, "post", "text");
  905. if (isload) {
  906. WXSdk.ShowLoading("");
  907. }
  908. }
  909. static errorRequest(arg, callback) {
  910. let httpRequest = new Laya.HttpRequest();
  911. if (callback) {
  912. httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
  913. httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
  914. httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
  915. }
  916. httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
  917. }
  918. static ErrorReport() {
  919. let arg = {
  920. "code": 1003,
  921. "msg": "invalid code",
  922. "user_id": 0,
  923. "game": "parkourrace",
  924. "type": "backend",
  925. "platform": "weixin"
  926. };
  927. this.errorRequest(arg, {
  928. complete: (request) => {
  929. },
  930. error: (request) => {
  931. }
  932. });
  933. }
  934. }
  935. var UserConfigName;
  936. (function (UserConfigName) {
  937. UserConfigName[UserConfigName["train"] = 0] = "train";
  938. UserConfigName[UserConfigName["sign"] = 1] = "sign";
  939. UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
  940. })(UserConfigName || (UserConfigName = {}));
  941. var UserAttr;
  942. (function (UserAttr) {
  943. UserAttr[UserAttr["user_id"] = 0] = "user_id";
  944. UserAttr[UserAttr["diamond"] = 1] = "diamond";
  945. UserAttr[UserAttr["energy"] = 2] = "energy";
  946. UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
  947. UserAttr[UserAttr["stage"] = 4] = "stage";
  948. UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
  949. UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
  950. UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
  951. UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
  952. UserAttr[UserAttr["money"] = 9] = "money";
  953. UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
  954. UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
  955. UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
  956. UserAttr[UserAttr["attrs"] = 13] = "attrs";
  957. })(UserAttr || (UserAttr = {}));
  958. class NetUserModel {
  959. constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_lottery, _user_treasure, t, _user_achievement, _user_sign, _user_arena, is_new, user_shop, user_daily_task, user_video) {
  960. this.loginSeverTime = 0;
  961. this.m_avatar = "";
  962. this.localTime = Laya.timer.currTimer;
  963. this.loginSeverTime = t;
  964. this.m_token = _token;
  965. this.m_user = _user;
  966. this.m_base = _userbase;
  967. this.m_invite = _useInvite;
  968. this.m_lottery = _user_lottery;
  969. this.m_treasure = _user_treasure;
  970. this.m_achievement = _user_achievement;
  971. this.m_sign = _user_sign;
  972. this.m_arena = _user_arena;
  973. this.m_shop = user_shop;
  974. this.user_video = user_video;
  975. this.user_daily_task = user_daily_task;
  976. this.m_userid = this.m_user["user_id"];
  977. this.m_openid = this.m_base["openid"];
  978. this.m_nickname = this.m_base["nickname"];
  979. this.is_new = Number(is_new);
  980. }
  981. GetUserAttr(_attr) {
  982. var attr = UserAttr[_attr];
  983. return this.m_user[attr];
  984. }
  985. get ServerTime() {
  986. let time = Laya.timer.currTimer;
  987. let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
  988. return stime;
  989. }
  990. HasTheme(_id) {
  991. var data = this.GetUserAttr(UserAttr.get_themes);
  992. for (var i = 0; i < data.length; i++) {
  993. var hd = data[i];
  994. if (_id == hd) {
  995. return true;
  996. }
  997. }
  998. return false;
  999. }
  1000. GetThemeProgress(_id) {
  1001. var config = this.GetUserAttr(UserAttr.progress_themes);
  1002. var progress = config[_id] ? config[_id] : 0;
  1003. return progress;
  1004. }
  1005. JundgCfg(ver, callball) {
  1006. var cfg = Laya.LocalStorage.getJSON(GameVersion.CFG);
  1007. if (cfg) {
  1008. if (cfg.VER == ver) {
  1009. console.log("已经拥有,不用更新");
  1010. UserInfoManager.SetCfg(cfg);
  1011. callball(true);
  1012. }
  1013. else {
  1014. console.log("cfg存在但是过期了");
  1015. Laya.LocalStorage.removeItem(GameVersion.CFG);
  1016. NetManager.Instance.PostCfgRequest((data) => {
  1017. data.VER = ver;
  1018. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1019. UserInfoManager.SetCfg(data);
  1020. callball(true);
  1021. }, (data) => {
  1022. console.log("配置获取失败" + data);
  1023. callball(false);
  1024. return;
  1025. });
  1026. }
  1027. }
  1028. else {
  1029. console.log("本地没有cfg");
  1030. NetManager.Instance.PostCfgRequest((data) => {
  1031. console.log("cfg" + data);
  1032. data.VER = ver;
  1033. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1034. UserInfoManager.SetCfg(data);
  1035. callball(true);
  1036. }, (data) => {
  1037. console.log("配置获取失败" + data);
  1038. });
  1039. }
  1040. }
  1041. }
  1042. class UserModel {
  1043. get CurModel() {
  1044. return this.curModel;
  1045. }
  1046. constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
  1047. UserModel.instance = this;
  1048. this.m_code = code;
  1049. this.m_nickname = nickname ? nickname : "";
  1050. this.m_avatar = avatar ? avatar : "";
  1051. this.m_gender = gender ? gender : 0;
  1052. this.m_city = city ? city : "";
  1053. this.m_device = device ? device : "";
  1054. this.m_share_id = share_id ? share_id : "";
  1055. this.channel = channel ? channel : "";
  1056. this.m_country = country ? country : "";
  1057. this.m_province = province ? province : "";
  1058. }
  1059. static get Instance() {
  1060. if (UserModel.instance) {
  1061. return UserModel.instance;
  1062. }
  1063. else {
  1064. UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
  1065. return UserModel.instance;
  1066. }
  1067. }
  1068. SetUserModel(_model) {
  1069. this.curModel = _model;
  1070. }
  1071. RefreshModel(data) {
  1072. if (data["user"])
  1073. this.curModel.m_user = data["user"];
  1074. if (data["user_invite"])
  1075. this.curModel.m_invite = data["user_invite"];
  1076. if (data["user_lottery"])
  1077. this.curModel.m_lottery = data["user_lottery"];
  1078. if (data["user_achievement"]) {
  1079. this.curModel.m_achievement = data["user_achievement"];
  1080. }
  1081. if (data["user_sign"])
  1082. this.curModel.m_sign = data["user_sign"];
  1083. if (data["user_shop"])
  1084. this.curModel.m_shop = data["user_shop"];
  1085. if (data["user_daily_task"])
  1086. this.curModel.user_daily_task = data["user_daily_task"];
  1087. if (data["user_video"])
  1088. this.curModel.user_video = data["user_video"];
  1089. }
  1090. }
  1091. var ALDType;
  1092. (function (ALDType) {
  1093. ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
  1094. ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
  1095. })(ALDType || (ALDType = {}));
  1096. class WXSdk {
  1097. static get ShareId() {
  1098. return this.shareId;
  1099. }
  1100. static get Chanel() {
  1101. return this._chanel;
  1102. }
  1103. static init(cb) {
  1104. this.EventStatistics();
  1105. Laya.Browser.window.wx.showShareMenu({
  1106. withShareTicket: true
  1107. });
  1108. Laya.Browser.window.wx.onShow(this.InitWx);
  1109. }
  1110. static InitWx(option) {
  1111. var shareid = option.query.share_id;
  1112. this.shareId = shareid ? shareid : "";
  1113. GameVersion.wxValue = option.scene;
  1114. var scene = Laya.LocalStorage.getItem("scene");
  1115. if (scene) {
  1116. GameVersion.wxValue = scene;
  1117. console.log("读取配置场景值:" + scene);
  1118. }
  1119. else {
  1120. console.log("第一次拉取场景值:" + GameVersion.wxValue);
  1121. Laya.LocalStorage.setItem("scene", GameVersion.wxValue);
  1122. }
  1123. var channel = option.query.channel;
  1124. this._chanel = channel ? channel : "";
  1125. Laya.Browser.window.wx.offShow(WXSdk.InitWx);
  1126. }
  1127. static ShareMessage() {
  1128. if (!GameVersion.isWx)
  1129. return;
  1130. var t = UserModel.Instance.CurModel.ServerTime;
  1131. var _title;
  1132. var _url;
  1133. _title = AppSetting.sharetitle;
  1134. _url = AppSetting.shareimage;
  1135. if (_title == null) {
  1136. _title = "枪王之王...";
  1137. _url = "res/share.png";
  1138. }
  1139. else {
  1140. let a = GameTool.SpliteString(_title);
  1141. let b = GameTool.SpliteString(_url);
  1142. _title = a[GameTool.randomInt(0, a.length - 1)];
  1143. _url = b[GameTool.randomInt(0, b.length - 1)];
  1144. }
  1145. console.log("_title:", _title);
  1146. console.log("_url:", _url);
  1147. Laya.Browser.window.wx.onShareAppMessage(() => ({
  1148. title: _title,
  1149. imageUrl: _url,
  1150. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  1151. }));
  1152. }
  1153. static Login(cb) {
  1154. if (WXSdk.Lodining) {
  1155. return;
  1156. }
  1157. WXSdk.Lodining = true;
  1158. Laya.Browser.window.wx.login({
  1159. success: function (res) {
  1160. console.log("wx.login: success! res.code=" + res.code);
  1161. if (res.code) {
  1162. WXSdk.Lodining = false;
  1163. console.log("将要传递的参数:" + res);
  1164. cb(res);
  1165. }
  1166. else {
  1167. console.log('获取用户登录态失败!' + res.errMsg);
  1168. cb("error");
  1169. }
  1170. },
  1171. fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
  1172. });
  1173. }
  1174. static ShowLoading(title = "加载中...", isShowWx = true) {
  1175. console.log(title);
  1176. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1177. if (isShowWx) {
  1178. Laya.Browser.window.wx.showLoading({ title: title, mask: true });
  1179. }
  1180. ViewManager.Instance.OpenMask();
  1181. }
  1182. else {
  1183. ViewManager.Instance.OpenMask();
  1184. }
  1185. }
  1186. static HideLoading(isShowWx = true) {
  1187. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1188. if (isShowWx) {
  1189. Laya.Browser.window.wx.hideLoading();
  1190. }
  1191. ViewManager.Instance.CloseMask();
  1192. }
  1193. else {
  1194. ViewManager.Instance.CloseMask();
  1195. }
  1196. }
  1197. static SystemInfo() {
  1198. if (Laya.Browser.window.wx) {
  1199. if (!WXSdk.sysdata)
  1200. WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
  1201. return WXSdk.sysdata;
  1202. }
  1203. }
  1204. static ShowToast(text, icon = true) {
  1205. if (Laya.Browser.window.wx) {
  1206. var t_icon = icon ? "success" : "none";
  1207. text = text ? text : "暂未开放...";
  1208. Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
  1209. }
  1210. else {
  1211. console.log(text);
  1212. }
  1213. }
  1214. static ShortVibrate() {
  1215. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1216. if (WXSdk.vibrating)
  1217. return;
  1218. WXSdk.vibrating = true;
  1219. Laya.Browser.window.wx.vibrateShort({
  1220. complete: function (res) {
  1221. WXSdk.vibrating = false;
  1222. }
  1223. });
  1224. }
  1225. }
  1226. static LongVibrate() {
  1227. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1228. if (WXSdk.vibrating)
  1229. return;
  1230. WXSdk.vibrating = true;
  1231. Laya.Browser.window.wx.vibrateLong({
  1232. complete: function (res) {
  1233. WXSdk.vibrating = false;
  1234. }
  1235. });
  1236. }
  1237. }
  1238. static Success(stageId) {
  1239. if (!GameVersion.isWx)
  1240. return;
  1241. Laya.Browser.window.wx.aldStage.onEnd({
  1242. stageId: stageId,
  1243. stageName: "第" + stageId + "关",
  1244. event: "complete",
  1245. params: {
  1246. desc: "关卡完成"
  1247. }
  1248. });
  1249. }
  1250. static AldEvent(eventName, a) {
  1251. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1252. Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
  1253. }
  1254. }
  1255. static EventStatistics() {
  1256. let uuid = Laya.LocalStorage.getItem("uuidTimes");
  1257. if (uuid) {
  1258. let lastSignTime = new Date(Number(uuid));
  1259. let todayZero = new Date(Laya.timer.currTimer);
  1260. todayZero.setHours(0, 0, 0, 0);
  1261. if (lastSignTime.valueOf() < todayZero.valueOf()) {
  1262. this.IsNew = 0;
  1263. }
  1264. else {
  1265. this.IsNew = 1;
  1266. }
  1267. }
  1268. else {
  1269. this.IsNew = 1;
  1270. Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
  1271. }
  1272. }
  1273. static Fail(stageId) {
  1274. if (!GameVersion.isWx)
  1275. return;
  1276. Laya.Browser.window.wx.aldStage.onEnd({
  1277. stageId: stageId,
  1278. stageName: "第" + stageId + "关",
  1279. event: "fail",
  1280. params: {
  1281. desc: "关卡失败",
  1282. }
  1283. });
  1284. }
  1285. static Start(stageId) {
  1286. if (!GameVersion.isWx)
  1287. return;
  1288. Laya.Browser.window.wx.aldStage.onStart({
  1289. stageId: stageId,
  1290. stageName: "第" + stageId + "关",
  1291. });
  1292. }
  1293. static Game_Share(callback = null, channel = "") {
  1294. if (!GameVersion.isWx) {
  1295. return;
  1296. }
  1297. var _title;
  1298. var _url;
  1299. _title = AppSetting.sharetitle;
  1300. _url = AppSetting.shareimage;
  1301. if (_title == null) {
  1302. _title = "枪王之王...";
  1303. _url = "res/share.png";
  1304. }
  1305. else {
  1306. let a = GameTool.SpliteString(_title);
  1307. let b = GameTool.SpliteString(_url);
  1308. _title = a[GameTool.randomInt(0, a.length - 1)];
  1309. _url = b[GameTool.randomInt(0, b.length - 1)];
  1310. }
  1311. console.log("_title:", _title);
  1312. console.log("_url:", _url);
  1313. var t = UserModel.Instance.CurModel.ServerTime;
  1314. Laya.Browser.window.wx.shareAppMessage({
  1315. title: _title,
  1316. imageUrl: _url,
  1317. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
  1318. });
  1319. ShareModule.GoShare(callback);
  1320. }
  1321. static LoadSubPackage(name, callback) {
  1322. if (GameVersion.isWx) {
  1323. const loadTask = Laya.Browser.window.wx.loadSubpackage({
  1324. name: name,
  1325. success(res) {
  1326. console.log("分包下载成功:", res);
  1327. if (callback)
  1328. callback(true);
  1329. },
  1330. fail(res) {
  1331. console.log("分包下载失败:" + JSON.stringify(res));
  1332. if (callback)
  1333. callback(false);
  1334. }
  1335. });
  1336. }
  1337. else {
  1338. if (callback)
  1339. callback(true);
  1340. }
  1341. }
  1342. static IsNeedUpdate() {
  1343. if (!GameVersion.isWx)
  1344. return false;
  1345. const updateManager = Laya.Browser.window.wx.getUpdateManager();
  1346. updateManager.onCheckForUpdate(function (res) {
  1347. console.log("最新版本:" + res.hasUpdate);
  1348. });
  1349. updateManager.onUpdateReady(function () {
  1350. Laya.Browser.window.wx.showModal({
  1351. showCancel: false,
  1352. title: '更新提示',
  1353. content: '新版本已经准备好,是否重启应用?',
  1354. success(res) {
  1355. updateManager.applyUpdate();
  1356. },
  1357. fail(res) {
  1358. updateManager.applyUpdate();
  1359. }
  1360. });
  1361. });
  1362. }
  1363. static IsAuth() {
  1364. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1365. Laya.Browser.window.wx.getSetting({
  1366. success: (res) => {
  1367. console.log("授权结果..");
  1368. console.log(res);
  1369. if (res.authSetting['scope.userInfo'] == true) {
  1370. WXSdk.isAuth = true;
  1371. Laya.Browser.window.wx.getUserInfo({
  1372. lang: 'zh_CN',
  1373. success: (res) => {
  1374. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1375. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1376. console.log("已经受过权");
  1377. },
  1378. fail: () => {
  1379. console.log('调用getUserInfo fail');
  1380. }
  1381. });
  1382. }
  1383. }
  1384. });
  1385. }
  1386. }
  1387. static RequestAuth(callback) {
  1388. if (WXSdk.isAuth) {
  1389. if (callback != null) {
  1390. callback(true);
  1391. }
  1392. return;
  1393. }
  1394. if (GameVersion.isWx) {
  1395. console.log("-----授权");
  1396. let openAuthView = () => {
  1397. let w = Laya.stage.width;
  1398. let h = Laya.stage.height;
  1399. console.log("准备授权");
  1400. let button = Laya.Browser.window.wx.createUserInfoButton({
  1401. type: 'text',
  1402. text: '',
  1403. style: {
  1404. left: 0,
  1405. top: 0,
  1406. width: w,
  1407. height: h,
  1408. lineHeight: 40,
  1409. backgroundColor: '#00000000',
  1410. textAlign: 'center',
  1411. fontSize: 16,
  1412. borderRadius: 4
  1413. }
  1414. });
  1415. let opTapHandler = (res) => {
  1416. console.log("res:" + JSON.stringify(res));
  1417. if (res.userInfo) {
  1418. button.hide();
  1419. button.offTap(opTapHandler);
  1420. button.destroy();
  1421. console.log("userinfo", res);
  1422. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1423. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1424. let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
  1425. { "country": res.userInfo.country }, { "province": res.userInfo.province }];
  1426. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
  1427. WXSdk.isAuth = true;
  1428. if (callback != null) {
  1429. callback(true);
  1430. }
  1431. }, null);
  1432. }
  1433. else {
  1434. button.hide();
  1435. button.offTap(opTapHandler);
  1436. button.destroy();
  1437. if (callback != null) {
  1438. callback(false);
  1439. }
  1440. }
  1441. };
  1442. button.show();
  1443. button.onTap(opTapHandler);
  1444. };
  1445. openAuthView();
  1446. }
  1447. else {
  1448. WXSdk.isAuth = true;
  1449. if (callback != null) {
  1450. callback(true);
  1451. }
  1452. }
  1453. }
  1454. static showbjWxGameQuan(flag) {
  1455. if (!GameVersion.isWx) {
  1456. return;
  1457. }
  1458. if (flag) {
  1459. if (this.button == null) {
  1460. let info = Laya.Browser.window.wx.getSystemInfoSync();
  1461. if (!info)
  1462. return;
  1463. var top = 0.5 * info.windowHeight;
  1464. var height = 109 * info.windowHeight / Laya.stage.height;
  1465. var width = height * 80 / 109;
  1466. Laya.stage.width;
  1467. this.button = Laya.Browser.window.wx.createGameClubButton({
  1468. type: "image",
  1469. image: 'res/talk.png',
  1470. style: {
  1471. left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
  1472. top: top - 240 * info.windowHeight / Laya.stage.height,
  1473. width: width,
  1474. height: height
  1475. }
  1476. });
  1477. }
  1478. this.button.show();
  1479. }
  1480. else {
  1481. if (this.button) {
  1482. this.button.hide();
  1483. }
  1484. }
  1485. }
  1486. }
  1487. WXSdk.Lodining = false;
  1488. WXSdk.shareId = "";
  1489. WXSdk._chanel = "";
  1490. WXSdk.isAuth = false;
  1491. WXSdk.vibrating = false;
  1492. WXSdk.IsNew = 0;
  1493. var Sprite3D = Laya.Sprite3D;
  1494. var PoolType;
  1495. (function (PoolType) {
  1496. PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
  1497. PoolType[PoolType["HpText"] = 2] = "HpText";
  1498. })(PoolType || (PoolType = {}));
  1499. class GamePool {
  1500. constructor() {
  1501. this.poolDic = new Dictionary();
  1502. this.prefabDic = new Dictionary();
  1503. this.singleobjDic = new Dictionary();
  1504. }
  1505. static get Instance() {
  1506. return GamePool.instance || (GamePool.instance = new GamePool());
  1507. }
  1508. InitSelf(name, prefab) {
  1509. if (prefab != null) {
  1510. if (!this.prefabDic.has(name))
  1511. this.prefabDic.set(name, prefab);
  1512. }
  1513. }
  1514. onComplete(s) {
  1515. Laya.Sprite3D.load("res/threeDimen/staticModel/lizard/lizard.lh", Laya.Handler.create(this, function (sprite) {
  1516. var monster1 = this.scene.addChild(sprite);
  1517. monster1.transform.position = new Laya.Vector3(-0.6, 0, 0);
  1518. monster1.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1519. var monster2 = Laya.Sprite3D.instantiate(monster1, this.scene, false, new Laya.Vector3(0.6, 0, 0));
  1520. monster2.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1521. for (var i = 0; i < monster2.getChildByName("lizard").numChildren; i++) {
  1522. var meshSprite3D = monster2.getChildByName("lizard").getChildAt(i);
  1523. var material = meshSprite3D.meshRenderer.material;
  1524. Laya.Texture2D.load(this.normalMapUrl[i], Laya.Handler.create(this, function (mat, texture) {
  1525. mat.normalTexture = texture;
  1526. }, [material]));
  1527. }
  1528. Laya.timer.frameLoop(1, this, function () {
  1529. monster1.transform.rotate(this.rotation);
  1530. monster2.transform.rotate(this.rotation);
  1531. });
  1532. }));
  1533. }
  1534. GetUi(type) {
  1535. if (this.singleobjDic.has(type)) {
  1536. if (this.singleobjDic.get(type).length > 0) {
  1537. var result = this.singleobjDic.get(type).shift();
  1538. result.visible = true;
  1539. return result;
  1540. }
  1541. else {
  1542. return this.GetByType(type);
  1543. }
  1544. }
  1545. else {
  1546. return this.GetByType(type);
  1547. }
  1548. }
  1549. RecoverUi(type, go) {
  1550. go.visible = false;
  1551. go.removeSelf();
  1552. if (!this.singleobjDic.has(type)) {
  1553. this.singleobjDic.set(type, new Array());
  1554. }
  1555. this.singleobjDic.get(type).push(go);
  1556. }
  1557. RecoverModel(go) {
  1558. if (!go)
  1559. return;
  1560. go.active = false;
  1561. go.removeSelf();
  1562. var key = go.name;
  1563. if (!this.poolDic.has(key)) {
  1564. this.poolDic.set(key, new Array());
  1565. }
  1566. this.poolDic.get(key).push(go);
  1567. }
  1568. GetModel(name) {
  1569. if (name == "PlayerShoot")
  1570. GamePool.bulletCount++;
  1571. if (this.poolDic.has(name)) {
  1572. if (this.poolDic.get(name).length > 0) {
  1573. var result = this.poolDic.get(name).shift();
  1574. result.active = true;
  1575. return result;
  1576. }
  1577. else {
  1578. if (this.prefabDic.has(name)) {
  1579. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1580. curObj.name = name;
  1581. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1582. return curObj;
  1583. }
  1584. else {
  1585. return null;
  1586. }
  1587. }
  1588. }
  1589. else {
  1590. if (this.prefabDic.has(name)) {
  1591. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1592. curObj.name = name;
  1593. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1594. return curObj;
  1595. }
  1596. else {
  1597. return null;
  1598. }
  1599. }
  1600. }
  1601. onStateEnter() {
  1602. console.log("动画开始播放了");
  1603. }
  1604. onStateUpdate() {
  1605. console.log("动画状态更新了");
  1606. }
  1607. onStateExit() {
  1608. console.log("动画退出了");
  1609. }
  1610. GetByType(type) {
  1611. if (type == PoolType.WarnTips) {
  1612. var _t = new Laya.Text();
  1613. _t.width = 720;
  1614. _t.height = 60;
  1615. _t.align = "center";
  1616. _t.valign = "middle";
  1617. _t.fontSize = 35;
  1618. _t.bold = true;
  1619. _t.pivotX = 360;
  1620. _t.pivotY = 30;
  1621. _t.color = "#ffffff";
  1622. _t.stroke = 5;
  1623. _t.strokeColor = "#000000";
  1624. return _t;
  1625. }
  1626. else if (type == PoolType.HpText) {
  1627. var _t = new Laya.Text();
  1628. _t.font = "Microsoft YaHei";
  1629. _t.width = 260;
  1630. _t.height = 50;
  1631. _t.align = "center";
  1632. _t.valign = "middle";
  1633. _t.fontSize = 30;
  1634. _t.bold = true;
  1635. _t.pivotX = 130;
  1636. _t.pivotY = 25;
  1637. _t.color = "#ffffff";
  1638. return _t;
  1639. }
  1640. }
  1641. }
  1642. GamePool.modeltype = {
  1643. Mound: "Mound",
  1644. PlayerShoot: "PlayerShoot",
  1645. Player: "Character",
  1646. Enemy: "enemy"
  1647. };
  1648. GamePool.bulletCount = 0;
  1649. class FollowNumber {
  1650. constructor(t, from = 0, to = 0, tiny = 0) {
  1651. this.m_t = 0;
  1652. this.target = 0;
  1653. this.follow = 0;
  1654. this.m_tiny = 0;
  1655. this.m_t = t;
  1656. this.target = to;
  1657. this.follow = from;
  1658. this.m_tiny = tiny;
  1659. }
  1660. ChangeT(value) {
  1661. this.m_t = value;
  1662. }
  1663. get t() { return this.m_t; }
  1664. update() {
  1665. this.follow = MathTool.MixNumber(this.follow, this.target, this.m_t);
  1666. if (this.m_tiny != 0 && this.target != this.follow) {
  1667. if (Math.abs(this.target - this.follow) <= this.m_tiny) {
  1668. this.follow = this.target;
  1669. }
  1670. }
  1671. }
  1672. }
  1673. class MathTool {
  1674. static get VecZero() {
  1675. return new Laya.Vector3();
  1676. }
  1677. static RandomNumber(from, to) {
  1678. if (from >= to) {
  1679. return 0;
  1680. }
  1681. var size = to - from;
  1682. var curNumber = Math.random() * size + from;
  1683. return curNumber;
  1684. }
  1685. static SpToCam(v3) {
  1686. v3.x = -v3.x;
  1687. v3.y = v3.y - 180;
  1688. v3.z = -v3.z;
  1689. return v3;
  1690. }
  1691. static MixVector3(from, to, t, res = null) {
  1692. if (res == null) {
  1693. res = this.m_mixVector;
  1694. }
  1695. res.x = MathTool.MixNumber(from.x, to.x, t);
  1696. res.y = MathTool.MixNumber(from.y, to.y, t);
  1697. res.z = MathTool.MixNumber(from.z, to.z, t);
  1698. return res;
  1699. }
  1700. static MixNumber(from, to, t) {
  1701. t = MathTool.Clamp(t, 0, 1);
  1702. from = (to - from) * t + from;
  1703. return from;
  1704. }
  1705. static Clamp(value, from, to) {
  1706. if (value < from) {
  1707. value = from;
  1708. }
  1709. if (value > to) {
  1710. value = to;
  1711. }
  1712. return value;
  1713. }
  1714. }
  1715. MathTool.m_mixVector = new Laya.Vector3();
  1716. var ColliderGroup;
  1717. (function (ColliderGroup) {
  1718. ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
  1719. ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
  1720. ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
  1721. ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
  1722. ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
  1723. ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
  1724. })(ColliderGroup || (ColliderGroup = {}));
  1725. class MusicType {
  1726. onPreLoadFinish() {
  1727. var layaMonkeyParent = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));
  1728. var layaMonkeySon = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey2/LayaMonkey.lh");
  1729. layaMonkeySon.transform.translate(new Laya.Vector3(2.5, 0, 0));
  1730. var scale = new Laya.Vector3(0.5, 0.5, 0.5);
  1731. layaMonkeySon.transform.localScale = scale;
  1732. layaMonkeyParent.addChild(layaMonkeySon);
  1733. this.addButton(100, 120, 160, 30, "移动父级猴子", 20, function (e) {
  1734. layaMonkeyParent.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1735. });
  1736. this.addButton(100, 160, 160, 30, "放大父级猴子", 20, function (e) {
  1737. var scale = new Laya.Vector3(0.2, 0.2, 0.2);
  1738. layaMonkeyParent.transform.localScale = scale;
  1739. });
  1740. this.addButton(100, 200, 160, 30, "旋转父级猴子", 20, function (e) {
  1741. layaMonkeyParent.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1742. });
  1743. this.addButton(100, 250, 160, 30, "移动子级猴子", 20, function (e) {
  1744. layaMonkeySon.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1745. });
  1746. this.addButton(100, 290, 160, 30, "放大子级猴子", 20, function (e) {
  1747. var scale = new Laya.Vector3(1, 1, 1);
  1748. layaMonkeySon.transform.localScale = scale;
  1749. });
  1750. this.addButton(100, 330, 160, 30, "旋转子级猴子", 20, function (e) {
  1751. layaMonkeySon.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1752. });
  1753. }
  1754. addButton(x, y, width, height, text, size, clickFun) {
  1755. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () {
  1756. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text));
  1757. changeActionButton.size(width, height);
  1758. changeActionButton.labelBold = true;
  1759. changeActionButton.labelSize = size;
  1760. changeActionButton.sizeGrid = "4,4,4,4";
  1761. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  1762. changeActionButton.pos(x, y);
  1763. changeActionButton.on(Laya.Event.CLICK, this, clickFun);
  1764. }));
  1765. }
  1766. }
  1767. MusicType.Idle = "Idle";
  1768. MusicType.CrouchFiring = "CrouchFiring";
  1769. MusicType.Dance = "Dance";
  1770. MusicType.RunAndGun = "RunAndGun";
  1771. MusicType.RunningHysteric = "RunningHysteric";
  1772. var Text = Laya.Text;
  1773. class CameraManager {
  1774. static get Instance() {
  1775. return this.instance || (this.instance = new CameraManager());
  1776. }
  1777. CameraFollow(z) {
  1778. if (this.Camera)
  1779. this.Camera.MoveGame(z);
  1780. }
  1781. Init(cam, startPos) {
  1782. this.startPosTra = startPos.transform;
  1783. if (cam) {
  1784. this._maincamera = cam;
  1785. this.Camera = this._maincamera.addComponent(Camera);
  1786. this.Camera.Init();
  1787. }
  1788. }
  1789. createSampleText() {
  1790. var text = new Text();
  1791. text.overflow = Text.HIDDEN;
  1792. text.color = "#FFFFFF";
  1793. text.font = "Impact";
  1794. text.fontSize = 20;
  1795. text.borderColor = "#FFFF00";
  1796. text.x = 80;
  1797. Laya.stage.addChild(text);
  1798. text.text = "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL";
  1799. return text;
  1800. }
  1801. SetCameraAction(type, arg) {
  1802. if (this.Camera)
  1803. this.Camera.CameraAction(type, arg);
  1804. }
  1805. }
  1806. var BitmapFont = Laya.BitmapFont;
  1807. var Text$1 = Laya.Text;
  1808. var Handler$2 = Laya.Handler;
  1809. class ConstructManager {
  1810. constructor() {
  1811. this.tarDis = 30;
  1812. this.constructArr = [];
  1813. this.fontName = "diyFont";
  1814. }
  1815. static get Instance() {
  1816. return this.instance || (this.instance = new ConstructManager());
  1817. }
  1818. Init(builds) {
  1819. this.constructArr.push(builds.getChildAt(2));
  1820. this.constructArr.push(builds.getChildAt(1));
  1821. this.constructArr.push(builds.getChildAt(0));
  1822. }
  1823. CheckMainRolePos(_zp) {
  1824. let d = this.tarDis - _zp;
  1825. if (d > 0)
  1826. return;
  1827. this.SwitchRoad();
  1828. }
  1829. loadFont() {
  1830. var bitmapFont = new BitmapFont();
  1831. bitmapFont.loadFont("res/bitmapFont/test.fnt", new Handler$2(this, this.onFontLoaded, [bitmapFont]));
  1832. }
  1833. onFontLoaded(bitmapFont) {
  1834. bitmapFont.setSpaceWidth(10);
  1835. Text$1.registerBitmapFont(this.fontName, bitmapFont);
  1836. this.createText(this.fontName);
  1837. }
  1838. createText(font) {
  1839. var txt = new Text$1();
  1840. txt.width = 250;
  1841. txt.wordWrap = true;
  1842. txt.text = "Do one thing at a time, and do well.";
  1843. txt.font = font;
  1844. txt.leading = 5;
  1845. txt.pos(Laya.stage.width - txt.width >> 1, Laya.stage.height - txt.height >> 1);
  1846. Laya.stage.addChild(txt);
  1847. }
  1848. SwitchRoad() {
  1849. let rs = this.constructArr.pop();
  1850. rs.transform.localPositionZ = this.tarDis + 60;
  1851. this.constructArr.unshift(rs);
  1852. this.tarDis = this.tarDis + 30;
  1853. }
  1854. SetConstruct() {
  1855. for (let index = this.constructArr.length - 1; index >= 0; index--) {
  1856. const element = this.constructArr[index];
  1857. element.transform.localPositionZ = (2 - index) * 30;
  1858. }
  1859. this.tarDis = 30;
  1860. }
  1861. }
  1862. var Sprite$1 = Laya.Sprite;
  1863. var Handler$3 = Laya.Handler;
  1864. class LevelController {
  1865. static get Instance() {
  1866. return LevelController.instance || (LevelController.instance = new LevelController());
  1867. }
  1868. showApe() {
  1869. var ape = new Sprite$1();
  1870. Laya.stage.addChild(ape);
  1871. ape.loadImage("res/apes/monkey3.png");
  1872. Laya.loader.load("res/apes/monkey2.png", Handler$3.create(this, function () {
  1873. var t = Laya.loader.getRes("res/apes/monkey2.png");
  1874. var ape = new Sprite$1();
  1875. ape.graphics.drawTexture(t, 0, 0);
  1876. Laya.stage.addChild(ape);
  1877. ape.pos(200, 0);
  1878. }));
  1879. }
  1880. SetLevel(level) {
  1881. let len = NetInfoManager.Instance._level.length;
  1882. let index = PlayerManager.Instance.stage;
  1883. if (PlayerManager.Instance.stage > len)
  1884. index = GameTool.randomInt(1, len);
  1885. this.curLevelData = NetInfoManager.Instance.GetLevel(index);
  1886. if (!this._level)
  1887. this._level = new Level();
  1888. this._level.SetLevel(this.curLevelData);
  1889. }
  1890. }
  1891. class Level {
  1892. constructor() {
  1893. this.road_list = [];
  1894. this.fail_gold = 0;
  1895. }
  1896. createApes() {
  1897. var layoutRadius = 150;
  1898. var radianUnit = Math.PI / 2;
  1899. this.apesCtn = new Sprite$1();
  1900. Laya.stage.addChild(this.apesCtn);
  1901. for (var i = 0; i < 4; i++) {
  1902. var ape = new Sprite$1();
  1903. ape.loadImage("res/apes/monkey" + i + ".png");
  1904. ape.pivot(55, 72);
  1905. ape.pos(Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius);
  1906. this.apesCtn.addChild(ape);
  1907. }
  1908. this.apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  1909. }
  1910. SetLevel(data) {
  1911. this.road_list = GameTool.SpliteString(data["road_list"]);
  1912. this.gold = Number(data["gold"]);
  1913. this.fail_gold = Number(data["fail_gold"]);
  1914. this.enemy = data["enemy"];
  1915. this.enemy_hp = data["enemy_hp"];
  1916. this.isgold = Number(data["isgold"]) == 1;
  1917. this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
  1918. }
  1919. }
  1920. class MoundManager {
  1921. static get Instance() {
  1922. return this.instance || (this.instance = new MoundManager());
  1923. }
  1924. constructor() {
  1925. this.MoundrDic = new Dictionary();
  1926. }
  1927. Init(da) {
  1928. this.moundContainer = da;
  1929. }
  1930. MakeMound(data) {
  1931. let tower = GamePool.Instance.GetModel(GamePool.modeltype.Mound);
  1932. if (!tower)
  1933. return;
  1934. this.moundContainer.addChild(tower);
  1935. let ts = tower.getComponent(Mound);
  1936. if (!ts)
  1937. ts = tower.addComponent(Mound);
  1938. ts.SetMound(data);
  1939. this.MoundrDic.set(tower.id, ts);
  1940. }
  1941. Reset() {
  1942. let arr = [];
  1943. for (const key in this.MoundrDic.container) {
  1944. arr.push(key);
  1945. }
  1946. if (arr.length > 0) {
  1947. for (let index = 0; index < arr.length; index++) {
  1948. const element = arr[index];
  1949. let s = this.MoundrDic.get(element);
  1950. if (s)
  1951. s.Recovery();
  1952. }
  1953. }
  1954. }
  1955. RecoverMound(sp) {
  1956. this.MoundrDic.delete(sp.id);
  1957. }
  1958. HpUi() {
  1959. return GamePool.Instance.GetUi(PoolType.HpText);
  1960. }
  1961. }
  1962. class MatrixTransform {
  1963. static WorldToScreen2(camera, point) {
  1964. var pointA = this.InverseTransformPoint(camera.transform, point);
  1965. var distance = pointA.z;
  1966. var out = new Laya.Vector3();
  1967. camera.viewport.project(point, camera.projectionViewMatrix, out);
  1968. var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
  1969. return value;
  1970. }
  1971. static ScreenToWorld(camera, point) {
  1972. var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
  1973. let height = point.z * Math.tan(halfFOV);
  1974. let width = height * camera.aspectRatio;
  1975. let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
  1976. let v = this.GetScreenScale(width, height);
  1977. var value = new Laya.Vector3();
  1978. var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
  1979. value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
  1980. Laya.Vector3.add(lowerLeftA, value, value);
  1981. value = this.TransformPoint(camera.transform, value);
  1982. return value;
  1983. }
  1984. static GetScreenScale(width, height) {
  1985. var v = new Laya.Vector3();
  1986. v.x = Laya.stage.width / width / 2;
  1987. v.y = Laya.stage.height / height / 2;
  1988. return v;
  1989. }
  1990. static GetLowerLeft(transform, distance, width, height) {
  1991. var lowerLeft = new Laya.Vector3();
  1992. var right = new Laya.Vector3();
  1993. transform.getRight(right);
  1994. Laya.Vector3.normalize(right, right);
  1995. var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
  1996. Laya.Vector3.add(transform.position, xx, lowerLeft);
  1997. var up = new Laya.Vector3();
  1998. transform.getUp(up);
  1999. Laya.Vector3.normalize(up, up);
  2000. var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
  2001. Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
  2002. var forward = new Laya.Vector3();
  2003. transform.getForward(forward);
  2004. Laya.Vector3.normalize(forward, forward);
  2005. var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
  2006. Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
  2007. return lowerLeft;
  2008. }
  2009. static InverseTransformPoint(origin, point) {
  2010. var xx = new Laya.Vector3();
  2011. origin.getRight(xx);
  2012. var yy = new Laya.Vector3();
  2013. origin.getUp(yy);
  2014. var zz = new Laya.Vector3();
  2015. origin.getForward(zz);
  2016. var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
  2017. var x = this.ProjectDistance(point, origin.position, xx);
  2018. var y = this.ProjectDistance(point, origin.position, yy);
  2019. var z = this.ProjectDistance(point, origin.position, zz1);
  2020. var value = new Laya.Vector3(x, y, z);
  2021. return value;
  2022. }
  2023. static TransformPoint(origin, point) {
  2024. var value = new Laya.Vector3();
  2025. Laya.Vector3.transformQuat(point, origin.rotation, value);
  2026. Laya.Vector3.add(value, origin.position, value);
  2027. return value;
  2028. }
  2029. static ProjectDistance(A, C, B) {
  2030. var CA = new Laya.Vector3();
  2031. Laya.Vector3.subtract(A, C, CA);
  2032. var angle = this.Angle2(CA, B) * Math.PI / 180;
  2033. var distance = Laya.Vector3.distance(A, C);
  2034. distance *= Math.cos(angle);
  2035. return distance;
  2036. }
  2037. static Angle2(ma, mb) {
  2038. var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
  2039. var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
  2040. var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
  2041. var cosM = v1 / (ma_val * mb_val);
  2042. if (cosM < -1)
  2043. cosM = -1;
  2044. if (cosM > 1)
  2045. cosM = 1;
  2046. var angleAMB = Math.acos(cosM) * 180 / Math.PI;
  2047. return angleAMB;
  2048. }
  2049. }
  2050. var Sprite$2 = Laya.Sprite;
  2051. class ParticleManager {
  2052. constructor() {
  2053. this.attackmaxcount = 0;
  2054. this.explodemaxcount = 0;
  2055. }
  2056. static get Instance() {
  2057. return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
  2058. }
  2059. AttackEffect(pos) {
  2060. if (this.attackmaxcount >= GlobalParam.hitmaxcount)
  2061. return;
  2062. let h = GamePool.Instance.GetModel("Hit");
  2063. h.transform.position = pos;
  2064. Scene3DManager.Instance.effectCon.addChild(h);
  2065. this.attackmaxcount++;
  2066. Laya.timer.once(800, this, this.RecoverEffect, [h], false);
  2067. }
  2068. RecoverEffect(sp) {
  2069. GamePool.Instance.RecoverModel(sp);
  2070. this.attackmaxcount--;
  2071. }
  2072. mapLoaded() {
  2073. this.layer = this.tiledMap.getLayerByIndex(0);
  2074. var radiusX = 32;
  2075. var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
  2076. var color = "#FF7F50";
  2077. this.sprite = new Sprite$2();
  2078. this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
  2079. this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
  2080. this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
  2081. this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
  2082. Laya.stage.addChild(this.sprite);
  2083. }
  2084. ExplodeEffect(pos) {
  2085. if (this.explodemaxcount >= GlobalParam.boommaxcount)
  2086. return;
  2087. let h = GamePool.Instance.GetModel("Explode");
  2088. h.transform.position = pos;
  2089. Scene3DManager.Instance.effectCon.addChild(h);
  2090. this.explodemaxcount++;
  2091. Laya.timer.once(800, this, this.RecoverExpolde, [h], false);
  2092. }
  2093. RecoverExpolde(sp) {
  2094. GamePool.Instance.RecoverModel(sp);
  2095. this.explodemaxcount--;
  2096. }
  2097. BloodEffect(pos) {
  2098. let h = GamePool.Instance.GetModel("Blood");
  2099. h.transform.position = pos;
  2100. Scene3DManager.Instance.effectCon.addChild(h);
  2101. Laya.timer.once(800, this, this.RecoverBlood, [h], false);
  2102. }
  2103. RecoverBlood(sp) {
  2104. GamePool.Instance.RecoverModel(sp);
  2105. }
  2106. }
  2107. var Event$3 = Laya.Event;
  2108. var MouseManager = Laya.MouseManager;
  2109. var MovieClip = Laya.MovieClip;
  2110. var Animation = Laya.Animation;
  2111. class MouseEvent {
  2112. constructor() {
  2113. this.SWFPath = "res/swf/dragon.swf";
  2114. this.MCWidth = 318;
  2115. this.MCHeight = 406;
  2116. this._switch = false;
  2117. this._isCanClick = true;
  2118. this.clickD = false;
  2119. this._mousePos = MathTool.VecZero;
  2120. this.tempMouse = MathTool.VecZero;
  2121. this.clickCount = 0;
  2122. this.mStartX = 400;
  2123. this.mStartY = 500;
  2124. this.mActionIndex = 0;
  2125. this.mCurrIndex = 0;
  2126. this.mCurrSkinIndex = 0;
  2127. }
  2128. static get Instance() {
  2129. return this.instance || (this.instance = new MouseEvent());
  2130. }
  2131. InitMouseEvent() {
  2132. Laya.stage.on(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2133. Laya.stage.on(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2134. }
  2135. createMovieClip() {
  2136. var mc = new MovieClip();
  2137. mc.load(this.SWFPath);
  2138. mc.x = (Laya.stage.width - this.MCWidth) / 2;
  2139. mc.y = (Laya.stage.height - this.MCHeight) / 2;
  2140. Laya.stage.addChild(mc);
  2141. }
  2142. OnClickDown(e) {
  2143. if (!this._isCanClick || !this._switch)
  2144. return;
  2145. if (e.target instanceof Laya.UIComponent)
  2146. return;
  2147. this.clickD = true;
  2148. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2149. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2150. this._mousePos.x = MouseManager.instance.mouseX;
  2151. this._mousePos.y = MouseManager.instance.mouseY;
  2152. this.MouseD();
  2153. }
  2154. StartGameClick() {
  2155. this._switch = true;
  2156. if (!this._isCanClick)
  2157. return;
  2158. this.clickD = true;
  2159. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2160. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2161. this._mousePos.x = MouseManager.instance.mouseX;
  2162. this.MouseD();
  2163. }
  2164. MouseD() {
  2165. MainRoleManager.Instance.SetModelPos(this._mousePos.x);
  2166. MainRoleManager.Instance.CreateShoot();
  2167. }
  2168. OnClickUp(e) {
  2169. if (!this._isCanClick || !this._switch)
  2170. return;
  2171. if (!this.clickD)
  2172. return;
  2173. this.MouseU();
  2174. }
  2175. createAnimation() {
  2176. var ani = new Animation();
  2177. ani.interval = 30;
  2178. ani.index = 1;
  2179. ani.play();
  2180. var bounds = ani.getGraphicBounds();
  2181. ani.pivot(bounds.width / 2, bounds.height / 2);
  2182. ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2183. Laya.stage.addChild(ani);
  2184. }
  2185. OffMouseEvent() {
  2186. Laya.stage.off(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2187. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2188. Laya.stage.off(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2189. }
  2190. MouseU() {
  2191. this.clickD = false;
  2192. Laya.stage.off(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2193. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2194. }
  2195. OnSlider(e) {
  2196. this.tempMouse.x = MouseManager.instance.mouseX;
  2197. let offestX = this.tempMouse.x - this._mousePos.x;
  2198. if (offestX >= 0)
  2199. offestX = offestX < 20 ? offestX : 20;
  2200. if (offestX < 0)
  2201. offestX = offestX > -20 ? offestX : -20;
  2202. MainRoleManager.Instance.PlayerSlip(-offestX);
  2203. this._mousePos.x = this.tempMouse.x;
  2204. this._mousePos.y = this.tempMouse.y;
  2205. }
  2206. OpenInput() {
  2207. this.clickCount++;
  2208. if (this.clickCount > 1)
  2209. return;
  2210. this._isCanClick = true;
  2211. }
  2212. CloseInput() {
  2213. this.clickCount--;
  2214. if (this.clickCount > 0)
  2215. return;
  2216. this._isCanClick = false;
  2217. this.clickD = false;
  2218. }
  2219. set _Switch(value) {
  2220. this._switch = value;
  2221. }
  2222. play() {
  2223. this.mCurrIndex++;
  2224. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  2225. this.mCurrIndex = 0;
  2226. }
  2227. this.mArmature.play(this.mCurrIndex, false);
  2228. }
  2229. onEvent(e) {
  2230. var tEventData = e;
  2231. Laya.stage.addChild(this.mLabelSprite);
  2232. this.mLabelSprite.x = this.mStartX;
  2233. this.mLabelSprite.y = this.mStartY;
  2234. this.mLabelSprite.graphics.clear();
  2235. this.mLabelSprite.graphics.fillText(tEventData.name, 0, 0, "20px Arial", "#ff0000", "center");
  2236. }
  2237. }
  2238. var Sprite$3 = Laya.Sprite;
  2239. var ColorFilter = Laya.ColorFilter;
  2240. class Street extends Laya.Script3D {
  2241. constructor() {
  2242. super(...arguments);
  2243. this.rotate = MathTool.VecZero;
  2244. this.speed = MathTool.VecZero;
  2245. this.ApePath = "res/apes/monkey2.png";
  2246. }
  2247. onAwake() {
  2248. this.selfobj = this.owner;
  2249. this.tran = this.selfobj.transform;
  2250. }
  2251. SetMoveType() {
  2252. if (this.thing.type == 5) {
  2253. this._transform = this.selfobj.getChildAt(0).transform;
  2254. }
  2255. else {
  2256. this._transform = this.tran;
  2257. if (this.thing.type == 4) {
  2258. StreetManager.Instance.StreetAddCube(this.selfobj);
  2259. }
  2260. }
  2261. if (this.thing.moveType == 1) {
  2262. Laya.timer.frameLoop(3, this, this.CheckRecover);
  2263. return;
  2264. }
  2265. else if (this.thing.moveType == 2) {
  2266. this.rotate.x = 0;
  2267. this.rotate.y = -this.thing.moveSpeed;
  2268. this.rotate.z = 0;
  2269. Laya.timer.frameLoop(2, this, this.MoveType2);
  2270. }
  2271. else if (this.thing.moveType == 3) {
  2272. this.rotate.x = 0;
  2273. this.rotate.y = this.thing.moveSpeed;
  2274. this.rotate.z = 0;
  2275. Laya.timer.frameLoop(2, this, this.MoveType2);
  2276. }
  2277. else if (this.thing.moveType == 4) {
  2278. this.rotate.x = 0;
  2279. this.rotate.y = 0;
  2280. this.rotate.z = this.thing.moveSpeed;
  2281. Laya.timer.frameLoop(1, this, this.MoveType3);
  2282. }
  2283. else if (this.thing.moveType == 5) {
  2284. this.rotate.x = 0;
  2285. this.rotate.y = 0;
  2286. this.rotate.z = -this.thing.moveSpeed;
  2287. Laya.timer.frameLoop(1, this, this.MoveType3);
  2288. }
  2289. else if (this.thing.moveType == 6) {
  2290. this.speed.x = -this.thing.moveSpeed;
  2291. this.speed.y = 0;
  2292. this.speed.z = 0;
  2293. Laya.timer.frameLoop(1, this, this.MoveType4);
  2294. }
  2295. else if (this.thing.moveType == 7) {
  2296. this.speed.x = this.thing.moveSpeed;
  2297. this.speed.y = 0;
  2298. this.speed.z = 0;
  2299. Laya.timer.frameLoop(1, this, this.MoveType4);
  2300. }
  2301. else if (this.thing.moveType == 8) ;
  2302. else if (this.thing.moveType == 9) ;
  2303. }
  2304. setup() {
  2305. this.normalizeApe();
  2306. this.makeRedApe();
  2307. this.grayingApe();
  2308. }
  2309. normalizeApe() {
  2310. var originalApe = this.createApe();
  2311. this.apeTexture = Laya.loader.getRes(this.ApePath);
  2312. originalApe.x = (Laya.stage.width - this.apeTexture.width * 3) / 2;
  2313. originalApe.y = (Laya.stage.height - this.apeTexture.height) / 2;
  2314. }
  2315. makeRedApe() {
  2316. var redMat = [
  2317. 1, 0, 0, 0, 0,
  2318. 0, 0, 0, 0, 0,
  2319. 0, 0, 0, 0, 0,
  2320. 0, 0, 0, 1, 0,
  2321. ];
  2322. var redFilter = new ColorFilter(redMat);
  2323. var redApe = this.createApe();
  2324. redApe.filters = [redFilter];
  2325. var firstChild = Laya.stage.getChildAt(0);
  2326. redApe.x = firstChild.x + this.apeTexture.width;
  2327. redApe.y = firstChild.y;
  2328. }
  2329. grayingApe() {
  2330. var grayscaleMat = [0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0];
  2331. var grayscaleFilter = new ColorFilter(grayscaleMat);
  2332. var grayApe = this.createApe();
  2333. grayApe.filters = [grayscaleFilter];
  2334. var secondChild = Laya.stage.getChildAt(1);
  2335. grayApe.x = secondChild.x + this.apeTexture.width;
  2336. grayApe.y = secondChild.y;
  2337. }
  2338. createApe() {
  2339. var ape = new Sprite$3();
  2340. ape.loadImage("res/apes/monkey2.png");
  2341. Laya.stage.addChild(ape);
  2342. return ape;
  2343. }
  2344. MoveType4() {
  2345. this._transform.translate(this.speed);
  2346. if (Math.abs(this._transform.localPositionX) >= GlobalParam.blockLRmoveMaxDis)
  2347. this.speed.x = -this.speed.x;
  2348. this.CheckRecover();
  2349. }
  2350. MoveType2() {
  2351. this._transform.rotate(this.rotate);
  2352. this.CheckRecover();
  2353. }
  2354. MoveType3() {
  2355. this._transform.rotate(this.rotate);
  2356. if (Math.abs(this._transform.localRotationEulerZ) >= 50)
  2357. this.rotate.z = -this.rotate.z;
  2358. this.CheckRecover();
  2359. }
  2360. Recover() {
  2361. if (this.thing.type) {
  2362. StreetManager.Instance.StreetResetCube(this.selfobj.id);
  2363. }
  2364. Laya.timer.clearAll(this);
  2365. StreetManager.Instance.RecoverStreet(this.selfobj);
  2366. GamePool.Instance.RecoverModel(this.selfobj);
  2367. }
  2368. CheckRecover() {
  2369. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
  2370. console.log("回收block", this.selfobj.name);
  2371. this.Recover();
  2372. return;
  2373. }
  2374. }
  2375. SetStreet(thing) {
  2376. this.tran.localPositionZ = Number(thing.z);
  2377. this.tran.localPositionX = Number(thing.x);
  2378. this.tran.rotationEuler = MathTool.VecZero;
  2379. this.thing = thing;
  2380. if (!MainRoleManager.Instance.player)
  2381. return;
  2382. this.tarTran = MainRoleManager.Instance.player.transform;
  2383. this.SetMoveType();
  2384. }
  2385. }
  2386. var REG = Laya.ClassUtils.regClass;
  2387. var ui;
  2388. (function (ui) {
  2389. class AttributeUpViewUI extends Laya.Scene {
  2390. constructor() { super(); }
  2391. createChildren() {
  2392. super.createChildren();
  2393. this.createView(AttributeUpViewUI.uiView);
  2394. }
  2395. }
  2396. AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "14,14,13,15", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 3 }, { "type": "Box", "props": { "y": 253, "x": 42, "width": 636, "height": 538 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/webp.webp.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 40, "x": -9, "width": 655, "skin": "Main/shengji-biaoti.png", "height": 102 }, "compId": 32 }] }, { "type": "Button", "props": { "y": 556, "x": 350, "var": "rateBtn", "stateNum": 1, "skin": "Main/landi.png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "Main/gongjisudu-1.png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 4, "width": 236, "var": "_rate", "stateNum": 1, "height": 71 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "Main/jinbi-zhu.png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 5, "width": 235, "visible": false, "var": "_rateVideo", "stateNum": 1, "height": 71 }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 42 }, { "type": "Image", "props": { "y": 16.5, "x": 117.5, "skin": "Main/shipin-biao.png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 558, "x": 54, "var": "atkBtn", "stateNum": 1, "skin": "Main/hong-di.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "Main/gongjili-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 3, "width": 236, "var": "_atk", "stateNum": 1, "height": 71 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 15, "x": 61, "skin": "Main/jinbi-zhu.png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 2, "width": 238, "visible": false, "var": "_atkVideo", "stateNum": 1, "height": 71 }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 16.5, "x": 119, "skin": "Main/shipin-biao.png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "x": 201, "var": "backBtn", "skin": "Main/jixuyouxi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": 620 }, "compId": 8 }] }, { "type": "Box", "props": { "y": 384, "x": 75, "width": 571, "var": "PushBox", "height": 407 }, "compId": 72, "child": [{ "type": "Box", "props": { "y": 112, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 70 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 71 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 69 }] }, { "type": "Box", "props": { "y": 112, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 73, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 74 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 76 }] }, { "type": "Box", "props": { "y": 112, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 77, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 78 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 79 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 80 }] }, { "type": "Box", "props": { "y": 306, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 84 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 86 }] }, { "type": "Box", "props": { "y": 306, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 87 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 88 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 89 }] }, { "type": "Box", "props": { "y": 306, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 83, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 90 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 176, "x": 578, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 94 }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 68, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 20 }] } }, { "target": 73, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 20 }] } }, { "target": 77, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 20 }] } }, { "target": 81, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 20 }] } }, { "target": 82, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 20 }] } }, { "target": 83, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 20 }] } }], "name": "shakeani", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/webp.webp.png", "Main/shengji-biaoti.png", "Main/landi.png", "Main/gongjisudu-1.png", "Main/shengji-tubiao-1.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/shou.png", "Main/hong-di.png", "Main/gongjili-2.png", "Main/jixuyouxi-bt.png", "Main/exit2.png"], "loadList3D": [] };
  2397. ui.AttributeUpViewUI = AttributeUpViewUI;
  2398. REG("ui.AttributeUpViewUI", AttributeUpViewUI);
  2399. class CompleteViewUI extends Laya.Scene {
  2400. constructor() { super(); }
  2401. createChildren() {
  2402. super.createChildren();
  2403. this.createView(CompleteViewUI.uiView);
  2404. }
  2405. }
  2406. CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "10,10,12,11", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 22 }, { "type": "Box", "props": { "y": 854, "x": 178, "width": 364, "var": "winbtnBox", "height": 167 }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 120, "var": "nextBtn", "skin": "Main/no.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 19 }, "compId": 46 }, { "type": "Image", "props": { "y": 5, "x": 36, "var": "doublegetBtn", "skin": "Main/sanbeilingqu.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 28 }] }, { "type": "Image", "props": { "x": 41, "var": "shibaiTop", "skin": "Main/shibai-di bg.png", "centerY": -182 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 136, "x": 76, "skin": "Main/shibai-jiesuan-b.png" }, "compId": 121 }] }, { "type": "Image", "props": { "x": 41.5, "var": "winTop", "skin": "Main/shengli-beidi.png", "centerY": -182 }, "compId": 44, "child": [{ "type": "Image", "props": { "y": 132, "x": 76, "skin": "Main/tonggun-biao.png" }, "compId": 122 }] }, { "type": "Image", "props": { "x": 243, "width": 60, "skin": "Main/jinbi-zhu.png", "height": 60, "centerY": 120 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "x": 136, "width": 447, "height": 419, "centerY": -138 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 58, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 80, "child": [{ "type": "Image", "props": { "y": 15, "x": 17, "skin": "Main/baolei.png" }, "compId": 118 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 179, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 85, "child": [{ "type": "Image", "props": { "y": 15, "x": 13.5, "skin": "Main/rentou.png" }, "compId": 119 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 301, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 13, "x": 16, "skin": "Main/baohe.png" }, "compId": 120 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "LeftTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 96, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 98 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "LeftBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 102, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 103 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "RightTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 105, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 107 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "RightBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 109 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 110 }] }, { "type": "Button", "props": { "y": 175, "x": 568.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 123 }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 96, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 20 }] } }, { "target": 102, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 20 }] } }, { "target": 105, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 20 }] } }, { "target": 106, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 20 }] } }], "name": "pushshake", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/no.png", "Main/sanbeilingqu.png", "Main/shibai-di bg.png", "Main/shibai-jiesuan-b.png", "Main/shengli-beidi.png", "Main/tonggun-biao.png", "Main/jinbi-zhu.png", "Main/zhengchang-di.png", "Main/biaozhi-di8.png", "Main/baolei.png", "Main/rentou.png", "Main/baohe.png", "Main/hutui-1-4.png", "Main/exit2.png"], "loadList3D": [] };
  2407. ui.CompleteViewUI = CompleteViewUI;
  2408. REG("ui.CompleteViewUI", CompleteViewUI);
  2409. class ExitViewUI extends Laya.Scene {
  2410. constructor() { super(); }
  2411. createChildren() {
  2412. super.createChildren();
  2413. this.createView(ExitViewUI.uiView);
  2414. }
  2415. }
  2416. ExitViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/hutui-1-4.png", "sizeGrid": "16,16,14,14", "right": 0, "name": "BG", "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "Main/hutui-1-3.png", "height": 131 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 84, "x": 360, "width": 135, "valign": "middle", "text": "小程序", "pivotY": 31, "pivotX": 68, "height": 61, "fontSize": 35, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 154, "x": 56, "width": 92, "valign": "middle", "text": "最近使用", "pivotY": 18, "pivotX": 46, "height": 36, "fontSize": 23, "color": "#5d5353", "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }, { "type": "Image", "props": { "y": 174, "width": 753, "skin": "Main/hutui_line.png", "right": 0, "pivotY": 2, "pivotX": 320, "height": 7 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 66, "x": 37, "width": 66, "var": "CloseBtn", "pivotY": 41, "pivotX": 33, "height": 81 }, "compId": 7 }, { "type": "List", "props": { "x": 360, "width": 656, "var": "PushList", "top": 180, "spaceY": 15, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 9, "child": [{ "type": "Box", "props": { "y": 0, "width": 630, "right": 26, "renderType": "render", "height": 101 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 100, "x": 123, "width": 538, "skin": "Main/hutui_line.png", "name": "line", "height": 5 }, "compId": 18 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "name": "icon", "height": 100 }, "compId": 11 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 101, "skin": "Main/zhezhao.png", "name": "zhezhao", "height": 101 }, "compId": 17 }, { "type": "Text", "props": { "y": 0, "x": 150, "width": 473, "valign": "middle", "text": "冲冲冲冲", "name": "name", "height": 100, "fontSize": 30, "align": "left", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 65, "x": 598.5, "width": 49, "skin": "Main/hutui-1-1.png", "pivotY": 23, "pivotX": 25, "name": "star", "height": 46 }, "compId": 13 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 14 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 16 }] }] }], "loadList": ["Main/hutui-1-4.png", "Main/hutui-1-3.png", "Main/hutui_line.png", "Main/zhezhao.png", "Main/hutui-1-1.png"], "loadList3D": [] };
  2417. ui.ExitViewUI = ExitViewUI;
  2418. REG("ui.ExitViewUI", ExitViewUI);
  2419. class ExportViewUI extends Laya.Scene {
  2420. constructor() { super(); }
  2421. createChildren() {
  2422. super.createChildren();
  2423. this.createView(ExportViewUI.uiView);
  2424. }
  2425. }
  2426. ExportViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/111111.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "top": 130, "skin": "Main/haoyourwBg.png", "right": 10, "left": 10, "height": 200 }, "compId": 3, "child": [{ "type": "List", "props": { "y": 52, "x": 11.5, "width": 697, "var": "TopList", "spaceX": 20, "height": 130 }, "compId": 8, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 130, "renderType": "render", "height": 130 }, "compId": 9, "child": [{ "type": "Image", "props": { "width": 131, "name": "icon", "height": 131 }, "compId": 10 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 11 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 23 }] }] }] }, { "type": "Image", "props": { "top": 360, "skin": "Main/baokuanrwbg.png", "right": 10, "left": 10, "height": 36 }, "compId": 4 }, { "type": "Image", "props": { "x": 209.5, "top": 50, "skin": "Main/hotGameTitle.png" }, "compId": 6 }, { "type": "Button", "props": { "x": 8, "width": 172, "var": "CloseBtn", "top": 50, "stateNum": 1, "skin": "Main/backBtn.png", "height": 51 }, "compId": 7 }, { "type": "List", "props": { "x": 10, "var": "BottomList", "top": 400, "spaceY": 15, "spaceX": 40, "right": 0, "repeatX": 3, "left": 0, "bottom": 150 }, "compId": 12, "child": [{ "type": "Box", "props": { "y": 0, "x": 32, "width": 190, "renderType": "render", "height": 230 }, "compId": 13, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/bg-box.png", "sizeGrid": "33,36,40,30", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 18 }, { "type": "Image", "props": { "y": 40, "x": 0, "width": 190, "name": "icon", "height": 150 }, "compId": 14 }, { "type": "Text", "props": { "y": 190, "x": 1, "width": 189, "valign": "middle", "text": "text", "name": "tip", "height": 41, "fontSize": 23, "align": "center", "runtime": "laya.display.Text" }, "compId": 15 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 190, "name": "bottom", "height": 40 }, "compId": 16 }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 189, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 17 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 19 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 24 }] }] }, { "type": "Button", "props": { "x": 228, "width": 241, "var": "ContinueBtn", "stateNum": 1, "skin": "Main/zhengchang-di2.png", "sizeGrid": "17,31,12,28", "height": 65, "bottom": 50 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 11, "x": 33.5, "skin": "Main/jixuyouxi.png" }, "compId": 21 }] }], "loadList": ["Main/111111.png", "Main/haoyourwBg.png", "Main/baokuanrwbg.png", "Main/hotGameTitle.png", "Main/backBtn.png", "Main/bg-box.png", "Main/zhengchang-di2.png", "Main/jixuyouxi.png"], "loadList3D": [] };
  2427. ui.ExportViewUI = ExportViewUI;
  2428. REG("ui.ExportViewUI", ExportViewUI);
  2429. class GuideViewUI extends Laya.Scene {
  2430. constructor() { super(); }
  2431. createChildren() {
  2432. super.createChildren();
  2433. this.createView(GuideViewUI.uiView);
  2434. }
  2435. }
  2436. GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "Main/guangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "Main/jiantou(1).png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "Main/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "Main/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "Main/jiantou(1).png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 183, "var": "guide1Image", "skin": "Main/biaoyu.png", "bottom": 220 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "Main/biaoyu4.png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "Main/biaoyu2.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["Main/guangquan(1).png", "Main/jiantou(1).png", "Main/zuoyou-jiantou(1).png", "Main/shou.png", "Main/biaoyu.png", "Main/biaoyu4.png", "Main/biaoyu2.png"], "loadList3D": [] };
  2437. ui.GuideViewUI = GuideViewUI;
  2438. REG("ui.GuideViewUI", GuideViewUI);
  2439. class InGameViewUI extends Laya.Scene {
  2440. constructor() { super(); }
  2441. createChildren() {
  2442. super.createChildren();
  2443. this.createView(InGameViewUI.uiView);
  2444. }
  2445. }
  2446. InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  2447. ui.InGameViewUI = InGameViewUI;
  2448. REG("ui.InGameViewUI", InGameViewUI);
  2449. class IntensifyViewUI extends Laya.Scene {
  2450. constructor() { super(); }
  2451. createChildren() {
  2452. super.createChildren();
  2453. this.createView(IntensifyViewUI.uiView);
  2454. }
  2455. }
  2456. IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "sizeGrid": "0,0,0,0", "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "15,13,12,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 64 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8 }, "compId": 3 }, { "type": "Image", "props": { "y": 139, "x": 63.5, "skin": "Main/beijing-di.png" }, "compId": 36 }, { "type": "Box", "props": { "y": 402, "x": 42, "width": 636, "height": 645 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 17, "x": 44.5, "var": "atkBox", "skin": "Main/wenzi-di5.png" }, "compId": 37, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "Main/gongji-2-3.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 60 }, { "type": "Image", "props": { "y": 58.5, "x": 34, "skin": "Main/gongji-icon.png" }, "compId": 39 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "Main/gongji-1-3.png" }, "compId": 40 }, { "type": "Button", "props": { "y": 95.5, "x": 358, "var": "atkupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 7, "x": 15, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 43, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 44 }] }] }, { "type": "Text", "props": { "y": 38, "x": 390, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 226, "x": 44.5, "var": "rateBox", "skin": "Main/wenzi-di5.png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 43, "x": 170, "skin": "Main/gongji-2-2.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 62 }, { "type": "Image", "props": { "y": 63.5, "x": 35, "skin": "Main/iconqiang.png" }, "compId": 47 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "Main/gongji-1-2.png" }, "compId": 48 }, { "type": "Button", "props": { "y": 94.5, "x": 360, "var": "rateupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 49, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 51, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 52 }] }] }, { "type": "Text", "props": { "y": 33, "x": 392, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 50 }] }, { "type": "Image", "props": { "y": 445, "x": 44.5, "var": "coinBox", "skin": "Main/wenzi-di5.png" }, "compId": 53, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "Main/gongji-2.png" }, "compId": 54 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 63 }, { "type": "Image", "props": { "y": 63.5, "x": 30, "skin": "Main/jinbi.png" }, "compId": 55 }, { "type": "Image", "props": { "y": 124, "x": 161, "skin": "Main/gongji-1.png" }, "compId": 56 }, { "type": "Button", "props": { "y": 94, "x": 351, "var": "getcoinBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 57, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/shipin-biao.png", "height": 45 }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }] }] }] }] }, { "type": "Button", "props": { "y": 174.5, "x": 573, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 65 }, { "type": "Button", "props": { "y": 139, "x": 14, "var": "backBtn", "stateNum": 1, "skin": "Main/p__fanhui.png" }, "compId": 66 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng.png", "Main/beijing-di.png", "Main/wenzi-di5.png", "Main/gongji-2-3.png", "Main/zhuangbei-tubiao-di.png", "Main/gongji-icon.png", "Main/gongji-1-3.png", "Main/zheng-qianbi-di.png", "Main/jinbi-zhu.png", "Main/gongji-2-2.png", "Main/iconqiang.png", "Main/gongji-1-2.png", "Main/gongji-2.png", "Main/jinbi.png", "Main/gongji-1.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/p__fanhui.png"], "loadList3D": [] };
  2457. ui.IntensifyViewUI = IntensifyViewUI;
  2458. REG("ui.IntensifyViewUI", IntensifyViewUI);
  2459. class LoadViewUI extends Laya.Scene {
  2460. constructor() { super(); }
  2461. createChildren() {
  2462. super.createChildren();
  2463. this.createView(LoadViewUI.uiView);
  2464. }
  2465. }
  2466. LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "load/bg.png", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "x": 86, "skin": "load/title.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-di.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/shang.png" }, "compId": 21 }, { "type": "Text", "props": { "y": 0, "x": 2, "width": 442, "var": "proTex", "valign": "middle", "text": "100%", "height": 38, "fontSize": 28, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }, { "type": "Text", "props": { "y": 60, "x": 51, "width": 359, "valign": "middle", "text": "一款好玩的游戏正在加载...", "height": 37, "fontSize": 30, "font": "SimSun", "color": "#ff0000", "align": "left", "runtime": "laya.display.Text" }, "compId": 23 }] }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 20 }] } }, { "target": 10, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 10 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 20 }] } }, { "target": 11, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 20 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["load/bg.png", "load/title.png", "load/jindu-di.png", "load/shang.png"], "loadList3D": [] };
  2467. ui.LoadViewUI = LoadViewUI;
  2468. REG("ui.LoadViewUI", LoadViewUI);
  2469. class MainViewUI extends Laya.Scene {
  2470. constructor() { super(); }
  2471. createChildren() {
  2472. super.createChildren();
  2473. this.createView(MainViewUI.uiView);
  2474. }
  2475. }
  2476. MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "Main/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 1, "width": 150, "var": "pro1", "skin": "Main/jindu-guan-do.png", "height": 20 }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "Main/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "Main/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "width": 187, "top": 130, "skin": "Main/jinbi-di.png", "right": 522 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 4.5, "x": 0, "skin": "Main/jinbi-zhu.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 3.5, "x": 37, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Image", "props": { "x": 30, "var": "settingBtn", "top": 104, "skin": "Main/shezhi.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/ButtonVibrationOff.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/ButtonVibrationOn.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "Main/shengji.png", "runtime": "View/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "Main/shangdain.png", "runtime": "View/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }] }, { "type": "Image", "props": { "x": 168.5, "var": "sliderBox", "skin": "Main/zhiyin-di.png", "gray": false, "bottom": 325 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -71, "x": 27, "skin": "Main/pause1.png" }, "compId": 334 }, { "type": "Image", "props": { "y": 18, "x": 191.5, "skin": "Main/shouzhi.png", "anchorX": 0.5 }, "compId": 293 }, { "type": "Image", "props": { "y": 13.5, "x": 18, "skin": "Main/fangxiangzuo.png" }, "compId": 331 }, { "type": "Image", "props": { "y": 13.5, "x": 283, "skin": "Main/fangxiangyou.png" }, "compId": 332 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "visible": true, "right": 0, "name": "BottomBox", "left": 0, "height": 177, "bottom": 0 }, "compId": 314, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "Main/chunhei2.png", "sizeGrid": "12,11,13,10", "right": 0, "name": "BG", "left": 0, "height": 183, "bottom": 0 }, "compId": 317 }, { "type": "List", "props": { "width": 720, "var": "BottomList", "spaceX": 30, "right": 0, "repeatY": 1, "left": 0, "height": 176, "bottom": 0 }, "compId": 318, "child": [{ "type": "Box", "props": { "y": 8, "x": 18, "width": 130, "renderType": "render", "height": 160 }, "compId": 319, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 129, "skin": "Main/bg-box.png", "sizeGrid": "27,27,37,20", "name": "BG", "height": 159 }, "compId": 320 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 321 }, { "type": "Text", "props": { "y": 130, "x": 0, "width": 126, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 29, "fontSize": 20, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 322 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 130, "name": "btn", "height": 160 }, "compId": 323 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 335 }] }] }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "LeftPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 88, "pivotX": 70, "left": 20, "height": 175 }, "compId": 315, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 325 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 326 }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "RightPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "right": 21, "pivotY": 88, "pivotX": 70, "height": 175 }, "compId": 316, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 327 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 328 }] }, { "type": "Button", "props": { "y": 211, "x": 561, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 330 }, { "type": "Button", "props": { "y": 726, "x": 0, "var": "MoreGameBtn", "stateNum": 1, "skin": "Main/gengduoyouxi.png" }, "compId": 333 }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 315, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 20 }] } }], "name": "lefticon", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 316, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 20 }] } }], "name": "righticon", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/jindu-duan.png", "Main/jindu-guan-do.png", "Main/guanshu.png", "Main/shadi.png", "Main/jinbi-di.png", "Main/jinbi-zhu.png", "Main/shezhi.png", "Main/ButtonVibrationOff.png", "Main/ButtonVibrationOn.png", "Main/Icon_SoundOn.png", "Main/Icon_SoundOff.png", "Main/shengji.png", "Main/shangdain.png", "Main/zhiyin-di.png", "Main/pause1.png", "Main/shouzhi.png", "Main/fangxiangzuo.png", "Main/fangxiangyou.png", "Main/chunhei2.png", "Main/bg-box.png", "Main/hutui-1-4.png", "Main/exit2.png", "Main/gengduoyouxi.png"], "loadList3D": [] };
  2477. ui.MainViewUI = MainViewUI;
  2478. REG("ui.MainViewUI", MainViewUI);
  2479. class ShadeViewUI extends Laya.View {
  2480. constructor() { super(); }
  2481. createChildren() {
  2482. super.createChildren();
  2483. this.createView(ShadeViewUI.uiView);
  2484. }
  2485. }
  2486. ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  2487. ui.ShadeViewUI = ShadeViewUI;
  2488. REG("ui.ShadeViewUI", ShadeViewUI);
  2489. class SkinShopViewUI extends Laya.View {
  2490. constructor() { super(); }
  2491. createChildren() {
  2492. super.createChildren();
  2493. this.createView(SkinShopViewUI.uiView);
  2494. }
  2495. }
  2496. SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "13,14,14,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 115 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng1.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 238, "x": 0, "skin": "Main/pifu-biaoti.png" }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "y": 0, "x": 0, "width": 83, "var": "leftBtn", "stateNum": 1, "height": 88 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/wu-you.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/you-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "y": 51, "x": 572, "width": 94, "var": "rightBtn", "stateNum": 1, "pivotY": 51, "pivotX": 51, "height": 97 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/wu-zuo.png", "rotation": 180, "pivotY": 42, "pivotX": 40, "name": "rightFalse", "height": 84 }, "compId": 98 }, { "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/you-you.png", "pivotY": 42, "pivotX": 40, "name": "rightTrue", "height": 84 }, "compId": 99 }] }] }, { "type": "Image", "props": { "x": 163.5, "skin": "Main/dizuo.png", "centerY": 199 }, "compId": 101 }, { "type": "Image", "props": { "x": 173.5, "width": 379, "var": "viewPort", "height": 426, "centerY": 14 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "y": 9, "x": 0, "var": "using", "skin": "Main/bt.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "use", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "coin", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 26.5, "x": 40, "width": 53, "skin": "Main/jinbi-zhu.png", "height": 56 }, "compId": 109, "child": [{ "type": "Text", "props": { "y": -4.5, "x": 37, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "video", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 24, "x": 46, "width": 65, "skin": "Main/shipin-biao.png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }, { "type": "Button", "props": { "y": 155, "x": 562.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 116 }, { "type": "Button", "props": { "y": 131, "x": 18, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guanbi-bt.png" }, "compId": 117 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng1.png", "Main/pifu-biaoti.png", "Main/wu-you.png", "Main/you-zuo.png", "Main/wu-zuo.png", "Main/you-you.png", "Main/dizuo.png", "Main/bt.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/guanbi-bt.png"], "loadList3D": [] };
  2497. ui.SkinShopViewUI = SkinShopViewUI;
  2498. REG("ui.SkinShopViewUI", SkinShopViewUI);
  2499. class TopTipUiUI extends Laya.Scene {
  2500. constructor() { super(); }
  2501. createChildren() {
  2502. super.createChildren();
  2503. this.createView(TopTipUiUI.uiView);
  2504. }
  2505. }
  2506. TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "Main/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "Main/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "Main/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/huadong-tiao.png", "Main/pause1.png", "Main/shou.png"], "loadList3D": [] };
  2507. ui.TopTipUiUI = TopTipUiUI;
  2508. REG("ui.TopTipUiUI", TopTipUiUI);
  2509. class TrialViewUI extends Laya.Scene {
  2510. constructor() { super(); }
  2511. createChildren() {
  2512. super.createChildren();
  2513. this.createView(TrialViewUI.uiView);
  2514. }
  2515. }
  2516. TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "11,11,13,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 97, "x": 125, "skin": "Main/biaoti.png" }, "compId": 4 }, { "type": "Image", "props": { "y": 221, "x": 98, "visible": false, "skin": "Main/shiyong-bg.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 657, "x": 170, "skin": "Main/dizuo.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 357, "x": 169, "width": 380, "var": "viewPort", "height": 398 }, "compId": 8 }, { "type": "Box", "props": { "y": 886, "x": 196, "width": 325, "var": "btnBox", "height": 191 }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 127, "x": 91, "var": "backBtn", "skin": "Main/no-bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "y": 0, "x": 16, "var": "videoBtn", "skin": "Main/sanbeilingqu--s.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 10 }] }, { "type": "Button", "props": { "y": 203, "x": 570, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 13 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/biaoti.png", "Main/shiyong-bg.png", "Main/dizuo.png", "Main/no-bt.png", "Main/sanbeilingqu--s.png", "Main/exit2.png"], "loadList3D": [] };
  2517. ui.TrialViewUI = TrialViewUI;
  2518. REG("ui.TrialViewUI", TrialViewUI);
  2519. })(ui || (ui = {}));
  2520. class GuideView extends ui.GuideViewUI {
  2521. constructor() {
  2522. super();
  2523. this.isguide2or3 = false;
  2524. this.guide1pos = MathTool.VecZero;
  2525. this.guide1Com = false;
  2526. GuideView.instance = this;
  2527. this.Resize();
  2528. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  2529. }
  2530. static get Instance() {
  2531. return GuideView.instance;
  2532. }
  2533. OnShow(data) {
  2534. this.RegButton();
  2535. this.RefreshData();
  2536. this.RefreshUI();
  2537. }
  2538. RefreshUI() {
  2539. }
  2540. RefreshData() {
  2541. }
  2542. RegButton() {
  2543. }
  2544. TwoGuide() {
  2545. this.guide3Box.visible = true;
  2546. this.guide4Box.visible = true;
  2547. this.guide2Image.visible = true;
  2548. this.guide3.play(0, true);
  2549. this.guide4.play(0, true);
  2550. Laya.timer.frameLoop(1, this, this._twoguide);
  2551. this.guide1pos.x = -4.5;
  2552. this.guide1pos.y = 0;
  2553. }
  2554. _twoguide() {
  2555. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guidetwoPos.clone());
  2556. this.guide4Box.pos(p.x, p.y);
  2557. this.guide1pos.z = this.playerTran.localPositionZ + 5;
  2558. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  2559. this.guide3Box.pos(p1.x, p1.y);
  2560. if (this.playerTran.localPositionZ >= GuideController.Instance.guidetwoPos.z - 10) {
  2561. this.guide3Box.visible = false;
  2562. this.guide4Box.visible = false;
  2563. this.guide2Image.visible = false;
  2564. this.guide3Image.visible = true;
  2565. this.guide3.stop();
  2566. this.guide4.stop();
  2567. Laya.timer.clear(this, this._twoguide);
  2568. Laya.timer.once(5000, this, () => {
  2569. GuideController.Instance.GuideOff();
  2570. });
  2571. }
  2572. }
  2573. SetGuide(type) {
  2574. if (!this.playerTran)
  2575. this.playerTran = MainRoleManager.Instance.playerTra;
  2576. if (!this._camera)
  2577. this._camera = CameraManager.Instance._maincamera;
  2578. if (type == 1) {
  2579. this.guide1Image.visible = true;
  2580. this.guide2Image.visible = false;
  2581. this.guide3Image.visible = false;
  2582. this.guide1Box.visible = true;
  2583. this.guide1.play(0, true);
  2584. this.guide4Box.visible = false;
  2585. if (this.playerTran.localPositionX <= GuideController.Instance.guideonepos.x) {
  2586. this.guide2Box.visible = true;
  2587. this.guide3Box.visible = false;
  2588. this.isguide2or3 = true;
  2589. this.guide2.play(0, true);
  2590. }
  2591. else {
  2592. this.guide2Box.visible = false;
  2593. this.guide3Box.visible = true;
  2594. this.isguide2or3 = false;
  2595. this.guide3.play(0, true);
  2596. }
  2597. this.guide1pos = GuideController.Instance.guideonepos.clone();
  2598. Laya.timer.frameLoop(1, this, this.OneGuide);
  2599. this.guide1Com = false;
  2600. }
  2601. }
  2602. OnClose() {
  2603. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  2604. GuideView.instance = null;
  2605. Laya.timer.clearAll(this);
  2606. }
  2607. Resize() {
  2608. this.height = Laya.stage.height;
  2609. }
  2610. OneGuide() {
  2611. if (!this.guide1Com) {
  2612. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guideonepos.clone());
  2613. this.guide1Box.pos(p.x, p.y);
  2614. this.guide1pos.z = this.playerTran.localPositionZ + 10;
  2615. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  2616. if (this.isguide2or3) {
  2617. this.guide2Box.pos(p1.x, p1.y);
  2618. }
  2619. else {
  2620. this.guide3Box.pos(p1.x, p1.y);
  2621. }
  2622. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z - 5) {
  2623. this.guide2.stop();
  2624. this.guide3.stop();
  2625. this.guide2Box.visible = false;
  2626. this.guide3Box.visible = false;
  2627. this.guide1Box.visible = false;
  2628. this.guide1Com = true;
  2629. this.guide1Image.visible = false;
  2630. }
  2631. }
  2632. else {
  2633. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z) {
  2634. console.log(111);
  2635. Laya.timer.clear(this, this.OneGuide);
  2636. this.TwoGuide();
  2637. }
  2638. }
  2639. }
  2640. }
  2641. var Input = Laya.Input;
  2642. class GuideController {
  2643. constructor() {
  2644. this.guideonepos = new Laya.Vector3(2.5, 0, 59.4);
  2645. this.guidetwoPos = new Laya.Vector3(-5, 2, 104.4);
  2646. this.index = 0;
  2647. this._guide = false;
  2648. }
  2649. static get Instance() {
  2650. return this.instance || (this.instance = new GuideController());
  2651. }
  2652. GuideOn() {
  2653. if (this._guide) {
  2654. Laya.timer.once(500, this, this.Guide);
  2655. }
  2656. }
  2657. Guide() {
  2658. ViewManager.Instance.ShowGuideView();
  2659. if (GuideView.Instance) {
  2660. GuideView.Instance.SetGuide(1);
  2661. }
  2662. }
  2663. GuideOff() {
  2664. this._guide = false;
  2665. ViewManager.Instance.CloseGuideView();
  2666. }
  2667. GameOver() {
  2668. if (this._guide) {
  2669. ViewManager.Instance.CloseGuideView();
  2670. }
  2671. }
  2672. createInput() {
  2673. var inputText = new Input();
  2674. inputText.size(350, 100);
  2675. inputText.x = Laya.stage.width - inputText.width >> 1;
  2676. inputText.y = Laya.stage.height - inputText.height >> 1;
  2677. inputText.text = "这段文本不可编辑,但可复制";
  2678. inputText.editable = false;
  2679. inputText.bold = true;
  2680. inputText.bgColor = "#666666";
  2681. inputText.color = "#ffffff";
  2682. inputText.fontSize = 20;
  2683. Laya.stage.addChild(inputText);
  2684. }
  2685. InitGuide(p) {
  2686. if (this.index == 0) {
  2687. this.guideonepos.z = p;
  2688. this.index++;
  2689. }
  2690. else if (this.index == 1) {
  2691. this.guidetwoPos.z = p;
  2692. this.index++;
  2693. }
  2694. }
  2695. RequireGuide() {
  2696. let t = Laya.LocalStorage.getItem("guide");
  2697. if (PlayerManager.Instance.stage == 1) {
  2698. Laya.LocalStorage.setItem("guide", "1");
  2699. this._guide = true;
  2700. return true;
  2701. }
  2702. this._guide = false;
  2703. return false;
  2704. }
  2705. }
  2706. var Sprite$4 = Laya.Sprite;
  2707. class RoadArr {
  2708. constructor(blocks, blockPos) {
  2709. this.blocks = blocks;
  2710. this.blockPos = blockPos;
  2711. }
  2712. }
  2713. class BlockArr {
  2714. constructor(things, thingPos, blockHp) {
  2715. this.things = things;
  2716. this.thingPos = thingPos;
  2717. this.blockHp = blockHp;
  2718. }
  2719. }
  2720. class ThingArr {
  2721. constructor(type, prrfabName, moveType, moveSpeed) {
  2722. this.type = type;
  2723. this.prrfabName = prrfabName;
  2724. this.moveType = moveType;
  2725. this.moveSpeed = moveSpeed;
  2726. }
  2727. }
  2728. class StreetManager {
  2729. constructor() {
  2730. this.isover = false;
  2731. this.curindex = 1;
  2732. this.texture1 = "res/apes/monkey2.png";
  2733. this.texture2 = "res/apes/monkey3.png";
  2734. this.flag = false;
  2735. this.blockDic = new Dictionary();
  2736. this.cubeBlockDic = new Dictionary();
  2737. }
  2738. static get Instance() {
  2739. return StreetManager.instance || (StreetManager.instance = new StreetManager());
  2740. }
  2741. Init(BlockContainer) {
  2742. this.BlockContainer = BlockContainer;
  2743. }
  2744. SetBlock() {
  2745. this.isover = false;
  2746. this.curindex = 1;
  2747. this.CreateStreet();
  2748. }
  2749. onAssetsLoaded() {
  2750. this.ape = new Sprite$4();
  2751. Laya.stage.addChild(this.ape);
  2752. this.ape.pivot(55, 72);
  2753. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2754. this.switchTexture();
  2755. this.ape.on("click", this, this.switchTexture);
  2756. }
  2757. switchTexture() {
  2758. var textureUrl = (this.flag = !this.flag) ? this.texture1 : this.texture2;
  2759. this.ape.graphics.clear();
  2760. var texture = Laya.loader.getRes(textureUrl);
  2761. this.ape.graphics.drawTexture(texture, 0, 0);
  2762. this.ape.size(texture.width, texture.height);
  2763. }
  2764. CheckPlayerRoadPos(_zp) {
  2765. if (this.isover)
  2766. return;
  2767. let d = this.tarDis - _zp;
  2768. if (d > 0)
  2769. return;
  2770. this.StreetSwitch();
  2771. }
  2772. StreetSwitch() {
  2773. this.curindex++;
  2774. this.CreateStreet();
  2775. }
  2776. CreateSprite(road) {
  2777. if (GuideController.Instance._guide) {
  2778. GuideController.Instance.InitGuide(road.blockPos[0]);
  2779. }
  2780. let blocks = road.blocks;
  2781. let blockPos = road.blockPos;
  2782. let j = 0;
  2783. for (let index = 0; index < blocks.length; index++) {
  2784. const element = blocks[index];
  2785. const p = blockPos[index];
  2786. let things = element.things;
  2787. let thingPos = element.thingPos;
  2788. let blockHp = element.blockHp;
  2789. let isr = blockHp.length > 1;
  2790. for (let index = 0; index < things.length; index++) {
  2791. const element1 = things[index];
  2792. element1.z = p;
  2793. element1.x = thingPos[index];
  2794. element1.towerR = isr;
  2795. element1.hp = blockHp[index];
  2796. j++;
  2797. Laya.timer.frameOnce(j, this, this.Create, [element1], false);
  2798. }
  2799. }
  2800. }
  2801. Create(thing) {
  2802. if (thing.type == 1 || thing.type == 2) {
  2803. MoundManager.Instance.MakeMound(thing);
  2804. }
  2805. else {
  2806. let p = GamePool.Instance.GetModel(thing.prrfabName);
  2807. if (!p)
  2808. return;
  2809. this.BlockContainer.addChild(p);
  2810. let ts = p.getComponent(Street);
  2811. if (!ts)
  2812. ts = p.addComponent(Street);
  2813. ts.SetStreet(thing);
  2814. this.blockDic.set(p.id, ts);
  2815. }
  2816. }
  2817. RecoverStreet(sp) {
  2818. this.blockDic.delete(sp.id);
  2819. }
  2820. StreetAtkedCube(sp) {
  2821. sp.active = false;
  2822. ParticleManager.Instance.ExplodeEffect(sp.transform.position);
  2823. }
  2824. Reset() {
  2825. this.isover = false;
  2826. let arr = [];
  2827. for (const key in this.blockDic.container) {
  2828. arr.push(key);
  2829. }
  2830. let j = 1;
  2831. if (arr.length > 0) {
  2832. for (let index = 0; index < arr.length; index++) {
  2833. const element = arr[index];
  2834. let s = this.blockDic.get(element);
  2835. if (s)
  2836. s.Recover();
  2837. if (this.cubeBlockDic.has(element)) {
  2838. Laya.timer.frameOnce(j, this, this.StreetResetCube, [element], false);
  2839. j++;
  2840. }
  2841. }
  2842. }
  2843. }
  2844. StreetAddCube(sp) {
  2845. if (this.cubeBlockDic.has(sp.id))
  2846. return;
  2847. this.cubeBlockDic.set(sp.id, sp);
  2848. }
  2849. StreetResetCube(id) {
  2850. let sp = this.cubeBlockDic.get(id);
  2851. this.cubeBlockDic.delete(id);
  2852. if (!sp)
  2853. return;
  2854. console.log("回收CubeBlock,", sp.name);
  2855. for (let index = 0; index < sp.numChildren; index++) {
  2856. const element = sp.getChildAt(index);
  2857. element.active = true;
  2858. }
  2859. }
  2860. createApes() {
  2861. var gap = 300;
  2862. this.sp1 = new Sprite$4();
  2863. this.sp1.pos((Laya.stage.width - gap) / 2, Laya.stage.height / 2);
  2864. this.sp1.pivot(55, 72);
  2865. Laya.stage.addChild(this.sp1);
  2866. this.sp2 = new Sprite$4();
  2867. this.sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2);
  2868. Laya.stage.addChild(this.sp2);
  2869. Laya.timer.frameLoop(1, this, this.animate);
  2870. }
  2871. animate(e) {
  2872. this.sp1.rotation += 2;
  2873. this.sp2.rotation += 2;
  2874. }
  2875. CreateStreet() {
  2876. let road_list = LevelController.Instance._level.road_list;
  2877. if (this.curindex > road_list.length - 1) {
  2878. this.isover = true;
  2879. console.log("没有障碍物了");
  2880. return;
  2881. }
  2882. this.tarDis =
  2883. this.curindex * GlobalParam.barrierRoadLength;
  2884. let roadindex = road_list[this.curindex];
  2885. if (roadindex == 0)
  2886. return;
  2887. let roads = NetInfoManager.Instance.GetRoad(roadindex);
  2888. if (!roads)
  2889. return;
  2890. let blocks = GameTool.SpliteString(roads["blocks"]);
  2891. let blockPoss = GameTool.SpliteString(roads["position"]);
  2892. let bps = [];
  2893. let d = GlobalParam.barrierRoadLength / GlobalParam.barrierRoadAverageNum;
  2894. blockPoss.forEach(element => {
  2895. bps.push(this.tarDis + element * d);
  2896. });
  2897. let bbs = [];
  2898. blocks.forEach(element => {
  2899. let thing = NetInfoManager.Instance.GetStreet(element);
  2900. let tss = GameTool.SpliteString(thing["block_things"]);
  2901. let tps = GameTool.SpliteString(thing["thing_position"]);
  2902. let ths = GameTool.SpliteString(thing["block_hp"]);
  2903. let ttt = [];
  2904. tss.forEach(element1 => {
  2905. let t = NetInfoManager.Instance.GetThing(element1);
  2906. let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
  2907. ttt.push(tt);
  2908. });
  2909. let things = new BlockArr(ttt, tps, ths);
  2910. bbs.push(things);
  2911. });
  2912. let blockB = new RoadArr(bbs, bps);
  2913. this.CreateSprite(blockB);
  2914. }
  2915. }
  2916. var Vector3 = Laya.Vector3;
  2917. var Quaternion = Laya.Quaternion;
  2918. var Animation$1 = Laya.Animation;
  2919. var Tween = Laya.Tween;
  2920. class Opponent extends Laya.Script3D {
  2921. constructor() {
  2922. super(...arguments);
  2923. this._up = new Vector3(0, 1, 0);
  2924. this.isArrive1 = false;
  2925. this.phoenixWidth = 550;
  2926. this.phoenixHeight = 400;
  2927. this.bgColorTweener = new Tween();
  2928. this.gradientInterval = 2000;
  2929. this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
  2930. }
  2931. onAwake() {
  2932. this.selfobj = this.owner;
  2933. this.tran = this.selfobj.transform;
  2934. this.forW = MathTool.VecZero;
  2935. this.speed = GlobalParam.enemySpeed;
  2936. this.quaternion1 = new Quaternion();
  2937. }
  2938. Run() {
  2939. if (this.isArrive1) {
  2940. if (this.tarSp == null)
  2941. return;
  2942. if (!this.tarSp.active) {
  2943. this.tarSp = RoleManager.Instance.GetTar();
  2944. if (this.tarSp == null)
  2945. return;
  2946. this.tarPos = this.tarSp.transform.position.clone();
  2947. }
  2948. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2949. Vector3.normalize(this.forW, this.forW);
  2950. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2951. this.tran.translate(this.forW, false);
  2952. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2953. return;
  2954. }
  2955. Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
  2956. this.quaternion1.invert(this.quaternion1);
  2957. this.tran.rotation = this.quaternion1.clone();
  2958. }
  2959. else {
  2960. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2961. Vector3.normalize(this.forW, this.forW);
  2962. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2963. this.tran.translate(this.forW, false);
  2964. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2965. this.tarSp = RoleManager.Instance.GetTar();
  2966. this.isArrive1 = true;
  2967. if (this.tarSp == null)
  2968. return;
  2969. this.tarPos = this.tarSp.transform.position.clone();
  2970. return;
  2971. }
  2972. Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
  2973. this.quaternion1.invert(this.quaternion1);
  2974. this.tran.rotation = this.quaternion1.clone();
  2975. }
  2976. }
  2977. createPhoenixes() {
  2978. var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight);
  2979. var blendedPhoenix = this.createAnimation();
  2980. blendedPhoenix.blendMode = "lighter";
  2981. blendedPhoenix.scale(scaleFactor, scaleFactor);
  2982. blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2983. var normalPhoenix = this.createAnimation();
  2984. normalPhoenix.scale(scaleFactor, scaleFactor);
  2985. normalPhoenix.x = this.phoenixWidth * scaleFactor;
  2986. normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2987. }
  2988. createAnimation() {
  2989. var frames = [];
  2990. var animation = new Animation$1();
  2991. animation.loadImages(frames);
  2992. Laya.stage.addChild(animation);
  2993. var clips = animation.frames.concat();
  2994. clips = clips.reverse();
  2995. animation.frames = animation.frames.concat(clips);
  2996. animation.play();
  2997. return animation;
  2998. }
  2999. Recovery() {
  3000. Laya.timer.clearAll(this);
  3001. RoleManager.Instance.RecoverEnemy(this.selfobj);
  3002. GamePool.Instance.RecoverModel(this.selfobj);
  3003. }
  3004. InitModel(tar, hp, cloth) {
  3005. this.tarSp = tar;
  3006. this.isArrive1 = false;
  3007. if (this.tarSp == null)
  3008. return;
  3009. this.tarPos = this.tarSp.transform.position.clone();
  3010. if (this.tarPos.x > 0) {
  3011. this.tarPos = PlaneManager.Instance.toured1.clone();
  3012. }
  3013. else {
  3014. this.tarPos = PlaneManager.Instance.toured2.clone();
  3015. }
  3016. this.hp = hp;
  3017. Laya.timer.frameLoop(1, this, this.Run);
  3018. }
  3019. Injured(hitpos) {
  3020. this.hp -= PlayerManager.bulletAttack;
  3021. if (this.hp <= 0) {
  3022. this.Dead();
  3023. return;
  3024. }
  3025. ParticleManager.Instance.AttackEffect(hitpos);
  3026. }
  3027. Dead() {
  3028. ParticleManager.Instance.BloodEffect(this.tran.position);
  3029. this.Recovery();
  3030. RoleManager.Instance.CheckGameOver();
  3031. GameManager.Instance.roleCount++;
  3032. }
  3033. }
  3034. var Sprite$5 = Laya.Sprite;
  3035. class RoleManager {
  3036. constructor() {
  3037. this.frameCount = 10;
  3038. this.enemyDic = new Dictionary();
  3039. }
  3040. static get Instance() {
  3041. return this.instance || (this.instance = new RoleManager());
  3042. }
  3043. Create(hp, texture) {
  3044. let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy);
  3045. if (!e)
  3046. return;
  3047. MainRoleManager.Instance.playerContainer.addChild(e);
  3048. e.transform.position = this.startPos.clone();
  3049. let ps = e.getComponent(Opponent);
  3050. if (!ps)
  3051. ps = e.addComponent(Opponent);
  3052. let sp = this.GetTar();
  3053. ps.InitModel(sp, hp, texture);
  3054. this.enemyDic.set(e.id, ps);
  3055. }
  3056. CheckGameOver() {
  3057. if (this.enemyDic.size == 0) {
  3058. MouseEvent.Instance.OnClickUp();
  3059. MainRoleManager.Instance.CreateOver();
  3060. GameManager.Instance.Congratulate();
  3061. }
  3062. }
  3063. GetOpponent() {
  3064. for (const key in this.enemyDic.container) {
  3065. const element = this.enemyDic.get(key);
  3066. return element.selfobj;
  3067. }
  3068. return null;
  3069. }
  3070. Reset() {
  3071. let arr = [];
  3072. for (const key in this.enemyDic.container) {
  3073. arr.push(key);
  3074. }
  3075. if (arr.length > 0) {
  3076. for (let index = 0; index < arr.length; index++) {
  3077. const element = arr[index];
  3078. let s = this.enemyDic.get(element);
  3079. if (s)
  3080. s.Recovery();
  3081. }
  3082. }
  3083. }
  3084. CreateOpponent(startPos) {
  3085. this.startPos = startPos;
  3086. let count = LevelController.Instance._level.enemy;
  3087. let hp = LevelController.Instance._level.enemy_hp;
  3088. let texture = LevelController.Instance._level.enemy_cloth;
  3089. for (let index = 0; index < count; index++) {
  3090. let a = index;
  3091. Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false);
  3092. }
  3093. }
  3094. createCoralRect() {
  3095. var coralRect = new Sprite$5();
  3096. coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50");
  3097. coralRect.name = "珊瑚色容器";
  3098. coralRect.size(Laya.stage.width, Laya.stage.height / 2);
  3099. Laya.stage.addChild(coralRect);
  3100. }
  3101. createDeepSkyblueRect() {
  3102. var deepSkyblueRect = new Sprite$5();
  3103. deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF");
  3104. deepSkyblueRect.name = "天蓝色矩形";
  3105. deepSkyblueRect.size(100, 100);
  3106. deepSkyblueRect.pos(10, 10);
  3107. Laya.stage.addChild(deepSkyblueRect);
  3108. }
  3109. GetTar() {
  3110. let p = MainRoleManager.Instance.NearIsdead();
  3111. if (!p) {
  3112. if (Math.random() > 0.5) {
  3113. return MainRoleManager.Instance.playerScript.body;
  3114. }
  3115. else {
  3116. let s = MateManager.Instance.GetSprite();
  3117. if (!s)
  3118. return MainRoleManager.Instance.playerScript.body;
  3119. else
  3120. return s;
  3121. }
  3122. }
  3123. else {
  3124. let s = MateManager.Instance.GetSprite();
  3125. if (!s)
  3126. return null;
  3127. else
  3128. return s;
  3129. }
  3130. }
  3131. RecoverEnemy(sp) {
  3132. this.enemyDic.delete(sp.id);
  3133. }
  3134. }
  3135. class GuangGao {
  3136. constructor() {
  3137. GuangGao.ins = this;
  3138. }
  3139. static get Instance() {
  3140. if (GuangGao.ins == null) {
  3141. return new GuangGao();
  3142. }
  3143. return GuangGao.ins;
  3144. }
  3145. static InitVideo() {
  3146. if (!Laya.Browser.onWeiXin)
  3147. return;
  3148. this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
  3149. this.fsaasfafssfa.onLoad(() => {
  3150. console.log('激励视频 广告加载成功');
  3151. this.asfasfsaffsa = true;
  3152. });
  3153. this.fsaasfafssfa.onError(err => {
  3154. console.log("激励视屏加载失败:" + err);
  3155. this.asfasfsaffsa = false;
  3156. });
  3157. this.afsfsaafsfsa = true;
  3158. }
  3159. static ShowVideo(callback) {
  3160. if (this.asfasfsaffsa) {
  3161. console.log("showVideoAd:" + this.asfasfsaffsa);
  3162. this.SetVideoCallBack(callback);
  3163. this.fsaasfafssfa.show().catch(err => {
  3164. this.fsaasfafssfa.load().then(() => {
  3165. this.SetVideoCallBack(callback);
  3166. this.fsaasfafssfa.show();
  3167. });
  3168. });
  3169. }
  3170. }
  3171. static SetVideoCallBack(callback) {
  3172. this.fsaasfafssfa.offClose();
  3173. this.fsaasfafssfa.onClose(res => {
  3174. console.log("激励视频关闭:" + res.isEnded);
  3175. if (res && res.isEnded || res === undefined) {
  3176. callback && callback(true);
  3177. }
  3178. else {
  3179. callback && callback(false);
  3180. }
  3181. this.fsaasfafssfa.offClose();
  3182. });
  3183. }
  3184. static OpenBanner(gap = 0, callVack = null, iswait = false) {
  3185. if (!Laya.Browser.onWeiXin) {
  3186. callVack && callVack(null);
  3187. return;
  3188. }
  3189. this.canshowbanner = true;
  3190. var idd = this.bannerAdUnitId;
  3191. console.log("adUnitId:" + idd);
  3192. let newBanner = Laya.Browser.window.wx.createBannerAd({
  3193. adUnitId: idd,
  3194. style: {
  3195. left: 0,
  3196. top: 0,
  3197. width: 460
  3198. }
  3199. });
  3200. newBanner.onError(err => {
  3201. console.log(err);
  3202. callVack && callVack(null);
  3203. });
  3204. newBanner.onLoad(() => {
  3205. if (this.curbanner)
  3206. this.curbanner.destroy();
  3207. this.curbanner = newBanner;
  3208. var hight = this.GetRealHight(gap);
  3209. if (callVack != null) {
  3210. callVack(hight);
  3211. }
  3212. if (this.canshowbanner && !iswait) {
  3213. this.curbanner.show();
  3214. }
  3215. else {
  3216. this.curbanner.hide();
  3217. }
  3218. });
  3219. }
  3220. static GetRealHight(gap) {
  3221. if (this.curbanner) {
  3222. let info = Laya.Browser.window.wx.getSystemInfoSync();
  3223. this.curbanner.style.width = info.windowWidth;
  3224. this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
  3225. return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
  3226. }
  3227. }
  3228. static Clear() {
  3229. Laya.timer.clearAll(this);
  3230. Laya.Tween.clearAll(this);
  3231. this.canshowbanner = false;
  3232. if (this.curbanner)
  3233. this.curbanner.hide();
  3234. }
  3235. static hidebanner() {
  3236. if (!Laya.Browser.onWeiXin)
  3237. return;
  3238. if (this.curbanner)
  3239. this.curbanner.hide();
  3240. }
  3241. static showbanner() {
  3242. if (!Laya.Browser.onWeiXin)
  3243. return;
  3244. if (this.curbanner)
  3245. this.curbanner.show();
  3246. }
  3247. static get cancheat() {
  3248. if (!UserInfoManager.Cheat) {
  3249. console.log("cheat:false-> CurAccountData.cheat != 1");
  3250. return false;
  3251. }
  3252. var checkscence = UserInfoManager.CheckScene;
  3253. if (checkscence == false) {
  3254. console.log("cheat:true-> " + GameVersion.wxValue);
  3255. return true;
  3256. }
  3257. if (GameVersion.wxValue == "1037" || GameVersion.wxValue == "1058" || GameVersion.wxValue == "1067" || GameVersion.wxValue == "1095") {
  3258. console.log("cheat:true-> " + GameVersion.wxValue);
  3259. return true;
  3260. }
  3261. console.log("cheat:false-> " + GameVersion.wxValue);
  3262. return false;
  3263. }
  3264. static CheatBanner(btn, complete = null, gap = 0) {
  3265. if (!FYHD_Sdk.iswhite) {
  3266. console.log("ignorecheat");
  3267. GuangGao.OpenBanner(0, (height) => {
  3268. });
  3269. }
  3270. else {
  3271. btn.y = Laya.stage.height - btn.height - 100;
  3272. GuangGao.OpenBanner(gap, (height) => {
  3273. if (height == null) ;
  3274. else {
  3275. console.log("cheatstart", "bottom:100");
  3276. btn.mouseEnabled = false;
  3277. var end = Laya.stage.height - height - btn.height - 20;
  3278. console.log("y:" + end);
  3279. Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
  3280. btn.mouseEnabled = true;
  3281. this.showbanner();
  3282. Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
  3283. if (complete != null) {
  3284. complete();
  3285. }
  3286. }));
  3287. });
  3288. }
  3289. }, true);
  3290. }
  3291. }
  3292. showBanner(success = null, fail = null) {
  3293. if (!Laya.Browser.onWeiXin)
  3294. return;
  3295. let ad = GuangGao.bannerAdUnitId;
  3296. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  3297. adUnitId: ad,
  3298. style: {
  3299. left: 0,
  3300. top: 0,
  3301. width: 460
  3302. }
  3303. });
  3304. bannerAd.onLoad(() => {
  3305. console.log("[LOG] Banner广告加载成功");
  3306. this.hideBanner();
  3307. this._bannerAd = bannerAd;
  3308. let info = Laya.Browser.window.wx.getSystemInfoSync();
  3309. this._bannerAd.style.width = info.windowWidth;
  3310. this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 20;
  3311. this._bannerAd.show();
  3312. success && success(this._bannerAd);
  3313. });
  3314. bannerAd.onError(err => {
  3315. console.log("[LOG] Banner广告加载失败");
  3316. console.log(err);
  3317. fail && fail();
  3318. });
  3319. }
  3320. hideBanner() {
  3321. if (!Laya.Browser.onWeiXin)
  3322. return;
  3323. if (this._bannerAd) {
  3324. this._bannerAd.hide();
  3325. this._bannerAd.destroy();
  3326. this._bannerAd = null;
  3327. }
  3328. }
  3329. }
  3330. GuangGao.videlAdUnitId = "adunit-0fb53ab4969d46bb";
  3331. GuangGao.bannerAdUnitId = "adunit-de3afc5da6054394";
  3332. GuangGao.afsfsaafsfsa = false;
  3333. GuangGao.asfasfsaffsa = false;
  3334. GuangGao.canshowbanner = true;
  3335. GuangGao.bannerhigt = 0;
  3336. class GameManager {
  3337. constructor() {
  3338. this.towerCount = 0;
  3339. this.roleCount = 0;
  3340. this.blockCount = 0;
  3341. }
  3342. static get Instance() {
  3343. return GameManager.instance || (GameManager.instance = new GameManager());
  3344. }
  3345. Start() {
  3346. this.towerCount = 0;
  3347. this.roleCount = 0;
  3348. this.blockCount = 0;
  3349. }
  3350. Win() {
  3351. WXSdk.LongVibrate();
  3352. GuangGao.Clear();
  3353. ViewManager.Instance.AddView(ViewType.CompleteView, true);
  3354. MoundManager.Instance.Reset();
  3355. StreetManager.Instance.Reset();
  3356. MateManager.Instance.Reset();
  3357. MainRoleManager.Instance.Reset();
  3358. RoleManager.Instance.Reset();
  3359. }
  3360. Congratulate(isglod = false) {
  3361. MainRoleManager.Instance.GoToTiaoWu();
  3362. if (isglod)
  3363. MateManager.Instance.TiaoWu1();
  3364. else
  3365. MateManager.Instance.TiaoWu();
  3366. CameraManager.Instance.SetCameraAction(CameraState.jump, 0.03);
  3367. Laya.timer.once(4000, this, this.Win);
  3368. }
  3369. Over() {
  3370. GuideController.Instance.GameOver();
  3371. MouseEvent.Instance.OnClickUp();
  3372. MainRoleManager.Instance.CreateOver();
  3373. MouseEvent.Instance._Switch = false;
  3374. WXSdk.LongVibrate();
  3375. GuangGao.Clear();
  3376. ViewManager.Instance.AddView(ViewType.CompleteView, false);
  3377. MoundManager.Instance.Reset();
  3378. StreetManager.Instance.Reset();
  3379. MateManager.Instance.Reset();
  3380. MainRoleManager.Instance.Reset();
  3381. MainRoleManager.Instance.HidePlayer();
  3382. RoleManager.Instance.Reset();
  3383. }
  3384. loadUI() {
  3385. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  3386. this.changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换Mesh"));
  3387. this.changeActionButton.size(160, 40);
  3388. this.changeActionButton.labelBold = true;
  3389. this.changeActionButton.labelSize = 30;
  3390. this.changeActionButton.sizeGrid = "4,4,4,4";
  3391. this.changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  3392. this.changeActionButton.pos(Laya.stage.width / 2 - this.changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  3393. this.changeActionButton.on(Laya.Event.CLICK, this, function () {
  3394. this.index++;
  3395. if (this.index % 5 === 1) {
  3396. this.sphere.meshFilter.sharedMesh = this.box;
  3397. }
  3398. else if (this.index % 5 === 2) {
  3399. this.sphere.meshFilter.sharedMesh = this.capsule;
  3400. }
  3401. else if (this.index % 5 === 3) {
  3402. this.sphere.meshFilter.sharedMesh = this.cylinder;
  3403. }
  3404. else if (this.index % 5 === 3) {
  3405. this.sphere.meshFilter.sharedMesh = this.cone;
  3406. }
  3407. else {
  3408. this.sphere.meshFilter.sharedMesh = this.sphereMesh;
  3409. }
  3410. });
  3411. }));
  3412. }
  3413. Near() {
  3414. MoundManager.Instance.Reset();
  3415. StreetManager.Instance.Reset();
  3416. }
  3417. ReStart() {
  3418. MateManager.Instance.Reset();
  3419. Scene3DManager.Instance.InItScene();
  3420. DispatcherManager.event(EventType.Event.ShowMainUi);
  3421. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  3422. }
  3423. LevelUp() {
  3424. PlayerManager.Instance.stage++;
  3425. Scene3DManager.Instance.InItScene();
  3426. ViewManager.Instance.CloseView(ViewType.CompleteView);
  3427. DispatcherManager.event(EventType.Event.ShowMainUi);
  3428. DispatcherManager.event(EventType.Event.SetStage);
  3429. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  3430. }
  3431. }
  3432. GameManager.GameNum = 0;
  3433. class Mound extends Laya.Script3D {
  3434. constructor() {
  3435. super(...arguments);
  3436. this.guideSteps = [
  3437. { x: 151, y: 575, radius: 150, tip: "res/guide/help6.png", tipx: 200, tipy: 250 },
  3438. { x: 883, y: 620, radius: 100, tip: "res/guide/help4.png", tipx: 730, tipy: 380 },
  3439. { x: 1128, y: 583, radius: 110, tip: "res/guide/help3.png", tipx: 900, tipy: 300 }
  3440. ];
  3441. this.guideStep = 0;
  3442. }
  3443. onAwake() {
  3444. this.selfobj = this.owner;
  3445. this.tran = this.selfobj.transform;
  3446. this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
  3447. this.HealthText = this.selfobj.getChildByName("HealthText").transform;
  3448. let we = this.selfobj.getChildByName("WallsEnd");
  3449. this.WallsEnd = we.transform;
  3450. this._reflect = we.getChildAt(0).meshRenderer.material;
  3451. }
  3452. HpUi() {
  3453. let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
  3454. if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
  3455. this.hpText.visible = false;
  3456. else {
  3457. if (!this.hpText.visible)
  3458. this.hpText.visible = true;
  3459. this.hpText.x = p.x;
  3460. this.hpText.y = p.y;
  3461. }
  3462. }
  3463. CheckHp() {
  3464. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
  3465. this.Recovery();
  3466. return;
  3467. }
  3468. this.HpUi();
  3469. }
  3470. nextStep() {
  3471. if (this.guideStep == this.guideSteps.length) {
  3472. Laya.stage.removeChild(this.guideContainer);
  3473. Laya.stage.removeChild(this.tipContainer);
  3474. }
  3475. else {
  3476. var step = this.guideSteps[this.guideStep++];
  3477. this.hitArea.unHit.clear();
  3478. this.hitArea.unHit.drawCircle(step.x, step.y, step.radius, "#000000");
  3479. this.interactionArea.graphics.clear();
  3480. this.interactionArea.graphics.drawCircle(step.x, step.y, step.radius, "#000000");
  3481. this.tipContainer.graphics.clear();
  3482. this.tipContainer.loadImage(step.tip);
  3483. this.tipContainer.pos(step.tipx, step.tipy);
  3484. }
  3485. }
  3486. MakeMate() {
  3487. this._mate = MateManager.Instance.MadeMate(this.FriendSpawnPoint);
  3488. }
  3489. Rescue() {
  3490. if (this._mate) {
  3491. this._mate.FallDown();
  3492. this._mate = null;
  3493. }
  3494. }
  3495. ReflectSet() {
  3496. this._reflect.albedoIntensity = 4;
  3497. Laya.timer.once(100, this, () => {
  3498. this._reflect.albedoIntensity = 1;
  3499. });
  3500. }
  3501. Recovery() {
  3502. Laya.timer.clearAll(this);
  3503. if (this.hpText) {
  3504. GamePool.Instance.RecoverUi(PoolType.HpText, this.hpText);
  3505. this.hpText = null;
  3506. }
  3507. this._reflect.albedoIntensity = 1;
  3508. MoundManager.Instance.RecoverMound(this.selfobj);
  3509. GamePool.Instance.RecoverModel(this.selfobj);
  3510. if (this._mate) {
  3511. this._mate.Recover();
  3512. this._mate = null;
  3513. }
  3514. }
  3515. Injured(hitpos) {
  3516. this._hp -= PlayerManager.bulletAttack;
  3517. if (this._hp <= 0) {
  3518. this.Rescue();
  3519. ParticleManager.Instance.ExplodeEffect(this.tran.position);
  3520. this.Recovery();
  3521. GameManager.Instance.towerCount++;
  3522. return;
  3523. }
  3524. ParticleManager.Instance.AttackEffect(hitpos);
  3525. let t = Math.ceil(this._hp);
  3526. this.hpText.text = t.toString();
  3527. this.ReflectSet();
  3528. }
  3529. SetMound(data) {
  3530. this._mate = null;
  3531. this.tarTran = MainRoleManager.Instance.player.transform;
  3532. this.tran.localPositionX = data.x;
  3533. this.tran.localPositionY = 0;
  3534. this.tran.localPositionZ = data.z;
  3535. if (data.towerR)
  3536. this.WallsEnd.localRotationEulerY = 30;
  3537. else
  3538. this.WallsEnd.localRotationEulerY = 0;
  3539. if (data.type == 1) {
  3540. this.MakeMate();
  3541. }
  3542. this._hp = data.hp;
  3543. if (!this.hpText) {
  3544. this.hpText = MoundManager.Instance.HpUi();
  3545. this.hpText.text = this._hp.toString();
  3546. if (!this._camera)
  3547. this._camera = CameraManager.Instance._maincamera;
  3548. ViewManager.Instance.popNode.addChild(this.hpText);
  3549. }
  3550. this.HpUi();
  3551. Laya.timer.frameLoop(1, this, this.CheckHp);
  3552. }
  3553. }
  3554. var Vector3$1 = Laya.Vector3;
  3555. var Sprite$6 = Laya.Sprite;
  3556. class MainRoleShot extends Laya.Script3D {
  3557. constructor() {
  3558. super(...arguments);
  3559. this.speed = MathTool.VecZero;
  3560. this._forward = new Vector3$1(0, 0, 1);
  3561. this.over = false;
  3562. }
  3563. onAwake() {
  3564. this.selfobj = this.owner;
  3565. this.tran = this.selfobj.transform;
  3566. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3567. this.speed.z = GlobalParam.shootspeed;
  3568. }
  3569. Run() {
  3570. this.tran.translate(this.speed);
  3571. let d = Vector3$1.distance(this.tarTran.position, this.tran.position);
  3572. if (d >= GlobalParam.bulletMaxDis) {
  3573. this.RecoverBullet();
  3574. return;
  3575. }
  3576. this.RayReset();
  3577. }
  3578. RecoverBullet() {
  3579. Laya.timer.clearAll(this);
  3580. GamePool.Instance.RecoverModel(this.selfobj);
  3581. GamePool.bulletCount--;
  3582. }
  3583. drawSomething() {
  3584. this.sp = new Sprite$6();
  3585. Laya.stage.addChild(this.sp);
  3586. this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
  3587. this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
  3588. this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5);
  3589. this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
  3590. this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
  3591. this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
  3592. this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
  3593. this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
  3594. this.sp.graphics.drawPath(400, 310, [["moveTo", 5, 0], ["lineTo", 105, 0], ["arcTo", 110, 0, 110, 5, 5], ["lineTo", 110, 55], ["arcTo", 110, 60, 105, 60, 5], ["lineTo", 5, 60], ["arcTo", 0, 60, 0, 55, 5], ["lineTo", 0, 5], ["arcTo", 0, 0, 5, 0, 5], ["closePath"]], { fillStyle: "#00ffff" });
  3595. }
  3596. RayReset() {
  3597. let origP = this.rayPoint.position.clone();
  3598. if (!this._scene) {
  3599. this._scene = Scene3DManager.Instance.MainScene;
  3600. }
  3601. if (!this.ray) {
  3602. if (!this.forward)
  3603. this.forward = MathTool.VecZero;
  3604. this.ray = new Laya.Ray(MathTool.VecZero, this._forward);
  3605. this.outHit = new Laya.HitResult();
  3606. }
  3607. this.ray.origin = origP;
  3608. if (this.over) {
  3609. this.tran.getForward(this.forward);
  3610. this.forward.x = -this.forward.x;
  3611. this.forward.y = -this.forward.y;
  3612. this.forward.z = -this.forward.z;
  3613. this.ray.direction = this.forward;
  3614. }
  3615. else {
  3616. this.ray.direction = this._forward;
  3617. }
  3618. let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength);
  3619. if (isHItF) {
  3620. let obj = this.outHit.collider.owner;
  3621. if (obj.layer == ColliderGroup.mound) {
  3622. let tower = obj.getComponent(Mound);
  3623. if (tower) {
  3624. tower.Injured(this.outHit.point);
  3625. }
  3626. }
  3627. else if (obj.layer == ColliderGroup.opponent) {
  3628. let tower = obj.getComponent(Opponent);
  3629. if (tower) {
  3630. tower.Injured(this.outHit.point);
  3631. }
  3632. }
  3633. else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
  3634. StreetManager.Instance.StreetAtkedCube(obj);
  3635. GameManager.Instance.blockCount++;
  3636. }
  3637. else {
  3638. ParticleManager.Instance.AttackEffect(this.outHit.point);
  3639. }
  3640. this.RecoverBullet();
  3641. return;
  3642. }
  3643. }
  3644. Start(tarTran, isover = false) {
  3645. this.tarTran = tarTran;
  3646. this.over = isover;
  3647. Laya.timer.frameLoop(1, this, this.Run);
  3648. }
  3649. }
  3650. var Vector3$2 = Laya.Vector3;
  3651. var Quaternion$1 = Laya.Quaternion;
  3652. var Sprite$7 = Laya.Sprite;
  3653. var Text$2 = Laya.Text;
  3654. class Mate extends Laya.Script3D {
  3655. constructor() {
  3656. super(...arguments);
  3657. this._up = new Vector3$2(0, 1, 0);
  3658. this.isreturn = false;
  3659. this.isover = false;
  3660. this.isClickCom = true;
  3661. this.isStop = true;
  3662. this.texture1 = "res/apes/monkey2.png";
  3663. this.texture2 = "res/apes/monkey3.png";
  3664. this.flag = false;
  3665. this.isFristShoot = true;
  3666. this.ts = new Vector3$2(0, 0, 0.01);
  3667. }
  3668. onAwake() {
  3669. this.selfobj = this.owner;
  3670. this.tran = this.selfobj.transform;
  3671. this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
  3672. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3673. this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
  3674. this.forW = MathTool.VecZero;
  3675. this.speed = GlobalParam.matespeed;
  3676. this.quaternion1 = new Quaternion$1();
  3677. }
  3678. setup() {
  3679. var textBox = new Sprite$7();
  3680. var text;
  3681. for (var i = 0; i < 1000; i++) {
  3682. text = new Text$2();
  3683. text.fontSize = 20;
  3684. text.text = (Math.random() * 100).toFixed(0);
  3685. text.rotation = Math.random() * 360;
  3686. text.color = "#CCCCCC";
  3687. text.x = Math.random() * Laya.stage.width;
  3688. text.y = Math.random() * Laya.stage.height;
  3689. textBox.addChild(text);
  3690. }
  3691. textBox.cacheAs = "bitmap";
  3692. Laya.stage.addChild(textBox);
  3693. }
  3694. TrialAdd(dataPar) {
  3695. this.AnimatorPlayByType(MusicType.Idle, 1);
  3696. this.dataPar = dataPar;
  3697. this.dataPar["ishave"] = true;
  3698. this.isClickCom = true;
  3699. this.isStop = true;
  3700. this.isreturn = true;
  3701. this.isover = false;
  3702. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3703. this.ShootFunc();
  3704. if (MainRoleManager.Instance.IsShoot())
  3705. this.CreateShoot();
  3706. Laya.timer.frameLoop(1, this, this.Move);
  3707. }
  3708. SetTar() {
  3709. this.isreturn = false;
  3710. this.isClickCom = true;
  3711. this.isStop = true;
  3712. this.isover = false;
  3713. this.AnimatorPlayByType(MusicType.Idle, 1);
  3714. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3715. }
  3716. FallDown() {
  3717. let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3718. let dataPar = MainRoleManager.Instance.GetMatePos();
  3719. if (!dataPar) {
  3720. console.warn("friendPar没有位置了");
  3721. return;
  3722. }
  3723. this.dataPar = dataPar;
  3724. this.dataPar["ishave"] = true;
  3725. this.tar = this.dataPar["sp"];
  3726. this.tarTra = this.tar.transform;
  3727. tween.clear();
  3728. this.Start();
  3729. }, null, false));
  3730. }
  3731. Start() {
  3732. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3733. this.isreturn = false;
  3734. this.isClickCom = true;
  3735. this.isStop = true;
  3736. this.isover = false;
  3737. Laya.timer.frameLoop(1, this, this.Move);
  3738. }
  3739. ArriveTarPos() {
  3740. this.isClickCom = true;
  3741. this.isStop = true;
  3742. this.isreturn = true;
  3743. this.tar.addChild(this.selfobj);
  3744. this.tran.localPosition = MathTool.VecZero;
  3745. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3746. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3747. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3748. tween.clear();
  3749. this.tran.localRotationEuler = MathTool.VecZero;
  3750. this.ShootFunc();
  3751. this.CreateShoot();
  3752. }, null, false));
  3753. }
  3754. RayReset() {
  3755. let origP = this.rayPoint.position;
  3756. if (!this._scene) {
  3757. this._scene = Scene3DManager.Instance.MainScene;
  3758. }
  3759. if (!this.rayF) {
  3760. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$2(0, 0, 1));
  3761. this.outHitF = new Laya.HitResult();
  3762. }
  3763. this.rayF.origin = origP;
  3764. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  3765. if (isHItF) {
  3766. let obj = this.outHitF.collider.owner;
  3767. this.Dead(this.outHitF.point);
  3768. return;
  3769. }
  3770. if (!this.rayL) {
  3771. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$2(1, 0, 0));
  3772. this.outHitL = new Laya.HitResult();
  3773. }
  3774. this.rayL.origin = origP;
  3775. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  3776. if (isHItL) {
  3777. let obj = this.outHitL.collider.owner;
  3778. this.Dead(this.outHitL.point);
  3779. return;
  3780. }
  3781. if (!this.rayR) {
  3782. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$2(-1, 0, 0));
  3783. this.outHitR = new Laya.HitResult();
  3784. }
  3785. this.rayR.origin = origP;
  3786. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  3787. if (isHItR) {
  3788. let obj = this.outHitR.collider.owner;
  3789. this.Dead(this.outHitR.point);
  3790. return;
  3791. }
  3792. }
  3793. createApes() {
  3794. this.ape1 = new Sprite$7();
  3795. this.ape2 = new Sprite$7();
  3796. this.ape1.loadImage("res/apes/monkey2.png");
  3797. this.ape2.loadImage("res/apes/monkey2.png");
  3798. this.ape1.pivot(55, 72);
  3799. this.ape2.pivot(55, 72);
  3800. this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3801. this.ape2.pos(200, 0);
  3802. Laya.stage.addChild(this.ape1);
  3803. this.ape1.addChild(this.ape2);
  3804. Laya.timer.frameLoop(1, this, this.animate);
  3805. }
  3806. animate(e) {
  3807. this.ape1.rotation += 2;
  3808. this.ape2.rotation -= 4;
  3809. }
  3810. Move() {
  3811. if (this.isreturn) {
  3812. this.RayReset();
  3813. return;
  3814. }
  3815. let tarPos = this.tarTra.position.clone();
  3816. Vector3$2.subtract(tarPos, this.tran.position, this.forW);
  3817. Vector3$2.normalize(this.forW, this.forW);
  3818. this.forW = new Vector3$2(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  3819. this.tran.translate(this.forW, false);
  3820. if (Vector3$2.distance(this.tran.position, tarPos) < 0.1) {
  3821. this.ArriveTarPos();
  3822. return;
  3823. }
  3824. Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
  3825. this.quaternion1.invert(this.quaternion1);
  3826. Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
  3827. this.tran.rotation = this.quaternion1.clone();
  3828. }
  3829. AnimatorPlayByType(clip, speed, callback) {
  3830. this.animator.play(clip);
  3831. if (!speed)
  3832. speed = 1;
  3833. this.animator.speed = speed;
  3834. }
  3835. ShootFunc() {
  3836. DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
  3837. }
  3838. LoopCreate() {
  3839. if (this.isStop) {
  3840. Laya.timer.clear(this, this.LoopCreate);
  3841. this.isClickCom = true;
  3842. return;
  3843. }
  3844. this._CreateShoot();
  3845. }
  3846. CreateShoot() {
  3847. this.isStop = false;
  3848. if (!this.isClickCom)
  3849. return;
  3850. this.isClickCom = false;
  3851. this._CreateShoot();
  3852. Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
  3853. }
  3854. _CreateShoot() {
  3855. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  3856. if (bu) {
  3857. Scene3DManager.Instance.bulletCon.addChild(bu);
  3858. bu.transform.position = this.bulletPos.position.clone();
  3859. bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
  3860. let pb = bu.getComponent(MainRoleShot);
  3861. if (!pb)
  3862. pb = bu.addComponent(MainRoleShot);
  3863. pb.Start(this.bulletPos, this.isover);
  3864. }
  3865. }
  3866. StopCreate() {
  3867. this.isStop = true;
  3868. }
  3869. Dead(pos) {
  3870. if (this.dataPar)
  3871. this.dataPar["ishave"] = false;
  3872. ParticleManager.Instance.BloodEffect(pos);
  3873. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3874. this.Recover();
  3875. MainRoleManager.Instance.CheckGameOver();
  3876. }
  3877. SetPar() {
  3878. let t = this.tran.position.clone();
  3879. MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
  3880. this.tran.position = t.clone();
  3881. }
  3882. TiaoWu(sp) {
  3883. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3884. this.danceP = sp.position.clone();
  3885. this.r = sp.rotationEuler.clone();
  3886. Laya.timer.frameLoop(1, this, this._TiaoWu);
  3887. }
  3888. _TiaoWu() {
  3889. Vector3$2.subtract(this.danceP, this.tran.position, this.forW);
  3890. Vector3$2.normalize(this.forW, this.forW);
  3891. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3892. this.tran.translate(this.forW);
  3893. if (Vector3$2.distance(this.tran.position, this.danceP) < 0.15) {
  3894. Laya.timer.clear(this, this._TiaoWu);
  3895. this.tran.position = this.danceP.clone();
  3896. this.tran.rotationEuler = this.r.clone();
  3897. this.AnimatorPlayByType(MusicType.Dance, 1);
  3898. return;
  3899. }
  3900. Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
  3901. this.quaternion1.invert(this.quaternion1);
  3902. this.tran.rotation = this.quaternion1.clone();
  3903. }
  3904. onAssetsLoaded() {
  3905. this.ape = new Sprite$7();
  3906. Laya.stage.addChild(this.ape);
  3907. this.ape.pivot(55, 72);
  3908. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3909. }
  3910. Attack() {
  3911. Laya.timer.clear(this, this._Defense);
  3912. this.isover = true;
  3913. this.isFristShoot = true;
  3914. this.enemyTar = null;
  3915. Laya.timer.frameLoop(1, this, this._attack);
  3916. }
  3917. _attack() {
  3918. if (this.enemyTar == null) {
  3919. this.enemyTar = RoleManager.Instance.GetOpponent();
  3920. if (this.enemyTar != null) {
  3921. this.ATKp = this.enemyTar.transform.position.clone();
  3922. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3923. this.quaternion1.invert(this.quaternion1);
  3924. this.tran.rotation = this.quaternion1.clone();
  3925. }
  3926. }
  3927. else {
  3928. if (!this.enemyTar.active) {
  3929. this.enemyTar = RoleManager.Instance.GetOpponent();
  3930. if (this.enemyTar != null) {
  3931. this.ATKp = this.enemyTar.transform.position.clone();
  3932. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3933. this.quaternion1.invert(this.quaternion1);
  3934. this.tran.rotation = this.quaternion1.clone();
  3935. }
  3936. }
  3937. if (this.enemyTar == null) {
  3938. this.StopCreate();
  3939. this.isFristShoot = true;
  3940. return;
  3941. }
  3942. if (this.isFristShoot) {
  3943. this.isFristShoot = false;
  3944. this.CreateShoot();
  3945. }
  3946. this.ATKp = this.enemyTar.transform.position.clone();
  3947. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3948. this.quaternion1.invert(this.quaternion1);
  3949. this.tran.rotation = this.quaternion1.clone();
  3950. }
  3951. }
  3952. _Defense() {
  3953. Vector3$2.subtract(this.tp, this.tran.position, this.forW);
  3954. Vector3$2.normalize(this.forW, this.forW);
  3955. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3956. this.tran.translate(this.forW, false);
  3957. if (Vector3$2.distance(this.tran.position, this.tp) < 0.1) {
  3958. Laya.timer.clear(this, this._Defense);
  3959. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3960. tween.clear();
  3961. }, null, false));
  3962. return;
  3963. }
  3964. Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
  3965. this.quaternion1.invert(this.quaternion1);
  3966. this.tran.rotation = this.quaternion1.clone();
  3967. }
  3968. Defense(pos) {
  3969. this.SetPar();
  3970. this.tp = pos;
  3971. Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
  3972. this.quaternion1.invert(this.quaternion1);
  3973. this.tran.rotation = this.quaternion1.clone();
  3974. this.AnimatorPlayByType(MusicType.CrouchFiring, 1);
  3975. Laya.timer.frameLoop(1, this, this._Defense);
  3976. }
  3977. Recover() {
  3978. if (this.dataPar) {
  3979. this.dataPar["ishave"] = false;
  3980. this.dataPar = null;
  3981. }
  3982. MateManager.Instance.RecoverMateModel(this.selfobj);
  3983. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3984. Laya.timer.clearAll(this);
  3985. Laya.Tween.clearAll(this);
  3986. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3987. GamePool.Instance.RecoverModel(this.selfobj);
  3988. }
  3989. }
  3990. var Rectangle$1 = Laya.Rectangle;
  3991. class MateManager {
  3992. constructor() {
  3993. this.ApePath = "res/apes/monkey2.png";
  3994. this.v3 = MathTool.VecZero;
  3995. this.friendDic = new Dictionary();
  3996. this.getDic = new Dictionary();
  3997. }
  3998. static get Instance() {
  3999. return this.instance || (this.instance = new MateManager());
  4000. }
  4001. Trial() {
  4002. for (let index = 0; index < 3; index++) {
  4003. Laya.timer.frameOnce(index, this, this._createtrialmodel, null, false);
  4004. }
  4005. }
  4006. TrialModelPlayAni() {
  4007. for (const key in this.friendDic.container) {
  4008. const element = this.friendDic.get(key);
  4009. element.CreateShoot();
  4010. element.AnimatorPlayByType(MusicType.RunAndGun, 2);
  4011. }
  4012. }
  4013. RecoverMateModel(sp) {
  4014. this.friendDic.delete(sp.id);
  4015. }
  4016. AddModelToDic(id, fr) {
  4017. this.getDic.set(id, fr);
  4018. }
  4019. RemoveModelToDic(sp) {
  4020. this.getDic.delete(sp.id);
  4021. }
  4022. MadeMate(tra) {
  4023. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4024. if (p) {
  4025. p.transform.position = tra.position.clone();
  4026. p.transform.rotationEuler = tra.rotationEuler.clone();
  4027. MainRoleManager.Instance.playerContainer.addChild(p);
  4028. let ps = p.getComponent(Mate);
  4029. if (!ps)
  4030. ps = p.addComponent(Mate);
  4031. ps.SetTar();
  4032. this.friendDic.set(p.id, ps);
  4033. return ps;
  4034. }
  4035. return null;
  4036. }
  4037. showDragRegion() {
  4038. var dragWidthLimit = 350;
  4039. var dragHeightLimit = 200;
  4040. this.dragRegion = new Rectangle$1(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dragHeightLimit >> 1, dragWidthLimit, dragHeightLimit);
  4041. Laya.stage.graphics.drawRect(this.dragRegion.x, this.dragRegion.y, this.dragRegion.width, this.dragRegion.height, null, "#FFFFFF", 2);
  4042. }
  4043. onStartDrag(e) {
  4044. this.ape.startDrag(this.dragRegion, true, 100);
  4045. }
  4046. NearDestination() {
  4047. return this.getDic.size;
  4048. }
  4049. Near(count, zs) {
  4050. if (count == 1) {
  4051. for (const key in this.getDic.container) {
  4052. const element = this.getDic.get(key);
  4053. this.v3.x = 0;
  4054. element.Defense(this.v3.clone());
  4055. }
  4056. return;
  4057. }
  4058. let len = 2 * GlobalParam.arriveStandWidth;
  4059. let avr = len / (count - 1);
  4060. let index = 0;
  4061. this.v3.z = zs;
  4062. for (const key in this.getDic.container) {
  4063. const element = this.getDic.get(key);
  4064. this.v3.x = GlobalParam.arriveStandWidth - index * avr;
  4065. element.Defense(this.v3.clone());
  4066. index++;
  4067. }
  4068. }
  4069. Attack() {
  4070. for (const key in this.getDic.container) {
  4071. const element = this.getDic.get(key);
  4072. element.Attack();
  4073. }
  4074. }
  4075. GetSprite() {
  4076. let count = this.getDic.size;
  4077. let a = GameTool.randomInt(1, count);
  4078. let tindex = 1;
  4079. for (const key in this.getDic.container) {
  4080. if (tindex == a) {
  4081. const element = this.getDic.get(key);
  4082. return element.selfobj;
  4083. }
  4084. tindex++;
  4085. }
  4086. return null;
  4087. }
  4088. TiaoWu() {
  4089. for (const key in this.getDic.container) {
  4090. let t = PlaneManager.Instance.GetWuDaoPosition();
  4091. if (!t)
  4092. return;
  4093. const element = this.getDic.get(key);
  4094. element.TiaoWu(t);
  4095. }
  4096. }
  4097. Reset() {
  4098. let arr = [];
  4099. for (const key in this.friendDic.container) {
  4100. arr.push(key);
  4101. }
  4102. if (arr.length > 0) {
  4103. for (let index = 0; index < arr.length; index++) {
  4104. const element = arr[index];
  4105. let s = this.friendDic.get(element);
  4106. if (s)
  4107. s.Recover();
  4108. }
  4109. }
  4110. console.log("this.friendDic.size", this.friendDic.size);
  4111. this.getDic.clear();
  4112. }
  4113. TiaoWu1() {
  4114. for (const key in this.getDic.container) {
  4115. let t = PlaneManager.Instance.GetWuDaoPosition();
  4116. const element = this.getDic.get(key);
  4117. element.SetPar();
  4118. if (t) {
  4119. element.TiaoWu(t);
  4120. }
  4121. }
  4122. }
  4123. _createtrialmodel() {
  4124. let dataPar = MainRoleManager.Instance.GetMatePos();
  4125. if (!dataPar) {
  4126. console.warn("friendPar没有位置了");
  4127. return;
  4128. }
  4129. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4130. if (p) {
  4131. let tar = dataPar["sp"];
  4132. tar.addChild(p);
  4133. p.transform.localPosition = MathTool.VecZero;
  4134. p.transform.localRotationEuler = MathTool.VecZero;
  4135. let ps = p.getComponent(Mate);
  4136. if (!ps)
  4137. ps = p.addComponent(Mate);
  4138. ps.TrialAdd(dataPar);
  4139. this.friendDic.set(p.id, ps);
  4140. }
  4141. }
  4142. }
  4143. var Sprite$8 = Laya.Sprite;
  4144. var Text$3 = Laya.Text;
  4145. class PlaneManager {
  4146. constructor() {
  4147. this.airisshow = false;
  4148. this.danceindex = 0;
  4149. }
  4150. static get Instance() {
  4151. return this.instance || (this.instance = new PlaneManager());
  4152. }
  4153. Init(finalP) {
  4154. if (!finalP) {
  4155. console.error("飞机不存在");
  4156. return;
  4157. }
  4158. this.finalTra = finalP.transform;
  4159. this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
  4160. this.FinalBlock = finalP.getChildAt(0);
  4161. this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
  4162. this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
  4163. this.helicopter = this.FinalBlock.getChildByName("helicopter");
  4164. this.toured = this.FinalBlock.getChildByName("toured").transform;
  4165. this.FinalBlock.active = false;
  4166. }
  4167. SetAir() {
  4168. this.danceindex = 0;
  4169. this.airisshow = false;
  4170. this.FinalBlock.active = false;
  4171. let count = LevelController.Instance._level.road_list.length;
  4172. this.winPos = (count) * GlobalParam.barrierRoadLength;
  4173. this.finalTra.localPositionZ = this.winPos;
  4174. this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
  4175. let isgold = LevelController.Instance._level.isgold;
  4176. this.helicopter.active = isgold;
  4177. this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
  4178. this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
  4179. }
  4180. createDarkOrchidRect() {
  4181. var darkOrchidRect = new Sprite$8();
  4182. darkOrchidRect.name = "暗紫色矩形容器";
  4183. darkOrchidRect.graphics.drawRect(-100, -100, 200, 200, "#9932CC");
  4184. darkOrchidRect.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  4185. Laya.stage.addChild(darkOrchidRect);
  4186. darkOrchidRect.mouseThrough = true;
  4187. }
  4188. createLogger() {
  4189. this.logger = new Text$3();
  4190. this.logger.size(Laya.stage.width, Laya.stage.height);
  4191. this.logger.align = 'right';
  4192. this.logger.fontSize = 20;
  4193. this.logger.color = "#FFFFFF";
  4194. Laya.stage.addChild(this.logger);
  4195. }
  4196. CheckPlayerRoadPos(_zp) {
  4197. let d = this.winPos - _zp;
  4198. if (d <= 60 && !this.airisshow) {
  4199. this.ShowAir();
  4200. return;
  4201. }
  4202. DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
  4203. if (d <= 0) {
  4204. this.NearDestination();
  4205. }
  4206. }
  4207. ShowAir() {
  4208. this.airisshow = true;
  4209. this.FinalBlock.active = true;
  4210. }
  4211. NearDestination() {
  4212. MainRoleManager.Instance.Destination();
  4213. if (LevelController.Instance._level.isgold) {
  4214. GameManager.Instance.Congratulate(true);
  4215. }
  4216. else {
  4217. let count = 0;
  4218. let isdesd = MainRoleManager.Instance.NearIsdead();
  4219. if (!isdesd) {
  4220. count++;
  4221. }
  4222. let num = MateManager.Instance.NearDestination();
  4223. count += num;
  4224. if (count == 0)
  4225. return;
  4226. MateManager.Instance.Near(count, this.toured.position.z);
  4227. if (!isdesd)
  4228. MainRoleManager.Instance.Near(count, this.toured.position.z);
  4229. Laya.timer.once(1300, this, this.CreateOpponent);
  4230. }
  4231. }
  4232. CreateOpponent() {
  4233. MainRoleManager.Instance.Attack();
  4234. MateManager.Instance.Attack();
  4235. RoleManager.Instance.CreateOpponent(this.EnemySpawnPoint.position.clone());
  4236. }
  4237. GetWuDaoPosition() {
  4238. if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
  4239. return null;
  4240. let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
  4241. this.danceindex++;
  4242. return t;
  4243. }
  4244. }
  4245. var Vector3$3 = Laya.Vector3;
  4246. var Quaternion$2 = Laya.Quaternion;
  4247. var Sprite$9 = Laya.Sprite;
  4248. class MainRole extends Laya.Script3D {
  4249. constructor() {
  4250. super(...arguments);
  4251. this.isarrive = false;
  4252. this.isdead = false;
  4253. this.isFristShoot = true;
  4254. this._up = new Vector3$3(0, 1, 0);
  4255. this.ts = new Vector3$3(0, 0, 0.01);
  4256. }
  4257. onAwake() {
  4258. this.selfobj = this.owner;
  4259. this._transform = this.selfobj.transform;
  4260. this.body = this.selfobj.getChildAt(0);
  4261. this.animator = this.body.getComponent(Laya.Animator);
  4262. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  4263. this.shootPos = this.selfobj.getChildByName("bulletPos").transform;
  4264. this._speed = MathTool.VecZero;
  4265. this._speed.z = GlobalParam.playerspeed;
  4266. this.forW = MathTool.VecZero;
  4267. this.quaternion1 = new Quaternion$2();
  4268. }
  4269. Move() {
  4270. if (this.isarrive) {
  4271. if (this.isdead)
  4272. return;
  4273. this.RayReset();
  4274. return;
  4275. }
  4276. this._transform.translate(this._speed);
  4277. let pz = this._transform.localPositionZ;
  4278. ConstructManager.Instance.CheckMainRolePos(pz);
  4279. PlaneManager.Instance.CheckPlayerRoadPos(pz);
  4280. StreetManager.Instance.CheckPlayerRoadPos(pz);
  4281. CameraManager.Instance.CameraFollow(pz);
  4282. if (this.isdead)
  4283. return;
  4284. this.RayReset();
  4285. }
  4286. Near() {
  4287. this.isarrive = true;
  4288. }
  4289. Start() {
  4290. this.isdead = false;
  4291. this.isarrive = false;
  4292. Laya.timer.frameLoop(1, this, this.Move);
  4293. }
  4294. drawPentagram() {
  4295. var canvas = new Sprite$9();
  4296. Laya.stage.addChild(canvas);
  4297. var path = [];
  4298. path.push(0, -130);
  4299. path.push(33, -33);
  4300. path.push(137, -30);
  4301. path.push(55, 32);
  4302. path.push(85, 130);
  4303. path.push(0, 73);
  4304. path.push(-85, 130);
  4305. path.push(-55, 32);
  4306. path.push(-137, -30);
  4307. path.push(-33, -33);
  4308. canvas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50");
  4309. }
  4310. PlayAni(clip, speed, callback) {
  4311. this.animator.play(clip);
  4312. if (!speed)
  4313. speed = 1;
  4314. this.animator.speed = speed;
  4315. }
  4316. Slider(x) {
  4317. this._transform.localPositionX += x;
  4318. let px = this._transform.localPositionX;
  4319. let abs = Math.abs(px);
  4320. if (abs > GlobalParam.playerMoveMaxX) {
  4321. if (px > 0)
  4322. this._transform.localPositionX = GlobalParam.playerMoveMaxX;
  4323. else
  4324. this._transform.localPositionX = -GlobalParam.playerMoveMaxX;
  4325. }
  4326. }
  4327. CreateBullet() {
  4328. if (this.isdead)
  4329. return null;
  4330. return this.shootPos;
  4331. }
  4332. Dead(pos) {
  4333. this.isdead = true;
  4334. this.body.active = false;
  4335. ParticleManager.Instance.BloodEffect(pos);
  4336. MainRoleManager.Instance.CheckGameOver(true);
  4337. }
  4338. Reset() {
  4339. this.body.active = true;
  4340. this.PlayAni(MusicType.Idle, 1);
  4341. Laya.timer.clearAll(this);
  4342. }
  4343. RayReset() {
  4344. let origP = this.rayPoint.position;
  4345. if (!this._scene) {
  4346. this._scene = Scene3DManager.Instance.MainScene;
  4347. }
  4348. if (!this.rayF) {
  4349. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$3(0, 0, 1));
  4350. this.outHitF = new Laya.HitResult();
  4351. }
  4352. this.rayF.origin = origP;
  4353. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  4354. if (isHItF) {
  4355. let obj = this.outHitF.collider.owner;
  4356. this.Dead(this.outHitF.point);
  4357. return;
  4358. }
  4359. if (!this.rayL) {
  4360. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$3(1, 0, 0));
  4361. this.outHitL = new Laya.HitResult();
  4362. }
  4363. this.rayL.origin = origP;
  4364. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  4365. if (isHItL) {
  4366. let obj = this.outHitL.collider.owner;
  4367. this.Dead(this.outHitL.point);
  4368. return;
  4369. }
  4370. if (!this.rayR) {
  4371. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$3(-1, 0, 0));
  4372. this.outHitR = new Laya.HitResult();
  4373. }
  4374. this.rayR.origin = origP;
  4375. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  4376. if (isHItR) {
  4377. let obj = this.outHitR.collider.owner;
  4378. this.Dead(this.outHitR.point);
  4379. return;
  4380. }
  4381. }
  4382. setup() {
  4383. var bg = new Sprite$9();
  4384. bg.loadImage("res/bg2.png");
  4385. Laya.stage.addChild(bg);
  4386. this.bg2 = new Sprite$9();
  4387. this.bg2.loadImage("res/bg2.png");
  4388. Laya.stage.addChild(this.bg2);
  4389. this.bg2.scale(3, 3);
  4390. this.maskSp = new Sprite$9();
  4391. this.maskSp.loadImage("res/mask.png");
  4392. this.maskSp.pivot(50, 50);
  4393. this.bg2.mask = this.maskSp;
  4394. }
  4395. _attack() {
  4396. if (this.isdead)
  4397. return;
  4398. if (this.enemyTar == null) {
  4399. this.enemyTar = RoleManager.Instance.GetOpponent();
  4400. if (this.enemyTar != null) {
  4401. this.tp = this.enemyTar.transform.position.clone();
  4402. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4403. this.quaternion1.invert(this.quaternion1);
  4404. this._transform.rotation = this.quaternion1.clone();
  4405. }
  4406. }
  4407. else {
  4408. if (!this.enemyTar.active) {
  4409. this.enemyTar = RoleManager.Instance.GetOpponent();
  4410. if (this.enemyTar != null) {
  4411. this.tp = this.enemyTar.transform.position.clone();
  4412. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4413. this.quaternion1.invert(this.quaternion1);
  4414. this._transform.rotation = this.quaternion1.clone();
  4415. }
  4416. }
  4417. if (this.enemyTar == null) {
  4418. MainRoleManager.Instance.CreateOver(true);
  4419. this.isFristShoot = true;
  4420. return;
  4421. }
  4422. if (this.isFristShoot) {
  4423. this.isFristShoot = false;
  4424. MainRoleManager.Instance.CreateShoot(true);
  4425. }
  4426. this.tp = this.enemyTar.transform.position.clone();
  4427. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4428. this.quaternion1.invert(this.quaternion1);
  4429. this._transform.rotation = this.quaternion1.clone();
  4430. }
  4431. }
  4432. TiaoWu(sp) {
  4433. this.PlayAni(MusicType.RunAndGun, 2);
  4434. this.dancepos = sp.position.clone();
  4435. this.r = sp.rotationEuler.clone();
  4436. Laya.timer.frameLoop(1, this, this.PlayWuDao);
  4437. }
  4438. PlayWuDao() {
  4439. Vector3$3.subtract(this.dancepos, this._transform.position, this.forW);
  4440. Vector3$3.normalize(this.forW, this.forW);
  4441. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4442. this._transform.translate(this.forW);
  4443. if (Vector3$3.distance(this._transform.position, this.dancepos) < 0.15) {
  4444. Laya.timer.clear(this, this.PlayWuDao);
  4445. this._transform.position = this.dancepos.clone();
  4446. this._transform.rotationEuler = this.r.clone();
  4447. this.PlayAni(MusicType.Dance, 1);
  4448. return;
  4449. }
  4450. Quaternion$2.lookAt(this.dancepos, this._transform.position, this._up, this.quaternion1);
  4451. this.quaternion1.invert(this.quaternion1);
  4452. this._transform.rotation = this.quaternion1.clone();
  4453. }
  4454. Defense(pos) {
  4455. if (this.isdead)
  4456. return;
  4457. this.tp = pos;
  4458. Quaternion$2.lookAt(pos, this._transform.position, this._up, this.quaternion1);
  4459. this.quaternion1.invert(this.quaternion1);
  4460. this._transform.rotation = this.quaternion1.clone();
  4461. this.PlayAni(MusicType.CrouchFiring, 1);
  4462. Laya.timer.frameLoop(1, this, this._Defense);
  4463. }
  4464. _Defense() {
  4465. Vector3$3.subtract(this.tp, this._transform.position, this.forW);
  4466. Vector3$3.normalize(this.forW, this.forW);
  4467. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4468. this._transform.translate(this.forW);
  4469. if (Vector3$3.distance(this._transform.position, this.tp) < 0.1) {
  4470. Laya.timer.clear(this, this._Defense);
  4471. return;
  4472. }
  4473. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4474. this.quaternion1.invert(this.quaternion1);
  4475. this._transform.rotation = this.quaternion1.clone();
  4476. }
  4477. Attack() {
  4478. Laya.timer.clear(this, this._Defense);
  4479. this.isFristShoot = true;
  4480. this.enemyTar = null;
  4481. Laya.timer.frameLoop(1, this, this._attack);
  4482. }
  4483. }
  4484. var Vector3$4 = Laya.Vector3;
  4485. var Text$4 = Laya.Text;
  4486. var HScrollBar = Laya.HScrollBar;
  4487. var VScrollBar = Laya.VScrollBar;
  4488. class MainRoleManager {
  4489. constructor() {
  4490. this.isover = false;
  4491. this.isClickCom = true;
  4492. this.isend = true;
  4493. }
  4494. static get Instance() {
  4495. return this.instance || (this.instance = new MainRoleManager());
  4496. }
  4497. Init(startPos, playerCon) {
  4498. this.playerStartTra = startPos.transform;
  4499. this.playerContainer = playerCon;
  4500. }
  4501. ChangeModel() {
  4502. if (this.player)
  4503. GamePool.Instance.RecoverModel(this.player);
  4504. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4505. if (p) {
  4506. this.player = p;
  4507. this.SetMatePos(p);
  4508. this.playerTra = this.player.transform;
  4509. this.playerTra.position = this.playerStartTra.position.clone();
  4510. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4511. this.playerContainer.addChild(this.player);
  4512. let ps = this.player.getComponent(MainRole);
  4513. if (ps)
  4514. this.playerScript = ps;
  4515. else
  4516. this.playerScript = this.player.addComponent(MainRole);
  4517. }
  4518. }
  4519. SetMatePos(player) {
  4520. this.MateArrPosition = [];
  4521. let par = player.getChildByName("FriendSpawPos");
  4522. if (!par)
  4523. console.error("friend父物体不存在");
  4524. for (let index = 0; index < par.numChildren; index++) {
  4525. let data = {};
  4526. data["ishave"] = false;
  4527. data["sp"] = par.getChildAt(index);
  4528. this.MateArrPosition.push(data);
  4529. }
  4530. }
  4531. GetMatePos() {
  4532. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4533. const element = this.MateArrPosition[index];
  4534. if (!element["ishave"])
  4535. return element;
  4536. }
  4537. return null;
  4538. }
  4539. createTexts() {
  4540. var t1 = this.createText();
  4541. t1.overflow = Text$4.VISIBLE;
  4542. t1.pos(10, 10);
  4543. var t2 = this.createText();
  4544. t2.overflow = Text$4.SCROLL;
  4545. t2.pos(10, 110);
  4546. var t3 = this.createText();
  4547. t3.overflow = Text$4.HIDDEN;
  4548. t3.pos(10, 210);
  4549. }
  4550. createText() {
  4551. var txt = new Text$4();
  4552. txt.text =
  4553. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4554. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4555. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!";
  4556. txt.borderColor = "#FFFF00";
  4557. txt.size(300, 50);
  4558. txt.fontSize = 20;
  4559. txt.color = "#ffffff";
  4560. Laya.stage.addChild(txt);
  4561. return txt;
  4562. }
  4563. PlayerSlip(offsetX) {
  4564. let x = offsetX.toFixed(2);
  4565. let x1 = Number(x) * GlobalParam.sliderFactor;
  4566. if (this.playerScript)
  4567. this.playerScript.Slider(x1);
  4568. }
  4569. CreateOver(isgameover = false) {
  4570. this.isend = true;
  4571. if (!isgameover)
  4572. DispatcherManager.event(EventType.Event.StopShot);
  4573. }
  4574. IsShoot() {
  4575. return !this.isend;
  4576. }
  4577. Destination() {
  4578. MouseEvent.Instance.OnClickUp();
  4579. MainRoleManager.Instance.CreateOver();
  4580. MouseEvent.Instance._Switch = false;
  4581. GameManager.Instance.Near();
  4582. if (!this.playerScript)
  4583. return;
  4584. this.playerScript.Near();
  4585. }
  4586. NearIsdead() {
  4587. if (!this.playerScript)
  4588. return true;
  4589. return this.playerScript.isdead;
  4590. }
  4591. Near(count, z) {
  4592. if (!this.playerScript)
  4593. return;
  4594. if (count == 1) {
  4595. this.playerScript.Defense(new Vector3$4(0, 0, z));
  4596. }
  4597. else {
  4598. this.playerScript.Defense(new Vector3$4(-GlobalParam.arriveStandWidth, 0, z));
  4599. }
  4600. }
  4601. Attack() {
  4602. if (!this.playerScript)
  4603. return;
  4604. this.isover = true;
  4605. this.playerScript.Attack();
  4606. }
  4607. CreateShoot(isgameover = false) {
  4608. if (!this.playerScript)
  4609. return;
  4610. this.isend = false;
  4611. if (!this.isClickCom)
  4612. return;
  4613. console.log("开始创建子弹");
  4614. this.isClickCom = false;
  4615. this._CreateShoot();
  4616. Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this._Loop);
  4617. }
  4618. _Loop() {
  4619. if (this.isend) {
  4620. Laya.timer.clear(this, this._Loop);
  4621. this.isClickCom = true;
  4622. return;
  4623. }
  4624. this._CreateShoot();
  4625. }
  4626. _CreateShoot() {
  4627. WXSdk.ShortVibrate();
  4628. SettingController.Instance.PlaySound(SoundType.hit);
  4629. let bulletPos = this.playerScript.CreateBullet();
  4630. if (bulletPos == null)
  4631. return;
  4632. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  4633. if (bu) {
  4634. Scene3DManager.Instance.bulletCon.addChild(bu);
  4635. bu.transform.position = bulletPos.position.clone();
  4636. bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
  4637. let pb = bu.getComponent(MainRoleShot);
  4638. if (!pb)
  4639. pb = bu.addComponent(MainRoleShot);
  4640. pb.Start(bulletPos, this.isover);
  4641. }
  4642. }
  4643. CheckGameOver(isplayer) {
  4644. if (isplayer) {
  4645. let count = MateManager.Instance.NearDestination();
  4646. if (count == 0) {
  4647. this.playerScript.Near();
  4648. GameManager.Instance.Over();
  4649. }
  4650. }
  4651. else {
  4652. let count = MateManager.Instance.NearDestination();
  4653. if (count == 0) {
  4654. let isplayerdead = this.playerScript.isdead;
  4655. if (isplayerdead) {
  4656. this.playerScript.Near();
  4657. GameManager.Instance.Over();
  4658. }
  4659. }
  4660. }
  4661. }
  4662. GoToTiaoWu() {
  4663. if (!this.playerScript)
  4664. return;
  4665. let t = PlaneManager.Instance.GetWuDaoPosition();
  4666. if (!t)
  4667. return;
  4668. this.playerScript.TiaoWu(t);
  4669. }
  4670. Reset() {
  4671. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4672. const element = this.MateArrPosition[index];
  4673. element["ishave"] = false;
  4674. }
  4675. this.isover = false;
  4676. if (!this.playerScript)
  4677. return;
  4678. this.playerScript.Reset();
  4679. }
  4680. HidePlayer() {
  4681. if (this.player)
  4682. this.player.active = false;
  4683. }
  4684. onSkinLoadComplete() {
  4685. this.placeHScroller();
  4686. this.placeVScroller();
  4687. }
  4688. placeHScroller() {
  4689. var hs = new HScrollBar();
  4690. hs.skin = "res/ui/hscroll.png";
  4691. hs.width = 300;
  4692. hs.pos(50, 170);
  4693. hs.min = 0;
  4694. hs.max = 100;
  4695. }
  4696. placeVScroller() {
  4697. var vs = new VScrollBar();
  4698. vs.skin = "res/ui/vscroll.png";
  4699. vs.height = 300;
  4700. vs.pos(400, 50);
  4701. vs.min = 0;
  4702. vs.max = 100;
  4703. Laya.stage.addChild(vs);
  4704. }
  4705. MadePlayer() {
  4706. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4707. if (p) {
  4708. this.player = p;
  4709. this.SetMatePos(p);
  4710. this.playerTra = this.player.transform;
  4711. this.playerTra.position = this.playerStartTra.position.clone();
  4712. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4713. this.playerContainer.addChild(this.player);
  4714. let ps = this.player.getComponent(MainRole);
  4715. if (ps)
  4716. this.playerScript = ps;
  4717. else
  4718. this.playerScript = this.player.addComponent(MainRole);
  4719. }
  4720. else {
  4721. console.error("player不存在");
  4722. }
  4723. }
  4724. SetPlayerPosition() {
  4725. this.player.active = true;
  4726. this.playerTra.position = this.playerStartTra.position.clone();
  4727. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4728. this.playerScript.PlayAni(MusicType.Idle, 1);
  4729. }
  4730. SetModelPos(x) {
  4731. if (!this.player) {
  4732. this.MadePlayer();
  4733. this.SetPlayerPosition();
  4734. }
  4735. if (!this._maincamera) {
  4736. this._maincamera = CameraManager.Instance._maincamera;
  4737. this._distance = -Vector3$4.distance(this.playerTra.position, this._maincamera.transform.position);
  4738. this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y;
  4739. }
  4740. let uiP = new Vector3$4(x, this._posy, this._distance);
  4741. let p = MatrixTransform.ScreenToWorld(this._maincamera, uiP);
  4742. this.playerTra.localPositionX = p.x;
  4743. }
  4744. Start() {
  4745. if (this.playerScript) {
  4746. this.playerScript.Start();
  4747. this.playerScript.PlayAni(MusicType.RunAndGun, 2);
  4748. }
  4749. }
  4750. }
  4751. var Vector3$5 = Laya.Vector3;
  4752. var CameraState;
  4753. (function (CameraState) {
  4754. CameraState[CameraState["game"] = 1] = "game";
  4755. CameraState[CameraState["jump"] = 2] = "jump";
  4756. })(CameraState || (CameraState = {}));
  4757. class Camera extends Laya.Script3D {
  4758. constructor() {
  4759. super();
  4760. this.arg = 0.1;
  4761. this.startShake = false;
  4762. this.seconds = 0;
  4763. this.started = false;
  4764. this.quake = 0.3;
  4765. this._position = new Laya.Vector3();
  4766. this._outPos = new Laya.Vector3();
  4767. this.scaleDelta = 0;
  4768. this.scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4769. this.canmovegame = false;
  4770. }
  4771. onAwake() {
  4772. this.selfObj = this.owner;
  4773. this._tran = this.selfObj.transform;
  4774. this.nowP = MathTool.VecZero;
  4775. this.nowR = MathTool.VecZero;
  4776. this.dis = MathTool.VecZero;
  4777. this.temp = MathTool.VecZero;
  4778. }
  4779. Init() {
  4780. let t = CameraManager.Instance.startPosTra;
  4781. this._tran.position = t.position.clone();
  4782. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4783. this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
  4784. this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
  4785. this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
  4786. }
  4787. StopMove() {
  4788. Laya.timer.clear(this, this.JumpCameraMove);
  4789. }
  4790. JumpCameraMove() {
  4791. let p, r;
  4792. if (this.arg == 1) {
  4793. p = this._transform.position;
  4794. r = MathTool.SpToCam(this._transform.localRotationEuler.clone());
  4795. }
  4796. else {
  4797. p = MathTool.MixVector3(this._tran.position.clone(), this._transform.position, this.arg, this.nowP);
  4798. r = MathTool.MixVector3(this._tran.localRotationEuler, MathTool.SpToCam(this._transform.localRotationEuler.clone()), this.arg, this.nowR);
  4799. }
  4800. this._tran.position = p;
  4801. this._tran.localRotationEuler = r;
  4802. }
  4803. CameraAction(type, arg) {
  4804. this.arg = arg;
  4805. switch (type) {
  4806. case CameraState.game:
  4807. this._transform = MainRoleManager.Instance.playerTra;
  4808. if (!this._transform)
  4809. return;
  4810. let t = CameraManager.Instance.startPosTra;
  4811. this._tran.position = t.position.clone();
  4812. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4813. this.canmovegame = true;
  4814. break;
  4815. case CameraState.jump:
  4816. this._transform = PlaneManager.Instance.jumpCamTra;
  4817. if (!this._transform)
  4818. return;
  4819. this.canmovegame = false;
  4820. Laya.timer.frameLoop(1, this, this.JumpCameraMove);
  4821. Laya.timer.once(3000, this, this.StopMove);
  4822. break;
  4823. }
  4824. }
  4825. onComplete() {
  4826. var grid = this._scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh"));
  4827. grid.getChildAt(0).meshRenderer.receiveShadow = true;
  4828. grid.getChildAt(0).layer = 5;
  4829. var staticLayaMonkey = new Laya.MeshSprite3D(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/LayaMonkey-LayaMonkey.lm"));
  4830. this._scene.addChild(staticLayaMonkey);
  4831. staticLayaMonkey.meshRenderer.material = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/Materials/T_Diffuse.lmat");
  4832. staticLayaMonkey.layer = 1;
  4833. staticLayaMonkey.transform.position = new Laya.Vector3(0, 0, 0.5);
  4834. staticLayaMonkey.transform.localScale = new Laya.Vector3(0.3, 0.3, 0.3);
  4835. staticLayaMonkey.transform.rotation = new Laya.Quaternion(0.7071068, 0, 0, -0.7071067);
  4836. staticLayaMonkey.meshRenderer.castShadow = true;
  4837. var layaMonkey_clone1 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4838. var layaMonkey_clone2 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4839. var layaMonkey_clone3 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4840. layaMonkey_clone1.layer = 2;
  4841. layaMonkey_clone2.layer = 3;
  4842. layaMonkey_clone3.layer = 0;
  4843. layaMonkey_clone1.transform.translate(new Laya.Vector3(1.5, 0, 0.0));
  4844. layaMonkey_clone2.transform.translate(new Laya.Vector3(-1.5, 0, 0.0));
  4845. layaMonkey_clone3.transform.translate(new Laya.Vector3(2.5, 0, 0.0));
  4846. layaMonkey_clone2.transform.rotate(new Laya.Vector3(0, 60, 0), false, false);
  4847. var scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4848. layaMonkey_clone3.transform.localScale = scale;
  4849. }
  4850. onDestroy() {
  4851. Laya.timer.clearAll(this);
  4852. }
  4853. ShakeFor(a, b) {
  4854. this.camPOS = this.selfObj.transform.position.clone();
  4855. this.seconds = a;
  4856. this.started = true;
  4857. this.startShake = true;
  4858. this.quake = b;
  4859. }
  4860. Shake() {
  4861. var x = GameTool.random_1to1() * this.quake;
  4862. var y = GameTool.random_1to1() * this.quake;
  4863. var z = GameTool.random_1to1() * this.quake;
  4864. var temp = new Vector3$5(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake);
  4865. this.selfObj.transform.position = temp;
  4866. }
  4867. onLateUpdate() {
  4868. if (this.startShake) {
  4869. this.Shake();
  4870. }
  4871. if (this.started) {
  4872. this.started = false;
  4873. Laya.timer.once(this.seconds * 1000, this, () => {
  4874. this.startShake = false;
  4875. this.selfObj.transform.position = this.camPOS;
  4876. });
  4877. }
  4878. }
  4879. animate() {
  4880. this._position.x = Math.sin(this.scaleDelta += 0.01);
  4881. this.layaMonkey3D.transform.position = this._position;
  4882. this.layaMonkey3D.transform.scale = this.scale;
  4883. this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos);
  4884. this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
  4885. }
  4886. MoveGame(z) {
  4887. if (!this.canmovegame)
  4888. return;
  4889. this.temp.z = z - this.dis.z;
  4890. this._tran.localPositionZ = this.temp.z;
  4891. }
  4892. }
  4893. var Sprite$a = Laya.Sprite;
  4894. var BlurFilter = Laya.BlurFilter;
  4895. class Scene3DManager {
  4896. constructor() {
  4897. this.apePath = "res/apes/monkey2.png";
  4898. }
  4899. static get Instance() {
  4900. return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
  4901. }
  4902. InitGame() {
  4903. Laya.timer.frameOnce(10, this, () => {
  4904. MainRoleManager.Instance.MadePlayer();
  4905. this.InItScene();
  4906. });
  4907. }
  4908. ;
  4909. Init(_s) {
  4910. if (_s) {
  4911. this.MainScene = _s;
  4912. Laya.stage.addChild(_s);
  4913. }
  4914. else {
  4915. console.error("场景不存在");
  4916. return;
  4917. }
  4918. let sceneNode;
  4919. sceneNode = this.MainScene.getChildByName("scene");
  4920. if (!sceneNode) {
  4921. console.error("场景资源配置错误!");
  4922. return;
  4923. }
  4924. this.MainCamera = this.MainScene.getChildByName("Main Camera");
  4925. this.MainCamera.enableHDR = false;
  4926. this.bulletCon = sceneNode.getChildByName("bulletContainer");
  4927. this.effectCon = sceneNode.getChildByName("effectPos");
  4928. this.SetSceneMaterial();
  4929. let build = sceneNode.getChildByName("buildings");
  4930. ConstructManager.Instance.Init(build);
  4931. let playerStartPos = sceneNode.getChildByName("playerstartPoint");
  4932. let playerCon = sceneNode.getChildByName("playerContainer");
  4933. MainRoleManager.Instance.Init(playerStartPos, playerCon);
  4934. let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
  4935. StreetManager.Instance.Init(moveBlockContainer);
  4936. let towerContainer = sceneNode.getChildByName("towerContainer");
  4937. MoundManager.Instance.Init(towerContainer);
  4938. let startCampos1 = sceneNode.getChildByName("startCamPos");
  4939. let startCamposX = sceneNode.getChildByName("startXCamPos");
  4940. let ps;
  4941. if (GameVersion.isX)
  4942. ps = startCamposX;
  4943. else
  4944. ps = startCampos1;
  4945. CameraManager.Instance.Init(this.MainCamera, ps);
  4946. let finalPos = sceneNode.getChildByName("finalPos");
  4947. PlaneManager.Instance.Init(finalPos);
  4948. this.InitGame();
  4949. }
  4950. createApe() {
  4951. var ape = new Sprite$a();
  4952. ape.loadImage(this.apePath);
  4953. ape.x = (Laya.stage.width - ape.width) / 2;
  4954. ape.y = (Laya.stage.height - ape.height) / 2;
  4955. Laya.stage.addChild(ape);
  4956. this.applayFilter(ape);
  4957. }
  4958. applayFilter(ape) {
  4959. var blurFilter = new BlurFilter();
  4960. blurFilter.strength = 5;
  4961. ape.filters = [blurFilter];
  4962. }
  4963. SetSceneMaterial() {
  4964. this.MainCamera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
  4965. let skyRenderer = this.MainScene.skyRenderer;
  4966. skyRenderer.mesh = Laya.SkyDome.instance;
  4967. let mat = new Laya.SkyProceduralMaterial();
  4968. skyRenderer.material = mat;
  4969. mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
  4970. mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
  4971. }
  4972. InItScene() {
  4973. LevelController.Instance.SetLevel();
  4974. PlaneManager.Instance.SetAir();
  4975. ConstructManager.Instance.SetConstruct();
  4976. CameraManager.Instance.SetCameraAction(CameraState.game, 1);
  4977. MainRoleManager.Instance.SetPlayerPosition();
  4978. }
  4979. }
  4980. var Sprite$b = Laya.Sprite;
  4981. var GlowFilter = Laya.GlowFilter;
  4982. class ResourcesManager {
  4983. constructor() {
  4984. this.cloth = [];
  4985. this.apePath = "res/apes/monkey2.png";
  4986. }
  4987. static get Instance() {
  4988. return this.instance || (this.instance = new ResourcesManager());
  4989. }
  4990. static LoadResource(path, complet) {
  4991. Laya.loader.retryNum = 2;
  4992. Laya.loader.maxLoader = 3;
  4993. Laya.loader.retryDelay = 100;
  4994. Laya.loader.create(path, new Laya.Handler(this, complet));
  4995. Laya.loader.on(Laya.Event.ERROR, this, (data) => {
  4996. console.log(data + " 资源加载失败");
  4997. });
  4998. }
  4999. InitAsset() {
  5000. AssetPath.Player.forEach(element => {
  5001. let _player = Laya.loader.getRes(element);
  5002. Laya.loader.clearRes(element);
  5003. this.LoadPoolRes(_player.name, _player);
  5004. });
  5005. AssetPath.Particle.forEach(element => {
  5006. let _effect = Laya.loader.getRes(element);
  5007. Laya.loader.clearRes(element);
  5008. this.LoadPoolRes(_effect.name, _effect);
  5009. });
  5010. let _enemy = Laya.loader.getRes(AssetPath.Enemy);
  5011. Laya.loader.clearRes(AssetPath.Enemy);
  5012. this.LoadPoolRes(_enemy.name, _enemy);
  5013. let _playerbullet = Laya.loader.getRes(AssetPath.PlayerShot);
  5014. Laya.loader.clearRes(AssetPath.PlayerShot);
  5015. this.LoadPoolRes(_playerbullet.name, _playerbullet);
  5016. let _tower = Laya.loader.getRes(AssetPath.Mound);
  5017. Laya.loader.clearRes(AssetPath.Mound);
  5018. this.LoadPoolRes(_tower.name, _tower);
  5019. let _scene = Laya.loader.getRes(AssetPath.MainScene);
  5020. Laya.loader.clearRes(AssetPath.MainScene);
  5021. AssetPath.Barrier.forEach(element => {
  5022. let _barrier = Laya.loader.getRes(element);
  5023. Laya.loader.clearRes(element);
  5024. this.LoadPoolRes(_barrier.name, _barrier);
  5025. });
  5026. Scene3DManager.Instance.Init(_scene);
  5027. }
  5028. LoadPoolRes(name, prefab) {
  5029. GamePool.Instance.InitSelf(name, prefab);
  5030. }
  5031. setup() {
  5032. this.createApe();
  5033. this.applayFilter();
  5034. }
  5035. createApe() {
  5036. this.ape = new Sprite$b();
  5037. this.ape.loadImage(this.apePath);
  5038. var texture = Laya.loader.getRes(this.apePath);
  5039. this.ape.x = (Laya.stage.width - texture.width) / 2;
  5040. this.ape.y = (Laya.stage.height - texture.height) / 2;
  5041. Laya.stage.addChild(this.ape);
  5042. }
  5043. applayFilter() {
  5044. var glowFilter = new GlowFilter("#ffff00", 10, 0, 0);
  5045. this.ape.filters = [glowFilter];
  5046. }
  5047. Load(callback) {
  5048. var arr = [
  5049. AssetPath.MainScene,
  5050. AssetPath.Enemy,
  5051. AssetPath.PlayerShot,
  5052. AssetPath.Mound,
  5053. ];
  5054. let arr1 = arr.concat(AssetPath.Player);
  5055. let arr2 = arr1.concat(AssetPath.Barrier);
  5056. let arr3 = arr2.concat(AssetPath.Particle);
  5057. ResourcesManager.LoadResource(arr3, () => {
  5058. this.InitAsset();
  5059. if (callback)
  5060. callback();
  5061. });
  5062. }
  5063. }
  5064. var Tween$1 = Laya.Tween;
  5065. class LoadView extends ui.LoadViewUI {
  5066. constructor() {
  5067. super();
  5068. this.proCom = false;
  5069. this.a = new Laya.Vector3();
  5070. this.loadResCom = false;
  5071. this.loginCom = false;
  5072. this.errorTime = 0;
  5073. this.timers = 0;
  5074. this.subLoadCom = false;
  5075. LoadView.instance = this;
  5076. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5077. }
  5078. static get Instance() {
  5079. return LoadView.instance;
  5080. }
  5081. Resize() {
  5082. this.height = Laya.stage.height;
  5083. }
  5084. OnShow(data) {
  5085. this.proTex.text = "0%";
  5086. this.pro1.width = 0;
  5087. this.RefreshUI();
  5088. this.LoginGame();
  5089. this.LoadSubpackage();
  5090. Laya.timer.frameOnce(5, this, () => {
  5091. this.Resize();
  5092. });
  5093. WXSdk.AldEvent("进入加载加载界面!");
  5094. }
  5095. RefreshData() {
  5096. this.proLen = this.pro.width;
  5097. }
  5098. RegButton() {
  5099. }
  5100. RefreshUI() {
  5101. Tween$1.to(this.a, {
  5102. x: 1, update: new Laya.Handler(this, () => {
  5103. var num = this.a.x;
  5104. this.pro1.width = this.proLen * num;
  5105. num = num * 100;
  5106. this.proTex.text = Math.ceil(num) + "%";
  5107. })
  5108. }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
  5109. this.proTex.text = "100%";
  5110. this.pro1.width = this.proLen;
  5111. this.proCom = true;
  5112. this.AllCom();
  5113. }));
  5114. }
  5115. LoadRes() {
  5116. if (this.subLoadCom && this.loginCom) {
  5117. ResourcesManager.Instance.Load(() => {
  5118. WXSdk.AldEvent("资源加载成功");
  5119. this.loadResCom = true;
  5120. this.AllCom();
  5121. });
  5122. }
  5123. }
  5124. LoginGame() {
  5125. if (GameVersion.isWx) {
  5126. WXSdk.Login((data) => {
  5127. this.onWxLoginHandler(data);
  5128. });
  5129. }
  5130. else {
  5131. this.LocalLogin();
  5132. }
  5133. }
  5134. onWxLoginHandler(params) {
  5135. console.log("微信回调成功!");
  5136. console.log(params);
  5137. if (params == "error" || params.code == null) {
  5138. if (this.errorTime == 0) {
  5139. WXSdk.AldEvent("微信登录失败");
  5140. }
  5141. this.errorTime++;
  5142. if (this.errorTime >= 3)
  5143. return;
  5144. WXSdk.Login((data) => {
  5145. this.onWxLoginHandler(data);
  5146. });
  5147. }
  5148. else {
  5149. if (this.errorTime == 0) {
  5150. WXSdk.AldEvent("微信登录成功!");
  5151. }
  5152. let systemInfo = WXSdk.SystemInfo();
  5153. let platformModel = "ipx";
  5154. if (systemInfo != null) {
  5155. var model = systemInfo.model;
  5156. platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
  5157. console.log("platformModel:" + platformModel);
  5158. }
  5159. new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
  5160. this.LocalLogin();
  5161. }
  5162. }
  5163. LocalLogin() {
  5164. NetManager.Instance.login(null, (data) => {
  5165. this.OnLoginComplete(data);
  5166. }, (data) => {
  5167. this.OnLoginError(data);
  5168. });
  5169. }
  5170. OnLoginComplete(data) {
  5171. if (data["code"] != "0") {
  5172. console.log("登录异常错误!");
  5173. WXSdk.AldEvent("本地登录成功!");
  5174. this.timers++;
  5175. if (this.timers >= 4)
  5176. return;
  5177. if (GameVersion.isWx) {
  5178. WXSdk.Login((data) => {
  5179. this.onWxLoginHandler(data);
  5180. });
  5181. }
  5182. else {
  5183. this.LocalLogin();
  5184. }
  5185. }
  5186. else {
  5187. this.loginCom = true;
  5188. this.LoadRes();
  5189. FYHD_Sdk.InitSdk();
  5190. this.AllCom();
  5191. }
  5192. }
  5193. OnLoginError(data) {
  5194. console.log("登录错误");
  5195. WXSdk.AldEvent("本地登陆失败");
  5196. }
  5197. LoadSubpackage() {
  5198. WXSdk.LoadSubPackage("subpackage", (com) => {
  5199. if (com) {
  5200. console.log("subpackage com++++++++++++++++");
  5201. LoadView.instance.subLoadCom = true;
  5202. LoadView.instance.LoadRes();
  5203. }
  5204. });
  5205. }
  5206. AllCom() {
  5207. if (this.proCom && this.loadResCom && this.loginCom) {
  5208. GuangGao.InitVideo();
  5209. Laya.timer.once(1000, this, () => {
  5210. WXSdk.AldEvent("进入主界面");
  5211. ViewManager.Instance.OpenView(ViewType.MainView);
  5212. MouseEvent.Instance.InitMouseEvent();
  5213. ShareModule.OnShowHandle();
  5214. SettingController.Instance.Init();
  5215. OnHideHandler.Reg();
  5216. SettingController.Instance._playMusic();
  5217. });
  5218. }
  5219. }
  5220. OnClose() {
  5221. LoadView.instance = null;
  5222. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5223. }
  5224. }
  5225. class MainView extends ui.MainViewUI {
  5226. constructor() {
  5227. super();
  5228. this.isTryed = false;
  5229. MainView.instance = this;
  5230. this.Resize();
  5231. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5232. }
  5233. static get Instance() {
  5234. return MainView.instance;
  5235. }
  5236. OnShow(data) {
  5237. this.RefreshData();
  5238. this.RegButton();
  5239. this.RefreshUI();
  5240. this.SetData();
  5241. this.SetTopAd();
  5242. if (GuideController.Instance.RequireGuide()) {
  5243. this.mainBox.visible = false;
  5244. }
  5245. }
  5246. RefreshUI() {
  5247. this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
  5248. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5249. this.SetStage();
  5250. this.SetStagePro(0);
  5251. this.SetSettingBox(false);
  5252. }
  5253. RefreshData() {
  5254. this.GetImage();
  5255. this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
  5256. this.proWidth = this.pro.width;
  5257. this.isTryed = false;
  5258. }
  5259. AdaptiveUI() {
  5260. }
  5261. moreFunc(ist) {
  5262. if (ist) ;
  5263. else {
  5264. console.log("mainui");
  5265. }
  5266. }
  5267. RegButton() {
  5268. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5269. this.settingBtn.CZ = () => {
  5270. this.SetSettingBox();
  5271. };
  5272. this.skinBtn.CZ = () => {
  5273. ViewManager.Instance.AddView(ViewType.SKinShopView);
  5274. };
  5275. this.updateBtn.CZ = () => {
  5276. ViewManager.Instance.AddView(ViewType.IntensifyView);
  5277. };
  5278. DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5279. DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5280. DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
  5281. DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
  5282. this.sound_btn.clickHandler = new Laya.Handler(this, () => {
  5283. this.ClickSound();
  5284. });
  5285. this.shake_btn.clickHandler = new Laya.Handler(this, () => {
  5286. this.ClickShake();
  5287. });
  5288. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5289. this.MoreGameBtn.clickHandler = new Laya.Handler(this, this.ClickExport);
  5290. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5291. }
  5292. ClickExit() {
  5293. ViewManager.Instance.AddView(ViewType.ExitView);
  5294. }
  5295. ClickExport() {
  5296. ViewManager.Instance.AddView(ViewType.ExportView);
  5297. }
  5298. SetStage() {
  5299. this.stageValue.text = PlayerManager.Instance.stage.toString();
  5300. }
  5301. SetStagePro(value) {
  5302. value = value >= 1 ? 1 : value;
  5303. this.pro1.width = this.proWidth * value;
  5304. }
  5305. SetPlayerGrade(num) {
  5306. this.tempTarGrade = num;
  5307. this.coinFollow.target = num;
  5308. Laya.timer.frameLoop(1, this, this.T2);
  5309. }
  5310. T2() {
  5311. this.coinFollow.update();
  5312. let v = Math.ceil(this.coinFollow.follow);
  5313. this.countValue.text = v.toString();
  5314. if (v >= this.tempTarGrade) {
  5315. this.countValue.text = this.tempTarGrade.toString();
  5316. Laya.timer.clear(this, this.T2);
  5317. }
  5318. }
  5319. StartGame(e) {
  5320. if (this.isTryed) {
  5321. this.TryStartGame();
  5322. return;
  5323. }
  5324. if (e.target instanceof Laya.UIComponent) {
  5325. if (e.target.name != "mainBox")
  5326. return;
  5327. }
  5328. console.log("click");
  5329. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
  5330. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
  5331. if (data["play_id"]) {
  5332. PlayerManager.Instance.Play_Id = data["play_id"];
  5333. }
  5334. WXSdk.Start(PlayerManager.Instance.stage.toString());
  5335. if (PlayerManager.Instance.stage >= 3) {
  5336. ViewManager.Instance.AddView(ViewType.TrialView);
  5337. }
  5338. else {
  5339. this.MainStartGame();
  5340. }
  5341. }, (data) => {
  5342. });
  5343. }
  5344. MainStartGame() {
  5345. GameManager.GameNum++;
  5346. this.mainBox.visible = false;
  5347. this.sliderBox.visible = false;
  5348. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5349. this.gameStart.stop();
  5350. GameManager.Instance.Start();
  5351. MouseEvent.Instance.StartGameClick();
  5352. MainRoleManager.Instance.Start();
  5353. MateManager.Instance.TrialModelPlayAni();
  5354. StreetManager.Instance.SetBlock();
  5355. GuideController.Instance.GuideOn();
  5356. }
  5357. TryStartGame() {
  5358. GameManager.GameNum++;
  5359. this.sliderBox.visible = false;
  5360. this.gameStart.stop();
  5361. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5362. GameManager.Instance.Start();
  5363. MouseEvent.Instance.StartGameClick();
  5364. MainRoleManager.Instance.Start();
  5365. MateManager.Instance.TrialModelPlayAni();
  5366. StreetManager.Instance.SetBlock();
  5367. }
  5368. TryClick() {
  5369. this.isTryed = true;
  5370. this.mainBox.visible = false;
  5371. }
  5372. ShowMainBox() {
  5373. this.mainBox.visible = true;
  5374. this.sliderBox.visible = true;
  5375. this.gameStart.play(0, true);
  5376. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5377. this.isTryed = false;
  5378. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5379. }
  5380. SetSettingBox(ist = true) {
  5381. if (!ist) {
  5382. this.settingBox.visible = false;
  5383. return;
  5384. }
  5385. this.settingBox.visible = !this.settingBox.visible;
  5386. }
  5387. GetImage() {
  5388. this.sound_open = this.sound_btn.getChildByName("kai");
  5389. this.sound_guan = this.sound_btn.getChildByName("guan");
  5390. this.shake_open = this.shake_btn.getChildByName("kai");
  5391. this.shake_guan = this.shake_btn.getChildByName("guan");
  5392. this.ShowSound(SettingController.Instance.sound);
  5393. this.ShowShake(SettingController.Instance.vibrate);
  5394. }
  5395. ClickSound() {
  5396. SettingController.Instance.sound = !SettingController.Instance.sound;
  5397. this.ShowSound(SettingController.Instance.sound);
  5398. }
  5399. ShowSound(isshow) {
  5400. if (!isshow) {
  5401. this.sound_open.visible = false;
  5402. this.sound_guan.visible = true;
  5403. SettingController.Instance.SettingSound(0);
  5404. Laya.LocalStorage.setItem("sound", "0");
  5405. console.log("关闭声音");
  5406. }
  5407. else {
  5408. this.sound_open.visible = true;
  5409. this.sound_guan.visible = false;
  5410. SettingController.Instance.SettingSound(1);
  5411. Laya.LocalStorage.setItem("sound", "1");
  5412. console.log("开启声音");
  5413. }
  5414. }
  5415. ClickShake() {
  5416. SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
  5417. this.ShowShake(SettingController.Instance.vibrate);
  5418. }
  5419. ShowShake(isshow) {
  5420. if (!isshow) {
  5421. this.shake_open.visible = false;
  5422. this.shake_guan.visible = true;
  5423. Laya.LocalStorage.setItem("vibrate", "0");
  5424. console.log("关闭震动");
  5425. }
  5426. else {
  5427. this.shake_open.visible = true;
  5428. this.shake_guan.visible = false;
  5429. Laya.LocalStorage.setItem("vibrate", "1");
  5430. console.log("开启震动");
  5431. }
  5432. }
  5433. OnClose() {
  5434. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5435. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5436. DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5437. DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5438. DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
  5439. DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
  5440. MainView.instance = null;
  5441. Laya.timer.clearAll(this);
  5442. }
  5443. Resize() {
  5444. this.height = Laya.stage.height;
  5445. }
  5446. SetData() {
  5447. FYHD_Sdk.SetHuTuiList(this.BottomList, 2, "");
  5448. this.GunGun();
  5449. }
  5450. GunGun() {
  5451. var maxBtm;
  5452. try {
  5453. this.BottomList.scrollBar.value = 0;
  5454. maxBtm = this.BottomList.scrollBar.max;
  5455. }
  5456. catch (error) {
  5457. console.error(error);
  5458. return;
  5459. }
  5460. var tempBtm = 1;
  5461. Laya.timer.frameLoop(1, this, () => {
  5462. this.BottomList.scrollBar.value += tempBtm;
  5463. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  5464. tempBtm = -tempBtm;
  5465. }
  5466. });
  5467. }
  5468. SetTopAd() {
  5469. if (Laya.Browser.onPC)
  5470. return;
  5471. this.topAdData = FYHD_Sdk.pushData || [];
  5472. this.LeftPushIcon.visible = this.RightPushIcon.visible = this.topAdData.length >= 2;
  5473. if (this.topAdData.length < 2)
  5474. return;
  5475. this.topLeftAdIndex = { index: 0 };
  5476. this.topRightAdIndex = { index: 1 };
  5477. this._setTopAd(this.LeftPushIcon, this.topLeftAdIndex);
  5478. this._setTopAd(this.RightPushIcon, this.topRightAdIndex);
  5479. }
  5480. _setTopAd(topAd, adIndex) {
  5481. let _icon = topAd.getChildByName("icon");
  5482. let _name = topAd.getChildByName("name");
  5483. topAd.clickHandler = new Laya.Handler(this, () => {
  5484. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5485. });
  5486. this._setIcon(_icon, _name, adIndex);
  5487. Laya.timer.loop(3000, this, () => {
  5488. this._setIcon(_icon, _name, adIndex);
  5489. this.lefticon.play(null, false);
  5490. this.righticon.play(null, false);
  5491. });
  5492. }
  5493. _setIcon(_icon, _name, adIndex) {
  5494. adIndex.index = (adIndex.index + 2) % this.topAdData.length;
  5495. _icon.skin = this.topAdData[adIndex.index].icon;
  5496. _name.text = this.topAdData[adIndex.index].togame_name;
  5497. }
  5498. }
  5499. class CompleteView extends ui.CompleteViewUI {
  5500. constructor() {
  5501. super();
  5502. this.isWin = false;
  5503. CompleteView.instance = this;
  5504. this.Resize();
  5505. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5506. }
  5507. static get Instance() {
  5508. return CompleteView.instance;
  5509. }
  5510. OnShow(data) {
  5511. this.isWin = data;
  5512. this.RefreshData();
  5513. this.RegButton();
  5514. this.RefreshUI();
  5515. this.SetTopAd();
  5516. GuangGao.CheatBanner(this.winbtnBox);
  5517. }
  5518. Resize() {
  5519. this.height = Laya.stage.height;
  5520. }
  5521. RefreshData() {
  5522. this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
  5523. this.tes1 = this.coinValue;
  5524. this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
  5525. let iswin = this.isWin == true ? 1 : 0;
  5526. let count = this.coinValue;
  5527. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
  5528. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
  5529. }, (data) => {
  5530. ViewManager.Instance.ShowTips("结算失败");
  5531. });
  5532. if (this.isWin) {
  5533. SettingController.Instance.PlaySound(SoundType.win);
  5534. WXSdk.Success(PlayerManager.Instance.stage.toString());
  5535. }
  5536. else {
  5537. SettingController.Instance.PlaySound(SoundType.defeat);
  5538. WXSdk.Fail(PlayerManager.Instance.stage.toString());
  5539. }
  5540. }
  5541. RegButton() {
  5542. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5543. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5544. this.doublegetBtn.CZ = () => {
  5545. this.DoubleGet();
  5546. };
  5547. this.nextBtn.CZ = () => {
  5548. if (this.isWin) {
  5549. this.Next();
  5550. }
  5551. else {
  5552. this.Resset();
  5553. }
  5554. };
  5555. }
  5556. ClickExit() {
  5557. ViewManager.Instance.AddView(ViewType.ExitView);
  5558. }
  5559. Next() {
  5560. GameManager.Instance.LevelUp();
  5561. }
  5562. Resset() {
  5563. ViewManager.Instance.CloseView(ViewType.CompleteView);
  5564. GameManager.Instance.ReStart();
  5565. }
  5566. OnClose() {
  5567. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5568. CompleteView.instance = null;
  5569. Laya.timer.clearAll(this);
  5570. if (GameManager.GameNum == 1) {
  5571. ViewManager.Instance.AddView(ViewType.AttributeUpView);
  5572. ViewManager.Instance.AddView(ViewType.ExportView);
  5573. }
  5574. else {
  5575. ViewManager.Instance.AddView(ViewType.IntensifyView);
  5576. ViewManager.Instance.AddView(ViewType.ExportView);
  5577. }
  5578. GuangGao.Clear();
  5579. }
  5580. RefreshUI() {
  5581. this.winTop.visible = this.isWin;
  5582. this.shibaiTop.visible = !this.isWin;
  5583. this.valueText.text = "+" + this.coinValue;
  5584. this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
  5585. this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
  5586. this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
  5587. this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
  5588. this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
  5589. this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
  5590. }
  5591. DoubleGet() {
  5592. GuangGao.ShowVideo((isok) => {
  5593. if (isok) {
  5594. WXSdk.AldEvent("结束界面看视屏获得钱");
  5595. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
  5596. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5597. ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
  5598. this.Next();
  5599. }, (data) => {
  5600. });
  5601. }
  5602. });
  5603. }
  5604. SetTopAd() {
  5605. if (Laya.Browser.onPC)
  5606. return;
  5607. this.topAdData = FYHD_Sdk.pushData || [];
  5608. if (this.topAdData.length < 4)
  5609. return;
  5610. this.topLeftAdIndex = { index: 0 };
  5611. this.topRightAdIndex = { index: 1 };
  5612. this.bottomleftAdIndex = { index: 2 };
  5613. this.bottomRightAdIndex = { index: 3 };
  5614. this._setTopAd(this.LeftTopPushIcon, this.topLeftAdIndex);
  5615. this._setTopAd(this.LeftBottomPushIcon, this.bottomleftAdIndex);
  5616. this._setTopAd(this.RightTopPushIcon, this.topRightAdIndex);
  5617. this._setTopAd(this.RightBottomPushIcon, this.bottomRightAdIndex);
  5618. }
  5619. _setTopAd(topAd, adIndex) {
  5620. let _icon = topAd.getChildByName("icon");
  5621. let _name = topAd.getChildByName("name");
  5622. topAd.clickHandler = new Laya.Handler(this, () => {
  5623. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5624. });
  5625. this._setIcon(_icon, _name, adIndex);
  5626. Laya.timer.loop(3000, this, () => {
  5627. this._setIcon(_icon, _name, adIndex);
  5628. this.pushshake.play(null, false);
  5629. });
  5630. }
  5631. _setIcon(_icon, _name, adIndex) {
  5632. adIndex.index = (adIndex.index + 4) % this.topAdData.length;
  5633. _icon.skin = this.topAdData[adIndex.index].icon;
  5634. _name.text = this.topAdData[adIndex.index].togame_name;
  5635. }
  5636. }
  5637. class InGameView extends ui.InGameViewUI {
  5638. static get Instance() {
  5639. return InGameView.instance;
  5640. }
  5641. constructor() {
  5642. super();
  5643. InGameView.instance = this;
  5644. this.Resize();
  5645. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5646. }
  5647. OnShow(data) {
  5648. this.RefreshData();
  5649. this.RegButton();
  5650. this.RefreshUI();
  5651. }
  5652. Resize() {
  5653. this.height = Laya.stage.height;
  5654. }
  5655. RefreshData() {
  5656. }
  5657. RegButton() {
  5658. }
  5659. RefreshUI() {
  5660. }
  5661. OnClose() {
  5662. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5663. InGameView.instance = null;
  5664. Laya.timer.clearAll(this);
  5665. }
  5666. }
  5667. class IntensifyView extends ui.IntensifyViewUI {
  5668. constructor() {
  5669. super();
  5670. this.iscoinShowfreecoinbtn = false;
  5671. this.Resize();
  5672. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5673. }
  5674. OnShow(data) {
  5675. this.RefreshData();
  5676. this.RegButton();
  5677. this.RefreshUI();
  5678. GuangGao.OpenBanner();
  5679. }
  5680. RefreshUI() {
  5681. this.InitUi();
  5682. this.RefreshCoinShow();
  5683. let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
  5684. this.freecoinValue = Math.floor(t * 1.2);
  5685. this.coinValue.text = this.freecoinValue.toString();
  5686. }
  5687. RefreshData() {
  5688. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  5689. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  5690. this.RefreshData2();
  5691. }
  5692. RefreshData2() {
  5693. let detail = UserModel.Instance.CurModel.user_video.detail;
  5694. if (!detail)
  5695. this.iscoinShowfreecoinbtn = true;
  5696. else {
  5697. let freet = detail.freecoin;
  5698. if (!freet) {
  5699. this.iscoinShowfreecoinbtn = true;
  5700. return;
  5701. }
  5702. if (freet < AppSetting.freeGetcoinTime) {
  5703. this.iscoinShowfreecoinbtn = true;
  5704. return;
  5705. }
  5706. this.iscoinShowfreecoinbtn = false;
  5707. }
  5708. }
  5709. RegButton() {
  5710. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5711. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5712. this.backBtn.visible = false;
  5713. Laya.timer.once(3000, this, () => {
  5714. this.backBtn.visible = true;
  5715. this.backBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  5716. });
  5717. this.atkupBtn.clickHandler = new Laya.Handler(this, this.AtkUp);
  5718. this.rateupBtn.clickHandler = new Laya.Handler(this, this.RateUp);
  5719. this.getcoinBtn.clickHandler = new Laya.Handler(this, this.GetCoin);
  5720. }
  5721. ClickExit() {
  5722. ViewManager.Instance.AddView(ViewType.ExitView);
  5723. }
  5724. ClickClose() {
  5725. ViewManager.Instance.CloseView(ViewType.IntensifyView);
  5726. }
  5727. AtkUp() {
  5728. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5729. ViewManager.Instance.ShowTips("金币不足!", 1);
  5730. return;
  5731. }
  5732. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  5733. if (iscom) {
  5734. WXSdk.AldEvent("升级界面花钱升级攻击力");
  5735. this.tempPowerLevel++;
  5736. this.InitUi();
  5737. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5738. }
  5739. });
  5740. }
  5741. RateUp() {
  5742. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5743. ViewManager.Instance.ShowTips("金币不足!", 1);
  5744. return;
  5745. }
  5746. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  5747. if (iscom) {
  5748. WXSdk.AldEvent("升级界面花钱升级速度");
  5749. this.tempRateLevel++;
  5750. this.InitUi();
  5751. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5752. }
  5753. });
  5754. }
  5755. GetCoin() {
  5756. GuangGao.ShowVideo((isok) => {
  5757. if (isok) {
  5758. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
  5759. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5760. WXSdk.AldEvent("升级界面看视屏获得钱");
  5761. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5762. this.RefreshData();
  5763. this.RefreshCoinShow();
  5764. }, (data) => {
  5765. });
  5766. }
  5767. });
  5768. }
  5769. RefreshCoinShow() {
  5770. if (this.iscoinShowfreecoinbtn) {
  5771. this.getcoinBtn.gray = false;
  5772. this.getcoinBtn.mouseEnabled = true;
  5773. }
  5774. else {
  5775. this.getcoinBtn.gray = true;
  5776. this.getcoinBtn.mouseEnabled = false;
  5777. }
  5778. }
  5779. InitUi() {
  5780. this.atkLv.text = "LV" + this.tempPowerLevel;
  5781. let al = NetInfoManager.Instance._atk.length;
  5782. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  5783. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  5784. this.atkValue.text = this.cost1.toString();
  5785. this.rateLv.text = "LV" + this.tempRateLevel;
  5786. let al1 = NetInfoManager.Instance._rate.length;
  5787. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  5788. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  5789. this.rateValue.text = this.cost2.toString();
  5790. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5791. this.atkupBtn.gray = true;
  5792. this.atkupBtn.mouseEnabled = false;
  5793. }
  5794. else {
  5795. this.atkupBtn.gray = false;
  5796. this.atkupBtn.mouseEnabled = true;
  5797. }
  5798. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5799. this.rateupBtn.gray = true;
  5800. this.rateupBtn.mouseEnabled = false;
  5801. }
  5802. else {
  5803. this.rateupBtn.gray = false;
  5804. this.rateupBtn.mouseEnabled = true;
  5805. }
  5806. }
  5807. OnClose() {
  5808. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5809. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  5810. PlayerManager.Instance.SetInfo();
  5811. }
  5812. GuangGao.Clear();
  5813. }
  5814. Resize() {
  5815. this.height = Laya.stage.height;
  5816. }
  5817. }
  5818. class AttributeUpView extends ui.AttributeUpViewUI {
  5819. constructor() {
  5820. super();
  5821. this.iscanShowVideoBtn = true;
  5822. this.isatkvideo = false;
  5823. this.isfirstatkvideo = true;
  5824. this.isfirstratevideo = true;
  5825. this.isratevideo = false;
  5826. this.atkShow = false;
  5827. this.PushDataArray = [];
  5828. this.doudongcishu = 2;
  5829. this.Resize();
  5830. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5831. }
  5832. OnShow(data) {
  5833. this.RefreshData();
  5834. this.RegButton();
  5835. this.RefreshUI();
  5836. this.InitPushData();
  5837. GuangGao.OpenBanner();
  5838. }
  5839. RefreshUI() {
  5840. this.SetUi();
  5841. }
  5842. SetUi() {
  5843. this.atkLv.text = "LV" + this.tempPowerLevel;
  5844. let al = NetInfoManager.Instance._atk.length;
  5845. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  5846. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  5847. this.atkValue.text = this.cost1.toString();
  5848. this.rateLv.text = "LV" + this.tempRateLevel;
  5849. let al1 = NetInfoManager.Instance._rate.length;
  5850. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  5851. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  5852. this.rateValue.text = this.cost2.toString();
  5853. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5854. if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
  5855. this.isatkvideo = true;
  5856. this._atk.visible = false;
  5857. this._atkVideo.visible = true;
  5858. this.atkBtn.mouseEnabled = true;
  5859. this.atkBtn.gray = false;
  5860. this.click1.visible = true;
  5861. this.atkShow = true;
  5862. }
  5863. else {
  5864. this.atkBtn.mouseEnabled = false;
  5865. this.atkBtn.gray = true;
  5866. this.isatkvideo = false;
  5867. this.click1.visible = false;
  5868. this.atkShow = false;
  5869. }
  5870. }
  5871. else {
  5872. this._atk.visible = true;
  5873. this._atkVideo.visible = false;
  5874. this.atkBtn.gray = false;
  5875. this.atkBtn.mouseEnabled = true;
  5876. this.isatkvideo = false;
  5877. this.click1.visible = true;
  5878. this.atkShow = true;
  5879. }
  5880. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5881. if (this.iscanShowVideoBtn && this.isfirstratevideo) {
  5882. this.isratevideo = true;
  5883. this._rate.visible = false;
  5884. this._rateVideo.visible = true;
  5885. this.rateBtn.mouseEnabled = true;
  5886. this.rateBtn.gray = false;
  5887. if (this.atkShow)
  5888. this.click2.visible = false;
  5889. else
  5890. this.click2.visible = true;
  5891. }
  5892. else {
  5893. this.rateBtn.mouseEnabled = false;
  5894. this.rateBtn.gray = true;
  5895. this.isratevideo = false;
  5896. this.click2.visible = false;
  5897. }
  5898. }
  5899. else {
  5900. this._rate.visible = true;
  5901. this._rateVideo.visible = false;
  5902. this.rateBtn.gray = false;
  5903. this.rateBtn.mouseEnabled = true;
  5904. this.isratevideo = false;
  5905. if (this.atkShow)
  5906. this.click2.visible = false;
  5907. else
  5908. this.click2.visible = true;
  5909. }
  5910. }
  5911. RefreshData() {
  5912. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  5913. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  5914. let detail = UserModel.Instance.CurModel.user_video.detail;
  5915. if (!detail)
  5916. this.iscanShowVideoBtn = true;
  5917. else {
  5918. let freet = detail.free;
  5919. if (!freet) {
  5920. this.iscanShowVideoBtn = true;
  5921. return;
  5922. }
  5923. if (freet < AppSetting.freeUpdateVideotime) {
  5924. this.iscanShowVideoBtn = true;
  5925. return;
  5926. }
  5927. {
  5928. this.iscanShowVideoBtn = false;
  5929. }
  5930. }
  5931. }
  5932. RegButton() {
  5933. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5934. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5935. this.backBtn.CZ = () => {
  5936. this.BackClickHandler();
  5937. };
  5938. this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
  5939. this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
  5940. }
  5941. ClickExit() {
  5942. ViewManager.Instance.AddView(ViewType.ExitView);
  5943. }
  5944. AtkBtnHandler() {
  5945. if (this.isatkvideo) {
  5946. GuangGao.ShowVideo((iscom) => {
  5947. if (iscom) {
  5948. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
  5949. if (iscom) {
  5950. WXSdk.AldEvent("失败界面看视屏升级攻击力");
  5951. this.tempPowerLevel++;
  5952. this.isfirstatkvideo = false;
  5953. this.SetUi();
  5954. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5955. }
  5956. });
  5957. }
  5958. });
  5959. }
  5960. else {
  5961. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  5962. if (iscom) {
  5963. WXSdk.AldEvent("失败界面花钱升级攻击力");
  5964. this.tempPowerLevel++;
  5965. this.SetUi();
  5966. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5967. }
  5968. });
  5969. }
  5970. }
  5971. RateBtnHandler() {
  5972. if (this.isratevideo) {
  5973. GuangGao.ShowVideo((iscom) => {
  5974. if (iscom) {
  5975. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
  5976. if (iscom) {
  5977. WXSdk.AldEvent("失败界面看视屏升级速度");
  5978. this.tempRateLevel++;
  5979. this.isfirstratevideo = false;
  5980. this.SetUi();
  5981. }
  5982. });
  5983. }
  5984. });
  5985. }
  5986. else {
  5987. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  5988. if (iscom) {
  5989. WXSdk.AldEvent("失败界面花钱升级速度");
  5990. this.tempRateLevel++;
  5991. this.SetUi();
  5992. }
  5993. });
  5994. }
  5995. }
  5996. BackClickHandler() {
  5997. ViewManager.Instance.CloseView(ViewType.AttributeUpView);
  5998. GameManager.Instance.ReStart();
  5999. }
  6000. OnClose() {
  6001. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6002. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  6003. PlayerManager.Instance.SetInfo();
  6004. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6005. }
  6006. GuangGao.Clear();
  6007. }
  6008. Resize() {
  6009. this.height = Laya.stage.height;
  6010. }
  6011. InitPushData() {
  6012. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  6013. if (i < 6) {
  6014. this.PushDataArray.push(FYHD_Sdk.pushData[i]);
  6015. }
  6016. }
  6017. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6018. let box = this.PushBox.getChildAt(j);
  6019. let icon = box.getChildByName("icon");
  6020. let btn = box.getChildByName("btn");
  6021. let name = box.getChildByName("name");
  6022. icon.skin = this.PushDataArray[j].icon;
  6023. name.text = this.PushDataArray[j].togame_name;
  6024. btn.clickHandler = new Laya.Handler(this, this.clickAd, [this.PushDataArray[j]]);
  6025. }
  6026. Laya.timer.loop(3000, this, this.Doudong);
  6027. }
  6028. clickAd(_data) {
  6029. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6030. FYHD_Sdk.ShowHuTuiJump(_data);
  6031. }
  6032. PlayAni() {
  6033. this.shakeani.play(null, false);
  6034. }
  6035. Doudong() {
  6036. this.PlayAni();
  6037. this.doudongcishu++;
  6038. let _arr = [];
  6039. if (this.doudongcishu % 2 == 0) {
  6040. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  6041. if (i < 6) {
  6042. _arr.push(FYHD_Sdk.pushData[i]);
  6043. }
  6044. }
  6045. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6046. let box = this.PushBox.getChildAt(j);
  6047. let icon = box.getChildByName("icon");
  6048. let btn = box.getChildByName("btn");
  6049. icon.skin = _arr[j].icon;
  6050. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  6051. }
  6052. }
  6053. else {
  6054. let num = 0;
  6055. for (let i = FYHD_Sdk.pushData.length - 1; i > -1; i--) {
  6056. if (num < 6) {
  6057. _arr.push(FYHD_Sdk.pushData[i]);
  6058. }
  6059. num++;
  6060. }
  6061. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6062. let box = this.PushBox.getChildAt(j);
  6063. let icon = box.getChildByName("icon");
  6064. let btn = box.getChildByName("btn");
  6065. icon.skin = _arr[j].icon;
  6066. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  6067. }
  6068. }
  6069. }
  6070. }
  6071. var Vector3$6 = Laya.Vector3;
  6072. class DisplayerCarController {
  6073. static get Instance() {
  6074. return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
  6075. }
  6076. CreatePlayer(id) {
  6077. if (!id)
  6078. id = PlayerManager.Instance.equipId;
  6079. if (!this.player) {
  6080. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  6081. if (p)
  6082. this.player = p;
  6083. this.mainscene.addChild(this.player);
  6084. this.player.transform.localPosition = MathTool.VecZero;
  6085. this.player.transform.localRotationEuler = MathTool.VecZero;
  6086. }
  6087. else {
  6088. GamePool.Instance.RecoverModel(this.player);
  6089. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  6090. if (p)
  6091. this.player = p;
  6092. this.mainscene.addChild(this.player);
  6093. this.player.transform.localPosition = MathTool.VecZero;
  6094. this.player.transform.localRotationEuler = MathTool.VecZero;
  6095. }
  6096. let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
  6097. anima.play(MusicType.Dance);
  6098. anima.speed = 1;
  6099. }
  6100. Reset() {
  6101. if (this.mainscene) {
  6102. this.mainscene.removeSelf();
  6103. }
  6104. if (this.player) {
  6105. GamePool.Instance.RecoverModel(this.player);
  6106. this.player = null;
  6107. }
  6108. }
  6109. InitDis(par) {
  6110. if (!this.mainscene) {
  6111. this.mainscene = new Laya.Scene3D();
  6112. this.maincamera = new Laya.Camera();
  6113. this.maincamera.enableHDR = false;
  6114. this.mainscene.addChild(this.maincamera);
  6115. this.light = new Laya.DirectionLight();
  6116. this.light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
  6117. this.light.intensity = 0.45;
  6118. this.light.color = new Vector3$6(1, 1, 1);
  6119. this.mainscene.addChild(this.light);
  6120. let or = 1;
  6121. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6122. this.maincamera.orthographic = false;
  6123. this.maincamera.enableHDR = false;
  6124. this.maincamera.clearFlag = 2;
  6125. this.maincamera.fieldOfView = 60;
  6126. this.maincamera.transform.position = new Vector3$6(0, 1.52, 3.12);
  6127. this.maincamera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
  6128. }
  6129. let or = 1;
  6130. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6131. par.addChild(this.mainscene);
  6132. this.CreatePlayer();
  6133. }
  6134. }
  6135. class SKinShopView extends ui.SkinShopViewUI {
  6136. static get Instance() {
  6137. return SKinShopView.instance;
  6138. }
  6139. constructor() {
  6140. super();
  6141. SKinShopView.instance = this;
  6142. this.Resize();
  6143. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6144. }
  6145. Resize() {
  6146. this.height = Laya.stage.height;
  6147. }
  6148. OnShow(data) {
  6149. this.RefreshData();
  6150. this.RegButton();
  6151. this.RefreshUI();
  6152. WXSdk.AldEvent("打开皮肤界面");
  6153. }
  6154. RefreshData() {
  6155. this.oignPlayerid = PlayerManager.Instance.equipId;
  6156. this.operateIndex = this.oignPlayerid;
  6157. }
  6158. RefreshUI(data) {
  6159. this.SetBtnUi(this.operateIndex);
  6160. this.RefreshBtnUi(this.operateIndex);
  6161. DisplayerCarController.Instance.InitDis(this.viewPort);
  6162. }
  6163. RefreshBtnUi(index) {
  6164. if (PlayerManager.Instance.equipId == index) {
  6165. this.using.visible = true;
  6166. this.use.visible = false;
  6167. this.coin.visible = false;
  6168. this.video.visible = false;
  6169. return;
  6170. }
  6171. if (UserModel.Instance.CurModel.HasTheme(index)) {
  6172. this.using.visible = false;
  6173. this.use.visible = true;
  6174. this.coin.visible = false;
  6175. this.video.visible = false;
  6176. return;
  6177. }
  6178. let data = NetInfoManager.Instance.GetTheme(index);
  6179. if (data.require_type == 2) {
  6180. this.using.visible = false;
  6181. this.use.visible = false;
  6182. this.coin.visible = true;
  6183. this.video.visible = false;
  6184. this.coinValue = Number(data.require_num);
  6185. this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
  6186. return;
  6187. }
  6188. if (data.require_type == 3) {
  6189. this.using.visible = false;
  6190. this.use.visible = false;
  6191. this.coin.visible = false;
  6192. this.video.visible = true;
  6193. this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
  6194. return;
  6195. }
  6196. }
  6197. SetBtnUi(index) {
  6198. if (index == 1) {
  6199. this.leftBtn.getChildByName("leftFalse").visible = true;
  6200. this.leftBtn.getChildByName("leftTrue").visible = false;
  6201. this.rightBtn.getChildByName("rightFalse").visible = false;
  6202. this.rightBtn.getChildByName("rightTrue").visible = true;
  6203. return;
  6204. }
  6205. if (index == 8) {
  6206. this.leftBtn.getChildByName("leftFalse").visible = false;
  6207. this.leftBtn.getChildByName("leftTrue").visible = true;
  6208. this.rightBtn.getChildByName("rightFalse").visible = true;
  6209. this.rightBtn.getChildByName("rightTrue").visible = false;
  6210. return;
  6211. }
  6212. this.leftBtn.getChildByName("leftFalse").visible = false;
  6213. this.leftBtn.getChildByName("leftTrue").visible = true;
  6214. this.rightBtn.getChildByName("rightFalse").visible = false;
  6215. this.rightBtn.getChildByName("rightTrue").visible = true;
  6216. }
  6217. ClickClose() {
  6218. DisplayerCarController.Instance.Reset();
  6219. if (this.oignPlayerid != PlayerManager.Instance.equipId) {
  6220. MainRoleManager.Instance.ChangeModel();
  6221. }
  6222. ViewManager.Instance.CloseView(ViewType.SKinShopView);
  6223. }
  6224. ClickVideo() {
  6225. GuangGao.ShowVideo((done) => {
  6226. if (done) {
  6227. WXSdk.AldEvent("商店中看视屏获得皮肤");
  6228. this.VideoGet();
  6229. }
  6230. });
  6231. }
  6232. ;
  6233. VideoGet() {
  6234. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
  6235. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
  6236. var usermodel = UserModel.Instance.CurModel;
  6237. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6238. this.RefreshBtnUi(this.operateIndex);
  6239. }, (data) => {
  6240. });
  6241. }
  6242. Buy() {
  6243. var param = [{ "id": this.operateIndex }];
  6244. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
  6245. var usermodel = UserModel.Instance.CurModel;
  6246. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6247. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6248. this.RefreshBtnUi(this.operateIndex);
  6249. }, (data) => {
  6250. });
  6251. }
  6252. Equip() {
  6253. var param = [{ "id": this.operateIndex }];
  6254. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
  6255. var usermodel = UserModel.Instance.CurModel;
  6256. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6257. this.RefreshBtnUi(this.operateIndex);
  6258. }, (data) => {
  6259. });
  6260. }
  6261. RegButton() {
  6262. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  6263. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  6264. this.CloseBtn.visible = false;
  6265. Laya.timer.once(3000, this, () => {
  6266. this.CloseBtn.visible = true;
  6267. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  6268. });
  6269. this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
  6270. if (this.operateIndex == 1)
  6271. return;
  6272. this.operateIndex--;
  6273. this.SetBtnUi(this.operateIndex);
  6274. this.RefreshBtnUi(this.operateIndex);
  6275. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6276. }, null, false);
  6277. this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
  6278. if (this.operateIndex == 8)
  6279. return;
  6280. this.operateIndex++;
  6281. this.SetBtnUi(this.operateIndex);
  6282. this.RefreshBtnUi(this.operateIndex);
  6283. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6284. }, null, false);
  6285. this.use.CZ = () => {
  6286. this.Equip();
  6287. };
  6288. this.coin.CZ = () => {
  6289. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
  6290. ViewManager.Instance.ShowTips("金币不足!", 2);
  6291. else
  6292. this.Buy();
  6293. };
  6294. this.video.CZ = () => {
  6295. this.ClickVideo();
  6296. };
  6297. }
  6298. ClickExit() {
  6299. ViewManager.Instance.AddView(ViewType.ExitView);
  6300. }
  6301. OnClose() {
  6302. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6303. SKinShopView.instance = null;
  6304. WXSdk.AldEvent("关闭皮肤界面");
  6305. }
  6306. }
  6307. class TrialView extends ui.TrialViewUI {
  6308. constructor() {
  6309. super();
  6310. this.Resize();
  6311. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6312. }
  6313. OnShow(data) {
  6314. this.RegButton();
  6315. this.RefreshData();
  6316. this.RegButton();
  6317. this.RefreshUI();
  6318. GuangGao.CheatBanner(this.btnBox);
  6319. }
  6320. RefreshUI() {
  6321. DisplayerCarController.Instance.InitDis(this.viewPort);
  6322. }
  6323. RefreshData() {
  6324. }
  6325. RegButton() {
  6326. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  6327. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  6328. this.videoBtn.CZ = () => {
  6329. this.VideoHandler();
  6330. };
  6331. this.backBtn.CZ = () => {
  6332. DisplayerCarController.Instance.Reset();
  6333. this.BackUi();
  6334. };
  6335. }
  6336. ClickExit() {
  6337. ViewManager.Instance.AddView(ViewType.ExitView);
  6338. }
  6339. VideoHandler() {
  6340. GuangGao.ShowVideo((isok) => {
  6341. if (isok) {
  6342. WXSdk.AldEvent("看视屏试用");
  6343. this.VideoCom();
  6344. }
  6345. });
  6346. }
  6347. VideoCom() {
  6348. DisplayerCarController.Instance.Reset();
  6349. this.BackUi();
  6350. MateManager.Instance.Trial();
  6351. }
  6352. BackUi() {
  6353. ViewManager.Instance.CloseView(ViewType.TrialView);
  6354. if (MainView.Instance)
  6355. MainView.Instance.TryClick();
  6356. }
  6357. OnClose() {
  6358. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6359. GuangGao.Clear();
  6360. }
  6361. Resize() {
  6362. this.height = Laya.stage.height;
  6363. }
  6364. }
  6365. class ShadeView extends ui.ShadeViewUI {
  6366. constructor() {
  6367. super();
  6368. this.Resize();
  6369. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6370. }
  6371. OnShow(data) {
  6372. this.RegButton();
  6373. }
  6374. RefreshUI() {
  6375. }
  6376. RefreshData() {
  6377. }
  6378. RegButton() {
  6379. this.on(Laya.Event.CLICK, this, this.Test);
  6380. }
  6381. Test() {
  6382. }
  6383. OnClose() {
  6384. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6385. this.off(Laya.Event.CLICK, this, this.Test);
  6386. }
  6387. Resize() {
  6388. this.height = Laya.stage.height;
  6389. }
  6390. }
  6391. class ExportView extends ui.ExportViewUI {
  6392. constructor() {
  6393. super(...arguments);
  6394. this.jump = false;
  6395. }
  6396. OnShow(data) {
  6397. this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, null, false);
  6398. this.ContinueBtn.clickHandler = Laya.Handler.create(this, this.ClickContinue, null, false);
  6399. this.SetData();
  6400. this.ContinueBtn.visible = FYHD_Sdk.iswhite;
  6401. this.CloseBtn.visible = false;
  6402. if (FYHD_Sdk.iswhite) {
  6403. GuangGao.OpenBanner();
  6404. Laya.timer.once(3000, this, () => {
  6405. console.log(444444444444444444444);
  6406. GuangGao.Clear();
  6407. this.CloseBtn.visible = true;
  6408. console.log(5555555555555555555);
  6409. });
  6410. }
  6411. else {
  6412. Laya.timer.once(3000, this, () => {
  6413. this.CloseBtn.visible = true;
  6414. });
  6415. }
  6416. this.height = Laya.stage.height;
  6417. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6418. this.height = Laya.stage.height;
  6419. });
  6420. }
  6421. OnClose() {
  6422. Laya.timer.clearAll(this);
  6423. }
  6424. ClickClose(_data) {
  6425. ViewManager.Instance.CloseView(ViewType.ExportView);
  6426. }
  6427. ClickContinue() {
  6428. let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
  6429. let item = FYHD_Sdk.pushData[ran];
  6430. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6431. FYHD_Sdk.ShowHuTuiJump(item);
  6432. }
  6433. SetData() {
  6434. FYHD_Sdk.SetHuTuiList(this.TopList, 2, "");
  6435. FYHD_Sdk.SetHuTuiList(this.BottomList, 1, "");
  6436. this.GunGun();
  6437. }
  6438. GunGun() {
  6439. var maxTop;
  6440. var maxBtm;
  6441. try {
  6442. this.TopList.scrollBar.value = 0;
  6443. this.BottomList.scrollBar.value = 0;
  6444. maxTop = this.TopList.scrollBar.max;
  6445. maxBtm = this.BottomList.scrollBar.max;
  6446. }
  6447. catch (error) {
  6448. console.error(error);
  6449. return;
  6450. }
  6451. var tempTop = 1;
  6452. var tempBtm = 1;
  6453. Laya.timer.frameLoop(1, this, () => {
  6454. this.TopList.scrollBar.value += tempTop;
  6455. if (this.TopList.scrollBar.value >= maxTop || this.TopList.scrollBar.value <= 0) {
  6456. tempTop = -tempTop;
  6457. }
  6458. this.BottomList.scrollBar.value += tempBtm;
  6459. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  6460. tempBtm = -tempBtm;
  6461. }
  6462. });
  6463. }
  6464. }
  6465. class ExitView extends ui.ExitViewUI {
  6466. constructor() {
  6467. super();
  6468. this.jump = false;
  6469. ExitView.ins = this;
  6470. }
  6471. static get Instance() {
  6472. if (ExitView.ins) {
  6473. return ExitView.ins;
  6474. }
  6475. else {
  6476. return new ExitView();
  6477. }
  6478. }
  6479. OnShow() {
  6480. this.SetData();
  6481. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  6482. this.height = Laya.stage.height;
  6483. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6484. this.height = Laya.stage.height;
  6485. });
  6486. }
  6487. OnClose() {
  6488. }
  6489. ClickClose() {
  6490. ViewManager.Instance.CloseView(ViewType.ExitView);
  6491. }
  6492. SetData() {
  6493. FYHD_Sdk.SetHuTuiList(this.PushList, 1, "");
  6494. }
  6495. }
  6496. var ViewType;
  6497. (function (ViewType) {
  6498. ViewType[ViewType["InGameView"] = 0] = "InGameView";
  6499. ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
  6500. ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
  6501. ViewType[ViewType["LoadView"] = 3] = "LoadView";
  6502. ViewType[ViewType["MainView"] = 4] = "MainView";
  6503. ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
  6504. ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
  6505. ViewType[ViewType["TrialView"] = 7] = "TrialView";
  6506. ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
  6507. ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
  6508. ViewType[ViewType["ExportView"] = 10] = "ExportView";
  6509. ViewType[ViewType["ExitView"] = 11] = "ExitView";
  6510. })(ViewType || (ViewType = {}));
  6511. class ViewManager {
  6512. constructor() {
  6513. this.viewDic = [];
  6514. this.addViewDic = new Dictionary();
  6515. this.showpushview = 0;
  6516. this._maskCnt = 0;
  6517. this.init();
  6518. }
  6519. static get Instance() {
  6520. return this.instance || (this.instance = new ViewManager());
  6521. }
  6522. init() {
  6523. this._maskCnt = 0;
  6524. this.viewDic[ViewType.InGameView] = InGameView;
  6525. this.viewDic[ViewType.LoadView] = LoadView;
  6526. this.viewDic[ViewType.MainView] = MainView;
  6527. this.viewDic[ViewType.IntensifyView] = IntensifyView;
  6528. this.viewDic[ViewType.CompleteView] = CompleteView;
  6529. this.viewDic[ViewType.SKinShopView] = SKinShopView;
  6530. this.viewDic[ViewType.TrialView] = TrialView;
  6531. this.viewDic[ViewType.ShadeView] = ShadeView;
  6532. this.viewDic[ViewType.ExportView] = ExportView;
  6533. this.viewDic[ViewType.ExitView] = ExitView;
  6534. this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
  6535. this.uiNode = new Laya.Sprite();
  6536. this.popNode = new Laya.Sprite();
  6537. Laya.stage.addChild(this.uiNode);
  6538. Laya.stage.addChild(this.popNode);
  6539. this.uiNode.zOrder = 3;
  6540. this.popNode.zOrder = 4;
  6541. }
  6542. OpenView(view, data) {
  6543. if (this.curView != null) {
  6544. this.curView.OnClose();
  6545. this.uiNode.removeChild(this.curView);
  6546. this.curView.destroy(true);
  6547. this.curView = null;
  6548. }
  6549. this.curView = new this.viewDic[view];
  6550. this.uiNode.addChild(this.curView);
  6551. this.curView.OnShow(data);
  6552. }
  6553. get getCurView() {
  6554. return this.curView;
  6555. }
  6556. AddView(view, data) {
  6557. if (this.addViewDic.has(view))
  6558. return;
  6559. let t_view = new this.viewDic[view];
  6560. this.addViewDic.set(view, t_view);
  6561. this.uiNode.addChild(t_view);
  6562. t_view.OnShow(data);
  6563. MouseEvent.Instance.CloseInput();
  6564. }
  6565. RemoveView() {
  6566. if (this.curView != null) {
  6567. this.curView.OnClose();
  6568. this.uiNode.removeChild(this.curView);
  6569. this.curView.destroy(true);
  6570. this.curView = null;
  6571. }
  6572. }
  6573. HaveView(view) {
  6574. return this.addViewDic.has(view);
  6575. }
  6576. CloseView(view) {
  6577. if (!this.addViewDic.has(view))
  6578. return;
  6579. let t_view = this.addViewDic.get(view);
  6580. t_view.OnClose();
  6581. this.uiNode.removeChild(t_view);
  6582. t_view.destroy(true);
  6583. this.addViewDic.delete(view);
  6584. MouseEvent.Instance.OpenInput();
  6585. }
  6586. OpenMask() {
  6587. this._maskCnt++;
  6588. if (this._maskCnt > 1)
  6589. return;
  6590. if (this.curMask != null) {
  6591. this.curMask.OnClose();
  6592. this.popNode.removeChild(this.curView);
  6593. this.curMask.destroy();
  6594. this.curMask = null;
  6595. return;
  6596. }
  6597. this.curMask = new this.viewDic[ViewType.ShadeView];
  6598. if (!this.curMask)
  6599. return;
  6600. console.log("打开遮罩");
  6601. this.popNode.addChild(this.curMask);
  6602. this.curMask.OnShow();
  6603. }
  6604. CloseMask() {
  6605. this._maskCnt--;
  6606. if (this._maskCnt > 0)
  6607. return;
  6608. if (this.curMask != null) {
  6609. this.curMask.OnClose();
  6610. this.popNode.removeChild(this.curMask);
  6611. this.curMask.destroy(true);
  6612. console.log("关闭遮罩");
  6613. this.curMask = null;
  6614. }
  6615. }
  6616. ShowTips(value, type = 1) {
  6617. var warn = GamePool.Instance.GetUi(PoolType.WarnTips);
  6618. if (!warn)
  6619. return;
  6620. if (type == 1) {
  6621. warn.y = 0;
  6622. warn.text = value;
  6623. warn.x = Laya.stage.width >> 1;
  6624. this.popNode.addChild(warn);
  6625. let _end = (Laya.stage.height >> 1) - 300;
  6626. var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  6627. tw.clear();
  6628. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  6629. }));
  6630. }
  6631. else if (type == 2) {
  6632. warn.y = Laya.stage.height - 400;
  6633. warn.text = value;
  6634. warn.x = Laya.stage.width >> 1;
  6635. this.popNode.addChild(warn);
  6636. var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  6637. tw.clear();
  6638. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  6639. warn.alpha = 1;
  6640. }));
  6641. }
  6642. }
  6643. ShowGuideView() {
  6644. if (!this.GuideView) {
  6645. this.GuideView = new GuideView();
  6646. this.popNode.addChild(this.GuideView);
  6647. }
  6648. this.GuideView.OnShow();
  6649. }
  6650. CloseGuideView() {
  6651. if (this.GuideView) {
  6652. this.GuideView.OnClose();
  6653. this.GuideView.removeSelf();
  6654. this.GuideView.destroy();
  6655. }
  6656. }
  6657. }
  6658. class FYHD_Sdk {
  6659. static InitSdk() {
  6660. Laya.Browser.window.sdk.getFyhd().startSdk();
  6661. FYHD_Sdk.UserInfoAuth();
  6662. let white = Laya.LocalStorage.getItem("is_white");
  6663. if (white) {
  6664. FYHD_Sdk.iswhite = true;
  6665. }
  6666. else {
  6667. FYHD_Sdk.getWhiteConfig();
  6668. }
  6669. let newuser = Laya.LocalStorage.getItem("is_newuser");
  6670. if (!newuser) {
  6671. FYHD_Sdk.isnewuser = true;
  6672. Laya.LocalStorage.setItem("is_newuser", "1");
  6673. }
  6674. else {
  6675. FYHD_Sdk.isnewuser = false;
  6676. }
  6677. FYHD_Sdk.PushData();
  6678. }
  6679. static UserInfoAuth() {
  6680. if (!Laya.Browser.onWeiXin)
  6681. return;
  6682. Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, (data) => {
  6683. console.log("无授权回调:" + JSON.stringify(data));
  6684. if (data.result.user) {
  6685. FYHD_Sdk.openid = data.result.user.openid;
  6686. FYHD_Sdk.AuthInfo();
  6687. }
  6688. });
  6689. }
  6690. static AuthInfo() {
  6691. var args = {
  6692. openid: FYHD_Sdk.openid,
  6693. };
  6694. Laya.Browser.window.sdk.getFyhd().loginData(args, (data) => {
  6695. console.log("授权上报回调:" + JSON.stringify(data));
  6696. FYHD_Sdk.ValueUser();
  6697. });
  6698. }
  6699. static ValueUser() {
  6700. var args = {
  6701. openid: FYHD_Sdk.openid,
  6702. };
  6703. Laya.Browser.window.sdk.getFyhd().valueuser(args, (data) => {
  6704. console.log("有效用户上报:" + JSON.stringify(data));
  6705. });
  6706. }
  6707. static getWhiteConfig() {
  6708. Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) {
  6709. FYHD_Sdk.iswhite = e.data.is_white;
  6710. if (FYHD_Sdk.iswhite) {
  6711. Laya.LocalStorage.setItem("is_white", "1");
  6712. }
  6713. console.log("白名单---", e);
  6714. });
  6715. }
  6716. static SetHuTuiList(list, scrol = 1, type = "") {
  6717. let arr = this.pushData;
  6718. if (!arr || arr.length == 0)
  6719. return;
  6720. list.selectEnable = false;
  6721. scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = "";
  6722. list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
  6723. list.array = arr;
  6724. list.refresh();
  6725. }
  6726. static updateItem(type, cell, index) {
  6727. var aditem = cell.getComponent(ListItem);
  6728. aditem.Refresh(type);
  6729. }
  6730. static ClickAd(ad_type) {
  6731. console.log("上报类型---", ad_type);
  6732. if (!Laya.Browser.onWeiXin)
  6733. return;
  6734. var param = {
  6735. ad_type: ad_type,
  6736. openid: FYHD_Sdk.openid
  6737. };
  6738. console.log("点击参数:" + param);
  6739. Laya.Browser.window.sdk.getFyhd().advertisement(param, (data) => {
  6740. console.log("点击结果:" + JSON.stringify(data));
  6741. });
  6742. }
  6743. static PushData() {
  6744. if (!Laya.Browser.onWeiXin)
  6745. return;
  6746. var param = {};
  6747. Laya.Browser.window.sdk.getFyhd().shareRecommend(param, (data) => {
  6748. console.log("热门游戏数据--", data);
  6749. if (data.data) {
  6750. FYHD_Sdk.pushData = data.data;
  6751. FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort);
  6752. FYHD_Sdk.isHaveDate = true;
  6753. }
  6754. console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData));
  6755. });
  6756. }
  6757. static ShowHuTuiJump(data) {
  6758. if (!Laya.Browser.onWeiXin)
  6759. return;
  6760. if (data.jump_type == 2) {
  6761. Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] });
  6762. }
  6763. else if (data.jump_type == 1) {
  6764. Laya.Browser.window.wx.navigateToMiniProgram({
  6765. appId: data.to_appid,
  6766. path: data.jump_path,
  6767. success(res) {
  6768. console.log("上报成功:" + JSON.stringify(res));
  6769. FYHD_Sdk.PushClick(data.to_appid);
  6770. },
  6771. fail(res) {
  6772. ViewManager.Instance.AddView(ViewType.ExportView);
  6773. }
  6774. });
  6775. }
  6776. else if (data.jump_type == 0) {
  6777. Laya.Browser.window.wx.navigateToMiniProgram({
  6778. appId: data.platform_appid,
  6779. path: data.jump_path,
  6780. success(res) {
  6781. console.log("上报成功:" + JSON.stringify(res));
  6782. FYHD_Sdk.PushClick(data.to_appid);
  6783. },
  6784. fail(res) {
  6785. }
  6786. });
  6787. }
  6788. }
  6789. static PushClick(to_appid) {
  6790. if (!Laya.Browser.onWeiXin)
  6791. return;
  6792. var param = {
  6793. openid: FYHD_Sdk.openid,
  6794. to_appid: to_appid,
  6795. };
  6796. Laya.Browser.window.sdk.getFyhd().sharePlay(param, (data) => {
  6797. console.log("点击上报结果:" + JSON.stringify(data));
  6798. });
  6799. }
  6800. static ListSort(a, b) {
  6801. if (Number(a["panel"]) < Number(b["panel"])) {
  6802. return -1;
  6803. }
  6804. if (Number(a["panel"]) == Number(b["panel"])) {
  6805. return 0;
  6806. }
  6807. if (Number(a["panel"]) > Number(b["panel"])) {
  6808. return 1;
  6809. }
  6810. }
  6811. }
  6812. FYHD_Sdk.Ad_ClickType = {
  6813. Video: "video_click",
  6814. Watch: "watch",
  6815. Share: "share",
  6816. Banner: "banner",
  6817. Push: "push",
  6818. PushClick: "icon_click"
  6819. };
  6820. FYHD_Sdk.pushData = [];
  6821. FYHD_Sdk.isHaveDate = false;
  6822. FYHD_Sdk.ShowAd = "ShowAd";
  6823. class ListItem extends Laya.Script {
  6824. constructor() { super(); }
  6825. onAwake() {
  6826. this.self = this.owner;
  6827. this.icon = this.self.getChildByName("icon");
  6828. this.btn = this.self.getChildByName("btn");
  6829. this.name = this.self.getChildByName("name");
  6830. this._tip = this.self.getChildByName("tip");
  6831. this.bottom = this.self.getChildByName("bottom");
  6832. this.remen = this.self.getChildByName("remen");
  6833. this.star = this.self.getChildByName("star");
  6834. this.diandian = this.icon.getChildAt(0);
  6835. this.btn.clickHandler = new Laya.Handler(this, this.clickAd);
  6836. console.log("self-------------------", this.self);
  6837. }
  6838. Refresh(type) {
  6839. this.data = this.self.dataSource;
  6840. this.type = type;
  6841. if (this.name) {
  6842. this.name.text = this.data.togame_name;
  6843. }
  6844. if (this._tip) {
  6845. this._tip.visible = true;
  6846. let rnd = GameTool.randomInt(1, 200000);
  6847. let text = rnd.toString() + "人在玩";
  6848. this._tip.text = text;
  6849. }
  6850. if (this.diandian) {
  6851. this.diandian.visible = false;
  6852. }
  6853. if (this.bottom) {
  6854. let num = GameTool.randomInt(1, 6);
  6855. this.bottom.skin = "subpackage/bottom/icontitle" + num + ".png";
  6856. }
  6857. if (this.remen) {
  6858. this.remen.visible = Math.random() < 0.2 ? true : false;
  6859. }
  6860. if (this.star) {
  6861. this.star.visible = Math.random() < 0.2 ? true : false;
  6862. }
  6863. this.icon.skin = this.data.icon;
  6864. }
  6865. clickAd() {
  6866. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6867. FYHD_Sdk.ShowHuTuiJump(this.data);
  6868. }
  6869. onDestroy() {
  6870. this.btn.clickHandler = null;
  6871. }
  6872. }
  6873. class GameConfig {
  6874. constructor() { }
  6875. static init() {
  6876. var reg = Laya.ClassUtils.regClass;
  6877. reg("View/Com/ButtonRunTime.ts", ImageRunTime);
  6878. reg("View/Com/ListItem.ts", ListItem);
  6879. }
  6880. }
  6881. GameConfig.width = 720;
  6882. GameConfig.height = 1280;
  6883. GameConfig.scaleMode = "fixedwidth";
  6884. GameConfig.screenMode = "vertical";
  6885. GameConfig.alignV = "middle";
  6886. GameConfig.alignH = "center";
  6887. GameConfig.startScene = "CompleteView.scene";
  6888. GameConfig.sceneRoot = "";
  6889. GameConfig.debug = false;
  6890. GameConfig.stat = false;
  6891. GameConfig.physicsDebug = false;
  6892. GameConfig.exportSceneToJson = true;
  6893. GameConfig.init();
  6894. class Main {
  6895. constructor() {
  6896. window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
  6897. window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
  6898. if (window["Laya3D"])
  6899. Laya3D.init(GameConfig.width, GameConfig.height);
  6900. else
  6901. Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
  6902. Laya["Physics"] && Laya["Physics"].enable();
  6903. Laya["DebugPanel"] && Laya["DebugPanel"].enable();
  6904. Laya.stage.scaleMode = GameConfig.scaleMode;
  6905. Laya.stage.screenMode = GameConfig.screenMode;
  6906. Laya.stage.alignV = GameConfig.alignV;
  6907. Laya.stage.alignH = GameConfig.alignH;
  6908. Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
  6909. if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
  6910. Laya.enableDebugPanel();
  6911. if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
  6912. Laya["PhysicsDebugDraw"].enable();
  6913. if (GameConfig.stat)
  6914. Laya.Stat.show();
  6915. Laya.alertGlobalError = true;
  6916. GameVersion.isWx = Laya.Browser.onWeiXin;
  6917. if (GameVersion.isWx) {
  6918. WXSdk.init();
  6919. }
  6920. Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
  6921. WXSdk.IsNeedUpdate();
  6922. }
  6923. onVersionLoaded() {
  6924. Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
  6925. Laya.MouseManager.multiTouchEnabled = false;
  6926. }
  6927. onConfigLoaded() {
  6928. ViewManager.Instance.OpenView(ViewType.LoadView);
  6929. GameVersion.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
  6930. }
  6931. }
  6932. new Main();
  6933. }());
  6934. //# sourceMappingURL=bundle.js.map