feat: 支持下载资源包
This commit is contained in:
@@ -1023,6 +1023,7 @@ Install:
|
|||||||
DownloadLiteLoader = 8
|
DownloadLiteLoader = 8
|
||||||
DownloadMod = 10
|
DownloadMod = 10
|
||||||
DownloadPack = 11
|
DownloadPack = 11
|
||||||
|
DownloadResourcePack = 12
|
||||||
SetupLaunch = 0
|
SetupLaunch = 0
|
||||||
SetupUI = 1
|
SetupUI = 1
|
||||||
SetupSystem = 2
|
SetupSystem = 2
|
||||||
@@ -1058,8 +1059,10 @@ Install:
|
|||||||
Return "Mod 下载 - " & Project.TranslatedName
|
Return "Mod 下载 - " & Project.TranslatedName
|
||||||
Case CompType.ModPack
|
Case CompType.ModPack
|
||||||
Return "整合包下载 - " & Project.TranslatedName
|
Return "整合包下载 - " & Project.TranslatedName
|
||||||
Case Else 'CompType.ResourcePack
|
Case CompType.ResourcePack
|
||||||
Return "资源包下载 - " & Project.TranslatedName
|
Return "资源包下载 - " & Project.TranslatedName
|
||||||
|
Case Else 'CompType.ShaderPack
|
||||||
|
Return "光影包下载 - " & Project.TranslatedName
|
||||||
End Select
|
End Select
|
||||||
Case PageType.HelpDetail
|
Case PageType.HelpDetail
|
||||||
Dim Entry As HelpEntry = Stack.Additional(0)
|
Dim Entry As HelpEntry = Stack.Additional(0)
|
||||||
|
|||||||
@@ -321,7 +321,24 @@
|
|||||||
Case 4480 : Tags.Add("基于地图")
|
Case 4480 : Tags.Add("基于地图")
|
||||||
Case 4481 : Tags.Add("轻量")
|
Case 4481 : Tags.Add("轻量")
|
||||||
Case 4482 : 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
|
End Select
|
||||||
Next
|
Next
|
||||||
If Not Tags.Any() Then Tags.Add("杂项")
|
If Not Tags.Any() Then Tags.Add("杂项")
|
||||||
@@ -387,7 +404,37 @@
|
|||||||
Case "adventure" : Tags.Add("冒险")
|
Case "adventure" : Tags.Add("冒险")
|
||||||
Case "kitchen-sink" : Tags.Add("烹饪")
|
Case "kitchen-sink" : Tags.Add("烹饪")
|
||||||
Case "lightweight" : 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
|
End Select
|
||||||
Next
|
Next
|
||||||
If Not Tags.Any() Then Tags.Add("杂项")
|
If Not Tags.Any() Then Tags.Add("杂项")
|
||||||
@@ -749,7 +796,7 @@ NoSubtitle:
|
|||||||
Case CompType.ModPack
|
Case CompType.ModPack
|
||||||
Address += "&classId=4471"
|
Address += "&classId=4471"
|
||||||
Case CompType.ResourcePack
|
Case CompType.ResourcePack
|
||||||
'FUTURE: Res
|
Address += "&classId=12"
|
||||||
End Select
|
End Select
|
||||||
Address += "&categoryId=" & If(Tag = "", "0", Tag.Before("/"))
|
Address += "&categoryId=" & If(Tag = "", "0", Tag.Before("/"))
|
||||||
If ModLoader <> CompModLoaderType.Any Then Address += "&modLoaderType=" & CType(ModLoader, Integer)
|
If ModLoader <> CompModLoaderType.Any Then Address += "&modLoaderType=" & CType(ModLoader, Integer)
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ EndHint:
|
|||||||
Public FrmDownloadFabric As PageDownloadFabric
|
Public FrmDownloadFabric As PageDownloadFabric
|
||||||
Public FrmDownloadMod As PageDownloadMod
|
Public FrmDownloadMod As PageDownloadMod
|
||||||
Public FrmDownloadPack As PageDownloadPack
|
Public FrmDownloadPack As PageDownloadPack
|
||||||
|
Public FrmDownloadResourcePack As PageDownloadResourcePack
|
||||||
|
|
||||||
'设置页面声明
|
'设置页面声明
|
||||||
Public FrmSetupLeft As PageSetupLeft
|
Public FrmSetupLeft As PageSetupLeft
|
||||||
|
|||||||
@@ -76,6 +76,14 @@
|
|||||||
</x:Array>
|
</x:Array>
|
||||||
</local:MyListItem.Buttons>
|
</local:MyListItem.Buttons>
|
||||||
</local:MyListItem>
|
</local:MyListItem>
|
||||||
|
<local:MyListItem x:Name="ItemResourcePack" Type="RadioBox" IsScaleAnimationEnabled="False" Tag="12" MinPaddingRight="35" Height="36" VerticalAlignment="Top" Title="资源包"
|
||||||
|
LogoScale="0.98" Logo="M511.488 995.328a128.654222 128.654222 0 0 1-57.116444-13.112889L70.769778 791.808a126.833778 126.833778 0 0 1-70.769778-113.777778V311.608889a126.179556 126.179556 0 0 1 15.36-60.103111V248.604444c1.479111-2.901333 3.356444-5.603556 5.518222-8.021333a127.630222 127.630222 0 0 1 49.891556-42.325333L454.371556 13.368889a128.739556 128.739556 0 0 1 112.981333 0l383.601778 190.407111a126.862222 126.862222 0 0 1 72.049777 113.379556v360.874666a126.805333 126.805333 0 0 1-70.769777 115.939556L568.604444 984.32c-17.92 7.964444-37.461333 11.747556-57.116444 11.008z m42.638222-470.897778v370.204445l360.192-178.545778c14.449778-7.253333 23.552-21.987556 23.438222-38.087111v-335.928889L554.097778 524.430222zM85.248 330.666667v347.335111a42.268444 42.268444 0 0 0 23.438222 38.087111l360.192 178.545778V523.576889L85.248 330.666667zM135.537778 260.835556l375.950222 189.952 137.671111-65.564445L286.435556 188.074667 135.537778 260.864z m245.105778-118.471112l363.576888 197.973334 150.897778-71.480889-365.283555-180.224a42.922667 42.922667 0 0 0-37.518223 0l-111.672888 53.731555z">
|
||||||
|
<local:MyListItem.Buttons>
|
||||||
|
<x:Array Type="{x:Type local:MyIconButton}">
|
||||||
|
<local:MyIconButton Tag="12" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||||
|
</x:Array>
|
||||||
|
</local:MyListItem.Buttons>
|
||||||
|
</local:MyListItem>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</local:MyPageLeft>
|
</local:MyPageLeft>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
''' <summary>
|
''' <summary>
|
||||||
''' 勾选事件改变页面。
|
''' 勾选事件改变页面。
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub PageCheck(sender As MyListItem, e As RouteEventArgs) Handles ItemInstall.Check, ItemClient.Check, ItemOptiFine.Check, ItemForge.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, ItemLiteLoader.Check, ItemMod.Check, ItemFabric.Check, ItemPack.Check, ItemResourcePack.Check
|
||||||
'尚未初始化控件属性时,sender.Tag 为 Nothing,会导致切换到页面 0
|
'尚未初始化控件属性时,sender.Tag 为 Nothing,会导致切换到页面 0
|
||||||
'若使用 IsLoaded,则会导致模拟点击不被执行(模拟点击切换页面时,控件的 IsLoaded 为 False)
|
'若使用 IsLoaded,则会导致模拟点击不被执行(模拟点击切换页面时,控件的 IsLoaded 为 False)
|
||||||
If sender.Tag IsNot Nothing Then PageChange(Val(sender.Tag))
|
If sender.Tag IsNot Nothing Then PageChange(Val(sender.Tag))
|
||||||
@@ -43,6 +43,9 @@
|
|||||||
Case FormMain.PageSubType.DownloadPack
|
Case FormMain.PageSubType.DownloadPack
|
||||||
If FrmDownloadPack Is Nothing Then FrmDownloadPack = New PageDownloadPack
|
If FrmDownloadPack Is Nothing Then FrmDownloadPack = New PageDownloadPack
|
||||||
Return FrmDownloadPack
|
Return FrmDownloadPack
|
||||||
|
Case FormMain.PageSubType.DownloadResourcePack
|
||||||
|
If FrmDownloadResourcePack Is Nothing Then FrmDownloadResourcePack = New PageDownloadResourcePack
|
||||||
|
Return FrmDownloadResourcePack
|
||||||
Case Else
|
Case Else
|
||||||
Throw New Exception("未知的下载子页面种类:" & ID)
|
Throw New Exception("未知的下载子页面种类:" & ID)
|
||||||
End Select
|
End Select
|
||||||
@@ -108,6 +111,12 @@
|
|||||||
CompProjectCache.Clear()
|
CompProjectCache.Clear()
|
||||||
If FrmDownloadPack IsNot Nothing Then FrmDownloadPack.PageLoaderRestart()
|
If FrmDownloadPack IsNot Nothing Then FrmDownloadPack.PageLoaderRestart()
|
||||||
ItemPack.Checked = True
|
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
|
Case FormMain.PageSubType.DownloadClient
|
||||||
DlClientListLoader.Start(IsForceRestart:=True)
|
DlClientListLoader.Start(IsForceRestart:=True)
|
||||||
ItemClient.Checked = True
|
ItemClient.Checked = True
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<local:MyPageRight
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" x:Class="PageDownloadResourcePack"
|
||||||
|
PanScroll="{Binding ElementName=PanBack}">
|
||||||
|
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
|
||||||
|
<StackPanel Orientation="Vertical" Margin="25">
|
||||||
|
<local:MyCard Title="搜索资源包" Margin="0,0,0,15" x:Name="PanAlways">
|
||||||
|
<StackPanel Margin="25,40,25,15">
|
||||||
|
<Grid Margin="0,0,0,11" HorizontalAlignment="Stretch">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="1.3*" />
|
||||||
|
<ColumnDefinition Width="1.2*" />
|
||||||
|
<ColumnDefinition Width="50" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="9" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="名称" Margin="0,0,18,0" />
|
||||||
|
<local:MyTextBox x:Name="TextSearchName" Grid.Column="1" Grid.ColumnSpan="2" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Grid.Column="4" HorizontalAlignment="Left" Text="来源" Margin="0,0,18,0" />
|
||||||
|
<local:MyComboBox x:Name="ComboSearchSource" Grid.Column="5">
|
||||||
|
<local:MyComboBoxItem Content="全部" Tag="3" IsSelected="True" />
|
||||||
|
<local:MyComboBoxItem Content="CurseForge" Tag="1" />
|
||||||
|
<local:MyComboBoxItem Content="Modrinth" Tag="2" />
|
||||||
|
</local:MyComboBox>
|
||||||
|
<TextBlock VerticalAlignment="Center" Grid.Row="2" HorizontalAlignment="Left" Text="版本" Margin="0,0,18,0" />
|
||||||
|
<local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" IsEditable="True" MaxDropDownHeight="320">
|
||||||
|
<local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
|
||||||
|
<local:MyComboBoxItem Content="1.20.6" />
|
||||||
|
<local:MyComboBoxItem Content="1.20.4" />
|
||||||
|
<local:MyComboBoxItem Content="1.20.1" />
|
||||||
|
<local:MyComboBoxItem Content="1.19.4" />
|
||||||
|
<local:MyComboBoxItem Content="1.19.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.18.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.17.1" />
|
||||||
|
<local:MyComboBoxItem Content="1.16.5" />
|
||||||
|
<local:MyComboBoxItem Content="1.15.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.14.4" />
|
||||||
|
<local:MyComboBoxItem Content="1.12.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.11.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.10.2" />
|
||||||
|
<local:MyComboBoxItem Content="1.8.9" />
|
||||||
|
<local:MyComboBoxItem Content="1.7.10" />
|
||||||
|
</local:MyComboBox>
|
||||||
|
<TextBlock VerticalAlignment="Center" Grid.Column="4" Grid.Row="2" HorizontalAlignment="Left" Text="类型" Margin="0,0,18,0" />
|
||||||
|
<local:MyComboBox x:Name="ComboSearchTag" Grid.Column="5" Grid.Row="2" MaxDropDownHeight="320">
|
||||||
|
<local:MyComboBoxItem Content="全部" Tag="" IsSelected="True" />
|
||||||
|
<local:MyComboBoxItem Content="字体包" Tag="5244/" />
|
||||||
|
<local:MyComboBoxItem Content="数据包" Tag="5193/" />
|
||||||
|
<local:MyComboBoxItem Content="蒸汽朋克" Tag="399/" />
|
||||||
|
<local:MyComboBoxItem Content="128x" Tag="396/" />
|
||||||
|
<local:MyComboBoxItem Content="512x 或更高" Tag="398/" />
|
||||||
|
<local:MyComboBoxItem Content="256x" Tag="397/" />
|
||||||
|
<local:MyComboBoxItem Content="其他" Tag="405/" />
|
||||||
|
<local:MyComboBoxItem Content="64x" Tag="395/" />
|
||||||
|
<local:MyComboBoxItem Content="仿真" Tag="400/" />
|
||||||
|
<local:MyComboBoxItem Content="16x" Tag="393/" />
|
||||||
|
<local:MyComboBoxItem Content="传统" Tag="403/" />
|
||||||
|
<local:MyComboBoxItem Content="32x" Tag="394/" />
|
||||||
|
<local:MyComboBoxItem Content="动态效果" Tag="404/" />
|
||||||
|
<local:MyComboBoxItem Content="模组支持" Tag="4465/" />
|
||||||
|
<local:MyComboBoxItem Content="中世纪" Tag="402/" />
|
||||||
|
<local:MyComboBoxItem Content="现代" Tag="401/" />
|
||||||
|
|
||||||
|
<local:MyComboBoxItem Content="8x-" Tag="/8x-" />
|
||||||
|
<local:MyComboBoxItem Content="16x" Tag="/16x" />
|
||||||
|
<local:MyComboBoxItem Content="32x" Tag="/32x" />
|
||||||
|
<local:MyComboBoxItem Content="48x" Tag="/48x" />
|
||||||
|
<local:MyComboBoxItem Content="64x" Tag="/64x" />
|
||||||
|
<local:MyComboBoxItem Content="128x" Tag="/128x" />
|
||||||
|
<local:MyComboBoxItem Content="256x" Tag="/256x" />
|
||||||
|
<local:MyComboBoxItem Content="512x+" Tag="/512x+" />
|
||||||
|
<local:MyComboBoxItem Content="声音" Tag="/audio" />
|
||||||
|
<local:MyComboBoxItem Content="方块" Tag="/blocks" />
|
||||||
|
<local:MyComboBoxItem Content="战斗" Tag="/combat" />
|
||||||
|
<local:MyComboBoxItem Content="核心着色器" Tag="/core-shaders" />
|
||||||
|
<local:MyComboBoxItem Content="Cursed" Tag="/cursed" />
|
||||||
|
<local:MyComboBoxItem Content="装饰" Tag="/decoration" />
|
||||||
|
<local:MyComboBoxItem Content="实体" Tag="/entities" />
|
||||||
|
<local:MyComboBoxItem Content="环境" Tag="/environment" />
|
||||||
|
<local:MyComboBoxItem Content="装备" Tag="/equipment" />
|
||||||
|
<local:MyComboBoxItem Content="字体" Tag="/fonts" />
|
||||||
|
<local:MyComboBoxItem Content="GUI" Tag="/gui" />
|
||||||
|
<local:MyComboBoxItem Content="物品" Tag="/items" />
|
||||||
|
<local:MyComboBoxItem Content="本地化" Tag="/locale" />
|
||||||
|
<local:MyComboBoxItem Content="Modded" Tag="/modded" />
|
||||||
|
<local:MyComboBoxItem Content="模型" Tag="/models" />
|
||||||
|
<local:MyComboBoxItem Content="写实" Tag="/realistic" />
|
||||||
|
<local:MyComboBoxItem Content="扁平" Tag="/simplistic" />
|
||||||
|
<local:MyComboBoxItem Content="主题" Tag="/themed" />
|
||||||
|
<local:MyComboBoxItem Content="优化" Tag="/tweaks" />
|
||||||
|
<local:MyComboBoxItem Content="实用" Tag="/utility" />
|
||||||
|
<local:MyComboBoxItem Content="类原生" Tag="/vanilla-like" />
|
||||||
|
</local:MyComboBox>
|
||||||
|
</Grid>
|
||||||
|
<Grid Margin="0,4,0,6" Height="35">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<local:MyButton x:Name="BtnSearchRun" Text="搜索" MinWidth="140" Padding="13,0" Margin="0,0,20,0" ColorType="Highlight" />
|
||||||
|
<local:MyButton x:Name="BtnSearchReset" Text="重置条件" MinWidth="140" Padding="13,0" Margin="0,0,20,0" Grid.Column="1" />
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</local:MyCard>
|
||||||
|
<StackPanel x:Name="PanContent">
|
||||||
|
<local:MyHint x:Name="HintError" Text="无法连接到 Modrinth,所以目前仅显示了来自 CurseForge 的内容,结果可能不全。
请尝试使用 VPN 或加速器以改善网络。" IsWarn="True" Margin="0,0,0,15" />
|
||||||
|
<local:MyCard x:Name="CardProjects" UseAnimation="False">
|
||||||
|
<StackPanel x:Name="PanProjects" Margin="12" />
|
||||||
|
</local:MyCard>
|
||||||
|
<local:MyCard Margin="0,15,0,0" x:Name="CardPages" HorizontalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal" Height="23" Margin="10,7">
|
||||||
|
<local:MyIconButton x:Name="BtnPageFirst" IsEnabled="False" Opacity="0.2" Margin="0,0.5,5,0.5"
|
||||||
|
Logo="M496.213333 329.856L315.306667 510.848l180.992 181.077333a42.666667 42.666667 0 1 1-60.330667 60.330667l-211.2-211.2a42.453333 42.453333 0 0 1-11.818667-22.613333l-0.597333-5.034667v-5.034667a42.496 42.496 0 0 1 12.373333-27.648l211.2-211.2a42.666667 42.666667 0 0 1 60.373334 60.330667z m298.666667 0l-180.949333 180.992 180.992 181.077333a42.666667 42.666667 0 1 1-60.330667 60.330667l-211.2-211.2a42.453333 42.453333 0 0 1-11.818667-22.613333l-0.597333-5.034667v-5.034667a42.496 42.496 0 0 1 12.373333-27.648l211.2-211.2a42.666667 42.666667 0 0 1 60.373334 60.330667z" />
|
||||||
|
<local:MyIconButton x:Name="BtnPageLeft" IsEnabled="False" Opacity="0.2" Margin="0,0,5,0"
|
||||||
|
Logo="M650.752 278.357333l-241.322667 241.365334 241.322667 241.365333a42.666667 42.666667 0 1 1-60.330667 60.330667l-271.530666-271.530667a42.453333 42.453333 0 0 1-11.818667-22.613333l-0.597333-5.034667v-5.034667a42.496 42.496 0 0 1 12.416-27.648l271.530666-271.530666a42.666667 42.666667 0 0 1 60.330667 60.330666z" />
|
||||||
|
<TextBlock x:Name="LabPage" Text="1"
|
||||||
|
Margin="8,0,13,0" FontSize="15" VerticalAlignment="Center" Foreground="{DynamicResource ColorBrush3}" />
|
||||||
|
<local:MyIconButton x:Name="BtnPageRight" Margin="0,0,30,0"
|
||||||
|
Logo="M404.309333 278.357333l241.322667 241.365334-241.322667 241.365333a42.666667 42.666667 0 1 0 60.330667 60.330667l271.530667-271.530667a42.453333 42.453333 0 0 0 11.818666-22.613333l0.597334-5.034667v-5.034667a42.496 42.496 0 0 0-12.416-27.648L464.64 218.026667a42.666667 42.666667 0 0 0-60.330667 60.330666z" />
|
||||||
|
</StackPanel>
|
||||||
|
</local:MyCard>
|
||||||
|
</StackPanel>
|
||||||
|
<local:MyCard HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True" x:Name="PanLoad" UseAnimation="False" Margin="40,50">
|
||||||
|
<local:MyLoading Text="正在获取资源包列表" Margin="20,20,20,17" x:Name="Load" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</local:MyCard>
|
||||||
|
</StackPanel>
|
||||||
|
</local:MyScrollViewer>
|
||||||
|
</local:MyPageRight>
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
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(BtnPageFirst.IsEnabled, 1, 0.2)
|
||||||
|
BtnPageLeft.IsEnabled = Page > 0
|
||||||
|
BtnPageLeft.Opacity = If(BtnPageLeft.IsEnabled, 1, 0.2)
|
||||||
|
BtnPageRight.IsEnabled = Storage.Results.Count > PageSize * (Page + 1) OrElse
|
||||||
|
Storage.CurseForgeOffset < Storage.CurseForgeTotal OrElse Storage.ModrinthOffset < Storage.ModrinthTotal
|
||||||
|
BtnPageRight.Opacity = If(BtnPageRight.IsEnabled, 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
|
||||||
@@ -185,9 +185,6 @@
|
|||||||
<Compile Include="Controls\MyIconTextButton.xaml.vb">
|
<Compile Include="Controls\MyIconTextButton.xaml.vb">
|
||||||
<DependentUpon>MyIconTextButton.xaml</DependentUpon>
|
<DependentUpon>MyIconTextButton.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Compile Include="Modules\Minecraft\ModComp.vb" />
|
<Compile Include="Modules\Minecraft\ModComp.vb" />
|
||||||
<Compile Include="Modules\Minecraft\ModJava.vb" />
|
<Compile Include="Modules\Minecraft\ModJava.vb" />
|
||||||
<Compile Include="Modules\Minecraft\ModMod.vb" />
|
<Compile Include="Modules\Minecraft\ModMod.vb" />
|
||||||
@@ -232,6 +229,9 @@
|
|||||||
<Compile Include="Modules\Minecraft\MyCompItem.xaml.vb">
|
<Compile Include="Modules\Minecraft\MyCompItem.xaml.vb">
|
||||||
<DependentUpon>MyCompItem.xaml</DependentUpon>
|
<DependentUpon>MyCompItem.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Pages\PageDownload\PageDownloadResourcePack.xaml.vb">
|
||||||
|
<DependentUpon>PageDownloadResourcePack.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Pages\PageDownload\PageDownloadMod.xaml.vb">
|
<Compile Include="Pages\PageDownload\PageDownloadMod.xaml.vb">
|
||||||
<DependentUpon>PageDownloadMod.xaml</DependentUpon>
|
<DependentUpon>PageDownloadMod.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -469,7 +469,6 @@
|
|||||||
<DependentUpon>FormMain.xaml</DependentUpon>
|
<DependentUpon>FormMain.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
||||||
<Page Include="Modules\Minecraft\MyLocalModItem.xaml">
|
<Page Include="Modules\Minecraft\MyLocalModItem.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -478,6 +477,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Pages\PageDownload\PageDownloadResourcePack.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Pages\PageDownload\PageDownloadMod.xaml">
|
<Page Include="Pages\PageDownload\PageDownloadMod.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -921,7 +924,6 @@
|
|||||||
<Resource Include="Images\Heads\MCBBS.png" />
|
<Resource Include="Images\Heads\MCBBS.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
|
|||||||
Reference in New Issue
Block a user