diff --git a/Plain Craft Launcher 2/FormMain.xaml.vb b/Plain Craft Launcher 2/FormMain.xaml.vb
index 4dedbccd..906273ef 100644
--- a/Plain Craft Launcher 2/FormMain.xaml.vb
+++ b/Plain Craft Launcher 2/FormMain.xaml.vb
@@ -1068,6 +1068,7 @@ Install:
DownloadLiteLoader = 9
DownloadMod = 11
DownloadPack = 12
+ DownloadResourcePack = 13
SetupLaunch = 0
SetupUI = 1
SetupSystem = 2
@@ -1103,8 +1104,10 @@ Install:
Return "Mod 下载 - " & Project.TranslatedName
Case CompType.ModPack
Return "整合包下载 - " & Project.TranslatedName
- Case Else 'CompType.ResourcePack
+ Case CompType.ResourcePack
Return "资源包下载 - " & Project.TranslatedName
+ Case Else 'CompType.ShaderPack
+ Return "光影包下载 - " & Project.TranslatedName
End Select
Case PageType.HelpDetail
Dim Entry As HelpEntry = Stack.Additional(0)
diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb
index a893e44a..bf1f8043 100644
--- a/Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb
+++ b/Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb
@@ -322,7 +322,24 @@
Case 4480 : Tags.Add("基于地图")
Case 4481 : Tags.Add("轻量")
Case 4482 : Tags.Add("大型")
- 'FUTURE: Res
+ '资源包
+ Case 5244 : Tags.Add("字体包")
+ Case 5193 : Tags.Add("数据包")
+ Case 399 : Tags.Add("蒸汽朋克")
+ Case 396 : Tags.Add("128x")
+ Case 398 : Tags.Add("512x 或更高")
+ Case 397 : Tags.Add("256x")
+ Case 405 : Tags.Add("其他")
+ Case 395 : Tags.Add("64x")
+ Case 400 : Tags.Add("仿真")
+ Case 393 : Tags.Add("16x")
+ Case 403 : Tags.Add("传统")
+ Case 394 : Tags.Add("32x")
+ Case 404 : Tags.Add("动态效果")
+ Case 4465 : Tags.Add("模组支持")
+ Case 402 : Tags.Add("中世纪")
+ Case 401 : Tags.Add("现代")
+
End Select
Next
If Not Tags.Any() Then Tags.Add("杂项")
@@ -388,7 +405,36 @@
Case "adventure" : Tags.Add("冒险")
Case "kitchen-sink" : Tags.Add("大杂烩")
Case "lightweight" : Tags.Add("轻量")
- 'FUTURE: Res
+ '资源包
+ Case "8x-" : Tags.Add("8x-")
+ Case "16x" : Tags.Add("16x")
+ Case "32x" : Tags.Add("32x")
+ Case "48x" : Tags.Add("48x")
+ Case "64x" : Tags.Add("64x")
+ Case "128x" : Tags.Add("128x")
+ Case "256x" : Tags.Add("256x")
+ Case "512x+" : Tags.Add("512x+")
+ Case "audio" : Tags.Add("声音")
+ Case "blocks" : Tags.Add("方块")
+ Case "combat" : Tags.Add("战斗")
+ Case "core-shaders" : Tags.Add("核心着色器")
+ Case "cursed" : Tags.Add("Cursed")
+ Case "decoration" : Tags.Add("装饰")
+ Case "entities" : Tags.Add("实体")
+ Case "environment" : Tags.Add("环境")
+ Case "equipment" : Tags.Add("装备")
+ Case "fonts" : Tags.Add("字体")
+ Case "gui" : Tags.Add("GUI")
+ Case "items" : Tags.Add("物品")
+ Case "locale" : Tags.Add("本地化")
+ Case "modded" : Tags.Add("Modded")
+ Case "models" : Tags.Add("模型")
+ Case "realistic" : Tags.Add("写实")
+ Case "simplistic" : Tags.Add("扁平")
+ Case "themed" : Tags.Add("主题")
+ Case "tweaks" : Tags.Add("优化")
+ Case "utility" : Tags.Add("实用")
+ Case "vanilla-like" : Tags.Add("类原生")
End Select
Next
If Not Tags.Any() Then Tags.Add("杂项")
@@ -750,7 +796,7 @@ NoSubtitle:
Case CompType.ModPack
Address += "&classId=4471"
Case CompType.ResourcePack
- 'FUTURE: Res
+ Address += "&classId=12"
End Select
Address += "&categoryId=" & If(Tag = "", "0", Tag.Before("/"))
If ModLoader <> CompModLoaderType.Any Then Address += "&modLoaderType=" & CType(ModLoader, Integer)
diff --git a/Plain Craft Launcher 2/Modules/ModMain.vb b/Plain Craft Launcher 2/Modules/ModMain.vb
index a9718867..5687be77 100644
--- a/Plain Craft Launcher 2/Modules/ModMain.vb
+++ b/Plain Craft Launcher 2/Modules/ModMain.vb
@@ -398,6 +398,7 @@ EndHint:
Public FrmDownloadFabric As PageDownloadFabric
Public FrmDownloadMod As PageDownloadMod
Public FrmDownloadPack As PageDownloadPack
+ Public FrmDownloadResourcePack As PageDownloadResourcePack
'设置页面声明
Public FrmSetupLeft As PageSetupLeft
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb
index 60f54bd9..7002755c 100644
--- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb
+++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb
@@ -205,7 +205,12 @@
RunInNewThread(
Sub()
Try
- Dim Desc As String = If(Project.Type = CompType.ModPack, "整合包", If(Project.Type = CompType.Mod, "Mod ", "资源包"))
+ Dim Desc As String = "资源"
+ Select Case Project.Type
+ Case CompType.ModPack : Desc = "整合包"
+ Case CompType.Mod : Desc = "Mod "
+ Case CompType.ResourcePack : Desc = "资源包"
+ End Select
'确认默认保存位置
Dim DefaultFolder As String = Nothing
If Project.Type = CompType.Mod Then
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml
index 8a646677..3a51612c 100644
--- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml
+++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml
@@ -84,6 +84,14 @@
+
+
+
+
+
+
+
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml.vb
index 2658c33e..f84defcb 100644
--- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml.vb
+++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadLeft.xaml.vb
@@ -10,7 +10,7 @@
'''
''' 勾选事件改变页面。
'''
- Private Sub PageCheck(sender As MyListItem, e As RouteEventArgs) Handles ItemInstall.Check, ItemClient.Check, ItemOptiFine.Check, ItemForge.Check, ItemNeoForge.Check, ItemLiteLoader.Check, ItemMod.Check, ItemFabric.Check, ItemPack.Check
+ Private Sub PageCheck(sender As MyListItem, e As RouteEventArgs) Handles ItemInstall.Check, ItemClient.Check, ItemOptiFine.Check, ItemForge.Check, ItemNeoForge.Check, ItemLiteLoader.Check, ItemMod.Check, ItemFabric.Check, ItemPack.Check, ItemResourcePack.Check
'尚未初始化控件属性时,sender.Tag 为 Nothing,会导致切换到页面 0
'若使用 IsLoaded,则会导致模拟点击不被执行(模拟点击切换页面时,控件的 IsLoaded 为 False)
If sender.Tag IsNot Nothing Then PageChange(Val(sender.Tag))
@@ -46,6 +46,9 @@
Case FormMain.PageSubType.DownloadPack
If FrmDownloadPack Is Nothing Then FrmDownloadPack = New PageDownloadPack
Return FrmDownloadPack
+ Case FormMain.PageSubType.DownloadResourcePack
+ If FrmDownloadResourcePack Is Nothing Then FrmDownloadResourcePack = New PageDownloadResourcePack
+ Return FrmDownloadResourcePack
Case Else
Throw New Exception("未知的下载子页面种类:" & ID)
End Select
@@ -114,6 +117,12 @@
CompProjectCache.Clear()
If FrmDownloadPack IsNot Nothing Then FrmDownloadPack.PageLoaderRestart()
ItemPack.Checked = True
+ Case FormMain.PageSubType.DownloadResourcePack
+ PageDownloadResourcePack.Storage = New CompProjectStorage
+ PageDownloadResourcePack.Page = 0
+ CompProjectCache.Clear()
+ If FrmDownloadResourcePack IsNot Nothing Then FrmDownloadResourcePack.PageLoaderRestart()
+ ItemResourcePack.Checked = True
Case FormMain.PageSubType.DownloadClient
DlClientListLoader.Start(IsForceRestart:=True)
ItemClient.Checked = True
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml
new file mode 100644
index 00000000..6ce439f2
--- /dev/null
+++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml.vb
new file mode 100644
index 00000000..41c5c7bc
--- /dev/null
+++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadResourcePack.xaml.vb
@@ -0,0 +1,124 @@
+Public Class PageDownloadResourcePack
+
+ Public Const PageSize = 40
+
+ '加载器信息
+ Public Shared Loader As New LoaderTask(Of CompProjectRequest, Integer)("CompProject ResourcePack", AddressOf CompProjectsGet, AddressOf LoaderInput) With {.ReloadTimeout = 60 * 1000}
+ Public Shared Storage As New CompProjectStorage
+ Public Shared Page As Integer = 0
+ Private Sub PageDownloadResourcePack_Inited(sender As Object, e As EventArgs) Handles Me.Initialized
+ PageLoaderInit(Load, PanLoad, PanContent, PanAlways, Loader, AddressOf Load_OnFinish, AddressOf LoaderInput)
+ If McVersionHighest = -1 Then McVersionHighest = Math.Max(McVersionHighest, Integer.Parse(CType(TextSearchVersion.Items(1), MyComboBoxItem).Content.ToString.Split(".")(1)))
+ End Sub
+ Private Shared Function LoaderInput() As CompProjectRequest
+ Dim Request As New CompProjectRequest(CompType.ResourcePack, Storage, (Page + 1) * PageSize)
+ If FrmDownloadResourcePack IsNot Nothing Then
+ With Request
+ .SearchText = FrmDownloadResourcePack.TextSearchName.Text
+ .GameVersion = If(FrmDownloadResourcePack.TextSearchVersion.Text = "全部 (也可自行输入)", Nothing,
+ If(FrmDownloadResourcePack.TextSearchVersion.Text.Contains(".") OrElse FrmDownloadResourcePack.TextSearchVersion.Text.Contains("w"), FrmDownloadResourcePack.TextSearchVersion.Text, Nothing))
+ .Tag = FrmDownloadResourcePack.ComboSearchTag.SelectedItem.Tag
+ .Source = CType(Val(FrmDownloadResourcePack.ComboSearchSource.SelectedItem.Tag), CompSourceType)
+ End With
+ End If
+ Return Request
+ End Function
+
+ '结果 UI 化
+ Private Sub Load_OnFinish()
+ Try
+ Log($"[Comp] 开始可视化资源包列表,已储藏 {Storage.Results.Count} 个结果,当前在第 {Page + 1} 页")
+ '列表项
+ PanProjects.Children.Clear()
+ For i = Math.Min(Page * PageSize, Storage.Results.Count - 1) To Math.Min((Page + 1) * PageSize - 1, Storage.Results.Count - 1)
+ PanProjects.Children.Add(Storage.Results(i).ToCompItem(Loader.Input.GameVersion Is Nothing, False))
+ Next
+ '页码
+ CardPages.Visibility = If(Storage.Results.Count > 40 OrElse
+ Storage.CurseForgeOffset < Storage.CurseForgeTotal OrElse Storage.ModrinthOffset < Storage.ModrinthTotal,
+ Visibility.Visible, Visibility.Collapsed)
+ LabPage.Text = Page + 1
+ BtnPageFirst.IsEnabled = Page > 1
+ BtnPageFirst.Opacity = If(Page > 1, 1, 0.2)
+ BtnPageLeft.IsEnabled = Page > 0
+ BtnPageLeft.Opacity = If(Page > 0, 1, 0.2)
+ Dim IsRightEnabled As Boolean = '由于 WPF 的未知 bug,读取到的 IsEnabled 可能是错误的值(#3319)
+ Storage.Results.Count > PageSize * (Page + 1) OrElse
+ Storage.CurseForgeOffset < Storage.CurseForgeTotal OrElse Storage.ModrinthOffset < Storage.ModrinthTotal
+ BtnPageRight.IsEnabled = IsRightEnabled
+ BtnPageRight.Opacity = If(IsRightEnabled, 1, 0.2)
+ '错误信息
+ If Storage.ErrorMessage Is Nothing Then
+ HintError.Visibility = Visibility.Collapsed
+ Else
+ HintError.Visibility = Visibility.Visible
+ HintError.Text = Storage.ErrorMessage
+ End If
+ '强制返回顶部
+ PanBack.ScrollToTop()
+ Catch ex As Exception
+ Log(ex, "可视化资源包列表出错", LogLevel.Feedback)
+ End Try
+ End Sub
+
+ '自动重试
+ Private Sub Load_State(sender As Object, state As MyLoading.MyLoadingState, oldState As MyLoading.MyLoadingState) Handles Load.StateChanged
+ Select Case Loader.State
+ Case LoadState.Failed
+ Dim ErrorMessage As String = ""
+ If Loader.Error IsNot Nothing Then ErrorMessage = Loader.Error.Message
+ If ErrorMessage.Contains("不是有效的 json 文件") Then
+ Log("[Download] 下载的资源包列表 json 文件损坏,已自动重试", LogLevel.Debug)
+ PageLoaderRestart()
+ End If
+ End Select
+ End Sub
+
+ '切换页码
+
+ Private Sub BtnPageFirst_Click(sender As Object, e As RoutedEventArgs) Handles BtnPageFirst.Click
+ ChangePage(0)
+ End Sub
+ Private Sub BtnPageLeft_Click(sender As Object, e As RoutedEventArgs) Handles BtnPageLeft.Click
+ ChangePage(Page - 1)
+ End Sub
+ Private Sub BtnPageRight_Click(sender As Object, e As RoutedEventArgs) Handles BtnPageRight.Click
+ ChangePage(Page + 1)
+ End Sub
+ Private Sub ChangePage(NewPage As Integer)
+ CardPages.IsEnabled = False
+ Page = NewPage
+ FrmMain.BackToTop()
+ Log($"[Download] 资源包切换到第 {Page + 1} 页")
+ RunInThread(Sub()
+ Thread.Sleep(100) '等待向上滚的动画结束
+ RunInUi(Sub() CardPages.IsEnabled = True)
+ Loader.Start()
+ End Sub)
+ End Sub
+
+#Region "搜索"
+
+ '搜索按钮
+ Private Sub StartNewSearch() Handles BtnSearchRun.Click
+ Page = 0
+ If Loader.ShouldStart(LoaderInput()) Then Storage = New CompProjectStorage '避免连续搜索两次使得 CompProjectStorage 引用丢失(#1311)
+ Loader.Start()
+ End Sub
+ Private Sub EnterTrigger(sender As Object, e As KeyEventArgs) Handles TextSearchName.KeyDown, TextSearchVersion.KeyDown
+ If e.Key = Key.Enter Then StartNewSearch()
+ End Sub
+
+ '重置按钮
+ Private Sub BtnSearchReset_Click(sender As Object, e As EventArgs) Handles BtnSearchReset.Click
+ TextSearchName.Text = ""
+ TextSearchVersion.Text = "全部 (也可自行输入)"
+ TextSearchVersion.SelectedIndex = 0
+ ComboSearchSource.SelectedIndex = 0
+ ComboSearchTag.SelectedIndex = 0
+ Loader.LastFinishedTime = 0 '要求强制重新开始
+ End Sub
+
+#End Region
+
+End Class
diff --git a/Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj b/Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
index 8246a859..16d31b47 100644
--- a/Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
+++ b/Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
@@ -185,9 +185,6 @@
MyIconTextButton.xaml
-
-
-
@@ -232,6 +229,9 @@
MyCompItem.xaml
+
+ PageDownloadResourcePack.xaml
+
PageDownloadMod.xaml
@@ -472,7 +472,6 @@
FormMain.xaml
Code
-
MSBuild:Compile
Designer
@@ -481,6 +480,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile
@@ -927,7 +930,6 @@
-