Browse Source

Refactored narrative comments

master
Christopher 9 years ago
parent
commit
f94e46e42d
  1. 5
      Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs
  2. 12
      Assets/Fungus/Narrative/Scripts/Character.cs
  3. 5
      Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs
  4. 5
      Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs
  5. 4
      Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs
  6. 5
      Assets/Fungus/Narrative/Scripts/Commands/Menu.cs
  7. 6
      Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs
  8. 21
      Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs
  9. 9
      Assets/Fungus/Narrative/Scripts/Commands/Say.cs
  10. 4
      Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs
  11. 5
      Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs
  12. 5
      Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs
  13. 6
      Assets/Fungus/Narrative/Scripts/ConversationManager.cs
  14. 11
      Assets/Fungus/Narrative/Scripts/CustomTag.cs
  15. 23
      Assets/Fungus/Narrative/Scripts/DialogInput.cs
  16. 110
      Assets/Fungus/Narrative/Scripts/Localization.cs
  17. 9
      Assets/Fungus/Narrative/Scripts/MenuDialog.cs
  18. 23
      Assets/Fungus/Narrative/Scripts/PortraitController.cs
  19. 18
      Assets/Fungus/Narrative/Scripts/SayDialog.cs
  20. 15
      Assets/Fungus/Narrative/Scripts/Stage.cs

5
Assets/Fungus/Lua/Scripts/Commands/ExecuteLua.cs

@ -4,13 +4,14 @@
*/
using UnityEngine;
using System.Collections;
using Fungus;
using MoonSharp.Interpreter;
namespace Fungus
{
/// <summary>
/// Executes a Lua code chunk using a Lua Environment.
/// </summary>
[CommandInfo("Scripting",
"Execute Lua",
"Executes a Lua code chunk using a Lua Environment.")]

12
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
{
/// <summary>
/// A Character that can be used in dialogue via the Say, Conversation and Portrait commands.
/// </summary>
[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<Sprite> portraits;
public List<Sprite> 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")]

5
Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Clears the options from a menu dialogue.
/// </summary>
[CommandInfo("Narrative",
"Clear Menu",
"Clears the options from a menu dialogue")]

5
Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs

@ -23,6 +23,9 @@ namespace Fungus
DimNonSpeakingPortraits
}
/// <summary>
/// Controls the stage on which character portraits are displayed.
/// </summary>
[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")]

4
Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs

@ -4,11 +4,13 @@
*/
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text].
/// </summary>
[CommandInfo("Narrative",
"Conversation",
"Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]")]

5
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
{
/// <summary>
/// Displays a button in a multiple choice menu.
/// </summary>
[CommandInfo("Narrative",
"Menu",
"Displays a button in a multiple choice menu")]

6
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
{
/// <summary>
/// Displays a timer bar and executes a target block if the player fails to select a menu option in time.
/// </summary>
[CommandInfo("Narrative",
"Menu Timer",
"Displays a timer bar and executes a target block if the player fails to select a menu option in time.")]

21
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
{
/// <summary>
/// Controls a character portrait.
/// </summary>
[CommandInfo("Narrative",
"Portrait",
"Controls a character portrait. ")]
"Controls a character portrait.")]
public class Portrait : ControlWithDisplay<DisplayType>
{
[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")]

9
Assets/Fungus/Narrative/Scripts/Commands/Say.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Writes text in a dialog box.
/// </summary>
[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.")]

4
Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs

@ -5,10 +5,12 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Set the active language for the scene. A Localization object with a localization file must be present in the scene.
/// </summary>
[CommandInfo("Narrative",
"Set Language",
"Set the active language for the scene. A Localization object with a localization file must be present in the scene.")]

5
Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Sets a custom menu dialog to use when displaying multiple choice menus.
/// </summary>
[CommandInfo("Narrative",
"Set Menu Dialog",
"Sets a custom menu dialog to use when displaying multiple choice menus")]

5
Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Sets a custom say dialog to use when displaying story text.
/// </summary>
[CommandInfo("Narrative",
"Set Say Dialog",
"Sets a custom say dialog to use when displaying story text")]

6
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
{
/// <summary>
/// Helper class to manage parsing and executing the conversation format.
/// </summary>
public class ConversationManager
{
protected struct ConversationItem

11
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
{
/// <summary>
/// Create custom tags for use in Say text.
/// </summary>
[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<CustomTag> activeCustomTags = new List<CustomTag>();
@ -45,5 +41,4 @@ namespace Fungus
activeCustomTags.Remove(this);
}
}
}

23
Assets/Fungus/Narrative/Scripts/DialogInput.cs

@ -5,15 +5,20 @@
using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Interface for listening for dialogue input events.
/// </summary>
public interface IDialogInputListener
{
void OnNextLineEvent();
}
/// <summary>
/// Input handler for say dialogues.
/// </summary>
public class DialogInput : MonoBehaviour
{
public enum ClickMode
@ -44,17 +49,17 @@ namespace Fungus
protected StandaloneInputModule currentStandaloneInputModule;
/**
* Trigger next line input event from script.
*/
/// <summary>
/// Trigger next line input event from script.
/// </summary>
public void SetNextLineFlag()
{
nextLineInputFlag = true;
}
/**
* Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI)
*/
/// <summary>
/// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI).
/// </summary>
public void SetDialogClickedFlag()
{
// Ignore repeat clicks for a short time to prevent accidentally clicking through the character dialogue
@ -157,6 +162,4 @@ namespace Fungus
}
}
}
}

110
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.
*/
/// <summary>
/// Multi-language localization support.
/// </summary>
public class Localization : MonoBehaviour, StringSubstituter.ISubstitutionHandler
{
/**
* Language to use at startup, usually defined by a two letter language code (e.g DE = German)
*/
/// <summary>
/// Language to use at startup, usually defined by a two letter language code (e.g DE = German).
/// </summary>
[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<string, string> localizedStrings = new Dictionary<string, string>();
protected Dictionary<string, ILocalizable> localizeableObjects = new Dictionary<string, ILocalizable>();
/**
* Temp storage for a single item of standard text and its localizations
*/
/// <summary>
/// Temp storage for a single item of standard text and its localizations.
/// </summary>
protected class TextItem
{
public string description = "";
@ -53,17 +48,17 @@ namespace Fungus
public Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
}
/**
* 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")]
/// <summary>
/// CSV file containing localization data which can be easily edited in a spreadsheet tool.
/// </summary>
[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.
*/
/// <summary>
/// Stores any notification message from export / import methods.
/// </summary>
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.
*/
/// <summary>
/// String subsitution can happen during the Start of another component, so we
/// may need to call Init() from other methods.
/// </summary>
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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// Convert all text items and localized strings to an easy to edit CSV format.
/// </summary>
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.
*/
/// <summary>
/// Builds a dictionary of localizable text items in the scene.
/// </summary>
protected Dictionary<string, TextItem> FindTextItems()
{
Dictionary<string, TextItem> textItems = new Dictionary<string, TextItem>();
@ -275,9 +270,9 @@ namespace Fungus
return textItems;
}
/**
* Adds localized strings from CSV file data to a dictionary of text items in the scene.
*/
/// <summary>
/// Adds localized strings from CSV file data to a dictionary of text items in the scene.
/// </summary>
protected virtual void AddCSVDataItems(Dictionary<string, TextItem> 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.
*/
/// <summary>
/// Scan a localization CSV file and copies the strings for the specified language code
/// into the text properties of the appropriate scene objects.
/// </summary>
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.
*/
/// <summary>
/// Populates the text property of a single scene object with a new text value.
/// </summary>
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.
*/
/// <summary>
/// Returns all standard text for localizeable text in the scene using an
/// easy to edit custom text format.
/// </summary>
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.
*/
/// <summary>
/// Sets standard text on scene objects by parsing a text data file.
/// </summary>
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.
*/
/// <summary>
/// Implementation of StringSubstituter.ISubstitutionHandler.
/// Replaces tokens of the form {$KeyName} with the localized value corresponding to that key.
/// </summary>
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;
}
}
}

9
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
{
/// <summary>
/// Presents multiple choice buttons to the players.
/// </summary>
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()

23
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
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
private PortraitOptions CleanPortraitOptions(PortraitOptions options)
protected PortraitOptions CleanPortraitOptions(PortraitOptions options)
{
// Use default stage settings
if (options.useDefaultSettings)
@ -285,7 +278,7 @@ namespace Fungus
/// </summary>
/// <param name="character"></param>
/// <param name="fadeDuration"></param>
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
/// <summary>
/// Util functions that I wanted to keep the main class clean of
/// </summary>
public class PortraitUtil {
public class PortraitUtil
{
/// <summary>
/// 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;
}
}
}

18
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
{
/// <summary>
/// Presents story text to the player in a dialogue box.
/// </summary>
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)")]

15
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
{
/// <summary>
/// Define a set of screen positions where character sprites can be displayed.
/// </summary>
[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<RectTransform> positions;
public List<RectTransform> Positions { get { return positions; } }
[SerializeField] protected RectTransform[] cachedPositions;
protected List<Character> charactersOnStage = new List<Character>();
[SerializeField] public List<Character> CharactersOnStage { get { return charactersOnStage; } }
static public List<Stage> activeStages = new List<Stage>();

Loading…
Cancel
Save