Compare commits

..
Author SHA1 Message Date
huiyadanli b5787aa9d3 Update version to 0.56.2 2026-02-03 14:46:22 +00:00
辉鸭蛋 f38e3e05ae 重置选项移动 2026-02-03 21:51:17 +08:00
辉鸭蛋 db67429350 fix: 调整事件触发顺序并修复地图点选择器状态
修复 PointsCanvas 中 ViewportChanged 事件与 Refresh 方法的调用顺序,确保界面正确更新。
在 MaskWindow 中增加关闭地图点选择器的逻辑,避免状态不一致。
2026-02-03 20:56:54 +08:00
辉鸭蛋 5484aea335 Revert "遮罩内 Popup 保持置顶"
This reverts commit ff3e89aa1c.
2026-02-03 20:40:05 +08:00
躁动的氨气 a948c70baf feat: 简化自动战斗日志输出 (#2732) 2026-02-03 17:35:23 +08:00
huiyadanli 688bdcd8ae Update version to 0.56.1 2026-02-02 18:22:32 +00:00
辉鸭蛋 3f2f45e3b1 fix: update BetterGI.Assets.Other package version to 1.0.12 2026-02-03 02:20:48 +08:00
辉鸭蛋 ff3e89aa1c 遮罩内 Popup 保持置顶 2026-02-03 02:19:58 +08:00
huiyadanli ddf1c72ba3 Update version to 0.56.0 2026-02-02 17:08:45 +00:00
辉鸭蛋 a651bbfbe5 优化更新界面UI与交互 2026-02-03 00:59:58 +08:00
kaedelcb a9cf0dcfb3 优化换队拾取和切换队伍 (#2729) 2026-02-03 00:39:39 +08:00
辉鸭蛋 e3caf32b94 Revise asset instructions and GitHub Actions setup
Updated README to reflect changes in asset handling and GitHub Actions.
2026-01-29 16:09:18 +08:00
huiyadanli 0761652e31 Update version to 0.55.2-alpha.2 2026-01-28 17:06:04 +00:00
辉鸭蛋 abc2b5dd19 fix: 修复地图标签搜索窗口DPI缩放和关闭逻辑
修复地图标签搜索窗口在高DPI缩放下的定位问题,调整计算方式以适配系统缩放比例。
同时确保地图点选择器关闭时同步隐藏搜索窗口,避免窗口残留。
2026-01-29 01:02:38 +08:00
辉鸭蛋 200f904a64 fix: 调整日志级别及UI元素位置比例
将米游社地图接口调用失败日志级别从Warning降为Debug,避免频繁警告干扰
调整日志文本框和状态列表的顶部位置及宽度比例,优化界面布局
2026-01-29 00:17:02 +08:00
辉鸭蛋 ab498fa731 fix: 调整截图预览区域尺寸以适应不同分辨率
调整 MaskWindow 中截图预览区域的列宽比例,将固定宽高改为最大宽高并启用拉伸对齐,提升在不同屏幕分辨率下的显示适应性。
2026-01-28 23:42:30 +08:00
辉鸭蛋 42ef97b1cd Revert "feat: 为多个窗口启用自动翻译拦截器"
This reverts commit fc942bd8cd.
2026-01-28 01:24:04 +08:00
辉鸭蛋 3beb762223 Merge remote-tracking branch 'origin/main' 2026-01-28 01:22:24 +08:00
辉鸭蛋 fc942bd8cd feat: 为多个窗口启用自动翻译拦截器
为 MapLabelSearchWindow、ArtifactOcrDialog、PromptDialog 等十三个 WPF 窗口添加了 AutoTranslateInterceptor 行为,以启用自动翻译功能。这确保了应用程序界面的文本内容在需要时可以被正确拦截并处理,提升国际化支持。
2026-01-28 01:22:09 +08:00
ema da80dd02c4 修复部分组件未随主题变更颜色 #2644 (#2699) 2026-01-27 12:28:24 +08:00
16 changed files with 441 additions and 332 deletions

No files matched your search

@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>BetterGI</AssemblyName>
<Version>0.55.2-alpha.1</Version>
<Version>0.56.2</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
@@ -45,7 +45,7 @@
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.17" />
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.18" />
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.10" />
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.12" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="DeviceId" Version="6.9.0" />
@@ -83,10 +83,10 @@ public partial class MaskWindowConfig : ObservableObject
private double _logTextBoxLeftRatio = 20.0 / 1920;
[ObservableProperty]
private double _logTextBoxTopRatio = 832.0 / 1080;
private double _logTextBoxTopRatio = 822.0 / 1080;
[ObservableProperty]
private double _logTextBoxWidthRatio = 477.0 / 1920;
private double _logTextBoxWidthRatio = 480.0 / 1920;
[ObservableProperty]
private double _logTextBoxHeightRatio = 188.0 / 1080;
@@ -95,10 +95,10 @@ public partial class MaskWindowConfig : ObservableObject
private double _statusListLeftRatio = 20.0 / 1920;
[ObservableProperty]
private double _statusListTopRatio = 807.0 / 1080;
private double _statusListTopRatio = 790.0 / 1080;
[ObservableProperty]
private double _statusListWidthRatio = 477.0 / 1920;
private double _statusListWidthRatio = 480.0 / 1920;
[ObservableProperty]
private double _statusListHeightRatio = 24.0 / 1080;
@@ -320,7 +320,8 @@ namespace BetterGenshinImpact.GameTask.AutoFight
if (retryCount == 0)
{
await Delay(delayTime,ct);
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
// Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
Logger.LogInformation("打开编队界面检查战斗是否结束");
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
await Delay(detectDelayTime, ct);
var ra3 = CaptureToRectArea();
@@ -444,7 +444,7 @@ public class AutoFightTask : ISoloTask
if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time))
{
delayTime = time;
Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
// Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
}
else
{
@@ -498,13 +498,13 @@ public class AutoFightTask : ISoloTask
{
oldPartyName = RunnerContext.Instance.PartyName;
}
else if (picker is null)
else if(picker is null && !string.IsNullOrEmpty(_taskParam.KazuhaPartyName))
{
Logger.LogWarning("换队拾取:当前队伍名称为空,尝试读取!");
await Delay(1000, ct);
await _returnMainUiTask.Start(ct);
for (int attempt = 0; attempt < 3; attempt++)
for (int attempt = 0; attempt < 6; attempt++)
{
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
var enterGameAppear = await NewRetry.WaitForElementAppear(
@@ -514,13 +514,15 @@ public class AutoFightTask : ISoloTask
15,
500
);
if (attempt == 2)
if(attempt == 5 && !enterGameAppear)
{
Logger.LogWarning("换队拾取:读取队伍名称失败!");
Logger.LogWarning("换队拾取:读取队伍名称失败,跳过换队拾取步骤");
}
}
}
await Delay(1000, ct);
//等待寻找2秒队伍按钮出现
var timeWaitStart = 0;
while(timeWaitStart < 6000)
@@ -530,14 +532,43 @@ public class AutoFightTask : ISoloTask
if (partyViewBtn.IsExist())
{
// OCR 当前队伍名称(无法单字,中间禁止空格)
oldPartyName = ra.Find(new RecognitionObject
{
RecognitionType = RecognitionTypes.Ocr,
RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
partyViewBtn.Height)
}).Text;
Logger.LogInformation("换队拾取:当前队伍名称读取为:{oldPartyName}",oldPartyName);
RunnerContext.Instance.PartyName = oldPartyName;
// 读取OCR原始识别文本
var rawPartyName = ra.Find(new RecognitionObject
{
RecognitionType = RecognitionTypes.Ocr,
RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
partyViewBtn.Height)
}).Text;
// 核心处理逻辑:1.空值兜底 2.去首尾空白 3.移除末尾的“口”字(仅最后一个是口才删)
if (string.IsNullOrWhiteSpace(rawPartyName))
{
oldPartyName = string.Empty;
}
else
{
//有概率把编辑图标识别为字符,并且含有空格或换行符,需要过滤
var tempName = rawPartyName
.Replace("\"", "") // 移除所有双引号(核心新增,解决日志里的""问题)
.Replace("\r\n", "") // 清理Windows换行符
.Replace("\r", ""); // 先清理所有双引号,避免引号干扰后续处理
// 核心逻辑:找到第一个换行符(\n)的位置,截断并删除换行+后面所有字符
int firstNewLineIndex = tempName.IndexOf('\n');
if (firstNewLineIndex != -1) // 存在换行符,截取到换行符前
{
tempName = tempName.Substring(0, firstNewLineIndex);
}
// 最后统一去首尾所有空白(空格、制表符、回车符\r等),得到纯净队伍名
oldPartyName = tempName.Trim();
}
// 后续原有逻辑不变
Logger.LogInformation("换队拾取:当前队伍名称读取为:{oldPartyName}", oldPartyName);
// 加在rawPartyName赋值后,打印原始文本的“原始形态”(转义符会显示)
Logger.LogDebug("OCR原始识别文本(含转义):{rawPartyName}", rawPartyName);
RunnerContext.Instance.PartyName = oldPartyName;
// await _returnMainUiTask.Start(ct);
break;
}
@@ -735,7 +766,8 @@ public class AutoFightTask : ISoloTask
if (!_finishDetectConfig.RotateFindEnemyEnabled)await Delay(delayTime, _ct);
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
// Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
Logger.LogInformation("打开编队界面检查战斗是否结束");
// 最终方案确认战斗结束
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
await Delay(detectDelayTime, _ct);
@@ -758,8 +790,9 @@ public class AutoFightTask : ISoloTask
return true;
}
Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
// Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
// Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
Logger.LogInformation($"未识别到战斗结束: yellow{b3.Item0},{b3.Item1},{b3.Item2};white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
if (_finishDetectConfig.RotateFindEnemyEnabled)
{
@@ -254,10 +254,10 @@ public class Avatar
// 切换成功
if (CombatScenes.GetActiveAvatarIndex(region, context) == Index)
{
if (needLog && i > 0)
{
Logger.LogInformation("成功切换角色:{Name}", Name);
}
// if (needLog && i > 0)
// {
// Logger.LogInformation("成功切换角色:{Name}", Name);
// }
return true;
}
@@ -267,6 +267,8 @@ public class Avatar
Sleep(250, Ct);
}
Logger.LogWarning("切换角色失败:{Name}", Name);
return false;
}
@@ -472,8 +474,8 @@ public class Avatar
var cd = AfterUseSkill(region);
if (cd > 0)
{
Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd} 秒" : "{Name} 点按元素战技,cd:{Cd} 秒", Name,
Math.Round(cd, 2));
// Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd} 秒" : "{Name} 点按元素战技,cd:{Cd} 秒", Name,
// Math.Round(cd, 2));
return;
}
}
@@ -28,8 +28,9 @@ public class CombatScriptBag(List<CombatScript> combatScripts)
}
if (matchCount != avatars.Count) continue;
Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}",
combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames));
// Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}",
// combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames));
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
return combatScript.CombatCommands;
}
@@ -92,6 +92,21 @@ public class SwitchPartyTask
RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
partyViewBtn.Height)
}).Text;
var tempName = currTeamName
.Replace("\"", "") // 移除所有双引号(核心新增,解决日志里的""问题)
.Replace("\r\n", "") // 清理Windows换行符
.Replace("\r", ""); // 先清理所有双引号,避免引号干扰后续处理
// 核心逻辑:找到第一个换行符(\n)的位置,截断并删除换行+后面所有字符
int firstNewLineIndex = tempName.IndexOf('\n');
if (firstNewLineIndex != -1) // 存在换行符,截取到换行符前
{
tempName = tempName.Substring(0, firstNewLineIndex);
}
// 最后统一去首尾所有空白(空格、制表符、回车符\r等),得到纯净队伍名
currTeamName = tempName.Trim();
Logger.LogInformation("切换队伍,当前队伍名称: {Text},使用正则表达式规则进行模糊匹配", currTeamName);
if (Regex.IsMatch(currTeamName, partyName))
+1 -1
View File
@@ -12,7 +12,7 @@
1. `git clone https://github.com/babalae/better-genshin-impact.git`
2. 需要使用 [Visual Studio 2022](https://visualstudio.microsoft.com/zh-hans/downloads/) 打开本项目。
请注意当前 `/Asset` 目录下的部分文件过大,比如地图特征数据(300M+),需要手动从 Release 包中获取并拷贝至对应的编译目录下,软件才能够正常运行对应的功能。(当前仅影响地图追踪、自动传送相关功能)
~~请注意当前 `/Asset` 目录下的部分文件过大,比如地图特征数据(300M+),需要手动从 Release 包中获取并拷贝至对应的编译目录下,软件才能够正常运行对应的功能。(当前仅影响地图追踪、自动传送相关功能)~~ 现在已经丢到 nuget 上可以直接编译构建了
## 如何通过 Github Action 直接构建完整包?
@@ -190,7 +190,7 @@ public sealed class MaskMapPointService : IMaskMapPointService
}
catch (Exception ex)
{
_logger.LogWarning(ex, "调用米游社地图接口获取点位列表失败");
_logger.LogDebug(ex, "调用米游社地图接口获取点位列表失败");
return new MaskMapPointsResult { Labels = labels, Points = Array.Empty<MaskMapPoint>() };
}
+1 -1
View File
@@ -120,7 +120,7 @@ public class UpdateService : IUpdateService
}
else
{
Process.Start(new ProcessStartInfo("https://github.com/babalae/better-genshin-impact/actions/workflows/publish.yml") { UseShellExecute = true });
Process.Start(new ProcessStartInfo("https://cnb.cool/bettergi/better-genshin-impact/-/releases") { UseShellExecute = true });
}
break;
@@ -538,8 +538,8 @@ public class PointsCanvas : FrameworkElement
}
_viewportRect = newRect;
Debug.WriteLine($"Viewport updated: {_viewportRect}");
Refresh();
ViewportChanged?.Invoke(this, EventArgs.Empty);
Refresh();
}
/// <summary>
+298 -262
View File
@@ -11,6 +11,7 @@
xmlns:converters="clr-namespace:BetterGenshinImpact.View.Converters"
xmlns:controls="clr-namespace:BetterGenshinImpact.View.Controls"
xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
Title="MaskWindow"
Width="500"
Height="800"
@@ -57,6 +58,8 @@
<ResourceDictionary Source="/View/Controls/Overlay/AdjustableOverlayItemStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:OverlayRelativeOrAbsoluteConverter x:Key="OverlayRelativeOrAbsoluteConverter" />
<sys:Double x:Key="MapPointPickerHeightRatio">0.62</sys:Double>
<sys:Double x:Key="MapPointPickerVerticalOffset">-12</sys:Double>
</ResourceDictionary>
</Window.Resources>
@@ -657,8 +660,8 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="58*" />
<ColumnDefinition Width="12*" />
<ColumnDefinition Width="540*" />
<ColumnDefinition Width="1192*" />
<ColumnDefinition Width="640*" />
<ColumnDefinition Width="1092*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="328*" />
@@ -667,266 +670,9 @@
<RowDefinition Height="58*" />
</Grid.RowDefinitions>
<Border Grid.Row="1"
Grid.Column="2"
Width="540"
Height="640"
Background="#C81F232A"
BorderBrush="#26FFFFFF"
BorderThickness="1"
CornerRadius="12"
Visibility="{Binding IsMapPointPickerOpen, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border.Effect>
<DropShadowEffect Opacity="0.7" BlurRadius="28" ShadowDepth="0" Color="#FF000000" />
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="12,12,12,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
Height="32"
MinWidth="140"
Margin="0,0,12,0"
Padding="12,0,6,0"
VerticalContentAlignment="Center"
ItemsSource="{Binding MapPointApiProviderOptions}"
SelectedItem="{Binding SelectedMapPointApiProviderOption, Mode=TwoWay}"
DisplayMemberPath="DisplayName" />
<ui:TextBox x:Name="MapLabelSearchTextBox"
Grid.Column="1"
Height="32"
PlaceholderText="搜索当前区域下的标点分类"
Text="{Binding MapLabelSearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseLeftButtonDown="MapLabelSearchTextBox_OnPreviewMouseLeftButtonDown" />
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="8,0,0,0">
<ui:Button Height="32"
Padding="12,0"
Background="#FF2B2F37"
Foreground="White"
Content="重置选择"
Command="{Binding ResetSelectedMapLabelSelectionCommand}" />
<ui:Button Margin="8,0,0,0"
Width="32"
Height="32"
Background="#FF2B2F37"
Foreground="White"
Icon="{ui:SymbolIcon Dismiss24}"
Command="{Binding ToggleMapPointPickerCommand}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1" Margin="12,0,12,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" />
<ColumnDefinition Width="12" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Background="#B2232831"
BorderBrush="#1FFFFFFF"
BorderThickness="1"
CornerRadius="10"
Padding="8">
<ui:ListView x:Name="MapLabelCategoriesListView"
ItemsSource="{Binding MapLabelCategories}"
SelectedItem="{Binding SelectedMapLabelCategory, Mode=TwoWay}"
SelectionMode="Single"
Background="Transparent"
BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Auto"
PreviewMouseLeftButtonDown="MapLabelCategoriesListView_OnPreviewMouseLeftButtonDown">
<ui:ListView.ItemTemplate>
<DataTemplate>
<Border Margin="0,1"
Padding="6,6"
Background="Transparent">
<TextBlock Foreground="White"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis" />
</Border>
</DataTemplate>
</ui:ListView.ItemTemplate>
</ui:ListView>
</Border>
<Border Grid.Column="2"
Background="#B2232831"
BorderBrush="#1FFFFFFF"
BorderThickness="1"
CornerRadius="10"
Padding="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ui:TextBlock Grid.Row="0"
Margin="2,0,0,8"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding SelectedMapLabelCategory.Name, TargetNullValue=''}" />
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding MapLabelItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="160"
Height="54"
Margin="0,0,8,8"
Background="#B22C323C"
BorderBrush="#403A424F"
BorderThickness="1"
Padding="8,0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Center"
Command="{Binding DataContext.SelectMapLabelItemCommand, RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
<DockPanel HorizontalAlignment="Stretch"
VerticalAlignment="Center"
LastChildFill="True">
<Border DockPanel.Dock="Left"
Width="36"
Height="36"
CornerRadius="8"
Background="#80232831"
Margin="0,0,4,0">
<Image Width="28"
Height="28"
Stretch="Uniform"
Source="{Binding IconImage}" />
</Border>
<TextBlock DockPanel.Dock="Right"
Width="42"
VerticalAlignment="Center"
HorizontalAlignment="Right"
TextAlignment="Right"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding PointCount}" />
<TextBlock VerticalAlignment="Center"
Foreground="White"
HorizontalAlignment="Stretch"
TextAlignment="Left"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis" />
</DockPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Grid.Row="1"
Visibility="{Binding IsMapLabelTreeLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
Background="#AA232831">
<ui:TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
FontTypography="BodyStrong"
Text="加载中..." />
</Grid>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
<ItemsControl Grid.Row="1"
Grid.Column="3"
Width="64"
MaxHeight="640"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="12,0,0,0"
ItemsSource="{Binding SelectedMapLabelItems}">
<ItemsControl.Style>
<Style TargetType="ItemsControl">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<Trigger Property="HasItems" Value="True">
<Setter Property="Visibility" Value="Visible" />
</Trigger>
<DataTrigger Binding="{Binding IsMapPointPickerOpen}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</ItemsControl.Style>
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<Border Background="#C81F232A"
BorderBrush="#26FFFFFF"
BorderThickness="1"
CornerRadius="12"
Padding="8">
<Border.Effect>
<DropShadowEffect Opacity="0.7" BlurRadius="28" ShadowDepth="0" Color="#FF000000" />
</Border.Effect>
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Padding="0"
Margin="0">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="40"
Height="40"
Margin="0,0,0,8"
Background="Transparent"
BorderThickness="0"
Padding="0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding DataContext.SelectMapLabelItemCommand, RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
<Border Width="40"
Height="40"
CornerRadius="20"
Background="#C82C323C"
BorderBrush="#403A424F"
BorderThickness="1">
<Image Width="30"
Height="30"
Stretch="Uniform"
Source="{Binding IconImage}" />
</Border>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Viewbox Grid.Row="3" Grid.Column="0"
<Viewbox x:Name="MapPointPickerToggleViewbox"
Grid.Row="3"
Grid.Column="0"
Stretch="Uniform"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
@@ -958,6 +704,296 @@
</Border>
</Grid>
</Viewbox>
<Popup AllowsTransparency="True"
IsOpen="{Binding IsMapPointPickerOpen}"
PlacementTarget="{Binding ElementName=MapPointPickerToggleViewbox}"
Placement="Top"
HorizontalOffset="0"
VerticalOffset="{StaticResource MapPointPickerVerticalOffset}"
StaysOpen="True">
<Grid VerticalAlignment="Top">
<Grid.Height>
<MultiBinding Converter="{StaticResource OverlayRelativeOrAbsoluteConverter}">
<Binding Source="{StaticResource MapPointPickerHeightRatio}" />
<Binding Path="MaskWindowHeight" />
</MultiBinding>
</Grid.Height>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="540" />
<ColumnDefinition Width="12" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Width="540"
Background="#C81F232A"
BorderBrush="#26FFFFFF"
BorderThickness="1"
CornerRadius="12">
<Border.Effect>
<DropShadowEffect Opacity="0.7" BlurRadius="28" ShadowDepth="0" Color="#FF000000" />
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="12,12,12,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
Height="32"
MinWidth="140"
Margin="0,0,12,0"
Padding="12,0,6,0"
VerticalContentAlignment="Center"
ItemsSource="{Binding MapPointApiProviderOptions}"
SelectedItem="{Binding SelectedMapPointApiProviderOption, Mode=TwoWay}"
DisplayMemberPath="DisplayName" />
<ui:TextBox x:Name="MapLabelSearchTextBox"
Grid.Column="1"
Height="32"
PlaceholderText="搜索当前区域下的标点分类"
Text="{Binding MapLabelSearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseLeftButtonDown="MapLabelSearchTextBox_OnPreviewMouseLeftButtonDown" />
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="8,0,0,0">
<ui:Button
Width="32"
Height="32"
Background="#FF2B2F37"
Foreground="White"
Icon="{ui:SymbolIcon Dismiss24}"
Command="{Binding ToggleMapPointPickerCommand}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1" Margin="12,0,12,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" />
<ColumnDefinition Width="12" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Background="#B2232831"
BorderBrush="#1FFFFFFF"
BorderThickness="1"
CornerRadius="10"
Padding="8">
<ui:ListView x:Name="MapLabelCategoriesListView"
ItemsSource="{Binding MapLabelCategories}"
SelectedItem="{Binding SelectedMapLabelCategory, Mode=TwoWay}"
SelectionMode="Single"
Background="Transparent"
BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Auto"
PreviewMouseLeftButtonDown="MapLabelCategoriesListView_OnPreviewMouseLeftButtonDown">
<ui:ListView.ItemTemplate>
<DataTemplate>
<Border Margin="0,1"
Padding="6,6"
Background="Transparent">
<TextBlock Foreground="White"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis" />
</Border>
</DataTemplate>
</ui:ListView.ItemTemplate>
</ui:ListView>
</Border>
<Border Grid.Column="2"
Background="#B2232831"
BorderBrush="#1FFFFFFF"
BorderThickness="1"
CornerRadius="10"
Padding="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ui:TextBlock Grid.Row="0"
Margin="2,0,0,8"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding SelectedMapLabelCategory.Name, TargetNullValue=''}" />
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding MapLabelItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="160"
Height="54"
Margin="0,0,8,8"
Background="#B22C323C"
BorderBrush="#403A424F"
BorderThickness="1"
Padding="8,0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Center"
Command="{Binding DataContext.SelectMapLabelItemCommand, RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
<DockPanel HorizontalAlignment="Stretch"
VerticalAlignment="Center"
LastChildFill="True">
<Border DockPanel.Dock="Left"
Width="36"
Height="36"
CornerRadius="8"
Background="#80232831"
Margin="0,0,4,0">
<Image Width="28"
Height="28"
Stretch="Uniform"
Source="{Binding IconImage}" />
</Border>
<TextBlock DockPanel.Dock="Right"
Width="42"
VerticalAlignment="Center"
HorizontalAlignment="Right"
TextAlignment="Right"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding PointCount}" />
<TextBlock VerticalAlignment="Center"
Foreground="White"
HorizontalAlignment="Stretch"
TextAlignment="Left"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis" />
</DockPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Grid.Row="1"
Visibility="{Binding IsMapLabelTreeLoading, Converter={StaticResource BooleanToVisibilityConverter}}"
Background="#AA232831">
<ui:TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
FontTypography="BodyStrong"
Text="加载中..." />
</Grid>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
<ItemsControl Grid.Column="2"
Width="64"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
ItemsSource="{Binding SelectedMapLabelItems}">
<ItemsControl.Style>
<Style TargetType="ItemsControl">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<Trigger Property="HasItems" Value="True">
<Setter Property="Visibility" Value="Visible" />
</Trigger>
</Style.Triggers>
</Style>
</ItemsControl.Style>
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<Border Background="#C81F232A"
BorderBrush="#26FFFFFF"
BorderThickness="1"
CornerRadius="12"
Padding="8">
<Border.Effect>
<DropShadowEffect Opacity="0.7" BlurRadius="28" ShadowDepth="0" Color="#FF000000" />
</Border.Effect>
<DockPanel LastChildFill="True">
<Button DockPanel.Dock="Top"
Width="40"
Height="40"
Margin="0,0,0,8"
Background="Transparent"
BorderThickness="0"
Padding="0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
ToolTip="重置选择"
Command="{Binding ResetSelectedMapLabelSelectionCommand}">
<Border Width="40"
Height="40"
CornerRadius="20"
Background="#C82C323C"
BorderBrush="#403A424F"
BorderThickness="1">
<ui:SymbolIcon Width="22"
Height="22"
Foreground="White"
Symbol="Broom24" />
</Border>
</Button>
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Padding="0"
Margin="0">
<ItemsPresenter />
</ScrollViewer>
</DockPanel>
</Border>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="40"
Height="40"
Margin="0,0,0,8"
Background="Transparent"
BorderThickness="0"
Padding="0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding DataContext.SelectMapLabelItemCommand, RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
<Border Width="40"
Height="40"
CornerRadius="20"
Background="#C82C323C"
BorderBrush="#403A424F"
BorderThickness="1">
<Image Width="30"
Height="30"
Stretch="Uniform"
Source="{Binding IconImage}" />
</Border>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Popup>
</Grid>
</Grid>
+26 -6
View File
@@ -144,7 +144,11 @@ public partial class MaskWindow : Window
return;
}
(DataContext as MaskWindowViewModel)?.PointInfoPopup.CloseCommand.Execute(null);
if (DataContext is MaskWindowViewModel vm)
{
vm.PointInfoPopup.CloseCommand.Execute(null);
vm.IsMapPointPickerOpen = false;
}
if (_mapLabelSearchWindow != null)
{
@@ -159,7 +163,11 @@ public partial class MaskWindow : Window
return;
}
(DataContext as MaskWindowViewModel)?.PointInfoPopup.CloseCommand.Execute(null);
if (DataContext is MaskWindowViewModel vm)
{
vm.PointInfoPopup.CloseCommand.Execute(null);
vm.IsMapPointPickerOpen = false;
}
}
private void OnLoaded(object sender, RoutedEventArgs e)
@@ -205,7 +213,11 @@ public partial class MaskWindow : Window
private void PointsCanvasControlOnViewportChanged(object? sender, EventArgs e)
{
_viewModel?.PointInfoPopup.CloseCommand.Execute(null);
if (_viewModel != null)
{
_viewModel.PointInfoPopup.CloseCommand.Execute(null);
_viewModel.IsMapPointPickerOpen = false;
}
}
protected override void OnClosed(EventArgs e)
@@ -249,6 +261,14 @@ public partial class MaskWindow : Window
Dispatcher.Invoke(UpdateClickThroughState);
}
if (e.PropertyName == nameof(MaskWindowViewModel.IsMapPointPickerOpen))
{
if (_viewModel?.IsMapPointPickerOpen != true && _mapLabelSearchWindow != null)
{
Dispatcher.Invoke(() => _mapLabelSearchWindow.Hide());
}
}
if (e.PropertyName == nameof(MaskWindowViewModel.MapPointLabels))
{
Dispatcher.Invoke(() =>
@@ -385,8 +405,8 @@ public partial class MaskWindow : Window
var point = textbox.PointToScreen(new Point(0, 0));
var popupHeight = _mapLabelSearchWindow.ActualHeight > 0 ? _mapLabelSearchWindow.ActualHeight : _mapLabelSearchWindow.Height;
_mapLabelSearchWindow.Left = point.X;
_mapLabelSearchWindow.Top = point.Y - popupHeight - 4;
_mapLabelSearchWindow.Left = point.X / DpiHelper.ScaleY;
_mapLabelSearchWindow.Top = (point.Y - 4) / DpiHelper.ScaleY - popupHeight;
if (!_mapLabelSearchWindow.IsVisible)
{
@@ -604,4 +624,4 @@ file static class MaskWindowExtension
style |= (int)User32.WindowStyles.WS_CHILD;
_ = User32.SetWindowLong(hWnd, User32.WindowLongFlags.GWL_STYLE, style);
}
}
}
@@ -115,7 +115,7 @@
</Grid.RowDefinitions>
<emoji:TextBlock Grid.Row="0"
Grid.Column="0"
Text="Mirror酱服务 ⚡"
Text="Mirror酱服务 💰"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
@@ -30,7 +30,7 @@ public partial class CheckUpdateWindow : FluentWindow
[ObservableProperty] private bool showOtherUpdateTip = false;
[ObservableProperty] private string selectedGitSource = "Github";
[ObservableProperty] private string selectedGitSource = "CNB";
public string GitSourceDescription => SelectedGitSource == "CNB" ? "【国内】直接从 CNB 下载并更新" : "【国外】直接从 Github 下载并更新";
@@ -68,26 +68,8 @@ public partial class CheckUpdateWindow : FluentWindow
// 隐藏开源渠道和Steambird服务卡片
GitSourceCard.Visibility = Visibility.Collapsed;
SteambirdCard.Visibility = Visibility.Collapsed;
// // 删除前几行
// MyGrid.RowDefinitions.RemoveAt(0);
// MyGrid.RowDefinitions.RemoveAt(0);
//
// // 注意:删除行定义后,需要调整剩余元素的 Grid.Row 属性
// foreach (FrameworkElement child in MyGrid.Children)
// {
// int currentRow = System.Windows.Controls.Grid.GetRow(child);
// if (currentRow > 1) // 如果元素在第三行或之后
// {
// Grid.SetRow(child, currentRow - 2); // 行号减2
// }
// }
//
// if (ServerPanel.Children.Count > 0)
// {
// ServerPanel.Children.RemoveAt(0);
// }
// SteambirdCard.Visibility = Visibility.Collapsed;
SizeToContent = SizeToContent.Height; // 设置高度为自动
UpdateLayout();
}
@@ -186,12 +168,31 @@ public partial class CheckUpdateWindow : FluentWindow
[RelayCommand]
private async Task UpdateFromSteambirdAsync()
{
await RunUpdaterAsync("-I");
if (_option.Channel == UpdateChannel.Stable)
{
await RunUpdaterAsync("-I");
}
else
{
await RunUpdaterAsync("-I --source dfs-alpha");
}
}
[RelayCommand]
private async Task UpdateFromMirrorChyanAsync()
{
// 没输入 CDK 的情况下提示这是收费渠道
if (string.IsNullOrEmpty(MirrorChyanHelper.GetCdk()))
{
var result = await ThemedMessageBox.ShowAsync("Mirror酱是一个【付费】更新渠道!\n更新窗上有多个可用的【免费】国内更新渠道!\n(使用有问题可以直接反馈,或者过一段时间后重试,也可以点击左下角按钮进行手动更新)\n是否继续使用 Mirror酱 渠道更新?",
"您已选择「Mirror酱」作为更新源", System.Windows.MessageBoxButton.OKCancel, ThemedMessageBox.MessageBoxIcon.Warning);
if (result != MessageBoxResult.OK)
{
return;
}
}
var cdk = MirrorChyanHelper.GetAndPromptCdk();
if (string.IsNullOrEmpty(cdk))
{
@@ -352,12 +352,12 @@ public partial class CommonSettingsPageViewModel : ViewModel
});
}
[RelayCommand]
private async Task GotoGithubActionAsync()
{
await Launcher.LaunchUriAsync(
new Uri("https://github.com/babalae/better-genshin-impact/actions/workflows/publish.yml"));
}
// [RelayCommand]
// private async Task GotoGithubActionAsync()
// {
// await Launcher.LaunchUriAsync(
// new Uri("https://github.com/babalae/better-genshin-impact/actions/workflows/publish.yml"));
// }
[RelayCommand]
private async Task OnGameLangSelectionChanged(KeyValuePair<string, string> type)