From e731ef69d4adaa344d7136741576aa8eadeaa0b9 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 15 Jun 2024 22:38:39 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E6=98=BE=E7=A4=BA=20NeoForge=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=B1=9E=E6=80=A7=EF=BC=88=E6=B5=8B=E8=AF=95=E7=89=88?= =?UTF-8?q?=20/=20=E7=A8=B3=E5=AE=9A=E7=89=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModDownload.vb | 17 ++++++++++++++--- .../Pages/PageDownload/ModDownloadLib.vb | 5 +++-- .../PageDownload/PageDownloadInstall.xaml.vb | 4 ++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb index 9e9ea6aa..78907b57 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb @@ -748,6 +748,10 @@ ''' 版本分支。若无分支则为 Nothing。 ''' Public Branch As String = Nothing + ''' + ''' 是否是 Beta 版。若未提供则默认为 False。 + ''' + Public IsBeta As Boolean = False Public Structure DlNeoForgeListResult ''' ''' 数据来源名称,如“Official”,“BMCLAPI”。 @@ -857,7 +861,6 @@ ResultJson = GetJson(Result) Dim Versions As New List(Of DlNeoForgeVersionEntry) Dim VersionList As String = ResultJson("versions") - MyMsgBox(VersionList, "VersionList 获取测试") 'Try ' Try ' '基础信息获取 @@ -894,9 +897,17 @@ Dim Versions As New List(Of DlNeoForgeVersionEntry) Try For Each Token As JObject In Json - Dim Name As String = Token("version") + Dim Name As String + Dim IsBeta As Boolean + If Token("version").Contains("-beta") Then + Name = Token("version").ToString() - "-beta" + IsBeta = True + Else + Name = Token("version") + IsBeta = False + End If Dim Inherit As String = Token("mcversion") - Dim Entry = New DlNeoForgeVersionEntry With {.Version = Name, .Inherit = Inherit} + Dim Entry = New DlNeoForgeVersionEntry With {.Version = Name, .Inherit = Inherit, .IsBeta = IsBeta} Versions.Add(Entry) Next 'For Each Token As JObject In Json diff --git a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb index 6f6a3310..97a63446 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb @@ -2258,8 +2258,9 @@ Retry: Public Function NeoForgeDownloadListItem(Entry As DlNeoForgeVersionEntry, OnClick As MyListItem.ClickEventHandler, IsSaveOnly As Boolean) As MyListItem '建立控件 Dim NewItem As New MyListItem With { - .Title = Entry.Version, .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry, - .Info = If(Entry.ReleaseTime = "", + .Title = If(Entry.IsBeta, Entry.Version & "-beta", Entry.Version), .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry, + .Info = If(Entry.IsBeta, "稳定版", "测试版") & + If(Entry.ReleaseTime = "", If(ModeDebug, "种类:" & Entry.Category & If(Entry.Branch Is Nothing, "", ",开发分支:" & Entry.Branch), ""), "发布于 " & Entry.ReleaseTime & If(ModeDebug, ",种类:" & Entry.Category & If(Entry.Branch Is Nothing, "", ",开发分支:" & Entry.Branch), "")), .Logo = PathImage & "Blocks/Anvil.png" diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb index f703ef49..e93e7789 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb @@ -787,6 +787,7 @@ If LoadLiteLoader Is Nothing OrElse LoadLiteLoader.State.LoadingState = MyLoading.MyLoadingState.Run Then Return "正在获取版本列表……" If LoadLiteLoader.State.LoadingState = MyLoading.MyLoadingState.Error Then Return "获取版本列表失败:" & CType(LoadLiteLoader.State, Object).Error.Message For Each Version As DlLiteLoaderListEntry In DlLiteLoaderListLoader.Output.Value + If SelectedNeoForge IsNot Nothing Then Return "与 NeoForge 不兼容" If Version.Inherit = SelectedMinecraftId Then Return Nothing Next Return "没有可用版本" @@ -857,6 +858,7 @@ Dim NotSuitForOptiFine As Boolean = False For Each Version In Loader.Output If Version.Category = "universal" OrElse Version.Category = "client" Then Continue For '跳过无法自动安装的版本 + If SelectedNeoForge IsNot Nothing Then Return "与 NeoForge 不兼容" If SelectedFabric IsNot Nothing Then Return "与 Fabric 不兼容" If SelectedOptiFine IsNot Nothing AndAlso VersionSortInteger(SelectedMinecraftId, "1.13") >= 0 AndAlso VersionSortInteger("1.14.3", SelectedMinecraftId) >= 0 Then @@ -945,6 +947,7 @@ If Loader.State <> LoadState.Finished Then Return "获取版本列表失败:未知错误,状态为 " & GetStringFromEnum(Loader.State) For Each Version In Loader.Output If Version.Category = "universal" OrElse Version.Category = "client" Then Continue For '跳过无法自动安装的版本 + If SelectedForge IsNot Nothing Then Return "与 Forge 不兼容" If SelectedFabric IsNot Nothing Then Return "与 Fabric 不兼容" Return Nothing Next @@ -1008,6 +1011,7 @@ If LoadFabric.State.LoadingState = MyLoading.MyLoadingState.Error Then Return "获取版本列表失败:" & CType(LoadFabric.State, Object).Error.Message For Each Version As JObject In DlFabricListLoader.Output.Value("game") If Version("version").ToString = SelectedMinecraftId.Replace("∞", "infinite").Replace("Combat Test 7c", "1.16_combat-3") Then + If SelectedNeoForge IsNot Nothing Then Return "与 NeoForge 不兼容" If SelectedForge IsNot Nothing Then Return "与 Forge 不兼容" 'If SelectedOptiFine IsNot Nothing Then Return "与 OptiFine 不兼容" Return Nothing