Browse Source

Refactored CustomTag to use ICustomTag interface

master
Christopher 8 years ago
parent
commit
f304538a36
  1. 20
      Assets/Fungus/Narrative/Scripts/CustomTag.cs
  2. 28
      Assets/Fungus/Narrative/Scripts/ICustomTag.cs
  3. 12
      Assets/Fungus/Narrative/Scripts/ICustomTag.cs.meta

20
Assets/Fungus/Narrative/Scripts/CustomTag.cs

@ -12,17 +12,17 @@ namespace Fungus
[ExecuteInEditMode] [ExecuteInEditMode]
public class CustomTag : MonoBehaviour public class CustomTag : MonoBehaviour
{ {
[Tooltip("String that defines the start of the tag.")]
[SerializeField] protected string tagStartSymbol; [SerializeField] protected string tagStartSymbol;
public virtual string TagStartSymbol { get { return tagStartSymbol; } }
[Tooltip("String that defines the end of the tag.")]
[SerializeField] protected string tagEndSymbol; [SerializeField] protected string tagEndSymbol;
public virtual string TagEndSymbol { get { return tagEndSymbol; } }
[Tooltip("String to replace the start tag with.")]
[SerializeField] protected string replaceTagStartWith; [SerializeField] protected string replaceTagStartWith;
public virtual string ReplaceTagStartWith { get { return replaceTagStartWith; } }
[Tooltip("String to replace the end tag with.")]
[SerializeField] protected string replaceTagEndWith; [SerializeField] protected string replaceTagEndWith;
public virtual string ReplaceTagEndWith { get { return replaceTagEndWith; } }
static public List<CustomTag> activeCustomTags = new List<CustomTag>(); static public List<CustomTag> activeCustomTags = new List<CustomTag>();
@ -38,5 +38,17 @@ namespace Fungus
{ {
activeCustomTags.Remove(this); activeCustomTags.Remove(this);
} }
#region ICustomTag implementation
public virtual string TagStartSymbol { get { return tagStartSymbol; } }
public virtual string TagEndSymbol { get { return tagEndSymbol; } }
public virtual string ReplaceTagStartWith { get { return replaceTagStartWith; } }
public virtual string ReplaceTagEndWith { get { return replaceTagEndWith; } }
#endregion
} }
} }

28
Assets/Fungus/Narrative/Scripts/ICustomTag.cs

@ -0,0 +1,28 @@
namespace Fungus
{
/// <summary>
/// Create custom tags for use in Say text.
/// </summary>
public interface ICustomTag
{
/// <summary>
/// String that defines the start of the tag.
/// </summary>
string TagStartSymbol { get; }
/// <summary>
/// String that defines the end of the tag.
/// </summary>
string TagEndSymbol { get; }
/// <summary>
/// String to replace the start tag with.
/// </summary>
string ReplaceTagStartWith { get; }
/// <summary>
/// String to replace the end tag with.
/// </summary>
string ReplaceTagEndWith { get; }
}
}

12
Assets/Fungus/Narrative/Scripts/ICustomTag.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 59af36c15380c4854860339298d3779e
timeCreated: 1473680400
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save