var laya = (function (exports) { 'use strict'; class GameConfig { constructor() { } static init() { var reg = Laya.ClassUtils.regClass; } } GameConfig.width = 720; GameConfig.height = 1280; GameConfig.scaleMode = "fixedwidth"; GameConfig.screenMode = "none"; GameConfig.alignV = "top"; GameConfig.alignH = "left"; GameConfig.startScene = "Window/SignWindow.scene"; GameConfig.sceneRoot = ""; GameConfig.debug = false; GameConfig.stat = false; GameConfig.physicsDebug = false; GameConfig.exportSceneToJson = true; GameConfig.init(); var REG = Laya.ClassUtils.regClass; var ui; (function (ui) { var Window; (function (Window) { class FriendPlayingWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(FriendPlayingWindowUI.uiView); } } FriendPlayingWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 138 }, { "type": "Sprite", "props": { "y": 180, "x": 38.5, "var": "panel", "texture": "morefriend/底.png", "alpha": 1 }, "compId": 4 }, { "type": "Button", "props": { "y": 188, "x": 604, "var": "CloseBtn", "stateNum": 1, "skin": "morefriend/x.png" }, "compId": 6 }, { "type": "Text", "props": { "y": 198, "x": 192, "width": 340, "valign": "middle", "text": "好友都在玩的游戏", "height": 50, "fontSize": 42, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 7 }, { "type": "Button", "props": { "y": 1059, "x": 311, "var": "ContinueBtn", "stateNum": 1 }, "compId": 54 }, { "type": "List", "props": { "y": 291, "x": 78, "width": 567, "var": "GameList", "spaceX": 10, "selectEnable": true, "repeatY": 3, "repeatX": 3, "height": 749 }, "compId": 58, "child": [{ "type": "Box", "props": { "y": -1, "x": 5, "width": 172, "renderType": "render", "height": 202 }, "compId": 59, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 172, "height": 202 }, "compId": 116, "child": [{ "type": "Image", "props": { "y": 11, "x": 0, "width": 156, "name": "icon", "height": 152 }, "compId": 60 }, { "type": "Text", "props": { "y": 159, "x": -1, "width": 154, "valign": "middle", "text": "游戏名字", "name": "name", "height": 40, "fontSize": 25, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Sprite", "props": { "y": 0, "x": 121, "texture": "morefriend/NEW.png", "name": "new" }, "compId": 62 }, { "type": "Button", "props": { "width": 172, "name": "btn", "height": 202 }, "compId": 125 }] }] }] }], "loadList": ["local/paiwei_xin_1_1.png", "morefriend/底.png", "morefriend/x.png", "morefriend/NEW.png"], "loadList3D": [] }; Window.FriendPlayingWindowUI = FriendPlayingWindowUI; REG("ui.Window.FriendPlayingWindowUI", FriendPlayingWindowUI); class HomeWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(HomeWindowUI.uiView); } } HomeWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "width": 720, "height": 150 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 46, "skin": "home/shouye_1_1.png", "left": 50 }, "compId": 5, "child": [{ "type": "Sprite", "props": { "y": -6, "x": 0, "texture": "home/shouye_1_2.png" }, "compId": 6 }, { "type": "FontClip", "props": { "y": 16, "x": 60, "width": 106, "var": "goldTex", "value": "0", "skin": "home/shouye_1_3.png", "sheet": "0123456789", "height": 25, "align": "center" }, "compId": 7 }] }] }, { "type": "Image", "props": { "y": 181, "x": 150, "skin": "load/logo(1).png", "scaleY": 0.85, "scaleX": 0.85 }, "compId": 23 }, { "type": "Image", "props": { "y": 319, "x": 295, "skin": "home/guanqia_1_1.png" }, "compId": 24, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 28, "width": 73, "var": "curswtage", "value": "1", "skin": "home/guanqia_1_2.png", "sheet": "0123456789", "scaleY": 1, "scaleX": 1, "height": 33, "align": "center" }, "compId": 22 }] }, { "type": "Box", "props": { "y": 309, "x": 0, "width": 720, "height": 277 }, "compId": 9, "child": [{ "type": "Button", "props": { "x": 1, "var": "settingBtn", "top": 0, "stateNum": 1, "skin": "home/shouye_1_6.png" }, "compId": 8 }, { "type": "Button", "props": { "var": "signBtn", "stateNum": 1, "skin": "home/shouye_1_5.png", "left": 0, "bottom": 0 }, "compId": 10 }, { "type": "Button", "props": { "var": "taskBtn", "stateNum": 1, "skin": "home/shouye_1_4.png", "right": 0, "bottom": 0 }, "compId": 11 }, { "type": "Button", "props": { "y": 0, "var": "rankBtn", "top": 0, "stateNum": 1, "skin": "home/shouye_1_6_1.png", "right": 0 }, "compId": 21 }] }, { "type": "Button", "props": { "x": 581, "var": "skinshop", "stateNum": 1, "skin": "home/shouye_1_8.png", "bottom": 334 }, "compId": 12 }, { "type": "Box", "props": { "x": 1, "width": 720, "var": "guide", "height": 181, "bottom": 465 }, "compId": 13, "child": [{ "type": "Sprite", "props": { "y": 26, "x": 135, "texture": "home/beijing_2_6(1)(1).png" }, "compId": 25 }, { "type": "Image", "props": { "y": 89, "x": 315, "skin": "home/beijing_2_5(1).png" }, "compId": 26 }, { "type": "Sprite", "props": { "y": 31, "x": 241, "visible": false, "texture": "home/shouye_1_7.png" }, "compId": 14 }, { "type": "Sprite", "props": { "y": 194, "x": 310, "width": 75, "visible": false, "var": "hand", "texture": "home/shouye_1_7_2.png", "pivotX": 28, "height": 89 }, "compId": 15 }, { "type": "Image", "props": { "y": 172, "x": 303, "width": 113, "visible": false, "var": "guide1", "skin": "home/shouye_1_7_1.png", "height": 11 }, "compId": 16 }, { "type": "Image", "props": { "y": 129, "x": 416, "width": 113, "visible": false, "var": "guide2", "skin": "home/shouye_1_7_1.png", "scaleX": -1, "height": 11 }, "compId": 20 }] }, { "type": "Button", "props": { "x": 191, "var": "baginBtn", "stateNum": 1, "skin": "home/shouye_1_9.png", "labelSize": 40, "labelFont": "SimHei", "labelBold": true, "bottom": 325 }, "compId": 3 }, { "type": "Button", "props": { "x": 212, "width": 296, "var": "rebtn", "stateNum": 1, "skin": "home/5底.png", "height": 98, "bottom": 220 }, "compId": 28, "child": [{ "type": "Image", "props": { "y": 13, "width": 60, "name": "icon", "left": 28, "height": 60 }, "compId": 29 }, { "type": "Text", "props": { "y": 22.5, "x": 97, "width": 158, "valign": "middle", "text": "微信小游戏", "name": "name", "height": 41, "fontSize": 30, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 30 }] }, { "type": "Button", "props": { "y": 190, "x": 15, "var": "LeaveBtn", "stateNum": 1, "skin": "homepage/x.png" }, "compId": 34 }, { "type": "Button", "props": { "y": 181, "x": 608, "var": "moreFunBtn", "stateNum": 1, "skin": "homepage/更多好玩.png" }, "compId": 35, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 72, "texture": "homepage/点.png", "name": "RedPoint" }, "compId": 38 }] }], "animations": [{ "nodes": [{ "target": 26, "keyframes": { "y": [{ "value": 89, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "y", "index": 0 }, { "value": 89, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "y", "index": 20 }], "x": [{ "value": 315, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "x", "index": 0 }, { "value": 115, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "x", "index": 20 }, { "value": 315, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "x", "index": 40 }, { "value": 540, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "x", "index": 65 }, { "value": 315, "tweenMethod": "linearNone", "tween": true, "target": 26, "key": "x", "index": 90 }] } }], "name": "ani1", "id": 1, "frameRate": 40, "action": 2 }], "loadList": ["home/shouye_1_1.png", "home/shouye_1_2.png", "home/shouye_1_3.png", "load/logo(1).png", "home/guanqia_1_1.png", "home/guanqia_1_2.png", "home/shouye_1_6.png", "home/shouye_1_5.png", "home/shouye_1_4.png", "home/shouye_1_6_1.png", "home/shouye_1_8.png", "home/beijing_2_6(1)(1).png", "home/beijing_2_5(1).png", "home/shouye_1_7.png", "home/shouye_1_7_2.png", "home/shouye_1_7_1.png", "home/shouye_1_9.png", "home/5底.png", "homepage/x.png", "homepage/更多好玩.png", "homepage/点.png"], "loadList3D": [] }; Window.HomeWindowUI = HomeWindowUI; REG("ui.Window.HomeWindowUI", HomeWindowUI); class InGameWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(InGameWindowUI.uiView); } } InGameWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "FontClip", "props": { "y": 221, "x": 279, "width": 108, "var": "score", "value": "0", "skin": "local/fuhuo_1_3_5.png", "sheet": "0123456789", "scaleY": 1.5, "scaleX": 1.5, "height": 36, "align": "center" }, "compId": 15 }, { "type": "Box", "props": { "width": 720, "visible": false, "name": "test", "height": 1280 }, "compId": 9, "child": [{ "type": "Text", "props": { "y": 176, "x": 119.5, "width": 480, "visible": false, "valign": "middle", "text": "0", "height": 126, "fontSize": 100, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 3 }, { "type": "Text", "props": { "y": 3, "x": 0, "width": 185, "visible": false, "var": "extraspeedtime", "valign": "middle", "text": "0", "height": 78, "fontSize": 80, "color": "#ff0400", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 5 }, { "type": "Text", "props": { "y": 3, "x": 535, "width": 185, "visible": false, "var": "flytime", "valign": "middle", "text": "0", "height": 78, "fontSize": 80, "color": "#ff0400", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 3, "x": 267, "width": 185, "visible": false, "var": "speed", "valign": "middle", "text": "0", "height": 78, "fontSize": 80, "color": "#ff0400", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 7 }, { "type": "Text", "props": { "y": 604, "x": 0, "width": 720, "visible": false, "var": "road", "valign": "middle", "text": "0", "height": 78, "fontSize": 80, "color": "#ff0400", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }] }, { "type": "List", "props": { "y": 496, "width": 250, "visible": false, "var": "ranklist", "spaceY": 5, "right": 83, "repeatY": 6, "height": 390 }, "compId": 10, "child": [{ "type": "Box", "props": { "width": 250, "renderType": "render", "height": 60 }, "compId": 12, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 250, "skin": "local/paiwei_xin_1_1.png", "height": 60, "sizeGrid": "50,50,50,50" }, "compId": 11, "child": [{ "type": "Text", "props": { "y": 13, "x": 14, "width": 148, "valign": "middle", "text": "草莓1号", "name": "name", "height": 35, "fontSize": 30, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }, { "type": "Text", "props": { "y": 17, "x": 162, "width": 74, "valign": "middle", "text": "100", "name": "score", "height": 26, "fontSize": 20, "font": "SimSun", "color": "#d8ff0b", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }] }] }] }, { "type": "Box", "props": { "y": 156.5, "x": 561, "width": 99, "var": "shiwan", "renderType": "render", "height": 129 }, "compId": 20, "child": [{ "type": "Button", "props": { "y": 10, "x": 0, "stateNum": 1, "skin": "tryplay/点击试玩.png", "name": "btn", "alpha": 0.5 }, "compId": 17 }, { "type": "Image", "props": { "y": 18, "x": 12, "width": 78, "name": "icon", "height": 77 }, "compId": 18 }, { "type": "Sprite", "props": { "y": 1, "x": 79, "texture": "tryplay/圆点.png" }, "compId": 19 }] }], "loadList": ["local/fuhuo_1_3_5.png", "local/paiwei_xin_1_1.png", "tryplay/点击试玩.png", "tryplay/圆点.png"], "loadList3D": [] }; Window.InGameWindowUI = InGameWindowUI; REG("ui.Window.InGameWindowUI", InGameWindowUI); class LoadWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(LoadWindowUI.uiView); } } LoadWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "load/jiazai_2.png", "name": "bg", "bottom": 0, "sizeGrid": "20,20,20,20" }, "compId": 4, "child": [{ "type": "Image", "props": { "x": 0, "skin": "load/jiazai_1.png", "bottom": 0 }, "compId": 5 }, { "type": "Sprite", "props": { "y": 191, "x": 113, "texture": "load/logo(1).png" }, "compId": 6 }] }, { "type": "Box", "props": { "width": 720, "height": 80, "bottom": 0 }, "compId": 9, "child": [{ "type": "ProgressBar", "props": { "y": 36, "x": 24, "width": 671, "var": "progress", "skin": "load/jiazai.png", "sizeGrid": "5,15,5,15", "height": 24 }, "compId": 3 }, { "type": "Text", "props": { "y": 0, "x": 341, "width": 73, "var": "preTex", "valign": "middle", "text": "50%", "height": 36, "fontSize": 30, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }] }], "loadList": ["load/jiazai_2.png", "load/jiazai_1.png", "load/logo(1).png", "load/jiazai.png"], "loadList3D": [] }; Window.LoadWindowUI = LoadWindowUI; REG("ui.Window.LoadWindowUI", LoadWindowUI); class MoreFunWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(MoreFunWindowUI.uiView); } } MoreFunWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 92 }, { "type": "Sprite", "props": { "y": 160, "x": 38.5, "var": "panel", "texture": "morefriend/底.png", "alpha": 1 }, "compId": 14 }, { "type": "Button", "props": { "y": 168, "x": 602, "var": "CloseBtn", "stateNum": 1, "skin": "morefriend/x.png" }, "compId": 54 }, { "type": "Text", "props": { "y": 178, "x": 203, "width": 320, "valign": "middle", "text": "更多好玩的游戏", "height": 50, "fontSize": 42, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 55 }, { "type": "Button", "props": { "y": 1039, "x": 313, "var": "ContinueBtn", "stateNum": 1 }, "compId": 65 }, { "type": "List", "props": { "y": 252, "x": 63, "width": 601, "var": "GameList", "spaceY": 13, "spaceX": 5, "height": 763 }, "compId": 85, "child": [{ "type": "Box", "props": { "y": 6, "x": 3, "width": 192, "renderType": "render", "height": 238 }, "compId": 86, "child": [{ "type": "Sprite", "props": { "y": 4.5, "x": 3, "texture": "morefriend/1.png", "name": "di" }, "compId": 87, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 187, "name": "icon", "height": 171 }, "compId": 88 }, { "type": "Text", "props": { "y": 179, "x": 13, "width": 80, "valign": "middle", "text": "游戏名字", "name": "name", "height": 20, "fontSize": 15, "font": "SimHei", "color": "#ffffff", "bold": false, "align": "left", "runtime": "laya.display.Text" }, "compId": 89 }, { "type": "Text", "props": { "y": 199, "x": 13, "width": 95, "valign": "middle", "text": "355631人在玩", "name": "num", "height": 20, "fontSize": 15, "font": "SimHei", "color": "#ffffff", "bold": false, "align": "left", "runtime": "laya.display.Text" }, "compId": 90 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 187, "name": "btn", "height": 231 }, "compId": 91 }] }] }] }], "loadList": ["local/paiwei_xin_1_1.png", "morefriend/底.png", "morefriend/x.png", "morefriend/1.png"], "loadList3D": [] }; Window.MoreFunWindowUI = MoreFunWindowUI; REG("ui.Window.MoreFunWindowUI", MoreFunWindowUI); class OffLineWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(OffLineWindowUI.uiView); } } OffLineWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280, "alpha": 1 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 69 }, { "type": "Sprite", "props": { "y": 336, "x": 146, "var": "panel", "texture": "offline/底.png", "alpha": 1 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 6, "x": 122, "width": 180, "valign": "middle", "text": "离线收益", "height": 50, "fontSize": 28, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 5 }, { "type": "Box", "props": { "y": 58, "x": 114, "width": 194, "name": "Box", "height": 255, "alpha": 1 }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 36, "x": 15, "skin": "offline/金币.png" }, "compId": 7 }, { "type": "Text", "props": { "y": 203, "x": 29, "width": 86, "valign": "middle", "text": "金币 X", "height": 41, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 43 }, { "type": "Text", "props": { "y": 203, "x": 115, "width": 66, "valign": "middle", "text": "108", "name": "Num", "height": 41, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 45 }] }] }, { "type": "List", "props": { "y": 241, "x": 20, "width": 105, "var": "GameListLeft", "repeatY": 5, "repeatX": 1, "height": 652 }, "compId": 46, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 106, "renderType": "render", "height": 141 }, "compId": 53, "child": [{ "type": "Sprite", "props": {}, "compId": 56, "child": [{ "type": "Image", "props": { "y": -1, "x": 7.5, "width": 100, "name": "icon", "height": 100 }, "compId": 54 }, { "type": "Text", "props": { "y": 99, "x": 7.5, "width": 100, "valign": "middle", "text": "游戏名字", "name": "name", "height": 20, "fontSize": 16, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 55 }, { "type": "Button", "props": { "y": -1, "x": 6, "width": 106, "name": "btn", "height": 120 }, "compId": 66 }] }] }] }, { "type": "List", "props": { "y": 241, "x": 596, "width": 105, "var": "GameListRight", "repeatY": 5, "repeatX": 1, "height": 652 }, "compId": 57, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 106, "renderType": "render", "height": 141 }, "compId": 58, "child": [{ "type": "Sprite", "props": {}, "compId": 59, "child": [{ "type": "Image", "props": { "y": 0, "x": 12, "width": 100, "name": "icon", "height": 100 }, "compId": 60 }, { "type": "Text", "props": { "y": 100, "x": 12, "width": 100, "valign": "middle", "text": "游戏名字", "name": "name", "height": 20, "fontSize": 16, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Button", "props": { "y": -1, "x": 6, "width": 106, "name": "btn", "height": 120 }, "compId": 67 }] }] }] }, { "type": "Box", "props": { "y": 841, "x": 361, "width": 305, "var": "BtnBox", "pivotY": 75, "pivotX": 153, "height": 150 }, "compId": 70, "child": [{ "type": "Button", "props": { "y": 5, "x": 4, "var": "DoubleBtn", "stateNum": 1, "skin": "offline/双倍.png" }, "compId": 9 }, { "type": "Button", "props": { "y": 93, "x": 76, "width": 172, "var": "GetBtn", "height": 57 }, "compId": 63, "child": [{ "type": "Text", "props": { "y": 8, "x": -12, "width": 172, "valign": "middle", "text": "直接领取", "height": 57, "fontSize": 35, "font": "SimHei", "color": "#f9ffff", "bold": false, "align": "center", "runtime": "laya.display.Text" }, "compId": 65 }] }] }], "loadList": ["local/paiwei_xin_1_1.png", "offline/底.png", "offline/金币.png", "offline/双倍.png"], "loadList3D": [] }; Window.OffLineWindowUI = OffLineWindowUI; REG("ui.Window.OffLineWindowUI", OffLineWindowUI); class QueueWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(QueueWindowUI.uiView); } } QueueWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Image", "props": { "y": 440, "x": 60, "width": 600, "skin": "queue/shangcheng_1_4_2.png", "height": 400, "sizeGrid": "100,100,100,100" }, "compId": 5, "child": [{ "type": "Sprite", "props": { "y": -33, "x": 60, "texture": "queue/pipei_1_1.png" }, "compId": 4 }] }, { "type": "Box", "props": { "y": 553, "x": 204, "width": 312, "var": "quelist", "height": 201 }, "compId": 6, "child": [{ "type": "Image", "props": { "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 7 }, { "type": "Image", "props": { "y": 0, "x": 110, "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 9 }, { "type": "Image", "props": { "y": 0, "x": 220, "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 10 }, { "type": "Image", "props": { "y": 110, "x": 0, "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 12 }, { "type": "Image", "props": { "y": 110, "x": 110, "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 13 }, { "type": "Image", "props": { "y": 110, "x": 220, "width": 90, "visible": true, "skin": "queue/pipei_1_2.png", "height": 90 }, "compId": 14 }] }], "loadList": ["local/paiwei_xin_1_1.png", "queue/shangcheng_1_4_2.png", "queue/pipei_1_1.png", "queue/pipei_1_2.png"], "loadList3D": [] }; Window.QueueWindowUI = QueueWindowUI; REG("ui.Window.QueueWindowUI", QueueWindowUI); class RankWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(RankWindowUI.uiView); } } RankWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Image", "props": { "y": 137, "x": 80, "width": 560, "skin": "rank/shezhi_1_4.png", "height": 1050, "sizeGrid": "9,15,30,17" }, "compId": 22, "child": [{ "type": "Image", "props": { "y": 100, "x": 23, "width": 514, "skin": "rank/paihang_1_4.png", "height": 100, "sizeGrid": "18,85,24,105" }, "compId": 44 }, { "type": "Image", "props": { "y": 300, "x": 23, "width": 514, "skin": "rank/paihang_1_4.png", "height": 100, "sizeGrid": "18,85,24,105" }, "compId": 46 }, { "type": "Image", "props": { "y": 500, "x": 23, "width": 514, "skin": "rank/paihang_1_4.png", "height": 100, "sizeGrid": "18,85,24,105" }, "compId": 48 }, { "type": "Image", "props": { "y": 700, "x": 23, "width": 514, "skin": "rank/paihang_1_4.png", "height": 100, "sizeGrid": "18,85,24,105" }, "compId": 50 }, { "type": "Image", "props": { "y": 900, "x": 23, "width": 514, "skin": "rank/paihang_1_4.png", "height": 100, "sizeGrid": "18,85,24,105" }, "compId": 52 }] }, { "type": "Image", "props": { "y": 85, "x": 220, "skin": "rank/shezhi_1_2.png", "sizeGrid": "8,16,26,13" }, "compId": 43, "child": [{ "type": "Image", "props": { "x": 67, "top": 11, "skin": "rank/paihang_1_5.png" }, "compId": 4 }] }, { "type": "Button", "props": { "y": 618, "var": "nextpageBtn", "stateNum": 1, "skin": "rank/paiwei_xin_1_4.png", "scaleX": -1, "right": 40 }, "compId": 20 }, { "type": "Button", "props": { "y": 618, "var": "uppageBtn", "stateNum": 1, "skin": "rank/paiwei_xin_1_4.png", "rotation": 0, "left": 0 }, "compId": 21 }, { "type": "Button", "props": { "x": 578, "var": "closeBtn", "top": 137, "stateNum": 1, "skin": "rank/shezhi_1_3.png", "scaleY": 1.3, "scaleX": 1.3 }, "compId": 6 }], "loadList": ["local/paiwei_xin_1_1.png", "rank/shezhi_1_4.png", "rank/paihang_1_4.png", "rank/shezhi_1_2.png", "rank/paihang_1_5.png", "rank/paiwei_xin_1_4.png", "rank/shezhi_1_3.png"], "loadList3D": [] }; Window.RankWindowUI = RankWindowUI; REG("ui.Window.RankWindowUI", RankWindowUI); class RecommendWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(RecommendWindowUI.uiView); } } RecommendWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "width": 720, "visible": false, "var": "cainixihuan", "mouseThrough": true, "height": 210, "bottom": 0 }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 5, "x": 0, "width": 750, "skin": "re/re_like-box-black.png", "height": 210, "bottom": 0 }, "compId": 4 }, { "type": "List", "props": { "width": 720, "var": "cainixihuanlist", "spaceX": 0, "repeatY": 1, "left": 60, "height": 210, "bottom": 0 }, "compId": 5, "child": [{ "type": "Box", "props": { "y": 10, "x": 0, "width": 154, "renderType": "render", "height": 204 }, "compId": 6, "child": [{ "type": "Sprite", "props": { "y": 14, "x": 5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 5, "x": 2, "width": 140, "top": 5, "name": "icon", "height": 140 }, "compId": 8 }, { "type": "Text", "props": { "y": 152, "x": 2, "width": 140, "valign": "middle", "text": "猜你喜欢", "name": "name", "height": 23, "fontSize": 20, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 37 }, { "type": "Button", "props": { "y": 7, "x": 2, "width": 139, "name": "btn", "height": 165 }, "compId": 34 }] }] }] }] }, { "type": "Box", "props": { "y": 701, "x": 62, "width": 129, "visible": false, "var": "baokuanyouxi", "styleSkin": "localview/超级好玩@2x.png", "pivotY": 81, "pivotX": 65, "mouseThrough": true, "height": 161 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 10, "x": 0, "width": 129, "skin": "re/re_item.png", "height": 140, "sizeGrid": "9,10,12,8" }, "compId": 33 }, { "type": "Image", "props": { "y": 20, "x": 4, "width": 120, "name": "icon", "height": 120 }, "compId": 13 }, { "type": "Button", "props": { "y": 8, "x": 5, "width": 119, "name": "btn", "height": 145 }, "compId": 36 }] }, { "type": "Box", "props": { "y": 358, "x": 0, "width": 720, "visible": false, "var": "siwangtuijian", "mouseThrough": true, "height": 452 }, "compId": 53, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "styleSkin": "localview/chouti_bg.png", "height": 449 }, "compId": 54, "child": [{ "type": "Image", "props": { "y": 27, "x": 35, "width": 650, "skin": "re/re_end-box.png", "height": 420 }, "compId": 55, "child": [{ "type": "Sprite", "props": { "y": -42, "x": 48, "texture": "re/re_end-title.png" }, "compId": 56 }] }] }, { "type": "List", "props": { "y": 54, "x": 69, "width": 582, "var": "siwangtuijianlist", "spaceY": 5, "spaceX": 20, "repeatY": 2, "repeatX": 3, "height": 379 }, "compId": 57, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 180, "renderType": "render", "height": 185 }, "compId": 58, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 180, "skin": "re/re_item.png", "height": 180, "sizeGrid": "9,10,12,8" }, "compId": 59, "child": [{ "type": "Image", "props": { "y": 10, "x": 20, "width": 140, "top": 10, "name": "icon", "height": 140 }, "compId": 60 }, { "type": "Text", "props": { "y": 150, "x": 8, "width": 163, "valign": "middle", "text": "猜你喜欢", "name": "name", "height": 27, "fontSize": 25, "font": "SimHei", "color": "#4c4040", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Button", "props": { "y": 7, "x": 15, "width": 150, "name": "btn", "height": 165 }, "compId": 62 }] }] }] }] }, { "type": "Box", "props": { "x": 0, "width": 720, "visible": false, "var": "chouti", "top": 10, "mouseThrough": true, "bottom": 0 }, "compId": 39, "child": [{ "type": "Button", "props": { "y": 640, "x": 720, "var": "choutiBtn", "stateNum": 1, "skin": "re/arrow-right.png", "scaleX": -1 }, "compId": 79 }, { "type": "Image", "props": { "x": 0, "width": 720, "visible": false, "var": "choutiview", "top": 0, "skin": "re/res1(1).png", "bottom": 0 }, "compId": 64, "child": [{ "type": "Button", "props": { "x": 242, "var": "sharebtn", "top": 82, "stateNum": 1, "skin": "re/分享.png", "scaleY": 1, "scaleX": 1 }, "compId": 66 }, { "type": "Button", "props": { "x": 0, "var": "closeCt", "top": 80, "stateNum": 1, "skin": "re/res2.png", "scaleY": 0.6, "scaleX": 0.6 }, "compId": 65 }, { "type": "Image", "props": { "x": 29, "width": 661, "top": 200, "skin": "re/re_item.png", "height": 140, "sizeGrid": "9,10,12,8" }, "compId": 71, "child": [{ "type": "List", "props": { "y": 10, "x": 10, "width": 640, "var": "ctList", "spaceX": 10, "repeatY": 1, "height": 120 }, "compId": 72, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 120, "renderType": "render", "height": 120 }, "compId": 73, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 120, "name": "icon", "height": 120 }, "compId": 75 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 120, "name": "btn", "height": 120 }, "compId": 80 }] }] }, { "type": "Text", "props": { "y": 151, "x": 0, "width": 121, "valign": "middle", "text": "热门推荐", "height": 36, "fontSize": 30, "font": "SimHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 67 }, { "type": "Text", "props": { "y": -40, "x": 1, "width": 121, "valign": "middle", "text": "好友在玩", "height": 36, "fontSize": 30, "font": "SimHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 69 }] }, { "type": "List", "props": { "x": 43, "width": 661, "var": "choutilist", "top": 410, "spaceX": 10, "repeatY": 3, "repeatX": 3, "height": 860, "bottom": 0 }, "compId": 45, "child": [{ "type": "Box", "props": { "width": 210, "renderType": "render", "height": 280 }, "compId": 46, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 210, "skin": "re/re_item.png", "height": 256, "sizeGrid": "9,10,12,8" }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 9, "width": 192, "top": 15, "name": "icon", "height": 183 }, "compId": 49 }, { "type": "Text", "props": { "y": 212, "x": 10, "width": 105, "valign": "middle", "text": "猜你喜欢", "name": "name", "height": 44, "fontSize": 15, "color": "#00a3ff", "bold": true, "align": "left", "runtime": "laya.display.Text" }, "compId": 50 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 211, "name": "btn", "height": 254 }, "compId": 51 }, { "type": "Text", "props": { "y": 212, "x": 61, "width": 140, "valign": "middle", "text": "654654人玩", "name": "num", "height": 44, "fontSize": 15, "font": "SimHei", "color": "#ff001e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 68 }] }] }] }] }] }], "animations": [{ "nodes": [{ "target": 10, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleY", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleY", "index": 30 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleX", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "scaleX", "index": 30 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["re/re_like-box-black.png", "localview/超级好玩@2x.png", "re/re_item.png", "localview/chouti_bg.png", "re/re_end-box.png", "re/re_end-title.png", "re/arrow-right.png", "re/res1(1).png", "re/分享.png", "re/res2.png"], "loadList3D": [] }; Window.RecommendWindowUI = RecommendWindowUI; REG("ui.Window.RecommendWindowUI", RecommendWindowUI); class ReviveWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(ReviveWindowUI.uiView); } } ReviveWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Image", "props": { "y": 47, "x": 148, "skin": "revive/fuhuo_1_1.png" }, "compId": 4, "child": [{ "type": "FontClip", "props": { "y": 8.5, "x": 5, "width": 64, "var": "stagetex", "value": "1", "skin": "revive/fuhuo_1_1_3.png", "sheet": "0123456789", "height": 29, "align": "center" }, "compId": 6 }, { "type": "ProgressBar", "props": { "y": 5, "x": 69, "width": 346, "var": "stagepre", "value": 0.25, "skin": "revive/fuhuo_1_1_.png", "height": 36 }, "compId": 7 }] }, { "type": "Sprite", "props": { "y": 124, "x": 243.5, "texture": "revive/fuhuo_1_1_4.png" }, "compId": 8 }, { "type": "Box", "props": { "y": 174, "x": 0, "width": 720, "var": "precent", "height": 92 }, "compId": 9, "child": [{ "type": "Box", "props": { "x": 292, "width": 136, "top": 0, "height": 60 }, "compId": 12, "child": [{ "type": "FontClip", "props": { "y": 8, "width": 73, "var": "stageClip", "value": "50", "skin": "revive/fuhuo_1_1_6.png", "sheet": "0123456789", "left": 0, "height": 43, "align": "center" }, "compId": 10 }, { "type": "Image", "props": { "y": 7, "skin": "revive/fuhuo_1_1_5.png", "right": 0 }, "compId": 11 }] }, { "type": "Image", "props": { "x": 311, "top": 60, "skin": "revive/fuhuo_1_1_7.png" }, "compId": 13 }, { "type": "Image", "props": { "x": 130, "skin": "revive/fuhuo_1_2.png", "bottom": 0 }, "compId": 14 }] }, { "type": "Sprite", "props": { "y": 257, "x": 571, "width": 218, "texture": "local/fuhuo_1_3_1.png", "rotation": 90, "pivotY": 108, "pivotX": 109, "height": 216 }, "compId": 16 }, { "type": "Sprite", "props": { "y": 272, "x": 279, "texture": "local/fuhuo_1_1_8.png" }, "compId": 17 }, { "type": "Sprite", "props": { "y": 137, "x": 462, "texture": "local/fuhuo_1_3_3.png" }, "compId": 18, "child": [{ "type": "FontClip", "props": { "y": 130, "x": 51, "width": 136, "var": "getmoney", "value": "120", "skin": "local/fuhuo_1_3_5.png", "sheet": "0123456789", "height": 36, "align": "left" }, "compId": 19, "child": [{ "type": "Sprite", "props": { "y": -1, "x": -35, "texture": "local/fuhuo_1_3_4.png", "scaleY": 1.5, "scaleX": 1.5 }, "compId": 20 }] }] }, { "type": "Box", "props": { "x": 235, "width": 250, "var": "showpan", "height": 250, "bottom": 445 }, "compId": 24 }, { "type": "Box", "props": { "x": 0, "width": 720, "var": "BtnPan", "height": 178, "bottom": 300 }, "compId": 23, "child": [{ "type": "Button", "props": { "y": 63, "x": 360, "width": 363, "var": "reviveBtn", "stateNum": 1, "skin": "revive/fuhuo_1_4.png", "pivotY": 63, "pivotX": 182, "height": 125 }, "compId": 21 }, { "type": "Button", "props": { "x": 308, "var": "passBtn", "stateNum": 1, "skin": "revive/fuhuo_1_4_1.png", "bottom": 0 }, "compId": 22 }] }], "animations": [{ "nodes": [{ "target": 21, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleY", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleY", "index": 30 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleX", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "scaleX", "index": 30 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 16, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 16, "key": "rotation", "index": 0 }, { "value": 45, "tweenMethod": "linearNone", "tween": true, "target": 16, "key": "rotation", "index": 5 }, { "value": 90, "tweenMethod": "linearNone", "tween": true, "target": 16, "key": "rotation", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }], "loadList": ["local/paiwei_xin_1_1.png", "revive/fuhuo_1_1.png", "revive/fuhuo_1_1_3.png", "revive/fuhuo_1_1_.png", "revive/fuhuo_1_1_4.png", "revive/fuhuo_1_1_6.png", "revive/fuhuo_1_1_5.png", "revive/fuhuo_1_1_7.png", "revive/fuhuo_1_2.png", "local/fuhuo_1_3_1.png", "local/fuhuo_1_1_8.png", "local/fuhuo_1_3_3.png", "local/fuhuo_1_3_5.png", "local/fuhuo_1_3_4.png", "revive/fuhuo_1_4.png", "revive/fuhuo_1_4_1.png"], "loadList3D": [] }; Window.ReviveWindowUI = ReviveWindowUI; REG("ui.Window.ReviveWindowUI", ReviveWindowUI); class SettingWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(SettingWindowUI.uiView); } } SettingWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Box", "props": { "y": 340, "x": 35, "width": 650, "height": 600 }, "compId": 5, "child": [{ "type": "Image", "props": { "x": 0, "width": 650, "skin": "setting/shezhi_1_4.png", "height": 400, "bottom": 100, "sizeGrid": "35,215,24,194" }, "compId": 6 }, { "type": "Image", "props": { "x": 186, "top": 58, "skin": "setting/shezhi_1_2.png", "sizeGrid": "9,15,26,15" }, "compId": 7, "child": [{ "type": "Sprite", "props": { "y": 10, "x": 91.5, "texture": "setting/shezhi_1_1.png" }, "compId": 24 }] }, { "type": "Button", "props": { "var": "closeBtn", "top": 58, "stateNum": 1, "skin": "setting/shezhi_1_3.png", "scaleY": 1.3, "scaleX": 1.3, "right": -22 }, "compId": 8 }, { "type": "Image", "props": { "y": 344, "skin": "setting/shezhi_1_5_5.png", "left": 50 }, "compId": 9 }, { "type": "Image", "props": { "y": 208, "skin": "setting/shezhi_1_5_4.png", "left": 50 }, "compId": 10 }, { "type": "Image", "props": { "y": 360.5, "x": 420, "var": "shakePan", "skin": "setting/shezhi_1_5_1.png" }, "compId": 11, "child": [{ "type": "Image", "props": { "y": -29, "x": -20, "visible": false, "skin": "setting/shezhi_1_5_3.png", "name": "closeSprite", "left": -20 }, "compId": 12 }, { "type": "Image", "props": { "y": -29, "visible": false, "skin": "setting/shezhi_1_5_2.png", "right": -20, "name": "openSprite" }, "compId": 14 }, { "type": "Button", "props": { "y": -31, "x": -22, "width": 180, "name": "button", "height": 73 }, "compId": 16 }] }, { "type": "Image", "props": { "y": 224.5, "x": 420, "var": "soundPan", "skin": "setting/shezhi_1_5_1.png" }, "compId": 17, "child": [{ "type": "Image", "props": { "y": -29, "x": -20, "visible": false, "skin": "setting/shezhi_1_5_3.png", "name": "closeSprite", "left": -20 }, "compId": 18 }, { "type": "Image", "props": { "y": -29, "x": 88, "visible": false, "skin": "setting/shezhi_1_5_2.png", "right": -20, "name": "openSprite" }, "compId": 20 }, { "type": "Button", "props": { "y": -28, "x": -22, "width": 180, "name": "button", "height": 73 }, "compId": 22 }] }, { "type": "Text", "props": { "y": 519, "x": 24, "width": 602, "var": "userid", "valign": "middle", "text": "用户ID:0000", "height": 59, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }], "loadList": ["local/paiwei_xin_1_1.png", "setting/shezhi_1_4.png", "setting/shezhi_1_2.png", "setting/shezhi_1_1.png", "setting/shezhi_1_3.png", "setting/shezhi_1_5_5.png", "setting/shezhi_1_5_4.png", "setting/shezhi_1_5_1.png", "setting/shezhi_1_5_3.png", "setting/shezhi_1_5_2.png"], "loadList3D": [] }; Window.SettingWindowUI = SettingWindowUI; REG("ui.Window.SettingWindowUI", SettingWindowUI); class SettlementWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(SettlementWindowUI.uiView); } } SettlementWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 18 }, { "type": "Box", "props": { "width": 720, "var": "tipp", "height": 600 }, "compId": 5, "child": [{ "type": "Sprite", "props": { "y": 38, "x": 135, "visible": false, "var": "winshow", "texture": "settlement/jeisuan_chenggong_1_2.png" }, "compId": 6, "child": [{ "type": "Sprite", "props": { "y": -99, "x": 158, "visible": false, "texture": "settlement/jeisuan_chenggong_1_1.png" }, "compId": 7 }] }, { "type": "Sprite", "props": { "y": 38, "x": 134, "visible": false, "var": "loseshow", "texture": "settlement/jiesuan_shibai_1_2.png" }, "compId": 19, "child": [{ "type": "Sprite", "props": { "y": -99, "x": 158, "visible": false, "texture": "settlement/jiesuan_shibai_1_3.png" }, "compId": 20 }] }, { "type": "Sprite", "props": { "y": 214, "x": 284.5, "texture": "settlement/jeisuan_chenggong_1_4.png" }, "compId": 14 }, { "type": "Sprite", "props": { "y": 170, "x": 304, "texture": "settlement/jeisuan_chenggong_1_5.png" }, "compId": 8, "child": [{ "type": "FontClip", "props": { "y": -7, "x": -9, "width": 134, "var": "scoreTex", "value": "15", "skin": "settlement/jeisuan_chenggong_1_5_1.png", "sheet": "0123456789", "height": 45, "align": "center" }, "compId": 9 }] }, { "type": "Sprite", "props": { "y": 225, "x": 281, "texture": "local/fuhuo_1_1_8.png" }, "compId": 15 }, { "type": "Sprite", "props": { "y": 216.5, "x": 519, "width": 101, "visible": true, "texture": "local/fuhuo_1_3_1.png", "rotation": 90, "pivotY": 50, "pivotX": 51, "height": 100 }, "compId": 10 }, { "type": "Image", "props": { "y": 150, "x": 464, "width": 128, "skin": "local/fuhuo_1_3_3.png", "height": 127 }, "compId": 11, "child": [{ "type": "FontClip", "props": { "y": 91, "x": 18, "width": 136, "var": "getmoney", "value": "120", "skin": "local/fuhuo_1_3_5.png", "sheet": "0123456789", "scaleY": 0.6, "scaleX": 0.6, "height": 36, "align": "left" }, "compId": 13 }, { "type": "Sprite", "props": { "y": 51, "x": 18, "texture": "local/fuhuo_1_3_4.png" }, "compId": 31 }] }] }, { "type": "Box", "props": { "x": 0, "width": 720, "var": "BtnPan", "height": 216, "bottom": 300 }, "compId": 16, "child": [{ "type": "Button", "props": { "y": 63, "x": 360, "width": 363, "var": "awardBtn", "stateNum": 1, "skin": "settlement/jeisuan_chenggong_1_3.png", "pivotY": 63, "pivotX": 182, "labelStrokeColor": "#000000", "labelSize": 60, "labelAlign": "center", "height": 125 }, "compId": 3 }, { "type": "Button", "props": { "x": 247.5, "width": 225, "var": "backhome", "stateNum": 1, "skin": "settlement/jiesuan_shibai_1_1.png", "height": 78, "bottom": 0 }, "compId": 17 }] }], "animations": [{ "nodes": [{ "target": 10, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "rotation", "index": 0 }, { "value": 45, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "rotation", "index": 3 }, { "value": 90, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "rotation", "index": 6 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 3, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleY", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleY", "index": 30 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleX", "index": 0 }, { "value": 1.3, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 3, "key": "scaleX", "index": 30 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }], "loadList": ["local/paiwei_xin_1_1.png", "settlement/jeisuan_chenggong_1_2.png", "settlement/jeisuan_chenggong_1_1.png", "settlement/jiesuan_shibai_1_2.png", "settlement/jiesuan_shibai_1_3.png", "settlement/jeisuan_chenggong_1_4.png", "settlement/jeisuan_chenggong_1_5.png", "settlement/jeisuan_chenggong_1_5_1.png", "local/fuhuo_1_1_8.png", "local/fuhuo_1_3_1.png", "local/fuhuo_1_3_3.png", "local/fuhuo_1_3_5.png", "local/fuhuo_1_3_4.png", "settlement/jeisuan_chenggong_1_3.png", "settlement/jiesuan_shibai_1_1.png"], "loadList3D": [] }; Window.SettlementWindowUI = SettlementWindowUI; REG("ui.Window.SettlementWindowUI", SettlementWindowUI); class ShopWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(ShopWindowUI.uiView); } } ShopWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "shop/shangcheng_1_2.png", "bottom": 0, "sizeGrid": "30,30,30,30" }, "compId": 5 }, { "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/shangcheng_1_1.png", "height": 600, "sizeGrid": "23,23,26,21" }, "compId": 3, "child": [{ "type": "Sprite", "props": { "y": 538, "x": 0, "texture": "shop/shangcheng_x_1_4.png" }, "compId": 36 }, { "type": "Image", "props": { "x": 206, "skin": "shop/shangcheng_1_4_9.png", "bottom": 63 }, "compId": 4 }, { "type": "Button", "props": { "y": 538, "x": 0, "width": 240, "var": "roleBtn", "stateNum": 1, "height": 62 }, "compId": 31, "child": [{ "type": "Image", "props": { "var": "rolebg", "skin": "shop/shangcheng_x_1_4_1.png" }, "compId": 41 }, { "type": "Sprite", "props": { "y": 17, "x": 92, "texture": "shop/shangcheng_x_1_1.png" }, "compId": 33 }] }, { "type": "Button", "props": { "y": 538, "x": 240, "width": 240, "var": "hatBtn", "stateNum": 1, "height": 62 }, "compId": 37, "child": [{ "type": "Image", "props": { "var": "hatbg", "skin": "shop/shangcheng_x_1_4_2.png" }, "compId": 42 }, { "type": "Sprite", "props": { "y": 17, "x": 91, "texture": "shop/shangcheng_x_1_2.png" }, "compId": 38 }] }, { "type": "Button", "props": { "y": 538, "x": 480, "width": 240, "var": "cbBtn", "stateNum": 1, "height": 62 }, "compId": 32, "child": [{ "type": "Image", "props": { "var": "cgbg", "skin": "shop/shangcheng_x_1_4_3.png" }, "compId": 43 }, { "type": "Sprite", "props": { "y": 17, "x": 91, "texture": "shop/shangcheng_x_1_3.png" }, "compId": 34 }] }, { "type": "Box", "props": { "y": 175, "x": 160, "width": 400, "var": "carShowPan", "mouseThrough": true, "mouseEnabled": false, "height": 500 }, "compId": 10 }] }, { "type": "List", "props": { "x": 48, "width": 624, "var": "renderList", "top": 605, "spaceY": 10, "spaceX": 20, "repeatX": 3, "bottom": 200 }, "compId": 6, "child": [{ "type": "Box", "props": { "width": 194, "renderType": "render", "height": 228 }, "compId": 8, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 194, "skin": "shop/shangcheng_1_4_1.png", "name": "bg", "height": 228 }, "compId": 9 }, { "type": "Image", "props": { "visible": false, "skin": "shop/xiaoren1.png", "name": "roleicon", "centerY": 0, "centerX": 0 }, "compId": 12 }, { "type": "Image", "props": { "y": 66, "x": 46, "visible": false, "skin": "shop/hat1.png", "name": "haticon" }, "compId": 39 }, { "type": "Image", "props": { "y": 72, "x": 14, "visible": false, "skin": "shop/zi.png", "name": "cbicon" }, "compId": 40 }, { "type": "Button", "props": { "x": 0, "width": 194, "top": 0, "name": "tryBtn", "height": 140 }, "compId": 35 }, { "type": "Button", "props": { "y": 150, "x": 20, "width": 154, "stateNum": 1, "skin": "shop/shangcheng_1_4_3.png", "sizeGrid": "25,62,42,61", "name": "btn", "height": 78 }, "compId": 13, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 154, "visible": false, "height": 78 }, "compId": 18, "child": [{ "type": "FontClip", "props": { "y": 23, "x": 65, "width": 73, "value": "x2000", "skin": "shop/shangcheng_1_4_8.png", "sheet": "x/0123456789", "name": "clip", "height": 20, "align": "left" }, "compId": 16 }, { "type": "Image", "props": { "y": 11, "x": 18, "skin": "shop/shangcheng_1_4_4.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 154, "visible": false, "height": 78 }, "compId": 19, "child": [{ "type": "FontClip", "props": { "y": 23, "x": 68, "width": 73, "value": "1/5", "skin": "shop/shangcheng_1_4_8.png", "sheet": "x/0123456789", "name": "clip", "height": 20, "align": "left" }, "compId": 20 }, { "type": "Image", "props": { "y": 20.5, "x": 21, "skin": "shop/shangcheng_1_4_5.png" }, "compId": 21 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 154, "visible": false, "height": 78 }, "compId": 44, "child": [{ "type": "FontClip", "props": { "y": 23, "x": 68, "width": 73, "value": "1/5", "skin": "shop/shangcheng_1_4_8.png", "sheet": "x/0123456789", "name": "clip", "height": 20, "align": "left" }, "compId": 45 }, { "type": "Image", "props": { "y": 20.5, "x": 21, "skin": "shop/shangcheng_x_1_4_4.png" }, "compId": 46 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 154, "visible": false, "height": 78 }, "compId": 25, "child": [{ "type": "Sprite", "props": { "y": 23, "x": 34.5, "texture": "shop/shangcheng_1_4_7.png" }, "compId": 28 }] }] }] }] }, { "type": "Button", "props": { "x": 359, "var": "vdawardBtn", "stateNum": 1, "skin": "shop/shangcheng_xin_1_5.png", "bottom": 51 }, "compId": 7 }, { "type": "Button", "props": { "x": 46, "var": "closeBtn", "stateNum": 1, "skin": "shop/shangcheng_xin_1_4.png", "bottom": 51 }, "compId": 29 }], "loadList": ["shop/shangcheng_1_2.png", "local/shangcheng_1_1.png", "shop/shangcheng_x_1_4.png", "shop/shangcheng_1_4_9.png", "shop/shangcheng_x_1_4_1.png", "shop/shangcheng_x_1_1.png", "shop/shangcheng_x_1_4_2.png", "shop/shangcheng_x_1_2.png", "shop/shangcheng_x_1_4_3.png", "shop/shangcheng_x_1_3.png", "shop/shangcheng_1_4_1.png", "shop/xiaoren1.png", "shop/hat1.png", "shop/zi.png", "shop/shangcheng_1_4_3.png", "shop/shangcheng_1_4_8.png", "shop/shangcheng_1_4_4.png", "shop/shangcheng_1_4_5.png", "shop/shangcheng_x_1_4_4.png", "shop/shangcheng_1_4_7.png", "shop/shangcheng_xin_1_5.png", "shop/shangcheng_xin_1_4.png"], "loadList3D": [] }; Window.ShopWindowUI = ShopWindowUI; REG("ui.Window.ShopWindowUI", ShopWindowUI); class SignWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(SignWindowUI.uiView); } } SignWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Box", "props": { "x": 70, "width": 580, "name": "dasda", "height": 641, "bottom": 550 }, "compId": 9, "child": [{ "type": "Image", "props": { "y": 50, "x": 0, "width": 580, "skin": "sign/shezhi_1_4.png", "height": 591, "bottom": 0, "sizeGrid": "11,16,24,18" }, "compId": 12 }, { "type": "Box", "props": { "y": 114, "x": 15, "width": 550, "var": "qiandaoPan", "height": 500 }, "compId": 19, "child": [{ "type": "Box", "props": { "y": 0, "width": 139, "left": 20, "height": 139 }, "compId": 14, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 15, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 17, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "1", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 18 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 49, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 50, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 53 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 55 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 51, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 56 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 395, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "scaleY": 0.5, "scaleX": 0.5 }, "compId": 396 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 146 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 47, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 48 }] }] }, { "type": "Box", "props": { "y": 0, "x": 205, "width": 139, "height": 139 }, "compId": 397, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 398, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 399, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "2", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 400 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 401, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 402, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 403 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 404 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 405, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 491 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 407, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 408 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 409 }, { "type": "Sprite", "props": { "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 410, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 411 }] }] }, { "type": "Box", "props": { "y": 0, "x": 391, "width": 139, "height": 139 }, "compId": 412, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 413, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 414, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "3", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 415 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 416, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 417, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 418 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 419 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 420, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 492 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 422, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 423 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 424 }, { "type": "Sprite", "props": { "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 425, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 426 }] }] }, { "type": "Box", "props": { "y": 158, "x": 20, "width": 139, "height": 139 }, "compId": 427, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 428, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 429, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "4", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 430 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 431, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 432, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 433 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 434 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 435, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 493 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 437, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 438 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 439 }, { "type": "Sprite", "props": { "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 440, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 441 }] }] }, { "type": "Box", "props": { "y": 158, "x": 205, "width": 139, "height": 139 }, "compId": 442, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 443, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 444, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "5", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 445 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 446, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 447, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 448 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 449 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 450, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 494 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 452, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 453 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 454 }, { "type": "Sprite", "props": { "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 455, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 456 }] }] }, { "type": "Box", "props": { "y": 158, "x": 391, "width": 139, "height": 139 }, "compId": 457, "child": [{ "type": "Image", "props": { "width": 139, "skin": "sign/qiandao_1_3.png", "name": "bg", "height": 139 }, "compId": 458, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 36, "texture": "sign/qiandao_1_5_1.png" }, "compId": 459, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "6", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 460 }] }] }, { "type": "Box", "props": { "x": 7.5, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 461, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 462, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 463 }, { "type": "FontClip", "props": { "y": 64, "x": 32, "width": 59, "value": "x200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 464 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 465, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 495 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 467, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 468 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 139, "name": "button", "height": 139 }, "compId": 469 }, { "type": "Sprite", "props": { "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 470, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 471 }] }] }, { "type": "Box", "props": { "y": 321, "x": 22, "width": 506, "height": 139 }, "compId": 380, "child": [{ "type": "Image", "props": { "y": 0, "skin": "sign/qiandao_1_3.png", "right": 0, "name": "bg", "left": 0, "height": 139 }, "compId": 381, "child": [{ "type": "Sprite", "props": { "y": 8, "x": 219, "texture": "sign/qiandao_1_5_1.png" }, "compId": 382, "child": [{ "type": "FontClip", "props": { "y": 0, "x": 14, "width": 39, "value": "7", "skin": "sign/qiandao_1_5_2.png", "sheet": "0123456789", "height": 21, "align": "center" }, "compId": 383 }] }] }, { "type": "Box", "props": { "y": 43, "x": 191, "width": 124, "name": "jiangli", "height": 85, "bottom": 11 }, "compId": 384, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "money", "height": 85 }, "compId": 385, "child": [{ "type": "Image", "props": { "x": 38, "top": 0, "skin": "sign/qiandao_1_5_4.png", "scaleY": 0.8, "scaleX": 0.8 }, "compId": 386 }, { "type": "FontClip", "props": { "x": 32, "width": 59, "value": "200", "skin": "sign/qiandao_1_5_3.png", "sheet": "x0123456789", "height": 21, "bottom": 0, "align": "center" }, "compId": 387 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "role", "height": 57 }, "compId": 487, "child": [{ "type": "Image", "props": { "skin": "shop/boluo.png", "scaleY": 0.5, "scaleX": 0.5, "centerY": 0, "centerX": 0 }, "compId": 496 }] }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 124, "visible": false, "name": "cb", "height": 57 }, "compId": 488, "child": [{ "type": "Image", "props": { "y": 15, "x": 20, "skin": "shop/zi.png", "scaleY": 0.5, "scaleX": 0.5 }, "compId": 490 }] }] }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 509, "name": "button", "height": 139 }, "compId": 391 }, { "type": "Sprite", "props": { "y": 0, "x": 183, "width": 139, "visible": false, "texture": "sign/qiandao_1_4_2.png", "name": "complete", "height": 139 }, "compId": 392, "child": [{ "type": "Sprite", "props": { "y": 0, "x": 0, "texture": "sign/qiandao_1_4_3.png" }, "compId": 393 }] }] }] }, { "type": "Sprite", "props": { "y": 0, "x": 151, "texture": "sign/shezhi_1_2.png" }, "compId": 295, "child": [{ "type": "Image", "props": { "x": 93.25, "top": 11, "skin": "sign/qiandao_1_1.png" }, "compId": 10 }] }, { "type": "Button", "props": { "x": 515, "var": "return", "top": 10, "stateNum": 1, "skin": "sign/shezhi_1_3.png", "scaleY": 1, "scaleX": 1 }, "compId": 11 }] }, { "type": "Box", "props": { "x": 184, "width": 352, "var": "BtnBox", "height": 218, "bottom": 300 }, "compId": 499, "child": [{ "type": "Button", "props": { "y": 73, "x": 177, "width": 314, "var": "ShuangBei", "stateNum": 1, "skin": "sign/qiandao_1_2.png", "scaleY": 1.1, "scaleX": 1.1, "pivotY": 56, "pivotX": 157, "height": 111 }, "compId": 46 }, { "type": "Button", "props": { "y": 150, "x": 122, "width": 108, "var": "ptBtn", "stateNum": 1, "skin": "sign/qiandao.png", "height": 51 }, "compId": 498 }] }], "loadList": ["local/paiwei_xin_1_1.png", "sign/shezhi_1_4.png", "sign/qiandao_1_3.png", "sign/qiandao_1_5_1.png", "sign/qiandao_1_5_2.png", "sign/qiandao_1_5_4.png", "sign/qiandao_1_5_3.png", "shop/boluo.png", "sign/qiandao_1_4_2.png", "sign/qiandao_1_4_3.png", "shop/zi.png", "sign/shezhi_1_2.png", "sign/qiandao_1_1.png", "sign/shezhi_1_3.png", "sign/qiandao_1_2.png", "sign/qiandao.png"], "loadList3D": [] }; Window.SignWindowUI = SignWindowUI; REG("ui.Window.SignWindowUI", SignWindowUI); class TaskWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(TaskWindowUI.uiView); } } TaskWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "local/paiwei_xin_1_1.png", "name": "bg", "bottom": 0, "sizeGrid": "50,50,50,50" }, "compId": 3 }, { "type": "Box", "props": { "y": 179, "x": 35, "width": 650, "height": 911 }, "compId": 9, "child": [{ "type": "Image", "props": { "y": 85, "x": -5, "width": 660, "skin": "task/shezhi_1_4.png", "height": 826, "sizeGrid": "11,14,27,19" }, "compId": 35 }, { "type": "Button", "props": { "var": "return", "top": 40, "stateNum": 1, "skin": "task/shezhi_1_3.png", "scaleY": 1.3, "scaleX": 1.3, "right": -22 }, "compId": 12 }, { "type": "List", "props": { "y": 166, "x": 0, "width": 650, "var": "renwupan", "spaceY": 10, "repeatX": 1, "height": 696 }, "compId": 13, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 650, "renderType": "render", "height": 130 }, "compId": 14, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 650, "skin": "task/paihang_1_4.png", "name": "dsd", "height": 130, "sizeGrid": "34,29,29,23" }, "compId": 15 }, { "type": "Image", "props": { "y": 13, "skin": "task/renwu_1_2_1.png", "left": 20 }, "compId": 36 }, { "type": "Text", "props": { "y": 0, "x": 142, "width": 202, "valign": "middle", "text": "赛车拥有者", "name": "miaoshu", "height": 38, "fontSize": 30, "color": "#282626", "bold": true, "align": "left", "runtime": "laya.display.Text" }, "compId": 16 }, { "type": "Text", "props": { "y": 39, "x": 146, "width": 350, "valign": "middle", "text": "至少拥有5辆7级车", "name": "xingxi", "height": 38, "fontSize": 18, "font": "Helvetica", "color": "#282626", "bold": true, "align": "left", "runtime": "laya.display.Text" }, "compId": 25 }, { "type": "ProgressBar", "props": { "width": 332, "value": 0.5, "skin": "task/renwu.png", "scaleX": 1.05, "name": "jindu", "left": 142, "height": 35, "bottom": 18 }, "compId": 17, "child": [{ "type": "FontClip", "props": { "y": 7, "x": 20, "value": "1/1", "skin": "task/shangcheng_1_4_8.png", "sheet": "x/0123456789", "name": "jinducp", "left": 20 }, "compId": 18 }, { "type": "Box", "props": { "y": -5, "x": 264, "width": 68, "right": 0, "name": "item", "height": 44 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 2, "x": 45, "skin": "task/renwu_1_2_5.png", "scaleY": 0.9, "scaleX": 0.9, "right": -10, "name": "itemin" }, "compId": 21 }, { "type": "FontClip", "props": { "y": 12, "x": 0, "value": "x20", "skin": "task/shangcheng_1_4_8.png", "sheet": "x/0123456789", "name": "itemnum", "left": 0, "height": 20, "align": "left" }, "compId": 23 }] }] }, { "type": "Button", "props": { "y": 27, "x": 517, "stateNum": 1, "skin": "task/renwu_1_2_6.png", "scaleY": 0.95, "scaleX": 0.95, "right": 10, "name": "completebtn" }, "compId": 19 }] }] }, { "type": "Image", "props": { "y": 24, "x": 144, "skin": "task/shezhi_1_2.png", "scaleY": 1.3, "scaleX": 1.3, "sizeGrid": "10,17,26,19" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 12, "x": 91.5, "skin": "task/renwu_1_1.png" }, "compId": 10 }] }] }], "loadList": ["local/paiwei_xin_1_1.png", "task/shezhi_1_4.png", "task/shezhi_1_3.png", "task/paihang_1_4.png", "task/renwu_1_2_1.png", "task/renwu.png", "task/shangcheng_1_4_8.png", "task/renwu_1_2_5.png", "task/renwu_1_2_6.png", "task/shezhi_1_2.png", "task/renwu_1_1.png"], "loadList3D": [] }; Window.TaskWindowUI = TaskWindowUI; REG("ui.Window.TaskWindowUI", TaskWindowUI); class TrialWindowUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(TrialWindowUI.uiView); } } TrialWindowUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 221, "x": 123, "skin": "bg/底.png", "name": "bg" }, "compId": 3, "child": [{ "type": "Text", "props": { "y": 24, "x": 138, "width": 198, "valign": "middle", "text": "皮肤试玩", "height": 44, "fontSize": 35, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Text", "props": { "y": 90, "x": 120, "width": 234, "valign": "middle", "text": "炫酷皮肤,免费试玩", "height": 44, "fontSize": 25, "font": "SimHei", "color": "#5f9dbb", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }, { "type": "Button", "props": { "y": 702, "x": 86.5, "var": "videobtn", "stateNum": 1, "skin": "trial/随机.png" }, "compId": 4 }, { "type": "Button", "props": { "y": 800, "x": 137, "width": 200, "var": "passbtn", "height": 50 }, "compId": 5, "child": [{ "type": "Text", "props": { "y": 3, "x": 1, "width": 198, "valign": "middle", "text": "点击跳过", "height": 44, "fontSize": 30, "font": "SimHei", "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }] }, { "type": "Button", "props": { "y": 590, "x": 113, "var": "hidebtn", "stateNum": 1, "skin": "trial/今日不再显示.png" }, "compId": 7, "child": [{ "type": "Sprite", "props": { "y": -9, "x": 7, "visible": false, "var": "ppp", "texture": "trial/√.png" }, "compId": 8 }] }, { "type": "List", "props": { "y": 148, "x": 41, "width": 391, "var": "skinlist", "spaceY": 20, "spaceX": 80, "repeatY": 2, "repeatX": 2, "height": 416 }, "compId": 9, "child": [{ "type": "Box", "props": { "renderType": "render" }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 155, "skin": "trial/试玩.png", "height": 197 }, "compId": 11, "child": [{ "type": "Box", "props": { "width": 155, "height": 155 }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 99, "x": 78, "skin": "trial/caomei.png", "scaleY": 0.6, "scaleX": 0.6, "name": "icon", "centerY": 0, "centerX": 0 }, "compId": 14 }] }, { "type": "Button", "props": { "x": 0, "width": 155, "name": "btn", "height": 197, "bottom": 0 }, "compId": 16 }] }] }] }] }], "loadList": ["bg/底.png", "trial/随机.png", "trial/今日不再显示.png", "trial/√.png", "trial/试玩.png", "trial/caomei.png"], "loadList3D": [] }; Window.TrialWindowUI = TrialWindowUI; REG("ui.Window.TrialWindowUI", TrialWindowUI); })(Window = ui.Window || (ui.Window = {})); })(ui || (ui = {})); class ShareUtil { constructor() { } ShareUtil() { } beginShare(callBack) { ShareUtil.beginShareTime = new Date().getTime(); console.log("分享点击时间=" + ShareUtil.beginShareTime); ShareUtil.isSharing = true; ShareUtil.callback = callBack; } onRegister() { if (Laya.Browser.window.wx == null) { return; } Laya.Browser.window.wx.onShow(function (option) { console.log("onshow share start"); if (ShareUtil.isSharing) { ShareUtil.isSharing = false; let time = new Date().getTime(); console.log("分享回到游戏时间" + time); let wait = (time - ShareUtil.beginShareTime) / 1000; console.log("分享停留时间为:" + wait); let shareSuccess = false; if (wait >= 2) { if (wait < 4) { shareSuccess = (Math.random() > 0.7) ? false : true; } else { shareSuccess = true; } } else { shareSuccess = false; } if (shareSuccess == false) { Laya.Browser.window.wx.showToast({ title: "请重试一次" }); ShareUtil.callback(false); } else { Laya.Browser.window.wx.showToast({ title: "分享成功" }); ShareUtil.callback(true); } } }); } } ShareUtil.Instance = new ShareUtil(); ShareUtil.shareSuccessTime = 0; ShareUtil.isSharing = false; var Event = Laya.Event; var HttpRequest = Laya.HttpRequest; const PROTOCOL_URL = "https://fallraceapi.94xj.net/"; class PROTOCOLS { } PROTOCOLS.Login = "user/login"; PROTOCOLS.game = "game/start"; PROTOCOLS.end = "game/play"; PROTOCOLS.Sign = "sign/sign"; PROTOCOLS.EquipHero = "theme/equipHero"; PROTOCOLS.BuyHero = "theme/buyHero"; PROTOCOLS.EquipHat = "theme/equipHat"; PROTOCOLS.BuyHat = "theme/buyHat"; PROTOCOLS.BuyDance = "theme/buyDance"; PROTOCOLS.EquipDance = "theme/equipDance"; PROTOCOLS.share = "fission/share"; PROTOCOLS.vd = "fission/vd"; PROTOCOLS.revival = "game/revival"; PROTOCOLS.fissionhat = "fission/hat"; PROTOCOLS.fissionhero = "fission/hero"; PROTOCOLS.fissiondance = "fission/dance"; PROTOCOLS.treasure = "treasure/click"; PROTOCOLS.Config = "config/table"; class NetworkManager { static get Instance() { if (NetworkManager.instance) { return NetworkManager.instance; } else { return new NetworkManager(); } } constructor() { NetworkManager.instance = this; } login(progresscb, completecb, errorcb) { var userInfor = PlayerAccount.CurrentAccount; var ver = Main.Ver; let args = `code=${userInfor.Code}&nickname=${userInfor.NickName}&avatar=${userInfor.Avatar}&gender=${userInfor.Gender}&country=${userInfor.Country}&province=${userInfor.Province}&city=${userInfor.City}& device=${userInfor.Device}$&share_id=${userInfor.ShareId}&scene=${userInfor.Scene}&v=${ver}`; let httpRequest = new HttpRequest(); httpRequest.once(Event.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]); httpRequest.once(Event.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]); httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]); httpRequest.send(PROTOCOL_URL + PROTOCOLS.Login, args, "post", "text"); } onHttpRequestProgress(progresscb, httpRequest) { if (progresscb) { console.log("HttpRequestProgress:..."); progresscb.run(); } } onLoginRequestComplete(completecb, httpRequest) { let data = JSON.parse(httpRequest.data); if (data["code"] != "0") { console.log("登录异常错误!错误信息:", httpRequest.data); return; } PlayerAccount.ServerTime = data["t"]; PlayerAccount.CurrentAccount.SetAccountData(data); completecb.runWith(data); } onHttpRequestError(errorcb, httpRequest) { if (errorcb != null) { errorcb.runWith(httpRequest); } console.log("Error! Http request error..." + httpRequest.data); } HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true) { let args = ""; let url = PROTOCOL_URL + protocol; var account = PlayerAccount.CurrentAccount; var accountdata = account.CurAccountData; if (hasToken == true) { args = `token=${accountdata.m_token}&`; } WxApi.ShowLoading("连接网络中..."); if (protocol == PROTOCOLS.game || protocol == PROTOCOLS.end || protocol == PROTOCOLS.fissionhat || protocol == PROTOCOLS.fissionhero || protocol == PROTOCOLS.fissiondance || protocol == PROTOCOLS.vd) { let str = "abcdefghijkimnopqrstuvwxyz0123456789"; let code = "{"; let mask = ""; for (let i = 0; i < 4; i++) { mask += str[Math.floor(Math.random() * 100) % str.length]; } for (let i = 0; i < param.length; i++) { for (let key in param[i]) { code += `\"${key}\":\"${param[i][key]}\"`; } if (i < param.length - 1) { code += ","; } else { code += "}"; } } args += "_r=" + mask + this.base64Encode(code); } else { if (param != null) { for (let i = 0; i < param.length; i++) { for (let key in param[i]) { let val = param[i][key]; args += `${key}=${val}`; if (i < param.length - 1) { args += "&"; } } } } } let httpRequest = new HttpRequest(); httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]); httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]); httpRequest.send(url, args, "post", "text"); } onHttpRequestComplete(succeedcb, failurecb, httpRequest) { WxApi.HideLoading(); let data = JSON.parse(httpRequest.data); if (data["code"] == 0) { PlayerAccount.CurrentAccount.SetAccountData(data); if (succeedcb != null) { succeedcb.runWith(data); } } else { if (failurecb != null) { failurecb.runWith(data); } Laya.timer.once(5000, this, () => { WxApi.HideLoading(); }); console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]); } } base64Encode(str) { var c1, c2, c3; var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var i = 0, len = str.length, string = ''; while (i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt((c1 & 0x3) << 4); string += "=="; break; } c2 = str.charCodeAt(i++); if (i == len) { string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); string += base64EncodeChars.charAt((c2 & 0xF) << 2); string += "="; break; } c3 = str.charCodeAt(i++); string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); string += base64EncodeChars.charAt(c3 & 0x3F); } return string; } } class ConfigTest { } ConfigTest.mission = []; ConfigTest.road = []; ConfigTest.things = []; ConfigTest.herodic = []; ConfigTest.hat = []; ConfigTest.cb = []; ConfigTest.effect = []; var Sprite3D = Laya.Sprite3D; var Vector4 = Laya.Vector4; var RoadType; (function (RoadType) { RoadType[RoadType["baseroad"] = 0] = "baseroad"; RoadType[RoadType["fixedroad"] = 1] = "fixedroad"; RoadType[RoadType["things"] = 2] = "things"; })(RoadType || (RoadType = {})); var baseroaddata; (function (baseroaddata) { baseroaddata[baseroaddata["ZhiRoad"] = 0] = "ZhiRoad"; })(baseroaddata || (baseroaddata = {})); var fixedroaddata; (function (fixedroaddata) { fixedroaddata[fixedroaddata["Ramps"] = 0] = "Ramps"; fixedroaddata[fixedroaddata["PlateFinish"] = 1] = "PlateFinish"; })(fixedroaddata || (fixedroaddata = {})); var thingsdata; (function (thingsdata) { thingsdata[thingsdata["Obstacle1"] = 1] = "Obstacle1"; thingsdata[thingsdata["Obstacle2"] = 2] = "Obstacle2"; thingsdata[thingsdata["Obstacle3"] = 3] = "Obstacle3"; thingsdata[thingsdata["Obstacle4"] = 4] = "Obstacle4"; thingsdata[thingsdata["Obstacle5"] = 5] = "Obstacle5"; thingsdata[thingsdata["PlateTrampoline"] = 6] = "PlateTrampoline"; thingsdata[thingsdata["RingBoost"] = 7] = "RingBoost"; thingsdata[thingsdata["RingEagle"] = 8] = "RingEagle"; thingsdata[thingsdata["PlateBend"] = 9] = "PlateBend"; thingsdata[thingsdata["Box"] = 10] = "Box"; thingsdata[thingsdata["Box1"] = 11] = "Box1"; thingsdata[thingsdata["Box2"] = 12] = "Box2"; thingsdata[thingsdata["Coin"] = 13] = "Coin"; })(thingsdata || (thingsdata = {})); var buildtype; (function (buildtype) { buildtype[buildtype["xrz"] = 0] = "xrz"; buildtype[buildtype["tt"] = 1] = "tt"; buildtype[buildtype["ft"] = 2] = "ft"; })(buildtype || (buildtype = {})); var effecttype; (function (effecttype) { effecttype[effecttype["tuowei"] = 0] = "tuowei"; effecttype[effecttype["caidai"] = 1] = "caidai"; effecttype[effecttype["huo"] = 2] = "huo"; })(effecttype || (effecttype = {})); var RoleType; (function (RoleType) { RoleType[RoleType["colorrole1"] = 0] = "colorrole1"; RoleType[RoleType["colorrole2"] = 1] = "colorrole2"; RoleType[RoleType["colorrole3"] = 2] = "colorrole3"; RoleType[RoleType["colorrole4"] = 3] = "colorrole4"; RoleType[RoleType["colorrole5"] = 4] = "colorrole5"; RoleType[RoleType["colorrole6"] = 5] = "colorrole6"; RoleType[RoleType["fruitrole1"] = 6] = "fruitrole1"; RoleType[RoleType["fruitrole2"] = 7] = "fruitrole2"; RoleType[RoleType["fruitrole3"] = 8] = "fruitrole3"; RoleType[RoleType["fruitrole4"] = 9] = "fruitrole4"; RoleType[RoleType["fruitrole5"] = 10] = "fruitrole5"; RoleType[RoleType["fruitrole6"] = 11] = "fruitrole6"; })(RoleType || (RoleType = {})); var decore; (function (decore) { decore[decore["hat"] = 0] = "hat"; decore[decore["cibang"] = 1] = "cibang"; })(decore || (decore = {})); var decoretype; (function (decoretype) { decoretype[decoretype["colorhat1"] = 0] = "colorhat1"; decoretype[decoretype["colorhat2"] = 1] = "colorhat2"; decoretype[decoretype["colorhat3"] = 2] = "colorhat3"; decoretype[decoretype["colorhat4"] = 3] = "colorhat4"; decoretype[decoretype["colorhat5"] = 4] = "colorhat5"; decoretype[decoretype["colorhat6"] = 5] = "colorhat6"; decoretype[decoretype["colorcb1"] = 6] = "colorcb1"; decoretype[decoretype["colorcb2"] = 7] = "colorcb2"; decoretype[decoretype["colorcb3"] = 8] = "colorcb3"; decoretype[decoretype["colorcb4"] = 9] = "colorcb4"; decoretype[decoretype["colorcb5"] = 10] = "colorcb5"; decoretype[decoretype["colorcb6"] = 11] = "colorcb6"; })(decoretype || (decoretype = {})); class AssetPaths { } AssetPaths.scencepath = "subpackage/res/gamescene/LayaScene_gamescene/Conventional/gamescene.ls"; AssetPaths.playerpath = { 1: "subpackage/res/playermodel/player1/Conventional/playermodel.lh", 2: "subpackage/res/playermodel/player2/Conventional/playermodel.lh", 3: "subpackage/res/playermodel/player3/Conventional/playermodel.lh", 4: "subpackage/res/playermodel/player4/Conventional/playermodel.lh", 5: "subpackage/res/playermodel/player5/Conventional/playermodel.lh", 6: "subpackage/res/playermodel/player6/Conventional/playermodel.lh", 7: "subpackage/res/playermodel/player7/Conventional/playermodel.lh" }; AssetPaths.roadpath = { 1: "subpackage/res/road/baseroad/Conventional/road.lh", 2: "subpackage/res/road/fixedroad/Conventional/road.lh", 3: "subpackage/res/road/things/Conventional/road.lh", }; AssetPaths.buildpath = "subpackage/res/builds/builds/Conventional/building.lh"; AssetPaths.decoratepath = "subpackage/res/decorate/decorate/Conventional/decorate.lh"; AssetPaths.planetxture = [ "subpackage/res/planetexture/1.png", "subpackage/res/planetexture/2.png", "subpackage/res/planetexture/3.png" ]; class ResourcesManager { constructor() { this.rolecolor = [ new Vector4(137 / 255, 67 / 255, 299 / 255, 1), new Vector4(201 / 255, 67 / 255, 229 / 255, 1), new Vector4(228 / 255, 69 / 255, 114 / 255, 1), new Vector4(223 / 255, 146 / 255, 39 / 255, 1), new Vector4(207 / 255, 61 / 255, 62 / 255, 1), new Vector4(53 / 255, 172 / 255, 24 / 255, 1) ]; this.hatcolor = [ new Vector4(9 / 255, 119 / 255, 183 / 255, 1), new Vector4(42 / 255, 166 / 255, 12 / 255, 1), new Vector4(96 / 255, 72 / 255, 20 / 255, 1), new Vector4(155 / 255, 53 / 255, 181 / 255, 1), new Vector4(234 / 255, 104 / 255, 127 / 255, 1), new Vector4(243 / 255, 136 / 255, 0, 1) ]; this.playerassets = {}; this.roleassets = {}; this.decorateasset = {}; this.hatasset = {}; this.cbasset = {}; this.bsroadassets = {}; this.fxroadassets = {}; this.tsroadassets = {}; this.buildsassets = {}; this.planetextures = {}; ResourcesManager.instance = this; } static get Instance() { if (ResourcesManager.instance) { return ResourcesManager.instance; } else { return new ResourcesManager(); } } InitSkinAsset() { for (var key in this.playerassets) { if (key == "1") { var role1 = this.playerassets[key]; for (var i = 0; i < 6; i++) { var colorrole = i == 0 ? this.playerassets[key] : Sprite3D.instantiate(role1); var skin = colorrole.getChildAt(0).getChildAt(0).getChildAt(2); var materail = skin.skinnedMeshRenderer.material; materail.albedoColor = this.rolecolor[i]; colorrole.getChildAt(0).name = RoleType[i]; this.roleassets[i + 1] = colorrole; } } else { this.roleassets[5 + Number(key)] = this.playerassets[key]; this.roleassets[5 + Number(key)].getChildAt(0).name = RoleType[5 + Number(key)]; } } for (var key in this.decorateasset) { if (key == "0") { var hat = this.decorateasset[key]; for (var i = 0; i < 6; i++) { var colorhat = i == 0 ? this.decorateasset[key] : Sprite3D.instantiate(hat); var Sprite = colorhat.getChildAt(0); var materail2 = Sprite.meshRenderer.material; materail2.albedoColor = this.hatcolor[i]; Sprite.name = decoretype[i]; this.hatasset[i + 1] = Sprite; } } else { var cb = this.decorateasset[key]; for (var i = 0; i < 6; i++) { var colorcb = i == 0 ? this.decorateasset[key] : Sprite3D.instantiate(cb); var Sprite = colorcb.getChildAt(0); var materai3 = Sprite.meshRenderer.material; materai3.albedoColor = this.rolecolor[i]; Sprite.name = decoretype[i + 6]; this.cbasset[i + 1] = Sprite; } } } } LoadBSRoad(_id, _complete) { if (this.bsroadassets[_id]) { _complete(this.bsroadassets[_id]); } else { var path = AssetPaths.roadpath[_id]; Laya.loader.create(path, Laya.Handler.create(this, () => { var asset = Laya.loader.getRes(path.url); this.bsroadassets[_id] = asset; _complete(asset); Laya.loader.clearRes(path.url); })); } } LoadFXRoad(_id, _complete) { if (this.fxroadassets[_id]) { _complete(this.fxroadassets[_id]); } else { var path = AssetPaths.roadpath[_id]; Laya.loader.create(path, Laya.Handler.create(this, () => { var asset = Laya.loader.getRes(path.url); this.fxroadassets[_id] = asset; _complete(asset); Laya.loader.clearRes(path.url); })); } } LoadTSRoad(_id, _complete) { if (this.tsroadassets[_id]) { _complete(this.tsroadassets[_id]); } else { var path = AssetPaths.roadpath[_id]; Laya.loader.create(path, Laya.Handler.create(this, () => { var asset = Laya.loader.getRes(path.url); this.tsroadassets[_id] = asset; _complete(asset); Laya.loader.clearRes(path.url); })); } } LoadPlayer(_id, _complete) { if (this.playerassets[_id]) { _complete.runWith(this.playerassets[_id]); } else { var path = AssetPaths.playerpath[_id]; Laya.loader.create(path, Laya.Handler.create(this, () => { var asset = Laya.loader.getRes(path.url); this.playerassets[_id] = asset; _complete.runWith(asset); Laya.loader.clearRes(path.url); })); } } } var Vector3 = Laya.Vector3; class TextData { constructor(_message, _pos, _size, _fontSize, _color = null) { this.fontSize = 30; this.message = ""; this.size = new Laya.Vector2(_size.x, _size.y); this.fontSize = _fontSize; this.color = _color; this.message = _message; this.pos = _pos; } } class GameUtils { static Vector3MulNumber(v3, f) { return new Vector3(v3.x * f, v3.y * f, v3.z * f); } static angleToEangle(_angle) { return _angle * Math.PI / 180; } static absEangle(_angle) { var x = _angle.x; if (x == -0) { x = 0; } var y = _angle.y; if (y == -0) { y = 0; } var z = _angle.z; if (z == -0) { z = 0; } return new Vector3(x, y, z); } static debugVector3(_vector3) { console.log(_vector3.x + " " + _vector3.y + " " + _vector3.z); } static getConverseVector3(_vector3) { return new Vector3(-_vector3.x, -_vector3.y, -_vector3.z); } static getRandomInt(left, right) { if (left >= right) { return 0; } var size = right - left + 1; var curNumber = Math.random() * size + left; return Math.floor(curNumber); } static getRandom(left, right) { if (left >= right) { return 0; } var size = right - left + 1; var curNumber = Math.random() * size + left; return curNumber; } static getRandoms(left, right) { if (left >= right) { return 0; } var size = right - left; var curNumber = Math.random() * size + left; return curNumber; } static TweenMove(targetTransform, TargetPos, duration, _completeHandle = null) { var curPos = targetTransform.position; var tween = Laya.Tween.to(curPos, { x: TargetPos.x, y: TargetPos.y, z: TargetPos.z, update: new Laya.Handler(this, function () { targetTransform.position = curPos; }) }, duration * 1000, null, Laya.Handler.create(this, function () { tween.clear(); if (_completeHandle != null) { _completeHandle.run(); } })); return tween; } static TweenProgress(_progress, _fromValue, _tovalue, _duration, _completeHandle = null) { _progress.value = _fromValue; var tween = Laya.Tween.to(_progress, { value: _tovalue }, _duration * 1000, null, _completeHandle); return tween; } static lerp(form, to, t) { if (t <= 0) { return form; } else if (t >= 1) { return to; } var a = t * to + (1 - t) * form; return a; } static LogVector3(name, Pos) { console.log(name + ":" + Pos.x + " " + Pos.y + " " + Pos.z); } static LogVector2(name, Pos) { console.log(name + ":" + Pos.x + " " + Pos.y); } static LogRotioion(name, Rot) { console.log(name + ":" + Rot.x + " " + Rot.y + " " + Rot.z + " " + Rot.w); } static DelayToDo(_delayDuration, _doFunction, agrs = null) { Laya.timer.once(_delayDuration * 1000, this, _doFunction, [agrs], false); } static CopyDic(_obj) { var curObj = {}; for (var key in _obj) { curObj[key] = _obj[key]; } return curObj; } static TweenLookAtMove(targetTransform, TargetPos, lookPos, duration, _completeHandle = null) { var curPos = targetTransform.position; var tween = Laya.Tween.to(curPos, { x: TargetPos.x, y: TargetPos.y, z: TargetPos.z, update: new Laya.Handler(this, () => { targetTransform.position = curPos; var quaternion1 = new Laya.Quaternion(); Laya.Quaternion.lookAt(curPos, lookPos, new Vector3(0, 1, 0), quaternion1); quaternion1.invert(quaternion1); Laya.Quaternion.slerp(targetTransform.rotation, quaternion1, 0.3, quaternion1); targetTransform.rotation = quaternion1; }) }, duration * 1000, null, Laya.Handler.create(this, function () { tween.clear(); if (_completeHandle != null) { _completeHandle(); } })); return tween; } static TweenGoldAward(_num, _pos = null, _completeHandle = null) { if (_num == 0) return; var parent = new Laya.Box; parent.width = 400; parent.height = 100; parent.pivotX = parent.width / 2; parent.pivotY = parent.height / 2; if (_pos == null) { _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2); } parent.pos(_pos.x, _pos.y); var _Image = new Laya.Image; _Image.skin = "localview/shoujiemian_1_6_1.png"; _Image.width = 60; _Image.height = 60; _Image.left = 50; _Image.y = 10; parent.addChild(_Image); var curText = new Laya.Text; curText.width = 300; curText.height = 50; curText.align = "center"; curText.valign = "middle"; curText.font = "Microsoft YaHei"; curText.fontSize = 35; curText.color = "#ff8e00"; curText.bold = true; curText.font = "Microsoft YaHei"; curText.text = "金币 +" + _num; curText.x = 60; curText.y = 10; parent.addChild(curText); Laya.stage.addChild(parent); var tween = Laya.Tween.to(parent, { y: parent.y - 200 }, 1000, Laya.Ease.expoInOut, Laya.Handler.create(this, () => { tween.clear(); parent.destroy(); if (_completeHandle) { _completeHandle.run(); } }), 100); } static TweenText(textData, _hight, _completeHandle = null, hide = true) { var curText = new Laya.Text(); curText.width = textData.size.x; curText.height = textData.size.y; curText.align = "center"; curText.valign = "middle"; curText.font = "Microsoft YaHei"; curText.fontSize = textData.fontSize; curText.pivotX = curText.width / 2; curText.pivotY = curText.height / 2; curText.color = "#5ad122"; curText.bold = true; curText.stroke = 5; curText.strokeColor = "#ffffff"; if (textData.color) { textData.color = textData.color; } curText.text = textData.message; curText.zOrder = 1; Laya.stage.addChild(curText); curText.pos(textData.pos.x, textData.pos.y); var tween = Laya.Tween.to(curText, { y: curText.y - _hight, update: new Laya.Handler(this, function () { }) }, 500, Laya.Ease.expoInOut, Laya.Handler.create(this, function () { tween.clear(); if (hide) { curText.destroy(); } if (_completeHandle) { _completeHandle.run(); } })); if (hide) { Laya.Tween.to(curText, { alpha: 0.4 }, 500); } return curText; } static GetMoney(_num, _pos = null, _completeHandle = null) { if (_num == 0) return; var fafaafsfa = new Laya.Box; fafaafsfa.width = 400; fafaafsfa.height = 100; fafaafsfa.pivotX = fafaafsfa.width / 2; fafaafsfa.pivotY = fafaafsfa.height / 2; if (_pos == null) { _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2); } fafaafsfa.pos(_pos.x, _pos.y); var aafafaffa = new Laya.Image; aafafaffa.skin = "sign/qiandao_1_5_4.png"; aafafaffa.width = 60; aafafaffa.height = 60; aafafaffa.left = 50; aafafaffa.y = 10; fafaafsfa.addChild(aafafaffa); var faasfafsafs = new Laya.Text; faasfafsafs.width = 300; faasfafsafs.height = 50; faasfafsafs.align = "center"; faasfafsafs.valign = "middle"; faasfafsafs.font = "Microsoft YaHei"; faasfafsafs.fontSize = 35; faasfafsafs.color = "#ff8e00"; faasfafsafs.bold = true; faasfafsafs.font = "Microsoft YaHei"; faasfafsafs.text = "金币 +" + _num; faasfafsafs.x = 60; faasfafsafs.y = 10; fafaafsfa.addChild(faasfafsafs); Laya.stage.addChild(fafaafsfa); var faasfsaf = Laya.Tween.to(fafaafsfa, { y: fafaafsfa.y - 200 }, 1000, Laya.Ease.expoInOut, Laya.Handler.create(this, () => { faasfsaf.clear(); fafaafsfa.destroy(); if (_completeHandle) { _completeHandle.run(); } }), 100); } } class ADPlayer { static initAd() { if (this.isInit) return; if (!Main.OnWx) return; this.rewardedVideoAd = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId }); this.rewardedVideoAd.onLoad(() => { console.log('激励视频 广告加载成功'); this.videoAdIsload = true; }); this.rewardedVideoAd.onError(err => { console.log("激励视屏加载失败:" + err); this.videoAdIsload = false; }); this.bannerCreateTimes = 0; this.isInit = true; } static showVideoAd(callback) { if (Main.OnWx) { console.log("showVideoAd , videoAdIsload:" + this.videoAdIsload); if (PlayerAccount.CurrentAccount.CurAccountData.share) { WxApi.shareImage("看视频", null, "看视频"); } if (PlayerAccount.CurrentAccount.CurAccountData.video == false) { return; } this.RegVideo(callback); this.rewardedVideoAd.show().catch(err => { this.rewardedVideoAd.load().then(() => { this.RegVideo(callback); this.rewardedVideoAd.show(); }); }); } else { callback(false); } } static RegVideo(callback) { this.rewardedVideoAd.offClose(); this.rewardedVideoAd.onClose(res => { console.log("激励视频关闭:" + res.isEnded); console.log(callback); if (res && res.isEnded || res === undefined) { callback && callback(true); } else { callback && callback(false); } this.rewardedVideoAd.offClose(); }); } static showBannerAd(gap = 0, callVack = null, iswait = false) { if (!Main.OnWx) return; if (this.bannerCreateTimes >= 10000) { var hh = this.ResetBannerHight(gap); if (iswait) { this.bannerAd.hide(); Laya.timer.once(PlayerAccount.CurrentAccount.CurAccountData.cheattime * 1000, this, () => { if (callVack != null) { callVack(hh); } this.bannerAd.show(); }); } else { if (callVack != null) { callVack(hh); } this.bannerAd.show(); } } else { var idd = this.bannerAdUnitId; console.log("adUnitId:" + idd); let newBanner = Laya.Browser.window.wx.createBannerAd({ adUnitId: idd, style: { left: 0, top: 0, width: 460 } }); newBanner.onError(err => { console.log(err); if (callVack != null) { callVack(null); } this.ResetBannerHight(gap); }); newBanner.onLoad(() => { this.bannerCreateTimes++; if (this.bannerAd) this.bannerAd.destroy(); this.bannerAd = newBanner; var hight = this.ResetBannerHight(gap); if (iswait) { this.bannerAd.hide(); Laya.timer.once(PlayerAccount.CurrentAccount.CurAccountData.cheattime * 1000, this, () => { if (callVack != null) { callVack(hight); } this.bannerAd.show(); }); } else { if (callVack != null) { callVack(hight); } this.bannerAd.show(); } }); } } static ResetBannerHight(gap) { if (this.bannerAd) { let info = Laya.Browser.window.wx.getSystemInfoSync(); this.bannerAd.style.width = info.windowWidth; this.bannerAd.style.top = info.windowHeight - this.bannerAd.style.realHeight - gap; return Laya.stage.height / info.windowHeight * this.bannerAd.style.realHeight; } } static ClearBanner() { Laya.timer.clearAll(this); if (!Main.OnWx) return; if (this.bannerAd) this.bannerAd.hide(); } static hiddenBannerAd() { if (!Main.OnWx) return; if (this.bannerAd) this.bannerAd.hide(); } static BannerAdEnable() { if (!Main.OnWx) return; if (this.bannerAd) this.bannerAd.show(); } static get CanCheat() { var cheat = PlayerAccount.CurrentAccount.CurAccountData.cheat; if (cheat == false) { console.log("cheat:" + cheat); return false; } if (Main.sceneValue == "1037" || Main.sceneValue == "1058" || Main.sceneValue == "1067" || Main.sceneValue == "1095") { console.log("cheat:true-> " + Main.sceneValue); return true; } else { var checkscence = PlayerAccount.CurrentAccount.CurAccountData.checkscence; if (checkscence == false) { console.log("cheat:true->checkscence: " + checkscence); return true; } } console.log("cheat:false-> " + Main.sceneValue); return false; } static MoveButton(btn, ShowBanner = true, complete = null, gap = 0) { if (PlayerAccount.CurrentAccount.CurAccountData.banner) { ADPlayer.hiddenBannerAd(); if (ADPlayer.CanCheat == false) { btn.bottom = 350; ADPlayer.showBannerAd(); } else { if (ShowBanner) { btn.bottom = 100; btn.mouseEnabled = false; ADPlayer.showBannerAd(gap, (height) => { var end = Laya.stage.height - height - btn.height; btn.y = end - 40; }, true); Laya.timer.once(PlayerAccount.CurrentAccount.CurAccountData.cheattime * 1000, this, () => { btn.mouseEnabled = true; if (complete != null) { complete(); } }); } else { if (complete != null) { complete(); } } } } } } ADPlayer.videlAdUnitId = "adunit-99203ac49ea44bd0"; ADPlayer.bannerAdUnitId = "adunit-398817d584c5941d"; ADPlayer.isInit = false; ADPlayer.videoAdIsload = false; ADPlayer.bannerCreateTimes = 0; class RecommendWindow extends ui.Window.RecommendWindowUI { constructor() { super(); this.cheat = false; this.index = 0; this.loopdir = 1; RecommendWindow.instance = this; } static get Instance() { return RecommendWindow.instance; } OnOpen(_data = null) { this.choutiview.visible = false; this.height = Laya.stage.height; } ShowRecommendWindow(_cainixihuan, fuhuotuijian, _chouti, _siwangtuijian, _baokuanyouxi) { Laya.timer.clearAll(this); if (_cainixihuan || (!_cainixihuan && !fuhuotuijian)) { this.ShowCaiNiXiHuanView(_cainixihuan); } if (fuhuotuijian || (!_cainixihuan && !fuhuotuijian)) { this.ShowCaiNiXiHuanView(fuhuotuijian); } this.ShowSiWangTuiJianView(_siwangtuijian); this.ShowChouTi(_chouti); this.ShowBaoKuanYouXiView(_baokuanyouxi); } ShowBaoKuanYouXiView(_open) { this.baokuanyouxi.visible = _open; if (_open == false) return; this.RefreshBaoKuanYouXi(); Laya.timer.loop(2000, this, this.LoopBaoKuan); } LoopBaoKuan() { this.index++; if (this.index > PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1) { this.index = 0; } this.RefreshBaoKuanYouXi(); } RefreshBaoKuanYouXi() { var data = PlayerAccount.CurrentAccount.CurAccountData.redata[this.index]; var icon = this.baokuanyouxi.getChildByName("icon"); icon.skin = data.icon; var btn = this.baokuanyouxi.getChildByName("btn"); btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ShowCaiNiXiHuanView(_open) { this.cainixihuan.visible = _open; if (_open == false) return; this.cainixihuan.bottom = 0; this.cainixihuanlist.hScrollBarSkin = ""; this.cainixihuanlist.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.cainixihuanlist.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); Laya.timer.loop(10, this, this.LoopList, [this.cainixihuanlist]); this.loopdir = 1; } ShowChouTi(_open) { this.chouti.visible = _open; this.choutiBtn.visible = true; if (_open == false) return; ADPlayer.ClearBanner(); this.choutiBtn.clickHandler = Laya.Handler.create(this, this.OpenChouTiView); this.closeCt.clickHandler = Laya.Handler.create(this, this.OnBackHome); } OnBackHome() { WindowManager.Instance.ClosePopView(WindowType.RecommendWindow); } OpenChouTiView(_open) { this.choutiview.visible = _open; this.sharebtn.visible = true; if (_open == false) { if (WindowManager.Instance.curOpenedView.name == "HomeWindow") WindowManager.Instance.ShowWindow(WindowType.HomeWindow); return; } this.choutilist.vScrollBarSkin = ""; this.choutilist.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.choutilist.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); this.ctList.hScrollBarSkin = ""; this.ctList.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.ctList.renderHandler = Laya.Handler.create(this, this.Renderct2List, null, false); Laya.timer.loop(10, this, this.LoopList, [this.ctList]); this.loopdir = 1; this.closeCt.clickHandler = Laya.Handler.create(this, this.OpenChouTiView, [false], false); this.sharebtn.clickHandler = Laya.Handler.create(this, this.OnShare, null, false); } ShowSiWangTuiJianView(_open) { this.siwangtuijian.visible = _open; if (_open == false) return; this.siwangtuijianlist.vScrollBarSkin = ""; this.siwangtuijianlist.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.siwangtuijianlist.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); Laya.timer.loop(10, this, this.LoopList, [this.siwangtuijianlist]); this.loopdir = 1; for (var i = 0; i < this.siwangtuijianlist.array.length; i++) { this.siwangtuijianlist.array[i].shownum++; } } OnShare() { WxApi.shareImage("互推界面分享", null, "1"); } static ListSort(a, b) { if (a.sort > b.sort) { return 1; } else { return -1; } } RenderList(_box, index) { var data = _box.dataSource; var icon = _box.getChildAt(0).getChildByName("icon"); icon.skin = data.icon; var name = _box.getChildAt(0).getChildByName("name"); name.text = data.title; var btn = _box.getChildAt(0).getChildByName("btn"); var num = _box.getChildAt(0).getChildByName("num"); if (num) num.text = GameUtils.getRandomInt(24841, 654878).toString() + "人玩"; if (this.cheat) { btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } else { btn.clickHandler = Laya.Handler.create(this, this.ClickNavigate, [data], false); } } Renderct2List(_box, index) { var data = _box.dataSource; var icon = _box.getChildByName("icon"); icon.skin = data.icon; var btn = _box.getChildByName("btn"); if (this.cheat) { btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } else { btn.clickHandler = Laya.Handler.create(this, this.ClickNavigate, [data], false); } } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; RecommendWindow.Instance.OpenChouTiView(true); if (WindowManager.Instance.curOpenedView.name == "ReviveWindow") { RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { RecommendWindow.Instance.ShowRecommendWindow(false, false, false, true, false); }); } if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } ClickNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } LoopList(_list) { if (this.loopdir > 0) { if (_list.scrollBar.value < _list.scrollBar.max) { _list.scrollBar.value += 1; } else { this.loopdir *= -1; } } else { if (_list.scrollBar.value > 0) { _list.scrollBar.value -= 1; } else { this.loopdir *= -1; } } } OnHide() { this.cheat = false; this.ShowRecommendWindow(false, false, false, false, false); Laya.timer.clearAll(this); } } var Vector3$1 = Laya.Vector3; class Rigbody extends Laya.Script3D { constructor() { super(...arguments); this.m_life = 1; this.m_time = 0; this.m_resistance = 0.03; this.OnLand = true; this.hit = new Laya.HitResult(); this.offestY = 0; this.g = 1; this.curdir = new Vector3$1(); this.curPos = new Vector3$1(); } onAwake() { this.m_sprite = this.owner; Laya.timer.once(this.m_life * 1000, this, this.OnEnd); Laya.timer.frameLoop(1, this, this.Update); } OnEnd() { Laya.timer.clearAll(this); this.destroy(); } CheckPlaneCollider() { var startpoint = new Vector3$1(this.m_sprite.transform.position.x, this.m_sprite.transform.position.y, this.m_sprite.transform.position.z); var dir = new Vector3$1(0, -1, 0); var ray = new Laya.Ray(startpoint, dir); if (ScenceManager.Instance.GameScence.physicsSimulation.rayCast(ray, this.hit, 0.5)) { if (this.hit.collider.collisionGroup != ColliderLay.Plane) return; var dis = this.m_sprite.transform.position.y - this.hit.point.y; if (this.OnLand) { if (dis > 0.15) { this.OnLand = false; return; } else { this.m_sprite.transform.position = new Vector3$1(this.m_sprite.transform.position.x, this.hit.point.y + 0.1, this.m_sprite.transform.position.z); } } else { if (dis < 0.01) { this.OnLand = true; this.OnPlane(); } } } else { this.OnLand = false; } } OnPlane() { } gravity() { this.offestY -= this.g * this.m_time * this.m_time; } AddVelocity(_dir, _speed) { Vector3$1.normalize(_dir, this.curdir); Vector3$1.scale(this.curdir, _speed, this.curdir); Laya.timer.frameLoop(1, this, this.Move); } Update() { this.m_time += 0.012; this.gravity(); this.CheckPlaneCollider(); } Move() { var mpos = this.m_sprite.transform.position; Vector3$1.add(mpos, this.curdir, this.curPos); if (this.OnLand) { this.curPos = new Vector3$1(this.curPos.x, this.m_sprite.transform.position.y, this.curPos.z); } else { Vector3$1.add(this.curPos, new Vector3$1(0, this.offestY, 0), this.curPos); } this.m_sprite.transform.position = this.curPos; Vector3$1.lerp(this.curdir, new Vector3$1(0, 0, 0), this.m_resistance, this.curdir); if (Vector3$1.scalarLength(this.curdir) < 0.01) { Laya.timer.clear(this, this.Move); } } } var SoundType; (function (SoundType) { SoundType[SoundType["crash"] = 0] = "crash"; SoundType[SoundType["die"] = 1] = "die"; SoundType[SoundType["extraspeed"] = 2] = "extraspeed"; SoundType[SoundType["gold"] = 3] = "gold"; SoundType[SoundType["jump"] = 4] = "jump"; SoundType[SoundType["land"] = 5] = "land"; SoundType[SoundType["xp"] = 6] = "xp"; SoundType[SoundType["fly"] = 7] = "fly"; })(SoundType || (SoundType = {})); class PlaySoundManager { static SoundPath(_type) { return "subpackage/res/sound/" + SoundType[_type] + ".wav"; } static Play(type) { if (PlaySoundManager.CanPlaySound) { this.NomalSources = Laya.SoundManager.playSound(this.SoundPath(type)); } } } PlaySoundManager.SoundVolume = 100; PlaySoundManager.CanPlaySound = true; class Queue { constructor() { this.players = []; Queue.instance = this; this.InitQueue(); } static get Instance() { if (Queue.instance) { return Queue.instance; } else { return new Queue(); } } InitQueue() { EventManager.GameStateEventOn(GameState.Win, this, this.OnGameEnd); EventManager.GameStateEventOn(GameState.End, this, this.OnGameOver); EventManager.GameStateEventOn(GameState.Playing, this, this.OnGamePlaying); EventManager.EventOn(EventType.CompleteStage, this, this.OnPlayerStageChange); } signup(runner) { this.players.push(runner); } OnGamePlaying() { Laya.timer.once(1000, this, () => { Laya.timer.frameLoop(1, this, this.SortPlayer); }); } OnGameEnd() { Laya.timer.clear(this, this.SortPlayer); } OnGameOver() { this.players = []; Laya.timer.clear(this, this.SortPlayer); } OnPlayerStageChange() { for (var i = 0; i < this.players.length; i++) { if (this.players[i].Ai) { if (this.players[i].die) { this.players[i].Cheat(); } } } } SortPlayer() { this.players.sort(this.Sort); EventManager.EventTrigger(EventType.PlayerRank, [this.players]); if (this.Champion == null || this.Champion.Id != this.players[0].Id) { this.Champion = this.players[0]; EventManager.EventTrigger(EventType.crownchange, this.players[0].Id); EventManager.EventTrigger(EventType.ScoreChange, this.GetPlayerScore); } } get GetPlayerScore() { for (var i = 0; i < this.players.length; i++) { var player = this.players[i]; if (!player.Ai) { return i + 1; } } } Sort(a, b) { if (a.m_sprite.transform.position.z > b.m_sprite.transform.position.z) { return -1; } else { return 1; } } } var Animator = Laya.Animator; var Vector3$2 = Laya.Vector3; var ColliderLay; (function (ColliderLay) { ColliderLay[ColliderLay["Play"] = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER1] = "Play"; ColliderLay[ColliderLay["Npc"] = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER2] = "Npc"; ColliderLay[ColliderLay["Plane"] = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER10] = "Plane"; ColliderLay[ColliderLay["things"] = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER3] = "things"; ColliderLay[ColliderLay["dieplane"] = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER5] = "dieplane"; })(ColliderLay || (ColliderLay = {})); class Runner extends Laya.Script3D { constructor() { super(...arguments); this.Ai = false; this.aioffestx = 0; this.aimiss = 0; this.m_speed = 1; this.m_curstages = []; this.offest = new Vector3$2(); this.outlandtime = 0; this.OnLand = true; this.hit = new Laya.HitResult(); this.JS = false; this.delayMove = false; this.nextpoint = []; this.oldpoint = []; this.LandTime = 0; this.enteroutplane = false; this.fly = false; this.flytime = 0; this.flyspeed = 2; this.flycutrate = 0.01; this.flycounttime = 0; this.extracutrate = 0.01; this.extraspeed = 0; this.extraspeedtime = 0; this.JumpDuration = 0; this.jump = false; this.csp = 0; this.JumpHigth = 0; this.bacoZ = 2; this.currotV = new Vector3$2(); this.currot = new Laya.Quaternion; this.NormalizeSpeed = new Vector3$2(); this.turndir = new Vector3$2(1, 0, 0); this.backrot = false; this.canmove = false; this.die = false; this.curpos = new Vector3$2(); this.endroad = false; this.curspeed = 0; this.AutoMoveSpeed = 0.5; this.curautospeed = 0; } onAwake() { this.m_sprite = this.owner; this.m_model = this.m_sprite.getChildAt(0); this.m_animator = this.m_sprite.getChildAt(0).getComponent(Animator); this.m_flySprite = PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.FalconMesh, ""); this.m_sprite.addChild(this.m_flySprite); this.m_flySprite.transform.localPosition = new Vector3$2(0, 0.95, 0); this.m_flySprite.transform.localScale = new Vector3$2(0.36, 0.36, 0.36); this.m_flySprite.active = false; this.m_hat = this.m_model.getChildAt(0).getChildAt(0); this.m_cb = this.m_model.getChildAt(1).getChildAt(0); this.m_head = this.m_model.getChildAt(0); this.m_crown = this.m_crown ? this.m_crown : PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.crown, ""); this.m_head.addChild(this.m_crown); this.m_crown.transform.localScale = new Vector3$2(13, 13, 13); this.m_crown.transform.localPosition = new Vector3$2(0, 0, 0); this.m_crown.transform.rotationEuler = new Vector3$2(0, 0, 0); this.m_crown.active = false; this.m_effect = this.m_sprite.getChildByName("effect"); this.GetStages(); EventManager.GameStateEventOn(GameState.Playing, this, this.OnEnterPlaying); EventManager.EventOn(EventType.crownchange, this, this.OnCrownChange); } onStart() { } GetStages() { var curstages = LevelManager.Instance.curLevel.stages; var stages = []; for (var i = 0; i < curstages.length; i++) { var st = curstages[i]; var news = new Stage(st.id.toString(), st.roadsdata); news.sprite = st.sprite; news.startz = st.startz; news.endz = st.endz; news.starty = st.starty; news.endy = st.endy; news.roadpointxs = st.roadpointxs; stages.push(news); } this.m_curstages = stages; } onDestroy() { EventManager.GameStateEventOff(GameState.Playing, this, this.OnEnterPlaying); EventManager.EventOff(EventType.crownchange, this, this.OnCrownChange); } OnEnterPlaying() { this.SetMove(); } OnCrownChange(_id) { if (_id != this.Id) { this.CloseCrown(); } else { this.GetCrown(); } } SetMove() { this.Start(); this.enteroutplane = false; this.fly = false; this.die = false; this.endroad = false; this.outlandtime = 0; Laya.timer.clearAll(this); Laya.timer.frameLoop(1, this, this.OnFrameLoop); } OnFrameLoop() { if (this.canmove) { var startpoint = new Vector3$2(this.m_sprite.transform.position.x, this.m_sprite.transform.position.y + 1, this.m_sprite.transform.position.z); var dir = new Vector3$2(0, -1, 0); var ray = new Laya.Ray(startpoint, dir); if (ScenceManager.Instance.GameScence.physicsSimulation.rayCast(ray, this.hit, 20)) { if (this.hit.collider.collisionGroup != ColliderLay.Plane && this.hit.collider.collisionGroup != ColliderLay.things) return; if (this.OnLand) { var dis = this.m_sprite.transform.position.y - this.hit.point.y; if (this.hit.collider.owner.name == "JS") { this.JS = true; } if (dis > 0.01) { this.OnLand = false; this.OnEnterOutPlane(); return; } else { if (this.hit.collider.owner.name == "Coin") { this.OnEnterPlane(); return; } this.m_sprite.transform.position = new Vector3$2(this.m_sprite.transform.position.x, this.hit.point.y, this.m_sprite.transform.position.z); } } else { var dis = this.m_sprite.transform.position.y - this.hit.point.y; if (dis < 0.0001) { this.OnEnterPlane(); } } } else { this.OnLand = false; this.OnEnterOutPlane(); } this.RayCastUpdate(); } } OnGetRoadPoint(_ps) { this.nextpoint = _ps; this.TriggerAuto(); this.oldpoint = _ps; } TriggerAuto(now = false) { if (this.nextpoint.length == 1) { if (this.oldpoint.length == 0 || this.oldpoint.length > 1) { if (this.aimiss <= Math.random()) { this.AutoMoveX(this.nextpoint[0]); } } if (this.oldpoint.length == 1) { this.delayMove = true; } } if (this.delayMove) { this.AutoMoveX(this.oldpoint[0]); } } OnEnterOutPlane() { if (this.enteroutplane) return; this.enteroutplane = true; if (!this.Ai) EventManager.EventTrigger(EventType.OutLand); if (this.JS) { this.SetExtraSpeed(ThingsEffect.JSEffect, ThingsEffect.Jstime); this.JS = false; } if (!this.fly) { this.m_animator.play("land1"); } } OnEnterPlane() { if (this.OnLand) return; if (this.hit.collider.collisionGroup == ColliderLay.things) { this.TriggerThings(this.hit.collider); } if (!this.Ai) { PlaySoundManager.Play(SoundType.land); WxApi.Shake(); } if (!this.Ai) EventManager.EventTrigger(EventType.OnLand); this.enteroutplane = false; this.m_flySprite.active = false; this.fly = false; this.flytime = 0; this.flycounttime = 0; this.m_animator.play("run"); this.outlandtime = 0; this.LandTime = 0; if (!this.Ai) EventManager.EventTrigger(EventType.flytime, this.flytime); this.OnLand = true; this.jump = false; var cp = new Vector3$2(this.m_sprite.transform.position.x, this.hit.point.y, this.m_sprite.transform.position.z); Vector3$2.lerp(this.m_sprite.transform.position, cp, 0.3, this.curpos); this.m_sprite.transform.position = this.curpos; } Start() { this.JS = false; this.canmove = true; this.m_animator.play("run"); } Pause() { this.canmove = false; } Stop() { this.Pause(); Laya.timer.clearAll(this); } LandDown() { this.curspeed = 0; } SetFly() { this.extraspeed = 0; this.extraspeedtime = 0; this.flytime = ThingsEffect.flytime; this.flyspeed = ThingsEffect.flyeffect; this.m_flySprite.active = true; this.fly = true; this.m_animator.play("fly"); this.BackRote(); } SetExtraSpeed(_speed, time = 0) { if (!this.Ai) { PlaySoundManager.Play(SoundType.extraspeed); WxApi.Shake(); } this.extraspeed = _speed; this.extraspeedtime += time; } Jump(_csp) { this.csp = _csp * 0.1; this.csp = Math.pow(this.csp, 0.5); this.JumpHigth = 1; this.JumpDuration = 0; this.jump = true; this.OnLand = false; } CurHight(csp = 1, dd, a = 3.5) { var hight = csp * dd - (dd * dd * a); if (hight < 0) { this.jump = false; } return hight; } HitObstacle(_node) { var target = _node; this.curspeed *= 0.5; var curpos = this.m_sprite.transform.position; var offesxx = curpos.x - target.transform.position.x >= 0 ? 0.4 : -0.4; this.m_sprite.transform.position = new Vector3$2(curpos.x + offesxx, curpos.y, curpos.z - this.bacoZ); } RayCastUpdate() { this.CheckForward(); this.Gravity(); } TurnDir(_dir) { if (_dir.x != 0) { Vector3$2.lerp(this.currotV, _dir, 0.35, _dir); this.currotV = _dir; Laya.Quaternion.rotationLookAt(_dir, new Vector3$2(0, 1, 0), this.currot); Laya.Quaternion.slerp(this.m_sprite.transform.rotation, this.currot, 0.025, this.currot); this.currot = new Laya.Quaternion(0, this.currot.y, 0); this.m_sprite.transform.rotation = this.currot; } else { Laya.Quaternion.slerp(this.m_sprite.transform.rotation, new Laya.Quaternion(0, 0, 0, 0), 0.1, this.currot); this.currot = new Laya.Quaternion(0, this.currot.y, 0); this.m_sprite.transform.rotation = this.currot; } } BackRote() { this.backrot = true; } Cheat() { var stage = Player.Instance.m_runner.completeStage; if (0.65 < Math.random()) return; if (!stage || Player.Instance.m_runner.m_curstages[Player.Instance.m_runner.m_curstages.length - 1].enter || Player.Instance.m_runner.die) return; stage.complete = false; this.curstage = stage; this.die = false; this.m_crown.active = false; var pp = Player.Instance.m_runner; this.m_sprite.transform.position = new Vector3$2(pp.m_sprite.transform.position.x, stage.endy, stage.endz - 5); this.SetMove(); this.SetExtraSpeed(0.01, 2); this.curspeed = this.m_speed; } onUpdate() { if (this.canmove) { this.Move(new Vector3$2(0, 0, 1), this.m_speed); } if (this.backrot) { Laya.Quaternion.slerp(this.m_sprite.transform.rotation, new Laya.Quaternion(0, 0, 0, 0), 0.25, this.currot); this.currot = new Laya.Quaternion(0, this.currot.y, 0); this.m_sprite.transform.rotation = this.currot; if (Math.abs(this.m_sprite.transform.rotation.y) < 0.0001) { this.backrot = false; } } if (this.m_curstages[this.m_curstages.length - 1].complete == false) { for (var i = 0; i < this.m_curstages.length; i++) { var stage = this.m_curstages[i]; if (stage.complete == false && this.m_sprite.transform.position.z > stage.endz) { this.completeStage = stage; stage.complete = true; EventManager.EventTrigger(EventType.CompleteStage, stage); } if (stage.enter == false && this.m_sprite.transform.position.z > stage.startz - 3) { this.curstage = stage; stage.enter = true; if (!this.Ai) { if (i == this.m_curstages.length - 1) LevelManager.Instance.curLevel.endroadsprite.active = true; this.SetRoad(i); EventManager.EventTrigger(EventType.GetRoadPoint, i + 1); } else { this.OnEnterStage(stage); } } } } else { this.curstage.endy = LevelManager.Instance.curLevel.endroadsprite.transform.position.y - 5; } if (this.curstage && this.flytime == 0 && !this.die && this.m_sprite.transform.position.y < this.curstage.endy - 8) { this.die = true; this.Stop(); if (this.m_flySprite.active) { this.m_flySprite.active = false; } if (!this.Ai) { PlaySoundManager.Play(SoundType.die); WxApi.Shake(false); GameManager.Instance.ChangeState(GameState.Die); } } } SetRoad(_stageid) { if (_stageid + 2 < LevelManager.Instance.curLevel.stages.length) { var nextroads = LevelManager.Instance.curLevel.stages[_stageid + 2].roads; for (var i = 0; i < nextroads.length; i++) { var road = nextroads[i]; road.SetActive(true); } var builds = LevelManager.Instance.curLevel.stages[_stageid + 2].builds; for (var i = 0; i < builds.length; i++) { var build = builds[i]; build.active = true; } } if (_stageid - 1 >= 0) { var oldroads = LevelManager.Instance.curLevel.stages[_stageid - 1].roads; for (var i = 0; i < oldroads.length; i++) { var road = oldroads[i]; Laya.timer.once(1000, this, () => { road.SetActive(false); }); } var oldbuilds = LevelManager.Instance.curLevel.stages[_stageid - 1].builds; for (var i = 0; i < oldbuilds.length; i++) { var build = oldbuilds[i]; build.active = false; } } } OnEnterStage(_stage) { this.OnGetRoadPoint(_stage.roadpointxs); } GetCrown() { this.m_crown.active = true; Laya.timer.clear(this, this.RotCrown); Laya.timer.frameLoop(1, this, this.RotCrown); } CloseCrown() { this.m_crown.active = false; Laya.timer.clear(this, this.RotCrown); } RotCrown() { this.m_crown.transform.rotate(new Vector3$2(0, 2, 0)); } Move(_dir, _speed) { if (this.flytime > 0) { this.flytime -= this.flycutrate; this.flycounttime += (this.flycutrate * 0.6); if (!this.Ai) EventManager.EventTrigger(EventType.flytime, this.flytime); _speed = this.flyspeed + this.extraspeed; if (this.flytime < 0) { this.flytime = 0; this.flycounttime = 0; } } else { if (this.fly) { _speed = (this.flyspeed * 0.8) + this.extraspeed; } } if (this.extraspeedtime > 0 || this.extraspeed > 0) { this.extraspeedtime -= this.extracutrate; if (!this.Ai) EventManager.EventTrigger(EventType.extraspeedtime, this.extraspeedtime); var esp = _speed + this.extraspeed; _speed = GameUtils.lerp(_speed, esp, 0.9); if (this.extraspeedtime < 0) { this.extraspeed = 0; this.extraspeedtime = 0; } } var sp = GameUtils.lerp(this.curspeed, _speed, 0.1); this.curspeed = sp; Vector3$2.scale(_dir, this.curspeed, this.offest); Vector3$2.add(this.m_sprite.transform.position, this.offest, this.curpos); Vector3$2.lerp(this.m_sprite.transform.position, this.curpos, 0.15, this.curpos); if (this.JumpHigth > 0) { this.JumpDuration += ThingsEffect.jumptime; this.JumpHigth = this.CurHight(this.csp, this.JumpDuration); this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + this.JumpHigth, this.curpos.z); } this.curpos = new Vector3$2(this.curpos.x + this.aioffestx, this.curpos.y, this.curpos.z); this.m_sprite.transform.position = this.curpos; if (this.endroad == false && (this.m_sprite.transform.position.z > LevelManager.Instance.curLevel.endroadsprite.transform.position.z)) { this.endroad = true; if (this.fly) { this.fly = false; this.flytime = 0; this.flycounttime = 0; this.m_flySprite.active = false; if (this.OnLand) { this.m_animator.play("land1"); } } } } CheckForward() { var startpoint = new Vector3$2(this.m_sprite.transform.position.x, this.m_sprite.transform.position.y + 0.5, this.m_sprite.transform.position.z); var dir = new Vector3$2(0, 0, 1); var ray = new Laya.Ray(startpoint, dir); if (ScenceManager.Instance.GameScence.physicsSimulation.rayCast(ray, this.hit, 0.5)) { if (this.hit.collider.collisionGroup != ColliderLay.things) return; this.TriggerThings(this.hit.collider); } } TriggerThings(_collider) { if (this.curcollider == _collider && _collider.owner.name != "obstacle") return; this.curcollider = _collider; if (_collider.owner.name == "Box") { if (!this.Ai) { PlaySoundManager.Play(SoundType.crash); WxApi.Shake(); } _collider.enabled = false; this.HitBox(_collider.owner); } else if (_collider.owner.name == "obstacle") { if (!this.Ai) { PlaySoundManager.Play(SoundType.crash); WxApi.Shake(); } this.fly = false; this.flytime = 0; this.flycounttime = 0; this.extraspeed = 0; this.HitObstacle(_collider.owner); } else if (_collider.owner.name == "fly") { if (!this.Ai) { PlaySoundManager.Play(SoundType.fly); WxApi.Shake(); } this.SetFly(); } else if (_collider.owner.name == "rocket") { if (!this.Ai) { PlaySoundManager.Play(SoundType.xp); WxApi.Shake(); } this.SetExtraSpeed(ThingsEffect.rocketeffect, ThingsEffect.rockettime); } else if (_collider.owner.name == "Jump") { if (!this.Ai) { PlaySoundManager.Play(SoundType.jump); WxApi.Shake(); } this.outlandtime = 0; this.fly = false; this.flytime = 0; this.flycounttime = 0; this.Jump(ThingsEffect.jumpeffect); this.SetExtraSpeed(0.3, 0.2); } else if (_collider.owner.name == "Coin") { if (!this.Ai) { PlaySoundManager.Play(SoundType.gold); WxApi.Shake(); EventManager.EventTrigger(EventType.GetMoney); } var sprite = _collider.owner.parent; sprite.active = false; } else if (_collider.owner.name == "Win") { this.m_animator.play("win"); if (this.m_flySprite.active) { this.m_flySprite.active = false; } if (!this.Ai) { if (Queue.Instance.GetPlayerScore == 1) { GameManager.Instance.ChangeState(GameState.Win); } else { Player.CanInput = false; this.Stop(); this.m_animator.play("idle2"); GameManager.Instance.ChangeState(GameState.End, false); } } else { this.Stop(); this.m_animator.play("fly"); } } } Gravity() { if (this.OnLand == false) { if (this.extraspeed > 0 && this.flytime <= 0) { if (this.jump) { this.outlandtime += 0.007; } else { this.outlandtime += 0.007; } } else if (this.flytime > 0) { if (this.flycounttime > 0 && this.flycounttime < 0.5) { this.outlandtime += 0.004; } else if (this.flycounttime > 0.5 && this.flycounttime < 1.3 && this.outlandtime > 0) { this.outlandtime -= 0.004; } else { this.outlandtime += 0.0035; } } else { if (this.fly) { this.outlandtime += 0.003; } else { this.outlandtime += 0.011; } } var offesty = this.outlandtime * this.outlandtime; this.m_sprite.transform.position = new Vector3$2(this.m_sprite.transform.position.x, this.m_sprite.transform.position.y - offesty, this.m_sprite.transform.position.z); } } delayDestory(_sprite) { _sprite.destroy(); } HitBox(_box) { var bp = _box; var boxspite = _box.parent.getChildAt(0); var pps = _box.parent; Laya.timer.once(1000, this, this.delayDestory, [_box.parent]); this.TriggerHit(boxspite, bp.transform.position.clone()); } TriggerHit(_node, _center) { var childNumber = _node.numChildren; for (var i = 0; i < childNumber; i++) { var box = _node.getChildAt(i); var rig = box.addComponent(Rigbody); var dir = new Vector3$2(); Vector3$2.subtract(box.transform.position, _center, dir); Vector3$2.normalize(dir, dir); rig.AddVelocity(dir, GameUtils.getRandoms(0.1, 0.5)); } } MoveX(_speed) { _speed *= 0.07; this.m_sprite.transform.translate(new Vector3$2(_speed, 0, 0)); this.m_sprite.transform.position = this.m_sprite.transform.position.x < -4.5 ? new Vector3$2(-4.5, this.m_sprite.transform.position.y, this.m_sprite.transform.position.z) : this.m_sprite.transform.position; this.m_sprite.transform.position = this.m_sprite.transform.position.x > 4.5 ? new Vector3$2(4.5, this.m_sprite.transform.position.y, this.m_sprite.transform.position.z) : this.m_sprite.transform.position; } AutoMoveX(_targetx) { this.curautospeed = 0; Laya.timer.clear(this, this.AutoMoveLoop); Laya.timer.frameLoop(1, this, this.AutoMoveLoop, [_targetx]); } AutoMoveLoop(_targetx) { if (Math.abs(_targetx - this.m_sprite.transform.position.x) < 0.01) { Laya.timer.clear(this, this.AutoMoveLoop); } var speed = GameUtils.lerp(this.curautospeed, this.AutoMoveSpeed, 0.25); if (_targetx > this.m_sprite.transform.position.x) { this.MoveX(speed); } else { this.MoveX(-speed); } } } var Vector3$3 = Laya.Vector3; class CameraManager extends Laya.Script { constructor() { super(); this.follow = false; this.lookat = false; this.offest = new Vector3$3(); this.curCameraPos = new Vector3$3(); this.startPos = new Vector3$3(); this.starRot = new Vector3$3(); this.forwardDistance = 2; this.addspeed = 1; this.followrate = 0.3; this.lerpPos = new Vector3$3(); this.lerprot = new Laya.Quaternion(); this.lookdir = new Vector3$3(); this.offesty = 0; this.offestz = 0; CameraManager.CameraManagerInstance = this; } static get Instance() { return CameraManager.CameraManagerInstance; } onAwake() { this.camera = this.owner; } SetFollow(_target, _lookat = false) { this.curTarget = _target; Vector3$3.subtract(_target.position, this.camera.transform.position, this.offest); this.follow = true; this.lookat = _lookat; this.startPos = this.camera.transform.position.clone(); this.starRot = this.camera.transform.rotationEuler.clone(); Laya.timer.clearAll(this); } StopFollow() { this.follow = false; this.curTarget = null; this.offesty = 0; this.offestz = 0; this.offest = new Vector3$3(0, 0, 0); this.curCameraPos = new Vector3$3(0, 0, 0); this.lerpPos = new Vector3$3(0, 0, 0); } PauseFollow() { this.follow = false; } ResumeFollow() { this.follow = true; } onUpdate() { if (this.follow && this.curTarget) { Vector3$3.subtract(this.curTarget.position, this.offest, this.curCameraPos); this.offesty = GameUtils.lerp(this.offesty, 1, 0.02); this.curCameraPos = new Vector3$3(this.curCameraPos.x, this.curCameraPos.y + this.offesty, this.curCameraPos.z + this.offestz); Vector3$3.lerp(this.camera.transform.position, this.curCameraPos, this.followrate, this.lerpPos); this.camera.transform.position = new Vector3$3(this.curCameraPos.x, this.lerpPos.y, this.lerpPos.z); var quaternion1 = new Laya.Quaternion(); var lookpos = new Vector3$3(this.lerpPos.x, this.lerpPos.y - 0.7, this.lerpPos.z); Laya.Quaternion.lookAt(lookpos, this.curTarget.position, new Vector3$3(0, 1, 0), quaternion1); quaternion1.invert(quaternion1); Laya.Quaternion.slerp(this.camera.transform.rotation, quaternion1, 0.05, quaternion1); this.camera.transform.rotation = quaternion1; } } SetCameraPos() { Vector3$3.subtract(this.curTarget.position, this.offest, this.curCameraPos); Vector3$3.lerp(this.camera.transform.position, this.curCameraPos, 0.7, this.lerpPos); this.camera.transform.position = new Vector3$3(this.lerpPos.x, this.camera.transform.position.y, this.camera.transform.position.z); } get GetCurCameraPos() { Vector3$3.subtract(this.curTarget.position, this.offest, this.curCameraPos); return this.curCameraPos; } } var Vector3$4 = Laya.Vector3; var Vector2 = Laya.Vector2; var InputState; (function (InputState) { InputState[InputState["None"] = 0] = "None"; InputState[InputState["ClickDown"] = 1] = "ClickDown"; InputState[InputState["ClickUp"] = 2] = "ClickUp"; InputState[InputState["Slider"] = 3] = "Slider"; })(InputState || (InputState = {})); class Player { constructor(_sprite) { this.m_inputState = InputState.None; this.curMousePos = new Vector2(0, 0); this.offestx = 0; this.m_sprite = _sprite; this.m_model = this.m_sprite.getChildAt(0); this.m_runner = _sprite.addComponent(Runner); this.m_runner.m_speed = LevelManager.Instance.curLevel.playerspeed; Queue.Instance.signup(this.m_runner); this.m_runner.name = "hehe"; Player.Instance = this; this.RegEvent(); } Reset(_sprite) { this.m_sprite = _sprite; this.m_model = this.m_sprite.getChildAt(0); this.m_runner.m_effect = this.m_sprite.getChildByName("effect"); this.m_runner.Id = 6; this.m_runner = _sprite.addComponent(Runner); this.m_runner.OnLand = true; this.m_inputState = InputState.None; this.m_runner.name = "hehe"; Queue.Instance.signup(this.m_runner); this.RegEvent(); } RegEvent() { Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnClickDown); Laya.stage.on(Laya.Event.MOUSE_UP, this, this.OnClickUp); Laya.stage.on(Laya.Event.MOUSE_OUT, this, this.OnClickUp); EventManager.EventOn(EventType.InputState, this, this.OnInput); EventManager.GameStateEventOn(GameState.Playing, this, this.OnEnterPlaying); EventManager.GameStateEventOn(GameState.Win, this, this.OnPlayerWin); EventManager.GameStateEventOn(GameState.Die, this, this.OnPlayerDie); EventManager.GameStateEventOn(GameState.End, this, this.OnGameOver); } UnRegEvent() { Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.OnClickDown); Laya.stage.off(Laya.Event.MOUSE_UP, this, this.OnClickUp); Laya.stage.off(Laya.Event.MOUSE_OUT, this, this.OnClickUp); EventManager.EventOff(EventType.InputState, this, this.OnInput); EventManager.GameStateEventOff(GameState.Playing, this, this.OnEnterPlaying); EventManager.GameStateEventOff(GameState.Win, this, this.OnPlayerWin); EventManager.GameStateEventOff(GameState.Die, this, this.OnPlayerDie); EventManager.GameStateEventOff(GameState.End, this, this.OnGameOver); Laya.timer.clearAll(this); } OnClickDown(e) { if (e.target instanceof Laya.UIComponent) { return; } this.m_inputState = InputState.ClickDown; if (!Player.CanInput) return; EventManager.EventTrigger(EventType.InputState, InputState.ClickDown); } OnClickUp(e) { if (e.target instanceof Laya.UIComponent) { return; } this.m_inputState = InputState.ClickDown; if (!Player.CanInput) return; EventManager.EventTrigger(EventType.InputState, InputState.ClickUp); } OnSlider() { this.m_inputState = InputState.Slider; if (!Player.CanInput) return; EventManager.EventTrigger(EventType.InputState, InputState.Slider); } OnInput(_state) { if (_state == InputState.ClickDown) { this.OnInputDown(); } if (_state == InputState.ClickUp) { this.OnInputUp(); } if (_state == InputState.Slider) { this.OnInputSlider(); } } RessetPlayer(_hero = null) { if (this.m_runner.m_hat) PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_hat); if (this.m_runner.m_cb) PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_cb); if (this.m_runner.m_crown) this.m_runner.m_crown.active = true; PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_crown); if (this.m_sprite) PoolManager.Instance.RecoverMeshSprite3D(this.m_sprite); var playerid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hero)); if (_hero) playerid = _hero.id; var player = ResourcesManager.Instance.roleassets[playerid].getChildAt(0); var playermodel = PoolManager.Instance.CreatMeshSprite3D(player, ""); var startpoint = new Vector3$4(0, 0, 10); playermodel.transform.position = startpoint; var hatid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)); if (hatid > 0) { var hat = ResourcesManager.Instance.hatasset[hatid]; var hatmodel = PoolManager.Instance.CreatMeshSprite3D(hat, ""); var head = playermodel.getChildAt(0).getChildAt(0); head.addChild(hatmodel); hatmodel.transform.localPosition = new Laya.Vector3(0.06, 0, 0); hatmodel.transform.localRotationEuler = new Laya.Vector3(0, 90, 0); } var cbid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)); if (cbid > 0) { var cb = ResourcesManager.Instance.cbasset[cbid]; var cbmodel = PoolManager.Instance.CreatMeshSprite3D(cb, ""); var back = playermodel.getChildAt(0).getChildAt(1); back.addChild(cbmodel); cbmodel.transform.localPosition = new Laya.Vector3(0, -0.01, 0); cbmodel.transform.localRotationEuler = new Laya.Vector3(-25, 90, 180); } ScenceManager.Instance.GameScence.addChild(playermodel); this.m_runner.Id = 6; CameraManager.Instance.StopFollow(); ScenceManager.Instance.GameCamera.transform.position = new Vector3$4(0, 0.6, 8.5); ScenceManager.Instance.GameCamera.transform.rotationEuler = new Vector3$4(-5, 180, 0); this.Reset(playermodel); } ClearPlayer() { this.m_runner.m_flySprite.active = true; this.m_runner.m_crown.active = true; PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_flySprite); PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_crown); if (this.m_runner.m_hat) PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_hat); if (this.m_runner.m_cb) PoolManager.Instance.RecoverMeshSprite3D(this.m_runner.m_cb); PoolManager.Instance.RecoverMeshSprite3D(this.m_sprite); CameraManager.Instance.StopFollow(); ScenceManager.Instance.GameCamera.transform.position = new Vector3$4(0, 0.6, 8.5); ScenceManager.Instance.GameCamera.transform.rotationEuler = new Vector3$4(-5, 180, 0); } RevivePlayer() { var stage = this.m_runner.curstage; this.m_runner.die = false; this.m_runner.m_crown.active = false; this.m_sprite.transform.position = new Vector3$4(0, stage.starty + 5, stage.startz + 5); this.m_runner.SetMove(); this.m_runner.curspeed = this.m_runner.m_speed; this.m_runner.SetFly(); ScenceManager.Instance.GameCamera.transform.position = new Vector3$4(0, this.m_sprite.transform.position.y + 0.6, this.m_sprite.transform.position.z - 1.5); CameraManager.Instance.SetFollow(this.m_sprite.transform); Player.CanInput = true; } get CurLevelPrecent() { return this.m_runner.m_sprite.transform.position.z / LevelManager.Instance.curLevel.endroadsprite.transform.position.z; } OnEnterIdle() { CameraManager.Instance.SetFollow(this.m_sprite.transform); } OnEnterPlaying() { CameraManager.Instance.SetFollow(this.m_sprite.transform); } OnPlayerWin() { Player.CanInput = false; this.m_runner.Stop(); CameraManager.Instance.StopFollow(); ScenceManager.Instance.GameLight.transform.rotationEuler = new Vector3$4(-50, 0, 0); var camera = ScenceManager.Instance.GameCamera; var camerapos = new Vector3$4(1, this.m_sprite.transform.position.y + 1.5, this.m_sprite.transform.position.z + 2.5); var lookpos = new Vector3$4(this.m_sprite.transform.position.x, this.m_sprite.transform.position.y + 0.5, this.m_sprite.transform.position.z); GameUtils.TweenLookAtMove(camera.transform, camerapos, this.m_sprite.transform.position, 1.5, () => { Laya.timer.once(1000, this, () => { GameManager.Instance.ChangeState(GameState.End, true); }); }); } OnPlayerDie() { Player.CanInput = false; this.m_runner.Stop(); CameraManager.Instance.StopFollow(); GameManager.Instance.ChangeState(GameState.Revive); } OnGameOver() { this.offestx = 0; this.UnRegEvent(); } OnInputDown() { this.curMousePos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY); Laya.timer.frameLoop(1, this, this.OnSlider); } OnInputUp() { this.offestx = 0; this.m_runner.BackRote(); Laya.timer.clear(this, this.OnSlider); } OnInputSlider() { var MousePos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY); var offestX = MousePos.x - this.curMousePos.x; offestX = offestX > 100 ? 100 : offestX; offestX = offestX < -100 ? -100 : offestX; this.offestx = GameUtils.lerp(this.offestx, offestX, 0.015); this.m_runner.MoveX(-this.offestx); var dir = new Vector3$4(-offestX * 0.005, 0, 0); if (!this.m_runner.fly) this.m_runner.TurnDir(dir); this.curMousePos = MousePos; } } Player.CanInput = true; class TrialWindow extends ui.Window.TrialWindowUI { constructor() { super(); TrialWindow.instance = this; } static get Instance() { return TrialWindow.instance; } OnOpen(_data = null) { this.hidebtn.clickHandler = Laya.Handler.create(this, this.OnTrialHide, null, false); var trialid = [2, 3, 4, 5, 6, 8, 9, 10, 11]; var curids = []; for (var i = 0; i < trialid.length; i++) { var id = trialid[i]; if (!PlayerAccount.CurrentAccount.CurAccountData.HasHero(id)) { curids.push(id); } } var useids = []; for (var i = curids.length - 1; i > -1; i--) { if (useids.length < 4) { var index = GameUtils.getRandomInt(0, curids.length - 1); useids.push(curids[index]); curids.splice(index, 1); } } if (curids.length) var skins = []; if (useids.length > 0) { for (var i = 0; i < useids.length; i++) { var heroid = useids[i]; skins.push(PlayerAccount.CurrentAccount.CurAccountData.m_heroDic[heroid]); } } else { this.Pass(); return; } this.skinlist.array = skins; for (var i = 0; i < this.skinlist.cells.length; i++) { var cell = this.skinlist.cells[i]; var config = skins[i]; var icon = cell.getChildAt(0).getChildAt(0).getChildAt(0); icon.skin = config.id > 6 ? "trial/" + config.curicon + ".png" : "shop/" + config.curicon + ".png"; var btn = cell.getChildAt(0).getChildAt(1); btn.clickHandler = Laya.Handler.create(this, this.OnTrialHero, [config], false); } this.passbtn.clickHandler = Laya.Handler.create(this, this.Pass); this.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.height = Laya.stage.height; }); } OnTrialHero(_skin) { ADPlayer.showVideoAd((flag) => { if (flag) { Player.Instance.RessetPlayer(_skin); GameManager.Instance.ChangeState(GameState.Queue); } }); } Pass() { GameManager.Instance.ChangeState(GameState.Queue); } OnTrialHide() { TrialWindow.trial = !TrialWindow.trial; this.ppp.visible = !TrialWindow.trial; } OnHide() { } } TrialWindow.trial = true; class OffLineWindow extends ui.Window.OffLineWindowUI { constructor() { super(); this.num = 0; this.left = []; this.right = []; OffLineWindow.instance = this; } OnOpen() { for (var i = 0; i < PlayerAccount.CurrentAccount.CurAccountData.redata.length; i++) { if (i <= 5) { this.left.push(PlayerAccount.CurrentAccount.CurAccountData.redata[i]); } else if (i >= 6 && i <= 10) { this.right.push(PlayerAccount.CurrentAccount.CurAccountData.redata[i]); } } this.GameListLeft.array = this.left; this.GameListLeft.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); this.GameListRight.array = this.right; this.GameListRight.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); this.GetBtn.clickHandler = Laya.Handler.create(this, this.GetCoin); this.DoubleBtn.clickHandler = Laya.Handler.create(this, this.DoubleGetCoin); var Gold = this.panel.getChildByName("Box").getChildByName("Num"); Gold.text = this.RandomGold().toString(); this.num = this.RandomGold(); Gold.text = this.num.toString(); ADPlayer.MoveButton(this.BtnBox); this.height = Laya.stage.height; } ; RenderList(_box, index) { var data = _box.dataSource; var icon = _box.getChildAt(0).getChildByName("icon"); icon.skin = data.icon; var name = _box.getChildAt(0).getChildByName("name"); name.text = data.title; var btn = _box.getChildAt(0).getChildByName("btn"); var num = _box.getChildAt(0).getChildByName("num"); if (num) num.text = GameUtils.getRandomInt(24841, 654878).toString() + "人玩"; btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { WindowManager.Instance.ClosePopView(WindowType.OffLineWindow); WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ClosePopView(WindowType.RecommendWindow); WindowManager.Instance.OpenPopView(WindowType.OffLineWindow); }); console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } ShowOffLine(leftList, Right, panel, DoubleBtn, GetBtn) { this.GameListLeft.visible = leftList; this.GameListRight.visible = Right; this.panel.visible = panel; this.DoubleBtn.visible = DoubleBtn; this.GetBtn.visible = GetBtn; } DoubleGetCoin() { ADPlayer.showVideoAd((flag) => { if (flag) { var awardmoney = this.num * 2; var agrs = [{ "reward_item": "1000" }, { "reward_num": awardmoney.toString() }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.vd, agrs, Laya.Handler.create(this, () => { GameManager.Instance.videogetmoney -= 1; }), null); } else { var awardmoney = this.num; var agrs = [{ "reward_item": "1000" }, { "reward_num": awardmoney.toString() }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.vd, agrs, Laya.Handler.create(this, () => { GameManager.Instance.videogetmoney -= 1; }), null); } WindowManager.Instance.ClosePopView(WindowType.OffLineWindow); GameManager.Instance.GetGoin = true; HomeWindow.Instance.goldTex.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money); }); } GetCoin() { var awardmoney = this.RandomGold(); var agrs = [{ "reward_item": "1000" }, { "reward_num": awardmoney.toString() }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.vd, agrs, Laya.Handler.create(this, () => { GameManager.Instance.videogetmoney -= 1; }), null); WindowManager.Instance.ClosePopView(WindowType.OffLineWindow); WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); GameManager.Instance.GetGoin = true; HomeWindow.Instance.goldTex.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money); } RandomGold() { var goldnum = GameUtils.getRandomInt(100, 1000); return goldnum; } ShowList() { } OnHide() { RecommendWindow.Instance.ShowRecommendWindow(true, false, true, false, true); } ; } class HomeWindow extends ui.Window.HomeWindowUI { constructor() { super(); this.index = 0; this.offestx = 0; this.offestx2 = 0; HomeWindow.instance = this; } static get Instance() { return HomeWindow.instance; } OnOpen(_data = null) { this.baginBtn.clickHandler = Laya.Handler.create(this, this.OnClickBagin, null, false); this.skinshop.clickHandler = Laya.Handler.create(this, this.OnOpenSkinShop); this.settingBtn.clickHandler = Laya.Handler.create(this, this.OnOpenSetting); this.rankBtn.clickHandler = Laya.Handler.create(this, this.OnOpenRank); this.signBtn.clickHandler = Laya.Handler.create(this, this.OnOpenSign); this.taskBtn.clickHandler = Laya.Handler.create(this, this.OnOpenTask, null, false); this.LeaveBtn.clickHandler = Laya.Handler.create(this, this.onOpenLeave); this.moreFunBtn.clickHandler = Laya.Handler.create(this, this.onOpenMoreFun); this.guide.on(Laya.Event.MOUSE_DOWN, this, this.OnGuideClick); WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); if (!GameManager.Instance.GetGoin) { WindowManager.Instance.OpenPopView(WindowType.OffLineWindow); } RecommendWindow.Instance.cheat = true; OffLineWindow.instance.ShowOffLine(true, true, true, true, true); RecommendWindow.Instance.cainixihuan.bottom = 0; RecommendWindow.Instance.choutiBtn.clickHandler = Laya.Handler.create(this, this.OnCloseCT, null, false); this.ShowBaoKuanYouXiView(); this.goldTex.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money); this.curswtage.value = (Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.stage)) + 1).toString(); this.height = Laya.stage.height; } ShowBaoKuanYouXiView() { this.index = PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1; this.RefreshBaoKuanYouXi(); Laya.timer.loop(3000, this, this.LoopBaoKuan); } LoopBaoKuan() { this.index--; if (this.index < 0) { this.index = PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1; } this.RefreshBaoKuanYouXi(); } RefreshBaoKuanYouXi() { var data = PlayerAccount.CurrentAccount.CurAccountData.redata[this.index]; var icon = this.rebtn.getChildByName("icon"); icon.skin = data.icon; var name = this.rebtn.getChildByName("name"); name.text = data.title; this.rebtn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { RecommendWindow.Instance.OpenChouTiView(true); console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } OnGuideClick() { this.guide.on(Laya.Event.MOUSE_MOVE, this, this.OnClickBagin); } ShowGuide() { this.Mask1 = new Laya.Sprite(); this.Mask1.graphics.drawRect(0, 0, this.guide1.width, this.guide1.height, "#000000"); this.Mask1.pivot(this.guide1.width, 0); this.guide1.mask = this.Mask1; this.Mask2 = new Laya.Sprite(); this.Mask2.graphics.drawRect(0, 0, this.guide2.width, this.guide2.height, "#000000"); this.Mask2.pivot(this.guide2.width, 0); this.guide2.mask = this.Mask2; this.offestx = 0; this.offestx2 = 0; Laya.timer.frameLoop(1, this, this.RefreshMask1); } RefreshMask1() { this.offestx += 3; if (this.offestx > this.guide1.width) { Laya.timer.clear(this, this.RefreshMask1); this.offestx = 0; this.Mask1.pos(this.offestx, 0); Laya.timer.frameLoop(1, this, this.RefreshMask2); return; } this.Mask1.pos(this.offestx, 0); this.hand.x = this.guide1.x + this.offestx; } RefreshMask2() { this.offestx2 += 3; if (this.offestx2 > this.guide2.width) { Laya.timer.clear(this, this.RefreshMask2); this.offestx2 = 0; this.Mask2.pos(this.guide1.x + this.guide1.width, 0); Laya.timer.frameLoop(1, this, this.RefreshMask1); return; } this.Mask2.pos(this.offestx2, 0); this.hand.x = this.guide2.x - this.offestx2; } OnClickBagin() { WxApi.Instance.recordAldEvent("主界面点击开始游戏", ""); if (TrialWindow.trial && PlayerAccount.CurrentAccount.CurAccountData.trial) { WindowManager.Instance.ShowWindow(WindowType.TrialWindow); } else { GameManager.Instance.ChangeState(GameState.Queue); } } OnOpenSkinShop() { WxApi.Instance.recordAldEvent("主界面点击皮肤商城", ""); WindowManager.Instance.ShowWindow(WindowType.ShopWindow); } OnOpenSetting() { WxApi.Instance.recordAldEvent("主界面点击设置界面", ""); WindowManager.Instance.ShowWindow(WindowType.SettingWindow); } OnOpenRank() { WxApi.Instance.recordAldEvent("主界面点击排行榜", ""); WindowManager.Instance.ShowWindow(WindowType.RankWindow); } OnOpenSign() { WxApi.Instance.recordAldEvent("主界面点击签到界面", ""); WindowManager.Instance.ShowWindow(WindowType.SignWindow); } OnOpenTask() { WxApi.Instance.recordAldEvent("主界面点击任务界面", ""); WxApi.Message("暂未开放"); } onOpenLeave() { WxApi.Instance.recordAldEvent("主界面点击离开游戏", ""); WindowManager.Instance.ShowWindow(WindowType.MoreFunWindow); } onOpenMoreFun() { WxApi.Instance.recordAldEvent("主界面点击更多好玩游戏", ""); WindowManager.Instance.ShowWindow(WindowType.FriendPlayingWindow); } OnOpenOffLine() { WxApi.Instance.recordAldEvent("离线收益界面开启", ""); WindowManager.Instance.ShowWindow(WindowType.OffLineWindow); } OnCloseCT() { RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); }); } OnHide() { this.guide.off(Laya.Event.MOUSE_DOWN, this, this.OnGuideClick); this.guide.off(Laya.Event.MOUSE_MOVE, this, this.OnClickBagin); Laya.timer.clearAll(this); } } class InGameWindow extends ui.Window.InGameWindowUI { constructor() { super(); this.nextpoint = []; this.oldpoint = []; this.index = 0; InGameWindow.instance = this; } static get Instance() { return InGameWindow.instance; } OnOpen(_data = null) { EventManager.EventOn(EventType.MoneyChange, this, this.OnHover); this.RefreshBaoKuanYouXi(); Laya.timer.loop(3000, this, this.LoopBaoKuan); this.height = Laya.stage.height; } OnPlayerRank(_playerList) { this.ranklist.array = _playerList; this.ranklist.renderHandler = Laya.Handler.create(this, this.OnRank, null, false); } OnRank(_box) { var data = _box.dataSource; var name = _box.getChildAt(0).getChildByName("name"); name.text = data.name; var score = _box.getChildAt(0).getChildByName("score"); score.text = Math.round(data.m_sprite.transform.position.z).toString(); } OnHover(_time) { this.score.value = _time.toString(); } OnExtraspeedtime(_time) { this.extraspeedtime.text = Math.round(_time).toString(); } OnSpeed(_time) { this.speed.text = _time; } OnFly(_time) { this.flytime.text = Math.round(_time).toString(); } OnGetRoadPoint(_ps) { this.road.text = Math.floor(_ps).toString(); } LoopBaoKuan() { this.index++; if (this.index > PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1) { this.index = 0; } this.RefreshBaoKuanYouXi(); } RefreshBaoKuanYouXi() { var data = PlayerAccount.CurrentAccount.CurAccountData.redata[this.index]; var icon = this.shiwan.getChildByName("icon"); icon.skin = data.icon; var btn = this.shiwan.getChildByName("btn"); btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } RenderList(_box, index) { var data = _box.dataSource; var icon = _box.getChildAt(0).getChildByName("icon"); icon.skin = data.icon; var btn = _box.getChildAt(0).getChildByName("btn"); btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ClosePopView(WindowType.RecommendWindow); }); console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } OnHide() { EventManager.EventOff(EventType.Hover, this, this.OnHover); EventManager.EventOff(EventType.extraspeedtime, this, this.OnExtraspeedtime); EventManager.EventOff(EventType.speed, this, this.OnSpeed); EventManager.EventOff(EventType.flytime, this, this.OnFly); EventManager.EventOff(EventType.GetRoadPoint, this, this.OnGetRoadPoint); EventManager.EventOff(EventType.PlayerRank, this, this.OnPlayerRank); } } var SignItemState; (function (SignItemState) { SignItemState[SignItemState["ready"] = 0] = "ready"; SignItemState[SignItemState["locking"] = 1] = "locking"; SignItemState[SignItemState["complete"] = 2] = "complete"; })(SignItemState || (SignItemState = {})); class JiangLi { constructor(_num, _amount) { this.jianglinum = _num; this.jiangliamount = _amount; } } class QianDao { get JiangLiShuJu() { var jianglishuju = this.jianglis.split(";"); if (jianglishuju.length > 1) { return new JiangLi(Number(6000), Number(1)); } else { return new JiangLi(Number(this.jianglis), Number(this.jiangliamount)); } } } class SignWindow extends ui.Window.SignWindowUI { constructor() { super(); this.JiangLiLieBiao = {}; this.qiandaoshujus = []; SignWindow.Viewmode = this; } static get Mode() { return SignWindow.Viewmode; } OnOpen(_data = null) { this.qiandaoshujus = this.GetQinDaoShuJu(); this.ShuaXinLieBiao(); this.ShuangBei.visible = SignWindow.keyiqiandao; this.ShuangBei.clickHandler = Laya.Handler.create(this, this.OnDoubleSign, null, false); this.return.clickHandler = Laya.Handler.create(this, this.GoHome); this.ptBtn.clickHandler = Laya.Handler.create(this, this.OnSign, null, false); ADPlayer.MoveButton(this.BtnBox); this.height = Laya.stage.height; } GoHome() { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } GetQinDaoShuJu() { var qiandaos = []; var peizhi = PlayerAccount.CurrentAccount.CurAccountData.GetConfig(AccountConfig.sign); var qiandaotian = Number(PlayerAccount.CurrentAccount.CurAccountData.GetSign(signdata.sign_days)); var diyizhou = qiandaotian < 7; var afsafssfa = diyizhou ? 0 : 7; for (var i = afsafssfa; i < afsafssfa + 7; i++) { this.JiangLiLieBiao[peizhi[i].id] = peizhi[i].rewards; } for (var key in this.JiangLiLieBiao) { var jianglinum = this.JiangLiLieBiao[key]; var jiangli = PlayerAccount.CurrentAccount.CurAccountData.GetRewardConfig(jianglinum); var afsfsafs = new QianDao(); afsfsafs.miaoshu = jiangli.group_name; afsfsafs.logo = jiangli.icon; afsfsafs.qiandaonum = Number(jiangli.id); afsfsafs.jianglis = jiangli.reward_item; afsfsafs.jiangliamount = jiangli.reward_num; afsfsafs.weight = jiangli.reward_weight; var fasafsaf = Number(key); if (qiandaotian > fasafsaf - 1) afsfsafs.mold = SignItemState.complete; if (qiandaotian < fasafsaf - 1) afsfsafs.mold = SignItemState.locking; if (qiandaotian == fasafsaf - 1 && SignWindow.keyiqiandao) { afsfsafs.mold = SignItemState.ready; } qiandaos.push(afsfsafs); } return qiandaos; } ShuaXinLieBiao() { for (var i = 0; i < this.qiandaoPan.numChildren; i++) { var qindao = this.qiandaoPan.getChildAt(i); var shuju = this.qiandaoshujus[i]; var jianglinum = shuju.JiangLiShuJu.jianglinum; var award = qindao.getChildByName("jiangli").getChildByName("money"); award.visible = true; var clip = award.getChildAt(1); clip.value = "x" + shuju.JiangLiShuJu.jiangliamount.toString(); var icon = award.getChildAt(0); icon.skin = "sign/qiandao_1_5_4.png"; var bg = qindao.getChildByName("bg"); bg.skin = "sign/qiandao_1_3.png"; var money = qindao.getChildByName("jiangli").getChildByName("money"); money.visible = false; var role = qindao.getChildByName("jiangli").getChildByName("role"); role.visible = false; var cb = qindao.getChildByName("jiangli").getChildByName("cb"); cb.visible = false; if (jianglinum == 1000) { money.visible = true; var clip = money.getChildAt(1); clip.value = shuju.JiangLiShuJu.jiangliamount.toString(); var sprite = money.getChildAt(0); sprite.skin = "sign/qiandao_1_5_4.png"; } else if (jianglinum >= 7001 && jianglinum <= 70012) { role.visible = true; var roleicon = PlayerAccount.CurrentAccount.CurAccountData.GetEntity(jianglinum.toString(), entity.icon); var sprite = role.getChildAt(0); sprite.skin = "shop/" + roleicon + ".png"; } else if (jianglinum >= 8001 && jianglinum <= 8006) { cb.visible = true; var cbicon = PlayerAccount.CurrentAccount.CurAccountData.GetEntity(jianglinum.toString(), entity.icon); var sprite = cb.getChildAt(0); sprite.skin = "shop/" + cbicon + ".png"; } var cansign = shuju.mold; if (cansign == SignItemState.complete) { var complete = qindao.getChildByName("complete"); complete.visible = true; bg.skin = "sign/qiandao_1_4_2.png"; } else if (cansign == SignItemState.ready) { var btn = qindao.getChildByName("button"); btn.clickHandler = Laya.Handler.create(this, this.OnSign, null, false); bg.skin = "sign/qiandao_1_4.png"; } } } OnSign() { var curgold = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)); let param = [{ "video": "0" }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.Sign, param, Laya.Handler.create(this, function (e) { console.log("OnSign---111111111"); var reward = e["rewards"]; SignWindow.Mode.qiandaoshujus = SignWindow.Mode.GetQinDaoShuJu(); SignWindow.Mode.ShuangBei.visible = false; SignWindow.Mode.ShuaXinLieBiao(); if (reward["1000"]) { console.log("OnSign---222222"); var gg = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)) - curgold; GameUtils.GetMoney(gg, null, Laya.Handler.create(this, () => { console.log("OnSign---3333333"); WindowManager.Instance.ShowWindow(WindowType.HomeWindow); })); } else { GameUtils.TweenText(new TextData("皮肤 + 1", new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height * 0.35), new Laya.Vector2(250, 80), 30), 150, Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); })); } }), Laya.Handler.create(this, this.OnSignError), true); } OnDoubleSign() { console.log("双倍领取doublesign"); ADPlayer.showVideoAd((flag) => { if (flag) { var curgold = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)); let param = [{ "video": "1" }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.Sign, param, Laya.Handler.create(this, function (e) { var reward = e["rewards"]; SignWindow.Mode.qiandaoshujus = SignWindow.Mode.GetQinDaoShuJu(); SignWindow.Mode.ShuangBei.visible = false; SignWindow.Mode.ShuaXinLieBiao(); if (reward["1000"]) { var gg = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)) - curgold; GameUtils.GetMoney(gg, null, Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); })); } else { GameUtils.TweenText(new TextData("皮肤 + 1", new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height * 0.35), new Laya.Vector2(250, 80), 30), 150, Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); })); } }), Laya.Handler.create(this, this.OnSignError), true); } }); } OnSignError(e) { console.log(e); } OnHide() { } static get keyiqiandao() { let fassafsafs = new Date(PlayerAccount.CurrentAccount.ServerTime * 1000); fassafsafs.setHours(0, 0, 0, 0); var faafsafs = fassafsafs.valueOf(); var dadadas = Number(PlayerAccount.CurrentAccount.CurAccountData.GetSign(signdata.sign_time)); var asagsag = dadadas * 1000; var faafs = asagsag < faafsafs ? true : false; return faafs; } } class SettlementWindow extends ui.Window.SettlementWindowUI { constructor() { super(); SettlementWindow.instance = this; } static get Instance() { return SettlementWindow.instance; } OnOpen(win = false) { WxApi.Instance.recordAldEvent("进入结算界面 " + "win:" + win + " stage:" + LevelManager.Instance.curLevel.levelid, "1"); if (win) { this.winshow.visible = true; } else { this.loseshow.visible = true; } this.getmoney.value = GameManager.Instance.gamegold.toString(); this.scoreTex.value = Player.Instance.m_runner.die ? "6" : Queue.Instance.GetPlayerScore.toString(); var iswin = win ? "1" : "0"; var rank = Queue.Instance.GetPlayerScore; var equiphero = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hero); var qeuiphat = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat); var qeuipdance = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_dance); var agrs = [{ "t": PlayerAccount.CurrentAccount.ServerTime.toString() }, { "win": iswin }, { "rank": rank.toString() }, { "money": GameManager.Instance.gamegold.toString() }, { "hat": qeuiphat }, { "hero": equiphero }, { "dance": qeuipdance }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.end, agrs, Laya.Handler.create(this, this.OnSettlementEnd, [win]), Laya.Handler.create(this, this.OnError)); WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.ShowRecommendWindow(false, false, false, true, false); ADPlayer.MoveButton(this.BtnPan); this.awardBtn.clickHandler = Laya.Handler.create(this, this.OnVdAward); this.height = Laya.stage.height; } OnVdAward() { WxApi.Instance.recordAldEvent("点击3倍奖励", ""); ADPlayer.showVideoAd((flag) => { if (flag) { var awardmoney = GameManager.Instance.gamegold * 3; var agrs = [{ "reward_item": "1000" }, { "reward_num": awardmoney.toString() }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.vd, agrs, Laya.Handler.create(this, () => { GameUtils.GetMoney(awardmoney); }), null); } }); } OnPlayAgain(_win) { if (_win) { GameManager.Instance.EnterNextLevel(); } else { GameManager.Instance.RessetGame(); } if (SignWindow.keyiqiandao) { WindowManager.Instance.ShowWindow(WindowType.SignWindow); } else { ADPlayer.ClearBanner(); RecommendWindow.Instance.chouti.visible = true; RecommendWindow.Instance.choutiBtn.visible = false; RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); }); } } OnSettlementEnd(_win, _data) { var level = LevelManager.Instance.curLevel; if (_win) { WxApi.Instance.levelSuccess(level.levelid.toString(), level.levelid.toString(), PlayerAccount.CurrentAccount.CurAccountData.UseId); } else { WxApi.Instance.levelFail(level.levelid.toString(), level.levelid.toString(), PlayerAccount.CurrentAccount.CurAccountData.UseId, Player.Instance.CurLevelPrecent.toString(), Player.Instance.m_runner.m_sprite.name); } var stage = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.stage)); if (_win) WxApi.writeStage(stage); this.backhome.clickHandler = Laya.Handler.create(this, this.OnPlayAgain, [_win]); } OnError(e) { console.log(e); } OnHide() { } } class ReviveWindow extends ui.Window.ReviveWindowUI { constructor() { super(); ReviveWindow.instance = this; } static get Instance() { return ReviveWindow.instance; } OnOpen(_data = null) { WxApi.Instance.recordAldEvent("进入复活界面", "1"); this.passBtn.clickHandler = Laya.Handler.create(this, this.OnPassRevive); this.reviveBtn.clickHandler = Laya.Handler.create(this, this.OnRevive, null, false); this.stagepre.value = Player.Instance.CurLevelPrecent; this.stagetex.value = LevelManager.Instance.curLevel.levelid.toString(); this.stageClip.value = Math.floor(Player.Instance.CurLevelPrecent * 100).toString(); this.getmoney.value = GameManager.Instance.gamegold.toString(); WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.ShowRecommendWindow(false, false, false, true, false); ADPlayer.MoveButton(this.BtnPan); this.height = Laya.stage.height; } OnPassRevive() { WxApi.Instance.recordAldEvent("点击跳过复活", "1"); GameManager.Instance.ChangeState(GameState.End, false); } ReadyShow() { this.showcarCamera = new Laya.Camera(); this.showScence.addChild(this.showcarCamera); this.showlight = new Laya.DirectionLight(); this.showScence.addChild(this.showlight); this.curstage = new Laya.Sprite3D(); this.showScence.addChild(this.curstage); this.showcarCamera.viewport = new Laya.Viewport(this.showpan.x, this.showpan.y, this.showpan.width, this.showpan.height); this.showcarCamera.clearFlag = 2; this.showcarCamera.fieldOfView = 30; this.showcarCamera.transform.position = new Laya.Vector3(0, 0.5, 1.1); ResourcesManager.Instance.LoadPlayer(1, Laya.Handler.create(this, this.OnPlayerLoad, [1])); } OnPlayerLoad(_id, _model) { var cursprite = _model.getChildAt(0); this.cursprite = PoolManager.Instance.CreatMeshSprite3D(cursprite, ""); this.curanimator = this.cursprite.getChildAt(0).getComponent(Laya.Animator); this.curstage.addChild(this.cursprite); this.cursprite.transform.localPosition = new Laya.Vector3(0, 0, 0); this.cursprite.transform.rotationEuler = new Laya.Vector3(-10, 0, 0); var lookpos = new Laya.Vector3(this.cursprite.transform.position.x, this.cursprite.transform.position.y + 0.3, this.cursprite.transform.position.z + 0.01); this.showcarCamera.transform.lookAt(lookpos, new Laya.Vector3(0, 1, 0)); Laya.timer.once(500, this, () => { this.curanimator.play("lose"); }); } OnRevive() { if (!Main.OnWx) { GameManager.Instance.ReviveGame(); return; } WxApi.Instance.recordAldEvent("点击复活", "1"); ADPlayer.showVideoAd((flag) => { if (flag) { WxApi.Instance.recordAldEvent("复活成功", "1"); GameManager.Instance.ReviveGame(); } else { WxApi.Instance.recordAldEvent("复活失败", "1"); } }); } OnHide() { } } var Vector2$1 = Laya.Vector2; var ShopState; (function (ShopState) { ShopState[ShopState["role"] = 0] = "role"; ShopState[ShopState["hat"] = 1] = "hat"; ShopState[ShopState["cb"] = 2] = "cb"; })(ShopState || (ShopState = {})); class ShopWindow extends ui.Window.ShopWindowUI { constructor() { super(); this.roleicon = new Vector2$1(69, 172); this.cbicon = new Vector2$1(166, 83); this.haticon = new Vector2$1(102, 95); this.showhatdic = {}; this.showcbdic = {}; this.herodatas = []; this.hatDatas = []; this.cbDatas = []; this.curstate = ShopState.role; ShopWindow.instance = this; } InitData() { this.herodatas = []; this.hatDatas = []; this.cbDatas = []; var gethero = []; var nogethero = []; var gethat = []; var nogethat = []; var getcb = []; var nogetcb = []; for (var key in PlayerAccount.CurrentAccount.CurAccountData.m_heroDic) { var data = PlayerAccount.CurrentAccount.CurAccountData.m_heroDic[key]; if (PlayerAccount.CurrentAccount.CurAccountData.HasHero(data.id)) { gethero.push(data); } else { nogethero.push(data); } } this.herodatas = gethero.concat(nogethero); for (var key in PlayerAccount.CurrentAccount.CurAccountData.m_hatDic) { var data1 = PlayerAccount.CurrentAccount.CurAccountData.m_hatDic[key]; if (PlayerAccount.CurrentAccount.CurAccountData.HasHat(data1.id)) { gethat.push(data1); } else { nogethat.push(data1); } } this.hatDatas = gethat.concat(nogethat); for (var key in PlayerAccount.CurrentAccount.CurAccountData.m_cbDic) { var data1 = PlayerAccount.CurrentAccount.CurAccountData.m_cbDic[key]; if (PlayerAccount.CurrentAccount.CurAccountData.HasDane(data1.id)) { getcb.push(data1); } else { nogetcb.push(data1); } } this.cbDatas = getcb.concat(nogetcb); } static get Instance() { return ShopWindow.instance; } OnOpen(_data = null) { this.InitData(); this.showScence = new Laya.Scene3D(); this.addChild(this.showScence); this.ReadyShow(); this.closeBtn.clickHandler = Laya.Handler.create(this, this.CloseW); this.renderList.vScrollBarSkin = ""; this.roleBtn.clickHandler = Laya.Handler.create(this, this.ChangeState, [ShopState.role], false); this.hatBtn.clickHandler = Laya.Handler.create(this, this.ChangeState, [ShopState.hat], false); this.cbBtn.clickHandler = Laya.Handler.create(this, this.ChangeState, [ShopState.cb], false); this.vdawardBtn.clickHandler = Laya.Handler.create(this, this.OnVdAward, null, false); this.height = Laya.stage.height; } ChangeState(_state) { this.curstate = _state; switch (_state) { case ShopState.role: this.OnShowRoleList(); break; case ShopState.hat: this.OnShowHatList(); break; case ShopState.cb: this.OnShowcbList(); break; } } OnVdAward() { if (GameManager.Instance.videogetmoney <= 0) return; ADPlayer.showVideoAd((flag) => { if (flag) { var awardmoney = 200; var agrs = [{ "reward_item": "1000" }, { "reward_num": awardmoney.toString() }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.vd, agrs, Laya.Handler.create(this, () => { GameManager.Instance.videogetmoney -= 1; GameUtils.GetMoney(awardmoney); }), null); } }); WxApi.Message("暂未开放"); } CloseW() { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } OnShowRoleList() { this.hatbg.visible = true; this.cgbg.visible = true; this.rolebg.visible = false; this.renderList.array = this.herodatas; this.renderList.renderHandler = Laya.Handler.create(this, this.OnRenderRoleList, null, false); } OnShowHatList() { this.hatbg.visible = false; this.cgbg.visible = true; this.rolebg.visible = true; this.renderList.array = this.hatDatas; this.renderList.renderHandler = Laya.Handler.create(this, this.OnRenderHatList, null, false); } OnShowcbList() { this.hatbg.visible = true; this.cgbg.visible = false; this.rolebg.visible = true; this.renderList.array = this.cbDatas; this.renderList.renderHandler = Laya.Handler.create(this, this.OnRenderCbList, null, false); } ReadyShow() { this.showcarCamera = new Laya.Camera(); this.showScence.addChild(this.showcarCamera); this.showlight = new Laya.DirectionLight(); this.showScence.addChild(this.showlight); this.curstage = new Laya.Sprite3D(); this.showScence.addChild(this.curstage); this.showcarCamera.viewport = new Laya.Viewport(this.carShowPan.x, this.carShowPan.y, this.carShowPan.width, this.carShowPan.height); this.showcarCamera.clearFlag = 2; this.showcarCamera.fieldOfView = 30; this.showcarCamera.transform.position = new Laya.Vector3(0, 2, 3); var playerid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hero)); this.TryToShowCar(playerid); var hatid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)); if (hatid > 0) this.TryToShowHat(hatid); var cbid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_dance)); if (cbid > 0) this.TryToShowCb(cbid); Laya.timer.frameLoop(1, this, this.ShowRot); this.ChangeState(ShopState.role); } OnRenderRoleList(_cell, _index) { var data = _cell.dataSource; var btn = _cell.getChildByName("btn"); var tryBtn = _cell.getChildByName("tryBtn"); var roleicon = _cell.getChildByName("roleicon"); roleicon.visible = true; var haticon = _cell.getChildByName("haticon"); haticon.visible = false; var cbicon = _cell.getChildByName("cbicon"); cbicon.visible = false; var bg = _cell.getChildByName("bg"); var type = data.require_type; var num = data.require_num; bg.skin = data.id == Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hero)) ? "shop/shangcheng_1_4_2.png" : "shop/shangcheng_1_4_1.png"; tryBtn.clickHandler = Laya.Handler.create(this, this.TryToShowCar, [data.id], false); roleicon.skin = "shop/" + data.curicon + ".png"; btn.visible = true; btn.clickHandler = null; var box = btn.getChildAt(0); box.visible = false; var box2 = btn.getChildAt(1); box2.visible = false; var box3 = btn.getChildAt(2); box3.visible = false; var box4 = btn.getChildAt(3); box4.visible = false; if (PlayerAccount.CurrentAccount.CurAccountData.HasHero(data.id)) { btn.visible = false; return; } if (type == 2) { box.visible = true; var clip = box.getChildByName("clip"); clip.value = "x" + num; btn.clickHandler = Laya.Handler.create(this, this.TryBuyHero, [data], false); } else if (type == 3) { box2.visible = true; var clip = box2.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetHeroProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.videoGetHero, [data.id], false); } else if (type == 4) { box3.visible = true; var clip = box3.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetHeroProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.ShareGetHero, [data.id], false); } else if (type == 6) { box4.visible = true; } else { btn.visible = false; } } OnRenderHatList(_cell, _index) { var data = _cell.dataSource; var btn = _cell.getChildByName("btn"); var tryBtn = _cell.getChildByName("tryBtn"); var roleicon = _cell.getChildByName("roleicon"); roleicon.visible = false; var haticon = _cell.getChildByName("haticon"); haticon.visible = true; var cbicon = _cell.getChildByName("cbicon"); cbicon.visible = false; var bg = _cell.getChildByName("bg"); var type = data.require_type; var num = data.require_num; bg.skin = data.id == Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)) ? "shop/shangcheng_1_4_2.png" : "shop/shangcheng_1_4_1.png"; tryBtn.clickHandler = Laya.Handler.create(this, this.TryToShowHat, [data.id], false); haticon.skin = "shop/" + data.icon + ".png"; btn.visible = true; btn.clickHandler = null; var box = btn.getChildAt(0); box.visible = false; var box2 = btn.getChildAt(1); box2.visible = false; var box3 = btn.getChildAt(2); box3.visible = false; var box4 = btn.getChildAt(3); box4.visible = false; if (PlayerAccount.CurrentAccount.CurAccountData.HasHat(data.id)) { btn.visible = false; return; } if (type == 2) { box.visible = true; var clip = box.getChildByName("clip"); clip.value = "x" + num; btn.clickHandler = Laya.Handler.create(this, this.TryBuyHat, [data], false); } else if (type == 3) { box2.visible = true; var clip = box2.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetHatProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.VideoGetHat, [data.id], false); } else if (type == 4) { box3.visible = true; var clip = box3.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetHatProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.ShareGetHat, [data.id], false); } else if (type == 6) { box4.visible = true; } else { btn.visible = false; } } OnRenderCbList(_cell, _index) { var data = _cell.dataSource; var btn = _cell.getChildByName("btn"); var tryBtn = _cell.getChildByName("tryBtn"); var roleicon = _cell.getChildByName("roleicon"); roleicon.visible = false; var haticon = _cell.getChildByName("haticon"); haticon.visible = false; var cbicon = _cell.getChildByName("cbicon"); cbicon.visible = true; var bg = _cell.getChildByName("bg"); var type = data.require_type; var num = data.require_num; bg.skin = data.id == Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_dance)) ? "shop/shangcheng_1_4_2.png" : "shop/shangcheng_1_4_1.png"; tryBtn.clickHandler = Laya.Handler.create(this, this.TryToShowCb, [data.id], false); cbicon.skin = "shop/" + data.icon + ".png"; btn.visible = true; btn.clickHandler = null; var box = btn.getChildAt(0); box.visible = false; var box2 = btn.getChildAt(1); box2.visible = false; var box3 = btn.getChildAt(2); box3.visible = false; var box4 = btn.getChildAt(3); box4.visible = false; if (PlayerAccount.CurrentAccount.CurAccountData.HasDane(data.id)) { btn.visible = false; return; } if (type == 2) { box.visible = true; var clip = box.getChildByName("clip"); clip.value = "x" + num; btn.clickHandler = Laya.Handler.create(this, this.TryBuyCB, [data], false); } else if (type == 3) { box2.visible = true; var clip = box2.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetCbProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.videoGetCB, [data.id], false); } else if (type == 4) { box3.visible = true; var clip = box3.getChildByName("clip"); clip.value = PlayerAccount.CurrentAccount.CurAccountData.GetCbProgress(data.id) + "/" + num; btn.clickHandler = Laya.Handler.create(this, this.ShareGetHat, [data.id], false); } else if (type == 6) { box4.visible = true; } else { btn.visible = false; } } TryToShowCar(_carid) { var asset = ResourcesManager.Instance.roleassets[_carid].getChildAt(0); this.OnPlayerLoad(_carid, asset); this.TryToShowHat(Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat))); this.TryToShowCb(Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat))); if (PlayerAccount.CurrentAccount.CurAccountData.HasHero(_carid)) { this.TryEquipHero(_carid); } } TryToShowHat(_id) { if (_id == 0) return; var asset = ResourcesManager.Instance.hatasset[_id]; this.OnHatLoad(_id, asset); if (PlayerAccount.CurrentAccount.CurAccountData.HasHat(_id)) { this.TryEquipHat(_id); } } TryToShowCb(_id) { if (_id == 0) return; var asset = ResourcesManager.Instance.cbasset[_id]; this.onCbLoad(_id, asset); if (PlayerAccount.CurrentAccount.CurAccountData.HasDane(_id)) { this.TryEquipCB(_id); } } TryEquipHero(_id) { var agrs = [{ "id": _id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.EquipHero, agrs, Laya.Handler.create(this, () => { Player.Instance.RessetPlayer(); this.InitData(); this.renderList.array = this.herodatas; }), null); } TryEquipHat(_id) { var agrs = [{ "id": _id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.EquipHat, agrs, Laya.Handler.create(this, () => { Player.Instance.RessetPlayer(); this.InitData(); this.renderList.array = this.hatDatas; }), null); } TryEquipCB(_id) { var agrs = [{ "id": _id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.EquipDance, agrs, Laya.Handler.create(this, () => { Player.Instance.RessetPlayer(); this.InitData(); this.renderList.array = this.hatDatas; }), null); } TryBuyHero(_data) { WxApi.Instance.recordAldEvent("商城界面:点击购买角色->" + _data.name, "1"); var money = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)); if (money < _data.require_num) { WxApi.Message("金币不足!"); return; } var agrs = [{ "id": _data.id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.BuyHero, agrs, Laya.Handler.create(this, () => { WxApi.Instance.recordAldEvent("商城界面:成功购买角色->" + _data.name, "1"); this.TryToShowCar(_data.id); }), null); } ShareGetHat(_id) { WxApi.Instance.recordAldEvent("商城界面:点击分享获得帽子皮肤->" + _id, "1"); WxApi.shareImage("分享获得帽子", (flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "share" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissionhat, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.hatDatas; }), Laya.Handler.create(this, () => { })); } }, "1"); } ShareGetCB(_id) { WxApi.Instance.recordAldEvent("商城界面:点击分享获得翅膀皮肤->" + _id, "1"); WxApi.shareImage("分享获得翅膀", (flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "share" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissiondance, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.hatDatas; }), Laya.Handler.create(this, () => { })); } }, "1"); } ShareGetHero(_id) { WxApi.Instance.recordAldEvent("商城界面:点击分享获得角色皮肤->" + _id, "1"); WxApi.shareImage("分享获得英雄", (flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "share" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissionhero, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.herodatas; }), Laya.Handler.create(this, () => { })); } }, "1"); } VideoGetHat(_id) { WxApi.Instance.recordAldEvent("商城界面:点击看视频获得帽子皮肤", "1"); ADPlayer.showVideoAd((flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "video" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissionhat, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.herodatas; }), Laya.Handler.create(this, () => { })); } }); } videoGetHero(_id) { WxApi.Instance.recordAldEvent("商城界面:点击看视频获得角色皮肤", "1"); ADPlayer.showVideoAd((flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "video" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissionhero, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.herodatas; }), Laya.Handler.create(this, () => { })); } }); } videoGetCB(_id) { WxApi.Instance.recordAldEvent("商城界面:点击看视频获得翅膀皮肤", "1"); ADPlayer.showVideoAd((flag) => { if (flag) { var agrs = [{ "id": _id.toString() }, { "channel": "video" }, { "t": PlayerAccount.CurrentAccount.ServerTime.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.fissiondance, agrs, Laya.Handler.create(this, () => { this.InitData(); this.renderList.array = this.herodatas; }), Laya.Handler.create(this, () => { })); } }); } TryBuyHat(_data) { WxApi.Instance.recordAldEvent("商城界面:点击购买帽子->" + _data.name, "1"); var money = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)); if (money < _data.require_num) { WxApi.Message("金币不足!"); return; } var agrs = [{ "id": _data.id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.BuyHat, agrs, Laya.Handler.create(this, () => { this.TryToShowHat(_data.id); }), null); } TryBuyCB(_data) { WxApi.Instance.recordAldEvent("商城界面:点击购买翅膀->" + _data.name, "1"); var money = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money)); if (money < _data.require_num) { WxApi.Message("金币不足!"); return; } var agrs = [{ "id": _data.id.toString() }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.BuyDance, agrs, Laya.Handler.create(this, () => { this.TryToShowCb(_data.id); }), null); } OnPlayerLoad(_id, _model) { if (this.curshowPlayer != null) { if (this.curshowhat) { this.curshowhat.active = false; this.curshowhat.removeSelf(); } if (this.curshowcb) { this.curshowcb.active = false; this.curshowcb.removeSelf(); } PoolManager.Instance.RecoverMeshSprite3D(this.curshowPlayer); } var player = PoolManager.Instance.CreatMeshSprite3D(_model, ""); this.curshowPlayer = player; this.curstage.addChild(player); player.transform.localPosition = new Laya.Vector3(0, 0, 0); var lookpos = new Laya.Vector3(player.transform.position.x, player.transform.position.y + 0.03, player.transform.position.z + 0.01); this.showcarCamera.transform.lookAt(lookpos, new Laya.Vector3(0, 1, 0)); } OnHatLoad(_id, _model) { if (this.curshowhat != null) { this.curshowhat.active = false; } var sprite; if (this.showhatdic[_id]) { sprite = this.showhatdic[_id]; sprite.active = true; } else { sprite = PoolManager.Instance.CreatMeshSprite3D(_model, ""); this.showhatdic[_id] = sprite; } this.curshowhat = sprite; this.AddHatToBody(sprite); sprite.transform.localPosition = new Laya.Vector3(0.06, 0, 0); sprite.transform.localRotationEuler = new Laya.Vector3(0, 90, 0); } onCbLoad(_id, _model) { if (this.curshowcb != null) { this.curshowcb.active = false; } var sprite; if (this.showcbdic[_id]) { sprite = this.showcbdic[_id]; sprite.active = true; } else { sprite = PoolManager.Instance.CreatMeshSprite3D(_model, ""); this.showcbdic[_id] = sprite; } this.curshowcb = sprite; this.AddCbToBody(sprite); sprite.transform.localPosition = new Laya.Vector3(-0.06, -0.06, 0); sprite.transform.localRotationEuler = new Laya.Vector3(-25, 90, 180); } AddHatToBody(sprite) { var head = this.curshowPlayer.getChildAt(0).getChildAt(0); head.addChild(sprite); } AddCbToBody(sprite) { var back = this.curshowPlayer.getChildAt(0).getChildAt(1); back.addChild(sprite); } ShowRot() { this.curstage.transform.rotate(new Laya.Vector3(0, -0.01, 0)); } OnHide() { Laya.timer.clearAll(this); for (var key in this.showhatdic) { var hat = this.showhatdic[key]; hat.active = true; PoolManager.Instance.RecoverMeshSprite3D(hat); } for (var key in this.showcbdic) { var cb = this.showcbdic[key]; cb.active = true; PoolManager.Instance.RecoverMeshSprite3D(cb); } PoolManager.Instance.RecoverMeshSprite3D(this.curshowPlayer); this.showcarCamera.destroy(); this.showScence.destroy(); } } class QueueWindow extends ui.Window.QueueWindowUI { constructor() { super(); this.queueAtlas = [ "res/atlas/local.atlas", "res/atlas/local.png", "res/atlas/load.atlas", "res/atlas/load.png", ]; this.indess = []; QueueWindow.instance = this; } static get Instance() { return QueueWindow.instance; } OnOpen(_data = null) { WxApi.Instance.recordAldEvent("进入排队界面", "1"); var agrs = [{ "t": PlayerAccount.CurrentAccount.ServerTime.toString() }, { "n": "5" }]; NetworkManager.Instance.HttpPostRequest(PROTOCOLS.game, agrs, Laya.Handler.create(this, this.OnStarcomplete), null); this.height = Laya.stage.height; } OnResLoad() { Laya.timer.once(1000, this, this.OnQueueEnd); for (var i = 1; i < 30; i++) { this.indess.push(i); } for (var i = 0; i < this.quelist.numChildren; i++) { var cursprite = this.quelist.getChildAt(i); this.ShowIcon(cursprite); } } OnStarcomplete(e) { this.OnResLoad(); } ShowIcon(_sprite) { var time = GameUtils.getRandomInt(0, 900); Laya.timer.once(time, this, () => { var index = GameUtils.getRandomInt(0, this.indess.length); var num = this.indess[index]; this.indess.splice(index, 1); _sprite.skin = "icon/" + num + ".png"; }, null, false); } OnQueueEnd() { WxApi.Instance.recordAldEvent("排队结束开始游戏", "1"); var stage = LevelManager.Instance.curLevel; WxApi.Instance.levelStart(stage.levelid.toString(), stage.levelid.toString(), PlayerAccount.CurrentAccount.CurAccountData.UseId); GameManager.Instance.ChangeState(GameState.Playing); } OnHide() { } } var SwitchButtonState; (function (SwitchButtonState) { SwitchButtonState[SwitchButtonState["Close"] = 0] = "Close"; SwitchButtonState[SwitchButtonState["Open"] = 1] = "Open"; })(SwitchButtonState || (SwitchButtonState = {})); class SwitchButton extends Laya.Script { constructor() { super(); this.ButtonState = SwitchButtonState.Close; } onAwake() { this.openSprite = this.owner.getChildByName("openSprite"); this.closeSprite = this.owner.getChildByName("closeSprite"); this.button = this.owner.getChildByName("button"); this.button.clickHandler = Laya.Handler.create(this, () => { this.ChangeState(this.ButtonState); this.ButtonState++; if (this.ButtonState > 1) { this.ButtonState = 0; } }, null, false); } Init(open = true, _openHandle = null, _closeHnadle = null) { this.ButtonState = open ? SwitchButtonState.Open : SwitchButtonState.Close; this.openHandle = _openHandle; this.closeHandle = _closeHnadle; this.ChangeState(this.ButtonState); this.ButtonState++; if (this.ButtonState > 1) { this.ButtonState = 0; } } get CurState() { return this.ButtonState; } ChangeState(_state) { switch (this.ButtonState) { case SwitchButtonState.Close: this.openSprite.visible = false; this.closeSprite.visible = true; this.closeHandle.run(); break; case SwitchButtonState.Open: this.openSprite.visible = true; this.closeSprite.visible = false; this.openHandle.run(); break; } } } class SettingWindow extends ui.Window.SettingWindowUI { constructor() { super(); SettingWindow.instance = this; } static get Instance() { return SettingWindow.instance; } OnOpen(_data = null) { this.userid.text = "用户ID:" + PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.user_id); this.closeBtn.clickHandler = Laya.Handler.create(this, this.OnCLickClose); this.soundswitctbutton = this.soundPan.addComponent(SwitchButton); this.shakeswitchbutton = this.shakePan.addComponent(SwitchButton); this.soundswitctbutton.Init(PlaySoundManager.CanPlaySound, Laya.Handler.create(this, this.OnOpenSound, [true], false), Laya.Handler.create(this, this.OnOpenSound, [false], false)); this.shakeswitchbutton.Init(WxApi.CanShake, Laya.Handler.create(this, this.OnOpenShake, [true], false), Laya.Handler.create(this, this.OnOpenShake, [false], false)); ADPlayer.showBannerAd(); this.height = Laya.stage.height; } OnOpenSound(_open) { PlaySoundManager.CanPlaySound = _open; } OnOpenShake(_open) { WxApi.CanShake = _open; } OnCLickClose() { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } OnHide() { } } class ShareCanvas { constructor() { this.width = 0; this.height = 0; this.shareCanvas = Laya.Browser.window.sharedCanvas; this.sprite = new Laya.Sprite(); this.sprite.zOrder = 1008; this.sprite.pos(0, 0); this.sprite.cacheAs = "normal"; Laya.stage.addChild(this.sprite); this.t2d = new Laya.Texture2D(); this.tex = new Laya.Texture(this.t2d); } InitData(w = 720, h = 1559) { this.width = Laya.stage.width; this.height = Laya.stage.height; this.shareCanvas.width = w; this.shareCanvas.height = h; } show() { Laya.timer.frameLoop(10, this, this.update); this.sprite.visible = true; } hide() { Laya.timer.clear(this, this.update); this.sprite.visible = false; } update() { this.drawWebgl(); } drawWebgl() { this.t2d.loadImageSource(this.shareCanvas); this.tex.setTo(this.t2d); this.sprite.graphics.clear(); this.sprite.graphics.drawTexture(this.tex, 0, 0, this.tex.width, this.tex.height); } draw2d() { this.ctx.drawImage(this.shareCanvas, 0, 0, this.shareCanvas.width, this.shareCanvas.height); } } class JionTool { constructor() { } static Init() { if (!Main.OnWx) return; this._wx = Laya.Browser.window.wx; this.setWH(); this.shareCanvas = new ShareCanvas(); this.shareCanvas.InitData(); } static showFriendRank(keyName = "score") { if (Main.OnWx) this.postMessage(keyName, "show_friend_rank"); } static showWorldRank(keyName, data) { if (Main.OnWx) this.postMessage(keyName, "show_world_rank", data); } static upPage() { if (Main.OnWx) this.postMessage("", "show_up_page"); } static nextPage() { if (Main.OnWx) this.postMessage("", "show_next_page"); } static settlement(value, callBack = null, keyName = "score") { if (Main.OnWx) this.setUserCloudStorage(keyName, value.toString(), callBack); } static showShareCanvas() { if (Main.OnWx) this.shareCanvas.show(); } static hideShareCanvas() { if (Main.OnWx) this.shareCanvas.hide(); } static sendMoveDelta(delta) { if (Main.OnWx) this.postMessage("", "move_rank", delta); } static updateCtx() { if (Main.OnWx) this.postMessage("", "update_ctx"); } static setWH() { if (!Main.OnWx) return; let width = Laya.stage.width; let height = Laya.stage.height; let data = { width: width, height: height }; console.error(width, height); this.postMessage("", "canvase_width_height", data); } static postMessage(keyName, action, data) { this._wx.postMessage({ keyName: keyName, action: action, data: data }); } static setUserCloudStorage(keyName, value, callBack = null) { let obj = [{ key: keyName, value: value }]; this._wx.setUserCloudStorage({ KVDataList: obj, success: function (res) { console.log("数据上传成功" + res); if (callBack) { callBack(); } }, fail: function (res) { console.log("数据上传失败" + res); if (callBack) { callBack(); } } }); } } class RankWindow extends ui.Window.RankWindowUI { constructor() { super(); RankWindow.instance = this; } static get Instance() { return RankWindow.instance; } OnOpen(_data = null) { console.log("排行榜界面打开了----"); JionTool.showShareCanvas(); JionTool.showFriendRank("stage"); this.closeBtn.clickHandler = Laya.Handler.create(this, this.OnCloseRank); this.uppageBtn.clickHandler = Laya.Handler.create(this, this.OnUpPage, null, false); this.nextpageBtn.clickHandler = Laya.Handler.create(this, this.OnNextPage, null, false); this.height = Laya.stage.height; } OnUpPage() { JionTool.upPage(); } OnNextPage() { JionTool.nextPage(); } OnCloseRank() { JionTool.hideShareCanvas(); WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } OnHide() { } } class FriendPlyaingWindow extends ui.Window.FriendPlayingWindowUI { constructor() { super(); this.return = 0; FriendPlyaingWindow.instance = this; } OnOpen() { this.CloseBtn.clickHandler = Laya.Handler.create(this, this.OnClickClose); this.GameList.vScrollBarSkin = ""; this.GameList.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.GameList.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); this.height = Laya.stage.height; } ; RenderList(_box, index) { if (index > 5) { var ne = _box.getChildAt(0).getChildByName("new"); ne.visible = false; } var data = _box.dataSource; var icon = _box.getChildAt(0).getChildByName("icon"); icon.skin = data.icon; var name = _box.getChildAt(0).getChildByName("name"); name.text = data.title; var btn = _box.getChildAt(0).getChildByName("btn"); var num = _box.getChildAt(0).getChildByName("num"); if (num) num.text = GameUtils.getRandomInt(24841, 654878).toString() + "人玩"; btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); }); console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } OnClickClose() { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } OnHide() { } ; } class MoreFunWindow extends ui.Window.MoreFunWindowUI { constructor() { super(); MoreFunWindow.instance = this; } OnOpen() { this.CloseBtn.clickHandler = Laya.Handler.create(this, this.OnCloseClick); this.GameList.array = PlayerAccount.CurrentAccount.CurAccountData.redata; this.GameList.renderHandler = Laya.Handler.create(this, this.RenderList, null, false); this.height = Laya.stage.height; } ; OnCloseClick() { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); } RenderList(_box, index) { var data = _box.dataSource; var icon = _box.getChildAt(0).getChildByName("icon"); icon.skin = data.icon; var name = _box.getChildAt(0).getChildByName("name"); name.text = data.title; var btn = _box.getChildAt(0).getChildByName("btn"); var num = _box.getChildAt(0).getChildByName("num"); if (num) num.text = GameUtils.getRandomInt(100000, 1000000).toString() + "人玩"; btn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false); } ClickBNavigate(data) { var appid = data.appid; var path = data.path; let param = { "appId": appid.toString(), "path": path.toString() }; if (Main.OnWx) { WxApi.Instance.recordAldEvent("导出-总点击数", "1"); if (data.jump) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: appid.toString(), path: path.toString(), extraData: { next_appid: data.next_appid, next_path: data.next_path }, envVersion: 'develop', success: res => { WxApi.Instance.recordAldEvent("导出成功-总用户数", "1"); WxApi.Instance.recordAldEvent("导出成功-" + data.title, "1"); console.log("跳转成功..."); }, fail: res => { WindowManager.Instance.OpenPopView(WindowType.RecommendWindow); RecommendWindow.Instance.OpenChouTiView(true); RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => { WindowManager.Instance.ShowWindow(WindowType.HomeWindow); }); console.log("跳转失败..."); } }); } else { var marray = [data.image]; Laya.Browser.window.wx.previewImage({ current: data.image, urls: marray, success: res => { WxApi.Instance.recordAldEvent("显示游戏二维码成功", "1"); }, fail: res => { } }); } } } OnHide() { } ; } var WindowType; (function (WindowType) { WindowType[WindowType["HomeWindow"] = 0] = "HomeWindow"; WindowType[WindowType["InGameWindow"] = 1] = "InGameWindow"; WindowType[WindowType["SettlementWindow"] = 2] = "SettlementWindow"; WindowType[WindowType["ReviveWindow"] = 3] = "ReviveWindow"; WindowType[WindowType["ShopWindow"] = 4] = "ShopWindow"; WindowType[WindowType["QueueWindow"] = 5] = "QueueWindow"; WindowType[WindowType["SettingWindow"] = 6] = "SettingWindow"; WindowType[WindowType["RankWindow"] = 7] = "RankWindow"; WindowType[WindowType["SignWindow"] = 8] = "SignWindow"; WindowType[WindowType["TaskWindow"] = 9] = "TaskWindow"; WindowType[WindowType["RecommendWindow"] = 10] = "RecommendWindow"; WindowType[WindowType["TrialWindow"] = 11] = "TrialWindow"; WindowType[WindowType["FriendPlayingWindow"] = 12] = "FriendPlayingWindow"; WindowType[WindowType["MoreFunWindow"] = 13] = "MoreFunWindow"; WindowType[WindowType["OffLineWindow"] = 14] = "OffLineWindow"; })(WindowType || (WindowType = {})); class WindowManager { constructor() { this.ViewDic = []; this.popViewDic = []; this.viewCont = new Laya.Sprite; this.popCont = new Laya.Sprite; WindowManager.WindowManagerInstance = this; this.Init(); } static get Instance() { if (WindowManager.WindowManagerInstance) { return WindowManager.WindowManagerInstance; } else { return new WindowManager(); } } Init() { this.ViewDic[WindowType.HomeWindow] = HomeWindow; this.ViewDic[WindowType.InGameWindow] = InGameWindow; this.ViewDic[WindowType.SettlementWindow] = SettlementWindow; this.ViewDic[WindowType.ReviveWindow] = ReviveWindow; this.ViewDic[WindowType.ShopWindow] = ShopWindow; this.ViewDic[WindowType.QueueWindow] = QueueWindow; this.ViewDic[WindowType.SettingWindow] = SettingWindow; this.ViewDic[WindowType.RankWindow] = RankWindow; this.ViewDic[WindowType.SignWindow] = SignWindow; this.ViewDic[WindowType.RecommendWindow] = RecommendWindow; this.ViewDic[WindowType.TrialWindow] = TrialWindow; this.ViewDic[WindowType.FriendPlayingWindow] = FriendPlyaingWindow; this.ViewDic[WindowType.MoreFunWindow] = MoreFunWindow; this.ViewDic[WindowType.OffLineWindow] = OffLineWindow; Laya.stage.addChild(this.viewCont); Laya.stage.addChild(this.popCont); } ShowWindow(_type) { if (this.curOpenedView != null) { this.curOpenedView.OnHide(); this.curOpenedView.destroy(); this.curOpenedView.removeSelf(); } ADPlayer.ClearBanner(); this.ClearPopViews(); this.curOpenedView = new this.ViewDic[_type]; this.curOpenedView.name = WindowType[_type]; this.viewCont.addChild(this.curOpenedView); this.curOpenedView.OnOpen(); } ShowWindowWithData(_type, _data) { if (this.curOpenedView != null) { this.curOpenedView.OnHide(); this.curOpenedView.destroy(); this.curOpenedView.removeSelf(); } ADPlayer.ClearBanner(); this.ClearPopViews(); this.curOpenedView = new this.ViewDic[_type]; this.curOpenedView.name = WindowType[_type]; this.viewCont.addChild(this.curOpenedView); this.curOpenedView.OnOpen(_data); } OpenPopView(viewType, data = null) { ADPlayer.ClearBanner(); var popView; if (this.popViewDic[viewType]) { popView = this.popViewDic[viewType]; this.popCont.setChildIndex(popView, this.popCont.numChildren - 1); popView.visible = true; } else { popView = new this.ViewDic[viewType]; this.popCont.addChild(popView); this.popViewDic[viewType] = popView; } popView.OnOpen(data); } ClosePopView(viewType) { var popView = this.popViewDic[viewType]; if (popView == null) { return; } ADPlayer.ClearBanner(); popView.OnHide(); popView.visible = false; } CloseCurrentWindow() { this.curOpenedView.OnHide(); this.curOpenedView.destroy(); this.curOpenedView.removeSelf(); } ClearPopViews() { ADPlayer.ClearBanner(); this.ClosePopView(WindowType.RecommendWindow); this.ClosePopView(WindowType.OffLineWindow); } } var Vector3$5 = Laya.Vector3; var Vector4$1 = Laya.Vector4; class AImanager { constructor() { this.m_aiNum = 5; this.m_aiList = []; this.randombodycolor = [ new Vector4$1(0.25, 0.5, 1, 1), new Vector4$1(0.5, 0.25, 1, 1), new Vector4$1(1, 0.25, 1, 1), new Vector4$1(1, 0.25, 0.5, 1), ]; AImanager.instance = this; } static get Instance() { if (AImanager.instance) { return AImanager.instance; } else { return new AImanager(); } } CreatAi() { var level = LevelManager.Instance.curLevel; for (var i = 0; i < this.m_aiNum; i++) { var res = ResourcesManager.Instance.roleassets; var spr = res[GameUtils.getRandomInt(1, 6)].getChildAt(0); var model = PoolManager.Instance.CreatMeshSprite3D(spr, ""); ScenceManager.Instance.GameScence.addChild(model); var startpoint = new Vector3$5(-1.4 + (i * 0.7), 0, 13); model.transform.position = startpoint; var runner = model.addComponent(Runner); runner.Ai = true; runner.m_speed = GameUtils.getRandoms(-0.03, 0.02) + level.npcspeed; runner.aioffestx = GameUtils.getRandoms(-0.001, 0.001); runner.Id = i; runner.name = "草莓" + (runner.Id + 1) + "号"; runner.aimiss = level.NPCmiss; this.m_aiList.push(runner); Queue.Instance.signup(runner); } } ClearAis() { for (var i = 0; i < this.m_aiList.length; i++) { if (this.m_aiList[i].m_sprite.active) { this.m_aiList[i].m_flySprite.active = true; this.m_aiList[i].m_crown.active = true; PoolManager.Instance.RecoverMeshSprite3D(this.m_aiList[i].m_crown); PoolManager.Instance.RecoverMeshSprite3D(this.m_aiList[i].m_flySprite); PoolManager.Instance.RecoverMeshSprite3D(this.m_aiList[i].m_sprite); } } this.m_aiList = []; } RessetAis() { this.ClearAis(); this.CreatAi(); } } var GameState; (function (GameState) { GameState[GameState["Nono"] = 0] = "Nono"; GameState[GameState["Idle"] = 1] = "Idle"; GameState[GameState["Queue"] = 2] = "Queue"; GameState[GameState["Playing"] = 3] = "Playing"; GameState[GameState["Die"] = 4] = "Die"; GameState[GameState["Revive"] = 5] = "Revive"; GameState[GameState["Win"] = 6] = "Win"; GameState[GameState["Over"] = 7] = "Over"; GameState[GameState["End"] = 8] = "End"; })(GameState || (GameState = {})); class GameManager { constructor() { this.GetGoin = false; this.gamegold = 0; this.videogetmoney = 3; GameManager.Instance = this; this.RegEvent(); this.ChangeState(GameState.Nono); } RegEvent() { EventManager.GameStateEventOn(GameState.Nono, this, this.OnFristReadyGame); EventManager.GameStateEventOn(GameState.Idle, this, this.OnEnterIdle); EventManager.GameStateEventOn(GameState.Queue, this, this.OnEnterQueue); EventManager.GameStateEventOn(GameState.Playing, this, this.OnEnterPlaying); EventManager.GameStateEventOn(GameState.Die, this, this.OnEnterDie); EventManager.GameStateEventOn(GameState.Revive, this, this.OnEnterRevive); EventManager.GameStateEventOn(GameState.Win, this, this.OnEnterWin); EventManager.GameStateEventOn(GameState.Over, this, this.OnEnterOver); EventManager.GameStateEventOn(GameState.End, this, this.OnEnterEnd); EventManager.EventOn(EventType.GetMoney, this, this.OnGetMoney); } ChangeState(_state, arges = null) { if (this.curState != _state) { this.curState = _state; EventManager.GameStateEventTrigger(_state, arges); console.log("GameState:" + GameState[_state]); } else { console.log("Can not ChangeState:State is curstate..."); } } OnFristReadyGame() { WxApi.Instance.recordAldEvent("初始资源", ""); ResourcesManager.Instance.InitSkinAsset(); var curstage = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.stage)); LevelManager.Instance.ReadyLevel(curstage + 1, () => { ScenceManager.Instance.GameScence.visible = true; ScenceManager.Instance.CreatLevelScene(true); WindowManager.Instance.ShowWindow(WindowType.HomeWindow); WxApi.Instance.recordAldEvent("关卡展开", ""); }); } OnEnterIdle() { var camera = ScenceManager.Instance.GameCamera; var pos = camera.transform.position.clone(); Player.CanInput = false; this.gamegold = 0; ScenceManager.Instance.GameCamera.transform.position = new Laya.Vector3(camera.transform.position.x, camera.transform.position.y, camera.transform.position.z - 4); GameUtils.TweenMove(ScenceManager.Instance.GameCamera.transform, pos, 0.3); } OnEnterQueue() { WindowManager.Instance.ShowWindow(WindowType.QueueWindow); } OnEnterPlaying() { Player.CanInput = true; WindowManager.Instance.ShowWindow(WindowType.InGameWindow); } OnEnterDie() { } OnEnterRevive() { WindowManager.Instance.ShowWindow(WindowType.ReviveWindow); } OnEnterWin() { } OnEnterOver() { } OnEnterEnd(_win) { CameraManager.Instance.StopFollow(); WindowManager.Instance.ShowWindowWithData(WindowType.SettlementWindow, _win); } OnGetMoney() { this.gamegold += 1; EventManager.EventTrigger(EventType.MoneyChange, this.gamegold); } ReviveGame() { Player.Instance.RevivePlayer(); WindowManager.Instance.ShowWindow(WindowType.InGameWindow); } RessetGame() { ScenceManager.Instance.GameLight.transform.rotationEuler = new Laya.Vector3(-50, -150, 0); Player.Instance.RessetPlayer(); AImanager.Instance.RessetAis(); LevelManager.Instance.RessetLevel(); GameManager.Instance.ChangeState(GameState.Idle); } EnterNextLevel() { ScenceManager.Instance.GameLight.transform.rotationEuler = new Laya.Vector3(-50, -150, 0); Player.Instance.ClearPlayer(); AImanager.Instance.ClearAis(); LevelManager.Instance.ClearLevel(); LevelManager.Instance.NextLevel(); } } var EventType; (function (EventType) { EventType[EventType["ScoreChange"] = 0] = "ScoreChange"; EventType[EventType["MoneyChange"] = 1] = "MoneyChange"; EventType[EventType["GetMoney"] = 2] = "GetMoney"; EventType[EventType["InputState"] = 3] = "InputState"; EventType[EventType["Hover"] = 4] = "Hover"; EventType[EventType["extraspeedtime"] = 5] = "extraspeedtime"; EventType[EventType["speed"] = 6] = "speed"; EventType[EventType["flytime"] = 7] = "flytime"; EventType[EventType["OnLand"] = 8] = "OnLand"; EventType[EventType["OutLand"] = 9] = "OutLand"; EventType[EventType["ChangeStage"] = 10] = "ChangeStage"; EventType[EventType["GetRoadPoint"] = 11] = "GetRoadPoint"; EventType[EventType["EnterStage"] = 12] = "EnterStage"; EventType[EventType["CompleteStage"] = 13] = "CompleteStage"; EventType[EventType["crownchange"] = 14] = "crownchange"; EventType[EventType["PlayerRank"] = 15] = "PlayerRank"; })(EventType || (EventType = {})); class EventManager { static EventOn(_type, caller, _listance) { this.mDispatcher.on(EventType[_type], caller, _listance); } static EventOff(_type, caller, _listance) { this.mDispatcher.off(EventType[_type], caller, _listance); } static EventTrigger(_type, data = null) { this.mDispatcher.event(EventType[_type], data); } static GameStateEventOn(_type, caller, _listance) { this.mDispatcher.on(GameState[_type], caller, _listance); } static GameStateEventOff(_type, caller, _listance) { this.mDispatcher.off(GameState[_type], caller, _listance); } static GameStateEventTrigger(_type, data = null) { this.mDispatcher.event(GameState[_type], data); } } EventManager.mDispatcher = new Laya.EventDispatcher(); var Sprite3D$1 = Laya.Sprite3D; class MeshSprite3DData { constructor(_sprite) { this.ownSprite = _sprite; this.position = _sprite.transform.position.clone(); this.rotation = _sprite.transform.rotation.clone(); this.scale = _sprite.transform.scale.clone(); } } class PoolManager { constructor() { this.PoolSize = 30; this.ObjDic = {}; PoolManager.PoolManagerInstance = this; EventManager.GameStateEventOn(GameState.Idle, this, this.ClearPool); } static get Instance() { if (PoolManager.PoolManagerInstance) { return PoolManager.PoolManagerInstance; } else { var instance = new PoolManager(); return instance; } } CreatMeshSprite3D(_obj, _group) { var objName = _group + _obj.name; if (this.ObjDic[objName] != null && this.ObjDic[objName] != undefined) { if (this.ObjDic[objName].length > 0) { var obj = this.ObjDic[objName][0]; this.ObjDic[objName].splice(0, 1); if (obj.ownSprite.destroyed) { obj.ownSprite = Sprite3D$1.instantiate(_obj); } obj.ownSprite.active = true; obj.ownSprite.transform.position = _obj.transform.position.clone(); obj.ownSprite.transform.rotation = _obj.transform.rotation.clone(); obj.ownSprite.transform.scale = _obj.transform.scale.clone(); return obj.ownSprite; } else { return Sprite3D$1.instantiate(_obj); } } else { return Sprite3D$1.instantiate(_obj); } } RecoverMeshSprite3D(_obj, _group = "", _destory = false) { if (!_obj) { return; } if (_destory) { _obj.destroy(); return; } if (_obj.destroyed) { return; } if (_obj.active == false) { return; } var objName = _group + _obj.name; if (this.ObjDic[objName] != null && this.ObjDic[objName] != undefined) { var array = this.ObjDic[objName]; if (array.length > this.PoolSize) { _obj.destroy(); return; } else { array.push(new MeshSprite3DData(_obj)); } } else { array = []; array.push(new MeshSprite3DData(_obj)); this.ObjDic[objName] = array; } var runner = _obj.getComponent(Runner); if (runner) runner.destroy(); var rig = _obj.getComponent(Laya.Rigidbody3D); if (rig) { rig.isKinematic = true; rig.detectCollisions = false; } _obj.transform.position = new Laya.Vector3(0, 0, -100); _obj.removeSelf(); _obj.active = false; } ClearPool() { for (var key in this.ObjDic) { var objs = this.ObjDic[key]; for (var i = 0; i < objs.length; i++) { objs[i].ownSprite.destroy(); } } this.ObjDic = {}; } } var Vector3$6 = Laya.Vector3; var Sprite3D$2 = Laya.Sprite3D; var Vector4$2 = Laya.Vector4; class Road { constructor(_id, _data, _offestY, _offestZ, _parent, _textureid, _roadcolor) { this.things = []; this.builds = []; this.jumpHight = 0; this.id = _id; this.parent = _parent; var roadpos = new Vector3$6(3.6 - (_id * 1.8), _offestY - _data.high_change, _offestZ); this.Long = _data.long; this.CreatModel(_data.long * RunnerRoad.lengthrate, roadpos, _textureid, _roadcolor); this.CreateThings(_data.things, _data.position, _data.thing_hight, roadpos); } CreatModel(_size, _pos, _texture, __roadcolor) { this.startpos = _pos; if (_size != 0) { var sprite = PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.bsroadassets[baseroaddata.ZhiRoad], ""); this.sprite = sprite; this.sprite.transform.position = _pos; var meshchild = sprite.getChildAt(0).getChildAt(0).getChildAt(0); var materail = meshchild.meshRenderer.material; var tes = ResourcesManager.Instance.planetextures; materail.albedoTexture = tes[_texture]; var colors = ScenceManager.randomcolor; materail.albedoColor = colors[__roadcolor - 1]; FixedRoad.ForNodeSetColliderInThis(this.sprite, ColliderLay.Plane); this.sprite.transform.localScaleZ = _size; this.parent.addChild(this.sprite); } } CreateThings(_things, _poss, _hights, _pos) { for (var i = 0; i < _things.length; i++) { var curposZ = Number(_poss[i]); var curpos = new Vector3$6(_pos.x, _pos.y, _pos.z + curposZ - 1); var res = ResourcesManager.Instance.tsroadassets; if (id == thingsdata.PlateTrampoline) { var highchange = _hights.length == _poss.length ? _hights[i] : 0; curpos = new Vector3$6(curpos.x, curpos.y - highchange, curpos.z); if (this.jumpHight < _hights[i]) this.jumpHight = _hights[i]; } var id = _things[i].id; if (id == 0 || !res[id]) continue; if ((this.id == thingsdata.Box || this.id == thingsdata.Box1 || this.id == thingsdata.Box2)) { var things = Sprite3D$2.instantiate(ResourcesManager.Instance.tsroadassets[this.id]); var box = things.getChildByName("Box").getComponent(Laya.PhysicsCollider); box.collisionGroup = ColliderLay.things; } else { var things = PoolManager.Instance.CreatMeshSprite3D(res[id], ""); FixedRoad.ForNodeSetColliderInThis(things, ColliderLay.things); } var thing = new roadthings(_things[i].id.toString()); thing.buffertime = _things[i].buffertime; thing.effect = _things[i].effect; thing.model = _things[i].model; thing.pos = curpos; thing.type = _things[i].type; thing.sprite = things; thing.length = curposZ; this.things.push(thing); things.transform.position = curpos; ScenceManager.Instance.GameScence.addChild(things); } } Resset() { var things = this.things; for (var k = 0; k < things.length; k++) { var thing = things[k]; thing.Resset(); } } Clear() { if (this.sprite) { this.sprite.active = true; PoolManager.Instance.RecoverMeshSprite3D(this.sprite); } var things = this.things; for (var k = 0; k < things.length; k++) { var thing = things[k]; thing.Clear(); } } SetActive(_open) { if (this.sprite) { this.sprite.active = _open; } var things = this.things; for (var k = 0; k < things.length; k++) { var thing = things[k]; thing.sprite.active = _open; } } } class FixedRoad { constructor(_id, _pos = new Vector3$6(0, 0, 0), _parent = null) { this.id = _id; var sprite = PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.fxroadassets[_id], ""); this.sprite = sprite; this.sprite.transform.position = _pos; if (sprite.getChildByName("endpoint")) this.endSprite = sprite.getChildByName("endpoint"); FixedRoad.ForNodeSetColliderInThis(this.sprite, ColliderLay.Plane); if (_parent) { _parent.addChild(this.sprite); } else { ScenceManager.Instance.GameScence.addChild(this.sprite); } } static ForNodeSetColliderInThis(_node, lay) { var childNumber = _node.numChildren; for (var i = 0; i < childNumber; i++) { var eChildNumber = _node.getChildAt(i).numChildren; if (eChildNumber > 0) { this.ForNodeSetColliderInThis(_node.getChildAt(i), lay); } var PhysicsCollider = _node.getChildAt(i).getComponent(Laya.PhysicsCollider); if (PhysicsCollider) { this.SetCollider(PhysicsCollider, lay); } } } static SetCollider(Collider, _lay) { Collider.collisionGroup = _lay; } } class ScenceManager { constructor(_scence) { this.LevelRoads = []; this.starthideindex = 1; this.buildsnum = 10; this.hightnum = 2; ScenceManager.Instance = this; this.GameScence = _scence; this.GameScence.physicsSimulation.maxSubSteps = 15; this.GameScence.physicsSimulation.fixedTimeStep = 1 / 60; this.GameScence.enableFog = true; this.GameScence.fogStart = 25; this.GameScence.fogRange = 35; this.GameScence.fogColor = new Vector3$6(0.5803922, 0.8431373, 1); this.Init(); } Init() { this.GameCamera = this.GameScence.getChildByName("Main Camera"); this.GameCamera.transform.position = new Vector3$6(0, 0.6, 8.5); this.GameCamera.transform.rotationEuler = new Vector3$6(-5, 180, 0); this.GameCamera.clearColor = new Vector4$2(0.5803922, 0.8431373, 1, 1); this.GameLight = this.GameScence.getChildByName("Directional Light"); this.GameCamera.addComponent(CameraManager); var startroad = this.GameScence.getChildByName("PlateStart"); FixedRoad.ForNodeSetColliderInThis(startroad, ColliderLay.Plane); var FalconMesh = this.GameScence.getChildByName("FalconMesh"); ResourcesManager.Instance.FalconMesh = FalconMesh; FalconMesh.removeSelf(); var crown = this.GameScence.getChildByName("crown"); ResourcesManager.Instance.crown = crown; crown.removeSelf(); } CreatLevelScene(_frist = false) { ScenceManager.Instance.GameLight.transform.rotationEuler = new Laya.Vector3(-50, -150, 0); var level = LevelManager.Instance.curLevel; this.CreatLevelRoads(level); this.CreatPlayer(level, _frist); AImanager.Instance.CreatAi(); GameManager.Instance.ChangeState(GameState.Idle); } CreatLevelRoads(_level) { var curY = -5.5; var rd1pos = new Vector3$6(0, curY, 20); _level.ramproad = new FixedRoad(fixedroaddata.Ramps, rd1pos); var startpos = _level.ramproad.endSprite.transform.position; var offesthight = startpos.y - 6; for (var i = 0; i < _level.stages.length; i++) { var stagedata = _level.stages[i]; offesthight -= stagedata.StageHight; if ((i - 1) > -1) { var sss = _level.stages[i - 1].stagejumphight; offesthight -= sss; } var offestz = 0; var maxlength = 0; var maxhight = 0; stagedata.sprite = new Sprite3D$2(); stagedata.sprite.name = "stagesprite" + i; ScenceManager.Instance.GameScence.addChild(stagedata.sprite); var longs = 0; for (var j = 0; j < stagedata.roadsdata.length; j++) { var start = stagedata.roadsdata[j].start; offestz = startpos.z + start; var road = new Road(j, stagedata.roadsdata[j], offesthight, offestz, stagedata.sprite, _level.pic, _level.colour); stagedata.roads.push(road); if (road.jumpHight > stagedata.stagejumphight) stagedata.stagejumphight = road.jumpHight; if (i > 1) { road.SetActive(false); } var thingsLength = road.things.length > 0 ? road.things[road.things.length - 1].length : 0; longs = stagedata.roadsdata[j].long == 0 ? thingsLength : stagedata.roadsdata[j].long; if (offestz + longs > maxlength) maxlength = offestz + longs; if (offesthight - (stagedata.roadsdata[j].high_change + road.jumpHight) < maxhight) maxhight = offesthight - (stagedata.roadsdata[j].high_change + road.jumpHight); } stagedata.startz = offestz; stagedata.endz = maxlength; stagedata.starty = offesthight; stagedata.endy = maxhight; startpos = new Vector3$6(0, maxhight, maxlength); this.CreatBuilds(stagedata); } _level.getRoadPoint(); var endpos = new Vector3$6(0, startpos.y - 5.5, startpos.z + 2); var endroad = new FixedRoad(fixedroaddata.PlateFinish, endpos); _level.endroadsprite = endroad.sprite; var wincollider = endroad.sprite.getChildByName("Win").getComponent(Laya.PhysicsCollider); wincollider.collisionGroup = ColliderLay.things; _level.endroadsprite.active = false; } SortRoad(a, b) { if (a.Long > b.Long) { return -1; } else { return 1; } } CreatPlayer(_level, _frist) { var playerid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hero)); var player = ResourcesManager.Instance.roleassets[playerid].getChildAt(0); var playermodel = PoolManager.Instance.CreatMeshSprite3D(player, ""); var startpoint = new Vector3$6(0, 0, 10); playermodel.transform.position = startpoint; var hatid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)); if (hatid > 0) { var hat = ResourcesManager.Instance.hatasset[hatid]; var hatmodel = PoolManager.Instance.CreatMeshSprite3D(hat, ""); var head = playermodel.getChildAt(0).getChildAt(0); head.addChild(hatmodel); hatmodel.transform.localPosition = new Laya.Vector3(0.1, 0, 0); hatmodel.transform.localRotationEuler = new Laya.Vector3(0, 90, 0); } var cbid = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.equip_hat)); if (cbid > 0) { var cb = ResourcesManager.Instance.cbasset[cbid]; var cbmodel = PoolManager.Instance.CreatMeshSprite3D(cb, ""); var back = playermodel.getChildAt(0).getChildAt(1); back.addChild(cbmodel); cbmodel.transform.localPosition = new Laya.Vector3(-0.06, -0.06, 0); cbmodel.transform.localRotationEuler = new Laya.Vector3(-25, 90, 180); } this.GameScence.addChild(playermodel); if (_frist) { new Player(playermodel); } else { Player.Instance.Reset(playermodel); } } CreatBuilds(_stage) { var offestz = 0; var offestY = 0; var offesthight = _stage.endy - 30; var length = _stage.endz - _stage.startz; var hight = 0; this.buildsnum = 1; var level = LevelManager.Instance.curLevel; for (var i = 0; i < this.buildsnum; i++) { offestz += (length / this.buildsnum); offestY = hight; var build = PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.buildsassets[level.buildid], ""); var pos = new Vector3$6(12, offesthight - offestY, _stage.startz + offestz); build.transform.position = pos; ScenceManager.Instance.GameScence.addChild(build); _stage.builds.push(build); var build2 = PoolManager.Instance.CreatMeshSprite3D(ResourcesManager.Instance.buildsassets[level.buildid], ""); var pos = new Vector3$6(-12, offesthight - offestY, _stage.startz + offestz); build2.transform.position = pos; ScenceManager.Instance.GameScence.addChild(build2); _stage.builds.push(build2); if (i > 0) { build.active = false; build2.active = false; } } } } ScenceManager.randomcolor = [ new Vector4$2(145 * 1.0 / 255, 1, 101 * 1.0 / 255, 1), new Vector4$2(162 * 1.0 / 255, 56 * 1.0 / 255, 1, 1), new Vector4$2(1, 150 * 1.0 / 255, 38 * 1.0 / 255, 1), ]; class LevelManager { constructor() { LevelManager.test = false; LevelManager.instance = this; LevelManager.thingsdic = LevelManager.GetThingsConfigs; LevelManager.roaddic = LevelManager.GetRoadConfigs; LevelManager.testleveldic = LevelManager.GetLevelConfigs; } static get Instance() { if (LevelManager.instance) { return LevelManager.instance; } else { return new LevelManager(); } } ReadyLevel(_id, _complete) { this.curLevel = LevelManager.testleveldic[_id] ? LevelManager.testleveldic[_id] : LevelManager.testleveldic[1]; _complete(); } NextLevel() { var id = this.curLevel.levelid + 1; this.ReadyLevel(id, () => { ScenceManager.Instance.CreatLevelScene(false); }); } static get GetLevelConfigs() { var leveldatas = {}; var levels = LevelManager.test ? ConfigTest.mission : PlayerAccount.CurrentAccount.CurAccountData.GetConfig(AccountConfig.mission); for (var key in levels) { var config = levels[key]; var level = new Level(config.id, config.roads); level.pic = Number(config.pic); level.colour = Number(config.pic); level.NPCmiss = Number(config.NPCmiss) / 100; level.npcspeed = config.NpcSpeed ? Number(config.NpcSpeed) : 1; level.playerspeed = config.PlayerSpeed ? Number(config.PlayerSpeed) : 1; leveldatas[config.id] = level; } return leveldatas; } static get GetRoadConfigs() { var roaddatas = {}; var roads = LevelManager.test ? ConfigTest.road : PlayerAccount.CurrentAccount.CurAccountData.GetConfig(AccountConfig.road); for (var key in roads) { var roadss = []; if (roaddatas[roads[key].road_id]) continue; for (var key1 in roads) { if (roads[key].road_id == roads[key1].road_id) { var config = roads[key1]; var road = new RunnerRoad(config.road_id); road.high = (Number(config.high) < 0) ? 0 : Number(config.high); road.high = road.high == 0 ? 0.5 : road.high; road.start = Number(config.start); road.street = Number(config.street); road.high_change = Number(config.high_change); road.long = (Number(config.long) < 0) ? 0 : Number(config.long); road.things = road.GetThings(config.things); road.position = road.GetPos(config.position); road.thing_hight = road.GetTings_Hight(config.things_high); roadss.push(road); } } roaddatas[config.road_id] = roadss; } return roaddatas; } static get GetThingsConfigs() { var thingsdatas = {}; var thingss = LevelManager.test ? ConfigTest.things : PlayerAccount.CurrentAccount.CurAccountData.GetConfig(AccountConfig.things); for (var key in thingss) { var config = thingss[key]; var thing = new roadthings(config.id); thing.type = Number(config.type); thing.model = config.model; thing.effect = Number(config.effect); thing.buffertime = Number(config.bufftime); thingsdatas[config.id] = thing; } return thingsdatas; } RessetLevel() { this.curLevel.endroadsprite.active = false; var levelstages = this.curLevel.stages; for (var i = 0; i < levelstages.length; i++) { var roads = levelstages[i].roads; for (var j = 0; j < roads.length; j++) { roads[j].Resset(); } levelstages[i].enter = false; levelstages[i].complete = false; if (i < 2) { var roads22 = levelstages[i].roads; for (var k = 0; k < roads22.length; k++) { var rr = roads22[k]; rr.SetActive(true); } var builds22 = levelstages[i].builds; for (var k = 0; k < builds22.length; k++) { var bb = builds22[k]; bb.active = true; } } else { var roads22 = levelstages[i].roads; for (var k = 0; k < roads22.length; k++) { var rr = roads22[k]; rr.SetActive(false); } var builds22 = levelstages[i].builds; for (var k = 0; k < builds22.length; k++) { var bb = builds22[k]; bb.active = false; } } } var wincollider = this.curLevel.endroadsprite.getChildByName("Win").getComponent(Laya.PhysicsCollider); wincollider.collisionGroup = ColliderLay.things; } ClearLevel() { PoolManager.Instance.RecoverMeshSprite3D(this.curLevel.ramproad.sprite, ""); PoolManager.Instance.RecoverMeshSprite3D(this.curLevel.endroadsprite, ""); var levelstages = this.curLevel.stages; for (var i = 0; i < levelstages.length; i++) { var roads = levelstages[i].roads; for (var j = 0; j < roads.length; j++) { roads[j].Clear(); } var builds22 = levelstages[i].builds; for (var k = 0; k < builds22.length; k++) { var bb = builds22[k]; bb.active = true; PoolManager.Instance.RecoverMeshSprite3D(bb); } levelstages[i].sprite.destroy(); } } } LevelManager.test = false; LevelManager.testleveldic = {}; LevelManager.roaddic = {}; LevelManager.thingsdic = {}; var Sprite3D$3 = Laya.Sprite3D; class HeroData { constructor(_id) { this.id = _id; } } class HatData { constructor(_id) { this.id = _id; } } class roadthings { constructor(_id) { this.pos = new Laya.Vector3(); this.id = Number(_id); } Resset() { var oldsp = this.sprite; if (!oldsp) return; if (this.id == thingsdata.Box || this.id == thingsdata.Box1 || this.id == thingsdata.Box2) { var ns = Sprite3D$3.instantiate(ResourcesManager.Instance.tsroadassets[this.id]); ns.transform.position = this.pos; this.sprite = ns; var box = ns.getChildByName("Box").getComponent(Laya.PhysicsCollider); box.collisionGroup = ColliderLay.things; ScenceManager.Instance.GameScence.addChild(ns); if (!oldsp.destroyed) oldsp.destroy(); } else if (this.id == thingsdata.Coin) { this.sprite.active = true; } } Clear() { if ((this.id == thingsdata.Box || this.id == thingsdata.Box1 || this.id == thingsdata.Box2) && !this.sprite.destroyed) { this.sprite.destroy(); return; } if (this.sprite) { this.sprite.active = true; PoolManager.Instance.RecoverMeshSprite3D(this.sprite); } } static ForNodeSetColliderenbel(_node) { if (_node == null) { return; } _node.active = true; var childNumber = _node.numChildren; for (var i = 0; i < childNumber; i++) { var eChildNumber = _node.getChildAt(i).numChildren; if (eChildNumber > 0) { this.ForNodeSetColliderenbel(_node.getChildAt(i)); } var PhysicsCollider = _node.getChildAt(i).getComponent(Laya.PhysicsCollider); if (PhysicsCollider && PhysicsCollider.collisionGroup == ColliderLay.things) { PhysicsCollider.enabled = true; } } } } class Stage { constructor(_id, _roads) { this.roadsdata = []; this.roads = []; this.roadpointxs = []; this.complete = false; this.enter = false; this.builds = []; this.stagejumphight = 0; this.id = Number(_id); this.roadsdata = _roads; } get StageHight() { var max = 0; for (var i = 0; i < this.roadsdata.length; i++) { if (this.roadsdata[i].high > max) { max = this.roadsdata[i].high; } } return max; } } class RunnerRoad { constructor(_id) { this.things = []; this.position = []; this.thing_hight = []; this.id = Number(_id); } GetThings(_str) { var thingss = []; var datas = _str.split(";"); for (var i = 0; i < datas.length; i++) { if (datas[i] != "-1" && LevelManager.thingsdic[datas[i]]) { var things = LevelManager.thingsdic[datas[i]]; } else { var things = new roadthings("-1"); } thingss.push(things); } return thingss; } GetPos(_str) { var poss = []; var datas = _str.split(";"); for (var i = 0; i < datas.length; i++) { poss.push(datas[i]); } return poss; } GetTings_Hight(_str) { var hight = []; var datas = _str.split(";"); for (var i = 0; i < datas.length; i++) { hight.push(Number(datas[i])); } return hight; } } RunnerRoad.lengthrate = 1.6; class Level { constructor(_id, _roads) { this.stages = []; this.npcspeed = 1; this.playerspeed = 1; this.levelid = Number(_id); this.stages = this.getStages(_roads); this.buildid = GameUtils.getRandomInt(0, 2); } getStages(_st) { var stages = []; var datas = _st.split(";"); for (var i = 0; i < datas.length; i++) { var road = LevelManager.roaddic[datas[i]]; var stage = new Stage(datas[i], road); stages.push(stage); } return stages; } getRoadPoint() { for (var i = 0; i < this.stages.length; i++) { var point = []; var stage = this.stages[i]; for (var j = 0; j < stage.roads.length; j++) { if (stage.roads[j].sprite) { point.push(stage.roads[j].sprite.transform.position.x); } if (!stage.roads[j].sprite && stage.roads[j].things.length > 0) { point.push(stage.roads[j].things[0].sprite.transform.position.x); } } if (point.length != 0) { stage.roadpointxs = point; } else { stage.roadpointxs = [0]; } } for (var i = 0; i < this.stages.length; i++) { var ps = []; var stage = this.stages[i]; var points = stage.roadpointxs; if (i + 1 > this.stages.length - 1) { for (var j = 0; j < points.length; j++) { ps.push(points[j]); } stage.roadpointxs = ps; return; } var nextpoints = this.stages[i + 1].roadpointxs; for (var k = 0; k < nextpoints.length; k++) { var has = false; for (var j = 0; j < points.length; j++) { if (points[j] == nextpoints[k]) { ps.push(points[j]); has = true; } } if (nextpoints.length == 1 && !has && ps.length == 0) { ps.push(nextpoints[k]); } } stage.roadpointxs = ps; } } } var HttpRequest$1 = Laya.HttpRequest; class ReData { constructor(_obj) { this.appid = _obj["appid"]; this.banner = _obj["banner"]; this.icon = _obj["icon"]; this.image = _obj["image"]; this.jump = _obj["jump"]; this.next_appid = _obj["next_appid"]; this.next_icon = _obj["next_icon"]; this.next_path = _obj["next_path"]; this.next_title = _obj["next_title"]; this.path = _obj["path"]; this.pos = _obj["pos"]; this.sort = _obj["sort"]; this.title = _obj["title"]; } } class ThingsEffect { constructor(_data) { for (var key in _data) { var ccc = _data[key]; if (ccc.type == "1") { ThingsEffect.rockettime = ccc.bufftime; ThingsEffect.rocketeffect = ccc.effect; } else if (ccc.type == "2") { ThingsEffect.Jstime = ccc.bufftime; ThingsEffect.JSEffect = ccc.effect; } else if (ccc.type == "7") { ThingsEffect.jumptime = ccc.bufftime == 0 ? 1 : ccc.bufftime; ThingsEffect.jumpeffect = ccc.effect; } else if (ccc.type == "3") { ThingsEffect.flytime = ccc.bufftime; ThingsEffect.flyeffect = ccc.effect; } else if (ccc.type == "4") { ThingsEffect.goldeffect = ccc.effect; } } } } ThingsEffect.Jstime = 0; ThingsEffect.JSEffect = 0; ThingsEffect.rockettime = 1; ThingsEffect.rocketeffect = 1.5; ThingsEffect.jumptime = 0.1; ThingsEffect.jumpeffect = 0.3; ThingsEffect.flytime = 4.5; ThingsEffect.flyeffect = 2; ThingsEffect.goldeffect = 1; var requiretype; (function (requiretype) { requiretype[requiretype["\u7CFB\u7EDF\u8D60\u9001"] = 1] = "\u7CFB\u7EDF\u8D60\u9001"; requiretype[requiretype["\u91D1\u5E01\u8D2D\u4E70"] = 2] = "\u91D1\u5E01\u8D2D\u4E70"; requiretype[requiretype["\u89C2\u770B\u89C6\u9891"] = 3] = "\u89C2\u770B\u89C6\u9891"; requiretype[requiretype["\u5206\u4EAB"] = 4] = "\u5206\u4EAB"; requiretype[requiretype["\u7B7E\u5230"] = 5] = "\u7B7E\u5230"; requiretype[requiretype["\u6D3B\u52A8"] = 6] = "\u6D3B\u52A8"; requiretype[requiretype["\u901A\u8FC7\u5173\u5361"] = 7] = "\u901A\u8FC7\u5173\u5361"; requiretype[requiretype["\u7D2F\u8BA1\u767B\u9646"] = 8] = "\u7D2F\u8BA1\u767B\u9646"; requiretype[requiretype["\u9080\u8BF7\u4EBA\u6570\u8FBE\u5230"] = 9] = "\u9080\u8BF7\u4EBA\u6570\u8FBE\u5230"; requiretype[requiretype["\u7816\u77F3\u8D2D\u4E70"] = 10] = "\u7816\u77F3\u8D2D\u4E70"; })(requiretype || (requiretype = {})); var AccountConfig; (function (AccountConfig) { AccountConfig[AccountConfig["hero"] = 0] = "hero"; AccountConfig[AccountConfig["hat"] = 1] = "hat"; AccountConfig[AccountConfig["wing"] = 2] = "wing"; AccountConfig[AccountConfig["things"] = 3] = "things"; AccountConfig[AccountConfig["road"] = 4] = "road"; AccountConfig[AccountConfig["global"] = 5] = "global"; AccountConfig[AccountConfig["entity"] = 6] = "entity"; AccountConfig[AccountConfig["sign"] = 7] = "sign"; AccountConfig[AccountConfig["rewards"] = 8] = "rewards"; AccountConfig[AccountConfig["achievement"] = 9] = "achievement"; AccountConfig[AccountConfig["invite"] = 10] = "invite"; AccountConfig[AccountConfig["mission"] = 11] = "mission"; AccountConfig[AccountConfig["treasure_click"] = 12] = "treasure_click"; })(AccountConfig || (AccountConfig = {})); var AccountUser; (function (AccountUser) { AccountUser[AccountUser["money"] = 0] = "money"; AccountUser[AccountUser["diamond"] = 1] = "diamond"; AccountUser[AccountUser["user_id"] = 2] = "user_id"; AccountUser[AccountUser["game_times"] = 3] = "game_times"; AccountUser[AccountUser["get_hats"] = 4] = "get_hats"; AccountUser[AccountUser["get_heroes"] = 5] = "get_heroes"; AccountUser[AccountUser["get_dances"] = 6] = "get_dances"; AccountUser[AccountUser["video_times"] = 7] = "video_times"; AccountUser[AccountUser["equip_hat"] = 8] = "equip_hat"; AccountUser[AccountUser["equip_dance"] = 9] = "equip_dance"; AccountUser[AccountUser["equip_hero"] = 10] = "equip_hero"; AccountUser[AccountUser["last_action_time"] = 11] = "last_action_time"; AccountUser[AccountUser["last_favorite_time"] = 12] = "last_favorite_time"; AccountUser[AccountUser["progress_dances"] = 13] = "progress_dances"; AccountUser[AccountUser["progress_hats"] = 14] = "progress_hats"; AccountUser[AccountUser["progress_heroes"] = 15] = "progress_heroes"; AccountUser[AccountUser["revival"] = 16] = "revival"; AccountUser[AccountUser["stage"] = 17] = "stage"; })(AccountUser || (AccountUser = {})); var heroAttr; (function (heroAttr) { heroAttr[heroAttr["id"] = 0] = "id"; heroAttr[heroAttr["name"] = 1] = "name"; heroAttr[heroAttr["quality"] = 2] = "quality"; heroAttr[heroAttr["icon"] = 3] = "icon"; heroAttr[heroAttr["prefab"] = 4] = "prefab"; heroAttr[heroAttr["require_num"] = 5] = "require_num"; heroAttr[heroAttr["require_type"] = 6] = "require_type"; })(heroAttr || (heroAttr = {})); var signdata; (function (signdata) { signdata[signdata["sign_days"] = 0] = "sign_days"; signdata[signdata["sign_time"] = 1] = "sign_time"; })(signdata || (signdata = {})); var entity; (function (entity) { entity[entity["id"] = 0] = "id"; entity[entity["name"] = 1] = "name"; entity[entity["entity_id"] = 2] = "entity_id"; entity[entity["icon"] = 3] = "icon"; })(entity || (entity = {})); class AccountData { constructor(_token, _config, _appSetting, _user, _userbase, _useInvite = null, _user_stage = null, _user_sign, _user_achievement) { this.openid = ""; this.userId = ""; this.roadconfig = {}; this.m_RewardDic = {}; this.m_EntityDic = {}; this.m_AchievementDic = {}; this.m_heroDic = {}; this.m_hatDic = {}; this.m_cbDic = {}; this.bannerdata = []; this.redata = []; this.m_token = _token; this.m_app_setting = _appSetting; this.m_user = _user; this.m_user_base = _userbase; this.m_sign = _user_sign; this.m_task = _user_achievement; this.userId = this.m_user["user_id"]; this.openid = this.m_user_base["openid"]; console.log("user_id:" + this.userId); } get share() { return this.m_app_setting["share"] == "1"; } get sharecontent() { return this.m_app_setting["sharecontent"]; } get cheattime() { return Number(this.m_app_setting["cheattime"]); } get banner() { return this.m_app_setting["banner"] == "1"; } get video() { return this.m_app_setting["video"] == "1"; } get cheat() { return this.m_app_setting["cheat"] == "1"; } get checkscence() { return this.m_app_setting["checkscence"] == 1; } get trial() { return this.m_app_setting["trial"] == "1"; } get UseId() { return this.userId; } GetConfig(_type) { var type = AccountConfig[_type]; return this.m_configs[type]; } GetUser(_type) { var type = AccountUser[_type]; return this.m_user[type]; } HasHero(_id) { var data = this.GetUser(AccountUser.get_heroes); for (var i = 0; i < data.length; i++) { var hd = data[i]; if (_id == hd) { return true; } } return false; } HasHat(_id) { var data = this.GetUser(AccountUser.get_hats); for (var i = 0; i < data.length; i++) { var hd = data[i]; if (_id.toString == hd) { return true; } } return false; } HasDane(_id) { var data = this.GetUser(AccountUser.get_dances); for (var i = 0; i < data.length; i++) { var hd = data[i]; if (_id.toString == hd) { return true; } } return false; } GetSign(_datatype) { var type = signdata[_datatype]; return this.m_sign[type]; } GetRewardConfig(_rewardid) { var reward = this.m_RewardDic[_rewardid]; return reward; } GetEntity(_id, attr) { return this.m_EntityDic[_id][entity[attr]]; } GetRewardDic() { var config = this.GetConfig(AccountConfig.rewards); for (var key in config) { this.m_RewardDic[config[key].id] = config[key]; } } GetEntityDic() { var config = this.GetConfig(AccountConfig.entity); for (var key in config) { this.m_EntityDic[config[key].entity_id] = config[key]; } } GetAchievementData() { var data = this.GetConfig(AccountConfig.achievement); var dic = {}; for (var key1 in data) { var type1 = data[key1].type; if (dic[type1]) { continue; } var array = []; for (var key2 in data) { var type2 = data[key2].type; if (type1 == type2) { array.push(data[key2]); } } dic[type1] = array; } this.m_AchievementDic = dic; } GetRoadConfig() { var configs = this.GetConfig(AccountConfig.road); for (var i = 0; i < configs.length; i++) { var config = configs[i]; this.roadconfig[config.roadid] = config; } } GetHeroProgress(_id) { var config = this.m_user["progress_heroes"]; var progress = config[_id] ? config[_id] : 0; return progress; } GetHatProgress(_id) { var config = this.m_user["progress_hats"]; var progress = config[_id] ? config[_id] : 0; return progress; } GetCbProgress(_id) { var config = this.m_user["progress_dances"]; var progress = config[_id] ? config[_id] : 0; return progress; } GetHeroDic() { var config = this.GetConfig(AccountConfig.hero); for (var i = 0; i < config.length; i++) { var data = config[i]; var hero = new HeroData(Number(data.id)); hero.curicon = data.icon; hero.name = data.name; hero.prefab = data.prefab; hero.quality = Number(data.quality); hero.require_num = Number(data.require_num); hero.require_type = Number(data.require_type); this.m_heroDic[data.id] = hero; } return this.m_heroDic; } GetHatDic() { var config = this.GetConfig(AccountConfig.hat); for (var i = 0; i < config.length; i++) { var data = config[i]; var hat = new HatData(Number(data.id)); hat.icon = data.icon; hat.name = data.name; hat.prefab = data.prefab; hat.quality = Number(data.quality); hat.require_num = Number(data.require_num); hat.require_type = Number(data.require_type); this.m_hatDic[data.id] = hat; } return this.m_hatDic; } GetCbDic() { var config = this.GetConfig(AccountConfig.wing); for (var i = 0; i < config.length; i++) { var data = config[i]; var hat = new HatData(Number(data.id)); hat.icon = data.icon; hat.name = data.name; hat.prefab = data.prefab; hat.quality = Number(data.quality); hat.require_num = Number(data.require_num); hat.require_type = Number(data.require_type); this.m_cbDic[data.id] = hat; } return this.m_cbDic; } GetSeverConfig() { NetworkManager.Instance.HttpPostRequest(PROTOCOLS.Config, null, Laya.Handler.create(this, (data) => { this.m_configs = data["configs"]; new ThingsEffect(this.m_configs["things"]); this.GetHeroDic(); this.GetHatDic(); this.GetCbDic(); this.GetRewardDic(); this.GetEntityDic(); this.GetAchievementData(); this.InitData(); }), null); } InitData() { var url = "https://jiujiu.99huyu.cn/m/run/config.json"; var args = null; let httpRequest = new HttpRequest$1(); httpRequest.once(Laya.Event.COMPLETE, this, this.onHttpRequestComplete); httpRequest.once(Laya.Event.ERROR, this, this.onHttpRequestError); httpRequest.send(url, args, "get", "json"); } onHttpRequestComplete(_data) { var data = _data.data.mores; for (var key in data.banner) { var kk = data.banner[key]; var nd = new ReData(kk); this.bannerdata.push(nd); this.bannerdata.sort(RecommendWindow.ListSort); } for (var key in data.remen_game) { var kk = data.remen_game[key]; var nd = new ReData(kk); this.redata.push(nd); this.redata.sort(RecommendWindow.ListSort); } } onHttpRequestError(errorcb, httpRequest) { console.log("Error! Http request error..." + httpRequest.data); } } class PlayerAccount { constructor(_code, _nickname, _avatar, _gender, _country, _province, _city, _device, _shareid, _scence, _ver) { this.IsTest = false; this.localTime = Laya.timer.currTimer; this.Code = _code; this.NickName = _nickname; this.Avatar = _avatar; this.Gender = _gender; this.Country = _country; this.Province = _province; this.City = _city; this.Device = _device; this.ShareId = _shareid; this.Scene = _scence; this.ver = _ver; this.IsTest = false; PlayerAccount.instance = this; } static get CurrentAccount() { if (PlayerAccount.instance == null) { console.log("生成本地测试账号..."); } return PlayerAccount.instance; } static get TestAccount() { var curaccount = new PlayerAccount("123456", "我是谁,我在那?", "123", 1, "中国", "上海", "上海", "iphone6s", "123", "123", "123"); curaccount.IsTest = true; return curaccount; } SetAccountData(data) { var token = data["token"]; var configs = data["configs"]; var app_setting = data["app_setting"]; var user = data["user"]; var user_base = data["user_base"]; var user_sign = data["user_sign"]; var user_achievement = data["user_achievement"]; if (this.CurAccountData == null) { this.CurAccountData = new AccountData(token, configs, app_setting, user, user_base, null, null, user_sign, user_achievement); this.CurAccountData.GetSeverConfig(); } else { if (configs) { this.CurAccountData.m_configs = configs; } if (app_setting) { this.CurAccountData.m_app_setting = app_setting; } if (user) { this.CurAccountData.m_user = user; } if (user_base) { this.CurAccountData.m_user_base = user_base; } if (user_sign) { this.CurAccountData.m_sign = user_sign; } if (user_achievement) { this.CurAccountData.m_task = user_achievement; } } } get ServerTime() { let time = Laya.timer.currTimer; let stime = PlayerAccount.ServerTime + Math.ceil((time - this.localTime) / 1000); return stime; } } var WxParkInforType; (function (WxParkInforType) { WxParkInforType[WxParkInforType["stage"] = 0] = "stage"; })(WxParkInforType || (WxParkInforType = {})); class WxApi { constructor() { this.avator = ""; this.openId = 0; this.codeValue = ""; this.shareOpenId = ""; this.shareScene = ""; WxApi.WxApiInstance = this; } static get Instance() { if (WxApi.WxApiInstance) { return WxApi.WxApiInstance; } else { return new WxApi(); } } WxInit(callback) { Laya.Browser.window.wx.showShareMenu({ withShareTicket: true }); Laya.Browser.window.wx.onShareAppMessage(function () { return { title: "有人@你,能追上我,让你当王者又如何", imageUrl: "https://res.xcx.snsfun.com/melee/share/fallrace1.png", query: "userId=" + this.shareUserId, }; }); Laya.Browser.window.wx.onShow((option) => { var adsdasdsa = option.shareTicket; var afsafsfsa = option.query.userId; var dadads = option.query.shareTitle; console.log("scene:", option.scene); Main.sceneValue = option.scene; WxApi.querychannel = option.query.channel; if (WxApi.querychannel != null) { console.log("onShow channel is:", WxApi.querychannel); } if (option.referrerInfo) { WxApi.referrerInfoappid = option.referrerInfo.appId; console.log("onShow appId is:", option.referrerInfo.appId); } WxApi.queryuserId = afsafsfsa; callback(adsdasdsa, afsafsfsa, WxApi.querychannel, option.scene, dadads); }); } SetShareScence(sceneS) { if (sceneS != "" && sceneS != null) { this.shareScene = sceneS; } } ShareScene() { return this.shareScene; } gagasgasgsa() { if (typeof (Laya.Browser.window.wx) != "undefined") { return Laya.Browser.window.wx.getSystemInfoSync(); } } OpenId(id) { this.openId = id; } ShareId() { return this.shareOpenId; } WXLogin(cb) { var that = this; Laya.Browser.window.wx.login({ success: function (res) { if (res.code) { that.codeValue = res.code; that.avator = res.avator; console.log(res.avator); cb(res); } else { console.log('获取用户登录态失败!' + res.errMsg); } }, fail: function (res) { console.log("wx.login: failed, res=" + res); } }); } SetShareId(tid) { if (tid != "" && tid != null) { this.shareOpenId = tid; } } static shake() { Laya.Browser.window.wx.vibrateShort({}); } static shakeLong() { Laya.Browser.window.wx.vibrateLong({}); } static Shake(_short = true) { if (Main.OnWx && WxApi.CanShake) { if (_short) { this.shake(); } else { this.shakeLong(); } } } static Message(text) { if (Laya.Browser.window.wx) { Laya.Browser.window.wx.showToast({ title: text }); } else { console.log(text); } } static ShowToast(text) { if (Laya.Browser.window.wx) { Laya.Browser.window.wx.showToast({ title: text }); } else { console.log(text); } } static ShowLoading(title = "加载中...") { (Laya.Browser.onMiniGame) && Laya.Browser.window.wx.showLoading({ title: title, mask: true }); } static HideLoading() { (Laya.Browser.onMiniGame) && Laya.Browser.window.wx.hideLoading(); } static shareImage(channel, callback = null, shareType) { if (Laya.Browser.window.wx == null) { return; } if (!PlayerAccount.CurrentAccount.CurAccountData.share) { WxApi.Message("暂未开放"); return; } var sharecontent = PlayerAccount.CurrentAccount.CurAccountData.sharecontent; var content = JSON.parse(sharecontent); var con = content[GameUtils.getRandomInt(0, content.length - 1)]; var _title = con.title; var _url = con.url; var t = PlayerAccount.CurrentAccount.ServerTime; Laya.Browser.window.wx.aldShareAppMessage({ title: _title, imageUrl: _url, query: "userId=" + PlayerAccount.CurrentAccount.CurAccountData.UseId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString() + "&shareTitle=" + _title, }); if (callback) { ShareUtil.Instance.beginShare(callback); } } recordAldEvent(key, value) { if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.aldSendEvent(key, { key: value }); } } levelStart(stageId, stageName, userId) { console.log("开始记录关卡:" + stageId); if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.aldStage.onStart({ stageId: stageId, stageName: stageName, userId: userId }); } } levelSuccess(stageId, stageName, userId) { console.log("记录关卡:完成" + stageId); if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.aldStage.onEnd({ stageId: stageId, stageName: stageName, userId: userId, event: "complete", params: { desc: "关卡完成" } }); } } levelFail(stageId, stageName, userId, score, carname) { console.log("记录关卡:失败" + stageId); if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.aldStage.onEnd({ stageId: stageId, stageName: stageName, userId: userId, event: "fail", params: { desc: "失败", score: score, car: carname } }); } } static writeStage(stage) { var kvDataList = new Array(); let date = new Date().getTime(); var myValue = JSON.stringify({ "wxgame": { "stage": stage, "update_time": date.toString(), } }); kvDataList.push({ key: "stage", value: myValue }); if (Laya.Browser.window.wx) { Laya.Browser.window.wx.setUserCloudStorage({ KVDataList: kvDataList, success: r => { console.log("上传分数成功"); } }); } } } WxApi.referrerInfoappid = ""; WxApi.querychannel = ""; WxApi.queryuserId = "123"; WxApi.CanShake = true; class CheckMain { } CheckMain.create = false; class Main { constructor() { this.localAtlas = [ "res/atlas/local.atlas", "res/atlas/local.png", "res/atlas/load.atlas", "res/atlas/load.png", ]; if (CheckMain.create) return; CheckMain.create = true; if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height); else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]); Laya["Physics"] && Laya["Physics"].enable(); Laya["DebugPanel"] && Laya["DebugPanel"].enable(); Laya.stage.scaleMode = GameConfig.scaleMode; Laya.stage.screenMode = GameConfig.screenMode; Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson; if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel(); if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable(); if (GameConfig.stat) Laya.Stat.show(); Laya.alertGlobalError = true; Main.OnWx = Laya.Browser.onWeiXin; if (Main.OnWx) WxApi.Instance.WxInit(() => { }); Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION); } onVersionLoaded() { Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded)); } onConfigLoaded() { Laya.loader.create(this.localAtlas, Laya.Handler.create(this, () => { new LoadWindow(); })); } } Main.Ver = "1.0.85"; Main.sceneValue = "000000"; new Main(); var Tween = Laya.Tween; class LoadWindow extends ui.Window.LoadWindowUI { constructor() { super(); this.loadcomplete = false; LoadWindow.Instance = this; Laya.stage.addChild(this); this.OnShow(); } OnShow() { this.ShowProgress(); WxApi.Instance.recordAldEvent("进入加载界面", "1"); this.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.height = Laya.stage.height; }); } ShowProgress() { this.TweenProgress(0, 0.65, 1.5, () => { if (!this.loadcomplete) this.TweenProgress(0.65, 0.99, 100); this.AccountLogin(); }); } AccountLogin() { if (Main.OnWx) { WxApi.Instance.recordAldEvent("开始登录账号...", "1"); WxApi.Instance.WXLogin((res) => { this.OnLogin(res); }); } else { NetworkManager.Instance.login(null, Laya.Handler.create(this, this.OnLocalSeverLoginComplete), Laya.Handler.create(this, this.OnLoginError)); } } OnLogin(_res) { if (_res == "error") { WxApi.Instance.WXLogin((res) => { this.OnLogin(res); }); console.log("微信登录失败"); } else { WxApi.Instance.recordAldEvent("微信登录成功...", "1"); ShareUtil.Instance.onRegister(); console.log("微信登录成功"); new PlayerAccount(_res.code, "", "", 0, "", "", "", "", WxApi.Instance.shareOpenId, WxApi.Instance.shareOpenId, Main.Ver); NetworkManager.Instance.login(null, Laya.Handler.create(this, this.OnLocalSeverLoginComplete), Laya.Handler.create(this, this.OnLoginError)); } } OnLocalSeverLoginComplete() { WxApi.Instance.recordAldEvent("本地服务器登录完成...", "1"); console.log("本地服务器登录完成..."); var stage = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.stage)); WxApi.writeStage(stage); JionTool.Init(); this.LoadSubPackage(); } OnLoginError(e) { console.log(e); } TweenProgress(_start, _end, _duration, _complete = null) { if (this.ProgressTween) this.ProgressTween.clear(); this.progress.value = _start; this.preTex.text = Math.floor(this.progress.value * 100).toString() + "%"; this.ProgressTween = Tween.to(this.progress, { value: _end, update: Laya.Handler.create(this, () => { this.preTex.text = Math.floor(this.progress.value * 100).toString() + "%"; }, null, false) }, _duration * 1000, null, Laya.Handler.create(this, _complete), null, true, true); } LoadSubPackage() { if (Main.OnWx) { WxApi.Instance.recordAldEvent("开始加载分包资源...", "1"); Laya.Browser.window.wx.loadSubpackage({ name: 'subpackage', success: (res) => { console.log("分包加载成功"); WxApi.Instance.recordAldEvent("分包加载成功...", "1"); this.LoadScene(); }, fail: function (res) { this.LoadSubPackage(); } }); } else { this.LoadScene(); } } LoadScene() { WxApi.Instance.recordAldEvent("开始加载场景...", "1"); Laya.Scene3D.load(AssetPaths.scencepath, Laya.Handler.create(this, (_scence) => { ResourcesManager.Instance.scenceasset = _scence; ResourcesManager.Instance.scenceasset.visible = false; Laya.stage.addChild(ResourcesManager.Instance.scenceasset); new ScenceManager(_scence); WxApi.Instance.recordAldEvent("加载场景完成...", "1"); console.log("场景加载完成..."); this.LoadPlayerRes(); })); } LoadPlayerRes() { WxApi.Instance.recordAldEvent("开始加载角色资源...", "1"); var playerpath = []; for (var key in AssetPaths.playerpath) { playerpath.push(AssetPaths.playerpath[key]); } playerpath.push(AssetPaths.decoratepath); Laya.loader.create(playerpath, Laya.Handler.create(this, () => { for (var key in AssetPaths.playerpath) { var path = AssetPaths.playerpath[key]; var asset = Laya.loader.getRes(path); ResourcesManager.Instance.playerassets[key] = asset; Laya.loader.clearRes(path); } var decorate = Laya.loader.getRes(AssetPaths.decoratepath); for (var i = 0; i < decorate.numChildren; i++) { ResourcesManager.Instance.decorateasset[i] = decorate.getChildAt(i); } Laya.loader.clearRes(AssetPaths.decoratepath); console.log("角色资源完成..."); WxApi.Instance.recordAldEvent("角色资源完成...", "1"); this.LoadRoadRes(); })); } LoadRoadRes() { var roadpath = []; for (var key in AssetPaths.roadpath) { roadpath.push(AssetPaths.roadpath[key]); } for (var i = 0; i < AssetPaths.planetxture.length; i++) { roadpath.push(AssetPaths.planetxture[i]); } Laya.loader.create(roadpath, Laya.Handler.create(this, () => { var bspath = AssetPaths.roadpath[1]; var asset = Laya.loader.getRes(bspath).getChildAt(0); for (var i = 0; i < asset.numChildren; i++) { ResourcesManager.Instance.bsroadassets[i] = asset.getChildAt(i); } Laya.loader.clearRes(AssetPaths.roadpath[1]); var fxpath = AssetPaths.roadpath[2]; var asset = Laya.loader.getRes(fxpath).getChildAt(0); for (var i = 0; i < asset.numChildren; i++) { ResourcesManager.Instance.fxroadassets[i] = asset.getChildAt(i); } Laya.loader.clearRes(AssetPaths.roadpath[2]); var tspath = AssetPaths.roadpath[3]; var asset = Laya.loader.getRes(tspath).getChildAt(0); for (var i = 0; i < asset.numChildren; i++) { ResourcesManager.Instance.tsroadassets[i + 1] = asset.getChildAt(i); } Laya.loader.clearRes(AssetPaths.roadpath[3]); for (var i = 0; i < AssetPaths.planetxture.length; i++) { var asset = Laya.loader.getRes(AssetPaths.planetxture[i]); ResourcesManager.Instance.planetextures[i + 1] = asset; Laya.loader.clearRes(AssetPaths.planetxture[i]); } console.log("道路资源完成..."); WxApi.Instance.recordAldEvent("道路资源完成...", "1"); this.LoadBuildsRes(); })); } DelayHide(_sprite) { _sprite.removeSelf(); } LoadBuildsRes() { var path = AssetPaths.buildpath; Laya.loader.create(path, Laya.Handler.create(this, () => { var asset = Laya.loader.getRes(AssetPaths.buildpath); for (var i = 0; i < asset.numChildren; i++) { var build = asset.getChildAt(i); ResourcesManager.Instance.buildsassets[i] = build; } Laya.loader.clearRes(AssetPaths.buildpath); WxApi.Instance.recordAldEvent("建筑资源加载完成...", "1"); console.log("建筑资源加载完成..."); this.TweenProgress(this.progress.value, 100, 0.3, () => { WxApi.Instance.recordAldEvent("all资源加载完成...", "1"); this.loadcomplete = true; this.destroy(); ADPlayer.initAd(); new GameManager(); }); })); } } class Main$1 { constructor() { this.localAtlas = [ "res/atlas/local.atlas", "res/atlas/local.png", "res/atlas/load.atlas", "res/atlas/load.png", ]; if (CheckMain.create) return; CheckMain.create = true; if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height); else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]); Laya["Physics"] && Laya["Physics"].enable(); Laya["DebugPanel"] && Laya["DebugPanel"].enable(); Laya.stage.scaleMode = GameConfig.scaleMode; Laya.stage.screenMode = GameConfig.screenMode; Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson; if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel(); if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable(); if (GameConfig.stat) Laya.Stat.show(); Laya.alertGlobalError = true; Main$1.OnWx = Laya.Browser.onWeiXin; if (Main$1.OnWx) WxApi.Instance.WxInit(() => { }); Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION); } onVersionLoaded() { Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded)); } onConfigLoaded() { Laya.loader.create(this.localAtlas, Laya.Handler.create(this, () => { new LoadWindow(); })); } } Main$1.Ver = "1.0.85"; Main$1.sceneValue = "000000"; new Main$1(); exports.Main = Main$1; return exports; }({})); //# sourceMappingURL=bundle.js.map