bundle.js 321 KB

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