Roman 787b285227 任务:新建项目 导入必要的插件
1.导入URP
2.配置了URP
3.导入Dotween
4.导入Odin
5.导入了InputSystem
6.设置项目为新旧输入系统并用
7.导入了FunGus
8.创建了一些空文件夹

我是每日提醒上班小助手,今天你上班了吗?😺
2022-03-10 22:49:14 +08:00

105 lines
3.1 KiB
C#
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#if NETFX_CORE
using MarkerMetro.Unity.WinLegacy.Reflection;
#endif
namespace Fungus
{
/// <summary>
/// Replaces special tokens in a string with substituted values (typically variables or localisation strings).
/// </summary>
public class StringSubstituter : IStringSubstituter
{
protected static List<ISubstitutionHandler> substitutionHandlers = new List<ISubstitutionHandler>();
/// <summary>
/// The StringBuilder instance used to substitute strings optimally.
/// </summary>
protected StringBuilder stringBuilder;
protected int recursionDepth;
#region Public members
public static void RegisterHandler(ISubstitutionHandler handler)
{
if (!substitutionHandlers.Contains(handler))
{
substitutionHandlers.Add(handler);
}
}
public static void UnregisterHandler(ISubstitutionHandler handler)
{
substitutionHandlers.Remove(handler);
}
/// <summary>
/// Constructor which caches all components in the scene that implement ISubstitutionHandler.
/// <param name="recursionDepth">Number of levels of recursively embedded keys to resolve.</param>
/// </summary>
public StringSubstituter(int recursionDepth = 5)
{
stringBuilder = new StringBuilder(1024);
this.recursionDepth = recursionDepth;
}
#endregion
#region IStringSubstituter implementation
public virtual StringBuilder _StringBuilder { get { return stringBuilder; } }
public virtual string SubstituteStrings(string input)
{
stringBuilder.Length = 0;
stringBuilder.Append(input);
if (SubstituteStrings(stringBuilder))
{
return stringBuilder.ToString();
}
else
{
return input; // String wasn't modified
}
}
public virtual bool SubstituteStrings(StringBuilder input)
{
bool result = false;
// Perform the substitution multiple times to expand nested keys
int loopCount = 0; // Avoid infinite recursion loops
while (loopCount < recursionDepth)
{
bool modified = false;
foreach (ISubstitutionHandler handler in substitutionHandlers)
{
if (handler.SubstituteStrings(input))
{
modified = true;
result = true;
}
}
if (!modified)
{
break;
}
loopCount++;
}
return result;
}
#endregion
}
}