Skip to content

Commit

Permalink
ui: 显示 NeoForge 版本属性(测试版 / 稳定版)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pigeon0v0 committed Jun 15, 2024
1 parent 7ba79db commit e731ef6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
17 changes: 14 additions & 3 deletions Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@
''' 版本分支。若无分支则为 Nothing。
''' </summary>
Public Branch As String = Nothing
''' <summary>
''' 是否是 Beta 版。若未提供则默认为 False。
''' </summary>
Public IsBeta As Boolean = False
Public Structure DlNeoForgeListResult
''' <summary>
''' 数据来源名称,如“Official”,“BMCLAPI”。
Expand Down Expand Up @@ -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
' '基础信息获取
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "没有可用版本"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e731ef6

Please sign in to comment.