From f304538a36a4fb78033b9893bd532f62bf54c0a6 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 12 Sep 2016 12:42:37 +0100 Subject: [PATCH] Refactored CustomTag to use ICustomTag interface --- Assets/Fungus/Narrative/Scripts/CustomTag.cs | 20 ++++++++++--- Assets/Fungus/Narrative/Scripts/ICustomTag.cs | 28 +++++++++++++++++++ .../Narrative/Scripts/ICustomTag.cs.meta | 12 ++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 Assets/Fungus/Narrative/Scripts/ICustomTag.cs create mode 100644 Assets/Fungus/Narrative/Scripts/ICustomTag.cs.meta diff --git a/Assets/Fungus/Narrative/Scripts/CustomTag.cs b/Assets/Fungus/Narrative/Scripts/CustomTag.cs index 73a244df..de1314ea 100644 --- a/Assets/Fungus/Narrative/Scripts/CustomTag.cs +++ b/Assets/Fungus/Narrative/Scripts/CustomTag.cs @@ -12,17 +12,17 @@ namespace Fungus [ExecuteInEditMode] public class CustomTag : MonoBehaviour { + [Tooltip("String that defines the start of the tag.")] [SerializeField] protected string tagStartSymbol; - public virtual string TagStartSymbol { get { return tagStartSymbol; } } + [Tooltip("String that defines the end of the tag.")] [SerializeField] protected string tagEndSymbol; - public virtual string TagEndSymbol { get { return tagEndSymbol; } } + [Tooltip("String to replace the start tag with.")] [SerializeField] protected string replaceTagStartWith; - public virtual string ReplaceTagStartWith { get { return replaceTagStartWith; } } + [Tooltip("String to replace the end tag with.")] [SerializeField] protected string replaceTagEndWith; - public virtual string ReplaceTagEndWith { get { return replaceTagEndWith; } } static public List activeCustomTags = new List(); @@ -38,5 +38,17 @@ namespace Fungus { 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 } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/ICustomTag.cs b/Assets/Fungus/Narrative/Scripts/ICustomTag.cs new file mode 100644 index 00000000..d0f38781 --- /dev/null +++ b/Assets/Fungus/Narrative/Scripts/ICustomTag.cs @@ -0,0 +1,28 @@ +namespace Fungus +{ + /// + /// Create custom tags for use in Say text. + /// + public interface ICustomTag + { + /// + /// String that defines the start of the tag. + /// + string TagStartSymbol { get; } + + /// + /// String that defines the end of the tag. + /// + string TagEndSymbol { get; } + + /// + /// String to replace the start tag with. + /// + string ReplaceTagStartWith { get; } + + /// + /// String to replace the end tag with. + /// + string ReplaceTagEndWith { get; } + } +} diff --git a/Assets/Fungus/Narrative/Scripts/ICustomTag.cs.meta b/Assets/Fungus/Narrative/Scripts/ICustomTag.cs.meta new file mode 100644 index 00000000..b6b9ec49 --- /dev/null +++ b/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: