bundle.js 205 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366
  1. (function () {
  2. 'use strict';
  3. class ObjectUtil {
  4. constructor() { }
  5. static hitTest(sprite1, sprite2) {
  6. if (sprite1 == null || sprite2 == null)
  7. return false;
  8. if (sprite1.texture == null || sprite2.texture == null)
  9. return false;
  10. log('hittest1');
  11. let pos = sprite1.localToGlobal(Laya.Point.create());
  12. for (let w = 0; w < sprite1.width; w++) {
  13. for (let h = 0; h < sprite1.height; h++) {
  14. let pixels = sprite1.texture.getPixels(w, h, 1, 1);
  15. if (pixels) {
  16. log('hittest', pixels);
  17. if (pixels.join('') != '0000' && this.pointHitTest(sprite2, pos.x + w, pos.y + h))
  18. return true;
  19. }
  20. }
  21. }
  22. return false;
  23. }
  24. static pointHitTest(sprite, x, y) {
  25. if (sprite == null)
  26. return false;
  27. if (sprite.texture == null)
  28. return false;
  29. log('pointHitTest');
  30. let pos = sprite.localToGlobal(Laya.Point.create());
  31. let tempX = Math.floor(x - pos.x);
  32. let tempY = Math.floor(y - pos.y);
  33. let texture = sprite.texture;
  34. if (tempX < 0 || tempX >= texture.width || tempY < 0 || tempY >= texture.height)
  35. return false;
  36. let pixels = texture.getPixels(tempX, tempY, 1, 1);
  37. log('pointHitTestttt', pixels);
  38. if (pixels) {
  39. if (pixels.join('') != '0000')
  40. return true;
  41. }
  42. return false;
  43. }
  44. static dynamicChangePivot(sp, anchorV) {
  45. if (!sp || !anchorV || anchorV.length != 2)
  46. return;
  47. var prePX = sp.pivotX;
  48. var prePY = sp.pivotY;
  49. var aimPX = anchorV[0] * sp.width;
  50. var aimPY = anchorV[1] * sp.height;
  51. sp.x += (aimPX - prePX);
  52. sp.y += (aimPY - prePY);
  53. sp.pivot(aimPX, aimPY);
  54. }
  55. }
  56. class ButtonScript extends Laya.Script {
  57. constructor() {
  58. super(...arguments);
  59. this.shakeCtr = true;
  60. }
  61. onMouseDown() {
  62. this._mouseDown = true;
  63. Laya.Tween.to(this.owner, { scaleX: 1.2, scaleY: 1.2 }, 200, Laya.Ease.backOut, null, null, false);
  64. }
  65. onMouseUp(e) {
  66. this._mouseDown = false;
  67. Laya.Tween.to(this.owner, { scaleX: 1, scaleY: 1 }, 200, Laya.Ease.elasticOut, null, null, false);
  68. }
  69. onMouseOut() {
  70. if (this._mouseDown) {
  71. this._mouseDown = false;
  72. Laya.Tween.to(this.owner, { scaleX: 1, scaleY: 1 }, 200, Laya.Ease.elasticOut, null, null, false);
  73. }
  74. }
  75. onAwake() {
  76. if (!this.owner || !this.anchorV || !this.anchorH)
  77. return;
  78. let sp = this.owner;
  79. ObjectUtil.dynamicChangePivot(sp, [this.anchorH, this.anchorV]);
  80. }
  81. onEnable() {
  82. super.onEnable();
  83. if (this.needShake) {
  84. this.originScaleX = this.owner.scaleX;
  85. this.originScaleY = this.owner.scaleY;
  86. this.shakeTimer();
  87. }
  88. }
  89. shakeTimer() {
  90. if (!this.shakeTimeLine) {
  91. this.shakeTimeLine = new core.TweenTimeLine(1, Laya.Handler.create(this, this.shakeTimer));
  92. this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX * 1.1, scaleY: this.originScaleY * 0.9 }, 200, Laya.Ease.circInOut);
  93. this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX, scaleY: this.originScaleY }, 200, Laya.Ease.circInOut);
  94. this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX * 1.1, scaleY: this.originScaleY * 0.9 }, 200, Laya.Ease.circInOut);
  95. this.shakeTimeLine.addToTween(this.owner, { scaleX: this.originScaleX, scaleY: this.originScaleY }, 200, Laya.Ease.circInOut);
  96. this.shakeTimeLine.start();
  97. this.shakeTimeLine.pause();
  98. Laya.timer.once(Math.ceil(4 * Math.random()) * 1000, this, this.playShakeAni);
  99. }
  100. else {
  101. this.shakeTimeLine.destroy();
  102. this.shakeTimeLine = null;
  103. this.shakeTimer();
  104. }
  105. }
  106. playShakeAni() {
  107. if (this.shakeCtr)
  108. this.shakeTimeLine.resume();
  109. }
  110. onDisable() {
  111. if (this.shakeTimeLine)
  112. this.shakeTimeLine.destroy();
  113. this.shakeTimeLine = null;
  114. Laya.timer.clearAll(this);
  115. super.onDisable();
  116. }
  117. }
  118. var View = Laya.View;
  119. var Scene = Laya.Scene;
  120. var REG = Laya.ClassUtils.regClass;
  121. var game;
  122. (function (game) {
  123. var ui;
  124. (function (ui) {
  125. class GameViewUI extends View {
  126. constructor() { super(); }
  127. createChildren() {
  128. super.createChildren();
  129. this.createView(GameViewUI.uiView);
  130. }
  131. }
  132. 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": [] };
  133. ui.GameViewUI = GameViewUI;
  134. REG("game.ui.GameViewUI", GameViewUI);
  135. class HomeViewUI extends View {
  136. constructor() { super(); }
  137. createChildren() {
  138. super.createChildren();
  139. this.createView(HomeViewUI.uiView);
  140. }
  141. }
  142. 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": [] };
  143. ui.HomeViewUI = HomeViewUI;
  144. REG("game.ui.HomeViewUI", HomeViewUI);
  145. class PauseViewUI extends View {
  146. constructor() { super(); }
  147. createChildren() {
  148. super.createChildren();
  149. this.createView(PauseViewUI.uiView);
  150. }
  151. }
  152. 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": [] };
  153. ui.PauseViewUI = PauseViewUI;
  154. REG("game.ui.PauseViewUI", PauseViewUI);
  155. class RankItemUI extends View {
  156. constructor() { super(); }
  157. createChildren() {
  158. super.createChildren();
  159. this.createView(RankItemUI.uiView);
  160. }
  161. }
  162. 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": [] };
  163. ui.RankItemUI = RankItemUI;
  164. REG("game.ui.RankItemUI", RankItemUI);
  165. class RankViewUI extends View {
  166. constructor() { super(); }
  167. createChildren() {
  168. super.createChildren();
  169. this.createView(RankViewUI.uiView);
  170. }
  171. }
  172. 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": [] };
  173. ui.RankViewUI = RankViewUI;
  174. REG("game.ui.RankViewUI", RankViewUI);
  175. class ResultViewUI extends View {
  176. constructor() { super(); }
  177. createChildren() {
  178. super.createChildren();
  179. this.createView(ResultViewUI.uiView);
  180. }
  181. }
  182. 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": [] };
  183. ui.ResultViewUI = ResultViewUI;
  184. REG("game.ui.ResultViewUI", ResultViewUI);
  185. class SettingViewUI extends View {
  186. constructor() { super(); }
  187. createChildren() {
  188. super.createChildren();
  189. this.createView(SettingViewUI.uiView);
  190. }
  191. }
  192. 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": [] };
  193. ui.SettingViewUI = SettingViewUI;
  194. REG("game.ui.SettingViewUI", SettingViewUI);
  195. })(ui = game.ui || (game.ui = {}));
  196. })(game || (game = {}));
  197. (function (game) {
  198. var ui;
  199. (function (ui) {
  200. var res;
  201. (function (res) {
  202. class PropItemUI extends Scene {
  203. constructor() { super(); }
  204. createChildren() {
  205. super.createChildren();
  206. this.createView(PropItemUI.uiView);
  207. }
  208. }
  209. PropItemUI.uiView = { "type": "Scene", "props": { "width": 240, "height": 240 }, "loadList": [], "loadList3D": [] };
  210. res.PropItemUI = PropItemUI;
  211. REG("game.ui.res.PropItemUI", PropItemUI);
  212. })(res = ui.res || (ui.res = {}));
  213. })(ui = game.ui || (game.ui = {}));
  214. })(game || (game = {}));
  215. (function (game) {
  216. var ui;
  217. (function (ui) {
  218. var res;
  219. (function (res) {
  220. var scenes;
  221. (function (scenes) {
  222. class LoadingViewUI extends View {
  223. constructor() { super(); }
  224. createChildren() {
  225. super.createChildren();
  226. this.createView(LoadingViewUI.uiView);
  227. }
  228. }
  229. 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": [] };
  230. scenes.LoadingViewUI = LoadingViewUI;
  231. REG("game.ui.res.scenes.LoadingViewUI", LoadingViewUI);
  232. })(scenes = res.scenes || (res.scenes = {}));
  233. })(res = ui.res || (ui.res = {}));
  234. })(ui = game.ui || (game.ui = {}));
  235. })(game || (game = {}));
  236. class RankItem extends game.ui.RankItemUI {
  237. constructor() {
  238. super();
  239. }
  240. onEnable() {
  241. super.onEnable();
  242. }
  243. set dataSource(value) {
  244. if (!value)
  245. return;
  246. this.index = value.index;
  247. this.name = value.name;
  248. this.gender = value.gender;
  249. this.avatar = value.avatar;
  250. this.score = value.score;
  251. this.rank = value.rank;
  252. this.updataView();
  253. }
  254. updataView() {
  255. if (this.rank == 1) {
  256. this.winImg.skin = "res/imgs/rank/icon_diyi.png";
  257. this.winImg.visible = true;
  258. this.rankTxt.visible = false;
  259. this.scoreTxt.color = "#ff9005";
  260. this.scoreTxt1.color = "#ff9005";
  261. }
  262. else if (this.rank == 2) {
  263. this.winImg.skin = "res/imgs/rank/icon_dier.png";
  264. this.winImg.visible = true;
  265. this.rankTxt.visible = false;
  266. this.scoreTxt.color = "#ff9005";
  267. this.scoreTxt1.color = "#ff9005";
  268. }
  269. else if (this.rank == 3) {
  270. this.winImg.skin = "res/imgs/rank/icon_disan.png";
  271. this.winImg.visible = true;
  272. this.rankTxt.visible = false;
  273. this.scoreTxt.color = "#ff9005";
  274. this.scoreTxt1.color = "#ff9005";
  275. }
  276. else {
  277. this.scoreTxt.color = "#000000";
  278. this.scoreTxt1.color = "#000000";
  279. this.winImg.visible = false;
  280. this.rankTxt.visible = true;
  281. this.rankTxt.value = this.rank.toString();
  282. }
  283. this.nameTxt.text = this.name;
  284. this.scoreTxt.text = this.score.toString();
  285. if (this.avatar)
  286. this.avatarImg.skin = this.avatar;
  287. }
  288. onDisable() {
  289. super.onDisable();
  290. }
  291. destroy() {
  292. super.destroy();
  293. }
  294. }
  295. class GameConfig {
  296. constructor() { }
  297. static init() {
  298. var reg = Laya.ClassUtils.regClass;
  299. reg("game/script/ButtonScript.ts", ButtonScript);
  300. reg("game/view/common/RankItem.ts", RankItem);
  301. }
  302. }
  303. GameConfig.width = 1920;
  304. GameConfig.height = 1080;
  305. GameConfig.scaleMode = "fixedauto";
  306. GameConfig.screenMode = "horizontal";
  307. GameConfig.alignV = "middle";
  308. GameConfig.alignH = "center";
  309. GameConfig.startScene = "GameView.scene";
  310. GameConfig.sceneRoot = "";
  311. GameConfig.debug = true;
  312. GameConfig.stat = false;
  313. GameConfig.physicsDebug = false;
  314. GameConfig.exportSceneToJson = false;
  315. GameConfig.init();
  316. class Path {
  317. static getSound(name) {
  318. return "res/sound/" + name + ".mp3";
  319. }
  320. static getGameUI(name) {
  321. return "res/imgs/game/" + name + ".png";
  322. }
  323. }
  324. Path.fonts = [];
  325. Path.preLoadUrls = [
  326. "res/atlas/res/imgs/game.atlas",
  327. "res/atlas/res/imgs/game.png",
  328. "res/atlas/res/home.atlas",
  329. "res/atlas/res/home.png",
  330. "res/atlas/res/imgs/rank.atlas",
  331. "res/atlas/res/imgs/rank.png",
  332. "res/atlas/res/imgs/result.atlas",
  333. "res/atlas/res/imgs/result.png",
  334. "res/atlas/res/imgs/game/bg.atlas",
  335. "res/atlas/res/imgs/game/bg.png",
  336. "res/json/LevelConfig1.json",
  337. "res/json/LevelConfig2.json",
  338. "res/json/LevelConfig3.json",
  339. "res/ani/Shield_after.sk",
  340. "res/ani/Shield_after.png",
  341. "res/ani/nv2.sk",
  342. "res/ani/nv2.png",
  343. "res/ani/Coin.sk",
  344. "res/ani/Coin.png",
  345. "res/ani/nv22.png",
  346. "res/ani/nv23.png",
  347. "res/ani/nv24.png",
  348. "res/ani/nv25.png",
  349. "res/ani/nv26.png",
  350. "res/ani/nv27.png",
  351. "res/ani/nv28.png",
  352. "res/ani/nv29.png",
  353. "res/ani/nv210.png",
  354. "res/ani/nv211.png",
  355. "res/ani/nv212.png",
  356. "res/ani/nv213.png",
  357. "res/ani/nv214.png",
  358. "res/ani/nv215.png",
  359. "res/ani/nv216.png",
  360. "res/ani/nv217.png",
  361. "res/ani/nv218.png",
  362. "res/ani/gold.atlas",
  363. "res/ani/gold.png",
  364. "res/ani/board_glow.sk",
  365. "res/ani/board_glow.png",
  366. "res/ani/boom.atlas",
  367. "res/ani/boom.png",
  368. "res/ani/boomAni.atlas",
  369. "res/ani/boomAni.png",
  370. "res/home/bj_sy.jpg",
  371. "res/home/difficulty_1.png",
  372. "res/home/juese.png",
  373. "res/home/logo.png",
  374. "res/home/msxz_1.png",
  375. "res/home/normal_1.png",
  376. "res/home/simple_1.png",
  377. "res/imgs/game/bg/bg.jpg",
  378. "res/imgs/game/bg/pd.png",
  379. "res/imgs/game/bg/wpydd.png",
  380. "res/imgs/game/bg_ksjs.png",
  381. "res/imgs/game/text_finsh.png",
  382. "res/imgs/result/bg_js.png",
  383. "res/imgs/result/bg_js_bjdf.png",
  384. "res/imgs/result/bg_js_sjbd.png",
  385. "res/imgs/result/jsfgx.png",
  386. "res/imgs/rank/bg_ph.png",
  387. "res/imgs/rank/bg_ph.png",
  388. "res/imgs/rank/bg_ph.png",
  389. "res/imgs/rank/bg_phbhl.png",
  390. "res/imgs/rank/bg_phbsl.png",
  391. "res/imgs/rank/bg_wdph.png",
  392. ];
  393. Path.preLoadUrls2 = [];
  394. Path.sound = {
  395. readyGo: "readygo",
  396. bgm: "bgm",
  397. combo: "combo",
  398. jump: "jump"
  399. };
  400. const _delay = 1000 / 60.0;
  401. 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",
  402. "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",
  403. "down", "jump", "rssi", "timestamp", "right step", "left step", "rssi mobile"];
  404. var CMD;
  405. (function (CMD) {
  406. CMD[CMD["NONE_INTERATION"] = 2000] = "NONE_INTERATION";
  407. CMD[CMD["FRONT_LEFT"] = 2001] = "FRONT_LEFT";
  408. CMD[CMD["FRONT_RIGHT"] = 2002] = "FRONT_RIGHT";
  409. CMD[CMD["BACK_LEFT"] = 2003] = "BACK_LEFT";
  410. CMD[CMD["BACK_RIGHT"] = 2004] = "BACK_RIGHT";
  411. CMD[CMD["ENTER_KEY"] = 2005] = "ENTER_KEY";
  412. CMD[CMD["CANCLE_KEY"] = 2006] = "CANCLE_KEY";
  413. })(CMD || (CMD = {}));
  414. var MOTION;
  415. (function (MOTION) {
  416. MOTION[MOTION["MOTION_STOP"] = 0] = "MOTION_STOP";
  417. MOTION[MOTION["MOTION_RUN"] = 1] = "MOTION_RUN";
  418. MOTION[MOTION["MOTION_JUMP"] = 2] = "MOTION_JUMP";
  419. MOTION[MOTION["MOTION_DOWN"] = 3] = "MOTION_DOWN";
  420. MOTION[MOTION["MOTION_LEFT"] = 4] = "MOTION_LEFT";
  421. MOTION[MOTION["MOTION_RIGHT"] = 5] = "MOTION_RIGHT";
  422. MOTION[MOTION["MOTION_FRONT"] = 6] = "MOTION_FRONT";
  423. MOTION[MOTION["MOTION_BACK"] = 7] = "MOTION_BACK";
  424. MOTION[MOTION["MOTION_LEFT_UP"] = 8] = "MOTION_LEFT_UP";
  425. MOTION[MOTION["MOTION_LEFT_DOWN"] = 9] = "MOTION_LEFT_DOWN";
  426. MOTION[MOTION["MOTION_RIGHT_UP"] = 10] = "MOTION_RIGHT_UP";
  427. MOTION[MOTION["MOTION_RIGHT_DOWN"] = 11] = "MOTION_RIGHT_DOWN";
  428. MOTION[MOTION["MOTION_STEP"] = 12] = "MOTION_STEP";
  429. MOTION[MOTION["MOTION_JUMP_OC"] = 13] = "MOTION_JUMP_OC";
  430. MOTION[MOTION["MOTION_JUMP_VERTICAL"] = 14] = "MOTION_JUMP_VERTICAL";
  431. MOTION[MOTION["MOTION_ROCK"] = 15] = "MOTION_ROCK";
  432. MOTION[MOTION["MOTION_SCISSORS"] = 16] = "MOTION_SCISSORS";
  433. MOTION[MOTION["MOTION_PAPER"] = 17] = "MOTION_PAPER";
  434. MOTION[MOTION["MOTION_STRETCH_LEFT"] = 18] = "MOTION_STRETCH_LEFT";
  435. MOTION[MOTION["MOTION_LIFT_LEFT"] = 19] = "MOTION_LIFT_LEFT";
  436. MOTION[MOTION["MOTION_STRETCH_RIGHT"] = 20] = "MOTION_STRETCH_RIGHT";
  437. MOTION[MOTION["MOTION_LIFT_RIGHT"] = 21] = "MOTION_LIFT_RIGHT";
  438. MOTION[MOTION["MOTION_STRETCH_FRONT_LEFT"] = 22] = "MOTION_STRETCH_FRONT_LEFT";
  439. MOTION[MOTION["MOTION_STRETCH_FRONT_RIGHT"] = 23] = "MOTION_STRETCH_FRONT_RIGHT";
  440. MOTION[MOTION["MOTION_DOWN_FRONT"] = 24] = "MOTION_DOWN_FRONT";
  441. MOTION[MOTION["NUMBERS_OF_MOTION"] = 25] = "NUMBERS_OF_MOTION";
  442. })(MOTION || (MOTION = {}));
  443. var STEP;
  444. (function (STEP) {
  445. STEP[STEP["FREQ"] = 1000] = "FREQ";
  446. })(STEP || (STEP = {}));
  447. class Subscriber {
  448. constructor(target, fn) {
  449. this._target = target;
  450. this._fn = fn;
  451. }
  452. }
  453. class _SDK {
  454. constructor() {
  455. this._ver = 1;
  456. this._events = {};
  457. this._motion = [0, 0, 0, 0];
  458. this._motionTime = [0, 0, 0, 0];
  459. this._stepFreq = 0;
  460. this._stepCount = 0;
  461. this._responseCallMap = { string: Function };
  462. this._inited = false;
  463. }
  464. callback(name, args) {
  465. console.log("callback " + name + " " + args);
  466. const func = this._responseCallMap[name];
  467. if (func)
  468. func.call(func, args);
  469. }
  470. isMotion(index, delay) {
  471. let ts = new Date();
  472. let result = (this._motion[index] > 0) && (ts.getTime() - this._motionTime[index]) <= delay;
  473. if (result) {
  474. this._motion[index] = 0;
  475. }
  476. return result;
  477. }
  478. isLeftFootDown(delay = _delay) {
  479. return this.isMotion(0, delay);
  480. }
  481. isRightFootDown(delay = _delay) {
  482. return this.isMotion(1, delay);
  483. }
  484. getCmd() {
  485. let result = this._cmd;
  486. if (result > 0) {
  487. this._cmd = 0;
  488. }
  489. return result;
  490. }
  491. cmd(id, v0) {
  492. this._cmd = v0 + CMD.NONE_INTERATION;
  493. let ts = new Date().getTime();
  494. if (ts - this._cmdTime < 500)
  495. return;
  496. this._cmdTime = ts;
  497. console.log("cmd set " + v0 + " " + (this._cmd));
  498. this.emit((this._cmd).toString(), ts);
  499. }
  500. getMotion() {
  501. return this._motion;
  502. }
  503. motion(type, id, v0, v1, v2, v3) {
  504. this._motion[0] = v0;
  505. this._motion[1] = v1;
  506. this._motion[2] = v2;
  507. this._motion[3] = v3;
  508. console.log("motion set " + this._motion);
  509. let now = new Date();
  510. let ts = now.getTime();
  511. let arr = this._motion;
  512. for (let i = 0; i < arr.length; i++) {
  513. if (arr[i] > 0) {
  514. if (ts - this._motionTime[i] < 10)
  515. continue;
  516. this._motionTime[i] = ts;
  517. let motionIndex = arr[i];
  518. let motion = motionIndex.toString();
  519. this.emit(motion, ts);
  520. console.log("motion set " + motionIndex + " -> " + motion + " " + MOTION[motionIndex]);
  521. }
  522. }
  523. }
  524. getStepFreq() {
  525. return this._stepFreq;
  526. }
  527. getStepCount() {
  528. return this._stepCount;
  529. }
  530. getVelocity() {
  531. return this._velocity;
  532. }
  533. stepFreq(freq) {
  534. this._stepFreq = freq;
  535. console.log("step freq " + freq);
  536. this.emit(STEP.FREQ.toString(), freq);
  537. }
  538. step(freq, count) {
  539. this.stepFreq(freq);
  540. this._stepCount = count;
  541. console.log("step count " + count);
  542. }
  543. stepData(freq, count, velocity) {
  544. this.stepFreq(freq);
  545. this._stepCount = count;
  546. this._velocity = velocity;
  547. }
  548. emit(subscriber, ...args) {
  549. let callbackList = this._events[subscriber] || [];
  550. if (callbackList.length > 0) {
  551. console.log("motion emit " + subscriber + ", " + callbackList.length);
  552. callbackList.forEach(item => item._fn.apply(item._target || item._fn, args));
  553. }
  554. return this;
  555. }
  556. on(subscriber, callback, target) {
  557. if (!this._inited) {
  558. this._inited = true;
  559. this.onSdkLoaded();
  560. }
  561. let callbackList = this._events[subscriber] || [];
  562. callback && callbackList.push(new Subscriber(target || this, callback));
  563. console.log("motion set on " + subscriber + ", " + callbackList.length);
  564. this._events[subscriber] = callbackList;
  565. return this;
  566. }
  567. once(subscriber, callback, target) {
  568. let decor = (...args) => {
  569. callback && callback.apply(target || this, args);
  570. this.off(subscriber, decor);
  571. };
  572. this.on(subscriber, decor);
  573. return this;
  574. }
  575. off(subscriber, callback) {
  576. let callbackList = this._events[subscriber] || [];
  577. this._events[subscriber] = callbackList.filter(item => item._fn !== callback);
  578. return this;
  579. }
  580. remove(subscriber, callback) {
  581. this._events[subscriber] = [];
  582. callback && callback();
  583. return this;
  584. }
  585. onSdkLoaded() {
  586. this._callsdk("onLoad", { ver: this._ver });
  587. }
  588. onBackPressed(foot = false) {
  589. this._callsdk("onBackPressed", { foot: foot });
  590. }
  591. onGameStart() {
  592. this._stepFreq = 0;
  593. this._stepCount = 0;
  594. this._callsdk("onGameStart", {});
  595. }
  596. onGameEnd(level = 0, score = 0.0, record = 0, mode = 0, opponentId = 0, callback) {
  597. if (callback) {
  598. let method = "onGameEnd_callback";
  599. this._responseCallMap[method] = callback;
  600. }
  601. this._callsdk("onGameEnd", { level: level, score: score, record: record, mode: mode, opponentId: opponentId });
  602. }
  603. getUserInfo(callback) {
  604. let method = "getUserInfo_callback";
  605. this._responseCallMap[method] = callback;
  606. this._callsdk(method, { callback: method });
  607. }
  608. getRank(type, callback) {
  609. let method = "getRank_callback";
  610. this._responseCallMap[method] = callback;
  611. this._callsdk(method, { callback: method, type: type });
  612. }
  613. vibrate(duration, leftOrRight = 0) {
  614. let method = "vibrate";
  615. this._callsdk(method, { duration: duration, leftOrRight: leftOrRight });
  616. }
  617. openGameData(open, gameDataCallback) {
  618. this._gameDataCallback = gameDataCallback;
  619. this._callsdk("openGameData", { open: open });
  620. }
  621. gameData(args) {
  622. if (this._gameDataCallback)
  623. this._gameDataCallback.call(this._gameDataCallback, args);
  624. }
  625. _callsdk(method, args) {
  626. console.log("sdk call " + method);
  627. if (window["SDKBridge"])
  628. window["SDKBridge"].postMessage(JSON.stringify({ method: method, args: args }));
  629. }
  630. }
  631. const SDK = new _SDK();
  632. window.SHOES_SDK = SDK;
  633. class LoadingView extends game.ui.res.scenes.LoadingViewUI {
  634. constructor() {
  635. super();
  636. this._baseProgress = 0;
  637. this._targetProgress = 1;
  638. this._curProgress = 0;
  639. this.loadingPreload = [
  640. "res/home/bj_sy.jpg",
  641. 'res/home/juese.png',
  642. 'res/home/progress0.png',
  643. 'res/home/progress1.png',
  644. ];
  645. this.size(Laya.stage.width, Laya.stage.height);
  646. }
  647. static get instance() {
  648. if (!this._instance)
  649. this._instance = new LoadingView();
  650. return this._instance;
  651. }
  652. onAwake() {
  653. super.onAwake();
  654. core.SoundManager.setMusicVolume(.7);
  655. core.SoundManager.setSoundVolume(.7);
  656. }
  657. onEnable() {
  658. super.onEnable();
  659. }
  660. preLoad(callBack) {
  661. Laya.loader.load(this.loadingPreload, Laya.Handler.create(this, () => {
  662. callBack.run();
  663. }));
  664. }
  665. setProgress(value, isReset = false) {
  666. let cur = this._baseProgress + (this._targetProgress - this._baseProgress) * value;
  667. if (!isReset && cur < this._curProgress)
  668. return;
  669. this._curProgress = cur;
  670. this.loadingBar.width = this._curProgress * 1258;
  671. this.loadingTxt.text = Math.floor(this._curProgress * 100) + "%";
  672. if (window.platform && this._curProgress < 1)
  673. platform.progress({ percent: Math.floor(this._curProgress * 100) });
  674. }
  675. show() {
  676. if (!this.parent) {
  677. Laya.stage.addChild(this);
  678. }
  679. }
  680. hide() {
  681. if (this.parent)
  682. LoadingView._instance.destroy();
  683. LoadingView._instance = null;
  684. }
  685. onDisable() {
  686. super.onDisable();
  687. }
  688. destroy() {
  689. this.loadingPreload = null;
  690. super.destroy();
  691. if (window.platform)
  692. platform.progress({ percent: 100 });
  693. }
  694. }
  695. class Model extends Laya.EventDispatcher {
  696. constructor() {
  697. super();
  698. this.initW = 1920;
  699. this.initH = 1080;
  700. this.gameTime = 3 * 60 * 1000;
  701. this.onceAddSpeed = 100;
  702. this.forwordSpeed = 10;
  703. this.forwordSpeedMax = 6;
  704. this.backSpeed = 15;
  705. this.addSpeed = 1;
  706. this.runCountTime = 100;
  707. this.jumpCountTime = 1500;
  708. this.onceAddJump = 270;
  709. this.jumpSpeed = 15;
  710. this.jumpCount = 0;
  711. this.onceTime = 55;
  712. this.isStarGame = false;
  713. this.isPlaying = false;
  714. this.selfInfo = { "id": 1, "nickname": "昵称最多七个字", "gender": 1, "avatar": "" };
  715. }
  716. init() {
  717. Laya.SoundManager.useAudioMusic = false;
  718. this.getAllHighScoreData();
  719. this.getLevel1HighScoreData();
  720. this.getLevel2HighScoreData();
  721. this.getLevel3HighScoreData();
  722. if (!window["SDKBridge"]) {
  723. Manager.view.homeView.show();
  724. LoadingView.instance.hide();
  725. }
  726. else {
  727. SDK.getUserInfo((info) => {
  728. this.selfInfo = info;
  729. log("selfInfo", info);
  730. Manager.view.homeView.show();
  731. LoadingView.instance.hide();
  732. });
  733. }
  734. }
  735. reset() {
  736. this.score = 0;
  737. }
  738. getAllHighScoreData() {
  739. this.allHighScoreData = Laya.LocalStorage.getJSON("JumpallHighScoreData");
  740. if (!this.allHighScoreData) {
  741. this.setAllHighSocreData(0);
  742. }
  743. log('获取总最高分数', this.allHighScoreData);
  744. }
  745. setAllHighSocreData(num) {
  746. this.allHighScoreData = num;
  747. this.saveALlHighSocreData();
  748. }
  749. saveALlHighSocreData() {
  750. Laya.LocalStorage.setJSON("JumpallHighScoreData", this.allHighScoreData);
  751. }
  752. getLevel1HighScoreData() {
  753. this.level1HighScoreData = Laya.LocalStorage.getJSON("Jumplevel1HighScoreData");
  754. if (!this.level1HighScoreData) {
  755. this.setLevel1HighSocreData(0);
  756. }
  757. log('获取简单模式最高分数', this.level1HighScoreData);
  758. }
  759. setLevel1HighSocreData(num) {
  760. this.level1HighScoreData = num;
  761. this.saveLevel1HighSocreData();
  762. if (num > this.allHighScoreData)
  763. this.setAllHighSocreData(num);
  764. }
  765. saveLevel1HighSocreData() {
  766. Laya.LocalStorage.setJSON("Jumplevel1HighScoreData", this.level1HighScoreData);
  767. }
  768. getLevel2HighScoreData() {
  769. this.level2HighScoreData = Laya.LocalStorage.getJSON("Jumplevel2HighScoreData");
  770. if (!this.level2HighScoreData) {
  771. this.setLevel2HighSocreData(0);
  772. }
  773. log('获取简单模式最高分数', this.level2HighScoreData);
  774. }
  775. setLevel2HighSocreData(num) {
  776. this.level2HighScoreData = num;
  777. this.saveLevel2HighSocreData();
  778. if (num > this.allHighScoreData)
  779. this.setAllHighSocreData(num);
  780. }
  781. saveLevel2HighSocreData() {
  782. Laya.LocalStorage.setJSON("Jumplevel2HighScoreData", this.level2HighScoreData);
  783. }
  784. getLevel3HighScoreData() {
  785. this.level3HighScoreData = Laya.LocalStorage.getJSON("Jumplevel3HighScoreData");
  786. if (!this.level3HighScoreData) {
  787. this.setLevel3HighSocreData(0);
  788. }
  789. log('获取简单模式最高分数', this.level3HighScoreData);
  790. }
  791. setLevel3HighSocreData(num) {
  792. this.level3HighScoreData = num;
  793. this.saveLevel3HighSocreData();
  794. if (num > this.allHighScoreData)
  795. this.setAllHighSocreData(num);
  796. }
  797. saveLevel3HighSocreData() {
  798. Laya.LocalStorage.setJSON("Jumplevel3HighScoreData", this.level3HighScoreData);
  799. }
  800. }
  801. class DataManager {
  802. constructor() {
  803. this.levelConfig1 = [];
  804. this.levelConfig2 = [];
  805. this.levelConfig3 = [];
  806. this.init();
  807. }
  808. init() {
  809. Laya.loader.load("res/json/LevelConfig1.json", Laya.Handler.create(this, this.getLevelConfig1));
  810. Laya.loader.load("res/json/LevelConfig2.json", Laya.Handler.create(this, this.getLevelConfig2));
  811. Laya.loader.load("res/json/LevelConfig3.json", Laya.Handler.create(this, this.getLevelConfig3));
  812. this.levelConfig1 = Laya.loader.getRes("res/json/LevelConfig1.json");
  813. this.levelConfig2 = Laya.loader.getRes("res/json/LevelConfig2.json");
  814. this.levelConfig3 = Laya.loader.getRes("res/json/LevelConfig3.json");
  815. }
  816. getLevelConfig(gameType, id) {
  817. let levelConfig;
  818. if (gameType == 1)
  819. levelConfig = this.levelConfig1;
  820. else if (gameType == 2)
  821. levelConfig = this.levelConfig2;
  822. else if (gameType == 3)
  823. levelConfig = this.levelConfig3;
  824. for (let i = levelConfig.length - 1; i >= 0; i--) {
  825. if (levelConfig[i].id == id)
  826. return levelConfig[i];
  827. }
  828. return null;
  829. }
  830. getLevelConfig1() {
  831. this.goldCountArr1 = [];
  832. for (let i = 0; i < this.levelConfig1.length; i++) {
  833. if (this.levelConfig1[i].indexArr >= this.goldCountArr1.length) {
  834. for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
  835. if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
  836. if (!this.goldCountArr1[this.levelConfig1[i].indexArr - 1])
  837. this.goldCountArr1[this.levelConfig1[i].indexArr - 1] = 0;
  838. this.goldCountArr1[this.levelConfig1[i].indexArr - 1]++;
  839. }
  840. }
  841. }
  842. }
  843. log("goldCountArr1", this.goldCountArr1);
  844. }
  845. getLevelConfig2() {
  846. this.goldCountArr2 = [];
  847. for (let i = 0; i < this.levelConfig1.length; i++) {
  848. if (this.levelConfig1[i].indexArr >= this.goldCountArr2.length) {
  849. for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
  850. if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
  851. if (!this.goldCountArr2[this.levelConfig1[i].indexArr - 1])
  852. this.goldCountArr2[this.levelConfig1[i].indexArr - 1] = 0;
  853. this.goldCountArr2[this.levelConfig1[i].indexArr - 1]++;
  854. }
  855. }
  856. }
  857. }
  858. log("goldCountArr2", this.goldCountArr2);
  859. }
  860. getLevelConfig3(id) {
  861. this.goldCountArr3 = [];
  862. for (let i = 0; i < this.levelConfig1.length; i++) {
  863. if (this.levelConfig1[i].indexArr >= this.goldCountArr3.length) {
  864. for (let j = 0; j < this.levelConfig1[i].type.length; j++) {
  865. if (this.levelConfig1[i].type[j] == 1 || this.levelConfig1[i].type[j] == 3) {
  866. if (!this.goldCountArr3[this.levelConfig1[i].indexArr - 1])
  867. this.goldCountArr3[this.levelConfig1[i].indexArr - 1] = 0;
  868. this.goldCountArr3[this.levelConfig1[i].indexArr - 1]++;
  869. }
  870. }
  871. }
  872. }
  873. log("goldCountArr3", this.goldCountArr3);
  874. }
  875. }
  876. class EnemieShadow extends Laya.Image {
  877. constructor() {
  878. super();
  879. this.width = 47;
  880. this.height = 20;
  881. this.skin = 'res/imgs/game/shadow.png';
  882. this.anchorX = this.anchorY = 0.5;
  883. }
  884. onEnable() {
  885. Laya.timer.once(1000, this, () => {
  886. this.sdAlphaTween = Laya.TimeLine.to(this, { alpha: 1 }, 1000);
  887. this.sdAlphaTween.play();
  888. });
  889. }
  890. startMove() {
  891. let pos = Laya.Point.create();
  892. pos.x = Manager.view.gameView.sdEndPosArr[this.index].x;
  893. pos.y = Manager.view.gameView.sdEndPosArr[this.index].y;
  894. pos = Manager.view.gameView.createBox.localToGlobal(pos);
  895. 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);
  896. this.sdMoveTween.play();
  897. this.sdScaleTween = Laya.TimeLine.to(this, { scaleX: 3, scaleY: 3 }, 5900, Laya.Ease.expoIn);
  898. this.sdScaleTween.play();
  899. this.sdMoveTween.on(Laya.Event.COMPLETE, this, () => {
  900. this.destroy();
  901. });
  902. }
  903. destroy() {
  904. super.destroy();
  905. this.removeSelf();
  906. if (this.sdMoveTween)
  907. this.sdMoveTween.destroy();
  908. if (this.sdScaleTween)
  909. this.sdScaleTween.destroy();
  910. if (this.sdAlphaTween)
  911. this.sdAlphaTween.destroy();
  912. this.sdMoveTween = null;
  913. this.sdScaleTween = null;
  914. this.sdAlphaTween = null;
  915. Laya.Tween.clearAll(this);
  916. this.timer.clearAll(this);
  917. }
  918. recover() {
  919. Laya.Pool.recover("EnemieShadow", this);
  920. }
  921. static create(x, y, index) {
  922. let enemieShadow = new EnemieShadow();
  923. enemieShadow.x = x;
  924. enemieShadow.y = y;
  925. enemieShadow.index = index;
  926. return enemieShadow;
  927. }
  928. }
  929. class Enemie extends Laya.Image {
  930. constructor() {
  931. super();
  932. this.dx = 1;
  933. this.dy = 1;
  934. this.isDeath = false;
  935. ;
  936. this.width = this.height = 240;
  937. this.anchorX = this.anchorY = 0.5;
  938. this.alpha = 1;
  939. this.scale(0.1, 0.1);
  940. }
  941. onEnable() {
  942. Laya.timer.once(1000, this, () => {
  943. this.alphaTween = Laya.TimeLine.to(this, { alpha: 1 }, 1000);
  944. this.alphaTween.play();
  945. });
  946. this.creatShadow();
  947. }
  948. creatShadow() {
  949. let pos = Laya.Point.create();
  950. let index = this.index % 4;
  951. if (index == 0)
  952. index = 4;
  953. pos.x = Manager.view.gameView.sdStartPosArr[index].x;
  954. pos.y = Manager.view.gameView.sdStartPosArr[index].y;
  955. pos = Manager.view.gameView.createBox.localToGlobal(pos);
  956. let enmeyShadow = EnemieShadow.create(pos.x - Manager.view.gameView.gameBox.x, pos.y - Manager.view.gameView.gameBox.y, index);
  957. enmeyShadow.alpha = 0;
  958. enmeyShadow.scale(0.5, 0.5);
  959. Manager.view.gameView.playBox.addChild(enmeyShadow);
  960. enmeyShadow.startMove();
  961. this.shadow = enmeyShadow;
  962. }
  963. creatCoinAni() {
  964. if (!this.goldAni) {
  965. this.goldAni = new Laya.Skeleton();
  966. this.goldAni.load("res/ani/Coin.sk", Laya.Handler.create(this, () => {
  967. this.goldAni.pos(120, 250);
  968. this.goldAni.scale(1.8, 1.8);
  969. this.addChild(this.goldAni);
  970. if (this.type == 1) {
  971. this.goldAni.play("Sliver", true, true);
  972. }
  973. else {
  974. this.goldAni.play("Golden", true, true);
  975. }
  976. }));
  977. }
  978. else {
  979. this.goldAni.visible = true;
  980. if (this.type == 1) {
  981. this.goldAni.play("Sliver", true, true);
  982. }
  983. else {
  984. this.goldAni.play("Golden", true, true);
  985. }
  986. }
  987. }
  988. creatBoomAni() {
  989. if (!this.boomAni) {
  990. this.boomAni = new Laya.Animation();
  991. this.boomAni.loadAtlas("res/ani/boomAni.atlas", Laya.Handler.create(this, () => {
  992. this.boomAni.interval = 70;
  993. this.boomAni.source = "res/ani/boomAni.atlas";
  994. this.boomAni.pivotX = 70;
  995. this.boomAni.pivotY = 109;
  996. this.boomAni.scale(2, 2);
  997. this.boomAni.pos(126, 141);
  998. this.addChild(this.boomAni);
  999. this.boomAni.play(0, true);
  1000. }));
  1001. }
  1002. else {
  1003. this.boomAni.visible = true;
  1004. this.boomAni.play(0, true);
  1005. }
  1006. }
  1007. startMove() {
  1008. let pos = Laya.Point.create();
  1009. pos.x = Manager.view.gameView.endPosArr[this.index].x;
  1010. pos.y = Manager.view.gameView.endPosArr[this.index].y;
  1011. pos = Manager.view.gameView.createBox.localToGlobal(pos);
  1012. 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);
  1013. this.moveTween.play();
  1014. this.scaleTween = Laya.TimeLine.to(this, { scaleX: 1, scaleY: 1 }, 6000, Laya.Ease.expoIn);
  1015. this.scaleTween.play();
  1016. this.moveTween.on(Laya.Event.COMPLETE, this, () => {
  1017. this.isDeath = true;
  1018. if (this.type == 1)
  1019. Manager.view.gameView.showGrade(true, false, false);
  1020. else if (this.type == 3)
  1021. Manager.view.gameView.showGrade(true, false, false);
  1022. this.destroy();
  1023. });
  1024. }
  1025. destroy() {
  1026. this.alpha = 1;
  1027. if (this.goldAni)
  1028. this.goldAni.visible = false;
  1029. if (this.boomAni)
  1030. this.boomAni.visible = false;
  1031. this.scale(0.1, 0.1);
  1032. this.removeSelf();
  1033. Manager.view.gameView.enemies = Manager.view.gameView.enemies.filter(item => { return !item.isDeath; });
  1034. if (this.moveTween)
  1035. this.moveTween.destroy();
  1036. if (this.scaleTween)
  1037. this.scaleTween.destroy();
  1038. if (this.alphaTween)
  1039. this.alphaTween.destroy();
  1040. if (this.shadow)
  1041. this.shadow.destroy();
  1042. this.moveTween = null;
  1043. this.scaleTween = null;
  1044. this.alphaTween = null;
  1045. Laya.Tween.clearAll(this);
  1046. this.timer.clearAll(this);
  1047. this.recover();
  1048. }
  1049. recover() {
  1050. Laya.Pool.recover("Enemie", this);
  1051. }
  1052. static create(x, y, url, type, index) {
  1053. let enemie = Laya.Pool.getItemByClass("Enemie", Enemie);
  1054. enemie.x = x;
  1055. enemie.y = y;
  1056. enemie.skin = url;
  1057. enemie.type = type;
  1058. enemie.index = index;
  1059. enemie.scale(0.2, 0.2);
  1060. enemie.isDeath = false;
  1061. if (type == 2) {
  1062. enemie.creatBoomAni();
  1063. }
  1064. else {
  1065. enemie.creatCoinAni();
  1066. }
  1067. return enemie;
  1068. }
  1069. }
  1070. class PlayerAniName {
  1071. }
  1072. PlayerAniName.Standby = "daiji";
  1073. PlayerAniName.ReadyRun = "manpaoqibu";
  1074. PlayerAniName.Run = "manpao";
  1075. PlayerAniName.StopRun = "manpaotingzhi";
  1076. PlayerAniName.ReadyRun1 = "kuaipaoqibu";
  1077. PlayerAniName.Run1 = "kuaipao";
  1078. PlayerAniName.StopRun1 = "kuaipaotingzhi";
  1079. PlayerAniName.Jump = "yijitiao";
  1080. PlayerAniName.Jump2 = "erjitiao";
  1081. PlayerAniName.Dead = "jiluo";
  1082. class Player extends Laya.Sprite {
  1083. constructor() {
  1084. super();
  1085. this.gravity = 0.05;
  1086. this.dx = 0;
  1087. this.dy = 0;
  1088. this.isFalling = false;
  1089. this.isJumping = false;
  1090. this.isRuning = false;
  1091. this.isDeath = false;
  1092. this.isStand = false;
  1093. this.downDy = 0;
  1094. this.jumpSpeed = 0;
  1095. this.runRate = 1;
  1096. this.stepRate = 0;
  1097. this.stepRateTarget = 0;
  1098. this.isGO = false;
  1099. this.count = 0;
  1100. this.speed = 0;
  1101. this.addSpeed = 0;
  1102. this.createRole();
  1103. this.reset();
  1104. }
  1105. get width() { return 160; }
  1106. get height() { return 240; }
  1107. createRole() {
  1108. if (this.role) {
  1109. this.role.destroy();
  1110. this.role = null;
  1111. }
  1112. let roleUrl = "res/ani/nv2.sk";
  1113. this.role = new Laya.Skeleton();
  1114. this.role.load(roleUrl, Laya.Handler.create(this, () => {
  1115. this.addChild(this.role);
  1116. this.playStandby();
  1117. }));
  1118. }
  1119. playStandby() {
  1120. if (!this.isStand)
  1121. return;
  1122. this.role.playbackRate(1);
  1123. this.role.play(PlayerAniName.Standby, true, false);
  1124. this.isRuning = false;
  1125. this.isStand = true;
  1126. }
  1127. playReadyRun() {
  1128. this.role.playbackRate(1);
  1129. this.role.play(PlayerAniName.ReadyRun, false);
  1130. Laya.timer.once(100, this, () => {
  1131. this.isRuning = true;
  1132. this.isStand = false;
  1133. });
  1134. }
  1135. playRun() {
  1136. this.role.playbackRate(this.runRate);
  1137. this.role.play(PlayerAniName.Run, true, false);
  1138. this.isStand = false;
  1139. }
  1140. playStopRun() {
  1141. this.role.playbackRate(1);
  1142. this.role.play(PlayerAniName.StopRun, false, false);
  1143. this.isRuning = false;
  1144. }
  1145. playJump() {
  1146. this.role.playbackRate(1);
  1147. this.role.play(PlayerAniName.Jump, false, true);
  1148. this.isJumping = true;
  1149. this.isStand = false;
  1150. }
  1151. playJump2() {
  1152. this.role.playbackRate(0.8);
  1153. this.role.play(PlayerAniName.Jump2, false, true);
  1154. this.isJumping = true;
  1155. this.isStand = false;
  1156. }
  1157. playDead() {
  1158. this.role.playbackRate(1);
  1159. this.role.play(PlayerAniName.Dead, false, true);
  1160. this.role.on(Laya.Event.STOPPED, null, () => {
  1161. this.role.off(Laya.Event.STOPPED, null, null);
  1162. this.count++;
  1163. this.isDeath = false;
  1164. this.isRuning = false;
  1165. this.isStand = true;
  1166. this.isJumping = false;
  1167. this.isFalling = false;
  1168. this.dy = 0;
  1169. this.dx = 0;
  1170. this.playReadyRun();
  1171. Manager.model.jumpCount = 0;
  1172. Manager.view.gameView.jumpCountTime = Manager.model.jumpCountTime;
  1173. });
  1174. }
  1175. update() {
  1176. let offset = 1.0 / 16 * Laya.timer.delta;
  1177. if (this.dy > 0 && !this.isDeath) {
  1178. this.dx = 0;
  1179. this.downDy = 0;
  1180. this.runRate = 0.8;
  1181. this.y -= this.jumpSpeed * offset;
  1182. if (this.jumpSpeed > 2 * offset)
  1183. this.jumpSpeed -= 0.4 * offset;
  1184. else
  1185. this.jumpSpeed = 2 * offset;
  1186. if (this.y - this.dy <= 5 * offset)
  1187. this.jumpSpeed = 0.3 * offset;
  1188. this.isFalling = false;
  1189. if (this.y <= this.dy) {
  1190. this.y = this.dy;
  1191. this.dy = 0;
  1192. if (Manager.model.jumpCount == 2) {
  1193. Laya.timer.once(150 * offset, this, () => {
  1194. this.isFalling = true;
  1195. });
  1196. }
  1197. else {
  1198. this.isFalling = true;
  1199. }
  1200. }
  1201. if (!this.isJumping)
  1202. this.playJump();
  1203. }
  1204. if (this.isFalling && this.isJumping) {
  1205. this.downDy += this.gravity * Laya.timer.delta;
  1206. this.y += this.downDy;
  1207. this.jumpSpeed += 0.4 * Laya.timer.delta;
  1208. if (this.y >= Manager.view.gameView.startPosImg.y) {
  1209. this.y = Manager.view.gameView.startPosImg.y;
  1210. this.isJumping = false;
  1211. this.isFalling = false;
  1212. this.curBackSpeed = 0;
  1213. Manager.model.jumpCount = 0;
  1214. Manager.view.gameView.jumpCountTime = Manager.model.jumpCountTime;
  1215. }
  1216. }
  1217. if (this.dx > 0 && !this.isDeath && this.isRuning) {
  1218. if (this.isGO) {
  1219. this.speed += (this.addSpeed * Math.min(1.0, this.stepRate / this.stepRateTarget)) * offset;
  1220. }
  1221. else {
  1222. this.speed += 0.6 * offset;
  1223. }
  1224. if (this.speed > Manager.model.forwordSpeedMax * offset)
  1225. this.speed = Manager.model.forwordSpeedMax * offset;
  1226. this.x += this.speed;
  1227. this.dx -= Manager.model.forwordSpeed / 2.0 * offset;
  1228. if (this.x >= 1450) {
  1229. this.x = 1450;
  1230. }
  1231. if (this.x >= 460 && !this.isGO) {
  1232. this.isGO = true;
  1233. this.speed = 0;
  1234. }
  1235. }
  1236. else if (this.speed > 0) {
  1237. this.speed = 0;
  1238. }
  1239. if (this.x <= 460 && this.isGO) {
  1240. this.x = 460;
  1241. if (Manager.model.isPlaying && !this.isFalling && !this.isJumping && !this.isDeath) {
  1242. if (this.isRuning) {
  1243. this.playRun();
  1244. }
  1245. }
  1246. }
  1247. else if (this.x > Manager.view.gameView.startPosImg.x) {
  1248. if (!this.isFalling && !this.isJumping && !this.isDeath) {
  1249. if (this.curBackSpeed < this.backSpeed)
  1250. this.curBackSpeed += 0.2 * offset;
  1251. this.x -= this.curBackSpeed * offset;
  1252. this.runRate -= 0.05 * offset;
  1253. if (this.runRate <= 1) {
  1254. this.runRate = 1;
  1255. }
  1256. this.role.playbackRate(this.runRate);
  1257. if (this.isRuning) {
  1258. this.playRun();
  1259. }
  1260. }
  1261. }
  1262. else {
  1263. this.x = Manager.view.gameView.startPosImg.x;
  1264. if (Manager.model.isPlaying && (this.isRuning ||
  1265. !this.isStand && this.y == Manager.view.gameView.startPosImg.y && !this.isFalling && !this.isJumping)) {
  1266. this.isStand = true;
  1267. this.playStopRun();
  1268. Laya.timer.once(300, this, () => {
  1269. this.playStandby();
  1270. });
  1271. }
  1272. }
  1273. }
  1274. showHit() {
  1275. this.hitTween = Laya.TimeLine.to(this, { alpha: 0.3 }, 200);
  1276. this.hitTween.play(0, true);
  1277. }
  1278. hideHit() {
  1279. this.alpha = 1;
  1280. this.hitTween.pause();
  1281. }
  1282. reset() {
  1283. this.dx = 0;
  1284. this.dy = 0;
  1285. this.isFalling = false;
  1286. this.isJumping = false;
  1287. this.isRuning = false;
  1288. this.isStand = true;
  1289. this.runRate = 1;
  1290. this.isDeath = false;
  1291. this.isGO = false;
  1292. if (this.hitTween)
  1293. this.hideHit();
  1294. if (this.role.templet)
  1295. this.playStandby();
  1296. if (Manager.model.gameType == 1) {
  1297. this.backSpeed = Manager.model.backSpeed;
  1298. this.addSpeed = 0.3;
  1299. this.stepRateTarget = 100.0;
  1300. }
  1301. else if (Manager.model.gameType == 2) {
  1302. this.backSpeed = Manager.model.backSpeed;
  1303. this.addSpeed = 0.2;
  1304. this.stepRateTarget = 150.0;
  1305. }
  1306. else if (Manager.model.gameType == 3) {
  1307. this.backSpeed = Manager.model.backSpeed;
  1308. this.addSpeed = 0.2 * 0.7;
  1309. this.stepRateTarget = 200.0;
  1310. }
  1311. }
  1312. showProtectLight() {
  1313. if (!this.protectLight) {
  1314. this.protectLight = new Laya.Skeleton();
  1315. this.protectLight.load("res/ani/Shield_after.sk", Laya.Handler.create(this, () => {
  1316. this.protectLight.pos(0, 20);
  1317. this.protectLight.scale(3, 3);
  1318. this.addChild(this.protectLight);
  1319. this.protectLight.play("Play", true);
  1320. }));
  1321. }
  1322. else {
  1323. this.protectLight.visible = true;
  1324. this.protectLight.play("Play", true);
  1325. }
  1326. }
  1327. stopProtectLight() {
  1328. if (this.protectLight) {
  1329. this.protectLight.stop();
  1330. this.protectLight.visible = false;
  1331. }
  1332. }
  1333. destroy() {
  1334. if (this.role)
  1335. this.role.destroy();
  1336. this.role = null;
  1337. super.destroy();
  1338. }
  1339. }
  1340. class ScoreTxt extends Laya.FontClip {
  1341. constructor() {
  1342. super();
  1343. this.width = 300;
  1344. this.height = 65;
  1345. this.anchorX = this.anchorY = 0.5;
  1346. }
  1347. onEnable() {
  1348. this.starMove();
  1349. }
  1350. starMove() {
  1351. let posY = this.y - 50;
  1352. this.scaleTween = Laya.TimeLine.to(this, { scaleX: 1, scaleY: 1 }, 1000, Laya.Ease.elasticOut).to(this, { y: posY }, 1000);
  1353. this.scaleTween.play();
  1354. this.timer.once(1000, this, () => {
  1355. this.alphaTween = Laya.TimeLine.to(this, { alpha: 0 }, 500);
  1356. this.alphaTween.play();
  1357. });
  1358. this.scaleTween.on(Laya.Event.COMPLETE, this, () => {
  1359. this.destroy();
  1360. });
  1361. }
  1362. destroy() {
  1363. this.removeSelf();
  1364. Manager.view.gameView.socreTxtArr = Manager.view.gameView.socreTxtArr.filter(item => { return item.parent; });
  1365. if (this.scaleTween)
  1366. this.scaleTween.destroy();
  1367. if (this.alphaTween)
  1368. this.alphaTween.destroy();
  1369. this.scaleTween = null;
  1370. this.alphaTween = null;
  1371. this.timer.clearAll(this);
  1372. this.recover();
  1373. }
  1374. recover() {
  1375. Laya.Pool.recover("ScoreTxt", this);
  1376. }
  1377. static create(x, y, type, value) {
  1378. let scoreTxt = Laya.Pool.getItemByClass("ScoreTxt", ScoreTxt);
  1379. scoreTxt.x = x;
  1380. scoreTxt.y = y;
  1381. scoreTxt.alpha = 1;
  1382. scoreTxt.scaleX = scoreTxt.scaleY = 0;
  1383. scoreTxt.value = value;
  1384. if (type == 1) {
  1385. scoreTxt.sheet = "+0123456789";
  1386. scoreTxt.skin = "res/imgs/game/num_1.png";
  1387. }
  1388. else if (type == 2) {
  1389. scoreTxt.sheet = "+0123456789";
  1390. scoreTxt.skin = "res/imgs/game/num_2.png";
  1391. }
  1392. else if (type == 3) {
  1393. scoreTxt.sheet = "-0123456789";
  1394. scoreTxt.skin = "res/imgs/game/num_3.png";
  1395. }
  1396. return scoreTxt;
  1397. }
  1398. }
  1399. class Animation extends Laya.Animation {
  1400. static createOnceAni(x, y, pivotX, pivotY, scale, source, parent, interval = 15, callback) {
  1401. let ani = Laya.Pool.getItemByClass("FuritAnimation", Animation);
  1402. ani.autoPlay = true;
  1403. ani.interval = interval;
  1404. ani.source = source;
  1405. ani.pivotX = pivotX;
  1406. ani.pivotY = pivotY;
  1407. ani.scale(scale, scale);
  1408. ani.pos(x, y);
  1409. ani.on(Laya.Event.COMPLETE, this, () => {
  1410. Laya.Pool.recover("FuritAnimation", ani.removeSelf());
  1411. if (callback)
  1412. callback.run();
  1413. });
  1414. parent.addChild(ani);
  1415. return ani;
  1416. }
  1417. }
  1418. class GameView extends game.ui.GameViewUI {
  1419. constructor() {
  1420. super();
  1421. this.curTime = 0;
  1422. this.countNum = 1;
  1423. this.runCountTime = 0;
  1424. this.jumpCountTime = 0;
  1425. this.isProtect = false;
  1426. this.isScoreHigh = false;
  1427. this.goldIndex = 0;
  1428. this.goldNum = 0;
  1429. this.gradeCount = 0;
  1430. this.stepCount = 0;
  1431. this.creatCount = 0;
  1432. this.tirggerUp = 200;
  1433. this.tirggerDOWN = -100;
  1434. this.tirggerLeft = 150;
  1435. this.tirggerRight = -150;
  1436. this.model = Manager.model;
  1437. }
  1438. onAwake() {
  1439. super.onAwake();
  1440. this.player = new Player();
  1441. this.player.zOrder = 1000;
  1442. this.player.pos(this.startPosImg.x, this.startPosImg.y);
  1443. this.playBox.addChild(this.player);
  1444. this.playerShadow = new Laya.Image('res/imgs/game/shadow.png');
  1445. this.playerShadow.pos(this.player.x - 80, this.startPosImg.y - 20);
  1446. this.playerShadow.scale(3, 3);
  1447. this.playBox.addChild(this.playerShadow);
  1448. }
  1449. onEnable() {
  1450. super.onEnable();
  1451. this.createPosArr = [];
  1452. this.endPosArr = [];
  1453. for (let i = 1; i <= 12; i++) {
  1454. this.createPosArr[i] = this[`${"createPos" + i}`];
  1455. this.endPosArr[i] = this[`${"endPos" + i}`];
  1456. }
  1457. this.sdStartPosArr = [];
  1458. this.sdEndPosArr = [];
  1459. for (let i = 1; i <= 4; i++) {
  1460. this.sdStartPosArr[i] = this[`${"sdStartPos" + i}`];
  1461. this.sdEndPosArr[i] = this[`${"sdEndPos" + i}`];
  1462. }
  1463. document.addEventListener("visibilitychange", function () {
  1464. if (document.hidden === true) {
  1465. Manager.view.gameView.showPauseView();
  1466. }
  1467. else {
  1468. }
  1469. });
  1470. }
  1471. addEvent() {
  1472. this.startBtn.on(Laya.Event.CLICK, this, this.onClick);
  1473. this.settingBtn.on(Laya.Event.CLICK, this, this.onClick);
  1474. }
  1475. removeEvent() {
  1476. this.startBtn.off(Laya.Event.CLICK, this, this.onClick);
  1477. this.settingBtn.off(Laya.Event.CLICK, this, this.onClick);
  1478. }
  1479. addJumpEvent() {
  1480. Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
  1481. Laya.stage.on(Laya.Event.KEY_UP, this, this.onKeyUp);
  1482. this.runBtn.on(Laya.Event.CLICK, this, this.playRun);
  1483. this.jumpBtn.on(Laya.Event.CLICK, this, this.playJump);
  1484. SDK.on(MOTION.MOTION_JUMP.toString(), this.playJump, this);
  1485. SDK.on(CMD.CANCLE_KEY.toString(), this.showPauseView, this);
  1486. ;
  1487. }
  1488. removeJumpEvent() {
  1489. Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
  1490. Laya.stage.off(Laya.Event.KEY_UP, this, this.onKeyUp);
  1491. this.runBtn.off(Laya.Event.CLICK, this, this.playRun);
  1492. this.jumpBtn.off(Laya.Event.CLICK, this, this.playJump);
  1493. SDK.off(MOTION.MOTION_JUMP.toString(), this.playJump);
  1494. SDK.off(CMD.CANCLE_KEY.toString(), this.showPauseView);
  1495. }
  1496. onClick(e) {
  1497. switch (e.currentTarget) {
  1498. case this.startBtn:
  1499. this.startGame();
  1500. break;
  1501. case this.settingBtn:
  1502. this.showPauseView();
  1503. break;
  1504. }
  1505. }
  1506. showPauseView() {
  1507. this.pauseGame();
  1508. Manager.view.pauseViewView.show();
  1509. }
  1510. onkeydown(e) {
  1511. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT) && !this.keyDownList[e["keyCode"]]) {
  1512. SDK.step(SDK.getStepFreq(), this.stepCount + 1);
  1513. }
  1514. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.UP) && !this.keyDownList[e["keyCode"]]) {
  1515. this.playJump();
  1516. }
  1517. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_1) && !this.keyDownList[e["keyCode"]]) {
  1518. SDK.stepFreq(100);
  1519. }
  1520. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_2) && !this.keyDownList[e["keyCode"]]) {
  1521. SDK.stepFreq(200);
  1522. }
  1523. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_3) && !this.keyDownList[e["keyCode"]]) {
  1524. SDK.stepFreq(300);
  1525. }
  1526. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMBER_0) && !this.keyDownList[e["keyCode"]]) {
  1527. SDK.stepFreq(0);
  1528. }
  1529. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMPAD_ADD) && !this.keyDownList[e["keyCode"]]) {
  1530. SDK.stepFreq(SDK.getStepFreq() + 10);
  1531. }
  1532. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.NUMPAD_SUBTRACT) && !this.keyDownList[e["keyCode"]]) {
  1533. SDK.stepFreq(SDK.getStepFreq() - 10);
  1534. }
  1535. this.keyDownList[e["keyCode"]] = true;
  1536. }
  1537. onKeyUp(e) {
  1538. delete this.keyDownList[e["keyCode"]];
  1539. }
  1540. updateRun() {
  1541. if (SDK.getStepCount() > this.stepCount) {
  1542. this.stepCount++;
  1543. if (this.player.isFalling || this.player.isJumping || !this.model.isPlaying || this.player.isDeath)
  1544. return;
  1545. this.player.stepRate = SDK.getStepFreq();
  1546. this.player.dx = this.model.onceAddSpeed;
  1547. this.player.curBackSpeed = 0;
  1548. if (this.player.runRate <= 1.5)
  1549. this.player.runRate += 0.2;
  1550. if (!this.player.isRuning)
  1551. this.player.playReadyRun();
  1552. }
  1553. }
  1554. playRun() {
  1555. if (this.player.isFalling || this.player.isJumping || !this.model.isPlaying || this.player.isDeath)
  1556. return;
  1557. this.player.dx = this.model.onceAddSpeed;
  1558. this.player.curBackSpeed = 0;
  1559. if (this.player.runRate <= 1.5)
  1560. this.player.runRate += 0.2;
  1561. if (!this.player.isRuning)
  1562. this.player.playReadyRun();
  1563. }
  1564. playJump() {
  1565. if (!this.model.isPlaying || this.player.isDeath || !this.player.isGO)
  1566. return;
  1567. if (this.model.jumpCount < 2) {
  1568. if (this.model.jumpCount == 1 && this.jumpCountTime <= 0)
  1569. return;
  1570. this.player.dy = this.player.y - this.model.onceAddJump;
  1571. this.jumpCountTime = this.model.jumpCountTime;
  1572. this.model.jumpCount++;
  1573. this.player.jumpSpeed = this.model.jumpSpeed;
  1574. if (this.model.jumpCount == 2)
  1575. this.player.playJump2();
  1576. core.SoundManager.playSound(Path.getSound(Path.sound.jump));
  1577. }
  1578. }
  1579. startGame() {
  1580. this.openAni.play(0, false);
  1581. this.startBtn.visible = false;
  1582. this.model.isStarGame = true;
  1583. this.startOrOverBg.visible = true;
  1584. for (let i = 0; i <= 3; i++) {
  1585. Laya.timer.once(1000 * i, this, () => {
  1586. if (3 - i > 0) {
  1587. this.startOrOverImg.skin = `res/imgs/game/time${3 - i}.png`;
  1588. }
  1589. else {
  1590. this.startOrOverImg.skin = "res/imgs/game/text_go.png";
  1591. core.SoundManager.playSound(Path.getSound(Path.sound.readyGo));
  1592. Laya.timer.once(800, this, () => {
  1593. this.goAni.play(0, false);
  1594. });
  1595. }
  1596. this.countAni.play(0, false);
  1597. }, null, false);
  1598. }
  1599. Laya.timer.once(4000, this, () => {
  1600. this.model.isPlaying = true;
  1601. core.SoundManager.playMusic(Path.getSound(Path.sound.bgm));
  1602. let interval = this.runWayAni.interval;
  1603. this.runWayAni.interval = interval * 0.7;
  1604. this.runWayAni.play(0, true);
  1605. this.pd_LigthImg.skin = "res/imgs/game/bg/pd_bright.png";
  1606. this.startOrOverBg.visible = false;
  1607. this.startBg.visible = false;
  1608. Laya.timer.loop(this.model.onceTime, this, this.animate);
  1609. Laya.timer.frameLoop(1, this, this.updatePlayer);
  1610. SDK.onGameStart();
  1611. }, null, false);
  1612. }
  1613. pauseGame() {
  1614. if (this.player.role)
  1615. this.player.role.stop();
  1616. this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
  1617. this.runWayAni.stop();
  1618. for (let i = 0; i < this.enemies.length; i++) {
  1619. if (this.enemies[i].moveTween && this.enemies[i].scaleTween) {
  1620. this.enemies[i].moveTween.pause();
  1621. this.enemies[i].scaleTween.pause();
  1622. if (this.enemies[i].shadow.sdMoveTween && this.enemies[i].shadow.sdScaleTween) {
  1623. this.enemies[i].shadow.sdMoveTween.pause();
  1624. this.enemies[i].shadow.sdScaleTween.pause();
  1625. }
  1626. }
  1627. }
  1628. Laya.timer.clear(this, this.animate);
  1629. Laya.timer.clear(this, this.updatePlayer);
  1630. this.removeJumpEvent();
  1631. }
  1632. continueGame() {
  1633. this.openAni.play(0, false);
  1634. this.startBg.visible = true;
  1635. this.startOrOverBg.visible = true;
  1636. for (let i = 0; i < 3; i++) {
  1637. Laya.timer.once(1000 * i, this, () => {
  1638. this.startOrOverImg.skin = `res/imgs/game/time${3 - i}.png`;
  1639. if (3 - i == 1) {
  1640. Laya.timer.once(800, this, () => {
  1641. this.goAni.play(0, false);
  1642. for (let i = 0; i < this.enemies.length; i++) {
  1643. if (this.enemies[i].moveTween && this.enemies[i].scaleTween) {
  1644. this.enemies[i].moveTween.resume();
  1645. this.enemies[i].scaleTween.resume();
  1646. if (this.enemies[i].shadow.sdMoveTween && this.enemies[i].shadow.sdScaleTween) {
  1647. this.enemies[i].shadow.sdMoveTween.resume();
  1648. this.enemies[i].shadow.sdScaleTween.resume();
  1649. }
  1650. }
  1651. }
  1652. this.pd_LigthImg.skin = "res/imgs/game/bg/pd_bright.png";
  1653. this.runWayAni.play(0, true);
  1654. Laya.timer.loop(this.model.onceTime, this, this.animate);
  1655. Laya.timer.frameLoop(1, this, this.updatePlayer);
  1656. this.addJumpEvent();
  1657. Laya.timer.once(200, this, () => {
  1658. this.startOrOverBg.visible = false;
  1659. this.startBg.visible = false;
  1660. }, null, false);
  1661. });
  1662. }
  1663. this.countAni.play(0, false);
  1664. }, null, false);
  1665. }
  1666. }
  1667. exitGame() {
  1668. let highSocre = 0;
  1669. switch (this.model.gameType) {
  1670. case 1:
  1671. if (this.curScore > this.model.level1HighScoreData) {
  1672. this.isScoreHigh = true;
  1673. this.model.setLevel1HighSocreData(this.curScore);
  1674. }
  1675. highSocre = this.model.level1HighScoreData;
  1676. break;
  1677. case 2:
  1678. if (this.curScore > this.model.level2HighScoreData) {
  1679. this.isScoreHigh = true;
  1680. this.model.setLevel2HighSocreData(this.curScore);
  1681. }
  1682. highSocre = this.model.level2HighScoreData;
  1683. break;
  1684. case 3:
  1685. if (this.curScore > this.model.level3HighScoreData) {
  1686. this.isScoreHigh = true;
  1687. this.model.setLevel3HighSocreData(this.curScore);
  1688. }
  1689. highSocre = this.model.level3HighScoreData;
  1690. break;
  1691. }
  1692. SDK.onGameEnd(this.model.gameType, this.curScore);
  1693. this.player.reset();
  1694. Manager.view.homeView.show();
  1695. Manager.view.hideGameView();
  1696. }
  1697. animate() {
  1698. this.updateRun();
  1699. if (!this.model.isPlaying && !this.model.isStarGame)
  1700. return;
  1701. if (this.curTime > 0) {
  1702. this.curTime -= this.model.onceTime;
  1703. this.timeTxt.text = this.exchangeCDTime(this.curTime);
  1704. }
  1705. else {
  1706. if (this.model.isPlaying)
  1707. this.gameOver();
  1708. }
  1709. }
  1710. updatePlayer() {
  1711. this.updateEnemies();
  1712. this.player.update();
  1713. this.playerShadow.x = this.player.x - 80;
  1714. this.TirggerEnemies();
  1715. if (this.runCountTime > 0)
  1716. this.runCountTime -= Laya.timer.delta;
  1717. if (this.jumpCountTime > 0)
  1718. this.jumpCountTime -= Laya.timer.delta;
  1719. }
  1720. exchangeCDTime(time) {
  1721. let m = parseInt(time / 1000 / 60 % 60 + ''), s = parseInt(time / 1000 % 60 + ''), ms = time % 100;
  1722. if (m < 10)
  1723. m = "0" + m;
  1724. if (s < 10)
  1725. s = "0" + s;
  1726. if (ms < 10)
  1727. ms = "0" + ms;
  1728. return m + ":" + s + "`" + ms;
  1729. }
  1730. updateEnemies() {
  1731. for (let i = 0; i < this.createPosTime.length; i++) {
  1732. if (this.createPosTime[i] && this.createPosTime[i] > 0) {
  1733. this.createPosTime[i] -= this.timer.delta;
  1734. if (this.createPosTime[i] <= 0)
  1735. this.createPosArr[i].skin = "res/imgs/game/bg/led_dark.png";
  1736. }
  1737. }
  1738. if (this.countNum >= this.levelConfig.length)
  1739. return;
  1740. if (this.curTime <= Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).time * 1000) {
  1741. for (let i = 0; i < Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).type.length; i++) {
  1742. this.createPosArr[Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).posArr[i]].skin = "res/imgs/game/bg/led_bright.png";
  1743. let type = Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).type[i];
  1744. let index = Manager.dataManager.getLevelConfig(this.model.gameType, this.countNum).posArr[i];
  1745. let pos = Laya.Point.create();
  1746. pos.x = this.createPosArr[index].x;
  1747. pos.y = this.createPosArr[index].y;
  1748. pos = this.createBox.localToGlobal(pos);
  1749. let url;
  1750. if (type == 1)
  1751. url = "";
  1752. else if (type == 2)
  1753. url = "res/imgs/game/boomEnemy.png";
  1754. else if (type == 3)
  1755. url = "";
  1756. let enmey = Enemie.create(pos.x - this.gameBox.x, pos.y - this.gameBox.y, url, type, index);
  1757. this.creatCount++;
  1758. enmey.zOrder = 1000 - this.creatCount;
  1759. enmey.alpha = 0;
  1760. this.playBox.addChild(enmey);
  1761. this.enemies.push(enmey);
  1762. enmey.startMove();
  1763. this.createPosTime[index] = 2000;
  1764. }
  1765. this.countNum++;
  1766. }
  1767. }
  1768. TirggerEnemies() {
  1769. for (let i = 0; i < this.enemies.length; i++) {
  1770. if (this.enemies[i].type == 2) {
  1771. this.tirggerUp = 150;
  1772. this.tirggerDOWN = -50;
  1773. this.tirggerLeft = 130;
  1774. this.tirggerRight = -130;
  1775. }
  1776. else {
  1777. this.tirggerUp = 250;
  1778. this.tirggerDOWN = -150;
  1779. this.tirggerLeft = 200;
  1780. this.tirggerRight = -200;
  1781. }
  1782. if (this.player.y - this.enemies[i].y <= this.tirggerUp && this.player.y - this.enemies[i].y >= this.tirggerDOWN
  1783. && this.player.x - this.enemies[i].x <= this.tirggerLeft && this.player.x - this.enemies[i].x >= this.tirggerRight
  1784. && this.enemies[i].scaleX >= 0.8 && this.enemies[i].scaleY >= 0.8 && this.enemies[i].parent) {
  1785. if (this.model.jumpCount < 1 && this.enemies[i].index > 4)
  1786. return;
  1787. let socre;
  1788. let type;
  1789. if (this.enemies[i].type == 1 || this.enemies[i].type == 3) {
  1790. core.SoundManager.playSound(Path.getSound(Path.sound.combo));
  1791. if (this.enemies[i].type == 1) {
  1792. if (this.model.gameType == 1) {
  1793. socre = "+100";
  1794. this.curScore += 100;
  1795. this.addSocre += 100;
  1796. }
  1797. else if (this.model.gameType == 2) {
  1798. socre = "+150";
  1799. this.curScore += 150;
  1800. this.addSocre += 150;
  1801. }
  1802. else if (this.model.gameType == 3) {
  1803. socre = "+200";
  1804. this.curScore += 200;
  1805. this.addSocre += 200;
  1806. }
  1807. type = 1;
  1808. this.showGrade(true, false, true);
  1809. }
  1810. else {
  1811. if (this.model.gameType == 1) {
  1812. socre = "+300";
  1813. this.curScore += 300;
  1814. this.addSocre += 300;
  1815. }
  1816. else if (this.model.gameType == 2) {
  1817. socre = "+350";
  1818. this.curScore += 350;
  1819. this.addSocre += 350;
  1820. }
  1821. else if (this.model.gameType == 3) {
  1822. socre = "+400";
  1823. this.curScore += 400;
  1824. this.addSocre += 400;
  1825. }
  1826. type = 2;
  1827. this.showGrade(true, true, true);
  1828. }
  1829. Animation.createOnceAni(this.enemies[i].x, this.enemies[i].y, 190, 210, 1.5, `res/ani/gold.atlas`, this.playBox);
  1830. }
  1831. else if (this.enemies[i].type == 2) {
  1832. if (!this.player.isDeath) {
  1833. if (this.model.gameType == 1) {
  1834. socre = "-200";
  1835. this.curScore -= 200;
  1836. this.subSocre += 200;
  1837. }
  1838. else if (this.model.gameType == 2) {
  1839. socre = "-250";
  1840. this.curScore -= 250;
  1841. this.subSocre += 250;
  1842. }
  1843. else if (this.model.gameType == 3) {
  1844. socre = "-300";
  1845. this.curScore -= 300;
  1846. this.subSocre += 300;
  1847. }
  1848. type = 3;
  1849. this.huaryUpAniL.play(0, true);
  1850. this.huaryUpAniR.play(0, true);
  1851. this.huaryUpAniL.visible = true;
  1852. this.huaryUpAniR.visible = true;
  1853. this.showGrade(false, false, false);
  1854. SDK.vibrate(500);
  1855. Laya.timer.once(500, this, () => {
  1856. this.huaryUpAniL.stop();
  1857. this.huaryUpAniR.stop();
  1858. this.huaryUpAniL.visible = false;
  1859. this.huaryUpAniR.visible = false;
  1860. });
  1861. Animation.createOnceAni(this.enemies[i].x, this.enemies[i].y, 266, 209, 1.5, `res/ani/boom.atlas`, this.playBox, 30);
  1862. if (!this.isProtect) {
  1863. this.isProtect = true;
  1864. this.player.showHit();
  1865. if (this.model.jumpCount == 2) {
  1866. this.player.isDeath = true;
  1867. this.player.playDead();
  1868. Laya.Tween.to(this.player, { y: this.startPosImg.y }, 500);
  1869. }
  1870. else {
  1871. if (this.model.jumpCount == 0) {
  1872. if (this.player.x != 460) {
  1873. if (this.player.x - this.enemies[i].x <= 0) {
  1874. Laya.Tween.to(this.player, { x: this.player.x - this.enemies[i].width / 2 }, 200);
  1875. }
  1876. else {
  1877. Laya.Tween.to(this.player, { x: this.player.x + this.enemies[i].width / 2 }, 200);
  1878. }
  1879. }
  1880. }
  1881. }
  1882. Laya.timer.once(2500, this, () => {
  1883. this.player.hideHit();
  1884. this.isProtect = false;
  1885. });
  1886. }
  1887. }
  1888. }
  1889. if (socre) {
  1890. let pos = Laya.Point.create();
  1891. pos.x = this.endPosArr[this.enemies[i].index].x;
  1892. pos.y = this.endPosArr[this.enemies[i].index].y;
  1893. pos = this.createBox.localToGlobal(pos);
  1894. let socreTxt = ScoreTxt.create(pos.x + 120, pos.y - 150, type, socre);
  1895. socreTxt.zOrder = 1001;
  1896. this.playBox.addChild(socreTxt);
  1897. this.socreTxtArr.push(socreTxt);
  1898. }
  1899. this.enemies[i].isDeath = true;
  1900. this.enemies[i].destroy();
  1901. this.updateScore();
  1902. }
  1903. }
  1904. }
  1905. showGrade(isSilver = false, isGold = false, isShow = false) {
  1906. if (isSilver) {
  1907. this.goldNum++;
  1908. if (isShow) {
  1909. if (isGold) {
  1910. this.gradeImg.skin = "res/imgs/game/great.png";
  1911. this.scoreGrade.visible = true;
  1912. this.gradeAni.play(0, false);
  1913. }
  1914. if (this.goldNum == this.goldCountArr[this.goldIndex]) {
  1915. this.gradeCount++;
  1916. if (!isGold && this.isGood) {
  1917. if (this.gradeCount == 3) {
  1918. this.gradeImg.skin = "res/imgs/game/amaze.png";
  1919. }
  1920. else if (this.gradeCount == 4 || this.gradeCount >= this.goldCountArr.length) {
  1921. this.gradeImg.skin = "res/imgs/game/perfect.png";
  1922. }
  1923. else if (this.gradeCount == 1) {
  1924. this.gradeImg.skin = "res/imgs/game/good.png";
  1925. }
  1926. this.scoreGrade.visible = true;
  1927. this.gradeAni.play(0, false);
  1928. }
  1929. this.goldIndex++;
  1930. this.goldNum = 0;
  1931. this.isGood = true;
  1932. }
  1933. }
  1934. else {
  1935. this.gradeCount = 0;
  1936. this.isGood = false;
  1937. if (this.goldNum == this.goldCountArr[this.goldIndex]) {
  1938. this.goldIndex++;
  1939. this.goldNum = 0;
  1940. this.isGood = true;
  1941. }
  1942. }
  1943. }
  1944. else {
  1945. this.gradeCount = 0;
  1946. this.isGood = false;
  1947. }
  1948. }
  1949. updateScore() {
  1950. this.scoreTxt.text = this.curScore + "";
  1951. }
  1952. gameOver() {
  1953. this.timeTxt.text = "00:00`00";
  1954. this.model.isPlaying = false;
  1955. this.model.isStarGame = false;
  1956. this.startBg.visible = false;
  1957. this.startBg.visible = true;
  1958. this.startOrOverBg.visible = true;
  1959. this.startOrOverImg.skin = "res/imgs/game/text_finsh.png";
  1960. this.removeEvent();
  1961. this.removeJumpEvent();
  1962. this.player.isGO = false;
  1963. this.player.backSpeed = this.model.backSpeed;
  1964. this.player.playStopRun();
  1965. this.gameOverAni.play(0, false);
  1966. let highSocre = 0;
  1967. switch (this.model.gameType) {
  1968. case 1:
  1969. if (this.curScore > this.model.level1HighScoreData) {
  1970. this.isScoreHigh = true;
  1971. this.model.setLevel1HighSocreData(this.curScore);
  1972. }
  1973. highSocre = this.model.level1HighScoreData;
  1974. break;
  1975. case 2:
  1976. if (this.curScore > this.model.level2HighScoreData) {
  1977. this.isScoreHigh = true;
  1978. this.model.setLevel2HighSocreData(this.curScore);
  1979. }
  1980. highSocre = this.model.level2HighScoreData;
  1981. break;
  1982. case 3:
  1983. if (this.curScore > this.model.level3HighScoreData) {
  1984. this.isScoreHigh = true;
  1985. this.model.setLevel3HighSocreData(this.curScore);
  1986. }
  1987. highSocre = this.model.level3HighScoreData;
  1988. break;
  1989. }
  1990. SDK.onGameEnd(this.model.gameType, this.curScore, 0, 0, 0, (data) => {
  1991. this.gameOverData = data;
  1992. this.event("onGameEnd", data);
  1993. });
  1994. Laya.timer.once(300, this, () => {
  1995. this.player.playStandby();
  1996. Laya.timer.once(2500, this, () => {
  1997. this.runWayAni.stop();
  1998. this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
  1999. Laya.timer.once(1000, this, () => {
  2000. Manager.view.resultView.show(this.curScore, this.addSocre, this.subSocre, highSocre, this.isScoreHigh, this.exchangeCDTime(Manager.dataManager.getLevelConfig(this.model.gameType, 0).time * 1000));
  2001. });
  2002. });
  2003. });
  2004. }
  2005. onDisable() {
  2006. super.onDisable();
  2007. this.removeEvent();
  2008. this.removeJumpEvent();
  2009. Laya.timer.clear(this, this.animate);
  2010. Laya.timer.clear(this, this.updatePlayer);
  2011. }
  2012. destroy() {
  2013. super.destroy();
  2014. Laya.Tween.clearAll(this.player);
  2015. Laya.timer.clearAll(this);
  2016. if (this.enemies)
  2017. core.ObjectUtil.destroyList(...this.enemies);
  2018. if (this.socreTxtArr)
  2019. core.ObjectUtil.destroyList(...this.socreTxtArr);
  2020. this.model = null;
  2021. this.player.destroy();
  2022. this.player = null;
  2023. this.enemies = null;
  2024. }
  2025. resetGame() {
  2026. core.SoundManager.stopAllSound();
  2027. Laya.timer.clear(this, this.animate);
  2028. Laya.timer.clear(this, this.updatePlayer);
  2029. if (this.enemies)
  2030. core.ObjectUtil.destroyList(...this.enemies);
  2031. this.enemies = [];
  2032. this.curScore = 0;
  2033. this.subSocre = 0;
  2034. this.addSocre = 0;
  2035. this.updateScore();
  2036. this.model.reset();
  2037. this.player.reset();
  2038. this.runWayAni.interval = 16.6;
  2039. this.runWayAni.stop();
  2040. this.pd_LigthImg.skin = "res/imgs/game/bg/pd_dark.png";
  2041. this.startBg.visible = true;
  2042. this.model.isPlaying = false;
  2043. this.model.isStarGame = false;
  2044. this.isScoreHigh = false;
  2045. this.countNum = 1;
  2046. this.curTime = Manager.dataManager.getLevelConfig(this.model.gameType, 0).time * 1000;
  2047. this.timeTxt.text = this.exchangeCDTime(this.curTime);
  2048. this.keyDownList = [];
  2049. this.createPosTime = [];
  2050. this.socreTxtArr = [];
  2051. this.playerShadow.x = this.player.x - 80;
  2052. this.goldIndex = 0;
  2053. this.goldNum = 0;
  2054. this.gradeCount = 0;
  2055. this.stepCount = 0;
  2056. this.model.jumpCount = 0;
  2057. this.runCountTime = this.model.runCountTime;
  2058. this.jumpCountTime = this.model.jumpCountTime;
  2059. this.huaryUpAniL.stop();
  2060. this.huaryUpAniR.stop();
  2061. this.huaryUpAniL.visible = false;
  2062. this.huaryUpAniR.visible = false;
  2063. this.gameOverData = null;
  2064. switch (this.model.gameType) {
  2065. case 1:
  2066. this.highScoreTxt.text = this.model.level1HighScoreData + "";
  2067. break;
  2068. case 2:
  2069. this.highScoreTxt.text = this.model.level2HighScoreData + "";
  2070. break;
  2071. case 3:
  2072. this.highScoreTxt.text = this.model.level3HighScoreData + "";
  2073. break;
  2074. }
  2075. for (let i = 0; i < this.createPosArr.length; i++) {
  2076. if (this.createPosArr[i])
  2077. this.createPosArr[i].skin = "res/imgs/game/bg/led_dark.png";
  2078. }
  2079. this.player.pos(this.startPosImg.x, this.startPosImg.y);
  2080. this.addJumpEvent();
  2081. this.removeEvent();
  2082. this.addEvent();
  2083. this.selfRank = 0;
  2084. SDK.getRank(0, (info) => {
  2085. for (let i = 0; i < info[1].list.length; i++) {
  2086. if (info[1].list[i].user.id == this.model.selfInfo.id) {
  2087. this.selfRank = info[1].list[i].rank;
  2088. log("自己当前排行", this.selfRank);
  2089. break;
  2090. }
  2091. }
  2092. });
  2093. }
  2094. show(gameType) {
  2095. Laya.stage.addChild(this);
  2096. this.model.gameType = gameType;
  2097. if (this.model.gameType == 1) {
  2098. this.gametypeTxt.text = "简单";
  2099. this.levelConfig = Manager.dataManager.levelConfig1;
  2100. this.goldCountArr = Manager.dataManager.goldCountArr1;
  2101. }
  2102. else if (this.model.gameType == 2) {
  2103. this.gametypeTxt.text = "中等";
  2104. this.levelConfig = Manager.dataManager.levelConfig2;
  2105. this.goldCountArr = Manager.dataManager.goldCountArr2;
  2106. }
  2107. else if (this.model.gameType == 3) {
  2108. this.gametypeTxt.text = "困难";
  2109. this.levelConfig = Manager.dataManager.levelConfig3;
  2110. this.goldCountArr = Manager.dataManager.goldCountArr3;
  2111. }
  2112. this.resetGame();
  2113. this.startGame();
  2114. }
  2115. }
  2116. class HomeView extends game.ui.HomeViewUI {
  2117. constructor() {
  2118. super();
  2119. this.index = 1;
  2120. this.exitIndex = 1;
  2121. Laya.stage.frameRate = Laya.Stage.FRAME_FAST;
  2122. }
  2123. onAwake() {
  2124. super.onAwake();
  2125. }
  2126. onEnable() {
  2127. super.onEnable();
  2128. this.addEvent();
  2129. this.noBtn.on(Laya.Event.CLICK, this, this.onClick);
  2130. this.yesBtn.on(Laya.Event.CLICK, this, this.onClick);
  2131. this.index = 1;
  2132. this.setSkin();
  2133. this.openAni.play(0, false);
  2134. this.level1TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(1, 0).time * 1000);
  2135. this.level2TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(2, 0).time * 1000);
  2136. this.level3TimeTxt.text = this.exchangeCDTime(Manager.dataManager.getLevelConfig(3, 0).time * 1000);
  2137. this.level1ScoreTxt.text = Manager.model.level1HighScoreData.toString();
  2138. this.level2ScoreTxt.text = Manager.model.level2HighScoreData.toString();
  2139. this.level3ScoreTxt.text = Manager.model.level3HighScoreData.toString();
  2140. if (Manager.model.selfInfo.avatar)
  2141. this.avatarImg.skin = Manager.model.selfInfo.avatar;
  2142. this.nameTxt.text = Manager.model.selfInfo.nickname;
  2143. core.SoundManager.stopMusic();
  2144. }
  2145. addEvent() {
  2146. this.level1.on(Laya.Event.CLICK, this, this.onClick);
  2147. this.level2.on(Laya.Event.CLICK, this, this.onClick);
  2148. this.level3.on(Laya.Event.CLICK, this, this.onClick);
  2149. this.rankBtn.on(Laya.Event.CLICK, this, this.onClick);
  2150. this.settingBtn.on(Laya.Event.CLICK, this, this.onClick);
  2151. this.homeBtn.on(Laya.Event.CLICK, this, this.onClick);
  2152. Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
  2153. SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
  2154. SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
  2155. SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
  2156. SDK.on(CMD.CANCLE_KEY.toString(), this.showExitGameView, this);
  2157. }
  2158. removeEvent() {
  2159. this.level1.off(Laya.Event.CLICK, this, this.onClick);
  2160. this.level2.off(Laya.Event.CLICK, this, this.onClick);
  2161. this.level3.off(Laya.Event.CLICK, this, this.onClick);
  2162. this.rankBtn.off(Laya.Event.CLICK, this, this.onClick);
  2163. this.settingBtn.off(Laya.Event.CLICK, this, this.onClick);
  2164. this.homeBtn.off(Laya.Event.CLICK, this, this.onClick);
  2165. Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
  2166. SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
  2167. SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
  2168. SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
  2169. SDK.off(CMD.CANCLE_KEY.toString(), this.showExitGameView);
  2170. }
  2171. KeyUp() {
  2172. if (this.exitBg.visible) {
  2173. if (this.exitIndex == 1) {
  2174. this.exitIndex = 2;
  2175. this.yesBtn.skin = "res/imgs/game/btn_tyxz.png";
  2176. this.yesTxtImg.skin = "res/imgs/game/text_qd1.png";
  2177. this.noBtn.skin = "res/imgs/game/btn_tywxz.png";
  2178. this.noTxtImg.skin = "res/imgs/game/text_qx2.png";
  2179. }
  2180. else {
  2181. this.exitIndex = 1;
  2182. this.yesBtn.skin = "res/imgs/game/btn_tywxz.png";
  2183. this.yesTxtImg.skin = "res/imgs/game/text_qd2.png";
  2184. this.noBtn.skin = "res/imgs/game/btn_tyxz.png";
  2185. this.noTxtImg.skin = "res/imgs/game/text_qx1.png";
  2186. }
  2187. }
  2188. else {
  2189. if (this.index > 1) {
  2190. this.index--;
  2191. }
  2192. else {
  2193. this.index = 3;
  2194. }
  2195. this.setSkin();
  2196. }
  2197. }
  2198. KeyDown() {
  2199. if (this.exitBg.visible) {
  2200. if (this.exitIndex == 1) {
  2201. this.exitIndex = 2;
  2202. this.yesBtn.skin = "res/imgs/game/btn_tyxz.png";
  2203. this.yesTxtImg.skin = "res/imgs/game/text_qd1.png";
  2204. this.noBtn.skin = "res/imgs/game/btn_tywxz.png";
  2205. this.noTxtImg.skin = "res/imgs/game/text_qx2.png";
  2206. }
  2207. else {
  2208. this.exitIndex = 1;
  2209. this.yesBtn.skin = "res/imgs/game/btn_tywxz.png";
  2210. this.yesTxtImg.skin = "res/imgs/game/text_qd2.png";
  2211. this.noBtn.skin = "res/imgs/game/btn_tyxz.png";
  2212. this.noTxtImg.skin = "res/imgs/game/text_qx1.png";
  2213. }
  2214. }
  2215. else {
  2216. if (this.index < 3) {
  2217. this.index++;
  2218. }
  2219. else {
  2220. this.index = 1;
  2221. }
  2222. this.setSkin();
  2223. }
  2224. }
  2225. KeyEnter() {
  2226. if (this.exitBtnBg.visible) {
  2227. if (this.exitIndex == 1)
  2228. this.hideExitGameView();
  2229. else
  2230. SDK.onBackPressed();
  2231. }
  2232. else {
  2233. this.startGame(this.index);
  2234. }
  2235. }
  2236. onkeydown(e) {
  2237. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.LEFT)) {
  2238. this.KeyUp();
  2239. }
  2240. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT)) {
  2241. this.KeyDown();
  2242. }
  2243. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
  2244. this.KeyEnter();
  2245. }
  2246. }
  2247. onClick(e) {
  2248. switch (e.currentTarget) {
  2249. case this.level1:
  2250. this.index = 1;
  2251. this.setSkin();
  2252. this.startGame(1);
  2253. break;
  2254. case this.level2:
  2255. this.index = 2;
  2256. this.setSkin();
  2257. this.startGame(2);
  2258. break;
  2259. case this.level3:
  2260. this.index = 3;
  2261. this.setSkin();
  2262. this.startGame(3);
  2263. break;
  2264. case this.rankBtn:
  2265. this.showRankView();
  2266. break;
  2267. case this.settingBtn:
  2268. this.showSettingView();
  2269. break;
  2270. case this.homeBtn:
  2271. this.showExitGameView();
  2272. break;
  2273. case this.noBtn:
  2274. this.hideExitGameView();
  2275. break;
  2276. case this.yesBtn:
  2277. SDK.onBackPressed();
  2278. break;
  2279. }
  2280. }
  2281. setSkin() {
  2282. switch (this.index) {
  2283. case 1:
  2284. this.level1.gray = false;
  2285. this.level1.alpha = 1;
  2286. this.level1.scale(1.2, 1.2);
  2287. this.level2.gray = true;
  2288. this.level2.alpha = 0.8;
  2289. this.level2.scale(1.1, 1.1);
  2290. this.level3.gray = true;
  2291. this.level3.alpha = 0.8;
  2292. this.level3.scale(1.1, 1.1);
  2293. break;
  2294. case 2:
  2295. this.level1.gray = true;
  2296. this.level1.alpha = 0.8;
  2297. this.level1.scale(1.1, 1.1);
  2298. this.level2.gray = false;
  2299. this.level2.alpha = 1;
  2300. this.level2.scale(1.2, 1.2);
  2301. this.level3.gray = true;
  2302. this.level3.alpha = 0.8;
  2303. this.level3.scale(1.1, 1.1);
  2304. break;
  2305. case 3:
  2306. this.level1.gray = true;
  2307. this.level1.alpha = 0.8;
  2308. this.level1.scale(1.1, 1.1);
  2309. this.level2.gray = true;
  2310. this.level2.alpha = 0.8;
  2311. this.level2.scale(1.1, 1.1);
  2312. this.level3.gray = false;
  2313. this.level3.alpha = 1;
  2314. this.level3.scale(1.2, 1.2);
  2315. break;
  2316. }
  2317. }
  2318. startGame(gameType) {
  2319. let btn;
  2320. switch (this.index) {
  2321. case 1:
  2322. btn = this.level1;
  2323. break;
  2324. case 2:
  2325. btn = this.level2;
  2326. break;
  2327. case 3:
  2328. btn = this.level3;
  2329. break;
  2330. }
  2331. Laya.Tween.to(btn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
  2332. Laya.timer.once(300, this, () => {
  2333. Manager.view.gameView.show(gameType);
  2334. Manager.view.hideHomeView();
  2335. });
  2336. }));
  2337. }
  2338. showRankView() {
  2339. Laya.Tween.to(this.rankBtn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
  2340. Laya.timer.once(300, this, () => {
  2341. Manager.view.rankView.getRank();
  2342. Manager.view.rankView.show();
  2343. Manager.view.hideHomeView();
  2344. });
  2345. }));
  2346. }
  2347. showSettingView() {
  2348. Laya.Tween.to(this.settingBtn, { scaleX: 0.95, scaleY: 0.95, }, 100, null, Laya.Handler.create(this, () => {
  2349. Laya.timer.once(300, this, () => {
  2350. Manager.view.settingView.show();
  2351. Manager.view.hideHomeView();
  2352. });
  2353. }));
  2354. }
  2355. showExitGameView() {
  2356. this.exitBg.visible = true;
  2357. this.exitBtnBg.visible = true;
  2358. }
  2359. hideExitGameView() {
  2360. this.exitBg.visible = false;
  2361. this.exitBtnBg.visible = false;
  2362. this.addEvent();
  2363. }
  2364. exchangeCDTime(time) {
  2365. let m = parseInt(time / 1000 / 60 % 60 + ''), s = parseInt(time / 1000 % 60 + ''), ms = time % 100;
  2366. if (m < 10)
  2367. m = "0" + m;
  2368. if (s < 10)
  2369. s = "0" + s;
  2370. if (ms < 10)
  2371. ms = "0" + ms;
  2372. return m + ":" + s + "`" + ms;
  2373. }
  2374. onDisable() {
  2375. super.onDisable();
  2376. this.removeEvent();
  2377. this.noBtn.off(Laya.Event.CLICK, this, this.onClick);
  2378. this.yesBtn.on(Laya.Event.CLICK, this, this.onClick);
  2379. }
  2380. destroy() {
  2381. super.destroy();
  2382. }
  2383. show() {
  2384. Laya.stage.addChild(this);
  2385. }
  2386. }
  2387. class RankView extends game.ui.RankViewUI {
  2388. constructor() {
  2389. super();
  2390. this.selfInfo = { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" };
  2391. this.friendInfoList = [{ "user": { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" }, "score": 100, "rank": 1 }];
  2392. this.wordInfoList = [{ "user": { "id": 1, "nickname": "nickname", "gender": 1, "avatar": "" }, "score": 100, "rank": 1 }];
  2393. this.testInfo = {
  2394. index: 1,
  2395. id: 1,
  2396. name: "Self",
  2397. gender: 1,
  2398. avatar: "",
  2399. score: Manager.model.allHighScoreData,
  2400. rank: 100,
  2401. };
  2402. this.rankType = 1;
  2403. this.wordInfoList = [];
  2404. this.friendInfoList = [];
  2405. this.rankList.vScrollBarSkin = "";
  2406. }
  2407. getRank() {
  2408. if (!window["SDKBridge"]) {
  2409. this.rankList.visible = true;
  2410. this.showWordRank();
  2411. }
  2412. SDK.getUserInfo((info) => {
  2413. this.selfInfo = info;
  2414. log("info", info);
  2415. SDK.getRank(1, (info) => {
  2416. this.friendInfoList = info[1].list;
  2417. log("获取好友排行榜信息", this.friendInfoList, info[1].list);
  2418. SDK.getRank(0, (info) => {
  2419. this.wordInfoList = info[1].list;
  2420. log("获取世界排行榜信息", this.wordInfoList, info[1].list);
  2421. this.rankList.visible = true;
  2422. this.showWordRank();
  2423. });
  2424. });
  2425. });
  2426. }
  2427. notRankInfo() {
  2428. let a = [];
  2429. let item = {
  2430. index: 1,
  2431. id: 1,
  2432. name: "nickname",
  2433. gender: 1,
  2434. avatar: "",
  2435. score: Manager.model.allHighScoreData,
  2436. rank: 1,
  2437. };
  2438. a.push(item);
  2439. this.testInfo = a[0];
  2440. return a;
  2441. }
  2442. setSelfInfo(type) {
  2443. let rank = 100;
  2444. let socre = Manager.model.allHighScoreData;
  2445. switch (type) {
  2446. case 1:
  2447. for (let i = 0; i < this.wordInfoList.length; i++) {
  2448. if (this.wordInfoList[i].user.id == this.selfInfo.id) {
  2449. rank = this.wordInfoList[i].rank;
  2450. socre = this.wordInfoList[i].score;
  2451. this.scoreTxt.text = socre.toString();
  2452. }
  2453. }
  2454. break;
  2455. case 2:
  2456. for (let i = 0; i < this.friendInfoList.length; i++) {
  2457. if (this.friendInfoList[i].user.id == this.selfInfo.id) {
  2458. rank = this.friendInfoList[i].rank;
  2459. socre = this.friendInfoList[i].score;
  2460. this.scoreTxt.text = socre.toString();
  2461. }
  2462. }
  2463. break;
  2464. case 3:
  2465. rank = this.testInfo.rank;
  2466. break;
  2467. }
  2468. if (rank < 100) {
  2469. if (rank <= 3) {
  2470. switch (rank) {
  2471. case 1:
  2472. this.winImg.skin = "res/imgs/rank/icon_diyi.png";
  2473. break;
  2474. case 2:
  2475. this.winImg.skin = "res/imgs/rank/icon_dier.png";
  2476. break;
  2477. case 3:
  2478. this.winImg.skin = "res/imgs/rank/icon_disan.png";
  2479. break;
  2480. }
  2481. }
  2482. this.winImg.visible = true;
  2483. this.loseImg.visible = false;
  2484. this.rankTxt.visible = true;
  2485. this.rankTxt.value = rank.toString();
  2486. }
  2487. else {
  2488. this.winImg.visible = false;
  2489. this.loseImg.visible = true;
  2490. this.rankTxt.visible = false;
  2491. }
  2492. if (this.selfInfo.avatar)
  2493. this.avatarImg.skin = this.selfInfo.avatar;
  2494. this.nameTxt.text = this.selfInfo.nickname;
  2495. }
  2496. onEnable() {
  2497. super.onEnable();
  2498. this.addEvent();
  2499. }
  2500. addEvent() {
  2501. this.friendBtn.on(Laya.Event.CLICK, this, this.onClick);
  2502. this.wordBtn.on(Laya.Event.CLICK, this, this.onClick);
  2503. this.closeBtn.on(Laya.Event.CLICK, this, this.onClick);
  2504. this.on(Laya.Event.CLICK, this, this.onClick);
  2505. }
  2506. removeEvent() {
  2507. this.friendBtn.off(Laya.Event.CLICK, this, this.onClick);
  2508. this.wordBtn.off(Laya.Event.CLICK, this, this.onClick);
  2509. this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
  2510. this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
  2511. this.off(Laya.Event.CLICK, this, this.onClick);
  2512. }
  2513. onClick(e) {
  2514. switch (e.currentTarget) {
  2515. case this.friendBtn:
  2516. this.showFriendRank();
  2517. break;
  2518. case this.wordBtn:
  2519. this.showWordRank();
  2520. break;
  2521. case this.closeBtn:
  2522. Manager.view.homeView.show();
  2523. Manager.view.hideRankView();
  2524. break;
  2525. }
  2526. }
  2527. showFriendRank() {
  2528. if (this.rankType == 1)
  2529. return;
  2530. this.rankType = 1;
  2531. this.friendBg.visible = true;
  2532. this.wordBg.visible = false;
  2533. if (this.friendInfoList.length > 0) {
  2534. this.rankList.array = this.getFriendRankList();
  2535. this.setSelfInfo(2);
  2536. }
  2537. else {
  2538. this.rankList.array = [];
  2539. this.setSelfInfo(3);
  2540. }
  2541. this.rankList.refresh();
  2542. this.openAni.play(0, false);
  2543. }
  2544. showWordRank() {
  2545. if (this.rankType == 2)
  2546. return;
  2547. this.rankType = 2;
  2548. this.friendBg.visible = false;
  2549. this.wordBg.visible = true;
  2550. if (this.wordInfoList.length > 0) {
  2551. this.rankList.array = this.getWordRankList();
  2552. this.setSelfInfo(1);
  2553. }
  2554. else {
  2555. this.rankList.array = [];
  2556. this.setSelfInfo(3);
  2557. }
  2558. this.rankList.refresh();
  2559. this.openAni.play(0, false);
  2560. }
  2561. getFriendRankList() {
  2562. let arr = [];
  2563. for (let index = 0; index < this.friendInfoList.length; index++) {
  2564. if (index == 100)
  2565. break;
  2566. arr.push({
  2567. index: index,
  2568. name: this.friendInfoList[index].user.nickname,
  2569. gender: this.friendInfoList[index].user.gender,
  2570. avatar: this.friendInfoList[index].user.avatar,
  2571. score: this.friendInfoList[index].score,
  2572. rank: this.friendInfoList[index].rank,
  2573. });
  2574. }
  2575. return arr;
  2576. }
  2577. getWordRankList() {
  2578. let arr = [];
  2579. for (let index = 0; index < this.wordInfoList.length; index++) {
  2580. if (index == 100)
  2581. break;
  2582. arr.push({
  2583. index: index,
  2584. name: this.wordInfoList[index].user.nickname,
  2585. gender: this.wordInfoList[index].user.gender,
  2586. avatar: this.wordInfoList[index].user.avatar,
  2587. score: this.wordInfoList[index].score,
  2588. rank: this.wordInfoList[index].rank,
  2589. });
  2590. }
  2591. return arr;
  2592. }
  2593. onDisable() {
  2594. super.onDisable();
  2595. this.removeEvent();
  2596. }
  2597. destroy() {
  2598. super.destroy();
  2599. }
  2600. show() {
  2601. Laya.stage.addChild(this);
  2602. }
  2603. }
  2604. class ResultView extends game.ui.ResultViewUI {
  2605. constructor() {
  2606. super();
  2607. this.index = 1;
  2608. this.rankIndex = 0;
  2609. }
  2610. onAwake() {
  2611. super.onAwake();
  2612. }
  2613. onEnable() {
  2614. super.onEnable();
  2615. this.addEvent();
  2616. this.index = 1;
  2617. this.setSkin();
  2618. }
  2619. setRank() {
  2620. if (Manager.view.gameView.gameOverData) {
  2621. this.caloriesTxt.text = `${Manager.view.gameView.gameOverData.consume}`;
  2622. this.stepTxt.text = `${Manager.view.gameView.gameOverData.equivalent}`;
  2623. }
  2624. else {
  2625. this.caloriesTxt.text = `等待结算中`;
  2626. this.stepTxt.text = `等待结算中`;
  2627. log("等待结算中");
  2628. Manager.view.gameView.once("onGameEnd", this, this.updateInfo);
  2629. }
  2630. if (!window["SDKBridge"]) {
  2631. this.noRank1.visible = true;
  2632. this.pmFontClip1.visible = false;
  2633. if (Manager.model.selfInfo.avatar)
  2634. this.avatarImg1.skin = Manager.model.selfInfo.avatar;
  2635. this.nameTxt1.text = Manager.model.selfInfo.nickname;
  2636. this.nameTxt1.color = "#ffd905";
  2637. this.rankScore1.text = this.scoreTxt.text + "分";
  2638. this.rankScore1.color = "#ffd905";
  2639. this.rank1.visible = true;
  2640. }
  2641. SDK.getRank(0, (info) => {
  2642. this.wordRankInfo = info[1].list;
  2643. log("世界排行榜", this.wordRankInfo);
  2644. for (let i = 0; i < this.wordRankInfo.length; i++) {
  2645. if (this.wordRankInfo[i].user.id == Manager.model.selfInfo.id) {
  2646. this.selfInfo = this.wordRankInfo[i];
  2647. log("自己的信息", this.selfInfo);
  2648. break;
  2649. }
  2650. }
  2651. if (!this.selfInfo) {
  2652. if (this.wordRankInfo.length == 0) {
  2653. this.noRank1.visible = true;
  2654. this.pmFontClip1.visible = false;
  2655. if (Manager.model.selfInfo.avatar)
  2656. this.avatarImg1.skin = Manager.model.selfInfo.avatar;
  2657. this.nameTxt1.text = Manager.model.selfInfo.nickname;
  2658. this.nameTxt1.color = "#ffd905";
  2659. this.nameTxt1.fontSize = 38;
  2660. this.rankScore1.text = this.scoreTxt.text + "分";
  2661. this.rankScore1.color = "#ffd905";
  2662. this.rankScore1.fontSize = 45;
  2663. this.rank1.visible = true;
  2664. this.rankIndex = 1;
  2665. }
  2666. else if (this.wordRankInfo.length == 1) {
  2667. this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
  2668. if (this.wordRankInfo[0].user.avatar)
  2669. this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
  2670. this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
  2671. this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
  2672. this.noRank2.visible = true;
  2673. this.pmFontClip2.visible = false;
  2674. if (Manager.model.selfInfo.avatar)
  2675. this.avatarImg2.skin = Manager.model.selfInfo.avatar;
  2676. this.nameTxt2.text = Manager.model.selfInfo.nickname;
  2677. this.nameTxt2.color = "#ffd905";
  2678. this.nameTxt2.fontSize = 38;
  2679. this.rankScore2.text = this.scoreTxt.text + "分";
  2680. this.rankScore2.color = "#ffd905";
  2681. this.rankScore2.fontSize = 45;
  2682. this.rank1.visible = true;
  2683. this.rank2.visible = true;
  2684. this.rankIndex = 2;
  2685. }
  2686. else if (this.wordRankInfo.length >= 2) {
  2687. this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
  2688. if (this.wordRankInfo[0].user.avatar)
  2689. this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
  2690. this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
  2691. this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
  2692. this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
  2693. if (this.wordRankInfo[1].user.avatar)
  2694. this.avatarImg2.skin = this.wordRankInfo[0].user.avatar;
  2695. this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
  2696. this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
  2697. this.noRank3.visible = true;
  2698. this.pmFontClip3.visible = false;
  2699. if (Manager.model.selfInfo.avatar)
  2700. this.avatarImg3.skin = Manager.model.selfInfo.avatar;
  2701. this.nameTxt3.text = Manager.model.selfInfo.nickname;
  2702. this.nameTxt3.color = "#ffd905";
  2703. this.nameTxt3.fontSize = 38;
  2704. this.rankScore3.text = this.scoreTxt.text + "分";
  2705. this.rankScore3.color = "#ffd905";
  2706. this.rankScore3.fontSize = 45;
  2707. this.rankIndex = 3;
  2708. this.rank1.visible = true;
  2709. this.rank2.visible = true;
  2710. this.rank3.visible = true;
  2711. }
  2712. }
  2713. else {
  2714. if (this.wordRankInfo.length == 1) {
  2715. this.pmFontClip1.value = `${this.selfInfo.rank}`;
  2716. this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
  2717. if (Manager.model.selfInfo.avatar)
  2718. this.avatarImg1.skin = Manager.model.selfInfo.avatar;
  2719. this.nameTxt1.text = Manager.model.selfInfo.nickname;
  2720. this.nameTxt1.color = "#ffd905";
  2721. this.nameTxt1.fontSize = 38;
  2722. this.rankScore1.text = `${this.selfInfo.score}分`;
  2723. this.rankScore1.color = "#ffd905";
  2724. this.rankScore1.fontSize = 45;
  2725. this.rank1.visible = true;
  2726. this.rankIndex = 1;
  2727. }
  2728. else if (this.wordRankInfo.length == 2) {
  2729. if (this.selfInfo.rank == 1) {
  2730. this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
  2731. if (this.wordRankInfo[1].user.avatar)
  2732. this.avatarImg2.skin = this.wordRankInfo[1].user.avatar;
  2733. this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
  2734. this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
  2735. this.pmFontClip1.value = this.selfInfo.rank;
  2736. this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
  2737. if (Manager.model.selfInfo.avatar)
  2738. this.avatarImg1.skin = Manager.model.selfInfo.avatar;
  2739. this.nameTxt1.text = Manager.model.selfInfo.nickname;
  2740. this.nameTxt1.color = "#ffd905";
  2741. this.nameTxt1.fontSize = 38;
  2742. this.rankScore1.text = `${this.selfInfo.score}分`;
  2743. this.rankScore1.color = "#ffd905";
  2744. this.rankScore1.fontSize = 45;
  2745. this.rankIndex = 1;
  2746. }
  2747. else {
  2748. this.pmFontClip1.value = `${this.wordRankInfo[0].rank}`;
  2749. if (this.wordRankInfo[0].user.avatar)
  2750. this.avatarImg1.skin = this.wordRankInfo[0].user.avatar;
  2751. this.nameTxt1.text = this.wordRankInfo[0].user.nickname;
  2752. this.rankScore1.text = `${this.wordRankInfo[0].score}分`;
  2753. this.pmFontClip2.value = this.selfInfo.rank;
  2754. this.pmFontClip2.skin = "res/imgs/result/text_pm_num.png";
  2755. if (Manager.model.selfInfo.avatar)
  2756. this.avatarImg2.skin = Manager.model.selfInfo.avatar;
  2757. this.nameTxt2.text = Manager.model.selfInfo.nickname;
  2758. this.nameTxt2.color = "#ffd905";
  2759. this.nameTxt2.fontSize = 38;
  2760. this.rankScore2.text = `${this.selfInfo.score}分`;
  2761. this.rankScore2.color = "#ffd905";
  2762. this.rankScore2.fontSize = 45;
  2763. this.rankIndex = 2;
  2764. }
  2765. this.rank1.visible = true;
  2766. this.rank2.visible = true;
  2767. }
  2768. else if (this.wordRankInfo.length >= 3) {
  2769. if (this.selfInfo.rank == 1) {
  2770. this.pmFontClip2.value = `${this.wordRankInfo[1].rank}`;
  2771. if (this.wordRankInfo[1].user.avatar)
  2772. this.avatarImg2.skin = this.wordRankInfo[1].user.avatar;
  2773. this.nameTxt2.text = this.wordRankInfo[1].user.nickname;
  2774. this.rankScore2.text = `${this.wordRankInfo[1].score}分`;
  2775. this.pmFontClip3.value = `${this.wordRankInfo[2].rank}`;
  2776. if (this.wordRankInfo[2].user.avatar)
  2777. this.avatarImg3.skin = this.wordRankInfo[2].user.avatar;
  2778. this.nameTxt3.text = this.wordRankInfo[2].user.nickname;
  2779. this.rankScore3.text = `${this.wordRankInfo[2].score}分`;
  2780. this.pmFontClip1.value = this.selfInfo.rank;
  2781. this.pmFontClip1.skin = "res/imgs/result/text_pm_num.png";
  2782. if (Manager.model.selfInfo.avatar)
  2783. this.avatarImg1.skin = Manager.model.selfInfo.avatar;
  2784. this.nameTxt1.text = Manager.model.selfInfo.nickname;
  2785. this.nameTxt1.color = "#ffd905";
  2786. this.nameTxt1.fontSize = 38;
  2787. this.rankScore1.text = `${this.selfInfo.score}分`;
  2788. this.rankScore1.color = "#ffd905";
  2789. this.rankScore1.fontSize = 45;
  2790. this.rankIndex = 1;
  2791. }
  2792. else if (this.selfInfo.rank == this.wordRankInfo.length) {
  2793. this.pmFontClip1.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 2].rank}`;
  2794. if (this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.avatar)
  2795. this.avatarImg1.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.avatar;
  2796. this.nameTxt1.text = this.wordRankInfo[this.selfInfo.rank - 1 - 2].user.nickname;
  2797. this.rankScore1.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 2].score}分`;
  2798. this.pmFontClip3.value = this.selfInfo.rank;
  2799. this.pmFontClip3.skin = "res/imgs/result/text_pm_num.png";
  2800. if (Manager.model.selfInfo.avatar)
  2801. this.avatarImg3.skin = Manager.model.selfInfo.avatar;
  2802. this.nameTxt3.text = Manager.model.selfInfo.nickname;
  2803. this.nameTxt3.color = "#ffd905";
  2804. this.nameTxt3.fontSize = 38;
  2805. this.rankScore3.text = `${this.selfInfo.score}分`;
  2806. this.rankScore3.color = "#ffd905";
  2807. this.rankScore3.fontSize = 45;
  2808. this.pmFontClip2.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].rank}`;
  2809. if (this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar)
  2810. this.avatarImg2.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar;
  2811. this.nameTxt2.text = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.nickname;
  2812. this.rankScore2.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].score}分`;
  2813. this.rankIndex = 3;
  2814. }
  2815. else {
  2816. this.pmFontClip1.value = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].rank}`;
  2817. if (this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar)
  2818. this.avatarImg1.skin = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.avatar;
  2819. this.nameTxt1.text = this.wordRankInfo[this.selfInfo.rank - 1 - 1].user.nickname;
  2820. this.rankScore1.text = `${this.wordRankInfo[this.selfInfo.rank - 1 - 1].score}分`;
  2821. this.pmFontClip2.value = this.selfInfo.rank;
  2822. this.pmFontClip2.skin = "res/imgs/result/text_pm_num.png";
  2823. if (Manager.model.selfInfo.avatar)
  2824. this.avatarImg2.skin = Manager.model.selfInfo.avatar;
  2825. this.nameTxt2.text = Manager.model.selfInfo.nickname;
  2826. this.nameTxt2.color = "#ffd905";
  2827. this.nameTxt2.fontSize = 38;
  2828. this.rankScore2.text = `${this.selfInfo.score}分`;
  2829. this.rankScore2.color = "#ffd905";
  2830. this.rankScore2.fontSize = 45;
  2831. this.pmFontClip3.value = `${this.wordRankInfo[this.selfInfo.rank - 1 + 1].rank}`;
  2832. if (this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.avatar)
  2833. this.avatarImg3.skin = this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.avatar;
  2834. this.nameTxt3.text = this.wordRankInfo[this.selfInfo.rank - 1 + 1].user.nickname;
  2835. this.rankScore3.text = `${this.wordRankInfo[this.selfInfo.rank - 1 + 1].score}分`;
  2836. this.rankIndex = 2;
  2837. }
  2838. this.rank1.visible = true;
  2839. this.rank2.visible = true;
  2840. this.rank3.visible = true;
  2841. }
  2842. if (this.selfInfo.rank == Manager.view.gameView.selfRank) {
  2843. if (this.rankIndex == 1) {
  2844. this.pmImg1.visible = true;
  2845. this.pmImg1.skin = "res/imgs/result/icon_pmwsb.png";
  2846. }
  2847. else if (this.rankIndex == 2) {
  2848. this.pmImg2.visible = true;
  2849. this.pmImg2.skin = "res/imgs/result/icon_pmwsb.png";
  2850. }
  2851. else if (this.rankIndex == 3) {
  2852. this.pmImg3.visible = true;
  2853. this.pmImg3.skin = "res/imgs/result/icon_pmwsb.png";
  2854. }
  2855. }
  2856. else if (this.selfInfo.rank < Manager.view.gameView.selfRank) {
  2857. if (this.rankIndex == 1) {
  2858. this.pmImg1.visible = true;
  2859. this.pmImg1.skin = "res/imgs/result/icon_pmss.png";
  2860. }
  2861. else if (this.rankIndex == 2) {
  2862. this.pmImg2.visible = true;
  2863. this.pmImg2.skin = "res/imgs/result/icon_pmss.png";
  2864. }
  2865. else if (this.rankIndex == 3) {
  2866. this.pmImg3.visible = true;
  2867. this.pmImg3.skin = "res/imgs/result/icon_pmss.png";
  2868. }
  2869. }
  2870. else {
  2871. if (this.rankIndex == 1) {
  2872. this.pmImg1.visible = true;
  2873. this.pmImg1.skin = "res/imgs/result/icon_pmxj.png";
  2874. }
  2875. else if (this.rankIndex == 2) {
  2876. this.pmImg2.visible = true;
  2877. this.pmImg2.skin = "res/imgs/result/icon_pmxj.png";
  2878. }
  2879. else if (this.rankIndex == 3) {
  2880. this.pmImg3.visible = true;
  2881. this.pmImg3.skin = "res/imgs/result/icon_pmxj.png";
  2882. }
  2883. }
  2884. }
  2885. });
  2886. }
  2887. addEvent() {
  2888. this.homeBtn.on(Laya.Event.CLICK, this, this.onClick);
  2889. this.resetBtn.on(Laya.Event.CLICK, this, this.onClick);
  2890. Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
  2891. SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
  2892. SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
  2893. SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
  2894. }
  2895. removeEvent() {
  2896. this.homeBtn.off(Laya.Event.CLICK, this, this.onClick);
  2897. this.resetBtn.off(Laya.Event.CLICK, this, this.onClick);
  2898. Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
  2899. SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
  2900. SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
  2901. SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
  2902. }
  2903. KeyUp() {
  2904. if (this.index > 1) {
  2905. this.index--;
  2906. }
  2907. else {
  2908. this.index = 2;
  2909. }
  2910. this.setSkin();
  2911. }
  2912. KeyDown() {
  2913. if (this.index < 2) {
  2914. this.index++;
  2915. }
  2916. else {
  2917. this.index = 1;
  2918. }
  2919. this.setSkin();
  2920. }
  2921. KeyEnter() {
  2922. switch (this.index) {
  2923. case 1:
  2924. this.index = 1;
  2925. this.setSkin();
  2926. Manager.view.homeView.show();
  2927. Manager.view.hideGameView();
  2928. Manager.view.hideResultView();
  2929. break;
  2930. case 2:
  2931. this.index = 2;
  2932. this.setSkin();
  2933. core.SoundManager.stopMusic();
  2934. Manager.view.gameView.resetGame();
  2935. Manager.view.gameView.startGame();
  2936. break;
  2937. }
  2938. Manager.view.hideResultView();
  2939. }
  2940. onClick(e) {
  2941. switch (e.currentTarget) {
  2942. case this.homeBtn:
  2943. Manager.view.homeView.show();
  2944. Manager.view.hideGameView();
  2945. break;
  2946. case this.resetBtn:
  2947. core.SoundManager.stopMusic();
  2948. Manager.view.gameView.resetGame();
  2949. Manager.view.gameView.startGame();
  2950. break;
  2951. }
  2952. Manager.view.hideResultView();
  2953. }
  2954. onkeydown(e) {
  2955. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.LEFT)) {
  2956. this.KeyUp();
  2957. }
  2958. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.RIGHT)) {
  2959. this.KeyDown();
  2960. }
  2961. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
  2962. this.KeyEnter();
  2963. }
  2964. }
  2965. setSkin() {
  2966. switch (this.index) {
  2967. case 1:
  2968. this.homeBtn.skin = "res/imgs/result/btom_bright.png";
  2969. this.homeImg.skin = "res/imgs/result/text_an_fhb.png";
  2970. this.resetBtn.skin = "res/imgs/result/btom_dark.png";
  2971. this.resetImg.skin = "res/imgs/result/text_an_zld.png";
  2972. break;
  2973. case 2:
  2974. this.homeBtn.skin = "res/imgs/result/btom_dark.png";
  2975. this.homeImg.skin = "res/imgs/result/text_an_fhd.png";
  2976. this.resetBtn.skin = "res/imgs/result/btom_bright.png";
  2977. this.resetImg.skin = "res/imgs/result/text_an_zlb.png";
  2978. break;
  2979. }
  2980. }
  2981. updateInfo(data) {
  2982. log("onGameEnd", data);
  2983. this.caloriesTxt.text = `${data.consume}`;
  2984. this.stepTxt.text = `${data.equivalent}`;
  2985. }
  2986. onDisable() {
  2987. super.onDisable();
  2988. this.removeEvent();
  2989. }
  2990. destroy() {
  2991. super.destroy();
  2992. }
  2993. show(socre, addScore, subSocre, highSocre, isScoreHigh = false, time) {
  2994. this.setRank();
  2995. this.scoreTxt.text = socre.toString();
  2996. this.addScoreTxt.text = `+${addScore}`;
  2997. this.subScoreTxt.text = `-${subSocre}`;
  2998. this.timeTxt.text = time;
  2999. Laya.stage.addChild(this);
  3000. }
  3001. }
  3002. class PauseView extends game.ui.PauseViewUI {
  3003. constructor() {
  3004. super();
  3005. this.index = 1;
  3006. }
  3007. onAwake() {
  3008. super.onAwake();
  3009. }
  3010. onEnable() {
  3011. super.onEnable();
  3012. this.addEvent();
  3013. this.index = 1;
  3014. }
  3015. addEvent() {
  3016. this.continueBtn.on(Laya.Event.CLICK, this, this.onClick);
  3017. this.resetBtn.on(Laya.Event.CLICK, this, this.onClick);
  3018. this.exitBtn.on(Laya.Event.CLICK, this, this.onClick);
  3019. Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onkeydown);
  3020. SDK.on(CMD.BACK_LEFT.toString(), this.KeyUp, this);
  3021. SDK.on(CMD.BACK_RIGHT.toString(), this.KeyDown, this);
  3022. SDK.on(CMD.ENTER_KEY.toString(), this.KeyEnter, this);
  3023. }
  3024. removeEvent() {
  3025. this.continueBtn.off(Laya.Event.CLICK, this, this.onClick);
  3026. this.resetBtn.off(Laya.Event.CLICK, this, this.onClick);
  3027. this.exitBtn.off(Laya.Event.CLICK, this, this.onClick);
  3028. Laya.stage.off(Laya.Event.KEY_DOWN, this, this.onkeydown);
  3029. SDK.off(CMD.BACK_LEFT.toString(), this.KeyUp);
  3030. SDK.off(CMD.BACK_RIGHT.toString(), this.KeyDown);
  3031. SDK.off(CMD.ENTER_KEY.toString(), this.KeyEnter);
  3032. }
  3033. KeyUp() {
  3034. if (this.index > 1) {
  3035. this.index--;
  3036. }
  3037. else {
  3038. this.index = 3;
  3039. }
  3040. this.setSkin();
  3041. }
  3042. KeyDown() {
  3043. if (this.index < 3) {
  3044. this.index++;
  3045. }
  3046. else {
  3047. this.index = 1;
  3048. }
  3049. this.setSkin();
  3050. }
  3051. KeyEnter() {
  3052. switch (this.index) {
  3053. case 1:
  3054. Manager.view.gameView.continueGame();
  3055. break;
  3056. case 2:
  3057. core.SoundManager.stopMusic();
  3058. Manager.view.gameView.resetGame();
  3059. Manager.view.gameView.startGame();
  3060. break;
  3061. case 3:
  3062. Manager.view.gameView.exitGame();
  3063. break;
  3064. }
  3065. Manager.view.hidePauseViewView();
  3066. }
  3067. onClick(e) {
  3068. switch (e.currentTarget) {
  3069. case this.continueBtn:
  3070. Manager.view.gameView.continueGame();
  3071. break;
  3072. case this.resetBtn:
  3073. core.SoundManager.stopMusic();
  3074. Manager.view.gameView.resetGame();
  3075. Manager.view.gameView.startGame();
  3076. break;
  3077. case this.exitBtn:
  3078. Manager.view.gameView.exitGame();
  3079. break;
  3080. }
  3081. Manager.view.hidePauseViewView();
  3082. }
  3083. onkeydown(e) {
  3084. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.UP)) {
  3085. this.KeyUp();
  3086. }
  3087. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.DOWN)) {
  3088. this.KeyDown();
  3089. }
  3090. if (Laya.KeyBoardManager.hasKeyDown(Laya.Keyboard.ENTER)) {
  3091. this.KeyEnter();
  3092. }
  3093. }
  3094. setSkin() {
  3095. switch (this.index) {
  3096. case 1:
  3097. this.continueBtn.skin = "res/imgs/game/btom_bright.png";
  3098. this.continueImg.skin = "res/imgs/game/text_jxb.png";
  3099. this.resetBtn.skin = "res/imgs/game/btom_dark.png";
  3100. this.resetImg.skin = "res/imgs/game/text_ckd.png";
  3101. this.exitBtn.skin = "res/imgs/game/btom_dark.png";
  3102. this.exitImg.skin = "res/imgs/game/text_tcd.png";
  3103. break;
  3104. case 2:
  3105. this.continueBtn.skin = "res/imgs/game/btom_dark.png";
  3106. this.continueImg.skin = "res/imgs/game/text_jxd.png";
  3107. this.resetBtn.skin = "res/imgs/game/btom_bright.png";
  3108. this.resetImg.skin = "res/imgs/game/text_ckb.png";
  3109. this.exitBtn.skin = "res/imgs/game/btom_dark.png";
  3110. this.exitImg.skin = "res/imgs/game/text_tcd.png";
  3111. break;
  3112. case 3:
  3113. this.continueBtn.skin = "res/imgs/game/btom_dark.png";
  3114. this.continueImg.skin = "res/imgs/game/text_jxd.png";
  3115. this.resetBtn.skin = "res/imgs/game/btom_dark.png";
  3116. this.resetImg.skin = "res/imgs/game/text_ckd.png";
  3117. this.exitBtn.skin = "res/imgs/game/btom_bright.png";
  3118. this.exitImg.skin = "res/imgs/game/text_tcb.png";
  3119. break;
  3120. }
  3121. }
  3122. onDisable() {
  3123. super.onDisable();
  3124. this.removeEvent();
  3125. }
  3126. destroy() {
  3127. super.destroy();
  3128. }
  3129. show() {
  3130. Laya.stage.addChild(this);
  3131. }
  3132. }
  3133. class SettingView extends game.ui.SettingViewUI {
  3134. constructor() {
  3135. super();
  3136. }
  3137. onAwake() {
  3138. super.onAwake();
  3139. }
  3140. onEnable() {
  3141. super.onEnable();
  3142. this.addEvent();
  3143. this.btnMusic.x = core.SoundManager.musicVolume * 366;
  3144. this.btnSound.x = core.SoundManager.soundVolume * 366;
  3145. this.musicBarMask.x = core.SoundManager.musicVolume * (this.musicBar.width) - (this.musicBar.width);
  3146. this.soundBarMask.x = core.SoundManager.soundVolume * (this.soundBar.width) - (this.soundBar.width);
  3147. this.musicTxt.text = Math.ceil(core.SoundManager.musicVolume * 100) + "%";
  3148. this.soundTxt.text = Math.ceil(core.SoundManager.soundVolume * 100) + "%";
  3149. }
  3150. addEvent() {
  3151. this.btnMusic.on(Laya.Event.MOUSE_DOWN, this, this.musicMouseDown);
  3152. this.btnSound.on(Laya.Event.MOUSE_DOWN, this, this.soundMouseDown);
  3153. this.closeBtn.on(Laya.Event.CLICK, this, this.onClick);
  3154. }
  3155. removeEvent() {
  3156. this.btnMusic.off(Laya.Event.MOUSE_DOWN, this, this.musicMouseDown);
  3157. this.btnSound.off(Laya.Event.MOUSE_DOWN, this, this.soundMouseDown);
  3158. this.btnSound.off(Laya.Event.CLICK, this, this.onClick);
  3159. this.closeBtn.off(Laya.Event.CLICK, this, this.onClick);
  3160. Laya.stage.off(Laya.Event.MOUSE_UP, this, this.mouseUp);
  3161. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
  3162. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
  3163. }
  3164. musicMouseDown() {
  3165. Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
  3166. Laya.stage.on(Laya.Event.MOUSE_UP, this, this.mouseUp);
  3167. }
  3168. musicMousMove(e) {
  3169. this.btnMusic.x = e.stageX - this.soundBar.x - this.bg.x;
  3170. if (this.btnMusic.x <= 0)
  3171. this.btnMusic.x = 0;
  3172. if (this.btnMusic.x >= 366)
  3173. this.btnMusic.x = 366;
  3174. this.musicBarMask.x = this.btnMusic.x / 366 * (this.musicBar.width) - (this.musicBar.width);
  3175. core.SoundManager.setMusicVolume(this.btnMusic.x / 366);
  3176. this.musicTxt.text = Math.ceil(core.SoundManager.musicVolume * 100) + "%";
  3177. }
  3178. soundMouseDown() {
  3179. Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
  3180. Laya.stage.on(Laya.Event.MOUSE_UP, this, this.mouseUp);
  3181. }
  3182. soundMousMove(e) {
  3183. this.btnSound.x = e.stageX - this.soundBar.x - this.bg.x;
  3184. if (this.btnSound.x <= 0)
  3185. this.btnSound.x = 0;
  3186. if (this.btnSound.x >= 366)
  3187. this.btnSound.x = 366;
  3188. this.soundBarMask.x = this.btnSound.x / 366 * (this.soundBar.width) - (this.soundBar.width);
  3189. core.SoundManager.setSoundVolume(this.btnSound.x / 366);
  3190. this.soundTxt.text = Math.ceil(core.SoundManager.soundVolume * 100) + "%";
  3191. }
  3192. mouseUp() {
  3193. Laya.stage.off(Laya.Event.MOUSE_UP, this, this.mouseUp);
  3194. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.musicMousMove);
  3195. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.soundMousMove);
  3196. }
  3197. onClick(e) {
  3198. switch (e.currentTarget) {
  3199. case this.closeBtn:
  3200. Manager.view.homeView.show();
  3201. Manager.view.hideSettingView();
  3202. break;
  3203. }
  3204. }
  3205. onDisable() {
  3206. super.onDisable();
  3207. this.removeEvent();
  3208. this.destroy();
  3209. }
  3210. destroy() {
  3211. super.destroy();
  3212. }
  3213. show() {
  3214. Laya.stage.addChild(this);
  3215. }
  3216. }
  3217. class ViewManager {
  3218. get homeView() {
  3219. if (!this._homeView)
  3220. this._homeView = new HomeView();
  3221. return this._homeView;
  3222. }
  3223. hideHomeView() {
  3224. if (this._homeView)
  3225. this._homeView.destroy();
  3226. this._homeView = null;
  3227. }
  3228. get gameView() {
  3229. if (!this._gameView)
  3230. this._gameView = new GameView();
  3231. return this._gameView;
  3232. }
  3233. hideGameView() {
  3234. if (this._gameView)
  3235. this._gameView.destroy();
  3236. this._gameView = null;
  3237. }
  3238. get pauseViewView() {
  3239. if (!this._pauseViewView)
  3240. this._pauseViewView = new PauseView();
  3241. return this._pauseViewView;
  3242. }
  3243. hidePauseViewView() {
  3244. if (this._pauseViewView)
  3245. this._pauseViewView.destroy();
  3246. this._pauseViewView = null;
  3247. }
  3248. get resultView() {
  3249. if (!this._resultView)
  3250. this._resultView = new ResultView();
  3251. return this._resultView;
  3252. }
  3253. hideResultView() {
  3254. if (this._resultView)
  3255. this._resultView.destroy();
  3256. this._resultView = null;
  3257. }
  3258. get rankView() {
  3259. if (!this._rankView)
  3260. this._rankView = new RankView();
  3261. return this._rankView;
  3262. }
  3263. hideRankView() {
  3264. if (this._rankView)
  3265. this._rankView.destroy();
  3266. this._rankView = null;
  3267. }
  3268. get settingView() {
  3269. if (!this._settingView)
  3270. this._settingView = new SettingView();
  3271. return this._settingView;
  3272. }
  3273. hideSettingView() {
  3274. if (this._settingView)
  3275. this._settingView.destroy();
  3276. this._settingView = null;
  3277. }
  3278. }
  3279. class Manager {
  3280. static init() {
  3281. this.view = new ViewManager();
  3282. this.model = new Model();
  3283. this.dataManager = new DataManager();
  3284. this.initFont();
  3285. }
  3286. static initFont() {
  3287. let fonts = Path.fonts;
  3288. for (let i = 0, len = fonts.length; i < len; i++) {
  3289. let font = fonts[i];
  3290. core.FontUtil.registerFont(font.name, font.fntURL, font.pngURL);
  3291. }
  3292. }
  3293. }
  3294. class Main {
  3295. constructor() {
  3296. if (window["Laya3D"])
  3297. Laya3D.init(GameConfig.width, GameConfig.height);
  3298. else
  3299. Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
  3300. Laya["Physics"] && Laya["Physics"].enable();
  3301. Laya["DebugPanel"] && Laya["DebugPanel"].enable();
  3302. Laya.stage.scaleMode = GameConfig.scaleMode;
  3303. Laya.stage.screenMode = GameConfig.screenMode;
  3304. Laya.stage.alignV = GameConfig.alignV;
  3305. Laya.stage.alignH = GameConfig.alignH;
  3306. Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
  3307. Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
  3308. }
  3309. onVersionLoaded() {
  3310. Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
  3311. }
  3312. onConfigLoaded() {
  3313. this.initManager();
  3314. }
  3315. initManager() {
  3316. core.Manager.init(core.GameID.PARKOUR, Laya.Handler.create(this, this.preload));
  3317. }
  3318. preload() {
  3319. LoadingView.instance.preLoad(Laya.Handler.create(this, () => {
  3320. var div = document.getElementById("engineLoading");
  3321. if (div)
  3322. div.parentNode.removeChild(div);
  3323. LoadingView.instance.show();
  3324. Laya.loader.load(Path.preLoadUrls, Laya.Handler.create(this, this.loadComplete), Laya.Handler.create(this, this.onLoading, null, false), null, 1, true, 'preload');
  3325. }));
  3326. }
  3327. onLoading(progress, isReset = false) {
  3328. LoadingView.instance.setProgress(progress, isReset);
  3329. }
  3330. loadComplete() {
  3331. Manager.init();
  3332. Manager.model.init();
  3333. }
  3334. startGame() {
  3335. Manager.view.homeView.show();
  3336. }
  3337. }
  3338. new Main();
  3339. log = function (message, ...args) { };
  3340. }());