1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815 |
- (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 GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- reg("Window/Com/ButtonRunTime.ts", ImageRunTime);
- }
- }
- GameConfig.width = 720;
- GameConfig.height = 1280;
- GameConfig.scaleMode = "fixedwidth";
- GameConfig.screenMode = "vertical";
- GameConfig.alignV = "middle";
- GameConfig.alignH = "center";
- GameConfig.startScene = "AttributeUpView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = false;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = true;
- GameConfig.init();
- class GameVersion {
- }
- GameVersion.VER = "1.0.7";
- GameVersion.CFG = "CFG";
- GameVersion.wxValue = "";
- GameVersion.isX = false;
- GameVersion.mSharePeopleScene = null;
- 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());
- }
- 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 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 {
- }
- EventType.Event = {
- CamFollowArg: "CamFollowArg",
- SetAimPos: "SetAimPos",
- RefreshBulletCount: "RefreshBulletCount",
- RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
- GameShowTips: "GameShowTips",
- StartShot: 'StartShot',
- StopShot: 'StopShot',
- ShowMainUi: "ShowMainUi",
- SetMonery: "SetMonery",
- SetStage: "SetStage",
- SetStagePro: "SetStagePro"
- };
- var Vector3 = Laya.Vector3;
- class GameTool {
- static GetObjKey(obj) {
- if (obj == null)
- return null;
- for (const key in obj) {
- if (obj.hasOwnProperty(key)) {
- return key;
- }
- }
- }
- static randomInt(min, max) {
- if (max < min)
- return parseInt(min);
- return parseInt(Math.random() * (max - min + 1) + min);
- }
- static randomFl(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static getAng(xx, yy, obl) {
- return 180 / Math.PI * GameTool.getRad(xx, yy, obl);
- }
- static getRad(xx, yy, obl) {
- var rad = yy < 0 ? Math.acos(xx / obl) : (Math.PI * 2 - Math.acos(xx / obl));
- return rad;
- }
- 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 GetWeight(s) {
- let arr = GameTool.SpliteString(s);
- var sum = 0;
- for (var i = 0; i < arr.length; i++) {
- sum += Number(arr[i]);
- }
- let result = GameTool.randomInt(1, sum);
- let temp_sum = 0;
- for (let i = 0; i < arr.length; i++) {
- temp_sum += Number(arr[i]);
- if (result <= temp_sum) {
- return i;
- }
- }
- }
- 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 makeRandomArr(arrList, num) {
- if (num > arrList.length) {
- return;
- }
- var tempArr = arrList.slice(0);
- var newArrList = [];
- for (var i = 0; i < num; i++) {
- var random = Math.floor(Math.random() * (tempArr.length - 1));
- var arr = tempArr[random];
- tempArr.splice(random, 1);
- newArrList.push(arr);
- }
- return newArrList;
- }
- static CopyArr(o) {
- var arr = [];
- for (let index = 0; index < o.length; index++) {
- const element = o[index];
- arr.push(element);
- }
- return arr;
- }
- static clamp(n, min, max) {
- return n > max ? max : (n < min ? min : n);
- }
- static GetVecByArr(arr) {
- if (!arr)
- return null;
- var vec = new Vector3();
- vec.x = arr[0];
- vec.y = arr[1];
- vec.z = arr[2];
- return vec;
- }
- static IsNext() {
- let uuid = Laya.LocalStorage.getItem("isNext");
- if (uuid) {
- let lastSignTime = new Date(Number(Laya.LocalStorage.getItem("isNext")));
- let todayZero = new Date(Laya.timer.currTimer);
- todayZero.setHours(0, 0, 0, 0);
- if (lastSignTime.valueOf() < todayZero.valueOf()) {
- Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
- return true;
- }
- else {
- return false;
- }
- }
- else {
- Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
- return true;
- }
- }
- static ToTimeStr1(l) {
- let str = "";
- let minute = 0;
- let second = 0;
- second = l;
- if (second > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- str = second < 10 ? "0" + second : second + "";
- return (minute + ":" + str);
- }
- static ToTimeStr(l, isHour = false) {
- let hour = 0;
- let minute = 0;
- let second = 0;
- second = l;
- if (second > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- if (isHour && minute > 60) {
- hour = Math.floor(minute / 60);
- minute = minute % 60;
- let ss = second >= 10 ? second + "" : "0" + second.toString();
- let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
- let hh = hour >= 10 ? hour + "" : "0" + hour.toString();
- return (hh + ":" + mm + ":" + ss);
- }
- else {
- if (minute > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- let ss = second >= 10 ? second + "" : "0" + second.toString();
- let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
- return (mm + ":" + ss);
- }
- }
- }
- class NetInfoManager {
- 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;
- }
- }
- class AssetPath {
- }
- AssetPath.MainScene = "subpackage/LayaScene_main/Conventional/main.ls";
- AssetPath.Player = ["subpackage/LayaScene_role/Conventional/player1.lh",
- "subpackage/LayaScene_role/Conventional/player2.lh",
- "subpackage/LayaScene_role/Conventional/player3.lh",
- "subpackage/LayaScene_role/Conventional/player4.lh",
- "subpackage/LayaScene_role/Conventional/player5.lh",
- "subpackage/LayaScene_role/Conventional/player6.lh",
- ];
- AssetPath.Enemy = "subpackage/LayaScene_role/Conventional/enemy.lh";
- AssetPath.PlayerShot = "subpackage/LayaScene_prop/Conventional/PlayerBullet.lh";
- AssetPath.Mound = "subpackage/LayaScene_prop/Conventional/Tower.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_effect/Conventional/boom.lh",
- "subpackage/LayaScene_effect/Conventional/hit.lh",
- "subpackage/LayaScene_effect/Conventional/xue.lh",
- ];
- AssetPath.Config = {
- level: "level",
- road: "road",
- block: "block",
- thing: "thing",
- atk: "atk",
- rate: "rate",
- global: "global",
- theme: "theme"
- };
- class AppSetting {
- }
- AppSetting.moveTime = 1;
- class PlayerManager {
- constructor() {
- this.stage = 1;
- this.equipId = 1;
- }
- 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"];
- }
- 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;
- 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();
- }
- 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 = Laya.Event;
- var HttpRequest = Laya.HttpRequest;
- const PROTOCOL_URL = "https://gungangapi.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.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event.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.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
- httpRequest.once(Event.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
- httpRequest.once(Event.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.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.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.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event.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 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);
- }
- }
- 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;
- }
- }
- }
- 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: "barrier",
- PlayerShoot: "PlayerBullet",
- Player: "player",
- 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 {
- }
- MusicType.Idle = "Idle";
- MusicType.CrouchFiring = "CrouchFiring";
- MusicType.Dance = "Dance";
- MusicType.RunAndGun = "RunAndGun";
- MusicType.RunningHysteric = "RunningHysteric";
- 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();
- }
- }
- SetCameraAction(type, arg) {
- if (this.Camera)
- this.Camera.CameraAction(type, arg);
- }
- }
- class ConstructManager {
- constructor() {
- this.tarDis = 30;
- this.constructArr = [];
- }
- 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();
- }
- 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;
- }
- }
- class LevelController {
- static get Instance() {
- return LevelController.instance || (LevelController.instance = new LevelController());
- }
- 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;
- }
- 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;
- }
- }
- 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--;
- }
- ExplodeEffect(pos) {
- if (this.explodemaxcount >= GlobalParam.boommaxcount)
- return;
- let h = GamePool.Instance.GetModel("boom");
- 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("xue");
- 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$1 = Laya.Event;
- var MouseManager = Laya.MouseManager;
- class MouseEvent {
- constructor() {
- this._switch = false;
- this._isCanClick = true;
- this.clickD = false;
- this._mousePos = MathTool.VecZero;
- this.tempMouse = MathTool.VecZero;
- this.clickCount = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new MouseEvent());
- }
- InitMouseEvent() {
- Laya.stage.on(Event$1.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.on(Event$1.MOUSE_OUT, this, this.OnClickUp);
- }
- OnClickDown(e) {
- if (!this._isCanClick || !this._switch)
- return;
- if (e.target instanceof Laya.UIComponent)
- return;
- this.clickD = true;
- Laya.stage.on(Event$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$1.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$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$1.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();
- }
- OffMouseEvent() {
- Laya.stage.off(Event$1.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.off(Event$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.off(Event$1.MOUSE_OUT, this, this.OnClickUp);
- }
- MouseU() {
- this.clickD = false;
- Laya.stage.off(Event$1.MOUSE_MOVE, this, this.OnSlider);
- Laya.stage.off(Event$1.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;
- }
- }
- class Street extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.rotate = MathTool.VecZero;
- this.speed = MathTool.VecZero;
- }
- 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) ;
- }
- 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 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": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 538, "centerY": -41 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/d0bg-shengji.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "13,14,14,15" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": -43, "x": 134, "skin": "gameRes1/aasudu-bg-2 (2).png" }, "compId": 32 }] }, { "type": "Button", "props": { "y": 116, "x": 342, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (1).png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "gameRes1/aasudu-bg-2 (5).png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_rate", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_rateVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 42 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 116, "x": 46, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (3).png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "gameRes1/aasudu-bg-2 (4).png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_atk", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 33 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_atkVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 46 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "y": 426, "x": 209, "var": "backBtn", "skin": "gameRes1/aasudu-bg-2 (7).png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": 180 }, "compId": 8 }] }], "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 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/d0bg-shengji.png", "gameRes1/aasudu-bg-2 (2).png", "gameRes1/aasudu-bg-2 (1).png", "gameRes1/aasudu-bg-2 (5).png", "gameRes1/aasudu-bg-2 (8).png", "gameRes1/aasudu-bg-2 (9).png", "gameRes1/aasudu-bg-2 (6).png", "gameRes1/aasudu-bg-2 (10).png", "gameRes1/shou.png", "gameRes1/aasudu-bg-2 (3).png", "gameRes1/aasudu-bg-2 (4).png", "gameRes1/aasudu-bg-2 (7).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": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.9, "sizeGrid": "18,18,15,19" }, "compId": 22 }, { "type": "Box", "props": { "x": 178, "width": 364, "var": "winbtnBox", "height": 226, "bottom": 292 }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 130, "var": "nextBtn", "skin": "gameRes1/no.png", "runtime": "Window/Com/ButtonRunTime.ts", "bottom": 0 }, "compId": 46 }, { "type": "Image", "props": { "y": 0, "x": 9, "var": "doublegetBtn", "skin": "gameRes1/sanbei-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 28 }, { "type": "Image", "props": { "y": 74, "x": 33, "skin": "gameRes1/jinbi-da.png" }, "compId": 66, "child": [{ "type": "Text", "props": { "y": 3, "x": 81, "width": 218, "var": "doubleText", "valign": "middle", "text": "50", "strokeColor": "#714800", "stroke": 2, "height": 71, "fontSize": 56, "color": "#bc3e01", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Image", "props": { "x": 80, "var": "shibaiTop", "skin": "gameRes1/shibai.png", "centerY": -481 }, "compId": 68 }, { "type": "Image", "props": { "x": 92, "var": "winTop", "skin": "gameRes1/win-biao.png", "centerY": -481 }, "compId": 44 }, { "type": "Image", "props": { "x": 238, "width": 60, "skin": "gameRes1/jinbi-da.png", "height": 60, "centerY": 82 }, "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": { "y": 258, "x": 138, "width": 444, "height": 429, "centerY": -168 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 72, "child": [{ "type": "Image", "props": { "y": 31, "x": 52, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 73 }, { "type": "Image", "props": { "y": 31, "x": 343, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 31, "x": 177, "skin": "gameRes1/jiangli.png" }, "compId": 75 }] }, { "type": "Image", "props": { "y": 107, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baolei.png" }, "compId": 80 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 214, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/rentu.png" }, "compId": 85 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 321, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baohe.png" }, "compId": 90 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "duohuituiSp" }, "compId": 94 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 95 }], "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 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/no.png", "gameRes1/sanbei-bt.png", "gameRes1/jinbi-da.png", "gameRes1/shibai.png", "gameRes1/win-biao.png", "gameRes1/zhengchang-di.png", "gameRes1/jianxingzhuang.png", "gameRes1/jiangli.png", "gameRes1/baolei.png", "gameRes1/rentu.png", "gameRes1/baohe.png"], "loadList3D": [] };
- ui.CompleteViewUI = CompleteViewUI;
- REG("ui.CompleteViewUI", CompleteViewUI);
- 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": "gameRes1/zzzzzzguangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "gameRes1/zzzzz1.png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "gameRes1/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "gameRes1/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "gameRes1/zzzzz1.png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 203, "var": "guide1Image", "skin": "gameRes1/zzzzbiaoyu(2).png", "bottom": 213 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "gameRes1/zzzzbiaoyu(1).png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "gameRes1/zzzzbiaoyu.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["gameRes1/zzzzzzguangquan(1).png", "gameRes1/zzzzz1.png", "gameRes1/zzzzzuoyou-jiantou(1).png", "gameRes1/shou.png", "gameRes1/zzzzbiaoyu(2).png", "gameRes1/zzzzbiaoyu(1).png", "gameRes1/zzzzbiaoyu.png"], "loadList3D": [] };
- 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, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/111111.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "22,12,11,12" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 626, "centerY": -18 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 636, "var": "atkBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "gameRes1/gongji-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/gongji-icon.png" }, "compId": 9 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "gameRes1/gongji-1.png" }, "compId": 11 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 226, "x": 0, "width": 636, "var": "rateBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/sudu-2.png" }, "compId": 17 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/iconqiang.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "gameRes1/sudu-1(1).png" }, "compId": 19 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 21 }] }, { "type": "Image", "props": { "y": 444, "x": 0, "width": 636, "visible": true, "var": "coinBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/huode.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/jinbi (2).png" }, "compId": 25 }, { "type": "Image", "props": { "y": 125, "x": 156, "skin": "gameRes1/tishengjinbi3.png" }, "compId": 26 }, { "type": "Button", "props": { "y": 57, "x": 412, "var": "coinBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 27, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/shipin-icon.png", "height": 45 }, "compId": 29, "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": 30 }] }] }] }] }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/p__fanhui.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -436 }, "compId": 8 }, { "type": "Image", "props": { "x": 290, "skin": "gameRes1/shengji.png", "centerY": -478 }, "compId": 31 }], "loadList": ["gameRes1/111111.png", "gameRes1/11.png", "gameRes1/gongji-2.png", "gameRes1/gongji-icon.png", "gameRes1/gongji-1.png", "gameRes1/lv-di.png", "gameRes1/jinbi.png", "gameRes1/sudu-2.png", "gameRes1/iconqiang.png", "gameRes1/sudu-1(1).png", "gameRes1/huode.png", "gameRes1/jinbi (2).png", "gameRes1/tishengjinbi3.png", "gameRes1/shipin-icon.png", "gameRes1/p__fanhui.png", "gameRes1/shengji.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.jpg", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "y": 124, "x": 52, "skin": "load/logo.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-1.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/jindu-2.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 52, "x": 174, "skin": "load/jiazai-1-2.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "x": 105, "width": 6, "skin": "load/jiazai-1-3.png", "height": 6, "bottom": 9 }, "compId": 9 }, { "type": "Image", "props": { "x": 120, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 10 }, { "type": "Image", "props": { "x": 136, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 11 }] }, { "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 }] }], "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.jpg", "load/logo.png", "load/jindu-1.png", "load/jindu-2.png", "load/jiazai-1-2.png", "load/jiazai-1-3.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": "gameRes1/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 0, "var": "pro1", "skin": "gameRes1/jindu-guan-do.png" }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "gameRes1/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "gameRes1/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "x": 533, "width": 187, "top": 85, "skin": "gameRes1/jinbi-bg.png", "right": 0 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 11, "x": 5, "skin": "gameRes1/jinbi.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 6, "x": 41, "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": "Button", "props": { "var": "coutiBtn", "stateNum": 1, "skin": "gameRes1/Begin-gengduoyouxi.png", "left": 0, "centerY": 0 }, "compId": 294 }, { "type": "Image", "props": { "x": 24, "var": "settingBtn", "top": 101, "skin": "gameRes1/setBtn.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/ButtonVibrationOn.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/ButtonVibrationOff.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "gameRes1/updateBtn.png", "runtime": "Window/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "gameRes1/skinBtn.png", "runtime": "Window/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": { "var": "moreGameBtn", "stateNum": 1, "skin": "youziTexture/btn-entrance-nogift.png", "left": 587, "centerY": 133 }, "compId": 311 }] }, { "type": "Image", "props": { "x": 195, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "gray": false, "bottom": 304 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -45, "x": 95, "skin": "gameRes1/huadong.png" }, "compId": 292 }, { "type": "Image", "props": { "y": 0, "x": 164, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 293 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }, { "target": 292, "keyframes": { "x": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 292, "key": "x", "index": 0 }], "skin": [{ "value": "gameRes1/pause1.png", "tweenMethod": "linearNone", "tween": false, "target": 292, "key": "skin", "index": 0 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/jindu-duan.png", "gameRes1/jindu-guan-do.png", "gameRes1/guanshu.png", "gameRes1/shadi.png", "gameRes1/jinbi-bg.png", "gameRes1/jinbi.png", "gameRes1/Begin-gengduoyouxi.png", "gameRes1/setBtn.png", "gameRes1/ButtonVibrationOn.png", "gameRes1/ButtonVibrationOff.png", "gameRes1/Icon_SoundOn.png", "gameRes1/Icon_SoundOff.png", "gameRes1/updateBtn.png", "gameRes1/skinBtn.png", "youziTexture/btn-entrance-nogift.png", "gameRes1/huadong-tiao.png", "gameRes1/huadong.png", "gameRes1/shou.png", "gameRes1/pause1.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": "gameRes1/sssdi-3.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/pppguanbi-bt.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -529 }, "compId": 87 }, { "type": "Image", "props": { "skin": "gameRes1/ppppifu-biaoti.png", "centerY": -399 }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "width": 102, "var": "leftBtn", "stateNum": 1, "height": 102 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-zuo.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "x": 521, "width": 102, "var": "rightBtn", "stateNum": 1, "height": 102 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-you.png", "name": "rightFalse" }, "compId": 98 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-you.png", "name": "rightTrue" }, "compId": 99 }] }] }, { "type": "Image", "props": { "y": 813, "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 227 }, "compId": 101 }, { "type": "Image", "props": { "y": 469, "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": 28 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "var": "using", "skin": "gameRes1/pppbt-bg.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "var": "use", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "var": "coin", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 22, "x": 25, "skin": "gameRes1/jinbi-da.png" }, "compId": 109, "child": [{ "type": "Text", "props": { "y": 8, "x": 63, "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": { "var": "video", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 33, "x": 54, "width": 65, "skin": "gameRes1/aasudu-bg-2 (10).png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }], "loadList": ["gameRes1/sssdi-3.png", "gameRes1/pppguanbi-bt.png", "gameRes1/ppppifu-biaoti.png", "gameRes1/pppwu-zuo.png", "gameRes1/pppyou-zuo.png", "gameRes1/pppwu-you.png", "gameRes1/pppyou-you.png", "gameRes1/sssren-di-2.png", "gameRes1/pppbt-bg.png", "gameRes1/jinbi-da.png", "gameRes1/aasudu-bg-2 (10).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": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "gameRes1/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/huadong-tiao.png", "gameRes1/pause1.png", "gameRes1/shou.png"], "loadList3D": [] };
- 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": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "x": 125, "skin": "gameRes1/sssbiaoti.png", "centerY": -503 }, "compId": 4 }, { "type": "Image", "props": { "x": 104, "visible": false, "skin": "gameRes1/sssdi-3.png", "centerY": -100 }, "compId": 5 }, { "type": "Image", "props": { "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 85 }, "compId": 6 }, { "type": "Image", "props": { "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": -108 }, "compId": 8 }, { "type": "Image", "props": { "x": 245, "skin": "gameRes1/x3.png", "centerY": -374 }, "compId": 12 }, { "type": "Box", "props": { "x": 196, "width": 325, "var": "btnBox", "height": 191, "bottom": 289 }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 145, "x": 92, "var": "backBtn", "skin": "gameRes1/sssno-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "var": "videoBtn", "skin": "gameRes1/sssbt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 10 }] }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/sssbiaoti.png", "gameRes1/sssdi-3.png", "gameRes1/sssren-di-2.png", "gameRes1/x3.png", "gameRes1/sssno-bt.png", "gameRes1/sssbt.png"], "loadList3D": [] };
- ui.TrialViewUI = TrialViewUI;
- REG("ui.TrialViewUI", TrialViewUI);
- })(ui || (ui = {}));
- 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.RegButton();
- this.RefreshUI();
- }
- RefreshUI() {
- }
- RefreshData() {
- }
- RegButton() {
- }
- 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._guide1);
- this.guide1Com = false;
- }
- }
- _guide1() {
- 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._guide1);
- this.Guide2();
- }
- }
- }
- Guide2() {
- 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._guide2);
- this.guide1pos.x = -4.5;
- this.guide1pos.y = 0;
- }
- _guide2() {
- 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._guide2);
- Laya.timer.once(5000, this, () => {
- GuideController.Instance.GuideOff();
- });
- }
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- GuideView.instance = null;
- Laya.timer.clearAll(this);
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- 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() {
- ViewManager.Instance.ShowGuideView();
- if (GuideView.Instance) {
- GuideView.Instance.SetGuide(1);
- }
- }
- GuideOff() {
- this._guide = false;
- ViewManager.Instance.CloseGuideView();
- }
- GameOver() {
- if (this._guide) {
- ViewManager.Instance.CloseGuideView();
- }
- }
- 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;
- }
- }
- 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.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();
- }
- 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;
- }
- }
- 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$1 = Laya.Vector3;
- var Quaternion = Laya.Quaternion;
- class Opponent extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3$1(0, 1, 0);
- this.isArrive1 = false;
- }
- 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$1.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3$1.normalize(this.forW, this.forW);
- this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$1.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$1.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3$1.normalize(this.forW, this.forW);
- this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$1.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();
- }
- }
- 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++;
- }
- }
- 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);
- }
- }
- 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 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;
- console.log(this.bannerAdUnitId);
- 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;
- }
- static SetPosBanner(btn, complete) {
- if (Laya.Browser.onPC) {
- complete && complete(false);
- return;
- }
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- var reshight = btn.y * info.windowHeight / Laya.stage.height;
- var idd = this.bannerAdUnitId;
- console.log("adUnitId:" + idd);
- if (this.curbanner)
- this.curbanner.destroy();
- let newBanner = Laya.Browser.window.wx.createBannerAd({
- adUnitId: idd,
- style: {
- left: 0,
- top: 0,
- width: 720
- }
- });
- newBanner.onError(err => {
- console.log(err);
- complete && complete(false);
- });
- newBanner.onLoad(() => {
- this.curbanner = newBanner;
- this.curbanner.style.top = reshight;
- if (this.curbanner) {
- console.log("banner show");
- this.curbanner.show();
- Laya.timer.once(2300, this, () => {
- this.curbanner.style.top = info.windowHeight - GuangGao.bannerhigt;
- complete && complete(true);
- });
- }
- });
- newBanner.onResize((res) => {
- GuangGao.bannerhigt = res.height;
- this.curbanner.style.width = info.windowWidth;
- this.curbanner.style.top = reshight;
- });
- }
- static CheatBanner(btn, complete = null, gap = 0) {
- if (!GuangGao.cancheat) {
- console.log("ignorecheat");
- GuangGao.OpenBanner(0, (height) => {
- });
- }
- else {
- btn.y = Laya.stage.height - btn.height - 100;
- GuangGao.OpenBanner(gap, (height) => {
- if (height == null) ;
- else {
- console.log("cheatstart", "bottom:100");
- btn.mouseEnabled = false;
- var end = Laya.stage.height - height - btn.height - 20;
- console.log("y:" + end);
- Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
- btn.mouseEnabled = true;
- this.showbanner();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- }, true);
- }
- }
- showBanner(success = null, fail = null) {
- if (!Laya.Browser.onWeiXin)
- 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 - 20;
- this._bannerAd.show();
- success && success(this._bannerAd);
- });
- 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;
- }
- }
- }
- GuangGao.videlAdUnitId = "adunit-c417d6819ffdc5a2";
- GuangGao.bannerAdUnitId = "adunit-741a4dcc646d56b8";
- GuangGao.afsfsaafsfsa = false;
- GuangGao.asfasfsaffsa = false;
- GuangGao.canshowbanner = true;
- GuangGao.bannerhigt = 0;
- 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();
- GuangGao.Clear();
- ViewManager.Instance.AddView(ViewType.CompleteView, true);
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- RoleManager.Instance.Reset();
- }
- Congratulate(isglod = false) {
- GuangGao.CheatBanner(null);
- 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();
- GuangGao.Clear();
- ViewManager.Instance.AddView(ViewType.CompleteView, false);
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- MainRoleManager.Instance.HidePlayer();
- RoleManager.Instance.Reset();
- }
- 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);
- }
- }
- class Mound extends Laya.Script3D {
- 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();
- }
- 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$2 = Laya.Vector3;
- class MainRoleShot extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.speed = MathTool.VecZero;
- this._forward = new Vector3$2(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$2.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--;
- }
- 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$3 = Laya.Vector3;
- var Quaternion$1 = Laya.Quaternion;
- class Mate extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3$3(0, 1, 0);
- this.isreturn = false;
- this.isover = false;
- this.isClickCom = true;
- this.isStop = true;
- this.isFristShoot = true;
- this.ts = new Vector3$3(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();
- }
- 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$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;
- }
- }
- Move() {
- if (this.isreturn) {
- this.RayReset();
- return;
- }
- let tarPos = this.tarTra.position.clone();
- Vector3$3.subtract(tarPos, this.tran.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$3.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$3.subtract(this.danceP, this.tran.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.tran.translate(this.forW);
- if (Vector3$3.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();
- }
- 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$3.subtract(this.tp, this.tran.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.tran.translate(this.forW, false);
- if (Vector3$3.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);
- }
- }
- class MateManager {
- constructor() {
- 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;
- }
- 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);
- }
- }
- }
- 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();
- }
- 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$4 = Laya.Vector3;
- var Quaternion$2 = Laya.Quaternion;
- class MainRole extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.isarrive = false;
- this.isdead = false;
- this.isFristShoot = true;
- this._up = new Vector3$4(0, 1, 0);
- this.ts = new Vector3$4(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);
- }
- 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$4(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$4(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$4(-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;
- }
- }
- _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$4.subtract(this.dancepos, this._transform.position, this.forW);
- Vector3$4.normalize(this.forW, this.forW);
- this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._transform.translate(this.forW);
- if (Vector3$4.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$4.subtract(this.tp, this._transform.position, this.forW);
- Vector3$4.normalize(this.forW, this.forW);
- this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._transform.translate(this.forW);
- if (Vector3$4.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$5 = Laya.Vector3;
- 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;
- }
- 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$5(0, 0, z));
- }
- else {
- this.playerScript.Defense(new Vector3$5(-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;
- }
- 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$5.distance(this.playerTra.position, this._maincamera.transform.position);
- this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y;
- }
- let uiP = new Vector3$5(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$6 = 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.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;
- }
- }
- 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$6(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;
- });
- }
- }
- MoveGame(z) {
- if (!this.canmovegame)
- return;
- this.temp.z = z - this.dis.z;
- this._tran.localPositionZ = this.temp.z;
- }
- }
- class Scene3DManager {
- 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();
- }
- 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();
- }
- }
- class ResourcesManager {
- constructor() {
- this.cloth = [];
- }
- 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);
- }
- 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 Tween = 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("进入加载加载界面!");
- }
- RefreshData() {
- this.proLen = this.pro.width;
- }
- RegButton() {
- }
- RefreshUI() {
- Tween.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();
- 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, () => {
- WXSdk.AldEvent("进入主界面");
- ViewManager.Instance.OpenView(ViewType.MainView);
- 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();
- if (GuideController.Instance.RequireGuide()) {
- this.mainBox.visible = false;
- }
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- 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);
- }
- 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.moreGameBtn.clickHandler = new Laya.Handler(this, () => {
- });
- this.coutiBtn.clickHandler = new Laya.Handler(this, () => {
- });
- 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.SoundSetting();
- });
- this.shake_btn.clickHandler = new Laya.Handler(this, () => {
- this.ShakeSetting();
- });
- }
- 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 (PlayerManager.Instance.stage >= 3) {
- ViewManager.Instance.AddView(ViewType.TrialView);
- }
- else {
- this.MainStartGame();
- }
- }, (data) => {
- });
- }
- MainStartGame() {
- 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();
- GuideController.Instance.GuideOn();
- }
- TryStartGame() {
- 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.SoundShow(SettingController.Instance.sound);
- this.ShakeShow(SettingController.Instance.vibrate);
- }
- SoundSetting() {
- SettingController.Instance.sound = !SettingController.Instance.sound;
- this.SoundShow(SettingController.Instance.sound);
- }
- SoundShow(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("开启声音");
- }
- }
- ShakeSetting() {
- SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
- this.ShakeShow(SettingController.Instance.vibrate);
- }
- ShakeShow(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);
- }
- }
- 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 CompleteView extends ui.CompleteViewUI {
- constructor() {
- super();
- this.isWin = false;
- 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();
- GuangGao.CheatBanner(this.winbtnBox);
- }
- 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.doublegetBtn.CZ = () => {
- this.DoubleGetHandler();
- };
- this.nextBtn.CZ = () => {
- if (this.isWin) {
- this.NextHandler();
- }
- else {
- this.ResetHandler();
- }
- };
- }
- RefreshUI() {
- this.winTop.visible = this.isWin;
- this.shibaiTop.visible = !this.isWin;
- this.valueText.text = "+" + this.coinValue;
- this.doubleText.text = (this.coinValue * 3).toString();
- 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();
- }
- DoubleGetHandler() {
- 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.NextHandler();
- }, (data) => {
- });
- }
- });
- }
- NextHandler() {
- GameManager.Instance.LevelUp();
- }
- ResetHandler() {
- ViewManager.Instance.CloseView(ViewType.CompleteView);
- ViewManager.Instance.AddView(ViewType.AttributeUpView);
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- CompleteView.instance = null;
- Laya.timer.clearAll(this);
- GuangGao.Clear();
- }
- }
- 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.CheatBanner(null);
- }
- RefreshUI() {
- this.SetUi();
- 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();
- }
- 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) {
- this.atkBtn.gray = true;
- this.atkBtn.mouseEnabled = false;
- }
- else {
- this.atkBtn.gray = false;
- this.atkBtn.mouseEnabled = true;
- }
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- this.rateBtn.gray = true;
- this.rateBtn.mouseEnabled = false;
- }
- else {
- this.rateBtn.gray = false;
- this.rateBtn.mouseEnabled = true;
- }
- }
- 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;
- }
- }
- RefreshCoinShow() {
- if (this.iscoinShowfreecoinbtn) {
- this.coinBtn.gray = false;
- this.coinBtn.mouseEnabled = true;
- }
- else {
- this.coinBtn.gray = true;
- this.coinBtn.mouseEnabled = false;
- }
- }
- RegButton() {
- this.backBtn.CZ = () => {
- ViewManager.Instance.CloseView(ViewType.IntensifyView);
- };
- this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
- this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
- this.coinBtn.clickHandler = new Laya.Handler(this, this.CoinBtnHandler);
- }
- AtkBtnHandler() {
- 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.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- RateBtnHandler() {
- 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.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- CoinBtnHandler() {
- 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) => {
- });
- }
- });
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
- PlayerManager.Instance.SetInfo();
- }
- GuangGao.Clear();
- }
- 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.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- GuangGao.CheatBanner(null);
- }
- 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.backBtn.CZ = () => {
- this.BackClickHandler();
- };
- this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
- this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
- }
- 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));
- }
- GuangGao.Clear();
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- var Vector3$7 = 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$7(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$7(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.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- RegButton() {
- this.backBtn.CZ = () => {
- this.BackHandler();
- };
- this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 1)
- return;
- this.operateIndex--;
- this.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 6)
- return;
- this.operateIndex++;
- this.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.use.CZ = () => {
- this.NetEquip();
- };
- this.coin.CZ = () => {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
- ViewManager.Instance.ShowTips("金币不足!", 2);
- else
- this.NetBuy();
- };
- this.video.CZ = () => {
- this.VideoBtnHandler();
- };
- }
- SetShowbtn(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 == 6) {
- 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;
- }
- SetUseBtn(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;
- }
- }
- VideoBtnHandler() {
- GuangGao.ShowVideo((done) => {
- if (done) {
- WXSdk.AldEvent("商店中看视屏获得皮肤");
- this.NetVideo();
- }
- });
- }
- ;
- NetVideo() {
- 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.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- NetBuy() {
- 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.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- NetEquip() {
- 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.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- BackHandler() {
- DisplayerCarController.Instance.Reset();
- if (this.oignPlayerid != PlayerManager.Instance.equipId) {
- MainRoleManager.Instance.ChangeModel();
- }
- ViewManager.Instance.CloseView(ViewType.SKinShopView);
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
- SKinShopView.instance = null;
- WXSdk.AldEvent("关闭皮肤界面");
- }
- }
- class TrialView extends ui.TrialViewUI {
- constructor() {
- super();
- this.Resize();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
- }
- OnShow(data) {
- this.RegButton();
- this.RefreshData();
- this.RegButton();
- this.RefreshUI();
- GuangGao.CheatBanner(this.btnBox);
- }
- RefreshUI() {
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- RefreshData() {
- }
- RegButton() {
- this.videoBtn.CZ = () => {
- this.VideoHandler();
- };
- this.backBtn.CZ = () => {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- };
- }
- 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);
- GuangGao.Clear();
- }
- Resize() {
- this.height = Laya.stage.height;
- }
- }
- 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 = {}));
- class ViewManager {
- constructor() {
- this.viewDic = [];
- this.addViewDic = new Dictionary();
- 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.ShadeView] = ShadeView;
- this.viewDic[ViewType.IntensifyView] = IntensifyView;
- this.viewDic[ViewType.CompleteView] = CompleteView;
- this.viewDic[ViewType.SKinShopView] = SKinShopView;
- this.viewDic[ViewType.TrialView] = TrialView;
- this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
- 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 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 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 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;
- 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
|