From 462f985cc3ab0f48129c78c654f096b3860394e9 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Sun, 4 Aug 2024 23:24:20 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 17 +++- .../Pages/PageVersion/PageVersionMod.xaml.vb | 98 +++++++++++++------ 2 files changed, 83 insertions(+), 32 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index 1915d096..766dd514 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -8,8 +8,7 @@ - - + @@ -23,8 +22,18 @@ - - + + + + + + + + + + + + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index c909f099..28350a98 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -125,9 +125,20 @@ ''' 刷新结果显示。 ''' Private Sub RefreshResult(Mods As List(Of McMod)) - PanList.Children.Clear() + PanDefaultList.Children.Clear() + PanDisabledList.Children.Clear() + PanUpdateList.Children.Clear() + PanUnavaliableList.Children.Clear() For Each TargetMod In Mods - PanList.Children.Add(ModItems(TargetMod.RawFileName)) + If TargetMod.CanUpdate Then + PanUpdateList.Children.Add(ModItems(TargetMod.RawFileName)) + ElseIf TargetMod.State.Equals(McMod.McModState.Fine) Then + PanDefaultList.Children.Add(ModItems(TargetMod.RawFileName)) + ElseIf TargetMod.State.Equals(McMod.McModState.Disabled) Then + PanDisabledList.Children.Add(ModItems(TargetMod.RawFileName)) + Else + PanUnavaliableList.Children.Add(ModItems(TargetMod.RawFileName)) + End If Next RefreshTitle() End Sub @@ -135,23 +146,23 @@ ''' 刷新卡片标题。 ''' Private Sub RefreshTitle() - Dim Mods = PanList.Children.Cast(Of MyLocalModItem).Select(Function(i) i.Entry).ToList - Dim Counter = {0, 0, 0} - For Each ModEntity As McMod In Mods - Counter(ModEntity.State) += 1 - Next - Dim TypeList As New List(Of String) - If Counter(McMod.McModState.Disabled) > 0 Then TypeList.Add("禁用 " & Counter(McMod.McModState.Disabled)) - If Counter(McMod.McModState.Unavaliable) > 0 Then TypeList.Add("错误 " & Counter(McMod.McModState.Unavaliable)) - If Counter(McMod.McModState.Fine) > 0 Then TypeList.Insert(0, If(TypeList.Any, "启用 ", "") & Counter(McMod.McModState.Fine)) + RefreshTargetTitle(PanDefaultListBack, PanDefaultList, "启用 Mod") + RefreshTargetTitle(PanUpdateListBack, PanUpdateList, "可更新 Mod") + RefreshTargetTitle(PanDisabledListBack, PanDisabledList, "禁用 Mod") + RefreshTargetTitle(PanUnavaliableListBack, PanUnavaliableList, "暂不可用 Mod") + End Sub + + Private Sub RefreshTargetTitle(Card As MyCard, List As StackPanel, Name As String) + Dim Mods = List.Children.Cast(Of MyLocalModItem).Select(Function(i) i.Entry).ToList If Not IsSearching Then - PanListBack.Title = "Mod 列表 (" & Join(TypeList, ",") & ")" - ElseIf TypeList.Any() Then - PanListBack.Title = "搜索结果 (" & Join(TypeList, ",") & ")" + Card.Title = Name & " 列表 (" & Mods.Count & ")" + ElseIf Mods.Any() Then + Card.Title = Name & " 列表搜索结果 (" & Mods.Count & ")" Else - PanListBack.Title = "无搜索结果" + Card.Title = Name & " 列表无搜索结果" End If - PanList.Visibility = If(Mods.Any(), Visibility.Visible, Visibility.Collapsed) + List.Visibility = If(Mods.Any(), Visibility.Visible, Visibility.Collapsed) + Card.CanSwap = If(Mods.Any(), True, False) End Sub #End Region @@ -192,7 +203,7 @@ ''' 全选。 ''' Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click - If SelectedMods.Count < PanList.Children.Count Then + If SelectedMods.Count < PanDefaultList.Children.Count + PanUnavaliableList.Children.Count + PanUpdateList.Children.Count + PanDisabledList.Children.Count Then ChangeAllSelected(True) Else ChangeAllSelected(False) @@ -301,14 +312,22 @@ Private Sub ChangeAllSelected(Value As Boolean) AniControlEnabled += 1 SelectedMods.Clear() - For Each Item As MyLocalModItem In PanList.Children - Item.Checked = Value - If Value Then SelectedMods.Add(Item.Entry.RawFileName) - Next + ChangeTargetListSeleted(PanUpdateList, Value) + ChangeTargetListSeleted(PanDisabledList, Value) + ChangeTargetListSeleted(PanUnavaliableList, Value) + ChangeTargetListSeleted(PanDefaultList, Value) AniControlEnabled -= 1 '更新下边栏 UI RefreshBottomBar() End Sub + + Private Sub ChangeTargetListSeleted(List As StackPanel, Value As Boolean) + For Each Item As MyLocalModItem In List.Children + Item.Checked = Value + If Value Then SelectedMods.Add(Item.Entry.RawFileName) + Next + End Sub + Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit Dim CacheAniControlEnabled = AniControlEnabled AniControlEnabled = 0 @@ -377,10 +396,27 @@ '更改 UI 中的列表 Dim NewItem As MyLocalModItem = McModListItem(NewModEntity) ModItems(ModEntity.RawFileName) = NewItem - Dim IndexOfUi As Integer = PanList.Children.IndexOf(PanList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) - If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 - PanList.Children.RemoveAt(IndexOfUi) - PanList.Children.Insert(IndexOfUi, NewItem) + If ModEntity.CanUpdate Then + Dim IndexOfUi As Integer = PanUpdateList.Children.IndexOf(PanUpdateList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) + If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 + PanUpdateList.Children.RemoveAt(IndexOfUi) + PanUpdateList.Children.Insert(IndexOfUi, NewItem) + ElseIf ModEntity.State.Equals(McMod.McModState.Fine) Then + Dim IndexOfUi As Integer = PanDefaultList.Children.IndexOf(PanDefaultList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) + If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 + PanDefaultList.Children.RemoveAt(IndexOfUi) + PanDefaultList.Children.Insert(IndexOfUi, NewItem) + ElseIf ModEntity.State.Equals(McMod.McModState.Disabled) Then + Dim IndexOfUi As Integer = PanDisabledList.Children.IndexOf(PanDisabledList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) + If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 + PanDisabledList.Children.RemoveAt(IndexOfUi) + PanDisabledList.Children.Insert(IndexOfUi, NewItem) + Else + Dim IndexOfUi As Integer = PanUnavaliableList.Children.IndexOf(PanUnavaliableList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) + If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 + PanUnavaliableList.Children.RemoveAt(IndexOfUi) + PanUnavaliableList.Children.Insert(IndexOfUi, NewItem) + End If Next RefreshTitle() '改变数量显示 If Not IsSuccessful Then @@ -549,14 +585,20 @@ '更改 Loader 和 UI 中的列表 McModLoader.Output.Remove(ModEntity) ModItems.Remove(ModEntity.RawFileName) - Dim IndexOfUi As Integer = PanList.Children.IndexOf(PanList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) - If IndexOfUi >= 0 Then PanList.Children.RemoveAt(IndexOfUi) + Dim IndexOfUi As Integer = PanDefaultList.Children.IndexOf(PanDefaultList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) + If IndexOfUi >= 0 Then PanDefaultList.Children.RemoveAt(IndexOfUi) + IndexOfUi = PanUpdateList.Children.IndexOf(PanUpdateList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) + If IndexOfUi >= 0 Then PanUpdateList.Children.RemoveAt(IndexOfUi) + IndexOfUi = PanDisabledList.Children.IndexOf(PanDisabledList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) + If IndexOfUi >= 0 Then PanDisabledList.Children.RemoveAt(IndexOfUi) + IndexOfUi = PanUnavaliableList.Children.IndexOf(PanUnavaliableList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) + If IndexOfUi >= 0 Then PanUnavaliableList.Children.RemoveAt(IndexOfUi) Next RefreshTitle() If Not IsSuccessful Then Hint("由于文件被占用,Mod 删除失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical) RefreshList(True) - ElseIf PanList.Children.Count = 0 Then + ElseIf PanDefaultList.Children.Count + PanUpdateList.Children.Count + PanDisabledList.Children.Count + PanUnavaliableList.Children.Count = 0 Then RefreshList(True) '删除了全部文件 Else RefreshBottomBar() From ebfed4243b49e7c66169f6a68bb80fd383949795 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 00:22:15 +0800 Subject: [PATCH 02/18] =?UTF-8?q?feat:=20=E9=80=82=E5=BD=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=9C=AC=E5=9C=B0=20Mod=20=E7=AE=A1=E7=90=86=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=B8=8E=E6=93=8D=E4=BD=9C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 4 ++-- .../Pages/PageVersion/PageVersionMod.xaml.vb | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index 766dd514..abae719b 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -8,7 +8,8 @@ - + + @@ -22,7 +23,6 @@ - diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 28350a98..7e720c0d 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -312,16 +312,17 @@ Private Sub ChangeAllSelected(Value As Boolean) AniControlEnabled += 1 SelectedMods.Clear() - ChangeTargetListSeleted(PanUpdateList, Value) - ChangeTargetListSeleted(PanDisabledList, Value) - ChangeTargetListSeleted(PanUnavaliableList, Value) - ChangeTargetListSeleted(PanDefaultList, Value) + ChangeTargetListSeleted(PanUpdateListBack, PanUpdateList, Value) + ChangeTargetListSeleted(PanDisabledListBack, PanDisabledList, Value) + ChangeTargetListSeleted(PanUnavaliableListBack, PanUnavaliableList, Value) + ChangeTargetListSeleted(PanDefaultListBack, PanDefaultList, Value) AniControlEnabled -= 1 '更新下边栏 UI RefreshBottomBar() End Sub - Private Sub ChangeTargetListSeleted(List As StackPanel, Value As Boolean) + Private Sub ChangeTargetListSeleted(Card As MyCard, List As StackPanel, Value As Boolean) + If Value.Equals(True) Then Card.IsSwaped = False For Each Item As MyLocalModItem In List.Children Item.Checked = Value If Value Then SelectedMods.Add(Item.Entry.RawFileName) @@ -435,6 +436,16 @@ ''' 记录正在进行 Mod 更新的 mods 文件夹路径。 ''' Public Shared UpdatingVersions As New List(Of String) + + Public Sub New() + + ' 此调用是设计器所必需的。 + InitializeComponent() + + ' 在 InitializeComponent() 调用之后添加任何初始化。 + + End Sub + Public Sub UpdateMods(ModList As IEnumerable(Of McMod)) '更新前警告 If Not Setup.Get("HintUpdateMod") Then From 591421393f350b7fffa772bbda722f6b640b16d3 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 00:31:52 +0800 Subject: [PATCH 03/18] =?UTF-8?q?fix:=20=E6=84=8F=E6=96=99=E4=B9=8B?= =?UTF-8?q?=E5=A4=96=E7=9A=84=E5=86=85=E5=AE=B9=E5=8A=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 7e720c0d..1a8ce340 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -437,15 +437,6 @@ ''' Public Shared UpdatingVersions As New List(Of String) - Public Sub New() - - ' 此调用是设计器所必需的。 - InitializeComponent() - - ' 在 InitializeComponent() 调用之后添加任何初始化。 - - End Sub - Public Sub UpdateMods(ModList As IEnumerable(Of McMod)) '更新前警告 If Not Setup.Get("HintUpdateMod") Then From d915cd48f6db3ba80976f11f8be5b21376cc0ff2 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 00:41:00 +0800 Subject: [PATCH 04/18] =?UTF-8?q?feat:=20=E6=97=A0=E5=8F=AF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20Mod=20=E6=97=B6=E9=9A=90=E8=97=8F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 1a8ce340..55e57995 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -146,14 +146,16 @@ ''' 刷新卡片标题。 ''' Private Sub RefreshTitle() - RefreshTargetTitle(PanDefaultListBack, PanDefaultList, "启用 Mod") + RefreshTargetTitle(PanDefaultListBack, PanDefaultList, "已启用 Mod") RefreshTargetTitle(PanUpdateListBack, PanUpdateList, "可更新 Mod") - RefreshTargetTitle(PanDisabledListBack, PanDisabledList, "禁用 Mod") + '没有可以更新的 Mod 就暂时隐藏卡片 + PanUpdateListBack.Visibility = If(PanUpdateList.Children.Count.Equals(0), Visibility.Collapsed, Visibility.Visible) + RefreshTargetTitle(PanDisabledListBack, PanDisabledList, "已禁用的 Mod") RefreshTargetTitle(PanUnavaliableListBack, PanUnavaliableList, "暂不可用 Mod") End Sub Private Sub RefreshTargetTitle(Card As MyCard, List As StackPanel, Name As String) - Dim Mods = List.Children.Cast(Of MyLocalModItem).Select(Function(i) i.Entry).ToList + Dim Mods = List.Children.Cast(Of MyLocalModItem).ToList If Not IsSearching Then Card.Title = Name & " 列表 (" & Mods.Count & ")" ElseIf Mods.Any() Then @@ -161,8 +163,11 @@ Else Card.Title = Name & " 列表无搜索结果" End If - List.Visibility = If(Mods.Any(), Visibility.Visible, Visibility.Collapsed) - Card.CanSwap = If(Mods.Any(), True, False) + Dim IsContainItem As Boolean = Mods.Any() + List.Visibility = If(IsContainItem, Visibility.Visible, Visibility.Collapsed) + 'CanSwap 设置无效果,不知道为什么 + Card.CanSwap = IsContainItem + Card.IsSwaped = Not IsContainItem End Sub #End Region From c0a966f21241186a2ec535de31f721e4a0943cd1 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 00:52:08 +0800 Subject: [PATCH 05/18] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8=E6=88=96?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=A8=A1=E7=BB=84=E6=B2=A1=E6=9C=89=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E5=85=B6=E6=89=80=E5=9C=A8=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 55e57995..d26b0886 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -407,16 +407,16 @@ If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 PanUpdateList.Children.RemoveAt(IndexOfUi) PanUpdateList.Children.Insert(IndexOfUi, NewItem) - ElseIf ModEntity.State.Equals(McMod.McModState.Fine) Then + ElseIf ModEntity.State.Equals(McMod.McModState.Fine) Then '启用 → 禁用 Dim IndexOfUi As Integer = PanDefaultList.Children.IndexOf(PanDefaultList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 PanDefaultList.Children.RemoveAt(IndexOfUi) - PanDefaultList.Children.Insert(IndexOfUi, NewItem) - ElseIf ModEntity.State.Equals(McMod.McModState.Disabled) Then + PanDisabledList.Children.Add(NewItem) + ElseIf ModEntity.State.Equals(McMod.McModState.Disabled) Then '禁用 → 启用 Dim IndexOfUi As Integer = PanDisabledList.Children.IndexOf(PanDisabledList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 PanDisabledList.Children.RemoveAt(IndexOfUi) - PanDisabledList.Children.Insert(IndexOfUi, NewItem) + PanDefaultList.Children.Add(NewItem) Else Dim IndexOfUi As Integer = PanUnavaliableList.Children.IndexOf(PanUnavaliableList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 From cfe925c667eb9010c24ca12d2de708c58dcbb35b Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 13:32:36 +0800 Subject: [PATCH 06/18] =?UTF-8?q?feat:=20=E6=94=B9=E6=88=90=E9=BE=99?= =?UTF-8?q?=E7=8C=AB=E6=83=B3=E8=A6=81=E7=9A=84=E6=A0=B7=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 23 ++- .../Pages/PageVersion/PageVersionMod.xaml.vb | 153 +++++++++--------- 2 files changed, 87 insertions(+), 89 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index abae719b..e1bf3947 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -7,7 +7,8 @@ - + + @@ -23,17 +24,15 @@ - - - - - - - - - - - + + + + + + + + + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index d26b0886..d311e087 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -25,6 +25,7 @@ ''' 刷新 Mod 列表。 ''' Public Sub RefreshList(Optional ForceReload As Boolean = False) + ViewModType = "All" If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then Log("[System] 已刷新 Mod 列表") PanBack.ScrollToHome() @@ -125,49 +126,68 @@ ''' 刷新结果显示。 ''' Private Sub RefreshResult(Mods As List(Of McMod)) - PanDefaultList.Children.Clear() - PanDisabledList.Children.Clear() - PanUpdateList.Children.Clear() - PanUnavaliableList.Children.Clear() - For Each TargetMod In Mods - If TargetMod.CanUpdate Then - PanUpdateList.Children.Add(ModItems(TargetMod.RawFileName)) - ElseIf TargetMod.State.Equals(McMod.McModState.Fine) Then - PanDefaultList.Children.Add(ModItems(TargetMod.RawFileName)) - ElseIf TargetMod.State.Equals(McMod.McModState.Disabled) Then - PanDisabledList.Children.Add(ModItems(TargetMod.RawFileName)) - Else - PanUnavaliableList.Children.Add(ModItems(TargetMod.RawFileName)) + Dim ShowMods As List(Of McMod) = New List(Of McMod) + Select Case ViewModType + Case "All" + ShowMods = Mods + Case "Enabled" + For Each Item In Mods + If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item) + Next + Case "Disabled" + For Each Item In Mods + If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item) + Next + Case "CanUpdate" + For Each Item In Mods + If Item.CanUpdate Then ShowMods.Add(Item) + Next + Case "Error" + For Each Item In Mods + If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item) + Next + End Select + PanList.Children.Clear() + For Each TargetMod In ShowMods + PanList.Children.Add(ModItems(TargetMod.RawFileName)) + Next + Dim ModEnabled As Integer = 0 + Dim ModDisabled As Integer = 0 + Dim ModCanUpdate As Integer = 0 + Dim ModError As Integer = 0 + For Each ModItem In ModItems + If ModItem.Value.Entry.CanUpdate Then + ModCanUpdate += 1 + End If + If ModItem.Value.Entry.State.Equals(McMod.McModState.Fine) Then + ModEnabled += 1 + End If + If ModItem.Value.Entry.State.Equals(McMod.McModState.Disabled) Then + ModDisabled += 1 + End If + If ModItem.Value.Entry.State.Equals(McMod.McModState.Unavaliable) Then + ModError += 1 End If Next + BtnTypeAll.Text = $"全部({ModEnabled + ModDisabled + ModCanUpdate + ModError})" + BtnTypeCanUpdate.Text = $"可更新({ModCanUpdate})" + BtnTypeEnabled.Text = $"已启用({ModEnabled})" + BtnTypeDisabled.Text = $"已禁用({ModDisabled})" + BtnTypeError.Text = $"错误({ModError})" RefreshTitle() End Sub ''' ''' 刷新卡片标题。 ''' Private Sub RefreshTitle() - RefreshTargetTitle(PanDefaultListBack, PanDefaultList, "已启用 Mod") - RefreshTargetTitle(PanUpdateListBack, PanUpdateList, "可更新 Mod") - '没有可以更新的 Mod 就暂时隐藏卡片 - PanUpdateListBack.Visibility = If(PanUpdateList.Children.Count.Equals(0), Visibility.Collapsed, Visibility.Visible) - RefreshTargetTitle(PanDisabledListBack, PanDisabledList, "已禁用的 Mod") - RefreshTargetTitle(PanUnavaliableListBack, PanUnavaliableList, "暂不可用 Mod") - End Sub - - Private Sub RefreshTargetTitle(Card As MyCard, List As StackPanel, Name As String) - Dim Mods = List.Children.Cast(Of MyLocalModItem).ToList If Not IsSearching Then - Card.Title = Name & " 列表 (" & Mods.Count & ")" - ElseIf Mods.Any() Then - Card.Title = Name & " 列表搜索结果 (" & Mods.Count & ")" + PanListBack.Title = "Mod 列表 (" & PanList.Children.Count & ")" + ElseIf PanList.Children.Count > 0 Then + PanListBack.Title = "搜索结果 (" & PanList.Children.Count & ")" Else - Card.Title = Name & " 列表无搜索结果" + PanListBack.Title = "无搜索结果" End If - Dim IsContainItem As Boolean = Mods.Any() - List.Visibility = If(IsContainItem, Visibility.Visible, Visibility.Collapsed) - 'CanSwap 设置无效果,不知道为什么 - Card.CanSwap = IsContainItem - Card.IsSwaped = Not IsContainItem + PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed) End Sub #End Region @@ -208,7 +228,7 @@ ''' 全选。 ''' Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click - If SelectedMods.Count < PanDefaultList.Children.Count + PanUnavaliableList.Children.Count + PanUpdateList.Children.Count + PanDisabledList.Children.Count Then + If SelectedMods.Count < PanList.Children.Count Then ChangeAllSelected(True) Else ChangeAllSelected(False) @@ -317,23 +337,14 @@ Private Sub ChangeAllSelected(Value As Boolean) AniControlEnabled += 1 SelectedMods.Clear() - ChangeTargetListSeleted(PanUpdateListBack, PanUpdateList, Value) - ChangeTargetListSeleted(PanDisabledListBack, PanDisabledList, Value) - ChangeTargetListSeleted(PanUnavaliableListBack, PanUnavaliableList, Value) - ChangeTargetListSeleted(PanDefaultListBack, PanDefaultList, Value) - AniControlEnabled -= 1 - '更新下边栏 UI - RefreshBottomBar() - End Sub - - Private Sub ChangeTargetListSeleted(Card As MyCard, List As StackPanel, Value As Boolean) - If Value.Equals(True) Then Card.IsSwaped = False - For Each Item As MyLocalModItem In List.Children + For Each Item As MyLocalModItem In PanList.Children Item.Checked = Value If Value Then SelectedMods.Add(Item.Entry.RawFileName) Next + AniControlEnabled -= 1 + '更新下边栏 UI + RefreshBottomBar() End Sub - Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit Dim CacheAniControlEnabled = AniControlEnabled AniControlEnabled = 0 @@ -344,6 +355,17 @@ If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeAllSelected(True) End Sub + Private ViewModType As String = "All" + + Private Sub ChangeViewType(sender As MyTextButton, e As EventArgs) Handles BtnTypeAll.Click, BtnTypeCanUpdate.Click, BtnTypeDisabled.Click, BtnTypeEnabled.Click, BtnTypeError.Click + ViewModType = sender.Tag + If IsSearching Then + SearchRun() + Else + RefreshResult(McModLoader.Output) + End If + End Sub + #End Region #Region "下边栏" @@ -353,6 +375,7 @@ EDMods(McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)), Not sender.Equals(BtnSelectDisable)) ChangeAllSelected(False) + RefreshResult(McModLoader.Output) End Sub Private Sub EDMods(ModList As IEnumerable(Of McMod), IsEnable As Boolean) Dim IsSuccessful As Boolean = True @@ -402,27 +425,10 @@ '更改 UI 中的列表 Dim NewItem As MyLocalModItem = McModListItem(NewModEntity) ModItems(ModEntity.RawFileName) = NewItem - If ModEntity.CanUpdate Then - Dim IndexOfUi As Integer = PanUpdateList.Children.IndexOf(PanUpdateList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) - If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 - PanUpdateList.Children.RemoveAt(IndexOfUi) - PanUpdateList.Children.Insert(IndexOfUi, NewItem) - ElseIf ModEntity.State.Equals(McMod.McModState.Fine) Then '启用 → 禁用 - Dim IndexOfUi As Integer = PanDefaultList.Children.IndexOf(PanDefaultList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) - If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 - PanDefaultList.Children.RemoveAt(IndexOfUi) - PanDisabledList.Children.Add(NewItem) - ElseIf ModEntity.State.Equals(McMod.McModState.Disabled) Then '禁用 → 启用 - Dim IndexOfUi As Integer = PanDisabledList.Children.IndexOf(PanDisabledList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) - If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 - PanDisabledList.Children.RemoveAt(IndexOfUi) - PanDefaultList.Children.Add(NewItem) - Else - Dim IndexOfUi As Integer = PanUnavaliableList.Children.IndexOf(PanUnavaliableList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) - If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 - PanUnavaliableList.Children.RemoveAt(IndexOfUi) - PanUnavaliableList.Children.Insert(IndexOfUi, NewItem) - End If + Dim IndexOfUi As Integer = PanList.Children.IndexOf(PanList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry Is ModEntity)) + If IndexOfUi = -1 Then Continue For '因为未知原因 Mod 的状态已经切换完了 + PanList.Children.RemoveAt(IndexOfUi) + PanList.Children.Insert(IndexOfUi, NewItem) Next RefreshTitle() '改变数量显示 If Not IsSuccessful Then @@ -441,7 +447,6 @@ ''' 记录正在进行 Mod 更新的 mods 文件夹路径。 ''' Public Shared UpdatingVersions As New List(Of String) - Public Sub UpdateMods(ModList As IEnumerable(Of McMod)) '更新前警告 If Not Setup.Get("HintUpdateMod") Then @@ -592,20 +597,14 @@ '更改 Loader 和 UI 中的列表 McModLoader.Output.Remove(ModEntity) ModItems.Remove(ModEntity.RawFileName) - Dim IndexOfUi As Integer = PanDefaultList.Children.IndexOf(PanDefaultList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) - If IndexOfUi >= 0 Then PanDefaultList.Children.RemoveAt(IndexOfUi) - IndexOfUi = PanUpdateList.Children.IndexOf(PanUpdateList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) - If IndexOfUi >= 0 Then PanUpdateList.Children.RemoveAt(IndexOfUi) - IndexOfUi = PanDisabledList.Children.IndexOf(PanDisabledList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) - If IndexOfUi >= 0 Then PanDisabledList.Children.RemoveAt(IndexOfUi) - IndexOfUi = PanUnavaliableList.Children.IndexOf(PanUnavaliableList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) - If IndexOfUi >= 0 Then PanUnavaliableList.Children.RemoveAt(IndexOfUi) + Dim IndexOfUi As Integer = PanList.Children.IndexOf(PanList.Children.OfType(Of MyLocalModItem).FirstOrDefault(Function(i) i.Entry.Equals(ModEntity))) + If IndexOfUi >= 0 Then PanList.Children.RemoveAt(IndexOfUi) Next RefreshTitle() If Not IsSuccessful Then Hint("由于文件被占用,Mod 删除失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical) RefreshList(True) - ElseIf PanDefaultList.Children.Count + PanUpdateList.Children.Count + PanDisabledList.Children.Count + PanUnavaliableList.Children.Count = 0 Then + ElseIf PanList.Children.Count = 0 Then RefreshList(True) '删除了全部文件 Else RefreshBottomBar() From 7cbdca12f30fdf466237c9aa5af3fda39eea38a0 Mon Sep 17 00:00:00 2001 From: tangge233 <50769997+tangge233@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:51:12 +0800 Subject: [PATCH 07/18] Apply suggestions from 3gf8jv4dv Co-authored-by: 3gf8jv4dv <158490944+3gf8jv4dv@users.noreply.github.com> --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index d311e087..6159ee0a 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -169,11 +169,11 @@ ModError += 1 End If Next - BtnTypeAll.Text = $"全部({ModEnabled + ModDisabled + ModCanUpdate + ModError})" - BtnTypeCanUpdate.Text = $"可更新({ModCanUpdate})" - BtnTypeEnabled.Text = $"已启用({ModEnabled})" - BtnTypeDisabled.Text = $"已禁用({ModDisabled})" - BtnTypeError.Text = $"错误({ModError})" + BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModCanUpdate + ModError})" + BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate})" + BtnTypeEnabled.Text = $"已启用 ({ModEnabled})" + BtnTypeDisabled.Text = $"已禁用 ({ModDisabled})" + BtnTypeError.Text = $"错误 ({ModError})" RefreshTitle() End Sub ''' From 3e06ea450228979e82200d07c5408272f57e9cc6 Mon Sep 17 00:00:00 2001 From: tangge233 <50769997+tangge233@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:37:30 +0800 Subject: [PATCH 08/18] =?UTF-8?q?fix:=20=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 6159ee0a..0d0bb0a6 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -169,7 +169,7 @@ ModError += 1 End If Next - BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModCanUpdate + ModError})" + BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModError})" BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate})" BtnTypeEnabled.Text = $"已启用 ({ModEnabled})" BtnTypeDisabled.Text = $"已禁用 ({ModDisabled})" From d2ef7d79898794c0bce3d71ed6199eb08b3df224 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 18:15:16 +0800 Subject: [PATCH 09/18] =?UTF-8?q?feat:=20=E5=8A=A0=E4=B8=AA=E5=88=86?= =?UTF-8?q?=E5=89=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index e1bf3947..f759c210 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -26,11 +26,15 @@ - - - - - + + + + + + + + + From 0007a0ac729cb598ef3e9b9eacc658ed987379f8 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 18:57:52 +0800 Subject: [PATCH 10/18] =?UTF-8?q?fix:=20=E5=85=A8=E9=80=89=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=97=AE=E9=A2=98=E3=80=81UI=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 20 ++++++++--------- .../Pages/PageVersion/PageVersionMod.xaml.vb | 22 ++++++++++++++++--- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index f759c210..2fe0e909 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -25,16 +25,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 0d0bb0a6..8726044a 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -229,9 +229,9 @@ ''' Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click If SelectedMods.Count < PanList.Children.Count Then - ChangeAllSelected(True) + ChangeCurrentSelected(True) Else - ChangeAllSelected(False) + ChangeCurrentSelected(False) End If End Sub @@ -337,7 +337,7 @@ Private Sub ChangeAllSelected(Value As Boolean) AniControlEnabled += 1 SelectedMods.Clear() - For Each Item As MyLocalModItem In PanList.Children + For Each Item As MyLocalModItem In ModItems.Values.ToList Item.Checked = Value If Value Then SelectedMods.Add(Item.Entry.RawFileName) Next @@ -345,6 +345,22 @@ '更新下边栏 UI RefreshBottomBar() End Sub + + Private Sub ChangeCurrentSelected(Value As Boolean) + AniControlEnabled += 1 + For Each Item As MyLocalModItem In PanList.Children + Item.Checked = Value + If Value Then + If Not SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Add(Item.Entry.RawFileName) + Else + If SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Remove(Item.Entry.RawFileName) + End If + Next + AniControlEnabled -= 1 + '更新下边栏 UI + RefreshBottomBar() + End Sub + Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit Dim CacheAniControlEnabled = AniControlEnabled AniControlEnabled = 0 From 8972aec56af3c1af1f35c1cd8d75ed27ff9b94a5 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 19:20:28 +0800 Subject: [PATCH 11/18] =?UTF-8?q?feat:=20Mod=20=E7=AE=A1=E7=90=86=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 8726044a..42d6052e 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -181,12 +181,24 @@ ''' Private Sub RefreshTitle() If Not IsSearching Then - PanListBack.Title = "Mod 列表 (" & PanList.Children.Count & ")" + PanListBack.Title = "Mod 列表 - " ElseIf PanList.Children.Count > 0 Then - PanListBack.Title = "搜索结果 (" & PanList.Children.Count & ")" + PanListBack.Title = "搜索结果 - " Else - PanListBack.Title = "无搜索结果" + PanListBack.Title = "无搜索结果 - " End If + Select Case ViewModType + Case "All" + PanListBack.Title += BtnTypeAll.Text + Case "Enabled" + PanListBack.Title += BtnTypeEnabled.Text + Case "Disabled" + PanListBack.Title += BtnTypeDisabled.Text + Case "CanUpdate" + PanListBack.Title += BtnTypeCanUpdate.Text + Case "Error" + PanListBack.Title += BtnTypeError.Text + End Select PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed) End Sub From f9c4e5a75202826c880c2b30fb8a7ca6f9c305b2 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 19:53:45 +0800 Subject: [PATCH 12/18] =?UTF-8?q?fix:=20Ctrl+A=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=B8=8D=E5=90=88=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 42d6052e..34336e29 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -380,7 +380,7 @@ AniControlEnabled += CacheAniControlEnabled End Sub Private Sub PageVersionMod_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown - If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeAllSelected(True) + If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True) End Sub Private ViewModType As String = "All" From eca89febf6bd215fd6033dc524d37a9a8df17d1b Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 23:34:49 +0800 Subject: [PATCH 13/18] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=20MyRadioButto?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 12 ++++++------ .../Pages/PageVersion/PageVersionMod.xaml.vb | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index 2fe0e909..5177eee4 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -25,16 +25,16 @@ - - + + - + - + - + - + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 34336e29..b55339d7 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -169,11 +169,11 @@ ModError += 1 End If Next - BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModError})" - BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate})" - BtnTypeEnabled.Text = $"已启用 ({ModEnabled})" - BtnTypeDisabled.Text = $"已禁用 ({ModDisabled})" - BtnTypeError.Text = $"错误 ({ModError})" + BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModError}) " + BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate}) " + BtnTypeEnabled.Text = $"已启用 ({ModEnabled}) " + BtnTypeDisabled.Text = $"已禁用 ({ModDisabled}) " + BtnTypeError.Text = $"错误 ({ModError}) " RefreshTitle() End Sub ''' @@ -385,7 +385,7 @@ Private ViewModType As String = "All" - Private Sub ChangeViewType(sender As MyTextButton, e As EventArgs) Handles BtnTypeAll.Click, BtnTypeCanUpdate.Click, BtnTypeDisabled.Click, BtnTypeEnabled.Click, BtnTypeError.Click + Private Sub ChangeViewType(sender As MyRadioButton, raiseByMouse As Boolean) Handles BtnTypeAll.Check, BtnTypeCanUpdate.Check, BtnTypeDisabled.Check, BtnTypeEnabled.Check, BtnTypeError.Check ViewModType = sender.Tag If IsSearching Then SearchRun() From 9fe1471f8eb667025a3778b3ab6e3fa3c8262bd2 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Mon, 5 Aug 2024 23:43:31 +0800 Subject: [PATCH 14/18] =?UTF-8?q?fix:=20=E7=94=A8=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml | 10 ++--- .../Pages/PageVersion/PageVersionMod.xaml.vb | 37 +++++++++++++------ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index 5177eee4..bc6770e5 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -26,15 +26,15 @@ - + - + - + - + - + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index b55339d7..3700f22b 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -4,6 +4,11 @@ Private IsLoad As Boolean = False Public Sub PageOther_Loaded() Handles Me.Loaded + BtnTypeAll.Tag = ViewType.All + BtnTypeEnabled.Tag = ViewType.Enabled + BtnTypeDisabled.Tag = ViewType.Disabled + BtnTypeCanUpdate.Tag = ViewType.CanUpdate + BtnTypeError.Tag = ViewType.InError If FrmMain.PageLast.Page <> FormMain.PageType.CompDetail Then PanBack.ScrollToHome() AniControlEnabled += 1 @@ -25,7 +30,7 @@ ''' 刷新 Mod 列表。 ''' Public Sub RefreshList(Optional ForceReload As Boolean = False) - ViewModType = "All" + ViewModType = ViewType.All If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then Log("[System] 已刷新 Mod 列表") PanBack.ScrollToHome() @@ -128,21 +133,21 @@ Private Sub RefreshResult(Mods As List(Of McMod)) Dim ShowMods As List(Of McMod) = New List(Of McMod) Select Case ViewModType - Case "All" + Case ViewType.All ShowMods = Mods - Case "Enabled" + Case ViewType.Enabled For Each Item In Mods If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item) Next - Case "Disabled" + Case ViewType.Disabled For Each Item In Mods If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item) Next - Case "CanUpdate" + Case ViewType.CanUpdate For Each Item In Mods If Item.CanUpdate Then ShowMods.Add(Item) Next - Case "Error" + Case ViewType.InError For Each Item In Mods If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item) Next @@ -188,15 +193,15 @@ PanListBack.Title = "无搜索结果 - " End If Select Case ViewModType - Case "All" + Case ViewType.All PanListBack.Title += BtnTypeAll.Text - Case "Enabled" + Case ViewType.Enabled PanListBack.Title += BtnTypeEnabled.Text - Case "Disabled" + Case ViewType.Disabled PanListBack.Title += BtnTypeDisabled.Text - Case "CanUpdate" + Case ViewType.CanUpdate PanListBack.Title += BtnTypeCanUpdate.Text - Case "Error" + Case ViewType.InError PanListBack.Title += BtnTypeError.Text End Select PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed) @@ -383,7 +388,15 @@ If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True) End Sub - Private ViewModType As String = "All" + Private ViewModType As ViewType = ViewType.All + + Private Enum ViewType As Integer + All + Enabled + Disabled + CanUpdate + InError + End Enum Private Sub ChangeViewType(sender As MyRadioButton, raiseByMouse As Boolean) Handles BtnTypeAll.Check, BtnTypeCanUpdate.Check, BtnTypeDisabled.Check, BtnTypeEnabled.Check, BtnTypeError.Check ViewModType = sender.Tag From 7721db131b693e5f56fc1837cfc343b17f67ffb8 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Tue, 6 Aug 2024 11:03:57 +0800 Subject: [PATCH 15/18] =?UTF-8?q?fix:=20=E5=88=B7=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=90=8E=E5=85=A8=E9=83=A8=E9=80=89=E9=A1=B9=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=20Checked=20=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 3700f22b..1bba288a 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -31,6 +31,7 @@ ''' Public Sub RefreshList(Optional ForceReload As Boolean = False) ViewModType = ViewType.All + BtnTypeAll.Checked = True If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then Log("[System] 已刷新 Mod 列表") PanBack.ScrollToHome() From 76adffffad2417e4ff07c55af142de9e1dad9dbb Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Tue, 6 Aug 2024 11:58:37 +0800 Subject: [PATCH 16/18] =?UTF-8?q?fix:=20=E9=AC=BC=E7=9F=A5=E9=81=93?= =?UTF-8?q?=E4=B8=BA=E4=BB=80=E4=B9=88=E6=B2=A1=E6=9C=89=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml | 2 +- Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml index bc6770e5..d5b72852 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml @@ -25,7 +25,7 @@ - + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 1bba288a..f742d572 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -132,6 +132,7 @@ ''' 刷新结果显示。 ''' Private Sub RefreshResult(Mods As List(Of McMod)) + If PanList Is Nothing Then Exit Sub Dim ShowMods As List(Of McMod) = New List(Of McMod) Select Case ViewModType Case ViewType.All From 53743495ecd7a30e57fbd7f4951eaa04ca0fae38 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Tue, 6 Aug 2024 20:34:04 +0800 Subject: [PATCH 17/18] =?UTF-8?q?fix:=20=E5=85=A8=E9=80=89=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index f742d572..0018d007 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -247,7 +247,11 @@ ''' 全选。 ''' Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click - If SelectedMods.Count < PanList.Children.Count Then + Dim CurrentSelected As Integer = 0 + For Each Item In PanList.Children.OfType(Of MyLocalModItem).ToList + If Item.Checked Then CurrentSelected += 1 + Next + If CurrentSelected < PanList.Children.Count Then ChangeCurrentSelected(True) Else ChangeCurrentSelected(False) From 05dc7a2650ba9017a34ac50d5857f19b3ac70b79 Mon Sep 17 00:00:00 2001 From: tangge233 <2697992791@qq.com> Date: Thu, 15 Aug 2024 17:03:41 +0800 Subject: [PATCH 18/18] =?UTF-8?q?fix:=20=E7=AA=97=E5=8F=A3=E9=87=8D?= =?UTF-8?q?=E8=8E=B7=E7=84=A6=E7=82=B9=E5=90=8E=E7=AD=9B=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E8=A2=AB=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageVersion/PageVersionMod.xaml.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb index 0018d007..ce3e8cfc 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb @@ -30,10 +30,10 @@ ''' 刷新 Mod 列表。 ''' Public Sub RefreshList(Optional ForceReload As Boolean = False) - ViewModType = ViewType.All - BtnTypeAll.Checked = True If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then Log("[System] 已刷新 Mod 列表") + ViewModType = ViewType.All + BtnTypeAll.Checked = True PanBack.ScrollToHome() SearchBox.Text = "" End If