diff --git a/src/MaaWpfGui/Helper/ItemListHelper.cs b/src/MaaWpfGui/Helper/ItemListHelper.cs index dac0755c77..5a5e817d7e 100644 --- a/src/MaaWpfGui/Helper/ItemListHelper.cs +++ b/src/MaaWpfGui/Helper/ItemListHelper.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Text.Json; +using System.Windows.Media.Imaging; using MaaWpfGui.Constants; using MaaWpfGui.Models; using Serilog; @@ -76,11 +77,29 @@ namespace MaaWpfGui.Helper ArkItems = tempItems ?? new Dictionary(); } + /// + /// 获取当前语言下的物品名称 / Get the name of the item in the current language + /// + /// 物品 id / Item id + /// public static string GetItemName(string itemId) { return ArkItems.TryGetValue(itemId, out var item) ? item.Name : itemId; } + + /// + /// 获取对应物品的图标 / Get the icon of the corresponding item + /// + /// 物品 id / Item id + /// + public static BitmapImage GetItemImage(string itemId) + { + var imagePath = Path.Combine(Environment.CurrentDirectory, $"resource/template/items/{itemId}.png"); + return File.Exists(imagePath) + ? new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)) + : new BitmapImage(); + } } } diff --git a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs index d8e36f09c8..38d8c61f5b 100644 --- a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs @@ -377,6 +377,10 @@ namespace MaaWpfGui.ViewModels.UI { public string Name { get; set; } + public string Id { get; set; } + + public BitmapImage Image { get; set; } + public int Count { get; set; } } @@ -405,7 +409,14 @@ namespace MaaWpfGui.ViewModels.UI DepotResult.Clear(); foreach (var item in details["arkplanner"]?["object"]?["items"]?.Cast()!) { - DepotResultDate result = new DepotResultDate() { Name = (string)item["name"], Count = (int)item["have"] }; + var id = (string)item["id"]; + DepotResultDate result = new DepotResultDate() + { + Id = id, + Name = ItemListHelper.GetItemName(id), + Image = ItemListHelper.GetItemImage(id), + Count = (int)item["have"] + }; DepotResult.Add(result); } diff --git a/src/MaaWpfGui/Views/UI/RecognizerView.xaml b/src/MaaWpfGui/Views/UI/RecognizerView.xaml index ee2d06f699..e378d7daea 100644 --- a/src/MaaWpfGui/Views/UI/RecognizerView.xaml +++ b/src/MaaWpfGui/Views/UI/RecognizerView.xaml @@ -205,15 +205,39 @@ + ItemsSource="{Binding DepotResult}" + ScrollViewer.CanContentScroll="True" + ScrollViewer.HorizontalScrollBarVisibility="Disabled"> - + + + + + + + + + + + + + + + + IsChecked="{Binding GachaShowDisclaimerNoMore}" + IsEnabled="False" />