mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
move viewmodels
This commit is contained in:
@@ -36,6 +36,7 @@ internal partial class Avatar : IStatisticsItemSource, ISummaryItemSource, IName
|
||||
/// <summary>
|
||||
/// 最大等级
|
||||
/// </summary>
|
||||
[SuppressMessage("", "CA1822")]
|
||||
public int MaxLevel { get => 90; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
using Snap.Hutao.ViewModel.Cultivation;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata.Item;
|
||||
@@ -81,6 +82,7 @@ internal sealed class Material : Display
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Currently only support CN
|
||||
return TypeDescription switch
|
||||
{
|
||||
"角色与武器培养素材" => true,
|
||||
@@ -114,23 +116,23 @@ internal sealed class Material : Display
|
||||
/// 获取物品对应的 DaysOfWeek
|
||||
/// </summary>
|
||||
/// <returns>DaysOfWeek</returns>
|
||||
public Binding.Cultivation.DaysOfWeek GetDaysOfWeek()
|
||||
public DaysOfWeek GetDaysOfWeek()
|
||||
{
|
||||
if (MondayThursdayItems.Contains(Id))
|
||||
{
|
||||
return Binding.Cultivation.DaysOfWeek.MondayAndThursday;
|
||||
return DaysOfWeek.MondayAndThursday;
|
||||
}
|
||||
|
||||
if (TuesdayFridayItems.Contains(Id))
|
||||
{
|
||||
return Binding.Cultivation.DaysOfWeek.TuesdayAndFriday;
|
||||
return DaysOfWeek.TuesdayAndFriday;
|
||||
}
|
||||
|
||||
if (WednesdaySaturdayItems.Contains(Id))
|
||||
{
|
||||
return Binding.Cultivation.DaysOfWeek.WednesdayAndSaturday;
|
||||
return DaysOfWeek.WednesdayAndSaturday;
|
||||
}
|
||||
|
||||
return Binding.Cultivation.DaysOfWeek.Any;
|
||||
return DaysOfWeek.Any;
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,8 @@ using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
using Snap.Hutao.Service.Metadata;
|
||||
using Snap.Hutao.ViewModel.Cultivation;
|
||||
using System.Collections.ObjectModel;
|
||||
using BindingCultivateEntry = Snap.Hutao.Model.Binding.Cultivation.CultivateEntryView;
|
||||
using BindingCultivateItem = Snap.Hutao.Model.Binding.Cultivation.CultivateItem;
|
||||
using BindingInventoryItem = Snap.Hutao.Model.Binding.Inventory.InventoryItem;
|
||||
using BindingStatisticsItem = Snap.Hutao.Model.Binding.Cultivation.StatisticsCultivateItem;
|
||||
|
||||
namespace Snap.Hutao.Service.Cultivation;
|
||||
|
||||
@@ -64,7 +61,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
|
||||
try
|
||||
{
|
||||
Current ??= projects.SingleOrDefault(proj => proj.IsSelected);
|
||||
Current ??= projects.SelectedOrDefault();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException ex)
|
||||
{
|
||||
@@ -129,7 +126,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<BindingInventoryItem> GetInventoryItems(CultivateProject cultivateProject, List<Material> metadata, ICommand saveCommand)
|
||||
public List<InventoryItemView> GetInventoryItems(CultivateProject cultivateProject, List<Material> metadata, ICommand saveCommand)
|
||||
{
|
||||
Guid projectId = cultivateProject.InnerId;
|
||||
using (IServiceScope scope = scopeFactory.CreateScope())
|
||||
@@ -139,7 +136,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
.Where(a => a.ProjectId == projectId)
|
||||
.ToList();
|
||||
|
||||
List<BindingInventoryItem> results = new();
|
||||
List<InventoryItemView> results = new();
|
||||
foreach (Material meta in metadata.Where(m => m.IsInventoryItem()).OrderBy(m => m.Id))
|
||||
{
|
||||
InventoryItem entity = entities.SingleOrDefault(e => e.ItemId == meta.Id) ?? InventoryItem.Create(projectId, meta.Id);
|
||||
@@ -151,7 +148,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<ObservableCollection<BindingCultivateEntry>> GetCultivateEntriesAsync(CultivateProject cultivateProject)
|
||||
public async Task<ObservableCollection<CultivateEntryView>> GetCultivateEntriesAsync(CultivateProject cultivateProject)
|
||||
{
|
||||
await ThreadHelper.SwitchToBackgroundAsync();
|
||||
using (IServiceScope scope = scopeFactory.CreateScope())
|
||||
@@ -163,7 +160,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
Dictionary<AvatarId, Model.Metadata.Avatar.Avatar> idAvatarMap = await metadataService.GetIdToAvatarMapAsync().ConfigureAwait(false);
|
||||
Dictionary<WeaponId, Model.Metadata.Weapon.Weapon> idWeaponMap = await metadataService.GetIdToWeaponMapAsync().ConfigureAwait(false);
|
||||
|
||||
List<BindingCultivateEntry> results = new();
|
||||
List<CultivateEntryView> results = new();
|
||||
List<CultivateEntry> entries = await appDbContext.CultivateEntries
|
||||
.Where(e => e.ProjectId == cultivateProject.InnerId)
|
||||
.ToListAsync()
|
||||
@@ -173,7 +170,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
{
|
||||
Guid entryId = entry.InnerId;
|
||||
|
||||
List<BindingCultivateItem> resultItems = new();
|
||||
List<CultivateItemView> resultItems = new();
|
||||
|
||||
foreach (CultivateItem item in await GetEntryItemsAsync(appDbContext, entryId).ConfigureAwait(false))
|
||||
{
|
||||
@@ -197,11 +194,11 @@ internal sealed class CultivationService : ICultivationService
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<ObservableCollection<BindingStatisticsItem>> GetStatisticsCultivateItemCollectionAsync(CultivateProject cultivateProject, CancellationToken token)
|
||||
public async Task<ObservableCollection<StatisticsCultivateItem>> GetStatisticsCultivateItemCollectionAsync(CultivateProject cultivateProject, CancellationToken token)
|
||||
{
|
||||
using (IServiceScope scope = scopeFactory.CreateScope())
|
||||
{
|
||||
List<BindingStatisticsItem> resultItems = new();
|
||||
List<StatisticsCultivateItem> resultItems = new();
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
List<Material> materials = await scope.ServiceProvider
|
||||
@@ -222,7 +219,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
continue;
|
||||
}
|
||||
|
||||
if (resultItems.SingleOrDefault(i => i.Inner.Id == item.ItemId) is BindingStatisticsItem existedItem)
|
||||
if (resultItems.SingleOrDefault(i => i.Inner.Id == item.ItemId) is StatisticsCultivateItem existedItem)
|
||||
{
|
||||
existedItem.Count += item.Count;
|
||||
}
|
||||
@@ -237,7 +234,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
|
||||
foreach (InventoryItem inventoryItem in await GetProjectInventoryAsync(appDbContext, projectId).ConfigureAwait(false))
|
||||
{
|
||||
if (resultItems.SingleOrDefault(i => i.Inner.Id == inventoryItem.ItemId) is BindingStatisticsItem existedItem)
|
||||
if (resultItems.SingleOrDefault(i => i.Inner.Id == inventoryItem.ItemId) is StatisticsCultivateItem existedItem)
|
||||
{
|
||||
existedItem.TotalCount += inventoryItem.Count;
|
||||
}
|
||||
@@ -264,7 +261,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void SaveInventoryItem(BindingInventoryItem item)
|
||||
public void SaveInventoryItem(InventoryItemView item)
|
||||
{
|
||||
using (IServiceScope scope = scopeFactory.CreateScope())
|
||||
{
|
||||
@@ -295,7 +292,7 @@ internal sealed class CultivationService : ICultivationService
|
||||
|
||||
try
|
||||
{
|
||||
Current ??= appDbContext.CultivateProjects.AsNoTracking().SingleOrDefault(proj => proj.IsSelected);
|
||||
Current ??= appDbContext.CultivateProjects.AsNoTracking().SelectedOrDefault();
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using Snap.Hutao.Model.Binding.Cultivation;
|
||||
using Snap.Hutao.Model.Entity;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.ViewModel.Cultivation;
|
||||
using Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
@@ -35,7 +36,7 @@ internal interface ICultivationService
|
||||
/// <param name="metadata">元数据</param>
|
||||
/// <param name="saveCommand">保存命令</param>
|
||||
/// <returns>物品列表</returns>
|
||||
List<Model.Binding.Inventory.InventoryItem> GetInventoryItems(CultivateProject cultivateProject, List<Material> metadata, ICommand saveCommand);
|
||||
List<InventoryItemView> GetInventoryItems(CultivateProject cultivateProject, List<Material> metadata, ICommand saveCommand);
|
||||
|
||||
/// <summary>
|
||||
/// 获取用于绑定的项目集合
|
||||
@@ -84,7 +85,7 @@ internal interface ICultivationService
|
||||
/// 保存单个物品
|
||||
/// </summary>
|
||||
/// <param name="item">物品</param>
|
||||
void SaveInventoryItem(Model.Binding.Inventory.InventoryItem item);
|
||||
void SaveInventoryItem(InventoryItemView item);
|
||||
|
||||
/// <summary>
|
||||
/// 异步尝试添加新的项目
|
||||
|
||||
@@ -304,9 +304,10 @@ internal sealed class GameService : IGameService
|
||||
bool isElevated = Activation.GetElevated();
|
||||
|
||||
game.Start();
|
||||
|
||||
if (isElevated && launchOptions.MultipleInstances)
|
||||
{
|
||||
await ProcessInterop.DisableProtectionAsync(game, gamePath).ConfigureAwait(false);
|
||||
ProcessInterop.DisableProtection(game, gamePath);
|
||||
}
|
||||
|
||||
if (isElevated && launchOptions.UnlockFps)
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core;
|
||||
using Snap.Hutao.Core.IO;
|
||||
using Snap.Hutao.Service.Game.Unlocker;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Snap.Hutao.Service.Game;
|
||||
|
||||
@@ -69,21 +67,17 @@ internal static class ProcessInterop
|
||||
/// <param name="game">游戏进程</param>
|
||||
/// <param name="gamePath">游戏路径</param>
|
||||
/// <returns>是否禁用成功</returns>
|
||||
public static async Task<bool> DisableProtectionAsync(Process game, string gamePath)
|
||||
public static bool DisableProtection(Process game, string gamePath)
|
||||
{
|
||||
string? gameFolder = Path.GetDirectoryName(gamePath);
|
||||
if (!string.IsNullOrEmpty(gameFolder))
|
||||
{
|
||||
string pbasePath = Path.Combine(gameFolder, "mhypbase.dll");
|
||||
SafeHandle handle = File.OpenHandle(pbasePath, share: FileShare.None);
|
||||
while (true) {
|
||||
if (game.MainWindowHandle != nint.Zero) {
|
||||
handle.Close();
|
||||
break;
|
||||
}
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
string mhypbaseDll = Path.Combine(gameFolder, "mhypbase.dll");
|
||||
using (File.OpenHandle(mhypbaseDll, share: FileShare.None))
|
||||
{
|
||||
SpinWait.SpinUntil(() => game.MainWindowHandle != 0);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -530,4 +530,7 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\Binding\BaseValue\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.Model.Binding.BaseValue;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
||||
xmlns:shct="using:Snap.Hutao.Control.Text"
|
||||
xmlns:shv="using:Snap.Hutao.ViewModel"
|
||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||
d:DataContext="{d:DesignInstance Type=shv:WikiAvatarViewModel}"
|
||||
xmlns:shvw="using:Snap.Hutao.ViewModel.Wiki"
|
||||
d:DataContext="{d:DesignInstance Type=shvw:WikiAvatarViewModel}"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<mxi:Interaction.Behaviors>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.ViewModel;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
namespace Snap.Hutao.View.Page;
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
||||
xmlns:shv="using:Snap.Hutao.ViewModel"
|
||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||
xmlns:shvw="using:Snap.Hutao.ViewModel.Wiki"
|
||||
xmlns:wsc="using:WinUICommunity.SettingsUI.Controls"
|
||||
d:DataContext="{d:DesignInstance Type=shv:WikiMonsterViewModel}"
|
||||
d:DataContext="{d:DesignInstance Type=shvw:WikiMonsterViewModel}"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<mxi:Interaction.Behaviors>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.ViewModel;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
namespace Snap.Hutao.View.Page;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
||||
xmlns:shct="using:Snap.Hutao.Control.Text"
|
||||
xmlns:shv="using:Snap.Hutao.ViewModel"
|
||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||
d:DataContext="{d:DesignInstance Type=shv:WikiWeaponViewModel}"
|
||||
xmlns:shvw="using:Snap.Hutao.ViewModel.Wiki"
|
||||
d:DataContext="{d:DesignInstance Type=shvw:WikiWeaponViewModel}"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<mxi:Interaction.Behaviors>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.ViewModel;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
namespace Snap.Hutao.View.Page;
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.Cultivation;
|
||||
using Snap.Hutao.Model.Binding;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Cultivation;
|
||||
|
||||
/// <summary>
|
||||
/// 养成物品
|
||||
@@ -15,7 +17,7 @@ internal sealed class CultivateEntryView : Item
|
||||
/// <param name="entry">实体入口</param>
|
||||
/// <param name="item">对应物品</param>
|
||||
/// <param name="items">物品列表</param>
|
||||
public CultivateEntryView(Entity.CultivateEntry entry, Item item, List<CultivateItem> items)
|
||||
public CultivateEntryView(Model.Entity.CultivateEntry entry, Item item, List<CultivateItemView> items)
|
||||
{
|
||||
Id = entry.Id;
|
||||
EntryId = entry.InnerId;
|
||||
@@ -39,7 +41,7 @@ internal sealed class CultivateEntryView : Item
|
||||
/// <summary>
|
||||
/// 实体
|
||||
/// </summary>
|
||||
public List<CultivateItem> Items { get; set; } = default!;
|
||||
public List<CultivateItemView> Items { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为今日的材料
|
||||
|
||||
@@ -2,22 +2,23 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Snap.Hutao.Model.Binding;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.Cultivation;
|
||||
namespace Snap.Hutao.ViewModel.Cultivation;
|
||||
|
||||
/// <summary>
|
||||
/// 养成物品
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal sealed class CultivateItem : ObservableObject, IEntityWithMetadata<Entity.CultivateItem, Material>
|
||||
internal sealed class CultivateItemView : ObservableObject, IEntityWithMetadata<Model.Entity.CultivateItem, Material>
|
||||
{
|
||||
/// <summary>
|
||||
/// 养成物品
|
||||
/// </summary>
|
||||
/// <param name="entity">实体</param>
|
||||
/// <param name="inner">元数据</param>
|
||||
public CultivateItem(Entity.CultivateItem entity, Material inner)
|
||||
public CultivateItemView(Model.Entity.CultivateItem entity, Material inner)
|
||||
{
|
||||
Entity = entity;
|
||||
Inner = inner;
|
||||
@@ -31,7 +32,7 @@ internal sealed class CultivateItem : ObservableObject, IEntityWithMetadata<Enti
|
||||
/// <summary>
|
||||
/// 实体
|
||||
/// </summary>
|
||||
public Entity.CultivateItem Entity { get; }
|
||||
public Model.Entity.CultivateItem Entity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否完成此项
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Snap.Hutao.Model.Binding.Cultivation;
|
||||
using Snap.Hutao.Model.Entity;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.Service.Abstraction;
|
||||
@@ -31,7 +30,7 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
|
||||
private ObservableCollection<CultivateProject>? projects;
|
||||
private CultivateProject? selectedProject;
|
||||
private List<Model.Binding.Inventory.InventoryItem>? inventoryItems;
|
||||
private List<InventoryItemView>? inventoryItems;
|
||||
private ObservableCollection<CultivateEntryView>? cultivateEntries;
|
||||
private ObservableCollection<StatisticsCultivateItem>? statisticsItems;
|
||||
|
||||
@@ -39,8 +38,6 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
/// 构造一个新的养成视图模型
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider">服务提供器</param>
|
||||
/// <param name="metadataService">元数据服务</param>
|
||||
/// <param name="logger">日志器</param>
|
||||
public CultivationViewModel(IServiceProvider serviceProvider)
|
||||
{
|
||||
cultivationService = serviceProvider.GetRequiredService<ICultivationService>();
|
||||
@@ -51,9 +48,9 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
AddProjectCommand = new AsyncRelayCommand(AddProjectAsync);
|
||||
RemoveProjectCommand = new AsyncRelayCommand<CultivateProject>(RemoveProjectAsync);
|
||||
RemoveEntryCommand = new AsyncRelayCommand<CultivateEntryView>(RemoveEntryAsync);
|
||||
SaveInventoryItemCommand = new RelayCommand<Model.Binding.Inventory.InventoryItem>(SaveInventoryItem);
|
||||
SaveInventoryItemCommand = new RelayCommand<InventoryItemView>(SaveInventoryItem);
|
||||
NavigateToPageCommand = new RelayCommand<string>(NavigateToPage);
|
||||
FinishStateCommand = new RelayCommand<Model.Binding.Cultivation.CultivateItem>(UpdateFinishedState);
|
||||
FinishStateCommand = new RelayCommand<CultivateItemView>(UpdateFinishedState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,7 +76,7 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
/// <summary>
|
||||
/// 物品列表
|
||||
/// </summary>
|
||||
public List<Model.Binding.Inventory.InventoryItem>? InventoryItems { get => inventoryItems; set => SetProperty(ref inventoryItems, value); }
|
||||
public List<InventoryItemView>? InventoryItems { get => inventoryItems; set => SetProperty(ref inventoryItems, value); }
|
||||
|
||||
/// <summary>
|
||||
/// 养成列表
|
||||
@@ -203,7 +200,7 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveInventoryItem(Model.Binding.Inventory.InventoryItem? inventoryItem)
|
||||
private void SaveInventoryItem(InventoryItemView? inventoryItem)
|
||||
{
|
||||
if (inventoryItem != null)
|
||||
{
|
||||
@@ -212,7 +209,7 @@ internal sealed class CultivationViewModel : Abstraction.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFinishedState(Model.Binding.Cultivation.CultivateItem? item)
|
||||
private void UpdateFinishedState(CultivateItemView? item)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.Cultivation;
|
||||
namespace Snap.Hutao.ViewModel.Cultivation;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏内星期中的天
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Snap.Hutao.Model.Binding;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.Inventory;
|
||||
namespace Snap.Hutao.ViewModel.Cultivation;
|
||||
|
||||
/// <summary>
|
||||
/// 背包物品
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal sealed class InventoryItem : ObservableObject, IEntityWithMetadata<Entity.InventoryItem, Material>
|
||||
internal sealed class InventoryItemView : ObservableObject, IEntityWithMetadata<Model.Entity.InventoryItem, Material>
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建一个新的背包物品
|
||||
@@ -18,7 +19,7 @@ internal sealed class InventoryItem : ObservableObject, IEntityWithMetadata<Enti
|
||||
/// <param name="entity">实体</param>
|
||||
/// <param name="inner">元数据</param>
|
||||
/// <param name="saveCommand">保存命令</param>
|
||||
public InventoryItem(Entity.InventoryItem entity, Material inner, ICommand saveCommand)
|
||||
public InventoryItemView(Model.Entity.InventoryItem entity, Material inner, ICommand saveCommand)
|
||||
{
|
||||
Entity = entity;
|
||||
Inner = inner;
|
||||
@@ -28,7 +29,7 @@ internal sealed class InventoryItem : ObservableObject, IEntityWithMetadata<Enti
|
||||
/// <summary>
|
||||
/// 实体
|
||||
/// </summary>
|
||||
public Entity.InventoryItem Entity { get; set; }
|
||||
public Model.Entity.InventoryItem Entity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 元数据
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.Cultivation;
|
||||
namespace Snap.Hutao.ViewModel.Cultivation;
|
||||
|
||||
/// <summary>
|
||||
/// 仅用于统计总数的养成物品
|
||||
@@ -16,7 +16,7 @@ internal sealed class StatisticsCultivateItem
|
||||
/// </summary>
|
||||
/// <param name="inner">材料</param>
|
||||
/// <param name="entity">实体</param>
|
||||
public StatisticsCultivateItem(Material inner, Entity.CultivateItem entity)
|
||||
public StatisticsCultivateItem(Material inner, Model.Entity.CultivateItem entity)
|
||||
{
|
||||
Inner = inner;
|
||||
Count = entity.Count;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Binding;
|
||||
using Snap.Hutao.Service.Game;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 截图
|
||||
/// </summary>
|
||||
internal sealed class Screenshot : INameIcon
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造一个新的截图
|
||||
/// </summary>
|
||||
/// <param name="path">路径</param>
|
||||
public Screenshot(string path)
|
||||
{
|
||||
Name = $"{new FileInfo(path).CreationTime}";
|
||||
Icon = path.ToUri();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Uri Icon { get; }
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Service.Game;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 截图视图模型
|
||||
/// </summary>
|
||||
[Injection(InjectAs.Scoped)]
|
||||
internal sealed class ScreenshotViewModel : Abstraction.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造一个新的截图视图模型
|
||||
/// </summary>
|
||||
/// <param name="gameService">游戏服务</param>
|
||||
public ScreenshotViewModel(IGameService gameService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -272,15 +272,16 @@ internal sealed class SettingViewModel : Abstraction.ViewModel
|
||||
|
||||
private async Task SetDataFolderAsync()
|
||||
{
|
||||
IPickerFactory pickerFactory = serviceProvider.GetRequiredService<IPickerFactory>();
|
||||
FolderPicker picker = pickerFactory.GetFolderPicker();
|
||||
(bool isOk, string folder) = await picker.TryPickSingleFolderAsync().ConfigureAwait(false);
|
||||
(bool isOk, string folder) = await serviceProvider
|
||||
.GetRequiredService<IPickerFactory>()
|
||||
.GetFolderPicker()
|
||||
.TryPickSingleFolderAsync()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
IInfoBarService infoBarService = serviceProvider.GetRequiredService<IInfoBarService>();
|
||||
if (isOk)
|
||||
{
|
||||
LocalSetting.Set(SettingKeys.DataFolderPath, folder);
|
||||
infoBarService.Success(SH.ViewModelSettingSetDataFolderSuccess);
|
||||
serviceProvider.GetRequiredService<IInfoBarService>().Success(SH.ViewModelSettingSetDataFolderSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,8 +293,7 @@ internal sealed class SettingViewModel : Abstraction.ViewModel
|
||||
|
||||
private void CopyDeviceId()
|
||||
{
|
||||
IInfoBarService infoBarService = serviceProvider.GetRequiredService<IInfoBarService>();
|
||||
Clipboard.SetText(DeviceId);
|
||||
infoBarService.Success(SH.ViewModelSettingCopyDeviceIdSuccess);
|
||||
serviceProvider.GetRequiredService<IInfoBarService>().Success(SH.ViewModelSettingCopyDeviceIdSuccess);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata;
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.BaseValue;
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
/// <summary>
|
||||
/// 基础数值信息
|
||||
@@ -101,7 +102,7 @@ internal sealed class BaseValueInfo : ObservableObject
|
||||
value += addValue;
|
||||
}
|
||||
|
||||
values.Add(Metadata.Converter.PropertyDescriptor.FormatNameValue(propValue.Property, value));
|
||||
values.Add(Model.Metadata.Converter.PropertyDescriptor.FormatNameValue(propValue.Property, value));
|
||||
}
|
||||
|
||||
Values = values;
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
|
||||
namespace Snap.Hutao.Model.Binding.BaseValue;
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗属性与初始值
|
||||
@@ -5,7 +5,6 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Snap.Hutao.Model.Binding.BaseValue;
|
||||
using Snap.Hutao.Model.Binding.Hutao;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
@@ -30,7 +29,7 @@ using CalcConsumption = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.Consumptio
|
||||
using CalcItem = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.Item;
|
||||
using CalcItemHelper = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.ItemHelper;
|
||||
|
||||
namespace Snap.Hutao.ViewModel;
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
/// <summary>
|
||||
/// 角色资料视图模型
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Snap.Hutao.Model.Binding.BaseValue;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.Model.Metadata.Monster;
|
||||
@@ -11,7 +10,7 @@ using Snap.Hutao.Model.Primitive;
|
||||
using Snap.Hutao.Service.Metadata;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Snap.Hutao.ViewModel;
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
/// <summary>
|
||||
/// 怪物资料视图模型
|
||||
@@ -5,7 +5,6 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Snap.Hutao.Model.Binding.BaseValue;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Intrinsic.Immutable;
|
||||
@@ -26,7 +25,7 @@ using CalcAvatarPromotionDelta = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.A
|
||||
using CalcClient = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.CalculateClient;
|
||||
using CalcConsumption = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.Consumption;
|
||||
|
||||
namespace Snap.Hutao.ViewModel;
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
/// <summary>
|
||||
/// 武器资料视图模型
|
||||
Reference in New Issue
Block a user