Skip to content

Commit 6e54821

Browse files
authored
feat(download): 修改 Mod Loader 手动安装包下载逻辑 (#1619)
* feat(download): 修改 Mod Loader 手动安装包下载逻辑 * chore: clean up unused code
1 parent 0e3055d commit 6e54821

File tree

4 files changed

+96
-256
lines changed

4 files changed

+96
-256
lines changed

Plain Craft Launcher 2/FormMain.xaml.vb

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,23 +1004,13 @@ Public Class FormMain
10041004
Public Enum PageSubType
10051005
[Default] = 0
10061006
DownloadInstall = 1
1007-
DownloadClient = 4
1008-
DownloadOptiFine = 5
1009-
DownloadForge = 6
1010-
DownloadNeoForge = 7
1011-
DownloadCleanroom = 16
1012-
DownloadFabric = 8
1013-
DownloadQuilt = 10
1014-
DownloadLiteLoader = 9
1015-
DownloadLabyMod = 20
1016-
DownloadLegacyFabric = 21
1017-
DownloadMod = 11
1018-
DownloadPack = 12
1019-
DownloadDataPack = 13
1020-
DownloadResourcePack = 14
1021-
DownloadShader = 15
1022-
DownloadCompFavorites = 17
1023-
DownloadWorld = 18
1007+
DownloadMod = 2
1008+
DownloadPack = 3
1009+
DownloadDataPack = 4
1010+
DownloadResourcePack = 5
1011+
DownloadShader = 6
1012+
DownloadWorld = 7
1013+
DownloadCompFavorites = 8
10241014
SetupLaunch = 0
10251015
SetupUI = 1
10261016
SetupSystem = 2

Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,9 +2109,21 @@ Retry:
21092109
.Logo = PathImage & "Blocks/Fabric.png"
21102110
}
21112111
AddHandler NewItem.Click, OnClick
2112+
NewItem.ContentHandler = AddressOf FabricContMenuBuild
21122113
'结束
21132114
Return NewItem
21142115
End Function
2116+
Private Sub FabricContMenuBuild(sender As Object, e As EventArgs)
2117+
Dim btnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
2118+
ToolTipService.SetPlacement(btnInfo, Primitives.PlacementMode.Center)
2119+
ToolTipService.SetVerticalOffset(btnInfo, 30)
2120+
ToolTipService.SetHorizontalOffset(btnInfo, 2)
2121+
AddHandler btnInfo.Click, AddressOf FabricLog_Click
2122+
sender.Buttons = {btnInfo}
2123+
End Sub
2124+
Private Sub FabricLog_Click(sender As Object, e As RoutedEventArgs)
2125+
OpenWebsite("https://fabricmc.net/blog")
2126+
End Sub
21152127
Public Function FabricApiDownloadListItem(Entry As CompFile, OnClick As MyListItem.ClickEventHandler) As MyListItem
21162128
'建立控件
21172129
Dim NewItem As New MyListItem With {
@@ -2252,9 +2264,21 @@ Retry:
22522264
.Logo = PathImage & "Blocks/Quilt.png"
22532265
}
22542266
AddHandler NewItem.Click, OnClick
2267+
NewItem.ContentHandler = AddressOf QuiltContMenuBuild
22552268
'结束
22562269
Return NewItem
22572270
End Function
2271+
Private Sub QuiltContMenuBuild(sender As Object, e As EventArgs)
2272+
Dim btnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
2273+
ToolTipService.SetPlacement(btnInfo, Primitives.PlacementMode.Center)
2274+
ToolTipService.SetVerticalOffset(btnInfo, 30)
2275+
ToolTipService.SetHorizontalOffset(btnInfo, 2)
2276+
AddHandler btnInfo.Click, AddressOf QuiltLog_Click
2277+
sender.Buttons = {btnInfo}
2278+
End Sub
2279+
Private Sub QuiltLog_Click(sender As Object, e As RoutedEventArgs)
2280+
OpenWebsite("https://quiltmc.org/en/blog/1/")
2281+
End Sub
22582282
Public Function QSLDownloadListItem(Entry As CompFile, OnClick As MyListItem.ClickEventHandler) As MyListItem
22592283
'建立控件
22602284
Dim NewItem As New MyListItem With {
@@ -2433,9 +2457,41 @@ Retry:
24332457
.Logo = PathImage & "Blocks/LabyMod.png"
24342458
}
24352459
AddHandler NewItem.Click, OnClick
2460+
NewItem.ContentHandler = AddressOf LabyModContMenuBuild
24362461
'结束
24372462
Return NewItem
24382463
End Function
2464+
Private Sub LabyModContMenuBuild(sender As Object, e As EventArgs)
2465+
Dim btnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
2466+
ToolTipService.SetPlacement(btnSave, Primitives.PlacementMode.Center)
2467+
ToolTipService.SetVerticalOffset(btnSave, 30)
2468+
ToolTipService.SetHorizontalOffset(btnSave, 2)
2469+
AddHandler btnSave.Click, AddressOf LabyModSave_Click
2470+
Dim btnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
2471+
ToolTipService.SetPlacement(btnInfo, Primitives.PlacementMode.Center)
2472+
ToolTipService.SetVerticalOffset(btnInfo, 30)
2473+
ToolTipService.SetHorizontalOffset(btnInfo, 2)
2474+
AddHandler btnInfo.Click, AddressOf LabyModLog_Click
2475+
sender.Buttons = {btnSave, btnInfo}
2476+
End Sub
2477+
Private Sub LabyModLog_Click(sender As Object, e As RoutedEventArgs)
2478+
OpenWebsite("https://www.labymod.net/zh_Hans/download")
2479+
End Sub
2480+
Private Sub LabyModSave_Click(sender As Object, e As RoutedEventArgs)
2481+
Dim version As JObject
2482+
If sender.Tag IsNot Nothing Then
2483+
version = sender.Tag
2484+
ElseIf sender.Parent.Tag IsNot Nothing Then
2485+
version = sender.Parent.Tag
2486+
Else
2487+
version = sender.Parent.Parent.Tag
2488+
End If
2489+
If version("channel") = "snapshot" Then
2490+
McDownloadLabyModSnapshotLoaderSave()
2491+
Else
2492+
McDownloadLabyModProductionLoaderSave()
2493+
End If
2494+
End Sub
24392495
#End Region
24402496

24412497
#Region "合并安装"

0 commit comments

Comments
 (0)