实装 模组载入和模组本地化文件读取

This commit is contained in:
Hakoyu 2023-08-30 04:45:25 +08:00
parent e8f71384c8
commit 1f3cda4023
29 changed files with 986 additions and 671 deletions

View File

@ -8,26 +8,19 @@ using VPet_Simulator.Windows.Interface;
namespace VPet.Plugin.ModMaker.Models;
public class ClickTextModel : II18nData<I18nClickTextModel>
public class ClickTextModel : I18nModel<I18nClickTextModel>
{
public string Text { get; set; }
public ObservableValue<string> Id { get; } = new();
public ObservableValue<ClickText.ModeType> Mode { get; } = new();
public ObservableValue<string> Working { get; } = new();
public ObservableValue<int> LikeMin { get; } = new();
public ObservableValue<int> LikeMax { get; } = new();
public ObservableValue<double> LikeMin { get; } = new();
public ObservableValue<double> LikeMax { get; } = new();
public ObservableValue<VPet_Simulator.Core.Main.WorkingState> WorkingState { get; } = new();
public ObservableValue<ClickText.DayTime> DayTime { get; } = new();
public ObservableValue<I18nClickTextModel> CurrentI18nData { get; } = new();
public Dictionary<string, I18nClickTextModel> I18nDatas { get; } = new();
public ClickTextModel()
{
foreach (var lang in I18nHelper.Current.CultureNames)
I18nDatas.Add(lang, new());
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public ClickTextModel() { }
public ClickTextModel(ClickTextModel clickText)
: this()
@ -38,15 +31,25 @@ public class ClickTextModel : II18nData<I18nClickTextModel>
LikeMax.Value = clickText.LikeMax.Value;
LikeMin.Value = clickText.LikeMin.Value;
DayTime.Value = clickText.DayTime.Value;
foreach (var item in clickText.I18nDatas)
I18nDatas[item.Key] = item.Value;
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public ClickTextModel(ClickText clickText)
: this()
{
Text = clickText.Text;
Mode.Value = clickText.Mode;
Working.Value = clickText.Working;
WorkingState.Value = clickText.State;
DayTime.Value = clickText.DaiTime;
LikeMax.Value = clickText.LikeMax;
LikeMin.Value = clickText.LikeMin;
}
public ClickText ToClickText()
{
return new()
{
Text = Text,
Mode = Mode.Value,
Working = Working.Value,
State = WorkingState.Value,

View File

@ -10,8 +10,10 @@ using VPet_Simulator.Windows.Interface;
namespace VPet.Plugin.ModMaker.Models;
public class FoodModel : II18nData<I18nFoodModel>
public class FoodModel : I18nModel<I18nFoodModel>
{
public string Name { get; set; }
public string Description { get; set; }
public ObservableValue<string> Id { get; } = new();
public ObservableValue<Food.FoodType> Type { get; } = new();
public ObservableValue<double> Strength { get; } = new();
@ -23,15 +25,8 @@ public class FoodModel : II18nData<I18nFoodModel>
public ObservableValue<double> Price { get; } = new();
public ObservableValue<int> Exp { get; } = new();
public ObservableValue<BitmapImage> Image { get; } = new();
public ObservableValue<I18nFoodModel> CurrentI18nData { get; } = new();
public Dictionary<string, I18nFoodModel> I18nDatas { get; } = new();
public FoodModel()
{
foreach (var lang in I18nHelper.Current.CultureNames)
I18nDatas.Add(lang, new());
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public FoodModel() { }
public FoodModel(FoodModel food)
: this()
@ -47,9 +42,24 @@ public class FoodModel : II18nData<I18nFoodModel>
Price.Value = food.Price.Value;
Exp.Value = food.Exp.Value;
Image.Value = Utils.LoadImageToStream(food.Image.Value);
foreach (var item in food.I18nDatas)
I18nDatas[item.Key] = item.Value;
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public FoodModel(Food food)
: this()
{
Name = food.Name;
Description = food.Description;
Type.Value = food.Type;
Strength.Value = food.Strength;
StrengthDrink.Value = food.StrengthDrink;
StrengthFood.Value = food.StrengthFood;
Feeling.Value = food.Feeling;
Health.Value = food.Health;
Likability.Value = food.Likability;
Price.Value = food.Price;
Exp.Value = food.Exp;
if (File.Exists(food.Image))
Image.Value = Utils.LoadImageToStream(food.Image);
}
public Food ToFood()

View File

@ -0,0 +1,52 @@
using HKW.HKWViewModels.SimpleObservable;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Plugin.ModMaker.Models;
public class I18nModel<T>
where T : class, new()
{
public ObservableValue<T> CurrentI18nData { get; } = new();
public Dictionary<string, T> I18nDatas { get; } = new();
public I18nModel()
{
I18nHelper.Current.CultureName.ValueChanged += LangChanged;
I18nHelper.Current.AddLang += AddLang;
I18nHelper.Current.RemoveLang += RemoveLang;
I18nHelper.Current.ReplaceLang += ReplaceLang;
if (I18nDatas.Count == 0)
return;
foreach (var item in I18nDatas)
I18nDatas[item.Key] = item.Value;
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
private void LangChanged(string value)
{
if (I18nDatas.TryGetValue(value, out var result))
CurrentI18nData.Value = result;
}
private void AddLang(string lang)
{
if (I18nDatas.ContainsKey(lang) is false)
I18nDatas.Add(lang, new());
}
private void RemoveLang(string lang)
{
I18nDatas.Remove(lang);
}
private void ReplaceLang(string oldLang, string newLang)
{
var item = I18nDatas[oldLang];
I18nDatas.Remove(oldLang);
I18nDatas.Add(newLang, item);
}
}

View File

@ -1,15 +0,0 @@
using HKW.HKWViewModels.SimpleObservable;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Plugin.ModMaker.Models;
public interface II18nData<T>
where T : class
{
public ObservableValue<T> CurrentI18nData { get; }
public Dictionary<string, T> I18nDatas { get; }
}

View File

@ -4,36 +4,36 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using VPet_Simulator.Windows.Interface;
namespace VPet.Plugin.ModMaker.Models;
public class LowTextModel : II18nData<I18nLowTextModel>
public class LowTextModel : I18nModel<I18nLowTextModel>
{
public string Text { get; set; }
public ObservableValue<string> Id { get; } = new();
public ObservableValue<LowText.ModeType> Mode { get; } = new();
public ObservableValue<LowText.StrengthType> Strength { get; } = new();
public ObservableValue<LowText.LikeType> Like { get; } = new();
public ObservableValue<I18nLowTextModel> CurrentI18nData { get; } = new();
public Dictionary<string, I18nLowTextModel> I18nDatas { get; } = new();
public LowTextModel()
{
foreach (var lang in I18nHelper.Current.CultureNames)
I18nDatas.Add(lang, new());
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public LowTextModel() { }
public LowTextModel(LowTextModel lowText)
: this()
{
Mode = lowText.Mode;
Strength = lowText.Strength;
Like = lowText.Like;
foreach (var item in lowText.I18nDatas)
I18nDatas[item.Key] = item.Value;
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
Mode.Value = lowText.Mode.Value;
Strength.Value = lowText.Strength.Value;
Like.Value = lowText.Like.Value;
}
public LowTextModel(LowText lowText)
: this()
{
Text = lowText.Text;
Mode.Value = lowText.Mode;
Strength.Value = lowText.Strength;
Like.Value = lowText.Like;
}
public void Close() { }
@ -43,6 +43,7 @@ public class LowTextModel : II18nData<I18nLowTextModel>
// 没有 Text
return new()
{
Text = Text,
Mode = Mode.Value,
Strength = Strength.Value,
Like = Like.Value,

View File

@ -1,6 +1,9 @@
using HKW.HKWViewModels.SimpleObservable;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,17 +12,55 @@ using VPet_Simulator.Windows.Interface;
namespace VPet.Plugin.ModMaker.Models;
public class ModInfoModel
public class ModInfoModel : I18nModel<I18nModInfoModel>
{
public static ModInfoModel Current { get; set; }
public ObservableValue<string> Id { get; } = new();
public ObservableValue<string> Summary { get; } = new();
public ObservableValue<string> Author { get; } = new();
public ObservableValue<string> GameVersion { get; } = new();
public ObservableValue<string> ModVersion { get; } = new();
public ObservableValue<BitmapImage> ModImage { get; } = new();
public ObservableValue<I18nModInfoModel> CurrentI18nData { get; } = new();
public Dictionary<string, I18nModInfoModel> I18nDatas { get; } = new();
public List<FoodModel> Foods { get; set; } = new();
//public List<ClickText> ClickTexts { get; set; } = new();
//public List<LowText> LowTexts { get; set; } = new();
public ObservableCollection<FoodModel> Foods { get; } = new();
public ObservableCollection<ClickTextModel> ClickTexts { get; } = new();
public ObservableCollection<LowTextModel> LowTexts { get; } = new();
public ObservableValue<string> SourcePath { get; } = new();
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
public ModInfoModel() { }
public ModInfoModel(ModLoader loader)
{
SourcePath.Value = loader.Path.FullName;
Id.Value = loader.Name;
var imagePath = Path.Combine(loader.Path.FullName, "icon.png");
if (File.Exists(imagePath))
ModImage.Value = Utils.LoadImageToStream(imagePath);
Author.Value = loader.Author;
GameVersion.Value = loader.GameVer.ToString();
ModVersion.Value = loader.Ver.ToString();
foreach (var food in loader.Foods)
Foods.Add(new(food));
foreach (var clickText in loader.ClickTexts)
ClickTexts.Add(new(clickText));
foreach (var lowText in loader.LowTexts)
LowTexts.Add(new(lowText));
Summary.Value = GetSummary();
foreach (var lang in loader.I18nDatas)
I18nDatas.Add(lang.Key, lang.Value);
OtherI18nDatas = loader.OtherI18nDatas;
}
public string GetSummary()
{
return $@"包含以下内容:
: {Foods.Count}
: {ClickTexts.Count}
: {LowTexts.Count}";
}
}
public class I18nModInfoModel

View File

@ -0,0 +1,219 @@
using LinePutScript;
using LinePutScript.Converter;
using LinePutScript.Dictionary;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VPet_Simulator.Core;
using VPet_Simulator.Windows.Interface;
namespace VPet.Plugin.ModMaker.Models;
public class ModLoader
{
public string Name { get; }
public string Author { get; }
/// <summary>
/// 如果是上传至Steam,则为SteamUserID
/// </summary>
public long AuthorID { get; }
/// <summary>
/// 上传至Steam的ItemID
/// </summary>
public ulong ItemID { get; }
public string Intro { get; }
public DirectoryInfo Path { get; }
public int GameVer { get; }
public int Ver { get; }
public HashSet<string> Tag { get; } = new();
public bool SuccessLoad { get; } = true;
public DateTime CacheDate { get; } = DateTime.MinValue;
public List<PetLoader> Pets { get; } = new();
public List<Food> Foods { get; } = new();
public List<LowText> LowTexts { get; } = new();
public Dictionary<string, I18nModInfoModel> I18nDatas { get; } = new();
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
public List<ClickText> ClickTexts { get; } = new();
public ModLoader(DirectoryInfo directory)
{
try
{
Path = directory;
LpsDocument modlps = new LpsDocument(
File.ReadAllText(directory.FullName + @"\info.lps")
);
Name = modlps.FindLine("vupmod").Info;
Intro = modlps.FindLine("intro").Info;
GameVer = modlps.FindSub("gamever").InfoToInt;
Ver = modlps.FindSub("ver").InfoToInt;
Author = modlps.FindSub("author").Info.Split('[').First();
if (modlps.FindLine("authorid") != null)
AuthorID = modlps.FindLine("authorid").InfoToInt64;
else
AuthorID = 0;
if (modlps.FindLine("itemid") != null)
ItemID = Convert.ToUInt64(modlps.FindLine("itemid").info);
else
ItemID = 0;
CacheDate = modlps.GetDateTime("cachedate", DateTime.MinValue);
//MOD未加载时支持翻译
foreach (var line in modlps.FindAllLine("lang"))
{
var i18nData = new I18nModInfoModel();
foreach (var sub in line)
{
if (sub.Name == Name)
i18nData.Name.Value = sub.Info;
else if (sub.Name == Intro)
i18nData.Description.Value = sub.Info;
}
I18nDatas.Add(line.Info, i18nData);
}
DirectoryInfo? langDirectory = null;
foreach (DirectoryInfo di in Path.EnumerateDirectories())
{
switch (di.Name.ToLower())
{
case "pet":
//宠物模型
Tag.Add("pet");
foreach (FileInfo fi in di.EnumerateFiles("*.lps"))
{
var lps = new LpsDocument(File.ReadAllText(fi.FullName));
if (lps.First().Name.ToLower() == "pet")
{
var name = lps.First().Info;
Pets.Add(new PetLoader(lps, di));
//var p = mw.Pets.FirstOrDefault(x => x.Name == name);
//if (p == null)
// mw.Pets.Add(new PetLoader(lps, di));
//else
//{
// p.path.Add(di.FullName + "\\" + lps.First()["path"].Info);
// p.Config.Set(lps);
//}
}
}
break;
case "food":
Tag.Add("food");
foreach (FileInfo fi in di.EnumerateFiles("*.lps"))
{
var tmp = new LpsDocument(File.ReadAllText(fi.FullName));
foreach (ILine li in tmp)
{
var food = LPSConvert.DeserializeObject<Food>(li);
var imagePath = $"{Path.FullName}\\image\\food\\{food.Name}.png";
if (File.Exists(imagePath))
food.Image = imagePath;
Foods.Add(food);
//string tmps = li.Find("name").info;
//mw.Foods.RemoveAll(x => x.Name == tmps);
//mw.Foods.Add(LPSConvert.DeserializeObject<Food>(li));
}
}
break;
case "image":
Tag.Add("image");
break;
case "text":
Tag.Add("text");
foreach (FileInfo fi in di.EnumerateFiles("*.lps"))
{
var tmp = new LpsDocument(File.ReadAllText(fi.FullName));
foreach (ILine li in tmp)
{
switch (li.Name.ToLower())
{
case "lowfoodtext":
LowTexts.Add(LPSConvert.DeserializeObject<LowText>(li));
break;
case "lowdrinktext":
LowTexts.Add(LPSConvert.DeserializeObject<LowText>(li));
break;
case "clicktext":
ClickTexts.Add(LPSConvert.DeserializeObject<ClickText>(li));
break;
//case "selecttext":
// mw.SelectTexts.Add(
// LPSConvert.DeserializeObject<SelectText>(li)
// );
// break;
}
}
}
break;
case "lang":
Tag.Add("lang");
langDirectory = di;
//foreach (FileInfo fi in di.EnumerateFiles("*.lps"))
//{
// //LocalizeCore.AddCulture(
// // fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length),
// // new LPS_D(File.ReadAllText(fi.FullName))
// //);
//}
//foreach (DirectoryInfo dis in di.EnumerateDirectories())
//{
// foreach (FileInfo fi in dis.EnumerateFiles("*.lps"))
// {
// //LocalizeCore.AddCulture(
// // dis.Name,
// // new LPS_D(File.ReadAllText(fi.FullName))
// //);
// }
//}
//if (mw.Set.Language == "null")
//{
// LocalizeCore.LoadDefaultCulture();
//}
//else
// LocalizeCore.LoadCulture(mw.Set.Language);
break;
}
}
if (langDirectory is null)
return;
foreach (DirectoryInfo dis in langDirectory.EnumerateDirectories())
{
OtherI18nDatas.Add(dis.Name, new());
foreach (FileInfo fi in dis.EnumerateFiles("*.lps"))
{
var lps = new LPS(File.ReadAllText(fi.FullName));
foreach (var item in lps)
{
if (OtherI18nDatas[dis.Name].ContainsKey(item.Name) is false)
OtherI18nDatas[dis.Name].Add(item.Name, item.Info);
}
}
}
}
catch (Exception ex)
{
Tag.Add("该模组已损坏");
SuccessLoad = false;
}
}
public void WriteFile()
{
var lps = new LpsDocument(File.ReadAllText(Path.FullName + @"\info.lps"));
lps.FindLine("vupmod").Info = Name;
lps.FindLine("intro").Info = Intro;
lps.FindSub("gamever").InfoToInt = GameVer;
lps.FindSub("ver").InfoToInt = Ver;
lps.FindSub("author").Info = Author;
lps.FindorAddLine("authorid").InfoToInt64 = AuthorID;
lps.FindorAddLine("itemid").info = ItemID.ToString();
File.WriteAllText(Path.FullName + @"\info.lps", lps.ToString());
}
}

View File

@ -0,0 +1,20 @@
using LinePutScript.Converter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Plugin.ModMaker.Models;
public class ModMakeHistory
{
[Line(ignoreCase: true)]
public string Name { get; set; }
[Line(ignoreCase: true)]
public string Path { get; set; }
[Line(ignoreCase: true)]
public DateTime LastOpenTime { get; set; }
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Plugin.ModMaker.Models;
public static class ModMakerInfo
{
public const string BaseDirectory = nameof(ModMaker);
}

View File

@ -9,12 +9,22 @@ using System.Windows.Media.Imaging;
namespace VPet.Plugin.ModMaker.Models;
public class PetModel
public class PetModel : I18nModel<I18nPetInfoModel>
{
public ObservableValue<string> Id { get; } = new();
public ObservableValue<BitmapImage> Image { get; } = new();
public ObservableValue<ObservableInt32Rect> TouchHeadRect { get; } = new(new());
public ObservableValue<MultiStateRect> TouchRaisedRect { get; } = new(new());
public ObservableValue<MultiStatePoint> RaisePoint { get; } = new(new());
public ObservableValue<I18nPetInfoModel> CurrentI18nData { get; } = new();
public Dictionary<string, I18nPetInfoModel> I18nDatas { get; } = new();
}
public class I18nPetInfoModel
{
public ObservableValue<string> Name { get; set; } = new();
public ObservableValue<string> Description { get; set; } = new();
}
public class MultiStateRect

View File

@ -61,8 +61,8 @@
<Reference Include="Panuon.WPF, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.15.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.6\lib\net462\Panuon.WPF.UI.dll</HintPath>
<Reference Include="Panuon.WPF.UI, Version=1.1.15.7, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.7\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -76,10 +76,10 @@
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Core.1.0.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
<HintPath>..\packages\VPet-Simulator.Core.1.0.2\lib\net462\VPet-Simulator.Core.dll</HintPath>
</Reference>
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Windows.Interface.1.0.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
<HintPath>..\packages\VPet-Simulator.Windows.Interface.1.0.2\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
@ -94,8 +94,11 @@
<Compile Include="Models\ClickTextModel.cs" />
<Compile Include="Models\FoodModel.cs" />
<Compile Include="Models\I18nHelper.cs" />
<Compile Include="Models\II18nData.cs" />
<Compile Include="Models\I18nModel.cs" />
<Compile Include="Models\LowTextModel.cs" />
<Compile Include="Models\ModLoader.cs" />
<Compile Include="Models\ModMakeHistory.cs" />
<Compile Include="Models\ModMakerInfo.cs" />
<Compile Include="Models\PetModel.cs" />
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextEditWindowVM.cs" />
<Compile Include="ViewModels\ModEdit\ClickTextEdit\ClickTextPageVM.cs" />

View File

@ -12,7 +12,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.ClickTextEdit;
public class ClickTextEditWindowVM
{
public ObservableCollection<ClickTextModel> ClickTexts { get; set; }
#region Value
public ObservableValue<ClickTextModel> ClickText { get; } = new(new());
public ObservableCollection<ClickText.ModeType> ModeTypes { get; } = new();

View File

@ -15,7 +15,8 @@ public class ClickTextPageVM
{
#region Value
public ObservableValue<ObservableCollection<ClickTextModel>> ShowClickTexts { get; } = new();
public ObservableCollection<ClickTextModel> ClickTexts { get; } = new();
public ObservableCollection<ClickTextModel> ClickTexts { get; } =
new(ModInfoModel.Current.ClickTexts);
public ObservableValue<string> FilterClickText { get; } = new();
#endregion
#region Command
@ -31,11 +32,6 @@ public class ClickTextPageVM
AddClickTextCommand.ExecuteAction = AddClickText;
EditClickTextCommand.ExecuteAction = EditClickText;
RemoveClickTextCommand.ExecuteAction = RemoveClickText;
I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged;
I18nHelper.Current.AddLang += Instance_AddLang;
I18nHelper.Current.RemoveLang += Instance_RemoveLang;
I18nHelper.Current.ReplaceLang += Instance_ReplaceLang;
}
private void FilterClickText_ValueChanged(string value)
@ -54,7 +50,7 @@ public class ClickTextPageVM
private void AddClickText()
{
var window = CreateClickTextEditWindow();
var window = new ClickTextEditWindow();
var vm = window.ViewModel;
window.ShowDialog();
if (window.IsCancel)
@ -64,7 +60,7 @@ public class ClickTextPageVM
public void EditClickText(ClickTextModel clickText)
{
var window = CreateClickTextEditWindow();
var window = new ClickTextEditWindow();
var vm = window.ViewModel;
var newLowTest = vm.ClickText.Value = new(clickText);
window.ShowDialog();
@ -95,45 +91,4 @@ public class ClickTextPageVM
ClickTexts.Remove(clickText);
}
}
private void CurrentLang_ValueChanged(string value)
{
foreach (var lowText in ClickTexts)
{
lowText.CurrentI18nData.Value = lowText.I18nDatas[value];
}
}
private void Instance_AddLang(string lang)
{
foreach (var lowText in ClickTexts)
{
lowText.I18nDatas.Add(lang, new());
}
}
private void Instance_RemoveLang(string lang)
{
foreach (var lowText in ClickTexts)
{
lowText.I18nDatas.Remove(lang);
}
}
private void Instance_ReplaceLang(string oldLang, string newLang)
{
foreach (var lowText in ClickTexts)
{
var item = lowText.I18nDatas[oldLang];
lowText.I18nDatas.Remove(oldLang);
lowText.I18nDatas.Add(newLang, item);
}
}
private ClickTextEditWindow CreateClickTextEditWindow()
{
var window = new ClickTextEditWindow();
window.ViewModel.ClickTexts = ClickTexts;
return window;
}
}

View File

@ -15,8 +15,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.FoodEdit;
public class FoodEditWindowVM
{
public ObservableCollection<FoodModel> Foods { get; set; }
#region Value
public ObservableValue<FoodModel> Food { get; } = new(new());
public ObservableCollection<Food.FoodType> FoodTypes { get; } = new();

View File

@ -17,7 +17,7 @@ public class FoodPageVM
{
#region Value
public ObservableValue<ObservableCollection<FoodModel>> ShowFoods { get; } = new();
public ObservableCollection<FoodModel> Foods { get; } = new();
public ObservableCollection<FoodModel> Foods { get; } = new(ModInfoModel.Current.Foods);
public ObservableValue<string> FilterFoodText { get; } = new();
#endregion
#region Command
@ -33,45 +33,6 @@ public class FoodPageVM
AddFoodCommand.ExecuteAction = AddFood;
EditFoodCommand.ExecuteAction = EditFood;
RemoveFoodCommand.ExecuteAction = RemoveFood;
I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged;
I18nHelper.Current.AddLang += Instance_AddLang;
I18nHelper.Current.RemoveLang += Instance_RemoveLang;
I18nHelper.Current.ReplaceLang += Instance_ReplaceLang;
}
private void CurrentLang_ValueChanged(string value)
{
foreach (var food in Foods)
{
food.CurrentI18nData.Value = food.I18nDatas[value];
}
}
private void Instance_AddLang(string lang)
{
foreach (var food in Foods)
{
food.I18nDatas.Add(lang, new());
}
}
private void Instance_RemoveLang(string lang)
{
foreach (var food in Foods)
{
food.I18nDatas.Remove(lang);
}
}
private void Instance_ReplaceLang(string oldLang, string newLang)
{
foreach (var food in Foods)
{
var item = food.I18nDatas[oldLang];
food.I18nDatas.Remove(oldLang);
food.I18nDatas.Add(newLang, item);
}
}
private void FilterFoodText_ValueChanged(string value)
@ -92,7 +53,7 @@ public class FoodPageVM
private void AddFood()
{
var window = CreateAddFoodWindow();
var window = new FoodEditWindow();
var vm = window.ViewModel;
window.ShowDialog();
if (window.IsCancel)
@ -102,7 +63,7 @@ public class FoodPageVM
public void EditFood(FoodModel food)
{
var window = CreateAddFoodWindow();
var window = new FoodEditWindow();
var vm = window.ViewModel;
var newFood = vm.Food.Value = new(food);
window.ShowDialog();
@ -134,11 +95,4 @@ public class FoodPageVM
Foods.Remove(food);
}
}
private FoodEditWindow CreateAddFoodWindow()
{
var window = new FoodEditWindow();
window.ViewModel.Foods = Foods;
return window;
}
}

View File

@ -12,8 +12,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.LowTextEdit;
public class LowTextEditWindowVM
{
public ObservableCollection<LowTextModel> LowTexts { get; set; }
#region Value
public ObservableValue<LowTextModel> LowText { get; } = new(new());

View File

@ -19,7 +19,8 @@ public class LowTextPageVM
#region Value
public ObservableValue<string> FilterLowText { get; } = new();
public ObservableValue<ObservableCollection<LowTextModel>> ShowLowTexts { get; } = new();
public ObservableCollection<LowTextModel> LowTexts { get; } = new();
public ObservableCollection<LowTextModel> LowTexts { get; } =
new(ModInfoModel.Current.LowTexts);
#endregion
#region Command
public ObservableCommand AddLowTextCommand { get; } = new();
@ -34,11 +35,6 @@ public class LowTextPageVM
AddLowTextCommand.ExecuteAction = AddLowText;
EditLowTextCommand.ExecuteAction = EditLowText;
RemoveLowTextCommand.ExecuteAction = RemoveLowText;
I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged;
I18nHelper.Current.AddLang += Instance_AddLang;
I18nHelper.Current.RemoveLang += Instance_RemoveLang;
I18nHelper.Current.ReplaceLang += Instance_ReplaceLang;
}
private void FilterLowText_ValueChanged(string value)
@ -57,7 +53,7 @@ public class LowTextPageVM
private void AddLowText()
{
var window = CreateLowTextEditWindow();
var window = new LowTextEditWindow();
var vm = window.ViewModel;
window.ShowDialog();
if (window.IsCancel)
@ -67,7 +63,7 @@ public class LowTextPageVM
public void EditLowText(LowTextModel lowText)
{
var window = CreateLowTextEditWindow();
var window = new LowTextEditWindow();
var vm = window.ViewModel;
var newLowTest = vm.LowText.Value = new(lowText);
window.ShowDialog();
@ -98,45 +94,4 @@ public class LowTextPageVM
LowTexts.Remove(lowText);
}
}
private void CurrentLang_ValueChanged(string value)
{
foreach (var lowText in LowTexts)
{
lowText.CurrentI18nData.Value = lowText.I18nDatas[value];
}
}
private void Instance_AddLang(string lang)
{
foreach (var lowText in LowTexts)
{
lowText.I18nDatas.Add(lang, new());
}
}
private void Instance_RemoveLang(string lang)
{
foreach (var lowText in LowTexts)
{
lowText.I18nDatas.Remove(lang);
}
}
private void Instance_ReplaceLang(string oldLang, string newLang)
{
foreach (var lowText in LowTexts)
{
var item = lowText.I18nDatas[oldLang];
lowText.I18nDatas.Remove(oldLang);
lowText.I18nDatas.Add(newLang, item);
}
}
private LowTextEditWindow CreateLowTextEditWindow()
{
var window = new LowTextEditWindow();
window.ViewModel.LowTexts = LowTexts;
return window;
}
}

View File

@ -20,8 +20,7 @@ public class ModEditWindowVM
public ModEditWindow ModEditWindow { get; }
#region Value
public ObservableValue<BitmapImage> ModImage { get; } = new();
public ObservableValue<ModInfoModel> ModInfo { get; } = new(new());
public ObservableValue<ModInfoModel> ModInfo { get; } = new(ModInfoModel.Current);
public ObservableValue<string> CurrentLang { get; } = new();
public I18nHelper I18nData => I18nHelper.Current;
#endregion
@ -33,16 +32,48 @@ public class ModEditWindowVM
public ObservableCommand<string> EditLangCommand { get; } = new();
public ObservableCommand<string> RemoveLangCommand { get; } = new();
public ObservableCommand SaveCommand { get; } = new();
public ObservableCommand SaveToCommand { get; } = new();
#endregion
public ModEditWindowVM() { }
public ModEditWindowVM(ModEditWindow window)
{
#if DEBUG
I18nHelper.Current.CultureNames.Add("zh-CN");
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
#endif
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 i18n in ModInfo.Value.OtherI18nDatas)
{
foreach (var food in ModInfo.Value.Foods)
{
var foodI18n = food.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(food.Name, out var i18nName))
foodI18n.Name.Value = i18nName;
if (i18n.Value.TryGetValue(food.Description, out var i18nDescription))
foodI18n.Description.Value = i18nDescription;
}
foreach (var lowText in ModInfo.Value.LowTexts)
{
var lowTextI18n = lowText.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(lowText.Text, out var text))
lowTextI18n.Text.Value = text;
}
foreach (var clickText in ModInfo.Value.ClickTexts)
{
var clickTextI18n = clickText.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(clickText.Text, out var text))
clickTextI18n.Text.Value = text;
}
}
}
ModEditWindow = window;
I18nHelper.Current.AddLang += I18nData_AddLang;
@ -50,11 +81,13 @@ public class ModEditWindowVM
I18nHelper.Current.ReplaceLang += I18nData_ReplaceLang;
CurrentLang.ValueChanged += CurrentLang_ValueChanged;
AddImageCommand.ExecuteAction = AddImage;
ChangeImageCommand.ExecuteAction = ChangeImage;
AddLangCommand.ExecuteAction = AddLang;
EditLangCommand.ExecuteAction = EditLang;
RemoveLangCommand.ExecuteAction = RemoveLang;
AddImageCommand.ExecuteAction += AddImage;
ChangeImageCommand.ExecuteAction += ChangeImage;
AddLangCommand.ExecuteAction += AddLang;
EditLangCommand.ExecuteAction += EditLang;
RemoveLangCommand.ExecuteAction += RemoveLang;
SaveCommand.ExecuteAction += Save;
SaveToCommand.ExecuteAction += SaveTo;
}
private void I18nData_AddLang(string lang)
@ -135,4 +168,14 @@ public class ModEditWindowVM
return;
I18nHelper.Current.CultureNames.Remove(oldLang);
}
private void Save()
{
return;
}
private void SaveTo()
{
return;
}
}

View File

@ -1,6 +1,8 @@
using HKW.HKWViewModels.SimpleObservable;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,26 +12,56 @@ using VPet.Plugin.ModMaker.Views.ModEdit;
namespace VPet.Plugin.ModMaker.ViewModels;
public class WindowVM_ModMaker
public class ModMakerWindowVM
{
public ModMakerWindow ModMakerWindow { get; }
public ModEditWindow ModEditWindow { get; private set; }
public ObservableCommand CreateNewModCommand { get; set; } =
new() { ExecuteAction = () => { } };
public ObservableCommand CreateNewModCommand { get; set; } = new();
public WindowVM_ModMaker() { }
public ObservableValue<string> ModFilterText { get; } = new();
public WindowVM_ModMaker(ModMakerWindow window)
public ObservableCollection<ModInfoModel> ShowMods { get; set; }
public ObservableCollection<ModInfoModel> Mods { get; } = new();
public ModMakerWindowVM() { }
public ModMakerWindowVM(ModMakerWindow window)
{
LoadMods();
ModMakerWindow = window;
ShowMods = Mods;
CreateNewModCommand.ExecuteAction = CreateNewMod;
ModFilterText.ValueChanged += ModFilterText_ValueChanged;
}
private void CreateNewMod()
private void LoadMods()
{
I18nHelper.Current = new();
var dic = Directory.CreateDirectory(ModMakerInfo.BaseDirectory);
foreach (var modDic in dic.EnumerateDirectories())
{
var mod = new ModLoader(modDic);
if (mod.SuccessLoad is false)
continue;
var modModel = new ModInfoModel(mod);
Mods.Add(modModel);
if (mod.OtherI18nDatas.Count == 0)
continue;
}
}
private void ModFilterText_ValueChanged(string value)
{
if (string.IsNullOrEmpty(value))
ShowMods = Mods;
else
ShowMods = new(Mods.Where(i => i.Id.Value.Contains(value)));
}
public void CreateNewMod()
{
// I18nHelper.Current = new();
ModEditWindow = new();
ModEditWindow.Show();
ModMakerWindow.Hide();

View File

@ -11,6 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VPet.Plugin.ModMaker.Models;
using VPet.Plugin.ModMaker.ViewModels.ModEdit.ClickTextEdit;
namespace VPet.Plugin.ModMaker.Views.ModEdit.ClickTextEdit;
@ -41,7 +42,11 @@ public partial class ClickTextEditWindow : Window
MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (ViewModel.ClickTexts.Any(i => i.Id.Value == ViewModel.ClickText.Value.Id.Value))
if (
ModInfoModel.Current.ClickTexts.Any(
i => i.Id.Value == ViewModel.ClickText.Value.Id.Value
)
)
{
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;

View File

@ -12,6 +12,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VPet.Plugin.ModMaker.Models;
using VPet.Plugin.ModMaker.ViewModels.ModEdit.FoodEdit;
using VPet_Simulator.Windows.Interface;
@ -60,7 +61,7 @@ public partial class FoodEditWindow : Window
MessageBox.Show("图像不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (ViewModel.Foods.Any(i => i.Id.Value == ViewModel.Food.Value.Id.Value))
if (ModInfoModel.Current.Foods.Any(i => i.Id.Value == ViewModel.Food.Value.Id.Value))
{
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;

View File

@ -42,7 +42,7 @@
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="Horizontal"
ItemsSource="{Binding Foods}"
ItemsSource="{Binding ShowFoods.Value}"
MouseDoubleClick="DataGrid_Food_MouseDoubleClick"
RowDetailsVisibilityMode="Visible"
RowHeight="64"
@ -76,7 +76,7 @@
Height="64"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{Binding Image.Value, IsAsync=True}"
Source="{Binding Image.Value}"
Stretch="Uniform">
<Image.ToolTip>
<Image
@ -84,7 +84,7 @@
Height="256"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{Binding Image.Value, IsAsync=True}"
Source="{Binding Image.Value}"
Stretch="Uniform" />
</Image.ToolTip>
</Image>
@ -104,7 +104,7 @@
Binding="{Binding Type.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="Type">
SortMemberPath="Type.Value">
<DataGridTextColumn.Header>
<Label Content="食物类型" />
</DataGridTextColumn.Header>

View File

@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VPet.Plugin.ModMaker.Models;
using VPet.Plugin.ModMaker.ViewModels.ModEdit.LowTextEdit;
namespace VPet.Plugin.ModMaker.Views.ModEdit.LowTextEdit;
@ -42,7 +43,7 @@ public partial class LowTextEditWindow : Window
MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (ViewModel.LowTexts.Any(i => i.Id.Value == ViewModel.LowText.Value.Id.Value))
if (ModInfoModel.Current.LowTexts.Any(i => i.Id.Value == ViewModel.LowText.Value.Id.Value))
{
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;

View File

@ -48,7 +48,7 @@
</Style.Triggers>
</Style>
</Grid.Style>
<Grid>
<Grid MaxWidth="256">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
@ -130,8 +130,12 @@
x:Name="TextBox_Description"
Grid.Row="4"
Grid.Column="1"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Top"
d:Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
pu:TextBoxHelper.Watermark="模组介绍"
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}" />
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}"
TextWrapping="Wrap" />
</Grid>
</ScrollViewer>
</Grid>
@ -216,6 +220,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button
x:Name="Button_AddLang"
@ -235,6 +240,10 @@
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<StackPanel Grid.Row="2">
<Button x:Name="Button_Save" Content="保存" />
<Button x:Name="Button_SaveTo" Content="保存至" />
</StackPanel>
</Grid>
</Grid>
</Window>

View File

@ -29,7 +29,7 @@ namespace VPet.Plugin.ModMaker.Views.ModEdit;
/// </summary>
public partial class ModEditWindow : Window
{
public ModEditWindowVM ViewModel => (ModEditWindowVM)this.DataContext;
public ModEditWindowVM ViewModel => (ModEditWindowVM)DataContext;
public FoodPage FoodPage { get; } = new();
public LowTextPage LowTextPage { get; } = new();
public ClickTextPage ClickTextPage { get; } = new();
@ -37,11 +37,16 @@ public partial class ModEditWindow : Window
public ModEditWindow()
{
InitializeComponent();
DataContext = new ModEditWindowVM(this);
Closed += Window_ModEdit_Closed;
DataContext = new ModEditWindowVM(this);
FoodPage.ViewModel.Foods.CollectionChanged += Foods_CollectionChanged;
LowTextPage.ViewModel.LowTexts.CollectionChanged += LowTexts_CollectionChanged;
ClickTextPage.ViewModel.ClickTexts.CollectionChanged += ClickTexts_CollectionChanged;
TabItem_ClickText.Header =
$"{TabItem_ClickText.Tag} ({ClickTextPage.ViewModel.ClickTexts.Count})";
TabItem_LowText.Header = $"{TabItem_LowText.Tag} ({LowTextPage.ViewModel.LowTexts.Count})";
TabItem_Food.Header = $"{TabItem_Food.Tag} ({FoodPage.ViewModel.Foods.Count})";
}
private void ClickTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)

View File

@ -221,29 +221,112 @@
</Label.Style>
</Label>
</Grid>
<!--<Grid Grid.Row="1" >
<TextBox/>
</Grid>-->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="宠物Id:" />
<TextBox
Grid.Column="1"
pu:TextBoxHelper.Watermark="宠物Id"
Text="{Binding Pet.Value.Id.Value}" />
<Label Grid.Row="1" Content="宠物名称:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
pu:TextBoxHelper.Watermark="宠物名称"
Text="{Binding Pet.Value.CurrentI18nData.Value.Name.Value}" />
<Label Grid.Row="2" Content="宠物描述:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
pu:TextBoxHelper.Watermark="宠物描述"
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value}" />
</Grid>
</Grid>
<Grid Grid.Column="1">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<ToggleButton
x:Name="ToggleButton_TouchHead"
Padding="5"
HorizontalContentAlignment="Stretch"
DataContext="{Binding Pet.Value.TouchHeadRect.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton
x:Name="ToggleButton_TouchHead"
Padding="5"
HorizontalContentAlignment="Stretch"
Content="TouchHead:" />
<Grid Grid.Column="1" Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchHeadRect.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchHeadRect.Value.Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchHeadRect.Value.Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchHeadRect.Value.Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
<Expander Header="TouchRaisedRect">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="TouchHead:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ToggleButton
x:Name="ToggleButton_TouchRaisedRect_HappyState"
Padding="5"
HorizontalContentAlignment="Stretch"
d:IsChecked="True"
Content="HappyState:" />
<Grid Grid.Column="1" Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@ -258,7 +341,7 @@
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
@ -266,7 +349,7 @@
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
@ -275,7 +358,7 @@
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Width.Value, Mode=TwoWay}" />
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
@ -285,433 +368,317 @@
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Height.Value, Mode=TwoWay}" />
Value="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value.X.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
<Expander Header="TouchRaisedRect">
<StackPanel>
<ToggleButton
x:Name="ToggleButton_TouchRaisedRect_HappyState"
Padding="5"
HorizontalContentAlignment="Stretch"
d:IsChecked="True"
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Happy.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="HappyState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
<ToggleButton
x:Name="ToggleButton_TouchRaisedRect_NomalState"
Grid.Row="1"
Padding="5"
HorizontalContentAlignment="Stretch"
d:IsChecked="True"
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="NomalState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
Content="NomalState:" />
<Grid
Grid.Row="1"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value.Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value.Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Nomal.Value.Height.Value, Mode=TwoWay}" />
</Grid>
<ToggleButton
x:Name="ToggleButton_TouchRaisedRect_PoorConditionState"
Grid.Row="2"
Padding="5"
HorizontalContentAlignment="Stretch"
d:IsChecked="True"
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="PoorConditionState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
Content="PoorConditionState:" />
<Grid
Grid.Row="2"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value.Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value.Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.PoorCondition.Value.Height.Value, Mode=TwoWay}" />
</Grid>
<ToggleButton
x:Name="ToggleButton_TouchRaisedRect_IllState"
Grid.Row="3"
Padding="5"
HorizontalContentAlignment="Stretch"
d:IsChecked="True"
DataContext="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="IllState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
</StackPanel>
Content="IllState:" />
<Grid
Grid.Row="3"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value.Y.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Background="{x:Null}"
Content="w:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value.Width.Value, Mode=TwoWay}" />
<Label
Grid.Row="1"
Grid.Column="2"
Background="{x:Null}"
Content="h:" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.TouchRaisedRect.Value.Ill.Value.Height.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</Expander>
<Expander Header="RaisePoint">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ToggleButton
x:Name="ToggleButton_RaisePoint_Happy"
Padding="5"
HorizontalContentAlignment="Stretch"
DataContext="{Binding Pet.Value.RaisePoint.Value.Happy.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="HappyState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
Content="HappyState:" />
<Grid Grid.Column="1" Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Happy.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Happy.Value.Y.Value, Mode=TwoWay}" />
</Grid>
<ToggleButton
x:Name="ToggleButton_RaisePoint_Nomal"
Grid.Row="1"
Padding="5"
HorizontalContentAlignment="Stretch"
DataContext="{Binding Pet.Value.RaisePoint.Value.Nomal.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="NomalState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
Content="NomalState:" />
<Grid
Grid.Row="1"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Nomal.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Nomal.Value.Y.Value, Mode=TwoWay}" />
</Grid>
<ToggleButton
x:Name="ToggleButton_RaisePoint_PoorCondition"
Grid.Row="2"
Padding="5"
HorizontalContentAlignment="Stretch"
DataContext="{Binding Pet.Value.RaisePoint.Value.PoorCondition.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="PoorConditionState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
Content="PoorConditionState:" />
<Grid
Grid.Row="2"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.PoorCondition.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.PoorCondition.Value.Y.Value, Mode=TwoWay}" />
</Grid>
<ToggleButton
x:Name="ToggleButton_RaisePoint_Ill"
Grid.Row="3"
Padding="5"
HorizontalContentAlignment="Stretch"
DataContext="{Binding Pet.Value.RaisePoint.Value.Ill.Value}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
Content="IllState:" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Y.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</ToggleButton>
</StackPanel>
Content="IllState:" />
<Grid
Grid.Row="3"
Grid.Column="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Background="{x:Null}" Content="x:" />
<pu:NumberInput
Grid.Column="1"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Ill.Value.X.Value, Mode=TwoWay}" />
<Label
Grid.Column="2"
Background="{x:Null}"
Content="y:" />
<pu:NumberInput
Grid.Column="3"
d:Value="100"
Value="{Binding Pet.Value.RaisePoint.Value.Ill.Value.Y.Value, Mode=TwoWay}" />
</Grid>
</Grid>
</Expander>
</StackPanel>
</ScrollViewer>

View File

@ -14,7 +14,7 @@
FontSize="16"
mc:Ignorable="d">
<d:Window.DataContext>
<vm:WindowVM_ModMaker />
<vm:ModMakerWindowVM />
</d:Window.DataContext>
<Grid>
<Grid.ColumnDefinitions>
@ -32,7 +32,36 @@
<ListBox
Grid.Row="2"
d:ItemsSource="{d:SampleData ItemCount=5}"
Style="{StaticResource SideMenuListBoxStyle}" />
ItemsSource="{Binding Mods}"
Style="{StaticResource SideMenuListBoxStyle}">
<ListBox.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="ListBoxItem">
<Setter Property="Height" Value="64" />
<EventSetter Event="MouseDoubleClick" Handler="ListBoxItem_MouseDoubleClick" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid ToolTip="{Binding Summary.Value}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Width="64" Source="{Binding ModImage.Value}" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock d:Text="Mod名称" Text="{Binding Id.Value}" />
<TextBlock Grid.Row="1" d:Text="Mod描述" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>

View File

@ -1,4 +1,5 @@
using System;
using LinePutScript;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
@ -24,14 +25,21 @@ namespace VPet.Plugin.ModMaker.Views;
/// </summary>
public partial class ModMakerWindow : Window
{
public WindowVM_ModMaker ViewModel => (WindowVM_ModMaker)DataContext;
public Models.ModMaker ModMaker { get; set; }
public ModMakerWindowVM ViewModel => (ModMakerWindowVM)DataContext;
public ModEditWindow ModEditWindow { get; set; }
public Models.ModMaker ModMaker { get; internal set; }
public ModMakerWindow()
{
InitializeComponent();
DataContext = new WindowVM_ModMaker(this);
new PetEditWindow().Show();
DataContext = new ModMakerWindowVM(this);
}
private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender is not ListBoxItem item)
return;
ModInfoModel.Current = (ModInfoModel)item.DataContext;
ViewModel.CreateNewMod();
}
}

View File

@ -3,7 +3,7 @@
<package id="LinePutScript" version="1.9.2" targetFramework="net462" />
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.15.6" targetFramework="net462" />
<package id="VPet-Simulator.Core" version="1.0.0" targetFramework="net462" />
<package id="VPet-Simulator.Windows.Interface" version="1.0.0" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.15.7" targetFramework="net462" />
<package id="VPet-Simulator.Core" version="1.0.2" targetFramework="net462" />
<package id="VPet-Simulator.Windows.Interface" version="1.0.2" targetFramework="net462" />
</packages>