Skip to content
Merged
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
6 changes: 6 additions & 0 deletions src/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public static class ConfigManager
public static string TelemetryClientId { get; set; } = "";
public static string LastTelemetrySentUtc { get; set; } = "";

/// 点击特效是否处于激活状态(点击特效开关)
public static bool IsClickEffectActive => IsEffectEnabled;

/// 拖尾效果是否处于激活状态(点击特效或常驻拖尾任意一个开启)
public static bool IsTrailEffectActive => IsEffectEnabled || EnableAlwaysTrailEffect;

private static List<FilterProfile> _profiles = new List<FilterProfile>();

public static void Load()
Expand Down
4 changes: 2 additions & 2 deletions src/ControlPanelWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@
</Border>
<TextBlock x:Name="TxtScrollbarHint" Text="* 控制面板滚动条较细;仅滚动时显示可减少调整窗口大小时滚动条反复出现/消失的视觉割裂。" FontSize="11" Foreground="#9BA3AF" Margin="0,8,0,0" TextWrapping="Wrap" Opacity="0.8"/>
</StackPanel>
<CheckBox Name="CheckMasterSwitch" Content="启用鼠标点击特效" Style="{StaticResource ToggleSwitch}" FontWeight="SemiBold" Margin="0,0,0,12"/>
<CheckBox Name="CheckAlwaysTrailEffectSwitch" Content="启用鼠标常驻拖尾" Style="{StaticResource ToggleSwitch}" FontWeight="SemiBold" Margin="0,0,0,12"/>
<StackPanel Margin="0,0,0,15">
<CheckBox Name="CheckMasterSwitch" Content="启用鼠标点击特效" Style="{StaticResource ToggleSwitch}" FontWeight="SemiBold" Margin="0,0,0,12" Checked="CheckMasterSwitch_Changed" Unchecked="CheckMasterSwitch_Changed"/>
<StackPanel x:Name="PanelClickEffectOptions" Margin="0,0,0,15">
<TextBlock x:Name="TxtClickType" Text="触发按键类型" Foreground="#666" Margin="0,0,0,8" FontSize="12"/>
<Border Background="#F0F2F5" CornerRadius="8" Padding="2" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal">
Expand Down
13 changes: 13 additions & 0 deletions src/ControlPanelWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@

UpdateColorPreview(ConfigManager.ParticleColor);
UpdateStartSilentInterlock();
UpdateClickEffectPanelVisibility();
UpdateEnvironmentFilterInterlock();

SliderScale.Value = ConfigManager.EffectScale;
Expand Down Expand Up @@ -773,6 +774,18 @@
UpdateStartSilentInterlock();
}

private void CheckMasterSwitch_Changed(object sender, RoutedEventArgs e)
{
if (!IsLoaded) return;
UpdateClickEffectPanelVisibility();
}

private void UpdateClickEffectPanelVisibility()
{
bool enabled = CheckMasterSwitch.IsChecked == true;
PanelClickEffectOptions.Visibility = enabled ? Visibility.Visible : Visibility.Collapsed;
}

private void CheckRunAsAdmin_Changed(object sender, RoutedEventArgs e)
{
if (!IsLoaded) return;
Expand Down Expand Up @@ -1586,7 +1599,7 @@
string? exePath = AutoStartManager.ResolveExecutablePath(
Environment.ProcessPath,
Process.GetCurrentProcess().MainModule?.FileName,
Assembly.GetExecutingAssembly().Location,

Check warning on line 1602 in src/ControlPanelWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.
AppDomain.CurrentDomain.BaseDirectory);

if (string.IsNullOrEmpty(exePath)) return;
Expand Down
10 changes: 9 additions & 1 deletion src/OverlayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ private void CancelScreenshotFailsafeTimer()

private void OnMouseDownExt(object? sender, MouseEventExtArgs e)
{
// 点击特效开关
if (!ConfigManager.IsClickEffectActive) return;
if (!CanRenderEffects()) return;

bool isLeft = e.Button == MouseButtons.Left;
Expand Down Expand Up @@ -527,6 +529,8 @@ private void OnMouseDownExt(object? sender, MouseEventExtArgs e)

private void OnMouseMoveExt(object? sender, MouseEventExtArgs e)
{
// 拖尾仅在点击特效开启或常驻拖尾开启时渲染
if (!ConfigManager.IsTrailEffectActive) return;
if (!CanRenderEffects()) return;

bool cursorVisible = CursorIsVisible();
Expand Down Expand Up @@ -561,9 +565,13 @@ private void OnMouseUpExt(object? sender, MouseEventExtArgs e)
_activePointerOverlay = null;
}

/// <summary>
/// 检查渲染环境条件(覆盖窗口存在性、环境过滤、光标可见性)。
/// 业务开关(点击特效、常驻拖尾)由各调用点自行判断。
/// </summary>
private bool CanRenderEffects()
{
if (!ConfigManager.IsEffectEnabled || _overlays.Count == 0)
if (_overlays.Count == 0)
{
ReleasePointerState();
return false;
Expand Down
Loading