12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890 |
- (function () {
- 'use strict';
- class GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- }
- }
- GameConfig.width = 720;
- GameConfig.height = 1280;
- GameConfig.scaleMode = "fixedwidth";
- GameConfig.screenMode = "none";
- GameConfig.alignV = "top";
- GameConfig.alignH = "left";
- GameConfig.startScene = "LoadView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = false;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = false;
- GameConfig.init();
- var Vector3 = Laya.Vector3;
- class faafssfafsa {
- constructor(_message, _pos, _size, _fontSize, _color = null) {
- this.fontSize = 30;
- this.message = "";
- this.size = new Laya.Vector2(_size.x, _size.y);
- this.fontSize = _fontSize;
- this.color = _color;
- this.message = _message;
- this.pos = _pos;
- }
- }
- class Transform3DHelper {
- static getForward(transform) {
- let forward = new Vector3();
- transform.getForward(forward);
- Laya.Vector3.scale(forward, -1, forward);
- Laya.Vector3.normalize(forward, forward);
- return forward;
- }
- }
- class GameTools {
- constructor() {
- GameTools.ins = this;
- }
- static get Instance() {
- if (GameTools.ins) {
- return GameTools.ins;
- }
- else {
- return new GameTools();
- }
- }
- lerp(form, to, t) {
- if (t <= 0) {
- return form;
- }
- else if (t >= 1) {
- return to;
- }
- var a = t * to + (1 - t) * form;
- return a;
- }
- SetCollider(setNode, CollisionGroup) {
- var numchild = setNode.numChildren;
- for (var i = 0; i < setNode.numChildren; i++) {
- var numchild2 = setNode.getChildAt(i).numChildren;
- if (numchild2 > 1) {
- this.SetCollider(setNode.getChildAt(i), CollisionGroup);
- }
- var physicsCollider = setNode.getChildAt(i).getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = CollisionGroup;
- }
- }
- }
- EnemySetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("npcfrontcollider");
- var collider2 = setNode.getChildByName("npcrearcollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- var physicsCollider2 = collider2.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- if (physicsCollider2) {
- physicsCollider2.collisionGroup = collisionGroup;
- }
- }
- PlayerSetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("playercollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- }
- HostageSetCollider(setNode, collisionGroup) {
- var collider = setNode.getChildByName("hostagecollider");
- var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
- if (physicsCollider) {
- physicsCollider.collisionGroup = collisionGroup;
- }
- }
- static RandomNumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static RandomANumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return Math.floor(curNumber);
- }
- static GetMoney(_num, _pos = null, _completeHandle = null) {
- if (_num == 0)
- return;
- var fafaafsfa = new Laya.Box;
- fafaafsfa.width = 400;
- fafaafsfa.height = 100;
- fafaafsfa.pivotX = fafaafsfa.width / 2;
- fafaafsfa.pivotY = fafaafsfa.height / 2;
- if (_pos == null) {
- _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2);
- }
- fafaafsfa.pos(_pos.x, _pos.y);
- var aafafaffa = new Laya.Image;
- aafafaffa.skin = "game/qiandao_1_7.png";
- aafafaffa.width = 60;
- aafafaffa.height = 60;
- aafafaffa.left = 50;
- aafafaffa.y = 10;
- fafaafsfa.addChild(aafafaffa);
- var faasfafsafs = new Laya.Text;
- faasfafsafs.width = 300;
- faasfafsafs.height = 50;
- faasfafsafs.align = "center";
- faasfafsafs.valign = "middle";
- faasfafsafs.font = "Microsoft YaHei";
- faasfafsafs.fontSize = 40;
- faasfafsafs.color = "#FFFFFF";
- faasfafsafs.bold = true;
- faasfafsafs.font = "Microsoft YaHei";
- faasfafsafs.text = "金币 +" + _num;
- faasfafsafs.x = 60;
- faasfafsafs.y = 10;
- fafaafsfa.addChild(faasfafsafs);
- Laya.stage.addChild(fafaafsfa);
- var faasfsaf = Laya.Tween.to(fafaafsfa, { y: fafaafsfa.y - 200 }, 1500, Laya.Ease.expoInOut, Laya.Handler.create(this, () => {
- faasfsaf.clear();
- fafaafsfa.destroy();
- if (_completeHandle) {
- _completeHandle.run();
- }
- }), 100);
- }
- static TweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
- var afasafsafsfa = new Laya.Text();
- afasafsafsfa.width = faafssfafsa.size.x;
- afasafsafsfa.height = faafssfafsa.size.y;
- afasafsafsfa.align = "center";
- afasafsafsfa.valign = "middle";
- afasafsafsfa.font = "Microsoft YaHei";
- afasafsafsfa.fontSize = faafssfafsa.fontSize;
- afasafsafsfa.pivotX = afasafsafsfa.width / 2;
- afasafsafsfa.pivotY = afasafsafsfa.height / 2;
- afasafsafsfa.color = "#5ad122";
- afasafsafsfa.bold = true;
- afasafsafsfa.stroke = 5;
- afasafsafsfa.strokeColor = "#ffffff";
- if (faafssfafsa.color) {
- faafssfafsa.color = faafssfafsa.color;
- }
- afasafsafsfa.text = faafssfafsa.message;
- afasafsafsfa.zOrder = 1;
- Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
- afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
- var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
- }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
- tween.clear();
- if (hide) {
- afasafsafsfa.destroy();
- }
- if (_completeHandle) {
- _completeHandle.run();
- }
- }));
- if (hide) {
- Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 500);
- }
- return afasafsafsfa;
- }
- static StationTweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
- var afasafsafsfa = new Laya.Text();
- afasafsafsfa.width = faafssfafsa.size.x;
- afasafsafsfa.height = faafssfafsa.size.y;
- afasafsafsfa.align = "center";
- afasafsafsfa.valign = "middle";
- afasafsafsfa.font = "Microsoft YaHei";
- afasafsafsfa.fontSize = 50;
- afasafsafsfa.pivotX = afasafsafsfa.width / 2;
- afasafsafsfa.pivotY = afasafsafsfa.height / 2;
- afasafsafsfa.color = "#5ad122";
- afasafsafsfa.bold = true;
- afasafsafsfa.stroke = 5;
- afasafsafsfa.strokeColor = "#ffffff";
- if (faafssfafsa.color) {
- faafssfafsa.color = faafssfafsa.color;
- }
- afasafsafsfa.text = faafssfafsa.message;
- afasafsafsfa.zOrder = 1;
- Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
- afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
- var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
- }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
- tween.clear();
- if (hide) {
- afasafsafsfa.destroy();
- }
- if (_completeHandle) {
- _completeHandle.run();
- }
- }));
- if (hide) {
- Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 10000);
- }
- return afasafsafsfa;
- }
- static tweenMove(transform, targPos, delay, ease, complete) {
- let curPos = transform.position.clone();
- return Laya.Tween.to(curPos, {
- x: targPos.x,
- y: targPos.y,
- z: targPos.z,
- update: new Laya.Handler(this, () => {
- transform.position = curPos.clone();
- })
- }, delay, ease, complete);
- }
- static tweenRotate(transform, targEuler, delay, ease, complete) {
- let curEuler = transform.rotationEuler.clone();
- return Laya.Tween.to(curEuler, {
- x: targEuler.x,
- y: targEuler.y,
- z: targEuler.z,
- update: new Laya.Handler(this, () => {
- transform.rotationEuler = curEuler.clone();
- })
- }, delay, ease, complete);
- }
- }
- var EventState;
- (function (EventState) {
- EventState[EventState["LoadComplete"] = 0] = "LoadComplete";
- EventState[EventState["SceneInit"] = 1] = "SceneInit";
- EventState[EventState["StageInit"] = 2] = "StageInit";
- EventState[EventState["ShowModel"] = 3] = "ShowModel";
- })(EventState || (EventState = {}));
- ;
- var StageState;
- (function (StageState) {
- StageState[StageState["Win"] = 0] = "Win";
- StageState[StageState["Lose"] = 1] = "Lose";
- StageState[StageState["Start"] = 2] = "Start";
- StageState[StageState["BackMain"] = 3] = "BackMain";
- StageState[StageState["StageCreateComPlete"] = 4] = "StageCreateComPlete";
- StageState[StageState["Over"] = 5] = "Over";
- StageState[StageState["Pause"] = 6] = "Pause";
- StageState[StageState["Resume"] = 7] = "Resume";
- StageState[StageState["RefreshPro"] = 8] = "RefreshPro";
- StageState[StageState["ShowGuide1"] = 9] = "ShowGuide1";
- StageState[StageState["HideGuide1"] = 10] = "HideGuide1";
- StageState[StageState["ShowGuide2"] = 11] = "ShowGuide2";
- StageState[StageState["HideGuide2"] = 12] = "HideGuide2";
- StageState[StageState["ArriverAttack"] = 13] = "ArriverAttack";
- })(StageState || (StageState = {}));
- ;
- var RoleState;
- (function (RoleState) {
- RoleState[RoleState["Die"] = 0] = "Die";
- RoleState[RoleState["Sky"] = 1] = "Sky";
- RoleState[RoleState["OnLand"] = 2] = "OnLand";
- RoleState[RoleState["Land"] = 3] = "Land";
- RoleState[RoleState["Arriver"] = 4] = "Arriver";
- })(RoleState || (RoleState = {}));
- ;
- class DispatcherManager {
- static EventOn(_mode, caller, fun, args = []) {
- DispatcherManager.instance.on(EventState[_mode], caller, fun, args);
- }
- static EventOff(_mode, caller, fun, args = []) {
- DispatcherManager.instance.off(EventState[_mode], caller, fun);
- }
- static EventTrigger(_mode, args = []) {
- DispatcherManager.instance.event(EventState[_mode], args);
- }
- static StageOn(_mode, caller, fun, args = []) {
- DispatcherManager.instance.on(StageState[_mode], caller, fun, args);
- }
- static StageOff(_mode, caller, fun, args = []) {
- DispatcherManager.instance.off(StageState[_mode], caller, fun);
- }
- static StageTrigger(_mode, args = []) {
- DispatcherManager.instance.event(StageState[_mode], args);
- }
- }
- DispatcherManager.instance = new Laya.EventDispatcher();
- class Dictionary {
- constructor() {
- this._items = {};
- this.length = 0;
- }
- get container() {
- return this._items;
- }
- has(key) {
- return this._items.hasOwnProperty(key);
- }
- set(key, val) {
- if (!this.has(key)) {
- this.length++;
- }
- this._items[key] = val;
- }
- delete(key) {
- let val = null;
- if (this.has(key)) {
- val = this._items[key];
- delete this._items[key];
- this.length--;
- }
- return val;
- }
- get(key) {
- return this.has(key) ? this._items[key] : null;
- }
- values() {
- let values = [];
- for (let k in this._items) {
- if (this.has(k)) {
- values.push(this._items[k]);
- }
- }
- return values;
- }
- keys() {
- let keys = [];
- for (let k in this._items) {
- if (this.has(k)) {
- keys.push(k);
- }
- }
- return keys;
- }
- clear() {
- this._items = {};
- this.length = 0;
- }
- }
- class NodeUtil {
- static GetChild(node, cond) {
- let queue = [];
- for (let i = 0; i < node.numChildren; i++) {
- queue.push(node.getChildAt(i));
- }
- while (queue.length > 0) {
- let first = queue.shift();
- if (cond(first)) {
- return first;
- }
- else {
- for (let i = 0; i < first.numChildren; i++) {
- queue.push(first.getChildAt(i));
- }
- }
- }
- return null;
- }
- static GetChildByName(node, name) {
- return NodeUtil.GetChild(node, s => s.name == name);
- }
- static getChildren(node, cond) {
- let finded = [];
- let queue = [];
- for (let i = 0; i < node.numChildren; i++) {
- queue.push(node.getChildAt(i));
- }
- while (queue.length > 0) {
- let first = queue.shift();
- if (cond(first)) {
- finded.push(first);
- }
- for (let i = 0; i < first.numChildren; i++) {
- queue.push(first.getChildAt(i));
- }
- }
- return finded;
- }
- static SetColliderInactive(sp) {
- let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
- colliders.forEach(s => {
- let collider = s.getComponent(Laya.PhysicsCollider);
- if (collider) {
- collider.enabled = false;
- }
- }, this);
- }
- static SetColliderGroup(sp, _group) {
- let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
- colliders.forEach(s => {
- let collisionGroup = _group;
- let collider = s.getComponent(Laya.PhysicsCollider);
- collider.collisionGroup = collisionGroup;
- }, this);
- }
- }
- NodeUtil.All = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER;
- NodeUtil.Body = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER1;
- NodeUtil.Head = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER2;
- NodeUtil.Citizen = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER3;
- class Transform3DHelper$1 {
- static getForward(transform) {
- let forward = new Laya.Vector3();
- transform.getForward(forward);
- Laya.Vector3.scale(forward, -1, forward);
- Laya.Vector3.normalize(forward, forward);
- return forward;
- }
- }
- class ResourcesPath {
- }
- ResourcesPath.Yan = "yan";
- ResourcesPath.YanHua = "yanhua";
- ResourcesPath.Nail1 = "Nail1";
- ResourcesPath.Nail2 = "Nail2";
- ResourcesPath.Nail3 = "Nail3";
- ResourcesPath.Nail4 = "Nail4";
- ResourcesPath.Nail5 = "Nail5";
- ResourcesPath.Nail6 = "Nail6";
- ResourcesPath.Nail7 = "Nail7";
- ResourcesPath.Coin = "Coin";
- ResourcesPath.FinishCircle = "FinishCircle";
- ResourcesPath.Speed = "speed";
- ResourcesPath.Ramp = "Ramp";
- ResourcesPath.Boss = "Boss";
- ResourcesPath.EndGround = "endground2";
- ResourcesPath.mainscene = "subpackage/res/mainscene/LayaScene_mainscene2/Conventional/mainscene2.ls";
- ResourcesPath.Character = [
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character1.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character2.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character3.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character4.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character5.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character6.lh"
- ];
- ResourcesPath.Prop = [
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle2.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail1.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail2.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail3.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail4.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail5.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail6.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail7.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yan.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yanhua.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/flag.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Coin.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Ramp.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/speed.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Boss.lh",
- "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/endground2.lh"
- ];
- var Vector3$1 = Laya.Vector3;
- class WallBehav extends Laya.Script3D {
- constructor() {
- super();
- this._hitres = new Laya.HitResult();
- this.crash = false;
- this._hitres2 = new Laya.HitResult();
- }
- onAwake() {
- this._gameobject = this.owner;
- }
- onStart() {
- var isFowardHit = false;
- var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y, this._gameobject.transform.position.z);
- let _up = new Laya.Vector3(0, 1, 0);
- var FowardRay = new Laya.Ray(startPos, _up);
- if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres, 1)) {
- if (this._hitres.collider.collisionGroup == 2) {
- let _wall = this._hitres.collider.owner.parent;
- if (this.crash) {
- NodeUtil.SetColliderInactive(this._gameobject);
- let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
- let yan = Laya.Sprite3D.instantiate(_pre);
- LevelManager.Instance.spritepool.addChild(yan);
- yan.transform.position = this._gameobject.transform.position.clone();
- yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
- this.destroy();
- this._gameobject.destroy();
- }
- else {
- this.FallDown();
- }
- let _behav = _wall.addComponent(WallBehav);
- }
- }
- else {
- if (this.crash) {
- NodeUtil.SetColliderInactive(this._gameobject);
- let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
- let yan = Laya.Sprite3D.instantiate(_pre);
- LevelManager.Instance.spritepool.addChild(yan);
- yan.transform.position = this._gameobject.transform.position.clone();
- yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
- this.destroy();
- this._gameobject.destroy();
- }
- }
- }
- onUpdate() {
- if (this.crash) {
- NodeUtil.SetColliderInactive(this._gameobject);
- let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
- let yan = Laya.Sprite3D.instantiate(_pre);
- LevelManager.Instance.spritepool.addChild(yan);
- yan.transform.position = this._gameobject.transform.position.clone();
- yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
- this.destroy();
- this._gameobject.destroy();
- return;
- }
- this.Down();
- }
- Crash() {
- NodeUtil.SetColliderInactive(this._gameobject);
- let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
- let yan = Laya.Sprite3D.instantiate(_pre);
- LevelManager.Instance.spritepool.addChild(yan);
- yan.transform.position = this._gameobject.transform.position.clone();
- yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
- this.destroy();
- this._gameobject.destroy();
- }
- FallDown() {
- Laya.timer.loop(1, this, this.Down);
- }
- Down() {
- var isFowardHit = false;
- var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
- let _down = new Laya.Vector3(0, -0.1, 0);
- var FowardRay = new Laya.Ray(startPos, _down);
- if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres2, 0.2)) {
- if (this._hitres2 != null && (this._hitres2.collider.collisionGroup == 1 || this._hitres2.collider.collisionGroup == 2)) {
- Laya.timer.clear(this, this.Down);
- }
- else {
- let _posy = this._gameobject.transform.position.y -= 0.03;
- this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
- }
- }
- else {
- let _posy = this._gameobject.transform.position.y -= 0.03;
- this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
- }
- }
- }
- var VoiceType;
- (function (VoiceType) {
- VoiceType[VoiceType["crashrole"] = 0] = "crashrole";
- VoiceType[VoiceType["crashwall"] = 1] = "crashwall";
- VoiceType[VoiceType["win"] = 2] = "win";
- VoiceType[VoiceType["lose"] = 3] = "lose";
- VoiceType[VoiceType["fly"] = 4] = "fly";
- VoiceType[VoiceType["speedup"] = 5] = "speedup";
- VoiceType[VoiceType["coin"] = 6] = "coin";
- })(VoiceType || (VoiceType = {}));
- var BGMType;
- (function (BGMType) {
- BGMType[BGMType["bgm"] = 0] = "bgm";
- })(BGMType || (BGMType = {}));
- ;
- class AudioManager {
- static voiceres(_type) {
- return "subpackage2/res/music/" + VoiceType[_type] + ".mp3";
- }
- static bgmres(_type) {
- return "subpackage2/res/music/" + BGMType[_type] + ".mp3";
- }
- static ClearAudio() {
- Laya.SoundManager.stopAllSound();
- }
- static StopMusic() {
- Laya.SoundManager.stopMusic();
- }
- static PlayBGM(_type) {
- }
- static PlayVoice(_type, _loop = false) {
- if (!this.play)
- return;
- var loop = _loop ? 0 : 1;
- Laya.SoundManager.soundVolume = 1;
- if (_type == VoiceType.coin) {
- Laya.SoundManager.soundVolume = 0.3;
- }
- Laya.SoundManager.playSound(this.voiceres(_type), loop);
- }
- }
- AudioManager.play = true;
- class CoinBehav extends Laya.Script3D {
- constructor() {
- super();
- }
- onAwake() {
- this._gameobject = this.owner;
- Laya.timer.loop(1, this, this.Rotate);
- }
- OnTouch() {
- GameManager.GoldNum++;
- AudioManager.PlayVoice(VoiceType.coin);
- Laya.timer.clear(this, this.Rotate);
- this.destroy();
- }
- Rotate() {
- this._gameobject.transform.rotate(new Laya.Vector3(0, 0.05, 0));
- }
- }
- class MathHelper {
- static Clamp(n, min, max) {
- return n > max ? max : (n < min ? min : n);
- }
- static ClampRange(n, a, b, min, max) {
- return (MathHelper.Clamp(n, a, b) - a) / (b - a) * (max - min) + min;
- }
- static ToPercentage(n, min, max) {
- return (n - min) / (max - min);
- }
- static ToRad() {
- return Math.PI / 180;
- }
- static ToDeg() {
- return 180 / Math.PI;
- }
- static Rand(min, max) {
- return Math.random() * (max - min) + min;
- }
- static RandInt(min, max) {
- return Math.floor(Math.random() * (max - min + 1) + min);
- }
- static Lerp(a, b, t) {
- return a * (1 - t) + b * t;
- }
- static PrefixNum(num, len, prefix = "0") {
- return (Array(len).join(prefix) + num).slice(-len);
- }
- static ClampEuler(angle) {
- while (angle > 180) {
- angle -= 360;
- }
- while (angle < -180) {
- angle += 360;
- }
- return angle;
- }
- }
- class Vector3Helper {
- static get Zero() {
- return new Laya.Vector3(0, 0, 0);
- }
- static get Up() {
- return new Laya.Vector3(0, 1, 0);
- }
- static Add(a, b) {
- return new Laya.Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
- }
- static Substract(a, b) {
- return new Laya.Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
- }
- static Scale(a, b) {
- let res = Vector3Helper.Zero;
- Laya.Vector3.scale(a, b, res);
- return res;
- }
- static Lerp(a, b, t) {
- let res = Vector3Helper.Zero;
- Laya.Vector3.lerp(a, b, t, res);
- return res;
- }
- static ClampEuler(euler) {
- return new Laya.Vector3(MathHelper.ClampEuler(euler.x), MathHelper.ClampEuler(euler.y), MathHelper.ClampEuler(euler.z));
- }
- static RotateY(a, deg) {
- let matrix = new Laya.Matrix4x4();
- Laya.Matrix4x4.createRotationY(deg * MathHelper.ToRad(), matrix);
- let res = Vector3Helper.Zero;
- Laya.Vector3.transformCoordinate(a, matrix, res);
- return res;
- }
- static CancelBrackets(str) {
- let a = str.split("(");
- let b = a[1];
- let c = b.split(")");
- let d = c[0];
- let e = d.split(",");
- return e;
- }
- }
- class Transform3DHelper$2 {
- static getForward(transform) {
- let forward = new Laya.Vector3();
- transform.getForward(forward);
- Laya.Vector3.scale(forward, -1, forward);
- Laya.Vector3.normalize(forward, forward);
- return forward;
- }
- }
- class HpBarBehav extends Laya.Script3D {
- constructor() {
- super();
- }
- onAwake() {
- this._gameobject = this.owner;
- this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
- this._bossbehav = this._gameobject.getComponent(BossBehav);
- this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
- this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
- Laya.stage.addChild(this._hpBar);
- }
- onUpdate() {
- let sp = new Laya.Sprite3D();
- sp.transform.position = this._headPos.transform.position.clone();
- sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
- sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
- let pt = Vector3Helper.Zero;
- AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
- this._hpBar.pos(pt.x, pt.y);
- this._hpBar.value = this._bossbehav.health / this._bossbehav.maxhealth;
- }
- onDestroy() {
- this._hpBar.destroy();
- this._hpBar = null;
- }
- }
- class AnimatorManager {
- static Play(isboss = false, animator, anim, islooping = null, complete = null, speed = null) {
- if (animator == null || animator.getControllerLayer() == null) {
- complete && complete.run();
- return;
- }
- let animatorState = animator.getControllerLayer().getAnimatorState(anim);
- if (animatorState == null) {
- complete && complete.run();
- return;
- }
- if (islooping != null)
- animatorState.clip.islooping = islooping;
- if (speed != null)
- animatorState.speed = speed;
- animator.play(anim);
- if (complete) {
- let cb = () => {
- if (animator.getCurrentAnimatorPlayState().normalizedTime >= 1) {
- if (isboss) {
- animator.play("idle");
- }
- Laya.timer.clear(this, cb);
- complete.run();
- }
- };
- Laya.timer.frameLoop(1, this, cb);
- }
- }
- }
- class BossBehav extends Laya.Script3D {
- constructor() {
- super();
- this.dead = false;
- this.canmove = true;
- this.start = false;
- this.play = false;
- this._up = new Laya.Vector3(0, 1, 0);
- this.quaternion1 = new Laya.Quaternion();
- }
- onAwake() {
- this._gameobject = this.owner;
- this._animator = this._gameobject.getComponent(Laya.Animator);
- this.health = 100;
- this.maxhealth = 100;
- this.atk = 10;
- DispatcherManager.StageOn(StageState.ArriverAttack, this, this.Start);
- DispatcherManager.StageOn(StageState.Win, this, this.Destroy);
- DispatcherManager.StageOn(StageState.Lose, this, this.Destroy);
- }
- onUpdate() {
- if (!this.start)
- return;
- if (this.dead) {
- this.BossDie();
- return;
- }
- if (this.canmove) {
- this.Attack();
- }
- }
- Attack() {
- if (!this.play) {
- this.play = true;
- AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
- this.play = false;
- this._Attack();
- }));
- }
- }
- _Attack() {
- if (this.target) {
- let _matemove = this.target.getComponent(MateMove);
- if (_matemove) {
- _matemove.Injured(this.atk);
- }
- }
- }
- Injured(_damega) {
- if (this.health == 0)
- return;
- this.health -= _damega;
- if (this.health <= 0) {
- this.health = 0;
- this.dead = true;
- }
- }
- BossDie() {
- this._animator.play("die2");
- this.canmove = false;
- Laya.timer.clearAll(this);
- GameManager.Instance.GameWin();
- this.destroy();
- }
- Start() {
- this.start = true;
- let _hp = this._gameobject.addComponent(HpBarBehav);
- }
- HideHpBar() {
- let _hp = this._gameobject.getComponent(HpBarBehav);
- if (_hp) {
- _hp.destroy();
- }
- }
- SetTarRotate(_trans) {
- this.target = _trans;
- this.targetpos = _trans.transform.position;
- Laya.Quaternion.lookAt(this.targetpos, this._gameobject.transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._gameobject.transform.rotation = this.quaternion1.clone();
- }
- Destroy() {
- let _hp = this._gameobject.getComponent(HpBarBehav);
- if (_hp) {
- _hp.destroy();
- }
- }
- }
- class MateHpBarBehav extends Laya.Script3D {
- constructor() {
- super();
- }
- onAwake() {
- this._gameobject = this.owner;
- this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
- this._matebehav = this._gameobject.getComponent(MateMove);
- this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
- this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
- Laya.stage.addChild(this._hpBar);
- }
- onUpdate() {
- let sp = new Laya.Sprite3D();
- sp.transform.position = this._headPos.transform.position.clone();
- sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
- sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
- let pt = Vector3Helper.Zero;
- AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
- this._hpBar.pos(pt.x, pt.y);
- this._hpBar.value = this._matebehav.health / this._matebehav.maxhealth;
- }
- onDestroy() {
- this._hpBar.destroy();
- this._hpBar = null;
- }
- }
- var Vector3$2 = Laya.Vector3;
- var Quaternion = Laya.Quaternion;
- class MateMove extends Laya.Script3D {
- constructor() {
- super();
- this._speed = 0.2;
- this.testspeed = 0.5;
- this.Tag_Head = false;
- this.start = false;
- this.isdead = false;
- this.geted = false;
- this._arriver = false;
- this._destination = false;
- this.GravityTime = 0;
- this.ChargeSpeed = 0;
- this.ChargeTime = 0;
- this.Downhit = new Laya.HitResult();
- this.FowardHit = new Laya.HitResult();
- this._forward = new Vector3$2(0, 0, 0);
- this._up = new Vector3$2(0, 1, 0);
- this._up2 = new Vector3$2(0, -1, 0);
- this.CanJump = false;
- this.JumpTime = 0;
- this.JumpSpeed = 0.3;
- this.JumpSpeedUp = 1;
- this.targetPos = new Vector3$2(0, 0, 0);
- this.forW = new Vector3$2(0, 0, 0);
- this.RoleList = [];
- this.MovePointList = [];
- this.MoveRotateList = [];
- this._foward = new Laya.Vector3(0, 0, 0);
- this._MovetarPos = new Laya.Vector3(0, 0, 0);
- this.curpos2 = new Vector3$2();
- this.offest2 = new Vector3$2();
- this.curspeed2 = 0;
- this.curpos = new Vector3$2();
- this.offest = new Vector3$2();
- this.curspeed = 0;
- this.isarrive = false;
- this.showguide1 = false;
- this.showguide2 = false;
- this.pause = false;
- this.play = false;
- this.v3 = new Vector3$2(0, 0, 0);
- this.ts = new Vector3$2(0, 0, 0.01);
- this.quaternion1 = new Laya.Quaternion();
- this.quaternion2 = new Laya.Quaternion();
- this.quaternion3 = new Laya.Quaternion();
- this.showpro = false;
- DispatcherManager.StageOn(StageState.Start, this, this.GameStart);
- }
- onAwake() {
- this._gameobject = this.owner;
- this._transform = this._gameobject.transform;
- this._quaternion = new Quaternion();
- this._animator = this._gameobject.getComponent(Laya.Animator);
- this.health = 50;
- this.maxhealth = 50;
- }
- onUpdate() {
- if (!this.start)
- return;
- if (this.isdead) {
- this.RoleDie();
- this.ChangeState(RoleState.Die);
- return;
- }
- if (this._destination)
- return;
- if (this.isarrive)
- return;
- if (this.Tag_Head) {
- this.RefreshUI();
- if (this.DownRayCheck) {
- if (this.curstate == RoleState.OnLand) {
- this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
- if (this.Downhit.collider.owner.parent.name == "speed") {
- AudioManager.PlayVoice(VoiceType.speedup);
- this.SpeedUp(0.6, 0.1);
- }
- else if (this.Downhit.collider.owner.parent.name == "Ramp") {
- AudioManager.PlayVoice(VoiceType.fly);
- this.SpeedUp(0.3, 0.2);
- this.Jump();
- }
- }
- else if (this.curstate == RoleState.Sky) {
- var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
- if (distance < 0.5) {
- var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
- Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
- this._gameobject.transform.position = leropos;
- this.ChangeState(RoleState.OnLand);
- }
- }
- }
- else {
- this.ChangeState(RoleState.Sky);
- }
- if (this.FowardRayCheck) {
- }
- let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
- this.Move(foward);
- this.Gravity();
- }
- else {
- if (!this.geted)
- return;
- if (this._arriver) {
- if (this.DownRayCheck) {
- if (this.curstate == RoleState.OnLand) {
- this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
- }
- else if (this.curstate == RoleState.Sky) {
- var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
- if (distance < 0.5) {
- var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
- Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
- this._gameobject.transform.position = leropos;
- this.ChangeState(RoleState.OnLand);
- }
- }
- }
- else {
- this.ChangeState(RoleState.Sky);
- }
- this.RoleMoveFun();
- this.Gravity();
- }
- else {
- this.MoveToGroup();
- }
- }
- if (this._gameobject.transform.position.y < -15) {
- this.FallDown();
- }
- }
- RefreshUI() {
- let pre = PlayerManager.Instance.RefreshPro();
- let count = this.RoleList.length;
- let data = {};
- data["pre"] = pre;
- data["count"] = count;
- DispatcherManager.StageTrigger(StageState.RefreshPro, [data]);
- }
- GameStart() {
- this.start = true;
- if (this.Tag_Head)
- this.ChangeState(RoleState.OnLand);
- Laya.timer.loop(2, this, this.SetNewMovePoint, [this._transform]);
- }
- Start(model) {
- if (this.geted)
- return;
- this.targetmodel = model.getChildByName("followpos");
- this.geted = true;
- this.ChangeState(RoleState.OnLand);
- }
- ChangeState(state) {
- if (this.curstate == state)
- return;
- this.curstate = state;
- switch (this.curstate) {
- case RoleState.Die:
- this.DIE();
- break;
- case RoleState.Sky:
- this.SKY();
- break;
- case RoleState.OnLand:
- this.ONLAND();
- break;
- case RoleState.Arriver:
- this.ARRIVER();
- break;
- }
- }
- ONLAND() {
- if (this.Tag_Head) {
- this._animator.play("run");
- this._animator.speed = 2;
- }
- else {
- if (this.geted) {
- this._animator.play("run");
- this._animator.speed = 2;
- }
- else {
- this._animator.play("idle");
- }
- }
- }
- SKY() {
- WXSDK.Shake();
- this._animator.play("sky");
- }
- ARRIVER() {
- this._destination = true;
- Laya.timer.clear(this, this.SetNewMovePoint);
- this._animator.play("win");
- if (this.Tag_Head) {
- GameManager.Instance.GameWin();
- for (let i = 0; i < this.RoleList.length; i++) {
- let item = this.RoleList[i].getComponent(MateMove);
- if (item) {
- item.ARRIVER();
- }
- }
- }
- }
- DIE() {
- Laya.timer.clearAll(this);
- this._gameobject.active = false;
- if (this.Tag_Head && this.RoleList.length == 0) {
- GameManager.Instance.GameLose();
- }
- this.destroy();
- }
- FallDown() {
- if (this.Tag_Head) {
- Laya.timer.clearAll(this);
- GameManager.Instance.GameLose();
- AudioManager.PlayVoice(VoiceType.lose);
- WXSDK.Shake(false);
- this.DestroyProBar();
- this.destroy();
- }
- }
- SetMoveTarger(_point, _rotate) {
- if (this.pause)
- return;
- if (_point) {
- this._MovetarPos = _point;
- this._gameobject.transform.position = this._MovetarPos.clone();
- this._gameobject.transform.rotationEuler = _rotate.clone();
- this.MovePointList.push(_point);
- if (this.MovePointList.length > 100) {
- this.MovePointList.shift();
- }
- this.MoveRotateList.push(_rotate);
- if (this.MoveRotateList.length > 100) {
- this.MoveRotateList.shift();
- }
- }
- }
- RoleMoveFun() {
- if (this.pause)
- return;
- Quaternion.lookAt(this._MovetarPos, this._transform.position, this._up, this._quaternion);
- this._quaternion.invert(this._quaternion);
- Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
- this._transform.rotation = this._quaternion.clone();
- let _rotationEuler = this._transform.rotationEuler.clone();
- _rotationEuler.x = 0;
- _rotationEuler.z = 0;
- this._transform.rotationEuler = _rotationEuler;
- }
- SetNewMovePoint(_transform) {
- if (this.Tag_Head) {
- var _movePos = _transform.position.clone();
- var _point = new Laya.Vector3(_movePos.x, _movePos.y, _movePos.z);
- var _rotate = _transform.rotationEuler.clone();
- this.MovePointList.push(_point);
- if (this.MovePointList.length > 200) {
- this.MovePointList.shift();
- }
- this.MoveRotateList.push(_rotate);
- if (this.MoveRotateList.length > 200) {
- this.MoveRotateList.shift();
- }
- for (let i = 0; i < this.RoleList.length; i++) {
- var _script = this.RoleList[i].getComponent(MateMove);
- if (_script) {
- var _id = this.MovePointList.length - 1 - (i + 1) * 10;
- _script.SetMoveTarger(this.MovePointList[_id], this.MoveRotateList[_id]);
- }
- }
- }
- }
- RoleDie() {
- if (this.RoleList.length == 0) {
- return;
- }
- var _newHand = this.RoleList[0];
- var _script = _newHand.getComponent(MateMove);
- if (_script) {
- _script._gameobject.transform.rotationEuler = this._gameobject.transform.rotationEuler.clone();
- _script.Tag_Head = true;
- PlayerManager.Instance.player = _script._gameobject;
- _script.RoleList = [];
- for (let i = 1; i < this.RoleList.length; i++) {
- _script.RoleList.push(this.RoleList[i]);
- }
- }
- }
- MoveToGroup() {
- this.targetPos = this.targetmodel.transform.position;
- let tarPos = this.targetPos;
- let speed = 0.05;
- Vector3$2.subtract(tarPos, this._transform.position, this._forward);
- Vector3$2.normalize(this._forward, this._forward);
- this._forward = new Vector3$2(this._forward.x * speed, this._forward.y * speed, this._forward.z * speed);
- this._transform.translate(this._forward, false);
- if (Vector3$2.distance(this._transform.position, tarPos) < 0.1) {
- this.ArriverTargetPos();
- return;
- }
- Quaternion.lookAt(tarPos, this._transform.position, this._up, this._quaternion);
- this._quaternion.invert(this._quaternion);
- Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
- this._transform.rotation = this._quaternion.clone();
- }
- Move(_dir) {
- if (this.pause)
- return;
- let speed = this.testspeed;
- if (this.ChargeTime > 0) {
- this.ChargeTime -= 0.01;
- speed = speed + this.ChargeSpeed;
- }
- else {
- this.ChargeSpeed = GameTools.Instance.lerp(this.ChargeSpeed, 0, 0.1);
- speed = speed + this.ChargeSpeed;
- this.ChargeTime = 0;
- }
- this.curspeed = GameTools.Instance.lerp(this.curspeed, speed, 0.1);
- Vector3$2.scale(_dir, this.curspeed, this.offest);
- Vector3$2.add(this._gameobject.transform.position, this.offest, this.curpos);
- Vector3$2.lerp(this._gameobject.transform.position, this.curpos, 0.15, this.curpos);
- if (this.CanJump) {
- this.JumpTime += 0.8;
- var Height = this.JumpSpeed * this.JumpTime * 1.9 - (this.JumpTime * this.JumpTime * this.JumpSpeedUp);
- if (Height > 0) {
- this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + Height, this.curpos.z);
- }
- else {
- this.CanJump = false;
- }
- this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + 0.8, this.curpos.z);
- this._gameobject.transform.position = this.curpos;
- }
- else {
- this.curpos = new Vector3$2(this.curpos.x, this.curpos.y, this.curpos.z);
- this._gameobject.transform.position = this.curpos;
- }
- }
- ArriverTargetPos() {
- this._gameobject.transform.position = this.targetmodel.transform.position.clone();
- this._gameobject.transform.rotationEuler = this.targetmodel.transform.rotationEuler.clone();
- this._arriver = true;
- }
- get DownRayCheck() {
- var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
- let foward = new Laya.Vector3(0, -1, 0);
- var FowardRay = new Laya.Ray(startPos, foward);
- var isDownHit = false;
- if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.Downhit, 1)) {
- if (this.Downhit != null) {
- if (this.Downhit.collider.collisionGroup == 1) {
- isDownHit = true;
- }
- }
- }
- return isDownHit;
- }
- get FowardRayCheck() {
- var isFowardHit = false;
- var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
- let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
- var FowardRay = new Laya.Ray(startPos, foward);
- if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 0.1)) {
- if (this.FowardHit) {
- }
- if (this.FowardHit.collider.collisionGroup == 100) {
- this.ForwardTarget = this.FowardHit.collider;
- isFowardHit = true;
- let _mate = this.FowardHit.collider.owner.parent.getComponent(MateMove);
- if (_mate) {
- let _model;
- if (this.RoleList.length > 0) {
- _model = this.RoleList[this.RoleList.length - 1];
- }
- else {
- _model = this._gameobject;
- }
- _mate.Start(_model);
- let target = this.FowardHit.collider.owner.parent;
- if (!this.JudgeEqual(target)) {
- this.RoleList.push(target);
- }
- }
- AudioManager.PlayVoice(VoiceType.crashrole);
- WXSDK.Shake();
- }
- else if (this.FowardHit.collider.collisionGroup == 2) {
- this.isdead = true;
- let _wall = this.FowardHit.collider.owner.parent;
- let _behav = _wall.getComponent(WallBehav);
- if (_behav) {
- _behav.Crash();
- }
- else {
- _behav = _wall.addComponent(WallBehav);
- _behav.crash = true;
- }
- AudioManager.PlayVoice(VoiceType.crashwall);
- WXSDK.Shake();
- }
- else if (this.FowardHit.collider.collisionGroup == 3) {
- this.Crash();
- }
- else if (this.FowardHit.collider.collisionGroup == 4) {
- let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
- if (stage == 1) {
- if (this.FowardHit.collider.owner.parent.name == "roleguide") {
- if (!this.showguide1) {
- this.showguide1 = true;
- DispatcherManager.StageTrigger(StageState.ShowGuide1);
- }
- }
- else if (this.FowardHit.collider.owner.parent.name == "rotateguide") {
- if (!this.showguide2) {
- this.showguide2 = true;
- DispatcherManager.StageTrigger(StageState.ShowGuide2);
- }
- }
- }
- }
- else if (this.FowardHit.collider.collisionGroup == 200) {
- }
- else if (this.FowardHit.collider.collisionGroup == 400) {
- let atkpos_z = this.FowardHit.collider.owner.parent.transform.position.clone();
- if (!this.isarrive) {
- this.isarrive = true;
- this.NearAtkPos(this.RoleList.length + 1, atkpos_z.z);
- }
- }
- }
- return isFowardHit;
- }
- Crash() {
- let target = this.FowardHit.collider.owner.parent;
- switch (target.name) {
- case "Ramp":
- AudioManager.PlayVoice(VoiceType.fly);
- this.SpeedUp(0.8, 0.3);
- this.Jump();
- break;
- case "Coin":
- let _behav = target.getComponent(CoinBehav);
- if (_behav) {
- _behav.OnTouch();
- }
- target.destroy();
- break;
- }
- }
- Gravity() {
- if (this.curstate == RoleState.Sky) {
- if (this.ChargeSpeed > 0.001) {
- this.GravityTime += 0.008;
- }
- else {
- this.GravityTime += 0.010;
- }
- var hight = this.GravityTime * this.GravityTime;
- this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y - hight, this._gameobject.transform.position.z + hight / 2);
- }
- }
- Jump() {
- this.CanJump = true;
- this.JumpTime = 0;
- }
- SpeedUp(_speed, _time) {
- if (this.ChargeTime < _time) {
- this.ChargeTime += 0.1;
- }
- if (this.ChargeSpeed < _speed) {
- this.ChargeSpeed += 0.2;
- }
- }
- Pause() {
- this._animator.play("idle");
- this.testspeed = 0;
- this.pause = true;
- for (let i = 0; i < this.RoleList.length; i++) {
- let _role = this.RoleList[i].getComponent(MateMove);
- if (_role) {
- _role.Pause();
- }
- }
- }
- Resume() {
- this.pause = false;
- this._animator.play("run");
- this.testspeed = 0.5;
- for (let i = 0; i < this.RoleList.length; i++) {
- let _role = this.RoleList[i].getComponent(MateMove);
- if (_role) {
- _role.Resume();
- }
- }
- }
- JudgeEqual(_model) {
- for (let i = 0; i < this.RoleList.length; i++) {
- let item = this.RoleList[i];
- if (item == _model) {
- return true;
- }
- }
- return false;
- }
- SetRoleAtk() {
- for (let i = 0; i < this.RoleList.length; i++) {
- let item = this.RoleList[i].getComponent(MateMove);
- item.isarrive = true;
- item.pause = true;
- }
- }
- MoveToAttackPoint() {
- Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._gameobject.transform.translate(this.forW, false);
- let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
- if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 1) {
- Laya.timer.clear(this, this.MoveToAttackPoint);
- this._animator.play("atk");
- return;
- }
- Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._gameobject.transform.rotation = this.quaternion1.clone();
- let _rotationEuler = this._transform.rotationEuler.clone();
- _rotationEuler.x = 0;
- _rotationEuler.z = 0;
- this._transform.rotationEuler = _rotationEuler;
- }
- SetBossRotate() {
- Laya.timer.frameLoop(1, this, this._SetBossRotate);
- }
- _SetBossRotate() {
- if (this.Tag_Head) {
- let _boss = AssetManager.Instance.Boss.getComponent(BossBehav);
- if (_boss) {
- _boss.SetTarRotate(this._gameobject);
- }
- }
- }
- NearAtkPos(_count, _zpos) {
- this.tp = AssetManager.Instance.Boss.transform.position.clone();
- Laya.timer.clear(this, this.SetNewMovePoint);
- Laya.timer.frameLoop(1, this, this.MoveToAttackPoint);
- this.SetRoleAtk();
- this.SetBossRotate();
- this.pause = true;
- if (_count == 1)
- return;
- this.v3.z = _zpos;
- var _dis = Math.abs(Number(AssetManager.Instance.leftpos.x) - Number(AssetManager.Instance.rightpos.x));
- var _interval = Math.floor(_dis / (_count - 1));
- var mubiaodian = AssetManager.Instance.endground.transform.position.clone();
- var jiange = false;
- var index = 1;
- var num = 0;
- this.v3.x = mubiaodian.x;
- this.Defense(this.v3.clone());
- for (let i = 0; i < this.RoleList.length; i++) {
- num++;
- const element = this.RoleList[i].getComponent(MateMove);
- const element2 = this.RoleList[i].getComponent(MateMove);
- if (num > 2) {
- index++;
- num = 1;
- }
- jiange = !jiange;
- if (jiange) {
- this.v3.x = mubiaodian.x - 1 * index;
- }
- else {
- this.v3.x = mubiaodian.x + 1 * index;
- }
- element.Defense(this.v3.clone());
- element.SetBossRotate();
- }
- DispatcherManager.StageTrigger(StageState.ArriverAttack);
- }
- ArriverAtkPos() {
- Laya.timer.clear(this, this._Attack);
- let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
- let BossPos = BossTran.transform.position.clone();
- Quaternion.lookAt(BossPos, this._gameobject.transform.position, this._up, this.quaternion2);
- this.quaternion2.invert(this.quaternion2);
- this._gameobject.transform.rotation = this.quaternion2.clone();
- let _rotationEuler = this._transform.rotationEuler.clone();
- _rotationEuler.x = 0;
- _rotationEuler.z = 0;
- this._transform.rotationEuler = _rotationEuler;
- Laya.timer.loop(1, this, this.PlayAtkAni);
- let tween = Laya.Tween.to(this._gameobject.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- }, null, false));
- return;
- }
- PlayAtkAni() {
- if (!this.play) {
- this.play = true;
- AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
- let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
- let _behav = BossTran.getComponent(BossBehav);
- if (_behav) {
- _behav.Injured(10);
- }
- this.play = false;
- }));
- }
- }
- _Defense() {
- Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this._gameobject.transform.translate(this.forW, false);
- let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
- if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
- Laya.timer.clear(this, this._Defense);
- this.Attack(AssetManager.Instance.Boss.transform.position.clone());
- return;
- }
- Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._gameobject.transform.rotation = this.quaternion1.clone();
- let _rotationEuler = this._transform.rotationEuler.clone();
- _rotationEuler.x = 0;
- _rotationEuler.z = 0;
- this._transform.rotationEuler = _rotationEuler;
- }
- Defense(pos) {
- this.tp = pos;
- Quaternion.lookAt(pos, this._gameobject.transform.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this._gameobject.transform.rotation = this.quaternion1.clone();
- Laya.timer.frameLoop(1, this, this._Defense);
- }
- Attack(pos) {
- this.tp = pos;
- Quaternion.lookAt(pos, this._gameobject.transform.position, this._up2, this.quaternion3);
- this.quaternion3.invert(this.quaternion3);
- this._gameobject.transform.rotation = this.quaternion3.clone();
- Laya.timer.frameLoop(1, this, this._Attack);
- }
- _Attack() {
- Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
- Vector3$2.normalize(this.forW, this.forW);
- this.forW = new Vector3$2(this.forW.x * 0.05, this.forW.y * 0.05, this.forW.z * 0.05);
- this._gameobject.transform.translate(this.forW, false);
- let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
- if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
- this.ArriverAtkPos();
- return;
- }
- Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up2, this.quaternion3);
- this.quaternion3.invert(this.quaternion3);
- this._gameobject.transform.rotation = this.quaternion3.clone();
- let _rotationEuler = this._transform.rotationEuler.clone();
- _rotationEuler.x = 0;
- _rotationEuler.z = 0;
- this._transform.rotationEuler = _rotationEuler;
- }
- Killed() {
- if (this.isdead)
- return;
- AnimatorManager.Play(false, this._animator, "die2", false, Laya.Handler.create(this, () => {
- this.isdead = true;
- }));
- }
- Injured(_demage) {
- if (this.health == 0)
- return;
- if (!this.showpro) {
- this.showpro = true;
- this.AddProBar();
- }
- this.health -= _demage;
- if (this.health <= 0) {
- this.health = 0;
- this.Killed();
- }
- }
- AddProBar() {
- let probar = this._gameobject.addComponent(MateHpBarBehav);
- }
- DestroyProBar() {
- let probar = this._gameobject.getComponent(MateHpBarBehav);
- if (probar) {
- probar.destroy();
- }
- }
- }
- class PlayerManager {
- constructor() {
- this.canmove = false;
- this.guide2stop = false;
- this.trun = true;
- PlayerManager.ins = this;
- }
- static get Instance() {
- if (PlayerManager.ins == null) {
- return new PlayerManager();
- }
- return PlayerManager.ins;
- }
- Init() {
- this.Direction = AccountManager.Instance.curplayerData.LevelDirection;
- let playerpref = AssetManager.Instance.Character.get(1);
- this.player = Laya.Sprite3D.instantiate(playerpref);
- LevelManager.Instance.spritepool.addChild(this.player);
- this.player.transform.position = AssetManager.Instance.playerpos.transform.position.clone();
- this.player.transform.rotation = AssetManager.Instance.playerpos.transform.rotation.clone();
- this.trun = true;
- DispatcherManager.StageOn(StageState.ShowGuide1, this, this.Guide1);
- DispatcherManager.StageOn(StageState.ShowGuide2, this, this.Guide2);
- }
- RefreshPro() {
- let startpoint = AssetManager.Instance.playerpos.transform.position.clone();
- let Z = startpoint.z;
- let finishpoint = AssetManager.Instance.finishpoint.z;
- let distance = finishpoint - Z;
- let pro = this.player.transform.position.z / distance;
- return pro;
- }
- EnablePlayer() {
- let _move = this.player.addComponent(MateMove);
- _move.Tag_Head = true;
- this.ListenOn();
- }
- ListenOn() {
- Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
- }
- ListenOff() {
- Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
- }
- DisablePlayer() {
- let _move = this.player.getComponent(MateMove);
- if (_move) {
- _move.destroy();
- }
- }
- Guide1() {
- this.ListenOff();
- let _matemove = this.player.getComponent(MateMove);
- if (_matemove) {
- _matemove.Pause();
- }
- }
- Guide2() {
- let _matemove = this.player.getComponent(MateMove);
- if (_matemove) {
- _matemove.Pause();
- }
- this.guide2stop = true;
- }
- Resume() {
- let _matemove = this.player.getComponent(MateMove);
- if (_matemove) {
- _matemove.Resume();
- }
- }
- OnMouseDown() {
- if (this.Direction == 1) {
- if (this.trun) {
- this.player.transform.rotationEuler = new Laya.Vector3(0, -90, 0);
- this.trun = !this.trun;
- }
- else {
- this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
- this.trun = !this.trun;
- }
- }
- else if (this.Direction == 2) {
- if (this.trun) {
- this.player.transform.rotationEuler = new Laya.Vector3(0, 90, 0);
- this.trun = !this.trun;
- }
- else {
- this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
- this.trun = !this.trun;
- }
- }
- if (this.guide2stop) {
- this.guide2stop = false;
- this.Resume();
- DispatcherManager.StageTrigger(StageState.HideGuide2);
- }
- }
- }
- var REG = Laya.ClassUtils.regClass;
- var ui;
- (function (ui) {
- class GameResultViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GameResultViewUI.uiView);
- }
- }
- GameResultViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 29 }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "WinBox", "skin": "Main/lanshandi.png", "alpha": 1 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/shenglilo.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangkuan.png" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/jinbidi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 9 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Win_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#92501d", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 10 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Win_VideoBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 12, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 40.5, "x": 158, "skin": "Main/sanbeilingqu.png" }, "compId": 14 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Win_BackBtn", "stateNum": 1, "skin": "Main/shenglibtn-1.png" }, "compId": 15 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Win_kuangbtn", "stateNum": 1, "skin": "Main/shenglibtn-4.png" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "win_dian", "skin": "Main/shenglibtn-3.png" }, "compId": 31 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shenglibtn-2.png" }, "compId": 32 }] }] }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "FailBox", "skin": "Main/beijing.png", "alpha": 1 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/tongguanshi-lo.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangshudi.png" }, "compId": 19, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/qinandi.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 22 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Fail_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#3660ab", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Fail_VideoBtn", "stateNum": 1, "skin": "Main/ludi.png" }, "compId": 24, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 25 }, { "type": "Image", "props": { "y": 39, "x": 157, "skin": "Main/sanbeilingqu.png" }, "compId": 26 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Fail_BackBtn", "stateNum": 1, "skin": "Main/shibaibtn-1.png" }, "compId": 27 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Fail_kuangbtn", "stateNum": 1, "skin": "Main/shibaibtn-3.png" }, "compId": 33, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "fail_dian", "skin": "Main/shibaibtn-4.png" }, "compId": 34 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shibaibtn-2.png" }, "compId": 35 }] }] }], "loadList": ["Main/chunhei.png", "Main/lanshandi.png", "Main/shenglilo.png", "Main/shangkuan.png", "Main/jinbidi.png", "Main/jinbihud.png", "Main/jinbi.png", "Main/dihong.png", "Main/shipin.png", "Main/sanbeilingqu.png", "Main/shenglibtn-1.png", "Main/shenglibtn-4.png", "Main/shenglibtn-3.png", "Main/shenglibtn-2.png", "Main/beijing.png", "Main/tongguanshi-lo.png", "Main/shangshudi.png", "Main/qinandi.png", "Main/ludi.png", "Main/shibaibtn-1.png", "Main/shibaibtn-3.png", "Main/shibaibtn-4.png", "Main/shibaibtn-2.png"], "loadList3D": [] };
- ui.GameResultViewUI = GameResultViewUI;
- REG("ui.GameResultViewUI", GameResultViewUI);
- class HomeViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(HomeViewUI.uiView);
- }
- }
- HomeViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Button", "props": { "y": 718, "x": 204, "var": "StartBtn", "stateNum": 1, "skin": "Main/dianjikaishi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 72, "x": 209, "width": 86, "var": "shou", "skin": "Main/shou.png", "scaleY": 1, "scaleX": 1, "pivotY": 46, "pivotX": 43, "height": 92 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 630, "x": 0, "stateNum": 1, "skin": "Main/gengduo.png", "name": "MoreFunBtn" }, "compId": 9 }, { "type": "Button", "props": { "y": 754, "x": 606, "var": "SkinBtn", "stateNum": 1, "skin": "Main/shangdain.png" }, "compId": 10 }, { "type": "Button", "props": { "y": 630, "x": 605, "var": "SignBtn", "stateNum": 1, "skin": "Main/qiandao.png" }, "compId": 11 }, { "type": "Image", "props": { "y": 95, "x": 557, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 15 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 18 }] }, { "type": "Box", "props": { "y": 160.5, "x": 127.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 21, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 20 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 24 }] }, { "type": "Button", "props": { "y": 36, "x": 32, "var": "SetBtn", "stateNum": 1, "skin": "Main/shezhi.png" }, "compId": 26 }, { "type": "Image", "props": { "visible": false, "var": "SetPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,15,15,15", "right": 0, "left": 0, "bottom": 0 }, "compId": 48, "child": [{ "type": "Image", "props": { "y": 466, "x": 118.5, "skin": "Main/Background Pop up ads.png" }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 40, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "shake" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 15, "x": 43, "skin": "Main/zhenfu.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 35, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 39 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 41 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 40 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "shakebtn", "height": 41 }, "compId": 49 }] }, { "type": "Image", "props": { "y": 151.5, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "sound" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 20, "x": 47, "skin": "Main/yinfu.png" }, "compId": 34 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 42, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 43 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 44 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 45 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 46 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "soundbtn", "height": 41 }, "compId": 50 }] }, { "type": "Button", "props": { "y": -46, "x": -35, "var": "CloseSetBtn", "stateNum": 1, "skin": "Main/guanbi.png" }, "compId": 47 }] }] }, { "type": "Button", "props": { "y": 504, "x": 606, "var": "LotteryBtn", "stateNum": 1, "skin": "Main/qiandao-2.png" }, "compId": 52 }, { "type": "Button", "props": { "y": 754, "x": 0, "visible": false, "var": "RewardBtn", "stateNum": 1, "skin": "Main/gengduo -2.png" }, "compId": 53 }, { "type": "Box", "props": { "y": 890, "x": 23.5, "width": 673, "visible": false, "var": "UpgradeBox", "height": 227 }, "compId": 54, "child": [{ "type": "Image", "props": { "y": 2.5, "x": 5, "skin": "Main/wuazhudi.png" }, "compId": 55, "child": [{ "type": "Image", "props": { "y": -27.5, "x": 0, "skin": "Main/xiaodi.png", "name": "Info" }, "compId": 56, "child": [{ "type": "Image", "props": { "y": 42, "x": 16, "skin": "Main/wenzid.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 85, "x": 47.5, "name": "icon" }, "compId": 77 }, { "type": "Text", "props": { "y": 45, "x": 23, "width": 185, "valign": "middle", "text": "刀兵", "name": "name", "height": 40, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Text", "props": { "y": 204, "x": 149, "width": 66, "valign": "middle", "text": "lv2", "name": "lv", "height": 32, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 76 }] }, { "type": "Image", "props": { "y": 21, "x": 243, "skin": "Main/cahgdi.png", "name": "Atk" }, "compId": 58, "child": [{ "type": "Image", "props": { "skin": "Main/gaoncb.png" }, "compId": 59 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻击", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 60 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 62 }] }, { "type": "Image", "props": { "y": 78, "x": 243, "skin": "Main/cahgdi.png", "name": "AtkSpeed" }, "compId": 63, "child": [{ "type": "Image", "props": { "skin": "Main/sudi-b.png" }, "compId": 64 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻速", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 65 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 66 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Button", "props": { "y": 136, "x": 312, "stateNum": 1, "skin": "Main/dalan.png" }, "compId": 68, "child": [{ "type": "Text", "props": { "y": 0, "x": 0, "width": 284, "valign": "middle", "text": "升级", "height": 75, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }] }], "animations": [{ "nodes": [{ "target": 19, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 20 }] } }], "name": "handclick", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/dianjikaishi.png", "Main/shou.png", "Main/gengduo.png", "Main/shangdain.png", "Main/qiandao.png", "Main/qiandi.png", "Main/qian.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shezhi.png", "Main/chunhei.png", "Main/Background Pop up ads.png", "Main/Bouton policy privacy.png", "Main/zhenfu.png", "Main/kaigdi.png", "Main/OFF.png", "Main/ON.png", "Main/bodong.png", "Main/boodong-2.png", "Main/yinfu.png", "Main/guanbi.png", "Main/qiandao-2.png", "Main/gengduo -2.png", "Main/wuazhudi.png", "Main/xiaodi.png", "Main/wenzid.png", "Main/cahgdi.png", "Main/gaoncb.png", "Main/sudi-b.png", "Main/dalan.png"], "loadList3D": [] };
- ui.HomeViewUI = HomeViewUI;
- REG("ui.HomeViewUI", HomeViewUI);
- 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, "child": [{ "type": "Box", "props": { "y": 123, "x": 116.5, "width": 487, "visible": true, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "var": "jindupro", "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 181.5, "x": 251.5, "visible": true, "skin": "Main/shuliandi.png" }, "compId": 13, "child": [{ "type": "Text", "props": { "y": 0, "x": 28, "width": 161, "var": "CountTxt", "valign": "middle", "text": "小人数量:22", "height": 45, "fontSize": 24, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }] }, { "type": "Box", "props": { "y": 998, "x": 166, "width": 388, "visible": false, "var": "GuideBox1", "height": 80 }, "compId": 16, "child": [{ "type": "Text", "props": { "y": 0, "x": 132, "wordWrap": true, "width": 148, "var": "Txt2", "valign": "top", "text": "收集同伴一起行动", "leading": 15, "height": 88, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 20 }] }, { "type": "Box", "props": { "y": 883, "x": 166, "width": 388, "visible": false, "var": "GuideBox2", "height": 186 }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 69, "x": 194, "width": 87, "var": "shou1", "skin": "Main/shou-yindao3.png", "scaleY": 1, "scaleX": 1, "pivotY": 59, "pivotX": 44, "height": 117 }, "compId": 17 }, { "type": "Text", "props": { "y": 136, "x": 123.5, "width": 141, "var": "Txt1", "valign": "middle", "text": "点击转向", "height": 48, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 18 }] }], "animations": [{ "nodes": [{ "target": 17, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 20 }] } }], "name": "guideclick1", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shuliandi.png", "Main/shou-yindao3.png"], "loadList3D": [] };
- ui.InGameViewUI = InGameViewUI;
- REG("ui.InGameViewUI", InGameViewUI);
- 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": { "top": 0, "skin": "Load/beijing.png", "sizeGrid": "10,14,12,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "ProgressBar", "props": { "y": 1018, "x": 165, "var": "jindupro", "skin": "Load/ss.png" }, "compId": 3 }, { "type": "Image", "props": { "y": 160, "x": 105, "skin": "Load/title.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 1062, "x": 292.5, "skin": "Load/jiazaizhon.png" }, "compId": 7 }], "loadList": ["Load/beijing.png", "Load/ss.png", "Load/title.png", "Load/jiazaizhon.png"], "loadList3D": [] };
- ui.LoadViewUI = LoadViewUI;
- REG("ui.LoadViewUI", LoadViewUI);
- class LotteryViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(LotteryViewUI.uiView);
- }
- }
- LotteryViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "11,13,15,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 36 }, { "type": "Box", "props": { "y": 253, "x": 10, "width": 700, "height": 581 }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 7.5, "x": 71.5, "skin": "Main/zhuanpandi.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 288, "x": 350, "var": "dial", "skin": "Main/p__zhuan-wu1.png", "anchorY": 0.5, "anchorX": 0.5, "alpha": 1 }, "compId": 3, "child": [{ "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "pivotY": 225, "pivotX": 50, "name": "reward1", "height": 100 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 0, "x": 23, "name": "skin" }, "compId": 12 }, { "type": "Text", "props": { "y": 72, "x": 1.5, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 45, "pivotY": 225, "pivotX": 50, "name": "reward2", "height": 100 }, "compId": 14, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 15 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 90, "pivotY": 225, "pivotX": 50, "name": "reward3", "height": 100 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": 2, "x": 25.5, "name": "skin" }, "compId": 18 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 19 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 135, "pivotY": 225, "pivotX": 50, "name": "reward4", "height": 100 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 0, "x": -16.5, "name": "skin" }, "compId": 21 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 180, "pivotY": 225, "pivotX": 50, "name": "reward5", "height": 100 }, "compId": 23, "child": [{ "type": "Image", "props": { "y": 0, "x": 27, "name": "skin" }, "compId": 24 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 25 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 225, "pivotY": 225, "pivotX": 50, "name": "reward6", "height": 100 }, "compId": 26, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 27 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 28 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 270, "pivotY": 225, "pivotX": 50, "name": "reward7", "height": 100 }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 30 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 31 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 315, "pivotY": 225, "pivotX": 50, "name": "reward8", "height": 100 }, "compId": 32, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 33 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 34 }] }] }, { "type": "Image", "props": { "y": -159, "x": 111, "skin": "Main/choujian.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 196, "x": 277, "skin": "Main/p__zhizhen.png", "name": "pont" }, "compId": 37 }] }, { "type": "Button", "props": { "y": 218, "x": 29, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guabi.png" }, "compId": 9 }, { "type": "Button", "props": { "y": 903, "x": 160, "var": "VideoGetBtn", "stateNum": 1, "skin": "Main/anniu.png" }, "compId": 35 }], "loadList": ["Main/chunhei.png", "Main/zhuanpandi.png", "Main/p__zhuan-wu1.png", "Main/choujian.png", "Main/p__zhizhen.png", "Main/guabi.png", "Main/anniu.png"], "loadList3D": [] };
- ui.LotteryViewUI = LotteryViewUI;
- REG("ui.LotteryViewUI", LotteryViewUI);
- class ReviveViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ReviveViewUI.uiView);
- }
- }
- ReviveViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 15 }, { "type": "Button", "props": { "y": 711, "x": 172.5, "var": "ReviveBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 39, "x": 41, "skin": "Main/shipin.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 39, "x": 162, "skin": "Main/fuhuowenzi.png" }, "compId": 6 }] }, { "type": "Button", "props": { "y": 888, "x": 294, "var": "BackBtn", "stateNum": 1, "skin": "Main/fanhuiwenzi.png" }, "compId": 7 }, { "type": "Box", "props": { "y": 315, "x": 116.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 192, "x": 80.5, "skin": "Main/wenzi.png" }, "compId": 13 }], "loadList": ["Main/chunhei.png", "Main/dihong.png", "Main/shipin.png", "Main/fuhuowenzi.png", "Main/fanhuiwenzi.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/wenzi.png"], "loadList3D": [] };
- ui.ReviveViewUI = ReviveViewUI;
- REG("ui.ReviveViewUI", ReviveViewUI);
- class SignViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(SignViewUI.uiView);
- }
- }
- SignViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,14,14,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 72 }, { "type": "Image", "props": { "y": 170, "x": 60.5, "skin": "Main/qinad-d.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 12, "x": 188, "skin": "Main/qiriqiandao.png" }, "compId": 6 }, { "type": "Box", "props": { "y": 101, "x": 0, "width": 600, "var": "signList", "height": 632 }, "compId": 73, "child": [{ "type": "Box", "props": { "y": 2, "x": 24, "width": 180, "name": "day1", "height": 200 }, "compId": 74, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 75, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 76 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第1天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 77 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 78 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 79, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 80 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 210, "width": 180, "name": "day2", "height": 200 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "y": 118, "x": 85.5, "name": "item", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 12 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第2天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 9 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 10 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 396, "width": 180, "name": "day3", "height": 200 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 83 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第3天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 84 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 86, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 87 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 24, "width": 180, "name": "day4", "height": 200 }, "compId": 88, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 91, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 92 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第4天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 93 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 94 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 95, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 96 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 210, "width": 180, "name": "day5", "height": 200 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 98 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第5天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 100 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 101, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 102 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 396, "width": 180, "name": "day6", "height": 200 }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 103, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 104 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第6天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 105 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 108 }] }] }] }, { "type": "Box", "props": { "y": 436, "x": 12, "width": 553, "name": "day7", "height": 196 }, "compId": 57, "child": [{ "type": "Image", "props": { "y": -2, "x": 71, "skin": "Main/qitiankuang.png" }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 42, "x": 42, "width": 78, "valign": "middle", "text": "第7天", "rotation": -45, "pivotY": 17, "pivotX": 39, "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }, { "type": "Image", "props": { "y": 58.5, "x": 180, "scaleY": 0.5, "scaleX": 0.5, "name": "item" }, "compId": 60 }, { "type": "Text", "props": { "y": 136, "x": 182, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Image", "props": { "y": 0, "x": -1, "width": 433, "skin": "Main/heizha.png", "sizeGrid": "63,54,82,55", "name": "isGet", "height": 198 }, "compId": 62, "child": [{ "type": "Image", "props": { "y": 42.5, "x": 160, "skin": "Main/yihuode.png" }, "compId": 63 }] }] }] }] }] }, { "type": "Image", "props": { "y": 70, "x": 556, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 65, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 66 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }, { "type": "Button", "props": { "y": 948, "x": 172, "var": "receiveBtn", "stateNum": 1, "skin": "Main/bd-d.png" }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 39, "x": 42, "skin": "Main/ship.png" }, "compId": 69 }, { "type": "Image", "props": { "y": 39, "x": 156, "skin": "Main/minf.png" }, "compId": 70 }] }, { "type": "Button", "props": { "y": 1101, "x": 274, "var": "closeBtn", "stateNum": 1, "skin": "Main/buyong.png" }, "compId": 71 }], "loadList": ["Main/chunhei.png", "Main/qinad-d.png", "Main/qiriqiandao.png", "Main/pitongkuan.png", "Main/jinbi.png", "Main/heizha.png", "Main/yihuode.png", "Main/qitiankuang.png", "Main/qiandi.png", "Main/qian.png", "Main/bd-d.png", "Main/ship.png", "Main/minf.png", "Main/buyong.png"], "loadList3D": [] };
- ui.SignViewUI = SignViewUI;
- REG("ui.SignViewUI", SignViewUI);
- class SkinViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(SkinViewUI.uiView);
- }
- }
- SkinViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "loadList": [], "loadList3D": [] };
- ui.SkinViewUI = SkinViewUI;
- REG("ui.SkinViewUI", SkinViewUI);
- })(ui || (ui = {}));
- class InGameView extends ui.InGameViewUI {
- constructor() {
- super();
- InGameView.ins = this;
- }
- static get Instance() {
- if (InGameView.ins == null) {
- return new InGameView();
- }
- return InGameView.ins;
- }
- OnShow() {
- console.log("游戏界面");
- this.on(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
- this.RefreshUI();
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- DispatcherManager.StageOn(StageState.RefreshPro, this, this.SetProValue);
- DispatcherManager.StageOn(StageState.ShowGuide1, this, this.ShowGuide1);
- DispatcherManager.StageOn(StageState.HideGuide1, this, this.HideGuide1);
- DispatcherManager.StageOn(StageState.ShowGuide2, this, this.ShowGuide2);
- DispatcherManager.StageOn(StageState.HideGuide2, this, this.HideGuide2);
- }
- ClickStart() {
- this.off(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
- }
- RefreshUI() {
- let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
- this.NowLevelNum.text = stage + "";
- }
- SetProValue(data) {
- this.jindupro.value = data["pre"];
- this.CountTxt.text = "小人数量:" + (Number(data["count"]) + 1);
- }
- ShowGuide1() {
- this.GuideBox1.visible = true;
- Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
- }
- HideGuide1() {
- this.GuideBox1.visible = false;
- Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
- PlayerManager.Instance.Resume();
- PlayerManager.Instance.ListenOn();
- }
- ShowGuide2() {
- this.GuideBox2.visible = true;
- this.guideclick1.play(null, true);
- }
- HideGuide2() {
- this.GuideBox2.visible = false;
- this.guideclick1.stop();
- }
- OnHide() {
- DispatcherManager.StageOff(StageState.RefreshPro, this, this.SetProValue);
- DispatcherManager.StageOff(StageState.ShowGuide1, this, this.ShowGuide1);
- DispatcherManager.StageOff(StageState.HideGuide1, this, this.HideGuide1);
- DispatcherManager.StageOff(StageState.ShowGuide2, this, this.ShowGuide2);
- DispatcherManager.StageOff(StageState.HideGuide2, this, this.HideGuide2);
- }
- }
- class Global {
- }
- Global.VERSION = "1.0.3";
- Global.CFG = "123";
- var HttpRequest = Laya.HttpRequest;
- var Event = Laya.Event;
- const JtSniperApiUrl = "https://waveapi.xwxgame.com/";
- class TeamWave {
- }
- TeamWave.DengLu = "user/login";
- TeamWave.KaiShi = "game/start";
- TeamWave.JieShu = "game/play";
- TeamWave.QianDao = "sign/sign";
- TeamWave.Chengjiu = "achievement/getRewards";
- TeamWave.Config = "config/table";
- TeamWave.FenXiang = "fission/share";
- TeamWave.LiXian = "fission/offline";
- TeamWave.vd = "fission/vd";
- TeamWave.FuHuo = "game/revival";
- TeamWave.gadagdag = "treasure/click";
- TeamWave.Invite = "invite/getRewards";
- TeamWave.Lottery = "lottery/lottery";
- TeamWave.ShareGetSkin = "theme/fission";
- TeamWave.WearEquip = "theme/equip";
- TeamWave.BuyEquip = "theme/buy";
- TeamWave.ShouQuan = "user/auth";
- TeamWave.JinBi = "user/sync";
- ;
- class ServerManager {
- constructor() { }
- static get Instance() {
- if (ServerManager.ins) {
- return ServerManager.ins;
- }
- else {
- return new ServerManager();
- }
- }
- Login(progresscb, completecb, errorcb) {
- var Account = AccountManager.Instance;
- var ver = Global.VERSION;
- let Data = `code=${Account.code}&nickname=${Account.nickName}&avatar=${Account.avatarUrl}&gender=${Account.gender}&country=${Account.country}&province=${Account.province}&city=${Account.city}& device=${Account.device}$&share_id=${Account.share_id}&scene=${Account.scene}&v=${ver}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.PROGRESS, this, this.Progress, [progresscb, httpRequest]);
- httpRequest.once(Event.COMPLETE, this, this.Complete, [completecb, httpRequest]);
- httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
- httpRequest.send(JtSniperApiUrl + TeamWave.DengLu, Data, "post", "text");
- }
- Progress(_progresscb, _httpreq) {
- if (_progresscb) {
- _progresscb.run();
- }
- }
- Complete(_completecb, _httpreq) {
- let data = JSON.parse(_httpreq.data);
- console.log(data);
- if (data["code"] != "0") {
- console.log("登录异常错误!错误信息sssssssss:", _httpreq.data["code"]);
- return;
- }
- console.log("-----------sss", data["t"]);
- AccountManager.Instance.SFSFSF = data["t"];
- this.RessetConfig(data, _completecb);
- }
- RessetConfig(data, completecb) {
- AccountManager.Instance.ReSetting(data, (flag) => {
- if (flag) {
- completecb.runWith(data);
- }
- else {
- this.RessetConfig(data, completecb);
- }
- });
- }
- Errorcb(_errorcb, _httpreq) {
- if (_errorcb != null) {
- _errorcb.runWith(_httpreq);
- }
- }
- SendHttp(protocol, param, completecb, errorcb, hasToken = true) {
- let sfaasfsfa = "";
- let daadsads = JtSniperApiUrl + protocol;
- if (hasToken == true) {
- sfaasfsfa = `token=${AccountManager.Instance.curplayerData.zhengshu}&`;
- }
- if (protocol == TeamWave.KaiShi || protocol == TeamWave.JieShu || protocol == TeamWave.vd || protocol == TeamWave.Lottery || protocol == TeamWave.ShareGetSkin) {
- let asddsa = "abcdefghijkimnopqrstuvwxyz0123456789";
- let adsassda = "{";
- let saafsafs = "";
- for (let i = 0; i < 4; i++) {
- saafsafs += asddsa[Math.floor(Math.random() * 100) % asddsa.length];
- }
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- adsassda += `\"${key}\":\"${param[i][key]}\"`;
- }
- if (i < param.length - 1) {
- adsassda += ",";
- }
- else {
- adsassda += "}";
- }
- }
- sfaasfsfa += "_r=" + saafsafs + this.SFGSGSG(adsassda);
- }
- else {
- if (param != null) {
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- let val = param[i][key];
- sfaasfsfa += `${key}=${val}`;
- if (i < param.length - 1) {
- sfaasfsfa += "&";
- }
- }
- }
- }
- }
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]);
- httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
- httpRequest.send(daadsads, sfaasfsfa, "post", "text");
- }
- onHttpRequestComplete(succeedcb, failurecb, httpRequest) {
- let data = JSON.parse(httpRequest.data);
- if (data["code"] == 0) {
- AccountManager.Instance.ReSetting(data);
- if (succeedcb != null) {
- succeedcb.runWith(data);
- }
- }
- else {
- if (failurecb != null) {
- failurecb.runWith(data);
- }
- console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]);
- }
- }
- SFGSGSG(str) {
- var c1, c2, c3;
- var SFSFFSFSFSFS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var i = 0, len = str.length, SFFSSFFS = '';
- while (i < len) {
- c1 = str.charCodeAt(i++) & 0xff;
- if (i == len) {
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt((c1 & 0x3) << 4);
- SFFSSFFS += "==";
- break;
- }
- c2 = str.charCodeAt(i++);
- if (i == len) {
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- SFFSSFFS += SFSFFSFSFSFS.charAt((c2 & 0xF) << 2);
- SFFSSFFS += "=";
- break;
- }
- c3 = str.charCodeAt(i++);
- SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- SFFSSFFS += SFSFFSFSFSFS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
- SFFSSFFS += SFSFFSFSFSFS.charAt(c3 & 0x3F);
- }
- return SFFSSFFS;
- }
- }
- class HomeView extends ui.HomeViewUI {
- constructor() {
- super();
- HomeView.ins = this;
- }
- static get Instance() {
- if (HomeView.ins == null) {
- return new HomeView();
- }
- return HomeView.ins;
- }
- OnShow() {
- console.log("主界面");
- this.RefreshUI();
- this.RegButton();
- this.handclick.play(null, true);
- }
- RegButton() {
- this.StartBtn.clickHandler = new Laya.Handler(this, this.Start);
- this.SignBtn.clickHandler = new Laya.Handler(this, this.ClickSign);
- this.LotteryBtn.clickHandler = new Laya.Handler(this, this.ClickLottery);
- this.SkinBtn.clickHandler = new Laya.Handler(this, this.ClickSKin);
- this.SetBtn.clickHandler = new Laya.Handler(this, this.ShowSetPanel);
- this.CloseSetBtn.clickHandler = new Laya.Handler(this, this.HideSetPanel);
- this.shakebtn.clickHandler = new Laya.Handler(this, this.ClickShake);
- this.soundbtn.clickHandler = new Laya.Handler(this, this.ClickSound);
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- RefreshUI() {
- let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
- this.NowLevelNum.text = stage + "";
- this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
- }
- Start() {
- var agrs = [{ "t": AccountManager.Instance.ServerTime.toString() }];
- ServerManager.Instance.SendHttp(TeamWave.KaiShi, agrs, Laya.Handler.create(this, (data) => {
- GameManager.play_id = data.play_id;
- PlayerManager.Instance.EnablePlayer();
- this.handclick.stop();
- this.shou.visible = false;
- ViewManager.Instance.ShowView(ViewType.InGameView);
- DispatcherManager.StageTrigger(StageState.Start);
- }), null);
- }
- ShowSetPanel() {
- this.SetPanel.visible = true;
- let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
- let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
- let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
- let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
- soundon.visible = AudioManager.play;
- soundoff.visible = !soundon.visible;
- shakeon.visible = WXSDK.shake;
- shakeoff.visible = !shakeon.visible;
- }
- HideSetPanel() {
- this.SetPanel.visible = false;
- }
- ClickSound() {
- let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
- let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
- AudioManager.play = !AudioManager.play;
- soundon.visible = AudioManager.play;
- soundoff.visible = !soundon.visible;
- if (AudioManager.play) {
- AudioManager.PlayBGM(BGMType.bgm);
- }
- else {
- AudioManager.StopMusic();
- }
- }
- ClickShake() {
- let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
- let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
- WXSDK.shake = !WXSDK.shake;
- shakeon.visible = WXSDK.shake;
- shakeoff.visible = !shakeon.visible;
- }
- ClickSign() {
- WXSDK.ShowTxt("暂未开放");
- }
- ClickLottery() {
- WXSDK.ShowTxt("暂未开放");
- }
- ClickSKin() {
- WXSDK.ShowTxt("暂未开放");
- }
- OnHide() {
- }
- }
- class ReviveView extends ui.ReviveViewUI {
- constructor() {
- super();
- ReviveView.ins = this;
- }
- static get Instance() {
- if (ReviveView.ins == null) {
- return new ReviveView();
- }
- return ReviveView.ins;
- }
- OnShow() {
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- OnHide() {
- }
- }
- class WxGameItem {
- constructor() {
- this.appNameHidden = false;
- this.color = "C93B3BFF";
- this.size = 100;
- this.borderWidth = 50;
- this.borderColor = "A1A0A0FF";
- }
- }
- class GuangGao {
- constructor() {
- GuangGao.ins = this;
- }
- static get Instance() {
- if (GuangGao.ins) {
- return GuangGao.ins;
- }
- else {
- return new GuangGao();
- }
- }
- 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) {
- if (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("广告错误onerror--");
- console.log(err);
- 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() {
- return false;
- }
- static SetPosBanner(btn, complete) {
- if (Laya.Browser.onPC) {
- 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(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(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 (!AccountManager.Instance.curplayerData.Cheat) {
- console.log("ignorecheat");
- GuangGao.OpenBanner(0, (height) => {
- if (height == null) {
- console.log("banner高度为null---");
- }
- });
- }
- 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(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;
- var ran = GameTools.RandomANumber(0, 3);
- 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-8feb4e40536601ff";
- GuangGao.bannerAdUnitId = "adunit-426c9d6299d18f7e";
- GuangGao.afsfsaafsfsa = false;
- GuangGao.asfasfsaffsa = false;
- GuangGao.canshowbanner = true;
- GuangGao.bannerhigt = 0;
- class GameResultView extends ui.GameResultViewUI {
- constructor() {
- super();
- GameResultView.ins = this;
- }
- static get Instance() {
- if (GameResultView.ins == null) {
- return new GameResultView();
- }
- return GameResultView.ins;
- }
- OnShow(data) {
- this._result = data;
- if (data) {
- this.WinBox.visible = true;
- this.FailBox.visible = false;
- }
- else {
- this.WinBox.visible = false;
- this.FailBox.visible = true;
- }
- LevelManager.Instance.BackMain();
- this.RefreshUI();
- this.RegButton();
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- RegButton() {
- this.Win_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
- this.Win_VideoBtn.clickHandler = new Laya.Handler(this, this.WinVideoGet);
- this.Win_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickWinKuang);
- this.Fail_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
- this.Fail_VideoBtn.clickHandler = new Laya.Handler(this, this.LoseVideoGet);
- this.Fail_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickLoseKuang);
- }
- RefreshUI() {
- this.Win_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
- this.Fail_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
- }
- ClickWinKuang() {
- this.win_dian.visible = !this.win_dian.visible;
- }
- ClickLoseKuang() {
- this.fail_dian.visible = !this.fail_dian.visible;
- }
- WinVideoGet() {
- GuangGao.ShowVideo((isLoad) => {
- if (isLoad) {
- }
- });
- }
- LoseVideoGet() {
- GuangGao.ShowVideo((isLoad) => {
- if (isLoad) {
- }
- });
- }
- BackHome() {
- let stage = AccountManager.Instance.curplayerData.STAGE;
- var iswin = this._result ? "1" : "0";
- var coinnum = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
- var args = [{ "t": AccountManager.Instance.ServerTime.toString() }, { "play_id": GameManager.play_id }, { "win": iswin }, { "money": coinnum }];
- ServerManager.Instance.SendHttp(TeamWave.JieShu, args, Laya.Handler.create(this, this.Success), null);
- }
- Success() {
- GameManager.GoldNum = 0;
- GameManager.Instance.GameOver();
- }
- OnHide() {
- }
- }
- class SignView extends ui.SignViewUI {
- constructor() {
- super();
- SignView.ins = this;
- }
- static get Instance() {
- if (SignView.ins == null) {
- return new SignView();
- }
- return SignView.ins;
- }
- OnShow() {
- this.signReward = AccountManager.Instance.curplayerData.GainCollocation("sign");
- this.RegButton();
- this.RefreshUI();
- this.InitData();
- if (!SignView.canSgin) {
- this.receiveBtn.visible = false;
- }
- else {
- this.receiveBtn.visible = true;
- }
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- RefreshUI() {
- this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
- }
- RegButton() {
- this.receiveBtn.clickHandler = new Laya.Handler(this, this.ClickReceive);
- this.closeBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
- }
- ClickReceive() {
- if (Laya.Browser.onWeiXin) {
- GuangGao.ShowVideo((isLoad) => {
- if (isLoad) {
- var agrs = [{ "video": "0" }];
- ServerManager.Instance.SendHttp(TeamWave.QianDao, agrs, Laya.Handler.create(this, (e) => {
- this.InitData();
- this.RefreshUI();
- this.showReward(e.rewards, () => {
- this.ClickClose();
- });
- }), Laya.Handler.create(this, this.OnSignError), true);
- }
- });
- }
- else {
- this.ClickClose();
- }
- }
- OnSignError(e) {
- console.log(e);
- }
- ClickClose() {
- ViewManager.Instance.ShowView(ViewType.HomeView);
- }
- InitData() {
- let day = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_days));
- let signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
- let curIndex = day % 7 + 1;
- let first = day < 7;
- let index = first ? 0 : 7;
- let rewards = [];
- for (var i = index; i < index + 7; i++) {
- rewards[this.signReward[i].id] = this.signReward[i].rewards;
- }
- for (let i = 1 + index; i <= 7 + index; i++) {
- let t = i % 8;
- var rewardid = rewards[i];
- var reward = AccountManager.Instance.curplayerData.GetRewardConfig(rewardid);
- let dayBox = this.signList.getChildByName('day' + t).getChildAt(0);
- let item = dayBox.getChildByName('item');
- let itemnum = dayBox.getChildByName('itemnum');
- let isGet = dayBox.getChildByName('isGet');
- isGet.visible = false;
- let type = reward.reward_item;
- if (type == 1000) {
- itemnum.text = reward.reward_num;
- }
- else {
- item.skin = 'subpackage2/res/skin/' + reward.icon + '.png';
- itemnum.visible = false;
- }
- if (t < curIndex) {
- isGet.visible = true;
- }
- }
- }
- static get canSgin() {
- let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
- todayZero.setHours(0, 0, 0, 0);
- var zeroTime = todayZero.valueOf();
- var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
- var signTime = signtime * 1000;
- var can = signTime < zeroTime ? true : false;
- return can;
- }
- static get CanVideoSign() {
- let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
- todayZero.setHours(0, 0, 0, 0);
- let lasttime = new Date(AccountManager.Instance.ServerTime * 1000);
- lasttime.setHours(24, 0, 0, 0);
- var mtime = lasttime.valueOf();
- var zeroTime = todayZero.valueOf();
- var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
- var signTime = signtime * 1000;
- var can = (signTime > zeroTime && signTime < mtime) ? true : false;
- return can;
- }
- showReward(rewards, callback) {
- for (let key in rewards) {
- let itemId = Number(key);
- let itemnum = Number(rewards[key]);
- if (itemId == 1000) {
- GameTools.GetMoney(itemnum, null, Laya.Handler.create(this, () => {
- callback && callback();
- }));
- }
- else {
- Laya.timer.once(1000, this, () => {
- callback && callback();
- });
- }
- }
- }
- OnHide() {
- }
- }
- const REWARDNAME = "reward";
- const MAINPATH = "Main/";
- const SKINPATH = "subpackage2/res/skin/";
- const CIRCLES = 5;
- const ROTATIME = 5000;
- class LotteryView extends ui.LotteryViewUI {
- constructor() {
- super();
- LotteryView.ins = this;
- }
- static get Instance() {
- if (LotteryView.ins == null) {
- return new LotteryView();
- }
- return LotteryView.ins;
- }
- OnShow() {
- this.RegButton();
- this.RefreshUI();
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- RefreshUI() {
- let lottery = AccountManager.Instance.curplayerData.GainCollocation("lottery");
- let idx = 1;
- this._itemDic = new Dictionary();
- lottery && lottery.forEach(item => {
- this._itemDic.set(idx, item);
- let type = Math.floor(Number(item.reward_item) * 0.001);
- let reward = this.dial.getChildByName(`${REWARDNAME}${idx++}`);
- if (!reward)
- return;
- let skin = reward.getChildByName("skin");
- let name = reward.getChildByName("name");
- if (type == 1) {
- skin.skin = MAINPATH + item.icon + ".png";
- name.text = "X" + item.reward_num.toString();
- }
- else if (type == 6) {
- skin.skin = SKINPATH + item.icon + ".png";
- name.text = item.name.toString();
- name.visible = false;
- }
- }, this);
- }
- _rotateDial(data) {
- let targRota = 360 * CIRCLES - 45 * (data.lottery_id - 1);
- let tween = Laya.Tween.to(this.dial, { rotation: targRota }, ROTATIME, Laya.Ease.quadInOut, Laya.Handler.create(this, () => {
- let item = this._itemDic.get(data.lottery_id);
- let type = Math.floor(Number(item.reward_item) * 0.001);
- var reward = data["rewards"];
- if (reward["1000"]) {
- var gg = Number(reward["1000"]);
- GameTools.GetMoney(gg, null, Laya.Handler.create(this, () => {
- ViewManager.Instance.ShowView(ViewType.LotteryView);
- }));
- }
- else {
- GameTools.TweenText(new faafssfafsa("皮肤 + 1", new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height * 0.35), new Laya.Vector2(250, 80), 30), 150, Laya.Handler.create(this, () => {
- ViewManager.Instance.ShowView(ViewType.LotteryView);
- }));
- }
- }));
- }
- RegButton() {
- this.VideoGetBtn.clickHandler = new Laya.Handler(this, this.ClickVideoGet);
- this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
- }
- ClickClose() {
- ViewManager.Instance.ShowView(ViewType.HomeView);
- }
- ClickVideoGet() {
- this.VideoGetBtn.visible = false;
- let param = [{ "channel": "video" }, { "t": AccountManager.Instance.ServerTime.toString() }];
- ServerManager.Instance.SendHttp(TeamWave.Lottery, param, Laya.Handler.create(this, function (e) {
- this._rotateDial(e);
- }), Laya.Handler.create(this, () => {
- WXSDK.ShowTxt("抽奖次数已经用完!");
- }), true);
- }
- OnHide() {
- }
- }
- class SkinView extends ui.SkinViewUI {
- constructor() {
- super();
- SkinView.ins = this;
- }
- static get Instance() {
- if (SkinView.ins == null) {
- return new SkinView();
- }
- return SkinView.ins;
- }
- OnShow() {
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- OnHide() {
- }
- }
- var ViewType;
- (function (ViewType) {
- ViewType[ViewType["InGameView"] = 0] = "InGameView";
- ViewType[ViewType["HomeView"] = 1] = "HomeView";
- ViewType[ViewType["GameResultView"] = 2] = "GameResultView";
- ViewType[ViewType["SkinView"] = 3] = "SkinView";
- ViewType[ViewType["TrialView"] = 4] = "TrialView";
- ViewType[ViewType["ReviveView"] = 5] = "ReviveView";
- ViewType[ViewType["SignView"] = 6] = "SignView";
- ViewType[ViewType["LotteryView"] = 7] = "LotteryView";
- })(ViewType || (ViewType = {}));
- ;
- class ViewManager {
- constructor() {
- this.showexportview = 0;
- this.popViewDic = [];
- this.ViewSprite = new Laya.Sprite();
- this.OtherViewSprite = new Laya.Sprite();
- ViewManager.ins = this;
- Laya.stage.addChild(this.ViewSprite);
- Laya.stage.addChild(this.OtherViewSprite);
- }
- static get Instance() {
- if (ViewManager.ins) {
- return ViewManager.ins;
- }
- else {
- return new ViewManager();
- }
- }
- ShowView(_viewtype, data = null) {
- if (this.curView != null) {
- this.curView.OnHide();
- this.curView.destroy();
- this.curView.removeSelf();
- }
- this.curView = this.CreateView(_viewtype);
- this.curView.name = ViewType[_viewtype];
- this.ViewSprite.addChild(this.curView);
- this.curView.OnShow(data);
- }
- CloseView() {
- if (this.curView != null) {
- this.curView.OnHide();
- this.curView.destroy();
- this.curView.removeSelf();
- }
- }
- OpenPopView(viewType, data = null) {
- var popView;
- if (this.popViewDic[viewType]) {
- popView = this.popViewDic[viewType];
- this.OtherViewSprite.setChildIndex(popView, this.OtherViewSprite.numChildren - 1);
- popView.visible = true;
- }
- else {
- popView = this.CreateView(viewType);
- this.OtherViewSprite.addChild(popView);
- this.popViewDic[viewType] = popView;
- }
- popView.OnOpen(data);
- }
- ClosePopView(viewType) {
- var popView = this.popViewDic[viewType];
- if (popView == null) {
- return;
- }
- popView.OnHide();
- popView.visible = false;
- }
- ClearPopViews() {
- }
- CreateView(_viewtype) {
- switch (_viewtype) {
- case ViewType.InGameView:
- return new InGameView();
- case ViewType.HomeView:
- return new HomeView();
- case ViewType.ReviveView:
- return new ReviveView();
- case ViewType.GameResultView:
- return new GameResultView();
- case ViewType.SignView:
- return new SignView();
- case ViewType.LotteryView:
- return new LotteryView();
- case ViewType.SkinView:
- return new SkinView();
- }
- return null;
- }
- }
- class CameraManager {
- constructor() {
- this.LeftPosition = new Laya.Vector3(3.65, 5.72, -4.52);
- this.LeftRotate = new Laya.Vector3(-24, 145, 0);
- this.RightPosition = new Laya.Vector3(-3.78, 4.87, -4.46);
- this.RightRotate = new Laya.Vector3(-24, -145, 0);
- this.poschazhi = new Laya.Vector3();
- this.gengsuipos = new Laya.Vector3();
- this.lllpos = new Laya.Vector3();
- this.hights = 0;
- this.wights = 0;
- CameraManager.ins = this;
- DispatcherManager.StageOn(StageState.Start, this, this.CameraFollow);
- DispatcherManager.StageOn(StageState.Win, this, this.CameraCancelFollow);
- DispatcherManager.StageOn(StageState.Lose, this, this.CameraCancelFollow);
- }
- static get Instance() {
- if (CameraManager.ins == null) {
- return new CameraManager();
- }
- return CameraManager.ins;
- }
- Init() {
- let Direction = AccountManager.Instance.curplayerData.LevelDirection;
- if (Direction == 1) {
- this.camera.transform.position = this.LeftPosition;
- this.camera.transform.rotationEuler = this.LeftRotate;
- }
- else {
- this.camera.transform.position = this.RightPosition;
- this.camera.transform.rotationEuler = this.RightRotate;
- }
- this.CameraFollow();
- }
- CameraFollow() {
- this.hights = 0;
- this.wights = 0;
- Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.camera.transform.position, this.poschazhi);
- Laya.timer.frameLoop(1, this, this.GenSui);
- }
- GenSui() {
- Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.poschazhi, this.gengsuipos);
- this.hights = GameTools.Instance.lerp(this.hights, 1, 0.03);
- this.wights = GameTools.Instance.lerp(this.wights, 1, 0.05);
- this.gengsuipos = new Laya.Vector3(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z);
- Laya.Vector3.lerp(this.camera.transform.position, this.gengsuipos, 0.25, this.lllpos);
- this.lllpos = new Laya.Vector3(this.gengsuipos.x, this.lllpos.y, this.lllpos.z);
- this.camera.transform.position = this.lllpos;
- }
- CameraCancelFollow() {
- Laya.timer.clear(this, this.GenSui);
- }
- CameraRotate() {
- let tween = Laya.Tween.to(this.camera.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- }, null, false));
- }
- }
- class LevelManager {
- constructor() {
- LevelManager.ins = this;
- }
- static get Instance() {
- if (LevelManager.ins == null) {
- return new LevelManager();
- }
- return LevelManager.ins;
- }
- RegEvent() {
- DispatcherManager.StageOn(StageState.Lose, this, this.GameLose);
- DispatcherManager.StageOn(StageState.Win, this, this.GameWin);
- DispatcherManager.StageOn(StageState.Pause, this, this.GamePause);
- DispatcherManager.StageOn(StageState.Resume, this, this.GameResume);
- DispatcherManager.StageOn(StageState.Over, this, this.GameStart);
- }
- GameStart() {
- PlayerManager.Instance.Init();
- CameraManager.Instance.Init();
- ViewManager.Instance.ShowView(ViewType.HomeView);
- AudioManager.PlayBGM(BGMType.bgm);
- }
- GameLose() {
- PlayerManager.Instance.ListenOff();
- Laya.timer.once(1000, this, () => {
- ViewManager.Instance.ShowView(ViewType.GameResultView, false);
- });
- AudioManager.StopMusic();
- }
- GameWin() {
- PlayerManager.Instance.ListenOff();
- Laya.timer.once(1000, this, () => {
- ViewManager.Instance.ShowView(ViewType.GameResultView, true);
- });
- AudioManager.StopMusic();
- }
- GamePause() {
- }
- GameResume() {
- }
- BackMain() {
- for (let i = this.spritepool.numChildren - 1; i >= 0; i--) {
- let child = this.spritepool.getChildAt(i);
- let _well = child.getComponent(WallBehav);
- if (_well) {
- _well.destroy();
- }
- let _matemove = child.getComponent(MateMove);
- if (_matemove) {
- _matemove.destroy();
- }
- let _hppro = child.getComponent(HpBarBehav);
- if (_hppro) {
- _hppro.destroy();
- }
- child.removeSelf();
- child.destroy();
- child = null;
- }
- }
- }
- class AssetManager {
- constructor() {
- this.Prop = new Dictionary();
- this.Character = new Dictionary();
- AssetManager.ins = this;
- DispatcherManager.EventOn(EventState.LoadComplete, this, this.Init);
- }
- static get Instance() {
- if (AssetManager.ins == null) {
- return new AssetManager();
- }
- return AssetManager.ins;
- }
- Init() {
- this.mainscene.enableFog = true;
- this.mainscene.fogStart = 25;
- this.mainscene.fogRange = 40;
- this.mainscene.fogColor = new Laya.Vector3(138 / 255, 78 / 255, 188 / 255);
- Laya.stage.addChild(this.mainscene);
- this.maincamera = this.mainscene.getChildByName("Main Camera");
- this.maincamera.clearColor = new Laya.Vector4(138 / 255, 78 / 255, 188 / 255, 1);
- this.maincamera.enableHDR = false;
- CameraManager.Instance.camera = this.maincamera;
- this.camerapos = this.maincamera.transform.position.clone();
- this.camerarotate = this.maincamera.transform.rotationEuler.clone();
- let _sprite = new Laya.Sprite3D();
- this.mainscene.addChild(_sprite);
- LevelManager.Instance.spritepool = _sprite;
- this.SetCharacterPos();
- LevelManager.Instance.RegEvent();
- LevelManager.Instance.GameStart();
- }
- getPref(name) {
- return this.Prop.get(name);
- }
- getRolePref(index) {
- return this.Character.get(index);
- }
- SetCharacterPos() {
- GameManager.STAGE = -1;
- let _level = this.mainscene.getChildByName("level456");
- let stage = AccountManager.Instance.curplayerData.STAGE;
- let levelname = "level" + stage;
- let decorate = this.mainscene.getChildByName("decorate");
- let decorate2 = this.mainscene.getChildByName("decorate2");
- let decorateid = AccountManager.Instance.curplayerData.SceneDecorate;
- if (decorateid == 3) {
- decorate.active = true;
- decorate2.active = false;
- }
- else {
- decorate.active = false;
- decorate2.active = true;
- }
- for (let i = 0; i < _level.numChildren; i++) {
- let item = _level.getChildAt(i);
- if (item.name != levelname) {
- item.active = false;
- }
- else {
- item.active = true;
- this.curstage = item;
- }
- }
- for (let i = 0; i < this.curstage.numChildren; i++) {
- let item = this.curstage.getChildAt(i);
- if (item.name == "player") {
- this.playerpos = Laya.Sprite3D.instantiate(item);
- }
- else if (item.name == "barrier") {
- let _pref = this.getPref(ResourcesPath.Nail2);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotation = item.transform.rotation.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.Nail2;
- NodeUtil.SetColliderGroup(_cube, 2);
- }
- else if (item.name == "role") {
- let _pref = this.getRolePref(1);
- let _player = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_player);
- _player.transform.position = item.transform.position.clone();
- _player.transform.rotation = item.transform.rotation.clone();
- let _mate = _player.addComponent(MateMove);
- NodeUtil.SetColliderGroup(_player, 100);
- }
- else if (item.name == "speed") {
- let _pref = this.getPref(ResourcesPath.Speed);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotation = item.transform.rotation.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.Speed;
- NodeUtil.SetColliderGroup(item, 1);
- }
- else if (item.name == "Ramp") {
- let _pref = this.getPref(ResourcesPath.Ramp);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotation = item.transform.rotation.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.Ramp;
- NodeUtil.SetColliderGroup(item, 1);
- }
- else if (item.name == "bridge") {
- NodeUtil.SetColliderGroup(item, 1);
- }
- else if (item.name == "Coin") {
- let _pref = this.getPref(ResourcesPath.Coin);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotation = item.transform.rotation.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.Coin;
- let coinbehav = _cube.addComponent(CoinBehav);
- NodeUtil.SetColliderGroup(_cube, 3);
- }
- else if (item.name == "FinishCircle") {
- let _pref = this.getPref(ResourcesPath.FinishCircle);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotation = item.transform.rotation.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.FinishCircle;
- this.finishpoint = item.transform.position.clone();
- NodeUtil.SetColliderGroup(_cube, 200);
- }
- else if (item.name == "Boss") {
- let _behav = item.addComponent(BossBehav);
- this.Boss = item;
- }
- else if (item.name == "roleguide" || item.name == "rotateguide" || item.name == "roleguideend" || item.name == "rotateguideend") {
- NodeUtil.SetColliderGroup(item, 4);
- }
- else if (item.name == "AttackPoint") {
- let left = item.getChildByName("leftpos");
- let right = item.getChildByName("rightpos");
- this.leftpos = left.transform.position.clone();
- this.rightpos = right.transform.position.clone();
- NodeUtil.SetColliderGroup(item, 400);
- }
- else if (item.name == "endground2") {
- let _pref = this.getPref(ResourcesPath.EndGround);
- let _cube = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_cube);
- _cube.transform.position = item.transform.position.clone();
- _cube.transform.rotationEuler = item.transform.rotationEuler.clone();
- _cube.transform.scale = item.transform.scale.clone();
- _cube.name = ResourcesPath.EndGround;
- let attackpoint = _cube.getChildByName("AttackPoint");
- let left = attackpoint.getChildByName("leftpos");
- let right = attackpoint.getChildByName("rightpos");
- this.leftpos = left.transform.position.clone();
- this.rightpos = right.transform.position.clone();
- let bosspoint = _cube.getChildByName("BossPoint");
- let _bosspref = this.getPref(ResourcesPath.Boss);
- let _boss = Laya.Sprite3D.instantiate(_pref);
- LevelManager.Instance.spritepool.addChild(_boss);
- _boss.transform.position = bosspoint.transform.position.clone();
- _boss.transform.rotationEuler = bosspoint.transform.rotationEuler.clone();
- _boss.transform.scale = item.transform.scale.clone();
- _boss.name = ResourcesPath.Boss;
- console.log(_cube.transform.rotationEuler);
- console.log(_cube.transform.position);
- console.log(_cube.transform.scale);
- this.endground = item;
- }
- }
- }
- }
- class GameManager {
- constructor() {
- GameManager.ins = this;
- }
- static get Instance() {
- if (GameManager.ins == null) {
- return new GameManager();
- }
- return GameManager.ins;
- }
- GameLose() {
- DispatcherManager.StageTrigger(StageState.Lose);
- }
- GameWin() {
- DispatcherManager.StageTrigger(StageState.Win);
- }
- GameOver() {
- AssetManager.Instance.SetCharacterPos();
- DispatcherManager.StageTrigger(StageState.Over);
- }
- }
- GameManager.STAGE = -1;
- GameManager.GoldNum = 0;
- var signdata;
- (function (signdata) {
- signdata[signdata["sign_days"] = 0] = "sign_days";
- signdata[signdata["sign_time"] = 1] = "sign_time";
- })(signdata || (signdata = {}));
- var AccountUser;
- (function (AccountUser) {
- AccountUser[AccountUser["buyed_kun"] = 0] = "buyed_kun";
- AccountUser[AccountUser["diamond"] = 1] = "diamond";
- AccountUser[AccountUser["equip_themes"] = 2] = "equip_themes";
- AccountUser[AccountUser["favorite_times"] = 3] = "favorite_times";
- AccountUser[AccountUser["game_times"] = 4] = "game_times";
- AccountUser[AccountUser["get_themes"] = 5] = "get_themes";
- AccountUser[AccountUser["list_kun"] = 6] = "list_kun";
- AccountUser[AccountUser["moeny"] = 7] = "moeny";
- AccountUser[AccountUser["progress_themes"] = 8] = "progress_themes";
- AccountUser[AccountUser["revival"] = 9] = "revival";
- AccountUser[AccountUser["stage"] = 10] = "stage";
- })(AccountUser || (AccountUser = {}));
- class PlayerData {
- constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_stage = null, _user_sign, _user_achievement, lottery) {
- this.openid = "";
- this.userId = "";
- this.m_RewardDic = {};
- this.zhengshu = _token;
- this.netzheshe = _appSetting;
- this.account = _user;
- this.accountssss = _userbase;
- this.qiandao = _user_sign;
- this.renwu = _user_achievement;
- this.userId = this.account["user_id"];
- this.openid = this.accountssss["openid"];
- this.m_invite = _useInvite;
- this.lottery = lottery;
- console.log("user_id:" + this.userId);
- }
- GetSign(_datatype) {
- var type = signdata[_datatype];
- return this.qiandao[type];
- }
- GainCollocation(_type) {
- return this.peizhis[_type];
- }
- GainAccount(_type) {
- return this.account[_type];
- }
- GetRewardDic() {
- var config = this.GainCollocation("rewards");
- for (var key in config) {
- this.m_RewardDic[config[key].id] = config[key];
- }
- }
- GetRewardConfig(_rewardid) {
- var reward = this.m_RewardDic[_rewardid];
- return reward;
- }
- get fenxiang() {
- return this.netzheshe["share"] == "1";
- }
- get CheckScene() {
- return this.netzheshe["checkscene"] == "1";
- }
- get Cheat() {
- return this.netzheshe["cheat"] == "1";
- }
- get Banner() {
- return this.netzheshe["Banner"] == "1";
- }
- get wudaoshijian() {
- return Number(this.netzheshe["wudaoshijian"]);
- }
- get SceneDecorate() {
- let stage = this.STAGE;
- let _mission = this.GainCollocation("mission");
- for (var key in _mission) {
- let item = _mission[key];
- if (item.ID == stage) {
- return Number(item.scene);
- }
- }
- return null;
- }
- LevelReward(win) {
- let stage = this.STAGE;
- let levelinfo = this.GainCollocation("mission");
- for (var key in levelinfo) {
- let item = levelinfo[key];
- if (item.ID == stage) {
- if (win) {
- return Number(item.win);
- }
- else {
- return Number(item.lose);
- }
- }
- }
- return null;
- }
- get LevelDirection() {
- let stage = this.STAGE;
- let levelinfo = this.GainCollocation("mission");
- for (var key in levelinfo) {
- let item = levelinfo[key];
- if (item.ID == stage) {
- return Number(item.direction);
- }
- }
- return null;
- }
- get STAGE() {
- if (GameManager.STAGE == -1) {
- GameManager.STAGE = Number(this.GainAccount("stage")) + 1;
- if (GameManager.STAGE > 30) {
- GameManager.STAGE = GameTools.RandomANumber(1, 30);
- }
- }
- return GameManager.STAGE;
- }
- GetUser(_type) {
- var type = AccountUser[_type];
- return this.account[type];
- }
- HasGun(_id) {
- var data = this.GainAccount("get_themes");
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id == hd) {
- return true;
- }
- }
- return false;
- }
- GetProgress(_id) {
- var config = this.account["progress_themes"];
- var progress = config[_id] ? config[_id] : 0;
- return progress;
- }
- get ShareTxt() {
- return this.netzheshe["sharecontent"];
- }
- }
- class AccountManager {
- constructor(_code, _userinfo, _nickname, _avatarurl, _gender, _province, _city, _country, _device, _shareid, _scene, _v) {
- this.createTime = Laya.timer.currTimer;
- AccountManager.ins = this;
- this.code = _code;
- this.userInfo = _userinfo;
- this.nickName = _nickname;
- this.avatarUrl = _avatarurl;
- this.gender = _gender;
- this.province = _province;
- this.city = _city;
- this.country = _country;
- this.device = _device;
- this.share_id = _shareid;
- this.scene = _scene;
- this.v = _v;
- }
- static get Instance() {
- if (AccountManager.ins == null) {
- new AccountManager("222222", "你找谁?", "1233", "123", 1, "中国", "上海", "上海", "iphone6s", "123", "123", "123");
- }
- return AccountManager.ins;
- }
- ReSetting(data, cb = null) {
- var zhengshu = data["token"];
- var netset = data["app_setting"];
- var user = data["user"];
- var jichu = data["user_base"];
- var qiandao = data["user_sign"];
- var chengjiu = data["user_achievement"];
- var invite = data["user_invite"];
- var lottery = data["user_lottery"];
- if (this.curplayerData == null) {
- this.curplayerData = new PlayerData(zhengshu, null, netset, user, jichu, invite, null, qiandao, chengjiu, lottery);
- this.JundgCfg(data.table_version, cb);
- }
- else {
- if (netset) {
- this.curplayerData.netzheshe = netset;
- }
- if (user) {
- this.curplayerData.account = user;
- }
- if (jichu) {
- this.curplayerData.accountssss = jichu;
- }
- if (qiandao) {
- this.curplayerData.qiandao = qiandao;
- }
- if (chengjiu) {
- this.curplayerData.renwu = chengjiu;
- }
- }
- }
- JundgCfg(ver, callball) {
- var cfg = Laya.LocalStorage.getJSON(Global.CFG);
- if (cfg) {
- if (cfg.VER == ver) {
- console.log("已经拥有,不用更新");
- this.SetCfg(cfg);
- if (callball)
- callball(true);
- }
- else {
- console.log("cfg存在但是过期了");
- Laya.LocalStorage.removeItem(Global.CFG);
- ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
- data.configs.VER = ver;
- Laya.LocalStorage.setJSON(Global.CFG, data.configs);
- this.SetCfg(data.configs);
- if (callball)
- callball(true);
- }), Laya.Handler.create(this, (data) => {
- console.log("配置获取失败" + data);
- if (callball)
- callball(false);
- return;
- }));
- }
- }
- else {
- console.log("本地没有cfg");
- ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
- data.configs.VER = ver;
- Laya.LocalStorage.setJSON(Global.CFG, data.configs);
- this.SetCfg(data.configs);
- if (callball)
- callball(true);
- }), Laya.Handler.create(this, (data) => {
- console.log("配置获取失败" + data);
- }));
- }
- }
- SetCfg(data) {
- this.curplayerData.peizhis = data;
- this.curplayerData.GetRewardDic();
- }
- RessetConfig() {
- ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
- this.curplayerData.peizhis = data["configs"];
- }), null);
- }
- get ServerTime() {
- let time = Laya.timer.currTimer;
- let stime = this.SFSFSF + Math.ceil((time - this.createTime) / 1000);
- return stime;
- }
- }
- class ShareUtil {
- beginShare(callBack) {
- ShareUtil.beginShareTime = new Date().getTime();
- console.log("分享点击时间=" + ShareUtil.beginShareTime);
- ShareUtil.isSharing = true;
- ShareUtil.callback = callBack;
- }
- onRegister() {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- Laya.Browser.window.wx.onShow(function (option) {
- console.log("onshow share start");
- if (ShareUtil.isSharing) {
- ShareUtil.isSharing = false;
- let time = new Date().getTime();
- console.log("分享回到游戏时间" + time);
- let wait = (time - ShareUtil.beginShareTime) / 1000;
- console.log("分享停留时间为:" + wait);
- let shareSuccess = false;
- let realSuccess = false;
- if (wait < 3) {
- Laya.Browser.window.wx.showToast({ title: "请重试一次" });
- ShareUtil.callback(false);
- }
- else {
- var random = Math.random();
- if (random <= 0.3) {
- var message = ["你已分享过该群", "请重新换个群分享!", "请分享到30人大群中!"];
- var curmes = message[GameTools.RandomANumber(0, 2)];
- Laya.Browser.window.wx.showToast({ title: curmes });
- ShareUtil.callback(false);
- }
- else {
- Laya.Browser.window.wx.showToast({ title: "分享成功!" });
- ShareUtil.callback(true);
- }
- }
- }
- });
- }
- static ShareMessage() {
- if (!Laya.Browser.onWeiXin)
- return;
- var t = AccountManager.Instance.ServerTime;
- var _title = AccountManager.Instance.curplayerData.ShareTxt;
- _title = (_title == "" || !_title) ? "组团一起浪" : _title;
- var _image = "subpackage2/res/share/shareimage.png";
- Laya.Browser.window.wx.onShareAppMessage(() => ({
- title: _title,
- imageUrl: _image,
- query: "shareid=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- }));
- }
- static shareImage(channel, callback = null, shareType) {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- var t = AccountManager.Instance.ServerTime;
- var _title = AccountManager.Instance.curplayerData.ShareTxt;
- _title = (_title == "" || !_title) ? "组团一起浪" : _title;
- var _image = "subpackage2/res/share/shareimage.png";
- Laya.Browser.window.wx.aldShareAppMessage({
- title: _title,
- imageUrl: _image,
- query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- });
- if (callback) {
- ShareUtil.Instance.beginShare(callback);
- }
- }
- }
- ShareUtil.Instance = new ShareUtil();
- ShareUtil.shareSuccessTime = 0;
- ShareUtil.isSharing = false;
- class WXSDK {
- constructor() {
- WXSDK.ins = this;
- }
- static get Instance() {
- if (WXSDK.ins) {
- return WXSDK.ins;
- }
- else {
- return new WXSDK();
- }
- }
- static Init() {
- }
- static DengLu(_complete) {
- var that = this;
- Laya.Browser.window.wx.login({
- success: function (res) {
- if (res.code) {
- ShareUtil.Instance.onRegister();
- console.log("微信登陆成功----");
- that.codeValue = res.code;
- console.log("shareid:" + WXSDK.shareOpenId);
- new AccountManager(res.code, "", "", "", 0, "", "", "", "", WXSDK.shareOpenId, WXSDK.shareOpenId, Global.VERSION);
- _complete(res);
- }
- else {
- WXSDK.DengLu(WXSDK.DengLu);
- console.log('wx no code' + res.errMsg);
- }
- },
- fail: function (res) { console.log("wx.login: failed, res=" + res); }
- });
- }
- static ShowTxt(text) {
- if (Laya.Browser.onWeiXin) {
- Laya.Browser.window.wx.showToast({ title: text });
- }
- else {
- console.log(text);
- }
- }
- static OnShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.onShow(cb);
- }
- static OffShow(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.offShow(cb);
- }
- static OnHide(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.onHide(cb);
- }
- static OffHide(cb) {
- if (!Laya.Browser.onWeiXin)
- return;
- Laya.Browser.window.wx.offHide(cb);
- }
- static ShortShake() {
- Laya.Browser.window.wx.vibrateShort({});
- }
- static LongShake() {
- Laya.Browser.window.wx.vibrateLong({});
- }
- static Shake(_short = true) {
- if (Laya.Browser.onWeiXin && WXSDK.shake) {
- if (_short) {
- this.ShortShake();
- }
- else {
- this.LongShake();
- }
- }
- }
- static LoadSubPackage(name, _complete) {
- if (Laya.Browser.onWeiXin) {
- const loadTask = Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage',
- success: function (res) {
- _complete && _complete(true);
- console.log("分包加载成功");
- },
- fail: function (res) {
- _complete && _complete(false);
- console.log("分包加载失败");
- }
- });
- }
- else {
- console.log("未进行分包加载");
- _complete && _complete(true);
- }
- }
- static stageShake(callBack = null, speed = 32) {
- if (this.isShake || !this.canshakestage)
- return;
- this.isShake = true;
- var point = new Laya.Vector2(Laya.stage.x, Laya.stage.y);
- Laya.stage.timerLoop(speed, this, this.shakeObject, [point, callBack]);
- }
- static shakeObject(_point, _callBack) {
- var count = (this.num++) % 4;
- this.offsetArr[this.num % 2] = count < 2 ? 0 : this.offset;
- Laya.stage.x = this.offsetArr[0] + _point.x;
- Laya.stage.y = this.offsetArr[1] + _point.y;
- if (this.num > (this.times * 4 + 1)) {
- Laya.stage.clearTimer(this, this.shakeObject);
- Laya.stage.pos(0, 0);
- this.num = 0;
- this.isShake = false;
- if (_callBack != null) {
- _callBack();
- }
- }
- }
- static UpdateGuide(ShowGuide = 0) {
- var kvDataList = new Array();
- let date = new Date().getTime();
- var myValue = JSON.stringify({
- "guide": {
- "ShowGuide": ShowGuide,
- "update_time": date.toString()
- }
- });
- kvDataList.push({ key: "ShowGuide", value: myValue });
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.setUserCloudStorage({
- KVDataList: kvDataList,
- success: r => {
- console.log("KVDATALIST---", kvDataList);
- console.log("上传新手指引成功:" + ShowGuide);
- }
- });
- }
- }
- static UpdateScore(max_score) {
- var kvDataList = new Array();
- let date = new Date().getTime();
- var myValue = JSON.stringify({
- "wxgame": {
- "max_score": max_score,
- "update_time": date.toString(),
- }
- });
- kvDataList.push({ key: "max_score", value: myValue });
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.setUserCloudStorage({
- KVDataList: kvDataList,
- success: r => {
- console.log("KVDATALIST---", kvDataList);
- console.log("上传分数成功:" + max_score);
- }
- });
- }
- }
- static fengxiangtupian(callback) {
- if (Laya.Browser.window.wx == null) {
- return;
- }
- var _title = "组团一起浪";
- var t = AccountManager.Instance.ServerTime;
- Laya.Browser.window.wx.aldShareAppMessage({
- title: _title,
- imageUrl: "subpackage2/res/share/shareimage.png",
- query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- });
- if (callback) {
- }
- }
- static AldEvent(eventName, key = "用户id", value = "") {
- }
- static AldStart(stageId) {
- }
- static AldEnd(stageId, isComplete) {
- }
- }
- WXSDK.codeValue = "";
- WXSDK.shareOpenId = "";
- WXSDK.openId = 0;
- WXSDK.shareScene = "";
- WXSDK.uid = "123";
- WXSDK.querychannel = "";
- WXSDK.referrerInfoappId = "";
- WXSDK.shake = true;
- WXSDK.times = 1.3;
- WXSDK.num = 0;
- WXSDK.offsetArr = [0, 0];
- WXSDK.offset = 14;
- WXSDK.canshakestage = false;
- class LoadView extends ui.LoadViewUI {
- constructor() {
- super();
- this.progressnum = 0;
- this.fast = 0.07;
- this.slow = 0.005;
- this.End = false;
- this.EndProgress = false;
- LoadView.ins = this;
- Laya.stage.addChild(this);
- this.Init();
- }
- static get Instance() {
- if (LoadView.ins == null) {
- return new LoadView();
- }
- return LoadView.ins;
- }
- Init() {
- this.Login();
- Laya.timer.loop(1, this, this.UpdateProgress);
- this.height = Laya.stage.height;
- Laya.stage.on(Laya.Event.RESIZE, this, () => {
- this.height = Laya.stage.height;
- });
- }
- UpdateProgress() {
- if (this.progressnum <= 0.7) {
- this.progressnum += this.fast;
- }
- else if (this.progressnum > 0.7 && this.progressnum < 0.99) {
- this.progressnum += this.slow;
- }
- else {
- if (this.End) {
- this.progressnum += this.slow;
- }
- }
- if (!this.EndProgress && this.progressnum >= 1) {
- this.EndProgress = true;
- this.progressnum = 1;
- Laya.timer.clear(this, this.UpdateProgress);
- this.LoadComplete();
- }
- this.jindupro.value = this.progressnum;
- }
- Login() {
- WXSDK.AldEvent("开始登陆");
- if (Laya.Browser.onWeiXin) {
- this.LoginWx();
- }
- else {
- this.LoginLocal();
- }
- }
- LoginWx() {
- if (Laya.Browser.onWeiXin) {
- WXSDK.DengLu((res) => {
- if (res != "error") {
- WXSDK.AldEvent("微信登陆成功");
- console.log("1微信登录成功:" + res);
- this.LoginLocal();
- }
- else {
- this.LoginWx();
- }
- });
- }
- else {
- this.LoginLocal();
- }
- }
- LoginLocal() {
- ServerManager.Instance.Login(null, Laya.Handler.create(this, this.LoginComplete), Laya.Handler.create(this, this.LoginFail));
- }
- LoginComplete() {
- WXSDK.AldEvent("本地服务器登陆成功");
- console.log("本地服务器登陆成功");
- GuangGao.InitVideo();
- if (Laya.Browser.onWeiXin) {
- this.LoadSubPackage();
- }
- else {
- this.LoadScene();
- }
- }
- LoginFail() {
- console.log("本地服务器登陆失败");
- }
- LoadSubPackage() {
- Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage',
- success: (res) => {
- WXSDK.AldEvent("分包1加载成功");
- this.LoadSubPackage2();
- },
- fail: (res) => {
- this.LoadSubPackage();
- }
- });
- }
- LoadSubPackage2() {
- Laya.Browser.window.wx.loadSubpackage({
- name: 'subpackage2',
- success: (res) => {
- WXSDK.AldEvent("分包2加载成功");
- this.LoadScene();
- },
- fail: (res) => {
- this.LoadSubPackage2();
- }
- });
- }
- LoadScene() {
- Laya.Scene3D.load(ResourcesPath.mainscene, Laya.Handler.create(this, (sprite) => {
- this.mainscene = sprite;
- AssetManager.Instance.mainscene = this.mainscene;
- WXSDK.AldEvent("场景资源加载完毕");
- this.LoadRole();
- }));
- console.log("场景资源加载成功");
- }
- LoadRole() {
- var arr = [];
- for (let i = 0; i < ResourcesPath.Character.length; i++) {
- let item = ResourcesPath.Character[i];
- arr.push(item);
- }
- Laya.loader.create(arr, Laya.Handler.create(this, () => {
- for (let i = 0; i < ResourcesPath.Character.length; i++) {
- let model = Laya.loader.getRes(ResourcesPath.Character[i]);
- AssetManager.Instance.Character.set(i + 1, model);
- Laya.loader.clearRes(ResourcesPath.Character[i]);
- }
- console.log("玩家模型加载成功");
- WXSDK.AldEvent("玩家模型加载完毕");
- this.LoadResources();
- }));
- }
- LoadResources() {
- var arr = [];
- for (let i = 0; i < ResourcesPath.Prop.length; i++) {
- let item = ResourcesPath.Prop[i];
- arr.push(item);
- }
- Laya.loader.create(arr, Laya.Handler.create(this, () => {
- arr.forEach(s => {
- if (s.progress == 1) {
- let sp = Laya.loader.getRes(s.url);
- AssetManager.Instance.Prop.set(sp.name, sp);
- }
- else {
- console.log(`[LOG]${s.url}加载失败`);
- }
- }, this);
- console.log("道具模型加载成功");
- WXSDK.AldEvent("道具模型加载完毕");
- this.complete();
- }));
- }
- complete() {
- this.End = true;
- this.slow = this.fast;
- DispatcherManager.EventTrigger(EventState.LoadComplete);
- }
- LoadComplete() {
- this.destroy();
- }
- }
- class Main {
- constructor() {
- 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;
- if (Laya.Browser.onWeiXin) {
- Laya.Browser.window.wx.showShareMenu({
- withShareTicket: true
- });
- Laya.Browser.window.wx.onShareAppMessage(function () {
- return {
- title: "组团一起浪",
- imageUrl: "subpackage2/res/share/shareimage.png",
- };
- });
- Laya.Browser.window.wx.onShow((option) => {
- var shareTicket = option.shareTicket;
- var userId = option.query.userId;
- var shareTitle = option.query.shareTitle;
- Main.SceneNum = option.scene;
- WXSDK.querychannel = option.query.channel;
- WXSDK.shareOpenId = option.query.userId;
- console.log("scene:", option.scene);
- if (WXSDK.querychannel != null) {
- console.log("onShow channel is:", WXSDK.querychannel);
- }
- if (option.referrerInfo) {
- WXSDK.referrerInfoappId = option.referrerInfo.appId;
- console.log("onShow appId is:", option.referrerInfo.appId);
- }
- });
- if (!Laya.Browser.onWeiXin)
- return;
- 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();
- }
- });
- });
- }
- Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
- }
- onVersionLoaded() {
- Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
- }
- onConfigLoaded() {
- new LoadView();
- }
- }
- Main.SceneNum = "123";
- new Main();
- }());
- //# sourceMappingURL=bundle.js.map
|