From 51e577e673c7157bdc88267cff8f06c76cfcce6e Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 28 Mar 2024 15:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A6=82=E6=9E=9C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=8F=AF=E4=BB=A5=E8=AF=B4=E7=9A=84=E8=AF=9D=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/MainWindow.cs | 36 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 74f9dfa..2c5f719 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -556,17 +556,20 @@ namespace VPet_Simulator.Windows if (Core.Save.StrengthFood > sm * 0.60) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else if (Core.Save.StrengthFood > sm * 0.40) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Hunger, AnimatType.Single, Main.DisplayToNomal)); return; @@ -580,17 +583,20 @@ namespace VPet_Simulator.Windows if (Core.Save.StrengthDrink > sm * 0.60) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else if (Core.Save.StrengthDrink > sm * 0.40) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Thirsty, AnimatType.Single, Main.DisplayToNomal)); return; @@ -607,17 +613,20 @@ namespace VPet_Simulator.Windows if (Core.Save.StrengthFood > sm * 0.40) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else if (Core.Save.StrengthFood > sm20) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Hunger, AnimatType.Single, Main.DisplayToNomal)); return; @@ -630,17 +639,20 @@ namespace VPet_Simulator.Windows if (Core.Save.StrengthDrink > sm * 0.40) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else if (Core.Save.StrengthDrink > sm20) { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } else { txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); - Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); + if (txt.Count != 0) + Main.Say(txt[Function.Rnd.Next(txt.Count)].TranslateText); } Main.DisplayStopForce(() => Main.Display(GraphType.Switch_Thirsty, AnimatType.Single, Main.DisplayToNomal)); return;