支持连续吃东西

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,6 +262,9 @@ namespace VPet_Simulator.Windows
} }
} }
if (showeatanm)
{//显示动画
showeatanm = false;
GraphType gt; GraphType gt;
switch (item.Type) switch (item.Type)
{ {
@ -274,11 +285,12 @@ namespace VPet_Simulator.Windows
var b = mw.Main.FindDisplayBorder(ig); var b = mw.Main.FindDisplayBorder(ig);
ig.Run(b, item.ImageSource, () => ig.Run(b, item.ImageSource, () =>
{ {
Dispatcher.Invoke(() => IsEnabled = true); showeatanm = true;
mw.Main.DisplayToNomal(); mw.Main.DisplayToNomal();
mw.Main.EventTimer_Elapsed(); mw.Main.EventTimer_Elapsed();
}); });
} }
}
if (!_puswitch.IsChecked.Value) if (!_puswitch.IsChecked.Value)
{ {
TryClose(); TryClose();