- 载入编辑器历史ID为空时会产生错误的问题
- 食物动画编辑页面的食物在动画中显示异常的问题
This commit is contained in:
Hakoyu 2024-04-01 19:33:55 +08:00
parent d7b8f23a63
commit c050e0586f
6 changed files with 28 additions and 23 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
@ -32,5 +33,5 @@ public class I18nData : ObservableObjectX<I18nData>
/// <summary>
/// 基于 <see cref="I18nHelper.Current.CultureNames"/> 的索引的数据列表
/// </summary>
//public ObservableList<Func<I18nModel<>>> Datas { get; } = new();
public ObservableList<Func<INotifyPropertyChanged, string>> Datas { get; } = new();
}

View File

@ -32,7 +32,7 @@ public class FoodAnimeLocationModel
#endregion
/// <summary>
/// 范围
/// 矩形位置
/// </summary>
public ObservableRectangleLocation<double> RectangleLocation { get; set; } = new();
@ -55,7 +55,7 @@ public class FoodAnimeLocationModel
/// </summary>
#region Opacity
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private double _opacity;
private double _opacity = 1.0;
public double Opacity
{

View File

@ -26,8 +26,8 @@ public class FoodAnimeEditWindowVM : ObservableObjectX<FoodAnimeEditWindowVM>
_frontPlayerTask = new(FrontPlay);
_backPlayerTask = new(BackPlay);
_foodPlayerTask = new(FoodPlay);
FoodImage = DefaultFoodImage;
PropertyChangedX += FoodAnimeEditWindowVM_PropertyChangedX;
;
PlayCommand.ExecuteAsyncCommand += PlayCommand_AsyncExecuteEvent;
StopCommand.ExecuteCommand += StopCommand_ExecuteEvent;
@ -104,7 +104,7 @@ public class FoodAnimeEditWindowVM : ObservableObjectX<FoodAnimeEditWindowVM>
#region LengthRatio
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private double _lengthRatio;
private double _lengthRatio = 0.5;
/// <summary>
/// 比例
@ -119,7 +119,7 @@ public class FoodAnimeEditWindowVM : ObservableObjectX<FoodAnimeEditWindowVM>
/// <summary>
/// 旧动画
/// </summary>
public FoodAnimeTypeModel OldAnime { get; set; }
public FoodAnimeTypeModel? OldAnime { get; set; }
/// <summary>
/// 动画
@ -612,7 +612,7 @@ public class FoodAnimeEditWindowVM : ObservableObjectX<FoodAnimeEditWindowVM>
private void RemoveFoodLocationCommand_ExecuteEvent(FoodAnimeModel value)
{
value.FoodLocations.Remove(CurrentFoodLocationModel);
CurrentFoodLocationModel = null;
CurrentFoodLocationModel = null!;
}
private void ClearFoodLocationCommand_ExecuteEvent(FoodAnimeModel value)

View File

@ -26,9 +26,9 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
// else
// {
// var cultureIndex = I18nHelper.Current.CultureNames.IndexOf(SearchTarget);
// return d.Datas[cultureIndex]
// .Value.Contains(Search, StringComparison.OrdinalIgnoreCase);
// throw new();
// //return d.Datas[cultureIndex]()
// // .Contains(Search, StringComparison.OrdinalIgnoreCase);
// }
// },
// FilteredList = new()
@ -360,8 +360,8 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
// /// <param name="id"></param>
// /// <param name="i18nModel"></param>
// /// <param name="i18nValue"></param>
// private void AddData<T>(I18nModel<T> i18nModel, string id)
// where T : I18nModel<T>, new()
// private void AddData<T>(string id, Func<T,string> getValue)
// where T : , new()
// {
// if (AllI18nDatas.TryGetValue(id, out var outData))
// {

View File

@ -125,6 +125,7 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
{
if (LPSConvert.DeserializeObject<ModMakeHistory>(line) is not ModMakeHistory history)
continue;
history.ID ??= string.Empty;
set.Add(history);
}
Histories.AddRange(set.OrderByDescending(h => h.LastTime));
@ -181,8 +182,8 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
)
return;
Histories.Clear();
Histories.Clear();
File.WriteAllText(ModMakerInfo.HistoryFile, string.Empty);
if (File.Exists(ModMakerInfo.HistoryFile))
File.WriteAllText(ModMakerInfo.HistoryFile, string.Empty);
}
#endregion

View File

@ -340,6 +340,9 @@
<pu:NumberInput
Grid.Row="2"
Grid.Column="1"
Interval="0.1"
Maximum="1"
Minimum="0"
Value="{Binding Opacity}" />
<Label
Grid.Row="3"
@ -348,7 +351,7 @@
<pu:NumberInput
Grid.Row="3"
Grid.Column="1"
Value="{Binding Rect.Width}" />
Value="{Binding RectangleLocation.Width}" />
<Grid Grid.Row="4" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
@ -360,7 +363,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="X:" />
<pu:NumberInput Grid.Column="1" Value="{Binding Rect.X}" />
<pu:NumberInput Grid.Column="1" Value="{Binding RectangleLocation.X}" />
</Grid>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
@ -368,7 +371,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="Y:" />
<pu:NumberInput Grid.Column="1" Value="{Binding Rect.Y}" />
<pu:NumberInput Grid.Column="1" Value="{Binding RectangleLocation.Y}" />
</Grid>
</Grid>
</Grid>
@ -432,7 +435,7 @@
<Setter Property="Width">
<Setter.Value>
<MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*">
<Binding Path="CurrentFoodLocationModel.Rect.Width" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.Width" />
<Binding Path="LengthRatio" />
</MultiBinding>
</Setter.Value>
@ -441,8 +444,8 @@
<Setter.Value>
<MultiBinding Converter="{StaticResource RatioMarginConverter}">
<Binding Path="LengthRatio" />
<Binding Path="CurrentFoodLocationModel.Rect.X" />
<Binding Path="CurrentFoodLocationModel.Rect.Y" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.X" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.Y" />
</MultiBinding>
</Setter.Value>
</Setter>
@ -480,7 +483,7 @@
<Setter Property="Width">
<Setter.Value>
<MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*">
<Binding Path="CurrentFoodLocationModel.Rect.Width" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.Width" />
<Binding Source="1" />
</MultiBinding>
</Setter.Value>
@ -489,8 +492,8 @@
<Setter.Value>
<MultiBinding Converter="{StaticResource RatioMarginConverter}">
<Binding Source="1" />
<Binding Path="CurrentFoodLocationModel.Rect.X" />
<Binding Path="CurrentFoodLocationModel.Rect.Y" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.X" />
<Binding Path="CurrentFoodLocationModel.RectangleLocation.Y" />
</MultiBinding>
</Setter.Value>
</Setter>