mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
实装 WorkEdit
This commit is contained in:
parent
22be8ad961
commit
c3a20d84c8
@ -56,10 +56,7 @@ public class ClickTextModel : I18nModel<I18nClickTextModel>
|
|||||||
Feel = clickText.Feel.Copy();
|
Feel = clickText.Feel.Copy();
|
||||||
Strength = clickText.Strength.Copy();
|
Strength = clickText.Strength.Copy();
|
||||||
foreach (var item in clickText.I18nDatas)
|
foreach (var item in clickText.I18nDatas)
|
||||||
{
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
I18nDatas[item.Key] = new();
|
|
||||||
I18nDatas[item.Key].Text.Value = clickText.I18nDatas[item.Key].Text.Value;
|
|
||||||
}
|
|
||||||
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,4 +110,11 @@ public class ClickTextModel : I18nModel<I18nClickTextModel>
|
|||||||
public class I18nClickTextModel
|
public class I18nClickTextModel
|
||||||
{
|
{
|
||||||
public ObservableValue<string> Text { get; } = new();
|
public ObservableValue<string> Text { get; } = new();
|
||||||
|
|
||||||
|
public I18nClickTextModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nClickTextModel();
|
||||||
|
result.Text.Value = Text.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
15
VPet.ModMaker/Models/Expansions.cs
Normal file
15
VPet.ModMaker/Models/Expansions.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.Models;
|
||||||
|
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
public static bool Contains(this string source, string value, StringComparison comparisonType)
|
||||||
|
{
|
||||||
|
return source.IndexOf(value, comparisonType) >= 0;
|
||||||
|
}
|
||||||
|
}
|
@ -39,28 +39,24 @@ public class FoodModel : I18nModel<I18nFoodModel>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public FoodModel(FoodModel food)
|
public FoodModel(FoodModel model)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
Name.Value = food.Name.Value;
|
Name.Value = model.Name.Value;
|
||||||
Description.Value = food.Description.Value;
|
Description.Value = model.Description.Value;
|
||||||
Graph.Value = food.Graph.Value;
|
Graph.Value = model.Graph.Value;
|
||||||
Type.Value = food.Type.Value;
|
Type.Value = model.Type.Value;
|
||||||
Strength.Value = food.Strength.Value;
|
Strength.Value = model.Strength.Value;
|
||||||
StrengthFood.Value = food.StrengthFood.Value;
|
StrengthFood.Value = model.StrengthFood.Value;
|
||||||
StrengthDrink.Value = food.StrengthDrink.Value;
|
StrengthDrink.Value = model.StrengthDrink.Value;
|
||||||
Feeling.Value = food.Feeling.Value;
|
Feeling.Value = model.Feeling.Value;
|
||||||
Health.Value = food.Health.Value;
|
Health.Value = model.Health.Value;
|
||||||
Likability.Value = food.Likability.Value;
|
Likability.Value = model.Likability.Value;
|
||||||
Price.Value = food.Price.Value;
|
Price.Value = model.Price.Value;
|
||||||
Exp.Value = food.Exp.Value;
|
Exp.Value = model.Exp.Value;
|
||||||
Image.Value = Utils.LoadImageToStream(food.Image.Value);
|
Image.Value = Utils.LoadImageToStream(model.Image.Value);
|
||||||
foreach (var item in food.I18nDatas)
|
foreach (var item in model.I18nDatas)
|
||||||
{
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
I18nDatas[item.Key] = new();
|
|
||||||
I18nDatas[item.Key].Name.Value = food.I18nDatas[item.Key].Name.Value;
|
|
||||||
I18nDatas[item.Key].Description.Value = food.I18nDatas[item.Key].Description.Value;
|
|
||||||
}
|
|
||||||
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,4 +108,12 @@ public class I18nFoodModel
|
|||||||
{
|
{
|
||||||
public ObservableValue<string> Name { get; } = new();
|
public ObservableValue<string> Name { get; } = new();
|
||||||
public ObservableValue<string> Description { get; } = new();
|
public ObservableValue<string> Description { get; } = new();
|
||||||
|
|
||||||
|
public I18nFoodModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nFoodModel();
|
||||||
|
result.Name.Value = Name.Value;
|
||||||
|
result.Description.Value = Description.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,9 @@ public class LowTextModel : I18nModel<I18nLowTextModel>
|
|||||||
Mode.Value = lowText.Mode.Value;
|
Mode.Value = lowText.Mode.Value;
|
||||||
Strength.Value = lowText.Strength.Value;
|
Strength.Value = lowText.Strength.Value;
|
||||||
Like.Value = lowText.Like.Value;
|
Like.Value = lowText.Like.Value;
|
||||||
|
|
||||||
foreach (var item in lowText.I18nDatas)
|
foreach (var item in lowText.I18nDatas)
|
||||||
{
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
I18nDatas[item.Key] = item.Value;
|
|
||||||
I18nDatas[item.Key].Text.Value = lowText.I18nDatas[item.Key].Text.Value;
|
|
||||||
}
|
|
||||||
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,4 +65,11 @@ public class LowTextModel : I18nModel<I18nLowTextModel>
|
|||||||
public class I18nLowTextModel
|
public class I18nLowTextModel
|
||||||
{
|
{
|
||||||
public ObservableValue<string> Text { get; } = new();
|
public ObservableValue<string> Text { get; } = new();
|
||||||
|
|
||||||
|
public I18nLowTextModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nLowTextModel();
|
||||||
|
result.Text.Value = Text.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace VPet.ModMaker.Models;
|
|||||||
|
|
||||||
public class ModInfoModel : I18nModel<I18nModInfoModel>
|
public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||||
{
|
{
|
||||||
|
public const string ModInfoFile = "info.lps";
|
||||||
public static ModInfoModel Current { get; set; } = new();
|
public static ModInfoModel Current { get; set; } = new();
|
||||||
|
|
||||||
public ObservableValue<string> Name { get; } = new();
|
public ObservableValue<string> Name { get; } = new();
|
||||||
@ -26,11 +27,13 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
public ObservableValue<string> GameVersion { get; } = new();
|
public ObservableValue<string> GameVersion { get; } = new();
|
||||||
public ObservableValue<string> ModVersion { get; } = new();
|
public ObservableValue<string> ModVersion { get; } = new();
|
||||||
public ObservableValue<BitmapImage> Image { get; } = new();
|
public ObservableValue<BitmapImage> Image { get; } = new();
|
||||||
|
public ObservableValue<string> SourcePath { get; } = new();
|
||||||
|
|
||||||
public ObservableCollection<FoodModel> Foods { get; } = new();
|
public ObservableCollection<FoodModel> Foods { get; } = new();
|
||||||
public ObservableCollection<ClickTextModel> ClickTexts { get; } = new();
|
public ObservableCollection<ClickTextModel> ClickTexts { get; } = new();
|
||||||
public ObservableCollection<LowTextModel> LowTexts { get; } = new();
|
public ObservableCollection<LowTextModel> LowTexts { get; } = new();
|
||||||
public ObservableCollection<SelectTextModel> SelectTexts { get; } = new();
|
public ObservableCollection<SelectTextModel> SelectTexts { get; } = new();
|
||||||
public ObservableValue<string> SourcePath { get; } = new();
|
public ObservableCollection<PetModel> Pets { get; } = new();
|
||||||
|
|
||||||
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
|
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
|
||||||
|
|
||||||
@ -63,23 +66,76 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
LowTexts.Add(new(lowText));
|
LowTexts.Add(new(lowText));
|
||||||
foreach (var selectText in loader.SelectTexts)
|
foreach (var selectText in loader.SelectTexts)
|
||||||
SelectTexts.Add(new(selectText));
|
SelectTexts.Add(new(selectText));
|
||||||
|
foreach (var pet in loader.Pets)
|
||||||
|
Pets.Add(new(pet));
|
||||||
|
|
||||||
Summary.Value = GetSummary();
|
|
||||||
foreach (var lang in loader.I18nDatas)
|
foreach (var lang in loader.I18nDatas)
|
||||||
I18nDatas.Add(lang.Key, lang.Value);
|
I18nDatas.Add(lang.Key, lang.Value);
|
||||||
OtherI18nDatas = loader.OtherI18nDatas;
|
OtherI18nDatas = loader.OtherI18nDatas;
|
||||||
|
|
||||||
|
LoadI18nData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSummary()
|
private void LoadI18nData()
|
||||||
{
|
{
|
||||||
return @"包含以下内容:
|
foreach (var lang in I18nDatas)
|
||||||
食物: {0}
|
{
|
||||||
点击文本: {1}
|
if (I18nHelper.Current.CultureNames.Contains(lang.Key) is false)
|
||||||
低状态文本: {2}".Translate(Foods.Count, ClickTexts.Count, LowTexts.Count);
|
I18nHelper.Current.CultureNames.Add(lang.Key);
|
||||||
|
}
|
||||||
|
if (I18nHelper.Current.CultureNames.Count > 0)
|
||||||
|
{
|
||||||
|
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
|
||||||
|
foreach (var i18nData in OtherI18nDatas)
|
||||||
|
{
|
||||||
|
foreach (var food in Foods)
|
||||||
|
{
|
||||||
|
var foodI18n = food.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(food.Name.Value, out var name))
|
||||||
|
foodI18n.Name.Value = name;
|
||||||
|
if (i18nData.Value.TryGetValue(food.Description.Value, out var description))
|
||||||
|
foodI18n.Description.Value = description;
|
||||||
|
}
|
||||||
|
foreach (var lowText in LowTexts)
|
||||||
|
{
|
||||||
|
var lowTextI18n = lowText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(lowText.Name.Value, out var text))
|
||||||
|
lowTextI18n.Text.Value = text;
|
||||||
|
}
|
||||||
|
foreach (var clickText in ClickTexts)
|
||||||
|
{
|
||||||
|
var clickTextI18n = clickText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(clickText.Name.Value, out var text))
|
||||||
|
clickTextI18n.Text.Value = text;
|
||||||
|
}
|
||||||
|
foreach (var selectText in SelectTexts)
|
||||||
|
{
|
||||||
|
var selectTextI18n = selectText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(selectText.Name.Value, out var text))
|
||||||
|
selectTextI18n.Text.Value = text;
|
||||||
|
if (i18nData.Value.TryGetValue(selectText.Choose.Value, out var choose))
|
||||||
|
selectTextI18n.Choose.Value = choose;
|
||||||
|
}
|
||||||
|
foreach (var pet in Pets)
|
||||||
|
{
|
||||||
|
var petI18n = pet.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(pet.Name.Value, out var name))
|
||||||
|
petI18n.Name.Value = name;
|
||||||
|
if (i18nData.Value.TryGetValue(pet.PetName.Value, out var petName))
|
||||||
|
petI18n.PetName.Value = petName;
|
||||||
|
if (i18nData.Value.TryGetValue(pet.Description.Value, out var description))
|
||||||
|
petI18n.Description.Value = description;
|
||||||
|
foreach (var work in pet.Works)
|
||||||
|
{
|
||||||
|
var workI18n = work.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(work.Name.Value, out var workName))
|
||||||
|
workI18n.Name.Value = workName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public const string ModInfoFile = "info.lps";
|
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
SaveTo(SourcePath.Value);
|
SaveTo(SourcePath.Value);
|
||||||
|
@ -1,55 +1,210 @@
|
|||||||
using HKW.HKWViewModels.SimpleObservable;
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using VPet_Simulator.Core;
|
||||||
|
|
||||||
namespace VPet.ModMaker.Models;
|
namespace VPet.ModMaker.Models;
|
||||||
|
|
||||||
public class PetModel : I18nModel<I18nPetInfoModel>
|
public class PetModel : I18nModel<I18nPetInfoModel>
|
||||||
{
|
{
|
||||||
public ObservableValue<string> Id { get; } = new();
|
public ObservableValue<string> Name { get; } = new();
|
||||||
public ObservableValue<BitmapImage> Image { get; } = new();
|
public ObservableValue<string> PetName { get; } = new();
|
||||||
public ObservableValue<ObservableInt32Rect> TouchHeadRect { get; } = new(new());
|
public ObservableValue<string> Description { get; } = new();
|
||||||
public ObservableValue<MultiStateRect> TouchRaisedRect { get; } = new(new());
|
public ObservableValue<ObservableRect<double>> TouchHeadRect { get; } = new(new());
|
||||||
public ObservableValue<MultiStatePoint> RaisePoint { get; } = new(new());
|
public ObservableValue<ObservableMultiStateRect> TouchRaisedRect { get; } = new(new());
|
||||||
|
public ObservableValue<ObservableMultiStatePoint> RaisePoint { get; } = new(new());
|
||||||
|
|
||||||
|
public ObservableCollection<WorkModel> Works { get; } = new();
|
||||||
|
|
||||||
|
public PetModel()
|
||||||
|
{
|
||||||
|
PetName.Value = $"{Name.Value}_{nameof(PetName)}";
|
||||||
|
Description.Value = $"{Name.Value}_{nameof(Description)}";
|
||||||
|
Name.ValueChanged += (v) =>
|
||||||
|
{
|
||||||
|
PetName.Value = $"{v}_{nameof(PetName)}";
|
||||||
|
Description.Value = $"{v}_{nameof(Description)}";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public PetModel(PetModel model)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
Name.Value = model.Name.Value;
|
||||||
|
TouchHeadRect.Value = model.TouchHeadRect.Value.Copy();
|
||||||
|
TouchRaisedRect.Value = model.TouchRaisedRect.Value.Copy();
|
||||||
|
RaisePoint.Value = model.RaisePoint.Value.Copy();
|
||||||
|
foreach (var work in model.Works)
|
||||||
|
Works.Add(work);
|
||||||
|
|
||||||
|
foreach (var item in model.I18nDatas)
|
||||||
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
|
}
|
||||||
|
|
||||||
|
public PetModel(PetLoader loader)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
Name.Value = loader.Name;
|
||||||
|
PetName.Value = loader.PetName;
|
||||||
|
Description.Value = loader.Intor;
|
||||||
|
|
||||||
|
TouchHeadRect.Value.SetValue(
|
||||||
|
loader.Config.TouchHeadLocate.X,
|
||||||
|
loader.Config.TouchHeadLocate.Y,
|
||||||
|
loader.Config.TouchHeadSize.Width,
|
||||||
|
loader.Config.TouchHeadSize.Height
|
||||||
|
);
|
||||||
|
|
||||||
|
TouchRaisedRect.Value.Happy.Value.SetValue(
|
||||||
|
loader.Config.TouchRaisedLocate[0].X,
|
||||||
|
loader.Config.TouchRaisedLocate[0].Y,
|
||||||
|
loader.Config.TouchRaisedSize[0].Width,
|
||||||
|
loader.Config.TouchRaisedSize[0].Height
|
||||||
|
);
|
||||||
|
TouchRaisedRect.Value.Nomal.Value.SetValue(
|
||||||
|
loader.Config.TouchRaisedLocate[1].X,
|
||||||
|
loader.Config.TouchRaisedLocate[1].Y,
|
||||||
|
loader.Config.TouchRaisedSize[1].Width,
|
||||||
|
loader.Config.TouchRaisedSize[1].Height
|
||||||
|
);
|
||||||
|
TouchRaisedRect.Value.PoorCondition.Value.SetValue(
|
||||||
|
loader.Config.TouchRaisedLocate[2].X,
|
||||||
|
loader.Config.TouchRaisedLocate[2].Y,
|
||||||
|
loader.Config.TouchRaisedSize[2].Width,
|
||||||
|
loader.Config.TouchRaisedSize[2].Height
|
||||||
|
);
|
||||||
|
TouchRaisedRect.Value.Ill.Value.SetValue(
|
||||||
|
loader.Config.TouchRaisedLocate[3].X,
|
||||||
|
loader.Config.TouchRaisedLocate[3].Y,
|
||||||
|
loader.Config.TouchRaisedSize[3].Width,
|
||||||
|
loader.Config.TouchRaisedSize[3].Height
|
||||||
|
);
|
||||||
|
|
||||||
|
RaisePoint.Value.Happy.Value.SetValue(
|
||||||
|
loader.Config.RaisePoint[0].X,
|
||||||
|
loader.Config.RaisePoint[0].Y
|
||||||
|
);
|
||||||
|
RaisePoint.Value.Nomal.Value.SetValue(
|
||||||
|
loader.Config.RaisePoint[1].X,
|
||||||
|
loader.Config.RaisePoint[1].Y
|
||||||
|
);
|
||||||
|
RaisePoint.Value.PoorCondition.Value.SetValue(
|
||||||
|
loader.Config.RaisePoint[2].X,
|
||||||
|
loader.Config.RaisePoint[2].Y
|
||||||
|
);
|
||||||
|
RaisePoint.Value.Ill.Value.SetValue(
|
||||||
|
loader.Config.RaisePoint[3].X,
|
||||||
|
loader.Config.RaisePoint[3].Y
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach (var work in loader.Config.Works)
|
||||||
|
Works.Add(new(work));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class I18nPetInfoModel
|
public class I18nPetInfoModel
|
||||||
{
|
{
|
||||||
public ObservableValue<string> Name { get; set; } = new();
|
public ObservableValue<string> Name { get; } = new();
|
||||||
public ObservableValue<string> Description { get; set; } = new();
|
public ObservableValue<string> PetName { get; } = new();
|
||||||
|
public ObservableValue<string> Description { get; } = new();
|
||||||
|
|
||||||
|
public I18nPetInfoModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nPetInfoModel();
|
||||||
|
result.Name.Value = Name.Value;
|
||||||
|
result.PetName.Value = PetName.Value;
|
||||||
|
result.Description.Value = Description.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MultiStateRect
|
public class ObservableMultiStateRect
|
||||||
{
|
{
|
||||||
public ObservableValue<ObservableInt32Rect> Happy { get; } = new(new());
|
public ObservableValue<ObservableRect<double>> Happy { get; } = new(new());
|
||||||
public ObservableValue<ObservableInt32Rect> Nomal { get; } = new(new());
|
public ObservableValue<ObservableRect<double>> Nomal { get; } = new(new());
|
||||||
public ObservableValue<ObservableInt32Rect> PoorCondition { get; } = new(new());
|
public ObservableValue<ObservableRect<double>> PoorCondition { get; } = new(new());
|
||||||
public ObservableValue<ObservableInt32Rect> Ill { get; } = new(new());
|
public ObservableValue<ObservableRect<double>> Ill { get; } = new(new());
|
||||||
|
|
||||||
|
public ObservableMultiStateRect Copy()
|
||||||
|
{
|
||||||
|
var result = new ObservableMultiStateRect();
|
||||||
|
result.Happy.Value = Happy.Value.Copy();
|
||||||
|
result.Nomal.Value = Nomal.Value.Copy();
|
||||||
|
result.PoorCondition.Value = PoorCondition.Value.Copy();
|
||||||
|
result.Ill.Value = Ill.Value.Copy();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MultiStatePoint
|
public class ObservableMultiStatePoint
|
||||||
{
|
{
|
||||||
public ObservableValue<ObservablePoint> Happy { get; } = new(new());
|
public ObservableValue<ObservablePoint<double>> Happy { get; } = new(new());
|
||||||
public ObservableValue<ObservablePoint> Nomal { get; } = new(new());
|
public ObservableValue<ObservablePoint<double>> Nomal { get; } = new(new());
|
||||||
public ObservableValue<ObservablePoint> PoorCondition { get; } = new(new());
|
public ObservableValue<ObservablePoint<double>> PoorCondition { get; } = new(new());
|
||||||
public ObservableValue<ObservablePoint> Ill { get; } = new(new());
|
public ObservableValue<ObservablePoint<double>> Ill { get; } = new(new());
|
||||||
|
|
||||||
|
public ObservableMultiStatePoint Copy()
|
||||||
|
{
|
||||||
|
var result = new ObservableMultiStatePoint();
|
||||||
|
result.Happy.Value = Happy.Value.Copy();
|
||||||
|
result.Nomal.Value = Nomal.Value.Copy();
|
||||||
|
result.PoorCondition.Value = PoorCondition.Value.Copy();
|
||||||
|
result.Ill.Value = Ill.Value.Copy();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObservableInt32Rect
|
public class ObservableRect<T>
|
||||||
{
|
{
|
||||||
public ObservableValue<int> X { get; } = new();
|
public ObservableValue<T> X { get; } = new();
|
||||||
public ObservableValue<int> Y { get; } = new();
|
public ObservableValue<T> Y { get; } = new();
|
||||||
public ObservableValue<int> Width { get; } = new();
|
public ObservableValue<T> Width { get; } = new();
|
||||||
public ObservableValue<int> Height { get; } = new();
|
public ObservableValue<T> Height { get; } = new();
|
||||||
|
|
||||||
|
public void SetValue(T x, T y, T width, T hetght)
|
||||||
|
{
|
||||||
|
X.Value = x;
|
||||||
|
Y.Value = y;
|
||||||
|
Width.Value = width;
|
||||||
|
Height.Value = hetght;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableRect<T> Copy()
|
||||||
|
{
|
||||||
|
var result = new ObservableRect<T>();
|
||||||
|
result.X.Value = X.Value;
|
||||||
|
result.Y.Value = Y.Value;
|
||||||
|
result.Width.Value = Width.Value;
|
||||||
|
result.Height.Value = Height.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObservablePoint
|
public class ObservablePoint<T>
|
||||||
{
|
{
|
||||||
public ObservableValue<double> X { get; } = new();
|
public ObservableValue<T> X { get; } = new();
|
||||||
public ObservableValue<double> Y { get; } = new();
|
public ObservableValue<T> Y { get; } = new();
|
||||||
|
|
||||||
|
public void SetValue(T x, T y)
|
||||||
|
{
|
||||||
|
X.Value = x;
|
||||||
|
Y.Value = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservablePoint<T> Copy()
|
||||||
|
{
|
||||||
|
var result = new ObservablePoint<T>();
|
||||||
|
result.X.Value = X.Value;
|
||||||
|
result.Y.Value = Y.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,8 @@ public class SelectTextModel : I18nModel<I18nSelectTextModel>
|
|||||||
{
|
{
|
||||||
Name.Value = model.Name.Value;
|
Name.Value = model.Name.Value;
|
||||||
Mode.Value = model.Mode.Value;
|
Mode.Value = model.Mode.Value;
|
||||||
|
Tags.Value = model.Tags.Value;
|
||||||
|
ToTags.Value = model.ToTags.Value;
|
||||||
//Working.Value = model.Working.Value;
|
//Working.Value = model.Working.Value;
|
||||||
//WorkingState.Value = model.WorkingState.Value;
|
//WorkingState.Value = model.WorkingState.Value;
|
||||||
//DayTime.Value = model.DayTime.Value;
|
//DayTime.Value = model.DayTime.Value;
|
||||||
@ -68,12 +70,9 @@ public class SelectTextModel : I18nModel<I18nSelectTextModel>
|
|||||||
Drink = model.Drink.Copy();
|
Drink = model.Drink.Copy();
|
||||||
Feel = model.Feel.Copy();
|
Feel = model.Feel.Copy();
|
||||||
Strength = model.Strength.Copy();
|
Strength = model.Strength.Copy();
|
||||||
|
|
||||||
foreach (var item in model.I18nDatas)
|
foreach (var item in model.I18nDatas)
|
||||||
{
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
I18nDatas[item.Key] = new();
|
|
||||||
I18nDatas[item.Key].Text.Value = model.I18nDatas[item.Key].Text.Value;
|
|
||||||
I18nDatas[item.Key].Choose.Value = model.I18nDatas[item.Key].Choose.Value;
|
|
||||||
}
|
|
||||||
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +82,8 @@ public class SelectTextModel : I18nModel<I18nSelectTextModel>
|
|||||||
Name.Value = text.Text;
|
Name.Value = text.Text;
|
||||||
Choose.Value = text.Choose ?? string.Empty;
|
Choose.Value = text.Choose ?? string.Empty;
|
||||||
Mode.Value = text.Mode;
|
Mode.Value = text.Mode;
|
||||||
|
Tags.Value = text.Tags is null ? string.Empty : string.Join(", ", text.Tags);
|
||||||
|
ToTags.Value = text.ToTags is null ? string.Empty : string.Join(", ", text.ToTags);
|
||||||
//Working.Value = text.Working;
|
//Working.Value = text.Working;
|
||||||
//WorkingState.Value = text.State;
|
//WorkingState.Value = text.State;
|
||||||
//DayTime.Value = text.DaiTime;
|
//DayTime.Value = text.DaiTime;
|
||||||
@ -96,6 +97,8 @@ public class SelectTextModel : I18nModel<I18nSelectTextModel>
|
|||||||
Strength.SetValue(text.StrengthMin, text.StrengthMax);
|
Strength.SetValue(text.StrengthMin, text.StrengthMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly static char[] rs_splitChar = { ',', ' ' };
|
||||||
|
|
||||||
public SelectText ToSelectText()
|
public SelectText ToSelectText()
|
||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
@ -103,6 +106,8 @@ public class SelectTextModel : I18nModel<I18nSelectTextModel>
|
|||||||
Text = Name.Value,
|
Text = Name.Value,
|
||||||
Choose = Choose.Value,
|
Choose = Choose.Value,
|
||||||
Mode = Mode.Value,
|
Mode = Mode.Value,
|
||||||
|
Tags = new(Tags.Value.Split(rs_splitChar, StringSplitOptions.RemoveEmptyEntries)),
|
||||||
|
ToTags = new(ToTags.Value.Split(rs_splitChar, StringSplitOptions.RemoveEmptyEntries)),
|
||||||
//Working = Working.Value,
|
//Working = Working.Value,
|
||||||
//State = WorkingState.Value,
|
//State = WorkingState.Value,
|
||||||
//DaiTime = DayTime.Value,
|
//DaiTime = DayTime.Value,
|
||||||
@ -130,4 +135,12 @@ public class I18nSelectTextModel
|
|||||||
{
|
{
|
||||||
public ObservableValue<string> Choose { get; } = new();
|
public ObservableValue<string> Choose { get; } = new();
|
||||||
public ObservableValue<string> Text { get; } = new();
|
public ObservableValue<string> Text { get; } = new();
|
||||||
|
|
||||||
|
public I18nSelectTextModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nSelectTextModel();
|
||||||
|
result.Text.Value = Text.Value;
|
||||||
|
result.Choose.Value = Choose.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
142
VPet.ModMaker/Models/WorkModel.cs
Normal file
142
VPet.ModMaker/Models/WorkModel.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.Models;
|
||||||
|
|
||||||
|
public class WorkModel : I18nModel<I18nWorkModel>
|
||||||
|
{
|
||||||
|
public static ObservableCollection<VPet_Simulator.Core.GraphHelper.Work.WorkType> WorkTypes { get; } =
|
||||||
|
new(
|
||||||
|
Enum.GetValues(typeof(VPet_Simulator.Core.GraphHelper.Work.WorkType))
|
||||||
|
.Cast<VPet_Simulator.Core.GraphHelper.Work.WorkType>()
|
||||||
|
);
|
||||||
|
|
||||||
|
//public VPet_Simulator.Core.GraphHelper.Work
|
||||||
|
public ObservableValue<VPet_Simulator.Core.GraphHelper.Work.WorkType> WorkType { get; } =
|
||||||
|
new(VPet_Simulator.Core.GraphHelper.Work.WorkType.Work);
|
||||||
|
|
||||||
|
public ObservableValue<string> Name { get; } = new();
|
||||||
|
public ObservableValue<string> Graph { get; } = new();
|
||||||
|
|
||||||
|
public ObservableValue<double> MoneyLevel { get; } = new();
|
||||||
|
public ObservableValue<double> MoneyBase { get; } = new();
|
||||||
|
public ObservableValue<double> StrengthFood { get; } = new();
|
||||||
|
public ObservableValue<double> StrengthDrink { get; } = new();
|
||||||
|
public ObservableValue<double> Feeling { get; } = new();
|
||||||
|
public ObservableValue<int> LevelLimit { get; } = new();
|
||||||
|
public ObservableValue<int> Time { get; } = new();
|
||||||
|
public ObservableValue<double> FinishBonus { get; } = new();
|
||||||
|
|
||||||
|
public ObservableValue<string> BorderBrush { get; } = new("0290D5");
|
||||||
|
public ObservableValue<string> Background { get; } = new("81d4fa");
|
||||||
|
public ObservableValue<string> ButtonBackground { get; } = new("0286C6");
|
||||||
|
public ObservableValue<string> ButtonForeground { get; } = new("ffffff");
|
||||||
|
public ObservableValue<string> Foreground { get; } = new("0286C6");
|
||||||
|
|
||||||
|
public ObservableValue<double> Left { get; } = new(100);
|
||||||
|
public ObservableValue<double> Top { get; } = new(160);
|
||||||
|
public ObservableValue<double> Width { get; } = new(300);
|
||||||
|
|
||||||
|
public WorkModel() { }
|
||||||
|
|
||||||
|
public WorkModel(WorkModel model)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
WorkType.Value = model.WorkType.Value;
|
||||||
|
Name.Value = model.Name.Value;
|
||||||
|
Graph.Value = model.Graph.Value;
|
||||||
|
MoneyLevel.Value = model.MoneyLevel.Value;
|
||||||
|
MoneyBase.Value = model.MoneyBase.Value;
|
||||||
|
StrengthFood.Value = model.StrengthFood.Value;
|
||||||
|
StrengthDrink.Value = model.StrengthDrink.Value;
|
||||||
|
Feeling.Value = model.Feeling.Value;
|
||||||
|
LevelLimit.Value = model.LevelLimit.Value;
|
||||||
|
Time.Value = model.Time.Value;
|
||||||
|
FinishBonus.Value = model.FinishBonus.Value;
|
||||||
|
|
||||||
|
BorderBrush.Value = model.BorderBrush.Value;
|
||||||
|
Background.Value = model.Background.Value;
|
||||||
|
ButtonBackground.Value = model.ButtonBackground.Value;
|
||||||
|
ButtonForeground.Value = model.ButtonForeground.Value;
|
||||||
|
Foreground.Value = model.Foreground.Value;
|
||||||
|
|
||||||
|
Left.Value = model.Left.Value;
|
||||||
|
Top.Value = model.Top.Value;
|
||||||
|
Width.Value = model.Width.Value;
|
||||||
|
|
||||||
|
foreach (var item in model.I18nDatas)
|
||||||
|
I18nDatas[item.Key] = item.Value.Copy();
|
||||||
|
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkModel(VPet_Simulator.Core.GraphHelper.Work work)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
WorkType.Value = work.Type;
|
||||||
|
Name.Value = work.Name;
|
||||||
|
Graph.Value = work.Graph;
|
||||||
|
MoneyLevel.Value = work.MoneyLevel;
|
||||||
|
MoneyBase.Value = work.MoneyBase;
|
||||||
|
StrengthFood.Value = work.StrengthFood;
|
||||||
|
StrengthDrink.Value = work.StrengthDrink;
|
||||||
|
Feeling.Value = work.Feeling;
|
||||||
|
LevelLimit.Value = work.LevelLimit;
|
||||||
|
Time.Value = work.Time;
|
||||||
|
FinishBonus.Value = work.FinishBonus;
|
||||||
|
|
||||||
|
BorderBrush.Value = work.BorderBrush;
|
||||||
|
Background.Value = work.Background;
|
||||||
|
ButtonBackground.Value = work.ButtonBackground;
|
||||||
|
ButtonForeground.Value = work.ButtonForeground;
|
||||||
|
Foreground.Value = work.Foreground;
|
||||||
|
|
||||||
|
Left.Value = work.Left;
|
||||||
|
Top.Value = work.Top;
|
||||||
|
Width.Value = work.Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VPet_Simulator.Core.GraphHelper.Work ToWork()
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Type = WorkType.Value,
|
||||||
|
Name = Name.Value,
|
||||||
|
Graph = Graph.Value,
|
||||||
|
MoneyLevel = MoneyLevel.Value,
|
||||||
|
MoneyBase = MoneyBase.Value,
|
||||||
|
StrengthFood = StrengthFood.Value,
|
||||||
|
StrengthDrink = StrengthDrink.Value,
|
||||||
|
Feeling = Feeling.Value,
|
||||||
|
LevelLimit = LevelLimit.Value,
|
||||||
|
Time = Time.Value,
|
||||||
|
FinishBonus = FinishBonus.Value,
|
||||||
|
//
|
||||||
|
BorderBrush = BorderBrush.Value,
|
||||||
|
Background = Background.Value,
|
||||||
|
ButtonBackground = ButtonBackground.Value,
|
||||||
|
ButtonForeground = ButtonForeground.Value,
|
||||||
|
Foreground = Foreground.Value,
|
||||||
|
//
|
||||||
|
Left = Left.Value,
|
||||||
|
Top = Top.Value,
|
||||||
|
Width = Width.Value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class I18nWorkModel
|
||||||
|
{
|
||||||
|
public ObservableValue<string> Name { get; } = new();
|
||||||
|
|
||||||
|
public I18nWorkModel Copy()
|
||||||
|
{
|
||||||
|
var result = new I18nWorkModel();
|
||||||
|
result.Name.Value = Name.Value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -92,6 +92,7 @@
|
|||||||
<Compile Include="Converters\MaxConverter.cs" />
|
<Compile Include="Converters\MaxConverter.cs" />
|
||||||
<Compile Include="Converters\MarginConverter.cs" />
|
<Compile Include="Converters\MarginConverter.cs" />
|
||||||
<Compile Include="Models\ClickTextModel.cs" />
|
<Compile Include="Models\ClickTextModel.cs" />
|
||||||
|
<Compile Include="Models\Expansions.cs" />
|
||||||
<Compile Include="Models\FoodModel.cs" />
|
<Compile Include="Models\FoodModel.cs" />
|
||||||
<Compile Include="Models\I18nHelper.cs" />
|
<Compile Include="Models\I18nHelper.cs" />
|
||||||
<Compile Include="Models\I18nModel.cs" />
|
<Compile Include="Models\I18nModel.cs" />
|
||||||
@ -102,6 +103,7 @@
|
|||||||
<Compile Include="Models\ObservableRange.cs" />
|
<Compile Include="Models\ObservableRange.cs" />
|
||||||
<Compile Include="Models\PetModel.cs" />
|
<Compile Include="Models\PetModel.cs" />
|
||||||
<Compile Include="Models\SelectTextModel.cs" />
|
<Compile Include="Models\SelectTextModel.cs" />
|
||||||
|
<Compile Include="Models\WorkModel.cs" />
|
||||||
<Compile Include="SimpleObservable\ObservableCommandT.cs" />
|
<Compile Include="SimpleObservable\ObservableCommandT.cs" />
|
||||||
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextEditWindowVM.cs" />
|
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextEditWindowVM.cs" />
|
||||||
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextPageVM.cs" />
|
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextPageVM.cs" />
|
||||||
@ -114,6 +116,8 @@
|
|||||||
<Compile Include="ViewModels\ModEdit\PetEdit\PetPageVM.cs" />
|
<Compile Include="ViewModels\ModEdit\PetEdit\PetPageVM.cs" />
|
||||||
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextEditWindowVM.cs" />
|
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextEditWindowVM.cs" />
|
||||||
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextPageVM.cs" />
|
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextPageVM.cs" />
|
||||||
|
<Compile Include="ViewModels\ModEdit\WorkEdit\WorkEditWindowVM.cs" />
|
||||||
|
<Compile Include="ViewModels\ModEdit\WorkEdit\WorkPageVM.cs" />
|
||||||
<Compile Include="Views\ModEdit\ClickTextEdit\ClickTextPage.xaml.cs">
|
<Compile Include="Views\ModEdit\ClickTextEdit\ClickTextPage.xaml.cs">
|
||||||
<DependentUpon>ClickTextPage.xaml</DependentUpon>
|
<DependentUpon>ClickTextPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -169,6 +173,12 @@
|
|||||||
<Compile Include="Views\ModEdit\SelectTextEdit\SelectTextEditWindow.xaml.cs">
|
<Compile Include="Views\ModEdit\SelectTextEdit\SelectTextEditWindow.xaml.cs">
|
||||||
<DependentUpon>SelectTextEditWindow.xaml</DependentUpon>
|
<DependentUpon>SelectTextEditWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\ModEdit\WorkEdit\WorkEditWindow.xaml.cs">
|
||||||
|
<DependentUpon>WorkEditWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\ModEdit\WorkEdit\WorkPage.xaml.cs">
|
||||||
|
<DependentUpon>WorkPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\ModMakerWindow.xaml.cs">
|
<Compile Include="Views\ModMakerWindow.xaml.cs">
|
||||||
<DependentUpon>ModMakerWindow.xaml</DependentUpon>
|
<DependentUpon>ModMakerWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -243,6 +253,14 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\ModEdit\WorkEdit\WorkEditWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\ModEdit\WorkEdit\WorkPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\ModMakerWindow.xaml">
|
<Page Include="Views\ModMakerWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -17,38 +17,40 @@ public class ClickTextPageVM
|
|||||||
#region Value
|
#region Value
|
||||||
public ObservableValue<ObservableCollection<ClickTextModel>> ShowClickTexts { get; } = new();
|
public ObservableValue<ObservableCollection<ClickTextModel>> ShowClickTexts { get; } = new();
|
||||||
public ObservableCollection<ClickTextModel> ClickTexts => ModInfoModel.Current.ClickTexts;
|
public ObservableCollection<ClickTextModel> ClickTexts => ModInfoModel.Current.ClickTexts;
|
||||||
public ObservableValue<string> FilterClickText { get; } = new();
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddClickTextCommand { get; } = new();
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
public ObservableCommand<ClickTextModel> EditClickTextCommand { get; } = new();
|
public ObservableCommand<ClickTextModel> EditCommand { get; } = new();
|
||||||
public ObservableCommand<ClickTextModel> RemoveClickTextCommand { get; } = new();
|
public ObservableCommand<ClickTextModel> RemoveCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public ClickTextPageVM()
|
public ClickTextPageVM()
|
||||||
{
|
{
|
||||||
ShowClickTexts.Value = ClickTexts;
|
ShowClickTexts.Value = ClickTexts;
|
||||||
FilterClickText.ValueChanged += FilterClickText_ValueChanged;
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
AddClickTextCommand.ExecuteEvent += AddClickText;
|
AddCommand.ExecuteEvent += Add;
|
||||||
EditClickTextCommand.ExecuteEvent += EditClickText;
|
EditCommand.ExecuteEvent += Edit;
|
||||||
RemoveClickTextCommand.ExecuteEvent += RemoveClickText;
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterClickText_ValueChanged(string value)
|
private void Filter_ValueChanged(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
ShowClickTexts.Value = ClickTexts;
|
ShowClickTexts.Value = ClickTexts;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowClickTexts.Value = new(
|
ShowClickTexts.Value = new(
|
||||||
ClickTexts.Where(f => f.CurrentI18nData.Value.Text.Value.Contains(value))
|
ClickTexts.Where(
|
||||||
|
m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddClickText()
|
private void Add()
|
||||||
{
|
{
|
||||||
var window = new ClickTextEditWindow();
|
var window = new ClickTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -58,38 +60,38 @@ public class ClickTextPageVM
|
|||||||
ClickTexts.Add(vm.ClickText.Value);
|
ClickTexts.Add(vm.ClickText.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditClickText(ClickTextModel clickText)
|
public void Edit(ClickTextModel model)
|
||||||
{
|
{
|
||||||
var window = new ClickTextEditWindow();
|
var window = new ClickTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
vm.OldClickText = clickText;
|
vm.OldClickText = model;
|
||||||
var newLowTest = vm.ClickText.Value = new(clickText);
|
var newLowTest = vm.ClickText.Value = new(model);
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
if (window.IsCancel)
|
if (window.IsCancel)
|
||||||
return;
|
return;
|
||||||
if (ShowClickTexts.Value.Count == ClickTexts.Count)
|
if (ShowClickTexts.Value.Count == ClickTexts.Count)
|
||||||
{
|
{
|
||||||
ClickTexts[ClickTexts.IndexOf(clickText)] = newLowTest;
|
ClickTexts[ClickTexts.IndexOf(model)] = newLowTest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClickTexts[ClickTexts.IndexOf(clickText)] = newLowTest;
|
ClickTexts[ClickTexts.IndexOf(model)] = newLowTest;
|
||||||
ShowClickTexts.Value[ShowClickTexts.Value.IndexOf(clickText)] = newLowTest;
|
ShowClickTexts.Value[ShowClickTexts.Value.IndexOf(model)] = newLowTest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveClickText(ClickTextModel clickText)
|
private void Remove(ClickTextModel model)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
if (ShowClickTexts.Value.Count == ClickTexts.Count)
|
if (ShowClickTexts.Value.Count == ClickTexts.Count)
|
||||||
{
|
{
|
||||||
ClickTexts.Remove(clickText);
|
ClickTexts.Remove(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowClickTexts.Value.Remove(clickText);
|
ShowClickTexts.Value.Remove(model);
|
||||||
ClickTexts.Remove(clickText);
|
ClickTexts.Remove(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,14 @@ public class FoodEditWindowVM
|
|||||||
|
|
||||||
public FoodEditWindowVM()
|
public FoodEditWindowVM()
|
||||||
{
|
{
|
||||||
InitializeFoodTypes();
|
|
||||||
AddImageCommand.ExecuteEvent += AddImage;
|
AddImageCommand.ExecuteEvent += AddImage;
|
||||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() { }
|
public void Close()
|
||||||
|
{
|
||||||
private void InitializeFoodTypes() { }
|
Food.Value.Close();
|
||||||
|
}
|
||||||
|
|
||||||
private void AddImage()
|
private void AddImage()
|
||||||
{
|
{
|
||||||
|
@ -19,40 +19,40 @@ public class FoodPageVM
|
|||||||
#region Value
|
#region Value
|
||||||
public ObservableValue<ObservableCollection<FoodModel>> ShowFoods { get; } = new();
|
public ObservableValue<ObservableCollection<FoodModel>> ShowFoods { get; } = new();
|
||||||
public ObservableCollection<FoodModel> Foods => ModInfoModel.Current.Foods;
|
public ObservableCollection<FoodModel> Foods => ModInfoModel.Current.Foods;
|
||||||
public ObservableValue<string> FilterFoodText { get; } = new();
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddFoodCommand { get; } = new();
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
public ObservableCommand<FoodModel> EditFoodCommand { get; } = new();
|
public ObservableCommand<FoodModel> EditCommand { get; } = new();
|
||||||
public ObservableCommand<FoodModel> RemoveFoodCommand { get; } = new();
|
public ObservableCommand<FoodModel> RemoveCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
public FoodPageVM()
|
public FoodPageVM()
|
||||||
{
|
{
|
||||||
ShowFoods.Value = Foods;
|
ShowFoods.Value = Foods;
|
||||||
FilterFoodText.ValueChanged += FilterFoodText_ValueChanged;
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
|
|
||||||
AddFoodCommand.ExecuteEvent += AddFood;
|
AddCommand.ExecuteEvent += Add;
|
||||||
EditFoodCommand.ExecuteEvent += EditFood;
|
EditCommand.ExecuteEvent += Edit;
|
||||||
RemoveFoodCommand.ExecuteEvent += RemoveFood;
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterFoodText_ValueChanged(string value)
|
private void Filter_ValueChanged(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
ShowFoods.Value = Foods;
|
ShowFoods.Value = Foods;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowFoods.Value = new(
|
ShowFoods.Value = new(
|
||||||
Foods.Where(f => f.CurrentI18nData.Value.Name.Value.Contains(value))
|
Foods.Where(m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() { }
|
public void Close() { }
|
||||||
|
|
||||||
private void AddFood()
|
private void Add()
|
||||||
{
|
{
|
||||||
var window = new FoodEditWindow();
|
var window = new FoodEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -62,7 +62,7 @@ public class FoodPageVM
|
|||||||
Foods.Add(vm.Food.Value);
|
Foods.Add(vm.Food.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditFood(FoodModel food)
|
public void Edit(FoodModel food)
|
||||||
{
|
{
|
||||||
var window = new FoodEditWindow();
|
var window = new FoodEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -83,7 +83,7 @@ public class FoodPageVM
|
|||||||
food.Close();
|
food.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveFood(FoodModel food)
|
private void Remove(FoodModel food)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
|
@ -18,40 +18,42 @@ namespace VPet.ModMaker.ViewModels.ModEdit.LowTextEdit;
|
|||||||
public class LowTextPageVM
|
public class LowTextPageVM
|
||||||
{
|
{
|
||||||
#region Value
|
#region Value
|
||||||
public ObservableValue<string> FilterLowText { get; } = new();
|
|
||||||
public ObservableValue<ObservableCollection<LowTextModel>> ShowLowTexts { get; } = new();
|
public ObservableValue<ObservableCollection<LowTextModel>> ShowLowTexts { get; } = new();
|
||||||
public ObservableCollection<LowTextModel> LowTexts => ModInfoModel.Current.LowTexts;
|
public ObservableCollection<LowTextModel> LowTexts => ModInfoModel.Current.LowTexts;
|
||||||
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddLowTextCommand { get; } = new();
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
public ObservableCommand<LowTextModel> EditLowTextCommand { get; } = new();
|
public ObservableCommand<LowTextModel> EditCommand { get; } = new();
|
||||||
public ObservableCommand<LowTextModel> RemoveLowTextCommand { get; } = new();
|
public ObservableCommand<LowTextModel> RemoveCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public LowTextPageVM()
|
public LowTextPageVM()
|
||||||
{
|
{
|
||||||
ShowLowTexts.Value = LowTexts;
|
ShowLowTexts.Value = LowTexts;
|
||||||
FilterLowText.ValueChanged += FilterLowText_ValueChanged;
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
AddLowTextCommand.ExecuteEvent += AddLowText;
|
AddCommand.ExecuteEvent += Add;
|
||||||
EditLowTextCommand.ExecuteEvent += EditLowText;
|
EditCommand.ExecuteEvent += Edit;
|
||||||
RemoveLowTextCommand.ExecuteEvent += RemoveLowText;
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterLowText_ValueChanged(string value)
|
private void Filter_ValueChanged(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
ShowLowTexts.Value = LowTexts;
|
ShowLowTexts.Value = LowTexts;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowLowTexts.Value = new(
|
ShowLowTexts.Value = new(
|
||||||
LowTexts.Where(f => f.CurrentI18nData.Value.Text.Value.Contains(value))
|
LowTexts.Where(
|
||||||
|
m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddLowText()
|
private void Add()
|
||||||
{
|
{
|
||||||
var window = new LowTextEditWindow();
|
var window = new LowTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -61,38 +63,38 @@ public class LowTextPageVM
|
|||||||
LowTexts.Add(vm.LowText.Value);
|
LowTexts.Add(vm.LowText.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditLowText(LowTextModel lowText)
|
public void Edit(LowTextModel model)
|
||||||
{
|
{
|
||||||
var window = new LowTextEditWindow();
|
var window = new LowTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
vm.OldLowText = lowText;
|
vm.OldLowText = model;
|
||||||
var newLowTest = vm.LowText.Value = new(lowText);
|
var newLowTest = vm.LowText.Value = new(model);
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
if (window.IsCancel)
|
if (window.IsCancel)
|
||||||
return;
|
return;
|
||||||
if (ShowLowTexts.Value.Count == LowTexts.Count)
|
if (ShowLowTexts.Value.Count == LowTexts.Count)
|
||||||
{
|
{
|
||||||
LowTexts[LowTexts.IndexOf(lowText)] = newLowTest;
|
LowTexts[LowTexts.IndexOf(model)] = newLowTest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LowTexts[LowTexts.IndexOf(lowText)] = newLowTest;
|
LowTexts[LowTexts.IndexOf(model)] = newLowTest;
|
||||||
ShowLowTexts.Value[ShowLowTexts.Value.IndexOf(lowText)] = newLowTest;
|
ShowLowTexts.Value[ShowLowTexts.Value.IndexOf(model)] = newLowTest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveLowText(LowTextModel lowText)
|
private void Remove(LowTextModel model)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
if (ShowLowTexts.Value.Count == LowTexts.Count)
|
if (ShowLowTexts.Value.Count == LowTexts.Count)
|
||||||
{
|
{
|
||||||
LowTexts.Remove(lowText);
|
LowTexts.Remove(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowLowTexts.Value.Remove(lowText);
|
ShowLowTexts.Value.Remove(model);
|
||||||
LowTexts.Remove(lowText);
|
LowTexts.Remove(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,47 +43,6 @@ public class ModEditWindowVM
|
|||||||
|
|
||||||
public ModEditWindowVM(ModEditWindow window)
|
public ModEditWindowVM(ModEditWindow window)
|
||||||
{
|
{
|
||||||
foreach (var lang in ModInfo.Value.I18nDatas)
|
|
||||||
{
|
|
||||||
if (I18nHelper.Current.CultureNames.Contains(lang.Key) is false)
|
|
||||||
I18nHelper.Current.CultureNames.Add(lang.Key);
|
|
||||||
}
|
|
||||||
if (I18nHelper.Current.CultureNames.Count > 0)
|
|
||||||
{
|
|
||||||
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
|
|
||||||
foreach (var i18nData in ModInfo.Value.OtherI18nDatas)
|
|
||||||
{
|
|
||||||
foreach (var food in ModInfo.Value.Foods)
|
|
||||||
{
|
|
||||||
var foodI18n = food.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(food.Name.Value, out var name))
|
|
||||||
foodI18n.Name.Value = name;
|
|
||||||
if (i18nData.Value.TryGetValue(food.Description.Value, out var description))
|
|
||||||
foodI18n.Description.Value = description;
|
|
||||||
}
|
|
||||||
foreach (var lowText in ModInfo.Value.LowTexts)
|
|
||||||
{
|
|
||||||
var lowTextI18n = lowText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(lowText.Name.Value, out var text))
|
|
||||||
lowTextI18n.Text.Value = text;
|
|
||||||
}
|
|
||||||
foreach (var clickText in ModInfo.Value.ClickTexts)
|
|
||||||
{
|
|
||||||
var clickTextI18n = clickText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(clickText.Name.Value, out var text))
|
|
||||||
clickTextI18n.Text.Value = text;
|
|
||||||
}
|
|
||||||
foreach (var selectText in ModInfo.Value.SelectTexts)
|
|
||||||
{
|
|
||||||
var selectTextI18n = selectText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(selectText.Name.Value, out var text))
|
|
||||||
selectTextI18n.Text.Value = text;
|
|
||||||
if (i18nData.Value.TryGetValue(selectText.Choose.Value, out var choose))
|
|
||||||
selectTextI18n.Choose.Value = choose;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ModEditWindow = window;
|
ModEditWindow = window;
|
||||||
CurrentLang.ValueChanged += CurrentLang_ValueChanged;
|
CurrentLang.ValueChanged += CurrentLang_ValueChanged;
|
||||||
|
|
||||||
|
@ -1,17 +1,64 @@
|
|||||||
using HKW.HKWViewModels.SimpleObservable;
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using LinePutScript.Localization.WPF;
|
||||||
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
using VPet.ModMaker.Models;
|
using VPet.ModMaker.Models;
|
||||||
|
|
||||||
namespace VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
namespace VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
||||||
|
|
||||||
public class PetEditWindowVM
|
public class PetEditWindowVM
|
||||||
{
|
{
|
||||||
|
public PetModel OldPet { get; set; }
|
||||||
public ObservableValue<PetModel> Pet { get; } = new(new());
|
public ObservableValue<PetModel> Pet { get; } = new(new());
|
||||||
|
|
||||||
public PetEditWindowVM() { }
|
public ObservableValue<BitmapImage> Image { get; } = new();
|
||||||
|
#region Command
|
||||||
|
public ObservableCommand AddImageCommand { get; } = new();
|
||||||
|
public ObservableCommand ChangeImageCommand { get; } = new();
|
||||||
|
#endregion
|
||||||
|
public PetEditWindowVM()
|
||||||
|
{
|
||||||
|
AddImageCommand.ExecuteEvent += AddImage;
|
||||||
|
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
Image.Value?.StreamSource?.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddImage()
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog =
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Title = "选择图片".Translate(),
|
||||||
|
Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp".Translate()
|
||||||
|
};
|
||||||
|
if (openFileDialog.ShowDialog() is true)
|
||||||
|
{
|
||||||
|
Image.Value = Utils.LoadImageToStream(openFileDialog.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeImage()
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog =
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Title = "选择图片".Translate(),
|
||||||
|
Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp".Translate()
|
||||||
|
};
|
||||||
|
if (openFileDialog.ShowDialog() is true)
|
||||||
|
{
|
||||||
|
Image.Value?.StreamSource?.Close();
|
||||||
|
Image.Value = Utils.LoadImageToStream(openFileDialog.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,98 @@
|
|||||||
using System;
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using LinePutScript.Localization.WPF;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
|
using VPet.ModMaker.Views.ModEdit.PetEdit;
|
||||||
|
|
||||||
namespace VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
namespace VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
||||||
|
|
||||||
public class PetPageVM { }
|
public class PetPageVM
|
||||||
|
{
|
||||||
|
#region Value
|
||||||
|
public ObservableValue<ObservableCollection<PetModel>> ShowPets { get; } = new();
|
||||||
|
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
|
||||||
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
|
#endregion
|
||||||
|
#region Command
|
||||||
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
|
public ObservableCommand<PetModel> EditCommand { get; } = new();
|
||||||
|
public ObservableCommand<PetModel> RemoveCommand { get; } = new();
|
||||||
|
#endregion
|
||||||
|
public PetPageVM()
|
||||||
|
{
|
||||||
|
ShowPets.Value = Pets;
|
||||||
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
|
|
||||||
|
AddCommand.ExecuteEvent += Add;
|
||||||
|
EditCommand.ExecuteEvent += Edit;
|
||||||
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Filter_ValueChanged(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
ShowPets.Value = Pets;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowPets.Value = new(
|
||||||
|
Pets.Where(m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close() { }
|
||||||
|
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
var window = new PetEditWindow();
|
||||||
|
var vm = window.ViewModel;
|
||||||
|
window.ShowDialog();
|
||||||
|
if (window.IsCancel)
|
||||||
|
return;
|
||||||
|
Pets.Add(vm.Pet.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Edit(PetModel model)
|
||||||
|
{
|
||||||
|
var window = new PetEditWindow();
|
||||||
|
var vm = window.ViewModel;
|
||||||
|
vm.OldPet = model;
|
||||||
|
var newPet = vm.Pet.Value = new(model);
|
||||||
|
window.ShowDialog();
|
||||||
|
if (window.IsCancel)
|
||||||
|
return;
|
||||||
|
if (ShowPets.Value.Count == Pets.Count)
|
||||||
|
{
|
||||||
|
Pets[Pets.IndexOf(model)] = newPet;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pets[Pets.IndexOf(model)] = newPet;
|
||||||
|
ShowPets.Value[ShowPets.Value.IndexOf(model)] = newPet;
|
||||||
|
}
|
||||||
|
model.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Remove(PetModel food)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
|
return;
|
||||||
|
if (ShowPets.Value.Count == Pets.Count)
|
||||||
|
{
|
||||||
|
Pets.Remove(food);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowPets.Value.Remove(food);
|
||||||
|
Pets.Remove(food);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,24 +17,24 @@ public class SelectTextPageVM
|
|||||||
#region Value
|
#region Value
|
||||||
public ObservableValue<ObservableCollection<SelectTextModel>> ShowSelectTexts { get; } = new();
|
public ObservableValue<ObservableCollection<SelectTextModel>> ShowSelectTexts { get; } = new();
|
||||||
public ObservableCollection<SelectTextModel> SelectTexts => ModInfoModel.Current.SelectTexts;
|
public ObservableCollection<SelectTextModel> SelectTexts => ModInfoModel.Current.SelectTexts;
|
||||||
public ObservableValue<string> FilterSelectText { get; } = new();
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddSelectTextCommand { get; } = new();
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
public ObservableCommand<SelectTextModel> EditSelectTextCommand { get; } = new();
|
public ObservableCommand<SelectTextModel> EditCommand { get; } = new();
|
||||||
public ObservableCommand<SelectTextModel> RemoveSelectTextCommand { get; } = new();
|
public ObservableCommand<SelectTextModel> RemoveCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public SelectTextPageVM()
|
public SelectTextPageVM()
|
||||||
{
|
{
|
||||||
ShowSelectTexts.Value = SelectTexts;
|
ShowSelectTexts.Value = SelectTexts;
|
||||||
FilterSelectText.ValueChanged += FilterSelectText_ValueChanged;
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
AddSelectTextCommand.ExecuteEvent += AddSelectText;
|
AddCommand.ExecuteEvent += Add;
|
||||||
EditSelectTextCommand.ExecuteEvent += EditSelectText;
|
EditCommand.ExecuteEvent += Edit;
|
||||||
RemoveSelectTextCommand.ExecuteEvent += RemoveSelectText;
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterSelectText_ValueChanged(string value)
|
private void Filter_ValueChanged(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
@ -43,12 +43,14 @@ public class SelectTextPageVM
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowSelectTexts.Value = new(
|
ShowSelectTexts.Value = new(
|
||||||
SelectTexts.Where(f => f.CurrentI18nData.Value.Text.Value.Contains(value))
|
SelectTexts.Where(
|
||||||
|
m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddSelectText()
|
private void Add()
|
||||||
{
|
{
|
||||||
var window = new SelectTextEditWindow();
|
var window = new SelectTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -58,7 +60,7 @@ public class SelectTextPageVM
|
|||||||
SelectTexts.Add(vm.SelectText.Value);
|
SelectTexts.Add(vm.SelectText.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditSelectText(SelectTextModel model)
|
public void Edit(SelectTextModel model)
|
||||||
{
|
{
|
||||||
var window = new SelectTextEditWindow();
|
var window = new SelectTextEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
@ -78,7 +80,7 @@ public class SelectTextPageVM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveSelectText(SelectTextModel model)
|
private void Remove(SelectTextModel model)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
public class WorkEditWindowVM
|
||||||
|
{
|
||||||
|
#region Value
|
||||||
|
public PetModel CurrentPet { get; set; }
|
||||||
|
public WorkModel OldWork { get; set; }
|
||||||
|
public ObservableValue<WorkModel> Work { get; } = new(new());
|
||||||
|
#endregion
|
||||||
|
}
|
108
VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs
Normal file
108
VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using LinePutScript.Localization.WPF;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
|
using VPet.ModMaker.Views.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
public class WorkPageVM
|
||||||
|
{
|
||||||
|
#region Value
|
||||||
|
public ObservableValue<ObservableCollection<WorkModel>> ShowWorks { get; } = new();
|
||||||
|
public ObservableCollection<WorkModel> Works => CurrentPet.Value.Works;
|
||||||
|
|
||||||
|
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
|
||||||
|
public ObservableValue<PetModel> CurrentPet { get; } = new(new());
|
||||||
|
public ObservableValue<string> Filter { get; } = new();
|
||||||
|
#endregion
|
||||||
|
#region Command
|
||||||
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
|
public ObservableCommand<WorkModel> EditCommand { get; } = new();
|
||||||
|
public ObservableCommand<WorkModel> RemoveCommand { get; } = new();
|
||||||
|
#endregion
|
||||||
|
public WorkPageVM()
|
||||||
|
{
|
||||||
|
ShowWorks.Value = Works;
|
||||||
|
CurrentPet.ValueChanged += CurrentPet_ValueChanged;
|
||||||
|
Filter.ValueChanged += Filter_ValueChanged;
|
||||||
|
|
||||||
|
AddCommand.ExecuteEvent += Add;
|
||||||
|
EditCommand.ExecuteEvent += Edit;
|
||||||
|
RemoveCommand.ExecuteEvent += Remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentPet_ValueChanged(PetModel value)
|
||||||
|
{
|
||||||
|
ShowWorks.Value = value.Works;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Filter_ValueChanged(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
ShowWorks.Value = Works;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowWorks.Value = new(
|
||||||
|
Works.Where(m => m.Name.Value.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close() { }
|
||||||
|
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
var window = new WorkEditWindow();
|
||||||
|
var vm = window.ViewModel;
|
||||||
|
vm.CurrentPet = CurrentPet.Value;
|
||||||
|
window.ShowDialog();
|
||||||
|
if (window.IsCancel)
|
||||||
|
return;
|
||||||
|
Works.Add(vm.Work.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Edit(WorkModel model)
|
||||||
|
{
|
||||||
|
var window = new WorkEditWindow();
|
||||||
|
var vm = window.ViewModel;
|
||||||
|
vm.CurrentPet = CurrentPet.Value;
|
||||||
|
vm.OldWork = model;
|
||||||
|
var newWork = vm.Work.Value = new(model);
|
||||||
|
window.ShowDialog();
|
||||||
|
if (window.IsCancel)
|
||||||
|
return;
|
||||||
|
if (ShowWorks.Value.Count == Works.Count)
|
||||||
|
{
|
||||||
|
Works[Works.IndexOf(model)] = newWork;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Works[Works.IndexOf(model)] = newWork;
|
||||||
|
ShowWorks.Value[ShowWorks.Value.IndexOf(model)] = newWork;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Remove(WorkModel food)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
|
return;
|
||||||
|
if (ShowWorks.Value.Count == Works.Count)
|
||||||
|
{
|
||||||
|
Works.Remove(food);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowWorks.Value.Remove(food);
|
||||||
|
Works.Remove(food);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -146,22 +146,26 @@ public class ModMakerWindowVM
|
|||||||
};
|
};
|
||||||
if (openFileDialog.ShowDialog() is true)
|
if (openFileDialog.ShowDialog() is true)
|
||||||
{
|
{
|
||||||
try
|
LoadMod(Path.GetDirectoryName(openFileDialog.FileName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMod(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var mod = new ModLoader(new DirectoryInfo(path));
|
||||||
|
if (mod.SuccessLoad is false)
|
||||||
{
|
{
|
||||||
var path = Path.GetDirectoryName(openFileDialog.FileName);
|
MessageBox.Show("模组载入失败".Translate());
|
||||||
var mod = new ModLoader(new DirectoryInfo(path));
|
return;
|
||||||
if (mod.SuccessLoad is false)
|
|
||||||
{
|
|
||||||
MessageBox.Show("模组载入失败".Translate());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ModInfoModel.Current = new ModInfoModel(mod);
|
|
||||||
CreateNewMod();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("模组载入失败:\n{0}".Translate(ex));
|
|
||||||
}
|
}
|
||||||
|
var modInfo = new ModInfoModel(mod);
|
||||||
|
EditMod(modInfo);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("模组载入失败:\n{0}".Translate(ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit"
|
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
@ -10,6 +11,7 @@
|
|||||||
Title="Window_AddLang"
|
Title="Window_AddLang"
|
||||||
Width="400"
|
Width="400"
|
||||||
Height="300"
|
Height="300"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<d:Window.DataContext>
|
<d:Window.DataContext>
|
||||||
<local:Window_AddLang />
|
<local:Window_AddLang />
|
||||||
@ -26,10 +28,12 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox_Lang"
|
x:Name="TextBox_Lang"
|
||||||
pu:TextBoxHelper.Watermark="语言/区域标记,如: 'zh-CN', 'en-US'"
|
pu:TextBoxHelper.Watermark="{ll:Str 语言区域标记}"
|
||||||
Text="{Binding Lang.Value, UpdateSourceTrigger=PropertyChanged}" />
|
Text="{Binding Lang.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<TextBlock Grid.Row="1">
|
<TextBlock Grid.Row="1">
|
||||||
<Hyperlink Click="Hyperlink_Click">详情请参阅 Windows 支持的语言/区域名称列表中的“语言标记”列</Hyperlink>
|
<Hyperlink Click="Hyperlink_Click">
|
||||||
|
<TextBlock Text="{ll:Str 详情请参阅 Windows 支持的语言/区域名称列表中的“语言标记”列}" />
|
||||||
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
@ -41,13 +45,13 @@
|
|||||||
x:Name="Button_Cancel"
|
x:Name="Button_Cancel"
|
||||||
Margin="10"
|
Margin="10"
|
||||||
Click="Button_Cancel_Click"
|
Click="Button_Cancel_Click"
|
||||||
Content="取消" />
|
Content="{ll:Str 取消}" />
|
||||||
<Button
|
<Button
|
||||||
x:Name="Button_Yes"
|
x:Name="Button_Yes"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="10"
|
Margin="10"
|
||||||
Click="Button_Yes_Click"
|
Click="Button_Yes_Click"
|
||||||
Content="确定" />
|
Content="{ll:Str 确定}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -15,28 +15,13 @@
|
|||||||
<d:Page.DataContext>
|
<d:Page.DataContext>
|
||||||
<vm:ClickTextPageVM />
|
<vm:ClickTextPageVM />
|
||||||
</d:Page.DataContext>
|
</d:Page.DataContext>
|
||||||
<Page.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ContextMenu x:Key="ContextMenu_DataGridRow" x:Shared="false">
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.EditLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 修改点击文本}" />
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.RemoveLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 删除点击文本}" />
|
|
||||||
</ContextMenu>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Page.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterClickText.Value, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<DataGrid
|
<DataGrid
|
||||||
x:Name="DataGrid_ClickText"
|
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||||
@ -44,7 +29,7 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
GridLinesVisibility="Horizontal"
|
GridLinesVisibility="Horizontal"
|
||||||
ItemsSource="{Binding ShowClickTexts.Value}"
|
ItemsSource="{Binding ShowClickTexts.Value}"
|
||||||
MouseDoubleClick="DataGrid_ClickText_MouseDoubleClick"
|
MouseDoubleClick="DataGrid_MouseDoubleClick"
|
||||||
RowDetailsVisibilityMode="Visible"
|
RowDetailsVisibilityMode="Visible"
|
||||||
RowHeight="64"
|
RowHeight="64"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True"
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
@ -193,7 +178,7 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Command="{Binding AddClickTextCommand}"
|
Command="{Binding AddCommand}"
|
||||||
Content="➕"
|
Content="➕"
|
||||||
Style="{StaticResource AddButton}" />
|
Style="{StaticResource AddButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -30,12 +30,10 @@ public partial class ClickTextPage : Page
|
|||||||
DataContext = new ClickTextPageVM();
|
DataContext = new ClickTextPageVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGrid_ClickText_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not ClickTextModel model)
|
||||||
sender is not DataGrid dataGrid || dataGrid.SelectedItem is not ClickTextModel clickText
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
ViewModel.EditClickText(clickText);
|
ViewModel.Edit(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,34 +25,36 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Image
|
<Grid>
|
||||||
x:Name="Image_FoodImage"
|
<Image
|
||||||
Width="256"
|
x:Name="Image_FoodImage"
|
||||||
Height="256"
|
Width="256"
|
||||||
Source="{Binding Food.Value.Image.Value}"
|
Height="256"
|
||||||
Stretch="Uniform">
|
Source="{Binding Food.Value.Image.Value}"
|
||||||
<Image.ContextMenu>
|
Stretch="Uniform">
|
||||||
<ContextMenu>
|
<Image.ContextMenu>
|
||||||
<MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改图片}" />
|
<ContextMenu>
|
||||||
</ContextMenu>
|
<MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改图片}" />
|
||||||
</Image.ContextMenu>
|
</ContextMenu>
|
||||||
</Image>
|
</Image.ContextMenu>
|
||||||
<Button
|
</Image>
|
||||||
HorizontalAlignment="Center"
|
<Button
|
||||||
VerticalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Command="{Binding AddImageCommand}"
|
VerticalAlignment="Center"
|
||||||
Content="{ll:Str 添加图片}">
|
Command="{Binding AddImageCommand}"
|
||||||
<Button.Style>
|
Content="{ll:Str 添加图片}">
|
||||||
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
|
<Button.Style>
|
||||||
<Setter Property="Visibility" Value="Hidden" />
|
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
|
||||||
<Style.Triggers>
|
<Setter Property="Visibility" Value="Hidden" />
|
||||||
<DataTrigger Binding="{Binding Food.Value.Image.Value}" Value="{x:Null}">
|
<Style.Triggers>
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
<DataTrigger Binding="{Binding Food.Value.Image.Value}" Value="{x:Null}">
|
||||||
</DataTrigger>
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
</Style.Triggers>
|
</DataTrigger>
|
||||||
</Style>
|
</Style.Triggers>
|
||||||
</Button.Style>
|
</Style>
|
||||||
</Button>
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -24,7 +24,7 @@ namespace VPet.ModMaker.Views.ModEdit.FoodEdit;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FoodEditWindow : Window
|
public partial class FoodEditWindow : Window
|
||||||
{
|
{
|
||||||
public bool IsCancel { get; internal set; } = true;
|
public bool IsCancel { get; private set; } = true;
|
||||||
|
|
||||||
public FoodEditWindowVM ViewModel => (FoodEditWindowVM)DataContext;
|
public FoodEditWindowVM ViewModel => (FoodEditWindowVM)DataContext;
|
||||||
|
|
||||||
@ -34,9 +34,8 @@ public partial class FoodEditWindow : Window
|
|||||||
DataContext = new FoodEditWindowVM();
|
DataContext = new FoodEditWindowVM();
|
||||||
Closed += (s, e) =>
|
Closed += (s, e) =>
|
||||||
{
|
{
|
||||||
ViewModel.Close();
|
|
||||||
if (IsCancel)
|
if (IsCancel)
|
||||||
ViewModel.Food.Value.Image.Value?.StreamSource?.Close();
|
ViewModel.Close();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,21 +46,21 @@ public partial class FoodEditWindow : Window
|
|||||||
|
|
||||||
private void Button_Yes_Click(object sender, RoutedEventArgs e)
|
private void Button_Yes_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ViewModel.Food.Value.Name.Value))
|
if (string.IsNullOrWhiteSpace(ViewModel.Food.Value.Name.Value))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ViewModel.Food.Value.CurrentI18nData.Value.Name.Value is null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("名称不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ViewModel.Food.Value.Image.Value is null)
|
if (ViewModel.Food.Value.Image.Value is null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("图像不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("图像不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(ViewModel.Food.Value.CurrentI18nData.Value.Name.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show("名称不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
ViewModel.OldFood?.Name.Value != ViewModel.Food.Value.Name.Value
|
ViewModel.OldFood?.Name.Value != ViewModel.Food.Value.Name.Value
|
||||||
&& ModInfoModel.Current.Foods.Any(i => i.Name == ViewModel.Food.Value.Name)
|
&& ModInfoModel.Current.Foods.Any(i => i.Name == ViewModel.Food.Value.Name)
|
||||||
|
@ -15,28 +15,13 @@
|
|||||||
<d:Page.DataContext>
|
<d:Page.DataContext>
|
||||||
<vm:FoodPageVM />
|
<vm:FoodPageVM />
|
||||||
</d:Page.DataContext>
|
</d:Page.DataContext>
|
||||||
<Page.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ContextMenu x:Key="ContextMenu_DataGridRow" x:Shared="false">
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.EditFoodCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 修改食物}" />
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.RemoveFoodCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 删除食物}" />
|
|
||||||
</ContextMenu>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Page.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索食物}" Text="{Binding FilterFoodText.Value, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<DataGrid
|
<DataGrid
|
||||||
x:Name="DataGrid_Food"
|
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||||
@ -44,7 +29,7 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
GridLinesVisibility="Horizontal"
|
GridLinesVisibility="Horizontal"
|
||||||
ItemsSource="{Binding ShowFoods.Value}"
|
ItemsSource="{Binding ShowFoods.Value}"
|
||||||
MouseDoubleClick="DataGrid_Food_MouseDoubleClick"
|
MouseDoubleClick="DataGrid_MouseDoubleClick"
|
||||||
RowDetailsVisibilityMode="Visible"
|
RowDetailsVisibilityMode="Visible"
|
||||||
RowHeight="64"
|
RowHeight="64"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True"
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
@ -63,12 +48,12 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Name.Value">
|
SortMemberPath="Name.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 食物Id}" />
|
<TextBlock Text="Id" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTemplateColumn IsReadOnly="True">
|
<DataGridTemplateColumn IsReadOnly="True">
|
||||||
<DataGridTemplateColumn.Header>
|
<DataGridTemplateColumn.Header>
|
||||||
<Label Content="{ll:Str 食物图片}" />
|
<TextBlock Text="{ll:Str 食物图片}" />
|
||||||
</DataGridTemplateColumn.Header>
|
</DataGridTemplateColumn.Header>
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@ -98,7 +83,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="CurrentI18nData.Value.Name.Value">
|
SortMemberPath="CurrentI18nData.Value.Name.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 食物名称}" />
|
<TextBlock Text="{ll:Str 食物名称}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -107,7 +92,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Type.Value">
|
SortMemberPath="Type.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 食物类型}" />
|
<TextBlock Text="{ll:Str 食物类型}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -116,7 +101,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="StrengthFood.Value">
|
SortMemberPath="StrengthFood.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 饱腹值}" />
|
<TextBlock Text="{ll:Str 饱腹值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -125,7 +110,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="StrengthDrink.Value">
|
SortMemberPath="StrengthDrink.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 口渴值}" />
|
<TextBlock Text="{ll:Str 口渴值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -134,7 +119,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Health.Value">
|
SortMemberPath="Health.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 健康值}" />
|
<TextBlock Text="{ll:Str 健康值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -143,7 +128,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Strength.Value">
|
SortMemberPath="Strength.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 体力值}" />
|
<TextBlock Text="{ll:Str 体力值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -152,7 +137,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Feeling.Value">
|
SortMemberPath="Feeling.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 心情值}" />
|
<TextBlock Text="{ll:Str 心情值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -161,7 +146,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Likability.Value">
|
SortMemberPath="Likability.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 好感值}" />
|
<TextBlock Text="{ll:Str 好感值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -170,7 +155,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Exp.Value">
|
SortMemberPath="Exp.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 经验值}" />
|
<TextBlock Text="{ll:Str 经验值}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -179,7 +164,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Price.Value">
|
SortMemberPath="Price.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 价格}" />
|
<TextBlock Text="{ll:Str 价格}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@ -188,17 +173,16 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="CurrentI18nData.Value.Description.Value">
|
SortMemberPath="CurrentI18nData.Value.Description.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<Label Content="{ll:Str 描述}" />
|
<TextBlock Text="{ll:Str 描述}" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button
|
<Button
|
||||||
x:Name="Button_AddFood"
|
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Command="{Binding AddFoodCommand}"
|
Command="{Binding AddCommand}"
|
||||||
Content="➕"
|
Content="➕"
|
||||||
Style="{StaticResource AddButton}" />
|
Style="{StaticResource AddButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -33,10 +33,10 @@ public partial class FoodPage : Page
|
|||||||
DataContext = new FoodPageVM();
|
DataContext = new FoodPageVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGrid_Food_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not FoodModel food)
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not FoodModel model)
|
||||||
return;
|
return;
|
||||||
ViewModel.EditFood(food);
|
ViewModel.Edit(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,26 +15,12 @@
|
|||||||
<d:Page.DataContext>
|
<d:Page.DataContext>
|
||||||
<vm:LowTextPageVM />
|
<vm:LowTextPageVM />
|
||||||
</d:Page.DataContext>
|
</d:Page.DataContext>
|
||||||
<Page.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ContextMenu x:Key="ContextMenu_DataGridRow" x:Shared="false">
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.EditLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 修改低状态文本}" />
|
|
||||||
<MenuItem
|
|
||||||
Command="{Binding DataContext.RemoveLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
|
|
||||||
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
|
|
||||||
Header="{ll:Str 删除低状态文本}" />
|
|
||||||
</ContextMenu>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Page.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterLowText.Value, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<DataGrid
|
<DataGrid
|
||||||
x:Name="DataGrid_LowText"
|
x:Name="DataGrid_LowText"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@ -63,7 +49,7 @@
|
|||||||
CanUserSort="True"
|
CanUserSort="True"
|
||||||
ElementStyle="{StaticResource TextBlock_Wrap}"
|
ElementStyle="{StaticResource TextBlock_Wrap}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
SortMemberPath="Id.Value">
|
SortMemberPath="Name.Value">
|
||||||
<DataGridTextColumn.Header>
|
<DataGridTextColumn.Header>
|
||||||
<TextBlock Text="Id" />
|
<TextBlock Text="Id" />
|
||||||
</DataGridTextColumn.Header>
|
</DataGridTextColumn.Header>
|
||||||
@ -109,11 +95,10 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button
|
<Button
|
||||||
x:Name="Button_AddLowText"
|
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Command="{Binding AddLowTextCommand}"
|
Command="{Binding AddCommand}"
|
||||||
Content="➕"
|
Content="➕"
|
||||||
Style="{StaticResource AddButton}" />
|
Style="{StaticResource AddButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -37,6 +37,6 @@ public partial class LowTextPage : Page
|
|||||||
{
|
{
|
||||||
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not LowTextModel lowText)
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not LowTextModel lowText)
|
||||||
return;
|
return;
|
||||||
ViewModel.EditLowText(lowText);
|
ViewModel.Edit(lowText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit"
|
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit"
|
||||||
Title="ModEditWindow"
|
Title="ModEditWindow"
|
||||||
Width="800"
|
Width="1000"
|
||||||
Height="450"
|
Height="500"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<d:Window.DataContext>
|
<d:Window.DataContext>
|
||||||
<vm:ModEditWindowVM />
|
<vm:ModEditWindowVM />
|
||||||
@ -166,6 +167,18 @@
|
|||||||
Tag="{ll:Str 选择文本}">
|
Tag="{ll:Str 选择文本}">
|
||||||
<Frame Content="{Binding ModEditWindow.SelectTextPage}" />
|
<Frame Content="{Binding ModEditWindow.SelectTextPage}" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem
|
||||||
|
x:Name="TabItem_Pet"
|
||||||
|
Header="宠物 (0)"
|
||||||
|
Tag="{ll:Str 宠物}">
|
||||||
|
<Frame Content="{Binding ModEditWindow.PetPage}" />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem
|
||||||
|
x:Name="TabItem_Work"
|
||||||
|
Header="工作 (0)"
|
||||||
|
Tag="{ll:Str 工作}">
|
||||||
|
<Frame Content="{Binding ModEditWindow.WorkPage}" />
|
||||||
|
</TabItem>
|
||||||
<!--<TabItem Header="物品 (0)" Tag="{ll:Str 物品}">
|
<!--<TabItem Header="物品 (0)" Tag="{ll:Str 物品}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
@ -20,7 +20,9 @@ using VPet.ModMaker.ViewModels.ModEdit;
|
|||||||
using VPet.ModMaker.Views.ModEdit.ClickTextEdit;
|
using VPet.ModMaker.Views.ModEdit.ClickTextEdit;
|
||||||
using VPet.ModMaker.Views.ModEdit.FoodEdit;
|
using VPet.ModMaker.Views.ModEdit.FoodEdit;
|
||||||
using VPet.ModMaker.Views.ModEdit.LowTextEdit;
|
using VPet.ModMaker.Views.ModEdit.LowTextEdit;
|
||||||
|
using VPet.ModMaker.Views.ModEdit.PetEdit;
|
||||||
using VPet.ModMaker.Views.ModEdit.SelectTextEdit;
|
using VPet.ModMaker.Views.ModEdit.SelectTextEdit;
|
||||||
|
using VPet.ModMaker.Views.ModEdit.WorkEdit;
|
||||||
using VPet_Simulator.Windows.Interface;
|
using VPet_Simulator.Windows.Interface;
|
||||||
|
|
||||||
namespace VPet.ModMaker.Views.ModEdit;
|
namespace VPet.ModMaker.Views.ModEdit;
|
||||||
@ -34,8 +36,10 @@ public partial class ModEditWindow : Window
|
|||||||
public FoodPage FoodPage { get; } = new();
|
public FoodPage FoodPage { get; } = new();
|
||||||
public LowTextPage LowTextPage { get; } = new();
|
public LowTextPage LowTextPage { get; } = new();
|
||||||
public ClickTextPage ClickTextPage { get; } = new();
|
public ClickTextPage ClickTextPage { get; } = new();
|
||||||
|
|
||||||
public SelectTextPage SelectTextPage { get; } = new();
|
public SelectTextPage SelectTextPage { get; } = new();
|
||||||
|
public PetPage PetPage { get; } = new();
|
||||||
|
|
||||||
|
public WorkPage WorkPage { get; } = new();
|
||||||
|
|
||||||
public ModEditWindow()
|
public ModEditWindow()
|
||||||
{
|
{
|
||||||
@ -47,12 +51,26 @@ public partial class ModEditWindow : Window
|
|||||||
LowTextPage.ViewModel.LowTexts.CollectionChanged += LowTexts_CollectionChanged;
|
LowTextPage.ViewModel.LowTexts.CollectionChanged += LowTexts_CollectionChanged;
|
||||||
ClickTextPage.ViewModel.ClickTexts.CollectionChanged += ClickTexts_CollectionChanged;
|
ClickTextPage.ViewModel.ClickTexts.CollectionChanged += ClickTexts_CollectionChanged;
|
||||||
SelectTextPage.ViewModel.SelectTexts.CollectionChanged += SelectTexts_CollectionChanged;
|
SelectTextPage.ViewModel.SelectTexts.CollectionChanged += SelectTexts_CollectionChanged;
|
||||||
|
PetPage.ViewModel.Pets.CollectionChanged += Pets_CollectionChanged;
|
||||||
|
//WorkPage.ViewModel.Works.CollectionChanged += Works_CollectionChanged;
|
||||||
|
|
||||||
TabItem_ClickText.Header =
|
TabItem_ClickText.Header =
|
||||||
$"{TabItem_ClickText.Tag} ({ClickTextPage.ViewModel.ClickTexts.Count})";
|
$"{TabItem_ClickText.Tag} ({ClickTextPage.ViewModel.ClickTexts.Count})";
|
||||||
TabItem_LowText.Header = $"{TabItem_LowText.Tag} ({LowTextPage.ViewModel.LowTexts.Count})";
|
TabItem_LowText.Header = $"{TabItem_LowText.Tag} ({LowTextPage.ViewModel.LowTexts.Count})";
|
||||||
TabItem_Food.Header = $"{TabItem_Food.Tag} ({FoodPage.ViewModel.Foods.Count})";
|
TabItem_Food.Header = $"{TabItem_Food.Tag} ({FoodPage.ViewModel.Foods.Count})";
|
||||||
TabItem_SelectText.Header =
|
TabItem_SelectText.Header =
|
||||||
$"{TabItem_SelectText.Tag} ({SelectTextPage.ViewModel.SelectTexts.Count})";
|
$"{TabItem_SelectText.Tag} ({SelectTextPage.ViewModel.SelectTexts.Count})";
|
||||||
|
TabItem_Pet.Header = $"{TabItem_Pet.Tag} ({PetPage.ViewModel.Pets.Count})";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Works_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TabItem_Work.Header = $"{TabItem_Work.Tag} ({WorkPage.ViewModel.Works.Count})";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Pets_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TabItem_Pet.Header = $"{TabItem_Pet.Tag} ({PetPage.ViewModel.Pets.Count})";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private void SelectTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
@ -81,14 +99,4 @@ public partial class ModEditWindow : Window
|
|||||||
{
|
{
|
||||||
ViewModel.Close();
|
ViewModel.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_AddItem_Click(object sender, RoutedEventArgs e) { }
|
|
||||||
|
|
||||||
private void Button_AddAnime_Click(object sender, RoutedEventArgs e) { }
|
|
||||||
|
|
||||||
private void Button_AddAudio_Click(object sender, RoutedEventArgs e) { }
|
|
||||||
|
|
||||||
private void Button_AddClickText_Click(object sender, RoutedEventArgs e) { }
|
|
||||||
|
|
||||||
private void Button_AddLang_Click(object sender, RoutedEventArgs e) { }
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.PetEdit"
|
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.PetEdit"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
@ -47,179 +48,202 @@
|
|||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<!--
|
<Grid>
|
||||||
Width="{Binding Pet.Value.Image.Value.Width}"
|
<Image
|
||||||
Height="{Binding Pet.Value.Image.Value.Height}"
|
Width="500"
|
||||||
-->
|
Height="500"
|
||||||
<Image
|
Source="{Binding Image.Value}"
|
||||||
d:Height="250"
|
Stretch="Uniform">
|
||||||
d:Width="250"
|
<Image.ContextMenu>
|
||||||
Source="C:\Users\HKW\Desktop\测试肖像文件夹\10500.png" />
|
<ContextMenu>
|
||||||
<Label
|
<MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改测试图片}" />
|
||||||
Content="TouchHeadRect"
|
</ContextMenu>
|
||||||
DataContext="{Binding Pet.Value.TouchHeadRect.Value}"
|
</Image.ContextMenu>
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchHead}">
|
</Image>
|
||||||
<Label.Style>
|
<Button
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
HorizontalAlignment="Center"
|
||||||
<Setter Property="Margin">
|
VerticalAlignment="Center"
|
||||||
<Setter.Value>
|
Command="{Binding AddImageCommand}"
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
Content="{ll:Str 添加测试图片}">
|
||||||
<Binding Path="X.Value" />
|
<Button.Style>
|
||||||
<Binding Path="Y.Value" />
|
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
|
||||||
</MultiBinding>
|
<Setter Property="Visibility" Value="Hidden" />
|
||||||
</Setter.Value>
|
<Style.Triggers>
|
||||||
</Setter>
|
<DataTrigger Binding="{Binding Image.Value}" Value="{x:Null}">
|
||||||
</Style>
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
</Label.Style>
|
</DataTrigger>
|
||||||
</Label>
|
</Style.Triggers>
|
||||||
<Label
|
</Style>
|
||||||
Content="TouchRaisedRect_Happy"
|
</Button.Style>
|
||||||
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value}"
|
</Button>
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_HappyState}">
|
</Grid>
|
||||||
<Label.Style>
|
<Grid>
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
<Label
|
||||||
<Setter Property="Margin">
|
Content="TouchHeadRect"
|
||||||
<Setter.Value>
|
DataContext="{Binding Pet.Value.TouchHeadRect.Value}"
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchHead}">
|
||||||
<Binding Path="X.Value" />
|
<Label.Style>
|
||||||
<Binding Path="Y.Value" />
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
</MultiBinding>
|
<Setter Property="Margin">
|
||||||
</Setter.Value>
|
<Setter.Value>
|
||||||
</Setter>
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</Style>
|
<Binding Path="X.Value" />
|
||||||
</Label.Style>
|
<Binding Path="Y.Value" />
|
||||||
</Label>
|
</MultiBinding>
|
||||||
<Label
|
</Setter.Value>
|
||||||
Content="TouchRaisedRect_Nomal"
|
</Setter>
|
||||||
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value}"
|
</Style>
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_NomalState}">
|
</Label.Style>
|
||||||
<Label.Style>
|
</Label>
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
<Label
|
||||||
<Setter Property="Margin">
|
Content="TouchRaisedRect_Happy"
|
||||||
<Setter.Value>
|
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value}"
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_HappyState}">
|
||||||
<Binding Path="X.Value" />
|
<Label.Style>
|
||||||
<Binding Path="Y.Value" />
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
</MultiBinding>
|
<Setter Property="Margin">
|
||||||
</Setter.Value>
|
<Setter.Value>
|
||||||
</Setter>
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</Style>
|
<Binding Path="X.Value" />
|
||||||
</Label.Style>
|
<Binding Path="Y.Value" />
|
||||||
</Label>
|
</MultiBinding>
|
||||||
<Label
|
</Setter.Value>
|
||||||
Content="TouchRaisedRect_PoorCondition"
|
</Setter>
|
||||||
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value}"
|
</Style>
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_PoorConditionState}">
|
</Label.Style>
|
||||||
<Label.Style>
|
</Label>
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
<Label
|
||||||
<Setter Property="Margin">
|
Content="TouchRaisedRect_Nomal"
|
||||||
<Setter.Value>
|
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value}"
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_NomalState}">
|
||||||
<Binding Path="X.Value" />
|
<Label.Style>
|
||||||
<Binding Path="Y.Value" />
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
</MultiBinding>
|
<Setter Property="Margin">
|
||||||
</Setter.Value>
|
<Setter.Value>
|
||||||
</Setter>
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</Style>
|
<Binding Path="X.Value" />
|
||||||
</Label.Style>
|
<Binding Path="Y.Value" />
|
||||||
</Label>
|
</MultiBinding>
|
||||||
<Label
|
</Setter.Value>
|
||||||
Content="TouchRaisedRect_Ill"
|
</Setter>
|
||||||
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value}"
|
</Style>
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_IllState}">
|
</Label.Style>
|
||||||
<Label.Style>
|
</Label>
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
<Label
|
||||||
<Setter Property="Margin">
|
Content="TouchRaisedRect_PoorCondition"
|
||||||
<Setter.Value>
|
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value}"
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_PoorConditionState}">
|
||||||
<Binding Path="X.Value" />
|
<Label.Style>
|
||||||
<Binding Path="Y.Value" />
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
</MultiBinding>
|
<Setter Property="Margin">
|
||||||
</Setter.Value>
|
<Setter.Value>
|
||||||
</Setter>
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</Style>
|
<Binding Path="X.Value" />
|
||||||
</Label.Style>
|
<Binding Path="Y.Value" />
|
||||||
</Label>
|
</MultiBinding>
|
||||||
<Label
|
</Setter.Value>
|
||||||
Width="5"
|
</Setter>
|
||||||
Height="5"
|
</Style>
|
||||||
Background="Red"
|
</Label.Style>
|
||||||
Content="RaisePoint_Happy"
|
</Label>
|
||||||
DataContext="{Binding Pet.Value.RaisePoint.Value.Happy.Value}"
|
<Label
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Happy}">
|
Content="TouchRaisedRect_Ill"
|
||||||
<Label.Style>
|
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value}"
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_TouchRaisedRect_IllState}">
|
||||||
<Setter Property="Margin">
|
<Label.Style>
|
||||||
<Setter.Value>
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
<Setter Property="Margin">
|
||||||
<Binding Path="X.Value" />
|
<Setter.Value>
|
||||||
<Binding Path="Y.Value" />
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</MultiBinding>
|
<Binding Path="X.Value" />
|
||||||
</Setter.Value>
|
<Binding Path="Y.Value" />
|
||||||
</Setter>
|
</MultiBinding>
|
||||||
</Style>
|
</Setter.Value>
|
||||||
</Label.Style>
|
</Setter>
|
||||||
</Label>
|
</Style>
|
||||||
<Label
|
</Label.Style>
|
||||||
Width="5"
|
</Label>
|
||||||
Height="5"
|
<Label
|
||||||
Background="Red"
|
Width="5"
|
||||||
Content="RaisePoint_Nomal"
|
Height="5"
|
||||||
DataContext="{Binding Pet.Value.RaisePoint.Value.Nomal.Value}"
|
Background="Red"
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Nomal}">
|
Content="RaisePoint_Happy"
|
||||||
<Label.Style>
|
DataContext="{Binding Pet.Value.RaisePoint.Value.Happy.Value}"
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Happy}">
|
||||||
<Setter Property="Margin">
|
<Label.Style>
|
||||||
<Setter.Value>
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
<Setter Property="Margin">
|
||||||
<Binding Path="X.Value" />
|
<Setter.Value>
|
||||||
<Binding Path="Y.Value" />
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</MultiBinding>
|
<Binding Path="X.Value" />
|
||||||
</Setter.Value>
|
<Binding Path="Y.Value" />
|
||||||
</Setter>
|
</MultiBinding>
|
||||||
</Style>
|
</Setter.Value>
|
||||||
</Label.Style>
|
</Setter>
|
||||||
</Label>
|
</Style>
|
||||||
<Label
|
</Label.Style>
|
||||||
Width="5"
|
</Label>
|
||||||
Height="5"
|
<Label
|
||||||
Background="Red"
|
Width="5"
|
||||||
Content="RaisePoint_PoorCondition"
|
Height="5"
|
||||||
DataContext="{Binding Pet.Value.RaisePoint.Value.PoorCondition.Value}"
|
Background="Red"
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_PoorCondition}">
|
Content="RaisePoint_Nomal"
|
||||||
<Label.Style>
|
DataContext="{Binding Pet.Value.RaisePoint.Value.Nomal.Value}"
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Nomal}">
|
||||||
<Setter Property="Margin">
|
<Label.Style>
|
||||||
<Setter.Value>
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
<Setter Property="Margin">
|
||||||
<Binding Path="X.Value" />
|
<Setter.Value>
|
||||||
<Binding Path="Y.Value" />
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</MultiBinding>
|
<Binding Path="X.Value" />
|
||||||
</Setter.Value>
|
<Binding Path="Y.Value" />
|
||||||
</Setter>
|
</MultiBinding>
|
||||||
</Style>
|
</Setter.Value>
|
||||||
</Label.Style>
|
</Setter>
|
||||||
</Label>
|
</Style>
|
||||||
<Label
|
</Label.Style>
|
||||||
Width="5"
|
</Label>
|
||||||
Height="5"
|
<Label
|
||||||
Background="Red"
|
Width="5"
|
||||||
Content="RaisePoint_Ill"
|
Height="5"
|
||||||
DataContext="{Binding Pet.Value.RaisePoint.Value.Ill.Value}"
|
Background="Red"
|
||||||
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Ill}">
|
Content="RaisePoint_PoorCondition"
|
||||||
<Label.Style>
|
DataContext="{Binding Pet.Value.RaisePoint.Value.PoorCondition.Value}"
|
||||||
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_PoorCondition}">
|
||||||
<Setter Property="Margin">
|
<Label.Style>
|
||||||
<Setter.Value>
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
<MultiBinding Converter="{StaticResource MarginConverter}">
|
<Setter Property="Margin">
|
||||||
<Binding Path="X.Value" />
|
<Setter.Value>
|
||||||
<Binding Path="Y.Value" />
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
</MultiBinding>
|
<Binding Path="X.Value" />
|
||||||
</Setter.Value>
|
<Binding Path="Y.Value" />
|
||||||
</Setter>
|
</MultiBinding>
|
||||||
</Style>
|
</Setter.Value>
|
||||||
</Label.Style>
|
</Setter>
|
||||||
</Label>
|
</Style>
|
||||||
|
</Label.Style>
|
||||||
|
</Label>
|
||||||
|
<Label
|
||||||
|
Width="5"
|
||||||
|
Height="5"
|
||||||
|
Background="Red"
|
||||||
|
Content="RaisePoint_Ill"
|
||||||
|
DataContext="{Binding Pet.Value.RaisePoint.Value.Ill.Value}"
|
||||||
|
Tag="{Binding IsChecked, ElementName=ToggleButton_RaisePoint_Ill}">
|
||||||
|
<Label.Style>
|
||||||
|
<Style BasedOn="{StaticResource Label_ThouchRect}" TargetType="Label">
|
||||||
|
<Setter Property="Margin">
|
||||||
|
<Setter.Value>
|
||||||
|
<MultiBinding Converter="{StaticResource MarginConverter}">
|
||||||
|
<Binding Path="X.Value" />
|
||||||
|
<Binding Path="Y.Value" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Label.Style>
|
||||||
|
</Label>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -227,30 +251,35 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Content="宠物Id:" />
|
<Label Content="Id" />
|
||||||
<TextBox
|
<TextBox Grid.Column="1" Text="{Binding Pet.Value.Name.Value}" />
|
||||||
Grid.Column="1"
|
<Label Grid.Row="1" Content="{ll:Str 名称}" />
|
||||||
pu:TextBoxHelper.Watermark="宠物Id"
|
|
||||||
Text="{Binding Pet.Value.Id.Value}" />
|
|
||||||
<Label Grid.Row="1" Content="宠物名称:" />
|
|
||||||
<TextBox
|
<TextBox
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="宠物名称"
|
Text="{Binding Pet.Value.CurrentI18nData.Value.PetName.Value}" />
|
||||||
Text="{Binding Pet.Value.CurrentI18nData.Value.Name.Value}" />
|
<Label Grid.Row="2" Content="{ll:Str 宠物名称}" />
|
||||||
<Label Grid.Row="2" Content="宠物描述:" />
|
|
||||||
<TextBox
|
<TextBox
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="宠物描述"
|
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value}" />
|
||||||
|
<Label Grid.Row="3" Content="{ll:Str 宠物描述}" />
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value}" />
|
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Column="1">
|
<Grid Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -349,7 +378,7 @@
|
|||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
d:Value="100"
|
d:Value="100"
|
||||||
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
|
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.Y.Value, Mode=TwoWay}" />
|
||||||
<Label
|
<Label
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Background="{x:Null}"
|
Background="{x:Null}"
|
||||||
@ -358,7 +387,7 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
d:Value="100"
|
d:Value="100"
|
||||||
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
|
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.Width.Value, Mode=TwoWay}" />
|
||||||
<Label
|
<Label
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
@ -368,7 +397,7 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
d:Value="100"
|
d:Value="100"
|
||||||
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
|
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.Height.Value, Mode=TwoWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
x:Name="ToggleButton_TouchRaisedRect_NomalState"
|
x:Name="ToggleButton_TouchRaisedRect_NomalState"
|
||||||
@ -682,6 +711,23 @@
|
|||||||
</Expander>
|
</Expander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button
|
||||||
|
x:Name="Button_Cancel"
|
||||||
|
Margin="10"
|
||||||
|
Click="Button_Cancel_Click"
|
||||||
|
Content="{ll:Str 取消}" />
|
||||||
|
<Button
|
||||||
|
x:Name="Button_Yes"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="10"
|
||||||
|
Click="Button_Yes_Click"
|
||||||
|
Content="{ll:Str 确定}" />
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LinePutScript.Localization.WPF;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -11,6 +12,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
using VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
using VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
||||||
|
|
||||||
namespace VPet.ModMaker.Views.ModEdit.PetEdit;
|
namespace VPet.ModMaker.Views.ModEdit.PetEdit;
|
||||||
@ -21,10 +23,55 @@ namespace VPet.ModMaker.Views.ModEdit.PetEdit;
|
|||||||
public partial class PetEditWindow : Window
|
public partial class PetEditWindow : Window
|
||||||
{
|
{
|
||||||
public PetEditWindowVM ViewModel => (PetEditWindowVM)DataContext;
|
public PetEditWindowVM ViewModel => (PetEditWindowVM)DataContext;
|
||||||
|
public bool IsCancel { get; private set; } = true;
|
||||||
|
|
||||||
public PetEditWindow()
|
public PetEditWindow()
|
||||||
{
|
{
|
||||||
DataContext = new PetEditWindowVM();
|
DataContext = new PetEditWindowVM();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Closed += (s, e) =>
|
||||||
|
{
|
||||||
|
if (IsCancel)
|
||||||
|
ViewModel.Close();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Cancel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Yes_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(ViewModel.Pet.Value.Name.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(ViewModel.Pet.Value.CurrentI18nData.Value.Name.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show("名称不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(ViewModel.Pet.Value.CurrentI18nData.Value.PetName.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"宠物名称不可为空".Translate(),
|
||||||
|
"",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
ViewModel.OldPet?.Name.Value != ViewModel.Pet.Value.Name.Value
|
||||||
|
&& ModInfoModel.Current.Pets.Any(i => i.Name == ViewModel.Pet.Value.Name)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IsCancel = false;
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,91 @@
|
|||||||
<Page x:Class="VPet.ModMaker.Views.ModEdit.PetEdit.PetPage"
|
<Page
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
x:Class="VPet.ModMaker.Views.ModEdit.PetEdit.PetPage"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.PetEdit"
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
mc:Ignorable="d"
|
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.PetEdit"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
Title="PetPage">
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
|
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.PetEdit"
|
||||||
<Grid>
|
Title="PetPage"
|
||||||
|
d:DesignHeight="450"
|
||||||
</Grid>
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<d:Page.DataContext>
|
||||||
|
<vm:PetPageVM />
|
||||||
|
</d:Page.DataContext>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
<DataGrid
|
||||||
|
Grid.Row="1"
|
||||||
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
|
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
ItemsSource="{Binding ShowPets.Value}"
|
||||||
|
MouseDoubleClick="DataGrid_MouseDoubleClick"
|
||||||
|
RowDetailsVisibilityMode="Visible"
|
||||||
|
RowHeight="64"
|
||||||
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
|
VirtualizingStackPanel.VirtualizationMode="Recycling">
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
|
||||||
|
<Setter Property="Height" Value="64" />
|
||||||
|
<Setter Property="Tag" Value="{Binding}" />
|
||||||
|
<Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding Name.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="Name.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="Id" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding CurrentI18nData.Value.Name.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="CurrentI18nData.Value.Name.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 名称}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding CurrentI18nData.Value.PetName.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="CurrentI18nData.Value.PetName.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 宠物名称}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding CurrentI18nData.Value.Description.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="CurrentI18nData.Value.Description.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 宠物描述}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Button
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Command="{Binding AddCommand}"
|
||||||
|
Content="➕"
|
||||||
|
Style="{StaticResource AddButton}" />
|
||||||
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -12,6 +12,7 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
using VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
using VPet.ModMaker.ViewModels.ModEdit.PetEdit;
|
||||||
|
|
||||||
namespace VPet.ModMaker.Views.ModEdit.PetEdit;
|
namespace VPet.ModMaker.Views.ModEdit.PetEdit;
|
||||||
@ -28,4 +29,11 @@ public partial class PetPage : Page
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = new PetPageVM();
|
DataContext = new PetPageVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not PetModel model)
|
||||||
|
return;
|
||||||
|
ViewModel.Edit(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterSelectText.Value, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<DataGrid
|
<DataGrid
|
||||||
x:Name="DataGrid_SelectText"
|
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||||
@ -30,7 +29,7 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
GridLinesVisibility="Horizontal"
|
GridLinesVisibility="Horizontal"
|
||||||
ItemsSource="{Binding ShowSelectTexts.Value}"
|
ItemsSource="{Binding ShowSelectTexts.Value}"
|
||||||
MouseDoubleClick="DataGrid_SelectText_MouseDoubleClick"
|
MouseDoubleClick="DataGrid_MouseDoubleClick"
|
||||||
RowDetailsVisibilityMode="Visible"
|
RowDetailsVisibilityMode="Visible"
|
||||||
RowHeight="64"
|
RowHeight="64"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True"
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
@ -185,7 +184,7 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Command="{Binding AddSelectTextCommand}"
|
Command="{Binding AddCommand}"
|
||||||
Content="➕"
|
Content="➕"
|
||||||
Style="{StaticResource AddButton}" />
|
Style="{StaticResource AddButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -30,13 +30,10 @@ public partial class SelectTextPage : Page
|
|||||||
DataContext = new SelectTextPageVM();
|
DataContext = new SelectTextPageVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGrid_SelectText_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not SelectTextModel model)
|
||||||
sender is not DataGrid dataGrid
|
|
||||||
|| dataGrid.SelectedItem is not SelectTextModel clickText
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
ViewModel.EditSelectText(clickText);
|
ViewModel.Edit(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkEditWindow.xaml
Normal file
12
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkEditWindow.xaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Window x:Class="VPet.ModMaker.Views.ModEdit.WorkEdit.WorkEditWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.WorkEdit"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="WorkEditWindow" Height="450" Width="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
67
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkEditWindow.xaml.cs
Normal file
67
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkEditWindow.xaml.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using LinePutScript.Localization.WPF;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
|
using VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.Views.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WorkEditWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class WorkEditWindow : Window
|
||||||
|
{
|
||||||
|
public bool IsCancel { get; private set; } = true;
|
||||||
|
public WorkEditWindowVM ViewModel => (WorkEditWindowVM)DataContext;
|
||||||
|
|
||||||
|
public WorkEditWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = new WorkEditWindowVM();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Cancel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Yes_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(ViewModel.Work.Value.Name.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(ViewModel.Work.Value.Graph.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"指定动画Id不可为空".Translate(),
|
||||||
|
"",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
ViewModel.OldWork?.Name.Value != ViewModel.Work.Value.Name.Value
|
||||||
|
&& ViewModel.CurrentPet.Works.Any(i => i.Name.Value == ViewModel.Work.Value.Name.Value)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MessageBox.Show("此Id已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IsCancel = false;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
204
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkPage.xaml
Normal file
204
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkPage.xaml
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="VPet.ModMaker.Views.ModEdit.WorkEdit.WorkPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
|
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.WorkEdit"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
|
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.WorkEdit"
|
||||||
|
Title="WorkPage"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<d:Page.DataContext>
|
||||||
|
<vm:WorkPageVM />
|
||||||
|
</d:Page.DataContext>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
<TextBox.Style>
|
||||||
|
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem, ElementName=ComboBox_Pet}" Value="{x:Null}">
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBox.Style>
|
||||||
|
</TextBox>
|
||||||
|
<ComboBox
|
||||||
|
x:Name="ComboBox_Pet"
|
||||||
|
Grid.Column="1"
|
||||||
|
pu:ComboBoxHelper.Watermark="{ll:Str 选择宠物}"
|
||||||
|
DisplayMemberPath="Name.Value"
|
||||||
|
ItemsSource="{Binding Pets}"
|
||||||
|
SelectedItem="{Binding CurrentPet.Value}">
|
||||||
|
<ComboBox.ItemContainerStyle>
|
||||||
|
<Style BasedOn="{StaticResource {x:Type ComboBoxItem}}" TargetType="ComboBoxItem">
|
||||||
|
<Setter Property="ToolTip" Value="{Binding CurrentI18nData.Value.Name.Value}" />
|
||||||
|
</Style>
|
||||||
|
</ComboBox.ItemContainerStyle>
|
||||||
|
</ComboBox>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.Style>
|
||||||
|
<Style TargetType="Grid">
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem, ElementName=ComboBox_Pet}" Value="{x:Null}">
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Grid.Style>
|
||||||
|
<DataGrid
|
||||||
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
|
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
ItemsSource="{Binding ShowWorks.Value}"
|
||||||
|
MouseDoubleClick="DataGrid_MouseDoubleClick"
|
||||||
|
RowDetailsVisibilityMode="Visible"
|
||||||
|
RowHeight="64"
|
||||||
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
|
VirtualizingStackPanel.VirtualizationMode="Recycling">
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
|
||||||
|
<Setter Property="Height" Value="64" />
|
||||||
|
<Setter Property="Tag" Value="{Binding}" />
|
||||||
|
<Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding Name.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="Name.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="Id" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding CurrentI18nData.Value.Name.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="CurrentI18nData.Value.Name.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 工作名称}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding WorkType.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="WorkType.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 工作类型}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding Graph.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="Graph.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 动画名称}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding MoneyBase.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="MoneyBase.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 基本倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding MoneyLevel.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="MoneyLevel.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 等级倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding StrengthFood.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="StrengthFood.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 饱食度消耗倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding StrengthDrink.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="StrengthDrink.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 口渴度消耗倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding Feeling.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="Feeling.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 心情消耗倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding LevelLimit.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="LevelLimit.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 等级限制}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding Time.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="Time.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 花费时间}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding FinishBonus.Value}"
|
||||||
|
CanUserSort="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SortMemberPath="FinishBonus.Value">
|
||||||
|
<DataGridTextColumn.Header>
|
||||||
|
<TextBlock Text="{ll:Str 奖励倍率}" />
|
||||||
|
</DataGridTextColumn.Header>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Button
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Command="{Binding AddCommand}"
|
||||||
|
Content="➕"
|
||||||
|
Style="{StaticResource AddButton}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
39
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkPage.xaml.cs
Normal file
39
VPet.ModMaker/Views/ModEdit/WorkEdit/WorkPage.xaml.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using VPet.ModMaker.Models;
|
||||||
|
using VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
namespace VPet.ModMaker.Views.ModEdit.WorkEdit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WorkPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class WorkPage : Page
|
||||||
|
{
|
||||||
|
public WorkPageVM ViewModel => (WorkPageVM)DataContext;
|
||||||
|
|
||||||
|
public WorkPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = new WorkPageVM();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not WorkModel model)
|
||||||
|
return;
|
||||||
|
ViewModel.Edit(model);
|
||||||
|
}
|
||||||
|
}
|
@ -54,12 +54,6 @@ public partial class ModMakerWindow : Window
|
|||||||
ViewModel.ShowHistories.Value.Remove(history);
|
ViewModel.ShowHistories.Value.Remove(history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var loader = new ModLoader(new(history.SourcePath));
|
ViewModel.LoadMod(history.SourcePath);
|
||||||
if (loader.SuccessLoad)
|
|
||||||
{
|
|
||||||
ViewModel.EditMod(new(loader));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MessageBox.Show($"载入失败".Translate());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user