123456789101112131415161718 |
- {
- "code": "import { ui } from \"../ui/layaMaxUI\";\r\nimport { GameManager, GameState } from \"../Scripts/Game/GameManager\";\r\nimport { WindowManager, WindowType } from \"./WindowManager\";\r\nimport { PlayerAccount, AccountUser } from \"../Scripts/Network/PlayerAccount\";\r\nimport WxApi from \"../WXSDK/wxsdk\";\r\nimport { RecommendWindow } from \"./RecommendWindow\";\r\nimport { Main } from \"../Main\";\r\nimport { TrialWindow } from \"./TrialWindow\";\r\nimport { OffLineWindow } from \"./OffLineWindow\";\r\nexport class HomeWindow extends ui.Window.HomeWindowUI {\r\n constructor() {\r\n super();\r\n this.index = 0;\r\n this.offestx = 0;\r\n this.offestx2 = 0;\r\n HomeWindow.instance = this;\r\n }\r\n static get Instance() {\r\n return HomeWindow.instance;\r\n }\r\n OnOpen(_data = null) {\r\n this.baginBtn.clickHandler = Laya.Handler.create(this, this.OnClickBagin, null, false);\r\n this.skinshop.clickHandler = Laya.Handler.create(this, this.OnOpenSkinShop);\r\n this.settingBtn.clickHandler = Laya.Handler.create(this, this.OnOpenSetting);\r\n this.rankBtn.clickHandler = Laya.Handler.create(this, this.OnOpenRank);\r\n this.signBtn.clickHandler = Laya.Handler.create(this, this.OnOpenSign);\r\n this.taskBtn.clickHandler = Laya.Handler.create(this, this.OnOpenTask, null, false);\r\n this.LeaveBtn.clickHandler = Laya.Handler.create(this, this.onOpenLeave);\r\n this.moreFunBtn.clickHandler = Laya.Handler.create(this, this.onOpenMoreFun);\r\n this.guide.on(Laya.Event.MOUSE_DOWN, this, this.OnGuideClick);\r\n WindowManager.Instance.OpenPopView(WindowType.RecommendWindow);\r\n if (!GameManager.Instance.GetGoin) {\r\n WindowManager.Instance.OpenPopView(WindowType.OffLineWindow);\r\n }\r\n RecommendWindow.Instance.cheat = true;\r\n OffLineWindow.instance.ShowOffLine(true, true, true, true, true);\r\n RecommendWindow.Instance.cainixihuan.bottom = 0;\r\n RecommendWindow.Instance.choutiBtn.clickHandler = Laya.Handler.create(this, this.OnCloseCT, null, false);\r\n this.ShowBaoKuanYouXiView();\r\n this.goldTex.value = PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money);\r\n this.curswtage.value = (Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.stage)) + 1).toString();\r\n this.height = Laya.stage.height;\r\n }\r\n ShowBaoKuanYouXiView() {\r\n this.index = PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1;\r\n this.RefreshBaoKuanYouXi();\r\n Laya.timer.loop(3000, this, this.LoopBaoKuan);\r\n }\r\n LoopBaoKuan() {\r\n this.index--;\r\n if (this.index < 0) {\r\n this.index = PlayerAccount.CurrentAccount.CurAccountData.redata.length - 1;\r\n }\r\n this.RefreshBaoKuanYouXi();\r\n }\r\n RefreshBaoKuanYouXi() {\r\n var data = PlayerAccount.CurrentAccount.CurAccountData.redata[this.index];\r\n var icon = this.rebtn.getChildByName(\"icon\");\r\n icon.skin = data.icon;\r\n var name = this.rebtn.getChildByName(\"name\");\r\n name.text = data.title;\r\n this.rebtn.clickHandler = Laya.Handler.create(this, this.ClickBNavigate, [data], false);\r\n }\r\n ClickBNavigate(data) {\r\n var appid = data.appid;\r\n var path = data.path;\r\n let param = { \"appId\": appid.toString(), \"path\": path.toString() };\r\n if (Main.OnWx) {\r\n WxApi.Instance.recordAldEvent(\"导出-总点击数\", \"1\");\r\n if (data.jump) {\r\n Laya.Browser.window.wx.navigateToMiniProgram({\r\n appId: appid.toString(),\r\n path: path.toString(),\r\n extraData: {\r\n next_appid: data.next_appid,\r\n next_path: data.next_path\r\n },\r\n envVersion: 'develop',\r\n success: res => {\r\n WxApi.Instance.recordAldEvent(\"导出成功-总用户数\", \"1\");\r\n WxApi.Instance.recordAldEvent(\"导出成功-\" + data.title, \"1\");\r\n console.log(\"跳转成功...\");\r\n },\r\n fail: res => {\r\n RecommendWindow.Instance.OpenChouTiView(true);\r\n console.log(\"跳转失败...\");\r\n }\r\n });\r\n }\r\n else {\r\n var marray = [data.image];\r\n Laya.Browser.window.wx.previewImage({\r\n current: data.image,\r\n urls: marray,\r\n success: res => {\r\n WxApi.Instance.recordAldEvent(\"显示游戏二维码成功\", \"1\");\r\n },\r\n fail: res => {\r\n }\r\n });\r\n }\r\n }\r\n }\r\n OnGuideClick() {\r\n this.guide.on(Laya.Event.MOUSE_MOVE, this, this.OnClickBagin);\r\n }\r\n ShowGuide() {\r\n this.Mask1 = new Laya.Sprite();\r\n this.Mask1.graphics.drawRect(0, 0, this.guide1.width, this.guide1.height, \"#000000\");\r\n this.Mask1.pivot(this.guide1.width, 0);\r\n this.guide1.mask = this.Mask1;\r\n this.Mask2 = new Laya.Sprite();\r\n this.Mask2.graphics.drawRect(0, 0, this.guide2.width, this.guide2.height, \"#000000\");\r\n this.Mask2.pivot(this.guide2.width, 0);\r\n this.guide2.mask = this.Mask2;\r\n this.offestx = 0;\r\n this.offestx2 = 0;\r\n Laya.timer.frameLoop(1, this, this.RefreshMask1);\r\n }\r\n RefreshMask1() {\r\n this.offestx += 3;\r\n if (this.offestx > this.guide1.width) {\r\n Laya.timer.clear(this, this.RefreshMask1);\r\n this.offestx = 0;\r\n this.Mask1.pos(this.offestx, 0);\r\n Laya.timer.frameLoop(1, this, this.RefreshMask2);\r\n return;\r\n }\r\n this.Mask1.pos(this.offestx, 0);\r\n this.hand.x = this.guide1.x + this.offestx;\r\n }\r\n RefreshMask2() {\r\n this.offestx2 += 3;\r\n if (this.offestx2 > this.guide2.width) {\r\n Laya.timer.clear(this, this.RefreshMask2);\r\n this.offestx2 = 0;\r\n this.Mask2.pos(this.guide1.x + this.guide1.width, 0);\r\n Laya.timer.frameLoop(1, this, this.RefreshMask1);\r\n return;\r\n }\r\n this.Mask2.pos(this.offestx2, 0);\r\n this.hand.x = this.guide2.x - this.offestx2;\r\n }\r\n OnClickBagin() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击开始游戏\", \"\");\r\n if (TrialWindow.trial && PlayerAccount.CurrentAccount.CurAccountData.trial) {\r\n WindowManager.Instance.ShowWindow(WindowType.TrialWindow);\r\n }\r\n else {\r\n GameManager.Instance.ChangeState(GameState.Queue);\r\n }\r\n }\r\n OnOpenSkinShop() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击皮肤商城\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.ShopWindow);\r\n }\r\n OnOpenSetting() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击设置界面\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.SettingWindow);\r\n }\r\n OnOpenRank() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击排行榜\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.RankWindow);\r\n }\r\n OnOpenSign() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击签到界面\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.SignWindow);\r\n }\r\n OnOpenTask() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击任务界面\", \"\");\r\n WxApi.Message(\"暂未开放\");\r\n }\r\n onOpenLeave() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击离开游戏\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.MoreFunWindow);\r\n }\r\n onOpenMoreFun() {\r\n WxApi.Instance.recordAldEvent(\"主界面点击更多好玩游戏\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.FriendPlayingWindow);\r\n }\r\n OnOpenOffLine() {\r\n WxApi.Instance.recordAldEvent(\"离线收益界面开启\", \"\");\r\n WindowManager.Instance.ShowWindow(WindowType.OffLineWindow);\r\n }\r\n OnCloseCT() {\r\n RecommendWindow.Instance.OpenChouTiView(true);\r\n RecommendWindow.Instance.closeCt.clickHandler = Laya.Handler.create(this, () => {\r\n WindowManager.Instance.ShowWindow(WindowType.HomeWindow);\r\n });\r\n }\r\n OnHide() {\r\n this.guide.off(Laya.Event.MOUSE_DOWN, this, this.OnGuideClick);\r\n this.guide.off(Laya.Event.MOUSE_MOVE, this, this.OnClickBagin);\r\n Laya.timer.clearAll(this);\r\n }\r\n}\r\n",
- "references": [
- "C:/Users/admin/Desktop/runner/src/ui/layaMaxUI.ts",
- "C:/Users/admin/Desktop/runner/src/Window/Component/IWindow.ts",
- "C:/Users/admin/Desktop/runner/src/Scripts/Game/GameManager.ts",
- "C:/Users/admin/Desktop/runner/src/Window/WindowManager.ts",
- "C:/Users/admin/Desktop/runner/src/Scripts/Network/PlayerAccount.ts",
- "C:/Users/admin/Desktop/runner/src/WXSDK/wxsdk.ts",
- "C:/Users/admin/Desktop/runner/src/Window/RecommendWindow.ts",
- "C:/Users/admin/Desktop/runner/src/Main.ts",
- "C:/Users/admin/Desktop/runner/src/Window/TrialWindow.ts",
- "C:/Users/admin/Desktop/runner/src/Window/OffLineWindow.ts",
- "C:/Users/admin/Desktop/runner/src/Window/FriendPlayingWindow.ts",
- "C:/Users/admin/Desktop/runner/src/Window/MoreFunWindow.ts"
- ]
- }
|