This commit is contained in:
龙腾猫跃
2025-12-27 02:48:47 +08:00
parent d6ba445e54
commit 085af160a1
78 changed files with 8426 additions and 4863 deletions
+31 -6
View File
@@ -96,11 +96,36 @@ End Module
''' 自定义事件。
''' </summary>
Public Class CustomEvent
Inherits DependencyObject
#Region "属性与触发"
Public Property Type As EventType = EventType.None
Public Property Data As String = Nothing
Public Property Type As EventType
Get
Dim Value As EventType = EventType.None
RunInUiWait(Sub() Value = GetValue(TypeProperty))
Return Value
End Get
Set(value As EventType)
SetValue(TypeProperty, value)
End Set
End Property
Public Shared ReadOnly TypeProperty As DependencyProperty =
DependencyProperty.Register("Type", GetType(EventType), GetType(CustomEvent), New PropertyMetadata(EventType.None))
Public Property Data As String
Get
Dim Value As String = Nothing
RunInUiWait(Sub() Value = GetValue(DataProperty))
Return Value
End Get
Set(value As String)
SetValue(DataProperty, value)
End Set
End Property
Public Shared ReadOnly DataProperty As DependencyProperty =
DependencyProperty.Register("Data", GetType(String), GetType(CustomEvent), New PropertyMetadata(Nothing))
Public Sub New()
End Sub
Public Sub New(Type As EventType, Data As String)
@@ -190,17 +215,17 @@ Public Class CustomEvent
Case EventType.启动游戏
If Args(0) = "\current" Then
If McVersionCurrent Is Nothing Then
If McInstanceSelected Is Nothing Then
Hint("请先选择一个 Minecraft 版本!", HintType.Red)
Return
Else
Args(0) = McVersionCurrent.Name
Args(0) = McInstanceSelected.Name
End If
End If
RunInUi(
Sub()
If McLaunchStart(New McLaunchOptions With
{.ServerIp = If(Args.Length >= 2, Args(1), Nothing), .Version = New McVersion(Args(0))}) Then
{.ServerIp = If(Args.Length >= 2, Args(1), Nothing), .Instance = New McInstance(Args(0))}) Then
Hint($"正在启动 {Args(0)}……")
End If
End Sub)
@@ -276,7 +301,7 @@ Public Class CustomEvent
Case EventType.修改设置, EventType.写入设置
If Args.Length = 1 Then Throw New Exception($"EventType {Type} 需要至少 2 个以 | 分割的参数,例如 UiLauncherTransparent|400")
Setup.SetSafe(Args(0), Args(1), Version:=McVersionCurrent)
Setup.SetSafe(Args(0), Args(1), Instance:=McInstanceSelected)
If Args.Length = 2 Then Hint($"已写入设置:{Args(0)} → {Args(1)}", HintType.Green)
Case EventType.修改变量, EventType.写入变量