From f94e46e42dae465f562b8e5c8a2dafd349f2d01e Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 23 Aug 2016 16:07:01 +0100 Subject: [PATCH] Refactored narrative comments --- .../Fungus/Lua/Scripts/Commands/ExecuteLua.cs | 5 +- Assets/Fungus/Narrative/Scripts/Character.cs | 12 +- .../Narrative/Scripts/Commands/ClearMenu.cs | 5 +- .../Scripts/Commands/ControlStage.cs | 5 +- .../Scripts/Commands/Conversation.cs | 4 +- .../Fungus/Narrative/Scripts/Commands/Menu.cs | 5 +- .../Narrative/Scripts/Commands/MenuTimer.cs | 6 +- .../Narrative/Scripts/Commands/Portrait.cs | 21 +--- .../Fungus/Narrative/Scripts/Commands/Say.cs | 9 +- .../Narrative/Scripts/Commands/SetLanguage.cs | 4 +- .../Scripts/Commands/SetMenuDialog.cs | 5 +- .../Scripts/Commands/SetSayDialog.cs | 5 +- .../Narrative/Scripts/ConversationManager.cs | 6 +- Assets/Fungus/Narrative/Scripts/CustomTag.cs | 11 +- .../Fungus/Narrative/Scripts/DialogInput.cs | 23 ++-- .../Fungus/Narrative/Scripts/Localization.cs | 110 +++++++++--------- Assets/Fungus/Narrative/Scripts/MenuDialog.cs | 9 +- .../Narrative/Scripts/PortraitController.cs | 23 ++-- Assets/Fungus/Narrative/Scripts/SayDialog.cs | 18 ++- Assets/Fungus/Narrative/Scripts/Stage.cs | 15 +-- 20 files changed, 135 insertions(+), 166 deletions(-) diff --git a/Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs b/Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs index 240abe78..90f57e9b 100644 --- a/Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs +++ b/Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs @@ -4,13 +4,14 @@ */ using UnityEngine; -using System.Collections; using Fungus; using MoonSharp.Interpreter; namespace Fungus { - + /// + /// Executes a Lua code chunk using a Lua Environment. + /// [CommandInfo("Scripting", "Execute Lua", "Executes a Lua code chunk using a Lua Environment.")] diff --git a/Assets/Fungus/Narrative/Scripts/Character.cs b/Assets/Fungus/Narrative/Scripts/Character.cs index 751ebfdd..8b7df495 100644 --- a/Assets/Fungus/Narrative/Scripts/Character.cs +++ b/Assets/Fungus/Narrative/Scripts/Character.cs @@ -5,47 +5,41 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; using System.Collections.Generic; using System; namespace Fungus { + /// + /// A Character that can be used in dialogue via the Say, Conversation and Portrait commands. + /// [ExecuteInEditMode] public class Character : MonoBehaviour, ILocalizable { [SerializeField] protected string nameText; // We need a separate name as the object name is used for character variations (e.g. "Smurf Happy", "Smurf Sad") - public string NameText { get { return nameText; } } [SerializeField] protected Color nameColor = Color.white; - public Color NameColor { get { return nameColor; } } [SerializeField] protected AudioClip soundEffect; - public AudioClip SoundEffect { get { return soundEffect; } } [SerializeField] protected Sprite profileSprite; - public Sprite ProfileSprite { get { return profileSprite; } set { profileSprite = value; } } [SerializeField] protected List portraits; - public List Portraits { get { return portraits; } } [SerializeField] protected FacingDirection portraitsFace; - public FacingDirection PortraitsFace { get { return portraitsFace; } } [SerializeField] protected PortraitState state = new PortraitState(); - public PortraitState State { get { return state; } } [Tooltip("Sets the active Say dialog with a reference to a Say Dialog object in the scene. All story text will now display using this Say Dialog.")] [SerializeField] protected SayDialog setSayDialog; - public SayDialog SetSayDialog { get { return setSayDialog; } } [FormerlySerializedAs("notes")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs b/Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs index f9729e64..c9847821 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - + /// + /// Clears the options from a menu dialogue. + /// [CommandInfo("Narrative", "Clear Menu", "Clears the options from a menu dialogue")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs b/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs index 838b79d7..5f245b20 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs @@ -23,6 +23,9 @@ namespace Fungus DimNonSpeakingPortraits } + /// + /// Controls the stage on which character portraits are displayed. + /// [CommandInfo("Narrative", "Control Stage", "Controls the stage on which character portraits are displayed.")] @@ -30,7 +33,6 @@ namespace Fungus { [Tooltip("Stage to display characters on")] [SerializeField] protected Stage stage; - public Stage _Stage { get { return stage; } } [Tooltip("Stage to swap with")] @@ -38,7 +40,6 @@ namespace Fungus [Tooltip("Use Default Settings")] [SerializeField] protected bool useDefaultSettings = true; - public bool UseDefaultSettings { get { return useDefaultSettings; } } [Tooltip("Fade Duration")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs index f4c391fa..8b614d5a 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs @@ -4,11 +4,13 @@ */ using UnityEngine; -using UnityEngine.Serialization; using System.Collections; namespace Fungus { + /// + /// Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]. + /// [CommandInfo("Narrative", "Conversation", "Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs b/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs index d064e9df..a837ef2d 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs @@ -5,12 +5,13 @@ using UnityEngine; using UnityEngine.Serialization; -using System; -using System.Collections; using System.Collections.Generic; namespace Fungus { + /// + /// Displays a button in a multiple choice menu. + /// [CommandInfo("Narrative", "Menu", "Displays a button in a multiple choice menu")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs b/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs index 8b5cb43e..722c8ea3 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs @@ -5,13 +5,13 @@ using UnityEngine; using UnityEngine.Serialization; -using UnityEngine.EventSystems; -using System; -using System.Collections; using System.Collections.Generic; namespace Fungus { + /// + /// Displays a timer bar and executes a target block if the player fails to select a menu option in time. + /// [CommandInfo("Narrative", "Menu Timer", "Displays a timer bar and executes a target block if the player fails to select a menu option in time.")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs b/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs index 468154f2..f3e6afe4 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs @@ -4,28 +4,23 @@ */ using UnityEngine; -using UnityEngine.UI; -using UnityEngine.Events; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { - + /// + /// Controls a character portrait. + /// [CommandInfo("Narrative", "Portrait", - "Controls a character portrait. ")] + "Controls a character portrait.")] public class Portrait : ControlWithDisplay { [Tooltip("Stage to display portrait on")] [SerializeField] protected Stage stage; - public Stage _Stage { get { return stage; } set { stage = value; } } [Tooltip("Character to display")] [SerializeField] protected Character character; - public Character _Character { get { return character; } set { character = value; } } [Tooltip("Character to swap with")] @@ -33,32 +28,26 @@ namespace Fungus [Tooltip("Portrait to display")] [SerializeField] protected Sprite portrait; - public Sprite _Portrait { get { return portrait; } set { portrait = value; } } [Tooltip("Move the portrait from/to this offset position")] [SerializeField] protected PositionOffset offset; - public PositionOffset Offset { get { return offset; } set { offset = value; } } [Tooltip("Move the portrait from this position")] [SerializeField] protected RectTransform fromPosition; - public RectTransform FromPosition { get { return fromPosition; } set { fromPosition = value;} } [Tooltip("Move the portrait to this positoin")] [SerializeField] protected RectTransform toPosition; - public RectTransform ToPosition { get { return toPosition; } set { toPosition = value;} } [Tooltip("Direction character is facing")] [SerializeField] protected FacingDirection facing; - public FacingDirection Facing { get { return facing; } set { facing = value; } } [Tooltip("Use Default Settings")] [SerializeField] protected bool useDefaultSettings = true; - public bool UseDefaultSettings { get { return useDefaultSettings; } set { useDefaultSettings = value; } } [Tooltip("Fade Duration")] @@ -72,12 +61,10 @@ namespace Fungus [Tooltip("Move")] [SerializeField] protected bool move; - public bool Move { get { return move; } set { move = value; } } [Tooltip("Start from offset")] [SerializeField] protected bool shiftIntoPlace; - public bool ShiftIntoPlace { get { return shiftIntoPlace; } set { shiftIntoPlace = value; } } [Tooltip("Wait until the tween has finished before executing the next command")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs index d0996f43..02b3c0b7 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Writes text in a dialog box. + /// [CommandInfo("Narrative", "Say", "Writes text in a dialog box.")] @@ -25,12 +25,10 @@ namespace Fungus [Tooltip("Character that is speaking")] [SerializeField] protected Character character; - public Character _Character { get { return character; } } [Tooltip("Portrait that represents speaking character")] [SerializeField] protected Sprite portrait; - public Sprite Portrait { get { return portrait; } set { portrait = value; } } [Tooltip("Voiceover audio to play when writing the text")] @@ -44,7 +42,6 @@ namespace Fungus [Tooltip("Type this text in the previous dialog box.")] [SerializeField] protected bool extendPrevious = false; - public bool ExtendPrevious { get { return extendPrevious; } } [Tooltip("Fade out the dialog box when writing has finished and not waiting for input.")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs index bdadaa01..b959a182 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs @@ -5,10 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; namespace Fungus { + /// + /// Set the active language for the scene. A Localization object with a localization file must be present in the scene. + /// [CommandInfo("Narrative", "Set Language", "Set the active language for the scene. A Localization object with a localization file must be present in the scene.")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs b/Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs index 0e5166f0..0e7d6b60 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Sets a custom menu dialog to use when displaying multiple choice menus. + /// [CommandInfo("Narrative", "Set Menu Dialog", "Sets a custom menu dialog to use when displaying multiple choice menus")] diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs b/Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs index 491e45dc..b8ff328c 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Sets a custom say dialog to use when displaying story text. + /// [CommandInfo("Narrative", "Set Say Dialog", "Sets a custom say dialog to use when displaying story text")] diff --git a/Assets/Fungus/Narrative/Scripts/ConversationManager.cs b/Assets/Fungus/Narrative/Scripts/ConversationManager.cs index af3a3732..31403c9c 100644 --- a/Assets/Fungus/Narrative/Scripts/ConversationManager.cs +++ b/Assets/Fungus/Narrative/Scripts/ConversationManager.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEngine; @@ -7,6 +6,9 @@ using System.Text; namespace Fungus { + /// + /// Helper class to manage parsing and executing the conversation format. + /// public class ConversationManager { protected struct ConversationItem diff --git a/Assets/Fungus/Narrative/Scripts/CustomTag.cs b/Assets/Fungus/Narrative/Scripts/CustomTag.cs index 687fecab..9732f918 100644 --- a/Assets/Fungus/Narrative/Scripts/CustomTag.cs +++ b/Assets/Fungus/Narrative/Scripts/CustomTag.cs @@ -4,30 +4,26 @@ */ using UnityEngine; -using UnityEngine.UI; -using UnityEngine.Events; -using System.Collections; using System.Collections.Generic; namespace Fungus { + /// + /// Create custom tags for use in Say text. + /// [ExecuteInEditMode] public class CustomTag : MonoBehaviour { [SerializeField] protected string tagStartSymbol; - public string TagStartSymbol { get { return tagStartSymbol; } } [SerializeField] protected string tagEndSymbol; - public string TagEndSymbol { get { return tagEndSymbol; } } [SerializeField] protected string replaceTagStartWith; - public string ReplaceTagStartWith { get { return replaceTagStartWith; } } [SerializeField] protected string replaceTagEndWith; - public string ReplaceTagEndWith { get { return replaceTagEndWith; } } static public List activeCustomTags = new List(); @@ -45,5 +41,4 @@ namespace Fungus activeCustomTags.Remove(this); } } - } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/DialogInput.cs b/Assets/Fungus/Narrative/Scripts/DialogInput.cs index 3abf233e..bde00d90 100644 --- a/Assets/Fungus/Narrative/Scripts/DialogInput.cs +++ b/Assets/Fungus/Narrative/Scripts/DialogInput.cs @@ -5,15 +5,20 @@ using UnityEngine; using UnityEngine.EventSystems; -using System.Collections; namespace Fungus { + /// + /// Interface for listening for dialogue input events. + /// public interface IDialogInputListener { void OnNextLineEvent(); } - + + /// + /// Input handler for say dialogues. + /// public class DialogInput : MonoBehaviour { public enum ClickMode @@ -44,17 +49,17 @@ namespace Fungus protected StandaloneInputModule currentStandaloneInputModule; - /** - * Trigger next line input event from script. - */ + /// + /// Trigger next line input event from script. + /// public void SetNextLineFlag() { nextLineInputFlag = true; } - /** - * Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI) - */ + /// + /// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI). + /// public void SetDialogClickedFlag() { // Ignore repeat clicks for a short time to prevent accidentally clicking through the character dialogue @@ -157,6 +162,4 @@ namespace Fungus } } } - } - diff --git a/Assets/Fungus/Narrative/Scripts/Localization.cs b/Assets/Fungus/Narrative/Scripts/Localization.cs index 79d66e0e..cdd298f4 100644 --- a/Assets/Fungus/Narrative/Scripts/Localization.cs +++ b/Assets/Fungus/Narrative/Scripts/Localization.cs @@ -7,17 +7,13 @@ #if UNITY_EDITOR using UnityEditor; #endif -using System; -using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Text; -using System.IO; using Ideafixxxer.CsvParser; namespace Fungus { - public interface ILocalizable { string GetStandardText(); @@ -26,26 +22,25 @@ namespace Fungus string GetStringId(); } - /** - * Multi-language localization support. - */ + /// + /// Multi-language localization support. + /// public class Localization : MonoBehaviour, StringSubstituter.ISubstitutionHandler { - /** - * Language to use at startup, usually defined by a two letter language code (e.g DE = German) - */ + /// + /// Language to use at startup, usually defined by a two letter language code (e.g DE = German). + /// [Tooltip("Language to use at startup, usually defined by a two letter language code (e.g DE = German)")] [SerializeField] protected string activeLanguage = ""; - public string ActiveLanguage { get { return activeLanguage; } } protected static Dictionary localizedStrings = new Dictionary(); protected Dictionary localizeableObjects = new Dictionary(); - /** - * Temp storage for a single item of standard text and its localizations - */ + /// + /// Temp storage for a single item of standard text and its localizations. + /// protected class TextItem { public string description = ""; @@ -53,17 +48,17 @@ namespace Fungus public Dictionary localizedStrings = new Dictionary(); } - /** - * CSV file containing localization data which can be easily edited in a spreadsheet tool. - */ - [Tooltip("CSV file containing localization data which can be easily edited in a spreadsheet tool")] + /// + /// CSV file containing localization data which can be easily edited in a spreadsheet tool. + /// + [Tooltip("CSV file containing localization data which can be easily edited in a spreadsheet tool")] [SerializeField] protected TextAsset localizationFile; public TextAsset LocalizationFile { get { return localizationFile; } set { localizationFile = value; } } - /** - * Stores any notification message from export / import methods. - */ + /// + /// Stores any notification message from export / import methods. + /// protected string notificationText = ""; public string NotificationText { get { return notificationText; } set { notificationText = value; } } @@ -99,10 +94,10 @@ namespace Fungus Init(); } - /** - * String subsitution can happen during the Start of another component, so we - * may need to call Init() from other methods. - */ + /// + /// String subsitution can happen during the Start of another component, so we + /// may need to call Init() from other methods. + /// protected virtual void Init() { if (initialized) @@ -140,11 +135,11 @@ namespace Fungus } } - /** - * Looks up the specified string in the localized strings table. - * For this to work, a localization file and active language must have been set previously. - * Return null if the string is not found. - */ + /// + /// Looks up the specified string in the localized strings table. + /// For this to work, a localization file and active language must have been set previously. + /// Return null if the string is not found. + /// public static string GetLocalizedString(string stringId) { if (localizedStrings == null) @@ -160,9 +155,9 @@ namespace Fungus return null; } - /** - * Convert all text items and localized strings to an easy to edit CSV format. - */ + /// + /// Convert all text items and localized strings to an easy to edit CSV format. + /// public virtual string GetCSVData() { // Collect all the text items present in the scene @@ -222,9 +217,9 @@ namespace Fungus return csvData; } - /** - * Builds a dictionary of localizable text items in the scene. - */ + /// + /// Builds a dictionary of localizable text items in the scene. + /// protected Dictionary FindTextItems() { Dictionary textItems = new Dictionary(); @@ -275,9 +270,9 @@ namespace Fungus return textItems; } - /** - * Adds localized strings from CSV file data to a dictionary of text items in the scene. - */ + /// + /// Adds localized strings from CSV file data to a dictionary of text items in the scene. + /// protected virtual void AddCSVDataItems(Dictionary textItems, string csvData) { CsvParser csvParser = new CsvParser(); @@ -342,10 +337,10 @@ namespace Fungus } } - /** - * Scan a localization CSV file and copies the strings for the specified language code - * into the text properties of the appropriate scene objects. - */ + /// + /// Scan a localization CSV file and copies the strings for the specified language code + /// into the text properties of the appropriate scene objects. + /// public virtual void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false) { if (!Application.isPlaying) @@ -438,9 +433,9 @@ namespace Fungus } } - /** - * Populates the text property of a single scene object with a new text value. - */ + /// + /// Populates the text property of a single scene object with a new text value. + /// public virtual bool PopulateTextProperty(string stringId, string newText) { // Ensure that all localizeable objects have been cached @@ -460,10 +455,10 @@ namespace Fungus return false; } - /** - * Returns all standard text for localizeable text in the scene using an - * easy to edit custom text format. - */ + /// + /// Returns all standard text for localizeable text in the scene using an + /// easy to edit custom text format. + /// public virtual string GetStandardText() { // Collect all the text items present in the scene @@ -485,9 +480,9 @@ namespace Fungus return textData; } - /** - * Sets standard text on scene objects by parsing a text data file. - */ + /// + /// Sets standard text on scene objects by parsing a text data file. + /// public virtual void SetStandardText(string textData) { string[] lines = textData.Split('\n'); @@ -532,10 +527,10 @@ namespace Fungus notificationText = "Updated " + updatedCount + " standard text items."; } - /** - * Implementation of StringSubstituter.ISubstitutionHandler. - * Relaces tokens of the form {$KeyName} with the localized value corresponding to that key. - */ + /// + /// Implementation of StringSubstituter.ISubstitutionHandler. + /// Replaces tokens of the form {$KeyName} with the localized value corresponding to that key. + /// public virtual bool SubstituteStrings(StringBuilder input) { // This method could be called from the Start method of another component, so we @@ -565,5 +560,4 @@ namespace Fungus return modified; } } - } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/MenuDialog.cs b/Assets/Fungus/Narrative/Scripts/MenuDialog.cs index 0bda12bc..95abd8f0 100644 --- a/Assets/Fungus/Narrative/Scripts/MenuDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/MenuDialog.cs @@ -5,16 +5,15 @@ using UnityEngine; using UnityEngine.UI; -using UnityEngine.Events; -using System; using System.Collections; -using System.Collections.Generic; using UnityEngine.EventSystems; using System.Linq; namespace Fungus { - + /// + /// Presents multiple choice buttons to the players. + /// public class MenuDialog : MonoBehaviour { // Currently active Menu Dialog used to display Menu options @@ -24,11 +23,9 @@ namespace Fungus [SerializeField] protected bool autoSelectFirstButton = false; protected Button[] cachedButtons; - public Button[] CachedButtons { get { return cachedButtons; } } protected Slider cachedSlider; - public Slider CachedSlider { get { return cachedSlider; } } public static MenuDialog GetMenuDialog() diff --git a/Assets/Fungus/Narrative/Scripts/PortraitController.cs b/Assets/Fungus/Narrative/Scripts/PortraitController.cs index 4dcc70c3..d30a5c97 100644 --- a/Assets/Fungus/Narrative/Scripts/PortraitController.cs +++ b/Assets/Fungus/Narrative/Scripts/PortraitController.cs @@ -4,11 +4,9 @@ */ using UnityEngine; -using UnityEngine.Events; using UnityEngine.UI; using System; using System.Collections; -using System.Collections.Generic; using MoonSharp.Interpreter; namespace Fungus @@ -57,11 +55,6 @@ namespace Fungus moveDuration = 1f; this.useDefaultSettings = useDefaultSettings; } - - public override string ToString() - { - return base.ToString(); - } } public class PortraitState @@ -170,7 +163,7 @@ namespace Fungus } - private void FinishCommand(PortraitOptions options) + protected void FinishCommand(PortraitOptions options) { if (options.onComplete != null) { @@ -194,7 +187,7 @@ namespace Fungus /// /// /// - private PortraitOptions CleanPortraitOptions(PortraitOptions options) + protected PortraitOptions CleanPortraitOptions(PortraitOptions options) { // Use default stage settings if (options.useDefaultSettings) @@ -285,7 +278,7 @@ namespace Fungus /// /// /// - private void CreatePortraitObject(Character character, float fadeDuration) + protected void CreatePortraitObject(Character character, float fadeDuration) { // Create a new portrait object GameObject portraitObj = new GameObject(character.name, @@ -312,7 +305,7 @@ namespace Fungus character.State.portraitImage = portraitImage; } - private IEnumerator WaitUntilFinished(float duration, Action onComplete = null) + protected IEnumerator WaitUntilFinished(float duration, Action onComplete = null) { // Wait until the timer has expired // Any method can modify this timer variable to delay continuing. @@ -330,7 +323,7 @@ namespace Fungus } } - private void SetupPortrait(PortraitOptions options) + protected void SetupPortrait(PortraitOptions options) { SetRectTransform(options.character.State.portraitImage.rectTransform, options.fromPosition); @@ -653,8 +646,8 @@ namespace Fungus /// /// Util functions that I wanted to keep the main class clean of /// - public class PortraitUtil { - + public class PortraitUtil + { /// /// Convert a Moonsharp table to portrait options /// If the table returns a null for any of the parameters, it should keep the defaults @@ -732,7 +725,6 @@ namespace Fungus options.shiftIntoPlace = table.Get("shiftIntoPlace").CastToBool(); } - //TODO: Make the next lua command wait when this options is true if (!table.Get("waitUntilFinished").IsNil()) { options.waitUntilFinished = table.Get("waitUntilFinished").CastToBool(); @@ -740,6 +732,5 @@ namespace Fungus return options; } - } } diff --git a/Assets/Fungus/Narrative/Scripts/SayDialog.cs b/Assets/Fungus/Narrative/Scripts/SayDialog.cs index af952248..45f58ecb 100644 --- a/Assets/Fungus/Narrative/Scripts/SayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/SayDialog.cs @@ -7,11 +7,12 @@ using UnityEngine; using UnityEngine.UI; using System; using System.Collections; -using System.Collections.Generic; namespace Fungus { - + /// + /// Presents story text to the player in a dialogue box. + /// public class SayDialog : MonoBehaviour { // Currently active Say Dialog used to display Say text @@ -20,17 +21,24 @@ namespace Fungus // Most recent speaking character public static Character speakingCharacter; + [Tooltip("Duration to fade dialogue in/out")] [SerializeField] protected float fadeDuration = 0.25f; - + + [Tooltip("The continue button UI object")] [SerializeField] protected Button continueButton; + + [Tooltip("The canvas UI object")] [SerializeField] protected Canvas dialogCanvas; + + [Tooltip("The name text UI object")] [SerializeField] protected Text nameText; - [SerializeField] protected Text storyText; + [Tooltip("The story text UI object")] + [SerializeField] protected Text storyText; public Text StoryText { get { return storyText; } } + [Tooltip("The character UI object")] [SerializeField] protected Image characterImage; - public Image CharacterImage { get { return characterImage; } } [Tooltip("Adjust width of story text when Character Image is displayed (to avoid overlapping)")] diff --git a/Assets/Fungus/Narrative/Scripts/Stage.cs b/Assets/Fungus/Narrative/Scripts/Stage.cs index 08d63870..4718e8db 100644 --- a/Assets/Fungus/Narrative/Scripts/Stage.cs +++ b/Assets/Fungus/Narrative/Scripts/Stage.cs @@ -5,53 +5,44 @@ using UnityEngine; using UnityEngine.UI; -using UnityEngine.Events; using System; -using System.Collections; using System.Collections.Generic; namespace Fungus { - + /// + /// Define a set of screen positions where character sprites can be displayed. + /// [ExecuteInEditMode] public class Stage : PortraitController { [SerializeField] protected Canvas portraitCanvas; - public Canvas PortraitCanvas { get { return portraitCanvas; } } [SerializeField] protected bool dimPortraits; - public bool DimPortraits { get { return dimPortraits; } set { dimPortraits = value; } } [SerializeField] protected float fadeDuration = 0.5f; - public float FadeDuration { get { return fadeDuration; } set { fadeDuration = value; } } [SerializeField] protected float moveDuration = 1f; - public float MoveDuration { get { return moveDuration; } set { moveDuration = value; } } [SerializeField] protected LeanTweenType fadeEaseType; - public LeanTweenType FadeEaseType { get { return fadeEaseType; } } [SerializeField] protected Vector2 shiftOffset; - public Vector2 ShiftOffset { get { return shiftOffset; } } [SerializeField] protected Image defaultPosition; - public Image DefaultPosition { get { return defaultPosition; } } [SerializeField] protected List positions; - public List Positions { get { return positions; } } [SerializeField] protected RectTransform[] cachedPositions; protected List charactersOnStage = new List(); - [SerializeField] public List CharactersOnStage { get { return charactersOnStage; } } static public List activeStages = new List();