diff --git a/VPet-Simulator.Core/Handle/GameSave.cs b/VPet-Simulator.Core/Handle/GameSave.cs index b2a861f9..24eb0873 100644 --- a/VPet-Simulator.Core/Handle/GameSave.cs +++ b/VPet-Simulator.Core/Handle/GameSave.cs @@ -15,6 +15,7 @@ public class GameSave : IGameSave /// [Line(name: "name")] public string Name { get; set; } + public string HostName { get; set; } /// /// 金钱 diff --git a/VPet-Simulator.Core/Handle/IGameSave.cs b/VPet-Simulator.Core/Handle/IGameSave.cs index b644d10b..d66c20f1 100644 --- a/VPet-Simulator.Core/Handle/IGameSave.cs +++ b/VPet-Simulator.Core/Handle/IGameSave.cs @@ -11,7 +11,10 @@ public interface IGameSave /// 宠物名字 /// string Name { get; set; } - + /// + /// 主人称呼 + /// + string HostName { get; set; } /// /// 金钱 /// diff --git a/VPet-Simulator.Windows.Interface/GameSave_VPet.cs b/VPet-Simulator.Windows.Interface/GameSave_VPet.cs index f5a9110b..c60e639a 100644 --- a/VPet-Simulator.Windows.Interface/GameSave_VPet.cs +++ b/VPet-Simulator.Windows.Interface/GameSave_VPet.cs @@ -16,6 +16,7 @@ public class GameSave_VPet : IGameSave /// [Line(name: "name")] public string Name { get; set; } + public string HostName { get; set; } /// /// 金钱 diff --git a/VPet-Simulator.Windows.Interface/Mod/ICheckText.cs b/VPet-Simulator.Windows.Interface/Mod/ICheckText.cs index b8ecbc57..1b542fa5 100644 --- a/VPet-Simulator.Windows.Interface/Mod/ICheckText.cs +++ b/VPet-Simulator.Windows.Interface/Mod/ICheckText.cs @@ -139,25 +139,5 @@ public virtual bool CheckState(IGameSave save) /// 检查部分状态是否满足需求 /// 之所以不是全部的,是因为挨个取效率太差了 public virtual bool CheckState(Main m) => CheckState(m.Core.Save); - - /// - /// 将文本转换成实际值 - /// - public string ConverText(Main m) => ConverText(TranslateText, m); - /// - /// 将文本转换成实际值 - /// - public static string ConverText(string text, Main m) - { - if (text.Contains('{') && text.Contains('}')) - { - return text.Replace("{name}", m.Core.Save.Name).Replace("{food}", m.Core.Save.StrengthFood.ToString("f0")) - .Replace("{drink}", m.Core.Save.StrengthDrink.ToString("f0")).Replace("{feel}", m.Core.Save.Feeling.ToString("f0")). - Replace("{strength}", m.Core.Save.Strength.ToString("f0")).Replace("{money}", m.Core.Save.Money.ToString("f0")) - .Replace("{level}", m.Core.Save.Level.ToString("f0")).Replace("{health}", m.Core.Save.Health.ToString("f0")); - } - else - return text; - } } } diff --git a/VPet-Simulator.Windows.Interface/Mod/IText.cs b/VPet-Simulator.Windows.Interface/Mod/IText.cs index cbf3cfa3..bf7bf4cc 100644 --- a/VPet-Simulator.Windows.Interface/Mod/IText.cs +++ b/VPet-Simulator.Windows.Interface/Mod/IText.cs @@ -2,6 +2,7 @@ using LinePutScript.Localization.WPF; using System; using System.Linq; +using VPet_Simulator.Core; namespace VPet_Simulator.Windows.Interface; @@ -47,4 +48,25 @@ public string Tag /// public bool FindTag(string[] tags) => tags.Any(tag => this.tags.Contains(tag)); + + /// + /// 将文本转换成实际值 + /// + public string ConverText(Main m) => ConverText(TranslateText, m); + /// + /// 将文本转换成实际值 + /// + public static string ConverText(string text, Main m) + { + if (text.Contains('{') && text.Contains('}')) + { + return text.Replace("{name}", m.Core.Save.Name).Replace("{food}", m.Core.Save.StrengthFood.ToString("f0")) + .Replace("{drink}", m.Core.Save.StrengthDrink.ToString("f0")).Replace("{feel}", m.Core.Save.Feeling.ToString("f0")). + Replace("{strength}", m.Core.Save.Strength.ToString("f0")).Replace("{money}", m.Core.Save.Money.ToString("f0")) + .Replace("{level}", m.Core.Save.Level.ToString("f0")).Replace("{health}", m.Core.Save.Health.ToString("f0")) + .Replace("{hostname}", m.Core.Save.HostName); + } + else + return text; + } }