Skip to content

Commit 3b8de89

Browse files
committed
2.6.8
1 parent f18ede2 commit 3b8de89

28 files changed

+613
-449
lines changed

Plain Craft Launcher 2/Application.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
<Setter Property="Template">
134134
<Setter.Value>
135135
<ControlTemplate>
136-
<Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1.5" CornerRadius="4" MaxWidth="500" Background="#E5FFFFFF" Margin="0,0,4,4" SnapsToDevicePixels="True">
136+
<Border Loaded="TooltipLoaded" Unloaded="TooltipUnloaded" BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1.5" CornerRadius="4" MaxWidth="500" Background="#E5FFFFFF" Margin="0,0,4,4" SnapsToDevicePixels="True">
137137
<Border.Effect>
138138
<DropShadowEffect Opacity="0.3" BlurRadius="4" ShadowDepth="2" Color="{DynamicResource ColorObject1}" />
139139
</Border.Effect>
@@ -147,7 +147,7 @@
147147
<Setter Property="Template">
148148
<Setter.Value>
149149
<ControlTemplate>
150-
<Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
150+
<Border Loaded="TooltipLoaded" Unloaded="TooltipUnloaded" BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
151151
<TextBlock Text="{TemplateBinding ContentControl.Content}" TextWrapping="Wrap" Foreground="{DynamicResource ColorBrush1}" Margin="7,5" FontSize="12"/>
152152
</Border>
153153
</ControlTemplate>

Plain Craft Launcher 2/Application.xaml.vb

+8
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,12 @@ Public Class Application
247247
End Select
248248
End Sub
249249

250+
Public Shared ShowingTooltips As New List(Of Border)
251+
Private Sub TooltipLoaded(sender As Border, e As EventArgs)
252+
ShowingTooltips.Add(sender)
253+
End Sub
254+
Private Sub TooltipUnloaded(sender As Border, e As RoutedEventArgs)
255+
ShowingTooltips.Remove(sender)
256+
End Sub
257+
250258
End Class

Plain Craft Launcher 2/Controls/MyCard.vb

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
End Sub
4242
Private IsLoad As Boolean = False
4343
Private Sub MyCard_Loaded() Handles Me.Loaded
44-
'卡片的进入时动画已被页面通用切换动画替代
45-
'If LoadAnimation AndAlso IsLoad Then
46-
' StartHeightAnimation(Math.Min(50, ActualHeight), ActualHeight - Math.Min(50, ActualHeight), True)
47-
'End If
4844
If IsLoad Then Exit Sub
4945
'初次加载限定
5046
If Not Title = "" AndAlso IsNothing(MainTextBlock) Then

Plain Craft Launcher 2/Controls/MyExtraButton.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Opacity="0.2" />
1717
</Border.Effect>
1818
</Border>
19-
<Border x:Name="PanProgress" CornerRadius="1000" BorderThickness="0.001" Background="#2AFFFFFF" ClipToBounds="True" Visibility="Collapsed">
19+
<Border x:Name="PanProgress" CornerRadius="1000" BorderThickness="0.001" Background="#2FFFFFFF" ClipToBounds="True" Visibility="Collapsed">
2020
<Border.Clip>
21-
<RectangleGeometry x:Name="RectProgress" Rect="0,0,40,25" />
21+
<RectangleGeometry x:Name="RectProgress" Rect="0,5,40,35" />
2222
</Border.Clip>
2323
</Border>
2424
<Path x:Name="Path" Stretch="Uniform" Margin="12" Fill="{DynamicResource ColorBrush8}" RenderTransformOrigin="0.5,0.5">

Plain Craft Launcher 2/Controls/MyExtraButton.xaml.vb

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
PanProgress.Visibility = Visibility.Collapsed
1818
Else
1919
PanProgress.Visibility = Visibility.Visible
20-
RectProgress.Rect = New Rect(0, 0, 40, 40 * (1 - value))
20+
RectProgress.Rect = New Rect(0, 40 * (1 - value), 40, 40 * value)
2121
End If
2222
End Set
2323
End Property
@@ -179,7 +179,7 @@
179179

180180
AniStop("MyExtraButton Color " & Uuid)
181181
If IsMouseOver Then
182-
PanColor.SetResourceReference(BackgroundProperty, "ColorBrush2")
182+
PanColor.SetResourceReference(BackgroundProperty, "ColorBrush4")
183183
Else
184184
PanColor.SetResourceReference(BackgroundProperty, "ColorBrush3")
185185
End If

Plain Craft Launcher 2/Controls/MyPageLeft.vb

+27-21
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,28 @@
2929
'逐个进入动画
3030
Dim AniList As New List(Of AniData)
3131
Dim Id As Integer = 0, Delay As Integer = 0
32-
Dim Controls = GetAllAnimControls()
33-
For Each Element As FrameworkElement In Controls
34-
Element.Opacity = 0
35-
Element.RenderTransform = New TranslateTransform(-25, 0)
36-
AniList.Add(AaOpacity(Element, If(TypeOf Element Is TextBlock, 0.6, 1), 200, Delay, New AniEaseOutFluent(AniEasePower.Weak)))
37-
AniList.Add(AaTranslateX(Element, 5, 200, Delay, New AniEaseOutFluent))
38-
AniList.Add(AaTranslateX(Element, 20, 300, Delay, New AniEaseOutBack(AniEasePower.Weak)))
39-
If TypeOf Element Is MyListItem Then
40-
AniList.Add(AaCode(Sub()
41-
CType(Element, MyListItem).IsMouseOverAnimationEnabled = True
42-
CType(Element, MyListItem).RefreshColor(Me, New EventArgs)
43-
End Sub, Delay + 280))
32+
For Each Element As FrameworkElement In GetAllAnimControls(True)
33+
If Element.Visibility = Visibility.Collapsed Then
34+
'还原之前的隐藏动画可能导致的改变(#2436)
35+
Element.Opacity = 1
36+
Element.RenderTransform = New TranslateTransform(0, 0)
37+
If TypeOf Element Is MyListItem Then CType(Element, MyListItem).IsMouseOverAnimationEnabled = True
38+
Else
39+
Element.Opacity = 0
40+
Element.RenderTransform = New TranslateTransform(-25, 0)
41+
If TypeOf Element Is MyListItem Then CType(Element, MyListItem).IsMouseOverAnimationEnabled = False
42+
AniList.Add(AaOpacity(Element, If(TypeOf Element Is TextBlock, 0.6, 1), 200, Delay, New AniEaseOutFluent(AniEasePower.Weak)))
43+
AniList.Add(AaTranslateX(Element, 5, 200, Delay, New AniEaseOutFluent))
44+
AniList.Add(AaTranslateX(Element, 20, 300, Delay, New AniEaseOutBack(AniEasePower.Weak)))
45+
If TypeOf Element Is MyListItem Then
46+
AniList.Add(AaCode(Sub()
47+
CType(Element, MyListItem).IsMouseOverAnimationEnabled = True
48+
CType(Element, MyListItem).RefreshColor(Me, New EventArgs)
49+
End Sub, Delay + 280))
50+
End If
51+
Delay += Math.Max(8, 20 - Id) * 2.5
52+
Id += 1
4453
End If
45-
Delay += Math.Max(8, 20 - Id) * 2.5
46-
Id += 1
4754
Next
4855
AniStart(AniList, "PageLeft PageChange " & Uuid)
4956
End If
@@ -74,23 +81,22 @@
7481
End Sub
7582

7683
'遍历获取所有需要生成动画的控件
77-
Private Function GetAllAnimControls() As List(Of FrameworkElement)
84+
Private Function GetAllAnimControls(Optional IgnoreInvisibility As Boolean = False) As List(Of FrameworkElement)
7885
Dim AllControls As New List(Of FrameworkElement)
79-
GetAllAnimControls(AnimatedControl, AllControls)
86+
GetAllAnimControls(AnimatedControl, AllControls, IgnoreInvisibility)
8087
Return AllControls
8188
End Function
82-
Private Sub GetAllAnimControls(Element As FrameworkElement, ByRef AllControls As List(Of FrameworkElement))
83-
If Element.Visibility = Visibility.Collapsed Then Exit Sub
89+
Private Sub GetAllAnimControls(Element As FrameworkElement, ByRef AllControls As List(Of FrameworkElement), IgnoreInvisibility As Boolean)
90+
If Not IgnoreInvisibility AndAlso Element.Visibility = Visibility.Collapsed Then Exit Sub
8491
If TypeOf Element Is MyTextButton Then
8592
AllControls.Add(Element)
8693
ElseIf TypeOf Element Is MyListItem Then
87-
CType(Element, MyListItem).IsMouseOverAnimationEnabled = False
8894
AllControls.Add(Element)
8995
ElseIf TypeOf Element Is ContentControl Then
90-
GetAllAnimControls(CType(Element, ContentControl).Content, AllControls)
96+
GetAllAnimControls(CType(Element, ContentControl).Content, AllControls, IgnoreInvisibility)
9197
ElseIf TypeOf Element Is Panel Then
9298
For Each Element2 As FrameworkElement In CType(Element, Panel).Children
93-
GetAllAnimControls(Element2, AllControls)
99+
GetAllAnimControls(Element2, AllControls, IgnoreInvisibility)
94100
Next
95101
Else
96102
AllControls.Add(Element)

Plain Craft Launcher 2/Controls/MyScrollViewer.vb

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
'如果当前是在对有滚动条的下拉框或文本框执行,则不接管操作
1616
Exit Sub
1717
End If
18-
PerformVerticalOffsetDelta(-e.Delta)
1918
e.Handled = True
19+
PerformVerticalOffsetDelta(-e.Delta)
20+
'关闭 Tooltip (#2552)
21+
For Each TooltipBorder In Application.ShowingTooltips
22+
AniStart(AaOpacity(TooltipBorder, -1, 100), $"Hide Tooltip {GetUuid()}")
23+
Next
2024
End Sub
2125
Public Sub PerformVerticalOffsetDelta(Delta As Double)
2226
AniStart(AaDouble(Sub(AnimDelta As Double)

Plain Craft Launcher 2/FormMain.xaml.vb

+24
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Public Class FormMain
1010
Dim FeatureList As New List(Of KeyValuePair(Of Integer, String))
1111
'统计更新日志条目
1212
#If BETA Then
13+
If LastVersion < 304 Then 'Release 2.6.8
14+
FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复开始或结束游戏时可能报错的 Bug"))
15+
FeatureCount += 20
16+
BugCount += 25
17+
End If
1318
If LastVersion < 302 Then 'Release 2.6.7
1419
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "再次修复网络条件差时可能无法下载 MC 的 Bug"))
1520
BugCount += 1
@@ -128,6 +133,11 @@ Public Class FormMain
128133
'3:BUG+ IMP* FEAT-
129134
'2:BUG* IMP-
130135
'1:BUG-
136+
If LastVersion < 305 Then 'Snapshot 2.6.8
137+
FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复开始或结束游戏时可能报错的 Bug"))
138+
FeatureCount += 20
139+
BugCount += 25
140+
End If
131141
If LastVersion < 303 Then 'Snapshot 2.6.7
132142
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "再次修复网络条件差时可能无法下载 MC 的 Bug"))
133143
BugCount += 1
@@ -331,6 +341,7 @@ Public Class FormMain
331341
End Sub
332342

333343
'窗口加载
344+
Private Declare Auto Function ChangeWindowMessageFilterEx Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal message As UInt32, ByVal action As UInt32, ByVal changeInfo As UInt32) As Boolean
334345
Private IsWindowLoadFinished As Boolean = False
335346
''' <summary>
336347
''' 是否为联机提权后自动重启。
@@ -442,6 +453,7 @@ Public Class FormMain
442453
TimerMainStartRun()
443454
'加载池
444455
RunInNewThread(Sub()
456+
'EULA 提示
445457
If Not Setup.Get("SystemEula") Then
446458
Select Case MyMsgBox("在使用 PCL 前,请同意 PCL 的用户协议与免责声明。", "协议授权", "同意", "拒绝", "查看用户协议与免责声明",
447459
Button3Action:=Sub() OpenWebsite("https://shimo.im/docs/rGrd8pY8xWkt6ryW"))
@@ -451,6 +463,7 @@ Public Class FormMain
451463
EndProgram(False)
452464
End Select
453465
End If
466+
'启动加载器池
454467
Try
455468
JavaListInit() '延后到同意协议后再执行,避免在初次启动时进行进程操作
456469
Thread.Sleep(200)
@@ -460,11 +473,22 @@ Public Class FormMain
460473
Catch ex As Exception
461474
Log(ex, "初始化加载池运行失败", LogLevel.Feedback)
462475
End Try
476+
'清理自动更新文件
463477
Try
464478
If File.Exists(Path & "PCL\Plain Craft Launcher 2.exe") Then File.Delete(Path & "PCL\Plain Craft Launcher 2.exe")
465479
Catch ex As Exception
466480
Log(ex, "清理自动更新文件失败")
467481
End Try
482+
'开启管理员权限下的文件拖拽(#2531)
483+
Try
484+
If IsAdmin() Then
485+
Log("[System] PCL 正以管理员权限运行")
486+
ChangeWindowMessageFilterEx(Handle, &H233, 1, Nothing)
487+
ChangeWindowMessageFilterEx(Handle, &H49, 1, Nothing)
488+
End If
489+
Catch ex As Exception
490+
Log(ex, "开启管理员权限下的文件拖拽失败")
491+
End Try
468492
End Sub, "Start Loader", ThreadPriority.Lowest)
469493

470494
Log("[Start] 第三阶段加载用时:" & GetTimeTick() - ApplicationStartTick & " ms")

Plain Craft Launcher 2/Modules/Base/ModBase.vb

+20-24
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Public Module ModBase
1111
#Region "声明"
1212

1313
'下列版本信息由更新器自动修改
14-
Public Const VersionBaseName As String = "2.6.7" '不含分支前缀的显示用版本名
15-
Public Const VersionStandardCode As String = "2.6.7." & VersionBranchCode '标准格式的四段式版本号
14+
Public Const VersionBaseName As String = "2.6.8" '不含分支前缀的显示用版本名
15+
Public Const VersionStandardCode As String = "2.6.8." & VersionBranchCode '标准格式的四段式版本号
1616
#If BETA Then
17-
Public Const VersionCode As Integer = 302 'Release
17+
Public Const VersionCode As Integer = 304 'Release
1818
#Else
19-
Public Const VersionCode As Integer = 303 'Snapshot
19+
Public Const VersionCode As Integer = 305 'Snapshot
2020
#End If
2121
'自动生成的版本信息
2222
Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
@@ -1242,23 +1242,7 @@ Re:
12421242
Public Function ExtractFile(CompressFilePath As String, DestDirectory As String, Optional Encode As Encoding = Nothing) As Boolean
12431243
Try
12441244
Directory.CreateDirectory(DestDirectory)
1245-
If CompressFilePath.EndsWith(".zip") OrElse CompressFilePath.EndsWith(".jar") OrElse CompressFilePath.EndsWith(".mrpack") Then
1246-
'以 zip 方式解压
1247-
Using stream As New FileStream(CompressFilePath, FileMode.Open)
1248-
Using archive As New ZipArchive(stream, ZipArchiveMode.Read, False, If(Encode, Encoding.GetEncoding("GB18030")))
1249-
For Each entry As ZipArchiveEntry In archive.Entries
1250-
Dim destinationPath As String = IO.Path.Combine(DestDirectory, entry.FullName)
1251-
If destinationPath.EndsWith("\") OrElse destinationPath.EndsWith("/") Then
1252-
Directory.CreateDirectory(destinationPath)
1253-
Else
1254-
If File.Exists(destinationPath) Then File.Delete(destinationPath)
1255-
entry.ExtractToFile(destinationPath, True)
1256-
End If
1257-
Next
1258-
End Using
1259-
End Using
1260-
Return True
1261-
ElseIf CompressFilePath.EndsWith(".gz") Then
1245+
If CompressFilePath.EndsWith(".gz") Then
12621246
'以 gz 方式解压
12631247
Dim stream As New GZipStream(New FileStream(CompressFilePath, FileMode.Open, FileAccess.ReadWrite), CompressionMode.Decompress)
12641248
Dim decompressedFile As New FileStream(DestDirectory & GetFileNameFromPath(CompressFilePath).ToLower.Replace(".tar", "").Replace(".gz", ""), FileMode.OpenOrCreate, FileAccess.Write)
@@ -1271,7 +1255,19 @@ Re:
12711255
stream.Close()
12721256
Return True
12731257
Else
1274-
Return False
1258+
'以 zip 方式解压
1259+
Using Archive = ZipFile.Open(CompressFilePath, ZipArchiveMode.Read, If(Encode, Encoding.GetEncoding("GB18030")))
1260+
For Each Entry As ZipArchiveEntry In Archive.Entries
1261+
Dim DestinationPath As String = IO.Path.Combine(DestDirectory, Entry.FullName)
1262+
If DestinationPath.EndsWith("\") OrElse DestinationPath.EndsWith("/") Then
1263+
Continue For '不创建空文件夹
1264+
Else
1265+
Directory.CreateDirectory(GetPathFromFullPath(DestinationPath))
1266+
Entry.ExtractToFile(DestinationPath, True)
1267+
End If
1268+
Next
1269+
End Using
1270+
Return True
12751271
End If
12761272
Catch ex As Exception
12771273
Log(ex, "尝试解压文件失败")
@@ -1301,7 +1297,7 @@ Re:
13011297
Next
13021298
Temp = Directory.GetDirectories(Path)
13031299
For Each str As String In Temp
1304-
DeleteDirectory(str)
1300+
DeleteDirectory(str, IgnoreIssue)
13051301
Next
13061302
Try
13071303
Directory.Delete(Path, True)
@@ -1578,7 +1574,7 @@ Re:
15781574
''' 为字符串进行 XML 转义。
15791575
''' </summary>
15801576
Public Function EscapeXML(Str As String) As String
1581-
Return Str.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("'", "&apos;").Replace("""", "&quot;")
1577+
Return Str.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("'", "&apos;").Replace("""", "&quot;").Replace(vbCrLf, "&#xa;")
15821578
End Function
15831579

15841580
'正则

0 commit comments

Comments
 (0)