Skip to content

Commit

Permalink
feat: 修改界面
Browse files Browse the repository at this point in the history
  • Loading branch information
tangge233 committed Oct 12, 2024
1 parent f1ed80e commit 72d84ab
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 6 deletions.
1 change: 1 addition & 0 deletions Plain Craft Launcher 2/FormMain.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ Install:
DownloadLiteLoader = 9
DownloadMod = 11
DownloadPack = 12
DownloadCompFavorites = 13
SetupLaunch = 0
SetupUI = 1
SetupSystem = 2
Expand Down
1 change: 1 addition & 0 deletions Plain Craft Launcher 2/Modules/ModMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ EndHint:
Public FrmDownloadFabric As PageDownloadFabric
Public FrmDownloadMod As PageDownloadMod
Public FrmDownloadPack As PageDownloadPack
Public FrmDownloadCompFavorites As PageDownloadCompFavorites

'设置页面声明
Public FrmSetupLeft As PageSetupLeft
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<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="PageDownloadCompFavorites"
PanScroll="{Binding ElementName=PanBack}">
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
<StackPanel Orientation="Vertical" Margin="25">
<StackPanel x:Name="PanContent">
<local:MySearchBox HintText="搜索收藏夹内容" x:Name="PanSearchBox" Margin="0,0,0,15"/>

<local:MyCard x:Name="CardProjectsMod" Title="Mod" UseAnimation="False" Margin="0,0,0,15">
<StackPanel x:Name="PanProjectsMod" Margin="12" />
</local:MyCard>
<local:MyCard x:Name="CardProjectsModpack" Title="整合包" UseAnimation="False" Margin="0,0,0,15">
<StackPanel x:Name="PanProjectsModpack" Margin="12" />
</local:MyCard>

<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>
</StackPanel>
</local:MyScrollViewer>
</local:MyPageRight>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Public Class PageDownloadCompFavorites

Public Const PageSize = 40

'加载器信息
Public Shared Loader As New LoaderTask(Of String, Integer)("CompProject Mod", AddressOf CompFavoritesGet, AddressOf LoaderInput)
Public Shared Storage As New CompProjectStorage

Private Sub PageDownloadMod_Inited(sender As Object, e As EventArgs) Handles Me.Initialized
PageLoaderInit(Load, PanLoad, PanContent, Nothing, Loader, AddressOf Load_OnFinish, AddressOf LoaderInput)
End Sub
Private Shared Function LoaderInput() As String
Return ReadReg("CustomCompFavorites")
End Function
Private Shared Function CompFavoritesGet(Task As LoaderTask(Of String, Integer))

End Function

'结果 UI 化
Private Sub Load_OnFinish()
Try

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] 下载的 Mod 列表 json 文件损坏,已自动重试", LogLevel.Debug)
PageLoaderRestart()
End If
End Select
End Sub


#Region "搜索"

'搜索按钮
Private Sub StartNewSearch() Handles PanSearchBox.TextInput
Loader.Start()
End Sub

#End Region

End Class
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,14 @@
</local:MyListItem.Buttons>
</local:MyListItem>

<local:MyListItem x:Name="ItemFavorites" Type="RadioBox" IsScaleAnimationEnabled="False" Tag="13" MinPaddingRight="35" Height="36" VerticalAlignment="Top" Title="收藏夹"
LogoScale="0.85" Logo="M192 308.864v-25.728c0-6.16 4.976-11.136 11.136-11.136h601.728c6.16 0 11.136 4.976 11.136 11.136v25.728a11.136 11.136 0 0 1-11.136 11.136H203.136a11.136 11.136 0 0 1-11.136-11.136z m0 208v-25.728c0-6.16 4.976-11.136 11.136-11.136h217.728c6.16 0 11.136 4.976 11.136 11.136v25.728a11.136 11.136 0 0 1-11.136 11.136H203.136a11.136 11.136 0 0 1-11.136-11.136z m554.032 76.832c10.48-10.112 16.368-23.488 16.368-37.696 0-29.776-26-54.4-58.624-54.4-22.72 0-42.928 12.08-52.672 30.512a21.6 21.6 0 0 1-38.208 0c-9.744-18.432-29.952-30.512-52.672-30.512-32.64 0-58.624 24.624-58.624 54.4 0 14.176 5.856 27.52 16.288 37.616 1.296 1.264 2.4 2.624 3.312 4.064l107.248 108.096 115.6-109.92c0.608-0.736 1.264-1.472 1.984-2.16zM458.4 556c0-54.176 45.84-97.6 101.824-97.6 27.472 0 53.072 10.544 71.776 28.352a104.016 104.016 0 0 1 71.776-28.352c55.984 0 101.824 43.424 101.824 97.6a95.136 95.136 0 0 1-26.96 66.176 22.24 22.24 0 0 1-2.496 2.784l-133.264 126.688a21.6 21.6 0 0 1-30.208-0.432l-125.696-126.688a21.984 21.984 0 0 1-3.12-3.968 95.024 95.024 0 0 1-25.456-64.56zM192 724.864v-25.728c0-6.16 4.976-11.136 11.136-11.136h217.728c6.16 0 11.136 4.976 11.136 11.136v25.728a11.136 11.136 0 0 1-11.136 11.136H203.136a11.136 11.136 0 0 1-11.136-11.136z">
<local:MyListItem.Buttons>
<x:Array Type="{x:Type local:MyIconButton}">
<local:MyIconButton Tag="13" 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>
</local:MyPageLeft>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
''' <summary>
''' 勾选事件改变页面。
''' </summary>
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, ItemFavorites.Check
'尚未初始化控件属性时,sender.Tag 为 Nothing,会导致切换到页面 0
'若使用 IsLoaded,则会导致模拟点击不被执行(模拟点击切换页面时,控件的 IsLoaded 为 False)
If sender.Tag IsNot Nothing Then PageChange(Val(sender.Tag))
Expand Down Expand Up @@ -46,6 +46,9 @@
Case FormMain.PageSubType.DownloadPack
If FrmDownloadPack Is Nothing Then FrmDownloadPack = New PageDownloadPack
Return FrmDownloadPack
Case FormMain.PageSubType.DownloadCompFavorites
If FrmDownloadCompFavorites Is Nothing Then FrmDownloadCompFavorites = New PageDownloadCompFavorites
Return FrmDownloadCompFavorites
Case Else
Throw New Exception("未知的下载子页面种类:" & ID)
End Select
Expand Down
12 changes: 7 additions & 5 deletions Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@
<Compile Include="Controls\MyIconTextButton.xaml.vb">
<DependentUpon>MyIconTextButton.xaml</DependentUpon>
</Compile>



<Compile Include="Modules\Minecraft\ModComp.vb" />
<Compile Include="Modules\Minecraft\ModJava.vb" />
<Compile Include="Modules\Minecraft\ModMod.vb" />
Expand Down Expand Up @@ -238,6 +235,9 @@
<Compile Include="Modules\Minecraft\MyCompItem.xaml.vb">
<DependentUpon>MyCompItem.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\PageDownload\PageDownloadCompFavorites.xaml.vb">
<DependentUpon>PageDownloadCompFavorites.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\PageDownload\PageDownloadMod.xaml.vb">
<DependentUpon>PageDownloadMod.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -478,7 +478,6 @@
<DependentUpon>FormMain.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>

<Page Include="Modules\Minecraft\MyLocalModItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -487,6 +486,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\PageDownload\PageDownloadCompFavorites.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\PageDownload\PageDownloadMod.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -913,7 +916,6 @@
<Resource Include="Images\Heads\MCBBS.png" />
</ItemGroup>
<ItemGroup>

</ItemGroup>
<ItemGroup>
<Resource Include="Images\Blocks\NeoForge.png" />
Expand Down

0 comments on commit 72d84ab

Please sign in to comment.