123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638 |
- (function () {
- 'use strict';
- class ImageRunTime extends Laya.Image {
- constructor() {
- super();
- this.scaleTime = 80;
- this.clickId = false;
- this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
- this.on(Laya.Event.MOUSE_OVER, this, this.overs);
- this.on(Laya.Event.MOUSE_UP, this, this.scaleBig);
- this.on(Laya.Event.MOUSE_OUT, this, this.mouseout);
- }
- scaleBig(e) {
- if (!this.clickId)
- return;
- this.clickId = false;
- this.alpha = 1;
- if (this.CZ) {
- this.CZ();
- }
- }
- overs() {
- this.alpha = 0.7;
- }
- mouseout() {
- this.alpha = 1;
- }
- scaleSmall(e) {
- this.clickId = true;
- }
- onDestroy() {
- this.ClearRunTime();
- }
- ClearRunTime() {
- this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
- this.off(Laya.Event.MOUSE_UP, this, this.scaleBig);
- this.off(Laya.Event.MOUSE_OUT, this, this.mouseout);
- this.off(Laya.Event.MOUSE_OVER, this, this.overs);
- this.CZ = null;
- }
- }
- class GameTool {
- static getM_Vector(v1, v2) {
- let temp = new Laya.Vector3();
- Laya.Vector3.add(v1, v2, temp);
- return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
- }
- static SpliteString(s, sp) {
- var _sp = sp ? sp : ";";
- let s_s = s.split(_sp);
- let result = [];
- for (let i = 0; i < s_s.length; i++) {
- result.push(s_s[i]);
- }
- return result;
- }
- static random_1to1() {
- var iszheng = Math.random() > 0.5 ? -1 : 1;
- return Math.random() * iszheng;
- }
- static get64Encode(str) {
- var c1, c2, c3;
- var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var i = 0, len = str.length, string = '';
- while (i < len) {
- c1 = str.charCodeAt(i++) & 0xff;
- if (i == len) {
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt((c1 & 0x3) << 4);
- string += "==";
- break;
- }
- c2 = str.charCodeAt(i++);
- if (i == len) {
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- string += base64EncodeChars.charAt((c2 & 0xF) << 2);
- string += "=";
- break;
- }
- c3 = str.charCodeAt(i++);
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
- string += base64EncodeChars.charAt(c3 & 0x3F);
- }
- return string;
- }
- static randomInt(min, max) {
- if (max < min)
- return parseInt(min);
- return parseInt(Math.random() * (max - min + 1) + min);
- }
- static randRangefloat(min, max) {
- var value = Math.random() * (max - min + 1) + min;
- if (value > max) {
- value = max;
- }
- return value;
- }
- }
- class Dictionary {
- constructor() {
- this._container = {};
- this._length = 0;
- }
- get container() {
- return this._container;
- }
- get size() {
- return this._length;
- }
- set(key, value) {
- if (!this._container.hasOwnProperty(key)) {
- this._length++;
- }
- this._container[key] = value;
- }
- delete(key) {
- if (this._container.hasOwnProperty(key)) {
- delete this._container[key];
- this._length--;
- }
- }
- has(key) {
- return this._container.hasOwnProperty(key) ? true : false;
- }
- get(key) {
- if (this._container.hasOwnProperty(key)) {
- return this._container[key];
- }
- else {
- return undefined;
- }
- }
- clear() {
- this._container = {};
- this._length = 0;
- }
- }
- class DispatcherManager {
- static get Disispatcher() {
- return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
- }
- static on(type, call, data) {
- this.Disispatcher.on(type, call, data);
- }
- static off(type, call, data) {
- this.Disispatcher.off(type, call, data);
- }
- static event(type, data = null) {
- this.Disispatcher.event(type, data);
- }
- }
- class EventType {
- loadUI() {
- Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
- var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式"));
- changeActionButton.size(160, 40);
- changeActionButton.labelBold = true;
- changeActionButton.labelSize = 30;
- changeActionButton.sizeGrid = "4,4,4,4";
- changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
- changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
- changeActionButton.on(Laya.Event.CLICK, this, function () {
- if (++this.curStateIndex % 2 == 1) {
- this.sprite3D.active = false;
- this.lineSprite3D.active = true;
- changeActionButton.label = "网格模式";
- }
- else {
- this.sprite3D.active = true;
- this.lineSprite3D.active = false;
- changeActionButton.label = "正常模式";
- }
- });
- }));
- }
- }
- EventType.Event = {
- CamFollowArg: "CamFollowArg",
- SetAimPos: "SetAimPos",
- RefreshBulletCount: "RefreshBulletCount",
- RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
- GameShowTips: "GameShowTips",
- StartShot: 'StartShot',
- StopShot: 'StopShot',
- ShowMainUi: "ShowMainUi",
- SetMonery: "SetMonery",
- SetStage: "SetStage",
- SetStagePro: "SetStagePro"
- };
- class GameVersion {
- }
- GameVersion.VER = "1.0.11";
- GameVersion.CFG = "CFG";
- GameVersion.wxValue = "";
- GameVersion.isX = false;
- GameVersion.mSharePeopleScene = null;
- var Particle2D = Laya.Particle2D;
- var SoundType;
- (function (SoundType) {
- SoundType[SoundType["hit"] = 0] = "hit";
- SoundType[SoundType["click"] = 1] = "click";
- SoundType[SoundType["win"] = 2] = "win";
- SoundType[SoundType["defeat"] = 3] = "defeat";
- })(SoundType || (SoundType = {}));
- class SettingController {
- constructor() {
- this.vibrate = true;
- this.sound = true;
- this.SoundType = {
- click: "subpackage1/sound/click.mp3",
- win: "subpackage1/sound/vector.mp3",
- defeat: "subpackage1/sound/defeat.mp3",
- car_crush_1: "subpackage1/sound/car_crush_1.mp3",
- car_crush_2: "subpackage1/sound/car_crush_2.mp3",
- car_crush_3: "subpackage1/sound/car_crush_3.mp3",
- explotion1: "subpackage1/sound/explotion1.mp3",
- explotion2: "subpackage1/sound/explotion2.mp3",
- gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
- gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
- gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
- reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
- reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
- hitcar: "subpackage1/sound/hitcar.mp3",
- hitrole: "subpackage1/sound/hitrole.mp3",
- hit: "subpackage1/sound/hit.mp3"
- };
- this.bgm = "subpackage1/sound/bgm.mp3";
- }
- static get Instance() {
- return this.instasnce || (this.instasnce = new SettingController());
- }
- onAssetsLoaded(settings) {
- this.sp = new Particle2D(settings);
- this.sp.emitter.start();
- this.sp.play();
- Laya.stage.addChild(this.sp);
- this.sp.x = Laya.stage.width / 2;
- this.sp.y = Laya.stage.height / 2;
- }
- SettingSound(value) {
- }
- _playMusic(on) {
- }
- SetSoundV(value) {
- }
- PlaySound(type) {
- }
- StopSound(type) {
- }
- Init() {
- var v = Laya.LocalStorage.getItem("vibrate");
- this.vibrate = Number(v) ? v == "1" ? true : false : true;
- }
- }
- class ShareModule {
- static GoShare(callBack) {
- ShareModule.ShareTime = new Date().getTime();
- console.log("分享点击时间=" + ShareModule.ShareTime);
- ShareModule.IsSharing = true;
- ShareModule.callback = callBack;
- }
- static OnShowHandle() {
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.onShow(function (option) {
- SettingController.Instance.SetSoundV(1);
- console.log("onshow share start");
- console.log("进入微信");
- if (ShareModule.IsSharing) {
- ShareModule.IsSharing = false;
- let time = new Date().getTime();
- console.log("分享回到游戏时间" + time);
- let wait = (time - ShareModule.ShareTime) / 1000;
- console.log("分享停留时间为:" + wait);
- if (wait >= 2) {
- if (Math.random() <= 1) {
- if (!ShareModule.callback)
- return;
- ShareModule.callback(true, 1);
- }
- else {
- if (!ShareModule.callback)
- return;
- if (Math.random() <= 0.5) {
- ViewManager.Instance.ShowTips("分享失败!");
- }
- else {
- ViewManager.Instance.ShowTips("请分享到不同的群!");
- }
- ShareModule.callback(false, 1);
- }
- }
- else {
- if (!ShareModule.callback)
- return;
- if (Math.random() <= 0.5) {
- ViewManager.Instance.ShowTips("分享失败!");
- }
- else {
- ViewManager.Instance.ShowTips("请分享到不同的群!");
- }
- ShareModule.callback(false, 1);
- }
- }
- });
- }
- }
- }
- ShareModule.IsSharing = false;
- class OnHideHandler {
- static Reg() {
- }
- }
- var Templet = Laya.Templet;
- var Event = Laya.Event;
- class NetInfoManager {
- constructor() {
- this.mStartX = 200;
- this.mStartY = 500;
- this.mActionIndex = 0;
- this.mCurrIndex = 0;
- this.mCurrSkinIndex = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new NetInfoManager());
- }
- GetThing(id) {
- if (this._thing) {
- return this._thing[id - 1];
- }
- return null;
- }
- GetTheme(id) {
- if (this._theme) {
- return this._theme[id - 1];
- }
- return null;
- }
- GetRoad(id) {
- if (this._road) {
- return this._road[id - 1];
- }
- return null;
- }
- GetRate(id) {
- if (this._rate) {
- return this._rate[id - 1];
- }
- return null;
- }
- GetStreet(id) {
- if (this._block) {
- return this._block[id - 1];
- }
- return null;
- }
- GetGlobal(key) {
- if (this._globe) {
- for (let index = 0; index < this._globe.length; index++) {
- const element = this._globe[index];
- if (element.key == key) {
- return element.value;
- }
- }
- }
- }
- GetLevel(id) {
- if (this._level) {
- return this._level[id - 1];
- }
- return null;
- }
- GetAtk(id) {
- if (this._atk) {
- return this._atk[id - 1];
- }
- return null;
- }
- startFun() {
- this.mAniPath = "res/spine/spineRes5/vine.sk";
- this.mFactory = new Templet();
- this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
- this.mFactory.on(Event.ERROR, this, this.onError);
- this.mFactory.loadAni(this.mAniPath);
- }
- onError() {
- console.log("error");
- }
- parseComplete() {
- this.mArmature = this.mFactory.buildArmature(1);
- this.mArmature.x = this.mStartX;
- this.mArmature.y = this.mStartY;
- this.mArmature.scale(0.5, 0.5);
- Laya.stage.addChild(this.mArmature);
- this.mArmature.on(Event.STOPPED, this, this.completeHandler);
- this.play();
- }
- completeHandler() {
- this.play();
- }
- play() {
- this.mCurrIndex++;
- if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
- this.mCurrIndex = 0;
- }
- this.mArmature.play(this.mCurrIndex, false);
- }
- }
- class AssetPath {
- loadUI() {
- Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
- var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换注视目标"));
- changeActionButton.size(200, 40);
- changeActionButton.labelBold = true;
- changeActionButton.labelSize = 30;
- changeActionButton.sizeGrid = "4,4,4,4";
- changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
- changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
- changeActionButton.on(Laya.Event.CLICK, this, function () {
- this.index++;
- if (this.index % 3 === 1) {
- this.camera.transform.lookAt(this.box.transform.position, this.upVector);
- }
- else if (this.index % 3 === 2) {
- this.camera.transform.lookAt(this.cylinder.transform.position, this.upVector);
- }
- else {
- this.camera.transform.lookAt(this.capsule.transform.position, this.upVector);
- }
- });
- }));
- }
- }
- AssetPath.MainScene = "subpackage/LayaScene_MainScene/Conventional/main.ls";
- AssetPath.Player = ["subpackage/LayaScene_Character/Conventional/Character1.lh",
- "subpackage/LayaScene_Character/Conventional/Character2.lh",
- "subpackage/LayaScene_Character/Conventional/Character3.lh",
- "subpackage/LayaScene_Character/Conventional/Character4.lh",
- "subpackage/LayaScene_Character/Conventional/Character5.lh",
- "subpackage/LayaScene_Character/Conventional/Character6.lh",
- "subpackage/LayaScene_Character/Conventional/Character7.lh",
- "subpackage/LayaScene_Character/Conventional/Character8.lh",
- ];
- AssetPath.Enemy = "subpackage/LayaScene_Character/Conventional/enemy.lh";
- AssetPath.PlayerShot = "subpackage/LayaScene_Property/Conventional/PlayerShoot.lh";
- AssetPath.Mound = "subpackage/LayaScene_Property/Conventional/Mound.lh";
- AssetPath.Barrier = [
- "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
- "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
- "subpackage/LayaScene_barrier/Conventional/Block1.lh",
- ];
- AssetPath.Particle = [
- "subpackage/LayaScene_Particle/Conventional/Explode.lh",
- "subpackage/LayaScene_Particle/Conventional/Hit.lh",
- "subpackage/LayaScene_Particle/Conventional/Blood.lh",
- ];
- AssetPath.Config = {
- level: "level",
- road: "road",
- block: "block",
- thing: "thing",
- atk: "atk",
- rate: "rate",
- global: "global",
- theme: "theme"
- };
- class AppSetting {
- constructor() {
- this._outHitResult = new Laya.HitResult();
- this.outs = new Array();
- this.posX = 0.0;
- this.posY = 0.0;
- this.point = new Laya.Vector2();
- }
- addBoxXYZ(x, y, z) {
- var mat1 = new Laya.BlinnPhongMaterial();
- Laya.Texture2D.load("res/threeDimen/Physics/rocks.jpg", Laya.Handler.create(null, function (tex) {
- mat1.albedoTexture = tex;
- }));
- var sX = Math.random() * 0.75 + 0.25;
- var sY = Math.random() * 0.75 + 0.25;
- var sZ = Math.random() * 0.75 + 0.25;
- var box = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ));
- this.scene.addChild(box);
- box.meshRenderer.material = mat1;
- this.tmpVector.setValue(x, y, z);
- box.transform.position = this.tmpVector;
- this.tmpVector.setValue(Math.random() * 360, Math.random() * 360, Math.random() * 360);
- box.transform.rotationEuler = this.tmpVector;
- var rigidBody = box.addComponent(Laya.Rigidbody3D);
- var boxShape = new Laya.BoxColliderShape(sX, sY, sZ);
- rigidBody.colliderShape = boxShape;
- rigidBody.mass = 10;
- }
- }
- AppSetting.moveTime = 1;
- var TiledMap = Laya.TiledMap;
- var Rectangle = Laya.Rectangle;
- var Browser = Laya.Browser;
- var Handler = Laya.Handler;
- class PlayerManager {
- constructor() {
- this.stage = 1;
- this.equipId = 1;
- this.mLastMouseX = 0;
- this.mLastMouseY = 0;
- this.mX = 0;
- this.mY = 0;
- }
- static get Instance() {
- return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
- }
- static GlobalMessage() {
- PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal("tower_reward"));
- PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal("block_reward"));
- PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal("enemy_reward"));
- }
- InitPlayer() {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
- PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.SetInfo();
- }
- SpeedUp(level, chanel, count, callback) {
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
- if (callback)
- callback(true);
- }, (data) => {
- if (callback)
- callback(false);
- });
- }
- SetInfo() {
- let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
- if (power)
- this.powerLevel = Number(power);
- else
- this.powerLevel = 1;
- let al = NetInfoManager.Instance._atk.length;
- let t = this.powerLevel > al ? al : this.powerLevel;
- PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)["atk"];
- let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
- if (rate)
- this.rateLevel = Number(rate);
- else
- this.rateLevel = 1;
- let al1 = NetInfoManager.Instance._rate.length;
- let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
- PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)["rate"];
- }
- createMap() {
- this.tiledMap = new TiledMap();
- this.mX = this.mY = 0;
- this.tiledMap.createMap("res/tiledMap/desert.json", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler));
- }
- completeHandler() {
- console.log("地图创建完成");
- console.log("ClientW:" + Browser.clientWidth + " ClientH:" + Browser.clientHeight);
- Laya.stage.on(Laya.Event.RESIZE, this, this.resize);
- this.resize();
- }
- mouseDown() {
- this.mLastMouseX = Laya.stage.mouseX;
- this.mLastMouseY = Laya.stage.mouseY;
- Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
- }
- mouseMove() {
- this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY));
- }
- mouseUp() {
- this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX);
- this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY);
- Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
- }
- resize() {
- this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height);
- }
- PowerUp(level, chanel, count, callback) {
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
- if (callback)
- callback(true);
- }, (data) => {
- if (callback)
- callback(false);
- });
- }
- }
- PlayerManager.bulletAttack = 1;
- PlayerManager.bulletTime = 0.3;
- class GlobalParam {
- }
- GlobalParam.playerRayLengthF = 1.3;
- GlobalParam.playerRayLengthLR = 0.3;
- GlobalParam.bulletRayLength = 1;
- GlobalParam.bulletMaxDis = 40;
- GlobalParam.barrierRoadLength = 50;
- GlobalParam.barrierRoadAverageNum = 50;
- GlobalParam.playerspeed = 0.1;
- GlobalParam.matespeed = 0.2;
- GlobalParam.hitmaxcount = 2;
- GlobalParam.boommaxcount = 2;
- GlobalParam.blockLRmoveMaxDis = 5;
- GlobalParam.arriveStandWidth = 5;
- GlobalParam.enemySpeed = 0.1;
- GlobalParam.shootspeed = 0.8;
- GlobalParam.sliderFactor = 0.02;
- GlobalParam.playerMoveMaxX = 4.5;
- var Sprite = Laya.Sprite;
- var Event$1 = Laya.Event;
- var SoundManager = Laya.SoundManager;
- var Handler$1 = Laya.Handler;
- class UserInfoManager {
- static GameInfo() {
- PlayerManager.Instance.InitPlayer();
- }
- static SetCfg(cfg) {
- NetInfoManager.Instance._level = cfg[AssetPath.Config.level];
- NetInfoManager.Instance._road = cfg[AssetPath.Config.road];
- NetInfoManager.Instance._block = cfg[AssetPath.Config.block];
- NetInfoManager.Instance._thing = cfg[AssetPath.Config.thing];
- NetInfoManager.Instance._atk = cfg[AssetPath.Config.atk];
- NetInfoManager.Instance._rate = cfg[AssetPath.Config.rate];
- NetInfoManager.Instance._theme = cfg[AssetPath.Config.theme];
- NetInfoManager.Instance._globe = cfg[AssetPath.Config.global];
- PlayerManager.GlobalMessage();
- }
- setup() {
- var gap = 10;
- var soundButton = this.createButton("播放音效");
- soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2;
- soundButton.y = (Laya.stage.height - soundButton.height) / 2;
- Laya.stage.addChild(soundButton);
- var musicButton = this.createButton("播放音乐");
- musicButton.x = soundButton.x + gap + soundButton.width;
- musicButton.y = soundButton.y;
- Laya.stage.addChild(musicButton);
- soundButton.on(Event$1.CLICK, this, this.onPlaySound);
- musicButton.on(Event$1.CLICK, this, this.onPlayMusic);
- }
- createButton(label) {
- var w = 110;
- var h = 40;
- var button = new Sprite();
- button.size(w, h);
- button.graphics.drawRect(0, 0, w, h, "#FF7F50");
- button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center");
- Laya.stage.addChild(button);
- return button;
- }
- onPlayMusic(e) {
- console.log("播放音乐");
- SoundManager.playMusic("res/sounds/bgm.mp3", 1, new Handler$1(this, this.onComplete));
- }
- onPlaySound(e) {
- console.log("播放音效");
- SoundManager.playSound("res/sounds/btn.mp3", 1, new Handler$1(this, this.onComplete));
- }
- onComplete() {
- console.log("播放完成");
- }
- static Appseting(data) {
- AppSetting.shareimage = data["shareimage"];
- AppSetting.sharetitle = data["sharetitle"];
- AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
- AppSetting.moveTime = Number(data["moveTime"]);
- AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
- AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
- AppSetting.freecoinValue = Number(data["freecoinValue"]);
- AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
- AppSetting.cheat = data["cheat"];
- AppSetting.cheattime = data["cheattime"];
- AppSetting.checkscene = data["checkscene"];
- GlobalParam.playerspeed = Number(data["playerspeed"]);
- GlobalParam.matespeed = Number(data["friendspeed"]);
- GlobalParam.shootspeed = Number(data["bulletspeed"]);
- GlobalParam.sliderFactor = Number(data["sliderFactor"]);
- GlobalParam.playerMoveMaxX = Number(data["playerMoveMaxX"]);
- GlobalParam.playerRayLengthF = Number(data["playerRayLengthF"]);
- GlobalParam.playerRayLengthLR = Number(data["playerRayLengthLR"]);
- GlobalParam.bulletRayLength = Number(data["bulletRayLength"]);
- GlobalParam.bulletMaxDis = Number(data["bulletMaxDis"]);
- GlobalParam.barrierRoadLength = Number(data["barrierRoadLength"]);
- GlobalParam.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
- GlobalParam.hitmaxcount = Number(data["hitmaxcount"]);
- GlobalParam.boommaxcount = Number(data["boommaxcount"]);
- GlobalParam.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
- GlobalParam.arriveStandWidth = Number(data["arriveStandWidth"]);
- GlobalParam.enemySpeed = Number(data["enemySpeed"]);
- }
- static get Cheat() {
- return AppSetting.cheat == "1";
- }
- static get CheatTime() {
- return Number(AppSetting.cheattime);
- }
- static get CheckScene() {
- return AppSetting.checkscene == "1";
- }
- }
- var Event$2 = Laya.Event;
- var HttpRequest = Laya.HttpRequest;
- const PROTOCOL_URL = "https://gungangfengyunapi.xwxgame.com/";
- class PROTOCOLS {
- }
- PROTOCOLS.protocols = {
- Login: "user/login",
- Userauth: "user/auth",
- BuyLand: "shop/land",
- UserSync: "user/sync",
- ShopBuild: "shop/build",
- ShopUpgrade: "shop/upgrade",
- ShopSale: "shop/sale",
- RoleUpgrade: "role/upgrade",
- Fissionvd: "fission/vd",
- DailyTaskrefresh: "dailytask/refresh",
- DailyTaskrewards: "dailytask/rewards",
- Rankingvmoney: "ranking/vmoney",
- Lotterylottery: "lottery/lottery",
- AchievementgetRewards: "achievement/getRewards",
- Fissiondeduct: "fission/deduct",
- Sign: "sign/sign",
- InvitegetRewards: "invite/getRewards",
- InvitetargetRewards: "invite/targetRewards",
- GameResult: "game/play",
- Easter: "game/revival",
- GetCfg: "config/table",
- DoubleAward: "fission/vd",
- KunDiscard: "kun/discard",
- KunEquip: "kun/equip",
- KunMove: "kun/move",
- KunBuy: "kun/buy",
- Opentreasure: "treasure/open",
- Entertreasure: "treasure/enter",
- Buy: "theme/buy",
- Equip: "theme/equip",
- themefission: "theme/fission",
- Start: "game/start",
- UpgradeAttr: "attr/upgrade"
- };
- class NetManager {
- PostTokenRequest(protocol, completecb, errorcb, isload = true) {
- let args = "";
- let url = PROTOCOL_URL + protocol;
- args = args = `token=${UserModel.Instance.CurModel.m_token}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
- httpRequest.send(url, args, "post", "text");
- if (isload) {
- WXSdk.ShowLoading("");
- }
- }
- onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
- let data;
- if (isload) {
- WXSdk.HideLoading();
- }
- data = JSON.parse(httpRequest.data);
- console.log("请求成功:" + JSON.stringify(data));
- if (data["code"] == 0) {
- UserModel.Instance.RefreshModel(data);
- if (succeedcb != null) {
- succeedcb(data);
- }
- }
- else {
- if (failurecb != null) {
- var mess = GameTool.SpliteString(data["message"], ",")[0];
- failurecb(mess);
- }
- }
- }
- onHttpRequestError(errorcb, httpRequest, isload) {
- if (errorcb != null) {
- var data = JSON.parse(httpRequest.data);
- errorcb(data);
- }
- console.log("Error! Http request error, code: " + data);
- if (isload) {
- WXSdk.HideLoading();
- }
- }
- static get Instance() {
- return NetManager.instance || (NetManager.instance = new NetManager());
- }
- login(progresscb, completecb, errorcb) {
- console.log("发送登录请求");
- var userInfor = UserModel.Instance;
- var ver = GameVersion.VER;
- 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}`;
- console.log("登录 参数: " + args);
- let httpRequest = new HttpRequest();
- httpRequest.once(Event$2.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
- httpRequest.once(Event$2.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
- httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
- httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
- }
- onHttpRequestProgress() {
- }
- onLoginRequestComplete(completecb, httpRequest) {
- let data = JSON.parse(httpRequest.data);
- console.log(data);
- console.log("登录完成");
- if (data["code"] != "0") {
- var errInfo = JSON.stringify(httpRequest.data);
- console.log("登录异常错误!错误信息:", errInfo);
- completecb(data);
- return;
- }
- 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"]));
- UserInfoManager.Appseting(data["app_setting"]);
- var ver = data["table_version"];
- UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
- if (c) {
- UserInfoManager.GameInfo();
- completecb(data);
- }
- });
- WXSdk.ShareMessage();
- }
- PostCfgRequest(completecb, errorcb) {
- let args = "";
- let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
- args = `token=${UserModel.Instance.CurModel.m_token}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event$2.COMPLETE, this, () => {
- var data = JSON.parse(httpRequest.data);
- if (data["code"] == 0) {
- if (completecb != null) {
- if (data["configs"]) {
- completecb(data["configs"]);
- }
- }
- }
- else {
- if (errorcb != null) {
- errorcb(data);
- }
- }
- });
- httpRequest.once(Event$2.ERROR, this, () => {
- var data = JSON.parse(httpRequest.data);
- if (errorcb != null) {
- errorcb(data);
- }
- });
- httpRequest.send(url, args, "post", "text");
- }
- HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
- let args = "";
- let url = PROTOCOL_URL + protocol;
- if (hasToken == true) {
- args = `token=${UserModel.Instance.CurModel.m_token}&`;
- }
- if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
- || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
- || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
- || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
- let str = "abcdefghijkimnopqrstuvwxyz0123456789";
- let code = "{";
- let mask = "";
- for (let i = 0; i < 4; i++) {
- mask += str[Math.floor(Math.random() * 100) % str.length];
- }
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- code += "\"" + key + "\":";
- if (typeof param[i][key] === 'string') {
- code += "\"" + param[i][key] + "\"";
- }
- else {
- code += param[i][key];
- }
- }
- if (i < param.length - 1) {
- code += ",";
- }
- else {
- code += "}";
- }
- }
- args += "_r=" + mask + GameTool.get64Encode(code);
- }
- else {
- if (param != null) {
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- let val = param[i][key];
- args += `${key}=${val}`;
- if (i < param.length - 1) {
- args += "&";
- }
- }
- }
- }
- }
- let httpRequest = new HttpRequest();
- httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
- httpRequest.send(url, args, "post", "text");
- if (isload) {
- WXSdk.ShowLoading("");
- }
- }
- static errorRequest(arg, callback) {
- let httpRequest = new Laya.HttpRequest();
- if (callback) {
- httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
- httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
- httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
- }
- httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
- }
- static ErrorReport() {
- let arg = {
- "code": 1003,
- "msg": "invalid code",
- "user_id": 0,
- "game": "parkourrace",
- "type": "backend",
- "platform": "weixin"
- };
- this.errorRequest(arg, {
- complete: (request) => {
- },
- error: (request) => {
- }
- });
- }
- }
- var UserConfigName;
- (function (UserConfigName) {
- UserConfigName[UserConfigName["train"] = 0] = "train";
- UserConfigName[UserConfigName["sign"] = 1] = "sign";
- UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
- })(UserConfigName || (UserConfigName = {}));
- var UserAttr;
- (function (UserAttr) {
- UserAttr[UserAttr["user_id"] = 0] = "user_id";
- UserAttr[UserAttr["diamond"] = 1] = "diamond";
- UserAttr[UserAttr["energy"] = 2] = "energy";
- UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
- UserAttr[UserAttr["stage"] = 4] = "stage";
- UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
- UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
- UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
- UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
- UserAttr[UserAttr["money"] = 9] = "money";
- UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
- UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
- UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
- UserAttr[UserAttr["attrs"] = 13] = "attrs";
- })(UserAttr || (UserAttr = {}));
- class NetUserModel {
- 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) {
- this.loginSeverTime = 0;
- this.m_avatar = "";
- this.localTime = Laya.timer.currTimer;
- this.loginSeverTime = t;
- this.m_token = _token;
- this.m_user = _user;
- this.m_base = _userbase;
- this.m_invite = _useInvite;
- this.m_lottery = _user_lottery;
- this.m_treasure = _user_treasure;
- this.m_achievement = _user_achievement;
- this.m_sign = _user_sign;
- this.m_arena = _user_arena;
- this.m_shop = user_shop;
- this.user_video = user_video;
- this.user_daily_task = user_daily_task;
- this.m_userid = this.m_user["user_id"];
- this.m_openid = this.m_base["openid"];
- this.m_nickname = this.m_base["nickname"];
- this.is_new = Number(is_new);
- }
- GetUserAttr(_attr) {
- var attr = UserAttr[_attr];
- return this.m_user[attr];
- }
- get ServerTime() {
- let time = Laya.timer.currTimer;
- let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
- return stime;
- }
- HasTheme(_id) {
- var data = this.GetUserAttr(UserAttr.get_themes);
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id == hd) {
- return true;
- }
- }
- return false;
- }
- GetThemeProgress(_id) {
- var config = this.GetUserAttr(UserAttr.progress_themes);
- var progress = config[_id] ? config[_id] : 0;
- return progress;
- }
- JundgCfg(ver, callball) {
- var cfg = Laya.LocalStorage.getJSON(GameVersion.CFG);
- if (cfg) {
- if (cfg.VER == ver) {
- console.log("已经拥有,不用更新");
- UserInfoManager.SetCfg(cfg);
- callball(true);
- }
- else {
- console.log("cfg存在但是过期了");
- Laya.LocalStorage.removeItem(GameVersion.CFG);
- NetManager.Instance.PostCfgRequest((data) => {
- data.VER = ver;
- Laya.LocalStorage.setJSON(GameVersion.CFG, data);
- UserInfoManager.SetCfg(data);
- callball(true);
- }, (data) => {
- console.log("配置获取失败" + data);
- callball(false);
- return;
- });
- }
- }
- else {
- console.log("本地没有cfg");
- NetManager.Instance.PostCfgRequest((data) => {
- console.log("cfg" + data);
- data.VER = ver;
- Laya.LocalStorage.setJSON(GameVersion.CFG, data);
- UserInfoManager.SetCfg(data);
- callball(true);
- }, (data) => {
- console.log("配置获取失败" + data);
- });
- }
- }
- }
- class UserModel {
- get CurModel() {
- return this.curModel;
- }
- constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
- UserModel.instance = this;
- this.m_code = code;
- this.m_nickname = nickname ? nickname : "";
- this.m_avatar = avatar ? avatar : "";
- this.m_gender = gender ? gender : 0;
- this.m_city = city ? city : "";
- this.m_device = device ? device : "";
- this.m_share_id = share_id ? share_id : "";
- this.channel = channel ? channel : "";
- this.m_country = country ? country : "";
- this.m_province = province ? province : "";
- }
- static get Instance() {
- if (UserModel.instance) {
- return UserModel.instance;
- }
- else {
- UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
- return UserModel.instance;
- }
- }
- SetUserModel(_model) {
- this.curModel = _model;
- }
- RefreshModel(data) {
- if (data["user"])
- this.curModel.m_user = data["user"];
- if (data["user_invite"])
- this.curModel.m_invite = data["user_invite"];
- if (data["user_lottery"])
- this.curModel.m_lottery = data["user_lottery"];
- if (data["user_achievement"]) {
- this.curModel.m_achievement = data["user_achievement"];
- }
- if (data["user_sign"])
- this.curModel.m_sign = data["user_sign"];
- if (data["user_shop"])
- this.curModel.m_shop = data["user_shop"];
- if (data["user_daily_task"])
- this.curModel.user_daily_task = data["user_daily_task"];
- if (data["user_video"])
- this.curModel.user_video = data["user_video"];
- }
- }
- var ALDType;
- (function (ALDType) {
- ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
- ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
- })(ALDType || (ALDType = {}));
- class WXSdk {
- static get ShareId() {
- return this.shareId;
- }
- static get Chanel() {
- return this._chanel;
- }
- static init(cb) {
- this.EventStatistics();
- Laya.Browser.window.wx.showShareMenu({
- withShareTicket: true
- });
- Laya.Browser.window.wx.onShow(this.InitWx);
- }
- static InitWx(option) {
- var shareid = option.query.share_id;
- this.shareId = shareid ? shareid : "";
- GameVersion.wxValue = option.scene;
- var scene = Laya.LocalStorage.getItem("scene");
- if (scene) {
- GameVersion.wxValue = scene;
- console.log("读取配置场景值:" + scene);
- }
- else {
- console.log("第一次拉取场景值:" + GameVersion.wxValue);
- Laya.LocalStorage.setItem("scene", GameVersion.wxValue);
- }
- var channel = option.query.channel;
- this._chanel = channel ? channel : "";
- Laya.Browser.window.wx.offShow(WXSdk.InitWx);
- }
- static ShareMessage() {
- if (!GameVersion.isWx)
- return;
- var t = UserModel.Instance.CurModel.ServerTime;
- var _title;
- var _url;
- _title = AppSetting.sharetitle;
- _url = AppSetting.shareimage;
- if (_title == null) {
- _title = "枪王之王...";
- _url = "res/share.png";
- }
- else {
- let a = GameTool.SpliteString(_title);
- let b = GameTool.SpliteString(_url);
- _title = a[GameTool.randomInt(0, a.length - 1)];
- _url = b[GameTool.randomInt(0, b.length - 1)];
- }
- console.log("_title:", _title);
- console.log("_url:", _url);
- Laya.Browser.window.wx.onShareAppMessage(() => ({
- title: _title,
- imageUrl: _url,
- query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- }));
- }
- static Login(cb) {
- if (WXSdk.Lodining) {
- return;
- }
- WXSdk.Lodining = true;
- Laya.Browser.window.wx.login({
- success: function (res) {
- console.log("wx.login: success! res.code=" + res.code);
- if (res.code) {
- WXSdk.Lodining = false;
- console.log("将要传递的参数:" + res);
- cb(res);
- }
- else {
- console.log('获取用户登录态失败!' + res.errMsg);
- cb("error");
- }
- },
- fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
- });
- }
- static ShowLoading(title = "加载中...", isShowWx = true) {
- console.log(title);
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- if (isShowWx) {
- Laya.Browser.window.wx.showLoading({ title: title, mask: true });
- }
- ViewManager.Instance.OpenMask();
- }
- else {
- ViewManager.Instance.OpenMask();
- }
- }
- static HideLoading(isShowWx = true) {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- if (isShowWx) {
- Laya.Browser.window.wx.hideLoading();
- }
- ViewManager.Instance.CloseMask();
- }
- else {
- ViewManager.Instance.CloseMask();
- }
- }
- static SystemInfo() {
- if (Laya.Browser.window.wx) {
- if (!WXSdk.sysdata)
- WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
- return WXSdk.sysdata;
- }
- }
- static ShowToast(text, icon = true) {
- if (Laya.Browser.window.wx) {
- var t_icon = icon ? "success" : "none";
- text = text ? text : "暂未开放...";
- Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
- }
- else {
- console.log(text);
- }
- }
- static ShortVibrate() {
- if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
- if (WXSdk.vibrating)
- return;
- WXSdk.vibrating = true;
- Laya.Browser.window.wx.vibrateShort({
- complete: function (res) {
- WXSdk.vibrating = false;
- }
- });
- }
- }
- static LongVibrate() {
- if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
- if (WXSdk.vibrating)
- return;
- WXSdk.vibrating = true;
- Laya.Browser.window.wx.vibrateLong({
- complete: function (res) {
- WXSdk.vibrating = false;
- }
- });
- }
- }
- static Success(stageId) {
- if (!GameVersion.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onEnd({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- event: "complete",
- params: {
- desc: "关卡完成"
- }
- });
- }
- static AldEvent(eventName, a) {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
- }
- }
- static EventStatistics() {
- let uuid = Laya.LocalStorage.getItem("uuidTimes");
- if (uuid) {
- let lastSignTime = new Date(Number(uuid));
- let todayZero = new Date(Laya.timer.currTimer);
- todayZero.setHours(0, 0, 0, 0);
- if (lastSignTime.valueOf() < todayZero.valueOf()) {
- this.IsNew = 0;
- }
- else {
- this.IsNew = 1;
- }
- }
- else {
- this.IsNew = 1;
- Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
- }
- }
- static Fail(stageId) {
- if (!GameVersion.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onEnd({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- event: "fail",
- params: {
- desc: "关卡失败",
- }
- });
- }
- static Start(stageId) {
- if (!GameVersion.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onStart({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- });
- }
- static Game_Share(callback = null, channel = "") {
- if (!GameVersion.isWx) {
- return;
- }
- var _title;
- var _url;
- _title = AppSetting.sharetitle;
- _url = AppSetting.shareimage;
- if (_title == null) {
- _title = "枪王之王...";
- _url = "res/share.png";
- }
- else {
- let a = GameTool.SpliteString(_title);
- let b = GameTool.SpliteString(_url);
- _title = a[GameTool.randomInt(0, a.length - 1)];
- _url = b[GameTool.randomInt(0, b.length - 1)];
- }
- console.log("_title:", _title);
- console.log("_url:", _url);
- var t = UserModel.Instance.CurModel.ServerTime;
- Laya.Browser.window.wx.shareAppMessage({
- title: _title,
- imageUrl: _url,
- query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
- });
- ShareModule.GoShare(callback);
- }
- static LoadSubPackage(name, callback) {
- if (GameVersion.isWx) {
- const loadTask = Laya.Browser.window.wx.loadSubpackage({
- name: name,
- success(res) {
- console.log("分包下载成功:", res);
- if (callback)
- callback(true);
- },
- fail(res) {
- console.log("分包下载失败:" + JSON.stringify(res));
- if (callback)
- callback(false);
- }
- });
- }
- else {
- if (callback)
- callback(true);
- }
- }
- static IsNeedUpdate() {
- if (!GameVersion.isWx)
- return false;
- const updateManager = Laya.Browser.window.wx.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- console.log("最新版本:" + res.hasUpdate);
- });
- updateManager.onUpdateReady(function () {
- Laya.Browser.window.wx.showModal({
- showCancel: false,
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- updateManager.applyUpdate();
- },
- fail(res) {
- updateManager.applyUpdate();
- }
- });
- });
- }
- static IsAuth() {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- Laya.Browser.window.wx.getSetting({
- success: (res) => {
- console.log("授权结果..");
- console.log(res);
- if (res.authSetting['scope.userInfo'] == true) {
- WXSdk.isAuth = true;
- Laya.Browser.window.wx.getUserInfo({
- lang: 'zh_CN',
- success: (res) => {
- UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
- UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
- console.log("已经受过权");
- },
- fail: () => {
- console.log('调用getUserInfo fail');
- }
- });
- }
- }
- });
- }
- }
- static RequestAuth(callback) {
- if (WXSdk.isAuth) {
- if (callback != null) {
- callback(true);
- }
- return;
- }
- if (GameVersion.isWx) {
- console.log("-----授权");
- let openAuthView = () => {
- let w = Laya.stage.width;
- let h = Laya.stage.height;
- console.log("准备授权");
- let button = Laya.Browser.window.wx.createUserInfoButton({
- type: 'text',
- text: '',
- style: {
- left: 0,
- top: 0,
- width: w,
- height: h,
- lineHeight: 40,
- backgroundColor: '#00000000',
- textAlign: 'center',
- fontSize: 16,
- borderRadius: 4
- }
- });
- let opTapHandler = (res) => {
- console.log("res:" + JSON.stringify(res));
- if (res.userInfo) {
- button.hide();
- button.offTap(opTapHandler);
- button.destroy();
- console.log("userinfo", res);
- UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
- UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
- let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
- { "country": res.userInfo.country }, { "province": res.userInfo.province }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
- WXSdk.isAuth = true;
- if (callback != null) {
- callback(true);
- }
- }, null);
- }
- else {
- button.hide();
- button.offTap(opTapHandler);
- button.destroy();
- if (callback != null) {
- callback(false);
- }
- }
- };
- button.show();
- button.onTap(opTapHandler);
- };
- openAuthView();
- }
- else {
- WXSdk.isAuth = true;
- if (callback != null) {
- callback(true);
- }
- }
- }
- static OnShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.onShow(cb);
- }
- static OffShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.offShow(cb);
- }
- static showbjWxGameQuan(flag) {
- if (!GameVersion.isWx) {
- return;
- }
- if (flag) {
- if (this.button == null) {
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- if (!info)
- return;
- var top = 0.5 * info.windowHeight;
- var height = 109 * info.windowHeight / Laya.stage.height;
- var width = height * 80 / 109;
- Laya.stage.width;
- this.button = Laya.Browser.window.wx.createGameClubButton({
- type: "image",
- image: 'res/talk.png',
- style: {
- left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
- top: top - 240 * info.windowHeight / Laya.stage.height,
- width: width,
- height: height
- }
- });
- }
- this.button.show();
- }
- else {
- if (this.button) {
- this.button.hide();
- }
- }
- }
- }
- WXSdk.Lodining = false;
- WXSdk.shareId = "";
- WXSdk._chanel = "";
- WXSdk.isAuth = false;
- WXSdk.vibrating = false;
- WXSdk.IsNew = 0;
- var Sprite3D = Laya.Sprite3D;
- var PoolType;
- (function (PoolType) {
- PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
- PoolType[PoolType["HpText"] = 2] = "HpText";
- })(PoolType || (PoolType = {}));
- class GamePool {
- constructor() {
- this.poolDic = new Dictionary();
- this.prefabDic = new Dictionary();
- this.singleobjDic = new Dictionary();
- }
- static get Instance() {
- return GamePool.instance || (GamePool.instance = new GamePool());
- }
- InitSelf(name, prefab) {
- if (prefab != null) {
- if (!this.prefabDic.has(name))
- this.prefabDic.set(name, prefab);
- }
- }
- onComplete(s) {
- Laya.Sprite3D.load("res/threeDimen/staticModel/lizard/lizard.lh", Laya.Handler.create(this, function (sprite) {
- var monster1 = this.scene.addChild(sprite);
- monster1.transform.position = new Laya.Vector3(-0.6, 0, 0);
- monster1.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
- var monster2 = Laya.Sprite3D.instantiate(monster1, this.scene, false, new Laya.Vector3(0.6, 0, 0));
- monster2.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
- for (var i = 0; i < monster2.getChildByName("lizard").numChildren; i++) {
- var meshSprite3D = monster2.getChildByName("lizard").getChildAt(i);
- var material = meshSprite3D.meshRenderer.material;
- Laya.Texture2D.load(this.normalMapUrl[i], Laya.Handler.create(this, function (mat, texture) {
- mat.normalTexture = texture;
- }, [material]));
- }
- Laya.timer.frameLoop(1, this, function () {
- monster1.transform.rotate(this.rotation);
- monster2.transform.rotate(this.rotation);
- });
- }));
- }
- GetUi(type) {
- if (this.singleobjDic.has(type)) {
- if (this.singleobjDic.get(type).length > 0) {
- var result = this.singleobjDic.get(type).shift();
- result.visible = true;
- return result;
- }
- else {
- return this.GetByType(type);
- }
- }
- else {
- return this.GetByType(type);
- }
- }
- RecoverUi(type, go) {
- go.visible = false;
- go.removeSelf();
- if (!this.singleobjDic.has(type)) {
- this.singleobjDic.set(type, new Array());
- }
- this.singleobjDic.get(type).push(go);
- }
- RecoverModel(go) {
- if (!go)
- return;
- go.active = false;
- go.removeSelf();
- var key = go.name;
- if (!this.poolDic.has(key)) {
- this.poolDic.set(key, new Array());
- }
- this.poolDic.get(key).push(go);
- }
- GetModel(name) {
- if (name == "PlayerShoot")
- GamePool.bulletCount++;
- if (this.poolDic.has(name)) {
- if (this.poolDic.get(name).length > 0) {
- var result = this.poolDic.get(name).shift();
- result.active = true;
- return result;
- }
- else {
- if (this.prefabDic.has(name)) {
- var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
- curObj.name = name;
- console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
- return curObj;
- }
- else {
- return null;
- }
- }
- }
- else {
- if (this.prefabDic.has(name)) {
- var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
- curObj.name = name;
- console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
- return curObj;
- }
- else {
- return null;
- }
- }
- }
- onStateEnter() {
- console.log("动画开始播放了");
- }
- onStateUpdate() {
- console.log("动画状态更新了");
- }
- onStateExit() {
- console.log("动画退出了");
- }
- GetByType(type) {
- if (type == PoolType.WarnTips) {
- var _t = new Laya.Text();
- _t.width = 720;
- _t.height = 60;
- _t.align = "center";
- _t.valign = "middle";
- _t.fontSize = 35;
- _t.bold = true;
- _t.pivotX = 360;
- _t.pivotY = 30;
- _t.color = "#ffffff";
- _t.stroke = 5;
- _t.strokeColor = "#000000";
- return _t;
- }
- else if (type == PoolType.HpText) {
- var _t = new Laya.Text();
- _t.font = "Microsoft YaHei";
- _t.width = 260;
- _t.height = 50;
- _t.align = "center";
- _t.valign = "middle";
- _t.fontSize = 30;
- _t.bold = true;
- _t.pivotX = 130;
- _t.pivotY = 25;
- _t.color = "#ffffff";
- return _t;
- }
- }
- }
- GamePool.modeltype = {
- Mound: "Mound",
- PlayerShoot: "PlayerShoot",
- Player: "Character",
- Enemy: "enemy"
- };
- GamePool.bulletCount = 0;
- class FollowNumber {
- constructor(t, from = 0, to = 0, tiny = 0) {
- this.m_t = 0;
- this.target = 0;
- this.follow = 0;
- this.m_tiny = 0;
- this.m_t = t;
- this.target = to;
- this.follow = from;
- this.m_tiny = tiny;
- }
- ChangeT(value) {
- this.m_t = value;
- }
- get t() { return this.m_t; }
- update() {
- this.follow = MathTool.MixNumber(this.follow, this.target, this.m_t);
- if (this.m_tiny != 0 && this.target != this.follow) {
- if (Math.abs(this.target - this.follow) <= this.m_tiny) {
- this.follow = this.target;
- }
- }
- }
- }
- class MathTool {
- static get VecZero() {
- return new Laya.Vector3();
- }
- static RandomNumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static SpToCam(v3) {
- v3.x = -v3.x;
- v3.y = v3.y - 180;
- v3.z = -v3.z;
- return v3;
- }
- static MixVector3(from, to, t, res = null) {
- if (res == null) {
- res = this.m_mixVector;
- }
- res.x = MathTool.MixNumber(from.x, to.x, t);
- res.y = MathTool.MixNumber(from.y, to.y, t);
- res.z = MathTool.MixNumber(from.z, to.z, t);
- return res;
- }
- static MixNumber(from, to, t) {
- t = MathTool.Clamp(t, 0, 1);
- from = (to - from) * t + from;
- return from;
- }
- static Clamp(value, from, to) {
- if (value < from) {
- value = from;
- }
- if (value > to) {
- value = to;
- }
- return value;
- }
- }
- MathTool.m_mixVector = new Laya.Vector3();
- var ColliderGroup;
- (function (ColliderGroup) {
- ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
- ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
- ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
- ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
- ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
- ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
- })(ColliderGroup || (ColliderGroup = {}));
- class MusicType {
- onPreLoadFinish() {
- var layaMonkeyParent = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));
- var layaMonkeySon = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey2/LayaMonkey.lh");
- layaMonkeySon.transform.translate(new Laya.Vector3(2.5, 0, 0));
- var scale = new Laya.Vector3(0.5, 0.5, 0.5);
- layaMonkeySon.transform.localScale = scale;
- layaMonkeyParent.addChild(layaMonkeySon);
- this.addButton(100, 120, 160, 30, "移动父级猴子", 20, function (e) {
- layaMonkeyParent.transform.translate(new Laya.Vector3(-0.1, 0, 0));
- });
- this.addButton(100, 160, 160, 30, "放大父级猴子", 20, function (e) {
- var scale = new Laya.Vector3(0.2, 0.2, 0.2);
- layaMonkeyParent.transform.localScale = scale;
- });
- this.addButton(100, 200, 160, 30, "旋转父级猴子", 20, function (e) {
- layaMonkeyParent.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
- });
- this.addButton(100, 250, 160, 30, "移动子级猴子", 20, function (e) {
- layaMonkeySon.transform.translate(new Laya.Vector3(-0.1, 0, 0));
- });
- this.addButton(100, 290, 160, 30, "放大子级猴子", 20, function (e) {
- var scale = new Laya.Vector3(1, 1, 1);
- layaMonkeySon.transform.localScale = scale;
- });
- this.addButton(100, 330, 160, 30, "旋转子级猴子", 20, function (e) {
- layaMonkeySon.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
- });
- }
- addButton(x, y, width, height, text, size, clickFun) {
- Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () {
- var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text));
- changeActionButton.size(width, height);
- changeActionButton.labelBold = true;
- changeActionButton.labelSize = size;
- changeActionButton.sizeGrid = "4,4,4,4";
- changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
- changeActionButton.pos(x, y);
- changeActionButton.on(Laya.Event.CLICK, this, clickFun);
- }));
- }
- }
- MusicType.Idle = "Idle";
- MusicType.CrouchFiring = "CrouchFiring";
- MusicType.Dance = "Dance";
- MusicType.RunAndGun = "RunAndGun";
- MusicType.RunningHysteric = "RunningHysteric";
- var Text = Laya.Text;
- class CameraManager {
- static get Instance() {
- return this.instance || (this.instance = new CameraManager());
- }
- CameraFollow(z) {
- if (this.Camera)
- this.Camera.MoveGame(z);
- }
- Init(cam, startPos) {
- this.startPosTra = startPos.transform;
- if (cam) {
- this._maincamera = cam;
- this.Camera = this._maincamera.addComponent(Camera);
- this.Camera.Init();
- }
- }
- createSampleText() {
- var text = new Text();
- text.overflow = Text.HIDDEN;
- text.color = "#FFFFFF";
- text.font = "Impact";
- text.fontSize = 20;
- text.borderColor = "#FFFF00";
- text.x = 80;
- Laya.stage.addChild(text);
- 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";
- return text;
- }
- SetCameraAction(type, arg) {
- if (this.Camera)
- this.Camera.CameraAction(type, arg);
- }
- }
- var BitmapFont = Laya.BitmapFont;
- var Text$1 = Laya.Text;
- var Handler$2 = Laya.Handler;
- class ConstructManager {
- constructor() {
- this.tarDis = 30;
- this.constructArr = [];
- this.fontName = "diyFont";
- }
- static get Instance() {
- return this.instance || (this.instance = new ConstructManager());
- }
- Init(builds) {
- this.constructArr.push(builds.getChildAt(2));
- this.constructArr.push(builds.getChildAt(1));
- this.constructArr.push(builds.getChildAt(0));
- }
- CheckMainRolePos(_zp) {
- let d = this.tarDis - _zp;
- if (d > 0)
- return;
- this.SwitchRoad();
- }
- loadFont() {
- var bitmapFont = new BitmapFont();
- bitmapFont.loadFont("res/bitmapFont/test.fnt", new Handler$2(this, this.onFontLoaded, [bitmapFont]));
- }
- onFontLoaded(bitmapFont) {
- bitmapFont.setSpaceWidth(10);
- Text$1.registerBitmapFont(this.fontName, bitmapFont);
- this.createText(this.fontName);
- }
- createText(font) {
- var txt = new Text$1();
- txt.width = 250;
- txt.wordWrap = true;
- txt.text = "Do one thing at a time, and do well.";
- txt.font = font;
- txt.leading = 5;
- txt.pos(Laya.stage.width - txt.width >> 1, Laya.stage.height - txt.height >> 1);
- Laya.stage.addChild(txt);
- }
- SwitchRoad() {
- let rs = this.constructArr.pop();
- rs.transform.localPositionZ = this.tarDis + 60;
- this.constructArr.unshift(rs);
- this.tarDis = this.tarDis + 30;
- }
- SetConstruct() {
- for (let index = this.constructArr.length - 1; index >= 0; index--) {
- const element = this.constructArr[index];
- element.transform.localPositionZ = (2 - index) * 30;
- }
- this.tarDis = 30;
- }
- }
- var Sprite$1 = Laya.Sprite;
- var Handler$3 = Laya.Handler;
- class LevelController {
- static get Instance() {
- return LevelController.instance || (LevelController.instance = new LevelController());
- }
- showApe() {
- var ape = new Sprite$1();
- Laya.stage.addChild(ape);
- ape.loadImage("res/apes/monkey3.png");
- Laya.loader.load("res/apes/monkey2.png", Handler$3.create(this, function () {
- var t = Laya.loader.getRes("res/apes/monkey2.png");
- var ape = new Sprite$1();
- ape.graphics.drawTexture(t, 0, 0);
- Laya.stage.addChild(ape);
- ape.pos(200, 0);
- }));
- }
- SetLevel(level) {
- let len = NetInfoManager.Instance._level.length;
- let index = PlayerManager.Instance.stage;
- if (PlayerManager.Instance.stage > len)
- index = GameTool.randomInt(1, len);
- this.curLevelData = NetInfoManager.Instance.GetLevel(index);
- if (!this._level)
- this._level = new Level();
- this._level.SetLevel(this.curLevelData);
- }
- }
- class Level {
- constructor() {
- this.road_list = [];
- this.fail_gold = 0;
- }
- createApes() {
- var layoutRadius = 150;
- var radianUnit = Math.PI / 2;
- this.apesCtn = new Sprite$1();
- Laya.stage.addChild(this.apesCtn);
- for (var i = 0; i < 4; i++) {
- var ape = new Sprite$1();
- ape.loadImage("res/apes/monkey" + i + ".png");
- ape.pivot(55, 72);
- ape.pos(Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius);
- this.apesCtn.addChild(ape);
- }
- this.apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- }
- SetLevel(data) {
- this.road_list = GameTool.SpliteString(data["road_list"]);
- this.gold = Number(data["gold"]);
- this.fail_gold = Number(data["fail_gold"]);
- this.enemy = data["enemy"];
- this.enemy_hp = data["enemy_hp"];
- this.isgold = Number(data["isgold"]) == 1;
- this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
- }
- }
- class MoundManager {
- static get Instance() {
- return this.instance || (this.instance = new MoundManager());
- }
- constructor() {
- this.MoundrDic = new Dictionary();
- }
- Init(da) {
- this.moundContainer = da;
- }
- MakeMound(data) {
- let tower = GamePool.Instance.GetModel(GamePool.modeltype.Mound);
- if (!tower)
- return;
- this.moundContainer.addChild(tower);
- let ts = tower.getComponent(Mound);
- if (!ts)
- ts = tower.addComponent(Mound);
- ts.SetMound(data);
- this.MoundrDic.set(tower.id, ts);
- }
- Reset() {
- let arr = [];
- for (const key in this.MoundrDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.MoundrDic.get(element);
- if (s)
- s.Recovery();
- }
- }
- }
- RecoverMound(sp) {
- this.MoundrDic.delete(sp.id);
- }
- HpUi() {
- return GamePool.Instance.GetUi(PoolType.HpText);
- }
- }
- class MatrixTransform {
- static WorldToScreen2(camera, point) {
- var pointA = this.InverseTransformPoint(camera.transform, point);
- var distance = pointA.z;
- var out = new Laya.Vector3();
- camera.viewport.project(point, camera.projectionViewMatrix, out);
- var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
- return value;
- }
- static ScreenToWorld(camera, point) {
- var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
- let height = point.z * Math.tan(halfFOV);
- let width = height * camera.aspectRatio;
- let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
- let v = this.GetScreenScale(width, height);
- var value = new Laya.Vector3();
- var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
- value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
- Laya.Vector3.add(lowerLeftA, value, value);
- value = this.TransformPoint(camera.transform, value);
- return value;
- }
- static GetScreenScale(width, height) {
- var v = new Laya.Vector3();
- v.x = Laya.stage.width / width / 2;
- v.y = Laya.stage.height / height / 2;
- return v;
- }
- static GetLowerLeft(transform, distance, width, height) {
- var lowerLeft = new Laya.Vector3();
- var right = new Laya.Vector3();
- transform.getRight(right);
- Laya.Vector3.normalize(right, right);
- var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
- Laya.Vector3.add(transform.position, xx, lowerLeft);
- var up = new Laya.Vector3();
- transform.getUp(up);
- Laya.Vector3.normalize(up, up);
- var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
- Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
- var forward = new Laya.Vector3();
- transform.getForward(forward);
- Laya.Vector3.normalize(forward, forward);
- var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
- Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
- return lowerLeft;
- }
- static InverseTransformPoint(origin, point) {
- var xx = new Laya.Vector3();
- origin.getRight(xx);
- var yy = new Laya.Vector3();
- origin.getUp(yy);
- var zz = new Laya.Vector3();
- origin.getForward(zz);
- var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
- var x = this.ProjectDistance(point, origin.position, xx);
- var y = this.ProjectDistance(point, origin.position, yy);
- var z = this.ProjectDistance(point, origin.position, zz1);
- var value = new Laya.Vector3(x, y, z);
- return value;
- }
- static TransformPoint(origin, point) {
- var value = new Laya.Vector3();
- Laya.Vector3.transformQuat(point, origin.rotation, value);
- Laya.Vector3.add(value, origin.position, value);
- return value;
- }
- static ProjectDistance(A, C, B) {
- var CA = new Laya.Vector3();
- Laya.Vector3.subtract(A, C, CA);
- var angle = this.Angle2(CA, B) * Math.PI / 180;
- var distance = Laya.Vector3.distance(A, C);
- distance *= Math.cos(angle);
- return distance;
- }
- static Angle2(ma, mb) {
- var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
- var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
- var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
- var cosM = v1 / (ma_val * mb_val);
- if (cosM < -1)
- cosM = -1;
- if (cosM > 1)
- cosM = 1;
- var angleAMB = Math.acos(cosM) * 180 / Math.PI;
- return angleAMB;
- }
- }
- var Sprite$2 = Laya.Sprite;
- class ParticleManager {
- constructor() {
- this.attackmaxcount = 0;
- this.explodemaxcount = 0;
- }
- static get Instance() {
- return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
- }
- AttackEffect(pos) {
- if (this.attackmaxcount >= GlobalParam.hitmaxcount)
- return;
- let h = GamePool.Instance.GetModel("Hit");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- this.attackmaxcount++;
- Laya.timer.once(800, this, this.RecoverEffect, [h], false);
- }
- RecoverEffect(sp) {
- GamePool.Instance.RecoverModel(sp);
- this.attackmaxcount--;
- }
- mapLoaded() {
- this.layer = this.tiledMap.getLayerByIndex(0);
- var radiusX = 32;
- var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
- var color = "#FF7F50";
- this.sprite = new Sprite$2();
- this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
- this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
- this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
- this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
- Laya.stage.addChild(this.sprite);
- }
- ExplodeEffect(pos) {
- if (this.explodemaxcount >= GlobalParam.boommaxcount)
- return;
- let h = GamePool.Instance.GetModel("Explode");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- this.explodemaxcount++;
- Laya.timer.once(800, this, this.RecoverExpolde, [h], false);
- }
- RecoverExpolde(sp) {
- GamePool.Instance.RecoverModel(sp);
- this.explodemaxcount--;
- }
- BloodEffect(pos) {
- let h = GamePool.Instance.GetModel("Blood");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- Laya.timer.once(800, this, this.RecoverBlood, [h], false);
- }
- RecoverBlood(sp) {
- GamePool.Instance.RecoverModel(sp);
- }
- }
- var Event$3 = Laya.Event;
- var MouseManager = Laya.MouseManager;
- var MovieClip = Laya.MovieClip;
- var Animation = Laya.Animation;
- class MouseEvent {
- constructor() {
- this.SWFPath = "res/swf/dragon.swf";
- this.MCWidth = 318;
- this.MCHeight = 406;
- this._switch = false;
- this._isCanClick = true;
- this.clickD = false;
- this._mousePos = MathTool.VecZero;
- this.tempMouse = MathTool.VecZero;
- this.clickCount = 0;
- this.mStartX = 400;
- this.mStartY = 500;
- this.mActionIndex = 0;
- this.mCurrIndex = 0;
- this.mCurrSkinIndex = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new MouseEvent());
- }
- InitMouseEvent() {
- Laya.stage.on(Event$3.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.on(Event$3.MOUSE_OUT, this, this.OnClickUp);
- }
- createMovieClip() {
- var mc = new MovieClip();
- mc.load(this.SWFPath);
- mc.x = (Laya.stage.width - this.MCWidth) / 2;
- mc.y = (Laya.stage.height - this.MCHeight) / 2;
- Laya.stage.addChild(mc);
- }
- OnClickDown(e) {
- if (!this._isCanClick || !this._switch)
- return;
- if (e.target instanceof Laya.UIComponent)
- return;
- this.clickD = true;
- Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
- this._mousePos.x = MouseManager.instance.mouseX;
- this._mousePos.y = MouseManager.instance.mouseY;
- this.MouseD();
- }
- StartGameClick() {
- this._switch = true;
- if (!this._isCanClick)
- return;
- this.clickD = true;
- Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
- this._mousePos.x = MouseManager.instance.mouseX;
- this.MouseD();
- }
- MouseD() {
- MainRoleManager.Instance.SetModelPos(this._mousePos.x);
- MainRoleManager.Instance.CreateShoot();
- }
- OnClickUp(e) {
- if (!this._isCanClick || !this._switch)
- return;
- if (!this.clickD)
- return;
- this.MouseU();
- }
- createAnimation() {
- var ani = new Animation();
- ani.interval = 30;
- ani.index = 1;
- ani.play();
- var bounds = ani.getGraphicBounds();
- ani.pivot(bounds.width / 2, bounds.height / 2);
- ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- Laya.stage.addChild(ani);
- }
- OffMouseEvent() {
- Laya.stage.off(Event$3.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.off(Event$3.MOUSE_OUT, this, this.OnClickUp);
- }
- MouseU() {
- this.clickD = false;
- Laya.stage.off(Event$3.MOUSE_MOVE, this, this.OnSlider);
- Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
- }
- OnSlider(e) {
- this.tempMouse.x = MouseManager.instance.mouseX;
- let offestX = this.tempMouse.x - this._mousePos.x;
- if (offestX >= 0)
- offestX = offestX < 20 ? offestX : 20;
- if (offestX < 0)
- offestX = offestX > -20 ? offestX : -20;
- MainRoleManager.Instance.PlayerSlip(-offestX);
- this._mousePos.x = this.tempMouse.x;
- this._mousePos.y = this.tempMouse.y;
- }
- OpenInput() {
- this.clickCount++;
- if (this.clickCount > 1)
- return;
- this._isCanClick = true;
- }
- CloseInput() {
- this.clickCount--;
- if (this.clickCount > 0)
- return;
- this._isCanClick = false;
- this.clickD = false;
- }
- set _Switch(value) {
- this._switch = value;
- }
- play() {
- this.mCurrIndex++;
- if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
- this.mCurrIndex = 0;
- }
- this.mArmature.play(this.mCurrIndex, false);
- }
- onEvent(e) {
- var tEventData = e;
- Laya.stage.addChild(this.mLabelSprite);
- this.mLabelSprite.x = this.mStartX;
- this.mLabelSprite.y = this.mStartY;
- this.mLabelSprite.graphics.clear();
- this.mLabelSprite.graphics.fillText(tEventData.name, 0, 0, "20px Arial", "#ff0000", "center");
- }
- }
- var Sprite$3 = Laya.Sprite;
- var ColorFilter = Laya.ColorFilter;
- class Street extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.rotate = MathTool.VecZero;
- this.speed = MathTool.VecZero;
- this.ApePath = "res/apes/monkey2.png";
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- }
- SetMoveType() {
- if (this.thing.type == 5) {
- this._transform = this.selfobj.getChildAt(0).transform;
- }
- else {
- this._transform = this.tran;
- if (this.thing.type == 4) {
- StreetManager.Instance.StreetAddCube(this.selfobj);
- }
- }
- if (this.thing.moveType == 1) {
- Laya.timer.frameLoop(3, this, this.CheckRecover);
- return;
- }
- else if (this.thing.moveType == 2) {
- this.rotate.x = 0;
- this.rotate.y = -this.thing.moveSpeed;
- this.rotate.z = 0;
- Laya.timer.frameLoop(2, this, this.MoveType2);
- }
- else if (this.thing.moveType == 3) {
- this.rotate.x = 0;
- this.rotate.y = this.thing.moveSpeed;
- this.rotate.z = 0;
- Laya.timer.frameLoop(2, this, this.MoveType2);
- }
- else if (this.thing.moveType == 4) {
- this.rotate.x = 0;
- this.rotate.y = 0;
- this.rotate.z = this.thing.moveSpeed;
- Laya.timer.frameLoop(1, this, this.MoveType3);
- }
- else if (this.thing.moveType == 5) {
- this.rotate.x = 0;
- this.rotate.y = 0;
- this.rotate.z = -this.thing.moveSpeed;
- Laya.timer.frameLoop(1, this, this.MoveType3);
- }
- else if (this.thing.moveType == 6) {
- this.speed.x = -this.thing.moveSpeed;
- this.speed.y = 0;
- this.speed.z = 0;
- Laya.timer.frameLoop(1, this, this.MoveType4);
- }
- else if (this.thing.moveType == 7) {
- this.speed.x = this.thing.moveSpeed;
- this.speed.y = 0;
- this.speed.z = 0;
- Laya.timer.frameLoop(1, this, this.MoveType4);
- }
- else if (this.thing.moveType == 8) ;
- else if (this.thing.moveType == 9) ;
- }
- setup() {
- this.normalizeApe();
- this.makeRedApe();
- this.grayingApe();
- }
- normalizeApe() {
- var originalApe = this.createApe();
- this.apeTexture = Laya.loader.getRes(this.ApePath);
- originalApe.x = (Laya.stage.width - this.apeTexture.width * 3) / 2;
- originalApe.y = (Laya.stage.height - this.apeTexture.height) / 2;
- }
- makeRedApe() {
- var redMat = [
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- ];
- var redFilter = new ColorFilter(redMat);
- var redApe = this.createApe();
- redApe.filters = [redFilter];
- var firstChild = Laya.stage.getChildAt(0);
- redApe.x = firstChild.x + this.apeTexture.width;
- redApe.y = firstChild.y;
- }
- grayingApe() {
- 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];
- var grayscaleFilter = new ColorFilter(grayscaleMat);
- var grayApe = this.createApe();
- grayApe.filters = [grayscaleFilter];
- var secondChild = Laya.stage.getChildAt(1);
- grayApe.x = secondChild.x + this.apeTexture.width;
- grayApe.y = secondChild.y;
- }
- createApe() {
- var ape = new Sprite$3();
- ape.loadImage("res/apes/monkey2.png");
- Laya.stage.addChild(ape);
- return ape;
- }
- MoveType4() {
- this._transform.translate(this.speed);
- if (Math.abs(this._transform.localPositionX) >= GlobalParam.blockLRmoveMaxDis)
- this.speed.x = -this.speed.x;
- this.CheckRecover();
- }
- MoveType2() {
- this._transform.rotate(this.rotate);
- this.CheckRecover();
- }
- MoveType3() {
- this._transform.rotate(this.rotate);
- if (Math.abs(this._transform.localRotationEulerZ) >= 50)
- this.rotate.z = -this.rotate.z;
- this.CheckRecover();
- }
- Recover() {
- if (this.thing.type) {
- StreetManager.Instance.StreetResetCube(this.selfobj.id);
- }
- Laya.timer.clearAll(this);
- StreetManager.Instance.RecoverStreet(this.selfobj);
- GamePool.Instance.RecoverModel(this.selfobj);
- }
- CheckRecover() {
- if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
- console.log("回收block", this.selfobj.name);
- this.Recover();
- return;
- }
- }
- SetStreet(thing) {
- this.tran.localPositionZ = Number(thing.z);
- this.tran.localPositionX = Number(thing.x);
- this.tran.rotationEuler = MathTool.VecZero;
- this.thing = thing;
- if (!MainRoleManager.Instance.player)
- return;
- this.tarTran = MainRoleManager.Instance.player.transform;
- this.SetMoveType();
- }
- }
- var Input = Laya.Input;
- class GuideController {
- constructor() {
- this.guideonepos = new Laya.Vector3(2.5, 0, 59.4);
- this.guidetwoPos = new Laya.Vector3(-5, 2, 104.4);
- this.index = 0;
- this._guide = false;
- }
- static get Instance() {
- return this.instance || (this.instance = new GuideController());
- }
- GuideOn() {
- if (this._guide) {
- Laya.timer.once(500, this, this.Guide);
- }
- }
- Guide() {
- }
- GuideOff() {
- this._guide = false;
- ViewManager.Instance.CloseGuideView();
- }
- GameOver() {
- if (this._guide) {
- ViewManager.Instance.CloseGuideView();
- }
- }
- createInput() {
- var inputText = new Input();
- inputText.size(350, 100);
- inputText.x = Laya.stage.width - inputText.width >> 1;
- inputText.y = Laya.stage.height - inputText.height >> 1;
- inputText.text = "这段文本不可编辑,但可复制";
- inputText.editable = false;
- inputText.bold = true;
- inputText.bgColor = "#666666";
- inputText.color = "#ffffff";
- inputText.fontSize = 20;
- Laya.stage.addChild(inputText);
- }
- InitGuide(p) {
- if (this.index == 0) {
- this.guideonepos.z = p;
- this.index++;
- }
- else if (this.index == 1) {
- this.guidetwoPos.z = p;
- this.index++;
- }
- }
- RequireGuide() {
- let t = Laya.LocalStorage.getItem("guide");
- if (PlayerManager.Instance.stage == 1) {
- Laya.LocalStorage.setItem("guide", "1");
- this._guide = true;
- return true;
- }
- this._guide = false;
- return false;
- }
- }
- var Sprite$4 = Laya.Sprite;
- class RoadArr {
- constructor(blocks, blockPos) {
- this.blocks = blocks;
- this.blockPos = blockPos;
- }
- }
- class BlockArr {
- constructor(things, thingPos, blockHp) {
- this.things = things;
- this.thingPos = thingPos;
- this.blockHp = blockHp;
- }
- }
- class ThingArr {
- constructor(type, prrfabName, moveType, moveSpeed) {
- this.type = type;
- this.prrfabName = prrfabName;
- this.moveType = moveType;
- this.moveSpeed = moveSpeed;
- }
- }
- class StreetManager {
- constructor() {
- this.isover = false;
- this.curindex = 1;
- this.texture1 = "res/apes/monkey2.png";
- this.texture2 = "res/apes/monkey3.png";
- this.flag = false;
- this.blockDic = new Dictionary();
- this.cubeBlockDic = new Dictionary();
- }
- static get Instance() {
- return StreetManager.instance || (StreetManager.instance = new StreetManager());
- }
- Init(BlockContainer) {
- this.BlockContainer = BlockContainer;
- }
- SetBlock() {
- this.isover = false;
- this.curindex = 1;
- this.CreateStreet();
- }
- onAssetsLoaded() {
- this.ape = new Sprite$4();
- Laya.stage.addChild(this.ape);
- this.ape.pivot(55, 72);
- this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- this.switchTexture();
- this.ape.on("click", this, this.switchTexture);
- }
- switchTexture() {
- var textureUrl = (this.flag = !this.flag) ? this.texture1 : this.texture2;
- this.ape.graphics.clear();
- var texture = Laya.loader.getRes(textureUrl);
- this.ape.graphics.drawTexture(texture, 0, 0);
- this.ape.size(texture.width, texture.height);
- }
- CheckPlayerRoadPos(_zp) {
- if (this.isover)
- return;
- let d = this.tarDis - _zp;
- if (d > 0)
- return;
- this.StreetSwitch();
- }
- StreetSwitch() {
- this.curindex++;
- this.CreateStreet();
- }
- CreateSprite(road) {
- if (GuideController.Instance._guide) {
- GuideController.Instance.InitGuide(road.blockPos[0]);
- }
- let blocks = road.blocks;
- let blockPos = road.blockPos;
- let j = 0;
- for (let index = 0; index < blocks.length; index++) {
- const element = blocks[index];
- const p = blockPos[index];
- let things = element.things;
- let thingPos = element.thingPos;
- let blockHp = element.blockHp;
- let isr = blockHp.length > 1;
- for (let index = 0; index < things.length; index++) {
- const element1 = things[index];
- element1.z = p;
- element1.x = thingPos[index];
- element1.towerR = isr;
- element1.hp = blockHp[index];
- j++;
- Laya.timer.frameOnce(j, this, this.Create, [element1], false);
- }
- }
- }
- Create(thing) {
- if (thing.type == 1 || thing.type == 2) {
- MoundManager.Instance.MakeMound(thing);
- }
- else {
- let p = GamePool.Instance.GetModel(thing.prrfabName);
- if (!p)
- return;
- this.BlockContainer.addChild(p);
- let ts = p.getComponent(Street);
- if (!ts)
- ts = p.addComponent(Street);
- ts.SetStreet(thing);
- this.blockDic.set(p.id, ts);
- }
- }
- RecoverStreet(sp) {
- this.blockDic.delete(sp.id);
- }
- StreetAtkedCube(sp) {
- sp.active = false;
- ParticleManager.Instance.ExplodeEffect(sp.transform.position);
- }
- Reset() {
- this.isover = false;
- let arr = [];
- for (const key in this.blockDic.container) {
- arr.push(key);
- }
- let j = 1;
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.blockDic.get(element);
- if (s)
- s.Recover();
- if (this.cubeBlockDic.has(element)) {
- Laya.timer.frameOnce(j, this, this.StreetResetCube, [element], false);
- j++;
- }
- }
- }
- }
- StreetAddCube(sp) {
- if (this.cubeBlockDic.has(sp.id))
- return;
- this.cubeBlockDic.set(sp.id, sp);
- }
- StreetResetCube(id) {
- let sp = this.cubeBlockDic.get(id);
- this.cubeBlockDic.delete(id);
- if (!sp)
- return;
- console.log("回收CubeBlock,", sp.name);
- for (let index = 0; index < sp.numChildren; index++) {
- const element = sp.getChildAt(index);
- element.active = true;
- }
- }
- createApes() {
- var gap = 300;
- this.sp1 = new Sprite$4();
- this.sp1.pos((Laya.stage.width - gap) / 2, Laya.stage.height / 2);
- this.sp1.pivot(55, 72);
- Laya.stage.addChild(this.sp1);
- this.sp2 = new Sprite$4();
- this.sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2);
- Laya.stage.addChild(this.sp2);
- Laya.timer.frameLoop(1, this, this.animate);
- }
- animate(e) {
- this.sp1.rotation += 2;
- this.sp2.rotation += 2;
- }
- CreateStreet() {
- let road_list = LevelController.Instance._level.road_list;
- if (this.curindex > road_list.length - 1) {
- this.isover = true;
- console.log("没有障碍物了");
- return;
- }
- this.tarDis =
- this.curindex * GlobalParam.barrierRoadLength;
- let roadindex = road_list[this.curindex];
- if (roadindex == 0)
- return;
- let roads = NetInfoManager.Instance.GetRoad(roadindex);
- if (!roads)
- return;
- let blocks = GameTool.SpliteString(roads["blocks"]);
- let blockPoss = GameTool.SpliteString(roads["position"]);
- let bps = [];
- let d = GlobalParam.barrierRoadLength / GlobalParam.barrierRoadAverageNum;
- blockPoss.forEach(element => {
- bps.push(this.tarDis + element * d);
- });
- let bbs = [];
- blocks.forEach(element => {
- let thing = NetInfoManager.Instance.GetStreet(element);
- let tss = GameTool.SpliteString(thing["block_things"]);
- let tps = GameTool.SpliteString(thing["thing_position"]);
- let ths = GameTool.SpliteString(thing["block_hp"]);
- let ttt = [];
- tss.forEach(element1 => {
- let t = NetInfoManager.Instance.GetThing(element1);
- let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
- ttt.push(tt);
- });
- let things = new BlockArr(ttt, tps, ths);
- bbs.push(things);
- });
- let blockB = new RoadArr(bbs, bps);
- this.CreateSprite(blockB);
- }
- }
- var Vector3 = Laya.Vector3;
- var Quaternion = Laya.Quaternion;
- var Animation$1 = Laya.Animation;
- var Tween = Laya.Tween;
- class Opponent extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3(0, 1, 0);
- this.isArrive1 = false;
- this.phoenixWidth = 550;
- this.phoenixHeight = 400;
- this.bgColorTweener = new Tween();
- this.gradientInterval = 2000;
- this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.forW = MathTool.VecZero;
- this.speed = GlobalParam.enemySpeed;
- this.quaternion1 = new Quaternion();
- }
- Run() {
- if (this.isArrive1) {
- if (this.tarSp == null)
- return;
- if (!this.tarSp.active) {
- this.tarSp = RoleManager.Instance.GetTar();
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- }
- Vector3.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3.normalize(this.forW, this.forW);
- this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
- return;
- }
- Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- else {
- Vector3.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3.normalize(this.forW, this.forW);
- this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
- this.tarSp = RoleManager.Instance.GetTar();
- this.isArrive1 = true;
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- return;
- }
- Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- createPhoenixes() {
- var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight);
- var blendedPhoenix = this.createAnimation();
- blendedPhoenix.blendMode = "lighter";
- blendedPhoenix.scale(scaleFactor, scaleFactor);
- blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
- var normalPhoenix = this.createAnimation();
- normalPhoenix.scale(scaleFactor, scaleFactor);
- normalPhoenix.x = this.phoenixWidth * scaleFactor;
- normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
- }
- createAnimation() {
- var frames = [];
- var animation = new Animation$1();
- animation.loadImages(frames);
- Laya.stage.addChild(animation);
- var clips = animation.frames.concat();
- clips = clips.reverse();
- animation.frames = animation.frames.concat(clips);
- animation.play();
- return animation;
- }
- Recovery() {
- Laya.timer.clearAll(this);
- RoleManager.Instance.RecoverEnemy(this.selfobj);
- GamePool.Instance.RecoverModel(this.selfobj);
- }
- InitModel(tar, hp, cloth) {
- this.tarSp = tar;
- this.isArrive1 = false;
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- if (this.tarPos.x > 0) {
- this.tarPos = PlaneManager.Instance.toured1.clone();
- }
- else {
- this.tarPos = PlaneManager.Instance.toured2.clone();
- }
- this.hp = hp;
- Laya.timer.frameLoop(1, this, this.Run);
- }
- Injured(hitpos) {
- this.hp -= PlayerManager.bulletAttack;
- if (this.hp <= 0) {
- this.Dead();
- return;
- }
- ParticleManager.Instance.AttackEffect(hitpos);
- }
- Dead() {
- ParticleManager.Instance.BloodEffect(this.tran.position);
- this.Recovery();
- RoleManager.Instance.CheckGameOver();
- GameManager.Instance.roleCount++;
- }
- }
- var Sprite$5 = Laya.Sprite;
- class RoleManager {
- constructor() {
- this.frameCount = 10;
- this.enemyDic = new Dictionary();
- }
- static get Instance() {
- return this.instance || (this.instance = new RoleManager());
- }
- Create(hp, texture) {
- let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy);
- if (!e)
- return;
- MainRoleManager.Instance.playerContainer.addChild(e);
- e.transform.position = this.startPos.clone();
- let ps = e.getComponent(Opponent);
- if (!ps)
- ps = e.addComponent(Opponent);
- let sp = this.GetTar();
- ps.InitModel(sp, hp, texture);
- this.enemyDic.set(e.id, ps);
- }
- CheckGameOver() {
- if (this.enemyDic.size == 0) {
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.CreateOver();
- GameManager.Instance.Congratulate();
- }
- }
- GetOpponent() {
- for (const key in this.enemyDic.container) {
- const element = this.enemyDic.get(key);
- return element.selfobj;
- }
- return null;
- }
- Reset() {
- let arr = [];
- for (const key in this.enemyDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.enemyDic.get(element);
- if (s)
- s.Recovery();
- }
- }
- }
- CreateOpponent(startPos) {
- this.startPos = startPos;
- let count = LevelController.Instance._level.enemy;
- let hp = LevelController.Instance._level.enemy_hp;
- let texture = LevelController.Instance._level.enemy_cloth;
- for (let index = 0; index < count; index++) {
- let a = index;
- Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false);
- }
- }
- createCoralRect() {
- var coralRect = new Sprite$5();
- coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50");
- coralRect.name = "珊瑚色容器";
- coralRect.size(Laya.stage.width, Laya.stage.height / 2);
- Laya.stage.addChild(coralRect);
- }
- createDeepSkyblueRect() {
- var deepSkyblueRect = new Sprite$5();
- deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF");
- deepSkyblueRect.name = "天蓝色矩形";
- deepSkyblueRect.size(100, 100);
- deepSkyblueRect.pos(10, 10);
- Laya.stage.addChild(deepSkyblueRect);
- }
- GetTar() {
- let p = MainRoleManager.Instance.NearIsdead();
- if (!p) {
- if (Math.random() > 0.5) {
- return MainRoleManager.Instance.playerScript.body;
- }
- else {
- let s = MateManager.Instance.GetSprite();
- if (!s)
- return MainRoleManager.Instance.playerScript.body;
- else
- return s;
- }
- }
- else {
- let s = MateManager.Instance.GetSprite();
- if (!s)
- return null;
- else
- return s;
- }
- }
- RecoverEnemy(sp) {
- this.enemyDic.delete(sp.id);
- }
- }
- class GameManager {
- constructor() {
- this.towerCount = 0;
- this.roleCount = 0;
- this.blockCount = 0;
- }
- static get Instance() {
- return GameManager.instance || (GameManager.instance = new GameManager());
- }
- Start() {
- this.towerCount = 0;
- this.roleCount = 0;
- this.blockCount = 0;
- }
- Win() {
- WXSdk.LongVibrate();
- GameManager.WINORLOSE = true;
- if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) {
- ViewManager.Instance.AddView(ViewType.ExitView, true);
- }
- else {
- ViewManager.Instance.AddView(ViewType.CompleteView, true);
- }
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- RoleManager.Instance.Reset();
- }
- Congratulate(isglod = false) {
- MainRoleManager.Instance.GoToTiaoWu();
- if (isglod)
- MateManager.Instance.TiaoWu1();
- else
- MateManager.Instance.TiaoWu();
- CameraManager.Instance.SetCameraAction(CameraState.jump, 0.03);
- Laya.timer.once(4000, this, this.Win);
- }
- Over() {
- GuideController.Instance.GameOver();
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.CreateOver();
- MouseEvent.Instance._Switch = false;
- WXSdk.LongVibrate();
- GameManager.WINORLOSE = false;
- if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) {
- ViewManager.Instance.AddView(ViewType.ExitView, true);
- }
- else {
- ViewManager.Instance.AddView(ViewType.CompleteView, false);
- }
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- MainRoleManager.Instance.HidePlayer();
- RoleManager.Instance.Reset();
- }
- loadUI() {
- Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
- this.changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换Mesh"));
- this.changeActionButton.size(160, 40);
- this.changeActionButton.labelBold = true;
- this.changeActionButton.labelSize = 30;
- this.changeActionButton.sizeGrid = "4,4,4,4";
- this.changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
- this.changeActionButton.pos(Laya.stage.width / 2 - this.changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
- this.changeActionButton.on(Laya.Event.CLICK, this, function () {
- this.index++;
- if (this.index % 5 === 1) {
- this.sphere.meshFilter.sharedMesh = this.box;
- }
- else if (this.index % 5 === 2) {
- this.sphere.meshFilter.sharedMesh = this.capsule;
- }
- else if (this.index % 5 === 3) {
- this.sphere.meshFilter.sharedMesh = this.cylinder;
- }
- else if (this.index % 5 === 3) {
- this.sphere.meshFilter.sharedMesh = this.cone;
- }
- else {
- this.sphere.meshFilter.sharedMesh = this.sphereMesh;
- }
- });
- }));
- }
- Near() {
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- }
- ReStart() {
- MateManager.Instance.Reset();
- Scene3DManager.Instance.InItScene();
- DispatcherManager.event(EventType.Event.ShowMainUi);
- DispatcherManager.event(EventType.Event.SetStagePro, 0);
- }
- LevelUp() {
- PlayerManager.Instance.stage++;
- Scene3DManager.Instance.InItScene();
- ViewManager.Instance.CloseView(ViewType.CompleteView);
- DispatcherManager.event(EventType.Event.ShowMainUi);
- DispatcherManager.event(EventType.Event.SetStage);
- DispatcherManager.event(EventType.Event.SetStagePro, 0);
- }
- }
- GameManager.GameNum = 0;
- GameManager.WINORLOSE = false;
- GameManager.GameCount = 0;
- class Mound extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.guideSteps = [
- { x: 151, y: 575, radius: 150, tip: "res/guide/help6.png", tipx: 200, tipy: 250 },
- { x: 883, y: 620, radius: 100, tip: "res/guide/help4.png", tipx: 730, tipy: 380 },
- { x: 1128, y: 583, radius: 110, tip: "res/guide/help3.png", tipx: 900, tipy: 300 }
- ];
- this.guideStep = 0;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
- this.HealthText = this.selfobj.getChildByName("HealthText").transform;
- let we = this.selfobj.getChildByName("WallsEnd");
- this.WallsEnd = we.transform;
- this._reflect = we.getChildAt(0).meshRenderer.material;
- }
- HpUi() {
- let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
- if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
- this.hpText.visible = false;
- else {
- if (!this.hpText.visible)
- this.hpText.visible = true;
- this.hpText.x = p.x;
- this.hpText.y = p.y;
- }
- }
- CheckHp() {
- if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
- this.Recovery();
- return;
- }
- this.HpUi();
- }
- nextStep() {
- if (this.guideStep == this.guideSteps.length) {
- Laya.stage.removeChild(this.guideContainer);
- Laya.stage.removeChild(this.tipContainer);
- }
- else {
- var step = this.guideSteps[this.guideStep++];
- this.hitArea.unHit.clear();
- this.hitArea.unHit.drawCircle(step.x, step.y, step.radius, "#000000");
- this.interactionArea.graphics.clear();
- this.interactionArea.graphics.drawCircle(step.x, step.y, step.radius, "#000000");
- this.tipContainer.graphics.clear();
- this.tipContainer.loadImage(step.tip);
- this.tipContainer.pos(step.tipx, step.tipy);
- }
- }
- MakeMate() {
- this._mate = MateManager.Instance.MadeMate(this.FriendSpawnPoint);
- }
- Rescue() {
- if (this._mate) {
- this._mate.FallDown();
- this._mate = null;
- }
- }
- ReflectSet() {
- this._reflect.albedoIntensity = 4;
- Laya.timer.once(100, this, () => {
- this._reflect.albedoIntensity = 1;
- });
- }
- Recovery() {
- Laya.timer.clearAll(this);
- if (this.hpText) {
- GamePool.Instance.RecoverUi(PoolType.HpText, this.hpText);
- this.hpText = null;
- }
- this._reflect.albedoIntensity = 1;
- MoundManager.Instance.RecoverMound(this.selfobj);
- GamePool.Instance.RecoverModel(this.selfobj);
- if (this._mate) {
- this._mate.Recover();
- this._mate = null;
- }
- }
- Injured(hitpos) {
- this._hp -= PlayerManager.bulletAttack;
- if (this._hp <= 0) {
- this.Rescue();
- ParticleManager.Instance.ExplodeEffect(this.tran.position);
- this.Recovery();
- GameManager.Instance.towerCount++;
- return;
- }
- ParticleManager.Instance.AttackEffect(hitpos);
- let t = Math.ceil(this._hp);
- this.hpText.text = t.toString();
- this.ReflectSet();
- }
- SetMound(data) {
- this._mate = null;
- this.tarTran = MainRoleManager.Instance.player.transform;
- this.tran.localPositionX = data.x;
- this.tran.localPositionY = 0;
- this.tran.localPositionZ = data.z;
- if (data.towerR)
- this.WallsEnd.localRotationEulerY = 30;
- else
- this.WallsEnd.localRotationEulerY = 0;
- if (data.type == 1) {
- this.MakeMate();
- }
- this._hp = data.hp;
- if (!this.hpText) {
- this.hpText = MoundManager.Instance.HpUi();
- this.hpText.text = this._hp.toString();
- if (!this._camera)
- this._camera = CameraManager.Instance._maincamera;
- ViewManager.Instance.popNode.addChild(this.hpText);
- }
- this.HpUi();
- Laya.timer.frameLoop(1, this, this.CheckHp);
- }
- }
- var Vector3$1 = Laya.Vector3;
- var Sprite$6 = Laya.Sprite;
- class MainRoleShot extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.speed = MathTool.VecZero;
- this._forward = new Vector3$1(0, 0, 1);
- this.over = false;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.speed.z = GlobalParam.shootspeed;
- }
- Run() {
- this.tran.translate(this.speed);
- let d = Vector3$1.distance(this.tarTran.position, this.tran.position);
- if (d >= GlobalParam.bulletMaxDis) {
- this.RecoverBullet();
- return;
- }
- this.RayReset();
- }
- RecoverBullet() {
- Laya.timer.clearAll(this);
- GamePool.Instance.RecoverModel(this.selfobj);
- GamePool.bulletCount--;
- }
- drawSomething() {
- this.sp = new Sprite$6();
- Laya.stage.addChild(this.sp);
- this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
- this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
- 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);
- this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
- this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
- this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
- this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
- this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
- 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" });
- }
- RayReset() {
- let origP = this.rayPoint.position.clone();
- if (!this._scene) {
- this._scene = Scene3DManager.Instance.MainScene;
- }
- if (!this.ray) {
- if (!this.forward)
- this.forward = MathTool.VecZero;
- this.ray = new Laya.Ray(MathTool.VecZero, this._forward);
- this.outHit = new Laya.HitResult();
- }
- this.ray.origin = origP;
- if (this.over) {
- this.tran.getForward(this.forward);
- this.forward.x = -this.forward.x;
- this.forward.y = -this.forward.y;
- this.forward.z = -this.forward.z;
- this.ray.direction = this.forward;
- }
- else {
- this.ray.direction = this._forward;
- }
- let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength);
- if (isHItF) {
- let obj = this.outHit.collider.owner;
- if (obj.layer == ColliderGroup.mound) {
- let tower = obj.getComponent(Mound);
- if (tower) {
- tower.Injured(this.outHit.point);
- }
- }
- else if (obj.layer == ColliderGroup.opponent) {
- let tower = obj.getComponent(Opponent);
- if (tower) {
- tower.Injured(this.outHit.point);
- }
- }
- else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
- StreetManager.Instance.StreetAtkedCube(obj);
- GameManager.Instance.blockCount++;
- }
- else {
- ParticleManager.Instance.AttackEffect(this.outHit.point);
- }
- this.RecoverBullet();
- return;
- }
- }
- Start(tarTran, isover = false) {
- this.tarTran = tarTran;
- this.over = isover;
- Laya.timer.frameLoop(1, this, this.Run);
- }
- }
- var Vector3$2 = Laya.Vector3;
- var Quaternion$1 = Laya.Quaternion;
- var Sprite$7 = Laya.Sprite;
- var Text$2 = Laya.Text;
- class Mate extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3$2(0, 1, 0);
- this.isreturn = false;
- this.isover = false;
- this.isClickCom = true;
- this.isStop = true;
- this.texture1 = "res/apes/monkey2.png";
- this.texture2 = "res/apes/monkey3.png";
- this.flag = false;
- this.isFristShoot = true;
- this.ts = new Vector3$2(0, 0, 0.01);
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
- this.forW = MathTool.VecZero;
- this.speed = GlobalParam.matespeed;
- this.quaternion1 = new Quaternion$1();
- }
- setup() {
- var textBox = new Sprite$7();
- var text;
- for (var i = 0; i < 1000; i++) {
- text = new Text$2();
- text.fontSize = 20;
- text.text = (Math.random() * 100).toFixed(0);
- text.rotation = Math.random() * 360;
- text.color = "#CCCCCC";
- text.x = Math.random() * Laya.stage.width;
- text.y = Math.random() * Laya.stage.height;
- textBox.addChild(text);
- }
- textBox.cacheAs = "bitmap";
- Laya.stage.addChild(textBox);
- }
- TrialAdd(dataPar) {
- this.AnimatorPlayByType(MusicType.Idle, 1);
- this.dataPar = dataPar;
- this.dataPar["ishave"] = true;
- this.isClickCom = true;
- this.isStop = true;
- this.isreturn = true;
- this.isover = false;
- MateManager.Instance.AddModelToDic(this.selfobj.id, this);
- this.ShootFunc();
- if (MainRoleManager.Instance.IsShoot())
- this.CreateShoot();
- Laya.timer.frameLoop(1, this, this.Move);
- }
- SetTar() {
- this.isreturn = false;
- this.isClickCom = true;
- this.isStop = true;
- this.isover = false;
- this.AnimatorPlayByType(MusicType.Idle, 1);
- DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
- }
- FallDown() {
- let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- let dataPar = MainRoleManager.Instance.GetMatePos();
- if (!dataPar) {
- console.warn("friendPar没有位置了");
- return;
- }
- this.dataPar = dataPar;
- this.dataPar["ishave"] = true;
- this.tar = this.dataPar["sp"];
- this.tarTra = this.tar.transform;
- tween.clear();
- this.Start();
- }, null, false));
- }
- Start() {
- this.AnimatorPlayByType(MusicType.RunAndGun, 2);
- this.isreturn = false;
- this.isClickCom = true;
- this.isStop = true;
- this.isover = false;
- Laya.timer.frameLoop(1, this, this.Move);
- }
- ArriveTarPos() {
- this.isClickCom = true;
- this.isStop = true;
- this.isreturn = true;
- this.tar.addChild(this.selfobj);
- this.tran.localPosition = MathTool.VecZero;
- this.AnimatorPlayByType(MusicType.RunAndGun, 2);
- MateManager.Instance.AddModelToDic(this.selfobj.id, this);
- let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- this.tran.localRotationEuler = MathTool.VecZero;
- this.ShootFunc();
- this.CreateShoot();
- }, null, false));
- }
- RayReset() {
- let origP = this.rayPoint.position;
- if (!this._scene) {
- this._scene = Scene3DManager.Instance.MainScene;
- }
- if (!this.rayF) {
- this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$2(0, 0, 1));
- this.outHitF = new Laya.HitResult();
- }
- this.rayF.origin = origP;
- let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
- if (isHItF) {
- let obj = this.outHitF.collider.owner;
- this.Dead(this.outHitF.point);
- return;
- }
- if (!this.rayL) {
- this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$2(1, 0, 0));
- this.outHitL = new Laya.HitResult();
- }
- this.rayL.origin = origP;
- let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
- if (isHItL) {
- let obj = this.outHitL.collider.owner;
- this.Dead(this.outHitL.point);
- return;
- }
- if (!this.rayR) {
- this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$2(-1, 0, 0));
- this.outHitR = new Laya.HitResult();
- }
- this.rayR.origin = origP;
- let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
- if (isHItR) {
- let obj = this.outHitR.collider.owner;
- this.Dead(this.outHitR.point);
- return;
- }
- }
- createApes() {
- this.ape1 = new Sprite$7();
- this.ape2 = new Sprite$7();
- this.ape1.loadImage("res/apes/monkey2.png");
- this.ape2.loadImage("res/apes/monkey2.png");
- this.ape1.pivot(55, 72);
- this.ape2.pivot(55, 72);
- this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- this.ape2.pos(200, 0);
- Laya.stage.addChild(this.ape1);
- this.ape1.addChild(this.ape2);
- Laya.timer.frameLoop(1, this, this.animate);
- }
- animate(e) {
- this.ape1.rotation += 2;
- this.ape2.rotation -= 4;
- }
- Move() {
- if (this.isreturn) {
- this.RayReset();
- return;
- }
- let tarPos = this.tarTra.position.clone();
- Vector3$2.subtract(tarPos, this.tran.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$2.distance(this.tran.position, tarPos) < 0.1) {
- this.ArriveTarPos();
- return;
- }
- Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- AnimatorPlayByType(clip, speed, callback) {
- this.animator.play(clip);
- if (!speed)
- speed = 1;
- this.animator.speed = speed;
- }
- ShootFunc() {
- DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
- }
- LoopCreate() {
- if (this.isStop) {
- Laya.timer.clear(this, this.LoopCreate);
- this.isClickCom = true;
- return;
- }
- this._CreateShoot();
- }
- CreateShoot() {
- this.isStop = false;
- if (!this.isClickCom)
- return;
- this.isClickCom = false;
- this._CreateShoot();
- Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
- }
- _CreateShoot() {
- let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
- if (bu) {
- Scene3DManager.Instance.bulletCon.addChild(bu);
- bu.transform.position = this.bulletPos.position.clone();
- bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
- let pb = bu.getComponent(MainRoleShot);
- if (!pb)
- pb = bu.addComponent(MainRoleShot);
- pb.Start(this.bulletPos, this.isover);
- }
- }
- StopCreate() {
- this.isStop = true;
- }
- Dead(pos) {
- if (this.dataPar)
- this.dataPar["ishave"] = false;
- ParticleManager.Instance.BloodEffect(pos);
- MateManager.Instance.RemoveModelToDic(this.selfobj);
- this.Recover();
- MainRoleManager.Instance.CheckGameOver();
- }
- SetPar() {
- let t = this.tran.position.clone();
- MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
- this.tran.position = t.clone();
- }
- TiaoWu(sp) {
- this.AnimatorPlayByType(MusicType.RunAndGun, 2);
- this.danceP = sp.position.clone();
- this.r = sp.rotationEuler.clone();
- Laya.timer.frameLoop(1, this, this._TiaoWu);
- }
- _TiaoWu() {
- Vector3$2.subtract(this.danceP, this.tran.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW);
- if (Vector3$2.distance(this.tran.position, this.danceP) < 0.15) {
- Laya.timer.clear(this, this._TiaoWu);
- this.tran.position = this.danceP.clone();
- this.tran.rotationEuler = this.r.clone();
- this.AnimatorPlayByType(MusicType.Dance, 1);
- return;
- }
- Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- onAssetsLoaded() {
- this.ape = new Sprite$7();
- Laya.stage.addChild(this.ape);
- this.ape.pivot(55, 72);
- this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- }
- Attack() {
- Laya.timer.clear(this, this._Defense);
- this.isover = true;
- this.isFristShoot = true;
- this.enemyTar = null;
- Laya.timer.frameLoop(1, this, this._attack);
- }
- _attack() {
- if (this.enemyTar == null) {
- this.enemyTar = RoleManager.Instance.GetOpponent();
- if (this.enemyTar != null) {
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- else {
- if (!this.enemyTar.active) {
- this.enemyTar = RoleManager.Instance.GetOpponent();
- if (this.enemyTar != null) {
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- if (this.enemyTar == null) {
- this.StopCreate();
- this.isFristShoot = true;
- return;
- }
- if (this.isFristShoot) {
- this.isFristShoot = false;
- this.CreateShoot();
- }
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- _Defense() {
- Vector3$2.subtract(this.tp, this.tran.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW, false);
- if (Vector3$2.distance(this.tran.position, this.tp) < 0.1) {
- Laya.timer.clear(this, this._Defense);
- let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- }, null, false));
- return;
- }
- Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- Defense(pos) {
- this.SetPar();
- this.tp = pos;
- Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- this.AnimatorPlayByType(MusicType.CrouchFiring, 1);
- Laya.timer.frameLoop(1, this, this._Defense);
- }
- Recover() {
- if (this.dataPar) {
- this.dataPar["ishave"] = false;
- this.dataPar = null;
- }
- MateManager.Instance.RecoverMateModel(this.selfobj);
- MateManager.Instance.RemoveModelToDic(this.selfobj);
- Laya.timer.clearAll(this);
- Laya.Tween.clearAll(this);
- DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
- GamePool.Instance.RecoverModel(this.selfobj);
- }
- }
- var Rectangle$1 = Laya.Rectangle;
- class MateManager {
- constructor() {
- this.ApePath = "res/apes/monkey2.png";
- this.v3 = MathTool.VecZero;
- this.friendDic = new Dictionary();
- this.getDic = new Dictionary();
- }
- static get Instance() {
- return this.instance || (this.instance = new MateManager());
- }
- Trial() {
- for (let index = 0; index < 3; index++) {
- Laya.timer.frameOnce(index, this, this._createtrialmodel, null, false);
- }
- }
- TrialModelPlayAni() {
- for (const key in this.friendDic.container) {
- const element = this.friendDic.get(key);
- element.CreateShoot();
- element.AnimatorPlayByType(MusicType.RunAndGun, 2);
- }
- }
- RecoverMateModel(sp) {
- this.friendDic.delete(sp.id);
- }
- AddModelToDic(id, fr) {
- this.getDic.set(id, fr);
- }
- RemoveModelToDic(sp) {
- this.getDic.delete(sp.id);
- }
- MadeMate(tra) {
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
- if (p) {
- p.transform.position = tra.position.clone();
- p.transform.rotationEuler = tra.rotationEuler.clone();
- MainRoleManager.Instance.playerContainer.addChild(p);
- let ps = p.getComponent(Mate);
- if (!ps)
- ps = p.addComponent(Mate);
- ps.SetTar();
- this.friendDic.set(p.id, ps);
- return ps;
- }
- return null;
- }
- showDragRegion() {
- var dragWidthLimit = 350;
- var dragHeightLimit = 200;
- this.dragRegion = new Rectangle$1(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dragHeightLimit >> 1, dragWidthLimit, dragHeightLimit);
- Laya.stage.graphics.drawRect(this.dragRegion.x, this.dragRegion.y, this.dragRegion.width, this.dragRegion.height, null, "#FFFFFF", 2);
- }
- onStartDrag(e) {
- this.ape.startDrag(this.dragRegion, true, 100);
- }
- NearDestination() {
- return this.getDic.size;
- }
- Near(count, zs) {
- if (count == 1) {
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- this.v3.x = 0;
- element.Defense(this.v3.clone());
- }
- return;
- }
- let len = 2 * GlobalParam.arriveStandWidth;
- let avr = len / (count - 1);
- let index = 0;
- this.v3.z = zs;
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- this.v3.x = GlobalParam.arriveStandWidth - index * avr;
- element.Defense(this.v3.clone());
- index++;
- }
- }
- Attack() {
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- element.Attack();
- }
- }
- GetSprite() {
- let count = this.getDic.size;
- let a = GameTool.randomInt(1, count);
- let tindex = 1;
- for (const key in this.getDic.container) {
- if (tindex == a) {
- const element = this.getDic.get(key);
- return element.selfobj;
- }
- tindex++;
- }
- return null;
- }
- TiaoWu() {
- for (const key in this.getDic.container) {
- let t = PlaneManager.Instance.GetWuDaoPosition();
- if (!t)
- return;
- const element = this.getDic.get(key);
- element.TiaoWu(t);
- }
- }
- Reset() {
- let arr = [];
- for (const key in this.friendDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.friendDic.get(element);
- if (s)
- s.Recover();
- }
- }
- console.log("this.friendDic.size", this.friendDic.size);
- this.getDic.clear();
- }
- TiaoWu1() {
- for (const key in this.getDic.container) {
- let t = PlaneManager.Instance.GetWuDaoPosition();
- const element = this.getDic.get(key);
- element.SetPar();
- if (t) {
- element.TiaoWu(t);
- }
- }
- }
- _createtrialmodel() {
- let dataPar = MainRoleManager.Instance.GetMatePos();
- if (!dataPar) {
- console.warn("friendPar没有位置了");
- return;
- }
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
- if (p) {
- let tar = dataPar["sp"];
- tar.addChild(p);
- p.transform.localPosition = MathTool.VecZero;
- p.transform.localRotationEuler = MathTool.VecZero;
- let ps = p.getComponent(Mate);
- if (!ps)
- ps = p.addComponent(Mate);
- ps.TrialAdd(dataPar);
- this.friendDic.set(p.id, ps);
- }
- }
- }
- var Sprite$8 = Laya.Sprite;
- var Text$3 = Laya.Text;
- class PlaneManager {
- constructor() {
- this.airisshow = false;
- this.danceindex = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new PlaneManager());
- }
- Init(finalP) {
- if (!finalP) {
- console.error("飞机不存在");
- return;
- }
- this.finalTra = finalP.transform;
- this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
- this.FinalBlock = finalP.getChildAt(0);
- this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
- this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
- this.helicopter = this.FinalBlock.getChildByName("helicopter");
- this.toured = this.FinalBlock.getChildByName("toured").transform;
- this.FinalBlock.active = false;
- }
- SetAir() {
- this.danceindex = 0;
- this.airisshow = false;
- this.FinalBlock.active = false;
- let count = LevelController.Instance._level.road_list.length;
- this.winPos = (count) * GlobalParam.barrierRoadLength;
- this.finalTra.localPositionZ = this.winPos;
- this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
- let isgold = LevelController.Instance._level.isgold;
- this.helicopter.active = isgold;
- this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
- this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
- }
- createDarkOrchidRect() {
- var darkOrchidRect = new Sprite$8();
- darkOrchidRect.name = "暗紫色矩形容器";
- darkOrchidRect.graphics.drawRect(-100, -100, 200, 200, "#9932CC");
- darkOrchidRect.pos(Laya.stage.width / 2, Laya.stage.height / 2);
- Laya.stage.addChild(darkOrchidRect);
- darkOrchidRect.mouseThrough = true;
- }
- createLogger() {
- this.logger = new Text$3();
- this.logger.size(Laya.stage.width, Laya.stage.height);
- this.logger.align = 'right';
- this.logger.fontSize = 20;
- this.logger.color = "#FFFFFF";
- Laya.stage.addChild(this.logger);
- }
- CheckPlayerRoadPos(_zp) {
- let d = this.winPos - _zp;
- if (d <= 60 && !this.airisshow) {
- this.ShowAir();
- return;
- }
- DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
- if (d <= 0) {
- this.NearDestination();
- }
- }
- ShowAir() {
- this.airisshow = true;
- this.FinalBlock.active = true;
- }
- NearDestination() {
- MainRoleManager.Instance.Destination();
- if (LevelController.Instance._level.isgold) {
- GameManager.Instance.Congratulate(true);
- }
- else {
- let count = 0;
- let isdesd = MainRoleManager.Instance.NearIsdead();
- if (!isdesd) {
- count++;
- }
- let num = MateManager.Instance.NearDestination();
- count += num;
- if (count == 0)
- return;
- MateManager.Instance.Near(count, this.toured.position.z);
- if (!isdesd)
- MainRoleManager.Instance.Near(count, this.toured.position.z);
- Laya.timer.once(1300, this, this.CreateOpponent);
- }
- }
- CreateOpponent() {
- MainRoleManager.Instance.Attack();
- MateManager.Instance.Attack();
- RoleManager.Instance.CreateOpponent(this.EnemySpawnPoint.position.clone());
- }
- GetWuDaoPosition() {
- if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
- return null;
- let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
- this.danceindex++;
- return t;
- }
- }
- var Vector3$3 = Laya.Vector3;
- var Quaternion$2 = Laya.Quaternion;
- var Sprite$9 = Laya.Sprite;
- class MainRole extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.isarrive = false;
- this.isdead = false;
- this.isFristShoot = true;
- this._up = new Vector3$3(0, 1, 0);
- this.ts = new Vector3$3(0, 0, 0.01);
- }
- onAwake() {
- this.selfobj = this.owner;
- this._transform = this.selfobj.transform;
- this.body = this.selfobj.getChildAt(0);
- this.animator = this.body.getComponent(Laya.Animator);
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.shootPos = this.selfobj.getChildByName("bulletPos").transform;
- this._speed = MathTool.VecZero;
- this._speed.z = GlobalParam.playerspeed;
- this.forW = MathTool.VecZero;
- this.quaternion1 = new Quaternion$2();
- }
- Move() {
- if (this.isarrive) {
- if (this.isdead)
- return;
- this.RayReset();
- return;
- }
- this._transform.translate(this._speed);
- let pz = this._transform.localPositionZ;
- ConstructManager.Instance.CheckMainRolePos(pz);
- PlaneManager.Instance.CheckPlayerRoadPos(pz);
- StreetManager.Instance.CheckPlayerRoadPos(pz);
- CameraManager.Instance.CameraFollow(pz);
- if (this.isdead)
- return;
- this.RayReset();
- }
- Near() {
- this.isarrive = true;
- }
- Start() {
- this.isdead = false;
- this.isarrive = false;
- Laya.timer.frameLoop(1, this, this.Move);
- }
- drawPentagram() {
- var canvas = new Sprite$9();
- Laya.stage.addChild(canvas);
- var path = [];
- path.push(0, -130);
- path.push(33, -33);
- path.push(137, -30);
- path.push(55, 32);
- path.push(85, 130);
- path.push(0, 73);
- path.push(-85, 130);
- path.push(-55, 32);
- path.push(-137, -30);
- path.push(-33, -33);
- canvas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50");
- }
- PlayAni(clip, speed, callback) {
- this.animator.play(clip);
- if (!speed)
- speed = 1;
- this.animator.speed = speed;
- }
- Slider(x) {
- this._transform.localPositionX += x;
- let px = this._transform.localPositionX;
- let abs = Math.abs(px);
- if (abs > GlobalParam.playerMoveMaxX) {
- if (px > 0)
- this._transform.localPositionX = GlobalParam.playerMoveMaxX;
- else
- this._transform.localPositionX = -GlobalParam.playerMoveMaxX;
- }
- }
- CreateBullet() {
- if (this.isdead)
- return null;
- return this.shootPos;
- }
- Dead(pos) {
- this.isdead = true;
- this.body.active = false;
- ParticleManager.Instance.BloodEffect(pos);
- MainRoleManager.Instance.CheckGameOver(true);
- }
- Reset() {
- this.body.active = true;
- this.PlayAni(MusicType.Idle, 1);
- Laya.timer.clearAll(this);
- }
- RayReset() {
- let origP = this.rayPoint.position;
- if (!this._scene) {
- this._scene = Scene3DManager.Instance.MainScene;
- }
- if (!this.rayF) {
- this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$3(0, 0, 1));
- this.outHitF = new Laya.HitResult();
- }
- this.rayF.origin = origP;
- let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
- if (isHItF) {
- let obj = this.outHitF.collider.owner;
- this.Dead(this.outHitF.point);
- return;
- }
- if (!this.rayL) {
- this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$3(1, 0, 0));
- this.outHitL = new Laya.HitResult();
- }
- this.rayL.origin = origP;
- let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
- if (isHItL) {
- let obj = this.outHitL.collider.owner;
- this.Dead(this.outHitL.point);
- return;
- }
- if (!this.rayR) {
- this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$3(-1, 0, 0));
- this.outHitR = new Laya.HitResult();
- }
- this.rayR.origin = origP;
- let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
- if (isHItR) {
- let obj = this.outHitR.collider.owner;
- this.Dead(this.outHitR.point);
- return;
- }
- }
- setup() {
- var bg = new Sprite$9();
- bg.loadImage("res/bg2.png");
- Laya.stage.addChild(bg);
- this.bg2 = new Sprite$9();
- this.bg2.loadImage("res/bg2.png");
- Laya.stage.addChild(this.bg2);
- this.bg2.scale(3, 3);
- this.maskSp = new Sprite$9();
- this.maskSp.loadImage("res/mask.png");
- this.maskSp.pivot(50, 50);
- this.bg2.mask = this.maskSp;
- }
- _attack() {
- if (this.isdead)
- return;
- if (this.enemyTar == null) {
- this.enemyTar = RoleManager.Instance.GetOpponent();
- if (this.enemyTar != null) {
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- }
- }
- else {
- if (!this.enemyTar.active) {
- this.enemyTar = RoleManager.Instance.GetOpponent();
- if (this.enemyTar != null) {
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- }
- }
- if (this.enemyTar == null) {
- MainRoleManager.Instance.CreateOver(true);
- this.isFristShoot = true;
- return;
- }
- if (this.isFristShoot) {
- this.isFristShoot = false;
- MainRoleManager.Instance.CreateShoot(true);
- }
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- }
- }
- TiaoWu(sp) {
- this.PlayAni(MusicType.RunAndGun, 2);
- this.dancepos = sp.position.clone();
- this.r = sp.rotationEuler.clone();
- Laya.timer.frameLoop(1, this, this.PlayWuDao);
- }
- PlayWuDao() {
- Vector3$3.subtract(this.dancepos, this._transform.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._transform.translate(this.forW);
- if (Vector3$3.distance(this._transform.position, this.dancepos) < 0.15) {
- Laya.timer.clear(this, this.PlayWuDao);
- this._transform.position = this.dancepos.clone();
- this._transform.rotationEuler = this.r.clone();
- this.PlayAni(MusicType.Dance, 1);
- return;
- }
- Quaternion$2.lookAt(this.dancepos, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- }
- Defense(pos) {
- if (this.isdead)
- return;
- this.tp = pos;
- Quaternion$2.lookAt(pos, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- this.PlayAni(MusicType.CrouchFiring, 1);
- Laya.timer.frameLoop(1, this, this._Defense);
- }
- _Defense() {
- Vector3$3.subtract(this.tp, this._transform.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._transform.translate(this.forW);
- if (Vector3$3.distance(this._transform.position, this.tp) < 0.1) {
- Laya.timer.clear(this, this._Defense);
- return;
- }
- Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._transform.rotation = this.quaternion1.clone();
- }
- Attack() {
- Laya.timer.clear(this, this._Defense);
- this.isFristShoot = true;
- this.enemyTar = null;
- Laya.timer.frameLoop(1, this, this._attack);
- }
- }
- var Vector3$4 = Laya.Vector3;
- var Text$4 = Laya.Text;
- var HScrollBar = Laya.HScrollBar;
- var VScrollBar = Laya.VScrollBar;
- class MainRoleManager {
- constructor() {
- this.isover = false;
- this.isClickCom = true;
- this.isend = true;
- }
- static get Instance() {
- return this.instance || (this.instance = new MainRoleManager());
- }
- Init(startPos, playerCon) {
- this.playerStartTra = startPos.transform;
- this.playerContainer = playerCon;
- }
- ChangeModel() {
- if (this.player)
- GamePool.Instance.RecoverModel(this.player);
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
- if (p) {
- this.player = p;
- this.SetMatePos(p);
- this.playerTra = this.player.transform;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerContainer.addChild(this.player);
- let ps = this.player.getComponent(MainRole);
- if (ps)
- this.playerScript = ps;
- else
- this.playerScript = this.player.addComponent(MainRole);
- }
- }
- SetMatePos(player) {
- this.MateArrPosition = [];
- let par = player.getChildByName("FriendSpawPos");
- if (!par)
- console.error("friend父物体不存在");
- for (let index = 0; index < par.numChildren; index++) {
- let data = {};
- data["ishave"] = false;
- data["sp"] = par.getChildAt(index);
- this.MateArrPosition.push(data);
- }
- }
- GetMatePos() {
- for (let index = 0; index < this.MateArrPosition.length; index++) {
- const element = this.MateArrPosition[index];
- if (!element["ishave"])
- return element;
- }
- return null;
- }
- createTexts() {
- var t1 = this.createText();
- t1.overflow = Text$4.VISIBLE;
- t1.pos(10, 10);
- var t2 = this.createText();
- t2.overflow = Text$4.SCROLL;
- t2.pos(10, 110);
- var t3 = this.createText();
- t3.overflow = Text$4.HIDDEN;
- t3.pos(10, 210);
- }
- createText() {
- var txt = new Text$4();
- txt.text =
- "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
- "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
- "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!";
- txt.borderColor = "#FFFF00";
- txt.size(300, 50);
- txt.fontSize = 20;
- txt.color = "#ffffff";
- Laya.stage.addChild(txt);
- return txt;
- }
- PlayerSlip(offsetX) {
- let x = offsetX.toFixed(2);
- let x1 = Number(x) * GlobalParam.sliderFactor;
- if (this.playerScript)
- this.playerScript.Slider(x1);
- }
- CreateOver(isgameover = false) {
- this.isend = true;
- if (!isgameover)
- DispatcherManager.event(EventType.Event.StopShot);
- }
- IsShoot() {
- return !this.isend;
- }
- Destination() {
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.CreateOver();
- MouseEvent.Instance._Switch = false;
- GameManager.Instance.Near();
- if (!this.playerScript)
- return;
- this.playerScript.Near();
- }
- NearIsdead() {
- if (!this.playerScript)
- return true;
- return this.playerScript.isdead;
- }
- Near(count, z) {
- if (!this.playerScript)
- return;
- if (count == 1) {
- this.playerScript.Defense(new Vector3$4(0, 0, z));
- }
- else {
- this.playerScript.Defense(new Vector3$4(-GlobalParam.arriveStandWidth, 0, z));
- }
- }
- Attack() {
- if (!this.playerScript)
- return;
- this.isover = true;
- this.playerScript.Attack();
- }
- CreateShoot(isgameover = false) {
- if (!this.playerScript)
- return;
- this.isend = false;
- if (!this.isClickCom)
- return;
- console.log("开始创建子弹");
- this.isClickCom = false;
- this._CreateShoot();
- Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this._Loop);
- }
- _Loop() {
- if (this.isend) {
- Laya.timer.clear(this, this._Loop);
- this.isClickCom = true;
- return;
- }
- this._CreateShoot();
- }
- _CreateShoot() {
- WXSdk.ShortVibrate();
- SettingController.Instance.PlaySound(SoundType.hit);
- let bulletPos = this.playerScript.CreateBullet();
- if (bulletPos == null)
- return;
- let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
- if (bu) {
- Scene3DManager.Instance.bulletCon.addChild(bu);
- bu.transform.position = bulletPos.position.clone();
- bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
- let pb = bu.getComponent(MainRoleShot);
- if (!pb)
- pb = bu.addComponent(MainRoleShot);
- pb.Start(bulletPos, this.isover);
- }
- }
- CheckGameOver(isplayer) {
- if (isplayer) {
- let count = MateManager.Instance.NearDestination();
- if (count == 0) {
- this.playerScript.Near();
- GameManager.Instance.Over();
- }
- }
- else {
- let count = MateManager.Instance.NearDestination();
- if (count == 0) {
- let isplayerdead = this.playerScript.isdead;
- if (isplayerdead) {
- this.playerScript.Near();
- GameManager.Instance.Over();
- }
- }
- }
- }
- GoToTiaoWu() {
- if (!this.playerScript)
- return;
- let t = PlaneManager.Instance.GetWuDaoPosition();
- if (!t)
- return;
- this.playerScript.TiaoWu(t);
- }
- Reset() {
- for (let index = 0; index < this.MateArrPosition.length; index++) {
- const element = this.MateArrPosition[index];
- element["ishave"] = false;
- }
- this.isover = false;
- if (!this.playerScript)
- return;
- this.playerScript.Reset();
- }
- HidePlayer() {
- if (this.player)
- this.player.active = false;
- }
- onSkinLoadComplete() {
- this.placeHScroller();
- this.placeVScroller();
- }
- placeHScroller() {
- var hs = new HScrollBar();
- hs.skin = "res/ui/hscroll.png";
- hs.width = 300;
- hs.pos(50, 170);
- hs.min = 0;
- hs.max = 100;
- }
- placeVScroller() {
- var vs = new VScrollBar();
- vs.skin = "res/ui/vscroll.png";
- vs.height = 300;
- vs.pos(400, 50);
- vs.min = 0;
- vs.max = 100;
- Laya.stage.addChild(vs);
- }
- MadePlayer() {
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
- if (p) {
- this.player = p;
- this.SetMatePos(p);
- this.playerTra = this.player.transform;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerContainer.addChild(this.player);
- let ps = this.player.getComponent(MainRole);
- if (ps)
- this.playerScript = ps;
- else
- this.playerScript = this.player.addComponent(MainRole);
- }
- else {
- console.error("player不存在");
- }
- }
- SetPlayerPosition() {
- this.player.active = true;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerScript.PlayAni(MusicType.Idle, 1);
- }
- SetModelPos(x) {
- if (!this.player) {
- this.MadePlayer();
- this.SetPlayerPosition();
- }
- if (!this._maincamera) {
- this._maincamera = CameraManager.Instance._maincamera;
- this._distance = -Vector3$4.distance(this.playerTra.position, this._maincamera.transform.position);
- this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y;
- }
- let uiP = new Vector3$4(x, this._posy, this._distance);
- let p = MatrixTransform.ScreenToWorld(this._maincamera, uiP);
- this.playerTra.localPositionX = p.x;
- }
- Start() {
- if (this.playerScript) {
- this.playerScript.Start();
- this.playerScript.PlayAni(MusicType.RunAndGun, 2);
- }
- }
- }
- var Vector3$5 = Laya.Vector3;
- var CameraState;
- (function (CameraState) {
- CameraState[CameraState["game"] = 1] = "game";
- CameraState[CameraState["jump"] = 2] = "jump";
- })(CameraState || (CameraState = {}));
- class Camera extends Laya.Script3D {
- constructor() {
- super();
- this.arg = 0.1;
- this.startShake = false;
- this.seconds = 0;
- this.started = false;
- this.quake = 0.3;
- this._position = new Laya.Vector3();
- this._outPos = new Laya.Vector3();
- this.scaleDelta = 0;
- this.scale = new Laya.Vector3(0.1, 0.1, 0.1);
- this.canmovegame = false;
- }
- onAwake() {
- this.selfObj = this.owner;
- this._tran = this.selfObj.transform;
- this.nowP = MathTool.VecZero;
- this.nowR = MathTool.VecZero;
- this.dis = MathTool.VecZero;
- this.temp = MathTool.VecZero;
- }
- Init() {
- let t = CameraManager.Instance.startPosTra;
- this._tran.position = t.position.clone();
- this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
- this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
- this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
- this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
- }
- StopMove() {
- Laya.timer.clear(this, this.JumpCameraMove);
- }
- JumpCameraMove() {
- let p, r;
- if (this.arg == 1) {
- p = this._transform.position;
- r = MathTool.SpToCam(this._transform.localRotationEuler.clone());
- }
- else {
- p = MathTool.MixVector3(this._tran.position.clone(), this._transform.position, this.arg, this.nowP);
- r = MathTool.MixVector3(this._tran.localRotationEuler, MathTool.SpToCam(this._transform.localRotationEuler.clone()), this.arg, this.nowR);
- }
- this._tran.position = p;
- this._tran.localRotationEuler = r;
- }
- CameraAction(type, arg) {
- this.arg = arg;
- switch (type) {
- case CameraState.game:
- this._transform = MainRoleManager.Instance.playerTra;
- if (!this._transform)
- return;
- let t = CameraManager.Instance.startPosTra;
- this._tran.position = t.position.clone();
- this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
- this.canmovegame = true;
- break;
- case CameraState.jump:
- this._transform = PlaneManager.Instance.jumpCamTra;
- if (!this._transform)
- return;
- this.canmovegame = false;
- Laya.timer.frameLoop(1, this, this.JumpCameraMove);
- Laya.timer.once(3000, this, this.StopMove);
- break;
- }
- }
- onComplete() {
- var grid = this._scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh"));
- grid.getChildAt(0).meshRenderer.receiveShadow = true;
- grid.getChildAt(0).layer = 5;
- var staticLayaMonkey = new Laya.MeshSprite3D(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/LayaMonkey-LayaMonkey.lm"));
- this._scene.addChild(staticLayaMonkey);
- staticLayaMonkey.meshRenderer.material = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/Materials/T_Diffuse.lmat");
- staticLayaMonkey.layer = 1;
- staticLayaMonkey.transform.position = new Laya.Vector3(0, 0, 0.5);
- staticLayaMonkey.transform.localScale = new Laya.Vector3(0.3, 0.3, 0.3);
- staticLayaMonkey.transform.rotation = new Laya.Quaternion(0.7071068, 0, 0, -0.7071067);
- staticLayaMonkey.meshRenderer.castShadow = true;
- var layaMonkey_clone1 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
- var layaMonkey_clone2 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
- var layaMonkey_clone3 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
- layaMonkey_clone1.layer = 2;
- layaMonkey_clone2.layer = 3;
- layaMonkey_clone3.layer = 0;
- layaMonkey_clone1.transform.translate(new Laya.Vector3(1.5, 0, 0.0));
- layaMonkey_clone2.transform.translate(new Laya.Vector3(-1.5, 0, 0.0));
- layaMonkey_clone3.transform.translate(new Laya.Vector3(2.5, 0, 0.0));
- layaMonkey_clone2.transform.rotate(new Laya.Vector3(0, 60, 0), false, false);
- var scale = new Laya.Vector3(0.1, 0.1, 0.1);
- layaMonkey_clone3.transform.localScale = scale;
- }
- onDestroy() {
- Laya.timer.clearAll(this);
- }
- ShakeFor(a, b) {
- this.camPOS = this.selfObj.transform.position.clone();
- this.seconds = a;
- this.started = true;
- this.startShake = true;
- this.quake = b;
- }
- Shake() {
- var x = GameTool.random_1to1() * this.quake;
- var y = GameTool.random_1to1() * this.quake;
- var z = GameTool.random_1to1() * this.quake;
- 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);
- this.selfObj.transform.position = temp;
- }
- onLateUpdate() {
- if (this.startShake) {
- this.Shake();
- }
- if (this.started) {
- this.started = false;
- Laya.timer.once(this.seconds * 1000, this, () => {
- this.startShake = false;
- this.selfObj.transform.position = this.camPOS;
- });
- }
- }
- animate() {
- this._position.x = Math.sin(this.scaleDelta += 0.01);
- this.layaMonkey3D.transform.position = this._position;
- this.layaMonkey3D.transform.scale = this.scale;
- this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos);
- this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
- }
- MoveGame(z) {
- if (!this.canmovegame)
- return;
- this.temp.z = z - this.dis.z;
- this._tran.localPositionZ = this.temp.z;
- }
- }
- var Sprite$a = Laya.Sprite;
- var BlurFilter = Laya.BlurFilter;
- class Scene3DManager {
- constructor() {
- this.apePath = "res/apes/monkey2.png";
- }
- static get Instance() {
- return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
- }
- InitGame() {
- Laya.timer.frameOnce(10, this, () => {
- MainRoleManager.Instance.MadePlayer();
- this.InItScene();
- });
- }
- ;
- Init(_s) {
- if (_s) {
- this.MainScene = _s;
- Laya.stage.addChild(_s);
- }
- else {
- console.error("场景不存在");
- return;
- }
- let sceneNode;
- sceneNode = this.MainScene.getChildByName("scene");
- if (!sceneNode) {
- console.error("场景资源配置错误!");
- return;
- }
- this.MainCamera = this.MainScene.getChildByName("Main Camera");
- this.MainCamera.enableHDR = false;
- this.bulletCon = sceneNode.getChildByName("bulletContainer");
- this.effectCon = sceneNode.getChildByName("effectPos");
- this.SetSceneMaterial();
- let build = sceneNode.getChildByName("buildings");
- ConstructManager.Instance.Init(build);
- let playerStartPos = sceneNode.getChildByName("playerstartPoint");
- let playerCon = sceneNode.getChildByName("playerContainer");
- MainRoleManager.Instance.Init(playerStartPos, playerCon);
- let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
- StreetManager.Instance.Init(moveBlockContainer);
- let towerContainer = sceneNode.getChildByName("towerContainer");
- MoundManager.Instance.Init(towerContainer);
- let startCampos1 = sceneNode.getChildByName("startCamPos");
- let startCamposX = sceneNode.getChildByName("startXCamPos");
- let ps;
- if (GameVersion.isX)
- ps = startCamposX;
- else
- ps = startCampos1;
- CameraManager.Instance.Init(this.MainCamera, ps);
- let finalPos = sceneNode.getChildByName("finalPos");
- PlaneManager.Instance.Init(finalPos);
- this.InitGame();
- }
- createApe() {
- var ape = new Sprite$a();
- ape.loadImage(this.apePath);
- ape.x = (Laya.stage.width - ape.width) / 2;
- ape.y = (Laya.stage.height - ape.height) / 2;
- Laya.stage.addChild(ape);
- this.applayFilter(ape);
- }
- applayFilter(ape) {
- var blurFilter = new BlurFilter();
- blurFilter.strength = 5;
- ape.filters = [blurFilter];
- }
- SetSceneMaterial() {
- this.MainCamera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
- let skyRenderer = this.MainScene.skyRenderer;
- skyRenderer.mesh = Laya.SkyDome.instance;
- let mat = new Laya.SkyProceduralMaterial();
- skyRenderer.material = mat;
- mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
- mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
- }
- InItScene() {
- LevelController.Instance.SetLevel();
- PlaneManager.Instance.SetAir();
- ConstructManager.Instance.SetConstruct();
- CameraManager.Instance.SetCameraAction(CameraState.game, 1);
- MainRoleManager.Instance.SetPlayerPosition();
- }
- }
- var Sprite$b = Laya.Sprite;
- var GlowFilter = Laya.GlowFilter;
- class ResourcesManager {
- constructor() {
- this.cloth = [];
- this.apePath = "res/apes/monkey2.png";
- }
- static get Instance() {
- return this.instance || (this.instance = new ResourcesManager());
- }
- static LoadResource(path, complet) {
- Laya.loader.retryNum = 2;
- Laya.loader.maxLoader = 3;
- Laya.loader.retryDelay = 100;
- Laya.loader.create(path, new Laya.Handler(this, complet));
- Laya.loader.on(Laya.Event.ERROR, this, (data) => {
- console.log(data + " 资源加载失败");
- });
- }
- InitAsset() {
- AssetPath.Player.forEach(element => {
- let _player = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_player.name, _player);
- });
- AssetPath.Particle.forEach(element => {
- let _effect = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_effect.name, _effect);
- });
- let _enemy = Laya.loader.getRes(AssetPath.Enemy);
- Laya.loader.clearRes(AssetPath.Enemy);
- this.LoadPoolRes(_enemy.name, _enemy);
- let _playerbullet = Laya.loader.getRes(AssetPath.PlayerShot);
- Laya.loader.clearRes(AssetPath.PlayerShot);
- this.LoadPoolRes(_playerbullet.name, _playerbullet);
- let _tower = Laya.loader.getRes(AssetPath.Mound);
- Laya.loader.clearRes(AssetPath.Mound);
- this.LoadPoolRes(_tower.name, _tower);
- let _scene = Laya.loader.getRes(AssetPath.MainScene);
- Laya.loader.clearRes(AssetPath.MainScene);
- AssetPath.Barrier.forEach(element => {
- let _barrier = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_barrier.name, _barrier);
- });
- Scene3DManager.Instance.Init(_scene);
- }
- LoadPoolRes(name, prefab) {
- GamePool.Instance.InitSelf(name, prefab);
- }
- setup() {
- this.createApe();
- this.applayFilter();
- }
- createApe() {
- this.ape = new Sprite$b();
- this.ape.loadImage(this.apePath);
- var texture = Laya.loader.getRes(this.apePath);
- this.ape.x = (Laya.stage.width - texture.width) / 2;
- this.ape.y = (Laya.stage.height - texture.height) / 2;
- Laya.stage.addChild(this.ape);
- }
- applayFilter() {
- var glowFilter = new GlowFilter("#ffff00", 10, 0, 0);
- this.ape.filters = [glowFilter];
- }
- Load(callback) {
- var arr = [
- AssetPath.MainScene,
- AssetPath.Enemy,
- AssetPath.PlayerShot,
- AssetPath.Mound,
- ];
- let arr1 = arr.concat(AssetPath.Player);
- let arr2 = arr1.concat(AssetPath.Barrier);
- let arr3 = arr2.concat(AssetPath.Particle);
- ResourcesManager.LoadResource(arr3, () => {
- this.InitAsset();
- if (callback)
- callback();
- });
- }
- }
- var REG = Laya.ClassUtils.regClass;
- var ui;
- (function (ui) {
- class AttributeUpViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(AttributeUpViewUI.uiView);
- }
- }
- AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "14,14,13,15", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 3 }, { "type": "Box", "props": { "y": 253, "x": 42, "width": 636, "height": 538 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/webp.webp.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 40, "x": -9, "width": 655, "skin": "Main/shengji-biaoti.png", "height": 102 }, "compId": 32 }] }, { "type": "Button", "props": { "y": 556, "x": 350, "var": "rateBtn", "stateNum": 1, "skin": "Main/landi.png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "Main/gongjisudu-1.png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 4, "width": 236, "var": "_rate", "stateNum": 1, "height": 71 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "Main/jinbi-zhu.png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 5, "width": 235, "visible": false, "var": "_rateVideo", "stateNum": 1, "height": 71 }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 42 }, { "type": "Image", "props": { "y": 16.5, "x": 117.5, "skin": "Main/shipin-biao.png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 558, "x": 54, "var": "atkBtn", "stateNum": 1, "skin": "Main/hong-di.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "Main/gongjili-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 3, "width": 236, "var": "_atk", "stateNum": 1, "height": 71 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 15, "x": 61, "skin": "Main/jinbi-zhu.png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 2, "width": 238, "visible": false, "var": "_atkVideo", "stateNum": 1, "height": 71 }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 16.5, "x": 119, "skin": "Main/shipin-biao.png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "x": 201, "var": "backBtn", "skin": "Main/jixuyouxi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": 620 }, "compId": 8 }] }, { "type": "Box", "props": { "y": 384, "x": 75, "width": 571, "var": "PushBox", "height": 407 }, "compId": 72, "child": [{ "type": "Box", "props": { "y": 112, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 70 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 71 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 69 }] }, { "type": "Box", "props": { "y": 112, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 73, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 74 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 76 }] }, { "type": "Box", "props": { "y": 112, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 77, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 78 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 79 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 80 }] }, { "type": "Box", "props": { "y": 306, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 84 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 86 }] }, { "type": "Box", "props": { "y": 306, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 87 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 88 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 89 }] }, { "type": "Box", "props": { "y": 306, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 83, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 90 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 176, "x": 578, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 94 }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 68, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 20 }] } }, { "target": 73, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 20 }] } }, { "target": 77, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 20 }] } }, { "target": 81, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 20 }] } }, { "target": 82, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 20 }] } }, { "target": 83, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 20 }] } }], "name": "shakeani", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/webp.webp.png", "Main/shengji-biaoti.png", "Main/landi.png", "Main/gongjisudu-1.png", "Main/shengji-tubiao-1.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/shou.png", "Main/hong-di.png", "Main/gongjili-2.png", "Main/jixuyouxi-bt.png", "Main/exit2.png"], "loadList3D": [] };
- ui.AttributeUpViewUI = AttributeUpViewUI;
- REG("ui.AttributeUpViewUI", AttributeUpViewUI);
- class CompleteViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(CompleteViewUI.uiView);
- }
- }
- CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "10,10,12,11", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 22 }, { "type": "Image", "props": { "y": 1196, "x": 298, "var": "nextBtn", "skin": "Main/no.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 46 }, { "type": "Image", "props": { "x": 214, "var": "doublegetBtn", "skin": "Main/sanbeilingqu.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 28 }, { "type": "Image", "props": { "x": 41, "var": "shibaiTop", "skin": "Main/shibai-di bg.png", "centerY": -182 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 136, "x": 76, "skin": "Main/shibai-jiesuan-b.png" }, "compId": 121 }] }, { "type": "Image", "props": { "x": 41.5, "var": "winTop", "skin": "Main/shengli-beidi.png", "centerY": -182 }, "compId": 44, "child": [{ "type": "Image", "props": { "y": 132, "x": 76, "skin": "Main/tonggun-biao.png" }, "compId": 122 }] }, { "type": "Image", "props": { "x": 243, "width": 60, "skin": "Main/jinbi-zhu.png", "height": 60, "centerY": 120 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "x": 136, "width": 447, "height": 419, "centerY": -138 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 58, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 80, "child": [{ "type": "Image", "props": { "y": 15, "x": 17, "skin": "Main/baolei.png" }, "compId": 118 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 179, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 85, "child": [{ "type": "Image", "props": { "y": 15, "x": 13.5, "skin": "Main/rentou.png" }, "compId": 119 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 301, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 13, "x": 16, "skin": "Main/baohe.png" }, "compId": 120 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "LeftTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 96, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 98 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "LeftBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 102, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 103 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "RightTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 105, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 107 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "RightBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 109 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 110 }] }, { "type": "Button", "props": { "y": 175, "x": 568.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 123 }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 96, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 20 }] } }, { "target": 102, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 20 }] } }, { "target": 105, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 20 }] } }, { "target": 106, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 20 }] } }], "name": "pushshake", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/no.png", "Main/sanbeilingqu.png", "Main/shibai-di bg.png", "Main/shibai-jiesuan-b.png", "Main/shengli-beidi.png", "Main/tonggun-biao.png", "Main/jinbi-zhu.png", "Main/zhengchang-di.png", "Main/biaozhi-di8.png", "Main/baolei.png", "Main/rentou.png", "Main/baohe.png", "Main/hutui-1-4.png", "Main/exit2.png"], "loadList3D": [] };
- ui.CompleteViewUI = CompleteViewUI;
- REG("ui.CompleteViewUI", CompleteViewUI);
- class ExitViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ExitViewUI.uiView);
- }
- }
- ExitViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/hutui-1-4.png", "sizeGrid": "16,16,14,14", "right": 0, "name": "BG", "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "Main/hutui-1-3.png", "height": 131 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 84, "x": 360, "width": 135, "valign": "middle", "text": "小程序", "pivotY": 31, "pivotX": 68, "height": 61, "fontSize": 35, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 154, "x": 56, "width": 92, "valign": "middle", "text": "最近使用", "pivotY": 18, "pivotX": 46, "height": 36, "fontSize": 23, "color": "#5d5353", "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }, { "type": "Image", "props": { "y": 174, "width": 753, "skin": "Main/hutui_line.png", "right": 0, "pivotY": 2, "pivotX": 320, "height": 7 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 66, "x": 37, "width": 66, "var": "CloseBtn", "pivotY": 41, "pivotX": 33, "height": 81 }, "compId": 7 }, { "type": "List", "props": { "x": 360, "width": 656, "var": "PushList", "top": 180, "spaceY": 15, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 9, "child": [{ "type": "Box", "props": { "y": 0, "width": 630, "right": 26, "renderType": "render", "height": 101 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 100, "x": 123, "width": 538, "skin": "Main/hutui_line.png", "name": "line", "height": 5 }, "compId": 18 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "name": "icon", "height": 100 }, "compId": 11 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 101, "skin": "Main/zhezhao.png", "name": "zhezhao", "height": 101 }, "compId": 17 }, { "type": "Text", "props": { "y": 0, "x": 150, "width": 473, "valign": "middle", "text": "冲冲冲冲", "name": "name", "height": 100, "fontSize": 30, "align": "left", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 65, "x": 598.5, "width": 49, "skin": "Main/hutui-1-1.png", "pivotY": 23, "pivotX": 25, "name": "star", "height": 46 }, "compId": 13 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 14 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 16 }] }] }], "loadList": ["Main/hutui-1-4.png", "Main/hutui-1-3.png", "Main/hutui_line.png", "Main/zhezhao.png", "Main/hutui-1-1.png"], "loadList3D": [] };
- ui.ExitViewUI = ExitViewUI;
- REG("ui.ExitViewUI", ExitViewUI);
- class ExportViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ExportViewUI.uiView);
- }
- }
- ExportViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/111111.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "top": 130, "skin": "Main/haoyourwBg.png", "right": 10, "left": 10, "height": 200 }, "compId": 3, "child": [{ "type": "List", "props": { "y": 52, "x": 11.5, "width": 697, "var": "TopList", "spaceX": 20, "height": 130 }, "compId": 8, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 130, "renderType": "render", "height": 130 }, "compId": 9, "child": [{ "type": "Image", "props": { "width": 131, "name": "icon", "height": 131 }, "compId": 10 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 11 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 23 }] }] }] }, { "type": "Image", "props": { "top": 360, "skin": "Main/baokuanrwbg.png", "right": 10, "left": 10, "height": 36 }, "compId": 4 }, { "type": "Image", "props": { "x": 209.5, "top": 50, "skin": "Main/hotGameTitle.png" }, "compId": 6 }, { "type": "Button", "props": { "x": 8, "width": 172, "var": "CloseBtn", "top": 50, "stateNum": 1, "skin": "Main/backBtn.png", "height": 51 }, "compId": 7 }, { "type": "List", "props": { "x": 10, "var": "BottomList", "top": 400, "spaceY": 15, "spaceX": 40, "right": 0, "repeatX": 3, "left": 0, "bottom": 150 }, "compId": 12, "child": [{ "type": "Box", "props": { "y": 0, "x": 32, "width": 190, "renderType": "render", "height": 230 }, "compId": 13, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/bg-box.png", "sizeGrid": "33,36,40,30", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 18 }, { "type": "Image", "props": { "y": 40, "x": 0, "width": 190, "name": "icon", "height": 150 }, "compId": 14 }, { "type": "Text", "props": { "y": 190, "x": 1, "width": 189, "valign": "middle", "text": "text", "name": "tip", "height": 41, "fontSize": 23, "align": "center", "runtime": "laya.display.Text" }, "compId": 15 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 190, "name": "bottom", "height": 40 }, "compId": 16 }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 189, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 17 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 19 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 24 }] }] }, { "type": "Button", "props": { "x": 228, "width": 241, "var": "ContinueBtn", "stateNum": 1, "skin": "Main/zhengchang-di2.png", "sizeGrid": "17,31,12,28", "height": 65, "bottom": 50 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 11, "x": 33.5, "skin": "Main/jixuyouxi.png" }, "compId": 21 }] }], "loadList": ["Main/111111.png", "Main/haoyourwBg.png", "Main/baokuanrwbg.png", "Main/hotGameTitle.png", "Main/backBtn.png", "Main/bg-box.png", "Main/zhengchang-di2.png", "Main/jixuyouxi.png"], "loadList3D": [] };
- ui.ExportViewUI = ExportViewUI;
- REG("ui.ExportViewUI", ExportViewUI);
- class GiftViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GiftViewUI.uiView);
- }
- }
- GiftViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,10,11,9", "right": 0, "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "y": 504, "x": 360, "width": 467, "skin": "Main/liwukuang.png", "pivotY": 234, "pivotX": 234, "name": "kuang", "height": 467 }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 183, "skin": "Main/lihe.png", "pivotY": 102, "pivotX": 92, "name": "gift", "height": 203 }, "compId": 4 }, { "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 85, "skin": "Main/wenhao.png", "pivotY": 66, "pivotX": 43, "name": "wenhao", "height": 132 }, "compId": 5 }] }, { "type": "Button", "props": { "x": 352, "width": 200, "var": "HitBtn", "stateNum": 1, "pivotY": 67, "pivotX": 100, "height": 133, "bottom": 8 }, "compId": 9, "child": [{ "type": "Image", "props": { "y": -51, "x": 108, "width": 89, "var": "shou", "skin": "Main/shou1.png", "pivotY": 59, "pivotX": 45, "height": 118 }, "compId": 12 }, { "type": "Image", "props": { "y": 34, "x": 0, "skin": "Main/eee 1@2x.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 45, "x": 100, "width": 174, "skin": "Main/anniu.png", "pivotY": 41, "pivotX": 87, "height": 82 }, "compId": 10 }] }, { "type": "Text", "props": { "y": 356, "x": 360, "width": 199, "valign": "middle", "text": "神秘礼盒", "pivotY": 34, "pivotX": 100, "name": "name", "height": 67, "fontSize": 30, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }, { "type": "ProgressBar", "props": { "y": 666, "x": 360, "width": 268, "var": "jinduBar", "value": 0, "skin": "Main/di.png", "pivotY": 11, "pivotX": 134, "height": 22 }, "compId": 14 }], "animations": [{ "nodes": [{ "target": 12, "keyframes": { "y": [{ "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 0 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 5 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 10 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 15 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 20 }], "x": [{ "value": 108, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "x", "index": 0 }] } }], "name": "click", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/liwukuang.png", "Main/lihe.png", "Main/wenhao.png", "Main/shou1.png", "Main/eee 1@2x.png", "Main/anniu.png", "Main/di.png"], "loadList3D": [] };
- ui.GiftViewUI = GiftViewUI;
- REG("ui.GiftViewUI", GiftViewUI);
- class GoldEggViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GoldEggViewUI.uiView);
- }
- }
- GoldEggViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,11,10,8", "right": 0, "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "Image", "props": { "y": 288, "x": 177.5, "skin": "Main/zajindan_3.png" }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 284, "x": 456, "width": 137, "skin": "Main/zajindan_5_3.png", "pivotY": 177, "pivotX": 77, "height": 177 }, "compId": 6 }] }, { "type": "ProgressBar", "props": { "y": 725.5, "x": 21, "var": "jindu", "value": 0, "skin": "Main/zadanjindu.png", "rotation": -90 }, "compId": 5 }, { "type": "Button", "props": { "y": 1157, "x": 360, "var": "HitBtn", "stateNum": 1, "skin": "Main/zadan.png", "scaleY": 1.01, "scaleX": 1.01, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 7 }, { "type": "Image", "props": { "y": 1007, "x": 506, "var": "kuangdian", "skin": "Main/kuangdian-2.png" }, "compId": 9 }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "y": [{ "value": 107, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 0 }, { "value": 284, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 1 }], "x": [{ "value": 379, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 448, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 1 }], "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 0 }, { "value": -6, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 1 }, { "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 2 }, { "value": -46, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 3 }, { "value": -19, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 4 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 5 }], "pivotY": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 0 }, { "value": 177, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 1 }], "pivotX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 0 }, { "value": 69, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 1 }] } }, { "target": 4, "keyframes": { "var": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 0 }, { "value": "Black", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 5 }], "name": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 0 }, { "value": "", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 5 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 7, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 40 }] } }], "name": "btnscale", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/zajindan_3.png", "Main/zajindan_5_3.png", "Main/zadanjindu.png", "Main/zadan.png", "Main/kuangdian-2.png"], "loadList3D": [] };
- ui.GoldEggViewUI = GoldEggViewUI;
- REG("ui.GoldEggViewUI", GoldEggViewUI);
- class GuideViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GuideViewUI.uiView);
- }
- }
- GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "Main/guangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "Main/jiantou(1).png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "Main/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "Main/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "Main/jiantou(1).png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 183, "var": "guide1Image", "skin": "Main/biaoyu.png", "bottom": 220 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "Main/biaoyu4.png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "Main/biaoyu2.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["Main/guangquan(1).png", "Main/jiantou(1).png", "Main/zuoyou-jiantou(1).png", "Main/shou.png", "Main/biaoyu.png", "Main/biaoyu4.png", "Main/biaoyu2.png"], "loadList3D": [] };
- ui.GuideViewUI = GuideViewUI;
- REG("ui.GuideViewUI", GuideViewUI);
- class InGameViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(InGameViewUI.uiView);
- }
- }
- InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
- ui.InGameViewUI = InGameViewUI;
- REG("ui.InGameViewUI", InGameViewUI);
- class IntensifyViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(IntensifyViewUI.uiView);
- }
- }
- IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "sizeGrid": "0,0,0,0", "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "15,13,12,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 64 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8 }, "compId": 3 }, { "type": "Image", "props": { "y": 139, "x": 63.5, "skin": "Main/beijing-di.png" }, "compId": 36 }, { "type": "Box", "props": { "y": 402, "x": 42, "width": 636, "height": 645 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 17, "x": 44.5, "var": "atkBox", "skin": "Main/wenzi-di5.png" }, "compId": 37, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "Main/gongji-2-3.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 60 }, { "type": "Image", "props": { "y": 58.5, "x": 34, "skin": "Main/gongji-icon.png" }, "compId": 39 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "Main/gongji-1-3.png" }, "compId": 40 }, { "type": "Button", "props": { "y": 95.5, "x": 358, "var": "atkupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 7, "x": 15, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 43, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 44 }] }] }, { "type": "Text", "props": { "y": 38, "x": 390, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 226, "x": 44.5, "var": "rateBox", "skin": "Main/wenzi-di5.png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 43, "x": 170, "skin": "Main/gongji-2-2.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 62 }, { "type": "Image", "props": { "y": 63.5, "x": 35, "skin": "Main/iconqiang.png" }, "compId": 47 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "Main/gongji-1-2.png" }, "compId": 48 }, { "type": "Button", "props": { "y": 94.5, "x": 360, "var": "rateupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 49, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 51, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 52 }] }] }, { "type": "Text", "props": { "y": 33, "x": 392, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 50 }] }, { "type": "Image", "props": { "y": 445, "x": 44.5, "var": "coinBox", "skin": "Main/wenzi-di5.png" }, "compId": 53, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "Main/gongji-2.png" }, "compId": 54 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 63 }, { "type": "Image", "props": { "y": 63.5, "x": 30, "skin": "Main/jinbi.png" }, "compId": 55 }, { "type": "Image", "props": { "y": 124, "x": 161, "skin": "Main/gongji-1.png" }, "compId": 56 }, { "type": "Button", "props": { "y": 94, "x": 351, "var": "getcoinBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 57, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/shipin-biao.png", "height": 45 }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }] }] }] }] }, { "type": "Button", "props": { "y": 174.5, "x": 573, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 65 }, { "type": "Button", "props": { "y": 139, "x": 14, "var": "backBtn", "stateNum": 1, "skin": "Main/p__fanhui.png" }, "compId": 66 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng.png", "Main/beijing-di.png", "Main/wenzi-di5.png", "Main/gongji-2-3.png", "Main/zhuangbei-tubiao-di.png", "Main/gongji-icon.png", "Main/gongji-1-3.png", "Main/zheng-qianbi-di.png", "Main/jinbi-zhu.png", "Main/gongji-2-2.png", "Main/iconqiang.png", "Main/gongji-1-2.png", "Main/gongji-2.png", "Main/jinbi.png", "Main/gongji-1.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/p__fanhui.png"], "loadList3D": [] };
- ui.IntensifyViewUI = IntensifyViewUI;
- REG("ui.IntensifyViewUI", IntensifyViewUI);
- class LoadViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(LoadViewUI.uiView);
- }
- }
- 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": [] };
- ui.LoadViewUI = LoadViewUI;
- REG("ui.LoadViewUI", LoadViewUI);
- class MainViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(MainViewUI.uiView);
- }
- }
- MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "Main/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 1, "width": 150, "var": "pro1", "skin": "Main/jindu-guan-do.png", "height": 20 }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "Main/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "Main/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "width": 187, "top": 130, "skin": "Main/jinbi-di.png", "right": 522 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 4.5, "x": 0, "skin": "Main/jinbi-zhu.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 3.5, "x": 37, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Image", "props": { "x": 30, "var": "settingBtn", "top": 104, "skin": "Main/shezhi.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/ButtonVibrationOff.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/ButtonVibrationOn.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "Main/shengji.png", "runtime": "View/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "Main/shangdain.png", "runtime": "View/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }, { "type": "Button", "props": { "y": 689, "x": 196, "var": "MoreFunBtn2", "stateNum": 1, "skin": "Main/gengduoyouxo-2.png" }, "compId": 336 }] }, { "type": "Image", "props": { "x": 168.5, "var": "sliderBox", "skin": "Main/zhiyin-di.png", "mouseEnabled": false, "gray": false, "bottom": 325 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -71, "x": 27, "skin": "Main/pause1.png" }, "compId": 334 }, { "type": "Image", "props": { "y": 18, "x": 191.5, "skin": "Main/shouzhi.png", "anchorX": 0.5 }, "compId": 293 }, { "type": "Image", "props": { "y": 13.5, "x": 18, "skin": "Main/fangxiangzuo.png" }, "compId": 331 }, { "type": "Image", "props": { "y": 13.5, "x": 283, "skin": "Main/fangxiangyou.png" }, "compId": 332 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "visible": true, "right": 0, "name": "BottomBox", "left": 0, "height": 177, "bottom": 0 }, "compId": 314, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "Main/chunhei2.png", "sizeGrid": "12,11,13,10", "right": 0, "name": "BG", "left": 0, "height": 183, "bottom": 0 }, "compId": 317 }, { "type": "List", "props": { "width": 720, "var": "BottomList", "spaceX": 30, "right": 0, "repeatY": 1, "left": 0, "height": 176, "bottom": 0 }, "compId": 318, "child": [{ "type": "Box", "props": { "y": 8, "x": 18, "width": 130, "renderType": "render", "height": 160 }, "compId": 319, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 129, "skin": "Main/bg-box.png", "sizeGrid": "27,27,37,20", "name": "BG", "height": 159 }, "compId": 320 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 321 }, { "type": "Text", "props": { "y": 130, "x": 0, "width": 126, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 29, "fontSize": 20, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 322 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 130, "name": "btn", "height": 160 }, "compId": 323 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 335 }] }] }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "LeftPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 88, "pivotX": 70, "left": 20, "height": 175 }, "compId": 315, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 325 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 326 }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "RightPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "right": 21, "pivotY": 88, "pivotX": 70, "height": 175 }, "compId": 316, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 327 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 328 }] }, { "type": "Button", "props": { "y": 211, "x": 561, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 330 }, { "type": "Button", "props": { "y": 726, "x": 0, "var": "MoreGameBtn", "stateNum": 1, "skin": "Main/gengduoyouxi.png" }, "compId": 333 }, { "type": "Image", "props": { "visible": false, "var": "BoxPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 337, "child": [{ "type": "Image", "props": { "y": 114, "x": 158.5, "skin": "Main/baoxiang-1-1.png" }, "compId": 339 }, { "type": "Image", "props": { "y": 272, "x": 165, "skin": "Main/baoxiang-1-2.png" }, "compId": 341 }, { "type": "Image", "props": { "y": 371, "x": 236, "skin": "Main/baoxiang-1-3.png" }, "compId": 340 }, { "type": "Button", "props": { "y": 756, "x": 205.5, "var": "VideoGetCoinBtn", "stateNum": 1, "skin": "Main/baoxiang-1-4.png" }, "compId": 342 }, { "type": "Button", "props": { "y": 912, "x": 312, "var": "CloseVideoBtn", "stateNum": 1, "skin": "Main/baoxiang-1-5.png" }, "compId": 344 }] }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 315, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 20 }] } }], "name": "lefticon", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 316, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 20 }] } }], "name": "righticon", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/jindu-duan.png", "Main/jindu-guan-do.png", "Main/guanshu.png", "Main/shadi.png", "Main/jinbi-di.png", "Main/jinbi-zhu.png", "Main/shezhi.png", "Main/ButtonVibrationOff.png", "Main/ButtonVibrationOn.png", "Main/Icon_SoundOn.png", "Main/Icon_SoundOff.png", "Main/shengji.png", "Main/shangdain.png", "Main/gengduoyouxo-2.png", "Main/zhiyin-di.png", "Main/pause1.png", "Main/shouzhi.png", "Main/fangxiangzuo.png", "Main/fangxiangyou.png", "Main/chunhei2.png", "Main/bg-box.png", "Main/hutui-1-4.png", "Main/exit2.png", "Main/gengduoyouxi.png", "Main/chunhei.png", "Main/baoxiang-1-1.png", "Main/baoxiang-1-2.png", "Main/baoxiang-1-3.png", "Main/baoxiang-1-4.png", "Main/baoxiang-1-5.png"], "loadList3D": [] };
- ui.MainViewUI = MainViewUI;
- REG("ui.MainViewUI", MainViewUI);
- class ShadeViewUI extends Laya.View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ShadeViewUI.uiView);
- }
- }
- ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
- ui.ShadeViewUI = ShadeViewUI;
- REG("ui.ShadeViewUI", ShadeViewUI);
- class SkinShopViewUI extends Laya.View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(SkinShopViewUI.uiView);
- }
- }
- SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "13,14,14,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 115 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng1.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 238, "x": 0, "skin": "Main/pifu-biaoti.png" }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "y": 0, "x": 0, "width": 83, "var": "leftBtn", "stateNum": 1, "height": 88 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/wu-you.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/you-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "y": 51, "x": 572, "width": 94, "var": "rightBtn", "stateNum": 1, "pivotY": 51, "pivotX": 51, "height": 97 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/wu-zuo.png", "rotation": 180, "pivotY": 42, "pivotX": 40, "name": "rightFalse", "height": 84 }, "compId": 98 }, { "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/you-you.png", "pivotY": 42, "pivotX": 40, "name": "rightTrue", "height": 84 }, "compId": 99 }] }] }, { "type": "Image", "props": { "x": 163.5, "skin": "Main/dizuo.png", "centerY": 199 }, "compId": 101 }, { "type": "Image", "props": { "x": 173.5, "width": 379, "var": "viewPort", "height": 426, "centerY": 14 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "y": 9, "x": 0, "var": "using", "skin": "Main/bt.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "use", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "coin", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 26.5, "x": 40, "width": 53, "skin": "Main/jinbi-zhu.png", "height": 56 }, "compId": 109, "child": [{ "type": "Text", "props": { "y": -4.5, "x": 37, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "video", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 24, "x": 46, "width": 65, "skin": "Main/shipin-biao.png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }, { "type": "Button", "props": { "y": 155, "x": 562.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 116 }, { "type": "Button", "props": { "y": 131, "x": 18, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guanbi-bt.png" }, "compId": 117 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng1.png", "Main/pifu-biaoti.png", "Main/wu-you.png", "Main/you-zuo.png", "Main/wu-zuo.png", "Main/you-you.png", "Main/dizuo.png", "Main/bt.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/guanbi-bt.png"], "loadList3D": [] };
- ui.SkinShopViewUI = SkinShopViewUI;
- REG("ui.SkinShopViewUI", SkinShopViewUI);
- class TopTipUiUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(TopTipUiUI.uiView);
- }
- }
- TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "Main/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "Main/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "Main/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/huadong-tiao.png", "Main/pause1.png", "Main/shou.png"], "loadList3D": [] };
- ui.TopTipUiUI = TopTipUiUI;
- REG("ui.TopTipUiUI", TopTipUiUI);
- class TrialViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(TrialViewUI.uiView);
- }
- }
- TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "11,11,13,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 97, "x": 125, "skin": "Main/biaoti.png" }, "compId": 4 }, { "type": "Image", "props": { "y": 221, "x": 98, "visible": false, "skin": "Main/shiyong-bg.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 657, "x": 170, "skin": "Main/dizuo.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 357, "x": 169, "width": 380, "var": "viewPort", "height": 398 }, "compId": 8 }, { "type": "Button", "props": { "y": 203, "x": 570, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 1192, "x": 287, "var": "backBtn", "skin": "Main/no-bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "x": 212, "var": "videoBtn", "skin": "Main/sanbeilingqu--s.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 10 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/biaoti.png", "Main/shiyong-bg.png", "Main/dizuo.png", "Main/exit2.png", "Main/no-bt.png", "Main/sanbeilingqu--s.png"], "loadList3D": [] };
- ui.TrialViewUI = TrialViewUI;
- REG("ui.TrialViewUI", TrialViewUI);
- })(ui || (ui = {}));
- class GuangGao {
- constructor() {
- GuangGao.ins = this;
- }
- static get Instance() {
- if (GuangGao.ins == null) {
- return new GuangGao();
- }
- return GuangGao.ins;
- }
- static InitVideo() {
- if (!Laya.Browser.onWeiXin)
- return;
- this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
- this.fsaasfafssfa.onLoad(() => {
- console.log('激励视频 广告加载成功');
- this.asfasfsaffsa = true;
- });
- this.fsaasfafssfa.onError(err => {
- console.log("激励视屏加载失败:" + err);
- this.asfasfsaffsa = false;
- });
- this.afsfsaafsfsa = true;
- }
- static ShowVideo(callback) {
- if (this.asfasfsaffsa) {
- console.log("showVideoAd:" + this.asfasfsaffsa);
- this.SetVideoCallBack(callback);
- this.fsaasfafssfa.show().catch(err => {
- this.fsaasfafssfa.load().then(() => {
- this.SetVideoCallBack(callback);
- this.fsaasfafssfa.show();
- });
- });
- }
- }
- static SetVideoCallBack(callback) {
- this.fsaasfafssfa.offClose();
- this.fsaasfafssfa.onClose(res => {
- console.log("激励视频关闭:" + res.isEnded);
- if (res && res.isEnded || res === undefined) {
- callback && callback(true);
- }
- else {
- callback && callback(false);
- }
- this.fsaasfafssfa.offClose();
- });
- }
- static OpenBanner(gap = 0, callVack = null, iswait = false) {
- if (!Laya.Browser.onWeiXin) {
- callVack && callVack(null);
- return;
- }
- this.canshowbanner = true;
- var idd = this.bannerAdUnitId;
- console.log("adUnitId:" + idd);
- let newBanner = Laya.Browser.window.wx.createBannerAd({
- adUnitId: idd,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- newBanner.onError(err => {
- console.log(err);
- callVack && callVack(null);
- });
- newBanner.onLoad(() => {
- if (this.curbanner)
- this.curbanner.destroy();
- this.curbanner = newBanner;
- var hight = this.GetRealHight(gap);
- if (callVack != null) {
- callVack(hight);
- }
- if (this.canshowbanner && !iswait) {
- this.curbanner.show();
- }
- else {
- this.curbanner.hide();
- }
- });
- }
- static GetRealHight(gap) {
- if (this.curbanner) {
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this.curbanner.style.width = info.windowWidth;
- this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
- return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
- }
- }
- static Clear() {
- Laya.timer.clearAll(this);
- Laya.Tween.clearAll(this);
- this.canshowbanner = false;
- if (this.curbanner)
- this.curbanner.hide();
- }
- static hidebanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this.curbanner)
- this.curbanner.hide();
- }
- static showbanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this.curbanner)
- this.curbanner.show();
- }
- static get cancheat() {
- if (!UserInfoManager.Cheat) {
- console.log("cheat:false-> CurAccountData.cheat != 1");
- return false;
- }
- var checkscence = UserInfoManager.CheckScene;
- if (checkscence == false) {
- console.log("cheat:true-> " + GameVersion.wxValue);
- return true;
- }
- if (GameVersion.wxValue == "1037" || GameVersion.wxValue == "1058" || GameVersion.wxValue == "1067" || GameVersion.wxValue == "1095") {
- console.log("cheat:true-> " + GameVersion.wxValue);
- return true;
- }
- console.log("cheat:false-> " + GameVersion.wxValue);
- return false;
- }
- showBanner(success = null, fail = null, gap = 0) {
- if (!Laya.Browser.onWeiXin) {
- success && success(null);
- return;
- }
- let ad = GuangGao.bannerAdUnitId;
- let bannerAd = Laya.Browser.window.wx.createBannerAd({
- adUnitId: ad,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- bannerAd.onLoad(() => {
- console.log("[LOG] Banner广告加载成功");
- this.hideBanner();
- this._bannerAd = bannerAd;
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this._bannerAd.style.width = info.windowWidth;
- this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 10;
- this._bannerAd.show();
- var hight = GuangGao.GetRealHight2(this._bannerAd, gap);
- let data = {};
- data["banner"] = this._bannerAd;
- data["gap"] = hight;
- success && success(data);
- });
- bannerAd.onError(err => {
- console.log("[LOG] Banner广告加载失败");
- console.log(err);
- fail && fail();
- });
- }
- hideBanner() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this._bannerAd) {
- this._bannerAd.hide();
- this._bannerAd.destroy();
- this._bannerAd = null;
- }
- }
- showBanner2(success = null, fail = null, gap = 0) {
- if (!Laya.Browser.onWeiXin) {
- success && success(null);
- return;
- }
- let ad = GuangGao.bannerAdUnitId2;
- let bannerAd = Laya.Browser.window.wx.createBannerAd({
- adUnitId: ad,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- bannerAd.onLoad(() => {
- console.log("[LOG] Banner广告加载成功");
- this.hideBanner2();
- this._bannerAd2 = bannerAd;
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this._bannerAd2.style.width = info.windowWidth;
- this._bannerAd2.style.top = info.windowHeight - this._bannerAd2.style.realHeight - 10;
- this._bannerAd2.show();
- var hight = GuangGao.GetRealHight2(this._bannerAd2, gap);
- let data = {};
- data["banner"] = this._bannerAd2;
- data["gap"] = hight;
- console.log("data>>>>>", data);
- success && success(data);
- });
- bannerAd.onError(err => {
- console.log("[LOG] Banner广告加载失败");
- console.log(err);
- fail && fail();
- });
- }
- hideBanner2() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this._bannerAd2) {
- this._bannerAd2.hide();
- this._bannerAd2.destroy();
- this._bannerAd2 = null;
- }
- }
- showBanner3(success = null, fail = null, gap = 0) {
- if (!Laya.Browser.onWeiXin) {
- success && success(null);
- return;
- }
- let ad = GuangGao.bannerAdUnitId3;
- let bannerAd = Laya.Browser.window.wx.createBannerAd({
- adUnitId: ad,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- bannerAd.onLoad(() => {
- console.log("[LOG] Banner广告加载成功");
- this.hideBanner3();
- this._bannerAd3 = bannerAd;
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this._bannerAd3.style.width = info.windowWidth;
- this._bannerAd3.style.top = info.windowHeight - this._bannerAd3.style.realHeight - 10;
- this._bannerAd3.show();
- var hight = GuangGao.GetRealHight2(this._bannerAd3, gap);
- let data = {};
- data["banner"] = this._bannerAd2;
- data["gap"] = hight;
- success && success(data);
- });
- bannerAd.onError(err => {
- console.log("[LOG] Banner广告加载失败");
- console.log(err);
- fail && fail();
- });
- }
- hideBanner3() {
- if (!Laya.Browser.onWeiXin)
- return;
- if (this._bannerAd3) {
- this._bannerAd3.hide();
- this._bannerAd3.destroy();
- this._bannerAd3 = null;
- }
- }
- static CheatBanner(btn, complete = null, gap = 0) {
- btn.mouseEnabled = false;
- GuangGao.Instance.showBanner((height) => {
- if (height == null) {
- btn.mouseEnabled = true;
- }
- else {
- let _height = Number(height["gap"]);
- height["banner"].hide();
- console.log("cheatstart", "bottom:100");
- btn.mouseEnabled = false;
- console.log("——height--", _height);
- var end = Laya.stage.height - _height - btn.height - 50;
- console.log("y:" + end);
- Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
- height["banner"].show();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- btn.mouseEnabled = true;
- console.log("上移成功cheat1--");
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- });
- }
- static CheatBanner2(btn, complete = null, gap = 0) {
- btn.mouseEnabled = false;
- GuangGao.Instance.showBanner2((height) => {
- if (height == null) {
- btn.mouseEnabled = true;
- }
- else {
- let _height = Number(height["gap"]);
- height["banner"].hide();
- console.log("cheatstart", "bottom:100");
- console.log("——height--", _height);
- var end = Laya.stage.height - _height - btn.height - 50;
- console.log("y:" + end);
- Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
- height["banner"].show();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- btn.mouseEnabled = true;
- console.log("上移成功cheat2---");
- height["banner"].hide();
- GuangGao.Instance.showBanner3();
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- });
- }
- static CheatBanner3(btn, complete = null, gap = 0) {
- btn.mouseEnabled = false;
- GuangGao.Instance.showBanner3((height) => {
- if (height == null) {
- btn.mouseEnabled = true;
- }
- else {
- let _height = Number(height["gap"]);
- height["banner"].hide();
- console.log("cheatstart", "bottom:100");
- console.log("——height--", _height);
- var end = Laya.stage.height - _height - btn.height - 50;
- console.log("y:" + end);
- Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
- height["banner"].show();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- console.log("上移成功cheat3--");
- btn.mouseEnabled = true;
- height["banner"].hide();
- GuangGao.Instance.showBanner();
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- });
- }
- static GetRealHight2(banner, gap) {
- if (banner) {
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- banner.style.width = info.windowWidth;
- banner.style.top = info.windowHeight - banner.style.realHeight - gap;
- console.log("banner真实高度为---", Laya.stage.height / info.windowHeight * banner.style.realHeight);
- return Laya.stage.height / info.windowHeight * banner.style.realHeight;
- }
- }
- }
- GuangGao.videlAdUnitId = "adunit-0fb53ab4969d46bb";
- GuangGao.bannerAdUnitId = "adunit-de3afc5da6054394";
- GuangGao.bannerAdUnitId2 = "adunit-72492b628fc3dee9";
- GuangGao.bannerAdUnitId3 = "adunit-a0e0b5dbf2b6c840";
- GuangGao.afsfsaafsfsa = false;
- GuangGao.asfasfsaffsa = false;
- GuangGao.canshowbanner = true;
- GuangGao.bannerhigt = 0;
- var Tween$1 = Laya.Tween;
- class LoadView extends ui.LoadViewUI {
- constructor() {
- super();
- this.proCom = false;
- this.a = new Laya.Vector3();
- this.loadResCom = false;
- this.loginCom = false;
- this.errorTime = 0;
- this.timers = 0;
- this.subLoadCom = false;
- LoadView.instance = this;
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- static get Instance() {
- return LoadView.instance;
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- OnShow(data) {
- this.proTex.text = "0%";
- this.pro1.width = 0;
- this.RefreshUI();
- this.LoginGame();
- this.LoadSubpackage();
- Laya.timer.frameOnce(5, this, () => {
- this.Resize();
- });
- WXSdk.AldEvent("进入加载加载界面!");
- let _new = Laya.LocalStorage.getItem("newuser");
- if (_new) {
- this.newuser = false;
- }
- else {
- this.newuser = true;
- Laya.LocalStorage.setItem("newuser", "1");
- }
- }
- RefreshData() {
- this.proLen = this.pro.width;
- }
- RegButton() {
- }
- RefreshUI() {
- Tween$1.to(this.a, {
- x: 1, update: new Laya.Handler(this, () => {
- var num = this.a.x;
- this.pro1.width = this.proLen * num;
- num = num * 100;
- this.proTex.text = Math.ceil(num) + "%";
- })
- }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
- this.proTex.text = "100%";
- this.pro1.width = this.proLen;
- this.proCom = true;
- this.AllCom();
- }));
- }
- LoadRes() {
- if (this.subLoadCom && this.loginCom) {
- ResourcesManager.Instance.Load(() => {
- WXSdk.AldEvent("资源加载成功");
- this.loadResCom = true;
- this.AllCom();
- });
- }
- }
- LoginGame() {
- if (GameVersion.isWx) {
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- this.LocalLogin();
- }
- }
- onWxLoginHandler(params) {
- console.log("微信回调成功!");
- console.log(params);
- if (params == "error" || params.code == null) {
- if (this.errorTime == 0) {
- WXSdk.AldEvent("微信登录失败");
- }
- this.errorTime++;
- if (this.errorTime >= 3)
- return;
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- if (this.errorTime == 0) {
- WXSdk.AldEvent("微信登录成功!");
- }
- let systemInfo = WXSdk.SystemInfo();
- let platformModel = "ipx";
- if (systemInfo != null) {
- var model = systemInfo.model;
- platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
- console.log("platformModel:" + platformModel);
- }
- new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
- this.LocalLogin();
- }
- }
- LocalLogin() {
- NetManager.Instance.login(null, (data) => {
- this.OnLoginComplete(data);
- }, (data) => {
- this.OnLoginError(data);
- });
- }
- OnLoginComplete(data) {
- if (data["code"] != "0") {
- console.log("登录异常错误!");
- WXSdk.AldEvent("本地登录成功!");
- this.timers++;
- if (this.timers >= 4)
- return;
- if (GameVersion.isWx) {
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- this.LocalLogin();
- }
- }
- else {
- this.loginCom = true;
- this.LoadRes();
- FYHD_Sdk.InitSdk();
- this.AllCom();
- }
- }
- OnLoginError(data) {
- console.log("登录错误");
- WXSdk.AldEvent("本地登陆失败");
- }
- LoadSubpackage() {
- WXSdk.LoadSubPackage("subpackage", (com) => {
- if (com) {
- console.log("subpackage com++++++++++++++++");
- LoadView.instance.subLoadCom = true;
- LoadView.instance.LoadRes();
- }
- });
- }
- AllCom() {
- if (this.proCom && this.loadResCom && this.loginCom) {
- GuangGao.InitVideo();
- Laya.timer.once(1000, this, () => {
- FYHD_Sdk.ValueUser();
- WXSdk.AldEvent("进入主界面");
- ViewManager.Instance.OpenView(ViewType.MainView);
- if (!this.newuser && FYHD_Sdk.iswhite) {
- ViewManager.Instance.AddView(ViewType.GiftView);
- }
- MouseEvent.Instance.InitMouseEvent();
- ShareModule.OnShowHandle();
- SettingController.Instance.Init();
- OnHideHandler.Reg();
- SettingController.Instance._playMusic();
- });
- }
- }
- OnClose() {
- LoadView.instance = null;
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- }
- }
- class MainView extends ui.MainViewUI {
- constructor() {
- super();
- this.isTryed = false;
- MainView.instance = this;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- static get Instance() {
- return MainView.instance;
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- this.SetData();
- this.SetTopAd();
- }
- RefreshUI() {
- this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
- this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.SetStage();
- this.SetStagePro(0);
- this.SetSettingBox(false);
- this.MoreFunBtn2.bottom = this.sliderBox.bottom + 155;
- }
- RefreshData() {
- this.GetImage();
- this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
- this.proWidth = this.pro.width;
- this.isTryed = false;
- }
- AdaptiveUI() {
- }
- moreFunc(ist) {
- if (ist) ;
- else {
- console.log("mainui");
- }
- }
- RegButton() {
- this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- this.settingBtn.CZ = () => {
- this.SetSettingBox();
- };
- this.skinBtn.CZ = () => {
- ViewManager.Instance.AddView(ViewType.SKinShopView);
- };
- this.updateBtn.CZ = () => {
- ViewManager.Instance.AddView(ViewType.IntensifyView);
- };
- DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
- DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
- DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
- DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
- this.sound_btn.clickHandler = new Laya.Handler(this, () => {
- this.ClickSound();
- });
- this.shake_btn.clickHandler = new Laya.Handler(this, () => {
- this.ClickShake();
- });
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.MoreGameBtn.clickHandler = new Laya.Handler(this, this.ClickExport);
- this.MoreFunBtn2.clickHandler = new Laya.Handler(this, this.ClickExport);
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.VideoGetCoinBtn.clickHandler = new Laya.Handler(this, this.VideoGet);
- this.CloseVideoBtn.clickHandler = new Laya.Handler(this, this.CloseVideoGet);
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- ClickExport() {
- ViewManager.Instance.AddView(ViewType.ExportView);
- }
- SetStage() {
- this.stageValue.text = PlayerManager.Instance.stage.toString();
- }
- SetStagePro(value) {
- value = value >= 1 ? 1 : value;
- this.pro1.width = this.proWidth * value;
- }
- SetPlayerGrade(num) {
- this.tempTarGrade = num;
- this.coinFollow.target = num;
- Laya.timer.frameLoop(1, this, this.T2);
- }
- T2() {
- this.coinFollow.update();
- let v = Math.ceil(this.coinFollow.follow);
- this.countValue.text = v.toString();
- if (v >= this.tempTarGrade) {
- this.countValue.text = this.tempTarGrade.toString();
- Laya.timer.clear(this, this.T2);
- }
- }
- StartGame(e) {
- if (this.isTryed) {
- this.TryStartGame();
- return;
- }
- if (e.target instanceof Laya.UIComponent) {
- if (e.target.name != "mainBox")
- return;
- }
- console.log("click");
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
- if (data["play_id"]) {
- PlayerManager.Instance.Play_Id = data["play_id"];
- }
- WXSdk.Start(PlayerManager.Instance.stage.toString());
- if (GameManager.GameCount == 1) {
- ViewManager.Instance.AddView(ViewType.TrialView);
- }
- else {
- this.MainStartGame();
- }
- }, (data) => {
- });
- }
- MainStartGame() {
- GameManager.GameCount++;
- GameManager.GameNum++;
- this.mainBox.visible = false;
- this.sliderBox.visible = false;
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- this.gameStart.stop();
- GameManager.Instance.Start();
- MouseEvent.Instance.StartGameClick();
- MainRoleManager.Instance.Start();
- MateManager.Instance.TrialModelPlayAni();
- StreetManager.Instance.SetBlock();
- }
- TryStartGame() {
- GameManager.GameCount++;
- GameManager.GameNum++;
- this.sliderBox.visible = false;
- this.gameStart.stop();
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- GameManager.Instance.Start();
- MouseEvent.Instance.StartGameClick();
- MainRoleManager.Instance.Start();
- MateManager.Instance.TrialModelPlayAni();
- StreetManager.Instance.SetBlock();
- }
- TryClick() {
- this.isTryed = true;
- this.mainBox.visible = false;
- }
- ShowMainBox() {
- this.mainBox.visible = true;
- this.sliderBox.visible = true;
- this.gameStart.play(0, true);
- this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.isTryed = false;
- this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- }
- SetSettingBox(ist = true) {
- if (!ist) {
- this.settingBox.visible = false;
- return;
- }
- this.settingBox.visible = !this.settingBox.visible;
- }
- GetImage() {
- this.sound_open = this.sound_btn.getChildByName("kai");
- this.sound_guan = this.sound_btn.getChildByName("guan");
- this.shake_open = this.shake_btn.getChildByName("kai");
- this.shake_guan = this.shake_btn.getChildByName("guan");
- this.ShowSound(SettingController.Instance.sound);
- this.ShowShake(SettingController.Instance.vibrate);
- }
- ClickSound() {
- SettingController.Instance.sound = !SettingController.Instance.sound;
- this.ShowSound(SettingController.Instance.sound);
- }
- ShowSound(isshow) {
- if (!isshow) {
- this.sound_open.visible = false;
- this.sound_guan.visible = true;
- SettingController.Instance.SettingSound(0);
- Laya.LocalStorage.setItem("sound", "0");
- console.log("关闭声音");
- }
- else {
- this.sound_open.visible = true;
- this.sound_guan.visible = false;
- SettingController.Instance.SettingSound(1);
- Laya.LocalStorage.setItem("sound", "1");
- console.log("开启声音");
- }
- }
- ClickShake() {
- SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
- this.ShowShake(SettingController.Instance.vibrate);
- }
- ShowShake(isshow) {
- if (!isshow) {
- this.shake_open.visible = false;
- this.shake_guan.visible = true;
- Laya.LocalStorage.setItem("vibrate", "0");
- console.log("关闭震动");
- }
- else {
- this.shake_open.visible = true;
- this.shake_guan.visible = false;
- Laya.LocalStorage.setItem("vibrate", "1");
- console.log("开启震动");
- }
- }
- OnClose() {
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
- DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
- DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
- DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
- MainView.instance = null;
- Laya.timer.clearAll(this);
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- SetData() {
- FYHD_Sdk.SetHuTuiList(this.BottomList, 2, "");
- this.GunGun();
- }
- GunGun() {
- var maxBtm;
- try {
- this.BottomList.scrollBar.value = 0;
- maxBtm = this.BottomList.scrollBar.max;
- }
- catch (error) {
- console.error(error);
- return;
- }
- var tempBtm = 1;
- Laya.timer.frameLoop(1, this, () => {
- this.BottomList.scrollBar.value += tempBtm;
- if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
- tempBtm = -tempBtm;
- }
- });
- }
- SetTopAd() {
- if (Laya.Browser.onPC)
- return;
- this.topAdData = FYHD_Sdk.pushData || [];
- this.LeftPushIcon.visible = this.RightPushIcon.visible = this.topAdData.length >= 2;
- if (this.topAdData.length < 2)
- return;
- this.topLeftAdIndex = { index: 0 };
- this.topRightAdIndex = { index: 1 };
- this._setTopAd(this.LeftPushIcon, this.topLeftAdIndex);
- this._setTopAd(this.RightPushIcon, this.topRightAdIndex);
- }
- _setTopAd(topAd, adIndex) {
- let _icon = topAd.getChildByName("icon");
- let _name = topAd.getChildByName("name");
- topAd.clickHandler = new Laya.Handler(this, () => {
- FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
- });
- this._setIcon(_icon, _name, adIndex);
- Laya.timer.loop(3000, this, () => {
- this._setIcon(_icon, _name, adIndex);
- this.lefticon.play(null, false);
- this.righticon.play(null, false);
- });
- }
- _setIcon(_icon, _name, adIndex) {
- adIndex.index = (adIndex.index + 2) % this.topAdData.length;
- _icon.skin = this.topAdData[adIndex.index].icon;
- _name.text = this.topAdData[adIndex.index].togame_name;
- }
- ShowBoxPanel() {
- this.BoxPanel.visible = true;
- this.CloseVideoBtn.visible = false;
- Laya.timer.once(2000, this, () => {
- this.CloseVideoBtn.visible = true;
- });
- GuangGao.Instance.showBanner2((_banner) => {
- if (_banner) {
- this.banner = _banner["banner"];
- }
- });
- }
- HideBoxPanel() {
- this.BoxPanel.visible = false;
- if (this.banner) {
- this.banner.hide();
- }
- }
- VideoGet() {
- GuangGao.ShowVideo((isLoad) => {
- if (isLoad) {
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- ViewManager.Instance.ShowTips("金币:X" + 200);
- this.HideBoxPanel();
- }, (data) => {
- });
- }
- });
- }
- CloseVideoGet() {
- this.HideBoxPanel();
- }
- }
- class CompleteView extends ui.CompleteViewUI {
- constructor() {
- super();
- this.isWin = false;
- this.clicknum = 0;
- CompleteView.instance = this;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- static get Instance() {
- return CompleteView.instance;
- }
- OnShow(data) {
- this.isWin = data;
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- this.SetTopAd();
- if (GameManager.GameCount == 1 || GameManager.GameCount >= 4) {
- GuangGao.Instance.showBanner((_banner) => {
- if (_banner) {
- this.banner = _banner["banner"];
- console.log("banner加载完毕---", this.banner);
- }
- });
- this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300;
- }
- else {
- if (FYHD_Sdk.iswhite) {
- this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 50;
- }
- else {
- GuangGao.Instance.showBanner((_banner) => {
- if (_banner) {
- this.banner = _banner["banner"];
- console.log("banner加载完毕---", this.banner);
- }
- });
- this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300;
- }
- }
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- RefreshData() {
- this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
- this.tes1 = this.coinValue;
- this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
- let iswin = this.isWin == true ? 1 : 0;
- let count = this.coinValue;
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
- }, (data) => {
- ViewManager.Instance.ShowTips("结算失败");
- });
- if (this.isWin) {
- SettingController.Instance.PlaySound(SoundType.win);
- WXSdk.Success(PlayerManager.Instance.stage.toString());
- }
- else {
- SettingController.Instance.PlaySound(SoundType.defeat);
- WXSdk.Fail(PlayerManager.Instance.stage.toString());
- }
- }
- RegButton() {
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.doublegetBtn.CZ = () => {
- this.DoubleGet();
- };
- this.nextBtn.CZ = () => {
- this.clicknum++;
- if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) {
- if (this.isWin) {
- this.Next();
- }
- else {
- this.Resset();
- }
- }
- else {
- if (FYHD_Sdk.iswhite) {
- if (this.clicknum <= 1) {
- GuangGao.CheatBanner3(this.nextBtn, () => {
- });
- }
- else {
- if (this.isWin) {
- this.Next();
- }
- else {
- this.Resset();
- }
- }
- }
- else {
- if (this.isWin) {
- this.Next();
- }
- else {
- this.Resset();
- }
- }
- }
- };
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- Next() {
- GameManager.Instance.LevelUp();
- }
- Resset() {
- ViewManager.Instance.CloseView(ViewType.CompleteView);
- GameManager.Instance.ReStart();
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- CompleteView.instance = null;
- Laya.timer.clearAll(this);
- if (FYHD_Sdk.iswhite) {
- if (GuangGao.Instance._bannerAd3) {
- GuangGao.Instance._bannerAd3.hide();
- }
- if (GuangGao.Instance._bannerAd) {
- GuangGao.Instance._bannerAd.hide();
- }
- }
- if (GameManager.GameNum == 1) {
- if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) {
- ViewManager.Instance.AddView(ViewType.GoldEggView);
- }
- ViewManager.Instance.AddView(ViewType.ExportView);
- }
- else {
- if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) {
- ViewManager.Instance.AddView(ViewType.GoldEggView);
- }
- ViewManager.Instance.AddView(ViewType.ExportView, true);
- }
- }
- RefreshUI() {
- this.winTop.visible = this.isWin;
- this.shibaiTop.visible = !this.isWin;
- this.valueText.text = "+" + this.coinValue;
- this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
- this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
- this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
- this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
- this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
- this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
- }
- DoubleGet() {
- GuangGao.ShowVideo((isok) => {
- if (isok) {
- WXSdk.AldEvent("结束界面看视屏获得钱");
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
- this.Next();
- }, (data) => {
- });
- }
- });
- }
- SetTopAd() {
- if (Laya.Browser.onPC)
- return;
- this.topAdData = FYHD_Sdk.pushData || [];
- if (this.topAdData.length < 4)
- return;
- this.topLeftAdIndex = { index: 0 };
- this.topRightAdIndex = { index: 1 };
- this.bottomleftAdIndex = { index: 2 };
- this.bottomRightAdIndex = { index: 3 };
- this._setTopAd(this.LeftTopPushIcon, this.topLeftAdIndex);
- this._setTopAd(this.LeftBottomPushIcon, this.bottomleftAdIndex);
- this._setTopAd(this.RightTopPushIcon, this.topRightAdIndex);
- this._setTopAd(this.RightBottomPushIcon, this.bottomRightAdIndex);
- }
- _setTopAd(topAd, adIndex) {
- let _icon = topAd.getChildByName("icon");
- let _name = topAd.getChildByName("name");
- topAd.clickHandler = new Laya.Handler(this, () => {
- FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
- });
- this._setIcon(_icon, _name, adIndex);
- Laya.timer.loop(3000, this, () => {
- this._setIcon(_icon, _name, adIndex);
- this.pushshake.play(null, false);
- });
- }
- _setIcon(_icon, _name, adIndex) {
- adIndex.index = (adIndex.index + 4) % this.topAdData.length;
- _icon.skin = this.topAdData[adIndex.index].icon;
- _name.text = this.topAdData[adIndex.index].togame_name;
- }
- }
- class InGameView extends ui.InGameViewUI {
- static get Instance() {
- return InGameView.instance;
- }
- constructor() {
- super();
- InGameView.instance = this;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- RefreshData() {
- }
- RegButton() {
- }
- RefreshUI() {
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- InGameView.instance = null;
- Laya.timer.clearAll(this);
- }
- }
- class IntensifyView extends ui.IntensifyViewUI {
- constructor() {
- super();
- this.iscoinShowfreecoinbtn = false;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- GuangGao.Instance.showBanner2((_banner) => {
- if (_banner) {
- this.banner = _banner["banner"];
- console.log("banner加载成功--");
- }
- });
- }
- RefreshUI() {
- this.InitUi();
- this.RefreshCoinShow();
- let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
- this.freecoinValue = Math.floor(t * 1.2);
- this.coinValue.text = this.freecoinValue.toString();
- }
- RefreshData() {
- this.tempPowerLevel = PlayerManager.Instance.powerLevel;
- this.tempRateLevel = PlayerManager.Instance.rateLevel;
- this.RefreshData2();
- }
- RefreshData2() {
- let detail = UserModel.Instance.CurModel.user_video.detail;
- if (!detail)
- this.iscoinShowfreecoinbtn = true;
- else {
- let freet = detail.freecoin;
- if (!freet) {
- this.iscoinShowfreecoinbtn = true;
- return;
- }
- if (freet < AppSetting.freeGetcoinTime) {
- this.iscoinShowfreecoinbtn = true;
- return;
- }
- this.iscoinShowfreecoinbtn = false;
- }
- }
- RegButton() {
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.backBtn.visible = false;
- Laya.timer.once(3000, this, () => {
- this.backBtn.visible = true;
- this.backBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
- });
- this.atkupBtn.clickHandler = new Laya.Handler(this, this.AtkUp);
- this.rateupBtn.clickHandler = new Laya.Handler(this, this.RateUp);
- this.getcoinBtn.clickHandler = new Laya.Handler(this, this.GetCoin);
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- ClickClose() {
- ViewManager.Instance.CloseView(ViewType.IntensifyView);
- }
- AtkUp() {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- ViewManager.Instance.ShowTips("金币不足!", 1);
- return;
- }
- PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("升级界面花钱升级攻击力");
- this.tempPowerLevel++;
- this.InitUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- RateUp() {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- ViewManager.Instance.ShowTips("金币不足!", 1);
- return;
- }
- PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("升级界面花钱升级速度");
- this.tempRateLevel++;
- this.InitUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- GetCoin() {
- GuangGao.ShowVideo((isok) => {
- if (isok) {
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- WXSdk.AldEvent("升级界面看视屏获得钱");
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.RefreshData();
- this.RefreshCoinShow();
- }, (data) => {
- });
- }
- });
- }
- RefreshCoinShow() {
- if (this.iscoinShowfreecoinbtn) {
- this.getcoinBtn.gray = false;
- this.getcoinBtn.mouseEnabled = true;
- }
- else {
- this.getcoinBtn.gray = true;
- this.getcoinBtn.mouseEnabled = false;
- }
- }
- InitUi() {
- this.atkLv.text = "LV" + this.tempPowerLevel;
- let al = NetInfoManager.Instance._atk.length;
- let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
- this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
- this.atkValue.text = this.cost1.toString();
- this.rateLv.text = "LV" + this.tempRateLevel;
- let al1 = NetInfoManager.Instance._rate.length;
- let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
- this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
- this.rateValue.text = this.cost2.toString();
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- this.atkupBtn.gray = true;
- this.atkupBtn.mouseEnabled = false;
- }
- else {
- this.atkupBtn.gray = false;
- this.atkupBtn.mouseEnabled = true;
- }
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- this.rateupBtn.gray = true;
- this.rateupBtn.mouseEnabled = false;
- }
- else {
- this.rateupBtn.gray = false;
- this.rateupBtn.mouseEnabled = true;
- }
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
- PlayerManager.Instance.SetInfo();
- }
- if (FYHD_Sdk.iswhite) {
- this.banner.hide();
- }
- else {
- GuangGao.Instance.hideBanner2();
- }
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- class AttributeUpView extends ui.AttributeUpViewUI {
- constructor() {
- super();
- this.iscanShowVideoBtn = true;
- this.isatkvideo = false;
- this.isfirstatkvideo = true;
- this.isfirstratevideo = true;
- this.isratevideo = false;
- this.atkShow = false;
- this.PushDataArray = [];
- this.doudongcishu = 2;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- this.InitPushData();
- }
- RefreshUI() {
- this.SetUi();
- }
- SetUi() {
- this.atkLv.text = "LV" + this.tempPowerLevel;
- let al = NetInfoManager.Instance._atk.length;
- let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
- this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
- this.atkValue.text = this.cost1.toString();
- this.rateLv.text = "LV" + this.tempRateLevel;
- let al1 = NetInfoManager.Instance._rate.length;
- let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
- this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
- this.rateValue.text = this.cost2.toString();
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
- this.isatkvideo = true;
- this._atk.visible = false;
- this._atkVideo.visible = true;
- this.atkBtn.mouseEnabled = true;
- this.atkBtn.gray = false;
- this.click1.visible = true;
- this.atkShow = true;
- }
- else {
- this.atkBtn.mouseEnabled = false;
- this.atkBtn.gray = true;
- this.isatkvideo = false;
- this.click1.visible = false;
- this.atkShow = false;
- }
- }
- else {
- this._atk.visible = true;
- this._atkVideo.visible = false;
- this.atkBtn.gray = false;
- this.atkBtn.mouseEnabled = true;
- this.isatkvideo = false;
- this.click1.visible = true;
- this.atkShow = true;
- }
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- if (this.iscanShowVideoBtn && this.isfirstratevideo) {
- this.isratevideo = true;
- this._rate.visible = false;
- this._rateVideo.visible = true;
- this.rateBtn.mouseEnabled = true;
- this.rateBtn.gray = false;
- if (this.atkShow)
- this.click2.visible = false;
- else
- this.click2.visible = true;
- }
- else {
- this.rateBtn.mouseEnabled = false;
- this.rateBtn.gray = true;
- this.isratevideo = false;
- this.click2.visible = false;
- }
- }
- else {
- this._rate.visible = true;
- this._rateVideo.visible = false;
- this.rateBtn.gray = false;
- this.rateBtn.mouseEnabled = true;
- this.isratevideo = false;
- if (this.atkShow)
- this.click2.visible = false;
- else
- this.click2.visible = true;
- }
- }
- RefreshData() {
- this.tempPowerLevel = PlayerManager.Instance.powerLevel;
- this.tempRateLevel = PlayerManager.Instance.rateLevel;
- let detail = UserModel.Instance.CurModel.user_video.detail;
- if (!detail)
- this.iscanShowVideoBtn = true;
- else {
- let freet = detail.free;
- if (!freet) {
- this.iscanShowVideoBtn = true;
- return;
- }
- if (freet < AppSetting.freeUpdateVideotime) {
- this.iscanShowVideoBtn = true;
- return;
- }
- {
- this.iscanShowVideoBtn = false;
- }
- }
- }
- RegButton() {
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.backBtn.CZ = () => {
- this.BackClickHandler();
- };
- this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
- this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- AtkBtnHandler() {
- if (this.isatkvideo) {
- GuangGao.ShowVideo((iscom) => {
- if (iscom) {
- PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面看视屏升级攻击力");
- this.tempPowerLevel++;
- this.isfirstatkvideo = false;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- });
- }
- else {
- PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面花钱升级攻击力");
- this.tempPowerLevel++;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- }
- RateBtnHandler() {
- if (this.isratevideo) {
- GuangGao.ShowVideo((iscom) => {
- if (iscom) {
- PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面看视屏升级速度");
- this.tempRateLevel++;
- this.isfirstratevideo = false;
- this.SetUi();
- }
- });
- }
- });
- }
- else {
- PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面花钱升级速度");
- this.tempRateLevel++;
- this.SetUi();
- }
- });
- }
- }
- BackClickHandler() {
- ViewManager.Instance.CloseView(ViewType.AttributeUpView);
- GameManager.Instance.ReStart();
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
- PlayerManager.Instance.SetInfo();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- InitPushData() {
- for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
- if (i < 6) {
- this.PushDataArray.push(FYHD_Sdk.pushData[i]);
- }
- }
- for (let j = 0; j < this.PushBox.numChildren; j++) {
- let box = this.PushBox.getChildAt(j);
- let icon = box.getChildByName("icon");
- let btn = box.getChildByName("btn");
- let name = box.getChildByName("name");
- icon.skin = this.PushDataArray[j].icon;
- name.text = this.PushDataArray[j].togame_name;
- btn.clickHandler = new Laya.Handler(this, this.clickAd, [this.PushDataArray[j]]);
- }
- Laya.timer.loop(3000, this, this.Doudong);
- }
- clickAd(_data) {
- FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
- FYHD_Sdk.ShowHuTuiJump(_data);
- }
- PlayAni() {
- this.shakeani.play(null, false);
- }
- Doudong() {
- this.PlayAni();
- this.doudongcishu++;
- let _arr = [];
- if (this.doudongcishu % 2 == 0) {
- for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
- if (i < 6) {
- _arr.push(FYHD_Sdk.pushData[i]);
- }
- }
- for (let j = 0; j < this.PushBox.numChildren; j++) {
- let box = this.PushBox.getChildAt(j);
- let icon = box.getChildByName("icon");
- let btn = box.getChildByName("btn");
- icon.skin = _arr[j].icon;
- btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
- }
- }
- else {
- let num = 0;
- for (let i = FYHD_Sdk.pushData.length - 1; i > -1; i--) {
- if (num < 6) {
- _arr.push(FYHD_Sdk.pushData[i]);
- }
- num++;
- }
- for (let j = 0; j < this.PushBox.numChildren; j++) {
- let box = this.PushBox.getChildAt(j);
- let icon = box.getChildByName("icon");
- let btn = box.getChildByName("btn");
- icon.skin = _arr[j].icon;
- btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
- }
- }
- }
- }
- var Vector3$6 = Laya.Vector3;
- class DisplayerCarController {
- static get Instance() {
- return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
- }
- CreatePlayer(id) {
- if (!id)
- id = PlayerManager.Instance.equipId;
- if (!this.player) {
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
- if (p)
- this.player = p;
- this.mainscene.addChild(this.player);
- this.player.transform.localPosition = MathTool.VecZero;
- this.player.transform.localRotationEuler = MathTool.VecZero;
- }
- else {
- GamePool.Instance.RecoverModel(this.player);
- let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
- if (p)
- this.player = p;
- this.mainscene.addChild(this.player);
- this.player.transform.localPosition = MathTool.VecZero;
- this.player.transform.localRotationEuler = MathTool.VecZero;
- }
- let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
- anima.play(MusicType.Dance);
- anima.speed = 1;
- }
- Reset() {
- if (this.mainscene) {
- this.mainscene.removeSelf();
- }
- if (this.player) {
- GamePool.Instance.RecoverModel(this.player);
- this.player = null;
- }
- }
- InitDis(par) {
- if (!this.mainscene) {
- this.mainscene = new Laya.Scene3D();
- this.maincamera = new Laya.Camera();
- this.maincamera.enableHDR = false;
- this.mainscene.addChild(this.maincamera);
- this.light = new Laya.DirectionLight();
- this.light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
- this.light.intensity = 0.45;
- this.light.color = new Vector3$6(1, 1, 1);
- this.mainscene.addChild(this.light);
- let or = 1;
- this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
- this.maincamera.orthographic = false;
- this.maincamera.enableHDR = false;
- this.maincamera.clearFlag = 2;
- this.maincamera.fieldOfView = 60;
- this.maincamera.transform.position = new Vector3$6(0, 1.52, 3.12);
- this.maincamera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
- }
- let or = 1;
- this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
- par.addChild(this.mainscene);
- this.CreatePlayer();
- }
- }
- class SKinShopView extends ui.SkinShopViewUI {
- static get Instance() {
- return SKinShopView.instance;
- }
- constructor() {
- super();
- SKinShopView.instance = this;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- WXSdk.AldEvent("打开皮肤界面");
- }
- RefreshData() {
- this.oignPlayerid = PlayerManager.Instance.equipId;
- this.operateIndex = this.oignPlayerid;
- }
- RefreshUI(data) {
- this.SetBtnUi(this.operateIndex);
- this.RefreshBtnUi(this.operateIndex);
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- RefreshBtnUi(index) {
- if (PlayerManager.Instance.equipId == index) {
- this.using.visible = true;
- this.use.visible = false;
- this.coin.visible = false;
- this.video.visible = false;
- return;
- }
- if (UserModel.Instance.CurModel.HasTheme(index)) {
- this.using.visible = false;
- this.use.visible = true;
- this.coin.visible = false;
- this.video.visible = false;
- return;
- }
- let data = NetInfoManager.Instance.GetTheme(index);
- if (data.require_type == 2) {
- this.using.visible = false;
- this.use.visible = false;
- this.coin.visible = true;
- this.video.visible = false;
- this.coinValue = Number(data.require_num);
- this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
- return;
- }
- if (data.require_type == 3) {
- this.using.visible = false;
- this.use.visible = false;
- this.coin.visible = false;
- this.video.visible = true;
- this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
- return;
- }
- }
- SetBtnUi(index) {
- if (index == 1) {
- this.leftBtn.getChildByName("leftFalse").visible = true;
- this.leftBtn.getChildByName("leftTrue").visible = false;
- this.rightBtn.getChildByName("rightFalse").visible = false;
- this.rightBtn.getChildByName("rightTrue").visible = true;
- return;
- }
- if (index == 8) {
- this.leftBtn.getChildByName("leftFalse").visible = false;
- this.leftBtn.getChildByName("leftTrue").visible = true;
- this.rightBtn.getChildByName("rightFalse").visible = true;
- this.rightBtn.getChildByName("rightTrue").visible = false;
- return;
- }
- this.leftBtn.getChildByName("leftFalse").visible = false;
- this.leftBtn.getChildByName("leftTrue").visible = true;
- this.rightBtn.getChildByName("rightFalse").visible = false;
- this.rightBtn.getChildByName("rightTrue").visible = true;
- }
- ClickClose() {
- DisplayerCarController.Instance.Reset();
- if (this.oignPlayerid != PlayerManager.Instance.equipId) {
- MainRoleManager.Instance.ChangeModel();
- }
- ViewManager.Instance.CloseView(ViewType.SKinShopView);
- }
- ClickVideo() {
- GuangGao.ShowVideo((done) => {
- if (done) {
- WXSdk.AldEvent("商店中看视屏获得皮肤");
- this.VideoGet();
- }
- });
- }
- ;
- VideoGet() {
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.RefreshBtnUi(this.operateIndex);
- }, (data) => {
- });
- }
- Buy() {
- var param = [{ "id": this.operateIndex }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.RefreshBtnUi(this.operateIndex);
- }, (data) => {
- });
- }
- Equip() {
- var param = [{ "id": this.operateIndex }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.RefreshBtnUi(this.operateIndex);
- }, (data) => {
- });
- }
- RegButton() {
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.CloseBtn.visible = false;
- Laya.timer.once(3000, this, () => {
- this.CloseBtn.visible = true;
- this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
- });
- this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 1)
- return;
- this.operateIndex--;
- this.SetBtnUi(this.operateIndex);
- this.RefreshBtnUi(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 8)
- return;
- this.operateIndex++;
- this.SetBtnUi(this.operateIndex);
- this.RefreshBtnUi(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.use.CZ = () => {
- this.Equip();
- };
- this.coin.CZ = () => {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
- ViewManager.Instance.ShowTips("金币不足!", 2);
- else
- this.Buy();
- };
- this.video.CZ = () => {
- this.ClickVideo();
- };
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- SKinShopView.instance = null;
- WXSdk.AldEvent("关闭皮肤界面");
- }
- }
- class TrialView extends ui.TrialViewUI {
- constructor() {
- super();
- this.clicknum = 0;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RegButton();
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) {
- console.log("第一局游戏》》》》");
- GuangGao.Instance.showBanner2((_banner) => {
- if (_banner) {
- this.banner = _banner["banner"];
- }
- });
- this.backBtn.y = Laya.stage.height - this.backBtn.height - 300;
- }
- else {
- console.log("非第一局游戏1》》》》");
- if (FYHD_Sdk.iswhite) {
- this.backBtn.y = Laya.stage.height - this.backBtn.height - 50;
- }
- else {
- GuangGao.Instance.showBanner2();
- this.backBtn.y = Laya.stage.height - this.backBtn.height - 300;
- }
- }
- }
- RefreshUI() {
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- RefreshData() {
- }
- RegButton() {
- this.ExitBtn.visible = FYHD_Sdk.iswhite;
- this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
- this.videoBtn.CZ = () => {
- this.VideoHandler();
- };
- this.backBtn.CZ = () => {
- this.clicknum++;
- if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) {
- console.log("第一局游戏2》》》》");
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- }
- else {
- console.log("非第一局游戏2》》》》");
- if (FYHD_Sdk.iswhite) {
- if (this.clicknum <= 1) {
- GuangGao.CheatBanner2(this.backBtn);
- }
- else {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- }
- }
- else {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- }
- }
- };
- }
- ClickExit() {
- ViewManager.Instance.AddView(ViewType.ExitView);
- }
- VideoHandler() {
- GuangGao.ShowVideo((isok) => {
- if (isok) {
- WXSdk.AldEvent("看视屏试用");
- this.VideoCom();
- }
- });
- }
- VideoCom() {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- MateManager.Instance.Trial();
- }
- BackUi() {
- ViewManager.Instance.CloseView(ViewType.TrialView);
- if (MainView.Instance)
- MainView.Instance.TryClick();
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- if (FYHD_Sdk.iswhite) {
- if (GuangGao.Instance._bannerAd2) {
- GuangGao.Instance._bannerAd2.hide();
- }
- if (GuangGao.Instance._bannerAd3) {
- GuangGao.Instance._bannerAd3.hide();
- }
- }
- else {
- GuangGao.Instance.hideBanner2();
- }
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- class GuideView extends ui.GuideViewUI {
- constructor() {
- super();
- this.isguide2or3 = false;
- this.guide1pos = MathTool.VecZero;
- this.guide1Com = false;
- GuideView.instance = this;
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- static get Instance() {
- return GuideView.instance;
- }
- OnShow(data) {
- this.RegButton();
- this.RefreshData();
- this.RefreshUI();
- }
- RefreshUI() {
- }
- RefreshData() {
- }
- RegButton() {
- }
- TwoGuide() {
- this.guide3Box.visible = true;
- this.guide4Box.visible = true;
- this.guide2Image.visible = true;
- this.guide3.play(0, true);
- this.guide4.play(0, true);
- Laya.timer.frameLoop(1, this, this._twoguide);
- this.guide1pos.x = -4.5;
- this.guide1pos.y = 0;
- }
- _twoguide() {
- let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guidetwoPos.clone());
- this.guide4Box.pos(p.x, p.y);
- this.guide1pos.z = this.playerTran.localPositionZ + 5;
- let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
- this.guide3Box.pos(p1.x, p1.y);
- if (this.playerTran.localPositionZ >= GuideController.Instance.guidetwoPos.z - 10) {
- this.guide3Box.visible = false;
- this.guide4Box.visible = false;
- this.guide2Image.visible = false;
- this.guide3Image.visible = true;
- this.guide3.stop();
- this.guide4.stop();
- Laya.timer.clear(this, this._twoguide);
- Laya.timer.once(5000, this, () => {
- GuideController.Instance.GuideOff();
- });
- }
- }
- SetGuide(type) {
- if (!this.playerTran)
- this.playerTran = MainRoleManager.Instance.playerTra;
- if (!this._camera)
- this._camera = CameraManager.Instance._maincamera;
- if (type == 1) {
- this.guide1Image.visible = true;
- this.guide2Image.visible = false;
- this.guide3Image.visible = false;
- this.guide1Box.visible = true;
- this.guide1.play(0, true);
- this.guide4Box.visible = false;
- if (this.playerTran.localPositionX <= GuideController.Instance.guideonepos.x) {
- this.guide2Box.visible = true;
- this.guide3Box.visible = false;
- this.isguide2or3 = true;
- this.guide2.play(0, true);
- }
- else {
- this.guide2Box.visible = false;
- this.guide3Box.visible = true;
- this.isguide2or3 = false;
- this.guide3.play(0, true);
- }
- this.guide1pos = GuideController.Instance.guideonepos.clone();
- Laya.timer.frameLoop(1, this, this.OneGuide);
- this.guide1Com = false;
- }
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- GuideView.instance = null;
- Laya.timer.clearAll(this);
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- OneGuide() {
- if (!this.guide1Com) {
- let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guideonepos.clone());
- this.guide1Box.pos(p.x, p.y);
- this.guide1pos.z = this.playerTran.localPositionZ + 10;
- let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
- if (this.isguide2or3) {
- this.guide2Box.pos(p1.x, p1.y);
- }
- else {
- this.guide3Box.pos(p1.x, p1.y);
- }
- if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z - 5) {
- this.guide2.stop();
- this.guide3.stop();
- this.guide2Box.visible = false;
- this.guide3Box.visible = false;
- this.guide1Box.visible = false;
- this.guide1Com = true;
- this.guide1Image.visible = false;
- }
- }
- else {
- if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z) {
- console.log(111);
- Laya.timer.clear(this, this.OneGuide);
- this.TwoGuide();
- }
- }
- }
- }
- class ShadeView extends ui.ShadeViewUI {
- constructor() {
- super();
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RegButton();
- }
- RefreshUI() {
- }
- RefreshData() {
- }
- RegButton() {
- this.on(Laya.Event.CLICK, this, this.Test);
- }
- Test() {
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- this.off(Laya.Event.CLICK, this, this.Test);
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- class ExportView extends ui.ExportViewUI {
- constructor() {
- super(...arguments);
- this.jump = false;
- this.clicknum = 0;
- }
- OnShow(data) {
- if (data) {
- this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, [data], false);
- }
- else {
- this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, null, false);
- }
- this.ContinueBtn.clickHandler = Laya.Handler.create(this, this.ClickContinue, null, false);
- this.SetData();
- this.ContinueBtn.visible = FYHD_Sdk.iswhite;
- this.CloseBtn.visible = false;
- Laya.timer.once(3000, this, () => {
- this.CloseBtn.visible = true;
- });
- if (GameManager.GameCount > 1 && GameManager.GameCount < 4 && FYHD_Sdk.iswhite) {
- if (GuangGao.Instance._bannerAd) {
- this._banner = GuangGao.Instance._bannerAd;
- this._banner.hide();
- console.log("banner加载完毕--", this._banner);
- }
- }
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- OnClose() {
- Laya.timer.clearAll(this);
- }
- ClickClose(_data) {
- ViewManager.Instance.CloseView(ViewType.ExportView);
- if (_data) {
- ViewManager.Instance.AddView(ViewType.IntensifyView);
- }
- }
- ClickContinue() {
- this.clicknum++;
- if (FYHD_Sdk.iswhite) {
- if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) {
- let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
- let item = FYHD_Sdk.pushData[ran];
- FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
- FYHD_Sdk.ShowHuTuiJump(item);
- }
- else {
- if (this.clicknum == 1) {
- this.ContinueBtn.mouseEnabled = false;
- if (this._banner) {
- console.log("展示banner");
- this._banner.show();
- Laya.timer.once(1000, this, () => {
- this._banner.hide();
- this.ContinueBtn.mouseEnabled = true;
- });
- }
- else {
- Laya.timer.once(1000, this, () => {
- this.ContinueBtn.mouseEnabled = true;
- });
- }
- }
- else {
- let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
- let item = FYHD_Sdk.pushData[ran];
- FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
- FYHD_Sdk.ShowHuTuiJump(item);
- }
- }
- }
- else {
- ViewManager.Instance.CloseView(ViewType.ExportView);
- }
- }
- SetData() {
- FYHD_Sdk.SetHuTuiList(this.TopList, 2, "");
- FYHD_Sdk.SetHuTuiList(this.BottomList, 1, "");
- this.GunGun();
- }
- GunGun() {
- var maxTop;
- var maxBtm;
- try {
- this.TopList.scrollBar.value = 0;
- this.BottomList.scrollBar.value = 0;
- maxTop = this.TopList.scrollBar.max;
- maxBtm = this.BottomList.scrollBar.max;
- }
- catch (error) {
- console.error(error);
- return;
- }
- var tempTop = 1;
- var tempBtm = 1;
- Laya.timer.frameLoop(1, this, () => {
- this.TopList.scrollBar.value += tempTop;
- if (this.TopList.scrollBar.value >= maxTop || this.TopList.scrollBar.value <= 0) {
- tempTop = -tempTop;
- }
- this.BottomList.scrollBar.value += tempBtm;
- if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
- tempBtm = -tempBtm;
- }
- });
- }
- }
- class ExitView extends ui.ExitViewUI {
- constructor() {
- super();
- this.jump = false;
- ExitView.ins = this;
- }
- static get Instance() {
- if (ExitView.ins) {
- return ExitView.ins;
- }
- else {
- return new ExitView();
- }
- }
- OnShow(data) {
- this.SetData();
- this.Jump();
- if (data) {
- this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose, [data]);
- }
- else {
- this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
- }
- this.CloseBtn.visible = false;
- Laya.timer.once(2000, this, () => {
- this.CloseBtn.visible = true;
- });
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- OnClose() {
- }
- ClickClose(data) {
- ViewManager.Instance.CloseView(ViewType.ExitView);
- if (data) {
- ViewManager.Instance.AddView(ViewType.CompleteView, GameManager.WINORLOSE);
- }
- }
- SetData() {
- FYHD_Sdk.SetHuTuiList(this.PushList, 1, "");
- }
- Jump() {
- let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
- let item = FYHD_Sdk.pushData[ran];
- FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
- FYHD_Sdk.ShowHuTuiJump(item);
- }
- }
- class GoldEggView extends ui.GoldEggViewUI {
- constructor() {
- super();
- this._isComplete = false;
- this._isShowBanner = false;
- this._bannerVal = 0.5;
- this._maxClickCnt = 12;
- this._clickCnt = 0;
- this._interval = 500;
- this._decrement = 0.03;
- this.shownum = 3;
- this.nowshownum = 0;
- GoldEggView.ins = this;
- }
- static get Instance() {
- if (GoldEggView.ins) {
- return GoldEggView.ins;
- }
- else {
- return new GoldEggView();
- }
- }
- RefreshData() {
- }
- RegButton() {
- }
- Resize() {
- }
- RefreshUI(data) {
- }
- OnShow(data = null) {
- this.HitBtn.y = Laya.stage.height - this.HitBtn.height - 50;
- this.kuangdian.y = Laya.stage.height - this.HitBtn.height - 200;
- this.btnscale.play(null, true);
- this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false);
- this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
- this.jindu.value = 0;
- Laya.timer.loop(this._interval, this, this.Daojishi);
- WXSdk.OnShow(this.onBannerHide);
- if (GuangGao.Instance._bannerAd) {
- this.banner = GuangGao.Instance._bannerAd;
- this.banner.hide();
- console.log("金蛋界面banner加载完毕--", this.banner);
- }
- this.height = Laya.stage.height;
- this.BG.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.BG.height = Laya.stage.height;
- this.height = Laya.stage.height;
- });
- }
- ClosePanel() {
- ViewManager.Instance.CloseView(ViewType.AttributeUpView);
- }
- OnClose() {
- console.log("设置界面关闭---");
- }
- QiaoDa() {
- this.ani1.play(null, false);
- this.btnscale.stop();
- this.kuangdian.visible = false;
- if (!this._isComplete) {
- this._clickCnt++;
- if (this._clickCnt > this._maxClickCnt)
- this._clickCnt = this._maxClickCnt;
- let pv = this._clickCnt / this._maxClickCnt;
- if (pv >= 1) {
- pv = 1;
- }
- this.jindu.value = pv;
- if (pv >= this._bannerVal && this.nowshownum < this.shownum) {
- if (this.banner) {
- this.nowshownum++;
- this.banner.show();
- Laya.timer.once(2000, this, () => {
- this.banner.hide();
- this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
- });
- }
- }
- if (pv >= 1) {
- this._isComplete = true;
- this.onBannerHide();
- }
- }
- }
- Daojishi() {
- let pv = this.jindu.value;
- pv -= this._decrement;
- if (pv <= 0)
- pv = 0;
- this.jindu.value = pv;
- if (this._clickCnt > 2) {
- this._clickCnt -= 2;
- }
- }
- onBannerHide() {
- GoldEggView.Instance._isComplete = true;
- ViewManager.Instance.CloseView(ViewType.GoldEggView);
- MainView.Instance.ShowBoxPanel();
- WXSdk.OffShow(this.onBannerHide);
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- ViewManager.Instance.ShowTips("金币:X" + 200);
- }, (data) => {
- });
- if (GuangGao.Instance._bannerAd) {
- GuangGao.Instance._bannerAd.hide();
- }
- }
- }
- class GiftView extends ui.GiftViewUI {
- constructor() {
- super();
- this.shownum = 3;
- this.nowshownum = 0;
- this._isComplete = false;
- this._bannerVal = 0.5;
- this._maxClickCnt = 12;
- this._clickCnt = 0;
- this._interval = 500;
- this._decrement = 0.03;
- GiftView.ins = this;
- }
- static get Instance() {
- if (GiftView.ins == null) {
- return new GiftView();
- }
- return GiftView.ins;
- }
- RefreshData() {
- }
- RegButton() {
- }
- Resize() {
- }
- RefreshUI(data) {
- }
- OnShow() {
- this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false);
- this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
- this.click.play(0, true);
- this.jinduBar.value = 0;
- Laya.timer.loop(this._interval, this, this.Daojishi);
- WXSdk.OnShow(this.onBannerHide);
- GuangGao.Instance.showBanner((banner) => {
- console.log("礼盒界面出现banner---");
- console.log("banner加载完毕--", banner);
- this.banner = banner["banner"];
- banner["banner"].hide();
- }, () => {
- });
- this.height = Laya.stage.height;
- this.BG.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.BG.height = Laya.stage.height;
- this.height = Laya.stage.height;
- });
- }
- OnClose() {
- }
- QiaoDa() {
- this.click.stop();
- this.shou.visible = false;
- if (!this._isComplete) {
- this._clickCnt++;
- if (this._clickCnt > this._maxClickCnt)
- this._clickCnt = this._maxClickCnt;
- let pv = this._clickCnt / this._maxClickCnt;
- if (pv >= 1) {
- pv = 1;
- }
- this.jinduBar.value = pv;
- if (pv >= this._bannerVal && this.nowshownum < this.shownum) {
- if (this.banner) {
- console.log("有banner", this.banner);
- this.banner.show();
- this.nowshownum++;
- Laya.timer.once(2000, this, () => {
- this.banner.hide();
- this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
- });
- }
- }
- if (pv >= 1) {
- this._isComplete = true;
- this.onBannerHide();
- }
- }
- }
- Daojishi() {
- let pv = this.jinduBar.value;
- pv -= this._decrement;
- if (pv <= 0)
- pv = 0;
- this.jinduBar.value = pv;
- if (this._clickCnt > 2) {
- this._clickCnt -= 2;
- }
- }
- onBannerHide() {
- if (GiftView.Instance.banner)
- GiftView.Instance.banner.hide();
- WXSdk.OffShow(this.onBannerHide);
- ViewManager.Instance.CloseView(ViewType.GiftView);
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- ViewManager.Instance.ShowTips("金币:X" + 200);
- }, (data) => {
- });
- }
- }
- var ViewType;
- (function (ViewType) {
- ViewType[ViewType["InGameView"] = 0] = "InGameView";
- ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
- ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
- ViewType[ViewType["LoadView"] = 3] = "LoadView";
- ViewType[ViewType["MainView"] = 4] = "MainView";
- ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
- ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
- ViewType[ViewType["TrialView"] = 7] = "TrialView";
- ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
- ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
- ViewType[ViewType["ExportView"] = 10] = "ExportView";
- ViewType[ViewType["ExitView"] = 11] = "ExitView";
- ViewType[ViewType["GoldEggView"] = 12] = "GoldEggView";
- ViewType[ViewType["GiftView"] = 13] = "GiftView";
- })(ViewType || (ViewType = {}));
- class ViewManager {
- constructor() {
- this.viewDic = [];
- this.addViewDic = new Dictionary();
- this.showpushview = 0;
- this._maskCnt = 0;
- this.init();
- }
- static get Instance() {
- return this.instance || (this.instance = new ViewManager());
- }
- init() {
- this._maskCnt = 0;
- this.viewDic[ViewType.InGameView] = InGameView;
- this.viewDic[ViewType.LoadView] = LoadView;
- this.viewDic[ViewType.MainView] = MainView;
- this.viewDic[ViewType.IntensifyView] = IntensifyView;
- this.viewDic[ViewType.CompleteView] = CompleteView;
- this.viewDic[ViewType.SKinShopView] = SKinShopView;
- this.viewDic[ViewType.TrialView] = TrialView;
- this.viewDic[ViewType.ShadeView] = ShadeView;
- this.viewDic[ViewType.ExportView] = ExportView;
- this.viewDic[ViewType.ExitView] = ExitView;
- this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
- this.viewDic[ViewType.GoldEggView] = GoldEggView;
- this.viewDic[ViewType.GiftView] = GiftView;
- this.uiNode = new Laya.Sprite();
- this.popNode = new Laya.Sprite();
- Laya.stage.addChild(this.uiNode);
- Laya.stage.addChild(this.popNode);
- this.uiNode.zOrder = 3;
- this.popNode.zOrder = 4;
- }
- OpenView(view, data) {
- if (this.curView != null) {
- this.curView.OnClose();
- this.uiNode.removeChild(this.curView);
- this.curView.destroy(true);
- this.curView = null;
- }
- this.curView = new this.viewDic[view];
- this.uiNode.addChild(this.curView);
- this.curView.OnShow(data);
- }
- get getCurView() {
- return this.curView;
- }
- AddView(view, data) {
- if (this.addViewDic.has(view))
- return;
- let t_view = new this.viewDic[view];
- this.addViewDic.set(view, t_view);
- this.uiNode.addChild(t_view);
- t_view.OnShow(data);
- MouseEvent.Instance.CloseInput();
- }
- RemoveView() {
- if (this.curView != null) {
- this.curView.OnClose();
- this.uiNode.removeChild(this.curView);
- this.curView.destroy(true);
- this.curView = null;
- }
- }
- HaveView(view) {
- return this.addViewDic.has(view);
- }
- CloseView(view) {
- if (!this.addViewDic.has(view))
- return;
- let t_view = this.addViewDic.get(view);
- t_view.OnClose();
- this.uiNode.removeChild(t_view);
- t_view.destroy(true);
- this.addViewDic.delete(view);
- MouseEvent.Instance.OpenInput();
- }
- OpenMask() {
- this._maskCnt++;
- if (this._maskCnt > 1)
- return;
- if (this.curMask != null) {
- this.curMask.OnClose();
- this.popNode.removeChild(this.curView);
- this.curMask.destroy();
- this.curMask = null;
- return;
- }
- this.curMask = new this.viewDic[ViewType.ShadeView];
- if (!this.curMask)
- return;
- console.log("打开遮罩");
- this.popNode.addChild(this.curMask);
- this.curMask.OnShow();
- }
- CloseMask() {
- this._maskCnt--;
- if (this._maskCnt > 0)
- return;
- if (this.curMask != null) {
- this.curMask.OnClose();
- this.popNode.removeChild(this.curMask);
- this.curMask.destroy(true);
- console.log("关闭遮罩");
- this.curMask = null;
- }
- }
- ShowTips(value, type = 1) {
- var warn = GamePool.Instance.GetUi(PoolType.WarnTips);
- if (!warn)
- return;
- if (type == 1) {
- warn.y = 0;
- warn.text = value;
- warn.x = Laya.stage.width >> 1;
- this.popNode.addChild(warn);
- let _end = (Laya.stage.height >> 1) - 300;
- var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
- tw.clear();
- GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
- }));
- }
- else if (type == 2) {
- warn.y = Laya.stage.height - 400;
- warn.text = value;
- warn.x = Laya.stage.width >> 1;
- this.popNode.addChild(warn);
- var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
- tw.clear();
- GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
- warn.alpha = 1;
- }));
- }
- }
- ShowGuideView() {
- if (!this.GuideView) {
- this.GuideView = new GuideView();
- this.popNode.addChild(this.GuideView);
- }
- this.GuideView.OnShow();
- }
- CloseGuideView() {
- if (this.GuideView) {
- this.GuideView.OnClose();
- this.GuideView.removeSelf();
- this.GuideView.destroy();
- }
- }
- }
- class FYHD_Sdk {
- static InitSdk() {
- Laya.Browser.window.sdk.getFyhd().startSdk();
- FYHD_Sdk.UserInfoAuth();
- let white = Laya.LocalStorage.getItem("is_white");
- if (white) {
- FYHD_Sdk.iswhite = true;
- }
- else {
- FYHD_Sdk.getWhiteConfig();
- }
- let newuser = Laya.LocalStorage.getItem("is_newuser");
- if (!newuser) {
- FYHD_Sdk.isnewuser = true;
- Laya.LocalStorage.setItem("is_newuser", "1");
- }
- else {
- FYHD_Sdk.isnewuser = false;
- }
- FYHD_Sdk.PushData();
- }
- static UserInfoAuth() {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, (data) => {
- console.log("无授权回调:" + JSON.stringify(data));
- if (data.result.user) {
- FYHD_Sdk.openid = data.result.user.openid;
- FYHD_Sdk.AuthInfo();
- }
- });
- }
- static AuthInfo() {
- var args = {
- openid: FYHD_Sdk.openid,
- };
- Laya.Browser.window.sdk.getFyhd().loginData(args, (data) => {
- console.log("授权上报回调:" + JSON.stringify(data));
- });
- }
- static ValueUser() {
- var args = {
- openid: FYHD_Sdk.openid,
- };
- Laya.Browser.window.sdk.getFyhd().valueuser(args, (data) => {
- console.log("有效用户上报:" + JSON.stringify(data));
- });
- }
- static getWhiteConfig() {
- Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) {
- FYHD_Sdk.iswhite = e.data.is_white;
- if (FYHD_Sdk.iswhite) {
- Laya.LocalStorage.setItem("is_white", "1");
- }
- console.log("白名单---", e);
- });
- }
- static SetHuTuiList(list, scrol = 1, type = "") {
- let arr = this.pushData;
- if (!arr || arr.length == 0)
- return;
- list.selectEnable = false;
- scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = "";
- list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
- list.array = arr;
- list.refresh();
- }
- static updateItem(type, cell, index) {
- var aditem = cell.getComponent(ListItem);
- aditem.Refresh(type);
- }
- static ClickAd(ad_type) {
- console.log("上报类型---", ad_type);
- if (!Laya.Browser.onWeiXin)
- return;
- var param = {
- ad_type: ad_type,
- openid: FYHD_Sdk.openid
- };
- console.log("点击参数:" + param);
- Laya.Browser.window.sdk.getFyhd().advertisement(param, (data) => {
- console.log("点击结果:" + JSON.stringify(data));
- });
- }
- static PushData() {
- if (!Laya.Browser.onWeiXin)
- return;
- var param = {};
- Laya.Browser.window.sdk.getFyhd().shareRecommend(param, (data) => {
- console.log("热门游戏数据--", data);
- if (data.data) {
- FYHD_Sdk.pushData = data.data;
- FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort);
- FYHD_Sdk.isHaveDate = true;
- }
- console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData));
- });
- }
- static ShowHuTuiJump(data) {
- if (!Laya.Browser.onWeiXin)
- return;
- if (data.jump_type == 2) {
- Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] });
- }
- else if (data.jump_type == 1) {
- Laya.Browser.window.wx.navigateToMiniProgram({
- appId: data.to_appid,
- path: data.jump_path,
- success(res) {
- console.log("上报成功:" + JSON.stringify(res));
- FYHD_Sdk.PushClick(data.to_appid);
- },
- fail(res) {
- ViewManager.Instance.AddView(ViewType.ExportView);
- }
- });
- }
- else if (data.jump_type == 0) {
- Laya.Browser.window.wx.navigateToMiniProgram({
- appId: data.platform_appid,
- path: data.jump_path,
- success(res) {
- console.log("上报成功:" + JSON.stringify(res));
- FYHD_Sdk.PushClick(data.to_appid);
- },
- fail(res) {
- }
- });
- }
- }
- static PushClick(to_appid) {
- if (!Laya.Browser.onWeiXin)
- return;
- var param = {
- openid: FYHD_Sdk.openid,
- to_appid: to_appid,
- };
- Laya.Browser.window.sdk.getFyhd().sharePlay(param, (data) => {
- console.log("点击上报结果:" + JSON.stringify(data));
- });
- }
- static ListSort(a, b) {
- if (Number(a["panel"]) < Number(b["panel"])) {
- return -1;
- }
- if (Number(a["panel"]) == Number(b["panel"])) {
- return 0;
- }
- if (Number(a["panel"]) > Number(b["panel"])) {
- return 1;
- }
- }
- }
- FYHD_Sdk.Ad_ClickType = {
- Video: "video_click",
- Watch: "watch",
- Share: "share",
- Banner: "banner",
- Push: "push",
- PushClick: "icon_click"
- };
- FYHD_Sdk.pushData = [];
- FYHD_Sdk.isHaveDate = false;
- FYHD_Sdk.ShowAd = "ShowAd";
- class ListItem extends Laya.Script {
- constructor() { super(); }
- onAwake() {
- this.self = this.owner;
- this.icon = this.self.getChildByName("icon");
- this.btn = this.self.getChildByName("btn");
- this.name = this.self.getChildByName("name");
- this._tip = this.self.getChildByName("tip");
- this.bottom = this.self.getChildByName("bottom");
- this.remen = this.self.getChildByName("remen");
- this.star = this.self.getChildByName("star");
- this.diandian = this.icon.getChildAt(0);
- this.btn.clickHandler = new Laya.Handler(this, this.clickAd);
- }
- Refresh(type) {
- this.data = this.self.dataSource;
- this.type = type;
- if (this.name) {
- this.name.text = this.data.togame_name;
- }
- if (this._tip) {
- this._tip.visible = true;
- let rnd = GameTool.randomInt(1, 200000);
- let text = rnd.toString() + "人在玩";
- this._tip.text = text;
- }
- if (this.diandian) {
- this.diandian.visible = false;
- }
- if (this.bottom) {
- let num = GameTool.randomInt(1, 6);
- this.bottom.skin = "subpackage/bottom/icontitle" + num + ".png";
- }
- if (this.remen) {
- this.remen.visible = Math.random() < 0.2 ? true : false;
- }
- if (this.star) {
- this.star.visible = Math.random() < 0.2 ? true : false;
- }
- this.icon.skin = this.data.icon;
- }
- clickAd() {
- FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
- FYHD_Sdk.ShowHuTuiJump(this.data);
- }
- onDestroy() {
- this.btn.clickHandler = null;
- }
- }
- class GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- reg("View/Com/ButtonRunTime.ts", ImageRunTime);
- reg("View/Com/ListItem.ts", ListItem);
- }
- }
- GameConfig.width = 720;
- GameConfig.height = 1280;
- GameConfig.scaleMode = "fixedwidth";
- GameConfig.screenMode = "vertical";
- GameConfig.alignV = "middle";
- GameConfig.alignH = "center";
- GameConfig.startScene = "MainView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = false;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = true;
- GameConfig.init();
- class Main {
- constructor() {
- window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
- window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
- if (window["Laya3D"])
- Laya3D.init(GameConfig.width, GameConfig.height);
- else
- Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
- Laya["Physics"] && Laya["Physics"].enable();
- Laya["DebugPanel"] && Laya["DebugPanel"].enable();
- Laya.stage.scaleMode = GameConfig.scaleMode;
- Laya.stage.screenMode = GameConfig.screenMode;
- Laya.stage.alignV = GameConfig.alignV;
- Laya.stage.alignH = GameConfig.alignH;
- Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
- if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
- Laya.enableDebugPanel();
- if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
- Laya["PhysicsDebugDraw"].enable();
- if (GameConfig.stat)
- Laya.Stat.show();
- Laya.alertGlobalError = true;
- GameVersion.isWx = Laya.Browser.onWeiXin;
- if (GameVersion.isWx) {
- WXSdk.init();
- }
- Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
- WXSdk.IsNeedUpdate();
- }
- onVersionLoaded() {
- Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
- Laya.MouseManager.multiTouchEnabled = false;
- }
- onConfigLoaded() {
- ViewManager.Instance.OpenView(ViewType.LoadView);
- GameVersion.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
- }
- }
- new Main();
- }());
- //# sourceMappingURL=bundle.js.map
|