diff --git a/Assets/Fungus/Narrative/Scripts/SayDialog.cs b/Assets/Fungus/Narrative/Scripts/SayDialog.cs index 04c6fd75..af952248 100644 --- a/Assets/Fungus/Narrative/Scripts/SayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/SayDialog.cs @@ -161,10 +161,10 @@ namespace Fungus { Writer writer = GetWriter(); - if (writer.isWriting || writer.isWaitingForInput) + if (writer.IsWriting || writer.IsWaitingForInput) { writer.Stop(); - while (writer.isWriting || writer.isWaitingForInput) + while (writer.IsWriting || writer.IsWaitingForInput) { yield return null; } @@ -196,7 +196,7 @@ namespace Fungus if (continueButton != null) { - continueButton.gameObject.SetActive( GetWriter().isWaitingForInput ); + continueButton.gameObject.SetActive( GetWriter().IsWaitingForInput ); } } @@ -219,7 +219,7 @@ namespace Fungus protected virtual void UpdateAlpha() { - if (GetWriter().isWriting) + if (GetWriter().IsWriting) { targetAlpha = 1f; fadeCoolDownTimer = 0.1f; diff --git a/Assets/Fungus/UI/Scripts/Commands/FadeUI.cs b/Assets/Fungus/UI/Scripts/Commands/FadeUI.cs index 24b09a64..d1d9288d 100644 --- a/Assets/Fungus/UI/Scripts/Commands/FadeUI.cs +++ b/Assets/Fungus/UI/Scripts/Commands/FadeUI.cs @@ -23,11 +23,11 @@ namespace Fungus Color } - public FadeMode fadeMode = FadeMode.Alpha; + [SerializeField] protected FadeMode fadeMode = FadeMode.Alpha; - public ColorData targetColor = new ColorData(Color.white); + [SerializeField] protected ColorData targetColor = new ColorData(Color.white); - public FloatData targetAlpha = new FloatData(1f); + [SerializeField] protected FloatData targetAlpha = new FloatData(1f); protected override void ApplyTween(GameObject go) { diff --git a/Assets/Fungus/UI/Scripts/Commands/GetText.cs b/Assets/Fungus/UI/Scripts/Commands/GetText.cs index a8bd4e7d..7e25e92d 100644 --- a/Assets/Fungus/UI/Scripts/Commands/GetText.cs +++ b/Assets/Fungus/UI/Scripts/Commands/GetText.cs @@ -19,11 +19,11 @@ namespace Fungus public class GetText : Command { [Tooltip("Text object to get text value from")] - public GameObject targetTextObject; + [SerializeField] protected GameObject targetTextObject; [Tooltip("String variable to store the text value in")] [VariableProperty(typeof(StringVariable))] - public StringVariable stringVariable; + [SerializeField] protected StringVariable stringVariable; public override void OnEnter() { diff --git a/Assets/Fungus/UI/Scripts/Commands/SetInteractable.cs b/Assets/Fungus/UI/Scripts/Commands/SetInteractable.cs index 92f0b372..c79bd07c 100644 --- a/Assets/Fungus/UI/Scripts/Commands/SetInteractable.cs +++ b/Assets/Fungus/UI/Scripts/Commands/SetInteractable.cs @@ -17,10 +17,10 @@ namespace Fungus public class SetInteractable : Command { [Tooltip("List of objects to be affected by the command")] - public List targetObjects = new List(); + [SerializeField] protected List targetObjects = new List(); [Tooltip("Controls if the selectable UI object be interactable or not")] - public BooleanData interactableState = new BooleanData(true); + [SerializeField] protected BooleanData interactableState = new BooleanData(true); public override void OnEnter() { diff --git a/Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs b/Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs index f9ef29eb..e91e9434 100644 --- a/Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs +++ b/Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs @@ -16,10 +16,10 @@ namespace Fungus public class SetSliderValue : Command { [Tooltip("Target slider object to set the value on")] - public Slider slider; + [SerializeField] protected Slider slider; [Tooltip("Float value to set the slider value to.")] - public FloatData value; + [SerializeField] protected FloatData value; public override void OnEnter() { diff --git a/Assets/Fungus/UI/Scripts/Commands/SetText.cs b/Assets/Fungus/UI/Scripts/Commands/SetText.cs index 4aa7255b..2c112272 100644 --- a/Assets/Fungus/UI/Scripts/Commands/SetText.cs +++ b/Assets/Fungus/UI/Scripts/Commands/SetText.cs @@ -19,14 +19,14 @@ namespace Fungus public class SetText : Command, ILocalizable { [Tooltip("Text object to set text on. Can be a UI Text, Text Field or Text Mesh object.")] - public GameObject targetTextObject; + [SerializeField] protected GameObject targetTextObject; [Tooltip("String value to assign to the text object")] [FormerlySerializedAs("stringData")] - public StringDataMulti text; + [SerializeField] protected StringDataMulti text; [Tooltip("Notes about this story text for other authors, localization, etc.")] - public string description; + [SerializeField] protected string description; public override void OnEnter() { diff --git a/Assets/Fungus/UI/Scripts/Commands/TweenUI.cs b/Assets/Fungus/UI/Scripts/Commands/TweenUI.cs index 0c0a34e8..b982c84a 100644 --- a/Assets/Fungus/UI/Scripts/Commands/TweenUI.cs +++ b/Assets/Fungus/UI/Scripts/Commands/TweenUI.cs @@ -15,16 +15,16 @@ namespace Fungus public abstract class TweenUI : Command { [Tooltip("List of objects to be affected by the tween")] - public List targetObjects = new List(); + [SerializeField] protected List targetObjects = new List(); [Tooltip("Type of tween easing to apply")] - public LeanTweenType tweenType = LeanTweenType.easeOutQuad; + [SerializeField] protected LeanTweenType tweenType = LeanTweenType.easeOutQuad; [Tooltip("Wait until this command completes before continuing execution")] - public BooleanData waitUntilFinished = new BooleanData(true); + [SerializeField] protected BooleanData waitUntilFinished = new BooleanData(true); [Tooltip("Time for the tween to complete")] - public FloatData duration = new FloatData(1f); + [SerializeField] protected FloatData duration = new FloatData(1f); public override void OnEnter() { diff --git a/Assets/Fungus/UI/Scripts/Commands/Write.cs b/Assets/Fungus/UI/Scripts/Commands/Write.cs index c068327e..dd4ebe14 100644 --- a/Assets/Fungus/UI/Scripts/Commands/Write.cs +++ b/Assets/Fungus/UI/Scripts/Commands/Write.cs @@ -19,19 +19,19 @@ namespace Fungus public class Write : Command, ILocalizable { [Tooltip("Text object to set text on. Text, Input Field and Text Mesh objects are supported.")] - public GameObject textObject; + [SerializeField] protected GameObject textObject; [Tooltip("String value to assign to the text object")] - public StringDataMulti text; + [SerializeField] protected StringDataMulti text; [Tooltip("Notes about this story text for other authors, localization, etc.")] - public string description; + [SerializeField] protected string description; [Tooltip("Clear existing text before writing new text")] - public bool clearText = true; + [SerializeField] protected bool clearText = true; [Tooltip("Wait until this command finishes before executing the next command")] - public bool waitUntilFinished = true; + [SerializeField] protected bool waitUntilFinished = true; public enum TextColor { @@ -41,11 +41,11 @@ namespace Fungus SetColor } - public TextColor textColor = TextColor.Default; + [SerializeField] protected TextColor textColor = TextColor.Default; - public FloatData setAlpha = new FloatData(1f); + [SerializeField] protected FloatData setAlpha = new FloatData(1f); - public ColorData setColor = new ColorData(Color.white); + [SerializeField] protected ColorData setColor = new ColorData(Color.white); protected Writer GetWriter() { diff --git a/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs b/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs index 7e1fd8d9..8597582a 100644 --- a/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs +++ b/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs @@ -16,7 +16,7 @@ namespace Fungus public class ButtonClicked : EventHandler { [Tooltip("The UI Button that the user can click on")] - public Button targetButton; + [SerializeField] protected Button targetButton; public virtual void Start() { diff --git a/Assets/Fungus/UI/Scripts/EventHandlers/EndEdit.cs b/Assets/Fungus/UI/Scripts/EventHandlers/EndEdit.cs index 4ff57e9b..5fc7510b 100644 --- a/Assets/Fungus/UI/Scripts/EventHandlers/EndEdit.cs +++ b/Assets/Fungus/UI/Scripts/EventHandlers/EndEdit.cs @@ -16,7 +16,7 @@ namespace Fungus public class EndEdit : EventHandler { [Tooltip("The UI Input Field that the user can enter text into")] - public InputField targetInputField; + [SerializeField] protected InputField targetInputField; public virtual void Start() { diff --git a/Assets/Fungus/UI/Scripts/Writer.cs b/Assets/Fungus/UI/Scripts/Writer.cs index c33cbe6d..6ca1e0ad 100644 --- a/Assets/Fungus/UI/Scripts/Writer.cs +++ b/Assets/Fungus/UI/Scripts/Writer.cs @@ -45,36 +45,38 @@ namespace Fungus public class Writer : MonoBehaviour, IDialogInputListener { [Tooltip("Gameobject containing a Text, Inout Field or Text Mesh object to write to")] - public GameObject targetTextObject; + [SerializeField] protected GameObject targetTextObject; [Tooltip("Gameobject to punch when the punch tags are displayed. If none is set, the main camera will shake instead.")] - public GameObject punchObject; + [SerializeField] protected GameObject punchObject; [Tooltip("Writing characters per second")] - public float writingSpeed = 60; + [SerializeField] protected float writingSpeed = 60; [Tooltip("Pause duration for punctuation characters")] - public float punctuationPause = 0.25f; + [SerializeField] protected float punctuationPause = 0.25f; [Tooltip("Color of text that has not been revealed yet")] - public Color hiddenTextColor = new Color(1,1,1,0); + [SerializeField] protected Color hiddenTextColor = new Color(1,1,1,0); [Tooltip("Write one word at a time rather one character at a time")] - public bool writeWholeWords = false; + [SerializeField] protected bool writeWholeWords = false; [Tooltip("Force the target text object to use Rich Text mode so text color and alpha appears correctly")] - public bool forceRichText = true; + [SerializeField] protected bool forceRichText = true; [Tooltip("Click while text is writing to finish writing immediately")] - public bool instantComplete = true; + [SerializeField] protected bool instantComplete = true; // This property is true when the writer is waiting for user input to continue - [System.NonSerialized] - public bool isWaitingForInput; + protected bool isWaitingForInput; + + public bool IsWaitingForInput { get { return isWaitingForInput; } } // This property is true when the writer is writing text or waiting (i.e. still processing tokens) - [System.NonSerialized] - public bool isWriting; + protected bool isWriting; + + public bool IsWriting { get { return isWriting; } } protected float currentWritingSpeed; protected float currentPunctuationPause; diff --git a/Assets/Tests/Narrative/NarrativeTests.unity b/Assets/Tests/Narrative/NarrativeTests.unity index 35d63b5a..95f4e393 100644 --- a/Assets/Tests/Narrative/NarrativeTests.unity +++ b/Assets/Tests/Narrative/NarrativeTests.unity @@ -117,7 +117,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 736071350} + selectedFlowchart: {fileID: 861253873} --- !u!4 &11556238 Transform: m_ObjectHideFlags: 1 @@ -7787,7 +7787,7 @@ MonoBehaviour: parentBlock: {fileID: 861253875} --- !u!114 &861253878 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 861253871} @@ -7811,7 +7811,7 @@ MonoBehaviour: - {fileID: 861253879} --- !u!114 &861253879 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 861253871} @@ -7837,7 +7837,7 @@ MonoBehaviour: callMode: 0 --- !u!114 &861253880 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 861253871} @@ -7854,7 +7854,7 @@ MonoBehaviour: durationOLD: 0 --- !u!114 &861253881 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 861253871} @@ -17014,7 +17014,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1929911610 Transform: m_ObjectHideFlags: 0 @@ -17065,7 +17065,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: go: {fileID: 1125936939} - thisPropertyPath: Writer.isWriting + thisPropertyPath: Writer.IsWriting compareToType: 1 other: {fileID: 0} otherPropertyPath: