mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
Merge branch 'main' of https://github.com/LorisYounger/VPet.ModMaker
This commit is contained in:
commit
5549f6b3af
@ -80,6 +80,8 @@ public static class Extensions
|
|||||||
/// <param name="path">路径</param>
|
/// <param name="path">路径</param>
|
||||||
public static void SaveToPng(this BitmapSource image, string path)
|
public static void SaveToPng(this BitmapSource image, string path)
|
||||||
{
|
{
|
||||||
|
if (image is null)
|
||||||
|
return;
|
||||||
if (path.EndsWith(".png") is false)
|
if (path.EndsWith(".png") is false)
|
||||||
path += ".png";
|
path += ".png";
|
||||||
var encoder = new PngBitmapEncoder();
|
var encoder = new PngBitmapEncoder();
|
||||||
|
@ -47,6 +47,15 @@ public class ModMaker : MainPlugin
|
|||||||
{
|
{
|
||||||
// 载入ModMaker资源
|
// 载入ModMaker资源
|
||||||
Maker = new ModMakerWindow();
|
Maker = new ModMakerWindow();
|
||||||
|
// 设置游戏版本
|
||||||
|
ModMakerInfo.GameVersion = MW.version;
|
||||||
|
// 载入本体宠物
|
||||||
|
foreach (var pet in MW.Pets)
|
||||||
|
{
|
||||||
|
var petModel = new PetModel();
|
||||||
|
petModel.Id.Value = pet.Name;
|
||||||
|
ModMakerInfo.Pets.Add(petModel);
|
||||||
|
}
|
||||||
//Maker.ModMaker = this;
|
//Maker.ModMaker = this;
|
||||||
Maker.Show();
|
Maker.Show();
|
||||||
Maker.Closed += Maker_Closed;
|
Maker.Closed += Maker_Closed;
|
||||||
|
@ -3,6 +3,7 @@ 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 VPet.ModMaker.Models.ModModel;
|
||||||
|
|
||||||
namespace VPet.ModMaker.Models;
|
namespace VPet.ModMaker.Models;
|
||||||
|
|
||||||
@ -25,4 +26,11 @@ public static class ModMakerInfo
|
|||||||
/// 信息文件
|
/// 信息文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string InfoFile = "info.lps";
|
public const string InfoFile = "info.lps";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏版本
|
||||||
|
/// </summary>
|
||||||
|
public static int GameVersion { get; set; } = 100;
|
||||||
|
|
||||||
|
public static List<PetModel> Pets { get; } = new();
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,10 @@ public class FoodModel : I18nModel<I18nFoodModel>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableValue<BitmapImage> Image { get; } = new();
|
public ObservableValue<BitmapImage> Image { get; } = new();
|
||||||
|
|
||||||
|
public ObservableValue<double> ReferencePrice { get; } = new();
|
||||||
|
|
||||||
|
private readonly Food _food = new();
|
||||||
|
|
||||||
public FoodModel()
|
public FoodModel()
|
||||||
{
|
{
|
||||||
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
|
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
|
||||||
@ -94,6 +98,19 @@ public class FoodModel : I18nModel<I18nFoodModel>
|
|||||||
{
|
{
|
||||||
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
|
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
|
||||||
};
|
};
|
||||||
|
ReferencePrice.AddNotifyReceiver(
|
||||||
|
Strength,
|
||||||
|
StrengthFood,
|
||||||
|
StrengthDrink,
|
||||||
|
Feeling,
|
||||||
|
Health,
|
||||||
|
Likability,
|
||||||
|
Exp
|
||||||
|
);
|
||||||
|
ReferencePrice.NotifyReceived += (ref double v) =>
|
||||||
|
{
|
||||||
|
v = Math.Floor(SetValueToFood(_food).RealPrice);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public FoodModel(FoodModel model)
|
public FoodModel(FoodModel model)
|
||||||
@ -155,6 +172,18 @@ public class FoodModel : I18nModel<I18nFoodModel>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Food SetValueToFood(Food food)
|
||||||
|
{
|
||||||
|
food.Strength = Strength.Value;
|
||||||
|
food.StrengthFood = StrengthFood.Value;
|
||||||
|
food.StrengthDrink = StrengthDrink.Value;
|
||||||
|
food.Feeling = Feeling.Value;
|
||||||
|
food.Health = Health.Value;
|
||||||
|
food.Likability = Likability.Value;
|
||||||
|
food.Exp = Exp.Value;
|
||||||
|
return food;
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
Image.Value?.StreamSource?.Close();
|
Image.Value?.StreamSource?.Close();
|
||||||
|
@ -56,12 +56,12 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 支持的游戏版本
|
/// 支持的游戏版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableValue<string> GameVersion { get; } = new();
|
public ObservableValue<int> GameVersion { get; } = new(ModMakerInfo.GameVersion);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模组版本
|
/// 模组版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableValue<string> ModVersion { get; } = new();
|
public ObservableValue<int> ModVersion { get; } = new(100);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 封面
|
/// 封面
|
||||||
@ -96,7 +96,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 宠物
|
/// 宠物
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableCollection<PetModel> Pets { get; } = new();
|
public ObservableCollection<PetModel> Pets { get; } = new(ModMakerInfo.Pets);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 其它I18n数据
|
/// 其它I18n数据
|
||||||
@ -106,8 +106,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 需要保存的I18n数据
|
/// 需要保存的I18n数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public static Dictionary<string, Dictionary<string, string>> SaveI18nDatas { get; } = new();
|
||||||
private readonly Dictionary<string, Dictionary<string, string>> _saveI18nDatas = new();
|
|
||||||
|
|
||||||
public ModInfoModel()
|
public ModInfoModel()
|
||||||
{
|
{
|
||||||
@ -125,8 +124,8 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
Id.Value = loader.Name;
|
Id.Value = loader.Name;
|
||||||
DescriptionId.Value = loader.Intro;
|
DescriptionId.Value = loader.Intro;
|
||||||
Author.Value = loader.Author;
|
Author.Value = loader.Author;
|
||||||
GameVersion.Value = loader.GameVer.ToString();
|
GameVersion.Value = loader.GameVer;
|
||||||
ModVersion.Value = loader.Ver.ToString();
|
ModVersion.Value = loader.Ver;
|
||||||
ItemID = loader.ItemID;
|
ItemID = loader.ItemID;
|
||||||
AuthorID = loader.AuthorID;
|
AuthorID = loader.AuthorID;
|
||||||
var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png");
|
var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png");
|
||||||
@ -144,7 +143,6 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
{
|
{
|
||||||
var petModel = new PetModel(pet);
|
var petModel = new PetModel(pet);
|
||||||
Pets.Add(petModel);
|
Pets.Add(petModel);
|
||||||
// TODO: 动画加载
|
|
||||||
foreach (var p in pet.path)
|
foreach (var p in pet.path)
|
||||||
{
|
{
|
||||||
LoadAnime(petModel, p);
|
LoadAnime(petModel, p);
|
||||||
@ -246,57 +244,56 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadI18nData()
|
private void LoadI18nData()
|
||||||
{
|
{
|
||||||
foreach (var lang in I18nDatas)
|
foreach (var lang in I18nDatas.Keys.Union(OtherI18nDatas.Keys))
|
||||||
{
|
{
|
||||||
if (I18nHelper.Current.CultureNames.Contains(lang.Key) is false)
|
if (I18nHelper.Current.CultureNames.Contains(lang) is false)
|
||||||
I18nHelper.Current.CultureNames.Add(lang.Key);
|
I18nHelper.Current.CultureNames.Add(lang);
|
||||||
}
|
}
|
||||||
if (I18nHelper.Current.CultureNames.Count > 0)
|
if (I18nHelper.Current.CultureNames.Count == 0)
|
||||||
|
return;
|
||||||
|
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
|
||||||
|
foreach (var i18nData in OtherI18nDatas)
|
||||||
{
|
{
|
||||||
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
|
foreach (var food in Foods)
|
||||||
foreach (var i18nData in OtherI18nDatas)
|
|
||||||
{
|
{
|
||||||
foreach (var food in Foods)
|
var foodI18n = food.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(food.Id.Value, out var name))
|
||||||
|
foodI18n.Name.Value = name;
|
||||||
|
if (i18nData.Value.TryGetValue(food.DescriptionId.Value, out var description))
|
||||||
|
foodI18n.Description.Value = description;
|
||||||
|
}
|
||||||
|
foreach (var lowText in LowTexts)
|
||||||
|
{
|
||||||
|
var lowTextI18n = lowText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(lowText.Id.Value, out var text))
|
||||||
|
lowTextI18n.Text.Value = text;
|
||||||
|
}
|
||||||
|
foreach (var clickText in ClickTexts)
|
||||||
|
{
|
||||||
|
var clickTextI18n = clickText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(clickText.Id.Value, out var text))
|
||||||
|
clickTextI18n.Text.Value = text;
|
||||||
|
}
|
||||||
|
foreach (var selectText in SelectTexts)
|
||||||
|
{
|
||||||
|
var selectTextI18n = selectText.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(selectText.Id.Value, out var text))
|
||||||
|
selectTextI18n.Text.Value = text;
|
||||||
|
if (i18nData.Value.TryGetValue(selectText.ChooseId.Value, out var choose))
|
||||||
|
selectTextI18n.Choose.Value = choose;
|
||||||
|
}
|
||||||
|
foreach (var pet in Pets)
|
||||||
|
{
|
||||||
|
var petI18n = pet.I18nDatas[i18nData.Key];
|
||||||
|
if (i18nData.Value.TryGetValue(pet.Id.Value, out var name))
|
||||||
|
petI18n.Name.Value = name;
|
||||||
|
if (i18nData.Value.TryGetValue(pet.DescriptionId.Value, out var description))
|
||||||
|
petI18n.Description.Value = description;
|
||||||
|
foreach (var work in pet.Works)
|
||||||
{
|
{
|
||||||
var foodI18n = food.I18nDatas[i18nData.Key];
|
var workI18n = work.I18nDatas[i18nData.Key];
|
||||||
if (i18nData.Value.TryGetValue(food.Id.Value, out var name))
|
if (i18nData.Value.TryGetValue(work.Id.Value, out var workName))
|
||||||
foodI18n.Name.Value = name;
|
workI18n.Name.Value = workName;
|
||||||
if (i18nData.Value.TryGetValue(food.DescriptionId.Value, out var description))
|
|
||||||
foodI18n.Description.Value = description;
|
|
||||||
}
|
|
||||||
foreach (var lowText in LowTexts)
|
|
||||||
{
|
|
||||||
var lowTextI18n = lowText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(lowText.Id.Value, out var text))
|
|
||||||
lowTextI18n.Text.Value = text;
|
|
||||||
}
|
|
||||||
foreach (var clickText in ClickTexts)
|
|
||||||
{
|
|
||||||
var clickTextI18n = clickText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(clickText.Id.Value, out var text))
|
|
||||||
clickTextI18n.Text.Value = text;
|
|
||||||
}
|
|
||||||
foreach (var selectText in SelectTexts)
|
|
||||||
{
|
|
||||||
var selectTextI18n = selectText.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(selectText.Id.Value, out var text))
|
|
||||||
selectTextI18n.Text.Value = text;
|
|
||||||
if (i18nData.Value.TryGetValue(selectText.ChooseId.Value, out var choose))
|
|
||||||
selectTextI18n.Choose.Value = choose;
|
|
||||||
}
|
|
||||||
foreach (var pet in Pets)
|
|
||||||
{
|
|
||||||
var petI18n = pet.I18nDatas[i18nData.Key];
|
|
||||||
if (i18nData.Value.TryGetValue(pet.Id.Value, out var name))
|
|
||||||
petI18n.Name.Value = name;
|
|
||||||
if (i18nData.Value.TryGetValue(pet.DescriptionId.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.Id.Value, out var workName))
|
|
||||||
workI18n.Name.Value = workName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,6 +314,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
/// <param name="path">路径</param>
|
/// <param name="path">路径</param>
|
||||||
public void SaveTo(string path)
|
public void SaveTo(string path)
|
||||||
{
|
{
|
||||||
|
SaveI18nDatas.Clear();
|
||||||
// 保存模型信息
|
// 保存模型信息
|
||||||
SaveModInfo(path);
|
SaveModInfo(path);
|
||||||
// 保存模组数据
|
// 保存模组数据
|
||||||
@ -325,6 +323,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
SaveText(path);
|
SaveText(path);
|
||||||
SaveI18nData(path);
|
SaveI18nData(path);
|
||||||
SaveImage(path);
|
SaveImage(path);
|
||||||
|
SaveI18nDatas.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -337,9 +336,9 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
if (File.Exists(modInfoFile) is false)
|
if (File.Exists(modInfoFile) is false)
|
||||||
File.Create(modInfoFile).Close();
|
File.Create(modInfoFile).Close();
|
||||||
|
|
||||||
_saveI18nDatas.Clear();
|
SaveI18nDatas.Clear();
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
_saveI18nDatas.Add(cultureName, new());
|
SaveI18nDatas.Add(cultureName, new());
|
||||||
|
|
||||||
var lps = new LPS()
|
var lps = new LPS()
|
||||||
{
|
{
|
||||||
@ -368,11 +367,6 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
File.WriteAllText(modInfoFile, lps.ToString());
|
File.WriteAllText(modInfoFile, lps.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SavePet
|
|
||||||
/// <summary>
|
|
||||||
/// 保存宠物
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">路径</param>
|
|
||||||
private void SavePets(string path)
|
private void SavePets(string path)
|
||||||
{
|
{
|
||||||
var petPath = Path.Combine(path, "pet");
|
var petPath = Path.Combine(path, "pet");
|
||||||
@ -385,137 +379,13 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
Directory.CreateDirectory(petPath);
|
Directory.CreateDirectory(petPath);
|
||||||
foreach (var pet in Pets)
|
foreach (var pet in Pets)
|
||||||
{
|
{
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
pet.Save(petPath);
|
||||||
{
|
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
|
||||||
pet.Id.Value,
|
|
||||||
pet.I18nDatas[cultureName].Name.Value
|
|
||||||
);
|
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
|
||||||
pet.DescriptionId.Value,
|
|
||||||
pet.I18nDatas[cultureName].Description.Value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
var petFile = Path.Combine(petPath, $"{pet.Id.Value}.lps");
|
|
||||||
if (File.Exists(petFile) is false)
|
|
||||||
File.Create(petFile).Close();
|
|
||||||
var lps = new LPS();
|
|
||||||
SavePetInfo(lps, pet);
|
|
||||||
SaveWorksInfo(lps, pet);
|
|
||||||
SaveMoveInfo(lps, pet);
|
|
||||||
File.WriteAllText(petFile, lps.ToString());
|
|
||||||
|
|
||||||
var petAnimePath = Path.Combine(petPath, pet.Id.Value);
|
|
||||||
foreach (var animeType in pet.Animes)
|
|
||||||
animeType.Save(petAnimePath);
|
|
||||||
}
|
}
|
||||||
|
// 如果没有一个完成保存, 则删除文件夹
|
||||||
|
if (Directory.EnumerateFiles(petPath).Any() is false)
|
||||||
|
Directory.Delete(petPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存移动信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lps"></param>
|
|
||||||
/// <param name="pet"></param>
|
|
||||||
void SaveMoveInfo(LPS lps, PetModel pet)
|
|
||||||
{
|
|
||||||
foreach (var move in pet.Moves)
|
|
||||||
{
|
|
||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(move.ToMove(), "move"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存工作信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lps"></param>
|
|
||||||
/// <param name="pet"></param>
|
|
||||||
void SaveWorksInfo(LPS lps, PetModel pet)
|
|
||||||
{
|
|
||||||
foreach (var work in pet.Works)
|
|
||||||
{
|
|
||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(work.ToWork(), "work"));
|
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
|
||||||
{
|
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
|
||||||
work.Id.Value,
|
|
||||||
work.I18nDatas[cultureName].Name.Value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存宠物信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lps"></param>
|
|
||||||
/// <param name="pet"></param>
|
|
||||||
private void SavePetInfo(LPS lps, PetModel pet)
|
|
||||||
{
|
|
||||||
lps.Add(
|
|
||||||
new Line("pet", pet.Id.Value)
|
|
||||||
{
|
|
||||||
new Sub("intor", pet.DescriptionId.Value),
|
|
||||||
new Sub("path", pet.Id.Value),
|
|
||||||
new Sub("petname", pet.Id.Value)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
lps.Add(
|
|
||||||
new Line("touchhead")
|
|
||||||
{
|
|
||||||
new Sub("px", pet.TouchHeadRect.Value.X.Value),
|
|
||||||
new Sub("py", pet.TouchHeadRect.Value.Y.Value),
|
|
||||||
new Sub("sw", pet.TouchHeadRect.Value.Width.Value),
|
|
||||||
new Sub("sh", pet.TouchHeadRect.Value.Height.Value),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
lps.Add(
|
|
||||||
new Line("touchraised")
|
|
||||||
{
|
|
||||||
new Sub("happy_px", pet.TouchRaisedRect.Value.Happy.Value.X.Value),
|
|
||||||
new Sub("happy_py", pet.TouchRaisedRect.Value.Happy.Value.Y.Value),
|
|
||||||
new Sub("happy_sw", pet.TouchRaisedRect.Value.Happy.Value.Width.Value),
|
|
||||||
new Sub("happy_sh", pet.TouchRaisedRect.Value.Happy.Value.Height.Value),
|
|
||||||
//
|
|
||||||
new Sub("nomal_px", pet.TouchRaisedRect.Value.Nomal.Value.X.Value),
|
|
||||||
new Sub("nomal_py", pet.TouchRaisedRect.Value.Nomal.Value.Y.Value),
|
|
||||||
new Sub("nomal_sw", pet.TouchRaisedRect.Value.Nomal.Value.Width.Value),
|
|
||||||
new Sub("nomal_sh", pet.TouchRaisedRect.Value.Nomal.Value.Height.Value),
|
|
||||||
//
|
|
||||||
new Sub("poorcondition_px", pet.TouchRaisedRect.Value.PoorCondition.Value.X.Value),
|
|
||||||
new Sub("poorcondition_py", pet.TouchRaisedRect.Value.PoorCondition.Value.Y.Value),
|
|
||||||
new Sub(
|
|
||||||
"poorcondition_sw",
|
|
||||||
pet.TouchRaisedRect.Value.PoorCondition.Value.Width.Value
|
|
||||||
),
|
|
||||||
new Sub(
|
|
||||||
"poorcondition_sh",
|
|
||||||
pet.TouchRaisedRect.Value.PoorCondition.Value.Height.Value
|
|
||||||
),
|
|
||||||
//
|
|
||||||
new Sub("ill_px", pet.TouchRaisedRect.Value.Ill.Value.X.Value),
|
|
||||||
new Sub("ill_py", pet.TouchRaisedRect.Value.Ill.Value.Y.Value),
|
|
||||||
new Sub("ill_sw", pet.TouchRaisedRect.Value.Ill.Value.Width.Value),
|
|
||||||
new Sub("ill_sh", pet.TouchRaisedRect.Value.Ill.Value.Height.Value),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
lps.Add(
|
|
||||||
new Line("raisepoint")
|
|
||||||
{
|
|
||||||
new Sub("happy_x", pet.RaisePoint.Value.Happy.Value.X.Value),
|
|
||||||
new Sub("happy_y", pet.RaisePoint.Value.Happy.Value.Y.Value),
|
|
||||||
//
|
|
||||||
new Sub("nomal_x", pet.RaisePoint.Value.Nomal.Value.X.Value),
|
|
||||||
new Sub("nomal_y", pet.RaisePoint.Value.Nomal.Value.Y.Value),
|
|
||||||
//
|
|
||||||
new Sub("poorcondition_x", pet.RaisePoint.Value.PoorCondition.Value.X.Value),
|
|
||||||
new Sub("poorcondition_y", pet.RaisePoint.Value.PoorCondition.Value.Y.Value),
|
|
||||||
//
|
|
||||||
new Sub("ill_x", pet.RaisePoint.Value.Ill.Value.X.Value),
|
|
||||||
new Sub("ill_y", pet.RaisePoint.Value.Ill.Value.Y.Value),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存食物
|
/// 保存食物
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -539,11 +409,11 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(food.ToFood(), "food"));
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(food.ToFood(), "food"));
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
{
|
{
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
food.Id.Value,
|
food.Id.Value,
|
||||||
food.I18nDatas[cultureName].Name.Value
|
food.I18nDatas[cultureName].Name.Value
|
||||||
);
|
);
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
food.DescriptionId.Value,
|
food.DescriptionId.Value,
|
||||||
food.I18nDatas[cultureName].Description.Value
|
food.I18nDatas[cultureName].Description.Value
|
||||||
);
|
);
|
||||||
@ -588,11 +458,11 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToSelectText(), "SelectText"));
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToSelectText(), "SelectText"));
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
{
|
{
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
text.Id.Value,
|
text.Id.Value,
|
||||||
text.I18nDatas[cultureName].Text.Value
|
text.I18nDatas[cultureName].Text.Value
|
||||||
);
|
);
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
text.ChooseId.Value,
|
text.ChooseId.Value,
|
||||||
text.I18nDatas[cultureName].Choose.Value
|
text.I18nDatas[cultureName].Choose.Value
|
||||||
);
|
);
|
||||||
@ -617,7 +487,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToLowText(), "lowfoodtext"));
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToLowText(), "lowfoodtext"));
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
{
|
{
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
text.Id.Value,
|
text.Id.Value,
|
||||||
text.I18nDatas[cultureName].Text.Value
|
text.I18nDatas[cultureName].Text.Value
|
||||||
);
|
);
|
||||||
@ -642,7 +512,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToClickText(), "clicktext"));
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToClickText(), "clicktext"));
|
||||||
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
{
|
{
|
||||||
_saveI18nDatas[cultureName].TryAdd(
|
SaveI18nDatas[cultureName].TryAdd(
|
||||||
text.Id.Value,
|
text.Id.Value,
|
||||||
text.I18nDatas[cultureName].Text.Value
|
text.I18nDatas[cultureName].Text.Value
|
||||||
);
|
);
|
||||||
@ -666,7 +536,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
var cultureFile = Path.Combine(culturePath, $"{cultureName}.lps");
|
var cultureFile = Path.Combine(culturePath, $"{cultureName}.lps");
|
||||||
File.Create(cultureFile).Close();
|
File.Create(cultureFile).Close();
|
||||||
var lps = new LPS();
|
var lps = new LPS();
|
||||||
foreach (var data in _saveI18nDatas[cultureName])
|
foreach (var data in SaveI18nDatas[cultureName])
|
||||||
lps.Add(new Line(data.Key, data.Value));
|
lps.Add(new Line(data.Key, data.Value));
|
||||||
File.WriteAllText(cultureFile, lps.ToString());
|
File.WriteAllText(cultureFile, lps.ToString());
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
using HKW.HKWViewModels.SimpleObservable;
|
using HKW.HKWViewModels.SimpleObservable;
|
||||||
|
using LinePutScript;
|
||||||
|
using LinePutScript.Converter;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -67,6 +70,8 @@ public class PetModel : I18nModel<I18nPetInfoModel>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableCollection<AnimeTypeModel> Animes { get; } = new();
|
public ObservableCollection<AnimeTypeModel> Animes { get; } = new();
|
||||||
|
|
||||||
|
public bool IsSimplePetModel { get; } = false;
|
||||||
|
|
||||||
public PetModel()
|
public PetModel()
|
||||||
{
|
{
|
||||||
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
|
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
|
||||||
@ -152,7 +157,165 @@ public class PetModel : I18nModel<I18nPetInfoModel>
|
|||||||
Moves.Add(new(move));
|
Moves.Add(new(move));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PetModel(PetLoader loader, bool isSimplePet)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
Id.Value = loader.PetName;
|
||||||
|
IsSimplePetModel = isSimplePet;
|
||||||
|
}
|
||||||
|
|
||||||
public void Close() { }
|
public void Close() { }
|
||||||
|
|
||||||
|
#region Save
|
||||||
|
/// <summary>
|
||||||
|
/// 保存宠物
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">路径</param>
|
||||||
|
public void Save(string path)
|
||||||
|
{
|
||||||
|
if (IsSimplePetModel)
|
||||||
|
{
|
||||||
|
SaveSimplePetInfo(path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
|
{
|
||||||
|
ModInfoModel.SaveI18nDatas[cultureName].TryAdd(
|
||||||
|
Id.Value,
|
||||||
|
I18nDatas[cultureName].Name.Value
|
||||||
|
);
|
||||||
|
ModInfoModel.SaveI18nDatas[cultureName].TryAdd(
|
||||||
|
DescriptionId.Value,
|
||||||
|
I18nDatas[cultureName].Description.Value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var petFile = Path.Combine(path, $"{Id.Value}.lps");
|
||||||
|
if (File.Exists(petFile) is false)
|
||||||
|
File.Create(petFile).Close();
|
||||||
|
var lps = new LPS();
|
||||||
|
SavePetInfo(lps);
|
||||||
|
SaveWorksInfo(lps);
|
||||||
|
SaveMoveInfo(lps);
|
||||||
|
File.WriteAllText(petFile, lps.ToString());
|
||||||
|
|
||||||
|
var petAnimePath = Path.Combine(path, Id.Value);
|
||||||
|
foreach (var animeType in Animes)
|
||||||
|
animeType.Save(petAnimePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveSimplePetInfo(string path)
|
||||||
|
{
|
||||||
|
if (Works.Count == 0 && Moves.Count == 0 && Animes.Count == 0)
|
||||||
|
return;
|
||||||
|
var petFile = Path.Combine(path, $"{Id.Value}.lps");
|
||||||
|
var lps = new LPS { new Line("pet", Id.Value) { new Sub("path", Id.Value), } };
|
||||||
|
SaveWorksInfo(lps);
|
||||||
|
SaveMoveInfo(lps);
|
||||||
|
File.WriteAllText(petFile, lps.ToString());
|
||||||
|
var petAnimePath = Path.Combine(path, Id.Value);
|
||||||
|
foreach (var animeType in Animes)
|
||||||
|
animeType.Save(petAnimePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存移动信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lps"></param>
|
||||||
|
/// <param name="pet"></param>
|
||||||
|
void SaveMoveInfo(LPS lps)
|
||||||
|
{
|
||||||
|
foreach (var move in Moves)
|
||||||
|
{
|
||||||
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(move.ToMove(), "move"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存工作信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lps"></param>
|
||||||
|
/// <param name="pet"></param>
|
||||||
|
void SaveWorksInfo(LPS lps)
|
||||||
|
{
|
||||||
|
foreach (var work in Works)
|
||||||
|
{
|
||||||
|
lps.Add(LPSConvert.SerializeObjectToLine<Line>(work.ToWork(), "work"));
|
||||||
|
foreach (var cultureName in I18nHelper.Current.CultureNames)
|
||||||
|
{
|
||||||
|
ModInfoModel.SaveI18nDatas[cultureName].TryAdd(
|
||||||
|
work.Id.Value,
|
||||||
|
work.I18nDatas[cultureName].Name.Value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存宠物信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lps"></param>
|
||||||
|
/// <param name="pet"></param>
|
||||||
|
private void SavePetInfo(LPS lps)
|
||||||
|
{
|
||||||
|
lps.Add(
|
||||||
|
new Line("pet", Id.Value)
|
||||||
|
{
|
||||||
|
new Sub("intor", DescriptionId.Value),
|
||||||
|
new Sub("path", Id.Value),
|
||||||
|
new Sub("petname", Id.Value)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
lps.Add(
|
||||||
|
new Line("touchhead")
|
||||||
|
{
|
||||||
|
new Sub("px", TouchHeadRect.Value.X.Value),
|
||||||
|
new Sub("py", TouchHeadRect.Value.Y.Value),
|
||||||
|
new Sub("sw", TouchHeadRect.Value.Width.Value),
|
||||||
|
new Sub("sh", TouchHeadRect.Value.Height.Value),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
lps.Add(
|
||||||
|
new Line("touchraised")
|
||||||
|
{
|
||||||
|
new Sub("happy_px", TouchRaisedRect.Value.Happy.Value.X.Value),
|
||||||
|
new Sub("happy_py", TouchRaisedRect.Value.Happy.Value.Y.Value),
|
||||||
|
new Sub("happy_sw", TouchRaisedRect.Value.Happy.Value.Width.Value),
|
||||||
|
new Sub("happy_sh", TouchRaisedRect.Value.Happy.Value.Height.Value),
|
||||||
|
//
|
||||||
|
new Sub("nomal_px", TouchRaisedRect.Value.Nomal.Value.X.Value),
|
||||||
|
new Sub("nomal_py", TouchRaisedRect.Value.Nomal.Value.Y.Value),
|
||||||
|
new Sub("nomal_sw", TouchRaisedRect.Value.Nomal.Value.Width.Value),
|
||||||
|
new Sub("nomal_sh", TouchRaisedRect.Value.Nomal.Value.Height.Value),
|
||||||
|
//
|
||||||
|
new Sub("poorcondition_px", TouchRaisedRect.Value.PoorCondition.Value.X.Value),
|
||||||
|
new Sub("poorcondition_py", TouchRaisedRect.Value.PoorCondition.Value.Y.Value),
|
||||||
|
new Sub("poorcondition_sw", TouchRaisedRect.Value.PoorCondition.Value.Width.Value),
|
||||||
|
new Sub("poorcondition_sh", TouchRaisedRect.Value.PoorCondition.Value.Height.Value),
|
||||||
|
//
|
||||||
|
new Sub("ill_px", TouchRaisedRect.Value.Ill.Value.X.Value),
|
||||||
|
new Sub("ill_py", TouchRaisedRect.Value.Ill.Value.Y.Value),
|
||||||
|
new Sub("ill_sw", TouchRaisedRect.Value.Ill.Value.Width.Value),
|
||||||
|
new Sub("ill_sh", TouchRaisedRect.Value.Ill.Value.Height.Value),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
lps.Add(
|
||||||
|
new Line("raisepoint")
|
||||||
|
{
|
||||||
|
new Sub("happy_x", RaisePoint.Value.Happy.Value.X.Value),
|
||||||
|
new Sub("happy_y", RaisePoint.Value.Happy.Value.Y.Value),
|
||||||
|
//
|
||||||
|
new Sub("nomal_x", RaisePoint.Value.Nomal.Value.X.Value),
|
||||||
|
new Sub("nomal_y", RaisePoint.Value.Nomal.Value.Y.Value),
|
||||||
|
//
|
||||||
|
new Sub("poorcondition_x", RaisePoint.Value.PoorCondition.Value.X.Value),
|
||||||
|
new Sub("poorcondition_y", RaisePoint.Value.PoorCondition.Value.Y.Value),
|
||||||
|
//
|
||||||
|
new Sub("ill_x", RaisePoint.Value.Ill.Value.X.Value),
|
||||||
|
new Sub("ill_y", RaisePoint.Value.Ill.Value.Y.Value),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class I18nPetInfoModel
|
public class I18nPetInfoModel
|
||||||
|
@ -20,17 +20,44 @@ public class FoodEditWindowVM
|
|||||||
#region Value
|
#region Value
|
||||||
public FoodModel OldFood { get; set; }
|
public FoodModel OldFood { get; set; }
|
||||||
public ObservableValue<FoodModel> Food { get; } = new(new());
|
public ObservableValue<FoodModel> Food { get; } = new(new());
|
||||||
|
public ObservableValue<bool> AutoSetReferencePrice { get; } = new(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddImageCommand { get; } = new();
|
public ObservableCommand AddImageCommand { get; } = new();
|
||||||
public ObservableCommand ChangeImageCommand { get; } = new();
|
public ObservableCommand ChangeImageCommand { get; } = new();
|
||||||
|
|
||||||
|
public ObservableCommand<double> SetReferencePriceCommand { get; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public FoodEditWindowVM()
|
public FoodEditWindowVM()
|
||||||
{
|
{
|
||||||
AddImageCommand.ExecuteEvent += AddImage;
|
AddImageCommand.ExecuteEvent += AddImage;
|
||||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||||
|
AutoSetReferencePrice.ValueChanged += AutoSetReferencePrice_ValueChanged;
|
||||||
|
SetReferencePriceCommand.ExecuteEvent += SetReferencePriceToPrice;
|
||||||
|
Food.Value.ReferencePrice.ValueChanged += ReferencePrice_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AutoSetReferencePrice_ValueChanged(bool oldValue, bool newValue)
|
||||||
|
{
|
||||||
|
if (newValue)
|
||||||
|
{
|
||||||
|
SetReferencePriceToPrice(Food.Value.ReferencePrice.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReferencePrice_ValueChanged(double oldValue, double newValue)
|
||||||
|
{
|
||||||
|
if (AutoSetReferencePrice.Value)
|
||||||
|
{
|
||||||
|
SetReferencePriceToPrice(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetReferencePriceToPrice(double value)
|
||||||
|
{
|
||||||
|
Food.Value.Price.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -200,21 +200,21 @@ public class ModEditWindowVM
|
|||||||
if (saveFileDialog.ShowDialog() is true)
|
if (saveFileDialog.ShowDialog() is true)
|
||||||
{
|
{
|
||||||
var pending = PendingBox.Show("保存中".Translate());
|
var pending = PendingBox.Show("保存中".Translate());
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
var path = Path.GetDirectoryName(saveFileDialog.FileName);
|
var path = Path.GetDirectoryName(saveFileDialog.FileName);
|
||||||
ModInfo.Value.SaveTo(path);
|
ModInfo.Value.SaveTo(path);
|
||||||
if (string.IsNullOrWhiteSpace(ModInfo.Value.SourcePath.Value))
|
if (string.IsNullOrWhiteSpace(ModInfo.Value.SourcePath.Value))
|
||||||
ModInfo.Value.SourcePath.Value = path;
|
ModInfo.Value.SourcePath.Value = path;
|
||||||
pending.Close();
|
pending.Close();
|
||||||
MessageBox.Show(ModEditWindow, "保存成功".Translate());
|
MessageBox.Show(ModEditWindow, "保存成功".Translate());
|
||||||
}
|
//}
|
||||||
catch (Exception ex)
|
//catch (Exception ex)
|
||||||
{
|
//{
|
||||||
pending.Close();
|
// pending.Close();
|
||||||
MessageBox.Show($"保存失败 错误信息:\n{0}".Translate(ex));
|
// MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,18 +91,18 @@ public class MovePageVM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Remove(MoveModel food)
|
private void Remove(MoveModel model)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
if (ShowMoves.Value.Count == Moves.Count)
|
if (ShowMoves.Value.Count == Moves.Count)
|
||||||
{
|
{
|
||||||
Moves.Remove(food);
|
Moves.Remove(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowMoves.Value.Remove(food);
|
ShowMoves.Value.Remove(model);
|
||||||
Moves.Remove(food);
|
Moves.Remove(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,11 @@ public class PetPageVM
|
|||||||
|
|
||||||
public void Edit(PetModel model)
|
public void Edit(PetModel model)
|
||||||
{
|
{
|
||||||
|
if (model.IsSimplePetModel)
|
||||||
|
{
|
||||||
|
MessageBox.Show("这是本体自带的宠物, 无法编辑".Translate());
|
||||||
|
return;
|
||||||
|
}
|
||||||
var window = new PetEditWindow();
|
var window = new PetEditWindow();
|
||||||
var vm = window.ViewModel;
|
var vm = window.ViewModel;
|
||||||
vm.OldPet = model;
|
vm.OldPet = model;
|
||||||
@ -81,18 +86,23 @@ public class PetPageVM
|
|||||||
model.Close();
|
model.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Remove(PetModel food)
|
private void Remove(PetModel model)
|
||||||
{
|
{
|
||||||
|
if (model.IsSimplePetModel)
|
||||||
|
{
|
||||||
|
MessageBox.Show("这是本体自带的宠物, 无法删除".Translate());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
if (ShowPets.Value.Count == Pets.Count)
|
if (ShowPets.Value.Count == Pets.Count)
|
||||||
{
|
{
|
||||||
Pets.Remove(food);
|
Pets.Remove(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowPets.Value.Remove(food);
|
ShowPets.Value.Remove(model);
|
||||||
Pets.Remove(food);
|
Pets.Remove(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,18 +91,18 @@ public class WorkPageVM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Remove(WorkModel food)
|
private void Remove(WorkModel model)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
if (ShowWorks.Value.Count == Works.Count)
|
if (ShowWorks.Value.Count == Works.Count)
|
||||||
{
|
{
|
||||||
Works.Remove(food);
|
Works.Remove(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowWorks.Value.Remove(food);
|
ShowWorks.Value.Remove(model);
|
||||||
Works.Remove(food);
|
Works.Remove(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,15 @@
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding PlacementTarget.Tag.AddImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
Command="{Binding PlacementTarget.Tag.AddImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
Header="添加图片" />
|
Header="{ll:Str 添加图片}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding PlacementTarget.Tag.ClearImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
Command="{Binding PlacementTarget.Tag.ClearImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
Header="清空图片" />
|
Header="{ll:Str 清空图片}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding PlacementTarget.Tag.RemoveAnimeCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
Command="{Binding PlacementTarget.Tag.RemoveAnimeCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
Header="删除此项" />
|
Header="{ll:Str 删除此项}" />
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
<Expander.Header>
|
<Expander.Header>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox pu:TextBoxHelper.Watermark="动画Id" Text="{Binding Id.Value, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 动画Id}" Text="{Binding Id.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<TextBlock Grid.Column="1" Margin="10,0,0,0">
|
<TextBlock Grid.Column="1" Margin="10,0,0,0">
|
||||||
<TextBlock.Text>
|
<TextBlock.Text>
|
||||||
<MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
|
<MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding PlacementTarget.Tag.RemoveImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
Command="{Binding PlacementTarget.Tag.RemoveImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
|
||||||
Header="删除图片" />
|
Header="{ll:Str 删除图片}" />
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Grid.ContextMenu>
|
</Grid.ContextMenu>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Content="持续时间(ms)" />
|
<Label Content="{ll:Str 持续时间(ms)}" />
|
||||||
<pu:NumberInput Grid.Column="1" Value="{Binding DataContext.Duration.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}" />
|
<pu:NumberInput Grid.Column="1" Value="{Binding DataContext.Duration.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -125,6 +125,7 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Content="{ll:Str 饱腹值}" />
|
<Label Content="{ll:Str 饱腹值}" />
|
||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
@ -163,10 +164,29 @@
|
|||||||
Value="{Binding Food.Value.Exp.Value, Mode=TwoWay}" />
|
Value="{Binding Food.Value.Exp.Value, Mode=TwoWay}" />
|
||||||
<Label Grid.Row="8" Content="{ll:Str 价格}" />
|
<Label Grid.Row="8" Content="{ll:Str 价格}" />
|
||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
x:Name="NumberInput_Price"
|
|
||||||
Grid.Row="8"
|
Grid.Row="8"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Value="{Binding Food.Value.Price.Value, Mode=TwoWay}" />
|
Value="{Binding Food.Value.Price.Value, Mode=TwoWay}" />
|
||||||
|
<Label Grid.Row="9" Content="{ll:Str 参考价格}" />
|
||||||
|
<Grid Grid.Row="9" Grid.Column="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="{Binding Food.Value.ReferencePrice.Value}" />
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
Command="{Binding SetReferencePriceCommand}"
|
||||||
|
CommandParameter="{Binding Food.Value.ReferencePrice.Value}"
|
||||||
|
Content="{ll:Str 设置}" />
|
||||||
|
<pu:Switch
|
||||||
|
Grid.Column="2"
|
||||||
|
BoxHeight="16"
|
||||||
|
BoxWidth="30"
|
||||||
|
Content="{ll:Str 自动设置}"
|
||||||
|
IsChecked="{Binding AutoSetReferencePrice.Value}" />
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2">
|
||||||
|
@ -89,34 +89,34 @@
|
|||||||
<TextBox
|
<TextBox
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="Id"
|
pu:TextBoxHelper.Watermark="Id"
|
||||||
Text="{Binding ModInfo.Value.Id.Value}" />
|
Text="{Binding ModInfo.Value.Id.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<Label Grid.Row="1" Content="{ll:Str 作者}" />
|
<Label Grid.Row="1" Content="{ll:Str 作者}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox_Author"
|
x:Name="TextBox_Author"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="{ll:Str 作者}"
|
pu:TextBoxHelper.Watermark="{ll:Str 作者}"
|
||||||
Text="{Binding ModInfo.Value.Author.Value}" />
|
Text="{Binding ModInfo.Value.Author.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<Label Grid.Row="2" Content="{ll:Str 游戏版本}" />
|
<Label Grid.Row="2" Content="{ll:Str 游戏版本}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox_GameVersion"
|
x:Name="TextBox_GameVersion"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="{ll:Str 游戏版本}"
|
pu:TextBoxHelper.Watermark="{ll:Str 游戏版本}"
|
||||||
Text="{Binding ModInfo.Value.GameVersion.Value}" />
|
Text="{Binding ModInfo.Value.GameVersion.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<Label Grid.Row="3" Content="{ll:Str 模组版本}" />
|
<Label Grid.Row="3" Content="{ll:Str 模组版本}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox_ModVersion"
|
x:Name="TextBox_ModVersion"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="{ll:Str 模组版本}"
|
pu:TextBoxHelper.Watermark="{ll:Str 模组版本}"
|
||||||
Text="{Binding ModInfo.Value.ModVersion.Value}" />
|
Text="{Binding ModInfo.Value.ModVersion.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<Label Grid.Row="4" Content="{ll:Str 模组名称}" />
|
<Label Grid.Row="4" Content="{ll:Str 模组名称}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
pu:TextBoxHelper.Watermark="{ll:Str 模组名称}"
|
pu:TextBoxHelper.Watermark="{ll:Str 模组名称}"
|
||||||
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Name.Value}" />
|
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<Label Grid.Row="5" Content="{ll:Str 模组介绍}" />
|
<Label Grid.Row="5" Content="{ll:Str 模组介绍}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox_Description"
|
x:Name="TextBox_Description"
|
||||||
@ -126,7 +126,7 @@
|
|||||||
VerticalContentAlignment="Top"
|
VerticalContentAlignment="Top"
|
||||||
d:Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
d:Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||||
pu:TextBoxHelper.Watermark="{ll:Str 模组介绍}"
|
pu:TextBoxHelper.Watermark="{ll:Str 模组介绍}"
|
||||||
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}"
|
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Value="{Binding Work.Value.Feeling.Value}" />
|
Value="{Binding Work.Value.Feeling.Value}" />
|
||||||
<Label Grid.Row="5" Content="{ll:Str 奖励倍率}" />
|
<Label Grid.Row="5" Content="{ll:Str 完成奖励倍率}" />
|
||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
@ -211,12 +211,12 @@
|
|||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
Grid.Row="6"
|
Grid.Row="6"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Value="{Binding Work.Value.FinishBonus.Value}" />
|
Value="{Binding Work.Value.LevelLimit.Value}" />
|
||||||
<Label Grid.Row="7" Content="{ll:Str 花费时间(分钟)}" />
|
<Label Grid.Row="7" Content="{ll:Str 花费时间(分钟)}" />
|
||||||
<pu:NumberInput
|
<pu:NumberInput
|
||||||
Grid.Row="7"
|
Grid.Row="7"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Value="{Binding Work.Value.FinishBonus.Value}" />
|
Value="{Binding Work.Value.Time.Value}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Expander Grid.Row="1" Header="{ll:Str 界面样式}">
|
<Expander Grid.Row="1" Header="{ll:Str 界面样式}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<Button
|
<Button
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Command="{Binding ClearHistoriesCommand}"
|
Command="{Binding ClearHistoriesCommand}"
|
||||||
Content="清空历史" />
|
Content="{ll:Str 清空历史}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ListBox
|
<ListBox
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
|
Loading…
Reference in New Issue
Block a user