123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366 |
- (function () {
- 'use strict';
- class ObjectUtil {
- constructor() { }
- static hitTest(sprite1, sprite2) {
- if (sprite1 == null || sprite2 == null)
- return false;
- if (sprite1.texture == null || sprite2.texture == null)
- return false;
- log('hittest1');
- let pos = sprite1.localToGlobal(Laya.Point.create());
- for (let w = 0; w < sprite1.width; w++) {
- for (let h = 0; h < sprite1.height; h++) {
- let pixels = sprite1.texture.getPixels(w, h, 1, 1);
- if (pixels) {
- log('hittest', pixels);
- if (pixels.join('') != '0000' && this.pointHitTest(sprite2, pos.x + w, pos.y + h))
- return true;
- }
- }
- }
- return false;
- }
- static pointHitTest(sprite, x, y) {
- if (sprite == null)
- return false;
- if (sprite.texture == null)
- return false;
- log('pointHitTest');
- let pos = sprite.localToGlobal(Laya.Point.create());
- let tempX = Math.floor(x - pos.x);
- let tempY = Math.floor(y - pos.y);
- let texture = sprite.texture;
- if (tempX < 0 || tempX >= texture.width || tempY < 0 || tempY >= texture.height)
- return false;
- let pixels = texture.getPixels(tempX, tempY, 1, 1);
- log('pointHitTestttt', pixels);
- if (pixels) {
- if (pixels.join('') != '0000')
- return true;
- }
- return false;
- }
- static dynamicChangePivot(sp, anchorV) {
- if (!sp || !anchorV || anchorV.length != 2)
- return;
- var prePX = sp.pivotX;
- var prePY = sp.pivotY;
- var aimPX = anchorV[0] * sp.width;
- var aimPY = anchorV[1] * sp.height;
- sp.x += (aimPX - prePX);
- sp.y += (aimPY - prePY);
- sp.pivot(aimPX, aimPY);
- }
- }
- class ButtonScript extends Laya.Script {
- constructor() {
- super(...arguments);
- this.shakeCtr = true;
- }
- onMouseDown() {
- this._mouseDown = true;
- Laya.Tween.to(this.owner, { scaleX: 1.2, scaleY: 1.2 }, 200, Laya.Ease.backOut, null, null, false);
- }
- onMouseUp(e) {
- this._mouseDown = false;
- Laya.Tween.to(this.owner, { scaleX: 1, scaleY: 1 }, 200, Laya.Ease.elasticOut, null, null, false);
- }
- onMouseOut() {
- if (this._mouseDown) {
- this._mouseDown = false;
- Laya.Tween.to(this.owner, { scaleX: 1, scaleY: 1 }, 200, Laya.Ease.elasticOut, null, null, false);
- }
- }
- onAwake() {
- if (!this.owner || !this.anchorV || !this.anchorH)
- return;
- let sp = this.owner;
- ObjectUtil.dynamicChangePivot(sp, [this.anchorH, this.anchorV]);
- }
- onEnable() {
- super.onEnable();
- if (this.needShake) {
- this.originScaleX = this.owner.scaleX;
- this.originScaleY = this.owner.scaleY;
- this.shakeTimer();
- }
- }
- shakeTimer() {
- if (!this.shakeTimeLine) {
- this.shakeTimeLine = new core.TweenTimeLine(1, Laya.Handler.create(this, this.shakeTimer));
- this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX * 1.1, scaleY: this.originScaleY * 0.9 }, 200, Laya.Ease.circInOut);
- this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX, scaleY: this.originScaleY }, 200, Laya.Ease.circInOut);
- this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX * 1.1, scaleY: this.originScaleY * 0.9 }, 200, Laya.Ease.circInOut);
- this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX, scaleY: this.originScaleY }, 200, Laya.Ease.circInOut);
- this.shakeTimeLine.start();
- this.shakeTimeLine.pause();
- Laya.timer.once(Math.ceil(4 * Math.random()) * 1000, this, this.playShakeAni);
- }
- else {
- this.shakeTimeLine.destroy();
- this.shakeTimeLine = null;
- this.shakeTimer();
- }
- }
- playShakeAni() {
- if (this.shakeCtr)
- this.shakeTimeLine.resume();
- }
- onDisable() {
- if (this.shakeTimeLine)
- this.shakeTimeLine.destroy();
- this.shakeTimeLine = null;
- Laya.timer.clearAll(this);
- super.onDisable();
- }
- }
- var View = Laya.View;
- var Scene = Laya.Scene;
- var REG = Laya.ClassUtils.regClass;
- var game;
- (function (game) {
- var ui;
- (function (ui) {
- class GameViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GameViewUI.uiView);
- }
- }
- GameViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "skin": "res/imgs/game/bg/bg.jpg", "right": 0, "left": 0, "centerY": 0 }, "compId": 200 }, { "type": "Box", "props": { "width": 1920, "var": "gameBox", "height": 1080, "centerY": 0, "centerX": 0 }, "compId": 218, "child": [{ "type": "Sprite", "props": { "y": 306, "x": 380, "texture": "res/imgs/game/bg/wpydd.png" }, "compId": 201 }, { "type": "Sprite", "props": { "y": 779, "x": 1, "texture": "res/imgs/game/bg/pd.png" }, "compId": 202 }, { "type": "Image", "props": { "y": 1015, "x": 245.5, "var": "pd_LigthImg", "skin": "res/imgs/game/bg/pd_bright.png" }, "compId": 235 }, { "type": "Sprite", "props": { "y": 787, "x": 140 }, "compId": 184, "child": [{ "type": "Image", "props": { "y": 73, "x": 1455, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 173 }, { "type": "Image", "props": { "y": 73, "x": 1120, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 178 }, { "type": "Image", "props": { "y": 73, "x": 785, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 179 }, { "type": "Image", "props": { "y": 73, "x": 450, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 180 }, { "type": "Image", "props": { "y": 73, "x": 116, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 181 }, { "type": "Image", "props": { "y": 73, "x": -224, "skin": "res/imgs/game/bg/pdjt.png" }, "compId": 182 }, { "type": "Image", "props": { "y": -21, "x": -139, "width": 1920, "skin": "res/imgs/game/new_back_black.png", "renderType": "mask", "height": 252, "alpha": 1, "sizeGrid": "5,5,5,5" }, "compId": 228 }] }, { "type": "Image", "props": { "y": 858, "x": 226, "width": 435, "var": "startPosImg", "skin": "res/imgs/game/bg/hl_left.png", "pivotY": 297, "pivotX": 227, "height": 436 }, "compId": 75, "child": [{ "type": "SkeletonPlayer", "props": { "y": 202, "x": 140, "var": "huaryUpAniL", "url": "res/ani/board_glow.sk", "scaleX": -1, "runtime": "Laya.Skeleton" }, "compId": 243 }, { "type": "Image", "props": { "y": 206, "x": 146, "width": 161, "skin": "res/imgs/game/bg/hu_left.png", "height": 181, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 236 }] }, { "type": "Image", "props": { "y": 564, "x": 1655, "var": "stopPosImg", "skin": "res/imgs/game/bg/hl_right.png" }, "compId": 203, "child": [{ "type": "SkeletonPlayer", "props": { "y": 202, "x": 128, "var": "huaryUpAniR", "url": "res/ani/board_glow.sk", "runtime": "Laya.Skeleton" }, "compId": 242 }, { "type": "Image", "props": { "y": 204, "x": 125, "width": 161, "skin": "res/imgs/game/bg/hu_right.png", "height": 181, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 237 }] }, { "type": "Image", "props": { "y": 849, "x": 1694, "width": 455, "var": "jumpBtn", "scaleY": 1, "scaleX": 1, "height": 455, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 56 }, { "type": "Image", "props": { "y": 878, "x": 203, "width": 405, "var": "runBtn", "scaleY": 1, "scaleX": 1, "height": 405, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 53 }, { "type": "Image", "props": { "y": 82, "x": 782, "var": "createBox", "skin": "res/imgs/game/bg/bg_led.png" }, "compId": 78, "child": [{ "type": "Image", "props": { "y": 185, "x": 49, "var": "createPos1", "skin": "res/imgs/game/bg/led_bright.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 94 }, { "type": "Image", "props": { "y": 185, "x": 133, "var": "createPos2", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 95 }, { "type": "Image", "props": { "y": 186, "x": 217, "var": "createPos3", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 96 }, { "type": "Image", "props": { "y": 186, "x": 301, "var": "createPos4", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 97 }, { "type": "Image", "props": { "y": 114, "x": 49, "var": "createPos5", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 86 }, { "type": "Image", "props": { "y": 114, "x": 133, "var": "createPos6", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 87 }, { "type": "Image", "props": { "y": 115, "x": 217, "var": "createPos7", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 88 }, { "type": "Image", "props": { "y": 115, "x": 301, "var": "createPos8", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 89 }, { "type": "Image", "props": { "y": 43, "x": 49, "var": "createPos9", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 74 }, { "type": "Image", "props": { "y": 43, "x": 133, "var": "createPos10", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 79 }, { "type": "Image", "props": { "y": 43, "x": 217, "var": "createPos11", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 80 }, { "type": "Image", "props": { "y": 42, "x": 301, "var": "createPos12", "skin": "res/imgs/game/bg/led_dark.png", "pivotY": 40, "pivotX": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 81 }, { "type": "Image", "props": { "y": 792, "x": -346, "width": 50, "var": "endPos1", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 137 }, { "type": "Image", "props": { "y": 792, "x": 11, "width": 50, "var": "endPos2", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 143 }, { "type": "Image", "props": { "y": 782, "x": 351, "width": 50, "var": "endPos3", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 149 }, { "type": "Image", "props": { "y": 782, "x": 720, "width": 50, "var": "endPos4", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 155 }, { "type": "Image", "props": { "y": 468, "x": -346, "width": 50, "var": "endPos5", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 139 }, { "type": "Image", "props": { "y": 468, "x": 11, "width": 50, "var": "endPos6", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 145 }, { "type": "Image", "props": { "y": 458, "x": 351, "width": 50, "var": "endPos7", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 151 }, { "type": "Image", "props": { "y": 459, "x": 720, "width": 50, "var": "endPos8", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 157 }, { "type": "Image", "props": { "y": 144, "x": -346, "width": 50, "var": "endPos9", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 141 }, { "type": "Image", "props": { "y": 144, "x": 11, "width": 50, "var": "endPos10", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 147 }, { "type": "Image", "props": { "y": 134, "x": 351, "width": 50, "var": "endPos11", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 153 }, { "type": "Image", "props": { "y": 135, "x": 720, "width": 50, "var": "endPos12", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 159 }, { "type": "Image", "props": { "y": 227.5, "x": 46, "width": 50, "var": "sdStartPos1", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 246 }, { "type": "Image", "props": { "y": 915, "x": -376, "width": 50, "var": "sdEndPos1", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 247 }, { "type": "Image", "props": { "y": 227, "x": 133, "width": 50, "var": "sdStartPos2", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 248 }, { "type": "Image", "props": { "y": 915, "x": -11, "width": 50, "var": "sdEndPos2", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 249 }, { "type": "Image", "props": { "y": 227, "x": 217, "width": 50, "var": "sdStartPos3", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 250 }, { "type": "Image", "props": { "y": 915, "x": 364, "width": 50, "var": "sdEndPos3", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 251 }, { "type": "Image", "props": { "y": 227, "x": 302, "width": 50, "var": "sdStartPos4", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 252 }, { "type": "Image", "props": { "y": 915, "x": 738, "width": 50, "var": "sdEndPos4", "name": "", "height": 50, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 253 }] }, { "type": "Box", "props": { "width": 1920, "var": "playBox", "height": 1080, "centerY": 0, "centerX": 0 }, "compId": 136 }, { "type": "Image", "props": { "y": 507, "x": 957, "width": 389, "visible": false, "var": "startBtn", "skin": "res/imgs/game/icon_qp.png", "scaleY": 1, "scaleX": 1, "height": 389, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 131, "child": [{ "type": "Text", "props": { "y": 136, "x": 105.5, "text": "开始", "fontSize": 90, "font": "Microsoft YaHei", "color": "#ffffff", "runtime": "Laya.Text" }, "compId": 132 }] }, { "type": "Image", "props": { "zOrder": 200, "y": 500.5, "x": 1315, "width": 418, "visible": false, "var": "scoreGrade", "height": 97 }, "compId": 216, "child": [{ "type": "Image", "props": { "y": 170, "x": 247, "var": "gradeImg", "skin": "res/imgs/game/great.png", "scaleY": 1, "scaleX": 1, "centerY": 0, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5, "alpha": 0 }, "compId": 217 }] }] }, { "type": "Image", "props": { "y": 59, "x": 1785, "var": "settingBtn", "top": 10, "skin": "res/home/bg_dzts_2.png", "right": 0, "name": "", "label": "label", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 268, "child": [{ "type": "Sprite", "props": { "y": 29, "x": 26, "texture": "res/home/icon_fh.png" }, "compId": 269 }, { "type": "Text", "props": { "y": 30, "x": 75, "width": 200, "valign": "middle", "text": "左踮脚 • 暂停", "height": 50, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 270 }] }, { "type": "Image", "props": { "y": 77, "x": 50, "var": "timeBg", "skin": "res/imgs/game/djs.png", "name": "", "left": 50 }, "compId": 209, "child": [{ "type": "Text", "props": { "y": 126, "x": 15, "width": 193, "var": "timeTxt", "valign": "middle", "text": "01:23`56", "italic": true, "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 60 }] }, { "type": "Image", "props": { "y": 129, "x": 1446, "var": "scoreBg", "skin": "res/imgs/game/bg_fs.png", "right": 40, "name": "" }, "compId": 211, "child": [{ "type": "Text", "props": { "y": 83, "x": 104, "width": 238, "var": "scoreTxt", "valign": "middle", "text": "100", "strokeColor": "#000000", "height": 57, "fontSize": 45, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 61 }, { "type": "Text", "props": { "y": 83, "x": 345, "width": 38, "valign": "middle", "text": "分", "strokeColor": "#000000", "height": 57, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 260 }, { "type": "Sprite", "props": { "y": 167, "x": 73, "width": 36, "texture": "res/imgs/rank/icon_df.png", "height": 29 }, "compId": 112 }, { "type": "Text", "props": { "y": 169, "x": 116, "width": 49, "valign": "middle", "text": "最佳", "height": 39, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffd748", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 113 }, { "type": "Text", "props": { "y": 163, "x": 181, "width": 161, "var": "highScoreTxt", "valign": "middle", "text": "1000", "height": 50, "fontSize": 32, "font": "Microsoft YaHei", "color": "#ffd748", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 62 }, { "type": "Text", "props": { "y": 160, "x": 336, "width": 38, "valign": "middle", "text": "分", "strokeColor": "#000000", "height": 57, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffd748", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 261 }, { "type": "Text", "props": { "y": 16, "x": 103, "width": 142, "valign": "middle", "text": "当前模式:", "strokeColor": "#000000", "height": 57, "fontSize": 20, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 262 }, { "type": "Text", "props": { "y": 16, "x": 249, "width": 142, "var": "gametypeTxt", "valign": "middle", "text": "简单", "strokeColor": "#000000", "height": 57, "fontSize": 30, "font": "Microsoft YaHei", "color": "#f19149", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 263 }] }, { "type": "Image", "props": { "y": 0, "x": 0, "var": "startBg", "top": 0, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.35, "sizeGrid": "5,5,5,5" }, "compId": 133 }, { "type": "Image", "props": { "y": 276, "x": -1920, "visible": false, "var": "startOrOverBg", "skin": "res/imgs/game/bg_ksjs.png", "centerY": -135 }, "compId": 215, "child": [{ "type": "Image", "props": { "y": 129, "x": 907, "var": "startOrOverImg", "skin": "res/imgs/game/text_go.png", "centerY": 0, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 214 }] }], "animations": [{ "nodes": [{ "target": 173, "keyframes": { "x": [{ "value": 1784, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 0 }, { "value": 1455, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 30 }] } }, { "target": 178, "keyframes": { "x": [{ "value": 1449, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 0 }, { "value": 1120, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 30 }] } }, { "target": 179, "keyframes": { "x": [{ "value": 1115, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 0 }, { "value": 785, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 30 }] } }, { "target": 180, "keyframes": { "x": [{ "value": 780, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 0 }, { "value": 450, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 30 }] } }, { "target": 181, "keyframes": { "x": [{ "value": 445, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 0 }, { "value": 116, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 30 }] } }, { "target": 182, "keyframes": { "x": [{ "value": 111, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 0 }, { "value": -224, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 30 }] } }], "name": "runWayAni", "id": 1, "frameRate": 60, "action": 0 }, { "nodes": [{ "target": 215, "keyframes": { "centerX": [{ "value": -2000, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 20 }] } }], "name": "openAni", "id": 2, "frameRate": 60, "action": 0 }, { "nodes": [{ "target": 215, "keyframes": { "centerX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 0 }, { "value": 2000, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 20 }] } }], "name": "goAni", "id": 3, "frameRate": 60, "action": 0 }, { "nodes": [{ "target": 215, "keyframes": { "centerX": [{ "value": 2000, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 215, "key": "centerX", "index": 20 }] } }], "name": "gameOverAni", "id": 4, "frameRate": 60, "action": 0 }, { "nodes": [{ "target": 217, "keyframes": { "scaleY": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "scaleY", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "scaleY", "index": 25 }], "scaleX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "scaleX", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "scaleX", "index": 25 }], "alpha": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "alpha", "index": 25 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 217, "label": null, "key": "alpha", "index": 50 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 217, "key": "alpha", "index": 60 }] } }, { "target": 216, "keyframes": { "visible": [{ "value": true, "tweenMethod": "linearNone", "tween": false, "target": 216, "key": "visible", "index": 0 }, { "value": false, "tweenMethod": "linearNone", "tween": false, "target": 216, "key": "visible", "index": 60 }] } }], "name": "gradeAni", "id": 5, "frameRate": 60, "action": 0 }, { "nodes": [{ "target": 214, "keyframes": { "scaleY": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleY", "index": 0 }, { "value": 1.2, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleY", "index": 20 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleY", "index": 25 }], "scaleX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleX", "index": 0 }, { "value": 1.2, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleX", "index": 20 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 214, "key": "scaleX", "index": 25 }] } }], "name": "countAni", "id": 6, "frameRate": 60, "action": 0 }], "loadList": ["res/imgs/game/bg/bg.jpg", "res/imgs/game/bg/wpydd.png", "res/imgs/game/bg/pd.png", "res/imgs/game/bg/pd_bright.png", "res/imgs/game/bg/pdjt.png", "res/imgs/game/new_back_black.png", "res/imgs/game/bg/hl_left.png", "res/ani/board_glow.sk", "res/imgs/game/bg/hu_left.png", "res/imgs/game/bg/hl_right.png", "res/imgs/game/bg/hu_right.png", "res/imgs/game/bg/bg_led.png", "res/imgs/game/bg/led_bright.png", "res/imgs/game/bg/led_dark.png", "res/imgs/game/icon_qp.png", "res/imgs/game/great.png", "res/home/bg_dzts_2.png", "res/home/icon_fh.png", "res/imgs/game/djs.png", "res/imgs/game/bg_fs.png", "res/imgs/rank/icon_df.png", "res/imgs/game/bg_ksjs.png", "res/imgs/game/text_go.png"], "loadList3D": [] };
- ui.GameViewUI = GameViewUI;
- REG("game.ui.GameViewUI", GameViewUI);
- class HomeViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(HomeViewUI.uiView);
- }
- }
- HomeViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "res/home/bj_sy.jpg", "right": 0, "left": 0, "bottom": 0 }, "compId": 21 }, { "type": "Box", "props": { "width": 1920, "height": 1080, "centerY": 0, "centerX": 0 }, "compId": 58, "child": [{ "type": "Image", "props": { "y": 220, "x": 0, "skin": "res/home/logo.png" }, "compId": 25 }, { "type": "Image", "props": { "y": 63, "x": -1000, "skin": "res/home/juese.png", "left": 80 }, "compId": 167 }, { "type": "Image", "props": { "y": 896, "skin": "res/home/msxz_1.png", "centerX": 0, "alpha": 1 }, "compId": 134, "child": [{ "type": "Image", "props": { "skin": "res/home/msxz_2.png", "centerY": 0, "centerX": 0 }, "compId": 166 }] }, { "type": "Image", "props": { "y": 715, "x": 400, "var": "level1", "skin": "res/home/simple_1.png", "scaleY": 1.1, "scaleX": 1.1, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 76, "x": 87, "text": "text", "skin": "res/home/simple_2.png" }, "compId": 27 }, { "type": "Sprite", "props": { "y": 170, "x": 76, "texture": "res/home/simple_3.png" }, "compId": 104 }, { "type": "Sprite", "props": { "y": 231, "x": 74, "texture": "res/home/simple_4.png" }, "compId": 39 }, { "type": "Text", "props": { "y": 192, "x": 131, "width": 46, "text": "时间", "strokeColor": "#fbfbfb", "height": 17, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 102 }, { "type": "Text", "props": { "y": 253, "x": 131, "width": 76, "text": "历史最高", "strokeColor": "#fbfbfb", "height": 18, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 103 }, { "type": "Text", "props": { "y": 186, "x": 263, "width": 183, "var": "level1TimeTxt", "text": "02:35:01", "strokeColor": "#fbfbfb", "italic": true, "height": 31, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 41 }, { "type": "Text", "props": { "y": 248, "x": 263, "width": 190, "var": "level1ScoreTxt", "text": "9999", "strokeColor": "#fbfbfb", "italic": true, "height": 29, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 715, "var": "level2", "skin": "res/home/normal_1.png", "scaleY": 1.1, "scaleX": 1.1, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 76, "x": 87, "text": "text", "skin": "res/home/normal_2.png" }, "compId": 152 }, { "type": "Sprite", "props": { "y": 170, "x": 76, "texture": "res/home/normal_3.png" }, "compId": 153 }, { "type": "Sprite", "props": { "y": 231, "x": 74, "texture": "res/home/normal_4.png" }, "compId": 154 }, { "type": "Text", "props": { "y": 192, "x": 131, "width": 46, "text": "时间", "strokeColor": "#fbfbfb", "height": 17, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 155 }, { "type": "Text", "props": { "y": 253, "x": 131, "width": 76, "text": "历史最高", "strokeColor": "#fbfbfb", "height": 18, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 156 }, { "type": "Text", "props": { "y": 186, "x": 263, "width": 183, "var": "level2TimeTxt", "text": "02:35:01", "strokeColor": "#fbfbfb", "italic": true, "height": 31, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 157 }, { "type": "Text", "props": { "y": 248, "x": 263, "width": 190, "var": "level2ScoreTxt", "text": "9999", "strokeColor": "#fbfbfb", "italic": true, "height": 29, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 158 }] }, { "type": "Image", "props": { "y": 715, "x": 1520, "var": "level3", "skin": "res/home/difficulty_1.png", "scaleY": 1.1, "scaleX": 1.1, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 118, "child": [{ "type": "Image", "props": { "y": 76, "x": 87, "text": "text", "skin": "res/home/difficulty_2.png" }, "compId": 159 }, { "type": "Sprite", "props": { "y": 170, "x": 76, "texture": "res/home/difficulty_3.png" }, "compId": 160 }, { "type": "Sprite", "props": { "y": 231, "x": 74, "texture": "res/home/difficulty_4.png" }, "compId": 161 }, { "type": "Text", "props": { "y": 192, "x": 131, "width": 46, "text": "时间", "strokeColor": "#fbfbfb", "height": 17, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 162 }, { "type": "Text", "props": { "y": 253, "x": 131, "width": 76, "text": "历史最高", "strokeColor": "#fbfbfb", "height": 18, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 163 }, { "type": "Text", "props": { "y": 186, "x": 263, "width": 183, "var": "level3TimeTxt", "text": "02:35:01", "strokeColor": "#fbfbfb", "italic": true, "height": 31, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 164 }, { "type": "Text", "props": { "y": 248, "x": 263, "width": 190, "var": "level3ScoreTxt", "text": "9999", "strokeColor": "#fbfbfb", "italic": true, "height": 29, "fontSize": 33, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "left", "runtime": "Laya.Text" }, "compId": 165 }] }] }, { "type": "Image", "props": { "width": 1920, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "height": 65, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5, "sizeGrid": "5,5,5,5" }, "compId": 60, "child": [{ "type": "Box", "props": { "y": 33, "width": 1560, "scaleY": 0.8, "scaleX": 0.8, "height": 60, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 77, "child": [{ "type": "Sprite", "props": { "x": 0, "texture": "res/imgs/game/icon_zc1.png" }, "compId": 61, "child": [{ "type": "Text", "props": { "y": 10, "x": 47, "width": 211, "valign": "middle", "text": "左踏 • 上一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 62 }] }, { "type": "Sprite", "props": { "x": 630, "texture": "res/imgs/game/icon_yc1.png" }, "compId": 63, "child": [{ "type": "Text", "props": { "y": 10, "x": 51, "width": 211, "valign": "middle", "text": "右踏 • 下一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 64 }] }, { "type": "Sprite", "props": { "y": 0, "x": 1264, "texture": "res/imgs/game/icon_right_yellow@3x1.png" }, "compId": 65, "child": [{ "type": "Text", "props": { "y": 10, "x": 79, "width": 211, "valign": "middle", "text": "右踮脚 • 确定", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 66 }] }] }] }, { "type": "Image", "props": { "visible": false, "var": "exitBg", "top": 0, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.5, "sizeGrid": "5,5,5,5" }, "compId": 93 }, { "type": "Image", "props": { "y": 493, "x": 960, "width": 507, "visible": false, "var": "exitBtnBg", "skin": "res/imgs/game/img_sz.png", "scaleY": 1.2, "scaleX": 1.2, "height": 456, "centerY": -47, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 78, "child": [{ "type": "Image", "props": { "y": 26, "skin": "res/imgs/game/tittle_ts.png", "centerX": 0 }, "compId": 79 }, { "type": "Text", "props": { "y": 189, "x": 69.5, "width": 368, "valign": "middle", "text": "您确定要返回大厅界面?", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 98 }, { "type": "Image", "props": { "y": 321, "x": 39, "var": "noBtn", "skin": "res/imgs/game/btn_tyxz.png" }, "compId": 94, "child": [{ "type": "Image", "props": { "var": "noTxtImg", "text": "text", "skin": "res/imgs/game/text_qx1.png", "centerY": 0, "centerX": 0 }, "compId": 95 }] }, { "type": "Image", "props": { "y": 321, "x": 269, "var": "yesBtn", "skin": "res/imgs/game/btn_tywxz.png" }, "compId": 96, "child": [{ "type": "Image", "props": { "var": "yesTxtImg", "text": "text", "skin": "res/imgs/game/text_qd2.png", "centerY": 0, "centerX": 0 }, "compId": 97 }] }] }, { "type": "Box", "props": { "y": 37, "x": 1920, "width": 553, "right": 0, "height": 107 }, "compId": 148, "child": [{ "type": "Image", "props": { "y": 47, "x": 52, "var": "rankBtn", "skin": "res/home/iocn_rank.png", "name": "", "label": "label", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 38, "child": [{ "type": "Sprite", "props": { "texture": "res/home/iocn_rank.png", "renderType": "mask" }, "compId": 56 }] }, { "type": "Image", "props": { "y": 48, "x": 194, "var": "settingBtn", "skin": "res/home/icon_setting.png", "name": "", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 20, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "res/home/icon_setting.png", "renderType": "mask" }, "compId": 54 }] }, { "type": "Image", "props": { "y": 48, "x": 421, "var": "homeBtn", "skin": "res/home/bg_dzts_2.png", "label": "label", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 74, "child": [{ "type": "Sprite", "props": { "y": 29, "x": 26, "texture": "res/home/icon_fh.png" }, "compId": 149 }, { "type": "Text", "props": { "y": 30, "x": 75, "width": 200, "valign": "middle", "text": "左踮脚 • 退出", "height": 50, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 150 }] }] }, { "type": "Box", "props": { "y": 82, "x": -196, "width": 334, "var": "selfIInfoBox", "pivotY": 49, "pivotX": 167, "left": 75, "height": 98 }, "compId": 147, "child": [{ "type": "Image", "props": { "y": 18, "x": 60, "skin": "res/home/bg_name.png" }, "compId": 146, "child": [{ "type": "Text", "props": { "y": 21.5, "x": 62, "width": 212, "var": "nameTxt", "valign": "middle", "text": "昵称最多七个字", "strokeColor": "#000000", "height": 51, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 136 }] }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "res/home/bg_txk.png" }, "compId": 139, "child": [{ "type": "Image", "props": { "width": 120, "var": "avatarImg", "skin": "res/imgs/rank/biaoqing3.png", "height": 120, "centerY": 0, "centerX": 0 }, "compId": 135, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 120, "skin": "res/home/bg_txk.png", "renderType": "mask", "height": 120, "centerY": 0, "centerX": -1 }, "compId": 145 }] }] }] }], "animations": [{ "nodes": [{ "target": 25, "keyframes": { "y": [{ "value": -437, "tweenMethod": "linearNone", "tween": true, "target": 25, "key": "y", "index": 0 }, { "value": 220, "tweenMethod": "linearNone", "tween": true, "target": 25, "key": "y", "index": 20 }, { "value": 200, "tweenMethod": "linearNone", "tween": true, "target": 25, "key": "y", "index": 25 }, { "value": 220, "tweenMethod": "linearNone", "tween": true, "target": 25, "key": "y", "index": 30 }] } }, { "target": 15, "keyframes": { "x": [{ "value": -350, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": -239, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 5 }, { "value": 400, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 20 }, { "value": 390, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 25 }, { "value": 400, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 30 }] } }, { "target": 118, "keyframes": { "x": [{ "value": 2146, "tweenMethod": "linearNone", "tween": true, "target": 118, "key": "x", "index": 0 }, { "value": 2146, "tweenMethod": "linearNone", "tween": true, "target": 118, "label": null, "key": "x", "index": 5 }, { "value": 1520, "tweenMethod": "linearNone", "tween": true, "target": 118, "key": "x", "index": 20 }, { "value": 1530, "tweenMethod": "linearNone", "tween": true, "target": 118, "key": "x", "index": 25 }, { "value": 1520, "tweenMethod": "linearNone", "tween": true, "target": 118, "key": "x", "index": 30 }] } }, { "target": 106, "keyframes": { "y": [{ "value": 1210, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "y", "index": 0 }, { "value": 695, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "y", "index": 20 }, { "value": 725, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "y", "index": 25 }, { "value": 715, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "y", "index": 30 }] } }, { "target": 134, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 134, "key": "alpha", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 134, "key": "alpha", "index": 20 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 134, "key": "alpha", "index": 40 }] } }, { "target": 147, "keyframes": { "left": [{ "value": -363, "tweenMethod": "linearNone", "tween": true, "target": 147, "key": "left", "index": 0 }, { "value": 75, "tweenMethod": "linearNone", "tween": true, "target": 147, "key": "left", "index": 40 }] } }, { "target": 148, "keyframes": { "right": [{ "value": -553, "tweenMethod": "linearNone", "tween": false, "target": 148, "key": "right", "index": 0 }, { "value": -553, "tweenMethod": "linearNone", "tween": true, "target": 148, "key": "right", "index": 20 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 148, "key": "right", "index": 40 }] } }, { "target": 60, "keyframes": { "bottom": [{ "value": -80, "tweenMethod": "linearNone", "tween": false, "target": 60, "key": "bottom", "index": 0 }, { "value": -80, "tweenMethod": "linearNone", "tween": true, "target": 60, "key": "bottom", "index": 20 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 60, "key": "bottom", "index": 40 }] } }, { "target": 61, "keyframes": { "x": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 61, "key": "x", "index": 0 }] } }, { "target": 77, "keyframes": { "width": [{ "value": 1560, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "width", "index": 0 }] } }, { "target": 65, "keyframes": { "x": [{ "value": 1264, "tweenMethod": "linearNone", "tween": true, "target": 65, "key": "x", "index": 0 }] } }, { "target": 63, "keyframes": { "x": [{ "value": 630, "tweenMethod": "linearNone", "tween": true, "target": 63, "key": "x", "index": 0 }] } }, { "target": 167, "keyframes": { "left": [{ "value": -1000, "tweenMethod": "linearNone", "tween": true, "target": 167, "key": "left", "index": 0 }, { "value": 80, "tweenMethod": "linearNone", "tween": true, "target": 167, "key": "left", "index": 30 }] } }], "name": "openAni", "id": 1, "frameRate": 60, "action": 0 }], "loadList": ["res/home/bj_sy.jpg", "res/home/logo.png", "res/home/juese.png", "res/home/msxz_1.png", "res/home/msxz_2.png", "res/home/simple_1.png", "res/home/simple_2.png", "res/home/simple_3.png", "res/home/simple_4.png", "res/home/normal_1.png", "res/home/normal_2.png", "res/home/normal_3.png", "res/home/normal_4.png", "res/home/difficulty_1.png", "res/home/difficulty_2.png", "res/home/difficulty_3.png", "res/home/difficulty_4.png", "res/imgs/game/new_back_black.png", "res/imgs/game/icon_zc1.png", "res/imgs/game/icon_yc1.png", "res/imgs/game/icon_right_yellow@3x1.png", "res/imgs/game/img_sz.png", "res/imgs/game/tittle_ts.png", "res/imgs/game/btn_tyxz.png", "res/imgs/game/text_qx1.png", "res/imgs/game/btn_tywxz.png", "res/imgs/game/text_qd2.png", "res/home/iocn_rank.png", "res/home/icon_setting.png", "res/home/bg_dzts_2.png", "res/home/icon_fh.png", "res/home/bg_name.png", "res/home/bg_txk.png", "res/imgs/rank/biaoqing3.png"], "loadList3D": [] };
- ui.HomeViewUI = HomeViewUI;
- REG("game.ui.HomeViewUI", HomeViewUI);
- class PauseViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(PauseViewUI.uiView);
- }
- }
- PauseViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "res/imgs/result/bj_mh.jpg", "right": 0, "left": 0, "bottom": 0 }, "compId": 197 }, { "type": "Image", "props": { "top": 0, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.5, "sizeGrid": "5,5,5,5" }, "compId": 196 }, { "type": "Image", "props": { "y": 278, "var": "continueBtn", "skin": "res/imgs/game/btom_bright.png", "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 131, "child": [{ "type": "Image", "props": { "var": "continueImg", "text": "text", "skin": "res/imgs/game/text_jxb.png", "centerY": 0, "centerX": 0 }, "compId": 198 }, { "type": "Script", "props": { "runtime": "game/script/ButtonScript.ts" }, "compId": 217 }] }, { "type": "Image", "props": { "y": 530, "var": "resetBtn", "skin": "res/imgs/game/btom_dark.png", "scaleY": 1, "scaleX": 1, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 192, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "resetImg", "text": "text", "skin": "res/imgs/game/text_ckd.png", "centerY": 0, "centerX": 0 }, "compId": 199 }, { "type": "Script", "props": { "runtime": "game/script/ButtonScript.ts" }, "compId": 218 }] }, { "type": "Image", "props": { "y": 781, "var": "exitBtn", "skin": "res/imgs/game/btom_dark.png", "scaleY": 1, "scaleX": 1, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 194, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "exitImg", "text": "text", "skin": "res/imgs/game/text_tcd.png", "centerY": 0, "centerX": 0 }, "compId": 200 }, { "type": "Script", "props": { "runtime": "game/script/ButtonScript.ts" }, "compId": 219 }] }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 1920, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "height": 65, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5, "sizeGrid": "5,5,5,5" }, "compId": 209, "child": [{ "type": "Box", "props": { "y": 33, "width": 1560, "scaleY": 0.8, "scaleX": 0.8, "height": 60, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 210, "child": [{ "type": "Sprite", "props": { "x": 0, "texture": "res/imgs/game/icon_zc1.png" }, "compId": 211, "child": [{ "type": "Text", "props": { "y": 10, "x": 47, "width": 211, "valign": "middle", "text": "左踏 • 上一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 212 }] }, { "type": "Sprite", "props": { "x": 630, "texture": "res/imgs/game/icon_yc1.png" }, "compId": 213, "child": [{ "type": "Text", "props": { "y": 10, "x": 51, "width": 211, "valign": "middle", "text": "右踏 • 下一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 214 }] }, { "type": "Sprite", "props": { "y": 0, "x": 1264, "texture": "res/imgs/game/icon_right_yellow@3x1.png" }, "compId": 215, "child": [{ "type": "Text", "props": { "y": 10, "x": 79, "width": 211, "valign": "middle", "text": "右踮脚 • 确定", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 216 }] }] }] }], "animations": [{ "nodes": [{ "target": 173, "keyframes": { "x": [{ "value": 1762, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 0 }, { "value": 1583, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 30 }] } }, { "target": 175, "keyframes": { "x": [{ "value": 1581, "tweenMethod": "linearNone", "tween": true, "target": 175, "key": "x", "index": 0 }, { "value": 1402, "tweenMethod": "linearNone", "tween": true, "target": 175, "key": "x", "index": 30 }] } }, { "target": 178, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "y", "index": 30 }], "x": [{ "value": 1400, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 0 }, { "value": 1221, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 30 }] } }, { "target": 177, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "y", "index": 30 }], "x": [{ "value": 1219, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "x", "index": 0 }, { "value": 1040, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "x", "index": 30 }] } }, { "target": 179, "keyframes": { "x": [{ "value": 1038, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 0 }, { "value": 859, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 30 }] } }, { "target": 180, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "y", "index": 30 }], "x": [{ "value": 857, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 0 }, { "value": 678, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 30 }] } }, { "target": 181, "keyframes": { "x": [{ "value": 676, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 0 }, { "value": 495, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 30 }] } }, { "target": 182, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "y", "index": 30 }], "x": [{ "value": 495, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 0 }, { "value": 316, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 30 }] } }, { "target": 183, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 19 }, { "value": 3.1999999999999886, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 20 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 30 }], "x": [{ "value": 314, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 0 }, { "value": 204, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 19 }, { "value": 1822, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 20 }, { "value": 1762, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 30 }] } }], "name": "runWayAni", "id": 1, "frameRate": 60, "action": 0 }], "loadList": ["res/imgs/result/bj_mh.jpg", "res/imgs/game/new_back_black.png", "res/imgs/game/btom_bright.png", "res/imgs/game/text_jxb.png", "res/imgs/game/btom_dark.png", "res/imgs/game/text_ckd.png", "res/imgs/game/text_tcd.png", "res/imgs/game/icon_zc1.png", "res/imgs/game/icon_yc1.png", "res/imgs/game/icon_right_yellow@3x1.png"], "loadList3D": [] };
- ui.PauseViewUI = PauseViewUI;
- REG("game.ui.PauseViewUI", PauseViewUI);
- class RankItemUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(RankItemUI.uiView);
- }
- }
- RankItemUI.uiView = { "type": "View", "props": { "width": 1545, "height": 200 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 29, "x": 0, "skin": "res/imgs/rank/bg_ph.png" }, "compId": 3 }, { "type": "Image", "props": { "y": -9, "x": 67, "var": "winImg", "skin": "res/imgs/rank/icon_diyi.png" }, "compId": 4 }, { "type": "FontClip", "props": { "y": 71, "x": 67, "width": 155, "visible": false, "var": "rankTxt", "value": "1", "skin": "res/imgs/rank/num_ph.png", "sheet": "0123456789", "height": 51, "align": "center" }, "compId": 24 }, { "type": "Image", "props": { "y": 42, "x": 274, "width": 115, "var": "avatarImg", "skin": "res/imgs/rank/biaoqing3.png", "height": 115 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 115, "skin": "res/imgs/rank/biaoqing3.png", "renderType": "mask", "height": 115 }, "compId": 20 }] }, { "type": "Text", "props": { "y": 71, "x": 435, "width": 289, "var": "nameTxt", "valign": "middle", "text": "婷子", "strokeColor": "#000000", "height": 57, "fontSize": 40, "font": "Microsoft YaHei", "color": "#000000", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 21 }, { "type": "Image", "props": { "y": 68, "x": 1001, "skin": "res/imgs/rank/icon_df.png" }, "compId": 22 }, { "type": "Text", "props": { "y": 71, "x": 1099, "width": 326, "var": "scoreTxt", "valign": "middle", "text": "0", "strokeColor": "#000000", "italic": true, "height": 65, "fontSize": 70, "font": "Microsoft YaHei", "color": "#ff9005", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 23 }, { "type": "Text", "props": { "y": 73, "x": 1434, "width": 57, "var": "scoreTxt1", "valign": "middle", "text": "分", "strokeColor": "#000000", "italic": true, "height": 65, "fontSize": 50, "font": "Microsoft YaHei", "color": "#ff9005", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 27 }], "loadList": ["res/imgs/rank/bg_ph.png", "res/imgs/rank/icon_diyi.png", "res/imgs/rank/num_ph.png", "res/imgs/rank/biaoqing3.png", "res/imgs/rank/icon_df.png"], "loadList3D": [] };
- ui.RankItemUI = RankItemUI;
- REG("game.ui.RankItemUI", RankItemUI);
- class RankViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(RankViewUI.uiView);
- }
- }
- RankViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "res/imgs/result/bj_mh.jpg", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "top": 75, "skin": "res/imgs/rank/bg_phbsl.png", "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "Image", "props": { "top": 0, "skin": "res/imgs/rank/bg_phbhl.png", "right": 0, "left": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 141, "top": 18, "skin": "res/imgs/rank/icon_phb.png" }, "compId": 8 }, { "type": "Image", "props": { "x": 203, "top": 18, "skin": "res/imgs/rank/tittle_phb.png" }, "compId": 9 }, { "type": "Image", "props": { "var": "closeBtn", "top": 5, "skin": "res/imgs/rank/btn_back.png", "right": 80, "label": "label" }, "compId": 7 }, { "type": "Image", "props": { "y": 75, "x": 0, "width": 267, "var": "friendBtn", "label": "label", "height": 152 }, "compId": 11, "child": [{ "type": "Image", "props": { "var": "friendBg", "skin": "res/imgs/rank/btn_phbxz.png", "label": "label", "centerY": 0, "centerX": 0 }, "compId": 17 }, { "type": "Image", "props": { "text": "text", "skin": "res/imgs/rank/text_hyb.png", "centerY": 0, "centerX": 0 }, "compId": 10 }, { "type": "Sprite", "props": { "y": 151, "x": -1, "width": 268, "texture": "res/imgs/rank/phbfgx.png" }, "compId": 13 }] }, { "type": "Image", "props": { "y": 229, "x": 0, "width": 267, "var": "wordBtn", "label": "label", "height": 152 }, "compId": 18, "child": [{ "type": "Sprite", "props": { "y": -3, "x": -1, "width": 268, "texture": "res/imgs/rank/phbfgx.png" }, "compId": 56 }, { "type": "Image", "props": { "var": "wordBg", "skin": "res/imgs/rank/btn_phbxz.png", "label": "label", "centerY": 0, "centerX": 0 }, "compId": 19 }, { "type": "Image", "props": { "text": "text", "skin": "res/imgs/rank/btn_sjb.png", "centerY": 0, "centerX": 0 }, "compId": 20 }, { "type": "Sprite", "props": { "y": 151, "x": -1, "width": 268, "texture": "res/imgs/rank/phbfgx.png" }, "compId": 21 }] }, { "type": "Image", "props": { "top": 75, "right": 0, "left": 263, "bottom": 160 }, "compId": 57, "child": [{ "type": "List", "props": { "y": 0, "width": 1617, "visible": false, "var": "rankList", "repeatY": 4, "height": 800, "centerX": 0 }, "compId": 33, "child": [{ "type": "RankItem", "props": { "y": 27, "x": 56, "runtime": "game/view/common/RankItem.ts", "renderType": "render" }, "compId": 34 }] }] }, { "type": "Image", "props": { "var": "selfBg", "skin": "res/imgs/rank/bg_wdph.png", "right": 0, "left": 264, "bottom": 0 }, "compId": 32, "child": [{ "type": "Box", "props": { "y": 69, "width": 1648, "height": 150, "centerX": 0 }, "compId": 58, "child": [{ "type": "Image", "props": { "width": 109, "var": "winImg", "skin": "res/imgs/rank/icon_diyi.png", "height": 124 }, "compId": 35 }, { "type": "Image", "props": { "y": 46, "x": 148, "text": "text", "skin": "res/imgs/rank/text_wdph.png" }, "compId": 41 }, { "type": "Image", "props": { "y": 92, "x": 116, "var": "loseImg", "text": "text", "skin": "res/imgs/rank/text_wsb.png" }, "compId": 42 }, { "type": "FontClip", "props": { "y": 93, "x": 178, "var": "rankTxt", "value": "1", "skin": "res/imgs/rank/num_ph.png", "sheet": "0123456789" }, "compId": 44 }, { "type": "Image", "props": { "y": 35, "x": 340, "width": 115, "var": "avatarImg", "skin": "res/imgs/rank/biaoqing3.png", "height": 115 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 115, "skin": "res/imgs/rank/biaoqing3.png", "renderType": "mask", "height": 115 }, "compId": 40 }] }, { "type": "Text", "props": { "y": 64, "x": 501, "width": 289, "var": "nameTxt", "valign": "middle", "text": "婷子", "strokeColor": "#000000", "height": 57, "fontSize": 40, "font": "Microsoft YaHei", "color": "#000000", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 37 }, { "type": "Image", "props": { "y": 61, "x": 1069, "skin": "res/imgs/rank/icon_df.png" }, "compId": 38 }, { "type": "Text", "props": { "y": 64, "x": 1159, "width": 340, "var": "scoreTxt", "valign": "middle", "text": "0", "strokeColor": "#000000", "italic": true, "height": 65, "fontSize": 70, "font": "Microsoft YaHei", "color": "#000000", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 39 }, { "type": "Text", "props": { "y": 68, "x": 1496, "width": 57, "var": "scoreTxt1", "valign": "middle", "text": "分", "strokeColor": "#000000", "italic": true, "height": 65, "fontSize": 50, "font": "Microsoft YaHei", "color": "#050200", "bold": true, "align": "right", "runtime": "Laya.Text" }, "compId": 59 }] }] }], "animations": [{ "nodes": [{ "target": 33, "keyframes": { "y": [{ "value": 1085, "tweenMethod": "linearNone", "tween": true, "target": 33, "key": "y", "index": 0 }, { "value": 27, "tweenMethod": "linearNone", "tween": true, "target": 33, "key": "y", "index": 30 }] } }], "name": "openAni", "id": 1, "frameRate": 60, "action": 0 }], "loadList": ["res/imgs/result/bj_mh.jpg", "res/imgs/rank/bg_phbsl.png", "res/imgs/rank/bg_phbhl.png", "res/imgs/rank/icon_phb.png", "res/imgs/rank/tittle_phb.png", "res/imgs/rank/btn_back.png", "res/imgs/rank/btn_phbxz.png", "res/imgs/rank/text_hyb.png", "res/imgs/rank/phbfgx.png", "res/imgs/rank/btn_sjb.png", "res/imgs/rank/bg_wdph.png", "res/imgs/rank/icon_diyi.png", "res/imgs/rank/text_wdph.png", "res/imgs/rank/text_wsb.png", "res/imgs/rank/num_ph.png", "res/imgs/rank/biaoqing3.png", "res/imgs/rank/icon_df.png"], "loadList3D": [] };
- ui.RankViewUI = RankViewUI;
- REG("game.ui.RankViewUI", RankViewUI);
- class ResultViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ResultViewUI.uiView);
- }
- }
- ResultViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "res/imgs/game/new_back_black.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.9, "sizeGrid": "5,5,5,5" }, "compId": 198 }, { "type": "Box", "props": { "width": 1920, "height": 1080, "centerX": 0 }, "compId": 207, "child": [{ "type": "Image", "props": { "y": 844, "var": "homeBtn", "skin": "res/imgs/result/btom_bright.png", "centerX": -253, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 215, "child": [{ "type": "Image", "props": { "var": "homeImg", "text": "text", "skin": "res/imgs/result/text_an_fhb.png", "centerY": 0, "centerX": 0 }, "compId": 217 }, { "type": "Script", "props": { "runtime": "game/script/ButtonScript.ts" }, "compId": 289 }] }, { "type": "Image", "props": { "y": 844, "var": "resetBtn", "skin": "res/imgs/result/btom_dark.png", "scaleY": 1, "scaleX": 1, "centerX": 260, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 216, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "resetImg", "text": "text", "skin": "res/imgs/result/text_an_zld.png", "centerY": 0, "centerX": 0 }, "compId": 218 }, { "type": "Script", "props": { "runtime": "game/script/ButtonScript.ts" }, "compId": 290 }] }, { "type": "Image", "props": { "y": 118, "x": 470, "skin": "res/imgs/result/tittle_js_bjdf.png", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 264 }, { "type": "Sprite", "props": { "y": 156, "x": 113.5, "texture": "res/imgs/result/bg_js_bjdf.png" }, "compId": 265 }, { "type": "Text", "props": { "y": 229, "x": 87, "width": 191, "valign": "middle", "text": "您本局消耗", "height": 44, "fontSize": 38, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 227, "child": [{ "type": "Text", "props": { "y": -2, "x": 230, "width": 398, "var": "caloriesTxt", "valign": "middle", "text": "999.99", "italic": true, "height": 49, "fontSize": 60, "font": "Microsoft YaHei", "color": "#ffd748", "align": "right", "runtime": "Laya.Text" }, "compId": 229 }, { "type": "Text", "props": { "y": 5, "x": 663, "width": 73, "valign": "middle", "text": "大卡", "height": 39, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 275 }] }, { "type": "Text", "props": { "y": 312, "x": 88, "width": 190, "valign": "middle", "text": "相当于步行", "height": 42, "fontSize": 38, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 230, "child": [{ "type": "Text", "props": { "y": -6, "x": 230, "width": 398, "var": "stepTxt", "valign": "middle", "text": "99999", "italic": true, "height": 49, "fontSize": 60, "font": "Microsoft YaHei", "color": "#ffd748", "align": "right", "runtime": "Laya.Text" }, "compId": 231 }, { "type": "Text", "props": { "y": -1, "x": 699, "width": 36, "valign": "middle", "text": "步", "height": 39, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 277 }] }, { "type": "Sprite", "props": { "y": 383, "x": 221.5, "texture": "res/imgs/result/bg_js_sjbdfgx.png" }, "compId": 266 }, { "type": "Text", "props": { "y": 419, "x": 200, "width": 76, "valign": "middle", "text": "得分", "height": 39, "fontSize": 38, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 232, "child": [{ "type": "Text", "props": { "y": 2, "x": 116, "width": 144, "valign": "middle", "text": "金币积分", "height": 28, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 268, "child": [{ "type": "Text", "props": { "y": -3, "x": 176, "width": 271, "var": "addScoreTxt", "valign": "middle", "text": "+10000", "italic": true, "height": 35, "fontSize": 45, "font": "Microsoft YaHei", "color": "#00ffff", "align": "right", "runtime": "Laya.Text" }, "compId": 269 }, { "type": "Text", "props": { "y": 1, "x": 464, "width": 38, "valign": "middle", "text": "分", "italic": true, "height": 29, "fontSize": 36, "font": "Microsoft YaHei", "color": "#00ffff", "align": "center", "runtime": "Laya.Text" }, "compId": 270 }] }, { "type": "Text", "props": { "y": 58, "x": 116, "width": 144, "valign": "middle", "text": "炸弹扣分", "height": 29, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 272, "child": [{ "type": "Text", "props": { "y": -3, "x": 179, "width": 269, "var": "subScoreTxt", "valign": "middle", "text": "-10000", "italic": true, "height": 29, "fontSize": 45, "font": "Microsoft YaHei", "color": "#ff156d", "align": "right", "runtime": "Laya.Text" }, "compId": 235 }, { "type": "Text", "props": { "y": 0, "x": 465, "width": 37, "valign": "middle", "text": "分", "rotation": 0, "name": "", "italic": true, "height": 29, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ff156d", "align": "center", "runtime": "Laya.Text" }, "compId": 271 }] }] }, { "type": "Text", "props": { "y": 555, "x": 198, "width": 78, "valign": "middle", "text": "总分", "name": "", "height": 39, "fontSize": 38, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 274, "child": [{ "type": "Text", "props": { "y": -1, "x": 306, "width": 259, "var": "scoreTxt", "valign": "middle", "text": "99999", "name": "", "italic": true, "height": 39, "fontSize": 50, "font": "Microsoft YaHei", "color": "#ffd905", "align": "right", "runtime": "Laya.Text" }, "compId": 233 }, { "type": "Text", "props": { "y": 6, "x": 583, "width": 36, "valign": "middle", "text": "分", "rotation": 0, "name": "", "italic": true, "height": 29, "fontSize": 36, "font": "Microsoft YaHei", "color": "#ffd905", "align": "center", "runtime": "Laya.Text" }, "compId": 273 }] }, { "type": "Text", "props": { "y": 628, "x": 198, "width": 76, "valign": "middle", "text": "用时", "name": "", "height": 39, "fontSize": 38, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "Laya.Text" }, "compId": 285, "child": [{ "type": "Text", "props": { "y": 4, "x": 314, "width": 301, "var": "timeTxt", "valign": "middle", "text": "00:00", "name": "", "italic": true, "height": 31, "fontSize": 45, "font": "Microsoft YaHei", "color": "#ffd905", "align": "right", "runtime": "Laya.Text" }, "compId": 286 }] }, { "type": "Sprite", "props": { "y": 156, "x": 908, "var": "rankBg", "texture": "res/imgs/result/bg_js_sjbd.png" }, "compId": 236, "child": [{ "type": "Image", "props": { "y": -34, "x": 484, "skin": "res/imgs/result/tittle_js_sjbd.png", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 237 }, { "type": "Box", "props": { "y": 64, "x": 96, "visible": false, "var": "rank1" }, "compId": 248, "child": [{ "type": "Image", "props": { "x": -42, "visible": false, "var": "pmImg1", "skin": "res/imgs/result/icon_pmxj.png", "centerY": 0 }, "compId": 247 }, { "type": "Image", "props": { "x": -7.5, "visible": false, "var": "noRank1", "text": "text", "skin": "res/imgs/result/text_pm_wsb.png", "centerY": 0 }, "compId": 281 }, { "type": "FontClip", "props": { "x": 46, "width": 75, "var": "pmFontClip1", "value": "2", "skin": "res/imgs/result/text_pm_num2.png", "sheet": "0123456789", "height": 40, "centerY": 0, "anchorY": 0.5, "anchorX": 0.5, "align": "center" }, "compId": 245 }, { "type": "Image", "props": { "x": 129, "width": 100, "var": "avatarImg1", "skin": "res/imgs/rank/biaoqing3.png", "height": 100 }, "compId": 241, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "skin": "res/home/001.png", "renderType": "mask", "height": 100, "centerY": 0, "centerX": -1 }, "compId": 242 }] }, { "type": "Text", "props": { "y": 24.5, "x": 250, "width": 271, "var": "nameTxt1", "valign": "middle", "text": "婷子", "strokeColor": "#000000", "height": 51, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 240 }, { "type": "Text", "props": { "y": 30.5, "x": 543, "width": 305, "var": "rankScore1", "valign": "middle", "text": "10000分", "italic": true, "height": 39, "fontSize": 42, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 244 }] }, { "type": "Sprite", "props": { "y": 194, "x": 240, "texture": "res/imgs/result/bg_js_sjbdfgx.png" }, "compId": 243 }, { "type": "Box", "props": { "y": 232.5, "x": 96, "visible": false, "var": "rank2" }, "compId": 249, "child": [{ "type": "Image", "props": { "x": -42, "visible": false, "var": "pmImg2", "skin": "res/imgs/result/icon_pmss.png", "centerY": 0 }, "compId": 251 }, { "type": "Image", "props": { "x": -7.5, "visible": false, "var": "noRank2", "text": "text", "skin": "res/imgs/result/text_pm_wsb.png", "centerY": 0 }, "compId": 280 }, { "type": "FontClip", "props": { "x": 46, "width": 75, "var": "pmFontClip2", "value": "2", "skin": "res/imgs/result/text_pm_num2.png", "sheet": "0123456789", "height": 40, "centerY": 0, "anchorY": 0.5, "anchorX": 0.5, "align": "center" }, "compId": 252 }, { "type": "Image", "props": { "x": 129, "width": 100, "var": "avatarImg2", "skin": "res/imgs/rank/biaoqing3.png", "height": 100 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "skin": "res/home/001.png", "renderType": "mask", "height": 100, "centerY": 0, "centerX": -1 }, "compId": 254 }] }, { "type": "Text", "props": { "y": 24.5, "x": 250, "width": 271, "var": "nameTxt2", "valign": "middle", "text": "婷子", "strokeColor": "#000000", "height": 51, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 255 }, { "type": "Text", "props": { "y": 30.5, "x": 544, "width": 305, "var": "rankScore2", "valign": "middle", "text": "10000分", "italic": true, "height": 39, "fontSize": 42, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 256 }] }, { "type": "Sprite", "props": { "y": 370, "x": 240, "texture": "res/imgs/result/bg_js_sjbdfgx.png" }, "compId": 250 }, { "type": "Box", "props": { "y": 405, "x": 96, "visible": false, "var": "rank3" }, "compId": 257, "child": [{ "type": "Image", "props": { "x": -42, "visible": false, "var": "pmImg3", "skin": "res/imgs/result/icon_pmwsb.png", "centerY": 0 }, "compId": 258 }, { "type": "Image", "props": { "x": -7.5, "visible": false, "var": "noRank3", "text": "text", "skin": "res/imgs/result/text_pm_wsb.png", "centerY": 0 }, "compId": 279 }, { "type": "FontClip", "props": { "y": 37, "x": 46, "width": 75, "var": "pmFontClip3", "value": "3", "skin": "res/imgs/result/text_pm_num2.png", "sheet": "0123456789", "height": 40, "centerY": 0, "anchorY": 0.5, "anchorX": 0.5, "align": "center" }, "compId": 259 }, { "type": "Image", "props": { "x": 129, "width": 100, "var": "avatarImg3", "skin": "res/imgs/rank/biaoqing3.png", "height": 100 }, "compId": 260, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "skin": "res/home/001.png", "renderType": "mask", "height": 100, "centerY": 0, "centerX": -1 }, "compId": 261 }] }, { "type": "Text", "props": { "y": 24.5, "x": 250, "width": 271, "var": "nameTxt3", "valign": "middle", "text": "nikeName", "strokeColor": "#000000", "height": 51, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 262 }, { "type": "Text", "props": { "y": 30.5, "x": 544, "width": 305, "var": "rankScore3", "valign": "middle", "text": "0分", "italic": true, "height": 39, "fontSize": 42, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 263 }] }] }, { "type": "Image", "props": { "y": 1048, "right": 0, "left": 0, "height": 65, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 219, "child": [{ "type": "Box", "props": { "y": 33, "x": 0, "width": 1560, "scaleY": 0.8, "scaleX": 0.8, "height": 60, "centerX": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 220, "child": [{ "type": "Sprite", "props": { "x": 0, "texture": "res/imgs/game/icon_zc1.png" }, "compId": 221, "child": [{ "type": "Text", "props": { "y": 10, "x": 47, "width": 211, "valign": "middle", "text": "左踏 • 上一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 222 }] }, { "type": "Sprite", "props": { "x": 630, "texture": "res/imgs/game/icon_yc1.png" }, "compId": 223, "child": [{ "type": "Text", "props": { "y": 10, "x": 51, "width": 211, "valign": "middle", "text": "右踏 • 下一项", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 224 }] }, { "type": "Sprite", "props": { "y": 0, "x": 1264, "texture": "res/imgs/game/icon_right_yellow@3x1.png" }, "compId": 225, "child": [{ "type": "Text", "props": { "y": 10, "x": 79, "width": 211, "valign": "middle", "text": "右踮脚 • 确定", "height": 50, "fontSize": 34, "font": "Microsoft YaHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 226 }] }] }] }] }], "animations": [{ "nodes": [{ "target": 173, "keyframes": { "x": [{ "value": 1762, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 0 }, { "value": 1583, "tweenMethod": "linearNone", "tween": true, "target": 173, "key": "x", "index": 30 }] } }, { "target": 175, "keyframes": { "x": [{ "value": 1581, "tweenMethod": "linearNone", "tween": true, "target": 175, "key": "x", "index": 0 }, { "value": 1402, "tweenMethod": "linearNone", "tween": true, "target": 175, "key": "x", "index": 30 }] } }, { "target": 178, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "y", "index": 30 }], "x": [{ "value": 1400, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 0 }, { "value": 1221, "tweenMethod": "linearNone", "tween": true, "target": 178, "key": "x", "index": 30 }] } }, { "target": 177, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "y", "index": 30 }], "x": [{ "value": 1219, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "x", "index": 0 }, { "value": 1040, "tweenMethod": "linearNone", "tween": true, "target": 177, "key": "x", "index": 30 }] } }, { "target": 179, "keyframes": { "x": [{ "value": 1038, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 0 }, { "value": 859, "tweenMethod": "linearNone", "tween": true, "target": 179, "key": "x", "index": 30 }] } }, { "target": 180, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "y", "index": 30 }], "x": [{ "value": 857, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 0 }, { "value": 678, "tweenMethod": "linearNone", "tween": true, "target": 180, "key": "x", "index": 30 }] } }, { "target": 181, "keyframes": { "x": [{ "value": 676, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 0 }, { "value": 495, "tweenMethod": "linearNone", "tween": true, "target": 181, "key": "x", "index": 30 }] } }, { "target": 182, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "y", "index": 0 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "y", "index": 30 }], "x": [{ "value": 495, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 0 }, { "value": 316, "tweenMethod": "linearNone", "tween": true, "target": 182, "key": "x", "index": 30 }] } }, { "target": 183, "keyframes": { "y": [{ "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 19 }, { "value": 3.1999999999999886, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 20 }, { "value": 2, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "y", "index": 30 }], "x": [{ "value": 314, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 0 }, { "value": 204, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 19 }, { "value": 1822, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 20 }, { "value": 1762, "tweenMethod": "linearNone", "tween": true, "target": 183, "key": "x", "index": 30 }] } }], "name": "runWayAni", "id": 1, "frameRate": 60, "action": 0 }], "loadList": ["res/imgs/game/new_back_black.png", "res/imgs/result/btom_bright.png", "res/imgs/result/text_an_fhb.png", "res/imgs/result/btom_dark.png", "res/imgs/result/text_an_zld.png", "res/imgs/result/tittle_js_bjdf.png", "res/imgs/result/bg_js_bjdf.png", "res/imgs/result/bg_js_sjbdfgx.png", "res/imgs/result/bg_js_sjbd.png", "res/imgs/result/tittle_js_sjbd.png", "res/imgs/result/icon_pmxj.png", "res/imgs/result/text_pm_wsb.png", "res/imgs/result/text_pm_num2.png", "res/imgs/rank/biaoqing3.png", "res/home/001.png", "res/imgs/result/icon_pmss.png", "res/imgs/result/icon_pmwsb.png", "res/imgs/game/icon_zc1.png", "res/imgs/game/icon_yc1.png", "res/imgs/game/icon_right_yellow@3x1.png"], "loadList3D": [] };
- ui.ResultViewUI = ResultViewUI;
- REG("game.ui.ResultViewUI", ResultViewUI);
- class SettingViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(SettingViewUI.uiView);
- }
- }
- SettingViewUI.uiView = { "type": "View", "props": { "width": 1920, "top": 0, "right": 0, "left": 0, "height": 1080, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "res/imgs/result/bj_mh.jpg", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "width": 507, "var": "bg", "skin": "res/imgs/game/img_sz.png", "scaleY": 1.2, "scaleX": 1.2, "height": 456, "centerY": -47, "centerX": 0 }, "compId": 4, "child": [{ "type": "Sprite", "props": { "y": 28, "x": 30, "texture": "res/imgs/game/tittle_sysz.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 24.5, "x": 429, "var": "closeBtn", "skin": "res/imgs/game/btn_close.png", "label": "label" }, "compId": 6 }, { "type": "Text", "props": { "y": 164, "x": 36, "text": "音乐", "fontSize": 26, "font": "Microsoft YaHei", "color": "#ffffff", "runtime": "Laya.Text" }, "compId": 8 }, { "type": "Image", "props": { "y": 210, "x": 36, "width": 366, "var": "musicBar", "skin": "res/imgs/game/progress_sz.png", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 7, "child": [{ "type": "Image", "props": { "width": 366, "var": "musicBg", "skin": "res/imgs/game/progressbar_sz.png", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 9, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 366, "var": "musicBarMask", "skin": "res/imgs/game/progressbar_sz.png", "renderType": "mask", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 7.5, "x": 0, "width": 45, "var": "btnMusic", "skin": "res/imgs/game/hdan.png", "height": 45, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 10 }, { "type": "Text", "props": { "y": -3, "x": 379, "width": 64, "var": "musicTxt", "valign": "middle", "text": "100%", "height": 26, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 18 }] }, { "type": "Text", "props": { "y": 284, "x": 36, "text": "音效", "fontSize": 26, "font": "Microsoft YaHei", "color": "#ffffff", "runtime": "Laya.Text" }, "compId": 13 }, { "type": "Image", "props": { "y": 330, "x": 36, "width": 366, "var": "soundBar", "skin": "res/imgs/game/progress_sz.png", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 14, "child": [{ "type": "Image", "props": { "width": 366, "var": "soundBg", "skin": "res/imgs/game/progressbar_sz.png", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 366, "var": "soundBarMask", "skin": "res/imgs/game/progressbar_sz.png", "renderType": "mask", "height": 15, "sizeGrid": "5,5,5,5" }, "compId": 16 }] }, { "type": "Image", "props": { "y": 7.5, "x": 0, "width": 45, "var": "btnSound", "skin": "res/imgs/game/hdan.png", "height": 45, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 17 }, { "type": "Text", "props": { "y": -3, "x": 379, "width": 64, "var": "soundTxt", "valign": "middle", "text": "100%", "height": 26, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "Laya.Text" }, "compId": 20 }] }] }], "loadList": ["res/imgs/result/bj_mh.jpg", "res/imgs/game/img_sz.png", "res/imgs/game/tittle_sysz.png", "res/imgs/game/btn_close.png", "res/imgs/game/progress_sz.png", "res/imgs/game/progressbar_sz.png", "res/imgs/game/hdan.png"], "loadList3D": [] };
- ui.SettingViewUI = SettingViewUI;
- REG("game.ui.SettingViewUI", SettingViewUI);
- })(ui = game.ui || (game.ui = {}));
- })(game || (game = {}));
- (function (game) {
- var ui;
- (function (ui) {
- var res;
- (function (res) {
- class PropItemUI extends Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(PropItemUI.uiView);
- }
- }
- PropItemUI.uiView = { "type": "Scene", "props": { "width": 240, "height": 240 }, "loadList": [], "loadList3D": [] };
- res.PropItemUI = PropItemUI;
- REG("game.ui.res.PropItemUI", PropItemUI);
- })(res = ui.res || (ui.res = {}));
- })(ui = game.ui || (game.ui = {}));
- })(game || (game = {}));
- (function (game) {
- var ui;
- (function (ui) {
- var res;
- (function (res) {
- var scenes;
- (function (scenes) {
- class LoadingViewUI extends View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(LoadingViewUI.uiView);
- }
- }
- LoadingViewUI.uiView = { "type": "View", "props": { "top": 0, "right": 0, "left": 0, "bottom": 0 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "res/home/bj_sy.jpg", "right": 0, "left": 0, "bottom": 0 }, "compId": 25 }, { "type": "Box", "props": { "y": 724, "width": 1258, "height": 127, "centerX": 0 }, "compId": 22, "child": [{ "type": "Image", "props": { "y": -491, "x": -345, "skin": "res/home/logo.png", "centerX": 0 }, "compId": 26 }, { "type": "Image", "props": { "y": -663, "x": -336, "skin": "res/home/juese.png" }, "compId": 33 }, { "type": "Image", "props": { "y": -2, "var": "barBg", "skin": "res/home/progress1.png", "sizeGrid": "0,161,0,161", "centerX": 0 }, "compId": 4 }, { "type": "Image", "props": { "y": 58, "x": -146, "width": 1566, "var": "loadingBar", "skin": "res/home/progress0.png", "height": 52 }, "compId": 5 }, { "type": "Sprite", "props": { "y": 48, "x": 652, "name": "circle" }, "compId": 8 }, { "type": "Text", "props": { "y": 138, "x": 486, "width": 287, "var": "loadingTxt", "valign": "middle", "text": "0%", "height": 56, "fontSize": 50, "font": "Helvetica", "color": "#fbffd5", "bold": true, "align": "center", "runtime": "Laya.Text" }, "compId": 11 }] }], "loadList": ["res/home/bj_sy.jpg", "res/home/logo.png", "res/home/juese.png", "res/home/progress1.png", "res/home/progress0.png"], "loadList3D": [] };
- scenes.LoadingViewUI = LoadingViewUI;
- REG("game.ui.res.scenes.LoadingViewUI", LoadingViewUI);
- })(scenes = res.scenes || (res.scenes = {}));
- })(res = ui.res || (ui.res = {}));
- })(ui = game.ui || (game.ui = {}));
- })(game || (game = {}));
- class RankItem extends game.ui.RankItemUI {
- constructor() {
- super();
- }
- onEnable() {
- super.onEnable();
- }
- set dataSource(value) {
- if (!value)
- return;
- this.index = value.index;
- this.name = value.name;
- this.gender = value.gender;
- this.avatar = value.avatar;
- this.score = value.score;
- this.rank = value.rank;
- this.updataView();
- }
- updataView() {
- if (this.rank == 1) {
- this.winImg.skin = "res/imgs/rank/icon_diyi.png";
- this.winImg.visible = true;
- this.rankTxt.visible = false;
- this.scoreTxt.color = "#ff9005";
- this.scoreTxt1.color = "#ff9005";
- }
- else if (this.rank == 2) {
- this.winImg.skin = "res/imgs/rank/icon_dier.png";
- this.winImg.visible = true;
- this.rankTxt.visible = false;
- this.scoreTxt.color = "#ff9005";
- this.scoreTxt1.color = "#ff9005";
- }
- else if (this.rank == 3) {
- this.winImg.skin = "res/imgs/rank/icon_disan.png";
- this.winImg.visible = true;
- this.rankTxt.visible = false;
- this.scoreTxt.color = "#ff9005";
- this.scoreTxt1.color = "#ff9005";
- }
- else {
- this.scoreTxt.color = "#000000";
- this.scoreTxt1.color = "#000000";
- this.winImg.visible = false;
- this.rankTxt.visible = true;
- this.rankTxt.value = this.rank.toString();
- }
- this.nameTxt.text = this.name;
- this.scoreTxt.text = this.score.toString();
- if (this.avatar)
- this.avatarImg.skin = this.avatar;
- }
- onDisable() {
- super.onDisable();
- }
- destroy() {
- super.destroy();
- }
- }
- class GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- reg("game/script/ButtonScript.ts", ButtonScript);
- reg("game/view/common/RankItem.ts", RankItem);
- }
- }
- GameConfig.width = 1920;
- GameConfig.height = 1080;
- GameConfig.scaleMode = "fixedauto";
- GameConfig.screenMode = "horizontal";
- GameConfig.alignV = "middle";
- GameConfig.alignH = "center";
- GameConfig.startScene = "GameView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = true;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = false;
- GameConfig.init();
- class Path {
- static getSound(name) {
- return "res/sound/" + name + ".mp3";
- }
- static getGameUI(name) {
- return "res/imgs/game/" + name + ".png";
- }
- }
- Path.fonts = [];
- Path.preLoadUrls = [
- "res/atlas/res/imgs/game.atlas",
- "res/atlas/res/imgs/game.png",
- "res/atlas/res/home.atlas",
- "res/atlas/res/home.png",
- "res/atlas/res/imgs/rank.atlas",
- "res/atlas/res/imgs/rank.png",
- "res/atlas/res/imgs/result.atlas",
- "res/atlas/res/imgs/result.png",
- "res/atlas/res/imgs/game/bg.atlas",
- "res/atlas/res/imgs/game/bg.png",
- "res/json/LevelConfig1.json",
- "res/json/LevelConfig2.json",
- "res/json/LevelConfig3.json",
- "res/ani/Shield_after.sk",
- "res/ani/Shield_after.png",
- "res/ani/nv2.sk",
- "res/ani/nv2.png",
- "res/ani/Coin.sk",
- "res/ani/Coin.png",
- "res/ani/nv22.png",
- "res/ani/nv23.png",
- "res/ani/nv24.png",
- "res/ani/nv25.png",
- "res/ani/nv26.png",
- "res/ani/nv27.png",
- "res/ani/nv28.png",
- "res/ani/nv29.png",
- "res/ani/nv210.png",
- "res/ani/nv211.png",
- "res/ani/nv212.png",
- "res/ani/nv213.png",
- "res/ani/nv214.png",
- "res/ani/nv215.png",
- "res/ani/nv216.png",
- "res/ani/nv217.png",
- "res/ani/nv218.png",
- "res/ani/gold.atlas",
- "res/ani/gold.png",
- "res/ani/board_glow.sk",
- "res/ani/board_glow.png",
- "res/ani/boom.atlas",
- "res/ani/boom.png",
- "res/ani/boomAni.atlas",
- "res/ani/boomAni.png",
- "res/home/bj_sy.jpg",
- "res/home/difficulty_1.png",
- "res/home/juese.png",
- "res/home/logo.png",
- "res/home/msxz_1.png",
- "res/home/normal_1.png",
- "res/home/simple_1.png",
- "res/imgs/game/bg/bg.jpg",
- "res/imgs/game/bg/pd.png",
- "res/imgs/game/bg/wpydd.png",
- "res/imgs/game/bg_ksjs.png",
- "res/imgs/game/text_finsh.png",
- "res/imgs/result/bg_js.png",
- "res/imgs/result/bg_js_bjdf.png",
- "res/imgs/result/bg_js_sjbd.png",
- "res/imgs/result/jsfgx.png",
- "res/imgs/rank/bg_ph.png",
- "res/imgs/rank/bg_ph.png",
- "res/imgs/rank/bg_ph.png",
- "res/imgs/rank/bg_phbhl.png",
- "res/imgs/rank/bg_phbsl.png",
- "res/imgs/rank/bg_wdph.png",
- ];
- Path.preLoadUrls2 = [];
- Path.sound = {
- readyGo: "readygo",
- bgm: "bgm",
- combo: "combo",
- jump: "jump"
- };
- const _delay = 1000 / 60.0;
- const LABEL = ["right pos x", "right pos y", "right pos z", "right att x", "right att y", "right att z", "right acc x", "right acc y", "right acc z", "right front mag", "right back mag ", "s zupt",
- "left pos x", "left pos y", "left pos z", "left att x", "left att y", "left att z", "left acc x", "left acc y", "left acc z", "left front mag", "left back mag", "h zupt",
- "down", "jump", "rssi", "timestamp", "right step", "left step", "rssi mobile"];
- var CMD;
- (function (CMD) {
- CMD[CMD["NONE_INTERATION"] = 2000] = "NONE_INTERATION";
- CMD[CMD["FRONT_LEFT"] = 2001] = "FRONT_LEFT";
- CMD[CMD["FRONT_RIGHT"] = 2002] = "FRONT_RIGHT";
- CMD[CMD["BACK_LEFT"] = 2003] = "BACK_LEFT";
- CMD[CMD["BACK_RIGHT"] = 2004] = "BACK_RIGHT";
- CMD[CMD["ENTER_KEY"] = 2005] = "ENTER_KEY";
- CMD[CMD["CANCLE_KEY"] = 2006] = "CANCLE_KEY";
- })(CMD || (CMD = {}));
- var MOTION;
- (function (MOTION) {
- MOTION[MOTION["MOTION_STOP"] = 0] = "MOTION_STOP";
- MOTION[MOTION["MOTION_RUN"] = 1] = "MOTION_RUN";
- MOTION[MOTION["MOTION_JUMP"] = 2] = "MOTION_JUMP";
- MOTION[MOTION["MOTION_DOWN"] = 3] = "MOTION_DOWN";
- MOTION[MOTION["MOTION_LEFT"] = 4] = "MOTION_LEFT";
- MOTION[MOTION["MOTION_RIGHT"] = 5] = "MOTION_RIGHT";
- MOTION[MOTION["MOTION_FRONT"] = 6] = "MOTION_FRONT";
- MOTION[MOTION["MOTION_BACK"] = 7] = "MOTION_BACK";
- MOTION[MOTION["MOTION_LEFT_UP"] = 8] = "MOTION_LEFT_UP";
- MOTION[MOTION["MOTION_LEFT_DOWN"] = 9] = "MOTION_LEFT_DOWN";
- MOTION[MOTION["MOTION_RIGHT_UP"] = 10] = "MOTION_RIGHT_UP";
- MOTION[MOTION["MOTION_RIGHT_DOWN"] = 11] = "MOTION_RIGHT_DOWN";
- MOTION[MOTION["MOTION_STEP"] = 12] = "MOTION_STEP";
- MOTION[MOTION["MOTION_JUMP_OC"] = 13] = "MOTION_JUMP_OC";
- MOTION[MOTION["MOTION_JUMP_VERTICAL"] = 14] = "MOTION_JUMP_VERTICAL";
- MOTION[MOTION["MOTION_ROCK"] = 15] = "MOTION_ROCK";
- MOTION[MOTION["MOTION_SCISSORS"] = 16] = "MOTION_SCISSORS";
- MOTION[MOTION["MOTION_PAPER"] = 17] = "MOTION_PAPER";
- MOTION[MOTION["MOTION_STRETCH_LEFT"] = 18] = "MOTION_STRETCH_LEFT";
- MOTION[MOTION["MOTION_LIFT_LEFT"] = 19] = "MOTION_LIFT_LEFT";
- MOTION[MOTION["MOTION_STRETCH_RIGHT"] = 20] = "MOTION_STRETCH_RIGHT";
- MOTION[MOTION["MOTION_LIFT_RIGHT"] = 21] = "MOTION_LIFT_RIGHT";
- MOTION[MOTION["MOTION_STRETCH_FRONT_LEFT"] = 22] = "MOTION_STRETCH_FRONT_LEFT";
- MOTION[MOTION["MOTION_STRETCH_FRONT_RIGHT"] = 23] = "MOTION_STRETCH_FRONT_RIGHT";
- MOTION[MOTION["MOTION_DOWN_FRONT"] = 24] = "MOTION_DOWN_FRONT";
- MOTION[MOTION["NUMBERS_OF_MOTION"] = 25] = "NUMBERS_OF_MOTION";
- })(MOTION || (MOTION = {}));
- var STEP;
- (function (STEP) {
- STEP[STEP["FREQ"] = 1000] = "FREQ";
- })(STEP || (STEP = {}));
- class Subscriber {
- constructor(target, fn) {
- this._target = target;
- this._fn = fn;
- }
- }
- class _SDK {
- constructor() {
- this._ver = 1;
- this._events = {};
- this._motion = [0, 0, 0, 0];
- this._motionTime = [0, 0, 0, 0];
- this._stepFreq = 0;
- this._stepCount = 0;
- this._responseCallMap = { string: Function };
- this._inited = false;
- }
- callback(name, args) {
- console.log("callback " + name + " " + args);
- const func = this._responseCallMap[name];
- if (func)
- func.call(func, args);
- }
- isMotion(index, delay) {
- let ts = new Date();
- let result = (this._motion[index] > 0) && (ts.getTime() - this._motionTime[index]) <= delay;
- if (result) {
- this._motion[index] = 0;
- }
- return result;
- }
- isLeftFootDown(delay = _delay) {
- return this.isMotion(0, delay);
- }
- isRightFootDown(delay = _delay) {
- return this.isMotion(1, delay);
- }
- getCmd() {
- let result = this._cmd;
- if (result > 0) {
- this._cmd = 0;
- }
- return result;
- }
- cmd(id, v0) {
- this._cmd = v0 + CMD.NONE_INTERATION;
- let ts = new Date().getTime();
- if (ts - this._cmdTime < 500)
- return;
- this._cmdTime = ts;
- console.log("cmd set " + v0 + " " + (this._cmd));
- this.emit((this._cmd).toString(), ts);
- }
- getMotion() {
- return this._motion;
- }
- motion(type, id, v0, v1, v2, v3) {
- this._motion[0] = v0;
- this._motion[1] = v1;
- this._motion[2] = v2;
- this._motion[3] = v3;
- console.log("motion set " + this._motion);
- let now = new Date();
- let ts = now.getTime();
- let arr = this._motion;
- for (let i = 0; i < arr.length; i++) {
- if (arr[i] > 0) {
- if (ts - this._motionTime[i] < 10)
- continue;
- this._motionTime[i] = ts;
- let motionIndex = arr[i];
- let motion = motionIndex.toString();
- this.emit(motion, ts);
- console.log("motion set " + motionIndex + " -> " + motion + " " + MOTION[motionIndex]);
- }
- }
- }
- getStepFreq() {
- return this._stepFreq;
- }
- getStepCount() {
- return this._stepCount;
- }
- getVelocity() {
- return this._velocity;
- }
- stepFreq(freq) {
- this._stepFreq = freq;
- console.log("step freq " + freq);
- this.emit(STEP.FREQ.toString(), freq);
- }
- step(freq, count) {
- this.stepFreq(freq);
- this._stepCount = count;
- console.log("step count " + count);
- }
- stepData(freq, count, velocity) {
- this.stepFreq(freq);
- this._stepCount = count;
- this._velocity = velocity;
- }
- emit(subscriber, ...args) {
- let callbackList = this._events[subscriber] || [];
- if (callbackList.length > 0) {
- console.log("motion emit " + subscriber + ", " + callbackList.length);
- callbackList.forEach(item => item._fn.apply(item._target || item._fn, args));
- }
- return this;
- }
- on(subscriber, callback, target) {
- if (!this._inited) {
- this._inited = true;
- this.onSdkLoaded();
- }
- let callbackList = this._events[subscriber] || [];
- callback && callbackList.push(new Subscriber(target || this, callback));
- console.log("motion set on " + subscriber + ", " + callbackList.length);
- this._events[subscriber] = callbackList;
- return this;
- }
- once(subscriber, callback, target) {
- let decor = (...args) => {
- callback && callback.apply(target || this, args);
- this.off(subscriber, decor);
- };
- this.on(subscriber, decor);
- return this;
- }
- off(subscriber, callback) {
- let callbackList = this._events[subscriber] || [];
- this._events[subscriber] = callbackList.filter(item => item._fn !== callback);
- return this;
- }
- remove(subscriber, callback) {
- this._events[subscriber] = [];
- callback && callback();
- return this;
- }
- onSdkLoaded() {
- this._callsdk("onLoad", { ver: this._ver });
- }
- onBackPressed(foot = false) {
- this._callsdk("onBackPressed", { foot: foot });
- }
- onGameStart() {
- this._stepFreq = 0;
- this._stepCount = 0;
- this._callsdk("onGameStart", {});
- }
- onGameEnd(level = 0, score = 0.0, record = 0, mode = 0, opponentId = 0, callback) {
- if (callback) {
- let method = "onGameEnd_callback";
- this._responseCallMap[method] = callback;
- }
- this._callsdk("onGameEnd", { level: level, score: score, record: record, mode: mode, opponentId: opponentId });
- }
- getUserInfo(callback) {
- let method = "getUserInfo_callback";
- this._responseCallMap[method] = callback;
- this._callsdk(method, { callback: method });
- }
- getRank(type, callback) {
- let method = "getRank_callback";
- this._responseCallMap[method] = callback;
- this._callsdk(method, { callback: method, type: type });
- }
- vibrate(duration, leftOrRight = 0) {
- let method = "vibrate";
- this._callsdk(method, { duration: duration, leftOrRight: leftOrRight });
- }
- openGameData(open, gameDataCallback) {
- this._gameDataCallback = gameDataCallback;
- this._callsdk("openGameData", { open: open });
- }
- gameData(args) {
- if (this._gameDataCallback)
- this._gameDataCallback.call(this._gameDataCallback, args);
- }
- _callsdk(method, args) {
- console.log("sdk call " + method);
- if (window["SDKBridge"])
- window["SDKBridge"].postMessage(JSON.stringify({ method: method, args: args }));
- }
- }
- const SDK = new _SDK();
- window.SHOES_SDK = SDK;
- class LoadingView extends game.ui.res.scenes.LoadingViewUI {
- constructor() {
- super();
- this._baseProgress = 0;
- this._targetProgress = 1;
- this._curProgress = 0;
- this.loadingPreload = [
- "res/home/bj_sy.jpg",
- 'res/home/juese.png',
- 'res/home/progress0.png',
- 'res/home/progress1.png',
- ];
- this.size(Laya.stage.width, Laya.stage.height);
- }
- static get instance() {
- if (!this._instance)
- this._instance = new LoadingView();
- return this._instance;
- }
- onAwake() {
- super.onAwake();
- core.SoundManager.setMusicVolume(.7);
- core.SoundManager.setSoundVolume(.7);
- }
- onEnable() {
- super.onEnable();
- }
- preLoad(callBack) {
- Laya.loader.load(this.loadingPreload, Laya.Handler.create(this, () => {
- callBack.run();
- }));
- }
- setProgress(value, isReset = false) {
- let cur = this._baseProgress + (this._targetProgress - this._baseProgress) * value;
- if (!isReset && cur < this._curProgress)
- return;
- this._curProgress = cur;
- this.loadingBar.width = this._curProgress * 1258;
- this.loadingTxt.text = Math.floor(this._curProgress * 100) + "%";
- if (window.platform && this._curProgress < 1)
- platform.progress({ percent: Math.floor(this._curProgress * 100) });
- }
- show() {
- if (!this.parent) {
- Laya.stage.addChild(this);
- }
- }
- hide() {
- if (this.parent)
- LoadingView._instance.destroy();
- LoadingView._instance = null;
- }
- onDisable() {
- super.onDisable();
- }
- destroy() {
- this.loadingPreload = null;
- super.destroy();
- if (window.platform)
- platform.progress({ percent: 100 });
- }
- }
- class Model extends Laya.EventDispatcher {
- constructor() {
- super();
- this.initW = 1920;
- this.initH = 1080;
- this.gameTime = 3 * 60 * 1000;
- this.onceAddSpeed = 100;
- this.forwordSpeed = 10;
- this.forwordSpeedMax = 6;
- this.backSpeed = 15;
- this.addSpeed = 1;
- this.runCountTime = 100;
- this.jumpCountTime = 1500;
- this.onceAddJump = 270;
- this.jumpSpeed = 15;
- this.jumpCount = 0;
- this.onceTime = 55;
- this.isStarGame = false;
- this.isPlaying = false;
- this.selfInfo = { "id": 1, "nickname": "昵称最多七个字", "gender": 1, "avatar": "" };
- }
- init() {
- Laya.SoundManager.useAudioMusic = false;
- this.getAllHighScoreData();
- this.getLevel1HighScoreData();
- this.getLevel2HighScoreData();
- this.getLevel3HighScoreData();
- if (!window["SDKBridge"]) {
- Manager.view.homeView.show();
- LoadingView.instance.hide();
- }
- else {
- SDK.getUserInfo((info) => {
- this.selfInfo = info;
- log("selfInfo", info);
- Manager.view.homeView.show();
- LoadingView.instance.hide();
- });
- }
- }
- reset() {
- this.score = 0;
- }
- getAllHighScoreData() {
- this.allHighScoreData = Laya.LocalStorage.getJSON("JumpallHighScoreData");
- if (!this.allHighScoreData) {
- this.setAllHighSocreData(0);
- }
- log('获取总最高分数', this.allHighScoreData);
- }
- setAllHighSocreData(num) {
- this.allHighScoreData = num;
- this.saveALlHighSocreData();
- }
- saveALlHighSocreData() {
- Laya.LocalStorage.setJSON("JumpallHighScoreData", this.allHighScoreData);
- }
- getLevel1HighScoreData() {
- this.level1HighScoreData = Laya.LocalStorage.getJSON("Jumplevel1HighScoreData");
- if (!this.level1HighScoreData) {
- this.setLevel1HighSocreData(0);
- }
- log('获取简单模式最高分数', this.level1HighScoreData);
- }
- setLevel1HighSocreData(num) {
- this.level1HighScoreData = num;
- this.saveLevel1HighSocreData();
- if (num > this.allHighScoreData)
- this.setAllHighSocreData(num);
- }
- saveLevel1HighSocreData() {
- Laya.LocalStorage.setJSON("Jumplevel1HighScoreData", this.level1HighScoreData);
- }
- getLevel2HighScoreData() {
- this.level2HighScoreData = Laya.LocalStorage.getJSON("Jumplevel2HighScoreData");
- if (!this.level2HighScoreData) {
- this.setLevel2HighSocreData(0);
- }
- log('获取简单模式最高分数', this.level2HighScoreData);
- }
- setLevel2HighSocreData(num) {
- this.level2HighScoreData = num;
- this.saveLevel2HighSocreData();
- if (num > this.allHighScoreData)
- this.setAllHighSocreData(num);
- }
- saveLevel2HighSocreData() {
- Laya.LocalStorage.setJSON("Jumplevel2HighScoreData", this.level2HighScoreData);
- }
- getLevel3HighScoreData() {
- this.level3HighScoreData = Laya.LocalStorage.getJSON("Jumplevel3HighScoreData");
- if (!this.level3HighScoreData) {
- this.setLevel3HighSocreData(0);
- }
- log('获取简单模式最高分数', this.level3HighScoreData);
- }
- setLevel3HighSocreData(num) {
- this.level3HighScoreData = num;
- this.saveLevel3HighSocreData();
- if (num > this.allHighScoreData)
- this.setAllHighSocreData(num);
- }
- saveLevel3HighSocreData() {
- Laya.LocalStorage.setJSON("Jumplevel3HighScoreData", this.level3HighScoreData);
- }
- }
- class DataManager {
- constructor() {
- this.levelConfig1 = [];
- this.levelConfig2 = [];
- this.levelConfig3 = [];
- this.init();
- }
- init() {
- Laya.loader.load("res/json/LevelConfig1.json", Laya.Handler.create(this, this.getLevelConfig1));
- Laya.loader.load("res/json/LevelConfig2.json", Laya.Handler.create(this, this.getLevelConfig2));
- Laya.loader.load("res/json/LevelConfig3.json", Laya.Handler.create(this, this.getLevelConfig3));
- this.levelConfig1 = Laya.loader.getRes("res/json/LevelConfig1.json");
- this.levelConfig2 = Laya.loader.getRes("res/json/LevelConfig2.json");
- this.levelConfig3 = Laya.loader.getRes("res/json/LevelConfig3.json");
- }
- getLevelConfig(gameType, id) {
- let levelConfig;
- if (gameType == 1)
- levelConfig = this.levelConfig1;
- else if (gameType == 2)
- levelConfig = this.levelConfig2;
- else if (gameType == 3)
- levelConfig = this.levelConfig3;
- for (let i = levelConfig.length - 1; i >= 0; i--) {
- if (levelConfig[i].id == id)
- return levelConfig[i];
- }
- return null;
- }
- getLevelConfig1() {
- this.goldCountArr1 = [];
- for (let i = 0; i < this.levelConfig1.length; i++) {
- if (this.levelConfig1[i].indexArr >= this.goldCountArr1.length) {
- for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
- if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
- if (!this.goldCountArr1[this.levelConfig1[i].indexArr - 1])
- this.goldCountArr1[this.levelConfig1[i].indexArr - 1] = 0;
- this.goldCountArr1[this.levelConfig1[i].indexArr - 1]++;
- }
- }
- }
- }
- log("goldCountArr1", this.goldCountArr1);
- }
- getLevelConfig2() {
- this.goldCountArr2 = [];
- for (let i = 0; i < this.levelConfig1.length; i++) {
- if (this.levelConfig1[i].indexArr >= this.goldCountArr2.length) {
- for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
- if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
- if (!this.goldCountArr2[this.levelConfig1[i].indexArr - 1])
- this.goldCountArr2[this.levelConfig1[i].indexArr - 1] = 0;
- this.goldCountArr2[this.levelConfig1[i].indexArr - 1]++;
- }
- }
- }
- }
- log("goldCountArr2", this.goldCountArr2);
- }
- getLevelConfig3(id) {
- this.goldCountArr3 = [];
- for (let i = 0; i < this.levelConfig1.length; i++) {
- if (this.levelConfig1[i].indexArr >= this.goldCountArr3.length) {
- for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
- if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
- if (!this.goldCountArr3[this.levelConfig1[i].indexArr - 1])
- this.goldCountArr3[this.levelConfig1[i].indexArr - 1] = 0;
- this.goldCountArr3[this.levelConfig1[i].indexArr - 1]++;
- }
- }
- }
- }
- log("goldCountArr3", this.goldCountArr3);
- }
- }
- class EnemieShadow extends Laya.Image {
- constructor() {
- super();
- this.width = 47;
- this.height = 20;
- this.skin = 'res/imgs/game/shadow.png';
- this.anchorX = this.anchorY = 0.5;
- }
- onEnable() {
- Laya.timer.once(1000, this, () => {
- this.sdAlphaTween = Laya.TimeLine.to(this, { alpha: 1 }, 1000);
- this.sdAlphaTween.play();
- });
- }
- startMove() {
- let pos = Laya.Point.create();
- pos.x = Manager.view.gameView.sdEndPosArr[this.index].x;
- pos.y = Manager.view.gameView.sdEndPosArr[this.index].y;
- pos = Manager.view.gameView.createBox.localToGlobal(pos);
- this.sdMoveTween = Laya.TimeLine.to(this, { x: pos.x - Manager.view.gameView.gameBox.x, y: pos.y - Manager.view.gameView.gameBox.y }, 5900, Laya.Ease.expoIn);
- this.sdMoveTween.play();
- this.sdScaleTween = Laya.TimeLine.to(this, { scaleX: 3, scaleY: 3 }, 5900, Laya.Ease.expoIn);
- this.sdScaleTween.play();
- this.sdMoveTween.on(Laya.Event.COMPLETE, this, () => {
- this.destroy();
- });
- }
- destroy() {
- super.destroy();
- this.removeSelf();
- if (this.sdMoveTween)
- this.sdMoveTween.destroy();
- if (this.sdScaleTween)
- this.sdScaleTween.destroy();
- if (this.sdAlphaTween)
- this.sdAlphaTween.destroy();
- this.sdMoveTween = null;
- this.sdScaleTween = null;
- this.sdAlphaTween = null;
- Laya.Tween.clearAll(this);
- this.timer.clearAll(this);
- }
- recover() {
- Laya.Pool.recover("EnemieShadow", this);
- }
- static create(x, y, index) {
- let enemieShadow = new EnemieShadow();
- enemieShadow.x = x;
- enemieShadow.y = y;
- enemieShadow.index = index;
- return enemieShadow;
- }
- }
- class Enemie extends Laya.Image {
- constructor() {
- super();
- this.dx = 1;
- this.dy = 1;
- this.isDeath = false;
- ;
- this.width = this.height = 240;
- this.anchorX = this.anchorY = 0.5;
- this.alpha = 1;
- this.scale(0.1, 0.1);
- }
- onEnable() {
- Laya.timer.once(1000, this, () => {
- this.alphaTween = Laya.TimeLine.to(this, { alpha: 1 }, 1000);
- this.alphaTween.play();
- });
- this.creatShadow();
- }
- creatShadow() {
- let pos = Laya.Point.create();
- let index = this.index % 4;
- if (index == 0)
- index = 4;
- pos.x = Manager.view.gameView.sdStartPosArr[index].x;
- pos.y = Manager.view.gameView.sdStartPosArr[index].y;
- pos = Manager.view.gameView.createBox.localToGlobal(pos);
- let enmeyShadow = EnemieShadow.create(pos.x - Manager.view.gameView.gameBox.x, pos.y - Manager.view.gameView.gameBox.y, index);
- enmeyShadow.alpha = 0;
- enmeyShadow.scale(0.5, 0.5);
- Manager.view.gameView.playBox.addChild(enmeyShadow);
- enmeyShadow.startMove();
- this.shadow = enmeyShadow;
- }
- creatCoinAni() {
- if (!this.goldAni) {
- this.goldAni = new Laya.Skeleton();
- this.goldAni.load("res/ani/Coin.sk", Laya.Handler.create(this, () => {
- this.goldAni.pos(120, 250);
- this.goldAni.scale(1.8, 1.8);
- this.addChild(this.goldAni);
- if (this.type == 1) {
- this.goldAni.play("Sliver", true, true);
- }
- else {
- this.goldAni.play("Golden", true, true);
- }
- }));
- }
- else {
- this.goldAni.visible = true;
- if (this.type == 1) {
- this.goldAni.play("Sliver", true, true);
- }
- else {
- this.goldAni.play("Golden", true, true);
- }
- }
- }
- creatBoomAni() {
- if (!this.boomAni) {
- this.boomAni = new Laya.Animation();
- this.boomAni.loadAtlas("res/ani/boomAni.atlas", Laya.Handler.create(this, () => {
- this.boomAni.interval = 70;
- this.boomAni.source = "res/ani/boomAni.atlas";
- this.boomAni.pivotX = 70;
- this.boomAni.pivotY = 109;
- this.boomAni.scale(2, 2);
- this.boomAni.pos(126, 141);
- this.addChild(this.boomAni);
- this.boomAni.play(0, true);
- }));
- }
- else {
- this.boomAni.visible = true;
- this.boomAni.play(0, true);
- }
- }
- startMove() {
- let pos = Laya.Point.create();
- pos.x = Manager.view.gameView.endPosArr[this.index].x;
- pos.y = Manager.view.gameView.endPosArr[this.index].y;
- pos = Manager.view.gameView.createBox.localToGlobal(pos);
- this.moveTween = Laya.TimeLine.to(this, { x: pos.x - Manager.view.gameView.gameBox.x, y: pos.y - Manager.view.gameView.gameBox.y }, 6000, Laya.Ease.expoIn);
- this.moveTween.play();
- this.scaleTween = Laya.TimeLine.to(this, { scaleX: 1, scaleY: 1 }, 6000, Laya.Ease.expoIn);
- this.scaleTween.play();
- this.moveTween.on(Laya.Event.COMPLETE, this, () => {
- this.isDeath = true;
- if (this.type == 1)
- Manager.view.gameView.showGrade(true, false, false);
- else if (this.type == 3)
- Manager.view.gameView.showGrade(true, false, false);
- this.destroy();
- });
- }
- destroy() {
- this.alpha = 1;
- if (this.goldAni)
- this.goldAni.visible = false;
- if (this.boomAni)
- this.boomAni.visible = false;
- this.scale(0.1, 0.1);
- this.removeSelf();
- Manager.view.gameView.enemies = Manager.view.gameView.enemies.filter(item => { return !item.isDeath; });
- if (this.moveTween)
- this.moveTween.destroy();
- if (this.scaleTween)
- this.scaleTween.destroy();
- if (this.alphaTween)
- this.alphaTween.destroy();
- if (this.shadow)
- this.shadow.destroy();
- this.moveTween = null;
- this.scaleTween = null;
- this.alphaTween = null;
- Laya.Tween.clearAll(this);
- this.timer.clearAll(this);
- this.recover();
- }
- recover() {
- Laya.Pool.recover("Enemie", this);
- }
- static create(x, y, url, type, index) {
- let enemie = Laya.Pool.getItemByClass("Enemie", Enemie);
- enemie.x = x;
- enemie.y = y;
- enemie.skin = url;
- enemie.type = type;
- enemie.index = index;
- enemie.scale(0.2, 0.2);
- enemie.isDeath = false;
- if (type == 2) {
- enemie.creatBoomAni();
- }
- else {
- enemie.creatCoinAni();
- }
- return enemie;
- }
- }
- class PlayerAniName {
- }
- PlayerAniName.Standby = "daiji";
- PlayerAniName.ReadyRun = "manpaoqibu";
- PlayerAniName.Run = "manpao";
- PlayerAniName.StopRun = "manpaotingzhi";
- PlayerAniName.ReadyRun1 = "kuaipaoqibu";
- PlayerAniName.Run1 = "kuaipao";
- PlayerAniName.StopRun1 = "kuaipaotingzhi";
- PlayerAniName.Jump = "yijitiao";
- PlayerAniName.Jump2 = "erjitiao";
- PlayerAniName.Dead = "jiluo";
- class Player extends Laya.Sprite {
- constructor() {
- super();
- this.gravity = 0.05;
- this.dx = 0;
- this.dy = 0;
- this.isFalling = false;
- this.isJumping = false;
- this.isRuning = false;
- this.isDeath = false;
- this.isStand = false;
- this.downDy = 0;
- this.jumpSpeed = 0;
- this.runRate = 1;
- this.stepRate = 0;
- this.stepRateTarget = 0;
- this.isGO = false;
- this.count = 0;
- this.speed = 0;
- this.addSpeed = 0;
- this.createRole();
- this.reset();
- }
- get width() { return 160; }
- get height() { return 240; }
- createRole() {
- if (this.role) {
- this.role.destroy();
- this.role = null;
- }
- let roleUrl = "res/ani/nv2.sk";
- this.role = new Laya.Skeleton();
- this.role.load(roleUrl, Laya.Handler.create(this, () => {
- this.addChild(this.role);
- this.playStandby();
- }));
- }
- playStandby() {
- if (!this.isStand)
- return;
- this.role.playbackRate(1);
- this.role.play(PlayerAniName.Standby, true, false);
- this.isRuning = false;
- this.isStand = true;
- }
- playReadyRun() {
- this.role.playbackRate(1);
- this.role.play(PlayerAniName.ReadyRun, false);
- Laya.timer.once(100, this, () => {
- this.isRuning = true;
- this.isStand = false;
- });
- }
- playRun() {
- this.role.playbackRate(this.runRate);
- this.role.play(PlayerAniName.Run, true, false);
- this.isStand = false;
- }
- playStopRun() {
- this.role.playbackRate(1);
- this.role.play(PlayerAniName.StopRun, false, false);
- this.isRuning = false;
- }
- playJump() {
- this.role.playbackRate(1);
- this.role.play(PlayerAniName.Jump, false, true);
- this.isJumping = true;
- this.isStand = false;
- }
- playJump2() {
- this.role.playbackRate(0.8);
- this.role.play(PlayerAniName.Jump2, false, true);
- this.isJumping = true;
- this.isStand = false;
- }
- playDead() {
- this.role.playbackRate(1);
- this.role.play(PlayerAniName.Dead, false, true);
- this.role.on(Laya.Event.STOPPED, null, () => {
- this.role.off(Laya.Event.STOPPED, null, null);
- this.count++;
- this.isDeath = false;
- this.isRuning = false;
- this.isStand = true;
- this.isJumping = false;
- this.isFalling = false;
- this.dy = 0;
- this.dx = 0;
- this.playReadyRun();
- Manager.model.jumpCount = 0;
- Manager.view.gameView.jumpCountTime = Manager.model.jumpCountTime;
- });
- }
- update() {
- let offset = 1.0 / 16 * Laya.timer.delta;
- if (this.dy > 0 && !this.isDeath) {
- this.dx = 0;
- this.downDy = 0;
- this.runRate = 0.8;
- this.y -= this.jumpSpeed * offset;
- if (this.jumpSpeed > 2 * offset)
- this.jumpSpeed -= 0.4 * offset;
- else
- this.jumpSpeed = 2 * offset;
- if (this.y - this.dy <= 5 * offset)
- this.jumpSpeed = 0.3 * offset;
- this.isFalling = false;
- if (this.y <= this.dy) {
- this.y = this.dy;
- this.dy = 0;
- if (Manager.model.jumpCount == 2) {
- Laya.timer.once(150 * offset, this, () => {
- this.isFalling = true;
- });
- }
- else {
- this.isFalling = true;
- }
- }
- if (!this.isJumping)
- this.playJump();
- }
- if (this.isFalling && this.isJumping) {
- this.downDy += this.gravity * Laya.timer.delta;
- this.y += this.downDy;
- this.jumpSpeed += 0.4 * Laya.timer.delta;
- if (this.y >= Manager.view.gameView.startPosImg.y) {
- this.y = Manager.view.gameView.startPosImg.y;
- this.isJumping = false;
- this.isFalling = false;
- this.curBackSpeed = 0;
- Manager.model.jumpCount = 0;
- Manager.view.gameView.jumpCountTime = Manager.model.jumpCountTime;
- }
- }
- if (this.dx > 0 && !this.isDeath && this.isRuning) {
- if (this.isGO) {
- this.speed += (this.addSpeed * Math.min(1.0, this.stepRate / this.stepRateTarget)) * offset;
- }
- else {
- this.speed += 0.6 * offset;
- }
- if (this.speed > Manager.model.forwordSpeedMax * offset)
- this.speed = Manager.model.forwordSpeedMax * offset;
- this.x += this.speed;
- this.dx -= Manager.model.forwordSpeed / 2.0 * offset;
- if (this.x >= 1450) {
- this.x = 1450;
- }
- if (this.x >= 460 && !this.isGO) {
- this.isGO = true;
- this.speed = 0;
- }
- }
- else if (this.speed > 0) {
- this.speed = 0;
- }
- if (this.x <= 460 && this.isGO) {
- this.x = 460;
- if (Manager.model.isPlaying && !this.isFalling && !this.isJumping && !this.isDeath) {
- if (this.isRuning) {
- this.playRun();
- }
- }
- }
- else if (this.x > Manager.view.gameView.startPosImg.x) {
- if (!this.isFalling && !this.isJumping && !this.isDeath) {
- if (this.curBackSpeed < this.backSpeed)
- this.curBackSpeed += 0.2 * offset;
- this.x -= this.curBackSpeed * offset;
- this.runRate -= 0.05 * offset;
- if (this.runRate <= 1) {
- this.runRate = 1;
- }
- this.role.playbackRate(this.runRate);
- if (this.isRuning) {
- this.playRun();
- }
- }
- }
- else {
- this.x = Manager.view.gameView.startPosImg.x;
- if (Manager.model.isPlaying && (this.isRuning ||
- !this.isStand && this.y == Manager.view.gameView.startPosImg.y && !this.isFalling && !this.isJumping)) {
- this.isStand = true;
- this.playStopRun();
- Laya.timer.once(300, this, () => {
- this.playStandby();
- });
- }
- }
- }
- showHit() {
- this.hitTween = Laya.TimeLine.to(this, { alpha: 0.3 }, 200);
- this.hitTween.play(0, true);
- }
- hideHit() {
- this.alpha = 1;
- this.hitTween.pause();
- }
- reset() {
- this.dx = 0;
- this.dy = 0;
- this.isFalling = false;
- this.isJumping = false;
- this.isRuning = false;
- this.isStand = true;
- this.runRate = 1;
- this.isDeath = false;
- this.isGO = false;
- if (this.hitTween)
- this.hideHit();
- if (this.role.templet)
- this.playStandby();
- if (Manager.model.gameType == 1) {
- this.backSpeed = Manager.model.backSpeed;
- this.addSpeed = 0.3;
- this.stepRateTarget = 100.0;
- }
- else if (Manager.model.gameType == 2) {
- this.backSpeed = Manager.model.backSpeed;
- this.addSpeed = 0.2;
- this.stepRateTarget = 150.0;
- }
- else if (Manager.model.gameType == 3) {
- this.backSpeed = Manager.model.backSpeed;
- this.addSpeed = 0.2 * 0.7;
- this.stepRateTarget = 200.0;
- }
- }
- showProtectLight() {
- if (!this.protectLight) {
- this.protectLight = new Laya.Skeleton();
- this.protectLight.load("res/ani/Shield_after.sk", Laya.Handler.create(this, () => {
- this.protectLight.pos(0, 20);
- this.protectLight.scale(3, 3);
- this.addChild(this.protectLight);
- this.protectLight.play("Play", true);
- }));
- }
- else {
- this.protectLight.visible = true;
- this.protectLight.play("Play", true);
- }
- }
- stopProtectLight() {
- if (this.protectLight) {
- this.protectLight.stop();
- this.protectLight.visible = false;
- }
- }
- destroy() {
- if (this.role)
- this.role.destroy();
- this.role = null;
- super.destroy();
- }
- }
- class ScoreTxt extends Laya.FontClip {
- constructor() {
- super();
- this.width = 300;
- this.height = 65;
- this.anchorX = this.anchorY = 0.5;
- }
- onEnable() {
- this.starMove();
- }
- starMove() {
- let posY = this.y - 50;
- this.scaleTween = Laya.TimeLine.to(this, { scaleX: 1, scaleY: 1 }, 1000, Laya.Ease.elasticOut).to(this, { y: posY }, 1000);
- this.scaleTween.play();
- this.timer.once(1000, this, () => {
- this.alphaTween = Laya.TimeLine.to(this, { alpha: 0 }, 500);
- this.alphaTween.play();
- });
- this.scaleTween.on(Laya.Event.COMPLETE, this, () => {
- this.destroy();
- });
- }
- destroy() {
- this.removeSelf();
- Manager.view.gameView.socreTxtArr = Manager.view.gameView.socreTxtArr.filter(item => { return item.parent; });
- if (this.scaleTween)
- this.scaleTween.destroy();
- if (this.alphaTween)
- this.alphaTween.destroy();
- this.scaleTween = null;
- this.alphaTween = null;
- this.timer.clearAll(this);
- this.recover();
- }
- recover() {
- Laya.Pool.recover("ScoreTxt", this);
- }
- static create(x, y, type, value) {
- let scoreTxt = Laya.Pool.getItemByClass("ScoreTxt", ScoreTxt);
- scoreTxt.x = x;
- scoreTxt.y = y;
- scoreTxt.alpha = 1;
- scoreTxt.scaleX = scoreTxt.scaleY = 0;
- scoreTxt.value = value;
- if (type == 1) {
- scoreTxt.sheet = "+0123456789";
- scoreTxt.skin = "res/imgs/game/num_1.png";
- }
- else if (type == 2) {
- scoreTxt.sheet = "+0123456789";
- scoreTxt.skin = "res/imgs/game/num_2.png";
- }
- else if (type == 3) {
- scoreTxt.sheet = "-0123456789";
- scoreTxt.skin = "res/imgs/game/num_3.png";
- }
- return scoreTxt;
- }
- }
- class Animation extends Laya.Animation {
- static createOnceAni(x, y, pivotX, pivotY, scale, source, parent, interval = 15, callback) {
- let ani = Laya.Pool.getItemByClass("FuritAnimation", Animation);
- ani.autoPlay = true;
- ani.interval = interval;
- ani.source = source;
- ani.pivotX = pivotX;
- ani.pivotY = pivotY;
- ani.scale(scale, scale);
- ani.pos(x, y);
- ani.on(Laya.Event.COMPLETE, this, () => {
- Laya.Pool.recover("FuritAnimation", ani.removeSelf());
- if (callback)
- callback.run();
- });
- parent.addChild(ani);
- return ani;
- }
- }
- class GameView extends game.ui.GameViewUI {
- constructor() {
- super();
- this.curTime = 0;
- this.countNum = 1;
- this.runCountTime = 0;
- this.jumpCountTime = 0;
- this.isProtect = false;
- this.isScoreHigh = false;
- this.goldIndex = 0;
- this.goldNum = 0;
- this.gradeCount = 0;
- this.stepCount = 0;
- this.creatCount = 0;
- this.tirggerUp = 200;
- this.tirggerDOWN = -100;
- this.tirggerLeft = 150;
- this.tirggerRight = -150;
- this.model = Manager.model;
- }
- onAwake() {
- super.onAwake();
- this.player = new Player();
- this.player.zOrder = 1000;
- this.player.pos(this.startPosImg.x, this.startPosImg.y);
- this.playBox.addChild(this.player);
- this.playerShadow = new Laya.Image('res/imgs/game/shadow.png');
- this.playerShadow.pos(this.player.x - 80, this.startPosImg.y - 20);
- this.playerShadow.scale(3, 3);
- this.playBox.addChild(this.playerShadow);
- }
- onEnable() {
- super.onEnable();
- this.createPosArr = [];
- this.endPosArr = [];
- for (let i = 1; i <= 12; i++) {
- this.createPosArr[i] = this[`${"createPos" + i}`];
- this.endPosArr[i] = this[`${"endPos" + i}`];
- }
- this.sdStartPosArr = [];
- this.sdEndPosArr = [];
- for (let i = 1; i <= 4; i++) {
- this.sdStartPosArr[i] = this[`${"sdStartPos" + i}`];
- this.sdEndPosArr[i] = this[`${"sdEndPos" + i}`];
- }
- document.addEventListener("visibilitychange", function () {
- if (document.hidden === true) {
- Manager.view.gameView.showPauseView();
- }
- else {
- }
- });
- }
- addEvent() {
- this.startBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.settingBtn.on(Laya.Event.CLICK, this, this.onClick);
- }
- removeEvent() {
- this.startBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.settingBtn.off(Laya.Event.CLICK, this, this.onClick);
- }
- addJumpEvent() {
- Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
- Laya.stage.on(Laya.Event.KEY_UP, this, this.onKeyUp);
- this.runBtn.on(Laya.Event.CLICK, this, this.playRun);
- this.jumpBtn.on(Laya.Event.CLICK, this, this.playJump);
- SDK.on(MOTION.MOTION_JUMP.toString(), this.playJump, this);
- SDK.on(CMD.CANCLE_KEY.toString(), this.showPauseView, this);
- ;
- }
- removeJumpEvent() {
- Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
- Laya.stage.off(Laya.Event.KEY_UP, this, this.onKeyUp);
- this.runBtn.off(Laya.Event.CLICK, this, this.playRun);
- this.jumpBtn.off(Laya.Event.CLICK, this, this.playJump);
- SDK.off(MOTION.MOTION_JUMP.toString(), this.playJump);
- SDK.off(CMD.CANCLE_KEY.toString(), this.showPauseView);
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.startBtn:
- this.startGame();
- break;
- case this.settingBtn:
- this.showPauseView();
- break;
- }
- }
- showPauseView() {
- this.pauseGame();
- Manager.view.pauseViewView.show();
- }
- onkeydown(e) {
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT) && !this.keyDownList[e["keyCode"]]) {
- SDK.step(SDK.getStepFreq(), this.stepCount + 1);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.UP) && !this.keyDownList[e["keyCode"]]) {
- this.playJump();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_1) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(100);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_2) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(200);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_3) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(300);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_0) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(0);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMPAD_ADD) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(SDK.getStepFreq() + 10);
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMPAD_SUBTRACT) && !this.keyDownList[e["keyCode"]]) {
- SDK.stepFreq(SDK.getStepFreq() - 10);
- }
- this.keyDownList[e["keyCode"]] = true;
- }
- onKeyUp(e) {
- delete this.keyDownList[e["keyCode"]];
- }
- updateRun() {
- if (SDK.getStepCount() > this.stepCount) {
- this.stepCount++;
- if (this.player.isFalling || this.player.isJumping || !this.model.isPlaying || this.player.isDeath)
- return;
- this.player.stepRate = SDK.getStepFreq();
- this.player.dx = this.model.onceAddSpeed;
- this.player.curBackSpeed = 0;
- if (this.player.runRate <= 1.5)
- this.player.runRate += 0.2;
- if (!this.player.isRuning)
- this.player.playReadyRun();
- }
- }
- playRun() {
- if (this.player.isFalling || this.player.isJumping || !this.model.isPlaying || this.player.isDeath)
- return;
- this.player.dx = this.model.onceAddSpeed;
- this.player.curBackSpeed = 0;
- if (this.player.runRate <= 1.5)
- this.player.runRate += 0.2;
- if (!this.player.isRuning)
- this.player.playReadyRun();
- }
- playJump() {
- if (!this.model.isPlaying || this.player.isDeath || !this.player.isGO)
- return;
- if (this.model.jumpCount < 2) {
- if (this.model.jumpCount == 1 && this.jumpCountTime <= 0)
- return;
- this.player.dy = this.player.y - this.model.onceAddJump;
- this.jumpCountTime = this.model.jumpCountTime;
- this.model.jumpCount++;
- this.player.jumpSpeed = this.model.jumpSpeed;
- if (this.model.jumpCount == 2)
- this.player.playJump2();
- core.SoundManager.playSound(Path.getSound(Path.sound.jump));
- }
- }
- startGame() {
- this.openAni.play(0, false);
- this.startBtn.visible = false;
- this.model.isStarGame = true;
- this.startOrOverBg.visible = true;
- for (let i = 0; i <= 3; i++) {
- Laya.timer.once(1000 * i, this, () => {
- if (3 - i > 0) {
- this.startOrOverImg.skin = `res/imgs/game/time${3 - i}.png`;
- }
- else {
- this.startOrOverImg.skin = "res/imgs/game/text_go.png";
- core.SoundManager.playSound(Path.getSound(Path.sound.readyGo));
- Laya.timer.once(800, this, () => {
- this.goAni.play(0, false);
- });
- }
- this.countAni.play(0, false);
- }, null, false);
- }
- Laya.timer.once(4000, this, () => {
- this.model.isPlaying = true;
- core.SoundManager.playMusic(Path.getSound(Path.sound.bgm));
- let interval = this.runWayAni.interval;
- this.runWayAni.interval = interval * 0.7;
- this.runWayAni.play(0, true);
- this.pd_LigthImg.skin = "res/imgs/game/bg/pd_bright.png";
- this.startOrOverBg.visible = false;
- this.startBg.visible = false;
- Laya.timer.loop(this.model.onceTime, this, this.animate);
- Laya.timer.frameLoop(1, this, this.updatePlayer);
- SDK.onGameStart();
- }, null, false);
- }
- pauseGame() {
- if (this.player.role)
- this.player.role.stop();
- this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
- this.runWayAni.stop();
- for (let i = 0; i < this.enemies.length; i++) {
- if (this.enemies[i].moveTween && this.enemies[i].scaleTween) {
- this.enemies[i].moveTween.pause();
- this.enemies[i].scaleTween.pause();
- if (this.enemies[i].shadow.sdMoveTween && this.enemies[i].shadow.sdScaleTween) {
- this.enemies[i].shadow.sdMoveTween.pause();
- this.enemies[i].shadow.sdScaleTween.pause();
- }
- }
- }
- Laya.timer.clear(this, this.animate);
- Laya.timer.clear(this, this.updatePlayer);
- this.removeJumpEvent();
- }
- continueGame() {
- this.openAni.play(0, false);
- this.startBg.visible = true;
- this.startOrOverBg.visible = true;
- for (let i = 0; i < 3; i++) {
- Laya.timer.once(1000 * i, this, () => {
- this.startOrOverImg.skin = `res/imgs/game/time${3 - i}.png`;
- if (3 - i == 1) {
- Laya.timer.once(800, this, () => {
- this.goAni.play(0, false);
- for (let i = 0; i < this.enemies.length; i++) {
- if (this.enemies[i].moveTween && this.enemies[i].scaleTween) {
- this.enemies[i].moveTween.resume();
- this.enemies[i].scaleTween.resume();
- if (this.enemies[i].shadow.sdMoveTween && this.enemies[i].shadow.sdScaleTween) {
- this.enemies[i].shadow.sdMoveTween.resume();
- this.enemies[i].shadow.sdScaleTween.resume();
- }
- }
- }
- this.pd_LigthImg.skin = "res/imgs/game/bg/pd_bright.png";
- this.runWayAni.play(0, true);
- Laya.timer.loop(this.model.onceTime, this, this.animate);
- Laya.timer.frameLoop(1, this, this.updatePlayer);
- this.addJumpEvent();
- Laya.timer.once(200, this, () => {
- this.startOrOverBg.visible = false;
- this.startBg.visible = false;
- }, null, false);
- });
- }
- this.countAni.play(0, false);
- }, null, false);
- }
- }
- exitGame() {
- let highSocre = 0;
- switch (this.model.gameType) {
- case 1:
- if (this.curScore > this.model.level1HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel1HighSocreData(this.curScore);
- }
- highSocre = this.model.level1HighScoreData;
- break;
- case 2:
- if (this.curScore > this.model.level2HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel2HighSocreData(this.curScore);
- }
- highSocre = this.model.level2HighScoreData;
- break;
- case 3:
- if (this.curScore > this.model.level3HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel3HighSocreData(this.curScore);
- }
- highSocre = this.model.level3HighScoreData;
- break;
- }
- SDK.onGameEnd(this.model.gameType, this.curScore);
- this.player.reset();
- Manager.view.homeView.show();
- Manager.view.hideGameView();
- }
- animate() {
- this.updateRun();
- if (!this.model.isPlaying && !this.model.isStarGame)
- return;
- if (this.curTime > 0) {
- this.curTime -= this.model.onceTime;
- this.timeTxt.text = this.exchangeCDTime(this.curTime);
- }
- else {
- if (this.model.isPlaying)
- this.gameOver();
- }
- }
- updatePlayer() {
- this.updateEnemies();
- this.player.update();
- this.playerShadow.x = this.player.x - 80;
- this.TirggerEnemies();
- if (this.runCountTime > 0)
- this.runCountTime -= Laya.timer.delta;
- if (this.jumpCountTime > 0)
- this.jumpCountTime -= Laya.timer.delta;
- }
- exchangeCDTime(time) {
- let m = parseInt(time / 1000 / 60 % 60 + ''), s = parseInt(time / 1000 % 60 + ''), ms = time % 100;
- if (m < 10)
- m = "0" + m;
- if (s < 10)
- s = "0" + s;
- if (ms < 10)
- ms = "0" + ms;
- return m + ":" + s + "`" + ms;
- }
- updateEnemies() {
- for (let i = 0; i < this.createPosTime.length; i++) {
- if (this.createPosTime[i] && this.createPosTime[i] > 0) {
- this.createPosTime[i] -= this.timer.delta;
- if (this.createPosTime[i] <= 0)
- this.createPosArr[i].skin = "res/imgs/game/bg/led_dark.png";
- }
- }
- if (this.countNum >= this.levelConfig.length)
- return;
- if (this.curTime <= Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).time * 1000) {
- for (let i = 0; i < Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).type.length; i++) {
- this.createPosArr[Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).posArr[i]].skin = "res/imgs/game/bg/led_bright.png";
- let type = Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).type[i];
- let index = Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).posArr[i];
- let pos = Laya.Point.create();
- pos.x = this.createPosArr[index].x;
- pos.y = this.createPosArr[index].y;
- pos = this.createBox.localToGlobal(pos);
- let url;
- if (type == 1)
- url = "";
- else if (type == 2)
- url = "res/imgs/game/boomEnemy.png";
- else if (type == 3)
- url = "";
- let enmey = Enemie.create(pos.x - this.gameBox.x, pos.y - this.gameBox.y, url, type, index);
- this.creatCount++;
- enmey.zOrder = 1000 - this.creatCount;
- enmey.alpha = 0;
- this.playBox.addChild(enmey);
- this.enemies.push(enmey);
- enmey.startMove();
- this.createPosTime[index] = 2000;
- }
- this.countNum++;
- }
- }
- TirggerEnemies() {
- for (let i = 0; i < this.enemies.length; i++) {
- if (this.enemies[i].type == 2) {
- this.tirggerUp = 150;
- this.tirggerDOWN = -50;
- this.tirggerLeft = 130;
- this.tirggerRight = -130;
- }
- else {
- this.tirggerUp = 250;
- this.tirggerDOWN = -150;
- this.tirggerLeft = 200;
- this.tirggerRight = -200;
- }
- if (this.player.y - this.enemies[i].y <= this.tirggerUp && this.player.y - this.enemies[i].y >= this.tirggerDOWN
- && this.player.x - this.enemies[i].x <= this.tirggerLeft && this.player.x - this.enemies[i].x >= this.tirggerRight
- && this.enemies[i].scaleX >= 0.8 && this.enemies[i].scaleY >= 0.8 && this.enemies[i].parent) {
- if (this.model.jumpCount < 1 && this.enemies[i].index > 4)
- return;
- let socre;
- let type;
- if (this.enemies[i].type == 1 || this.enemies[i].type == 3) {
- core.SoundManager.playSound(Path.getSound(Path.sound.combo));
- if (this.enemies[i].type == 1) {
- if (this.model.gameType == 1) {
- socre = "+100";
- this.curScore += 100;
- this.addSocre += 100;
- }
- else if (this.model.gameType == 2) {
- socre = "+150";
- this.curScore += 150;
- this.addSocre += 150;
- }
- else if (this.model.gameType == 3) {
- socre = "+200";
- this.curScore += 200;
- this.addSocre += 200;
- }
- type = 1;
- this.showGrade(true, false, true);
- }
- else {
- if (this.model.gameType == 1) {
- socre = "+300";
- this.curScore += 300;
- this.addSocre += 300;
- }
- else if (this.model.gameType == 2) {
- socre = "+350";
- this.curScore += 350;
- this.addSocre += 350;
- }
- else if (this.model.gameType == 3) {
- socre = "+400";
- this.curScore += 400;
- this.addSocre += 400;
- }
- type = 2;
- this.showGrade(true, true, true);
- }
- Animation.createOnceAni(this.enemies[i].x, this.enemies[i].y, 190, 210, 1.5, `res/ani/gold.atlas`, this.playBox);
- }
- else if (this.enemies[i].type == 2) {
- if (!this.player.isDeath) {
- if (this.model.gameType == 1) {
- socre = "-200";
- this.curScore -= 200;
- this.subSocre += 200;
- }
- else if (this.model.gameType == 2) {
- socre = "-250";
- this.curScore -= 250;
- this.subSocre += 250;
- }
- else if (this.model.gameType == 3) {
- socre = "-300";
- this.curScore -= 300;
- this.subSocre += 300;
- }
- type = 3;
- this.huaryUpAniL.play(0, true);
- this.huaryUpAniR.play(0, true);
- this.huaryUpAniL.visible = true;
- this.huaryUpAniR.visible = true;
- this.showGrade(false, false, false);
- SDK.vibrate(500);
- Laya.timer.once(500, this, () => {
- this.huaryUpAniL.stop();
- this.huaryUpAniR.stop();
- this.huaryUpAniL.visible = false;
- this.huaryUpAniR.visible = false;
- });
- Animation.createOnceAni(this.enemies[i].x, this.enemies[i].y, 266, 209, 1.5, `res/ani/boom.atlas`, this.playBox, 30);
- if (!this.isProtect) {
- this.isProtect = true;
- this.player.showHit();
- if (this.model.jumpCount == 2) {
- this.player.isDeath = true;
- this.player.playDead();
- Laya.Tween.to(this.player, { y: this.startPosImg.y }, 500);
- }
- else {
- if (this.model.jumpCount == 0) {
- if (this.player.x != 460) {
- if (this.player.x - this.enemies[i].x <= 0) {
- Laya.Tween.to(this.player, { x: this.player.x - this.enemies[i].width / 2 }, 200);
- }
- else {
- Laya.Tween.to(this.player, { x: this.player.x + this.enemies[i].width / 2 }, 200);
- }
- }
- }
- }
- Laya.timer.once(2500, this, () => {
- this.player.hideHit();
- this.isProtect = false;
- });
- }
- }
- }
- if (socre) {
- let pos = Laya.Point.create();
- pos.x = this.endPosArr[this.enemies[i].index].x;
- pos.y = this.endPosArr[this.enemies[i].index].y;
- pos = this.createBox.localToGlobal(pos);
- let socreTxt = ScoreTxt.create(pos.x + 120, pos.y - 150, type, socre);
- socreTxt.zOrder = 1001;
- this.playBox.addChild(socreTxt);
- this.socreTxtArr.push(socreTxt);
- }
- this.enemies[i].isDeath = true;
- this.enemies[i].destroy();
- this.updateScore();
- }
- }
- }
- showGrade(isSilver = false, isGold = false, isShow = false) {
- if (isSilver) {
- this.goldNum++;
- if (isShow) {
- if (isGold) {
- this.gradeImg.skin = "res/imgs/game/great.png";
- this.scoreGrade.visible = true;
- this.gradeAni.play(0, false);
- }
- if (this.goldNum == this.goldCountArr[this.goldIndex]) {
- this.gradeCount++;
- if (!isGold && this.isGood) {
- if (this.gradeCount == 3) {
- this.gradeImg.skin = "res/imgs/game/amaze.png";
- }
- else if (this.gradeCount == 4 || this.gradeCount >= this.goldCountArr.length) {
- this.gradeImg.skin = "res/imgs/game/perfect.png";
- }
- else if (this.gradeCount == 1) {
- this.gradeImg.skin = "res/imgs/game/good.png";
- }
- this.scoreGrade.visible = true;
- this.gradeAni.play(0, false);
- }
- this.goldIndex++;
- this.goldNum = 0;
- this.isGood = true;
- }
- }
- else {
- this.gradeCount = 0;
- this.isGood = false;
- if (this.goldNum == this.goldCountArr[this.goldIndex]) {
- this.goldIndex++;
- this.goldNum = 0;
- this.isGood = true;
- }
- }
- }
- else {
- this.gradeCount = 0;
- this.isGood = false;
- }
- }
- updateScore() {
- this.scoreTxt.text = this.curScore + "";
- }
- gameOver() {
- this.timeTxt.text = "00:00`00";
- this.model.isPlaying = false;
- this.model.isStarGame = false;
- this.startBg.visible = false;
- this.startBg.visible = true;
- this.startOrOverBg.visible = true;
- this.startOrOverImg.skin = "res/imgs/game/text_finsh.png";
- this.removeEvent();
- this.removeJumpEvent();
- this.player.isGO = false;
- this.player.backSpeed = this.model.backSpeed;
- this.player.playStopRun();
- this.gameOverAni.play(0, false);
- let highSocre = 0;
- switch (this.model.gameType) {
- case 1:
- if (this.curScore > this.model.level1HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel1HighSocreData(this.curScore);
- }
- highSocre = this.model.level1HighScoreData;
- break;
- case 2:
- if (this.curScore > this.model.level2HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel2HighSocreData(this.curScore);
- }
- highSocre = this.model.level2HighScoreData;
- break;
- case 3:
- if (this.curScore > this.model.level3HighScoreData) {
- this.isScoreHigh = true;
- this.model.setLevel3HighSocreData(this.curScore);
- }
- highSocre = this.model.level3HighScoreData;
- break;
- }
- SDK.onGameEnd(this.model.gameType, this.curScore, 0, 0, 0, (data) => {
- this.gameOverData = data;
- this.event("onGameEnd", data);
- });
- Laya.timer.once(300, this, () => {
- this.player.playStandby();
- Laya.timer.once(2500, this, () => {
- this.runWayAni.stop();
- this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
- Laya.timer.once(1000, this, () => {
- Manager.view.resultView.show(this.curScore, this.addSocre, this.subSocre, highSocre, this.isScoreHigh, this.exchangeCDTime(Manager.dataManager.getLevelConfig(this.model.gameType, 0).time * 1000));
- });
- });
- });
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- this.removeJumpEvent();
- Laya.timer.clear(this, this.animate);
- Laya.timer.clear(this, this.updatePlayer);
- }
- destroy() {
- super.destroy();
- Laya.Tween.clearAll(this.player);
- Laya.timer.clearAll(this);
- if (this.enemies)
- core.ObjectUtil.destroyList(...this.enemies);
- if (this.socreTxtArr)
- core.ObjectUtil.destroyList(...this.socreTxtArr);
- this.model = null;
- this.player.destroy();
- this.player = null;
- this.enemies = null;
- }
- resetGame() {
- core.SoundManager.stopAllSound();
- Laya.timer.clear(this, this.animate);
- Laya.timer.clear(this, this.updatePlayer);
- if (this.enemies)
- core.ObjectUtil.destroyList(...this.enemies);
- this.enemies = [];
- this.curScore = 0;
- this.subSocre = 0;
- this.addSocre = 0;
- this.updateScore();
- this.model.reset();
- this.player.reset();
- this.runWayAni.interval = 16.6;
- this.runWayAni.stop();
- this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
- this.startBg.visible = true;
- this.model.isPlaying = false;
- this.model.isStarGame = false;
- this.isScoreHigh = false;
- this.countNum = 1;
- this.curTime = Manager.dataManager.getLevelConfig(this.model.gameType, 0).time * 1000;
- this.timeTxt.text = this.exchangeCDTime(this.curTime);
- this.keyDownList = [];
- this.createPosTime = [];
- this.socreTxtArr = [];
- this.playerShadow.x = this.player.x - 80;
- this.goldIndex = 0;
- this.goldNum = 0;
- this.gradeCount = 0;
- this.stepCount = 0;
- this.model.jumpCount = 0;
- this.runCountTime = this.model.runCountTime;
- this.jumpCountTime = this.model.jumpCountTime;
- this.huaryUpAniL.stop();
- this.huaryUpAniR.stop();
- this.huaryUpAniL.visible = false;
- this.huaryUpAniR.visible = false;
- this.gameOverData = null;
- switch (this.model.gameType) {
- case 1:
- this.highScoreTxt.text = this.model.level1HighScoreData + "";
- break;
- case 2:
- this.highScoreTxt.text = this.model.level2HighScoreData + "";
- break;
- case 3:
- this.highScoreTxt.text = this.model.level3HighScoreData + "";
- break;
- }
- for (let i = 0; i < this.createPosArr.length; i++) {
- if (this.createPosArr[i])
- this.createPosArr[i].skin = "res/imgs/game/bg/led_dark.png";
- }
- this.player.pos(this.startPosImg.x, this.startPosImg.y);
- this.addJumpEvent();
- this.removeEvent();
- this.addEvent();
- this.selfRank = 0;
- SDK.getRank(0, (info) => {
- for (let i = 0; i < info[1].list.length; i++) {
- if (info[1].list[i].user.id == this.model.selfInfo.id) {
- this.selfRank = info[1].list[i].rank;
- log("自己当前排行", this.selfRank);
- break;
- }
- }
- });
- }
- show(gameType) {
- Laya.stage.addChild(this);
- this.model.gameType = gameType;
- if (this.model.gameType == 1) {
- this.gametypeTxt.text = "简单";
- this.levelConfig = Manager.dataManager.levelConfig1;
- this.goldCountArr = Manager.dataManager.goldCountArr1;
- }
- else if (this.model.gameType == 2) {
- this.gametypeTxt.text = "中等";
- this.levelConfig = Manager.dataManager.levelConfig2;
- this.goldCountArr = Manager.dataManager.goldCountArr2;
- }
- else if (this.model.gameType == 3) {
- this.gametypeTxt.text = "困难";
- this.levelConfig = Manager.dataManager.levelConfig3;
- this.goldCountArr = Manager.dataManager.goldCountArr3;
- }
- this.resetGame();
- this.startGame();
- }
- }
- class HomeView extends game.ui.HomeViewUI {
- constructor() {
- super();
- this.index = 1;
- this.exitIndex = 1;
- Laya.stage.frameRate = Laya.Stage.FRAME_FAST;
- }
- onAwake() {
- super.onAwake();
- }
- onEnable() {
- super.onEnable();
- this.addEvent();
- this.noBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.yesBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.index = 1;
- this.setSkin();
- this.openAni.play(0, false);
- this.level1TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(1, 0).time * 1000);
- this.level2TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(2, 0).time * 1000);
- this.level3TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(3, 0).time * 1000);
- this.level1ScoreTxt.text = Manager.model.level1HighScoreData.toString();
- this.level2ScoreTxt.text = Manager.model.level2HighScoreData.toString();
- this.level3ScoreTxt.text = Manager.model.level3HighScoreData.toString();
- if (Manager.model.selfInfo.avatar)
- this.avatarImg.skin = Manager.model.selfInfo.avatar;
- this.nameTxt.text = Manager.model.selfInfo.nickname;
- core.SoundManager.stopMusic();
- }
- addEvent() {
- this.level1.on(Laya.Event.CLICK, this, this.onClick);
- this.level2.on(Laya.Event.CLICK, this, this.onClick);
- this.level3.on(Laya.Event.CLICK, this, this.onClick);
- this.rankBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.settingBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.homeBtn.on(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
- SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
- SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
- SDK.on(CMD.CANCLE_KEY.toString(), this.showExitGameView, this);
- }
- removeEvent() {
- this.level1.off(Laya.Event.CLICK, this, this.onClick);
- this.level2.off(Laya.Event.CLICK, this, this.onClick);
- this.level3.off(Laya.Event.CLICK, this, this.onClick);
- this.rankBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.settingBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.homeBtn.off(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
- SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
- SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
- SDK.off(CMD.CANCLE_KEY.toString(), this.showExitGameView);
- }
- KeyUp() {
- if (this.exitBg.visible) {
- if (this.exitIndex == 1) {
- this.exitIndex = 2;
- this.yesBtn.skin = "res/imgs/game/btn_tyxz.png";
- this.yesTxtImg.skin = "res/imgs/game/text_qd1.png";
- this.noBtn.skin = "res/imgs/game/btn_tywxz.png";
- this.noTxtImg.skin = "res/imgs/game/text_qx2.png";
- }
- else {
- this.exitIndex = 1;
- this.yesBtn.skin = "res/imgs/game/btn_tywxz.png";
- this.yesTxtImg.skin = "res/imgs/game/text_qd2.png";
- this.noBtn.skin = "res/imgs/game/btn_tyxz.png";
- this.noTxtImg.skin = "res/imgs/game/text_qx1.png";
- }
- }
- else {
- if (this.index > 1) {
- this.index--;
- }
- else {
- this.index = 3;
- }
- this.setSkin();
- }
- }
- KeyDown() {
- if (this.exitBg.visible) {
- if (this.exitIndex == 1) {
- this.exitIndex = 2;
- this.yesBtn.skin = "res/imgs/game/btn_tyxz.png";
- this.yesTxtImg.skin = "res/imgs/game/text_qd1.png";
- this.noBtn.skin = "res/imgs/game/btn_tywxz.png";
- this.noTxtImg.skin = "res/imgs/game/text_qx2.png";
- }
- else {
- this.exitIndex = 1;
- this.yesBtn.skin = "res/imgs/game/btn_tywxz.png";
- this.yesTxtImg.skin = "res/imgs/game/text_qd2.png";
- this.noBtn.skin = "res/imgs/game/btn_tyxz.png";
- this.noTxtImg.skin = "res/imgs/game/text_qx1.png";
- }
- }
- else {
- if (this.index < 3) {
- this.index++;
- }
- else {
- this.index = 1;
- }
- this.setSkin();
- }
- }
- KeyEnter() {
- if (this.exitBtnBg.visible) {
- if (this.exitIndex == 1)
- this.hideExitGameView();
- else
- SDK.onBackPressed();
- }
- else {
- this.startGame(this.index);
- }
- }
- onkeydown(e) {
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.LEFT)) {
- this.KeyUp();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT)) {
- this.KeyDown();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
- this.KeyEnter();
- }
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.level1:
- this.index = 1;
- this.setSkin();
- this.startGame(1);
- break;
- case this.level2:
- this.index = 2;
- this.setSkin();
- this.startGame(2);
- break;
- case this.level3:
- this.index = 3;
- this.setSkin();
- this.startGame(3);
- break;
- case this.rankBtn:
- this.showRankView();
- break;
- case this.settingBtn:
- this.showSettingView();
- break;
- case this.homeBtn:
- this.showExitGameView();
- break;
- case this.noBtn:
- this.hideExitGameView();
- break;
- case this.yesBtn:
- SDK.onBackPressed();
- break;
- }
- }
- setSkin() {
- switch (this.index) {
- case 1:
- this.level1.gray = false;
- this.level1.alpha = 1;
- this.level1.scale(1.2, 1.2);
- this.level2.gray = true;
- this.level2.alpha = 0.8;
- this.level2.scale(1.1, 1.1);
- this.level3.gray = true;
- this.level3.alpha = 0.8;
- this.level3.scale(1.1, 1.1);
- break;
- case 2:
- this.level1.gray = true;
- this.level1.alpha = 0.8;
- this.level1.scale(1.1, 1.1);
- this.level2.gray = false;
- this.level2.alpha = 1;
- this.level2.scale(1.2, 1.2);
- this.level3.gray = true;
- this.level3.alpha = 0.8;
- this.level3.scale(1.1, 1.1);
- break;
- case 3:
- this.level1.gray = true;
- this.level1.alpha = 0.8;
- this.level1.scale(1.1, 1.1);
- this.level2.gray = true;
- this.level2.alpha = 0.8;
- this.level2.scale(1.1, 1.1);
- this.level3.gray = false;
- this.level3.alpha = 1;
- this.level3.scale(1.2, 1.2);
- break;
- }
- }
- startGame(gameType) {
- let btn;
- switch (this.index) {
- case 1:
- btn = this.level1;
- break;
- case 2:
- btn = this.level2;
- break;
- case 3:
- btn = this.level3;
- break;
- }
- Laya.Tween.to(btn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
- Laya.timer.once(300, this, () => {
- Manager.view.gameView.show(gameType);
- Manager.view.hideHomeView();
- });
- }));
- }
- showRankView() {
- Laya.Tween.to(this.rankBtn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
- Laya.timer.once(300, this, () => {
- Manager.view.rankView.getRank();
- Manager.view.rankView.show();
- Manager.view.hideHomeView();
- });
- }));
- }
- showSettingView() {
- Laya.Tween.to(this.settingBtn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
- Laya.timer.once(300, this, () => {
- Manager.view.settingView.show();
- Manager.view.hideHomeView();
- });
- }));
- }
- showExitGameView() {
- this.exitBg.visible = true;
- this.exitBtnBg.visible = true;
- }
- hideExitGameView() {
- this.exitBg.visible = false;
- this.exitBtnBg.visible = false;
- this.addEvent();
- }
- exchangeCDTime(time) {
- let m = parseInt(time / 1000 / 60 % 60 + ''), s = parseInt(time / 1000 % 60 + ''), ms = time % 100;
- if (m < 10)
- m = "0" + m;
- if (s < 10)
- s = "0" + s;
- if (ms < 10)
- ms = "0" + ms;
- return m + ":" + s + "`" + ms;
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- this.noBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.yesBtn.on(Laya.Event.CLICK, this, this.onClick);
- }
- destroy() {
- super.destroy();
- }
- show() {
- Laya.stage.addChild(this);
- }
- }
- class RankView extends game.ui.RankViewUI {
- constructor() {
- super();
- this.selfInfo = { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" };
- this.friendInfoList = [{ "user": { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" }, "score": 100, "rank": 1 }];
- this.wordInfoList = [{ "user": { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" }, "score": 100, "rank": 1 }];
- this.testInfo = {
- index: 1,
- id: 1,
- name: "Self",
- gender: 1,
- avatar: "",
- score: Manager.model.allHighScoreData,
- rank: 100,
- };
- this.rankType = 1;
- this.wordInfoList = [];
- this.friendInfoList = [];
- this.rankList.vScrollBarSkin = "";
- }
- getRank() {
- if (!window["SDKBridge"]) {
- this.rankList.visible = true;
- this.showWordRank();
- }
- SDK.getUserInfo((info) => {
- this.selfInfo = info;
- log("info", info);
- SDK.getRank(1, (info) => {
- this.friendInfoList = info[1].list;
- log("获取好友排行榜信息", this.friendInfoList, info[1].list);
- SDK.getRank(0, (info) => {
- this.wordInfoList = info[1].list;
- log("获取世界排行榜信息", this.wordInfoList, info[1].list);
- this.rankList.visible = true;
- this.showWordRank();
- });
- });
- });
- }
- notRankInfo() {
- let a = [];
- let item = {
- index: 1,
- id: 1,
- name: "nickname",
- gender: 1,
- avatar: "",
- score: Manager.model.allHighScoreData,
- rank: 1,
- };
- a.push(item);
- this.testInfo = a[0];
- return a;
- }
- setSelfInfo(type) {
- let rank = 100;
- let socre = Manager.model.allHighScoreData;
- switch (type) {
- case 1:
- for (let i = 0; i < this.wordInfoList.length; i++) {
- if (this.wordInfoList[i].user.id == this.selfInfo.id) {
- rank = this.wordInfoList[i].rank;
- socre = this.wordInfoList[i].score;
- this.scoreTxt.text = socre.toString();
- }
- }
- break;
- case 2:
- for (let i = 0; i < this.friendInfoList.length; i++) {
- if (this.friendInfoList[i].user.id == this.selfInfo.id) {
- rank = this.friendInfoList[i].rank;
- socre = this.friendInfoList[i].score;
- this.scoreTxt.text = socre.toString();
- }
- }
- break;
- case 3:
- rank = this.testInfo.rank;
- break;
- }
- if (rank < 100) {
- if (rank <= 3) {
- switch (rank) {
- case 1:
- this.winImg.skin = "res/imgs/rank/icon_diyi.png";
- break;
- case 2:
- this.winImg.skin = "res/imgs/rank/icon_dier.png";
- break;
- case 3:
- this.winImg.skin = "res/imgs/rank/icon_disan.png";
- break;
- }
- }
- this.winImg.visible = true;
- this.loseImg.visible = false;
- this.rankTxt.visible = true;
- this.rankTxt.value = rank.toString();
- }
- else {
- this.winImg.visible = false;
- this.loseImg.visible = true;
- this.rankTxt.visible = false;
- }
- if (this.selfInfo.avatar)
- this.avatarImg.skin = this.selfInfo.avatar;
- this.nameTxt.text = this.selfInfo.nickname;
- }
- onEnable() {
- super.onEnable();
- this.addEvent();
- }
- addEvent() {
- this.friendBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.wordBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.closeBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.on(Laya.Event.CLICK, this, this.onClick);
- }
- removeEvent() {
- this.friendBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.wordBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.off(Laya.Event.CLICK, this, this.onClick);
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.friendBtn:
- this.showFriendRank();
- break;
- case this.wordBtn:
- this.showWordRank();
- break;
- case this.closeBtn:
- Manager.view.homeView.show();
- Manager.view.hideRankView();
- break;
- }
- }
- showFriendRank() {
- if (this.rankType == 1)
- return;
- this.rankType = 1;
- this.friendBg.visible = true;
- this.wordBg.visible = false;
- if (this.friendInfoList.length > 0) {
- this.rankList.array = this.getFriendRankList();
- this.setSelfInfo(2);
- }
- else {
- this.rankList.array = [];
- this.setSelfInfo(3);
- }
- this.rankList.refresh();
- this.openAni.play(0, false);
- }
- showWordRank() {
- if (this.rankType == 2)
- return;
- this.rankType = 2;
- this.friendBg.visible = false;
- this.wordBg.visible = true;
- if (this.wordInfoList.length > 0) {
- this.rankList.array = this.getWordRankList();
- this.setSelfInfo(1);
- }
- else {
- this.rankList.array = [];
- this.setSelfInfo(3);
- }
- this.rankList.refresh();
- this.openAni.play(0, false);
- }
- getFriendRankList() {
- let arr = [];
- for (let index = 0; index < this.friendInfoList.length; index++) {
- if (index == 100)
- break;
- arr.push({
- index: index,
- name: this.friendInfoList[index].user.nickname,
- gender: this.friendInfoList[index].user.gender,
- avatar: this.friendInfoList[index].user.avatar,
- score: this.friendInfoList[index].score,
- rank: this.friendInfoList[index].rank,
- });
- }
- return arr;
- }
- getWordRankList() {
- let arr = [];
- for (let index = 0; index < this.wordInfoList.length; index++) {
- if (index == 100)
- break;
- arr.push({
- index: index,
- name: this.wordInfoList[index].user.nickname,
- gender: this.wordInfoList[index].user.gender,
- avatar: this.wordInfoList[index].user.avatar,
- score: this.wordInfoList[index].score,
- rank: this.wordInfoList[index].rank,
- });
- }
- return arr;
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- }
- destroy() {
- super.destroy();
- }
- show() {
- Laya.stage.addChild(this);
- }
- }
- class ResultView extends game.ui.ResultViewUI {
- constructor() {
- super();
- this.index = 1;
- this.rankIndex = 0;
- }
- onAwake() {
- super.onAwake();
- }
- onEnable() {
- super.onEnable();
- this.addEvent();
- this.index = 1;
- this.setSkin();
- }
- setRank() {
- if (Manager.view.gameView.gameOverData) {
- this.caloriesTxt.text = `${Manager.view.gameView.gameOverData.consume}`;
- this.stepTxt.text = `${Manager.view.gameView.gameOverData.equivalent}`;
- }
- else {
- this.caloriesTxt.text = `等待结算中`;
- this.stepTxt.text = `等待结算中`;
- log("等待结算中");
- Manager.view.gameView.once("onGameEnd", this, this.updateInfo);
- }
- if (!window["SDKBridge"]) {
- this.noRank1.visible = true;
- this.pmFontClip1.visible = false;
- if (Manager.model.selfInfo.avatar)
- this.avatarImg1.skin = Manager.model.selfInfo.avatar;
- this.nameTxt1.text = Manager.model.selfInfo.nickname;
- this.nameTxt1.color = "#ffd905";
- this.rankScore1.text = this.scoreTxt.text + "分";
- this.rankScore1.color = "#ffd905";
- this.rank1.visible = true;
- }
- SDK.getRank(0, (info) => {
- this.wordRankInfo = info[1].list;
- log("世界排行榜", this.wordRankInfo);
- for (let i = 0; i < this.wordRankInfo.length; i++) {
- if (this.wordRankInfo[i].user.id == Manager.model.selfInfo.id) {
- this.selfInfo = this.wordRankInfo[i];
- log("自己的信息", this.selfInfo);
- break;
- }
- }
- if (!this.selfInfo) {
- if (this.wordRankInfo.length == 0) {
- this.noRank1.visible = true;
- this.pmFontClip1.visible = false;
- if (Manager.model.selfInfo.avatar)
- this.avatarImg1.skin = Manager.model.selfInfo.avatar;
- this.nameTxt1.text = Manager.model.selfInfo.nickname;
- this.nameTxt1.color = "#ffd905";
- this.nameTxt1.fontSize = 38;
- this.rankScore1.text = this.scoreTxt.text + "分";
- this.rankScore1.color = "#ffd905";
- this.rankScore1.fontSize = 45;
- this.rank1.visible = true;
- this.rankIndex = 1;
- }
- else if (this.wordRankInfo.length == 1) {
- this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
- if (this.wordRankInfo[0].user.avatar)
- this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
- this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
- this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
- this.noRank2.visible = true;
- this.pmFontClip2.visible = false;
- if (Manager.model.selfInfo.avatar)
- this.avatarImg2.skin = Manager.model.selfInfo.avatar;
- this.nameTxt2.text = Manager.model.selfInfo.nickname;
- this.nameTxt2.color = "#ffd905";
- this.nameTxt2.fontSize = 38;
- this.rankScore2.text = this.scoreTxt.text + "分";
- this.rankScore2.color = "#ffd905";
- this.rankScore2.fontSize = 45;
- this.rank1.visible = true;
- this.rank2.visible = true;
- this.rankIndex = 2;
- }
- else if (this.wordRankInfo.length >= 2) {
- this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
- if (this.wordRankInfo[0].user.avatar)
- this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
- this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
- this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
- this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
- if (this.wordRankInfo[1].user.avatar)
- this.avatarImg2.skin = this.wordRankInfo[0].user.avatar;
- this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
- this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
- this.noRank3.visible = true;
- this.pmFontClip3.visible = false;
- if (Manager.model.selfInfo.avatar)
- this.avatarImg3.skin = Manager.model.selfInfo.avatar;
- this.nameTxt3.text = Manager.model.selfInfo.nickname;
- this.nameTxt3.color = "#ffd905";
- this.nameTxt3.fontSize = 38;
- this.rankScore3.text = this.scoreTxt.text + "分";
- this.rankScore3.color = "#ffd905";
- this.rankScore3.fontSize = 45;
- this.rankIndex = 3;
- this.rank1.visible = true;
- this.rank2.visible = true;
- this.rank3.visible = true;
- }
- }
- else {
- if (this.wordRankInfo.length == 1) {
- this.pmFontClip1.value = `${this.selfInfo.rank}`;
- this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg1.skin = Manager.model.selfInfo.avatar;
- this.nameTxt1.text = Manager.model.selfInfo.nickname;
- this.nameTxt1.color = "#ffd905";
- this.nameTxt1.fontSize = 38;
- this.rankScore1.text = `${this.selfInfo.score}分`;
- this.rankScore1.color = "#ffd905";
- this.rankScore1.fontSize = 45;
- this.rank1.visible = true;
- this.rankIndex = 1;
- }
- else if (this.wordRankInfo.length == 2) {
- if (this.selfInfo.rank == 1) {
- this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
- if (this.wordRankInfo[1].user.avatar)
- this.avatarImg2.skin = this.wordRankInfo[1].user.avatar;
- this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
- this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
- this.pmFontClip1.value = this.selfInfo.rank;
- this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg1.skin = Manager.model.selfInfo.avatar;
- this.nameTxt1.text = Manager.model.selfInfo.nickname;
- this.nameTxt1.color = "#ffd905";
- this.nameTxt1.fontSize = 38;
- this.rankScore1.text = `${this.selfInfo.score}分`;
- this.rankScore1.color = "#ffd905";
- this.rankScore1.fontSize = 45;
- this.rankIndex = 1;
- }
- else {
- this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
- if (this.wordRankInfo[0].user.avatar)
- this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
- this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
- this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
- this.pmFontClip2.value = this.selfInfo.rank;
- this.pmFontClip2.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg2.skin = Manager.model.selfInfo.avatar;
- this.nameTxt2.text = Manager.model.selfInfo.nickname;
- this.nameTxt2.color = "#ffd905";
- this.nameTxt2.fontSize = 38;
- this.rankScore2.text = `${this.selfInfo.score}分`;
- this.rankScore2.color = "#ffd905";
- this.rankScore2.fontSize = 45;
- this.rankIndex = 2;
- }
- this.rank1.visible = true;
- this.rank2.visible = true;
- }
- else if (this.wordRankInfo.length >= 3) {
- if (this.selfInfo.rank == 1) {
- this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
- if (this.wordRankInfo[1].user.avatar)
- this.avatarImg2.skin = this.wordRankInfo[1].user.avatar;
- this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
- this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
- this.pmFontClip3.value = `${this.wordRankInfo[2].rank}`;
- if (this.wordRankInfo[2].user.avatar)
- this.avatarImg3.skin = this.wordRankInfo[2].user.avatar;
- this.nameTxt3.text = this.wordRankInfo[2].user.nickname;
- this.rankScore3.text = `${this.wordRankInfo[2].score}分`;
- this.pmFontClip1.value = this.selfInfo.rank;
- this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg1.skin = Manager.model.selfInfo.avatar;
- this.nameTxt1.text = Manager.model.selfInfo.nickname;
- this.nameTxt1.color = "#ffd905";
- this.nameTxt1.fontSize = 38;
- this.rankScore1.text = `${this.selfInfo.score}分`;
- this.rankScore1.color = "#ffd905";
- this.rankScore1.fontSize = 45;
- this.rankIndex = 1;
- }
- else if (this.selfInfo.rank == this.wordRankInfo.length) {
- this.pmFontClip1.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 2].rank}`;
- if (this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.avatar)
- this.avatarImg1.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.avatar;
- this.nameTxt1.text = this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.nickname;
- this.rankScore1.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 2].score}分`;
- this.pmFontClip3.value = this.selfInfo.rank;
- this.pmFontClip3.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg3.skin = Manager.model.selfInfo.avatar;
- this.nameTxt3.text = Manager.model.selfInfo.nickname;
- this.nameTxt3.color = "#ffd905";
- this.nameTxt3.fontSize = 38;
- this.rankScore3.text = `${this.selfInfo.score}分`;
- this.rankScore3.color = "#ffd905";
- this.rankScore3.fontSize = 45;
- this.pmFontClip2.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].rank}`;
- if (this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar)
- this.avatarImg2.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar;
- this.nameTxt2.text = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.nickname;
- this.rankScore2.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].score}分`;
- this.rankIndex = 3;
- }
- else {
- this.pmFontClip1.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].rank}`;
- if (this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar)
- this.avatarImg1.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar;
- this.nameTxt1.text = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.nickname;
- this.rankScore1.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].score}分`;
- this.pmFontClip2.value = this.selfInfo.rank;
- this.pmFontClip2.skin = "res/imgs/result/text_pm_num.png";
- if (Manager.model.selfInfo.avatar)
- this.avatarImg2.skin = Manager.model.selfInfo.avatar;
- this.nameTxt2.text = Manager.model.selfInfo.nickname;
- this.nameTxt2.color = "#ffd905";
- this.nameTxt2.fontSize = 38;
- this.rankScore2.text = `${this.selfInfo.score}分`;
- this.rankScore2.color = "#ffd905";
- this.rankScore2.fontSize = 45;
- this.pmFontClip3.value = `${this.wordRankInfo[this.selfInfo.rank - 1 + 1].rank}`;
- if (this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.avatar)
- this.avatarImg3.skin = this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.avatar;
- this.nameTxt3.text = this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.nickname;
- this.rankScore3.text = `${this.wordRankInfo[this.selfInfo.rank - 1 + 1].score}分`;
- this.rankIndex = 2;
- }
- this.rank1.visible = true;
- this.rank2.visible = true;
- this.rank3.visible = true;
- }
- if (this.selfInfo.rank == Manager.view.gameView.selfRank) {
- if (this.rankIndex == 1) {
- this.pmImg1.visible = true;
- this.pmImg1.skin = "res/imgs/result/icon_pmwsb.png";
- }
- else if (this.rankIndex == 2) {
- this.pmImg2.visible = true;
- this.pmImg2.skin = "res/imgs/result/icon_pmwsb.png";
- }
- else if (this.rankIndex == 3) {
- this.pmImg3.visible = true;
- this.pmImg3.skin = "res/imgs/result/icon_pmwsb.png";
- }
- }
- else if (this.selfInfo.rank < Manager.view.gameView.selfRank) {
- if (this.rankIndex == 1) {
- this.pmImg1.visible = true;
- this.pmImg1.skin = "res/imgs/result/icon_pmss.png";
- }
- else if (this.rankIndex == 2) {
- this.pmImg2.visible = true;
- this.pmImg2.skin = "res/imgs/result/icon_pmss.png";
- }
- else if (this.rankIndex == 3) {
- this.pmImg3.visible = true;
- this.pmImg3.skin = "res/imgs/result/icon_pmss.png";
- }
- }
- else {
- if (this.rankIndex == 1) {
- this.pmImg1.visible = true;
- this.pmImg1.skin = "res/imgs/result/icon_pmxj.png";
- }
- else if (this.rankIndex == 2) {
- this.pmImg2.visible = true;
- this.pmImg2.skin = "res/imgs/result/icon_pmxj.png";
- }
- else if (this.rankIndex == 3) {
- this.pmImg3.visible = true;
- this.pmImg3.skin = "res/imgs/result/icon_pmxj.png";
- }
- }
- }
- });
- }
- addEvent() {
- this.homeBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.resetBtn.on(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
- SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
- SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
- }
- removeEvent() {
- this.homeBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.resetBtn.off(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
- SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
- SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
- }
- KeyUp() {
- if (this.index > 1) {
- this.index--;
- }
- else {
- this.index = 2;
- }
- this.setSkin();
- }
- KeyDown() {
- if (this.index < 2) {
- this.index++;
- }
- else {
- this.index = 1;
- }
- this.setSkin();
- }
- KeyEnter() {
- switch (this.index) {
- case 1:
- this.index = 1;
- this.setSkin();
- Manager.view.homeView.show();
- Manager.view.hideGameView();
- Manager.view.hideResultView();
- break;
- case 2:
- this.index = 2;
- this.setSkin();
- core.SoundManager.stopMusic();
- Manager.view.gameView.resetGame();
- Manager.view.gameView.startGame();
- break;
- }
- Manager.view.hideResultView();
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.homeBtn:
- Manager.view.homeView.show();
- Manager.view.hideGameView();
- break;
- case this.resetBtn:
- core.SoundManager.stopMusic();
- Manager.view.gameView.resetGame();
- Manager.view.gameView.startGame();
- break;
- }
- Manager.view.hideResultView();
- }
- onkeydown(e) {
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.LEFT)) {
- this.KeyUp();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT)) {
- this.KeyDown();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
- this.KeyEnter();
- }
- }
- setSkin() {
- switch (this.index) {
- case 1:
- this.homeBtn.skin = "res/imgs/result/btom_bright.png";
- this.homeImg.skin = "res/imgs/result/text_an_fhb.png";
- this.resetBtn.skin = "res/imgs/result/btom_dark.png";
- this.resetImg.skin = "res/imgs/result/text_an_zld.png";
- break;
- case 2:
- this.homeBtn.skin = "res/imgs/result/btom_dark.png";
- this.homeImg.skin = "res/imgs/result/text_an_fhd.png";
- this.resetBtn.skin = "res/imgs/result/btom_bright.png";
- this.resetImg.skin = "res/imgs/result/text_an_zlb.png";
- break;
- }
- }
- updateInfo(data) {
- log("onGameEnd", data);
- this.caloriesTxt.text = `${data.consume}`;
- this.stepTxt.text = `${data.equivalent}`;
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- }
- destroy() {
- super.destroy();
- }
- show(socre, addScore, subSocre, highSocre, isScoreHigh = false, time) {
- this.setRank();
- this.scoreTxt.text = socre.toString();
- this.addScoreTxt.text = `+${addScore}`;
- this.subScoreTxt.text = `-${subSocre}`;
- this.timeTxt.text = time;
- Laya.stage.addChild(this);
- }
- }
- class PauseView extends game.ui.PauseViewUI {
- constructor() {
- super();
- this.index = 1;
- }
- onAwake() {
- super.onAwake();
- }
- onEnable() {
- super.onEnable();
- this.addEvent();
- this.index = 1;
- }
- addEvent() {
- this.continueBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.resetBtn.on(Laya.Event.CLICK, this, this.onClick);
- this.exitBtn.on(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
- SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
- SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
- }
- removeEvent() {
- this.continueBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.resetBtn.off(Laya.Event.CLICK, this, this.onClick);
- this.exitBtn.off(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
- SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
- SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
- SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
- }
- KeyUp() {
- if (this.index > 1) {
- this.index--;
- }
- else {
- this.index = 3;
- }
- this.setSkin();
- }
- KeyDown() {
- if (this.index < 3) {
- this.index++;
- }
- else {
- this.index = 1;
- }
- this.setSkin();
- }
- KeyEnter() {
- switch (this.index) {
- case 1:
- Manager.view.gameView.continueGame();
- break;
- case 2:
- core.SoundManager.stopMusic();
- Manager.view.gameView.resetGame();
- Manager.view.gameView.startGame();
- break;
- case 3:
- Manager.view.gameView.exitGame();
- break;
- }
- Manager.view.hidePauseViewView();
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.continueBtn:
- Manager.view.gameView.continueGame();
- break;
- case this.resetBtn:
- core.SoundManager.stopMusic();
- Manager.view.gameView.resetGame();
- Manager.view.gameView.startGame();
- break;
- case this.exitBtn:
- Manager.view.gameView.exitGame();
- break;
- }
- Manager.view.hidePauseViewView();
- }
- onkeydown(e) {
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.UP)) {
- this.KeyUp();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.DOWN)) {
- this.KeyDown();
- }
- if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
- this.KeyEnter();
- }
- }
- setSkin() {
- switch (this.index) {
- case 1:
- this.continueBtn.skin = "res/imgs/game/btom_bright.png";
- this.continueImg.skin = "res/imgs/game/text_jxb.png";
- this.resetBtn.skin = "res/imgs/game/btom_dark.png";
- this.resetImg.skin = "res/imgs/game/text_ckd.png";
- this.exitBtn.skin = "res/imgs/game/btom_dark.png";
- this.exitImg.skin = "res/imgs/game/text_tcd.png";
- break;
- case 2:
- this.continueBtn.skin = "res/imgs/game/btom_dark.png";
- this.continueImg.skin = "res/imgs/game/text_jxd.png";
- this.resetBtn.skin = "res/imgs/game/btom_bright.png";
- this.resetImg.skin = "res/imgs/game/text_ckb.png";
- this.exitBtn.skin = "res/imgs/game/btom_dark.png";
- this.exitImg.skin = "res/imgs/game/text_tcd.png";
- break;
- case 3:
- this.continueBtn.skin = "res/imgs/game/btom_dark.png";
- this.continueImg.skin = "res/imgs/game/text_jxd.png";
- this.resetBtn.skin = "res/imgs/game/btom_dark.png";
- this.resetImg.skin = "res/imgs/game/text_ckd.png";
- this.exitBtn.skin = "res/imgs/game/btom_bright.png";
- this.exitImg.skin = "res/imgs/game/text_tcb.png";
- break;
- }
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- }
- destroy() {
- super.destroy();
- }
- show() {
- Laya.stage.addChild(this);
- }
- }
- class SettingView extends game.ui.SettingViewUI {
- constructor() {
- super();
- }
- onAwake() {
- super.onAwake();
- }
- onEnable() {
- super.onEnable();
- this.addEvent();
- this.btnMusic.x = core.SoundManager.musicVolume * 366;
- this.btnSound.x = core.SoundManager.soundVolume * 366;
- this.musicBarMask.x = core.SoundManager.musicVolume * (this.musicBar.width) - (this.musicBar.width);
- this.soundBarMask.x = core.SoundManager.soundVolume * (this.soundBar.width) - (this.soundBar.width);
- this.musicTxt.text = Math.ceil(core.SoundManager.musicVolume * 100) + "%";
- this.soundTxt.text = Math.ceil(core.SoundManager.soundVolume * 100) + "%";
- }
- addEvent() {
- this.btnMusic.on(Laya.Event.MOUSE_DOWN, this, this.musicMouseDown);
- this.btnSound.on(Laya.Event.MOUSE_DOWN, this, this.soundMouseDown);
- this.closeBtn.on(Laya.Event.CLICK, this, this.onClick);
- }
- removeEvent() {
- this.btnMusic.off(Laya.Event.MOUSE_DOWN, this, this.musicMouseDown);
- this.btnSound.off(Laya.Event.MOUSE_DOWN, this, this.soundMouseDown);
- this.btnSound.off(Laya.Event.CLICK, this, this.onClick);
- this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
- Laya.stage.off(Laya.Event.MOUSE_UP, this, this.mouseUp);
- Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
- Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
- }
- musicMouseDown() {
- Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
- Laya.stage.on(Laya.Event.MOUSE_UP, this, this.mouseUp);
- }
- musicMousMove(e) {
- this.btnMusic.x = e.stageX - this.soundBar.x - this.bg.x;
- if (this.btnMusic.x <= 0)
- this.btnMusic.x = 0;
- if (this.btnMusic.x >= 366)
- this.btnMusic.x = 366;
- this.musicBarMask.x = this.btnMusic.x / 366 * (this.musicBar.width) - (this.musicBar.width);
- core.SoundManager.setMusicVolume(this.btnMusic.x / 366);
- this.musicTxt.text = Math.ceil(core.SoundManager.musicVolume * 100) + "%";
- }
- soundMouseDown() {
- Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
- Laya.stage.on(Laya.Event.MOUSE_UP, this, this.mouseUp);
- }
- soundMousMove(e) {
- this.btnSound.x = e.stageX - this.soundBar.x - this.bg.x;
- if (this.btnSound.x <= 0)
- this.btnSound.x = 0;
- if (this.btnSound.x >= 366)
- this.btnSound.x = 366;
- this.soundBarMask.x = this.btnSound.x / 366 * (this.soundBar.width) - (this.soundBar.width);
- core.SoundManager.setSoundVolume(this.btnSound.x / 366);
- this.soundTxt.text = Math.ceil(core.SoundManager.soundVolume * 100) + "%";
- }
- mouseUp() {
- Laya.stage.off(Laya.Event.MOUSE_UP, this, this.mouseUp);
- Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
- Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
- }
- onClick(e) {
- switch (e.currentTarget) {
- case this.closeBtn:
- Manager.view.homeView.show();
- Manager.view.hideSettingView();
- break;
- }
- }
- onDisable() {
- super.onDisable();
- this.removeEvent();
- this.destroy();
- }
- destroy() {
- super.destroy();
- }
- show() {
- Laya.stage.addChild(this);
- }
- }
- class ViewManager {
- get homeView() {
- if (!this._homeView)
- this._homeView = new HomeView();
- return this._homeView;
- }
- hideHomeView() {
- if (this._homeView)
- this._homeView.destroy();
- this._homeView = null;
- }
- get gameView() {
- if (!this._gameView)
- this._gameView = new GameView();
- return this._gameView;
- }
- hideGameView() {
- if (this._gameView)
- this._gameView.destroy();
- this._gameView = null;
- }
- get pauseViewView() {
- if (!this._pauseViewView)
- this._pauseViewView = new PauseView();
- return this._pauseViewView;
- }
- hidePauseViewView() {
- if (this._pauseViewView)
- this._pauseViewView.destroy();
- this._pauseViewView = null;
- }
- get resultView() {
- if (!this._resultView)
- this._resultView = new ResultView();
- return this._resultView;
- }
- hideResultView() {
- if (this._resultView)
- this._resultView.destroy();
- this._resultView = null;
- }
- get rankView() {
- if (!this._rankView)
- this._rankView = new RankView();
- return this._rankView;
- }
- hideRankView() {
- if (this._rankView)
- this._rankView.destroy();
- this._rankView = null;
- }
- get settingView() {
- if (!this._settingView)
- this._settingView = new SettingView();
- return this._settingView;
- }
- hideSettingView() {
- if (this._settingView)
- this._settingView.destroy();
- this._settingView = null;
- }
- }
- class Manager {
- static init() {
- this.view = new ViewManager();
- this.model = new Model();
- this.dataManager = new DataManager();
- this.initFont();
- }
- static initFont() {
- let fonts = Path.fonts;
- for (let i = 0, len = fonts.length; i < len; i++) {
- let font = fonts[i];
- core.FontUtil.registerFont(font.name, font.fntURL, font.pngURL);
- }
- }
- }
- 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;
- 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() {
- this.initManager();
- }
- initManager() {
- core.Manager.init(core.GameID.PARKOUR, Laya.Handler.create(this, this.preload));
- }
- preload() {
- LoadingView.instance.preLoad(Laya.Handler.create(this, () => {
- var div = document.getElementById("engineLoading");
- if (div)
- div.parentNode.removeChild(div);
- LoadingView.instance.show();
- Laya.loader.load(Path.preLoadUrls, Laya.Handler.create(this, this.loadComplete), Laya.Handler.create(this, this.onLoading, null, false), null, 1, true, 'preload');
- }));
- }
- onLoading(progress, isReset = false) {
- LoadingView.instance.setProgress(progress, isReset);
- }
- loadComplete() {
- Manager.init();
- Manager.model.init();
- }
- startGame() {
- Manager.view.homeView.show();
- }
- }
- new Main();
- log = function (message, ...args) { };
- }());
|