diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs index eaabe3c..b07a708 100644 --- a/VPet-Simulator.Core/Display/MainDisplay.cs +++ b/VPet-Simulator.Core/Display/MainDisplay.cs @@ -657,5 +657,20 @@ namespace VPet_Simulator.Core ig.Run(b, img, EndAction); } } + /// + /// 显示夹层动画 + /// + /// 动画名称 + /// 夹层内容 + /// 动画结束后操作 + public void Display(string name, ImageSource img, Action EndAction) + { + var ig = Core.Graph.FindGraph(name, AnimatType.Single, Core.Save.Mode); + if (ig != null) + { + var b = FindDisplayBorder(ig); + ig.Run(b, img, EndAction); + } + } } } diff --git a/VPet-Simulator.Core/Graph/GraphInfo.cs b/VPet-Simulator.Core/Graph/GraphInfo.cs index d67188d..1531c31 100644 --- a/VPet-Simulator.Core/Graph/GraphInfo.cs +++ b/VPet-Simulator.Core/Graph/GraphInfo.cs @@ -219,18 +219,6 @@ namespace VPet_Simulator.Core /// 饥饿 /// Switch_Hunger, - /// - /// 吃东西 - /// - Eat, - /// - /// 喝东西 - /// - Drink, - /// - /// 收到礼物 - /// - Gift, } /// /// 动作: 动画的动作 Start Loop End diff --git a/VPet-Simulator.Windows.Interface/Mod/Food.cs b/VPet-Simulator.Windows.Interface/Mod/Food.cs index b14dc85..2057a4c 100644 --- a/VPet-Simulator.Windows.Interface/Mod/Food.cs +++ b/VPet-Simulator.Windows.Interface/Mod/Food.cs @@ -197,5 +197,28 @@ namespace VPet_Simulator.Windows.Interface descs += "\t\t" + "恢复".Translate() + ":\t" + (eattime).ToString("MM/dd HH"); } } + /// + /// 食用时显示的动画 + /// + [Line(ignoreCase: true)] + public string Graph { get; set; } = null; + /// + /// 获取食用时显示的动画 + /// + public string GetGraph() + { + if (string.IsNullOrEmpty(Graph)) + switch (Type) + { + default: + return "eat"; + case Food.FoodType.Drink: + return "drink"; + case Food.FoodType.Gift: + return "gift"; + } + else + return Graph; + } } } diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 91c9ad6..988bb95 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -299,7 +299,7 @@ namespace VPet_Simulator.Windows var item = food[Function.Rnd.Next(food.Count)]; Core.Save.Money -= item.Price * 0.2; TakeItem(item); - Main.Display(GraphType.Eat, item.ImageSource, Main.DisplayToNomal); + Main.Display(item.GetGraph(), item.ImageSource, Main.DisplayToNomal); } else if (Core.Save.StrengthDrink < 75) { @@ -309,7 +309,7 @@ namespace VPet_Simulator.Windows var item = food[Function.Rnd.Next(food.Count)]; Core.Save.Money -= item.Price * 0.2; TakeItem(item); - Main.Display(GraphType.Drink, item.ImageSource, Main.DisplayToNomal); + Main.Display(item.GetGraph(), item.ImageSource, Main.DisplayToNomal); } } else if (Core.Save.Mode == GameSave.ModeType.Happy || Core.Save.Mode == GameSave.ModeType.Nomal) diff --git a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs index d0db520..5170bfb 100644 --- a/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml.cs @@ -223,21 +223,8 @@ namespace VPet_Simulator.Windows } if (showeatanm) {//显示动画 - showeatanm = false; - GraphType gt; - switch (item.Type) - { - default: - gt = GraphType.Eat; - break; - case Food.FoodType.Drink: - gt = GraphType.Drink; - break; - case Food.FoodType.Gift: - gt = GraphType.Gift; - break; - } - mw.Main.Display(gt, item.ImageSource, () => + showeatanm = false; + mw.Main.Display(item.GetGraph(), item.ImageSource, () => { showeatanm = true; mw.Main.DisplayToNomal();