mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
支持指定食物的动画
This commit is contained in:
parent
972054a1be
commit
2ecba879d3
@ -657,5 +657,20 @@ namespace VPet_Simulator.Core
|
||||
ig.Run(b, img, EndAction);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示夹层动画
|
||||
/// </summary>
|
||||
/// <param name="name">动画名称</param>
|
||||
/// <param name="img">夹层内容</param>
|
||||
/// <param name="EndAction">动画结束后操作</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,18 +219,6 @@ namespace VPet_Simulator.Core
|
||||
/// 饥饿
|
||||
/// </summary>
|
||||
Switch_Hunger,
|
||||
/// <summary>
|
||||
/// 吃东西
|
||||
/// </summary>
|
||||
Eat,
|
||||
/// <summary>
|
||||
/// 喝东西
|
||||
/// </summary>
|
||||
Drink,
|
||||
/// <summary>
|
||||
/// 收到礼物
|
||||
/// </summary>
|
||||
Gift,
|
||||
}
|
||||
/// <summary>
|
||||
/// 动作: 动画的动作 Start Loop End
|
||||
|
@ -197,5 +197,28 @@ namespace VPet_Simulator.Windows.Interface
|
||||
descs += "\t\t" + "恢复".Translate() + ":\t" + (eattime).ToString("MM/dd HH");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 食用时显示的动画
|
||||
/// </summary>
|
||||
[Line(ignoreCase: true)]
|
||||
public string Graph { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 获取食用时显示的动画
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -224,20 +224,7 @@ 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, () =>
|
||||
mw.Main.Display(item.GetGraph(), item.ImageSource, () =>
|
||||
{
|
||||
showeatanm = true;
|
||||
mw.Main.DisplayToNomal();
|
||||
|
Loading…
Reference in New Issue
Block a user