Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PCL.Core/App/Localization/Languages/en-US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@
<sys:String x:Key="Main.Tab.Launch">Launch</sys:String>
<sys:String x:Key="Main.Tab.Settings">Settings</sys:String>
<sys:String x:Key="Main.Tab.Tools">Tools</sys:String>
<sys:String x:Key="Main.Tab.Test">Test</sys:String>
<sys:String x:Key="Main.Telemetry.Message">After telemetry data collection is enabled, the launcher will collect and report errors and device environment information. This can help developers fix potential issues and better plan and develop the launcher.&#xA;If this feature is enabled, we will collect the following information:&#xA;&#xA;- Errors that occur in the launcher&#xA;- Launcher version information and identifier&#xA;- Windows system version and architecture&#xA;- Installed physical memory size&#xA;- NAT and IPv6 support status&#xA;- Whether you have used the original PCL, HMCL, or BakaXL&#xA;&#xA;This data is not associated with you, and we will never sell it to any third party.&#xA;If you do not want to enable telemetry, you can choose to decline. This will not affect normal use of other features, but may affect developers' ability to fix potential bugs.&#xA;You can change this setting at any time in launcher settings.</sys:String>
<sys:String x:Key="Main.Telemetry.Title">Enable telemetry data collection</sys:String>
<sys:String x:Key="Main.Title.GameLog">Launch log</sys:String>
Expand Down
1 change: 1 addition & 0 deletions PCL.Core/App/Localization/Languages/zh-CN.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@
<sys:String x:Key="Main.Tab.Launch">启动</sys:String>
<sys:String x:Key="Main.Tab.Settings">设置</sys:String>
<sys:String x:Key="Main.Tab.Tools">工具</sys:String>
<sys:String x:Key="Main.Tab.Test">测试</sys:String>
<sys:String x:Key="Main.Telemetry.Message">启用遥测数据收集后,启动器将会收集并上报错误与设备环境信息,这可以帮助开发者修复潜在的问题、更好的进行规划和开发。&#xA;若启用此功能,我们将会收集以下信息:&#xA;&#xA;- 启动器内出现的错误&#xA;- 启动器版本信息与识别码&#xA;- Windows 系统版本与架构&#xA;- 已安装的物理内存大小&#xA;- NAT 与 IPv6 支持情况&#xA;- 是否使用过原版 PCL、HMCL 或 BakaXL&#xA;&#xA;这些数据均不与你关联,我们也绝不会向第三方出售数据。&#xA;如果不希望启用遥测,可以选择拒绝。这不会影响其他功能的正常使用,但可能会影响开发者修复潜在 Bug。&#xA;你可以随时在启动器设置中调整这项设置。</sys:String>
<sys:String x:Key="Main.Telemetry.Title">启用遥测数据收集</sys:String>
<sys:String x:Key="Main.Title.GameLog">实时日志</sys:String>
Expand Down
32 changes: 32 additions & 0 deletions Plain Craft Launcher 2/FormMain.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ public FormMain()
HintWrapper.OnShow += HintService.HintWrapper_OnShow;
// 加载 UI
InitializeComponent();
#if DEBUG
// 顶栏「测试」按钮。仅 Debug 构建下加入
var btnTitleTest = new MyRadioButton
{
Text = Lang.Text("Main.Tab.Test"),
Tag = "4",
Margin = new Thickness(5, 0, 5, 0),
Padding = new Thickness(2, 0, 2, 0),
LogoScale = 0.9,
SvgIcon = "lucide/flask-conical"
};
btnTitleTest.Check += BtnTitleSelect_Click;
PanTitleSelect.Children.Add(btnTitleTest);
#endif
Opacity = 0d;
try
{
Expand Down Expand Up @@ -1377,6 +1391,13 @@ public enum PageType
/// </summary>
Tools = 3,

#if DEBUG
/// <summary>
/// 测试。这是一个顶级页面,仅在 Dev(Debug)构建下编译。
/// </summary>
Test = 4,
#endif

/// <summary>
/// 设置。
/// </summary>
Expand Down Expand Up @@ -1909,6 +1930,17 @@ private void PageChangeActual(PageStackData stack, PageSubType subType)
(FrameworkElement)ModMain.frmInstanceSavesLeft.PageGet(subType));
break;
}
#if DEBUG
case PageType.Test: // 测试(仅 Dev 构建)
{
if (ModMain.frmTestLeft is null)
ModMain.frmTestLeft = new PageTestLeft();
if (ModMain.frmTestRight is null)
ModMain.frmTestRight = new PageTestRight();
PageChangeAnim(ModMain.frmTestLeft, ModMain.frmTestRight);
break;
}
#endif
}

#endregion
Expand Down
4 changes: 4 additions & 0 deletions Plain Craft Launcher 2/Modules/ModMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public static class ModMain
public static PageToolsLeft? frmToolsLeft;
public static PageToolsGameLink? frmToolsGameLink;
public static PageToolsTest? frmToolsTest;
#if DEBUG
public static PageTestLeft? frmTestLeft;
public static PageTestRight? frmTestRight;
#endif
public static PageDownloadLeft? frmDownloadLeft;
public static PageDownloadInstall? frmDownloadInstall;
public static PageDownloadClient? frmDownloadClient;
Expand Down
10 changes: 10 additions & 0 deletions Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<local:MyPageLeft x:Class="PCL.PageTestLeft"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PCL"
HorizontalAlignment="Left" Width="200">
<StackPanel Margin="20,30,20,0">
<TextBlock Text="测试页面" FontSize="20" FontWeight="Bold" Margin="10,0,0,6" />
<TextBlock Text="仅 Dev 构建编译的测试页面" Foreground="{DynamicResource ColorBrushGray1}" FontSize="12" Margin="10,0,0,0" />
</StackPanel>
</local:MyPageLeft>
9 changes: 9 additions & 0 deletions Plain Craft Launcher 2/Pages/PageTest/PageTestLeft.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace PCL;

public partial class PageTestLeft
{
public PageTestLeft()
{
InitializeComponent();
}
}
17 changes: 17 additions & 0 deletions Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<local:MyPageRight x:Class="PCL.PageTestRight"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PCL"
PanScroll="{Binding ElementName=PanBack}">
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
<StackPanel x:Name="PanMain" Margin="25,25,25,10" Grid.IsSharedSizeScope="True">
<!-- 测试功能放置区:往 MyCard 里添加你的测试控件即可 -->
<local:MyCard Margin="0,15" Title="测试功能(仅 Dev 构建)">
<StackPanel Margin="25,30,25,15">
<TextBlock Text="在这里添加测试功能。" Foreground="{DynamicResource ColorBrushGray1}" Margin="0,0,0,15" />
<local:MyButton MinWidth="120" Height="35" Text="弹出一条测试 Toast" Click="BtnToastTest_Click" />
</StackPanel>
</local:MyCard>
</StackPanel>
</local:MyScrollViewer>
</local:MyPageRight>
17 changes: 17 additions & 0 deletions Plain Craft Launcher 2/Pages/PageTest/PageTestRight.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Windows.Input;

namespace PCL;

public partial class PageTestRight
{
public PageTestRight()
{
InitializeComponent();
}

// 示例测试功能:弹出一条 Toast
private void BtnToastTest_Click(object sender, MouseButtonEventArgs e)
{
HintService.Hint("测试 Toast:新弹窗系统工作正常", HintType.Info);
}
}
Loading