From d2620297caad705ba1807fcd0c8876c1b237d11a Mon Sep 17 00:00:00 2001 From: tangge233 Date: Mon, 23 Sep 2024 21:23:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8E=9F=E7=89=88=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Base/ModBase.vb | 4 +++ .../Pages/PageDownload/ModDownloadLib.vb | 33 +++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Base/ModBase.vb b/Plain Craft Launcher 2/Modules/Base/ModBase.vb index 994dfaa..b57f3a4 100644 --- a/Plain Craft Launcher 2/Modules/Base/ModBase.vb +++ b/Plain Craft Launcher 2/Modules/Base/ModBase.vb @@ -176,6 +176,10 @@ Public Module ModBase ''' ''' 图标,音符,1x ''' + Public Const IconButtonServer As String = "M640 725.333333a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-256 0H256a42.666667 42.666667 0 0 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z m384 0a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-128-256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-256 0H256a42.666667 42.666667 0 1 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z m384-256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m0 256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m170.666667-256a128 128 0 0 0-128-128H213.333333a128 128 0 0 0-128 128v85.333334a128 128 0 0 0 33.28 85.333333A128 128 0 0 0 85.333333 469.333333v85.333334a128 128 0 0 0 33.28 85.333333A128 128 0 0 0 85.333333 725.333333v85.333334a128 128 0 0 0 128 128h597.333334a128 128 0 0 0 128-128v-85.333334a128 128 0 0 0-33.28-85.333333 128 128 0 0 0 33.28-85.333333v-85.333334a128 128 0 0 0-33.28-85.333333A128 128 0 0 0 938.666667 298.666667V213.333333z m-85.333334 597.333334a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-85.333334a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m0-256a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-85.333334a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m0-256a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666V213.333333a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m-213.333333-85.333334a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334zM384 213.333333H256a42.666667 42.666667 0 1 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z" + ''' + ''' 图标,音符,1x + ''' Public Const IconMusic As String = "M348.293565 716.53287V254.797913c0-41.672348 28.004174-78.358261 68.919652-90.37913L815.994435 40.826435c62.775652-18.610087 125.907478 26.579478 125.907478 89.933913v539.158261c8.013913 42.25113-8.94887 89.177043-47.014956 127.109565a232.848696 232.848696 0 0 1-170.785392 65.758609c-61.885217-2.938435-111.081739-33.435826-129.113043-80.050087-18.031304-46.614261-2.137043-102.177391 41.672348-145.853218a232.848696 232.848696 0 0 1 170.785391-65.80313c21.014261 1.024 40.514783 5.164522 57.878261 12.065391V233.338435c0-12.109913-10.551652-20.034783-20.569044-20.034783a24.620522 24.620522 0 0 0-5.787826 0.934957L439.785739 338.18713a19.545043 19.545043 0 0 0-14.825739 19.144348v438.984348H423.846957c11.53113 43.987478-5.164522 94.208-45.412174 134.322087a232.848696 232.848696 0 0 1-170.785392 65.758609c-61.885217-2.938435-111.081739-33.435826-129.113043-80.050087-18.031304-46.614261-2.137043-102.177391 41.672348-145.853218a232.848696 232.848696 0 0 1 170.785391-65.80313c20.791652 1.024 40.069565 5.075478 57.299478 11.842783z" ''' ''' 图标,播放,0.8x diff --git a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb index 1cd46b9..6982450 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb @@ -207,9 +207,19 @@ Public Module ModDownloadLib ToolTipService.SetVerticalOffset(BtnInfo, 30) ToolTipService.SetHorizontalOffset(BtnInfo, 2) AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog - sender.Buttons = {BtnInfo} + Dim BtnServer As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"} + ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center) + ToolTipService.SetVerticalOffset(BtnServer, 30) + ToolTipService.SetHorizontalOffset(BtnServer, 2) + AddHandler BtnServer.Click, AddressOf McDownloadMenuServer + sender.Buttons = {BtnServer, BtnInfo} End Sub Private Sub McDownloadMenuBuild(sender As Object, e As EventArgs) + Dim BtnServer As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"} + ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center) + ToolTipService.SetVerticalOffset(BtnServer, 30) + ToolTipService.SetHorizontalOffset(BtnServer, 2) + AddHandler BtnServer.Click, AddressOf McDownloadMenuServer Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"} ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center) ToolTipService.SetVerticalOffset(BtnSave, 30) @@ -220,7 +230,7 @@ Public Module ModDownloadLib ToolTipService.SetVerticalOffset(BtnInfo, 30) ToolTipService.SetHorizontalOffset(BtnInfo, 2) AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog - sender.Buttons = {BtnSave, BtnInfo} + sender.Buttons = {BtnServer, BtnSave, BtnInfo} End Sub Private Sub McDownloadMenuLog(sender As Object, e As RoutedEventArgs) Dim Version As JToken @@ -233,6 +243,25 @@ Public Module ModDownloadLib End If McUpdateLogShow(Version) End Sub + Private Sub McDownloadMenuServer(sender As Object, e As RoutedEventArgs) + Dim Version As JToken + If sender.Tag IsNot Nothing Then + Version = sender.Tag + ElseIf sender.Parent.Tag IsNot Nothing Then + Version = sender.Parent.Tag + Else + Version = sender.Parent.Parent.Tag + End If + RunInThread(Sub() + Dim Json As JObject = NetGetCodeByRequestRetry(Version("url"), IsJson:=True) + If Json("downloads")?("server") Is Nothing Then + Hint("此版本暂未有服务端文件提供下载") + Else + PageOtherTest.StartCustomDownload(Json("downloads")("server")("url").ToString(), Version("id").ToString() & "-server.jar") + End If + End Sub + ) + End Sub Public Sub McDownloadMenuSave(sender As Object, e As RoutedEventArgs) Dim Version As MyListItem If TypeOf sender Is MyListItem Then