From e18417618eed2be6017c2d85a252210d370dd4a6 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 8 Jun 2023 18:46:53 +1000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9B=B4=E5=A5=BD=E4=B9=B0,?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B4=AD=E4=B9=B0=E4=B8=9C=E8=A5=BF=E5=90=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Handle/Function.cs | 2 +- VPet-Simulator.Core/Handle/GameSave.cs | 5 +- .../VPet-Simulator.Core.csproj | 2 +- VPet-Simulator.Core/packages.config | 2 +- VPet-Simulator.Windows.Interface/Food.cs | 103 ++++- .../IMainWindow.cs | 7 +- VPet-Simulator.Windows.Interface/Source.cs | 170 ++++++++ .../VPet-Simulator.Windows.Interface.csproj | 3 +- .../packages.config | 2 +- VPet-Simulator.Windows/App.xaml | 2 +- VPet-Simulator.Windows/Function/CoreMOD.cs | 43 +- VPet-Simulator.Windows/MainWindow.cs | 4 +- VPet-Simulator.Windows/MainWindow.xaml.cs | 22 +- VPet-Simulator.Windows/Res/汉堡.png | Bin 0 -> 2518 bytes .../VPet-Simulator.Windows.csproj | 5 +- .../WinDesign/winBetterBuy.xaml | 376 ++++++------------ .../WinDesign/winBetterBuy.xaml.cs | 192 +++++---- .../mod/0000_core/food/food.lps | 63 +++ .../mod/0000_core/image/food.png | Bin 0 -> 5551 bytes .../mod/0000_core/image/food/ab钙奶.png | Bin 0 -> 2999 bytes .../mod/0000_core/image/food/三明治.png | Bin 0 -> 5551 bytes .../mod/0000_core/image/food/东坡肘子.png | Bin 0 -> 9112 bytes .../mod/0000_core/image/food/冰激凌.png | Bin 0 -> 2996 bytes .../mod/0000_core/image/food/凉茶.png | Bin 0 -> 3018 bytes .../mod/0000_core/image/food/华夫饼.png | Bin 0 -> 7986 bytes .../mod/0000_core/image/food/南瓜吐司.png | Bin 0 -> 6923 bytes .../mod/0000_core/image/food/压缩饼干.png | Bin 0 -> 2893 bytes .../mod/0000_core/image/food/可乐.png | Bin 0 -> 3022 bytes .../mod/0000_core/image/food/咖啡饮料.png | Bin 0 -> 2683 bytes .../mod/0000_core/image/food/土力架.png | Bin 0 -> 2895 bytes .../mod/0000_core/image/food/大鹏特饮.png | Bin 0 -> 2799 bytes .../mod/0000_core/image/food/奶片.png | Bin 0 -> 3083 bytes .../mod/0000_core/image/food/奶糖.png | Bin 0 -> 2895 bytes .../0000_core/image/food/娃仔小馒头.png | Bin 0 -> 3601 bytes .../mod/0000_core/image/food/小布丁.png | Bin 0 -> 2622 bytes .../mod/0000_core/image/food/巧克力.png | Bin 0 -> 2898 bytes .../mod/0000_core/image/food/戒指糖.png | Bin 0 -> 2863 bytes .../mod/0000_core/image/food/披萨.png | Bin 0 -> 6367 bytes .../mod/0000_core/image/food/散射雪糕.png | Bin 0 -> 2447 bytes .../mod/0000_core/image/food/果汁.png | Bin 0 -> 3224 bytes .../mod/0000_core/image/food/核桃仁.png | Bin 0 -> 2877 bytes .../mod/0000_core/image/food/梅菜扣肉.png | Bin 0 -> 8478 bytes .../mod/0000_core/image/food/椰汁.png | Bin 0 -> 2791 bytes .../mod/0000_core/image/food/汉堡.png | Bin 0 -> 2518 bytes .../mod/0000_core/image/food/沙拉.png | Bin 0 -> 7630 bytes .../mod/0000_core/image/food/泡泡糖.png | Bin 0 -> 3064 bytes .../mod/0000_core/image/food/火腿肠.png | Bin 0 -> 2753 bytes .../mod/0000_core/image/food/炸鸡腿.png | Bin 0 -> 1770 bytes .../mod/0000_core/image/food/烧鹅.png | Bin 0 -> 6658 bytes .../0000_core/image/food/煎西冷牛排.png | Bin 0 -> 7379 bytes .../mod/0000_core/image/food/爆米花.png | Bin 0 -> 3380 bytes .../mod/0000_core/image/food/牛扎糖.png | Bin 0 -> 3110 bytes .../mod/0000_core/image/food/牛板筋.png | Bin 0 -> 3606 bytes .../mod/0000_core/image/food/猪肉脯.png | Bin 0 -> 3487 bytes .../mod/0000_core/image/food/瓜子.png | Bin 0 -> 3337 bytes .../mod/0000_core/image/food/番茄意面.png | Bin 0 -> 6804 bytes .../mod/0000_core/image/food/盐汽水.png | Bin 0 -> 3099 bytes .../mod/0000_core/image/food/盐焗鸡.png | Bin 0 -> 8208 bytes .../mod/0000_core/image/food/红烧牛肉.png | Bin 0 -> 8097 bytes .../0000_core/image/food/红烧狮子头.png | Bin 0 -> 8771 bytes .../mod/0000_core/image/food/纸包鸡.png | Bin 0 -> 6562 bytes .../mod/0000_core/image/food/维他奶.png | Bin 0 -> 3174 bytes .../mod/0000_core/image/food/绿色心情.png | Bin 0 -> 3042 bytes .../mod/0000_core/image/food/罗宋汤.png | Bin 0 -> 8985 bytes .../mod/0000_core/image/food/老冰棍.png | Bin 0 -> 3214 bytes .../mod/0000_core/image/food/能量饮料.png | Bin 0 -> 2575 bytes .../mod/0000_core/image/food/臭豆腐.png | Bin 0 -> 7955 bytes .../mod/0000_core/image/food/花生米.png | Bin 0 -> 3933 bytes .../mod/0000_core/image/food/薯片.png | Bin 0 -> 3311 bytes .../0000_core/image/food/虾芝士焗虾.png | Bin 0 -> 7128 bytes .../mod/0000_core/image/food/西冷牛排.png | Bin 0 -> 7322 bytes .../mod/0000_core/image/food/软糖.png | Bin 0 -> 3467 bytes .../mod/0000_core/image/food/辣子鸡.png | Bin 0 -> 7935 bytes .../mod/0000_core/image/food/酸菜鱼.png | Bin 0 -> 9607 bytes .../mod/0000_core/image/food/酿豆腐.png | Bin 0 -> 9558 bytes .../mod/0000_core/image/food/雪饼.png | Bin 0 -> 3134 bytes .../mod/0000_core/image/food/雷碧.png | Bin 0 -> 3058 bytes .../mod/0000_core/image/food/面包.png | Bin 0 -> 5117 bytes .../0000_core/image/food/香煎牛仔骨.png | Bin 0 -> 6648 bytes .../mod/0000_core/image/food/鸡翅.png | Bin 0 -> 8053 bytes .../mod/0000_core/image/food/麻婆豆腐.png | Bin 0 -> 9350 bytes .../mod/0000_core/image/food/黄牛.png | Bin 0 -> 2889 bytes .../mod/0000_core/pet/vup/1,吃饭向右.rar | Bin 3485796 -> 0 bytes .../0000_core/pet/vup/1,吃饭向左.rar | Bin 3564592 -> 0 bytes .../PoorCondition/悲伤呼吸_000_125.png | Bin 0 -> 225183 bytes .../PoorCondition/悲伤呼吸_001_125.png | Bin 0 -> 229567 bytes .../PoorCondition/悲伤呼吸_002_125.png | Bin 0 -> 202872 bytes .../PoorCondition/悲伤呼吸_003_500.png | Bin 0 -> 214864 bytes .../PoorCondition/悲伤呼吸_004_125.png | Bin 0 -> 209750 bytes .../PoorCondition/悲伤呼吸_005_125.png | Bin 0 -> 214864 bytes .../PoorCondition/悲伤呼吸_006_375.png | Bin 0 -> 209750 bytes .../PoorCondition/悲伤呼吸_007_125.png | Bin 0 -> 214864 bytes .../PoorCondition/悲伤呼吸_008_750.png | Bin 0 -> 209750 bytes .../PoorCondition/悲伤呼吸_009_125.png | Bin 0 -> 214864 bytes .../PoorCondition/悲伤呼吸_010_125.png | Bin 0 -> 202872 bytes .../PoorCondition/悲伤呼吸_011_125.png | Bin 0 -> 229567 bytes .../PoorCondition/悲伤呼吸_012_250.png | Bin 0 -> 225183 bytes VPet-Simulator.Windows/packages.config | 4 +- 98 files changed, 664 insertions(+), 343 deletions(-) create mode 100644 VPet-Simulator.Windows.Interface/Source.cs create mode 100644 VPet-Simulator.Windows/Res/汉堡.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/food/food.lps create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/ab钙奶.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/三明治.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/东坡肘子.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/冰激凌.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/凉茶.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/华夫饼.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/南瓜吐司.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/压缩饼干.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/可乐.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/咖啡饮料.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/土力架.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/大鹏特饮.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/奶片.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/奶糖.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/娃仔小馒头.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/小布丁.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/巧克力.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/戒指糖.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/披萨.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/散射雪糕.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/果汁.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/核桃仁.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/梅菜扣肉.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/椰汁.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/汉堡.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/沙拉.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/泡泡糖.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/火腿肠.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/炸鸡腿.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/烧鹅.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/煎西冷牛排.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/爆米花.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/牛扎糖.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/牛板筋.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/猪肉脯.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/瓜子.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/番茄意面.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/盐汽水.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/盐焗鸡.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/红烧牛肉.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/红烧狮子头.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/纸包鸡.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/维他奶.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/绿色心情.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/罗宋汤.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/老冰棍.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/能量饮料.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/臭豆腐.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/花生米.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/薯片.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/虾芝士焗虾.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/西冷牛排.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/软糖.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/辣子鸡.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/酸菜鱼.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/酿豆腐.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/雪饼.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/雷碧.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/面包.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/香煎牛仔骨.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/鸡翅.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/麻婆豆腐.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/image/food/黄牛.png delete mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/1,吃饭向右.rar delete mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/1,吃饭向左.rar create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_000_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_001_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_002_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_003_500.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_004_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_005_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_006_375.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_007_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_008_750.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_009_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_010_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_011_125.png create mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Default/PoorCondition/悲伤呼吸_012_250.png diff --git a/VPet-Simulator.Core/Handle/Function.cs b/VPet-Simulator.Core/Handle/Function.cs index 2faf131..affa849 100644 --- a/VPet-Simulator.Core/Handle/Function.cs +++ b/VPet-Simulator.Core/Handle/Function.cs @@ -14,7 +14,7 @@ namespace VPet_Simulator.Core /// public static Brush ResourcesBrush(BrushType name) { - return (Brush)Application.Current.Resources.MergedDictionaries[0][name.ToString()]; + return (Brush)Application.Current.Resources.MergedDictionaries[0].MergedDictionaries[0][name.ToString()]; } public enum BrushType { diff --git a/VPet-Simulator.Core/Handle/GameSave.cs b/VPet-Simulator.Core/Handle/GameSave.cs index 182e496..ffbc174 100644 --- a/VPet-Simulator.Core/Handle/GameSave.cs +++ b/VPet-Simulator.Core/Handle/GameSave.cs @@ -174,7 +174,10 @@ namespace VPet_Simulator.Core else StrengthChange(StoreStrengthFood); } - + /// + /// 吃食物 + /// + /// 食物类 public void EatFood(IFood food) { Exp += food.Exp; diff --git a/VPet-Simulator.Core/VPet-Simulator.Core.csproj b/VPet-Simulator.Core/VPet-Simulator.Core.csproj index b63860f..9e4c973 100644 --- a/VPet-Simulator.Core/VPet-Simulator.Core.csproj +++ b/VPet-Simulator.Core/VPet-Simulator.Core.csproj @@ -71,7 +71,7 @@ - ..\packages\LinePutScript.1.8.1\lib\net462\LinePutScript.dll + ..\packages\LinePutScript.1.8.2\lib\net462\LinePutScript.dll ..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll diff --git a/VPet-Simulator.Core/packages.config b/VPet-Simulator.Core/packages.config index 01cdc92..ea43eed 100644 --- a/VPet-Simulator.Core/packages.config +++ b/VPet-Simulator.Core/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/VPet-Simulator.Windows.Interface/Food.cs b/VPet-Simulator.Windows.Interface/Food.cs index 55a658b..a1e3eb5 100644 --- a/VPet-Simulator.Windows.Interface/Food.cs +++ b/VPet-Simulator.Windows.Interface/Food.cs @@ -1,33 +1,118 @@ using LinePutScript.Converter; +using Panuon.WPF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using VPet_Simulator.Core; +using static LinePutScript.Converter.LPSConvert; namespace VPet_Simulator.Windows.Interface { - public class Food : IFood + public class Food : NotifyPropertyChangedBase, IFood { - [Line] + + /// + /// 食物类型 + /// + public enum FoodType + { + /// + /// 食物 (默认) + /// + Food, + /// + /// 收藏 (自定义) + /// + Star, + /// + /// 正餐 + /// + Meal, + /// + /// 零食 + /// + Snack, + /// + /// 饮料 + /// + Drink, + /// + /// 功能性 + /// + Functional, + /// + /// 药品 + /// + Drug, + } + /// + /// 食物类型 + /// + [Line(type: ConvertType.ToEnum, ignoreCase: true)] + public FoodType Type { get; set; } = FoodType.Food; + /// + /// 食物名字 + /// + [Line(name: "name")] + public string Name { get; set; } + [Line(ignoreCase: true)] public int Exp { get; set; } - [Line] + [Line(ignoreCase: true)] public double Strength { get; set; } - [Line] + [Line(ignoreCase: true)] public double StrengthFood { get; set; } - [Line] + [Line(ignoreCase: true)] public double StrengthDrink { get; set; } - [Line] + [Line(ignoreCase: true)] public double Feeling { get; set; } - [Line] + [Line(ignoreCase: true)] public double Health { get; set; } - [Line] + [Line(ignoreCase: true)] public double Likability { get; set; } /// /// 食物价格 /// - [Line] + [Line(ignoreCase: true)] public double Price { get; set; } + /// + /// 描述 + /// + [Line(ignoreCase: true)] + public string Desc { get; set; } + /// + /// 描述(ToBetterBuy) + /// + public string Description + { + get + { + StringBuilder sb = new StringBuilder(Desc); + return sb.ToString(); + } + } + /// + /// 显示的图片 + /// + public ImageSource ImageSource { get; set; } + /// + /// 是否已收藏 + /// + public bool Star { get; set; } + /// + /// 物品图片 + /// + [Line(ignoreCase: true)] + public string Image; + /// + /// 加载物品图片 + /// + public void LoadImageSource(IMainWindow imw) + { + ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food"); + Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name); + } } } diff --git a/VPet-Simulator.Windows.Interface/IMainWindow.cs b/VPet-Simulator.Windows.Interface/IMainWindow.cs index be0c9b0..3e60d15 100644 --- a/VPet-Simulator.Windows.Interface/IMainWindow.cs +++ b/VPet-Simulator.Windows.Interface/IMainWindow.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Windows.Media; using VPet_Simulator.Core; namespace VPet_Simulator.Windows.Interface @@ -47,7 +48,11 @@ namespace VPet_Simulator.Windows.Interface /// /// 所有食物 /// - List Items { get; } + List Foods { get; } + /// + /// 图片资源 + /// + ImageResources ImageSources { get; } /// /// 设置游戏缩放倍率 /// diff --git a/VPet-Simulator.Windows.Interface/Source.cs b/VPet-Simulator.Windows.Interface/Source.cs new file mode 100644 index 0000000..9560a1a --- /dev/null +++ b/VPet-Simulator.Windows.Interface/Source.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using LinePutScript; +using LinePutScript.Dictionary; + +namespace VPet_Simulator.Windows.Interface +{ + /// + /// 资源集 + /// + public class Resources : LPS_D + { + public Resources() { } + /// + /// 添加资源,后来覆盖之前 + /// + /// 资源行 + /// 功能位置 + public void AddSource(ILine line, string modpath) + { + ISub source = line.Find("source"); + if (source == null) + return; + //else if (!source.Info.Contains(":\\")) + source.Info = modpath + '\\' + source.Info; + line.Name = line.Name.ToLower(); + AddorReplaceLine(line); + } + /// + /// 添加资源,后来覆盖之前 + /// + /// 资源行 + public void AddSource(ILine line) + { + ISub source = line.Find("source"); + if (source == null) + return; + //else if (!source.Info.Contains(":\\")) + line.Name = line.Name.ToLower(); + AddorReplaceLine(line); + } + /// + /// 添加多个资源,后来覆盖之前 + /// + /// 资源表 + public void AddSources(ILPS lps) + { + foreach (ILine line in lps) + { + line.Name = line.Name.ToLower(); + AddSource(line); + } + } + /// + /// 添加多个资源,后来覆盖之前 + /// + /// 资源表 + /// 功能位置 + public void AddSources(ILPS lps, string modpath = "") + { + foreach (ILine line in lps) + { + AddSource(line, modpath); + } + } + /// + /// 添加资源,后来覆盖之前的 + /// + /// 资源名字 + /// 资源位置 + public void AddSource(string name, string path) + { + AddorReplaceLine(new Line(name.ToLower(), "", "", new Sub("source", path))); + } + /// + /// 查找资源 + /// + /// 资源名称 + /// 如果未找到,退回这个值 + /// 返回资源位置,如果未找到,则退回nofind + public string FindSource(string name, string nofind = null) + { + ILine line = FindLine(name.ToLower()); + if (line == null) + return nofind; + return line.Find("source").Info; + } + /// + /// 查找资源 + /// + /// 资源名称 + /// 如果未找到,退回这个值 + /// 返回资源位置,如果未找到,则退回nofind + public Uri FindSourceUri(string name, string nofind = null) + { + ILine line = FindLine(name.ToLower()); + if (line == null) + if (nofind != null) + return new Uri(nofind); + else + return null; + return new Uri(line.Find("source").Info); + } + } + + /// + /// 图片资源集合 + /// + public class ImageResources : Resources + { + public ImageResources() + { + + } + /// + /// 添加图片集,后来覆盖之前 + /// + /// 图片集 + /// 文件夹位置 + public void AddImages(LpsDocument lps, string modpath = "") => AddSources(lps, modpath); + /// + /// 添加单个图片,后来覆盖之前 + /// + /// 图片行 + /// 文件夹位置 + public void AddImage(ILine line, string modpath = "") => AddSource(line, modpath); + /// + /// 查找图片资源 + /// + /// 图片名称 + /// 图片资源,如果未找到则退回错误提示图片 + public BitmapImage FindImage(string imagename) => new BitmapImage(FindImageUri(imagename)); + + public Uri FindImageUri(string imagename) + { +#if DEBUGs + var v = FindSourceUri(imagename, "pack://application:,,,/Res/Image/system/error.png"); + if (v.AbsoluteUri == "pack://application:,,,/Res/Image/system/error.png") + throw new Exception($"image nofound {imagename}"); + return v; +#else + return FindSourceUri(imagename, "pack://application:,,,/Res/Image/system/error.png"); +#endif + } + + /// + /// 查找图片资源 如果找不到则使用上级 + /// + /// 图片名称 + /// 图片资源,如果未找到则退回错误提示图片 + /// 上级图片 如果没有专属的图片,则提供上级的图片 + public BitmapImage FindImage(string imagename, string superior) + { + string source = FindSource(imagename); + if (source == null) + { + return new BitmapImage(FindImageUri(superior)); + } + return new BitmapImage(new Uri(source)); + } + /// + /// 图片设置 (eg:定位锚点等) + /// + public LpsDocument ImageSetting = new LpsDocument(); + } +} diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj index c3d6769..69b35d7 100644 --- a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj +++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj @@ -89,7 +89,7 @@ - ..\packages\LinePutScript.1.8.1\lib\net462\LinePutScript.dll + ..\packages\LinePutScript.1.8.2\lib\net462\LinePutScript.dll ..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll @@ -116,6 +116,7 @@ + diff --git a/VPet-Simulator.Windows.Interface/packages.config b/VPet-Simulator.Windows.Interface/packages.config index 01cdc92..ea43eed 100644 --- a/VPet-Simulator.Windows.Interface/packages.config +++ b/VPet-Simulator.Windows.Interface/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/VPet-Simulator.Windows/App.xaml b/VPet-Simulator.Windows/App.xaml index e902a27..9d1b4f7 100644 --- a/VPet-Simulator.Windows/App.xaml +++ b/VPet-Simulator.Windows/App.xaml @@ -7,6 +7,7 @@ + /VPet-Simulator.Windows;component/Res/Font/#OPPOSans R @@ -22,7 +23,6 @@ IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon" IconFontSize="16" /> - diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index aed9c4e..b6412fe 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -1,4 +1,5 @@ using LinePutScript; +using LinePutScript.Converter; using System; using System.Collections.Generic; using System.IO; @@ -35,6 +36,29 @@ namespace VPet_Simulator.Windows public string Content = ""; public bool SuccessLoad = true; public static string INTtoVER(int ver) => $"{ver / 100}.{ver % 100:00}"; + public static void LoadImage(MainWindow mw, DirectoryInfo di) + { + //加载其他放在文件夹的图片 + foreach (FileInfo fi in di.EnumerateFiles("*.png")) + { + mw.ImageSources.AddSource(fi.Name.ToLower().Substring(0, fi.Name.Length - 4), fi.FullName); + } + //加载其他放在文件夹中文件夹的图片 + foreach (DirectoryInfo fordi in di.EnumerateDirectories()) + { + LoadImage(mw, fordi); + } + //加载标志好的图片和图片设置 + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var tmp = new LpsDocument(File.ReadAllText(fi.FullName)); + if (fi.Name.ToLower().StartsWith("set_")) + foreach (var line in tmp) + mw.ImageSources.ImageSetting.AddorReplaceLine(line); + else + mw.ImageSources.AddImages(tmp, di.FullName); + } + } public CoreMOD(DirectoryInfo directory, MainWindow mw) { Path = directory; @@ -83,6 +107,23 @@ namespace VPet_Simulator.Windows } } break; + case "food": + Content += "食物\n"; + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var tmp = new LpsDocument(File.ReadAllText(fi.FullName)); + foreach (ILine li in tmp) + { + string tmps = li.Find("name").info; + mw.Foods.RemoveAll(x => x.Name == tmps); + mw.Foods.Add(LPSConvert.DeserializeObject(li)); + } + } + break; + case "image": + Content += "图片包\n"; + LoadImage(mw, di); + break; case "plugin": Content += "代码插件\n"; SuccessLoad = false; @@ -133,7 +174,7 @@ namespace VPet_Simulator.Windows modlps.FindorAddLine("authorid").InfoToInt64 = AuthorID; modlps.FindorAddLine("itemid").info = ItemID.ToString(); File.WriteAllText(Path.FullName + @"\info.lps", modlps.ToString()); - } + } } public static class ExtensionSetting { diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 5456bf8..2376865 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -22,12 +22,14 @@ namespace VPet_Simulator.Windows public Main Main { get; set; } public UIElement TalkBox; public winGameSetting winSetting { get; set; } + public winBetterBuy winBetterBuy { get; set; } public ChatGPTClient CGPTClient; + public ImageResources ImageSources { get; set; } = new ImageResources(); /// /// 所有三方插件 /// public List Plugins { get; } = new List(); - public List Items { get; } = new List(); + public List Foods { get; } = new List(); /// /// 版本号 /// diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 8495fe1..dcb153a 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -218,6 +218,7 @@ namespace VPet_Simulator.Windows LoadingText.Content = "正在加载CGPT"; winSetting = new winGameSetting(this); + winBetterBuy = new winBetterBuy(this); Main = new Main(Core) { }; if (!Set["CGPT"][(gbol)"enable"] && IsSteamUser) { @@ -240,6 +241,8 @@ namespace VPet_Simulator.Windows { new winReport(this, "由于插件引起的游戏启动错误\n" + e.ToString()).Show(); } + Foods.ForEach(item => item.LoadImageSource(this)); + Main.DefaultClickAction = () => { if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalSeconds > 20) @@ -277,15 +280,24 @@ namespace VPet_Simulator.Windows Main.ToolBar.Visibility = Visibility.Collapsed; IRunImage eat = (IRunImage)Core.Graph.FindGraph(GraphType.Eat, GameSave.ModeType.Nomal); var b = Main.FindDisplayBorder(eat); - eat.Run(b, new BitmapImage(new Uri("pack://application:,,,/Res/tony.bmp")), Main.DisplayToNomal); + eat.Run(b, new BitmapImage(new Uri("pack://application:,,,/Res/汉堡.png")), Main.DisplayToNomal); } ); - Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Feed, "给不二一测试用的窗口", () => + Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Feed, "吃饭", () => + { + winBetterBuy.Show(Food.FoodType.Meal); + } + ); + Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Feed, "喝水", () => { - new winBetterBuy(this).Show(); + winBetterBuy.Show(Food.FoodType.Drink); } - ); - + ); + Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Feed, "药品", () => + { + winBetterBuy.Show(Food.FoodType.Drug); + } + ); Main.SetMoveMode(Set.AllowMove, Set.SmartMove, Set.SmartMoveInterval * 1000); Main.SetLogicInterval((int)(Set.LogicInterval * 1000)); if (Set.MessageBarOutside) diff --git a/VPet-Simulator.Windows/Res/汉堡.png b/VPet-Simulator.Windows/Res/汉堡.png new file mode 100644 index 0000000000000000000000000000000000000000..933e32df108dd164f4e76d9ae8120c6c95f24cc5 GIT binary patch literal 2518 zcmaJ@eNYo;9$vu;hy*P?(ee>3Ex9|V#$pBe3|3oo3dH)EG(e7#8Z9WEiGY#K(xReg zD|(IsMu{`r5l;dMU=xcbQNDr|5-pktl0<~Eq$>##HcJx7UKpM0*@Evs`@XX?&+qv? zzt5AKQ^vc>(te z2KoI9-VgZaH+IVD51YfkNb+1XSKoe+eGxxsXQ?`Zv-w-941{ly-hOOyEKQ(!a>~gw z!@N*M-+^?cQSY|=`e_;RELIdDUG0ym@R0E}+ob!9bi8M!g0S05+EcMa}z{jK4L`$R$q2*Ex^l#Hdrj856Tu!CJtFCn|E$}F6 zo(sGa4qRFF8p=&Gw^D8%U|M#3M|nrfhDSth7qBx!ANmJ7@zce@n3>S>MZLjyXH)C#z=g%VC1F|0sBkz5~b|Q zcH7htIm90+2|tHU#A{>V7p+@`Ee;OmJ34oUSi0dNN2Y);bxzs4wgmJ_*EqH~%V>FM zzhkpA&?8EK`ZDIPai30ybcmd&RRzQ? zE%2|>rzyef3>uxZxJ@Nf`&|F24r-fNp9$V~s{L=Sv+TSd13%~$YSegFE%_*FGCKv< zS$J#F=%Qq;N;3pR$TKvQ;RNWF>%|IJ{Vyw;xniA@g$cVW7Sz~q z{mE>pd$2VH7W91-CE|MmhNu}`RuFHuUZZD%h^rued??g%&(LH{v}F`)-D)F`$i!2+ z8rD1zkB}S4?=|AL??@`^U}g}Gt757$L5(ZF#c}s;;H^Mlm@p%J@7Cv>7gHYXL{Mm& zgfo=!B9_xHYo4BzdpWElOP7C0-7HCff3;U@EGTwQJHP@blOy4O_DFx(LSyE+zNX=QLE&~9-np~V7ts&Bp)|ZS83f%5 zaqwlLIdGM=%-(Nj^2RKg@r>Mf*B)A`^G49Q=;CzJGfc?>htf%v{s>H<9z&B6EcW2~ zxTLc=M+7{a&io!;*bse|PHjg_r2I}l1P*_efakj|J@=BVQb0m#D{kbC&6;1BM^ zblD}(axP-*w<55rEY6-9*L#4|e@Wu{fgW`X_4IEA2ese;L&s<71opO@xg{tkby-jD za-@Z&!+Xyc#N#1j&&F5;MP9V1R5L~Gwp&7eTqD81J8Vqv_qLF7_+b73Fqyco)=-}K6O<+%; z6Rxj7n-YvRh?h5l>k6UOwMvbdL?}T;RQ%^-1%!d&{3k<+4bdl$tZa9NBFhbVGQQDeI-H_nfd)Sce@_f98S$m0(}@ZlR}VvWr!3id(NJ@Ua@3*+*)+V%FoEwS z00qWB_~o7>h%@-M9BT#DDkiuh0cs$FHPp#vhBCR1?a?ZQc2Q{>$0Sv({CV8I>+{d} zr!@wrWH8@~XFpLiPU}@Ni(VaZH*(gkB}q*EZT;4l1z*!^`%0r_yUU?G-~`Hzhs4gw zC(^X}NDtT5`MJ22y=n+3s#`Qelgk+%0(cXT!}_fn3%F85Y21@aqbNw`ZkeKN84|`q z?#Rd|Fg?)*+M|-&&?gjbooS4ro31T^c&QJPzw$dc(RE;LWthpPaMiwHh%D=FVkT;Z zU0Gn?bU$DNwRun;on|>igbu3uB$YpAzn5VVj9_O_J3hX#5c+KKhki(`zz)(h<(|Ot z<1?wTKFaIN-J!XP>*3}w$fb~?gF>~+sg|ji7n;kG_@{IAWjw2DzYkJlX7+GgQ(lDQ zXm_B|8|mTs^Tk~RgxKVCNh(L8&Z5@UQ|2+&Z2bMUQyYRBqQ6OwOd9>q8m2db7ov&x zRKhRe1r4aVLR2ca>lm%Y$o#PKz2M}I%HMATuZF_zZPdn~9jDd)u=nD=!d>0=#^~Z? zX$F*I|A&M(*tR}JFpX28O#pXSqgKY@S$2!=fRV=UYm)f373C)BNGw9>Nt)T>>pKtt d6fJ*22{Cb&v{#?JIQ?(ar>Pt2KKa|X{{_t%nz8@@ literal 0 HcmV?d00001 diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index fbf51f9..7a5fbd7 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -76,10 +76,10 @@ - ..\packages\ChatGPT.API.Framework.1.0.2\lib\net462\ChatGPT.API.Framework.dll + ..\packages\ChatGPT.API.Framework.1.0.4\lib\net462\ChatGPT.API.Framework.dll - ..\packages\LinePutScript.1.8.1\lib\net48\LinePutScript.dll + ..\packages\LinePutScript.1.8.2\lib\net48\LinePutScript.dll ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll @@ -252,6 +252,7 @@ + PreserveNewest diff --git a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml index ad5d976..aabb94d 100644 --- a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml +++ b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml @@ -1,89 +1,46 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows" + mc:Ignorable="d" Title="更好买" Height="450" Width="800" FontSize="14" WindowStartupLocation="CenterScreen" + Background="#E0F6FF" pu:WindowXCaption.Height="45" pu:WindowXCaption.Background="{DynamicResource DARKPrimary}" + pu:WindowXCaption.Foreground="#FFFFFF" pu:WindowXCaption.Buttons="Close" Topmost="True" + pu:WindowXCaption.ShadowColor="{DynamicResource ShadowColor}" Closing="WindowX_Closing"> - -