支持连续吃东西

This commit is contained in:
ZouJin 2023-08-24 00:31:24 +10:00
parent e46072aca1
commit f8b482819b

View File

@ -50,7 +50,7 @@ namespace VPet_Simulator.Windows
public void Show(Food.FoodType type) public void Show(Food.FoodType type)
{ {
mw.Topmost = false; mw.Topmost = false;
IsEnabled = true;//逃出 showeatanm = true;//逃出
if (_searchTextBox != null) if (_searchTextBox != null)
_searchTextBox.Text = ""; _searchTextBox.Text = "";
if (LsbCategory.SelectedIndex == (int)type) if (LsbCategory.SelectedIndex == (int)type)
@ -110,6 +110,7 @@ namespace VPet_Simulator.Windows
IOrderedEnumerable<Food> ordered; IOrderedEnumerable<Food> ordered;
switch (sortrule) switch (sortrule)
{ {
default:
case 0: case 0:
if (sortasc) if (sortasc)
ordered = foods.OrderBy(x => x.TranslateName); ordered = foods.OrderBy(x => x.TranslateName);
@ -146,12 +147,18 @@ namespace VPet_Simulator.Windows
else else
ordered = foods.OrderByDescending(x => x.Feeling); ordered = foods.OrderByDescending(x => x.Feeling);
break; break;
default: case 6:
if (sortasc) if (sortasc)
ordered = foods.OrderBy(x => x.Health); ordered = foods.OrderBy(x => x.Health);
else else
ordered = foods.OrderByDescending(x => x.Health); ordered = foods.OrderByDescending(x => x.Health);
break; break;
case 7:
if (sortasc)
ordered = foods.OrderBy(x => x.Exp);
else
ordered = foods.OrderByDescending(x => x.Exp);
break;
} }
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
@ -185,12 +192,13 @@ namespace VPet_Simulator.Windows
//eventArg.Source = sender; //eventArg.Source = sender;
//PageDetail.RaiseEvent(eventArg); //PageDetail.RaiseEvent(eventArg);
} }
bool showeatanm = true;
private void BtnBuy_Click(object sender, RoutedEventArgs e) private void BtnBuy_Click(object sender, RoutedEventArgs e)
{ {
var Button = sender as Button; var Button = sender as Button;
var item = Button.DataContext as Food; var item = Button.DataContext as Food;
IsEnabled = false;
//看是什么模式 //看是什么模式
if (mw.Set.EnableFunction) if (mw.Set.EnableFunction)
{ {
@ -254,30 +262,34 @@ namespace VPet_Simulator.Windows
} }
} }
GraphType gt; if (showeatanm)
switch (item.Type) {//显示动画
{ showeatanm = false;
default: GraphType gt;
gt = GraphType.Eat; switch (item.Type)
break;
case Food.FoodType.Drink:
gt = GraphType.Drink;
break;
case Food.FoodType.Gift:
gt = GraphType.Gift;
break;
}
var name = mw.Core.Graph.FindName(gt);
var ig = mw.Core.Graph.FindGraph(name, AnimatType.Single, mw.Core.Save.Mode);
if (ig != null)
{
var b = mw.Main.FindDisplayBorder(ig);
ig.Run(b, item.ImageSource, () =>
{ {
Dispatcher.Invoke(() => IsEnabled = true); default:
mw.Main.DisplayToNomal(); gt = GraphType.Eat;
mw.Main.EventTimer_Elapsed(); break;
}); case Food.FoodType.Drink:
gt = GraphType.Drink;
break;
case Food.FoodType.Gift:
gt = GraphType.Gift;
break;
}
var name = mw.Core.Graph.FindName(gt);
var ig = mw.Core.Graph.FindGraph(name, AnimatType.Single, mw.Core.Save.Mode);
if (ig != null)
{
var b = mw.Main.FindDisplayBorder(ig);
ig.Run(b, item.ImageSource, () =>
{
showeatanm = true;
mw.Main.DisplayToNomal();
mw.Main.EventTimer_Elapsed();
});
}
} }
if (!_puswitch.IsChecked.Value) if (!_puswitch.IsChecked.Value)
{ {