- 载入编辑器历史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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -32,5 +33,5 @@ public class I18nData : ObservableObjectX<I18nData>
/// <summary> /// <summary>
/// 基于 <see cref="I18nHelper.Current.CultureNames"/> 的索引的数据列表 /// 基于 <see cref="I18nHelper.Current.CultureNames"/> 的索引的数据列表
/// </summary> /// </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 #endregion
/// <summary> /// <summary>
/// 范围 /// 矩形位置
/// </summary> /// </summary>
public ObservableRectangleLocation<double> RectangleLocation { get; set; } = new(); public ObservableRectangleLocation<double> RectangleLocation { get; set; } = new();
@ -55,7 +55,7 @@ public class FoodAnimeLocationModel
/// </summary> /// </summary>
#region Opacity #region Opacity
[DebuggerBrowsable(DebuggerBrowsableState.Never)] [DebuggerBrowsable(DebuggerBrowsableState.Never)]
private double _opacity; private double _opacity = 1.0;
public double Opacity public double Opacity
{ {

View File

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

View File

@ -26,9 +26,9 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
// else // else
// { // {
// var cultureIndex = I18nHelper.Current.CultureNames.IndexOf(SearchTarget); // var cultureIndex = I18nHelper.Current.CultureNames.IndexOf(SearchTarget);
// throw new();
// return d.Datas[cultureIndex] // //return d.Datas[cultureIndex]()
// .Value.Contains(Search, StringComparison.OrdinalIgnoreCase); // // .Contains(Search, StringComparison.OrdinalIgnoreCase);
// } // }
// }, // },
// FilteredList = new() // FilteredList = new()
@ -360,8 +360,8 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
// /// <param name="id"></param> // /// <param name="id"></param>
// /// <param name="i18nModel"></param> // /// <param name="i18nModel"></param>
// /// <param name="i18nValue"></param> // /// <param name="i18nValue"></param>
// private void AddData<T>(I18nModel<T> i18nModel, string id) // private void AddData<T>(string id, Func<T,string> getValue)
// where T : I18nModel<T>, new() // where T : , new()
// { // {
// if (AllI18nDatas.TryGetValue(id, out var outData)) // 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) if (LPSConvert.DeserializeObject<ModMakeHistory>(line) is not ModMakeHistory history)
continue; continue;
history.ID ??= string.Empty;
set.Add(history); set.Add(history);
} }
Histories.AddRange(set.OrderByDescending(h => h.LastTime)); Histories.AddRange(set.OrderByDescending(h => h.LastTime));
@ -181,7 +182,7 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
) )
return; return;
Histories.Clear(); Histories.Clear();
Histories.Clear(); if (File.Exists(ModMakerInfo.HistoryFile))
File.WriteAllText(ModMakerInfo.HistoryFile, string.Empty); File.WriteAllText(ModMakerInfo.HistoryFile, string.Empty);
} }
#endregion #endregion

View File

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