add record UI

This commit is contained in:
辉鸭蛋
2024-06-23 23:22:11 +08:00
parent 8469f6c37e
commit 85a2e4a642
9 changed files with 81 additions and 20 deletions

View File

@@ -83,6 +83,7 @@ public partial class App : Application
services.AddView<TaskSettingsPage, TaskSettingsPageViewModel>();
services.AddView<HotKeyPage, HotKeyPageViewModel>();
services.AddView<NotificationSettingsPage, NotificationSettingsPageViewModel>();
services.AddView<KeyMouseRecordPage, KeyMouseRecordPageViewModel>();
// My Services
services.AddSingleton<TaskTriggerDispatcher>();

View File

@@ -144,6 +144,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Core\Recorder\" />
<Folder Include="GameTask\Common\Element\Assets\MapPoint\" />
<Folder Include="View\Controls\WpfUi\" />
</ItemGroup>

View File

@@ -8,7 +8,7 @@ using System.Windows.Forms;
using Vanara.PInvoke;
using Timer = System.Timers.Timer;
namespace BetterGenshinImpact.Core;
namespace BetterGenshinImpact.Core.Monitor;
public class MouseKeyMonitor
{
@@ -32,9 +32,9 @@ public class MouseKeyMonitor
private DateTime _firstSpaceKeyDownTime = DateTime.MaxValue;
private IKeyboardMouseEvents? _globalHook;
private IntPtr _hWnd;
private nint _hWnd;
public void Subscribe(IntPtr gameHandle)
public void Subscribe(nint gameHandle)
{
_hWnd = gameHandle;
// Note: for the application hook, use the Hook.AppEvents() instead

View File

@@ -81,7 +81,17 @@
Visibility="{markup:Converter Value={x:Static helpers:RuntimeHelper.IsDebuggerAttached},
Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="WebAsset16" />
<ui:SymbolIcon Symbol="WebAsset24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<!-- Script16 -->
<ui:NavigationViewItem Content="录制回放"
NavigationCacheMode="Enabled"
TargetPageType="{x:Type pages:KeyMouseRecordPage}"
Visibility="{markup:Converter Value={x:Static helpers:RuntimeHelper.IsDebuggerAttached},
Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="Record24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem Content="快捷键"

View File

@@ -1,18 +1,5 @@
using BetterGenshinImpact.ViewModel.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BetterGenshinImpact.View.Pages;
@@ -28,4 +15,4 @@ public partial class HotKeyPage : Page
DataContext = ViewModel = viewModel;
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,29 @@
<Page x:Class="BetterGenshinImpact.View.Pages.KeyMouseRecordPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BetterGenshinImpact.View.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:BetterGenshinImpact.ViewModel.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="KeyMouseRecordPage"
d:DataContext="{d:DesignInstance Type=pages:KeyMouseRecordPageViewModel}"
d:DesignHeight="850"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
FontFamily="{StaticResource TextThemeFontFamily}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
<Grid>
<StackPanel Margin="42,16,42,12">
<ui:TextBlock Margin="0,0,0,8"
FontTypography="BodyStrong"
Text="键鼠录制回放功能" />
<ui:Button Content="开始录制" Icon="{ui:SymbolIcon Record20}" />
<ui:Button Content="停止录制" Icon="{ui:SymbolIcon Stop24}" />
<ui:Button Content="播放脚本" Icon="{ui:SymbolIcon Play24}" />
</StackPanel>
</Grid>
</Page>

View File

@@ -0,0 +1,18 @@
using BetterGenshinImpact.ViewModel.Pages;
using System.Windows.Controls;
namespace BetterGenshinImpact.View.Pages;
/// <summary>
/// KeyMouseRecordPage.xaml 的交互逻辑
/// </summary>
public partial class KeyMouseRecordPage : Page
{
private KeyMouseRecordPageViewModel ViewModel { get; }
public KeyMouseRecordPage(KeyMouseRecordPageViewModel viewModel)
{
DataContext = ViewModel = viewModel;
InitializeComponent();
}
}

View File

@@ -1,5 +1,5 @@
using BetterGenshinImpact.Core;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Monitor;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Genshin.Paths;

View File

@@ -0,0 +1,15 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Wpf.Ui.Controls;
namespace BetterGenshinImpact.ViewModel.Pages;
public class KeyMouseRecordPageViewModel : ObservableObject, INavigationAware, IViewModel
{
public void OnNavigatedTo()
{
}
public void OnNavigatedFrom()
{
}
}