mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
主人称呼功能(未完成) #291
This commit is contained in:
parent
9808de0396
commit
934595bd6d
@ -15,6 +15,7 @@ namespace VPet_Simulator.Core
|
||||
/// </summary>
|
||||
[Line(name: "name")]
|
||||
public string Name { get; set; }
|
||||
public string HostName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金钱
|
||||
|
@ -11,7 +11,10 @@ namespace VPet_Simulator.Core
|
||||
/// 宠物名字
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主人称呼
|
||||
/// </summary>
|
||||
string HostName { get; set; }
|
||||
/// <summary>
|
||||
/// 金钱
|
||||
/// </summary>
|
||||
|
@ -16,6 +16,7 @@ public class GameSave_VPet : IGameSave
|
||||
/// </summary>
|
||||
[Line(name: "name")]
|
||||
public string Name { get; set; }
|
||||
public string HostName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金钱
|
||||
|
@ -139,25 +139,5 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// 检查部分状态是否满足需求
|
||||
/// </summary>之所以不是全部的,是因为挨个取效率太差了
|
||||
public virtual bool CheckState(Main m) => CheckState(m.Core.Save);
|
||||
|
||||
/// <summary>
|
||||
/// 将文本转换成实际值
|
||||
/// </summary>
|
||||
public string ConverText(Main m) => ConverText(TranslateText, m);
|
||||
/// <summary>
|
||||
/// 将文本转换成实际值
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 class IText
|
||||
/// </summary>
|
||||
public bool FindTag(string[] tags) => tags.Any(tag => this.tags.Contains(tag));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将文本转换成实际值
|
||||
/// </summary>
|
||||
public string ConverText(Main m) => ConverText(TranslateText, m);
|
||||
/// <summary>
|
||||
/// 将文本转换成实际值
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user