keyword + animation
This commit is contained in:
@@ -9,19 +9,34 @@ namespace Continentis.MainGame
|
||||
{
|
||||
public partial class DynamicTextInterpreter
|
||||
{
|
||||
public static string Parse(Interpreter interpreter, string template, List<string> keywords, List<string> hintKeywords)
|
||||
public static void InitializeInterpreter(ref Interpreter interpreter)
|
||||
{
|
||||
interpreter.UnsetFunction("Keyword");
|
||||
interpreter.SetFunction("Keyword", new Func<string, string>(kw => SetKeyword(ref keywords, kw, "#FFA500")));
|
||||
interpreter.UnsetFunction("HintKeyword");
|
||||
interpreter.SetFunction("HintKeyword", new Func<string, string>(kw => SetKeyword(ref hintKeywords, kw, "#FFA500")));
|
||||
interpreter.SetFunction("HintKeyword", new Func<string, string, string>((kw, colorHex) => SetKeyword(ref hintKeywords, kw, colorHex)));
|
||||
interpreter.UnsetFunction("DescKeyword");
|
||||
interpreter.SetFunction("Keyword", new Func<string, string>(kw => SetKeyword(kw, "#FFA500")));
|
||||
interpreter.SetFunction("HintKeyword", new Func<string, string>(kw => SetKeyword(kw, "#FFA500")));
|
||||
interpreter.SetFunction("HintKeyword", new Func<string, string, string>(SetKeyword));
|
||||
interpreter.SetFunction("DescKeyword", new Func<string, string>(kw =>DescKeyword(kw, "#FFA500")));
|
||||
interpreter.SetFunction("DescKeyword", new Func<string, string, string>(DescKeyword));
|
||||
interpreter.UnsetFunction("ColorText");
|
||||
interpreter.SetFunction("ColorText", new Func<string, string, string>(ColorText));
|
||||
|
||||
interpreter.SetFunction("Value", new Func<float, string>((cv) => GetValue(cv, false)));
|
||||
interpreter.SetFunction("Value", new Func<float, float, string>((cv, bv) => GetValue(cv, bv, true, false)));
|
||||
interpreter.SetFunction("Value", new Func<float, float, bool, string>((cv, bv, high) => GetValue(cv, bv, high, false)));
|
||||
interpreter.SetFunction("Value", new Func<float, float, bool, bool, string>((cv, bv, high, percent) => GetValue(cv, bv, high, percent)));
|
||||
|
||||
//本地函数,用于添加关键词到集合中并返回格式化后的关键词字符串
|
||||
string SetKeyword(string keyword, string colorHex)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
return Keyword(keyword, colorHex);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static string Parse(Interpreter interpreter, string template)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (template.Contains("$"))
|
||||
@@ -49,17 +64,6 @@ namespace Continentis.MainGame
|
||||
}
|
||||
|
||||
return template;
|
||||
|
||||
//本地函数,用于添加关键词到集合中并返回格式化后的关键词字符串
|
||||
string SetKeyword(ref List<string> collection, string keyword, string colorHex)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(keyword) && !collection.Contains(keyword))
|
||||
{
|
||||
collection.Add(keyword);
|
||||
}
|
||||
|
||||
return Keyword(keyword, colorHex);
|
||||
}
|
||||
}
|
||||
|
||||
private static int FindMatchingClosingParenthesis(string text, int startIndex)
|
||||
|
||||
Reference in New Issue
Block a user